vwo-fme-react-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/LICENSE +202 -0
- package/NOTICE +18 -0
- package/README.md +352 -0
- package/dist/VWOContext.d.ts +24 -0
- package/dist/VWOProvider.d.ts +35 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +8 -0
- package/dist/logger/LogMessageBuilder.d.ts +63 -0
- package/dist/logger/Logger.d.ts +46 -0
- package/dist/logger/core/LogManager.d.ts +100 -0
- package/dist/logger/core/TransportManager.d.ts +80 -0
- package/dist/logger/enums/LogLevelEnum.d.ts +22 -0
- package/dist/logger/index.d.ts +17 -0
- package/dist/logger/transports/ConsoleTransport.d.ts +60 -0
- package/dist/services/loggerService.d.ts +35 -0
- package/dist/types/Common.d.ts +36 -0
- package/dist/useGetFlag.d.ts +21 -0
- package/dist/useGetFlagVariable.d.ts +29 -0
- package/dist/useSetAttribute.d.ts +20 -0
- package/dist/useTrackEvent.d.ts +21 -0
- package/dist/useVWOClient.d.ts +20 -0
- package/dist/utils/DataTypeUtil.d.ts +38 -0
- package/dist/vwo-fme-react-sdk.cjs.development.js +904 -0
- package/dist/vwo-fme-react-sdk.cjs.development.js.map +1 -0
- package/dist/vwo-fme-react-sdk.cjs.production.min.js +904 -0
- package/dist/vwo-fme-react-sdk.cjs.production.min.js.map +1 -0
- package/dist/vwo-fme-react-sdk.esm.js +886 -0
- package/dist/vwo-fme-react-sdk.esm.js.map +1 -0
- package/lib/VWOContext.ts +47 -0
- package/lib/VWOProvider.tsx +103 -0
- package/lib/index.ts +29 -0
- package/lib/logger/LogMessageBuilder.ts +99 -0
- package/lib/logger/Logger.ts +51 -0
- package/lib/logger/core/LogManager.ts +164 -0
- package/lib/logger/core/TransportManager.ts +142 -0
- package/lib/logger/enums/LogLevelEnum.ts +23 -0
- package/lib/logger/index.ts +18 -0
- package/lib/logger/transports/ConsoleTransport.ts +85 -0
- package/lib/services/LoggerService.ts +49 -0
- package/lib/types/Common.ts +42 -0
- package/lib/useGetFlag.ts +81 -0
- package/lib/useGetFlagVariable.ts +65 -0
- package/lib/useSetAttribute.ts +48 -0
- package/lib/useTrackEvent.ts +52 -0
- package/lib/useVWOClient.ts +41 -0
- package/lib/utils/DataTypeUtil.ts +48 -0
- package/package.json +84 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ReactNode } from 'react';
|
|
17
|
+
/**
|
|
18
|
+
* Props for VWOProvider
|
|
19
|
+
*/
|
|
20
|
+
interface VWOProviderProps {
|
|
21
|
+
client?: any;
|
|
22
|
+
config?: any;
|
|
23
|
+
context: any;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* VWOProvider component to provide the VWO SDK instance and context to the app
|
|
28
|
+
* @param client - VWO SDK instance
|
|
29
|
+
* @param config - VWO SDK config (initialization config)
|
|
30
|
+
* @param context - VWO SDK context (userContext)
|
|
31
|
+
* @param children - React children (ReactNode)
|
|
32
|
+
* @returns VWOProvider component
|
|
33
|
+
*/
|
|
34
|
+
export declare const VWOProvider: ({ client, config, context, children }: VWOProviderProps) => any;
|
|
35
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { VWOProvider } from './VWOProvider';
|
|
17
|
+
export { useVWOClient } from './useVWOClient';
|
|
18
|
+
export { useGetFlag } from './useGetFlag';
|
|
19
|
+
export { useGetFlagVariable } from './useGetFlagVariable';
|
|
20
|
+
export { useGetFlagVariables } from './useGetFlagVariable';
|
|
21
|
+
export { useTrackEvent } from './useTrackEvent';
|
|
22
|
+
export { useSetAttribute } from './useSetAttribute';
|
|
23
|
+
export { init } from 'vwo-fme-node-sdk';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { dynamic } from '../types/Common';
|
|
17
|
+
/**
|
|
18
|
+
* Interface defining the structure for a log message builder.
|
|
19
|
+
*/
|
|
20
|
+
interface ILogMessageBuilder {
|
|
21
|
+
loggerConfig: Record<string, dynamic>;
|
|
22
|
+
transportConfig: Record<string, dynamic>;
|
|
23
|
+
prefix: string;
|
|
24
|
+
dateTimeFormat: dynamic;
|
|
25
|
+
formatMessage(level: string, message: string): string;
|
|
26
|
+
getFormattedLevel(level: string): string;
|
|
27
|
+
getFormattedDateTime(): string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Implements the ILogMessageBuilder interface to provide a concrete log message builder.
|
|
31
|
+
*/
|
|
32
|
+
export declare class LogMessageBuilder implements ILogMessageBuilder {
|
|
33
|
+
loggerConfig: Record<string, any>;
|
|
34
|
+
transportConfig: Record<string, any>;
|
|
35
|
+
prefix: string;
|
|
36
|
+
dateTimeFormat: any;
|
|
37
|
+
/**
|
|
38
|
+
* Constructs a new LogMessageBuilder instance.
|
|
39
|
+
* @param {Record<string, any>} loggerConfig - Configuration for the logger.
|
|
40
|
+
* @param {Record<string, any>} transportConfig - Configuration for the transport mechanism.
|
|
41
|
+
*/
|
|
42
|
+
constructor(loggerConfig: Record<string, any>, transportConfig: Record<string, any>);
|
|
43
|
+
/**
|
|
44
|
+
* Formats a log message combining level, prefix, date/time, and the actual message.
|
|
45
|
+
* @param {string} level - The log level.
|
|
46
|
+
* @param {string} message - The message to log.
|
|
47
|
+
* @returns {string} The formatted log message.
|
|
48
|
+
*/
|
|
49
|
+
formatMessage(level: string, message: string): string;
|
|
50
|
+
getFormattedPrefix(prefix: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the formatted log level with appropriate coloring based on the log level.
|
|
53
|
+
* @param {string} level - The log level.
|
|
54
|
+
* @returns {string} The formatted log level.
|
|
55
|
+
*/
|
|
56
|
+
getFormattedLevel(level: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Retrieves the current date and time formatted according to the specified format.
|
|
59
|
+
* @returns {string} The formatted date and time.
|
|
60
|
+
*/
|
|
61
|
+
getFormattedDateTime(): string;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Abstract class representing a logger.
|
|
18
|
+
* This class provides the structure for logging mechanisms and should be extended by specific logger implementations.
|
|
19
|
+
*/
|
|
20
|
+
export declare abstract class Logger {
|
|
21
|
+
/**
|
|
22
|
+
* Logs a message at the trace level.
|
|
23
|
+
* @param {string} message - The message to log.
|
|
24
|
+
*/
|
|
25
|
+
abstract trace(message: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Logs a message at the debug level.
|
|
28
|
+
* @param {string} message - The message to log.
|
|
29
|
+
*/
|
|
30
|
+
abstract debug(message: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Logs a message at the info level.
|
|
33
|
+
* @param {string} message - The message to log.
|
|
34
|
+
*/
|
|
35
|
+
abstract info(message: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Logs a message at the warn level.
|
|
38
|
+
* @param {string} message - The message to log.
|
|
39
|
+
*/
|
|
40
|
+
abstract warn(message: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Logs a message at the error level.
|
|
43
|
+
* @param {string} message - The message to log.
|
|
44
|
+
*/
|
|
45
|
+
abstract error(message: string): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { dynamic } from '../../types/Common';
|
|
17
|
+
import { Logger } from '../Logger';
|
|
18
|
+
import { LogTransportManager } from './TransportManager';
|
|
19
|
+
import { LogLevelEnum } from '../enums/LogLevelEnum';
|
|
20
|
+
/**
|
|
21
|
+
* Interface defining the structure and methods for LogManager.
|
|
22
|
+
*/
|
|
23
|
+
export interface ILogManager {
|
|
24
|
+
transportManager?: LogTransportManager;
|
|
25
|
+
config?: Record<string, dynamic>;
|
|
26
|
+
name?: string;
|
|
27
|
+
requestId?: string;
|
|
28
|
+
level: string;
|
|
29
|
+
prefix?: string;
|
|
30
|
+
dateTimeFormat?: () => string;
|
|
31
|
+
transport?: Record<string, dynamic>;
|
|
32
|
+
transports?: Array<Record<string, dynamic>>;
|
|
33
|
+
addTransport?(transportObject: Record<string, dynamic>): void;
|
|
34
|
+
addTransports?(transportsList: Array<Record<string, dynamic>>): void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* LogManager class provides logging functionality with support for multiple transports.
|
|
38
|
+
* It is designed as a singleton to ensure a single instance throughout the application.
|
|
39
|
+
*/
|
|
40
|
+
export declare class LogManager extends Logger implements ILogManager {
|
|
41
|
+
private static instance;
|
|
42
|
+
transportManager: LogTransportManager;
|
|
43
|
+
config: Record<string, any>;
|
|
44
|
+
name: string;
|
|
45
|
+
requestId: string;
|
|
46
|
+
level: LogLevelEnum;
|
|
47
|
+
prefix: string;
|
|
48
|
+
dateTimeFormat(): string;
|
|
49
|
+
transport: Record<string, any>;
|
|
50
|
+
transports: Array<Record<string, any>>;
|
|
51
|
+
/**
|
|
52
|
+
* Constructor for LogManager.
|
|
53
|
+
* @param {Record<string, any>} config - Configuration object for LogManager.
|
|
54
|
+
*/
|
|
55
|
+
constructor(config?: Record<string, any>);
|
|
56
|
+
/**
|
|
57
|
+
* Provides access to the singleton instance of LogManager.
|
|
58
|
+
* @returns {LogManager} The singleton instance.
|
|
59
|
+
*/
|
|
60
|
+
static get Instance(): LogManager;
|
|
61
|
+
/**
|
|
62
|
+
* Handles the initialization and setup of transports based on configuration.
|
|
63
|
+
*/
|
|
64
|
+
handleTransports(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Adds a single transport to the LogManager.
|
|
67
|
+
* @param {Record<any, any>} transport - The transport object to add.
|
|
68
|
+
*/
|
|
69
|
+
addTransport(transport: Record<any, any>): void;
|
|
70
|
+
/**
|
|
71
|
+
* Adds multiple transports to the LogManager.
|
|
72
|
+
* @param {Array<Record<any, any>>} transports - The list of transport objects to add.
|
|
73
|
+
*/
|
|
74
|
+
addTransports(transports: Record<any, any>): void;
|
|
75
|
+
/**
|
|
76
|
+
* Logs a trace message.
|
|
77
|
+
* @param {string} message - The message to log at trace level.
|
|
78
|
+
*/
|
|
79
|
+
trace(message: string): void;
|
|
80
|
+
/**
|
|
81
|
+
* Logs a debug message.
|
|
82
|
+
* @param {string} message - The message to log at debug level.
|
|
83
|
+
*/
|
|
84
|
+
debug(message: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Logs an informational message.
|
|
87
|
+
* @param {string} message - The message to log at info level.
|
|
88
|
+
*/
|
|
89
|
+
info(message: string): void;
|
|
90
|
+
/**
|
|
91
|
+
* Logs a warning message.
|
|
92
|
+
* @param {string} message - The message to log at warn level.
|
|
93
|
+
*/
|
|
94
|
+
warn(message: string): void;
|
|
95
|
+
/**
|
|
96
|
+
* Logs an error message.
|
|
97
|
+
* @param {string} message - The message to log at error level.
|
|
98
|
+
*/
|
|
99
|
+
error(message: string): void;
|
|
100
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { dynamic } from '../../types/Common';
|
|
17
|
+
import { Logger } from '../Logger';
|
|
18
|
+
interface IlogTransport extends Logger {
|
|
19
|
+
transports: Array<Record<string, dynamic>>;
|
|
20
|
+
config: Record<string, dynamic>;
|
|
21
|
+
shouldLog(transportLevel: string, configLevel: string): boolean;
|
|
22
|
+
log(level: string, message: string): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Manages logging transports and delegates logging messages to them based on configuration.
|
|
26
|
+
* Implements the IlogTransport interface.
|
|
27
|
+
*/
|
|
28
|
+
export declare class LogTransportManager implements IlogTransport {
|
|
29
|
+
transports: Array<Record<string, any>>;
|
|
30
|
+
config: Record<string, any>;
|
|
31
|
+
/**
|
|
32
|
+
* Initializes the manager with a configuration object.
|
|
33
|
+
* @param {Record<string, any>} config - Configuration settings for the log manager.
|
|
34
|
+
*/
|
|
35
|
+
constructor(config: Record<string, any>);
|
|
36
|
+
/**
|
|
37
|
+
* Adds a new transport to the manager.
|
|
38
|
+
* @param {Record<string, any>} transport - The transport object to be added.
|
|
39
|
+
*/
|
|
40
|
+
addTransport(transport: Record<string, any>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Determines if the log should be processed based on the transport and configuration levels.
|
|
43
|
+
* @param {string} transportLevel - The log level set for the transport.
|
|
44
|
+
* @param {string} configLevel - The log level set in the configuration.
|
|
45
|
+
* @returns {boolean} - Returns true if the log level is appropriate for logging, false otherwise.
|
|
46
|
+
*/
|
|
47
|
+
shouldLog(transportLevel: string, configLevel: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Logs a message at TRACE level.
|
|
50
|
+
* @param {string} message - The message to log.
|
|
51
|
+
*/
|
|
52
|
+
trace(message: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Logs a message at DEBUG level.
|
|
55
|
+
* @param {string} message - The message to log.
|
|
56
|
+
*/
|
|
57
|
+
debug(message: string): void;
|
|
58
|
+
/**
|
|
59
|
+
* Logs a message at INFO level.
|
|
60
|
+
* @param {string} message - The message to log.
|
|
61
|
+
*/
|
|
62
|
+
info(message: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Logs a message at WARN level.
|
|
65
|
+
* @param {string} message - The message to log.
|
|
66
|
+
*/
|
|
67
|
+
warn(message: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Logs a message at ERROR level.
|
|
70
|
+
* @param {string} message - The message to log.
|
|
71
|
+
*/
|
|
72
|
+
error(message: string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Delegates the logging of messages to the appropriate transports.
|
|
75
|
+
* @param {string} level - The level at which to log the message.
|
|
76
|
+
* @param {string} message - The message to log.
|
|
77
|
+
*/
|
|
78
|
+
log(level: string, message: string): void;
|
|
79
|
+
}
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare enum LogLevelEnum {
|
|
17
|
+
TRACE = 'trace',
|
|
18
|
+
DEBUG = 'debug',
|
|
19
|
+
INFO = 'info',
|
|
20
|
+
WARN = 'warn',
|
|
21
|
+
ERROR = 'error',
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { LogManager, ILogManager } from './core/LogManager';
|
|
17
|
+
export { LogLevelEnum } from './enums/LogLevelEnum';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Logger } from '../Logger';
|
|
17
|
+
/**
|
|
18
|
+
* ConsoleTransport class implements the Logger interface to provide logging functionality.
|
|
19
|
+
* It outputs logs to the console based on the log level set in the configuration.
|
|
20
|
+
*/
|
|
21
|
+
export declare class ConsoleTransport implements Logger {
|
|
22
|
+
config: Record<string, any>;
|
|
23
|
+
level: string;
|
|
24
|
+
/**
|
|
25
|
+
* Constructor initializes the ConsoleTransport with a configuration object.
|
|
26
|
+
* @param {Record<string, any>} config - Configuration settings for the logger, including 'level'.
|
|
27
|
+
*/
|
|
28
|
+
constructor(config?: Record<string, any>);
|
|
29
|
+
/**
|
|
30
|
+
* Logs a trace message.
|
|
31
|
+
* @param {string} message - The message to log.
|
|
32
|
+
*/
|
|
33
|
+
trace(message: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Logs a debug message.
|
|
36
|
+
* @param {string} message - The message to log.
|
|
37
|
+
*/
|
|
38
|
+
debug(message: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Logs an informational message.
|
|
41
|
+
* @param {string} message - The message to log.
|
|
42
|
+
*/
|
|
43
|
+
info(message: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Logs a warning message.
|
|
46
|
+
* @param {string} message - The message to log.
|
|
47
|
+
*/
|
|
48
|
+
warn(message: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* Logs an error message.
|
|
51
|
+
* @param {string} message - The message to log.
|
|
52
|
+
*/
|
|
53
|
+
error(message: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Generic log function that logs messages to the console based on the log level.
|
|
56
|
+
* @param {string} level - The log level under which the message should be logged.
|
|
57
|
+
* @param {string} message - The message to log.
|
|
58
|
+
*/
|
|
59
|
+
consoleLog(level: string, message: string): void;
|
|
60
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* logger.ts - Global Logger Singleton
|
|
18
|
+
*/
|
|
19
|
+
import { LogManager } from '../logger/core/LogManager';
|
|
20
|
+
/**
|
|
21
|
+
* Initializes the global logger instance.
|
|
22
|
+
* This function should be called inside `VWOProvider` before logging is used anywhere in the application.
|
|
23
|
+
*
|
|
24
|
+
* @param {object} config - The logger configuration object.
|
|
25
|
+
* @param {object} config.logger - Optional logging configuration (e.g., log level, transports).
|
|
26
|
+
* @returns {void} No return value; initializes the logger instance.
|
|
27
|
+
*/
|
|
28
|
+
export declare function initLogger(config: any): void;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves the global logger instance.
|
|
31
|
+
* Ensures that `initLogger` has been called before attempting to use logging.
|
|
32
|
+
*
|
|
33
|
+
* @returns {LogManager} The global logger instance.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getLogger(): LogManager;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Defines a type `dynamic` which can be used to represent a variety of data types.
|
|
18
|
+
* This type is flexible and can handle multiple types including primitive types,
|
|
19
|
+
* complex objects, and collections.
|
|
20
|
+
*/
|
|
21
|
+
export declare type dynamic =
|
|
22
|
+
| boolean
|
|
23
|
+
| number
|
|
24
|
+
| string
|
|
25
|
+
| Date
|
|
26
|
+
| void
|
|
27
|
+
| undefined
|
|
28
|
+
| null
|
|
29
|
+
| Record<string, any>
|
|
30
|
+
| Array<dynamicArray>
|
|
31
|
+
| Map<string, dynamicArray>;
|
|
32
|
+
/**
|
|
33
|
+
* Defines a type `dynamicArray` which is used within the `dynamic` type.
|
|
34
|
+
* This type is intended for use in arrays and supports several basic data types and objects.
|
|
35
|
+
*/
|
|
36
|
+
export declare type dynamicArray = boolean | number | string | Record<string, any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Hook to get a feature flag value
|
|
18
|
+
* @param featureKey - The key of the feature flag to get
|
|
19
|
+
* @returns The feature flag value
|
|
20
|
+
*/
|
|
21
|
+
export declare const useGetFlag: (featureKey: string) => any;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Hook to get all variables from a flag
|
|
18
|
+
* @param flag - The flag to get the variables from
|
|
19
|
+
* @returns The variables from the flag
|
|
20
|
+
*/
|
|
21
|
+
export declare const useGetFlagVariables: (flag: any) => any;
|
|
22
|
+
/**
|
|
23
|
+
* Hook to get a flag variable
|
|
24
|
+
* @param flag - The flag to get the variable from
|
|
25
|
+
* @param variableKey - The key of the variable to get
|
|
26
|
+
* @param defaultValue - The default value to return if the variable is not found
|
|
27
|
+
* @returns The value of the variable
|
|
28
|
+
*/
|
|
29
|
+
export declare const useGetFlagVariable: (flag: any, variableKey: string, defaultValue: any) => any;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Hook to set attributes for the user
|
|
18
|
+
* @param attributeMap - The map of attributes to set
|
|
19
|
+
*/
|
|
20
|
+
export declare const useSetAttribute: (attributeMap: Record<string, string>) => {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Hook to track an event
|
|
18
|
+
* @param eventName - The name of the event to track
|
|
19
|
+
* @param eventProperties - The properties of the event to track (optional)
|
|
20
|
+
*/
|
|
21
|
+
export declare const useTrackEvent: (eventName: string, eventProperties?: Record<string, string>) => {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Wingify Software Pvt. Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Returns the VWO SDK client instance
|
|
18
|
+
* @returns VWO SDK client instance
|
|
19
|
+
*/
|
|
20
|
+
export declare const useVWOClient: () => any;
|