react-native-hyperkyc-sdk 2.12.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativehyperkycsdk/HyperkycSdkModule.java +22 -1
- package/ios/HyperkycSdk.swift +18 -1
- package/lib/commonjs/HyperKycThemeMode.js +48 -0
- package/lib/commonjs/HyperKycThemeMode.js.map +1 -0
- package/lib/commonjs/index.js +12 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/HyperKycThemeMode.js +40 -0
- package/lib/module/HyperKycThemeMode.js.map +1 -0
- package/lib/module/index.js +6 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/HyperKycThemeMode.d.ts +37 -0
- package/lib/typescript/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/HyperKycThemeMode.ts +42 -0
- package/src/index.tsx +5 -0
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ npm install react-native-hyperkyc-sdk
|
|
|
12
12
|
|
|
13
13
|
```js
|
|
14
14
|
import { NativeModules } from 'react-native';
|
|
15
|
+
import { HKThemeMode } from 'react-native-hyperkyc-sdk';
|
|
15
16
|
const { Hyperkyc } = NativeModules
|
|
16
17
|
|
|
17
18
|
// ...
|
|
@@ -30,6 +31,9 @@ const { Hyperkyc } = NativeModules
|
|
|
30
31
|
configDictionary["transactionId"] = transactionId
|
|
31
32
|
configDictionary["workflowId"] = "<workflow-id>"
|
|
32
33
|
|
|
34
|
+
// [Optional] Theme mode — defaults to light if not set
|
|
35
|
+
configDictionary["hkThemeMode"] = HKThemeMode.SYSTEM
|
|
36
|
+
|
|
33
37
|
// Generate unique ID
|
|
34
38
|
Hyperkyc.createUniqueId(uniqueId =>{
|
|
35
39
|
console.log(uniqueId)
|
|
@@ -53,6 +57,18 @@ Hyperkyc.launch(configDictionary, function(response){
|
|
|
53
57
|
})
|
|
54
58
|
```
|
|
55
59
|
|
|
60
|
+
### Theme mode
|
|
61
|
+
|
|
62
|
+
Pass `hkThemeMode` in the launch config to control how the SDK renders its UI:
|
|
63
|
+
|
|
64
|
+
| Value | Behaviour |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `HKThemeMode.LIGHT` | Force light theme regardless of system settings |
|
|
67
|
+
| `HKThemeMode.DARK` | Force dark theme regardless of system settings |
|
|
68
|
+
| `HKThemeMode.SYSTEM` | Follow the device's system theme settings |
|
|
69
|
+
|
|
70
|
+
If `hkThemeMode` is not set, the SDK defaults to the light theme.
|
|
71
|
+
|
|
56
72
|
## Contributing
|
|
57
73
|
|
|
58
74
|
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
package/android/build.gradle
CHANGED
|
@@ -56,7 +56,7 @@ repositories {
|
|
|
56
56
|
dependencies {
|
|
57
57
|
//noinspection GradleDynamicVersion
|
|
58
58
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
59
|
-
implementation('co.hyperverge:hyperkyc:2.11.
|
|
59
|
+
implementation('co.hyperverge:hyperkyc:2.11.3@aar', {
|
|
60
60
|
transitive = true
|
|
61
61
|
exclude group: 'co.hyperverge', module: 'hyperdocdetect'
|
|
62
62
|
exclude group: 'co.hyperverge', module: 'hypersnap-pdf'
|
|
@@ -27,6 +27,7 @@ import java.util.HashMap;
|
|
|
27
27
|
import java.util.Map;
|
|
28
28
|
|
|
29
29
|
import co.hyperverge.hyperkyc.HyperKyc;
|
|
30
|
+
import co.hyperverge.hyperkyc.data.models.HKThemeMode;
|
|
30
31
|
import co.hyperverge.hyperkyc.data.models.HyperKycConfig;
|
|
31
32
|
import co.hyperverge.hyperkyc.data.models.result.HyperKycResult;
|
|
32
33
|
import kotlin.Unit;
|
|
@@ -205,8 +206,9 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule {
|
|
|
205
206
|
String defaultLangCode = kycConfig.hasKey("defaultLangCode") ? kycConfig.getString("defaultLangCode") : null;
|
|
206
207
|
Boolean useLocation = kycConfig.hasKey("useLocation") ? kycConfig.getBoolean("useLocation") : null;
|
|
207
208
|
String uniqueId = kycConfig.hasKey("uniqueId") ? kycConfig.getString("uniqueId") : null;
|
|
209
|
+
String hkThemeMode = kycConfig.hasKey("hkThemeMode") ? kycConfig.getString("hkThemeMode") : null;
|
|
208
210
|
Map<String, String> metadata = new HashMap<>();
|
|
209
|
-
metadata.put("sdk-version", "2.
|
|
211
|
+
metadata.put("sdk-version", "2.13.0");
|
|
210
212
|
metadata.put("sdk-type", "React Native");
|
|
211
213
|
if (accessToken == null) {
|
|
212
214
|
assert appId != null;
|
|
@@ -227,6 +229,9 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule {
|
|
|
227
229
|
hyperKycConfig.setUniqueId(uniqueId);
|
|
228
230
|
}
|
|
229
231
|
hyperKycConfig.addMetadata(metadata);
|
|
232
|
+
if (hkThemeMode != null) {
|
|
233
|
+
hyperKycConfig.setHKThemeMode(getHKThemeModeFromString(hkThemeMode));
|
|
234
|
+
}
|
|
230
235
|
|
|
231
236
|
return hyperKycConfig;
|
|
232
237
|
} else {
|
|
@@ -246,11 +251,27 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule {
|
|
|
246
251
|
hyperKycConfig.setUniqueId(uniqueId);
|
|
247
252
|
}
|
|
248
253
|
hyperKycConfig.addMetadata(metadata);
|
|
254
|
+
if (hkThemeMode != null) {
|
|
255
|
+
hyperKycConfig.setHKThemeMode(getHKThemeModeFromString(hkThemeMode));
|
|
256
|
+
}
|
|
249
257
|
|
|
250
258
|
return hyperKycConfig;
|
|
251
259
|
}
|
|
252
260
|
}
|
|
253
261
|
|
|
262
|
+
private HKThemeMode getHKThemeModeFromString(String hkThemeModeString) {
|
|
263
|
+
switch (hkThemeModeString) {
|
|
264
|
+
case "LIGHT":
|
|
265
|
+
return HKThemeMode.LIGHT;
|
|
266
|
+
case "DARK":
|
|
267
|
+
return HKThemeMode.DARK;
|
|
268
|
+
case "SYSTEM":
|
|
269
|
+
return HKThemeMode.SYSTEM;
|
|
270
|
+
default:
|
|
271
|
+
return HKThemeMode.LIGHT;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
254
275
|
private WritableMap getDummyResultMap() {
|
|
255
276
|
WritableMap dummyResult = new WritableNativeMap();
|
|
256
277
|
dummyResult.putString("status", "");
|
package/ios/HyperkycSdk.swift
CHANGED
|
@@ -44,8 +44,9 @@ class Hyperkyc: RCTEventEmitter {
|
|
|
44
44
|
let inputs = _config["inputs"] as? [String: Any]
|
|
45
45
|
let useLocation = _config["useLocation"] as? Bool
|
|
46
46
|
let uniqueId = _config["uniqueId"] as? String
|
|
47
|
+
let hkThemeMode = _config["hkThemeMode"] as? String
|
|
47
48
|
let metadata: [String: String] = [
|
|
48
|
-
"sdk-version": "2.
|
|
49
|
+
"sdk-version": "2.13.0",
|
|
49
50
|
"sdk-type": "React Native"
|
|
50
51
|
]
|
|
51
52
|
|
|
@@ -81,6 +82,9 @@ class Hyperkyc: RCTEventEmitter {
|
|
|
81
82
|
hyperKYCConfig.setUniqueId(uuid: uniqueId)
|
|
82
83
|
}
|
|
83
84
|
hyperKYCConfig.addMetadata(metadata: metadata)
|
|
85
|
+
if let hkThemeMode = hkThemeMode {
|
|
86
|
+
hyperKYCConfig.setHKThemeMode(themeMode: self.getHKThemeModeFromString(hkThemeModeString: hkThemeMode))
|
|
87
|
+
}
|
|
84
88
|
|
|
85
89
|
// launch HyperKyc
|
|
86
90
|
HyperKyc.launch(controller!, hyperKycConfig: hyperKYCConfig) { hyperKycResult in
|
|
@@ -90,6 +94,19 @@ class Hyperkyc: RCTEventEmitter {
|
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
96
|
|
|
97
|
+
func getHKThemeModeFromString(hkThemeModeString: String) -> HyperKYC.HKThemeMode {
|
|
98
|
+
switch hkThemeModeString {
|
|
99
|
+
case "LIGHT":
|
|
100
|
+
return .light
|
|
101
|
+
case "DARK":
|
|
102
|
+
return .dark
|
|
103
|
+
case "SYSTEM":
|
|
104
|
+
return .system
|
|
105
|
+
default:
|
|
106
|
+
return .light
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
93
110
|
func processHyperKycResponse(hyperKycResult: HyperKycResult) -> [String: Any] {
|
|
94
111
|
var kycData = [:] as [String: Any]
|
|
95
112
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.HKThemeMode = void 0;
|
|
7
|
+
// src/HyperKycThemeMode.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Theme mode for the HyperKyc SDK.
|
|
11
|
+
*
|
|
12
|
+
* This enum specifies how the SDK should handle theming:
|
|
13
|
+
* - `LIGHT`: Force light theme regardless of system settings
|
|
14
|
+
* - `DARK`: Force dark theme regardless of system settings
|
|
15
|
+
* - `SYSTEM`: Follow the device's system theme settings
|
|
16
|
+
*
|
|
17
|
+
* The values are the strings sent over the bridge to the native SDKs.
|
|
18
|
+
*
|
|
19
|
+
* Usage:
|
|
20
|
+
* ```js
|
|
21
|
+
* import HyperKyc, { HKThemeMode } from 'react-native-hyperkyc-sdk';
|
|
22
|
+
*
|
|
23
|
+
* const configDictionary = {};
|
|
24
|
+
* configDictionary["appId"] = appId;
|
|
25
|
+
* configDictionary["appKey"] = appKey;
|
|
26
|
+
* configDictionary["workflowId"] = workflowId;
|
|
27
|
+
* configDictionary["transactionId"] = transactionId;
|
|
28
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.SYSTEM; // Follow system theme
|
|
29
|
+
* // or
|
|
30
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.DARK; // Force dark theme
|
|
31
|
+
* // or
|
|
32
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.LIGHT; // Force light theme
|
|
33
|
+
*
|
|
34
|
+
* HyperKyc.launch(configDictionary, (response) => console.log(response));
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
let HKThemeMode;
|
|
38
|
+
exports.HKThemeMode = HKThemeMode;
|
|
39
|
+
|
|
40
|
+
(function (HKThemeMode) {
|
|
41
|
+
HKThemeMode["LIGHT"] = "LIGHT";
|
|
42
|
+
HKThemeMode["DARK"] = "DARK";
|
|
43
|
+
HKThemeMode["SYSTEM"] = "SYSTEM";
|
|
44
|
+
})(HKThemeMode || (exports.HKThemeMode = HKThemeMode = {}));
|
|
45
|
+
|
|
46
|
+
var _default = HKThemeMode;
|
|
47
|
+
exports.default = _default;
|
|
48
|
+
//# sourceMappingURL=HyperKycThemeMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["HyperKycThemeMode.ts"],"names":["HKThemeMode"],"mappings":";;;;;;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W;;eAWGA,W","sourcesContent":["// src/HyperKycThemeMode.ts\n\n/**\n * Theme mode for the HyperKyc SDK.\n *\n * This enum specifies how the SDK should handle theming:\n * - `LIGHT`: Force light theme regardless of system settings\n * - `DARK`: Force dark theme regardless of system settings\n * - `SYSTEM`: Follow the device's system theme settings\n *\n * The values are the strings sent over the bridge to the native SDKs.\n *\n * Usage:\n * ```js\n * import HyperKyc, { HKThemeMode } from 'react-native-hyperkyc-sdk';\n *\n * const configDictionary = {};\n * configDictionary[\"appId\"] = appId;\n * configDictionary[\"appKey\"] = appKey;\n * configDictionary[\"workflowId\"] = workflowId;\n * configDictionary[\"transactionId\"] = transactionId;\n * configDictionary[\"hkThemeMode\"] = HKThemeMode.SYSTEM; // Follow system theme\n * // or\n * configDictionary[\"hkThemeMode\"] = HKThemeMode.DARK; // Force dark theme\n * // or\n * configDictionary[\"hkThemeMode\"] = HKThemeMode.LIGHT; // Force light theme\n *\n * HyperKyc.launch(configDictionary, (response) => console.log(response));\n * ```\n */\nexport enum HKThemeMode {\n /** Force light theme regardless of system settings */\n LIGHT = 'LIGHT',\n\n /** Force dark theme regardless of system settings */\n DARK = 'DARK',\n\n /** Follow the device's system theme settings */\n SYSTEM = 'SYSTEM',\n}\n\nexport default HKThemeMode;\n"]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "HKThemeMode", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _HyperKycThemeMode.HKThemeMode;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
exports.default = exports.addEventListener = void 0;
|
|
7
13
|
exports.multiply = multiply;
|
|
8
14
|
exports.removeAllEventListeners = void 0;
|
|
@@ -11,6 +17,8 @@ var _reactNative = require("react-native");
|
|
|
11
17
|
|
|
12
18
|
var _HyperKycEvents = _interopRequireDefault(require("./HyperKycEvents"));
|
|
13
19
|
|
|
20
|
+
var _HyperKycThemeMode = require("./HyperKycThemeMode");
|
|
21
|
+
|
|
14
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
23
|
|
|
16
24
|
// src/index.tsx
|
|
@@ -27,11 +35,12 @@ const HyperkycSdk = _reactNative.NativeModules.HyperkycSdk ? _reactNative.Native
|
|
|
27
35
|
const {
|
|
28
36
|
addEventListener,
|
|
29
37
|
removeAllEventListeners
|
|
30
|
-
} = _HyperKycEvents.default; // Export
|
|
38
|
+
} = _HyperKycEvents.default; // Export HKThemeMode so clients can access it
|
|
31
39
|
|
|
32
40
|
exports.removeAllEventListeners = removeAllEventListeners;
|
|
33
41
|
exports.addEventListener = addEventListener;
|
|
34
42
|
|
|
43
|
+
// Export any native methods if needed
|
|
35
44
|
function multiply(a, b) {
|
|
36
45
|
return HyperkycSdk.multiply(a, b);
|
|
37
46
|
} // You can also export the full native module if needed:
|
|
@@ -39,7 +48,8 @@ function multiply(a, b) {
|
|
|
39
48
|
|
|
40
49
|
var _default = { ...HyperkycSdk,
|
|
41
50
|
addEventListener,
|
|
42
|
-
removeAllEventListeners
|
|
51
|
+
removeAllEventListeners,
|
|
52
|
+
HKThemeMode: _HyperKycThemeMode.HKThemeMode
|
|
43
53
|
};
|
|
44
54
|
exports.default = _default;
|
|
45
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["LINKING_ERROR","Platform","select","ios","default","HyperkycSdk","NativeModules","Proxy","get","Error","addEventListener","removeAllEventListeners","HyperKycEvents","multiply","a","b"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["LINKING_ERROR","Platform","select","ios","default","HyperkycSdk","NativeModules","Proxy","get","Error","addEventListener","removeAllEventListeners","HyperKycEvents","multiply","a","b","HKThemeMode"],"mappings":";;;;;;;;;;;;;;;AACA;;AACA;;AACA;;;;AAHA;AAKA,MAAMA,aAAa,GAChB,oFAAD,GACAC,sBAASC,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,WAAW,GAAGC,2BAAcD,WAAd,GAChBC,2BAAcD,WADE,GAEhB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUT,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAWO,MAAM;AAAEU,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAgDC,uBAAtD,C,CAEP;;;;;AAGA;AACO,SAASC,QAAT,CAAkBC,CAAlB,EAA6BC,CAA7B,EAAyD;AAC9D,SAAOV,WAAW,CAACQ,QAAZ,CAAqBC,CAArB,EAAwBC,CAAxB,CAAP;AACD,C,CAED;;;eACe,EACb,GAAGV,WADU;AAEbK,EAAAA,gBAFa;AAGbC,EAAAA,uBAHa;AAIbK,EAAAA,WAAW,EAAXA;AAJa,C","sourcesContent":["// src/index.tsx\nimport { NativeModules, Platform } from 'react-native';\nimport HyperKycEvents from './HyperKycEvents';\nimport { HKThemeMode } from './HyperKycThemeMode';\n\nconst LINKING_ERROR =\n `The package 'react-native-hyperkyc-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst HyperkycSdk = NativeModules.HyperkycSdk\n ? NativeModules.HyperkycSdk\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport const { addEventListener, removeAllEventListeners } = HyperKycEvents;\n\n// Export HKThemeMode so clients can access it\nexport { HKThemeMode };\n\n// Export any native methods if needed\nexport function multiply(a: number, b: number): Promise<number> {\n return HyperkycSdk.multiply(a, b);\n}\n\n// You can also export the full native module if needed:\nexport default {\n ...HyperkycSdk,\n addEventListener,\n removeAllEventListeners,\n HKThemeMode,\n};"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/HyperKycThemeMode.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Theme mode for the HyperKyc SDK.
|
|
5
|
+
*
|
|
6
|
+
* This enum specifies how the SDK should handle theming:
|
|
7
|
+
* - `LIGHT`: Force light theme regardless of system settings
|
|
8
|
+
* - `DARK`: Force dark theme regardless of system settings
|
|
9
|
+
* - `SYSTEM`: Follow the device's system theme settings
|
|
10
|
+
*
|
|
11
|
+
* The values are the strings sent over the bridge to the native SDKs.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* ```js
|
|
15
|
+
* import HyperKyc, { HKThemeMode } from 'react-native-hyperkyc-sdk';
|
|
16
|
+
*
|
|
17
|
+
* const configDictionary = {};
|
|
18
|
+
* configDictionary["appId"] = appId;
|
|
19
|
+
* configDictionary["appKey"] = appKey;
|
|
20
|
+
* configDictionary["workflowId"] = workflowId;
|
|
21
|
+
* configDictionary["transactionId"] = transactionId;
|
|
22
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.SYSTEM; // Follow system theme
|
|
23
|
+
* // or
|
|
24
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.DARK; // Force dark theme
|
|
25
|
+
* // or
|
|
26
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.LIGHT; // Force light theme
|
|
27
|
+
*
|
|
28
|
+
* HyperKyc.launch(configDictionary, (response) => console.log(response));
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export let HKThemeMode;
|
|
32
|
+
|
|
33
|
+
(function (HKThemeMode) {
|
|
34
|
+
HKThemeMode["LIGHT"] = "LIGHT";
|
|
35
|
+
HKThemeMode["DARK"] = "DARK";
|
|
36
|
+
HKThemeMode["SYSTEM"] = "SYSTEM";
|
|
37
|
+
})(HKThemeMode || (HKThemeMode = {}));
|
|
38
|
+
|
|
39
|
+
export default HKThemeMode;
|
|
40
|
+
//# sourceMappingURL=HyperKycThemeMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["HyperKycThemeMode.ts"],"names":["HKThemeMode"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYA,WAAZ;;WAAYA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,KAAAA,W;;AAWZ,eAAeA,WAAf","sourcesContent":["// src/HyperKycThemeMode.ts\n\n/**\n * Theme mode for the HyperKyc SDK.\n *\n * This enum specifies how the SDK should handle theming:\n * - `LIGHT`: Force light theme regardless of system settings\n * - `DARK`: Force dark theme regardless of system settings\n * - `SYSTEM`: Follow the device's system theme settings\n *\n * The values are the strings sent over the bridge to the native SDKs.\n *\n * Usage:\n * ```js\n * import HyperKyc, { HKThemeMode } from 'react-native-hyperkyc-sdk';\n *\n * const configDictionary = {};\n * configDictionary[\"appId\"] = appId;\n * configDictionary[\"appKey\"] = appKey;\n * configDictionary[\"workflowId\"] = workflowId;\n * configDictionary[\"transactionId\"] = transactionId;\n * configDictionary[\"hkThemeMode\"] = HKThemeMode.SYSTEM; // Follow system theme\n * // or\n * configDictionary[\"hkThemeMode\"] = HKThemeMode.DARK; // Force dark theme\n * // or\n * configDictionary[\"hkThemeMode\"] = HKThemeMode.LIGHT; // Force light theme\n *\n * HyperKyc.launch(configDictionary, (response) => console.log(response));\n * ```\n */\nexport enum HKThemeMode {\n /** Force light theme regardless of system settings */\n LIGHT = 'LIGHT',\n\n /** Force dark theme regardless of system settings */\n DARK = 'DARK',\n\n /** Follow the device's system theme settings */\n SYSTEM = 'SYSTEM',\n}\n\nexport default HKThemeMode;\n"]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/index.tsx
|
|
2
2
|
import { NativeModules, Platform } from 'react-native';
|
|
3
3
|
import HyperKycEvents from './HyperKycEvents';
|
|
4
|
+
import { HKThemeMode } from './HyperKycThemeMode';
|
|
4
5
|
const LINKING_ERROR = `The package 'react-native-hyperkyc-sdk' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
5
6
|
ios: "- You have run 'pod install'\n",
|
|
6
7
|
default: ''
|
|
@@ -14,7 +15,9 @@ const HyperkycSdk = NativeModules.HyperkycSdk ? NativeModules.HyperkycSdk : new
|
|
|
14
15
|
export const {
|
|
15
16
|
addEventListener,
|
|
16
17
|
removeAllEventListeners
|
|
17
|
-
} = HyperKycEvents; // Export
|
|
18
|
+
} = HyperKycEvents; // Export HKThemeMode so clients can access it
|
|
19
|
+
|
|
20
|
+
export { HKThemeMode }; // Export any native methods if needed
|
|
18
21
|
|
|
19
22
|
export function multiply(a, b) {
|
|
20
23
|
return HyperkycSdk.multiply(a, b);
|
|
@@ -22,6 +25,7 @@ export function multiply(a, b) {
|
|
|
22
25
|
|
|
23
26
|
export default { ...HyperkycSdk,
|
|
24
27
|
addEventListener,
|
|
25
|
-
removeAllEventListeners
|
|
28
|
+
removeAllEventListeners,
|
|
29
|
+
HKThemeMode
|
|
26
30
|
};
|
|
27
31
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["NativeModules","Platform","HyperKycEvents","LINKING_ERROR","select","ios","default","HyperkycSdk","Proxy","get","Error","addEventListener","removeAllEventListeners","multiply","a","b"],"mappings":"AAAA;AACA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AAEA,MAAMC,aAAa,GAChB,oFAAD,
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["NativeModules","Platform","HyperKycEvents","HKThemeMode","LINKING_ERROR","select","ios","default","HyperkycSdk","Proxy","get","Error","addEventListener","removeAllEventListeners","multiply","a","b"],"mappings":"AAAA;AACA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,SAASC,WAAT,QAA4B,qBAA5B;AAEA,MAAMC,aAAa,GAChB,oFAAD,GACAH,QAAQ,CAACI,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,WAAW,GAAGR,aAAa,CAACQ,WAAd,GAChBR,aAAa,CAACQ,WADE,GAEhB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUP,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAWA,OAAO,MAAM;AAAEQ,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAgDX,cAAtD,C,CAEP;;AACA,SAASC,WAAT,G,CAEA;;AACA,OAAO,SAASW,QAAT,CAAkBC,CAAlB,EAA6BC,CAA7B,EAAyD;AAC9D,SAAOR,WAAW,CAACM,QAAZ,CAAqBC,CAArB,EAAwBC,CAAxB,CAAP;AACD,C,CAED;;AACA,eAAe,EACb,GAAGR,WADU;AAEbI,EAAAA,gBAFa;AAGbC,EAAAA,uBAHa;AAIbV,EAAAA;AAJa,CAAf","sourcesContent":["// src/index.tsx\nimport { NativeModules, Platform } from 'react-native';\nimport HyperKycEvents from './HyperKycEvents';\nimport { HKThemeMode } from './HyperKycThemeMode';\n\nconst LINKING_ERROR =\n `The package 'react-native-hyperkyc-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst HyperkycSdk = NativeModules.HyperkycSdk\n ? NativeModules.HyperkycSdk\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport const { addEventListener, removeAllEventListeners } = HyperKycEvents;\n\n// Export HKThemeMode so clients can access it\nexport { HKThemeMode };\n\n// Export any native methods if needed\nexport function multiply(a: number, b: number): Promise<number> {\n return HyperkycSdk.multiply(a, b);\n}\n\n// You can also export the full native module if needed:\nexport default {\n ...HyperkycSdk,\n addEventListener,\n removeAllEventListeners,\n HKThemeMode,\n};"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme mode for the HyperKyc SDK.
|
|
3
|
+
*
|
|
4
|
+
* This enum specifies how the SDK should handle theming:
|
|
5
|
+
* - `LIGHT`: Force light theme regardless of system settings
|
|
6
|
+
* - `DARK`: Force dark theme regardless of system settings
|
|
7
|
+
* - `SYSTEM`: Follow the device's system theme settings
|
|
8
|
+
*
|
|
9
|
+
* The values are the strings sent over the bridge to the native SDKs.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```js
|
|
13
|
+
* import HyperKyc, { HKThemeMode } from 'react-native-hyperkyc-sdk';
|
|
14
|
+
*
|
|
15
|
+
* const configDictionary = {};
|
|
16
|
+
* configDictionary["appId"] = appId;
|
|
17
|
+
* configDictionary["appKey"] = appKey;
|
|
18
|
+
* configDictionary["workflowId"] = workflowId;
|
|
19
|
+
* configDictionary["transactionId"] = transactionId;
|
|
20
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.SYSTEM; // Follow system theme
|
|
21
|
+
* // or
|
|
22
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.DARK; // Force dark theme
|
|
23
|
+
* // or
|
|
24
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.LIGHT; // Force light theme
|
|
25
|
+
*
|
|
26
|
+
* HyperKyc.launch(configDictionary, (response) => console.log(response));
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare enum HKThemeMode {
|
|
30
|
+
/** Force light theme regardless of system settings */
|
|
31
|
+
LIGHT = "LIGHT",
|
|
32
|
+
/** Force dark theme regardless of system settings */
|
|
33
|
+
DARK = "DARK",
|
|
34
|
+
/** Follow the device's system theme settings */
|
|
35
|
+
SYSTEM = "SYSTEM"
|
|
36
|
+
}
|
|
37
|
+
export default HKThemeMode;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { HKThemeMode } from './HyperKycThemeMode';
|
|
1
2
|
export declare const addEventListener: typeof import("./HyperKycEvents").addEventListener, removeAllEventListeners: typeof import("./HyperKycEvents").removeAllEventListeners;
|
|
3
|
+
export { HKThemeMode };
|
|
2
4
|
export declare function multiply(a: number, b: number): Promise<number>;
|
|
3
5
|
declare const _default: any;
|
|
4
6
|
export default _default;
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// src/HyperKycThemeMode.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Theme mode for the HyperKyc SDK.
|
|
5
|
+
*
|
|
6
|
+
* This enum specifies how the SDK should handle theming:
|
|
7
|
+
* - `LIGHT`: Force light theme regardless of system settings
|
|
8
|
+
* - `DARK`: Force dark theme regardless of system settings
|
|
9
|
+
* - `SYSTEM`: Follow the device's system theme settings
|
|
10
|
+
*
|
|
11
|
+
* The values are the strings sent over the bridge to the native SDKs.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* ```js
|
|
15
|
+
* import HyperKyc, { HKThemeMode } from 'react-native-hyperkyc-sdk';
|
|
16
|
+
*
|
|
17
|
+
* const configDictionary = {};
|
|
18
|
+
* configDictionary["appId"] = appId;
|
|
19
|
+
* configDictionary["appKey"] = appKey;
|
|
20
|
+
* configDictionary["workflowId"] = workflowId;
|
|
21
|
+
* configDictionary["transactionId"] = transactionId;
|
|
22
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.SYSTEM; // Follow system theme
|
|
23
|
+
* // or
|
|
24
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.DARK; // Force dark theme
|
|
25
|
+
* // or
|
|
26
|
+
* configDictionary["hkThemeMode"] = HKThemeMode.LIGHT; // Force light theme
|
|
27
|
+
*
|
|
28
|
+
* HyperKyc.launch(configDictionary, (response) => console.log(response));
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export enum HKThemeMode {
|
|
32
|
+
/** Force light theme regardless of system settings */
|
|
33
|
+
LIGHT = 'LIGHT',
|
|
34
|
+
|
|
35
|
+
/** Force dark theme regardless of system settings */
|
|
36
|
+
DARK = 'DARK',
|
|
37
|
+
|
|
38
|
+
/** Follow the device's system theme settings */
|
|
39
|
+
SYSTEM = 'SYSTEM',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default HKThemeMode;
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/index.tsx
|
|
2
2
|
import { NativeModules, Platform } from 'react-native';
|
|
3
3
|
import HyperKycEvents from './HyperKycEvents';
|
|
4
|
+
import { HKThemeMode } from './HyperKycThemeMode';
|
|
4
5
|
|
|
5
6
|
const LINKING_ERROR =
|
|
6
7
|
`The package 'react-native-hyperkyc-sdk' doesn't seem to be linked. Make sure: \n\n` +
|
|
@@ -21,6 +22,9 @@ const HyperkycSdk = NativeModules.HyperkycSdk
|
|
|
21
22
|
|
|
22
23
|
export const { addEventListener, removeAllEventListeners } = HyperKycEvents;
|
|
23
24
|
|
|
25
|
+
// Export HKThemeMode so clients can access it
|
|
26
|
+
export { HKThemeMode };
|
|
27
|
+
|
|
24
28
|
// Export any native methods if needed
|
|
25
29
|
export function multiply(a: number, b: number): Promise<number> {
|
|
26
30
|
return HyperkycSdk.multiply(a, b);
|
|
@@ -31,4 +35,5 @@ export default {
|
|
|
31
35
|
...HyperkycSdk,
|
|
32
36
|
addEventListener,
|
|
33
37
|
removeAllEventListeners,
|
|
38
|
+
HKThemeMode,
|
|
34
39
|
};
|