@unvired/react-native-wrapper-sdk 0.0.7 → 0.0.9

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 (33) hide show
  1. package/dist/UnviredWrapper.d.ts +7 -12
  2. package/dist/UnviredWrapper.d.ts.map +1 -1
  3. package/dist/UnviredWrapper.js +28 -32
  4. package/dist/core/UnviredSDK.d.ts +107 -0
  5. package/dist/core/UnviredSDK.d.ts.map +1 -0
  6. package/dist/core/UnviredSDK.js +24 -0
  7. package/dist/core/platform/CordovaPlatformAdapter.d.ts +13 -0
  8. package/dist/core/platform/CordovaPlatformAdapter.d.ts.map +1 -0
  9. package/dist/core/platform/CordovaPlatformAdapter.js +62 -0
  10. package/dist/core/platform/PlatformInterface.d.ts +12 -0
  11. package/dist/core/platform/PlatformInterface.d.ts.map +1 -0
  12. package/dist/core/platform/PlatformInterface.js +2 -0
  13. package/dist/core/platform/PlatformManager.d.ts +10 -0
  14. package/dist/core/platform/PlatformManager.d.ts.map +1 -0
  15. package/dist/core/platform/PlatformManager.js +29 -0
  16. package/dist/core/platform/ReactNativePlatformAdapter.d.ts +13 -0
  17. package/dist/core/platform/ReactNativePlatformAdapter.d.ts.map +1 -0
  18. package/dist/core/platform/ReactNativePlatformAdapter.js +47 -0
  19. package/dist/index.d.ts +3 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +6 -0
  22. package/dist/lib/AuthBuilder.d.ts +6 -42
  23. package/dist/lib/AuthBuilder.d.ts.map +1 -1
  24. package/dist/lib/AuthBuilder.js +7 -28
  25. package/package.json +1 -1
  26. package/src/UnviredWrapper.ts +36 -35
  27. package/src/core/UnviredSDK.ts +126 -0
  28. package/src/core/platform/CordovaPlatformAdapter.ts +69 -0
  29. package/src/core/platform/PlatformInterface.ts +12 -0
  30. package/src/core/platform/PlatformManager.ts +35 -0
  31. package/src/core/platform/ReactNativePlatformAdapter.ts +57 -0
  32. package/src/index.ts +5 -0
  33. package/src/lib/AuthBuilder.ts +28 -66
@@ -1,30 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LoginType = exports.LoginParameters = void 0;
4
- const unvired_ts_core_sdk_1 = require("@unvired/unvired-ts-core-sdk");
5
- /**
6
- * LoginParameters class - Local definition to avoid module resolution issues
7
- */
8
- class LoginParameters {
9
- }
10
- exports.LoginParameters = LoginParameters;
11
- /**
12
- * LoginType enum for different authentication types
13
- */
14
- var LoginType;
15
- (function (LoginType) {
16
- LoginType["UNVIRED"] = "UNVIRED";
17
- LoginType["LDAP"] = "LDAP";
18
- LoginType["SSO"] = "SSO";
19
- })(LoginType || (exports.LoginType = LoginType = {}));
20
- /**
21
- * AuthBuilder - Fluent API for building authentication requests
22
- * Can be awaited directly without calling .execute()
23
- */
3
+ const UnviredSDK_1 = require("./../core/UnviredSDK");
24
4
  class AuthBuilder {
25
- constructor(method) {
5
+ constructor(sdk, method) {
6
+ this.sdk = sdk;
26
7
  this.method = method;
27
- this.loginParameters = new LoginParameters();
8
+ this.loginParameters = new UnviredSDK_1.LoginParameters();
28
9
  }
29
10
  setAppName(appName) {
30
11
  this.loginParameters.appName = appName;
@@ -115,15 +96,13 @@ class AuthBuilder {
115
96
  return this;
116
97
  }
117
98
  execute() {
118
- // Get the singleton instance and call the appropriate authentication method
119
- const authService = unvired_ts_core_sdk_1.AuthenticationService.instance;
120
99
  switch (this.method) {
121
100
  case 'login':
122
- return authService.login(this.loginParameters);
101
+ return this.sdk.login(this.loginParameters);
123
102
  case 'authenticateAndActivate':
124
- return authService.authenticateAndActivate(this.loginParameters);
103
+ return this.sdk.authenticateAndActivate(this.loginParameters);
125
104
  case 'authenticateLocal':
126
- return authService.authenticateLocal(this.loginParameters);
105
+ return this.sdk.authenticateLocal(this.loginParameters);
127
106
  default:
128
107
  return Promise.reject(new Error(`Unknown method: ${this.method}`));
129
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unvired/react-native-wrapper-sdk",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Unvired SDK for React Native - Enterprise mobile platform SDK with authentication, sync, and offline database",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,13 +1,19 @@
1
- import AuthBuilder from './lib/AuthBuilder';
2
- import { AuthenticationService, PlatformManager } from '@unvired/unvired-ts-core-sdk';
1
+ import UnviredSDK from './core/UnviredSDK';
2
+ import AuthBuilder from './lib/AuthBuilder';
3
+
4
+ import PlatformInterface from '@unvired/unvired-ts-core-sdk/platform/PlatformManager';
5
+
3
6
 
4
- /**
5
- * React Native Wrapper for Unvired Core SDK
6
- * Provides a clean, fluent API for React Native applications
7
- */
8
7
  export class UnviredWrapper {
8
+ private unviredSDK: UnviredSDK;
9
+
9
10
  constructor() {
10
- // AuthenticationService is a singleton, accessed via static instance getter
11
+ this.unviredSDK = new UnviredSDK();
12
+ }
13
+
14
+ private static get logger() {
15
+ console.log('PlatformInterface from core SDK', PlatformInterface);
16
+ return UnviredSDK.getPlatformManager().getPlatformAdapter();
11
17
  }
12
18
 
13
19
  /**
@@ -15,7 +21,7 @@ export class UnviredWrapper {
15
21
  * Can be awaited directly: await sdk.login().setAppName("my-app")
16
22
  */
17
23
  login(): AuthBuilder {
18
- return new AuthBuilder('login');
24
+ return new AuthBuilder(this.unviredSDK, 'login');
19
25
  }
20
26
 
21
27
  /**
@@ -23,7 +29,7 @@ export class UnviredWrapper {
23
29
  * Can be awaited directly: await sdk.authenticateAndActivate().setUsername("demo")
24
30
  */
25
31
  authenticateAndActivate(): AuthBuilder {
26
- return new AuthBuilder('authenticateAndActivate');
32
+ return new AuthBuilder(this.unviredSDK, 'authenticateAndActivate');
27
33
  }
28
34
 
29
35
  /**
@@ -31,57 +37,52 @@ export class UnviredWrapper {
31
37
  * Can be awaited directly: await sdk.authenticateLocal().setUsername("demo")
32
38
  */
33
39
  authenticateLocal(): AuthBuilder {
34
- return new AuthBuilder('authenticateLocal');
40
+ return new AuthBuilder(this.unviredSDK, 'authenticateLocal');
35
41
  }
36
42
 
37
- /**
38
- * Logout method - Logs out the current user
39
- */
40
- async logout(): Promise<any> {
41
- const authService = (AuthenticationService as any).instance;
42
- return authService.logout();
43
- }
44
-
45
- /**
46
- * Clear all data
47
- */
48
- async clearData(): Promise<any> {
49
- const authService = (AuthenticationService as any).instance;
50
- return authService.clearData();
51
- }
52
-
53
- // Logging methods - delegating to PlatformManager's adapter
54
43
  static logInfo(className: string, methodName: string, message: string) {
55
- return PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().logInfo(className, methodName, message);
44
+
45
+ console.log('PlatformInterface from core SDK', PlatformInterface);
46
+ this.logger.logInfo(className, methodName, message);
56
47
  }
57
48
 
58
49
  static logError(className: string, methodName: string, message: string) {
59
- return PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().logError(className, methodName, message);
50
+ this.logger.logError(className, methodName, message);
60
51
  }
61
52
 
62
53
  static logDebug(className: string, methodName: string, message: string) {
63
- return PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().logDebug(className, methodName, message);
54
+ this.logger.logDebug(className, methodName, message);
64
55
  }
65
56
 
57
+ static logWarning(className: string, methodName: string, message: string) {
58
+ this.logger.logWarning(className, methodName, message);
59
+ }
66
60
 
67
61
  static setLogLevel(level: string) {
68
- return PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().setLogLevel(level);
62
+ this.logger.setLogLevel(level);
69
63
  }
70
64
 
71
65
  static async getLogFileURL(): Promise<string> {
72
- return PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().getLogFileURL();
66
+ return this.logger.getLogFileURL();
73
67
  }
74
68
 
75
69
  static async getLogFileContent(): Promise<string> {
76
- return PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().getLogFileContent();
70
+ return this.logger.getLogFileContent();
77
71
  }
78
72
 
79
73
  static async getBackupLogFileContent(): Promise<string> {
80
- return PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().getBackupLogFileContent();
74
+ return this.logger.getBackupLogFileContent();
81
75
  }
82
76
 
83
77
  static async clearLogFile(): Promise<void> {
84
- return PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().clearLogFile();
78
+ return this.logger.clearLogFile();
79
+ }
80
+
81
+ /**
82
+ * Logout method - Calls CoreWebSDK
83
+ */
84
+ async logout(): Promise<boolean> {
85
+ return this.unviredSDK.logout();
85
86
  }
86
87
  }
87
88
 
@@ -0,0 +1,126 @@
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;
@@ -0,0 +1,69 @@
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
+ }
@@ -0,0 +1,12 @@
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
+ }
@@ -0,0 +1,35 @@
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());
@@ -0,0 +1,57 @@
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
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  // Export main SDK
2
2
  import UnviredWrapper from './UnviredWrapper';
3
+
4
+ export { LoginParameters, LoginType } from './core/UnviredSDK';
5
+
3
6
  // Export the default SDK instance
4
7
  export default UnviredWrapper;
5
8
 
9
+ import UMP from '@unvired/unvired-ts-core-sdk';
10
+ export { UMP };
@@ -1,50 +1,15 @@
1
- import { AuthenticationService } from '@unvired/unvired-ts-core-sdk';
2
-
3
- /**
4
- * LoginParameters class - Local definition to avoid module resolution issues
5
- */
6
- export class LoginParameters {
7
- appName?: string;
8
- company?: string;
9
- username?: string;
10
- password?: string;
11
- url?: string;
12
- domain?: string;
13
- loginType?: string;
14
- feUserId?: string;
15
- port?: string;
16
- metadataPath?: string;
17
- isRequiredAttachmentBase64?: boolean;
18
- autoSendTime?: string;
19
- autoSyncTime?: string;
20
- metadataJSON?: string;
21
- demoData?: string;
22
- demoModeRequired?: boolean;
23
- persistWebDb?: boolean;
24
- jwtOptions?: object;
25
- loginLanguage?: string;
26
- cacheWebData?: boolean;
27
- requireClientCredentials?: boolean;
28
- }
29
-
30
- /**
31
- * LoginType enum for different authentication types
32
- */
33
- export enum LoginType {
34
- UNVIRED = 'UNVIRED',
35
- LDAP = 'LDAP',
36
- SSO = 'SSO'
37
- }
1
+ import UnviredSDK, { LoginParameters, LoginType } from './../core/UnviredSDK';
38
2
 
39
- /**
40
- * AuthBuilder - Fluent API for building authentication requests
41
- * Can be awaited directly without calling .execute()
42
- */
43
- export default class AuthBuilder implements PromiseLike<any> {
3
+ export default class AuthBuilder implements PromiseLike<string> {
4
+ private sdk: UnviredSDK;
44
5
  private method: 'login' | 'authenticateAndActivate' | 'authenticateLocal';
45
6
  private loginParameters: LoginParameters;
46
7
 
47
- constructor(method: 'login' | 'authenticateAndActivate' | 'authenticateLocal') {
8
+ constructor(
9
+ sdk: UnviredSDK,
10
+ method: 'login' | 'authenticateAndActivate' | 'authenticateLocal'
11
+ ) {
12
+ this.sdk = sdk;
48
13
  this.method = method;
49
14
  this.loginParameters = new LoginParameters();
50
15
  }
@@ -80,7 +45,7 @@ export default class AuthBuilder implements PromiseLike<any> {
80
45
  }
81
46
 
82
47
  setLoginType(loginType: LoginType): AuthBuilder {
83
- this.loginParameters.loginType = loginType as any;
48
+ this.loginParameters.loginType = loginType;
84
49
  return this;
85
50
  }
86
51
 
@@ -95,88 +60,85 @@ export default class AuthBuilder implements PromiseLike<any> {
95
60
  }
96
61
 
97
62
  setMetadataPath(metadataPath: string): AuthBuilder {
98
- (this.loginParameters as any).metadataPath = metadataPath;
63
+ this.loginParameters.metadataPath = metadataPath;
99
64
  return this;
100
65
  }
101
66
 
102
67
  setIsRequiredAttachmentBase64(isRequiredAttachmentBase64: boolean): AuthBuilder {
103
- (this.loginParameters as any).isRequiredAttachmentBase64 = isRequiredAttachmentBase64;
68
+ this.loginParameters.isRequiredAttachmentBase64 = isRequiredAttachmentBase64;
104
69
  return this;
105
70
  }
106
71
 
107
72
  setAutoSendTime(autoSendTime: string): AuthBuilder {
108
- (this.loginParameters as any).autoSendTime = autoSendTime;
73
+ this.loginParameters.autoSendTime = autoSendTime;
109
74
  return this;
110
75
  }
111
76
 
112
77
  setAutoSyncTime(autoSyncTime: string): AuthBuilder {
113
- (this.loginParameters as any).autoSyncTime = autoSyncTime;
78
+ this.loginParameters.autoSyncTime = autoSyncTime;
114
79
  return this;
115
80
  }
116
81
 
117
82
  setMetadataJSON(metadataJSON: string): AuthBuilder {
118
- (this.loginParameters as any).metadataJSON = metadataJSON;
83
+ this.loginParameters.metadataJSON = metadataJSON;
119
84
  return this;
120
85
  }
121
86
 
122
87
  setDemoData(demoData: string): AuthBuilder {
123
- (this.loginParameters as any).demoData = demoData;
88
+ this.loginParameters.demoData = demoData;
124
89
  return this;
125
90
  }
126
91
 
127
92
  setDemoModeRequired(demoModeRequired: boolean): AuthBuilder {
128
- (this.loginParameters as any).demoModeRequired = demoModeRequired;
93
+ this.loginParameters.demoModeRequired = demoModeRequired;
129
94
  return this;
130
95
  }
131
96
 
132
97
  setPersistWebDb(persistWebDb: boolean): AuthBuilder {
133
- (this.loginParameters as any).persistWebDb = persistWebDb;
98
+ this.loginParameters.persistWebDb = persistWebDb;
134
99
  return this;
135
100
  }
136
101
 
137
102
  setJwtOptions(jwtOptions: object): AuthBuilder {
138
- (this.loginParameters as any).jwtOptions = jwtOptions;
103
+ this.loginParameters.jwtOptions = jwtOptions;
139
104
  return this;
140
105
  }
141
106
 
142
107
  setLoginLanguage(loginLanguage: string): AuthBuilder {
143
- (this.loginParameters as any).loginLanguage = loginLanguage;
108
+ this.loginParameters.loginLanguage = loginLanguage;
144
109
  return this;
145
110
  }
146
111
 
147
112
  setCacheWebData(cacheWebData: boolean): AuthBuilder {
148
- (this.loginParameters as any).cacheWebData = cacheWebData;
113
+ this.loginParameters.cacheWebData = cacheWebData;
149
114
  return this;
150
115
  }
151
116
 
152
117
  setRequireClientCredentials(requireClientCredentials: boolean): AuthBuilder {
153
- (this.loginParameters as any).requireClientCredentials = requireClientCredentials;
118
+ this.loginParameters.requireClientCredentials = requireClientCredentials;
154
119
  return this;
155
120
  }
156
121
 
157
- setItem(key: string, value: any): AuthBuilder {
122
+ setItem(key: keyof LoginParameters, value: any): AuthBuilder {
158
123
  (this.loginParameters as any)[key] = value;
159
124
  return this;
160
125
  }
161
126
 
162
- private execute(): Promise<any> {
163
- // Get the singleton instance and call the appropriate authentication method
164
- const authService = (AuthenticationService as any).instance;
165
-
127
+ private execute(): Promise<string> {
166
128
  switch (this.method) {
167
129
  case 'login':
168
- return authService.login(this.loginParameters);
130
+ return this.sdk.login(this.loginParameters);
169
131
  case 'authenticateAndActivate':
170
- return authService.authenticateAndActivate(this.loginParameters);
132
+ return this.sdk.authenticateAndActivate(this.loginParameters);
171
133
  case 'authenticateLocal':
172
- return authService.authenticateLocal(this.loginParameters);
134
+ return this.sdk.authenticateLocal(this.loginParameters);
173
135
  default:
174
136
  return Promise.reject(new Error(`Unknown method: ${this.method}`));
175
137
  }
176
138
  }
177
139
 
178
- then<TResult1 = any, TResult2 = never>(
179
- onfulfilled?: ((value: any) => TResult1 | PromiseLike<TResult1>) | undefined | null,
140
+ then<TResult1 = string, TResult2 = never>(
141
+ onfulfilled?: ((value: string) => TResult1 | PromiseLike<TResult1>) | undefined | null,
180
142
  onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null
181
143
  ): PromiseLike<TResult1 | TResult2> {
182
144
  return this.execute().then(onfulfilled, onrejected);