vwo-fme-react-sdk 1.8.0 → 1.50.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/VWOContext.d.ts +2 -2
  3. package/dist/VWOProvider.d.ts +2 -2
  4. package/dist/constants/Constants.d.ts +18 -0
  5. package/dist/enum/HookEnum.d.ts +1 -1
  6. package/dist/enum/LogMessageEnum.d.ts +6 -6
  7. package/dist/index.d.ts +11 -7
  8. package/dist/index.wingify.d.ts +56 -0
  9. package/dist/sdk.d.ts +26 -0
  10. package/dist/sdk.wingify.d.ts +26 -0
  11. package/dist/services/LoggerService.d.ts +1 -1
  12. package/dist/types/Common.d.ts +1 -1
  13. package/dist/useGetFlag.d.ts +2 -2
  14. package/dist/useGetFlagVariable.d.ts +2 -2
  15. package/dist/useSetAttribute.d.ts +1 -1
  16. package/dist/useTrackEvent.d.ts +1 -1
  17. package/dist/useVWOClient.d.ts +2 -2
  18. package/dist/utils/LogMessageUtil.d.ts +7 -22
  19. package/dist/vwo-fme-react-sdk.cjs.development.js +51 -29
  20. package/dist/vwo-fme-react-sdk.cjs.development.js.map +1 -1
  21. package/dist/vwo-fme-react-sdk.cjs.production.min.js +1 -1
  22. package/dist/vwo-fme-react-sdk.cjs.production.min.js.map +1 -1
  23. package/dist/vwo-fme-react-sdk.esm.js +51 -29
  24. package/dist/vwo-fme-react-sdk.esm.js.map +1 -1
  25. package/dist/vwo-fme-react-sdk.umd.development.js +51 -29
  26. package/dist/vwo-fme-react-sdk.umd.development.js.map +1 -1
  27. package/dist/vwo-fme-react-sdk.umd.production.min.js +1 -1
  28. package/dist/vwo-fme-react-sdk.umd.production.min.js.map +1 -1
  29. package/lib/VWOContext.ts +2 -2
  30. package/lib/VWOProvider.tsx +3 -3
  31. package/lib/constants/Constants.ts +21 -0
  32. package/lib/enum/HookEnum.ts +1 -1
  33. package/lib/enum/LogMessageEnum.ts +6 -6
  34. package/lib/globals.d.ts +22 -0
  35. package/lib/index.ts +11 -7
  36. package/lib/index.wingify.ts +67 -0
  37. package/lib/sdk.ts +27 -0
  38. package/lib/sdk.wingify.ts +27 -0
  39. package/lib/services/LoggerService.ts +1 -1
  40. package/lib/types/Common.ts +1 -1
  41. package/lib/useGetFlag.ts +2 -2
  42. package/lib/useGetFlagVariable.ts +2 -2
  43. package/lib/useSetAttribute.ts +3 -3
  44. package/lib/useTrackEvent.ts +2 -2
  45. package/lib/useVWOClient.ts +2 -2
  46. package/lib/utils/LogMessageUtil.ts +19 -14
  47. package/package.json +13 -7
package/CHANGELOG.md CHANGED
@@ -5,6 +5,59 @@ 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.50.0] - 2026-06-05
9
+
10
+ This release introduces **Wingify** as the primary SDK branding and package namespace, while keeping existing **VWO** integrations fully supported.
11
+
12
+ ### Added
13
+
14
+ - **Wingify public API** — use `WingifyProvider`, `useWingifyClient`, `useGetFlag`, and `useTrackEvent` from the `wingify-fme-react-sdk` package as the recommended entry point for new integrations.
15
+
16
+ ```jsx
17
+ import { WingifyProvider, useGetFlag } from 'wingify-fme-react-sdk';
18
+
19
+ const wingifyOptions = {
20
+ accountId: '123456',
21
+ sdkKey: '32-alpha-numeric-sdk-key',
22
+ };
23
+
24
+ function App() {
25
+ return (
26
+ <WingifyProvider config={wingifyOptions}>
27
+ <FeatureComponent />
28
+ </WingifyProvider>
29
+ );
30
+ }
31
+
32
+ function FeatureComponent() {
33
+ const { isEnabled, variables } = useGetFlag('feature-key', { id: 'user-123' });
34
+ console.log(isEnabled, variables);
35
+ return isEnabled ? <div>Feature Enabled</div> : <div>Feature Disabled</div>;
36
+ }
37
+ ```
38
+
39
+ - Dual-brand support: single codebase builds two NPM packages — `vwo-fme-react-sdk` (legacy) and `wingify-fme-react-sdk` (new).
40
+ - Build scripts leveraging `tsdx` and `@rollup/plugin-alias` to produce both NPM bundles via `BRAND` env var.
41
+ - Dual support for fetching from Node SDKs: `vwo-fme-node-sdk` for VWO and `wingify-fme-node-sdk` for Wingify.
42
+
43
+ ### Changed
44
+
45
+ - The SDK implementation entry points now dynamically alias to Wingify or VWO.
46
+ - Log messages and documentation have been updated to reflect Wingify branding dynamically.
47
+ - **No breaking changes for existing integrations** — context, payload keys, and runtime behavior remain compatible with the VWO platform.
48
+
49
+ ### Deprecated
50
+
51
+ The following **VWO** package imports from `vwo-fme-react-sdk` are deprecated but **continue to work without modification**:
52
+
53
+ | Deprecated (still supported) | Use instead |
54
+ | ---------------------------- | ------------------------------- |
55
+ | `vwo-fme-react-sdk` package | `wingify-fme-react-sdk` package |
56
+
57
+ Existing code does not need to change immediately. We recommend adopting the Wingify API for new projects and migrating when convenient.
58
+
59
+ **Migration tip:** Replace package imports from `vwo-fme-react-sdk` with `wingify-fme-react-sdk`, and rename components/hooks (`VWOProvider` → `WingifyProvider`, `useVWOClient` → `useWingifyClient`, `useVWOContext` → `useWingifyContext`). Method signatures and SDK behavior are unchanged.
60
+
8
61
  ## [1.8.0] - 2026-02-13
9
62
 
10
63
  ### Added
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  /// <reference types="react" />
17
- import { IVWOClient, IVWOContextModel } from 'vwo-fme-node-sdk';
17
+ import { IVWOClient, IVWOContextModel } from './sdk';
18
18
  interface VWOContextType {
19
19
  vwoClient: IVWOClient | null;
20
20
  userContext?: IVWOContextModel | null;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import React, { ReactNode } from 'react';
17
- import { IVWOContextModel, IVWOClient, IVWOOptions } from 'vwo-fme-node-sdk';
17
+ import { IVWOContextModel, IVWOClient, IVWOOptions } from './sdk';
18
18
  export interface VWOProviderWithClient {
19
19
  client: IVWOClient;
20
20
  userContext?: IVWOContextModel;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare const isWingify: boolean;
17
+ export declare const BRAND_DISPLAY_NAME: string;
18
+ export declare const LOG_PREFIX: string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -14,19 +14,19 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export declare enum LogMessageEnum {
17
- VWO_CLIENT_MISSING = 'VWO Client is missing in {hookName} hook. Ensure VWOProvider is correctly initialized.',
17
+ VWO_CLIENT_MISSING = '{brand} Client is missing in {hookName} hook. Ensure VWOProvider is correctly initialized.',
18
18
  INVALID_CONTEXT = 'Invalid user context in {hookName} hook. Ensure a valid userContext is provided.',
19
19
  HOOK_ERROR = 'Error in {hookName} hook: {error}',
20
20
  INVALID_HOOK_USAGE = '{hookName} must be used within a VWOProvider !!',
21
- VWO_PROVIDER_CLIENT_CONFIG_WARNING = 'VWOProvider Warning: Both `client` and `config` are provided. The `client` prop will take precedence, and the `config` props will be disregarded.',
22
- VWO_PROVIDER_CONFIG_REQUIRED = 'VWOProvider Error: Either `client` or `config` must be provided.',
23
- VWO_SDK_INITIALIZATION_FAILED = 'VWO-SDK Initialization failed: {error}',
21
+ VWO_PROVIDER_CLIENT_CONFIG_WARNING = '{brand}Provider Warning: Both `client` and `config` are provided. The `client` prop will take precedence, and the `config` props will be disregarded.',
22
+ VWO_PROVIDER_CONFIG_REQUIRED = '{brand}Provider Error: Either `client` or `config` must be provided.',
23
+ VWO_SDK_INITIALIZATION_FAILED = '{logPrefix} Initialization failed: {error}',
24
24
  VWO_TRACK_EVENT_NAME_REQUIRED = 'Event name is required for useTrackEvent hook and it should be a string',
25
25
  VWO_TRACK_EVENT_ERROR = 'Error tracking event - {eventName}: {error}',
26
26
  VWO_SET_ATTRIBUTE_MAP_REQUIRED = 'attributeMap (object having key-value pairs of user attributes) is required for useSetAttribute hook',
27
27
  VWO_SET_ATTRIBUTE_ERROR = 'Error setting attributes: {error}',
28
28
  VWO_SET_ATTRIBUTE_SUCCESS = 'User attributes set: {attributes}',
29
- VWO_NOT_READY_IN_USE_GET_FLAG = 'VWO is not ready in useGetFlag hook',
29
+ VWO_NOT_READY_IN_USE_GET_FLAG = '{brand} is not ready in useGetFlag hook',
30
30
  VWO_GET_FLAG_FEATURE_KEY_REQUIRED = 'Feature key is required for useGetFlag hook',
31
31
  VWO_GET_FLAG_ERROR = 'Error fetching feature flag - {featureKey}: {error}',
32
32
  VWO_GET_FLAG_VARIABLES_FLAG_REQUIRED = 'Flag is required for useGetFlagVariables hook and should be an object',
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,15 +13,19 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { VWOProvider, IVWOProvider, VWOProviderWithClient, VWOProviderWithConfig } from './VWOProvider';
16
+ export { VWOProvider } from './VWOProvider';
17
+ export type { IVWOProvider, VWOProviderWithClient, VWOProviderWithConfig } from './VWOProvider';
17
18
  export { useVWOClient } from './useVWOClient';
18
- export { useGetFlag, IFlag } from './useGetFlag';
19
+ export { useGetFlag } from './useGetFlag';
20
+ export type { IFlag } from './useGetFlag';
19
21
  export { useGetFlagVariable } from './useGetFlagVariable';
20
22
  export { useGetFlagVariables } from './useGetFlagVariable';
21
- export { useTrackEvent, ITrackEvent } from './useTrackEvent';
22
- export { useSetAttribute, ISetAttribute } from './useSetAttribute';
23
+ export { useTrackEvent } from './useTrackEvent';
24
+ export type { ITrackEvent } from './useTrackEvent';
25
+ export { useSetAttribute } from './useSetAttribute';
26
+ export type { ISetAttribute } from './useSetAttribute';
23
27
  export { useVWOContext } from './VWOContext';
24
- export { VWOClientResult } from './useVWOClient';
28
+ export type { VWOClientResult } from './useVWOClient';
25
29
  export {
26
30
  init,
27
31
  IVWOContextModel,
@@ -32,4 +36,4 @@ export {
32
36
  LogLevelEnum,
33
37
  getUUID,
34
38
  ISettingsData,
35
- } from 'vwo-fme-node-sdk';
39
+ } from './sdk';
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import React, { ReactNode } from 'react';
17
+ import { IWingifyClient, IWingifyContextModel, IWingifyOptions } from 'wingify-fme-node-sdk';
18
+ export interface WingifyProviderWithClient {
19
+ client: IWingifyClient;
20
+ userContext?: IWingifyContextModel;
21
+ children: ReactNode;
22
+ fallbackComponent?: ReactNode;
23
+ }
24
+ export interface WingifyProviderWithConfig {
25
+ config: IWingifyOptions;
26
+ userContext?: IWingifyContextModel;
27
+ children: ReactNode;
28
+ fallbackComponent?: ReactNode;
29
+ }
30
+ export declare type IWingifyProvider = WingifyProviderWithClient | WingifyProviderWithConfig;
31
+ export declare function WingifyProvider(props: IWingifyProvider): React.ReactElement;
32
+ export { useVWOClient as useWingifyClient } from './useVWOClient';
33
+ export { useGetFlag } from './useGetFlag';
34
+ export type { IFlag } from './useGetFlag';
35
+ export { useGetFlagVariable } from './useGetFlagVariable';
36
+ export { useGetFlagVariables } from './useGetFlagVariable';
37
+ export { useTrackEvent } from './useTrackEvent';
38
+ export type { ITrackEvent } from './useTrackEvent';
39
+ export { useSetAttribute } from './useSetAttribute';
40
+ export type { ISetAttribute } from './useSetAttribute';
41
+ export { useVWOContext as useWingifyContext } from './VWOContext';
42
+ export {
43
+ init,
44
+ IWingifyContextModel,
45
+ IWingifyClient,
46
+ IWingifyOptions,
47
+ Flag,
48
+ StorageConnector,
49
+ LogLevelEnum,
50
+ getUUID,
51
+ ISettingsData,
52
+ } from 'wingify-fme-node-sdk';
53
+ export declare type WingifyClientResult = {
54
+ vwoClient: import('wingify-fme-node-sdk').IWingifyClient | null;
55
+ isReady: boolean;
56
+ };
package/dist/sdk.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {
17
+ init,
18
+ IVWOOptions,
19
+ IVWOClient,
20
+ IVWOContextModel,
21
+ Flag,
22
+ StorageConnector,
23
+ LogLevelEnum,
24
+ getUUID,
25
+ ISettingsData,
26
+ } from 'vwo-fme-node-sdk';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {
17
+ init,
18
+ IWingifyOptions as IVWOOptions,
19
+ IWingifyClient as IVWOClient,
20
+ IWingifyContextModel as IVWOContextModel,
21
+ Flag,
22
+ StorageConnector,
23
+ LogLevelEnum,
24
+ getUUID,
25
+ ISettingsData,
26
+ } from 'wingify-fme-node-sdk';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Flag, IVWOContextModel } from 'vwo-fme-node-sdk';
16
+ import { Flag, IVWOContextModel } from './sdk';
17
17
  export interface IFlag {
18
18
  flag: Flag;
19
19
  isReady: boolean;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Flag } from 'vwo-fme-node-sdk';
16
+ import { Flag } from './sdk';
17
17
  /**
18
18
  * Hook to get all variables from a flag
19
19
  * @param flag - The flag to get the variables from
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
2
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { IVWOClient } from 'vwo-fme-node-sdk';
16
+ import { IVWOClient } from './sdk';
17
17
  export interface VWOClientResult {
18
18
  vwoClient: IVWOClient | null;
19
19
  isReady: boolean;
@@ -1,18 +1,4 @@
1
- /**
2
- * Copyright 2025 Wingify Software Pvt. Ltd.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
1
+ import { LogManager } from '@wingify/service-logger';
16
2
  /**
17
3
  * Constructs a message by replacing placeholders in a template with corresponding values from a data object.
18
4
  *
@@ -20,12 +6,11 @@
20
6
  * @param {Record<string, any>} data - An object containing keys and values used to replace the placeholders in the template.
21
7
  * @returns {string} The constructed message with all placeholders replaced by their corresponding values from the data object.
22
8
  */
23
- export declare function buildMessage(template: string, data?: Record<string, any>): string;
9
+ export declare function buildMessage(template?: string, data?: Record<string, any>): string;
24
10
  /**
25
- * Logs an error message using the provided logger after building the message with template data.
26
- *
27
- * @param {any} logger - The logger instance used to log the error message.
28
- * @param {any} obj - An object containing data used to replace placeholders in the message template.
29
- * @param {string} message - The message template containing placeholders to be replaced with values from the obj parameter.
11
+ * Logs a hook error message.
12
+ * @param {LogManager} logger - The logger instance.
13
+ * @param {Record<string, any>} data - The data object containing error details.
14
+ * @param {string} template - The message template.
30
15
  */
31
- export declare function logHookError(logger: any, obj: Record<string, any>, message: string): void;
16
+ export declare function logHookError(logger: LogManager | undefined, data: Record<string, any>, template: string): void;
@@ -27,7 +27,7 @@ var serviceLogger = require('@wingify/service-logger');
27
27
  var utilDataType = require('@wingify/util-data-type');
28
28
 
29
29
  /**
30
- * Copyright 2025 Wingify Software Pvt. Ltd.
30
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
31
31
  *
32
32
  * Licensed under the Apache License, Version 2.0 (the "License");
33
33
  * you may not use this file except in compliance with the License.
@@ -72,7 +72,7 @@ function getLogger() {
72
72
  }
73
73
 
74
74
  /**
75
- * Copyright 2025 Wingify Software Pvt. Ltd.
75
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
76
76
  *
77
77
  * Licensed under the Apache License, Version 2.0 (the "License");
78
78
  * you may not use this file except in compliance with the License.
@@ -89,14 +89,14 @@ function getLogger() {
89
89
  var LogMessageEnum;
90
90
  (function (LogMessageEnum) {
91
91
  // common messages
92
- LogMessageEnum["VWO_CLIENT_MISSING"] = "VWO Client is missing in {hookName} hook. Ensure VWOProvider is correctly initialized.";
92
+ LogMessageEnum["VWO_CLIENT_MISSING"] = "{brand} Client is missing in {hookName} hook. Ensure VWOProvider is correctly initialized.";
93
93
  LogMessageEnum["INVALID_CONTEXT"] = "Invalid user context in {hookName} hook. Ensure a valid userContext is provided.";
94
94
  LogMessageEnum["HOOK_ERROR"] = "Error in {hookName} hook: {error}";
95
95
  LogMessageEnum["INVALID_HOOK_USAGE"] = "{hookName} must be used within a VWOProvider !!";
96
96
  // VWO Provider Messages
97
- LogMessageEnum["VWO_PROVIDER_CLIENT_CONFIG_WARNING"] = "VWOProvider Warning: Both `client` and `config` are provided. The `client` prop will take precedence, and the `config` props will be disregarded.";
98
- LogMessageEnum["VWO_PROVIDER_CONFIG_REQUIRED"] = "VWOProvider Error: Either `client` or `config` must be provided.";
99
- LogMessageEnum["VWO_SDK_INITIALIZATION_FAILED"] = "VWO-SDK Initialization failed: {error}";
97
+ LogMessageEnum["VWO_PROVIDER_CLIENT_CONFIG_WARNING"] = "{brand}Provider Warning: Both `client` and `config` are provided. The `client` prop will take precedence, and the `config` props will be disregarded.";
98
+ LogMessageEnum["VWO_PROVIDER_CONFIG_REQUIRED"] = "{brand}Provider Error: Either `client` or `config` must be provided.";
99
+ LogMessageEnum["VWO_SDK_INITIALIZATION_FAILED"] = "{logPrefix} Initialization failed: {error}";
100
100
  // useTrackEvent Messages
101
101
  LogMessageEnum["VWO_TRACK_EVENT_NAME_REQUIRED"] = "Event name is required for useTrackEvent hook and it should be a string";
102
102
  LogMessageEnum["VWO_TRACK_EVENT_ERROR"] = "Error tracking event - {eventName}: {error}";
@@ -105,7 +105,7 @@ var LogMessageEnum;
105
105
  LogMessageEnum["VWO_SET_ATTRIBUTE_ERROR"] = "Error setting attributes: {error}";
106
106
  LogMessageEnum["VWO_SET_ATTRIBUTE_SUCCESS"] = "User attributes set: {attributes}";
107
107
  // useGetFlag Messages
108
- LogMessageEnum["VWO_NOT_READY_IN_USE_GET_FLAG"] = "VWO is not ready in useGetFlag hook";
108
+ LogMessageEnum["VWO_NOT_READY_IN_USE_GET_FLAG"] = "{brand} is not ready in useGetFlag hook";
109
109
  LogMessageEnum["VWO_GET_FLAG_FEATURE_KEY_REQUIRED"] = "Feature key is required for useGetFlag hook";
110
110
  LogMessageEnum["VWO_GET_FLAG_ERROR"] = "Error fetching feature flag - {featureKey}: {error}";
111
111
  // useGetFlagVariable Messages
@@ -116,7 +116,25 @@ var LogMessageEnum;
116
116
  })(LogMessageEnum || (LogMessageEnum = {}));
117
117
 
118
118
  /**
119
- * Copyright 2025 Wingify Software Pvt. Ltd.
119
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
120
+ *
121
+ * Licensed under the Apache License, Version 2.0 (the "License");
122
+ * you may not use this file except in compliance with the License.
123
+ * You may obtain a copy of the License at
124
+ *
125
+ * http://www.apache.org/licenses/LICENSE-2.0
126
+ *
127
+ * Unless required by applicable law or agreed to in writing, software
128
+ * distributed under the License is distributed on an "AS IS" BASIS,
129
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130
+ * See the License for the specific language governing permissions and
131
+ * limitations under the License.
132
+ */
133
+ const BRAND_DISPLAY_NAME = 'VWO';
134
+ const LOG_PREFIX = 'VWO-React-SDK';
135
+
136
+ /**
137
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
120
138
  *
121
139
  * Licensed under the Apache License, Version 2.0 (the "License");
122
140
  * you may not use this file except in compliance with the License.
@@ -138,7 +156,12 @@ const nargs = /\{([0-9a-zA-Z_]+)\}/g;
138
156
  * @param {Record<string, any>} data - An object containing keys and values used to replace the placeholders in the template.
139
157
  * @returns {string} The constructed message with all placeholders replaced by their corresponding values from the data object.
140
158
  */
141
- function buildMessage(template, data = {}) {
159
+ function buildMessage(template = '', data = {}) {
160
+ const payload = {
161
+ brand: BRAND_DISPLAY_NAME,
162
+ logPrefix: LOG_PREFIX,
163
+ ...data
164
+ };
142
165
  try {
143
166
  return template.replace(nargs, (match, key, index) => {
144
167
  // Check for escaped placeholders
@@ -146,7 +169,7 @@ function buildMessage(template, data = {}) {
146
169
  return key;
147
170
  }
148
171
  // Retrieve the value from the data object
149
- const value = data[key];
172
+ const value = payload[key];
150
173
  // If the key does not exist or the value is null/undefined, return an empty string
151
174
  if (value === undefined || value === null) {
152
175
  return '';
@@ -159,22 +182,21 @@ function buildMessage(template, data = {}) {
159
182
  }
160
183
  }
161
184
  /**
162
- * Logs an error message using the provided logger after building the message with template data.
163
- *
164
- * @param {any} logger - The logger instance used to log the error message.
165
- * @param {any} obj - An object containing data used to replace placeholders in the message template.
166
- * @param {string} message - The message template containing placeholders to be replaced with values from the obj parameter.
185
+ * Logs a hook error message.
186
+ * @param {LogManager} logger - The logger instance.
187
+ * @param {Record<string, any>} data - The data object containing error details.
188
+ * @param {string} template - The message template.
167
189
  */
168
- function logHookError(logger, obj = {}, message) {
169
- try {
170
- logger.error(buildMessage(message, obj));
171
- } catch (error) {
172
- console.error(`Error logging hook. Error: ${error}`);
190
+ function logHookError(logger, data, template) {
191
+ if (logger) {
192
+ logger.error(buildMessage(template, data));
193
+ } else {
194
+ console.error(buildMessage(template, data));
173
195
  }
174
196
  }
175
197
 
176
198
  /**
177
- * Copyright 2025 Wingify Software Pvt. Ltd.
199
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
178
200
  *
179
201
  * Licensed under the Apache License, Version 2.0 (the "License");
180
202
  * you may not use this file except in compliance with the License.
@@ -200,7 +222,7 @@ var HookEnum;
200
222
  })(HookEnum || (HookEnum = {}));
201
223
 
202
224
  /**
203
- * Copyright 2025 Wingify Software Pvt. Ltd.
225
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
204
226
  *
205
227
  * Licensed under the Apache License, Version 2.0 (the "License");
206
228
  * you may not use this file except in compliance with the License.
@@ -244,7 +266,7 @@ const useVWOContext = () => {
244
266
  };
245
267
 
246
268
  /**
247
- * Copyright 2025 Wingify Software Pvt. Ltd.
269
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
248
270
  *
249
271
  * Licensed under the Apache License, Version 2.0 (the "License");
250
272
  * you may not use this file except in compliance with the License.
@@ -307,7 +329,7 @@ function VWOProvider(props) {
307
329
  logHookError(logger, error, LogMessageEnum.VWO_SDK_INITIALIZATION_FAILED);
308
330
  }
309
331
  }, [memoizedConfig]); // Re-run only when config changes
310
- return React__default.createElement(VWOContext.Provider, {
332
+ return /*#__PURE__*/React__default.createElement(VWOContext.Provider, {
311
333
  value: {
312
334
  vwoClient,
313
335
  userContext: context,
@@ -318,7 +340,7 @@ function VWOProvider(props) {
318
340
  }
319
341
 
320
342
  /**
321
- * Copyright 2025 Wingify Software Pvt. Ltd.
343
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
322
344
  *
323
345
  * Licensed under the Apache License, Version 2.0 (the "License");
324
346
  * you may not use this file except in compliance with the License.
@@ -368,7 +390,7 @@ const useVWOClient = () => {
368
390
  };
369
391
 
370
392
  /**
371
- * Copyright 2025 Wingify Software Pvt. Ltd.
393
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
372
394
  *
373
395
  * Licensed under the Apache License, Version 2.0 (the "License");
374
396
  * you may not use this file except in compliance with the License.
@@ -460,7 +482,7 @@ const useGetFlag = (featureKey, context) => {
460
482
  };
461
483
 
462
484
  /**
463
- * Copyright 2025 Wingify Software Pvt. Ltd.
485
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
464
486
  *
465
487
  * Licensed under the Apache License, Version 2.0 (the "License");
466
488
  * you may not use this file except in compliance with the License.
@@ -523,7 +545,7 @@ const useGetFlagVariable = (flag, variableKey, defaultValue) => {
523
545
  };
524
546
 
525
547
  /**
526
- * Copyright 2025 Wingify Software Pvt. Ltd.
548
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
527
549
  *
528
550
  * Licensed under the Apache License, Version 2.0 (the "License");
529
551
  * you may not use this file except in compliance with the License.
@@ -603,7 +625,7 @@ const useTrackEvent = () => {
603
625
  };
604
626
 
605
627
  /**
606
- * Copyright 2025 Wingify Software Pvt. Ltd.
628
+ * Copyright 2025-2026 Wingify Software Pvt. Ltd.
607
629
  *
608
630
  * Licensed under the Apache License, Version 2.0 (the "License");
609
631
  * you may not use this file except in compliance with the License.