@qore-id/react-native-qoreid-sdk 1.0.9 → 1.1.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.
Files changed (44) hide show
  1. package/README.md +79 -73
  2. package/android/build.gradle +0 -1
  3. package/android/src/main/java/com/qoreidsdk/QoreidSdkModule.kt +29 -33
  4. package/ios/QoreidSdk-Bridging-Header.h +7 -0
  5. package/ios/QoreidSdk.m +21 -0
  6. package/ios/QoreidSdk.swift +104 -0
  7. package/ios/QoreidSdk.xcodeproj/project.pbxproj +22 -4
  8. package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  9. package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +5 -0
  10. package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcuserdata/e.ugwuoke.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  11. package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcuserdata/e.ugwuoke.xcuserdatad/WorkspaceSettings.xcsettings +14 -0
  12. package/ios/QoreidSdk.xcodeproj/xcuserdata/e.ugwuoke.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  13. package/ios/ViewController.swift +22 -0
  14. package/lib/commonjs/index.js +10 -42
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/qoreIdSdk.js +57 -0
  17. package/lib/commonjs/qoreIdSdk.js.map +1 -0
  18. package/lib/module/index.js +1 -35
  19. package/lib/module/index.js.map +1 -1
  20. package/lib/module/qoreIdSdk.js +50 -0
  21. package/lib/module/qoreIdSdk.js.map +1 -0
  22. package/lib/typescript/index.d.ts +1 -2
  23. package/lib/typescript/index.d.ts.map +1 -1
  24. package/lib/typescript/{qoreIdButton.android.d.ts → qoreIdSdk.d.ts} +3 -5
  25. package/lib/typescript/qoreIdSdk.d.ts.map +1 -0
  26. package/package.json +1 -2
  27. package/qore-id-react-native-qoreid-sdk.podspec +3 -3
  28. package/src/index.tsx +1 -47
  29. package/src/qoreIdSdk.tsx +60 -0
  30. package/src/types.d.ts +14 -49
  31. package/ios/QoreidSdk.h +0 -12
  32. package/ios/QoreidSdk.mm +0 -27
  33. package/lib/commonjs/qoreIdButton.android.js +0 -105
  34. package/lib/commonjs/qoreIdButton.android.js.map +0 -1
  35. package/lib/commonjs/qoreIdButton.ios.js +0 -129
  36. package/lib/commonjs/qoreIdButton.ios.js.map +0 -1
  37. package/lib/module/qoreIdButton.android.js +0 -95
  38. package/lib/module/qoreIdButton.android.js.map +0 -1
  39. package/lib/module/qoreIdButton.ios.js +0 -121
  40. package/lib/module/qoreIdButton.ios.js.map +0 -1
  41. package/lib/typescript/qoreIdButton.android.d.ts.map +0 -1
  42. package/lib/typescript/qoreIdButton.ios.d.ts +0 -4
  43. package/lib/typescript/qoreIdButton.ios.d.ts.map +0 -1
  44. package/src/qoreIdButton.android.tsx +0 -139
@@ -3,17 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _exportNames = {
7
- QoreIdButton: true,
8
- QoreIdSdk: true
9
- };
10
- exports.QoreIdSdk = exports.QoreIdButton = void 0;
11
- var _reactNative = require("react-native");
12
- var _react = _interopRequireDefault(require("react"));
13
6
  var _utils = require("./utils");
14
7
  Object.keys(_utils).forEach(function (key) {
15
8
  if (key === "default" || key === "__esModule") return;
16
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
17
9
  if (key in exports && exports[key] === _utils[key]) return;
18
10
  Object.defineProperty(exports, key, {
19
11
  enumerable: true,
@@ -22,39 +14,15 @@ Object.keys(_utils).forEach(function (key) {
22
14
  }
23
15
  });
24
16
  });
25
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
- //Safe fail implementation for iOS
27
- const QoreIdButtonIOS = initialData => {
28
- console.info('No implementation for iOS');
29
- return initialData.render && initialData.render({
30
- onPress: () => {}
31
- }) || /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
32
- style: {
33
- flex: 1,
34
- justifyContent: 'center',
35
- alignItems: 'center',
36
- paddingHorizontal: 10,
37
- paddingVertical: 5
38
- }
39
- }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
40
- style: {
41
- color: 'blue'
17
+ var _qoreIdSdk = require("./qoreIdSdk");
18
+ Object.keys(_qoreIdSdk).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _qoreIdSdk[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _qoreIdSdk[key];
42
25
  }
43
- }, "Start QoreID"));
44
- };
45
-
46
- // (require('./qoreIdButton.ios').QoreIdButton as React.FC<IQoreIdButton>);
47
-
48
- const QoreIdSdkIOS = {
49
- launchQoreId: _data => {
50
- console.info('No implementation for iOS');
51
- },
52
- events: (_onSuccess, _onError) => {
53
- console.info('No implementation for iOS');
54
- }
55
- };
56
- const QoreIdButton = _reactNative.Platform.OS === 'android' ? require('./qoreIdButton.android').QoreIdButton : QoreIdButtonIOS;
57
- exports.QoreIdButton = QoreIdButton;
58
- const QoreIdSdk = _reactNative.Platform.OS === 'android' ? require('./qoreIdButton.android').QoreIdSdk : QoreIdSdkIOS;
59
- exports.QoreIdSdk = QoreIdSdk;
26
+ });
27
+ });
60
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","_utils","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","obj","__esModule","default","QoreIdButtonIOS","initialData","console","info","render","onPress","createElement","TouchableOpacity","style","flex","justifyContent","alignItems","paddingHorizontal","paddingVertical","Text","color","QoreIdSdkIOS","launchQoreId","_data","events","_onSuccess","_onError","QoreIdButton","Platform","OS","QoreIdSdk"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAwBA,IAAAG,MAAA,GAAAH,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAAwB,SAAAL,uBAAAc,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAtBxB;AACA,MAAMG,eAAwC,GAAIC,WAAW,IAAK;EAChEC,OAAO,CAACC,IAAI,CAAC,2BAA2B,CAAC;EACzC,OACGF,WAAW,CAACG,MAAM,IAAIH,WAAW,CAACG,MAAM,CAAC;IAAEC,OAAO,EAAEA,CAAA,KAAM,CAAC;EAAE,CAAC,CAAC,iBAC9DvB,MAAA,CAAAiB,OAAA,CAAAO,aAAA,CAAC1B,YAAA,CAAA2B,gBAAgB;IACfC,KAAK,EAAE;MACLC,IAAI,EAAE,CAAC;MACPC,cAAc,EAAE,QAAQ;MACxBC,UAAU,EAAE,QAAQ;MACpBC,iBAAiB,EAAE,EAAE;MACrBC,eAAe,EAAE;IACnB;EAAE,gBAEF/B,MAAA,CAAAiB,OAAA,CAAAO,aAAA,CAAC1B,YAAA,CAAAkC,IAAI;IAACN,KAAK,EAAE;MAAEO,KAAK,EAAE;IAAO;EAAE,GAAC,cAAY,CAAO,CAEtD;AAEL,CAAC;;AAED;;AAIA,MAAMC,YAAY,GAAG;EACnBC,YAAY,EAAGC,KAAc,IAAK;IAChChB,OAAO,CAACC,IAAI,CAAC,2BAA2B,CAAC;EAC3C,CAAC;EACDgB,MAAM,EAAEA,CACNC,UAAmC,EACnCC,QAAiC,KAC9B;IACHnB,OAAO,CAACC,IAAI,CAAC,2BAA2B,CAAC;EAC3C;AACF,CAAC;AAEM,MAAMmB,YAAY,GACvBC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACrB3C,OAAO,CAAC,wBAAwB,CAAC,CAACyC,YAAY,GAC9CtB,eAAe;AAACP,OAAA,CAAA6B,YAAA,GAAAA,YAAA;AAEf,MAAMG,SAAS,GACpBF,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACrB3C,OAAO,CAAC,wBAAwB,CAAC,CAAC4C,SAAS,GAC3CT,YAAY;AAACvB,OAAA,CAAAgC,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"names":["_utils","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_qoreIdSdk"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.QoreIdSdk = void 0;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ const QoreIdSdk = {
10
+ /**
11
+ * lauches QoreID SDK
12
+ * @param initialData - data to launch Qore ID SDK
13
+ * @requires QoreIdSdk native module installed
14
+ */
15
+ launch(initialData) {
16
+ _reactNative.NativeModules.QoreidSdk.launchQoreidSdk({
17
+ config: {
18
+ flowId: initialData.flowId || 0,
19
+ customerReference: initialData.customerReference,
20
+ productCode: initialData.productCode,
21
+ clientId: initialData.clientId
22
+ },
23
+ applicantData: {
24
+ ...initialData.applicantData
25
+ },
26
+ addressData: {
27
+ ...initialData.addressData
28
+ },
29
+ acceptedDocuments: initialData.ocrAcceptedDocuments,
30
+ identityData: {
31
+ ...initialData.identityData
32
+ }
33
+ });
34
+ },
35
+ /**
36
+ * QoreIdSdk events listener. It takes callbacks to handle success and error events
37
+ * @param onSuccess Called on success with result
38
+ * @param onError Called on error with error object
39
+ */
40
+ events(onSuccess, onError) {
41
+ (0, _react.useEffect)(() => {
42
+ const eventEmitter = _reactNative.Platform.OS === 'android' ? new _reactNative.NativeEventEmitter() : new _reactNative.NativeEventEmitter(_reactNative.NativeModules.QoreidSdk);
43
+ let eventListener = eventEmitter.addListener('onResult', event => {
44
+ if (event !== null && event !== void 0 && event.code) {
45
+ onError === null || onError === void 0 ? void 0 : onError(event);
46
+ return;
47
+ }
48
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event);
49
+ });
50
+ return () => {
51
+ eventEmitter.removeSubscription(eventListener);
52
+ };
53
+ }, []);
54
+ }
55
+ };
56
+ exports.QoreIdSdk = QoreIdSdk;
57
+ //# sourceMappingURL=qoreIdSdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","QoreIdSdk","launch","initialData","NativeModules","QoreidSdk","launchQoreidSdk","config","flowId","customerReference","productCode","clientId","applicantData","addressData","acceptedDocuments","ocrAcceptedDocuments","identityData","events","onSuccess","onError","useEffect","eventEmitter","Platform","OS","NativeEventEmitter","eventListener","addListener","event","code","removeSubscription","exports"],"sourceRoot":"../../src","sources":["qoreIdSdk.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGO,MAAME,SAAS,GAAG;EACvB;AACF;AACA;AACA;AACA;EACEC,MAAMA,CAACC,WAAqB,EAAE;IAC5BC,0BAAa,CAACC,SAAS,CAACC,eAAe,CAAC;MACtCC,MAAM,EAAE;QACNC,MAAM,EAAEL,WAAW,CAACK,MAAM,IAAI,CAAC;QAC/BC,iBAAiB,EAAEN,WAAW,CAACM,iBAAiB;QAChDC,WAAW,EAAEP,WAAW,CAACO,WAAW;QACpCC,QAAQ,EAAER,WAAW,CAACQ;MACxB,CAAC;MACDC,aAAa,EAAE;QACb,GAAGT,WAAW,CAACS;MACjB,CAAC;MACDC,WAAW,EAAE;QACX,GAAGV,WAAW,CAACU;MACjB,CAAC;MACDC,iBAAiB,EAAEX,WAAW,CAACY,oBAAoB;MACnDC,YAAY,EAAE;QAAE,GAAGb,WAAW,CAACa;MAAa;IAC9C,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,MAAMA,CACJC,SAAqD,EACrDC,OAAqC,EACrC;IACA,IAAAC,gBAAS,EAAC,MAAM;MACd,MAAMC,YAAY,GAChBC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACrB,IAAIC,+BAAkB,EAAE,GACxB,IAAIA,+BAAkB,CAACpB,0BAAa,CAACC,SAAS,CAAC;MACrD,IAAIoB,aAAa,GAAGJ,YAAY,CAACK,WAAW,CAC1C,UAAU,EACTC,KAAmB,IAAK;QACvB,IAAIA,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEC,IAAI,EAAE;UACfT,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGQ,KAAK,CAAC;UAChB;QACF;QACAT,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAGS,KAAK,CAAC;MACpB,CAAC,CACF;MAED,OAAO,MAAM;QACXN,YAAY,CAACQ,kBAAkB,CAACJ,aAAa,CAAC;MAChD,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;EACR;AACF,CAAC;AAACK,OAAA,CAAA7B,SAAA,GAAAA,SAAA"}
@@ -1,37 +1,3 @@
1
- import { Platform, Text, TouchableOpacity } from 'react-native';
2
- import React from 'react';
3
-
4
- //Safe fail implementation for iOS
5
- const QoreIdButtonIOS = initialData => {
6
- console.info('No implementation for iOS');
7
- return initialData.render && initialData.render({
8
- onPress: () => {}
9
- }) || /*#__PURE__*/React.createElement(TouchableOpacity, {
10
- style: {
11
- flex: 1,
12
- justifyContent: 'center',
13
- alignItems: 'center',
14
- paddingHorizontal: 10,
15
- paddingVertical: 5
16
- }
17
- }, /*#__PURE__*/React.createElement(Text, {
18
- style: {
19
- color: 'blue'
20
- }
21
- }, "Start QoreID"));
22
- };
23
-
24
- // (require('./qoreIdButton.ios').QoreIdButton as React.FC<IQoreIdButton>);
25
-
26
1
  export * from './utils';
27
- const QoreIdSdkIOS = {
28
- launchQoreId: _data => {
29
- console.info('No implementation for iOS');
30
- },
31
- events: (_onSuccess, _onError) => {
32
- console.info('No implementation for iOS');
33
- }
34
- };
35
- export const QoreIdButton = Platform.OS === 'android' ? require('./qoreIdButton.android').QoreIdButton : QoreIdButtonIOS;
36
- export const QoreIdSdk = Platform.OS === 'android' ? require('./qoreIdButton.android').QoreIdSdk : QoreIdSdkIOS;
2
+ export * from './qoreIdSdk';
37
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","Text","TouchableOpacity","React","QoreIdButtonIOS","initialData","console","info","render","onPress","createElement","style","flex","justifyContent","alignItems","paddingHorizontal","paddingVertical","color","QoreIdSdkIOS","launchQoreId","_data","events","_onSuccess","_onError","QoreIdButton","OS","require","QoreIdSdk"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AAE/D,OAAOC,KAAK,MAAM,OAAO;;AAEzB;AACA,MAAMC,eAAwC,GAAIC,WAAW,IAAK;EAChEC,OAAO,CAACC,IAAI,CAAC,2BAA2B,CAAC;EACzC,OACGF,WAAW,CAACG,MAAM,IAAIH,WAAW,CAACG,MAAM,CAAC;IAAEC,OAAO,EAAEA,CAAA,KAAM,CAAC;EAAE,CAAC,CAAC,iBAC9DN,KAAA,CAAAO,aAAA,CAACR,gBAAgB;IACfS,KAAK,EAAE;MACLC,IAAI,EAAE,CAAC;MACPC,cAAc,EAAE,QAAQ;MACxBC,UAAU,EAAE,QAAQ;MACpBC,iBAAiB,EAAE,EAAE;MACrBC,eAAe,EAAE;IACnB;EAAE,gBAEFb,KAAA,CAAAO,aAAA,CAACT,IAAI;IAACU,KAAK,EAAE;MAAEM,KAAK,EAAE;IAAO;EAAE,GAAC,cAAY,CAAO,CAEtD;AAEL,CAAC;;AAED;;AAEA,cAAc,SAAS;AAEvB,MAAMC,YAAY,GAAG;EACnBC,YAAY,EAAGC,KAAc,IAAK;IAChCd,OAAO,CAACC,IAAI,CAAC,2BAA2B,CAAC;EAC3C,CAAC;EACDc,MAAM,EAAEA,CACNC,UAAmC,EACnCC,QAAiC,KAC9B;IACHjB,OAAO,CAACC,IAAI,CAAC,2BAA2B,CAAC;EAC3C;AACF,CAAC;AAED,OAAO,MAAMiB,YAAY,GACvBxB,QAAQ,CAACyB,EAAE,KAAK,SAAS,GACrBC,OAAO,CAAC,wBAAwB,CAAC,CAACF,YAAY,GAC9CpB,eAAe;AAErB,OAAO,MAAMuB,SAAS,GACpB3B,QAAQ,CAACyB,EAAE,KAAK,SAAS,GACrBC,OAAO,CAAC,wBAAwB,CAAC,CAACC,SAAS,GAC3CT,YAAY"}
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AACA,cAAc,SAAS;AACvB,cAAc,aAAa"}
@@ -0,0 +1,50 @@
1
+ import { useEffect } from 'react';
2
+ import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
3
+ export const QoreIdSdk = {
4
+ /**
5
+ * lauches QoreID SDK
6
+ * @param initialData - data to launch Qore ID SDK
7
+ * @requires QoreIdSdk native module installed
8
+ */
9
+ launch(initialData) {
10
+ NativeModules.QoreidSdk.launchQoreidSdk({
11
+ config: {
12
+ flowId: initialData.flowId || 0,
13
+ customerReference: initialData.customerReference,
14
+ productCode: initialData.productCode,
15
+ clientId: initialData.clientId
16
+ },
17
+ applicantData: {
18
+ ...initialData.applicantData
19
+ },
20
+ addressData: {
21
+ ...initialData.addressData
22
+ },
23
+ acceptedDocuments: initialData.ocrAcceptedDocuments,
24
+ identityData: {
25
+ ...initialData.identityData
26
+ }
27
+ });
28
+ },
29
+ /**
30
+ * QoreIdSdk events listener. It takes callbacks to handle success and error events
31
+ * @param onSuccess Called on success with result
32
+ * @param onError Called on error with error object
33
+ */
34
+ events(onSuccess, onError) {
35
+ useEffect(() => {
36
+ const eventEmitter = Platform.OS === 'android' ? new NativeEventEmitter() : new NativeEventEmitter(NativeModules.QoreidSdk);
37
+ let eventListener = eventEmitter.addListener('onResult', event => {
38
+ if (event !== null && event !== void 0 && event.code) {
39
+ onError === null || onError === void 0 ? void 0 : onError(event);
40
+ return;
41
+ }
42
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event);
43
+ });
44
+ return () => {
45
+ eventEmitter.removeSubscription(eventListener);
46
+ };
47
+ }, []);
48
+ }
49
+ };
50
+ //# sourceMappingURL=qoreIdSdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","NativeEventEmitter","NativeModules","Platform","QoreIdSdk","launch","initialData","QoreidSdk","launchQoreidSdk","config","flowId","customerReference","productCode","clientId","applicantData","addressData","acceptedDocuments","ocrAcceptedDocuments","identityData","events","onSuccess","onError","eventEmitter","OS","eventListener","addListener","event","code","removeSubscription"],"sourceRoot":"../../src","sources":["qoreIdSdk.tsx"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAS,cAAc;AAG3E,OAAO,MAAMC,SAAS,GAAG;EACvB;AACF;AACA;AACA;AACA;EACEC,MAAMA,CAACC,WAAqB,EAAE;IAC5BJ,aAAa,CAACK,SAAS,CAACC,eAAe,CAAC;MACtCC,MAAM,EAAE;QACNC,MAAM,EAAEJ,WAAW,CAACI,MAAM,IAAI,CAAC;QAC/BC,iBAAiB,EAAEL,WAAW,CAACK,iBAAiB;QAChDC,WAAW,EAAEN,WAAW,CAACM,WAAW;QACpCC,QAAQ,EAAEP,WAAW,CAACO;MACxB,CAAC;MACDC,aAAa,EAAE;QACb,GAAGR,WAAW,CAACQ;MACjB,CAAC;MACDC,WAAW,EAAE;QACX,GAAGT,WAAW,CAACS;MACjB,CAAC;MACDC,iBAAiB,EAAEV,WAAW,CAACW,oBAAoB;MACnDC,YAAY,EAAE;QAAE,GAAGZ,WAAW,CAACY;MAAa;IAC9C,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,MAAMA,CACJC,SAAqD,EACrDC,OAAqC,EACrC;IACArB,SAAS,CAAC,MAAM;MACd,MAAMsB,YAAY,GAChBnB,QAAQ,CAACoB,EAAE,KAAK,SAAS,GACrB,IAAItB,kBAAkB,EAAE,GACxB,IAAIA,kBAAkB,CAACC,aAAa,CAACK,SAAS,CAAC;MACrD,IAAIiB,aAAa,GAAGF,YAAY,CAACG,WAAW,CAC1C,UAAU,EACTC,KAAmB,IAAK;QACvB,IAAIA,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEC,IAAI,EAAE;UACfN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGK,KAAK,CAAC;UAChB;QACF;QACAN,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAGM,KAAK,CAAC;MACpB,CAAC,CACF;MAED,OAAO,MAAM;QACXJ,YAAY,CAACM,kBAAkB,CAACJ,aAAa,CAAC;MAChD,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;EACR;AACF,CAAC"}
@@ -1,4 +1,3 @@
1
1
  export * from './utils';
2
- export declare const QoreIdButton: any;
3
- export declare const QoreIdSdk: any;
2
+ export * from './qoreIdSdk';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AA0BA,cAAc,SAAS,CAAC;AAcxB,eAAO,MAAM,YAAY,KAGJ,CAAC;AAEtB,eAAO,MAAM,SAAS,KAGJ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAA"}
@@ -1,12 +1,11 @@
1
- import React from 'react';
2
- import type { OnResultType, IQoreIdButton } from './types';
1
+ import type { OnResultType, DataType } from './types';
3
2
  export declare const QoreIdSdk: {
4
3
  /**
5
4
  * lauches QoreID SDK
6
5
  * @param initialData - data to launch Qore ID SDK
7
6
  * @requires QoreIdSdk native module installed
8
7
  */
9
- launchQoreId(initialData: Omit<IQoreIdButton, 'render' | 'title' | 'onQoreIDSdkSubmitted' | 'onQoreIDSdkError' | 'onQoreIDSdkClosed'>): void;
8
+ launch(initialData: DataType): void;
10
9
  /**
11
10
  * QoreIdSdk events listener. It takes callbacks to handle success and error events
12
11
  * @param onSuccess Called on success with result
@@ -14,5 +13,4 @@ export declare const QoreIdSdk: {
14
13
  */
15
14
  events(onSuccess: (data: Omit<OnResultType, 'code'>) => void, onError: (data: OnResultType) => void): void;
16
15
  };
17
- export declare const QoreIdButton: React.FC<IQoreIdButton>;
18
- //# sourceMappingURL=qoreIdButton.android.d.ts.map
16
+ //# sourceMappingURL=qoreIdSdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qoreIdSdk.d.ts","sourceRoot":"","sources":["../../src/qoreIdSdk.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,SAAS;IACpB;;;;OAIG;wBACiB,QAAQ;IAmB5B;;;;OAIG;6BAEiB,KAAK,YAAY,EAAE,MAAM,CAAC,KAAK,IAAI,kBACrC,YAAY,KAAK,IAAI;CAuBxC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qore-id/react-native-qoreid-sdk",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "QoreId React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -14,7 +14,6 @@
14
14
  "ios",
15
15
  "cpp",
16
16
  "*.podspec",
17
- "!src/qoreIdButton.ios.tsx",
18
17
  "!lib/typescript/example",
19
18
  "!ios/build",
20
19
  "!android/build",
@@ -14,10 +14,10 @@ Pod::Spec.new do |s|
14
14
  s.platforms = { :ios => "11.0" }
15
15
  s.source = { :git => "https://.git", :tag => "#{s.version}" }
16
16
 
17
- s.source_files = "ios/**/*.{h,m,mm}"
18
-
17
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
19
18
  s.dependency "React-Core"
20
-
19
+ s.dependency 'QoreIDSDK'
20
+
21
21
  # Don't install the dependencies when we run `pod install` in the old architecture.
22
22
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
23
23
  s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
package/src/index.tsx CHANGED
@@ -1,49 +1,3 @@
1
- import { Platform, Text, TouchableOpacity } from 'react-native';
2
- import type { IQoreIdButton } from './types';
3
- import React from 'react';
4
-
5
- //Safe fail implementation for iOS
6
- const QoreIdButtonIOS: React.FC<IQoreIdButton> = (initialData) => {
7
- console.info('No implementation for iOS');
8
- return (
9
- (initialData.render && initialData.render({ onPress: () => {} })) || (
10
- <TouchableOpacity
11
- style={{
12
- flex: 1,
13
- justifyContent: 'center',
14
- alignItems: 'center',
15
- paddingHorizontal: 10,
16
- paddingVertical: 5,
17
- }}
18
- >
19
- <Text style={{ color: 'blue' }}>Start QoreID</Text>
20
- </TouchableOpacity>
21
- )
22
- );
23
- };
24
-
25
- // (require('./qoreIdButton.ios').QoreIdButton as React.FC<IQoreIdButton>);
26
1
 
27
2
  export * from './utils';
28
-
29
- const QoreIdSdkIOS = {
30
- launchQoreId: (_data: unknown) => {
31
- console.info('No implementation for iOS');
32
- },
33
- events: (
34
- _onSuccess: (data: unknown) => void,
35
- _onError: (data: unknown) => void
36
- ) => {
37
- console.info('No implementation for iOS');
38
- },
39
- };
40
-
41
- export const QoreIdButton =
42
- Platform.OS === 'android'
43
- ? require('./qoreIdButton.android').QoreIdButton
44
- : QoreIdButtonIOS;
45
-
46
- export const QoreIdSdk =
47
- Platform.OS === 'android'
48
- ? require('./qoreIdButton.android').QoreIdSdk
49
- : QoreIdSdkIOS;
3
+ export * from './qoreIdSdk'
@@ -0,0 +1,60 @@
1
+ import { useEffect } from 'react';
2
+ import { NativeEventEmitter, NativeModules, Platform, } from 'react-native';
3
+ import type { OnResultType, DataType } from './types';
4
+
5
+ export const QoreIdSdk = {
6
+ /**
7
+ * lauches QoreID SDK
8
+ * @param initialData - data to launch Qore ID SDK
9
+ * @requires QoreIdSdk native module installed
10
+ */
11
+ launch(initialData: DataType) {
12
+ NativeModules.QoreidSdk.launchQoreidSdk({
13
+ config: {
14
+ flowId: initialData.flowId || 0,
15
+ customerReference: initialData.customerReference,
16
+ productCode: initialData.productCode,
17
+ clientId: initialData.clientId,
18
+ },
19
+ applicantData: {
20
+ ...initialData.applicantData,
21
+ },
22
+ addressData: {
23
+ ...initialData.addressData,
24
+ },
25
+ acceptedDocuments: initialData.ocrAcceptedDocuments,
26
+ identityData: { ...initialData.identityData },
27
+ });
28
+ },
29
+
30
+ /**
31
+ * QoreIdSdk events listener. It takes callbacks to handle success and error events
32
+ * @param onSuccess Called on success with result
33
+ * @param onError Called on error with error object
34
+ */
35
+ events(
36
+ onSuccess: (data: Omit<OnResultType, 'code'>) => void,
37
+ onError: (data: OnResultType) => void
38
+ ) {
39
+ useEffect(() => {
40
+ const eventEmitter =
41
+ Platform.OS === 'android'
42
+ ? new NativeEventEmitter()
43
+ : new NativeEventEmitter(NativeModules.QoreidSdk);
44
+ let eventListener = eventEmitter.addListener(
45
+ 'onResult',
46
+ (event: OnResultType) => {
47
+ if (event?.code) {
48
+ onError?.(event);
49
+ return;
50
+ }
51
+ onSuccess?.(event);
52
+ }
53
+ );
54
+
55
+ return () => {
56
+ eventEmitter.removeSubscription(eventListener);
57
+ };
58
+ }, []);
59
+ },
60
+ };
package/src/types.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  import type { GestureResponderEvent } from 'react-native';
2
2
 
3
3
  export interface DataType {
4
- config: IConfig;
4
+ flowId?: number;
5
+ customerReference: string;
6
+ productCode: string;
7
+ clientId: string;
5
8
  applicantData?: ApplicantData;
6
9
  addressData?: AddressData;
7
- acceptedDocuments?: string | string[];
10
+ ocrAcceptedDocuments: string[];
8
11
  identityData?: IdentityData
9
12
  }
10
13
 
@@ -47,53 +50,15 @@ export interface OnResultType {
47
50
  message: string;
48
51
  }
49
52
 
50
- export interface Options {
51
- config: string;
52
- onSubmitted?: (data: Omit<OnResultType, 'code'>) => void;
53
- onError?: (data: OnResultType) => void;
54
- buttonProps?: {
55
- title?: string;
56
- color?: string;
57
- backgroundColor?: string;
58
- };
59
- }
60
-
61
-
62
53
 
63
- export interface BrowserEventData {
64
- type: string;
65
- detail: any;
66
- }
67
54
 
68
- declare interface IQoreIdButton <T = JSX.Element>{
69
- title?: string
70
- sdkSource?: string
71
- flowId?: number
72
- clientId: string
73
- productCode?: string
74
- customerReference: string
75
- applicantData?: {
76
- firstName: string,
77
- middleName?: string,
78
- lastName: string,
79
- gender: 'male'|'female'|'others' | string,
80
- phoneNumber?: string,
81
- email?: string,
82
- },
83
- identityData?: {
84
- idType: string,
85
- idNumber: string,
86
- },
87
- addressData?: {
88
- address: string,
89
- city: string,
90
- lga: string,
91
- },
92
- ocrAcceptedDocuments?: string,
93
- onQoreIDSdkSubmitted: (data: BrowserEventData | Omit<OnResultType, 'code'>) => void;
94
- onQoreIDSdkError: (data: BrowserEventData | OnResultType) => void;
95
- onQoreIDSdkClosed: (data: BrowserEventData) => void;
96
- /** Render custom button or a Pressable Component */
97
- render?: ({onPress}:{onPress:(event: GestureResponderEvent) => void}) => T.onPress extends {onPress: (event: GestureResponderEvent) => void} ? T : never;
98
- }
99
55
 
56
+ export type QoreIdSdkType = {
57
+ launchQoreId: (
58
+ initialData: DataType
59
+ ) => void;
60
+ events: (
61
+ onSuccess: (data: Omit<OnResultType, 'code'>) => void,
62
+ onError: (data: OnResultType) => void
63
+ ) => void;
64
+ }
package/ios/QoreidSdk.h DELETED
@@ -1,12 +0,0 @@
1
-
2
- #ifdef RCT_NEW_ARCH_ENABLED
3
- #import "RNQoreidSdkSpec.h"
4
-
5
- @interface QoreidSdk : NSObject <NativeQoreidSdkSpec>
6
- #else
7
- #import <React/RCTBridgeModule.h>
8
-
9
- @interface QoreidSdk : NSObject <RCTBridgeModule>
10
- #endif
11
-
12
- @end
package/ios/QoreidSdk.mm DELETED
@@ -1,27 +0,0 @@
1
- #import "QoreidSdk.h"
2
-
3
- @implementation QoreidSdk
4
- RCT_EXPORT_MODULE()
5
-
6
- // Example method
7
- // See // https://reactnative.dev/docs/native-modules-ios
8
- RCT_REMAP_METHOD(multiply,
9
- multiplyWithA:(double)a withB:(double)b
10
- withResolver:(RCTPromiseResolveBlock)resolve
11
- withRejecter:(RCTPromiseRejectBlock)reject)
12
- {
13
- NSNumber *result = @(a * b);
14
-
15
- resolve(result);
16
- }
17
-
18
- // Don't compile this code when we build for the old architecture.
19
- #ifdef RCT_NEW_ARCH_ENABLED
20
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
21
- (const facebook::react::ObjCTurboModule::InitParams &)params
22
- {
23
- return std::make_shared<facebook::react::NativeQoreidSdkSpecJSI>(params);
24
- }
25
- #endif
26
-
27
- @end
@@ -1,105 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.QoreIdSdk = exports.QoreIdButton = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
- const QoreIdSdk = {
12
- /**
13
- * lauches QoreID SDK
14
- * @param initialData - data to launch Qore ID SDK
15
- * @requires QoreIdSdk native module installed
16
- */
17
- launchQoreId(initialData) {
18
- var _initialData$ocrAccep;
19
- _reactNative.NativeModules.QoreidSdk.launchQoreId(JSON.stringify({
20
- config: {
21
- flowId: initialData.flowId || 0,
22
- customerRef: initialData.customerReference,
23
- productCode: initialData.productCode,
24
- clientId: initialData.clientId
25
- },
26
- applicantData: {
27
- ...initialData.applicantData
28
- },
29
- addressData: {
30
- ...initialData.addressData
31
- },
32
- acceptedDocuments: (_initialData$ocrAccep = initialData.ocrAcceptedDocuments) === null || _initialData$ocrAccep === void 0 ? void 0 : _initialData$ocrAccep.split(','),
33
- identityData: {
34
- ...initialData.identityData
35
- }
36
- }));
37
- },
38
- /**
39
- * QoreIdSdk events listener. It takes callbacks to handle success and error events
40
- * @param onSuccess Called on success with result
41
- * @param onError Called on error with error object
42
- */
43
- events(onSuccess, onError) {
44
- (0, _react.useEffect)(() => {
45
- const eventEmitter = _reactNative.Platform.OS === 'android' ? new _reactNative.NativeEventEmitter() : new _reactNative.NativeEventEmitter(_reactNative.NativeModules.QoreidSdk);
46
- let eventListener = eventEmitter.addListener('onResult', event => {
47
- if (event !== null && event !== void 0 && event.code) {
48
- onError === null || onError === void 0 ? void 0 : onError(event);
49
- return;
50
- }
51
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event);
52
- });
53
- return () => {
54
- eventEmitter.removeSubscription(eventListener);
55
- };
56
- }, []);
57
- }
58
- };
59
- exports.QoreIdSdk = QoreIdSdk;
60
- const QoreIdButton = initialData => {
61
- const onSubmitted = (0, _react.useCallback)(data => initialData.onQoreIDSdkSubmitted && initialData.onQoreIDSdkSubmitted(data), [initialData]);
62
- const onError = (0, _react.useCallback)(data => initialData.onQoreIDSdkError && initialData.onQoreIDSdkError(data), [initialData]);
63
- (0, _react.useEffect)(() => {
64
- const eventEmitter = _reactNative.Platform.OS === 'android' ? new _reactNative.NativeEventEmitter() : new _reactNative.NativeEventEmitter(_reactNative.NativeModules.QoreidSdk);
65
- let eventListener = eventEmitter.addListener('onResult', event => {
66
- if (event !== null && event !== void 0 && event.code) {
67
- onError === null || onError === void 0 ? void 0 : onError(event);
68
- return;
69
- }
70
- onSubmitted === null || onSubmitted === void 0 ? void 0 : onSubmitted(event);
71
- });
72
- return () => {
73
- eventEmitter.removeSubscription(eventListener);
74
- };
75
- }, []);
76
- const startDSK = () => {
77
- var _initialData$ocrAccep2;
78
- _reactNative.NativeModules.QoreidSdk.launchQoreId(JSON.stringify({
79
- config: {
80
- flowId: initialData.flowId || 0,
81
- customerRef: initialData.customerReference,
82
- productCode: initialData.productCode,
83
- clientId: initialData.clientId
84
- },
85
- applicantData: {
86
- ...initialData.applicantData
87
- },
88
- addressData: {
89
- ...initialData.addressData
90
- },
91
- acceptedDocuments: (_initialData$ocrAccep2 = initialData.ocrAcceptedDocuments) === null || _initialData$ocrAccep2 === void 0 ? void 0 : _initialData$ocrAccep2.split(','),
92
- identityData: {
93
- ...initialData.identityData
94
- }
95
- }));
96
- };
97
- return initialData.render ? initialData.render({
98
- onPress: startDSK
99
- }) : /*#__PURE__*/_react.default.createElement(_reactNative.Button, {
100
- onPress: startDSK,
101
- title: "Start Verification"
102
- });
103
- };
104
- exports.QoreIdButton = QoreIdButton;
105
- //# sourceMappingURL=qoreIdButton.android.js.map