@unvired/react-native-wrapper-sdk 0.0.5 → 0.0.7
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/dist/UnviredWrapper.d.ts +12 -7
- package/dist/UnviredWrapper.d.ts.map +1 -1
- package/dist/UnviredWrapper.js +32 -28
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -6
- package/dist/lib/AuthBuilder.d.ts +42 -6
- package/dist/lib/AuthBuilder.d.ts.map +1 -1
- package/dist/lib/AuthBuilder.js +28 -7
- package/package.json +1 -1
- package/src/UnviredWrapper.ts +35 -36
- package/src/index.ts +0 -5
- package/src/lib/AuthBuilder.ts +66 -28
- package/dist/core/UnviredSDK.d.ts +0 -107
- package/dist/core/UnviredSDK.d.ts.map +0 -1
- package/dist/core/UnviredSDK.js +0 -24
- package/dist/core/platform/CordovaPlatformAdapter.d.ts +0 -13
- package/dist/core/platform/CordovaPlatformAdapter.d.ts.map +0 -1
- package/dist/core/platform/CordovaPlatformAdapter.js +0 -62
- package/dist/core/platform/PlatformInterface.d.ts +0 -12
- package/dist/core/platform/PlatformInterface.d.ts.map +0 -1
- package/dist/core/platform/PlatformInterface.js +0 -2
- package/dist/core/platform/PlatformManager.d.ts +0 -10
- package/dist/core/platform/PlatformManager.d.ts.map +0 -1
- package/dist/core/platform/PlatformManager.js +0 -29
- package/dist/core/platform/ReactNativePlatformAdapter.d.ts +0 -13
- package/dist/core/platform/ReactNativePlatformAdapter.d.ts.map +0 -1
- package/dist/core/platform/ReactNativePlatformAdapter.js +0 -47
- package/src/core/UnviredSDK.ts +0 -126
- package/src/core/platform/CordovaPlatformAdapter.ts +0 -69
- package/src/core/platform/PlatformInterface.ts +0 -12
- package/src/core/platform/PlatformManager.ts +0 -35
- package/src/core/platform/ReactNativePlatformAdapter.ts +0 -57
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { PlatformManager } from './platform/PlatformManager';
|
|
2
|
-
export declare enum LoginType {
|
|
3
|
-
unvired = "UNVIRED_ID"
|
|
4
|
-
}
|
|
5
|
-
export declare class LoginParameters {
|
|
6
|
-
/**
|
|
7
|
-
* Set the application name as configured in UMP.
|
|
8
|
-
*/
|
|
9
|
-
appName: string;
|
|
10
|
-
/**
|
|
11
|
-
* Company name as configured in UMP.
|
|
12
|
-
*/
|
|
13
|
-
company: string;
|
|
14
|
-
/**
|
|
15
|
-
* Username of the user trying to login.
|
|
16
|
-
*/
|
|
17
|
-
username: string;
|
|
18
|
-
/**
|
|
19
|
-
* Password of the user trying to login.
|
|
20
|
-
*/
|
|
21
|
-
password: string;
|
|
22
|
-
/**
|
|
23
|
-
* UMP URL. For example: https://umpdev.unvired.io/UMP
|
|
24
|
-
*/
|
|
25
|
-
url: string;
|
|
26
|
-
/**
|
|
27
|
-
* Domain name. Required only if the login type is ADS or SAP.
|
|
28
|
-
*/
|
|
29
|
-
domain: string;
|
|
30
|
-
/**
|
|
31
|
-
* Set this value to one of the allowed login types for your app as configured in UMP.
|
|
32
|
-
*/
|
|
33
|
-
loginType: LoginType;
|
|
34
|
-
/**
|
|
35
|
-
* FrontEndUserId: This id uniquely identifies the user across devices of same type. If the Unvired user has multiple front end ids for a device type, you need to set this value.
|
|
36
|
-
* If the Unvired user has only one front end id, leave this field blank.
|
|
37
|
-
*/
|
|
38
|
-
feUserId: string;
|
|
39
|
-
/**
|
|
40
|
-
* Required only if the loginType is 'sap'. This sets the SAP Port Name.
|
|
41
|
-
*/
|
|
42
|
-
port: string;
|
|
43
|
-
/**
|
|
44
|
-
* Required for Browser Platform.
|
|
45
|
-
* For iOS Platform include the metadata.xml file as part of App Bundle
|
|
46
|
-
* For Android Platform include the metadata.xml file in src > res > raw
|
|
47
|
-
*/
|
|
48
|
-
metadataPath: string;
|
|
49
|
-
/**
|
|
50
|
-
* This is required for Android only. Setting this value would save the attachments as Base64 string for easy access.
|
|
51
|
-
*/
|
|
52
|
-
isRequiredAttachmentBase64: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Set an interval in seconds at which the framework has to make an attempt to send data from outbox.
|
|
55
|
-
* If the data-sender fails for reason, then the framework does not restart even if there are outbox items.
|
|
56
|
-
* In those cases, you will have to set this value, so that the framework always makes an attempt to send from outbox.
|
|
57
|
-
* Example:
|
|
58
|
-
* loginParameters.autoSendTime = '5' // Make an attempt to send data every 5 seconds.
|
|
59
|
-
*/
|
|
60
|
-
autoSendTime: string;
|
|
61
|
-
/**
|
|
62
|
-
* Set the number of seconds at which GetMessage should automatically run. When this value is set, GetMessage would run in a interval as long as there are entries in Sent Items.
|
|
63
|
-
* You may need to set this value if your app doesn't support Push Notifications.
|
|
64
|
-
* By default, the framework does not do GetMessage automatically.
|
|
65
|
-
* Example:
|
|
66
|
-
* loginParameters.autoSyncTime = '5' // Make an attempt to receive data (GetMessage) every 5 seconds.
|
|
67
|
-
*/
|
|
68
|
-
autoSyncTime: string;
|
|
69
|
-
/**
|
|
70
|
-
* Specify the metadata as a JSON string. This will override metadata.xml set at platform level.
|
|
71
|
-
*/
|
|
72
|
-
metadataJSON: string;
|
|
73
|
-
/**
|
|
74
|
-
* Specify the demo data xml string for demo mode.
|
|
75
|
-
*/
|
|
76
|
-
demoData: string;
|
|
77
|
-
/**
|
|
78
|
-
* Set 'true' if the application supports demo mode otherwise set 'false'.
|
|
79
|
-
*/
|
|
80
|
-
demoModeRequired: boolean;
|
|
81
|
-
persistWebDb: boolean;
|
|
82
|
-
jwtOptions: object;
|
|
83
|
-
/**
|
|
84
|
-
* Language code to be sent to UMP. Specify a two-letter language code.
|
|
85
|
-
* The default value of this is 'en'.
|
|
86
|
-
*/
|
|
87
|
-
loginLanguage: string;
|
|
88
|
-
/**
|
|
89
|
-
* Applicable for browser only. Set this flag to indicate that saved data should be reloaded upon launch.
|
|
90
|
-
*/
|
|
91
|
-
cacheWebData: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Set this value if you the login process requires client credentials to be set.
|
|
94
|
-
* You can pass the client credentials with the method: |unviredSDK.setClientCredentials(credentials)|
|
|
95
|
-
* The passed credentials will be used based on this flag.
|
|
96
|
-
*/
|
|
97
|
-
requireClientCredentials: boolean;
|
|
98
|
-
}
|
|
99
|
-
declare class UnviredSDK {
|
|
100
|
-
static getPlatformManager(): PlatformManager;
|
|
101
|
-
login(_loginParameters: LoginParameters): Promise<string>;
|
|
102
|
-
logout(): Promise<boolean>;
|
|
103
|
-
authenticateLocal(_loginParameters: LoginParameters): Promise<string>;
|
|
104
|
-
authenticateAndActivate(_loginParameters: LoginParameters): Promise<string>;
|
|
105
|
-
}
|
|
106
|
-
export default UnviredSDK;
|
|
107
|
-
//# sourceMappingURL=UnviredSDK.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UnviredSDK.d.ts","sourceRoot":"","sources":["../../src/core/UnviredSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,MAAM,CAAC,OAAO,MAAM,SAAS;IAC3B,OAAO,eAAe;CACvB;AACD,MAAM,CAAC,OAAO,OAAO,eAAe;IAClC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,0BAA0B,EAAE,OAAO,CAAC;IACpC;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,wBAAwB,EAAE,OAAO,CAAC;CACnC;AAED,cAAM,UAAU;IACd,MAAM,CAAC,kBAAkB,IAAI,eAAe;IAItC,KAAK,CAAC,gBAAgB,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAKzD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAI1B,iBAAiB,CAAC,gBAAgB,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAKrE,uBAAuB,CAAC,gBAAgB,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;CAIlF;AAED,eAAe,UAAU,CAAC"}
|
package/dist/core/UnviredSDK.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const PlatformManager_1 = require("./platform/PlatformManager");
|
|
4
|
-
class UnviredSDK {
|
|
5
|
-
static getPlatformManager() {
|
|
6
|
-
return PlatformManager_1.PlatformManager.getInstance();
|
|
7
|
-
}
|
|
8
|
-
async login(_loginParameters) {
|
|
9
|
-
// Returns one of: auth_activation_required, app_requires_login, login_success, app_requires_current_account, login_demo
|
|
10
|
-
return 'auth_activation_required';
|
|
11
|
-
}
|
|
12
|
-
async logout() {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
async authenticateLocal(_loginParameters) {
|
|
16
|
-
// Returns one of: login_success, login_error
|
|
17
|
-
return 'login_success';
|
|
18
|
-
}
|
|
19
|
-
async authenticateAndActivate(_loginParameters) {
|
|
20
|
-
// Returns one of: auth_activation_success, auth_activation_error
|
|
21
|
-
return 'auth_activation_success';
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.default = UnviredSDK;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PlatformInterface } from './PlatformInterface';
|
|
2
|
-
export declare class CordovaPlatformAdapter implements PlatformInterface {
|
|
3
|
-
logInfo(className: string, methodName: string, message: string): void;
|
|
4
|
-
logError(className: string, methodName: string, message: string): void;
|
|
5
|
-
logDebug(className: string, methodName: string, message: string): void;
|
|
6
|
-
logWarning(className: string, methodName: string, message: string): void;
|
|
7
|
-
setLogLevel(level: string): void;
|
|
8
|
-
getLogFileURL(): Promise<string>;
|
|
9
|
-
getLogFileContent(): Promise<string>;
|
|
10
|
-
getBackupLogFileContent(): Promise<string>;
|
|
11
|
-
clearLogFile(): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=CordovaPlatformAdapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CordovaPlatformAdapter.d.ts","sourceRoot":"","sources":["../../../src/core/platform/CordovaPlatformAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,qBAAa,sBAAuB,YAAW,iBAAiB;IAG5D,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIrE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAItE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAItE,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxE,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI1B,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAWhC,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAUpC,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;IAU1C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAUtC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CordovaPlatformAdapter = void 0;
|
|
4
|
-
class CordovaPlatformAdapter {
|
|
5
|
-
// Logger
|
|
6
|
-
logInfo(className, methodName, message) {
|
|
7
|
-
Logger.logInfo(className, methodName, message);
|
|
8
|
-
}
|
|
9
|
-
logError(className, methodName, message) {
|
|
10
|
-
Logger.logError(className, methodName, message);
|
|
11
|
-
}
|
|
12
|
-
logDebug(className, methodName, message) {
|
|
13
|
-
Logger.logDebug(className, methodName, message);
|
|
14
|
-
}
|
|
15
|
-
logWarning(className, methodName, message) {
|
|
16
|
-
Logger.logWarning(className, methodName, message);
|
|
17
|
-
}
|
|
18
|
-
setLogLevel(level) {
|
|
19
|
-
Logger.setLogLevel(level);
|
|
20
|
-
}
|
|
21
|
-
async getLogFileURL() {
|
|
22
|
-
return new Promise((resolve, reject) => {
|
|
23
|
-
try {
|
|
24
|
-
const url = Logger.getLogFileURL();
|
|
25
|
-
resolve(url);
|
|
26
|
-
}
|
|
27
|
-
catch (e) {
|
|
28
|
-
reject(e);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
async getLogFileContent() {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
Logger.getLogFileContent((content) => {
|
|
35
|
-
resolve(content);
|
|
36
|
-
}, (error) => {
|
|
37
|
-
reject(error);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
async getBackupLogFileContent() {
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
Logger.getBackupLogFileContent((content) => {
|
|
44
|
-
resolve(content);
|
|
45
|
-
}, (error) => {
|
|
46
|
-
reject(error);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
async clearLogFile() {
|
|
51
|
-
return new Promise((resolve, reject) => {
|
|
52
|
-
try {
|
|
53
|
-
Logger.clearLogFile();
|
|
54
|
-
resolve();
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
reject(e);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.CordovaPlatformAdapter = CordovaPlatformAdapter;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface PlatformInterface {
|
|
2
|
-
logInfo(className: string, methodName: string, message: string): void;
|
|
3
|
-
logError(className: string, methodName: string, message: string): void;
|
|
4
|
-
logDebug(className: string, methodName: string, message: string): void;
|
|
5
|
-
logWarning(className: string, methodName: string, message: string): void;
|
|
6
|
-
setLogLevel(level: string): void;
|
|
7
|
-
getLogFileURL(): Promise<string>;
|
|
8
|
-
getLogFileContent(): Promise<string>;
|
|
9
|
-
getBackupLogFileContent(): Promise<string>;
|
|
10
|
-
clearLogFile(): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=PlatformInterface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformInterface.d.ts","sourceRoot":"","sources":["../../../src/core/platform/PlatformInterface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAE9B,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACtE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvE,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACzE,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PlatformInterface } from './PlatformInterface';
|
|
2
|
-
export declare class PlatformManager {
|
|
3
|
-
private static instance;
|
|
4
|
-
private platformAdapter;
|
|
5
|
-
private constructor();
|
|
6
|
-
static getInstance(): PlatformManager;
|
|
7
|
-
getPlatformAdapter(): PlatformInterface;
|
|
8
|
-
setPlatformAdapter(adapter: PlatformInterface): void;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=PlatformManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformManager.d.ts","sourceRoot":"","sources":["../../../src/core/platform/PlatformManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,qBAAa,eAAe;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,eAAe,CAAoB;IAE3C,OAAO;WAMO,WAAW,IAAI,eAAe;IAOrC,kBAAkB,IAAI,iBAAiB;IAIvC,kBAAkB,CAAC,OAAO,EAAE,iBAAiB;CAGvD"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlatformManager = void 0;
|
|
4
|
-
const ReactNativePlatformAdapter_1 = require("./ReactNativePlatformAdapter");
|
|
5
|
-
class PlatformManager {
|
|
6
|
-
constructor() {
|
|
7
|
-
// Default to Cordova for now, or detect environment
|
|
8
|
-
// In a real scenario, we might inject this or detect based on environment variables
|
|
9
|
-
this.platformAdapter = new ReactNativePlatformAdapter_1.ReactNativePlatformAdapter();
|
|
10
|
-
}
|
|
11
|
-
static getInstance() {
|
|
12
|
-
if (!PlatformManager.instance) {
|
|
13
|
-
PlatformManager.instance = new PlatformManager();
|
|
14
|
-
}
|
|
15
|
-
return PlatformManager.instance;
|
|
16
|
-
}
|
|
17
|
-
getPlatformAdapter() {
|
|
18
|
-
return this.platformAdapter;
|
|
19
|
-
}
|
|
20
|
-
setPlatformAdapter(adapter) {
|
|
21
|
-
this.platformAdapter = adapter;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.PlatformManager = PlatformManager;
|
|
25
|
-
// Usage:
|
|
26
|
-
// import { PlatformManager } from './platform/PlatformManager';
|
|
27
|
-
// import { ReactNativePlatformAdapter } from './platform/ReactNativePlatformAdapter';
|
|
28
|
-
// // Initialize with React Native adapter
|
|
29
|
-
// PlatformManager.getInstance().setPlatformAdapter(new ReactNativePlatformAdapter());
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PlatformInterface } from './PlatformInterface';
|
|
2
|
-
export declare class ReactNativePlatformAdapter implements PlatformInterface {
|
|
3
|
-
logInfo(className: string, methodName: string, message: string): void;
|
|
4
|
-
logError(className: string, methodName: string, message: string): void;
|
|
5
|
-
logDebug(className: string, methodName: string, message: string): void;
|
|
6
|
-
logWarning(className: string, methodName: string, message: string): void;
|
|
7
|
-
setLogLevel(level: string): void;
|
|
8
|
-
getLogFileURL(): Promise<string>;
|
|
9
|
-
getLogFileContent(): Promise<string>;
|
|
10
|
-
getBackupLogFileContent(): Promise<string>;
|
|
11
|
-
clearLogFile(): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=ReactNativePlatformAdapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativePlatformAdapter.d.ts","sourceRoot":"","sources":["../../../src/core/platform/ReactNativePlatformAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,qBAAa,0BAA2B,YAAW,iBAAiB;IAElE,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAMrE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAMtE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAMtE,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAYxE,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM1B,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAIhC,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIpC,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ReactNativePlatformAdapter = void 0;
|
|
4
|
-
const react_native_unvired_sdk_1 = require("@unvired/react-native-unvired-sdk");
|
|
5
|
-
class ReactNativePlatformAdapter {
|
|
6
|
-
// Logger
|
|
7
|
-
logInfo(className, methodName, message) {
|
|
8
|
-
react_native_unvired_sdk_1.logger.logInfo(className, methodName, message);
|
|
9
|
-
console.log(`[INFO] ${className}.${methodName}: ${message}`);
|
|
10
|
-
}
|
|
11
|
-
logError(className, methodName, message) {
|
|
12
|
-
react_native_unvired_sdk_1.logger.logError(className, methodName, message);
|
|
13
|
-
console.error(`[ERROR] ${className}.${methodName}: ${message}`);
|
|
14
|
-
}
|
|
15
|
-
logDebug(className, methodName, message) {
|
|
16
|
-
react_native_unvired_sdk_1.logger.logDebug(className, methodName, message);
|
|
17
|
-
console.debug(`[DEBUG] ${className}.${methodName}: ${message}`);
|
|
18
|
-
}
|
|
19
|
-
logWarning(className, methodName, message) {
|
|
20
|
-
// TODO: Update to logger.logWarning once available in react-native-wrapper-sdk
|
|
21
|
-
// Using logInfo as fallback for now
|
|
22
|
-
if (typeof react_native_unvired_sdk_1.logger.logWarning === 'function') {
|
|
23
|
-
react_native_unvired_sdk_1.logger.logWarning(className, methodName, message);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
react_native_unvired_sdk_1.logger.logInfo(className, methodName, `[WARNING] ${message}`);
|
|
27
|
-
}
|
|
28
|
-
console.warn(`[WARNING] ${className}.${methodName}: ${message}`);
|
|
29
|
-
}
|
|
30
|
-
setLogLevel(level) {
|
|
31
|
-
react_native_unvired_sdk_1.logger.setLogLevel(level.toUpperCase());
|
|
32
|
-
console.log(`[setLogLevel] ${level}`);
|
|
33
|
-
}
|
|
34
|
-
async getLogFileURL() {
|
|
35
|
-
return await react_native_unvired_sdk_1.logger.getLogFileURL();
|
|
36
|
-
}
|
|
37
|
-
async getLogFileContent() {
|
|
38
|
-
return await react_native_unvired_sdk_1.logger.getLogFileContent();
|
|
39
|
-
}
|
|
40
|
-
async getBackupLogFileContent() {
|
|
41
|
-
return await react_native_unvired_sdk_1.logger.getBackupLogFileContent();
|
|
42
|
-
}
|
|
43
|
-
async clearLogFile() {
|
|
44
|
-
await react_native_unvired_sdk_1.logger.clearLogFile();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.ReactNativePlatformAdapter = ReactNativePlatformAdapter;
|
package/src/core/UnviredSDK.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { PlatformManager } from './platform/PlatformManager';
|
|
2
|
-
|
|
3
|
-
export declare enum LoginType {
|
|
4
|
-
unvired = 'UNVIRED_ID',
|
|
5
|
-
}
|
|
6
|
-
export declare class LoginParameters {
|
|
7
|
-
/**
|
|
8
|
-
* Set the application name as configured in UMP.
|
|
9
|
-
*/
|
|
10
|
-
appName: string;
|
|
11
|
-
/**
|
|
12
|
-
* Company name as configured in UMP.
|
|
13
|
-
*/
|
|
14
|
-
company: string;
|
|
15
|
-
/**
|
|
16
|
-
* Username of the user trying to login.
|
|
17
|
-
*/
|
|
18
|
-
username: string;
|
|
19
|
-
/**
|
|
20
|
-
* Password of the user trying to login.
|
|
21
|
-
*/
|
|
22
|
-
password: string;
|
|
23
|
-
/**
|
|
24
|
-
* UMP URL. For example: https://umpdev.unvired.io/UMP
|
|
25
|
-
*/
|
|
26
|
-
url: string;
|
|
27
|
-
/**
|
|
28
|
-
* Domain name. Required only if the login type is ADS or SAP.
|
|
29
|
-
*/
|
|
30
|
-
domain: string;
|
|
31
|
-
/**
|
|
32
|
-
* Set this value to one of the allowed login types for your app as configured in UMP.
|
|
33
|
-
*/
|
|
34
|
-
loginType: LoginType;
|
|
35
|
-
/**
|
|
36
|
-
* FrontEndUserId: This id uniquely identifies the user across devices of same type. If the Unvired user has multiple front end ids for a device type, you need to set this value.
|
|
37
|
-
* If the Unvired user has only one front end id, leave this field blank.
|
|
38
|
-
*/
|
|
39
|
-
feUserId: string;
|
|
40
|
-
/**
|
|
41
|
-
* Required only if the loginType is 'sap'. This sets the SAP Port Name.
|
|
42
|
-
*/
|
|
43
|
-
port: string;
|
|
44
|
-
/**
|
|
45
|
-
* Required for Browser Platform.
|
|
46
|
-
* For iOS Platform include the metadata.xml file as part of App Bundle
|
|
47
|
-
* For Android Platform include the metadata.xml file in src > res > raw
|
|
48
|
-
*/
|
|
49
|
-
metadataPath: string;
|
|
50
|
-
/**
|
|
51
|
-
* This is required for Android only. Setting this value would save the attachments as Base64 string for easy access.
|
|
52
|
-
*/
|
|
53
|
-
isRequiredAttachmentBase64: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Set an interval in seconds at which the framework has to make an attempt to send data from outbox.
|
|
56
|
-
* If the data-sender fails for reason, then the framework does not restart even if there are outbox items.
|
|
57
|
-
* In those cases, you will have to set this value, so that the framework always makes an attempt to send from outbox.
|
|
58
|
-
* Example:
|
|
59
|
-
* loginParameters.autoSendTime = '5' // Make an attempt to send data every 5 seconds.
|
|
60
|
-
*/
|
|
61
|
-
autoSendTime: string;
|
|
62
|
-
/**
|
|
63
|
-
* Set the number of seconds at which GetMessage should automatically run. When this value is set, GetMessage would run in a interval as long as there are entries in Sent Items.
|
|
64
|
-
* You may need to set this value if your app doesn't support Push Notifications.
|
|
65
|
-
* By default, the framework does not do GetMessage automatically.
|
|
66
|
-
* Example:
|
|
67
|
-
* loginParameters.autoSyncTime = '5' // Make an attempt to receive data (GetMessage) every 5 seconds.
|
|
68
|
-
*/
|
|
69
|
-
autoSyncTime: string;
|
|
70
|
-
/**
|
|
71
|
-
* Specify the metadata as a JSON string. This will override metadata.xml set at platform level.
|
|
72
|
-
*/
|
|
73
|
-
metadataJSON: string;
|
|
74
|
-
/**
|
|
75
|
-
* Specify the demo data xml string for demo mode.
|
|
76
|
-
*/
|
|
77
|
-
demoData: string;
|
|
78
|
-
/**
|
|
79
|
-
* Set 'true' if the application supports demo mode otherwise set 'false'.
|
|
80
|
-
*/
|
|
81
|
-
demoModeRequired: boolean;
|
|
82
|
-
persistWebDb: boolean;
|
|
83
|
-
jwtOptions: object;
|
|
84
|
-
/**
|
|
85
|
-
* Language code to be sent to UMP. Specify a two-letter language code.
|
|
86
|
-
* The default value of this is 'en'.
|
|
87
|
-
*/
|
|
88
|
-
loginLanguage: string;
|
|
89
|
-
/**
|
|
90
|
-
* Applicable for browser only. Set this flag to indicate that saved data should be reloaded upon launch.
|
|
91
|
-
*/
|
|
92
|
-
cacheWebData: boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Set this value if you the login process requires client credentials to be set.
|
|
95
|
-
* You can pass the client credentials with the method: |unviredSDK.setClientCredentials(credentials)|
|
|
96
|
-
* The passed credentials will be used based on this flag.
|
|
97
|
-
*/
|
|
98
|
-
requireClientCredentials: boolean;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
class UnviredSDK {
|
|
102
|
-
static getPlatformManager(): PlatformManager {
|
|
103
|
-
return PlatformManager.getInstance();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async login(_loginParameters: LoginParameters): Promise<string> {
|
|
107
|
-
// Returns one of: auth_activation_required, app_requires_login, login_success, app_requires_current_account, login_demo
|
|
108
|
-
return 'auth_activation_required';
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
async logout(): Promise<boolean> {
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async authenticateLocal(_loginParameters: LoginParameters): Promise<string> {
|
|
116
|
-
// Returns one of: login_success, login_error
|
|
117
|
-
return 'login_success';
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
async authenticateAndActivate(_loginParameters: LoginParameters): Promise<string> {
|
|
121
|
-
// Returns one of: auth_activation_success, auth_activation_error
|
|
122
|
-
return 'auth_activation_success';
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export default UnviredSDK;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { PlatformInterface } from './PlatformInterface';
|
|
2
|
-
|
|
3
|
-
declare var Logger: any;
|
|
4
|
-
|
|
5
|
-
export class CordovaPlatformAdapter implements PlatformInterface {
|
|
6
|
-
|
|
7
|
-
// Logger
|
|
8
|
-
logInfo(className: string, methodName: string, message: string): void {
|
|
9
|
-
Logger.logInfo(className, methodName, message);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
logError(className: string, methodName: string, message: string): void {
|
|
13
|
-
Logger.logError(className, methodName, message);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
logDebug(className: string, methodName: string, message: string): void {
|
|
17
|
-
Logger.logDebug(className, methodName, message);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
logWarning(className: string, methodName: string, message: string): void {
|
|
21
|
-
Logger.logWarning(className, methodName, message);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
setLogLevel(level: string): void {
|
|
25
|
-
Logger.setLogLevel(level);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async getLogFileURL(): Promise<string> {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
try {
|
|
31
|
-
const url = Logger.getLogFileURL();
|
|
32
|
-
resolve(url);
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async getLogFileContent(): Promise<string> {
|
|
40
|
-
return new Promise((resolve, reject) => {
|
|
41
|
-
Logger.getLogFileContent((content: string) => {
|
|
42
|
-
resolve(content);
|
|
43
|
-
}, (error: any) => {
|
|
44
|
-
reject(error);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async getBackupLogFileContent(): Promise<string> {
|
|
50
|
-
return new Promise((resolve, reject) => {
|
|
51
|
-
Logger.getBackupLogFileContent((content: string) => {
|
|
52
|
-
resolve(content);
|
|
53
|
-
}, (error: any) => {
|
|
54
|
-
reject(error);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async clearLogFile(): Promise<void> {
|
|
60
|
-
return new Promise((resolve, reject) => {
|
|
61
|
-
try {
|
|
62
|
-
Logger.clearLogFile();
|
|
63
|
-
resolve();
|
|
64
|
-
} catch (e) {
|
|
65
|
-
reject(e);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface PlatformInterface {
|
|
2
|
-
// Logger
|
|
3
|
-
logInfo(className: string, methodName: string, message: string): void;
|
|
4
|
-
logError(className: string, methodName: string, message: string): void;
|
|
5
|
-
logDebug(className: string, methodName: string, message: string): void;
|
|
6
|
-
logWarning(className: string, methodName: string, message: string): void;
|
|
7
|
-
setLogLevel(level: string): void;
|
|
8
|
-
getLogFileURL(): Promise<string>;
|
|
9
|
-
getLogFileContent(): Promise<string>;
|
|
10
|
-
getBackupLogFileContent(): Promise<string>;
|
|
11
|
-
clearLogFile(): Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { PlatformInterface } from './PlatformInterface';
|
|
2
|
-
import { ReactNativePlatformAdapter } from './ReactNativePlatformAdapter';
|
|
3
|
-
|
|
4
|
-
export class PlatformManager {
|
|
5
|
-
private static instance: PlatformManager;
|
|
6
|
-
private platformAdapter: PlatformInterface;
|
|
7
|
-
|
|
8
|
-
private constructor() {
|
|
9
|
-
// Default to Cordova for now, or detect environment
|
|
10
|
-
// In a real scenario, we might inject this or detect based on environment variables
|
|
11
|
-
this.platformAdapter = new ReactNativePlatformAdapter();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public static getInstance(): PlatformManager {
|
|
15
|
-
if (!PlatformManager.instance) {
|
|
16
|
-
PlatformManager.instance = new PlatformManager();
|
|
17
|
-
}
|
|
18
|
-
return PlatformManager.instance;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public getPlatformAdapter(): PlatformInterface {
|
|
22
|
-
return this.platformAdapter;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public setPlatformAdapter(adapter: PlatformInterface) {
|
|
26
|
-
this.platformAdapter = adapter;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Usage:
|
|
31
|
-
// import { PlatformManager } from './platform/PlatformManager';
|
|
32
|
-
// import { ReactNativePlatformAdapter } from './platform/ReactNativePlatformAdapter';
|
|
33
|
-
|
|
34
|
-
// // Initialize with React Native adapter
|
|
35
|
-
// PlatformManager.getInstance().setPlatformAdapter(new ReactNativePlatformAdapter());
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { PlatformInterface } from './PlatformInterface';
|
|
2
|
-
import { logger, LogLevel } from '@unvired/react-native-unvired-sdk';
|
|
3
|
-
|
|
4
|
-
export class ReactNativePlatformAdapter implements PlatformInterface {
|
|
5
|
-
// Logger
|
|
6
|
-
logInfo(className: string, methodName: string, message: string): void {
|
|
7
|
-
logger.logInfo(className, methodName, message);
|
|
8
|
-
|
|
9
|
-
console.log(`[INFO] ${className}.${methodName}: ${message}`);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
logError(className: string, methodName: string, message: string): void {
|
|
13
|
-
logger.logError(className, methodName, message);
|
|
14
|
-
|
|
15
|
-
console.error(`[ERROR] ${className}.${methodName}: ${message}`);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
logDebug(className: string, methodName: string, message: string): void {
|
|
19
|
-
logger.logDebug(className, methodName, message);
|
|
20
|
-
|
|
21
|
-
console.debug(`[DEBUG] ${className}.${methodName}: ${message}`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
logWarning(className: string, methodName: string, message: string): void {
|
|
25
|
-
// TODO: Update to logger.logWarning once available in react-native-wrapper-sdk
|
|
26
|
-
// Using logInfo as fallback for now
|
|
27
|
-
if (typeof (logger as any).logWarning === 'function') {
|
|
28
|
-
(logger as any).logWarning(className, methodName, message);
|
|
29
|
-
} else {
|
|
30
|
-
logger.logInfo(className, methodName, `[WARNING] ${message}`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
console.warn(`[WARNING] ${className}.${methodName}: ${message}`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
setLogLevel(level: string): void {
|
|
37
|
-
logger.setLogLevel(level.toUpperCase() as LogLevel);
|
|
38
|
-
|
|
39
|
-
console.log(`[setLogLevel] ${level}`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async getLogFileURL(): Promise<string> {
|
|
43
|
-
return await logger.getLogFileURL();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async getLogFileContent(): Promise<string> {
|
|
47
|
-
return await logger.getLogFileContent();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async getBackupLogFileContent(): Promise<string> {
|
|
51
|
-
return await logger.getBackupLogFileContent();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async clearLogFile(): Promise<void> {
|
|
55
|
-
await logger.clearLogFile();
|
|
56
|
-
}
|
|
57
|
-
}
|