vwo-fme-react-sdk 0.2.0 → 1.0.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 +10 -0
- package/dist/vwo-fme-react-sdk.cjs.development.js +1 -1
- package/dist/vwo-fme-react-sdk.cjs.development.js.map +1 -1
- package/dist/vwo-fme-react-sdk.cjs.production.min.js +1 -1
- package/dist/vwo-fme-react-sdk.cjs.production.min.js.map +1 -1
- package/dist/vwo-fme-react-sdk.esm.js +1 -1
- package/dist/vwo-fme-react-sdk.esm.js.map +1 -1
- package/lib/useGetFlag.ts +1 -1
- package/package.json +1 -1
- /package/dist/services/{loggerService.d.ts → LoggerService.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.0] - 2025-04-12
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Stable Release of VWO FME React SDK
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Update dependency of `useMemo` hook inside `useGetFlag` hook
|
|
17
|
+
|
|
8
18
|
## [0.2.0] - 2025-04-11
|
|
9
19
|
|
|
10
20
|
### Added
|
|
@@ -710,7 +710,7 @@ const useGetFlag = (featureKey, context) => {
|
|
|
710
710
|
// Memoize the user context to prevent unnecessary re-renders
|
|
711
711
|
const stableUserContext = React.useMemo(() => {
|
|
712
712
|
return context || userContext || {};
|
|
713
|
-
}, [JSON.stringify(userContext)]); // Only recreate if userContext actually changes
|
|
713
|
+
}, [JSON.stringify(context || userContext || {})]); // Only recreate if userContext actually changes
|
|
714
714
|
// Define the getFlag function to fetch the feature flag
|
|
715
715
|
const getFlag = React.useCallback(async () => {
|
|
716
716
|
// Check if featureKey is provided
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vwo-fme-react-sdk.cjs.development.js","sources":["../lib/logger/Logger.ts","../lib/logger/enums/LogLevelEnum.ts","../lib/logger/transports/ConsoleTransport.ts","../lib/logger/LogMessageBuilder.ts","../lib/utils/DataTypeUtil.ts","../lib/logger/core/TransportManager.ts","../lib/logger/core/LogManager.ts","../lib/services/LoggerService.ts","../lib/VWOContext.ts","../lib/VWOProvider.tsx","../lib/useVWOClient.ts","../lib/useGetFlag.ts","../lib/useGetFlagVariable.ts","../lib/useTrackEvent.ts","../lib/useSetAttribute.ts"],"sourcesContent":["/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Abstract class representing a logger.\n * This class provides the structure for logging mechanisms and should be extended by specific logger implementations.\n */\nexport abstract class Logger {\n /**\n * Logs a message at the trace level.\n * @param {string} message - The message to log.\n */\n abstract trace(message: string): void;\n\n /**\n * Logs a message at the debug level.\n * @param {string} message - The message to log.\n */\n abstract debug(message: string): void;\n\n /**\n * Logs a message at the info level.\n * @param {string} message - The message to log.\n */\n abstract info(message: string): void;\n\n /**\n * Logs a message at the warn level.\n * @param {string} message - The message to log.\n */\n abstract warn(message: string): void;\n\n /**\n * Logs a message at the error level.\n * @param {string} message - The message to log.\n */\n abstract error(message: string): void;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum LogLevelEnum {\n TRACE = 'trace',\n DEBUG = 'debug',\n INFO = 'info',\n WARN = 'warn',\n ERROR = 'error',\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { Logger } from '../Logger';\n\n/**\n * ConsoleTransport class implements the Logger interface to provide logging functionality.\n * It outputs logs to the console based on the log level set in the configuration.\n */\nexport class ConsoleTransport implements Logger {\n config: Record<string, any>; // Configuration object for the logger\n level: string; // Current log level\n\n /**\n * Constructor initializes the ConsoleTransport with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the logger, including 'level'.\n */\n constructor(config: Record<string, any> = {}) {\n this.config = config; // Store the configuration\n this.level = this.config.level; // Set the logging level from the configuration\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.consoleLog(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.consoleLog(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.consoleLog(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.consoleLog(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.consoleLog(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Generic log function that logs messages to the console based on the log level.\n * @param {string} level - The log level under which the message should be logged.\n * @param {string} message - The message to log.\n */\n consoleLog(level: string, message: string): void {\n console[level](message); // Use console's logging function dynamically based on the level\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\nimport { LogLevelEnum } from './enums/LogLevelEnum';\n\n/**\n * Interface defining the structure for a log message builder.\n */\ninterface ILogMessageBuilder {\n loggerConfig: Record<string, dynamic>; // Configuration for the logger\n transportConfig: Record<string, dynamic>; // Configuration for the transport mechanism\n prefix: string; // Prefix to be added to each log message\n dateTimeFormat: dynamic; // Function or format for date and time in log messages\n\n formatMessage(level: string, message: string): string; // Method to format a log message\n getFormattedLevel(level: string): string; // Method to format the log level\n getFormattedDateTime(): string; // Method to get formatted date and time\n}\n\n/**\n * Implements the ILogMessageBuilder interface to provide a concrete log message builder.\n */\nexport class LogMessageBuilder implements ILogMessageBuilder {\n loggerConfig: Record<string, any>;\n transportConfig: Record<string, any>;\n prefix: string;\n dateTimeFormat: any;\n\n /**\n * Constructs a new LogMessageBuilder instance.\n * @param {Record<string, any>} loggerConfig - Configuration for the logger.\n * @param {Record<string, any>} transportConfig - Configuration for the transport mechanism.\n */\n constructor(loggerConfig: Record<string, any>, transportConfig: Record<string, any>) {\n this.loggerConfig = loggerConfig;\n this.transportConfig = transportConfig;\n\n // Set the prefix, defaulting to an empty string if not provided.\n this.prefix = this.transportConfig.prefix || this.loggerConfig.prefix || '';\n // Set the date and time format, defaulting to the logger's format if the transport's format is not provided.\n this.dateTimeFormat = this.transportConfig.dateTimeFormat || this.loggerConfig.dateTimeFormat;\n }\n\n /**\n * Formats a log message combining level, prefix, date/time, and the actual message.\n * @param {string} level - The log level.\n * @param {string} message - The message to log.\n * @returns {string} The formatted log message.\n */\n formatMessage(level: string, message: string): string {\n return `[${this.getFormattedLevel(level)}]: ${this.getFormattedPrefix(this.prefix)} ${this.getFormattedDateTime()} ${message}`;\n }\n\n getFormattedPrefix(prefix: string): string {\n return `${prefix}`;\n }\n\n /**\n * Returns the formatted log level with appropriate coloring based on the log level.\n * @param {string} level - The log level.\n * @returns {string} The formatted log level.\n */\n getFormattedLevel(level: string): string {\n const upperCaseLevel = level.toUpperCase();\n let LogLevelColorInfoEnum;\n\n LogLevelColorInfoEnum = {\n [LogLevelEnum.TRACE]: upperCaseLevel,\n [LogLevelEnum.DEBUG]: upperCaseLevel,\n [LogLevelEnum.INFO]: upperCaseLevel,\n [LogLevelEnum.WARN]: upperCaseLevel,\n [LogLevelEnum.ERROR]: upperCaseLevel,\n };\n\n return LogLevelColorInfoEnum[level];\n }\n\n /**\n * Retrieves the current date and time formatted according to the specified format.\n * @returns {string} The formatted date and time.\n */\n getFormattedDateTime(): string {\n return this.dateTimeFormat();\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\n\ntype FunctionType = (val: dynamic) => void;\n\n/**\n * Checks if a value is a function.\n * @param val The value to check.\n * @returns True if the value is a function, false otherwise.\n */\nexport function isFunction(val: dynamic): val is FunctionType {\n return Object.prototype.toString.call(val) === '[object Function]';\n}\n\n/**\n * Checks if a value is an object (excluding arrays, functions, regex, promises, and dates).\n * @param val The value to check.\n * @returns True if the value is a valid object, false otherwise.\n */\nexport function isObject<T>(\n val: T,\n): val is Record<any, dynamic> & Exclude<T, Array<dynamic> | FunctionType | RegExp | Promise<dynamic> | Date> {\n return Object.prototype.toString.call(val) === '[object Object]';\n}\n\n/**\n * Checks if a value is a string.\n * @param val The value to check.\n * @returns True if the value is a string, false otherwise.\n */\nexport function isString(val: dynamic): val is string {\n return typeof val === 'string' || Object.prototype.toString.call(val) === '[object String]';\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { LogMessageBuilder } from '../LogMessageBuilder';\nimport { Logger } from '../Logger';\nimport { isFunction } from '../../utils/DataTypeUtil';\n\nenum LogLevelNumberEnum {\n TRACE = 0,\n DEBUG = 1,\n INFO = 2,\n WARN = 3,\n ERROR = 4,\n}\n\ninterface IlogTransport extends Logger {\n transports: Array<Record<string, dynamic>>;\n config: Record<string, dynamic>;\n\n // Determines if a message should be logged based on the transport and configuration levels\n shouldLog(transportLevel: string, configLevel: string): boolean;\n // Logs a message at a specified level\n log(level: string, message: string): void;\n}\n\n/**\n * Manages logging transports and delegates logging messages to them based on configuration.\n * Implements the IlogTransport interface.\n */\nexport class LogTransportManager implements IlogTransport {\n transports: Array<Record<string, any>>;\n config: Record<string, any>;\n\n /**\n * Initializes the manager with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the log manager.\n */\n constructor(config: Record<string, any>) {\n this.transports = [];\n this.config = config;\n }\n\n /**\n * Adds a new transport to the manager.\n * @param {Record<string, any>} transport - The transport object to be added.\n */\n addTransport(transport: Record<string, any>): void {\n this.transports.push(transport);\n }\n\n /**\n * Determines if the log should be processed based on the transport and configuration levels.\n * @param {string} transportLevel - The log level set for the transport.\n * @param {string} configLevel - The log level set in the configuration.\n * @returns {boolean} - Returns true if the log level is appropriate for logging, false otherwise.\n */\n shouldLog(transportLevel: string, configLevel: string): boolean {\n // Default to the most specific level available\n // transportLevel = transportLevel || configLevel || this.config.level;\n\n const targetLevel = LogLevelNumberEnum[transportLevel.toUpperCase()];\n const desiredLevel = LogLevelNumberEnum[(configLevel || this.config.level).toUpperCase()];\n\n return targetLevel >= desiredLevel;\n }\n\n /**\n * Logs a message at TRACE level.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a message at DEBUG level.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs a message at INFO level.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a message at WARN level.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs a message at ERROR level.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.log(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Delegates the logging of messages to the appropriate transports.\n * @param {string} level - The level at which to log the message.\n * @param {string} message - The message to log.\n */\n log(level: string, message: string): void {\n for (let i = 0; i < this.transports.length; i++) {\n const logMessageBuilder = new LogMessageBuilder(this.config, this.transports[i]);\n const formattedMessage = logMessageBuilder.formatMessage(level, message);\n if (this.shouldLog(level, this.transports[i].level)) {\n if (this.transports[i].log && isFunction(this.transports[i].log)) {\n // Use custom log handler if available\n this.transports[i].log(level, message);\n } else {\n // Otherwise, use the default log method\n this.transports[i][level](formattedMessage);\n }\n }\n }\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\n\nimport { Logger } from '../Logger';\nimport { ConsoleTransport } from '../transports/ConsoleTransport';\nimport { LogTransportManager } from './TransportManager';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\n\n/**\n * Interface defining the structure and methods for LogManager.\n */\nexport interface ILogManager {\n transportManager?: LogTransportManager;\n config?: Record<string, dynamic>;\n name?: string;\n requestId?: string;\n level: string;\n prefix?: string;\n dateTimeFormat?: () => string;\n\n transport?: Record<string, dynamic>;\n transports?: Array<Record<string, dynamic>>;\n\n addTransport?(transportObject: Record<string, dynamic>): void;\n addTransports?(transportsList: Array<Record<string, dynamic>>): void;\n}\n\n/**\n * LogManager class provides logging functionality with support for multiple transports.\n * It is designed as a singleton to ensure a single instance throughout the application.\n */\nexport class LogManager extends Logger implements ILogManager {\n private static instance: LogManager; // Singleton instance of LogManager\n transportManager: LogTransportManager;\n config: Record<string, any>;\n name = 'VWO Logger'; // Default logger name\n requestId = new Date().getTime().toString(); // current timestamp in milliseconds\n level = LogLevelEnum.ERROR; // Default logging level\n prefix = 'VWO-SDK'; // Default prefix for log messages\n public dateTimeFormat(): string {\n return new Date().toISOString(); // Default date-time format for log messages\n }\n transport: Record<string, any>;\n transports: Array<Record<string, any>>;\n\n /**\n * Constructor for LogManager.\n * @param {Record<string, any>} config - Configuration object for LogManager.\n */\n constructor(config?: Record<string, any>) {\n super();\n\n this.config = config;\n\n if (config.isAlwaysNewInstance || !LogManager.instance) {\n LogManager.instance = this;\n\n // Initialize configuration with defaults or provided values\n this.config.name = config.name || this.name;\n this.config.requestId = config.requestId || this.requestId;\n this.config.level = config.level || this.level;\n this.config.prefix = config.prefix || this.prefix;\n this.config.dateTimeFormat = config.dateTimeFormat || this.dateTimeFormat;\n\n this.transportManager = new LogTransportManager(this.config);\n\n this.handleTransports();\n }\n\n return LogManager.instance;\n }\n\n /**\n * Provides access to the singleton instance of LogManager.\n * @returns {LogManager} The singleton instance.\n */\n static get Instance(): LogManager {\n return LogManager.instance;\n }\n\n /**\n * Handles the initialization and setup of transports based on configuration.\n */\n handleTransports(): void {\n this.addTransport(\n new ConsoleTransport({\n level: this.config.level,\n }),\n );\n }\n\n /**\n * Adds a single transport to the LogManager.\n * @param {Record<any, any>} transport - The transport object to add.\n */\n addTransport(transport: Record<any, any>): void {\n this.transportManager.addTransport(transport);\n }\n\n /**\n * Adds multiple transports to the LogManager.\n * @param {Array<Record<any, any>>} transports - The list of transport objects to add.\n */\n addTransports(transports: Record<any, any>): void {\n for (let i = 0; i < transports.length; i++) {\n this.addTransport(transports[i]);\n }\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log at trace level.\n */\n trace(message: string): void {\n this.transportManager.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log at debug level.\n */\n debug(message: string): void {\n this.transportManager.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log at info level.\n */\n info(message: string): void {\n this.transportManager.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log at warn level.\n */\n warn(message: string): void {\n this.transportManager.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log at error level.\n */\n error(message: string): void {\n this.transportManager.log(LogLevelEnum.ERROR, message);\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * logger.ts - Global Logger Singleton\n */\nimport { LogManager } from '../logger/core/LogManager';\n\nlet logger: LogManager | null = null;\n\n/**\n * Initializes the global logger instance.\n * This function should be called inside `VWOProvider` before logging is used anywhere in the application.\n *\n * @param {object} config - The logger configuration object.\n * @param {object} config.logger - Optional logging configuration (e.g., log level, transports).\n * @returns {void} No return value; initializes the logger instance.\n */\nexport function initLogger(config: any) {\n if (!logger) {\n logger = new LogManager(config.logger || {});\n }\n}\n\n/**\n * Retrieves the global logger instance.\n * Ensures that `initLogger` has been called before attempting to use logging.\n *\n * @returns {LogManager} The global logger instance.\n */\nexport function getLogger(): LogManager {\n if (!logger) {\n logger = new LogManager({ level: 'error' });\n }\n return logger;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createContext, useContext } from 'react';\nimport { getLogger } from './services/LoggerService';\n\ninterface VWOContextType {\n vwoClient: any;\n userContext?: any;\n setUserContext?: (context: any) => void;\n}\n\nexport const VWOContext = createContext<VWOContextType>({\n vwoClient: null,\n userContext: null,\n setUserContext: undefined, // Default is undefined\n});\n\nexport const useVWOContext = () => {\n const logger = getLogger();\n try {\n // Fetch the context\n const context = useContext(VWOContext);\n\n // If the context is not found, throw an error\n if (!context) {\n logger.error('useVWOContext must be used within a VWOProvider');\n return null;\n }\n return context;\n } catch (error) {\n logger.error(`Error in useVWOContext hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useState, useRef, ReactNode } from 'react';\nimport { init } from 'vwo-fme-node-sdk';\nimport { VWOContext } from './VWOContext';\nimport { initLogger, getLogger } from './services/LoggerService';\n\ninterface VWOProviderProps {\n client?: any;\n config?: any;\n userContext?: any;\n children: ReactNode;\n}\n\n/**\n * VWOProvider component to provide VWO client and configuration context to child components.\n *\n * @param {Object} props - The properties for the VWOProvider component.\n * @param {Object} props.client - The VWO client instance.\n * @param {Object} props.config - Configuration settings for the VWO client.\n * @param {Object} props.userContext - Initial user context for the VWO client.\n * @param {React.ReactNode} props.children - Child components that will have access to the VWO context.\n * @returns {JSX.Element} The provider component wrapping its children with VWO context.\n */\nexport const VWOProvider: React.FC<VWOProviderProps> = ({ client, config, userContext, children }) => {\n const [vwoClient, setVwoClient] = useState<any>(client || null);\n const [context, setContext] = useState<any>(userContext || null);\n const vwoClientRef = useRef<any>(vwoClient); // Store the client reference without triggering re-renders\n const isMounted = useRef(true); // Prevent updates after unmount\n\n const logger = getLogger();\n\n // Initialize logger globally before using it\n useEffect(() => {\n if (config?.logger) {\n initLogger(config);\n }\n }, [config]);\n\n // Initialize the VWO SDK instance only once when the component mounts or if config is updated\n useEffect(() => {\n // If neither vwoClient nor config is provided, log the error\n if (!vwoClient && !config) {\n logger.error(\"VWOProvider Error: Either `client` or `config` must be provided.\");\n return;\n }\n\n const initializeVWO = async () => {\n try {\n if (!vwoClient && config) {\n // Initialize the VWO SDK instance if vwoClient is not already initialized\n const instance = await init(config);\n if (isMounted.current) {\n setVwoClient(instance);\n vwoClientRef.current = instance;\n }\n }\n } catch (error) {\n logger.error(`VWO-SDK Initialization failed: ${error}`);\n }\n };\n\n // Only initialize once\n if (!vwoClient && config) {\n initializeVWO();\n }\n\n return () => {\n isMounted.current = false;\n if (vwoClientRef.current && vwoClientRef.current.destroy) {\n vwoClientRef.current.destroy();\n }\n };\n }, [config, vwoClient]); // Re-run only when config or vwoClient changes\n\n return (\n <VWOContext.Provider value={{ vwoClient, userContext: context, setUserContext: setContext }}>\n {children}\n </VWOContext.Provider>\n );\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\n\n/**\n * Returns the VWO SDK client instance\n * @returns VWO SDK client instance\n */\nexport const useVWOClient = () => {\n const logger = getLogger();\n try {\n const context = useVWOContext();\n\n // If the VWO SDK client is not found, throw an error\n if (!context || !context.vwoClient) {\n logger.error('useVWOClient must be used within a VWOProvider !!');\n return null;\n }\n\n // Return the VWO SDK client\n return context.vwoClient;\n } catch (error) {\n logger.error(`Error in useVWOClient hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useVWOContext } from './VWOContext';\nimport { getLogger } from './services/LoggerService';\nimport { isObject } from './utils/DataTypeUtil';\n\n/**\n * Custom hook to retrieve a feature flag using VWO client.\n *\n * @param {string} featureKey - The key of the feature flag to retrieve.\n * @param {Object} [context] - Optional user context to use for fetching the flag.\n * @returns {Object} An object containing the flag and a readiness status.\n */\nexport const useGetFlag = (featureKey: string, context?: any) => {\n // Define the error return schema for the hook\n const errorReturnSchema = {\n flag: {\n isEnabled: (): boolean => false,\n getVariables: (): Array<Record<string, any>> => [],\n getVariable: (_key: string, defaultValue: any): any => defaultValue,\n },\n isReady: (): boolean => false,\n };\n\n // Destructure vwoClient, setUserContext, and userContext from VWOContext\n const { vwoClient, setUserContext, userContext } = useVWOContext();\n\n // State to store the flag and loading status\n const [flag, setFlag] = useState<any | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n // Get the logger instance\n const logger = getLogger();\n\n // Memoize the user context to prevent unnecessary re-renders\n const stableUserContext = useMemo(() => {\n return context || userContext || {};\n }, [JSON.stringify(userContext)]); // Only recreate if userContext actually changes\n\n // Define the getFlag function to fetch the feature flag\n const getFlag = useCallback(async () => {\n // Check if featureKey is provided\n if (!featureKey) {\n logger.error('Feature key is required for useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Check if the user context is a valid object\n if (!isObject(stableUserContext)) {\n logger.error('Invalid user context in useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Try to fetch the feature flag and handle errors\n try {\n setIsLoading(true);\n const result = await vwoClient.getFlag(featureKey, stableUserContext);\n setFlag(result);\n\n // Set the user context in the context to ensure it's available for other hooks\n setUserContext(stableUserContext);\n } catch (error) {\n logger.error(`Error fetching feature flag \"${featureKey}\": ${error}`);\n setFlag(null);\n } finally {\n setIsLoading(false);\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Ensure vwoClient is ready\n if (!vwoClient) {\n logger.error('VWO Client is missing in useGetFlag hook. Ensure VWOProvider is correctly initialized.');\n return errorReturnSchema;\n }\n\n // Run effect when dependencies change to fetch the flag\n useEffect(() => {\n if (featureKey && vwoClient && stableUserContext) {\n getFlag();\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Return the flag and readiness status\n return {\n flag,\n isReady: (): boolean => !isLoading && !!flag,\n };\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to get all variables from a flag\n * @param flag - The flag to get the variables from\n * @returns The variables from the flag\n */\nexport const useGetFlagVariables = (flag: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariables hook and should be an object');\n return [];\n }\n\n return flag.getVariables();\n } catch (error) {\n logger.error(`Error getting flag variables: ${error}`);\n return [];\n }\n};\n\n/**\n * Hook to get a flag variable\n * @param flag - The flag to get the variable from\n * @param variableKey - The key of the variable to get\n * @param defaultValue - The default value to return if the variable is not found\n * @returns The value of the variable\n */\nexport const useGetFlagVariable = (flag: any, variableKey: string, defaultValue: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariable hook and should be an object');\n return [];\n }\n\n if (!flag || !variableKey) {\n logger.error('Flag and variable key are required for useGetFlagVariable hook');\n return defaultValue;\n }\n\n return flag.getVariable(variableKey, defaultValue);\n } catch (error) {\n logger.error(`Error getting flag variable: ${error}`);\n return defaultValue;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\nimport { isObject, isString } from './utils/DataTypeUtil';\n\n/**\n * Hook to track an event\n * @param eventName - The name of the event to track\n * @param eventProperties - The properties of the event to track (optional)\n */\nexport const useTrackEvent = (eventName: string, eventProperties: Record<string, string> = {}) => {\n const logger = getLogger();\n try {\n if (!eventName && !isString(eventName)) {\n logger.error('Event name is required for useTrackEvent hook and it should be a string');\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useTrackEvent hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useTrackEvent hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Track the event\n vwoClient.trackEvent(eventName, userContext, eventProperties);\n } catch (error) {\n logger.error(`Error tracking event: ${error}`);\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useVWOContext } from './VWOContext';\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to set attributes for the user\n * @param attributeMap - The map of attributes to set\n */\nexport const useSetAttribute = (attributeMap: Record<string, string>) => {\n const logger = getLogger();\n try {\n if (!attributeMap || !isObject(attributeMap) || Object.keys(attributeMap).length === 0) {\n logger.error(\n 'attributeMap(object having key-value pairs of user attributes) is required for useSetAttribute hook',\n );\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useSetAttribute hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useSetAttribute hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Set the attributes\n vwoClient.setAttribute(attributeMap, userContext);\n } catch (error) {\n logger.error(`Error setting attributes: ${error}`);\n }\n};\n"],"names":["Logger","LogLevelEnum","ConsoleTransport","constructor","config","level","trace","message","consoleLog","TRACE","debug","DEBUG","info","INFO","warn","WARN","error","ERROR","console","LogMessageBuilder","loggerConfig","transportConfig","prefix","dateTimeFormat","formatMessage","getFormattedLevel","getFormattedPrefix","getFormattedDateTime","upperCaseLevel","toUpperCase","LogLevelColorInfoEnum","isFunction","val","Object","prototype","toString","call","isObject","isString","LogLevelNumberEnum","LogTransportManager","transports","addTransport","transport","push","shouldLog","transportLevel","configLevel","targetLevel","desiredLevel","log","i","length","logMessageBuilder","formattedMessage","LogManager","Date","getTime","isAlwaysNewInstance","instance","name","requestId","transportManager","handleTransports","toISOString","Instance","addTransports","logger","initLogger","getLogger","VWOContext","createContext","vwoClient","userContext","setUserContext","undefined","useVWOContext","context","useContext","VWOProvider","client","children","setVwoClient","useState","setContext","vwoClientRef","useRef","isMounted","useEffect","initializeVWO","init","current","destroy","React","Provider","value","useVWOClient","useGetFlag","featureKey","errorReturnSchema","flag","isEnabled","getVariables","getVariable","_key","defaultValue","isReady","setFlag","isLoading","setIsLoading","stableUserContext","useMemo","JSON","stringify","getFlag","useCallback","result","useGetFlagVariables","useGetFlagVariable","variableKey","useTrackEvent","eventName","eventProperties","trackEvent","useSetAttribute","attributeMap","keys","setAttribute"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAgBA;;;;MAIsBA,MAAM;;ACpB5B;;;;;;;;;;;;;;;AAgBA,AAAA,IAAYC,YAMX;AAND,WAAYA,YAAY;EACtBA,+BAAe;EACfA,+BAAe;EACfA,6BAAa;EACbA,6BAAa;EACbA,+BAAe;AACjB,CAAC,EANWA,YAAY,KAAZA,YAAY;;AChBxB;;;;;;;;;;;;;;;AAgBA,AAGA;;;;AAIA,MAAaC,gBAAgB;;;;;EAQ3BC,YAAYC,SAA8B,EAAE;IAC1C,IAAI,CAACA,MAAM,GAAGA,MAAM,CAAC;IACrB,IAAI,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACC,KAAK,CAAC;;;;;;EAOjCC,KAAKA,CAACC,OAAe;IACnB,IAAI,CAACC,UAAU,CAACP,YAAY,CAACQ,KAAK,EAAEF,OAAO,CAAC;;;;;;EAO9CG,KAAKA,CAACH,OAAe;IACnB,IAAI,CAACC,UAAU,CAACP,YAAY,CAACU,KAAK,EAAEJ,OAAO,CAAC;;;;;;EAO9CK,IAAIA,CAACL,OAAe;IAClB,IAAI,CAACC,UAAU,CAACP,YAAY,CAACY,IAAI,EAAEN,OAAO,CAAC;;;;;;EAO7CO,IAAIA,CAACP,OAAe;IAClB,IAAI,CAACC,UAAU,CAACP,YAAY,CAAC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|
1
|
+
{"version":3,"file":"vwo-fme-react-sdk.cjs.development.js","sources":["../lib/logger/Logger.ts","../lib/logger/enums/LogLevelEnum.ts","../lib/logger/transports/ConsoleTransport.ts","../lib/logger/LogMessageBuilder.ts","../lib/utils/DataTypeUtil.ts","../lib/logger/core/TransportManager.ts","../lib/logger/core/LogManager.ts","../lib/services/LoggerService.ts","../lib/VWOContext.ts","../lib/VWOProvider.tsx","../lib/useVWOClient.ts","../lib/useGetFlag.ts","../lib/useGetFlagVariable.ts","../lib/useTrackEvent.ts","../lib/useSetAttribute.ts"],"sourcesContent":["/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Abstract class representing a logger.\n * This class provides the structure for logging mechanisms and should be extended by specific logger implementations.\n */\nexport abstract class Logger {\n /**\n * Logs a message at the trace level.\n * @param {string} message - The message to log.\n */\n abstract trace(message: string): void;\n\n /**\n * Logs a message at the debug level.\n * @param {string} message - The message to log.\n */\n abstract debug(message: string): void;\n\n /**\n * Logs a message at the info level.\n * @param {string} message - The message to log.\n */\n abstract info(message: string): void;\n\n /**\n * Logs a message at the warn level.\n * @param {string} message - The message to log.\n */\n abstract warn(message: string): void;\n\n /**\n * Logs a message at the error level.\n * @param {string} message - The message to log.\n */\n abstract error(message: string): void;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum LogLevelEnum {\n TRACE = 'trace',\n DEBUG = 'debug',\n INFO = 'info',\n WARN = 'warn',\n ERROR = 'error',\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { Logger } from '../Logger';\n\n/**\n * ConsoleTransport class implements the Logger interface to provide logging functionality.\n * It outputs logs to the console based on the log level set in the configuration.\n */\nexport class ConsoleTransport implements Logger {\n config: Record<string, any>; // Configuration object for the logger\n level: string; // Current log level\n\n /**\n * Constructor initializes the ConsoleTransport with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the logger, including 'level'.\n */\n constructor(config: Record<string, any> = {}) {\n this.config = config; // Store the configuration\n this.level = this.config.level; // Set the logging level from the configuration\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.consoleLog(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.consoleLog(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.consoleLog(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.consoleLog(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.consoleLog(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Generic log function that logs messages to the console based on the log level.\n * @param {string} level - The log level under which the message should be logged.\n * @param {string} message - The message to log.\n */\n consoleLog(level: string, message: string): void {\n console[level](message); // Use console's logging function dynamically based on the level\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\nimport { LogLevelEnum } from './enums/LogLevelEnum';\n\n/**\n * Interface defining the structure for a log message builder.\n */\ninterface ILogMessageBuilder {\n loggerConfig: Record<string, dynamic>; // Configuration for the logger\n transportConfig: Record<string, dynamic>; // Configuration for the transport mechanism\n prefix: string; // Prefix to be added to each log message\n dateTimeFormat: dynamic; // Function or format for date and time in log messages\n\n formatMessage(level: string, message: string): string; // Method to format a log message\n getFormattedLevel(level: string): string; // Method to format the log level\n getFormattedDateTime(): string; // Method to get formatted date and time\n}\n\n/**\n * Implements the ILogMessageBuilder interface to provide a concrete log message builder.\n */\nexport class LogMessageBuilder implements ILogMessageBuilder {\n loggerConfig: Record<string, any>;\n transportConfig: Record<string, any>;\n prefix: string;\n dateTimeFormat: any;\n\n /**\n * Constructs a new LogMessageBuilder instance.\n * @param {Record<string, any>} loggerConfig - Configuration for the logger.\n * @param {Record<string, any>} transportConfig - Configuration for the transport mechanism.\n */\n constructor(loggerConfig: Record<string, any>, transportConfig: Record<string, any>) {\n this.loggerConfig = loggerConfig;\n this.transportConfig = transportConfig;\n\n // Set the prefix, defaulting to an empty string if not provided.\n this.prefix = this.transportConfig.prefix || this.loggerConfig.prefix || '';\n // Set the date and time format, defaulting to the logger's format if the transport's format is not provided.\n this.dateTimeFormat = this.transportConfig.dateTimeFormat || this.loggerConfig.dateTimeFormat;\n }\n\n /**\n * Formats a log message combining level, prefix, date/time, and the actual message.\n * @param {string} level - The log level.\n * @param {string} message - The message to log.\n * @returns {string} The formatted log message.\n */\n formatMessage(level: string, message: string): string {\n return `[${this.getFormattedLevel(level)}]: ${this.getFormattedPrefix(this.prefix)} ${this.getFormattedDateTime()} ${message}`;\n }\n\n getFormattedPrefix(prefix: string): string {\n return `${prefix}`;\n }\n\n /**\n * Returns the formatted log level with appropriate coloring based on the log level.\n * @param {string} level - The log level.\n * @returns {string} The formatted log level.\n */\n getFormattedLevel(level: string): string {\n const upperCaseLevel = level.toUpperCase();\n let LogLevelColorInfoEnum;\n\n LogLevelColorInfoEnum = {\n [LogLevelEnum.TRACE]: upperCaseLevel,\n [LogLevelEnum.DEBUG]: upperCaseLevel,\n [LogLevelEnum.INFO]: upperCaseLevel,\n [LogLevelEnum.WARN]: upperCaseLevel,\n [LogLevelEnum.ERROR]: upperCaseLevel,\n };\n\n return LogLevelColorInfoEnum[level];\n }\n\n /**\n * Retrieves the current date and time formatted according to the specified format.\n * @returns {string} The formatted date and time.\n */\n getFormattedDateTime(): string {\n return this.dateTimeFormat();\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\n\ntype FunctionType = (val: dynamic) => void;\n\n/**\n * Checks if a value is a function.\n * @param val The value to check.\n * @returns True if the value is a function, false otherwise.\n */\nexport function isFunction(val: dynamic): val is FunctionType {\n return Object.prototype.toString.call(val) === '[object Function]';\n}\n\n/**\n * Checks if a value is an object (excluding arrays, functions, regex, promises, and dates).\n * @param val The value to check.\n * @returns True if the value is a valid object, false otherwise.\n */\nexport function isObject<T>(\n val: T,\n): val is Record<any, dynamic> & Exclude<T, Array<dynamic> | FunctionType | RegExp | Promise<dynamic> | Date> {\n return Object.prototype.toString.call(val) === '[object Object]';\n}\n\n/**\n * Checks if a value is a string.\n * @param val The value to check.\n * @returns True if the value is a string, false otherwise.\n */\nexport function isString(val: dynamic): val is string {\n return typeof val === 'string' || Object.prototype.toString.call(val) === '[object String]';\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { LogMessageBuilder } from '../LogMessageBuilder';\nimport { Logger } from '../Logger';\nimport { isFunction } from '../../utils/DataTypeUtil';\n\nenum LogLevelNumberEnum {\n TRACE = 0,\n DEBUG = 1,\n INFO = 2,\n WARN = 3,\n ERROR = 4,\n}\n\ninterface IlogTransport extends Logger {\n transports: Array<Record<string, dynamic>>;\n config: Record<string, dynamic>;\n\n // Determines if a message should be logged based on the transport and configuration levels\n shouldLog(transportLevel: string, configLevel: string): boolean;\n // Logs a message at a specified level\n log(level: string, message: string): void;\n}\n\n/**\n * Manages logging transports and delegates logging messages to them based on configuration.\n * Implements the IlogTransport interface.\n */\nexport class LogTransportManager implements IlogTransport {\n transports: Array<Record<string, any>>;\n config: Record<string, any>;\n\n /**\n * Initializes the manager with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the log manager.\n */\n constructor(config: Record<string, any>) {\n this.transports = [];\n this.config = config;\n }\n\n /**\n * Adds a new transport to the manager.\n * @param {Record<string, any>} transport - The transport object to be added.\n */\n addTransport(transport: Record<string, any>): void {\n this.transports.push(transport);\n }\n\n /**\n * Determines if the log should be processed based on the transport and configuration levels.\n * @param {string} transportLevel - The log level set for the transport.\n * @param {string} configLevel - The log level set in the configuration.\n * @returns {boolean} - Returns true if the log level is appropriate for logging, false otherwise.\n */\n shouldLog(transportLevel: string, configLevel: string): boolean {\n // Default to the most specific level available\n // transportLevel = transportLevel || configLevel || this.config.level;\n\n const targetLevel = LogLevelNumberEnum[transportLevel.toUpperCase()];\n const desiredLevel = LogLevelNumberEnum[(configLevel || this.config.level).toUpperCase()];\n\n return targetLevel >= desiredLevel;\n }\n\n /**\n * Logs a message at TRACE level.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a message at DEBUG level.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs a message at INFO level.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a message at WARN level.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs a message at ERROR level.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.log(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Delegates the logging of messages to the appropriate transports.\n * @param {string} level - The level at which to log the message.\n * @param {string} message - The message to log.\n */\n log(level: string, message: string): void {\n for (let i = 0; i < this.transports.length; i++) {\n const logMessageBuilder = new LogMessageBuilder(this.config, this.transports[i]);\n const formattedMessage = logMessageBuilder.formatMessage(level, message);\n if (this.shouldLog(level, this.transports[i].level)) {\n if (this.transports[i].log && isFunction(this.transports[i].log)) {\n // Use custom log handler if available\n this.transports[i].log(level, message);\n } else {\n // Otherwise, use the default log method\n this.transports[i][level](formattedMessage);\n }\n }\n }\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\n\nimport { Logger } from '../Logger';\nimport { ConsoleTransport } from '../transports/ConsoleTransport';\nimport { LogTransportManager } from './TransportManager';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\n\n/**\n * Interface defining the structure and methods for LogManager.\n */\nexport interface ILogManager {\n transportManager?: LogTransportManager;\n config?: Record<string, dynamic>;\n name?: string;\n requestId?: string;\n level: string;\n prefix?: string;\n dateTimeFormat?: () => string;\n\n transport?: Record<string, dynamic>;\n transports?: Array<Record<string, dynamic>>;\n\n addTransport?(transportObject: Record<string, dynamic>): void;\n addTransports?(transportsList: Array<Record<string, dynamic>>): void;\n}\n\n/**\n * LogManager class provides logging functionality with support for multiple transports.\n * It is designed as a singleton to ensure a single instance throughout the application.\n */\nexport class LogManager extends Logger implements ILogManager {\n private static instance: LogManager; // Singleton instance of LogManager\n transportManager: LogTransportManager;\n config: Record<string, any>;\n name = 'VWO Logger'; // Default logger name\n requestId = new Date().getTime().toString(); // current timestamp in milliseconds\n level = LogLevelEnum.ERROR; // Default logging level\n prefix = 'VWO-SDK'; // Default prefix for log messages\n public dateTimeFormat(): string {\n return new Date().toISOString(); // Default date-time format for log messages\n }\n transport: Record<string, any>;\n transports: Array<Record<string, any>>;\n\n /**\n * Constructor for LogManager.\n * @param {Record<string, any>} config - Configuration object for LogManager.\n */\n constructor(config?: Record<string, any>) {\n super();\n\n this.config = config;\n\n if (config.isAlwaysNewInstance || !LogManager.instance) {\n LogManager.instance = this;\n\n // Initialize configuration with defaults or provided values\n this.config.name = config.name || this.name;\n this.config.requestId = config.requestId || this.requestId;\n this.config.level = config.level || this.level;\n this.config.prefix = config.prefix || this.prefix;\n this.config.dateTimeFormat = config.dateTimeFormat || this.dateTimeFormat;\n\n this.transportManager = new LogTransportManager(this.config);\n\n this.handleTransports();\n }\n\n return LogManager.instance;\n }\n\n /**\n * Provides access to the singleton instance of LogManager.\n * @returns {LogManager} The singleton instance.\n */\n static get Instance(): LogManager {\n return LogManager.instance;\n }\n\n /**\n * Handles the initialization and setup of transports based on configuration.\n */\n handleTransports(): void {\n this.addTransport(\n new ConsoleTransport({\n level: this.config.level,\n }),\n );\n }\n\n /**\n * Adds a single transport to the LogManager.\n * @param {Record<any, any>} transport - The transport object to add.\n */\n addTransport(transport: Record<any, any>): void {\n this.transportManager.addTransport(transport);\n }\n\n /**\n * Adds multiple transports to the LogManager.\n * @param {Array<Record<any, any>>} transports - The list of transport objects to add.\n */\n addTransports(transports: Record<any, any>): void {\n for (let i = 0; i < transports.length; i++) {\n this.addTransport(transports[i]);\n }\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log at trace level.\n */\n trace(message: string): void {\n this.transportManager.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log at debug level.\n */\n debug(message: string): void {\n this.transportManager.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log at info level.\n */\n info(message: string): void {\n this.transportManager.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log at warn level.\n */\n warn(message: string): void {\n this.transportManager.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log at error level.\n */\n error(message: string): void {\n this.transportManager.log(LogLevelEnum.ERROR, message);\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * logger.ts - Global Logger Singleton\n */\nimport { LogManager } from '../logger/core/LogManager';\n\nlet logger: LogManager | null = null;\n\n/**\n * Initializes the global logger instance.\n * This function should be called inside `VWOProvider` before logging is used anywhere in the application.\n *\n * @param {object} config - The logger configuration object.\n * @param {object} config.logger - Optional logging configuration (e.g., log level, transports).\n * @returns {void} No return value; initializes the logger instance.\n */\nexport function initLogger(config: any) {\n if (!logger) {\n logger = new LogManager(config.logger || {});\n }\n}\n\n/**\n * Retrieves the global logger instance.\n * Ensures that `initLogger` has been called before attempting to use logging.\n *\n * @returns {LogManager} The global logger instance.\n */\nexport function getLogger(): LogManager {\n if (!logger) {\n logger = new LogManager({ level: 'error' });\n }\n return logger;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createContext, useContext } from 'react';\nimport { getLogger } from './services/LoggerService';\n\ninterface VWOContextType {\n vwoClient: any;\n userContext?: any;\n setUserContext?: (context: any) => void;\n}\n\nexport const VWOContext = createContext<VWOContextType>({\n vwoClient: null,\n userContext: null,\n setUserContext: undefined, // Default is undefined\n});\n\nexport const useVWOContext = () => {\n const logger = getLogger();\n try {\n // Fetch the context\n const context = useContext(VWOContext);\n\n // If the context is not found, throw an error\n if (!context) {\n logger.error('useVWOContext must be used within a VWOProvider');\n return null;\n }\n return context;\n } catch (error) {\n logger.error(`Error in useVWOContext hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useState, useRef, ReactNode } from 'react';\nimport { init } from 'vwo-fme-node-sdk';\nimport { VWOContext } from './VWOContext';\nimport { initLogger, getLogger } from './services/LoggerService';\n\ninterface VWOProviderProps {\n client?: any;\n config?: any;\n userContext?: any;\n children: ReactNode;\n}\n\n/**\n * VWOProvider component to provide VWO client and configuration context to child components.\n *\n * @param {Object} props - The properties for the VWOProvider component.\n * @param {Object} props.client - The VWO client instance.\n * @param {Object} props.config - Configuration settings for the VWO client.\n * @param {Object} props.userContext - Initial user context for the VWO client.\n * @param {React.ReactNode} props.children - Child components that will have access to the VWO context.\n * @returns {JSX.Element} The provider component wrapping its children with VWO context.\n */\nexport const VWOProvider: React.FC<VWOProviderProps> = ({ client, config, userContext, children }) => {\n const [vwoClient, setVwoClient] = useState<any>(client || null);\n const [context, setContext] = useState<any>(userContext || null);\n const vwoClientRef = useRef<any>(vwoClient); // Store the client reference without triggering re-renders\n const isMounted = useRef(true); // Prevent updates after unmount\n\n const logger = getLogger();\n\n // Initialize logger globally before using it\n useEffect(() => {\n if (config?.logger) {\n initLogger(config);\n }\n }, [config]);\n\n // Initialize the VWO SDK instance only once when the component mounts or if config is updated\n useEffect(() => {\n // If neither vwoClient nor config is provided, log the error\n if (!vwoClient && !config) {\n logger.error(\"VWOProvider Error: Either `client` or `config` must be provided.\");\n return;\n }\n\n const initializeVWO = async () => {\n try {\n if (!vwoClient && config) {\n // Initialize the VWO SDK instance if vwoClient is not already initialized\n const instance = await init(config);\n if (isMounted.current) {\n setVwoClient(instance);\n vwoClientRef.current = instance;\n }\n }\n } catch (error) {\n logger.error(`VWO-SDK Initialization failed: ${error}`);\n }\n };\n\n // Only initialize once\n if (!vwoClient && config) {\n initializeVWO();\n }\n\n return () => {\n isMounted.current = false;\n if (vwoClientRef.current && vwoClientRef.current.destroy) {\n vwoClientRef.current.destroy();\n }\n };\n }, [config, vwoClient]); // Re-run only when config or vwoClient changes\n\n return (\n <VWOContext.Provider value={{ vwoClient, userContext: context, setUserContext: setContext }}>\n {children}\n </VWOContext.Provider>\n );\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\n\n/**\n * Returns the VWO SDK client instance\n * @returns VWO SDK client instance\n */\nexport const useVWOClient = () => {\n const logger = getLogger();\n try {\n const context = useVWOContext();\n\n // If the VWO SDK client is not found, throw an error\n if (!context || !context.vwoClient) {\n logger.error('useVWOClient must be used within a VWOProvider !!');\n return null;\n }\n\n // Return the VWO SDK client\n return context.vwoClient;\n } catch (error) {\n logger.error(`Error in useVWOClient hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useVWOContext } from './VWOContext';\nimport { getLogger } from './services/LoggerService';\nimport { isObject } from './utils/DataTypeUtil';\n\n/**\n * Custom hook to retrieve a feature flag using VWO client.\n *\n * @param {string} featureKey - The key of the feature flag to retrieve.\n * @param {Object} [context] - Optional user context to use for fetching the flag.\n * @returns {Object} An object containing the flag and a readiness status.\n */\nexport const useGetFlag = (featureKey: string, context?: any) => {\n // Define the error return schema for the hook\n const errorReturnSchema = {\n flag: {\n isEnabled: (): boolean => false,\n getVariables: (): Array<Record<string, any>> => [],\n getVariable: (_key: string, defaultValue: any): any => defaultValue,\n },\n isReady: (): boolean => false,\n };\n\n // Destructure vwoClient, setUserContext, and userContext from VWOContext\n const { vwoClient, setUserContext, userContext } = useVWOContext();\n\n // State to store the flag and loading status\n const [flag, setFlag] = useState<any | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n // Get the logger instance\n const logger = getLogger();\n\n // Memoize the user context to prevent unnecessary re-renders\n const stableUserContext = useMemo(() => {\n return context || userContext || {};\n }, [JSON.stringify(context || userContext || {})]); // Only recreate if userContext actually changes\n\n // Define the getFlag function to fetch the feature flag\n const getFlag = useCallback(async () => {\n // Check if featureKey is provided\n if (!featureKey) {\n logger.error('Feature key is required for useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Check if the user context is a valid object\n if (!isObject(stableUserContext)) {\n logger.error('Invalid user context in useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Try to fetch the feature flag and handle errors\n try {\n setIsLoading(true);\n const result = await vwoClient.getFlag(featureKey, stableUserContext);\n setFlag(result);\n\n // Set the user context in the context to ensure it's available for other hooks\n setUserContext(stableUserContext);\n } catch (error) {\n logger.error(`Error fetching feature flag \"${featureKey}\": ${error}`);\n setFlag(null);\n } finally {\n setIsLoading(false);\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Ensure vwoClient is ready\n if (!vwoClient) {\n logger.error('VWO Client is missing in useGetFlag hook. Ensure VWOProvider is correctly initialized.');\n return errorReturnSchema;\n }\n\n // Run effect when dependencies change to fetch the flag\n useEffect(() => {\n if (featureKey && vwoClient && stableUserContext) {\n getFlag();\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Return the flag and readiness status\n return {\n flag,\n isReady: (): boolean => !isLoading && !!flag,\n };\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to get all variables from a flag\n * @param flag - The flag to get the variables from\n * @returns The variables from the flag\n */\nexport const useGetFlagVariables = (flag: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariables hook and should be an object');\n return [];\n }\n\n return flag.getVariables();\n } catch (error) {\n logger.error(`Error getting flag variables: ${error}`);\n return [];\n }\n};\n\n/**\n * Hook to get a flag variable\n * @param flag - The flag to get the variable from\n * @param variableKey - The key of the variable to get\n * @param defaultValue - The default value to return if the variable is not found\n * @returns The value of the variable\n */\nexport const useGetFlagVariable = (flag: any, variableKey: string, defaultValue: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariable hook and should be an object');\n return [];\n }\n\n if (!flag || !variableKey) {\n logger.error('Flag and variable key are required for useGetFlagVariable hook');\n return defaultValue;\n }\n\n return flag.getVariable(variableKey, defaultValue);\n } catch (error) {\n logger.error(`Error getting flag variable: ${error}`);\n return defaultValue;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\nimport { isObject, isString } from './utils/DataTypeUtil';\n\n/**\n * Hook to track an event\n * @param eventName - The name of the event to track\n * @param eventProperties - The properties of the event to track (optional)\n */\nexport const useTrackEvent = (eventName: string, eventProperties: Record<string, string> = {}) => {\n const logger = getLogger();\n try {\n if (!eventName && !isString(eventName)) {\n logger.error('Event name is required for useTrackEvent hook and it should be a string');\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useTrackEvent hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useTrackEvent hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Track the event\n vwoClient.trackEvent(eventName, userContext, eventProperties);\n } catch (error) {\n logger.error(`Error tracking event: ${error}`);\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useVWOContext } from './VWOContext';\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to set attributes for the user\n * @param attributeMap - The map of attributes to set\n */\nexport const useSetAttribute = (attributeMap: Record<string, string>) => {\n const logger = getLogger();\n try {\n if (!attributeMap || !isObject(attributeMap) || Object.keys(attributeMap).length === 0) {\n logger.error(\n 'attributeMap(object having key-value pairs of user attributes) is required for useSetAttribute hook',\n );\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useSetAttribute hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useSetAttribute hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Set the attributes\n vwoClient.setAttribute(attributeMap, userContext);\n } catch (error) {\n logger.error(`Error setting attributes: ${error}`);\n }\n};\n"],"names":["Logger","LogLevelEnum","ConsoleTransport","constructor","config","level","trace","message","consoleLog","TRACE","debug","DEBUG","info","INFO","warn","WARN","error","ERROR","console","LogMessageBuilder","loggerConfig","transportConfig","prefix","dateTimeFormat","formatMessage","getFormattedLevel","getFormattedPrefix","getFormattedDateTime","upperCaseLevel","toUpperCase","LogLevelColorInfoEnum","isFunction","val","Object","prototype","toString","call","isObject","isString","LogLevelNumberEnum","LogTransportManager","transports","addTransport","transport","push","shouldLog","transportLevel","configLevel","targetLevel","desiredLevel","log","i","length","logMessageBuilder","formattedMessage","LogManager","Date","getTime","isAlwaysNewInstance","instance","name","requestId","transportManager","handleTransports","toISOString","Instance","addTransports","logger","initLogger","getLogger","VWOContext","createContext","vwoClient","userContext","setUserContext","undefined","useVWOContext","context","useContext","VWOProvider","client","children","setVwoClient","useState","setContext","vwoClientRef","useRef","isMounted","useEffect","initializeVWO","init","current","destroy","React","Provider","value","useVWOClient","useGetFlag","featureKey","errorReturnSchema","flag","isEnabled","getVariables","getVariable","_key","defaultValue","isReady","setFlag","isLoading","setIsLoading","stableUserContext","useMemo","JSON","stringify","getFlag","useCallback","result","useGetFlagVariables","useGetFlagVariable","variableKey","useTrackEvent","eventName","eventProperties","trackEvent","useSetAttribute","attributeMap","keys","setAttribute"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAgBA;;;;MAIsBA,MAAM;;ACpB5B;;;;;;;;;;;;;;;AAgBA,AAAA,IAAYC,YAMX;AAND,WAAYA,YAAY;EACtBA,+BAAe;EACfA,+BAAe;EACfA,6BAAa;EACbA,6BAAa;EACbA,+BAAe;AACjB,CAAC,EANWA,YAAY,KAAZA,YAAY;;AChBxB;;;;;;;;;;;;;;;AAgBA,AAGA;;;;AAIA,MAAaC,gBAAgB;;;;;EAQ3BC,YAAYC,SAA8B,EAAE;IAC1C,IAAI,CAACA,MAAM,GAAGA,MAAM,CAAC;IACrB,IAAI,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACC,KAAK,CAAC;;;;;;EAOjCC,KAAKA,CAACC,OAAe;IACnB,IAAI,CAACC,UAAU,CAACP,YAAY,CAACQ,KAAK,EAAEF,OAAO,CAAC;;;;;;EAO9CG,KAAKA,CAACH,OAAe;IACnB,IAAI,CAACC,UAAU,CAACP,YAAY,CAACU,KAAK,EAAEJ,OAAO,CAAC;;;;;;EAO9CK,IAAIA,CAACL,OAAe;IAClB,IAAI,CAACC,UAAU,CAACP,YAAY,CAACY,IAAI,EAAEN,OAAO,CAAC;;;;;;EAO7CO,IAAIA,CAACP,OAAe;IAClB,IAAI,CAACC,UAAU,CAACP,YAAY,CAACc,IAAI,EAAER,OAAO,CAAC;;;;;;EAO7CS,KAAKA,CAAC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etFlag = (featureKey, context) => {
|
|
|
710
710
|
// Memoize the user context to prevent unnecessary re-renders
|
|
711
711
|
const stableUserContext = React.useMemo(() => {
|
|
712
712
|
return context || userContext || {};
|
|
713
|
-
}, [JSON.stringify(userContext)]); // Only recreate if userContext actually changes
|
|
713
|
+
}, [JSON.stringify(context || userContext || {})]); // Only recreate if userContext actually changes
|
|
714
714
|
// Define the getFlag function to fetch the feature flag
|
|
715
715
|
const getFlag = React.useCallback(async () => {
|
|
716
716
|
// Check if featureKey is provided
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vwo-fme-react-sdk.cjs.production.min.js","sources":["../lib/logger/Logger.ts","../lib/logger/enums/LogLevelEnum.ts","../lib/logger/transports/ConsoleTransport.ts","../lib/logger/LogMessageBuilder.ts","../lib/utils/DataTypeUtil.ts","../lib/logger/core/TransportManager.ts","../lib/logger/core/LogManager.ts","../lib/services/LoggerService.ts","../lib/VWOContext.ts","../lib/VWOProvider.tsx","../lib/useVWOClient.ts","../lib/useGetFlag.ts","../lib/useGetFlagVariable.ts","../lib/useTrackEvent.ts","../lib/useSetAttribute.ts"],"sourcesContent":["/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Abstract class representing a logger.\n * This class provides the structure for logging mechanisms and should be extended by specific logger implementations.\n */\nexport abstract class Logger {\n /**\n * Logs a message at the trace level.\n * @param {string} message - The message to log.\n */\n abstract trace(message: string): void;\n\n /**\n * Logs a message at the debug level.\n * @param {string} message - The message to log.\n */\n abstract debug(message: string): void;\n\n /**\n * Logs a message at the info level.\n * @param {string} message - The message to log.\n */\n abstract info(message: string): void;\n\n /**\n * Logs a message at the warn level.\n * @param {string} message - The message to log.\n */\n abstract warn(message: string): void;\n\n /**\n * Logs a message at the error level.\n * @param {string} message - The message to log.\n */\n abstract error(message: string): void;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum LogLevelEnum {\n TRACE = 'trace',\n DEBUG = 'debug',\n INFO = 'info',\n WARN = 'warn',\n ERROR = 'error',\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { Logger } from '../Logger';\n\n/**\n * ConsoleTransport class implements the Logger interface to provide logging functionality.\n * It outputs logs to the console based on the log level set in the configuration.\n */\nexport class ConsoleTransport implements Logger {\n config: Record<string, any>; // Configuration object for the logger\n level: string; // Current log level\n\n /**\n * Constructor initializes the ConsoleTransport with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the logger, including 'level'.\n */\n constructor(config: Record<string, any> = {}) {\n this.config = config; // Store the configuration\n this.level = this.config.level; // Set the logging level from the configuration\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.consoleLog(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.consoleLog(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.consoleLog(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.consoleLog(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.consoleLog(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Generic log function that logs messages to the console based on the log level.\n * @param {string} level - The log level under which the message should be logged.\n * @param {string} message - The message to log.\n */\n consoleLog(level: string, message: string): void {\n console[level](message); // Use console's logging function dynamically based on the level\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\nimport { LogLevelEnum } from './enums/LogLevelEnum';\n\n/**\n * Interface defining the structure for a log message builder.\n */\ninterface ILogMessageBuilder {\n loggerConfig: Record<string, dynamic>; // Configuration for the logger\n transportConfig: Record<string, dynamic>; // Configuration for the transport mechanism\n prefix: string; // Prefix to be added to each log message\n dateTimeFormat: dynamic; // Function or format for date and time in log messages\n\n formatMessage(level: string, message: string): string; // Method to format a log message\n getFormattedLevel(level: string): string; // Method to format the log level\n getFormattedDateTime(): string; // Method to get formatted date and time\n}\n\n/**\n * Implements the ILogMessageBuilder interface to provide a concrete log message builder.\n */\nexport class LogMessageBuilder implements ILogMessageBuilder {\n loggerConfig: Record<string, any>;\n transportConfig: Record<string, any>;\n prefix: string;\n dateTimeFormat: any;\n\n /**\n * Constructs a new LogMessageBuilder instance.\n * @param {Record<string, any>} loggerConfig - Configuration for the logger.\n * @param {Record<string, any>} transportConfig - Configuration for the transport mechanism.\n */\n constructor(loggerConfig: Record<string, any>, transportConfig: Record<string, any>) {\n this.loggerConfig = loggerConfig;\n this.transportConfig = transportConfig;\n\n // Set the prefix, defaulting to an empty string if not provided.\n this.prefix = this.transportConfig.prefix || this.loggerConfig.prefix || '';\n // Set the date and time format, defaulting to the logger's format if the transport's format is not provided.\n this.dateTimeFormat = this.transportConfig.dateTimeFormat || this.loggerConfig.dateTimeFormat;\n }\n\n /**\n * Formats a log message combining level, prefix, date/time, and the actual message.\n * @param {string} level - The log level.\n * @param {string} message - The message to log.\n * @returns {string} The formatted log message.\n */\n formatMessage(level: string, message: string): string {\n return `[${this.getFormattedLevel(level)}]: ${this.getFormattedPrefix(this.prefix)} ${this.getFormattedDateTime()} ${message}`;\n }\n\n getFormattedPrefix(prefix: string): string {\n return `${prefix}`;\n }\n\n /**\n * Returns the formatted log level with appropriate coloring based on the log level.\n * @param {string} level - The log level.\n * @returns {string} The formatted log level.\n */\n getFormattedLevel(level: string): string {\n const upperCaseLevel = level.toUpperCase();\n let LogLevelColorInfoEnum;\n\n LogLevelColorInfoEnum = {\n [LogLevelEnum.TRACE]: upperCaseLevel,\n [LogLevelEnum.DEBUG]: upperCaseLevel,\n [LogLevelEnum.INFO]: upperCaseLevel,\n [LogLevelEnum.WARN]: upperCaseLevel,\n [LogLevelEnum.ERROR]: upperCaseLevel,\n };\n\n return LogLevelColorInfoEnum[level];\n }\n\n /**\n * Retrieves the current date and time formatted according to the specified format.\n * @returns {string} The formatted date and time.\n */\n getFormattedDateTime(): string {\n return this.dateTimeFormat();\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\n\ntype FunctionType = (val: dynamic) => void;\n\n/**\n * Checks if a value is a function.\n * @param val The value to check.\n * @returns True if the value is a function, false otherwise.\n */\nexport function isFunction(val: dynamic): val is FunctionType {\n return Object.prototype.toString.call(val) === '[object Function]';\n}\n\n/**\n * Checks if a value is an object (excluding arrays, functions, regex, promises, and dates).\n * @param val The value to check.\n * @returns True if the value is a valid object, false otherwise.\n */\nexport function isObject<T>(\n val: T,\n): val is Record<any, dynamic> & Exclude<T, Array<dynamic> | FunctionType | RegExp | Promise<dynamic> | Date> {\n return Object.prototype.toString.call(val) === '[object Object]';\n}\n\n/**\n * Checks if a value is a string.\n * @param val The value to check.\n * @returns True if the value is a string, false otherwise.\n */\nexport function isString(val: dynamic): val is string {\n return typeof val === 'string' || Object.prototype.toString.call(val) === '[object String]';\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { LogMessageBuilder } from '../LogMessageBuilder';\nimport { Logger } from '../Logger';\nimport { isFunction } from '../../utils/DataTypeUtil';\n\nenum LogLevelNumberEnum {\n TRACE = 0,\n DEBUG = 1,\n INFO = 2,\n WARN = 3,\n ERROR = 4,\n}\n\ninterface IlogTransport extends Logger {\n transports: Array<Record<string, dynamic>>;\n config: Record<string, dynamic>;\n\n // Determines if a message should be logged based on the transport and configuration levels\n shouldLog(transportLevel: string, configLevel: string): boolean;\n // Logs a message at a specified level\n log(level: string, message: string): void;\n}\n\n/**\n * Manages logging transports and delegates logging messages to them based on configuration.\n * Implements the IlogTransport interface.\n */\nexport class LogTransportManager implements IlogTransport {\n transports: Array<Record<string, any>>;\n config: Record<string, any>;\n\n /**\n * Initializes the manager with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the log manager.\n */\n constructor(config: Record<string, any>) {\n this.transports = [];\n this.config = config;\n }\n\n /**\n * Adds a new transport to the manager.\n * @param {Record<string, any>} transport - The transport object to be added.\n */\n addTransport(transport: Record<string, any>): void {\n this.transports.push(transport);\n }\n\n /**\n * Determines if the log should be processed based on the transport and configuration levels.\n * @param {string} transportLevel - The log level set for the transport.\n * @param {string} configLevel - The log level set in the configuration.\n * @returns {boolean} - Returns true if the log level is appropriate for logging, false otherwise.\n */\n shouldLog(transportLevel: string, configLevel: string): boolean {\n // Default to the most specific level available\n // transportLevel = transportLevel || configLevel || this.config.level;\n\n const targetLevel = LogLevelNumberEnum[transportLevel.toUpperCase()];\n const desiredLevel = LogLevelNumberEnum[(configLevel || this.config.level).toUpperCase()];\n\n return targetLevel >= desiredLevel;\n }\n\n /**\n * Logs a message at TRACE level.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a message at DEBUG level.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs a message at INFO level.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a message at WARN level.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs a message at ERROR level.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.log(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Delegates the logging of messages to the appropriate transports.\n * @param {string} level - The level at which to log the message.\n * @param {string} message - The message to log.\n */\n log(level: string, message: string): void {\n for (let i = 0; i < this.transports.length; i++) {\n const logMessageBuilder = new LogMessageBuilder(this.config, this.transports[i]);\n const formattedMessage = logMessageBuilder.formatMessage(level, message);\n if (this.shouldLog(level, this.transports[i].level)) {\n if (this.transports[i].log && isFunction(this.transports[i].log)) {\n // Use custom log handler if available\n this.transports[i].log(level, message);\n } else {\n // Otherwise, use the default log method\n this.transports[i][level](formattedMessage);\n }\n }\n }\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\n\nimport { Logger } from '../Logger';\nimport { ConsoleTransport } from '../transports/ConsoleTransport';\nimport { LogTransportManager } from './TransportManager';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\n\n/**\n * Interface defining the structure and methods for LogManager.\n */\nexport interface ILogManager {\n transportManager?: LogTransportManager;\n config?: Record<string, dynamic>;\n name?: string;\n requestId?: string;\n level: string;\n prefix?: string;\n dateTimeFormat?: () => string;\n\n transport?: Record<string, dynamic>;\n transports?: Array<Record<string, dynamic>>;\n\n addTransport?(transportObject: Record<string, dynamic>): void;\n addTransports?(transportsList: Array<Record<string, dynamic>>): void;\n}\n\n/**\n * LogManager class provides logging functionality with support for multiple transports.\n * It is designed as a singleton to ensure a single instance throughout the application.\n */\nexport class LogManager extends Logger implements ILogManager {\n private static instance: LogManager; // Singleton instance of LogManager\n transportManager: LogTransportManager;\n config: Record<string, any>;\n name = 'VWO Logger'; // Default logger name\n requestId = new Date().getTime().toString(); // current timestamp in milliseconds\n level = LogLevelEnum.ERROR; // Default logging level\n prefix = 'VWO-SDK'; // Default prefix for log messages\n public dateTimeFormat(): string {\n return new Date().toISOString(); // Default date-time format for log messages\n }\n transport: Record<string, any>;\n transports: Array<Record<string, any>>;\n\n /**\n * Constructor for LogManager.\n * @param {Record<string, any>} config - Configuration object for LogManager.\n */\n constructor(config?: Record<string, any>) {\n super();\n\n this.config = config;\n\n if (config.isAlwaysNewInstance || !LogManager.instance) {\n LogManager.instance = this;\n\n // Initialize configuration with defaults or provided values\n this.config.name = config.name || this.name;\n this.config.requestId = config.requestId || this.requestId;\n this.config.level = config.level || this.level;\n this.config.prefix = config.prefix || this.prefix;\n this.config.dateTimeFormat = config.dateTimeFormat || this.dateTimeFormat;\n\n this.transportManager = new LogTransportManager(this.config);\n\n this.handleTransports();\n }\n\n return LogManager.instance;\n }\n\n /**\n * Provides access to the singleton instance of LogManager.\n * @returns {LogManager} The singleton instance.\n */\n static get Instance(): LogManager {\n return LogManager.instance;\n }\n\n /**\n * Handles the initialization and setup of transports based on configuration.\n */\n handleTransports(): void {\n this.addTransport(\n new ConsoleTransport({\n level: this.config.level,\n }),\n );\n }\n\n /**\n * Adds a single transport to the LogManager.\n * @param {Record<any, any>} transport - The transport object to add.\n */\n addTransport(transport: Record<any, any>): void {\n this.transportManager.addTransport(transport);\n }\n\n /**\n * Adds multiple transports to the LogManager.\n * @param {Array<Record<any, any>>} transports - The list of transport objects to add.\n */\n addTransports(transports: Record<any, any>): void {\n for (let i = 0; i < transports.length; i++) {\n this.addTransport(transports[i]);\n }\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log at trace level.\n */\n trace(message: string): void {\n this.transportManager.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log at debug level.\n */\n debug(message: string): void {\n this.transportManager.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log at info level.\n */\n info(message: string): void {\n this.transportManager.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log at warn level.\n */\n warn(message: string): void {\n this.transportManager.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log at error level.\n */\n error(message: string): void {\n this.transportManager.log(LogLevelEnum.ERROR, message);\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * logger.ts - Global Logger Singleton\n */\nimport { LogManager } from '../logger/core/LogManager';\n\nlet logger: LogManager | null = null;\n\n/**\n * Initializes the global logger instance.\n * This function should be called inside `VWOProvider` before logging is used anywhere in the application.\n *\n * @param {object} config - The logger configuration object.\n * @param {object} config.logger - Optional logging configuration (e.g., log level, transports).\n * @returns {void} No return value; initializes the logger instance.\n */\nexport function initLogger(config: any) {\n if (!logger) {\n logger = new LogManager(config.logger || {});\n }\n}\n\n/**\n * Retrieves the global logger instance.\n * Ensures that `initLogger` has been called before attempting to use logging.\n *\n * @returns {LogManager} The global logger instance.\n */\nexport function getLogger(): LogManager {\n if (!logger) {\n logger = new LogManager({ level: 'error' });\n }\n return logger;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createContext, useContext } from 'react';\nimport { getLogger } from './services/LoggerService';\n\ninterface VWOContextType {\n vwoClient: any;\n userContext?: any;\n setUserContext?: (context: any) => void;\n}\n\nexport const VWOContext = createContext<VWOContextType>({\n vwoClient: null,\n userContext: null,\n setUserContext: undefined, // Default is undefined\n});\n\nexport const useVWOContext = () => {\n const logger = getLogger();\n try {\n // Fetch the context\n const context = useContext(VWOContext);\n\n // If the context is not found, throw an error\n if (!context) {\n logger.error('useVWOContext must be used within a VWOProvider');\n return null;\n }\n return context;\n } catch (error) {\n logger.error(`Error in useVWOContext hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useState, useRef, ReactNode } from 'react';\nimport { init } from 'vwo-fme-node-sdk';\nimport { VWOContext } from './VWOContext';\nimport { initLogger, getLogger } from './services/LoggerService';\n\ninterface VWOProviderProps {\n client?: any;\n config?: any;\n userContext?: any;\n children: ReactNode;\n}\n\n/**\n * VWOProvider component to provide VWO client and configuration context to child components.\n *\n * @param {Object} props - The properties for the VWOProvider component.\n * @param {Object} props.client - The VWO client instance.\n * @param {Object} props.config - Configuration settings for the VWO client.\n * @param {Object} props.userContext - Initial user context for the VWO client.\n * @param {React.ReactNode} props.children - Child components that will have access to the VWO context.\n * @returns {JSX.Element} The provider component wrapping its children with VWO context.\n */\nexport const VWOProvider: React.FC<VWOProviderProps> = ({ client, config, userContext, children }) => {\n const [vwoClient, setVwoClient] = useState<any>(client || null);\n const [context, setContext] = useState<any>(userContext || null);\n const vwoClientRef = useRef<any>(vwoClient); // Store the client reference without triggering re-renders\n const isMounted = useRef(true); // Prevent updates after unmount\n\n const logger = getLogger();\n\n // Initialize logger globally before using it\n useEffect(() => {\n if (config?.logger) {\n initLogger(config);\n }\n }, [config]);\n\n // Initialize the VWO SDK instance only once when the component mounts or if config is updated\n useEffect(() => {\n // If neither vwoClient nor config is provided, log the error\n if (!vwoClient && !config) {\n logger.error(\"VWOProvider Error: Either `client` or `config` must be provided.\");\n return;\n }\n\n const initializeVWO = async () => {\n try {\n if (!vwoClient && config) {\n // Initialize the VWO SDK instance if vwoClient is not already initialized\n const instance = await init(config);\n if (isMounted.current) {\n setVwoClient(instance);\n vwoClientRef.current = instance;\n }\n }\n } catch (error) {\n logger.error(`VWO-SDK Initialization failed: ${error}`);\n }\n };\n\n // Only initialize once\n if (!vwoClient && config) {\n initializeVWO();\n }\n\n return () => {\n isMounted.current = false;\n if (vwoClientRef.current && vwoClientRef.current.destroy) {\n vwoClientRef.current.destroy();\n }\n };\n }, [config, vwoClient]); // Re-run only when config or vwoClient changes\n\n return (\n <VWOContext.Provider value={{ vwoClient, userContext: context, setUserContext: setContext }}>\n {children}\n </VWOContext.Provider>\n );\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\n\n/**\n * Returns the VWO SDK client instance\n * @returns VWO SDK client instance\n */\nexport const useVWOClient = () => {\n const logger = getLogger();\n try {\n const context = useVWOContext();\n\n // If the VWO SDK client is not found, throw an error\n if (!context || !context.vwoClient) {\n logger.error('useVWOClient must be used within a VWOProvider !!');\n return null;\n }\n\n // Return the VWO SDK client\n return context.vwoClient;\n } catch (error) {\n logger.error(`Error in useVWOClient hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useVWOContext } from './VWOContext';\nimport { getLogger } from './services/LoggerService';\nimport { isObject } from './utils/DataTypeUtil';\n\n/**\n * Custom hook to retrieve a feature flag using VWO client.\n *\n * @param {string} featureKey - The key of the feature flag to retrieve.\n * @param {Object} [context] - Optional user context to use for fetching the flag.\n * @returns {Object} An object containing the flag and a readiness status.\n */\nexport const useGetFlag = (featureKey: string, context?: any) => {\n // Define the error return schema for the hook\n const errorReturnSchema = {\n flag: {\n isEnabled: (): boolean => false,\n getVariables: (): Array<Record<string, any>> => [],\n getVariable: (_key: string, defaultValue: any): any => defaultValue,\n },\n isReady: (): boolean => false,\n };\n\n // Destructure vwoClient, setUserContext, and userContext from VWOContext\n const { vwoClient, setUserContext, userContext } = useVWOContext();\n\n // State to store the flag and loading status\n const [flag, setFlag] = useState<any | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n // Get the logger instance\n const logger = getLogger();\n\n // Memoize the user context to prevent unnecessary re-renders\n const stableUserContext = useMemo(() => {\n return context || userContext || {};\n }, [JSON.stringify(userContext)]); // Only recreate if userContext actually changes\n\n // Define the getFlag function to fetch the feature flag\n const getFlag = useCallback(async () => {\n // Check if featureKey is provided\n if (!featureKey) {\n logger.error('Feature key is required for useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Check if the user context is a valid object\n if (!isObject(stableUserContext)) {\n logger.error('Invalid user context in useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Try to fetch the feature flag and handle errors\n try {\n setIsLoading(true);\n const result = await vwoClient.getFlag(featureKey, stableUserContext);\n setFlag(result);\n\n // Set the user context in the context to ensure it's available for other hooks\n setUserContext(stableUserContext);\n } catch (error) {\n logger.error(`Error fetching feature flag \"${featureKey}\": ${error}`);\n setFlag(null);\n } finally {\n setIsLoading(false);\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Ensure vwoClient is ready\n if (!vwoClient) {\n logger.error('VWO Client is missing in useGetFlag hook. Ensure VWOProvider is correctly initialized.');\n return errorReturnSchema;\n }\n\n // Run effect when dependencies change to fetch the flag\n useEffect(() => {\n if (featureKey && vwoClient && stableUserContext) {\n getFlag();\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Return the flag and readiness status\n return {\n flag,\n isReady: (): boolean => !isLoading && !!flag,\n };\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to get all variables from a flag\n * @param flag - The flag to get the variables from\n * @returns The variables from the flag\n */\nexport const useGetFlagVariables = (flag: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariables hook and should be an object');\n return [];\n }\n\n return flag.getVariables();\n } catch (error) {\n logger.error(`Error getting flag variables: ${error}`);\n return [];\n }\n};\n\n/**\n * Hook to get a flag variable\n * @param flag - The flag to get the variable from\n * @param variableKey - The key of the variable to get\n * @param defaultValue - The default value to return if the variable is not found\n * @returns The value of the variable\n */\nexport const useGetFlagVariable = (flag: any, variableKey: string, defaultValue: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariable hook and should be an object');\n return [];\n }\n\n if (!flag || !variableKey) {\n logger.error('Flag and variable key are required for useGetFlagVariable hook');\n return defaultValue;\n }\n\n return flag.getVariable(variableKey, defaultValue);\n } catch (error) {\n logger.error(`Error getting flag variable: ${error}`);\n return defaultValue;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\nimport { isObject, isString } from './utils/DataTypeUtil';\n\n/**\n * Hook to track an event\n * @param eventName - The name of the event to track\n * @param eventProperties - The properties of the event to track (optional)\n */\nexport const useTrackEvent = (eventName: string, eventProperties: Record<string, string> = {}) => {\n const logger = getLogger();\n try {\n if (!eventName && !isString(eventName)) {\n logger.error('Event name is required for useTrackEvent hook and it should be a string');\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useTrackEvent hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useTrackEvent hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Track the event\n vwoClient.trackEvent(eventName, userContext, eventProperties);\n } catch (error) {\n logger.error(`Error tracking event: ${error}`);\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useVWOContext } from './VWOContext';\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to set attributes for the user\n * @param attributeMap - The map of attributes to set\n */\nexport const useSetAttribute = (attributeMap: Record<string, string>) => {\n const logger = getLogger();\n try {\n if (!attributeMap || !isObject(attributeMap) || Object.keys(attributeMap).length === 0) {\n logger.error(\n 'attributeMap(object having key-value pairs of user attributes) is required for useSetAttribute hook',\n );\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useSetAttribute hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useSetAttribute hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Set the attributes\n vwoClient.setAttribute(attributeMap, userContext);\n } catch (error) {\n logger.error(`Error setting attributes: ${error}`);\n }\n};\n"],"names":["Logger","LogLevelEnum","ConsoleTransport","constructor","config","level","trace","message","consoleLog","TRACE","debug","DEBUG","info","INFO","warn","WARN","error","ERROR","console","LogMessageBuilder","loggerConfig","transportConfig","prefix","dateTimeFormat","formatMessage","getFormattedLevel","getFormattedPrefix","getFormattedDateTime","upperCaseLevel","toUpperCase","LogLevelColorInfoEnum","isFunction","val","Object","prototype","toString","call","isObject","isString","LogLevelNumberEnum","LogTransportManager","transports","addTransport","transport","push","shouldLog","transportLevel","configLevel","targetLevel","desiredLevel","log","i","length","logMessageBuilder","formattedMessage","LogManager","Date","getTime","isAlwaysNewInstance","instance","name","requestId","transportManager","handleTransports","toISOString","Instance","addTransports","logger","initLogger","getLogger","VWOContext","createContext","vwoClient","userContext","setUserContext","undefined","useVWOContext","context","useContext","VWOProvider","client","children","setVwoClient","useState","setContext","vwoClientRef","useRef","isMounted","useEffect","initializeVWO","init","current","destroy","React","Provider","value","useVWOClient","useGetFlag","featureKey","errorReturnSchema","flag","isEnabled","getVariables","getVariable","_key","defaultValue","isReady","setFlag","isLoading","setIsLoading","stableUserContext","useMemo","JSON","stringify","getFlag","useCallback","result","useGetFlagVariables","useGetFlagVariable","variableKey","useTrackEvent","eventName","eventProperties","trackEvent","useSetAttribute","attributeMap","keys","setAttribute"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAgBA;;;;MAIsBA,MAAM;;ACpB5B;;;;;;;;;;;;;;;AAgBA,AAAA,IAAYC,YAMX;AAND,WAAYA,YAAY;EACtBA,+BAAe;EACfA,+BAAe;EACfA,6BAAa;EACbA,6BAAa;EACbA,+BAAe;AACjB,CAAC,EANWA,YAAY,KAAZA,YAAY;;AChBxB;;;;;;;;;;;;;;;AAgBA,AAGA;;;;AAIA,MAAaC,gBAAgB;;;;;EAQ3BC,YAAYC,SAA8B,EAAE;IAC1C,IAAI,CAACA,MAAM,GAAGA,MAAM,CAAC;IACrB,IAAI,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACC,KAAK,CAAC;;;;;;EAOjCC,KAAKA,CAACC,OAAe;IACnB,IAAI,CAACC,UAAU,CAACP,YAAY,CAACQ,KAAK,EAAEF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Q,CAACoC,WAAW,CAAC,EAAE;MAC1CN,MAAM,CAACnD,KAAK,CAAC,uFAAuF,CAAC;MACrG,OAAO,EAAE;;;IAIXwD,SAAS,CAACuD,YAAY,CAACF,YAAY,EAAEpD,WAAW,CAAC;GAClD,CAAC,OAAOzD,KAAK,EAAE;IACdmD,MAAM,CAACnD,KAAK,CAAC,6BAA6BA,KAAK,EAAE,CAAC;;AAEtD,CAAC;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"vwo-fme-react-sdk.cjs.production.min.js","sources":["../lib/logger/Logger.ts","../lib/logger/enums/LogLevelEnum.ts","../lib/logger/transports/ConsoleTransport.ts","../lib/logger/LogMessageBuilder.ts","../lib/utils/DataTypeUtil.ts","../lib/logger/core/TransportManager.ts","../lib/logger/core/LogManager.ts","../lib/services/LoggerService.ts","../lib/VWOContext.ts","../lib/VWOProvider.tsx","../lib/useVWOClient.ts","../lib/useGetFlag.ts","../lib/useGetFlagVariable.ts","../lib/useTrackEvent.ts","../lib/useSetAttribute.ts"],"sourcesContent":["/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Abstract class representing a logger.\n * This class provides the structure for logging mechanisms and should be extended by specific logger implementations.\n */\nexport abstract class Logger {\n /**\n * Logs a message at the trace level.\n * @param {string} message - The message to log.\n */\n abstract trace(message: string): void;\n\n /**\n * Logs a message at the debug level.\n * @param {string} message - The message to log.\n */\n abstract debug(message: string): void;\n\n /**\n * Logs a message at the info level.\n * @param {string} message - The message to log.\n */\n abstract info(message: string): void;\n\n /**\n * Logs a message at the warn level.\n * @param {string} message - The message to log.\n */\n abstract warn(message: string): void;\n\n /**\n * Logs a message at the error level.\n * @param {string} message - The message to log.\n */\n abstract error(message: string): void;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum LogLevelEnum {\n TRACE = 'trace',\n DEBUG = 'debug',\n INFO = 'info',\n WARN = 'warn',\n ERROR = 'error',\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { Logger } from '../Logger';\n\n/**\n * ConsoleTransport class implements the Logger interface to provide logging functionality.\n * It outputs logs to the console based on the log level set in the configuration.\n */\nexport class ConsoleTransport implements Logger {\n config: Record<string, any>; // Configuration object for the logger\n level: string; // Current log level\n\n /**\n * Constructor initializes the ConsoleTransport with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the logger, including 'level'.\n */\n constructor(config: Record<string, any> = {}) {\n this.config = config; // Store the configuration\n this.level = this.config.level; // Set the logging level from the configuration\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.consoleLog(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.consoleLog(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.consoleLog(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.consoleLog(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.consoleLog(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Generic log function that logs messages to the console based on the log level.\n * @param {string} level - The log level under which the message should be logged.\n * @param {string} message - The message to log.\n */\n consoleLog(level: string, message: string): void {\n console[level](message); // Use console's logging function dynamically based on the level\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\nimport { LogLevelEnum } from './enums/LogLevelEnum';\n\n/**\n * Interface defining the structure for a log message builder.\n */\ninterface ILogMessageBuilder {\n loggerConfig: Record<string, dynamic>; // Configuration for the logger\n transportConfig: Record<string, dynamic>; // Configuration for the transport mechanism\n prefix: string; // Prefix to be added to each log message\n dateTimeFormat: dynamic; // Function or format for date and time in log messages\n\n formatMessage(level: string, message: string): string; // Method to format a log message\n getFormattedLevel(level: string): string; // Method to format the log level\n getFormattedDateTime(): string; // Method to get formatted date and time\n}\n\n/**\n * Implements the ILogMessageBuilder interface to provide a concrete log message builder.\n */\nexport class LogMessageBuilder implements ILogMessageBuilder {\n loggerConfig: Record<string, any>;\n transportConfig: Record<string, any>;\n prefix: string;\n dateTimeFormat: any;\n\n /**\n * Constructs a new LogMessageBuilder instance.\n * @param {Record<string, any>} loggerConfig - Configuration for the logger.\n * @param {Record<string, any>} transportConfig - Configuration for the transport mechanism.\n */\n constructor(loggerConfig: Record<string, any>, transportConfig: Record<string, any>) {\n this.loggerConfig = loggerConfig;\n this.transportConfig = transportConfig;\n\n // Set the prefix, defaulting to an empty string if not provided.\n this.prefix = this.transportConfig.prefix || this.loggerConfig.prefix || '';\n // Set the date and time format, defaulting to the logger's format if the transport's format is not provided.\n this.dateTimeFormat = this.transportConfig.dateTimeFormat || this.loggerConfig.dateTimeFormat;\n }\n\n /**\n * Formats a log message combining level, prefix, date/time, and the actual message.\n * @param {string} level - The log level.\n * @param {string} message - The message to log.\n * @returns {string} The formatted log message.\n */\n formatMessage(level: string, message: string): string {\n return `[${this.getFormattedLevel(level)}]: ${this.getFormattedPrefix(this.prefix)} ${this.getFormattedDateTime()} ${message}`;\n }\n\n getFormattedPrefix(prefix: string): string {\n return `${prefix}`;\n }\n\n /**\n * Returns the formatted log level with appropriate coloring based on the log level.\n * @param {string} level - The log level.\n * @returns {string} The formatted log level.\n */\n getFormattedLevel(level: string): string {\n const upperCaseLevel = level.toUpperCase();\n let LogLevelColorInfoEnum;\n\n LogLevelColorInfoEnum = {\n [LogLevelEnum.TRACE]: upperCaseLevel,\n [LogLevelEnum.DEBUG]: upperCaseLevel,\n [LogLevelEnum.INFO]: upperCaseLevel,\n [LogLevelEnum.WARN]: upperCaseLevel,\n [LogLevelEnum.ERROR]: upperCaseLevel,\n };\n\n return LogLevelColorInfoEnum[level];\n }\n\n /**\n * Retrieves the current date and time formatted according to the specified format.\n * @returns {string} The formatted date and time.\n */\n getFormattedDateTime(): string {\n return this.dateTimeFormat();\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\n\ntype FunctionType = (val: dynamic) => void;\n\n/**\n * Checks if a value is a function.\n * @param val The value to check.\n * @returns True if the value is a function, false otherwise.\n */\nexport function isFunction(val: dynamic): val is FunctionType {\n return Object.prototype.toString.call(val) === '[object Function]';\n}\n\n/**\n * Checks if a value is an object (excluding arrays, functions, regex, promises, and dates).\n * @param val The value to check.\n * @returns True if the value is a valid object, false otherwise.\n */\nexport function isObject<T>(\n val: T,\n): val is Record<any, dynamic> & Exclude<T, Array<dynamic> | FunctionType | RegExp | Promise<dynamic> | Date> {\n return Object.prototype.toString.call(val) === '[object Object]';\n}\n\n/**\n * Checks if a value is a string.\n * @param val The value to check.\n * @returns True if the value is a string, false otherwise.\n */\nexport function isString(val: dynamic): val is string {\n return typeof val === 'string' || Object.prototype.toString.call(val) === '[object String]';\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { LogMessageBuilder } from '../LogMessageBuilder';\nimport { Logger } from '../Logger';\nimport { isFunction } from '../../utils/DataTypeUtil';\n\nenum LogLevelNumberEnum {\n TRACE = 0,\n DEBUG = 1,\n INFO = 2,\n WARN = 3,\n ERROR = 4,\n}\n\ninterface IlogTransport extends Logger {\n transports: Array<Record<string, dynamic>>;\n config: Record<string, dynamic>;\n\n // Determines if a message should be logged based on the transport and configuration levels\n shouldLog(transportLevel: string, configLevel: string): boolean;\n // Logs a message at a specified level\n log(level: string, message: string): void;\n}\n\n/**\n * Manages logging transports and delegates logging messages to them based on configuration.\n * Implements the IlogTransport interface.\n */\nexport class LogTransportManager implements IlogTransport {\n transports: Array<Record<string, any>>;\n config: Record<string, any>;\n\n /**\n * Initializes the manager with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the log manager.\n */\n constructor(config: Record<string, any>) {\n this.transports = [];\n this.config = config;\n }\n\n /**\n * Adds a new transport to the manager.\n * @param {Record<string, any>} transport - The transport object to be added.\n */\n addTransport(transport: Record<string, any>): void {\n this.transports.push(transport);\n }\n\n /**\n * Determines if the log should be processed based on the transport and configuration levels.\n * @param {string} transportLevel - The log level set for the transport.\n * @param {string} configLevel - The log level set in the configuration.\n * @returns {boolean} - Returns true if the log level is appropriate for logging, false otherwise.\n */\n shouldLog(transportLevel: string, configLevel: string): boolean {\n // Default to the most specific level available\n // transportLevel = transportLevel || configLevel || this.config.level;\n\n const targetLevel = LogLevelNumberEnum[transportLevel.toUpperCase()];\n const desiredLevel = LogLevelNumberEnum[(configLevel || this.config.level).toUpperCase()];\n\n return targetLevel >= desiredLevel;\n }\n\n /**\n * Logs a message at TRACE level.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a message at DEBUG level.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs a message at INFO level.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a message at WARN level.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs a message at ERROR level.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.log(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Delegates the logging of messages to the appropriate transports.\n * @param {string} level - The level at which to log the message.\n * @param {string} message - The message to log.\n */\n log(level: string, message: string): void {\n for (let i = 0; i < this.transports.length; i++) {\n const logMessageBuilder = new LogMessageBuilder(this.config, this.transports[i]);\n const formattedMessage = logMessageBuilder.formatMessage(level, message);\n if (this.shouldLog(level, this.transports[i].level)) {\n if (this.transports[i].log && isFunction(this.transports[i].log)) {\n // Use custom log handler if available\n this.transports[i].log(level, message);\n } else {\n // Otherwise, use the default log method\n this.transports[i][level](formattedMessage);\n }\n }\n }\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\n\nimport { Logger } from '../Logger';\nimport { ConsoleTransport } from '../transports/ConsoleTransport';\nimport { LogTransportManager } from './TransportManager';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\n\n/**\n * Interface defining the structure and methods for LogManager.\n */\nexport interface ILogManager {\n transportManager?: LogTransportManager;\n config?: Record<string, dynamic>;\n name?: string;\n requestId?: string;\n level: string;\n prefix?: string;\n dateTimeFormat?: () => string;\n\n transport?: Record<string, dynamic>;\n transports?: Array<Record<string, dynamic>>;\n\n addTransport?(transportObject: Record<string, dynamic>): void;\n addTransports?(transportsList: Array<Record<string, dynamic>>): void;\n}\n\n/**\n * LogManager class provides logging functionality with support for multiple transports.\n * It is designed as a singleton to ensure a single instance throughout the application.\n */\nexport class LogManager extends Logger implements ILogManager {\n private static instance: LogManager; // Singleton instance of LogManager\n transportManager: LogTransportManager;\n config: Record<string, any>;\n name = 'VWO Logger'; // Default logger name\n requestId = new Date().getTime().toString(); // current timestamp in milliseconds\n level = LogLevelEnum.ERROR; // Default logging level\n prefix = 'VWO-SDK'; // Default prefix for log messages\n public dateTimeFormat(): string {\n return new Date().toISOString(); // Default date-time format for log messages\n }\n transport: Record<string, any>;\n transports: Array<Record<string, any>>;\n\n /**\n * Constructor for LogManager.\n * @param {Record<string, any>} config - Configuration object for LogManager.\n */\n constructor(config?: Record<string, any>) {\n super();\n\n this.config = config;\n\n if (config.isAlwaysNewInstance || !LogManager.instance) {\n LogManager.instance = this;\n\n // Initialize configuration with defaults or provided values\n this.config.name = config.name || this.name;\n this.config.requestId = config.requestId || this.requestId;\n this.config.level = config.level || this.level;\n this.config.prefix = config.prefix || this.prefix;\n this.config.dateTimeFormat = config.dateTimeFormat || this.dateTimeFormat;\n\n this.transportManager = new LogTransportManager(this.config);\n\n this.handleTransports();\n }\n\n return LogManager.instance;\n }\n\n /**\n * Provides access to the singleton instance of LogManager.\n * @returns {LogManager} The singleton instance.\n */\n static get Instance(): LogManager {\n return LogManager.instance;\n }\n\n /**\n * Handles the initialization and setup of transports based on configuration.\n */\n handleTransports(): void {\n this.addTransport(\n new ConsoleTransport({\n level: this.config.level,\n }),\n );\n }\n\n /**\n * Adds a single transport to the LogManager.\n * @param {Record<any, any>} transport - The transport object to add.\n */\n addTransport(transport: Record<any, any>): void {\n this.transportManager.addTransport(transport);\n }\n\n /**\n * Adds multiple transports to the LogManager.\n * @param {Array<Record<any, any>>} transports - The list of transport objects to add.\n */\n addTransports(transports: Record<any, any>): void {\n for (let i = 0; i < transports.length; i++) {\n this.addTransport(transports[i]);\n }\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log at trace level.\n */\n trace(message: string): void {\n this.transportManager.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log at debug level.\n */\n debug(message: string): void {\n this.transportManager.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log at info level.\n */\n info(message: string): void {\n this.transportManager.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log at warn level.\n */\n warn(message: string): void {\n this.transportManager.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log at error level.\n */\n error(message: string): void {\n this.transportManager.log(LogLevelEnum.ERROR, message);\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * logger.ts - Global Logger Singleton\n */\nimport { LogManager } from '../logger/core/LogManager';\n\nlet logger: LogManager | null = null;\n\n/**\n * Initializes the global logger instance.\n * This function should be called inside `VWOProvider` before logging is used anywhere in the application.\n *\n * @param {object} config - The logger configuration object.\n * @param {object} config.logger - Optional logging configuration (e.g., log level, transports).\n * @returns {void} No return value; initializes the logger instance.\n */\nexport function initLogger(config: any) {\n if (!logger) {\n logger = new LogManager(config.logger || {});\n }\n}\n\n/**\n * Retrieves the global logger instance.\n * Ensures that `initLogger` has been called before attempting to use logging.\n *\n * @returns {LogManager} The global logger instance.\n */\nexport function getLogger(): LogManager {\n if (!logger) {\n logger = new LogManager({ level: 'error' });\n }\n return logger;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createContext, useContext } from 'react';\nimport { getLogger } from './services/LoggerService';\n\ninterface VWOContextType {\n vwoClient: any;\n userContext?: any;\n setUserContext?: (context: any) => void;\n}\n\nexport const VWOContext = createContext<VWOContextType>({\n vwoClient: null,\n userContext: null,\n setUserContext: undefined, // Default is undefined\n});\n\nexport const useVWOContext = () => {\n const logger = getLogger();\n try {\n // Fetch the context\n const context = useContext(VWOContext);\n\n // If the context is not found, throw an error\n if (!context) {\n logger.error('useVWOContext must be used within a VWOProvider');\n return null;\n }\n return context;\n } catch (error) {\n logger.error(`Error in useVWOContext hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useState, useRef, ReactNode } from 'react';\nimport { init } from 'vwo-fme-node-sdk';\nimport { VWOContext } from './VWOContext';\nimport { initLogger, getLogger } from './services/LoggerService';\n\ninterface VWOProviderProps {\n client?: any;\n config?: any;\n userContext?: any;\n children: ReactNode;\n}\n\n/**\n * VWOProvider component to provide VWO client and configuration context to child components.\n *\n * @param {Object} props - The properties for the VWOProvider component.\n * @param {Object} props.client - The VWO client instance.\n * @param {Object} props.config - Configuration settings for the VWO client.\n * @param {Object} props.userContext - Initial user context for the VWO client.\n * @param {React.ReactNode} props.children - Child components that will have access to the VWO context.\n * @returns {JSX.Element} The provider component wrapping its children with VWO context.\n */\nexport const VWOProvider: React.FC<VWOProviderProps> = ({ client, config, userContext, children }) => {\n const [vwoClient, setVwoClient] = useState<any>(client || null);\n const [context, setContext] = useState<any>(userContext || null);\n const vwoClientRef = useRef<any>(vwoClient); // Store the client reference without triggering re-renders\n const isMounted = useRef(true); // Prevent updates after unmount\n\n const logger = getLogger();\n\n // Initialize logger globally before using it\n useEffect(() => {\n if (config?.logger) {\n initLogger(config);\n }\n }, [config]);\n\n // Initialize the VWO SDK instance only once when the component mounts or if config is updated\n useEffect(() => {\n // If neither vwoClient nor config is provided, log the error\n if (!vwoClient && !config) {\n logger.error(\"VWOProvider Error: Either `client` or `config` must be provided.\");\n return;\n }\n\n const initializeVWO = async () => {\n try {\n if (!vwoClient && config) {\n // Initialize the VWO SDK instance if vwoClient is not already initialized\n const instance = await init(config);\n if (isMounted.current) {\n setVwoClient(instance);\n vwoClientRef.current = instance;\n }\n }\n } catch (error) {\n logger.error(`VWO-SDK Initialization failed: ${error}`);\n }\n };\n\n // Only initialize once\n if (!vwoClient && config) {\n initializeVWO();\n }\n\n return () => {\n isMounted.current = false;\n if (vwoClientRef.current && vwoClientRef.current.destroy) {\n vwoClientRef.current.destroy();\n }\n };\n }, [config, vwoClient]); // Re-run only when config or vwoClient changes\n\n return (\n <VWOContext.Provider value={{ vwoClient, userContext: context, setUserContext: setContext }}>\n {children}\n </VWOContext.Provider>\n );\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\n\n/**\n * Returns the VWO SDK client instance\n * @returns VWO SDK client instance\n */\nexport const useVWOClient = () => {\n const logger = getLogger();\n try {\n const context = useVWOContext();\n\n // If the VWO SDK client is not found, throw an error\n if (!context || !context.vwoClient) {\n logger.error('useVWOClient must be used within a VWOProvider !!');\n return null;\n }\n\n // Return the VWO SDK client\n return context.vwoClient;\n } catch (error) {\n logger.error(`Error in useVWOClient hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useVWOContext } from './VWOContext';\nimport { getLogger } from './services/LoggerService';\nimport { isObject } from './utils/DataTypeUtil';\n\n/**\n * Custom hook to retrieve a feature flag using VWO client.\n *\n * @param {string} featureKey - The key of the feature flag to retrieve.\n * @param {Object} [context] - Optional user context to use for fetching the flag.\n * @returns {Object} An object containing the flag and a readiness status.\n */\nexport const useGetFlag = (featureKey: string, context?: any) => {\n // Define the error return schema for the hook\n const errorReturnSchema = {\n flag: {\n isEnabled: (): boolean => false,\n getVariables: (): Array<Record<string, any>> => [],\n getVariable: (_key: string, defaultValue: any): any => defaultValue,\n },\n isReady: (): boolean => false,\n };\n\n // Destructure vwoClient, setUserContext, and userContext from VWOContext\n const { vwoClient, setUserContext, userContext } = useVWOContext();\n\n // State to store the flag and loading status\n const [flag, setFlag] = useState<any | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n // Get the logger instance\n const logger = getLogger();\n\n // Memoize the user context to prevent unnecessary re-renders\n const stableUserContext = useMemo(() => {\n return context || userContext || {};\n }, [JSON.stringify(context || userContext || {})]); // Only recreate if userContext actually changes\n\n // Define the getFlag function to fetch the feature flag\n const getFlag = useCallback(async () => {\n // Check if featureKey is provided\n if (!featureKey) {\n logger.error('Feature key is required for useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Check if the user context is a valid object\n if (!isObject(stableUserContext)) {\n logger.error('Invalid user context in useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Try to fetch the feature flag and handle errors\n try {\n setIsLoading(true);\n const result = await vwoClient.getFlag(featureKey, stableUserContext);\n setFlag(result);\n\n // Set the user context in the context to ensure it's available for other hooks\n setUserContext(stableUserContext);\n } catch (error) {\n logger.error(`Error fetching feature flag \"${featureKey}\": ${error}`);\n setFlag(null);\n } finally {\n setIsLoading(false);\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Ensure vwoClient is ready\n if (!vwoClient) {\n logger.error('VWO Client is missing in useGetFlag hook. Ensure VWOProvider is correctly initialized.');\n return errorReturnSchema;\n }\n\n // Run effect when dependencies change to fetch the flag\n useEffect(() => {\n if (featureKey && vwoClient && stableUserContext) {\n getFlag();\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Return the flag and readiness status\n return {\n flag,\n isReady: (): boolean => !isLoading && !!flag,\n };\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to get all variables from a flag\n * @param flag - The flag to get the variables from\n * @returns The variables from the flag\n */\nexport const useGetFlagVariables = (flag: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariables hook and should be an object');\n return [];\n }\n\n return flag.getVariables();\n } catch (error) {\n logger.error(`Error getting flag variables: ${error}`);\n return [];\n }\n};\n\n/**\n * Hook to get a flag variable\n * @param flag - The flag to get the variable from\n * @param variableKey - The key of the variable to get\n * @param defaultValue - The default value to return if the variable is not found\n * @returns The value of the variable\n */\nexport const useGetFlagVariable = (flag: any, variableKey: string, defaultValue: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariable hook and should be an object');\n return [];\n }\n\n if (!flag || !variableKey) {\n logger.error('Flag and variable key are required for useGetFlagVariable hook');\n return defaultValue;\n }\n\n return flag.getVariable(variableKey, defaultValue);\n } catch (error) {\n logger.error(`Error getting flag variable: ${error}`);\n return defaultValue;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\nimport { isObject, isString } from './utils/DataTypeUtil';\n\n/**\n * Hook to track an event\n * @param eventName - The name of the event to track\n * @param eventProperties - The properties of the event to track (optional)\n */\nexport const useTrackEvent = (eventName: string, eventProperties: Record<string, string> = {}) => {\n const logger = getLogger();\n try {\n if (!eventName && !isString(eventName)) {\n logger.error('Event name is required for useTrackEvent hook and it should be a string');\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useTrackEvent hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useTrackEvent hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Track the event\n vwoClient.trackEvent(eventName, userContext, eventProperties);\n } catch (error) {\n logger.error(`Error tracking event: ${error}`);\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useVWOContext } from './VWOContext';\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to set attributes for the user\n * @param attributeMap - The map of attributes to set\n */\nexport const useSetAttribute = (attributeMap: Record<string, string>) => {\n const logger = getLogger();\n try {\n if (!attributeMap || !isObject(attributeMap) || Object.keys(attributeMap).length === 0) {\n logger.error(\n 'attributeMap(object having key-value pairs of user attributes) is required for useSetAttribute hook',\n );\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useSetAttribute hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useSetAttribute hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Set the attributes\n vwoClient.setAttribute(attributeMap, userContext);\n } catch (error) {\n logger.error(`Error setting attributes: ${error}`);\n }\n};\n"],"names":["Logger","LogLevelEnum","ConsoleTransport","constructor","config","level","trace","message","consoleLog","TRACE","debug","DEBUG","info","INFO","warn","WARN","error","ERROR","console","LogMessageBuilder","loggerConfig","transportConfig","prefix","dateTimeFormat","formatMessage","getFormattedLevel","getFormattedPrefix","getFormattedDateTime","upperCaseLevel","toUpperCase","LogLevelColorInfoEnum","isFunction","val","Object","prototype","toString","call","isObject","isString","LogLevelNumberEnum","LogTransportManager","transports","addTransport","transport","push","shouldLog","transportLevel","configLevel","targetLevel","desiredLevel","log","i","length","logMessageBuilder","formattedMessage","LogManager","Date","getTime","isAlwaysNewInstance","instance","name","requestId","transportManager","handleTransports","toISOString","Instance","addTransports","logger","initLogger","getLogger","VWOContext","createContext","vwoClient","userContext","setUserContext","undefined","useVWOContext","context","useContext","VWOProvider","client","children","setVwoClient","useState","setContext","vwoClientRef","useRef","isMounted","useEffect","initializeVWO","init","current","destroy","React","Provider","value","useVWOClient","useGetFlag","featureKey","errorReturnSchema","flag","isEnabled","getVariables","getVariable","_key","defaultValue","isReady","setFlag","isLoading","setIsLoading","stableUserContext","useMemo","JSON","stringify","getFlag","useCallback","result","useGetFlagVariables","useGetFlagVariable","variableKey","useTrackEvent","eventName","eventProperties","trackEvent","useSetAttribute","attributeMap","keys","setAttribute"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAgBA;;;;MAIsBA,MAAM;;ACpB5B;;;;;;;;;;;;;;;AAgBA,AAAA,IAAYC,YAMX;AAND,WAAYA,YAAY;EACtBA,+BAAe;EACfA,+BAAe;EACfA,6BAAa;EACbA,6BAAa;EACbA,+BAAe;AACjB,CAAC,EANWA,YAAY,KAAZA,YAAY;;AChBxB;;;;;;;;;;;;;;;AAgBA,AAGA;;;;AAIA,MAAaC,gBAAgB;;;;;EAQ3BC,YAAYC,SAA8B,EAAE;IAC1C,IAAI,CAACA,MAAM,GAAGA,MAAM,CAAC;IACrB,IAAI,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACC,KAAK,CAAC;;;;;;EAOjCC,KAAKA,CAACC,OAAe;IACnB,IAAI,CAACC,UAAU,CAACP,YAAY,CAACQ,KAAK,EAAEF,OAAO,CAAC;;;;;;EAO9CG,KAAKA,CAACH,OAAe;IAC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EAAE;MAC1CN,MAAM,CAACnD,KAAK,CAAC,uFAAuF,CAAC;MACrG,OAAO,EAAE;;;IAIXwD,SAAS,CAACuD,YAAY,CAACF,YAAY,EAAEpD,WAAW,CAAC;GAClD,CAAC,OAAOzD,KAAK,EAAE;IACdmD,MAAM,CAACnD,KAAK,CAAC,6BAA6BA,KAAK,EAAE,CAAC;;AAEtD,CAAC;;;;;;;;;;;;;;;;;"}
|
|
@@ -704,7 +704,7 @@ const useGetFlag = (featureKey, context) => {
|
|
|
704
704
|
// Memoize the user context to prevent unnecessary re-renders
|
|
705
705
|
const stableUserContext = useMemo(() => {
|
|
706
706
|
return context || userContext || {};
|
|
707
|
-
}, [JSON.stringify(userContext)]); // Only recreate if userContext actually changes
|
|
707
|
+
}, [JSON.stringify(context || userContext || {})]); // Only recreate if userContext actually changes
|
|
708
708
|
// Define the getFlag function to fetch the feature flag
|
|
709
709
|
const getFlag = useCallback(async () => {
|
|
710
710
|
// Check if featureKey is provided
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vwo-fme-react-sdk.esm.js","sources":["../lib/logger/Logger.ts","../lib/logger/enums/LogLevelEnum.ts","../lib/logger/transports/ConsoleTransport.ts","../lib/logger/LogMessageBuilder.ts","../lib/utils/DataTypeUtil.ts","../lib/logger/core/TransportManager.ts","../lib/logger/core/LogManager.ts","../lib/services/LoggerService.ts","../lib/VWOContext.ts","../lib/VWOProvider.tsx","../lib/useVWOClient.ts","../lib/useGetFlag.ts","../lib/useGetFlagVariable.ts","../lib/useTrackEvent.ts","../lib/useSetAttribute.ts"],"sourcesContent":["/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Abstract class representing a logger.\n * This class provides the structure for logging mechanisms and should be extended by specific logger implementations.\n */\nexport abstract class Logger {\n /**\n * Logs a message at the trace level.\n * @param {string} message - The message to log.\n */\n abstract trace(message: string): void;\n\n /**\n * Logs a message at the debug level.\n * @param {string} message - The message to log.\n */\n abstract debug(message: string): void;\n\n /**\n * Logs a message at the info level.\n * @param {string} message - The message to log.\n */\n abstract info(message: string): void;\n\n /**\n * Logs a message at the warn level.\n * @param {string} message - The message to log.\n */\n abstract warn(message: string): void;\n\n /**\n * Logs a message at the error level.\n * @param {string} message - The message to log.\n */\n abstract error(message: string): void;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum LogLevelEnum {\n TRACE = 'trace',\n DEBUG = 'debug',\n INFO = 'info',\n WARN = 'warn',\n ERROR = 'error',\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { Logger } from '../Logger';\n\n/**\n * ConsoleTransport class implements the Logger interface to provide logging functionality.\n * It outputs logs to the console based on the log level set in the configuration.\n */\nexport class ConsoleTransport implements Logger {\n config: Record<string, any>; // Configuration object for the logger\n level: string; // Current log level\n\n /**\n * Constructor initializes the ConsoleTransport with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the logger, including 'level'.\n */\n constructor(config: Record<string, any> = {}) {\n this.config = config; // Store the configuration\n this.level = this.config.level; // Set the logging level from the configuration\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.consoleLog(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.consoleLog(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.consoleLog(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.consoleLog(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.consoleLog(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Generic log function that logs messages to the console based on the log level.\n * @param {string} level - The log level under which the message should be logged.\n * @param {string} message - The message to log.\n */\n consoleLog(level: string, message: string): void {\n console[level](message); // Use console's logging function dynamically based on the level\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\nimport { LogLevelEnum } from './enums/LogLevelEnum';\n\n/**\n * Interface defining the structure for a log message builder.\n */\ninterface ILogMessageBuilder {\n loggerConfig: Record<string, dynamic>; // Configuration for the logger\n transportConfig: Record<string, dynamic>; // Configuration for the transport mechanism\n prefix: string; // Prefix to be added to each log message\n dateTimeFormat: dynamic; // Function or format for date and time in log messages\n\n formatMessage(level: string, message: string): string; // Method to format a log message\n getFormattedLevel(level: string): string; // Method to format the log level\n getFormattedDateTime(): string; // Method to get formatted date and time\n}\n\n/**\n * Implements the ILogMessageBuilder interface to provide a concrete log message builder.\n */\nexport class LogMessageBuilder implements ILogMessageBuilder {\n loggerConfig: Record<string, any>;\n transportConfig: Record<string, any>;\n prefix: string;\n dateTimeFormat: any;\n\n /**\n * Constructs a new LogMessageBuilder instance.\n * @param {Record<string, any>} loggerConfig - Configuration for the logger.\n * @param {Record<string, any>} transportConfig - Configuration for the transport mechanism.\n */\n constructor(loggerConfig: Record<string, any>, transportConfig: Record<string, any>) {\n this.loggerConfig = loggerConfig;\n this.transportConfig = transportConfig;\n\n // Set the prefix, defaulting to an empty string if not provided.\n this.prefix = this.transportConfig.prefix || this.loggerConfig.prefix || '';\n // Set the date and time format, defaulting to the logger's format if the transport's format is not provided.\n this.dateTimeFormat = this.transportConfig.dateTimeFormat || this.loggerConfig.dateTimeFormat;\n }\n\n /**\n * Formats a log message combining level, prefix, date/time, and the actual message.\n * @param {string} level - The log level.\n * @param {string} message - The message to log.\n * @returns {string} The formatted log message.\n */\n formatMessage(level: string, message: string): string {\n return `[${this.getFormattedLevel(level)}]: ${this.getFormattedPrefix(this.prefix)} ${this.getFormattedDateTime()} ${message}`;\n }\n\n getFormattedPrefix(prefix: string): string {\n return `${prefix}`;\n }\n\n /**\n * Returns the formatted log level with appropriate coloring based on the log level.\n * @param {string} level - The log level.\n * @returns {string} The formatted log level.\n */\n getFormattedLevel(level: string): string {\n const upperCaseLevel = level.toUpperCase();\n let LogLevelColorInfoEnum;\n\n LogLevelColorInfoEnum = {\n [LogLevelEnum.TRACE]: upperCaseLevel,\n [LogLevelEnum.DEBUG]: upperCaseLevel,\n [LogLevelEnum.INFO]: upperCaseLevel,\n [LogLevelEnum.WARN]: upperCaseLevel,\n [LogLevelEnum.ERROR]: upperCaseLevel,\n };\n\n return LogLevelColorInfoEnum[level];\n }\n\n /**\n * Retrieves the current date and time formatted according to the specified format.\n * @returns {string} The formatted date and time.\n */\n getFormattedDateTime(): string {\n return this.dateTimeFormat();\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\n\ntype FunctionType = (val: dynamic) => void;\n\n/**\n * Checks if a value is a function.\n * @param val The value to check.\n * @returns True if the value is a function, false otherwise.\n */\nexport function isFunction(val: dynamic): val is FunctionType {\n return Object.prototype.toString.call(val) === '[object Function]';\n}\n\n/**\n * Checks if a value is an object (excluding arrays, functions, regex, promises, and dates).\n * @param val The value to check.\n * @returns True if the value is a valid object, false otherwise.\n */\nexport function isObject<T>(\n val: T,\n): val is Record<any, dynamic> & Exclude<T, Array<dynamic> | FunctionType | RegExp | Promise<dynamic> | Date> {\n return Object.prototype.toString.call(val) === '[object Object]';\n}\n\n/**\n * Checks if a value is a string.\n * @param val The value to check.\n * @returns True if the value is a string, false otherwise.\n */\nexport function isString(val: dynamic): val is string {\n return typeof val === 'string' || Object.prototype.toString.call(val) === '[object String]';\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { LogMessageBuilder } from '../LogMessageBuilder';\nimport { Logger } from '../Logger';\nimport { isFunction } from '../../utils/DataTypeUtil';\n\nenum LogLevelNumberEnum {\n TRACE = 0,\n DEBUG = 1,\n INFO = 2,\n WARN = 3,\n ERROR = 4,\n}\n\ninterface IlogTransport extends Logger {\n transports: Array<Record<string, dynamic>>;\n config: Record<string, dynamic>;\n\n // Determines if a message should be logged based on the transport and configuration levels\n shouldLog(transportLevel: string, configLevel: string): boolean;\n // Logs a message at a specified level\n log(level: string, message: string): void;\n}\n\n/**\n * Manages logging transports and delegates logging messages to them based on configuration.\n * Implements the IlogTransport interface.\n */\nexport class LogTransportManager implements IlogTransport {\n transports: Array<Record<string, any>>;\n config: Record<string, any>;\n\n /**\n * Initializes the manager with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the log manager.\n */\n constructor(config: Record<string, any>) {\n this.transports = [];\n this.config = config;\n }\n\n /**\n * Adds a new transport to the manager.\n * @param {Record<string, any>} transport - The transport object to be added.\n */\n addTransport(transport: Record<string, any>): void {\n this.transports.push(transport);\n }\n\n /**\n * Determines if the log should be processed based on the transport and configuration levels.\n * @param {string} transportLevel - The log level set for the transport.\n * @param {string} configLevel - The log level set in the configuration.\n * @returns {boolean} - Returns true if the log level is appropriate for logging, false otherwise.\n */\n shouldLog(transportLevel: string, configLevel: string): boolean {\n // Default to the most specific level available\n // transportLevel = transportLevel || configLevel || this.config.level;\n\n const targetLevel = LogLevelNumberEnum[transportLevel.toUpperCase()];\n const desiredLevel = LogLevelNumberEnum[(configLevel || this.config.level).toUpperCase()];\n\n return targetLevel >= desiredLevel;\n }\n\n /**\n * Logs a message at TRACE level.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a message at DEBUG level.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs a message at INFO level.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a message at WARN level.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs a message at ERROR level.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.log(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Delegates the logging of messages to the appropriate transports.\n * @param {string} level - The level at which to log the message.\n * @param {string} message - The message to log.\n */\n log(level: string, message: string): void {\n for (let i = 0; i < this.transports.length; i++) {\n const logMessageBuilder = new LogMessageBuilder(this.config, this.transports[i]);\n const formattedMessage = logMessageBuilder.formatMessage(level, message);\n if (this.shouldLog(level, this.transports[i].level)) {\n if (this.transports[i].log && isFunction(this.transports[i].log)) {\n // Use custom log handler if available\n this.transports[i].log(level, message);\n } else {\n // Otherwise, use the default log method\n this.transports[i][level](formattedMessage);\n }\n }\n }\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\n\nimport { Logger } from '../Logger';\nimport { ConsoleTransport } from '../transports/ConsoleTransport';\nimport { LogTransportManager } from './TransportManager';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\n\n/**\n * Interface defining the structure and methods for LogManager.\n */\nexport interface ILogManager {\n transportManager?: LogTransportManager;\n config?: Record<string, dynamic>;\n name?: string;\n requestId?: string;\n level: string;\n prefix?: string;\n dateTimeFormat?: () => string;\n\n transport?: Record<string, dynamic>;\n transports?: Array<Record<string, dynamic>>;\n\n addTransport?(transportObject: Record<string, dynamic>): void;\n addTransports?(transportsList: Array<Record<string, dynamic>>): void;\n}\n\n/**\n * LogManager class provides logging functionality with support for multiple transports.\n * It is designed as a singleton to ensure a single instance throughout the application.\n */\nexport class LogManager extends Logger implements ILogManager {\n private static instance: LogManager; // Singleton instance of LogManager\n transportManager: LogTransportManager;\n config: Record<string, any>;\n name = 'VWO Logger'; // Default logger name\n requestId = new Date().getTime().toString(); // current timestamp in milliseconds\n level = LogLevelEnum.ERROR; // Default logging level\n prefix = 'VWO-SDK'; // Default prefix for log messages\n public dateTimeFormat(): string {\n return new Date().toISOString(); // Default date-time format for log messages\n }\n transport: Record<string, any>;\n transports: Array<Record<string, any>>;\n\n /**\n * Constructor for LogManager.\n * @param {Record<string, any>} config - Configuration object for LogManager.\n */\n constructor(config?: Record<string, any>) {\n super();\n\n this.config = config;\n\n if (config.isAlwaysNewInstance || !LogManager.instance) {\n LogManager.instance = this;\n\n // Initialize configuration with defaults or provided values\n this.config.name = config.name || this.name;\n this.config.requestId = config.requestId || this.requestId;\n this.config.level = config.level || this.level;\n this.config.prefix = config.prefix || this.prefix;\n this.config.dateTimeFormat = config.dateTimeFormat || this.dateTimeFormat;\n\n this.transportManager = new LogTransportManager(this.config);\n\n this.handleTransports();\n }\n\n return LogManager.instance;\n }\n\n /**\n * Provides access to the singleton instance of LogManager.\n * @returns {LogManager} The singleton instance.\n */\n static get Instance(): LogManager {\n return LogManager.instance;\n }\n\n /**\n * Handles the initialization and setup of transports based on configuration.\n */\n handleTransports(): void {\n this.addTransport(\n new ConsoleTransport({\n level: this.config.level,\n }),\n );\n }\n\n /**\n * Adds a single transport to the LogManager.\n * @param {Record<any, any>} transport - The transport object to add.\n */\n addTransport(transport: Record<any, any>): void {\n this.transportManager.addTransport(transport);\n }\n\n /**\n * Adds multiple transports to the LogManager.\n * @param {Array<Record<any, any>>} transports - The list of transport objects to add.\n */\n addTransports(transports: Record<any, any>): void {\n for (let i = 0; i < transports.length; i++) {\n this.addTransport(transports[i]);\n }\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log at trace level.\n */\n trace(message: string): void {\n this.transportManager.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log at debug level.\n */\n debug(message: string): void {\n this.transportManager.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log at info level.\n */\n info(message: string): void {\n this.transportManager.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log at warn level.\n */\n warn(message: string): void {\n this.transportManager.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log at error level.\n */\n error(message: string): void {\n this.transportManager.log(LogLevelEnum.ERROR, message);\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * logger.ts - Global Logger Singleton\n */\nimport { LogManager } from '../logger/core/LogManager';\n\nlet logger: LogManager | null = null;\n\n/**\n * Initializes the global logger instance.\n * This function should be called inside `VWOProvider` before logging is used anywhere in the application.\n *\n * @param {object} config - The logger configuration object.\n * @param {object} config.logger - Optional logging configuration (e.g., log level, transports).\n * @returns {void} No return value; initializes the logger instance.\n */\nexport function initLogger(config: any) {\n if (!logger) {\n logger = new LogManager(config.logger || {});\n }\n}\n\n/**\n * Retrieves the global logger instance.\n * Ensures that `initLogger` has been called before attempting to use logging.\n *\n * @returns {LogManager} The global logger instance.\n */\nexport function getLogger(): LogManager {\n if (!logger) {\n logger = new LogManager({ level: 'error' });\n }\n return logger;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createContext, useContext } from 'react';\nimport { getLogger } from './services/LoggerService';\n\ninterface VWOContextType {\n vwoClient: any;\n userContext?: any;\n setUserContext?: (context: any) => void;\n}\n\nexport const VWOContext = createContext<VWOContextType>({\n vwoClient: null,\n userContext: null,\n setUserContext: undefined, // Default is undefined\n});\n\nexport const useVWOContext = () => {\n const logger = getLogger();\n try {\n // Fetch the context\n const context = useContext(VWOContext);\n\n // If the context is not found, throw an error\n if (!context) {\n logger.error('useVWOContext must be used within a VWOProvider');\n return null;\n }\n return context;\n } catch (error) {\n logger.error(`Error in useVWOContext hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useState, useRef, ReactNode } from 'react';\nimport { init } from 'vwo-fme-node-sdk';\nimport { VWOContext } from './VWOContext';\nimport { initLogger, getLogger } from './services/LoggerService';\n\ninterface VWOProviderProps {\n client?: any;\n config?: any;\n userContext?: any;\n children: ReactNode;\n}\n\n/**\n * VWOProvider component to provide VWO client and configuration context to child components.\n *\n * @param {Object} props - The properties for the VWOProvider component.\n * @param {Object} props.client - The VWO client instance.\n * @param {Object} props.config - Configuration settings for the VWO client.\n * @param {Object} props.userContext - Initial user context for the VWO client.\n * @param {React.ReactNode} props.children - Child components that will have access to the VWO context.\n * @returns {JSX.Element} The provider component wrapping its children with VWO context.\n */\nexport const VWOProvider: React.FC<VWOProviderProps> = ({ client, config, userContext, children }) => {\n const [vwoClient, setVwoClient] = useState<any>(client || null);\n const [context, setContext] = useState<any>(userContext || null);\n const vwoClientRef = useRef<any>(vwoClient); // Store the client reference without triggering re-renders\n const isMounted = useRef(true); // Prevent updates after unmount\n\n const logger = getLogger();\n\n // Initialize logger globally before using it\n useEffect(() => {\n if (config?.logger) {\n initLogger(config);\n }\n }, [config]);\n\n // Initialize the VWO SDK instance only once when the component mounts or if config is updated\n useEffect(() => {\n // If neither vwoClient nor config is provided, log the error\n if (!vwoClient && !config) {\n logger.error(\"VWOProvider Error: Either `client` or `config` must be provided.\");\n return;\n }\n\n const initializeVWO = async () => {\n try {\n if (!vwoClient && config) {\n // Initialize the VWO SDK instance if vwoClient is not already initialized\n const instance = await init(config);\n if (isMounted.current) {\n setVwoClient(instance);\n vwoClientRef.current = instance;\n }\n }\n } catch (error) {\n logger.error(`VWO-SDK Initialization failed: ${error}`);\n }\n };\n\n // Only initialize once\n if (!vwoClient && config) {\n initializeVWO();\n }\n\n return () => {\n isMounted.current = false;\n if (vwoClientRef.current && vwoClientRef.current.destroy) {\n vwoClientRef.current.destroy();\n }\n };\n }, [config, vwoClient]); // Re-run only when config or vwoClient changes\n\n return (\n <VWOContext.Provider value={{ vwoClient, userContext: context, setUserContext: setContext }}>\n {children}\n </VWOContext.Provider>\n );\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\n\n/**\n * Returns the VWO SDK client instance\n * @returns VWO SDK client instance\n */\nexport const useVWOClient = () => {\n const logger = getLogger();\n try {\n const context = useVWOContext();\n\n // If the VWO SDK client is not found, throw an error\n if (!context || !context.vwoClient) {\n logger.error('useVWOClient must be used within a VWOProvider !!');\n return null;\n }\n\n // Return the VWO SDK client\n return context.vwoClient;\n } catch (error) {\n logger.error(`Error in useVWOClient hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useVWOContext } from './VWOContext';\nimport { getLogger } from './services/LoggerService';\nimport { isObject } from './utils/DataTypeUtil';\n\n/**\n * Custom hook to retrieve a feature flag using VWO client.\n *\n * @param {string} featureKey - The key of the feature flag to retrieve.\n * @param {Object} [context] - Optional user context to use for fetching the flag.\n * @returns {Object} An object containing the flag and a readiness status.\n */\nexport const useGetFlag = (featureKey: string, context?: any) => {\n // Define the error return schema for the hook\n const errorReturnSchema = {\n flag: {\n isEnabled: (): boolean => false,\n getVariables: (): Array<Record<string, any>> => [],\n getVariable: (_key: string, defaultValue: any): any => defaultValue,\n },\n isReady: (): boolean => false,\n };\n\n // Destructure vwoClient, setUserContext, and userContext from VWOContext\n const { vwoClient, setUserContext, userContext } = useVWOContext();\n\n // State to store the flag and loading status\n const [flag, setFlag] = useState<any | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n // Get the logger instance\n const logger = getLogger();\n\n // Memoize the user context to prevent unnecessary re-renders\n const stableUserContext = useMemo(() => {\n return context || userContext || {};\n }, [JSON.stringify(userContext)]); // Only recreate if userContext actually changes\n\n // Define the getFlag function to fetch the feature flag\n const getFlag = useCallback(async () => {\n // Check if featureKey is provided\n if (!featureKey) {\n logger.error('Feature key is required for useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Check if the user context is a valid object\n if (!isObject(stableUserContext)) {\n logger.error('Invalid user context in useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Try to fetch the feature flag and handle errors\n try {\n setIsLoading(true);\n const result = await vwoClient.getFlag(featureKey, stableUserContext);\n setFlag(result);\n\n // Set the user context in the context to ensure it's available for other hooks\n setUserContext(stableUserContext);\n } catch (error) {\n logger.error(`Error fetching feature flag \"${featureKey}\": ${error}`);\n setFlag(null);\n } finally {\n setIsLoading(false);\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Ensure vwoClient is ready\n if (!vwoClient) {\n logger.error('VWO Client is missing in useGetFlag hook. Ensure VWOProvider is correctly initialized.');\n return errorReturnSchema;\n }\n\n // Run effect when dependencies change to fetch the flag\n useEffect(() => {\n if (featureKey && vwoClient && stableUserContext) {\n getFlag();\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Return the flag and readiness status\n return {\n flag,\n isReady: (): boolean => !isLoading && !!flag,\n };\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to get all variables from a flag\n * @param flag - The flag to get the variables from\n * @returns The variables from the flag\n */\nexport const useGetFlagVariables = (flag: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariables hook and should be an object');\n return [];\n }\n\n return flag.getVariables();\n } catch (error) {\n logger.error(`Error getting flag variables: ${error}`);\n return [];\n }\n};\n\n/**\n * Hook to get a flag variable\n * @param flag - The flag to get the variable from\n * @param variableKey - The key of the variable to get\n * @param defaultValue - The default value to return if the variable is not found\n * @returns The value of the variable\n */\nexport const useGetFlagVariable = (flag: any, variableKey: string, defaultValue: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariable hook and should be an object');\n return [];\n }\n\n if (!flag || !variableKey) {\n logger.error('Flag and variable key are required for useGetFlagVariable hook');\n return defaultValue;\n }\n\n return flag.getVariable(variableKey, defaultValue);\n } catch (error) {\n logger.error(`Error getting flag variable: ${error}`);\n return defaultValue;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\nimport { isObject, isString } from './utils/DataTypeUtil';\n\n/**\n * Hook to track an event\n * @param eventName - The name of the event to track\n * @param eventProperties - The properties of the event to track (optional)\n */\nexport const useTrackEvent = (eventName: string, eventProperties: Record<string, string> = {}) => {\n const logger = getLogger();\n try {\n if (!eventName && !isString(eventName)) {\n logger.error('Event name is required for useTrackEvent hook and it should be a string');\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useTrackEvent hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useTrackEvent hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Track the event\n vwoClient.trackEvent(eventName, userContext, eventProperties);\n } catch (error) {\n logger.error(`Error tracking event: ${error}`);\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useVWOContext } from './VWOContext';\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to set attributes for the user\n * @param attributeMap - The map of attributes to set\n */\nexport const useSetAttribute = (attributeMap: Record<string, string>) => {\n const logger = getLogger();\n try {\n if (!attributeMap || !isObject(attributeMap) || Object.keys(attributeMap).length === 0) {\n logger.error(\n 'attributeMap(object having key-value pairs of user attributes) is required for useSetAttribute hook',\n );\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useSetAttribute hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useSetAttribute hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Set the attributes\n vwoClient.setAttribute(attributeMap, userContext);\n } catch (error) {\n logger.error(`Error setting attributes: ${error}`);\n }\n};\n"],"names":["Logger","LogLevelEnum","ConsoleTransport","constructor","config","level","trace","message","consoleLog","TRACE","debug","DEBUG","info","INFO","warn","WARN","error","ERROR","console","LogMessageBuilder","loggerConfig","transportConfig","prefix","dateTimeFormat","formatMessage","getFormattedLevel","getFormattedPrefix","getFormattedDateTime","upperCaseLevel","toUpperCase","LogLevelColorInfoEnum","isFunction","val","Object","prototype","toString","call","isObject","isString","LogLevelNumberEnum","LogTransportManager","transports","addTransport","transport","push","shouldLog","transportLevel","configLevel","targetLevel","desiredLevel","log","i","length","logMessageBuilder","formattedMessage","LogManager","Date","getTime","isAlwaysNewInstance","instance","name","requestId","transportManager","handleTransports","toISOString","Instance","addTransports","logger","initLogger","getLogger","VWOContext","createContext","vwoClient","userContext","setUserContext","undefined","useVWOContext","context","useContext","VWOProvider","client","children","setVwoClient","useState","setContext","vwoClientRef","useRef","isMounted","useEffect","initializeVWO","init","current","destroy","React","Provider","value","useVWOClient","useGetFlag","featureKey","errorReturnSchema","flag","isEnabled","getVariables","getVariable","_key","defaultValue","isReady","setFlag","isLoading","setIsLoading","stableUserContext","useMemo","JSON","stringify","getFlag","useCallback","result","useGetFlagVariables","useGetFlagVariable","variableKey","useTrackEvent","eventName","eventProperties","trackEvent","useSetAttribute","attributeMap","keys","setAttribute"],"mappings":";;;;AAAA;;;;;;;;;;;;;;;AAgBA;;;;MAIsBA,MAAM;;ACpB5B;;;;;;;;;;;;;;;AAgBA,AAAA,IAAYC,YAMX;AAND,WAAYA,YAAY;EACtBA,+BAAe;EACfA,+BAAe;EACfA,6BAAa;EACbA,6BAAa;EACbA,+BAAe;AACjB,CAAC,EANWA,YAAY,KAAZA,YAAY;;AChBxB;;;;;;;;;;;;;;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KAAK,CAAC,EAAE;MACtFe,MAAM,CAACnD,KAAK,CACV,qGAAqG,CACtG;MACD;;;IAIF,MAAM;MAAEwD,SAAS;MAAEC;KAAa,GAAGG,aAAa,EAAE;IAElD,IAAI,CAACJ,SAAS,EAAE;MACdL,MAAM,CAACnD,KAAK,CAAC,6FAA6F,CAAC;MAC3G,OAAO,EAAE;;IAGX,IAAI,CAACyD,WAAW,IAAI,CAACpC,QAAQ,CAACoC,WAAW,CAAC,EAAE;MAC1CN,MAAM,CAACnD,KAAK,CAAC,uFAAuF,CAAC;MACrG,OAAO,EAAE;;;IAIXwD,SAAS,CAACuD,YAAY,CAACF,YAAY,EAAEpD,WAAW,CAAC;GAClD,CAAC,OAAOzD,KAAK,EAAE;IACdmD,MAAM,CAACnD,KAAK,CAAC,6BAA6BA,KAAK,EAAE,CAAC;;AAEtD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"vwo-fme-react-sdk.esm.js","sources":["../lib/logger/Logger.ts","../lib/logger/enums/LogLevelEnum.ts","../lib/logger/transports/ConsoleTransport.ts","../lib/logger/LogMessageBuilder.ts","../lib/utils/DataTypeUtil.ts","../lib/logger/core/TransportManager.ts","../lib/logger/core/LogManager.ts","../lib/services/LoggerService.ts","../lib/VWOContext.ts","../lib/VWOProvider.tsx","../lib/useVWOClient.ts","../lib/useGetFlag.ts","../lib/useGetFlagVariable.ts","../lib/useTrackEvent.ts","../lib/useSetAttribute.ts"],"sourcesContent":["/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Abstract class representing a logger.\n * This class provides the structure for logging mechanisms and should be extended by specific logger implementations.\n */\nexport abstract class Logger {\n /**\n * Logs a message at the trace level.\n * @param {string} message - The message to log.\n */\n abstract trace(message: string): void;\n\n /**\n * Logs a message at the debug level.\n * @param {string} message - The message to log.\n */\n abstract debug(message: string): void;\n\n /**\n * Logs a message at the info level.\n * @param {string} message - The message to log.\n */\n abstract info(message: string): void;\n\n /**\n * Logs a message at the warn level.\n * @param {string} message - The message to log.\n */\n abstract warn(message: string): void;\n\n /**\n * Logs a message at the error level.\n * @param {string} message - The message to log.\n */\n abstract error(message: string): void;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum LogLevelEnum {\n TRACE = 'trace',\n DEBUG = 'debug',\n INFO = 'info',\n WARN = 'warn',\n ERROR = 'error',\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { Logger } from '../Logger';\n\n/**\n * ConsoleTransport class implements the Logger interface to provide logging functionality.\n * It outputs logs to the console based on the log level set in the configuration.\n */\nexport class ConsoleTransport implements Logger {\n config: Record<string, any>; // Configuration object for the logger\n level: string; // Current log level\n\n /**\n * Constructor initializes the ConsoleTransport with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the logger, including 'level'.\n */\n constructor(config: Record<string, any> = {}) {\n this.config = config; // Store the configuration\n this.level = this.config.level; // Set the logging level from the configuration\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.consoleLog(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.consoleLog(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.consoleLog(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.consoleLog(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.consoleLog(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Generic log function that logs messages to the console based on the log level.\n * @param {string} level - The log level under which the message should be logged.\n * @param {string} message - The message to log.\n */\n consoleLog(level: string, message: string): void {\n console[level](message); // Use console's logging function dynamically based on the level\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\nimport { LogLevelEnum } from './enums/LogLevelEnum';\n\n/**\n * Interface defining the structure for a log message builder.\n */\ninterface ILogMessageBuilder {\n loggerConfig: Record<string, dynamic>; // Configuration for the logger\n transportConfig: Record<string, dynamic>; // Configuration for the transport mechanism\n prefix: string; // Prefix to be added to each log message\n dateTimeFormat: dynamic; // Function or format for date and time in log messages\n\n formatMessage(level: string, message: string): string; // Method to format a log message\n getFormattedLevel(level: string): string; // Method to format the log level\n getFormattedDateTime(): string; // Method to get formatted date and time\n}\n\n/**\n * Implements the ILogMessageBuilder interface to provide a concrete log message builder.\n */\nexport class LogMessageBuilder implements ILogMessageBuilder {\n loggerConfig: Record<string, any>;\n transportConfig: Record<string, any>;\n prefix: string;\n dateTimeFormat: any;\n\n /**\n * Constructs a new LogMessageBuilder instance.\n * @param {Record<string, any>} loggerConfig - Configuration for the logger.\n * @param {Record<string, any>} transportConfig - Configuration for the transport mechanism.\n */\n constructor(loggerConfig: Record<string, any>, transportConfig: Record<string, any>) {\n this.loggerConfig = loggerConfig;\n this.transportConfig = transportConfig;\n\n // Set the prefix, defaulting to an empty string if not provided.\n this.prefix = this.transportConfig.prefix || this.loggerConfig.prefix || '';\n // Set the date and time format, defaulting to the logger's format if the transport's format is not provided.\n this.dateTimeFormat = this.transportConfig.dateTimeFormat || this.loggerConfig.dateTimeFormat;\n }\n\n /**\n * Formats a log message combining level, prefix, date/time, and the actual message.\n * @param {string} level - The log level.\n * @param {string} message - The message to log.\n * @returns {string} The formatted log message.\n */\n formatMessage(level: string, message: string): string {\n return `[${this.getFormattedLevel(level)}]: ${this.getFormattedPrefix(this.prefix)} ${this.getFormattedDateTime()} ${message}`;\n }\n\n getFormattedPrefix(prefix: string): string {\n return `${prefix}`;\n }\n\n /**\n * Returns the formatted log level with appropriate coloring based on the log level.\n * @param {string} level - The log level.\n * @returns {string} The formatted log level.\n */\n getFormattedLevel(level: string): string {\n const upperCaseLevel = level.toUpperCase();\n let LogLevelColorInfoEnum;\n\n LogLevelColorInfoEnum = {\n [LogLevelEnum.TRACE]: upperCaseLevel,\n [LogLevelEnum.DEBUG]: upperCaseLevel,\n [LogLevelEnum.INFO]: upperCaseLevel,\n [LogLevelEnum.WARN]: upperCaseLevel,\n [LogLevelEnum.ERROR]: upperCaseLevel,\n };\n\n return LogLevelColorInfoEnum[level];\n }\n\n /**\n * Retrieves the current date and time formatted according to the specified format.\n * @returns {string} The formatted date and time.\n */\n getFormattedDateTime(): string {\n return this.dateTimeFormat();\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../types/Common';\n\ntype FunctionType = (val: dynamic) => void;\n\n/**\n * Checks if a value is a function.\n * @param val The value to check.\n * @returns True if the value is a function, false otherwise.\n */\nexport function isFunction(val: dynamic): val is FunctionType {\n return Object.prototype.toString.call(val) === '[object Function]';\n}\n\n/**\n * Checks if a value is an object (excluding arrays, functions, regex, promises, and dates).\n * @param val The value to check.\n * @returns True if the value is a valid object, false otherwise.\n */\nexport function isObject<T>(\n val: T,\n): val is Record<any, dynamic> & Exclude<T, Array<dynamic> | FunctionType | RegExp | Promise<dynamic> | Date> {\n return Object.prototype.toString.call(val) === '[object Object]';\n}\n\n/**\n * Checks if a value is a string.\n * @param val The value to check.\n * @returns True if the value is a string, false otherwise.\n */\nexport function isString(val: dynamic): val is string {\n return typeof val === 'string' || Object.prototype.toString.call(val) === '[object String]';\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\nimport { LogMessageBuilder } from '../LogMessageBuilder';\nimport { Logger } from '../Logger';\nimport { isFunction } from '../../utils/DataTypeUtil';\n\nenum LogLevelNumberEnum {\n TRACE = 0,\n DEBUG = 1,\n INFO = 2,\n WARN = 3,\n ERROR = 4,\n}\n\ninterface IlogTransport extends Logger {\n transports: Array<Record<string, dynamic>>;\n config: Record<string, dynamic>;\n\n // Determines if a message should be logged based on the transport and configuration levels\n shouldLog(transportLevel: string, configLevel: string): boolean;\n // Logs a message at a specified level\n log(level: string, message: string): void;\n}\n\n/**\n * Manages logging transports and delegates logging messages to them based on configuration.\n * Implements the IlogTransport interface.\n */\nexport class LogTransportManager implements IlogTransport {\n transports: Array<Record<string, any>>;\n config: Record<string, any>;\n\n /**\n * Initializes the manager with a configuration object.\n * @param {Record<string, any>} config - Configuration settings for the log manager.\n */\n constructor(config: Record<string, any>) {\n this.transports = [];\n this.config = config;\n }\n\n /**\n * Adds a new transport to the manager.\n * @param {Record<string, any>} transport - The transport object to be added.\n */\n addTransport(transport: Record<string, any>): void {\n this.transports.push(transport);\n }\n\n /**\n * Determines if the log should be processed based on the transport and configuration levels.\n * @param {string} transportLevel - The log level set for the transport.\n * @param {string} configLevel - The log level set in the configuration.\n * @returns {boolean} - Returns true if the log level is appropriate for logging, false otherwise.\n */\n shouldLog(transportLevel: string, configLevel: string): boolean {\n // Default to the most specific level available\n // transportLevel = transportLevel || configLevel || this.config.level;\n\n const targetLevel = LogLevelNumberEnum[transportLevel.toUpperCase()];\n const desiredLevel = LogLevelNumberEnum[(configLevel || this.config.level).toUpperCase()];\n\n return targetLevel >= desiredLevel;\n }\n\n /**\n * Logs a message at TRACE level.\n * @param {string} message - The message to log.\n */\n trace(message: string): void {\n this.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a message at DEBUG level.\n * @param {string} message - The message to log.\n */\n debug(message: string): void {\n this.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs a message at INFO level.\n * @param {string} message - The message to log.\n */\n info(message: string): void {\n this.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a message at WARN level.\n * @param {string} message - The message to log.\n */\n warn(message: string): void {\n this.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs a message at ERROR level.\n * @param {string} message - The message to log.\n */\n error(message: string): void {\n this.log(LogLevelEnum.ERROR, message);\n }\n\n /**\n * Delegates the logging of messages to the appropriate transports.\n * @param {string} level - The level at which to log the message.\n * @param {string} message - The message to log.\n */\n log(level: string, message: string): void {\n for (let i = 0; i < this.transports.length; i++) {\n const logMessageBuilder = new LogMessageBuilder(this.config, this.transports[i]);\n const formattedMessage = logMessageBuilder.formatMessage(level, message);\n if (this.shouldLog(level, this.transports[i].level)) {\n if (this.transports[i].log && isFunction(this.transports[i].log)) {\n // Use custom log handler if available\n this.transports[i].log(level, message);\n } else {\n // Otherwise, use the default log method\n this.transports[i][level](formattedMessage);\n }\n }\n }\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dynamic } from '../../types/Common';\n\nimport { Logger } from '../Logger';\nimport { ConsoleTransport } from '../transports/ConsoleTransport';\nimport { LogTransportManager } from './TransportManager';\nimport { LogLevelEnum } from '../enums/LogLevelEnum';\n\n/**\n * Interface defining the structure and methods for LogManager.\n */\nexport interface ILogManager {\n transportManager?: LogTransportManager;\n config?: Record<string, dynamic>;\n name?: string;\n requestId?: string;\n level: string;\n prefix?: string;\n dateTimeFormat?: () => string;\n\n transport?: Record<string, dynamic>;\n transports?: Array<Record<string, dynamic>>;\n\n addTransport?(transportObject: Record<string, dynamic>): void;\n addTransports?(transportsList: Array<Record<string, dynamic>>): void;\n}\n\n/**\n * LogManager class provides logging functionality with support for multiple transports.\n * It is designed as a singleton to ensure a single instance throughout the application.\n */\nexport class LogManager extends Logger implements ILogManager {\n private static instance: LogManager; // Singleton instance of LogManager\n transportManager: LogTransportManager;\n config: Record<string, any>;\n name = 'VWO Logger'; // Default logger name\n requestId = new Date().getTime().toString(); // current timestamp in milliseconds\n level = LogLevelEnum.ERROR; // Default logging level\n prefix = 'VWO-SDK'; // Default prefix for log messages\n public dateTimeFormat(): string {\n return new Date().toISOString(); // Default date-time format for log messages\n }\n transport: Record<string, any>;\n transports: Array<Record<string, any>>;\n\n /**\n * Constructor for LogManager.\n * @param {Record<string, any>} config - Configuration object for LogManager.\n */\n constructor(config?: Record<string, any>) {\n super();\n\n this.config = config;\n\n if (config.isAlwaysNewInstance || !LogManager.instance) {\n LogManager.instance = this;\n\n // Initialize configuration with defaults or provided values\n this.config.name = config.name || this.name;\n this.config.requestId = config.requestId || this.requestId;\n this.config.level = config.level || this.level;\n this.config.prefix = config.prefix || this.prefix;\n this.config.dateTimeFormat = config.dateTimeFormat || this.dateTimeFormat;\n\n this.transportManager = new LogTransportManager(this.config);\n\n this.handleTransports();\n }\n\n return LogManager.instance;\n }\n\n /**\n * Provides access to the singleton instance of LogManager.\n * @returns {LogManager} The singleton instance.\n */\n static get Instance(): LogManager {\n return LogManager.instance;\n }\n\n /**\n * Handles the initialization and setup of transports based on configuration.\n */\n handleTransports(): void {\n this.addTransport(\n new ConsoleTransport({\n level: this.config.level,\n }),\n );\n }\n\n /**\n * Adds a single transport to the LogManager.\n * @param {Record<any, any>} transport - The transport object to add.\n */\n addTransport(transport: Record<any, any>): void {\n this.transportManager.addTransport(transport);\n }\n\n /**\n * Adds multiple transports to the LogManager.\n * @param {Array<Record<any, any>>} transports - The list of transport objects to add.\n */\n addTransports(transports: Record<any, any>): void {\n for (let i = 0; i < transports.length; i++) {\n this.addTransport(transports[i]);\n }\n }\n\n /**\n * Logs a trace message.\n * @param {string} message - The message to log at trace level.\n */\n trace(message: string): void {\n this.transportManager.log(LogLevelEnum.TRACE, message);\n }\n\n /**\n * Logs a debug message.\n * @param {string} message - The message to log at debug level.\n */\n debug(message: string): void {\n this.transportManager.log(LogLevelEnum.DEBUG, message);\n }\n\n /**\n * Logs an informational message.\n * @param {string} message - The message to log at info level.\n */\n info(message: string): void {\n this.transportManager.log(LogLevelEnum.INFO, message);\n }\n\n /**\n * Logs a warning message.\n * @param {string} message - The message to log at warn level.\n */\n warn(message: string): void {\n this.transportManager.log(LogLevelEnum.WARN, message);\n }\n\n /**\n * Logs an error message.\n * @param {string} message - The message to log at error level.\n */\n error(message: string): void {\n this.transportManager.log(LogLevelEnum.ERROR, message);\n }\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * logger.ts - Global Logger Singleton\n */\nimport { LogManager } from '../logger/core/LogManager';\n\nlet logger: LogManager | null = null;\n\n/**\n * Initializes the global logger instance.\n * This function should be called inside `VWOProvider` before logging is used anywhere in the application.\n *\n * @param {object} config - The logger configuration object.\n * @param {object} config.logger - Optional logging configuration (e.g., log level, transports).\n * @returns {void} No return value; initializes the logger instance.\n */\nexport function initLogger(config: any) {\n if (!logger) {\n logger = new LogManager(config.logger || {});\n }\n}\n\n/**\n * Retrieves the global logger instance.\n * Ensures that `initLogger` has been called before attempting to use logging.\n *\n * @returns {LogManager} The global logger instance.\n */\nexport function getLogger(): LogManager {\n if (!logger) {\n logger = new LogManager({ level: 'error' });\n }\n return logger;\n}\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createContext, useContext } from 'react';\nimport { getLogger } from './services/LoggerService';\n\ninterface VWOContextType {\n vwoClient: any;\n userContext?: any;\n setUserContext?: (context: any) => void;\n}\n\nexport const VWOContext = createContext<VWOContextType>({\n vwoClient: null,\n userContext: null,\n setUserContext: undefined, // Default is undefined\n});\n\nexport const useVWOContext = () => {\n const logger = getLogger();\n try {\n // Fetch the context\n const context = useContext(VWOContext);\n\n // If the context is not found, throw an error\n if (!context) {\n logger.error('useVWOContext must be used within a VWOProvider');\n return null;\n }\n return context;\n } catch (error) {\n logger.error(`Error in useVWOContext hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useState, useRef, ReactNode } from 'react';\nimport { init } from 'vwo-fme-node-sdk';\nimport { VWOContext } from './VWOContext';\nimport { initLogger, getLogger } from './services/LoggerService';\n\ninterface VWOProviderProps {\n client?: any;\n config?: any;\n userContext?: any;\n children: ReactNode;\n}\n\n/**\n * VWOProvider component to provide VWO client and configuration context to child components.\n *\n * @param {Object} props - The properties for the VWOProvider component.\n * @param {Object} props.client - The VWO client instance.\n * @param {Object} props.config - Configuration settings for the VWO client.\n * @param {Object} props.userContext - Initial user context for the VWO client.\n * @param {React.ReactNode} props.children - Child components that will have access to the VWO context.\n * @returns {JSX.Element} The provider component wrapping its children with VWO context.\n */\nexport const VWOProvider: React.FC<VWOProviderProps> = ({ client, config, userContext, children }) => {\n const [vwoClient, setVwoClient] = useState<any>(client || null);\n const [context, setContext] = useState<any>(userContext || null);\n const vwoClientRef = useRef<any>(vwoClient); // Store the client reference without triggering re-renders\n const isMounted = useRef(true); // Prevent updates after unmount\n\n const logger = getLogger();\n\n // Initialize logger globally before using it\n useEffect(() => {\n if (config?.logger) {\n initLogger(config);\n }\n }, [config]);\n\n // Initialize the VWO SDK instance only once when the component mounts or if config is updated\n useEffect(() => {\n // If neither vwoClient nor config is provided, log the error\n if (!vwoClient && !config) {\n logger.error(\"VWOProvider Error: Either `client` or `config` must be provided.\");\n return;\n }\n\n const initializeVWO = async () => {\n try {\n if (!vwoClient && config) {\n // Initialize the VWO SDK instance if vwoClient is not already initialized\n const instance = await init(config);\n if (isMounted.current) {\n setVwoClient(instance);\n vwoClientRef.current = instance;\n }\n }\n } catch (error) {\n logger.error(`VWO-SDK Initialization failed: ${error}`);\n }\n };\n\n // Only initialize once\n if (!vwoClient && config) {\n initializeVWO();\n }\n\n return () => {\n isMounted.current = false;\n if (vwoClientRef.current && vwoClientRef.current.destroy) {\n vwoClientRef.current.destroy();\n }\n };\n }, [config, vwoClient]); // Re-run only when config or vwoClient changes\n\n return (\n <VWOContext.Provider value={{ vwoClient, userContext: context, setUserContext: setContext }}>\n {children}\n </VWOContext.Provider>\n );\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\n\n/**\n * Returns the VWO SDK client instance\n * @returns VWO SDK client instance\n */\nexport const useVWOClient = () => {\n const logger = getLogger();\n try {\n const context = useVWOContext();\n\n // If the VWO SDK client is not found, throw an error\n if (!context || !context.vwoClient) {\n logger.error('useVWOClient must be used within a VWOProvider !!');\n return null;\n }\n\n // Return the VWO SDK client\n return context.vwoClient;\n } catch (error) {\n logger.error(`Error in useVWOClient hook: ${error}`);\n return null;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useVWOContext } from './VWOContext';\nimport { getLogger } from './services/LoggerService';\nimport { isObject } from './utils/DataTypeUtil';\n\n/**\n * Custom hook to retrieve a feature flag using VWO client.\n *\n * @param {string} featureKey - The key of the feature flag to retrieve.\n * @param {Object} [context] - Optional user context to use for fetching the flag.\n * @returns {Object} An object containing the flag and a readiness status.\n */\nexport const useGetFlag = (featureKey: string, context?: any) => {\n // Define the error return schema for the hook\n const errorReturnSchema = {\n flag: {\n isEnabled: (): boolean => false,\n getVariables: (): Array<Record<string, any>> => [],\n getVariable: (_key: string, defaultValue: any): any => defaultValue,\n },\n isReady: (): boolean => false,\n };\n\n // Destructure vwoClient, setUserContext, and userContext from VWOContext\n const { vwoClient, setUserContext, userContext } = useVWOContext();\n\n // State to store the flag and loading status\n const [flag, setFlag] = useState<any | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n // Get the logger instance\n const logger = getLogger();\n\n // Memoize the user context to prevent unnecessary re-renders\n const stableUserContext = useMemo(() => {\n return context || userContext || {};\n }, [JSON.stringify(context || userContext || {})]); // Only recreate if userContext actually changes\n\n // Define the getFlag function to fetch the feature flag\n const getFlag = useCallback(async () => {\n // Check if featureKey is provided\n if (!featureKey) {\n logger.error('Feature key is required for useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Check if the user context is a valid object\n if (!isObject(stableUserContext)) {\n logger.error('Invalid user context in useGetFlag hook');\n return errorReturnSchema;\n }\n\n // Try to fetch the feature flag and handle errors\n try {\n setIsLoading(true);\n const result = await vwoClient.getFlag(featureKey, stableUserContext);\n setFlag(result);\n\n // Set the user context in the context to ensure it's available for other hooks\n setUserContext(stableUserContext);\n } catch (error) {\n logger.error(`Error fetching feature flag \"${featureKey}\": ${error}`);\n setFlag(null);\n } finally {\n setIsLoading(false);\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Ensure vwoClient is ready\n if (!vwoClient) {\n logger.error('VWO Client is missing in useGetFlag hook. Ensure VWOProvider is correctly initialized.');\n return errorReturnSchema;\n }\n\n // Run effect when dependencies change to fetch the flag\n useEffect(() => {\n if (featureKey && vwoClient && stableUserContext) {\n getFlag();\n }\n }, [featureKey, stableUserContext, vwoClient]);\n\n // Return the flag and readiness status\n return {\n flag,\n isReady: (): boolean => !isLoading && !!flag,\n };\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to get all variables from a flag\n * @param flag - The flag to get the variables from\n * @returns The variables from the flag\n */\nexport const useGetFlagVariables = (flag: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariables hook and should be an object');\n return [];\n }\n\n return flag.getVariables();\n } catch (error) {\n logger.error(`Error getting flag variables: ${error}`);\n return [];\n }\n};\n\n/**\n * Hook to get a flag variable\n * @param flag - The flag to get the variable from\n * @param variableKey - The key of the variable to get\n * @param defaultValue - The default value to return if the variable is not found\n * @returns The value of the variable\n */\nexport const useGetFlagVariable = (flag: any, variableKey: string, defaultValue: any) => {\n const logger = getLogger();\n try {\n if (!flag || !isObject(flag)) {\n logger.error('Flag is required for useGetFlagVariable hook and should be an object');\n return [];\n }\n\n if (!flag || !variableKey) {\n logger.error('Flag and variable key are required for useGetFlagVariable hook');\n return defaultValue;\n }\n\n return flag.getVariable(variableKey, defaultValue);\n } catch (error) {\n logger.error(`Error getting flag variable: ${error}`);\n return defaultValue;\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getLogger } from './services/LoggerService';\nimport { useVWOContext } from './VWOContext';\nimport { isObject, isString } from './utils/DataTypeUtil';\n\n/**\n * Hook to track an event\n * @param eventName - The name of the event to track\n * @param eventProperties - The properties of the event to track (optional)\n */\nexport const useTrackEvent = (eventName: string, eventProperties: Record<string, string> = {}) => {\n const logger = getLogger();\n try {\n if (!eventName && !isString(eventName)) {\n logger.error('Event name is required for useTrackEvent hook and it should be a string');\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useTrackEvent hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useTrackEvent hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Track the event\n vwoClient.trackEvent(eventName, userContext, eventProperties);\n } catch (error) {\n logger.error(`Error tracking event: ${error}`);\n }\n};\n","/**\n * Copyright 2025 Wingify Software Pvt. Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useVWOContext } from './VWOContext';\nimport { isObject } from './utils/DataTypeUtil';\nimport { getLogger } from './services/LoggerService';\n\n/**\n * Hook to set attributes for the user\n * @param attributeMap - The map of attributes to set\n */\nexport const useSetAttribute = (attributeMap: Record<string, string>) => {\n const logger = getLogger();\n try {\n if (!attributeMap || !isObject(attributeMap) || Object.keys(attributeMap).length === 0) {\n logger.error(\n 'attributeMap(object having key-value pairs of user attributes) is required for useSetAttribute hook',\n );\n return;\n }\n\n // Fetch the vwoClient and userContext from the context\n const { vwoClient, userContext } = useVWOContext();\n\n if (!vwoClient) {\n logger.error('VWO Client is missing in useSetAttribute hook. Ensure VWOProvider is correctly initialized.');\n return {};\n }\n\n if (!userContext || !isObject(userContext)) {\n logger.error('Invalid user context in useSetAttribute hook. Ensure a valid userContext is provided.');\n return {};\n }\n\n // Set the attributes\n vwoClient.setAttribute(attributeMap, userContext);\n } catch (error) {\n logger.error(`Error setting attributes: ${error}`);\n }\n};\n"],"names":["Logger","LogLevelEnum","ConsoleTransport","constructor","config","level","trace","message","consoleLog","TRACE","debug","DEBUG","info","INFO","warn","WARN","error","ERROR","console","LogMessageBuilder","loggerConfig","transportConfig","prefix","dateTimeFormat","formatMessage","getFormattedLevel","getFormattedPrefix","getFormattedDateTime","upperCaseLevel","toUpperCase","LogLevelColorInfoEnum","isFunction","val","Object","prototype","toString","call","isObject","isString","LogLevelNumberEnum","LogTransportManager","transports","addTransport","transport","push","shouldLog","transportLevel","configLevel","targetLevel","desiredLevel","log","i","length","logMessageBuilder","formattedMessage","LogManager","Date","getTime","isAlwaysNewInstance","instance","name","requestId","transportManager","handleTransports","toISOString","Instance","addTransports","logger","initLogger","getLogger","VWOContext","createContext","vwoClient","userContext","setUserContext","undefined","useVWOContext","context","useContext","VWOProvider","client","children","setVwoClient","useState","setContext","vwoClientRef","useRef","isMounted","useEffect","initializeVWO","init","current","destroy","React","Provider","value","useVWOClient","useGetFlag","featureKey","errorReturnSchema","flag","isEnabled","getVariables","getVariable","_key","defaultValue","isReady","setFlag","isLoading","setIsLoading","stableUserContext","useMemo","JSON","stringify","getFlag","useCallback","result","useGetFlagVariables","useGetFlagVariable","variableKey","useTrackEvent","eventName","eventProperties","trackEvent","useSetAttribute","attributeMap","keys","setAttribute"],"mappings":";;;;AAAA;;;;;;;;;;;;;;;AAgBA;;;;MAIsBA,MAAM;;ACpB5B;;;;;;;;;;;;;;;AAgBA,AAAA,IAAYC,YAMX;AAND,WAAYA,YAAY;EACtBA,+BAAe;EACfA,+BAAe;EACfA,6BAAa;EACbA,6BAAa;EACbA,+BAAe;AACjB,CAAC,EANWA,YAAY,KAAZA,YAAY;;AChBxB;;;;;;;;;;;;;;;AAgBA,AAGA;;;;AAIA,MAAaC,gBAAgB;;;;;EAQ3BC,YAAYC,SAA8B,EAAE;IAC1C,I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,CACtG;MACD;;;IAIF,MAAM;MAAEwD,SAAS;MAAEC;KAAa,GAAGG,aAAa,EAAE;IAElD,IAAI,CAACJ,SAAS,EAAE;MACdL,MAAM,CAACnD,KAAK,CAAC,6FAA6F,CAAC;MAC3G,OAAO,EAAE;;IAGX,IAAI,CAACyD,WAAW,IAAI,CAACpC,QAAQ,CAACoC,WAAW,CAAC,EAAE;MAC1CN,MAAM,CAACnD,KAAK,CAAC,uFAAuF,CAAC;MACrG,OAAO,EAAE;;;IAIXwD,SAAS,CAACuD,YAAY,CAACF,YAAY,EAAEpD,WAAW,CAAC;GAClD,CAAC,OAAOzD,KAAK,EAAE;IACdmD,MAAM,CAACnD,KAAK,CAAC,6BAA6BA,KAAK,EAAE,CAAC;;AAEtD,CAAC;;;;"}
|
package/lib/useGetFlag.ts
CHANGED
|
@@ -50,7 +50,7 @@ export const useGetFlag = (featureKey: string, context?: any) => {
|
|
|
50
50
|
// Memoize the user context to prevent unnecessary re-renders
|
|
51
51
|
const stableUserContext = useMemo(() => {
|
|
52
52
|
return context || userContext || {};
|
|
53
|
-
}, [JSON.stringify(userContext)]); // Only recreate if userContext actually changes
|
|
53
|
+
}, [JSON.stringify(context || userContext || {})]); // Only recreate if userContext actually changes
|
|
54
54
|
|
|
55
55
|
// Define the getFlag function to fetch the feature flag
|
|
56
56
|
const getFlag = useCallback(async () => {
|
package/package.json
CHANGED
|
File without changes
|