@unvired/react-native-wrapper-sdk 0.0.2

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 (34) hide show
  1. package/README.md +315 -0
  2. package/dist/UnviredWrapper.d.ts +36 -0
  3. package/dist/UnviredWrapper.d.ts.map +1 -0
  4. package/dist/UnviredWrapper.js +72 -0
  5. package/dist/core/UnviredSDK.d.ts +107 -0
  6. package/dist/core/UnviredSDK.d.ts.map +1 -0
  7. package/dist/core/UnviredSDK.js +24 -0
  8. package/dist/core/platform/CordovaPlatformAdapter.d.ts +13 -0
  9. package/dist/core/platform/CordovaPlatformAdapter.d.ts.map +1 -0
  10. package/dist/core/platform/CordovaPlatformAdapter.js +62 -0
  11. package/dist/core/platform/PlatformInterface.d.ts +12 -0
  12. package/dist/core/platform/PlatformInterface.d.ts.map +1 -0
  13. package/dist/core/platform/PlatformInterface.js +2 -0
  14. package/dist/core/platform/PlatformManager.d.ts +10 -0
  15. package/dist/core/platform/PlatformManager.d.ts.map +1 -0
  16. package/dist/core/platform/PlatformManager.js +29 -0
  17. package/dist/core/platform/ReactNativePlatformAdapter.d.ts +13 -0
  18. package/dist/core/platform/ReactNativePlatformAdapter.d.ts.map +1 -0
  19. package/dist/core/platform/ReactNativePlatformAdapter.js +47 -0
  20. package/dist/index.d.ts +4 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +13 -0
  23. package/dist/lib/AuthBuilder.d.ts +32 -0
  24. package/dist/lib/AuthBuilder.d.ts.map +1 -0
  25. package/dist/lib/AuthBuilder.js +114 -0
  26. package/package.json +55 -0
  27. package/src/UnviredWrapper.ts +83 -0
  28. package/src/core/UnviredSDK.ts +126 -0
  29. package/src/core/platform/CordovaPlatformAdapter.ts +69 -0
  30. package/src/core/platform/PlatformInterface.ts +12 -0
  31. package/src/core/platform/PlatformManager.ts +35 -0
  32. package/src/core/platform/ReactNativePlatformAdapter.ts +57 -0
  33. package/src/index.ts +7 -0
  34. package/src/lib/AuthBuilder.ts +146 -0
package/README.md ADDED
@@ -0,0 +1,315 @@
1
+ # React Native Unvired SDK
2
+
3
+ A lightweight React Native wrapper for the Unvired SDK with builder pattern implementation.
4
+
5
+ ## Architecture
6
+
7
+ This SDK follows a three-layer architecture:
8
+
9
+ ```
10
+ RN App ←→ RN Wrapper ←→ Core Web SDK (TS) ←→ Native Implementation
11
+ ```
12
+
13
+ - **RN App**: Your React Native application
14
+ - **RN Wrapper**: `UnviredSDK` class (this package)
15
+ - **Core Web SDK**: `CoreWebSDK` class - JS interface layer
16
+ - **Native Implementation**: Platform-specific implementations (iOS/Android)
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ npm install react-native-wrapper-sdk
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ### Basic Login Example
27
+
28
+ ```typescript
29
+ import UnviredSDK from 'react-native-wrapper-sdk';
30
+
31
+ // Create and configure SDK using builder pattern
32
+ const sdk = UnviredSDK.create()
33
+ .setServerUrl('https://api.unvired.io')
34
+ .setAppId('my-app-123')
35
+ .setTimeout(30000)
36
+ .enableLogging(true)
37
+ .build();
38
+
39
+ // Login
40
+ const response = await sdk.login({
41
+ username: 'demo',
42
+ password: 'demo123',
43
+ company: 'Unvired Inc.',
44
+ });
45
+
46
+ if (response.success) {
47
+ console.log('Login successful!');
48
+ console.log('Session Token:', response.sessionToken);
49
+ console.log('User ID:', response.userId);
50
+ } else {
51
+ console.log('Login failed:', response.message);
52
+ }
53
+ ```
54
+
55
+ ## API Reference
56
+
57
+ ### Builder Methods
58
+
59
+ The SDK uses a builder pattern for configuration. All builder methods return the builder instance for chaining.
60
+
61
+ #### `UnviredSDK.create()`
62
+ Creates a new SDK builder instance.
63
+
64
+ ```typescript
65
+ const builder = UnviredSDK.create();
66
+ ```
67
+
68
+ #### `setServerUrl(url: string)`
69
+ Sets the server URL for API calls.
70
+
71
+ ```typescript
72
+ builder.setServerUrl('https://api.unvired.io');
73
+ ```
74
+
75
+ #### `setAppId(appId: string)`
76
+ Sets the application ID.
77
+
78
+ ```typescript
79
+ builder.setAppId('my-app-123');
80
+ ```
81
+
82
+ #### `setTimeout(timeout: number)`
83
+ Sets the request timeout in milliseconds (default: 30000).
84
+
85
+ ```typescript
86
+ builder.setTimeout(60000); // 60 seconds
87
+ ```
88
+
89
+ #### `enableLogging(enable: boolean)`
90
+ Enables or disables SDK logging (default: false).
91
+
92
+ ```typescript
93
+ builder.enableLogging(true);
94
+ ```
95
+
96
+ #### `build()`
97
+ Builds and returns the SDK instance. Must be called after configuration.
98
+
99
+ ```typescript
100
+ const sdk = builder.build();
101
+ ```
102
+
103
+ ### Login Builder (Recommended)
104
+
105
+ The SDK provides a builder pattern for constructing login credentials, which avoids passing empty objects for optional parameters.
106
+
107
+ ```typescript
108
+ const response = await sdk.loginBuilder()
109
+ .setUsername('demo')
110
+ .setPassword('demo123')
111
+ .setCompany('Unvired Inc.') // Optional
112
+ .execute();
113
+ ```
114
+
115
+ ### SDK Instance Methods
116
+
117
+ #### `loginBuilder(): LoginBuilder`
118
+ Returns a builder to construct login credentials.
119
+
120
+ **Methods:**
121
+ - `setUsername(username: string): LoginBuilder`
122
+ - `setPassword(password: string): LoginBuilder`
123
+ - `setCompany(company: string): LoginBuilder`
124
+ - `execute(): Promise<LoginResponse>`
125
+
126
+ #### `login(credentials: LoginCredentials): Promise<LoginResponse>`
127
+ *Legacy method.* Authenticates a user with the provided credentials object.
128
+
129
+ **Parameters:**
130
+ ```typescript
131
+ interface LoginCredentials {
132
+ username: string;
133
+ password: string;
134
+ company?: string;
135
+ }
136
+ ```
137
+
138
+ **Returns:**
139
+ ```typescript
140
+ interface LoginResponse {
141
+ success: boolean;
142
+ message: string;
143
+ sessionToken?: string;
144
+ userId?: string;
145
+ error?: string;
146
+ }
147
+ ```
148
+
149
+ **Example:**
150
+ ```typescript
151
+ const response = await sdk.login({
152
+ username: 'demo',
153
+ password: 'demo123',
154
+ });
155
+ ```
156
+
157
+ #### `logout(): Promise<boolean>`
158
+ Logs out the current user and clears the session.
159
+
160
+ **Returns:** `Promise<boolean>` - true if logout was successful
161
+
162
+ **Example:**
163
+ ```typescript
164
+ const success = await sdk.logout();
165
+ ```
166
+
167
+ #### `isAuthenticated(): Promise<boolean>`
168
+ Checks if a user is currently authenticated.
169
+
170
+ **Returns:** `Promise<boolean>` - true if authenticated
171
+
172
+ **Example:**
173
+ ```typescript
174
+ const isAuth = await sdk.isAuthenticated();
175
+ ```
176
+
177
+ #### `getConfig(): SDKConfig`
178
+ Returns the current SDK configuration.
179
+
180
+ **Returns:**
181
+ ```typescript
182
+ interface SDKConfig {
183
+ serverUrl?: string;
184
+ timeout?: number;
185
+ enableLogging?: boolean;
186
+ appId?: string;
187
+ }
188
+ ```
189
+
190
+ ## Usage Examples
191
+
192
+ ### Complete Login/Logout Flow
193
+
194
+ ```typescript
195
+ import UnviredSDK from 'react-native-wrapper-sdk';
196
+
197
+ async function loginLogoutExample() {
198
+ // Build SDK
199
+ const sdk = UnviredSDK.create()
200
+ .setServerUrl('https://api.unvired.io')
201
+ .setAppId('my-app-123')
202
+ .enableLogging(true)
203
+ .build();
204
+
205
+ // Login
206
+ const loginResponse = await sdk.login({
207
+ username: 'demo',
208
+ password: 'demo123',
209
+ });
210
+
211
+ if (loginResponse.success) {
212
+ console.log('Logged in successfully');
213
+
214
+ // Check authentication
215
+ const isAuth = await sdk.isAuthenticated();
216
+ console.log('Is Authenticated:', isAuth); // true
217
+
218
+ // Logout
219
+ await sdk.logout();
220
+
221
+ // Check authentication again
222
+ const isAuthAfterLogout = await sdk.isAuthenticated();
223
+ console.log('Is Authenticated:', isAuthAfterLogout); // false
224
+ }
225
+ }
226
+ ```
227
+
228
+ ### Multiple SDK Instances
229
+
230
+ You can create multiple SDK instances with different configurations:
231
+
232
+ ```typescript
233
+ // Production instance
234
+ const prodSDK = UnviredSDK.create()
235
+ .setServerUrl('https://api.unvired.io')
236
+ .setAppId('prod-app')
237
+ .build();
238
+
239
+ // Staging instance
240
+ const stagingSDK = UnviredSDK.create()
241
+ .setServerUrl('https://staging-api.unvired.io')
242
+ .setAppId('staging-app')
243
+ .enableLogging(true)
244
+ .build();
245
+ ```
246
+
247
+ ### Error Handling
248
+
249
+ ```typescript
250
+ try {
251
+ const response = await sdk.login({
252
+ username: 'user',
253
+ password: 'pass',
254
+ });
255
+
256
+ if (!response.success) {
257
+ console.error('Login failed:', response.error);
258
+ }
259
+ } catch (error) {
260
+ console.error('Unexpected error:', error);
261
+ }
262
+ ```
263
+
264
+ ## TypeScript Support
265
+
266
+ This SDK is written in TypeScript and includes full type definitions. All interfaces are exported for your use:
267
+
268
+ ```typescript
269
+ import UnviredSDK, {
270
+ LoginCredentials,
271
+ LoginResponse,
272
+ SDKConfig,
273
+ UnviredSDKBuilder,
274
+ UnviredSDKInstance,
275
+ } from 'react-native-wrapper-sdk';
276
+ ```
277
+
278
+ ## Development
279
+
280
+ ### Build
281
+
282
+ ```bash
283
+ npm run build
284
+ ```
285
+
286
+ This compiles the TypeScript source to JavaScript in the `dist` directory.
287
+
288
+ ### Project Structure
289
+
290
+ ```
291
+ src/
292
+ ├── index.ts # Main entry point
293
+ ├── UnviredSDK.ts # RN Wrapper with builder pattern
294
+ ├── LoginBuilder.ts # Login Builder implementation
295
+ core/
296
+ ├── CoreWebSDK.ts # Core Web SDK (JS interface layer)
297
+ ├── types.ts # TypeScript type definitions
298
+ ```
299
+
300
+ ## Dummy Login Credentials
301
+
302
+ For testing purposes, use these credentials:
303
+
304
+ - **Username**: `demo`
305
+ - **Password**: `demo123`
306
+
307
+ Any other credentials will result in an authentication failure.
308
+
309
+ ## License
310
+
311
+ UNLICENSED
312
+
313
+ ## Author
314
+
315
+ Unvired Inc.
@@ -0,0 +1,36 @@
1
+ import AuthBuilder from './lib/AuthBuilder';
2
+ export declare class UnviredWrapper {
3
+ private unviredSDK;
4
+ constructor();
5
+ private static get logger();
6
+ /**
7
+ * Returns a builder for login method
8
+ * Can be awaited directly: await sdk.login().setAppName("my-app")
9
+ */
10
+ login(): AuthBuilder;
11
+ /**
12
+ * Returns a builder for authenticateAndActivate method
13
+ * Can be awaited directly: await sdk.authenticateAndActivate().setUsername("demo")
14
+ */
15
+ authenticateAndActivate(): AuthBuilder;
16
+ /**
17
+ * Returns a builder for authenticateLocal method
18
+ * Can be awaited directly: await sdk.authenticateLocal().setUsername("demo")
19
+ */
20
+ authenticateLocal(): AuthBuilder;
21
+ static logInfo(className: string, methodName: string, message: string): void;
22
+ static logError(className: string, methodName: string, message: string): void;
23
+ static logDebug(className: string, methodName: string, message: string): void;
24
+ static logWarning(className: string, methodName: string, message: string): void;
25
+ static setLogLevel(level: string): void;
26
+ static getLogFileURL(): Promise<string>;
27
+ static getLogFileContent(): Promise<string>;
28
+ static getBackupLogFileContent(): Promise<string>;
29
+ static clearLogFile(): Promise<void>;
30
+ /**
31
+ * Logout method - Calls CoreWebSDK
32
+ */
33
+ logout(): Promise<boolean>;
34
+ }
35
+ export default UnviredWrapper;
36
+ //# sourceMappingURL=UnviredWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnviredWrapper.d.ts","sourceRoot":"","sources":["../src/UnviredWrapper.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAa;;IAM/B,OAAO,CAAC,MAAM,KAAK,MAAM,GAExB;IAED;;;OAGG;IACH,KAAK,IAAI,WAAW;IAIpB;;;OAGG;IACH,uBAAuB,IAAI,WAAW;IAItC;;;OAGG;IACH,iBAAiB,IAAI,WAAW;IAIhC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAIrE,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAItE,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAItE,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAIxE,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM;WAInB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;WAIhC,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;WAIpC,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;WAI1C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;CAGjC;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UnviredWrapper = void 0;
7
+ const UnviredSDK_1 = __importDefault(require("./core/UnviredSDK"));
8
+ const AuthBuilder_1 = __importDefault(require("./lib/AuthBuilder"));
9
+ class UnviredWrapper {
10
+ constructor() {
11
+ this.unviredSDK = new UnviredSDK_1.default();
12
+ }
13
+ static get logger() {
14
+ return UnviredSDK_1.default.getPlatformManager().getPlatformAdapter();
15
+ }
16
+ /**
17
+ * Returns a builder for login method
18
+ * Can be awaited directly: await sdk.login().setAppName("my-app")
19
+ */
20
+ login() {
21
+ return new AuthBuilder_1.default(this.unviredSDK, 'login');
22
+ }
23
+ /**
24
+ * Returns a builder for authenticateAndActivate method
25
+ * Can be awaited directly: await sdk.authenticateAndActivate().setUsername("demo")
26
+ */
27
+ authenticateAndActivate() {
28
+ return new AuthBuilder_1.default(this.unviredSDK, 'authenticateAndActivate');
29
+ }
30
+ /**
31
+ * Returns a builder for authenticateLocal method
32
+ * Can be awaited directly: await sdk.authenticateLocal().setUsername("demo")
33
+ */
34
+ authenticateLocal() {
35
+ return new AuthBuilder_1.default(this.unviredSDK, 'authenticateLocal');
36
+ }
37
+ static logInfo(className, methodName, message) {
38
+ this.logger.logInfo(className, methodName, message);
39
+ }
40
+ static logError(className, methodName, message) {
41
+ this.logger.logError(className, methodName, message);
42
+ }
43
+ static logDebug(className, methodName, message) {
44
+ this.logger.logDebug(className, methodName, message);
45
+ }
46
+ static logWarning(className, methodName, message) {
47
+ this.logger.logWarning(className, methodName, message);
48
+ }
49
+ static setLogLevel(level) {
50
+ this.logger.setLogLevel(level);
51
+ }
52
+ static async getLogFileURL() {
53
+ return this.logger.getLogFileURL();
54
+ }
55
+ static async getLogFileContent() {
56
+ return this.logger.getLogFileContent();
57
+ }
58
+ static async getBackupLogFileContent() {
59
+ return this.logger.getBackupLogFileContent();
60
+ }
61
+ static async clearLogFile() {
62
+ return this.logger.clearLogFile();
63
+ }
64
+ /**
65
+ * Logout method - Calls CoreWebSDK
66
+ */
67
+ async logout() {
68
+ return this.unviredSDK.logout();
69
+ }
70
+ }
71
+ exports.UnviredWrapper = UnviredWrapper;
72
+ exports.default = UnviredWrapper;
@@ -0,0 +1,107 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,24 @@
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;
@@ -0,0 +1,13 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,62 @@
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;
@@ -0,0 +1,12 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
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
@@ -0,0 +1 @@
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"}