@kameleoon/react-sdk 7.2.3 → 7.2.4

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.
@@ -27,7 +27,7 @@ function createClient(siteCode, configuration) {
27
27
  externalRequestDispatcher: requestDispatcher,
28
28
  externalPackageInfo: {
29
29
  type: _javascriptSdkCore.SDKType.React,
30
- version: "7.2.3"
30
+ version: "7.2.4"
31
31
  }
32
32
  }
33
33
  });
@@ -8,6 +8,7 @@ export interface IAddDataHookResult {
8
8
  * @throws `KameleoonError` with one of the following `type` s:
9
9
  *
10
10
  * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.
11
+ * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
11
12
  * - `KameleoonException.StorageWrite` Couldn't update storage data.
12
13
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.
13
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useAddData.js","names":["_react","require","_useKameleoon","useAddData","client","useKameleoon","addData","useCallback","visitorCode","data"],"sources":["../src/useAddData.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { KameleoonDataType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IAddDataHookResult {\n /**\n * Adds targeting data to the storage so that other methods could decide whether the current visitor is targeted or not. Note: userAgent data will not be stored in storage like other data, and it will be sent with every tracking request for bot filtration.\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @param {KameleoonDataType[]} data - number of instances of any type of `KameleoonData`, can be added solely in array or as a sequential arguments.\n * @throws `KameleoonError` with one of the following `type` s:\n * \n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.\n * - `KameleoonException.StorageWrite` Couldn't update storage data.\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n */\n addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;\n}\n\n/**\n * A React Hook that returns `addData` function for adding targeting data to the Kameleoon storage.\n *\n * @returns {IAddDataHookResult} an object containing the `addData` function.\n */\nexport function useAddData(): IAddDataHookResult {\n const { client } = useKameleoon();\n\n const addData = useCallback(\n (visitorCode: string, ...data: KameleoonDataType[]): void => {\n client.addData(visitorCode, ...data);\n },\n [client],\n );\n\n return {\n addData,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAiBA;AACA;AACA;AACA;AACA;AACO,SAASE,UAAUA,CAAA,EAAuB;EAC/C,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,OAAO,GAAG,IAAAC,kBAAW,EACzB,CAACC,WAAmB,EAAE,GAAGC,IAAyB,KAAW;IAC3DL,MAAM,CAACE,OAAO,CAACE,WAAW,EAAE,GAAGC,IAAI,CAAC;EACtC,CAAC,EACD,CAACL,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"useAddData.js","names":["_react","require","_useKameleoon","useAddData","client","useKameleoon","addData","useCallback","visitorCode","data"],"sources":["../src/useAddData.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { KameleoonDataType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IAddDataHookResult {\n /**\n * Adds targeting data to the storage so that other methods could decide whether the current visitor is targeted or not. Note: userAgent data will not be stored in storage like other data, and it will be sent with every tracking request for bot filtration.\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @param {KameleoonDataType[]} data - number of instances of any type of `KameleoonData`, can be added solely in array or as a sequential arguments.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data.\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n */\n addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;\n}\n\n/**\n * A React Hook that returns `addData` function for adding targeting data to the Kameleoon storage.\n *\n * @returns {IAddDataHookResult} an object containing the `addData` function.\n */\nexport function useAddData(): IAddDataHookResult {\n const { client } = useKameleoon();\n\n const addData = useCallback(\n (visitorCode: string, ...data: KameleoonDataType[]): void => {\n client.addData(visitorCode, ...data);\n },\n [client],\n );\n\n return {\n addData,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAkBA;AACA;AACA;AACA;AACA;AACO,SAASE,UAAUA,CAAA,EAAuB;EAC/C,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,OAAO,GAAG,IAAAC,kBAAW,EACzB,CAACC,WAAmB,EAAE,GAAGC,IAAyB,KAAW;IAC3DL,MAAM,CAACE,OAAO,CAACE,WAAW,EAAE,GAAGC,IAAI,CAAC;EACtC,CAAC,EACD,CAACL,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
@@ -8,6 +8,7 @@ export interface IFeatureFlagActiveHookResult {
8
8
  * @throws `KameleoonError` with one of the following `type` s:
9
9
  *
10
10
  * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.
11
+ * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
11
12
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.
12
13
  * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`.
13
14
  * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.
@@ -1 +1 @@
1
- {"version":3,"file":"useFeatureFlagActive.js","names":["_react","require","_useKameleoon","useFeatureFlagActive","client","useKameleoon","isFeatureFlagActive","useCallback","visitorCode","featureKey"],"sources":["../src/useFeatureFlagActive.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IFeatureFlagActiveHookResult {\n /**\n * Indicates whether the visitor with `visitorCode` has `featureKey` active for him, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request.\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @param {string} featureKey - a unique key for feature flag.\n * @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`.\n * @throws `KameleoonError` with one of the following `type` s:\n * \n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`.\n * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted.\n */\n isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;\n}\n\n/**\n * A React Hook that returns `isFeatureFlagActive` function which indicates whether the visitor with `visitorCode` has `featureKey` active for him.\n *\n * @returns {IFeatureFlagActiveHookResult} an object containing the `isFeatureFlagActive` function.\n */\nexport function useFeatureFlagActive(): IFeatureFlagActiveHookResult {\n const { client } = useKameleoon();\n\n const isFeatureFlagActive = useCallback(\n (visitorCode: string, featureKey: string): boolean => {\n return client.isFeatureFlagActive(visitorCode, featureKey);\n },\n [client],\n );\n\n return {\n isFeatureFlagActive,\n };\n}"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAoBA;AACA;AACA;AACA;AACA;AACO,SAASE,oBAAoBA,CAAA,EAAiC;EACnE,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,mBAAmB,GAAG,IAAAC,kBAAW,EACrC,CAACC,WAAmB,EAAEC,UAAkB,KAAc;IACpD,OAAOL,MAAM,CAACE,mBAAmB,CAACE,WAAW,EAAEC,UAAU,CAAC;EAC5D,CAAC,EACD,CAACL,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"useFeatureFlagActive.js","names":["_react","require","_useKameleoon","useFeatureFlagActive","client","useKameleoon","isFeatureFlagActive","useCallback","visitorCode","featureKey"],"sources":["../src/useFeatureFlagActive.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IFeatureFlagActiveHookResult {\n /**\n * Indicates whether the visitor with `visitorCode` has `featureKey` active for him, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request.\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @param {string} featureKey - a unique key for feature flag.\n * @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`.\n * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted.\n */\n isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;\n}\n\n/**\n * A React Hook that returns `isFeatureFlagActive` function which indicates whether the visitor with `visitorCode` has `featureKey` active for him.\n *\n * @returns {IFeatureFlagActiveHookResult} an object containing the `isFeatureFlagActive` function.\n */\nexport function useFeatureFlagActive(): IFeatureFlagActiveHookResult {\n const { client } = useKameleoon();\n\n const isFeatureFlagActive = useCallback(\n (visitorCode: string, featureKey: string): boolean => {\n return client.isFeatureFlagActive(visitorCode, featureKey);\n },\n [client],\n );\n\n return {\n isFeatureFlagActive,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAqBA;AACA;AACA;AACA;AACA;AACO,SAASE,oBAAoBA,CAAA,EAAiC;EACnE,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,mBAAmB,GAAG,IAAAC,kBAAW,EACrC,CAACC,WAAmB,EAAEC,UAAkB,KAAc;IACpD,OAAOL,MAAM,CAACE,mBAAmB,CAACE,WAAW,EAAEC,UAAU,CAAC;EAC5D,CAAC,EACD,CAACL,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
@@ -8,6 +8,7 @@ export interface IFeatureFlagVariationKeyHookResult {
8
8
  * @throws `KameleoonError` with one of the following `type` s:
9
9
  *
10
10
  * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.
11
+ * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
11
12
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.
12
13
  * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`.
13
14
  * - `KameleoonException.NotTargeted` - Current visitor is not targeted.
@@ -1 +1 @@
1
- {"version":3,"file":"useFeatureFlagVariationKey.js","names":["_react","require","_useKameleoon","useFeatureFlagVariationKey","client","useKameleoon","getFeatureFlagVariationKey","useCallback","visitorCode","featureKey"],"sources":["../src/useFeatureFlagVariationKey.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IFeatureFlagVariationKeyHookResult {\n /**\n * Returns variation key for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request.\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @param {string} featureKey - a unique key for feature flag.\n * @returns {string} a string containing variable key for the allocated feature flag variation for the provided visitor.\n * @throws `KameleoonError` with one of the following `type` s:\n * \n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted.\n */\n getFeatureFlagVariationKey: (\n visitorCode: string,\n featureKey: string,\n ) => string;\n}\n\n/**\n * A React Hook that returns `getFeatureFlagVariationKey` function which returns variation key for the visitor under `visitorCode` in the found feature flag.\n *\n * @returns {IFeatureFlagVariationKeyHookResult} an object containing the `getFeatureFlagVariationKey` function.\n */\nexport function useFeatureFlagVariationKey(): IFeatureFlagVariationKeyHookResult {\n const { client } = useKameleoon();\n\n const getFeatureFlagVariationKey = useCallback(\n (visitorCode: string, featureKey: string): string => {\n return client.getFeatureFlagVariationKey(visitorCode, featureKey);\n },\n [client],\n );\n\n return {\n getFeatureFlagVariationKey,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAsBA;AACA;AACA;AACA;AACA;AACO,SAASE,0BAA0BA,CAAA,EAAuC;EAC/E,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,0BAA0B,GAAG,IAAAC,kBAAW,EAC5C,CAACC,WAAmB,EAAEC,UAAkB,KAAa;IACnD,OAAOL,MAAM,CAACE,0BAA0B,CAACE,WAAW,EAAEC,UAAU,CAAC;EACnE,CAAC,EACD,CAACL,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"useFeatureFlagVariationKey.js","names":["_react","require","_useKameleoon","useFeatureFlagVariationKey","client","useKameleoon","getFeatureFlagVariationKey","useCallback","visitorCode","featureKey"],"sources":["../src/useFeatureFlagVariationKey.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IFeatureFlagVariationKeyHookResult {\n /**\n * Returns variation key for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request.\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @param {string} featureKey - a unique key for feature flag.\n * @returns {string} a string containing variable key for the allocated feature flag variation for the provided visitor.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted.\n */\n getFeatureFlagVariationKey: (\n visitorCode: string,\n featureKey: string,\n ) => string;\n}\n\n/**\n * A React Hook that returns `getFeatureFlagVariationKey` function which returns variation key for the visitor under `visitorCode` in the found feature flag.\n *\n * @returns {IFeatureFlagVariationKeyHookResult} an object containing the `getFeatureFlagVariationKey` function.\n */\nexport function useFeatureFlagVariationKey(): IFeatureFlagVariationKeyHookResult {\n const { client } = useKameleoon();\n\n const getFeatureFlagVariationKey = useCallback(\n (visitorCode: string, featureKey: string): string => {\n return client.getFeatureFlagVariationKey(visitorCode, featureKey);\n },\n [client],\n );\n\n return {\n getFeatureFlagVariationKey,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAuBA;AACA;AACA;AACA;AACA;AACO,SAASE,0BAA0BA,CAAA,EAAuC;EAC/E,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,0BAA0B,GAAG,IAAAC,kBAAW,EAC5C,CAACC,WAAmB,EAAEC,UAAkB,KAAa;IACnD,OAAOL,MAAM,CAACE,0BAA0B,CAACE,WAAW,EAAEC,UAAU,CAAC;EACnE,CAAC,EACD,CAACL,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
@@ -8,8 +8,10 @@ export interface IFeatureVariableHookResult {
8
8
  * @throws `KameleoonError` with one of the following `type` s:
9
9
  *
10
10
  * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.
11
+ * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
11
12
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.
12
13
  * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`.
14
+ * - `KameleoonException.FeatureFlagVariableNotFound` - No feature variable was found for provided `visitorCode` and `variableKey`
13
15
  * - `KameleoonException.NotTargeted` - Current visitor is not targeted.
14
16
  * - `KameleoonException.JSONParse` - Couldn't pass JSON value.
15
17
  * - `KameleoonException.NumberParse` - Couldn't pass Number value.
@@ -15,8 +15,16 @@ function useFeatureVariable() {
15
15
  const {
16
16
  client
17
17
  } = (0, _useKameleoon.useKameleoon)();
18
- const getFeatureFlagVariable = (0, _react.useCallback)(params => {
19
- return client.getFeatureFlagVariable(params);
18
+ const getFeatureFlagVariable = (0, _react.useCallback)(({
19
+ visitorCode,
20
+ featureKey,
21
+ variableKey
22
+ }) => {
23
+ return client.getFeatureFlagVariable({
24
+ visitorCode,
25
+ featureKey,
26
+ variableKey
27
+ });
20
28
  }, [client]);
21
29
  return {
22
30
  getFeatureFlagVariable
@@ -1 +1 @@
1
- {"version":3,"file":"useFeatureVariable.js","names":["_react","require","_useKameleoon","useFeatureVariable","client","useKameleoon","getFeatureFlagVariable","useCallback","params"],"sources":["../src/useFeatureVariable.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport {\n GetFeatureFlagVariableParamsType,\n FeatureVariableResultType,\n} from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IFeatureVariableHookResult {\n /**\n * Returns a variable for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request.\n *\n * @param {GetFeatureFlagVariableParamsType} params - `visitorCode`, `featureKey` and `variableKey` parameters to return variable.\n * @return {FeatureVariableResultType} a variable object containing `type` and `value` fields, `type` can be checked against `FeatureVariableType` enum, if the `type` is `FeatureVariableType.BOOLEAN` then the `value` type will be `boolean` and so on.\n * @throws `KameleoonError` with one of the following `type` s:\n * \n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted.\n * - `KameleoonException.JSONParse` - Couldn't pass JSON value.\n * - `KameleoonException.NumberParse` - Couldn't pass Number value.\n */\n getFeatureFlagVariable: (\n params: GetFeatureFlagVariableParamsType,\n ) => FeatureVariableResultType;\n}\n\n/**\n * A React Hook that returns `getFeatureFlagVariable` function which retrieves a feature variable.\n *\n * @returns {IPageViewHookResult} an object containing the `getFeatureFlagVariable` function.\n */\nexport function useFeatureVariable(): IFeatureVariableHookResult {\n const { client } = useKameleoon();\n\n const getFeatureFlagVariable = useCallback(\n (params: GetFeatureFlagVariableParamsType): FeatureVariableResultType => {\n return client.getFeatureFlagVariable(params);\n },\n [client],\n );\n\n return {\n getFeatureFlagVariable,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,aAAA,GAAAD,OAAA;AAsBA;AACA;AACA;AACA;AACA;AACO,SAASE,kBAAkBA,CAAA,EAA+B;EAC/D,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,sBAAsB,GAAG,IAAAC,kBAAW,EACvCC,MAAwC,IAAgC;IACvE,OAAOJ,MAAM,CAACE,sBAAsB,CAACE,MAAM,CAAC;EAC9C,CAAC,EACD,CAACJ,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"useFeatureVariable.js","names":["_react","require","_useKameleoon","useFeatureVariable","client","useKameleoon","getFeatureFlagVariable","useCallback","visitorCode","featureKey","variableKey"],"sources":["../src/useFeatureVariable.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport {\n GetFeatureFlagVariableParamsType,\n FeatureVariableResultType,\n} from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IFeatureVariableHookResult {\n /**\n * Returns a variable for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request.\n *\n * @param {GetFeatureFlagVariableParamsType} params - `visitorCode`, `featureKey` and `variableKey` parameters to return variable.\n * @return {FeatureVariableResultType} a variable object containing `type` and `value` fields, `type` can be checked against `FeatureVariableType` enum, if the `type` is `FeatureVariableType.BOOLEAN` then the `value` type will be `boolean` and so on.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`.\n * - `KameleoonException.FeatureFlagVariableNotFound` - No feature variable was found for provided `visitorCode` and `variableKey`\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted.\n * - `KameleoonException.JSONParse` - Couldn't pass JSON value.\n * - `KameleoonException.NumberParse` - Couldn't pass Number value.\n */\n getFeatureFlagVariable: (\n params: GetFeatureFlagVariableParamsType,\n ) => FeatureVariableResultType;\n}\n\n/**\n * A React Hook that returns `getFeatureFlagVariable` function which retrieves a feature variable.\n *\n * @returns {IPageViewHookResult} an object containing the `getFeatureFlagVariable` function.\n */\nexport function useFeatureVariable(): IFeatureVariableHookResult {\n const { client } = useKameleoon();\n\n const getFeatureFlagVariable = useCallback(\n ({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType): FeatureVariableResultType => {\n return client.getFeatureFlagVariable({\n visitorCode,\n featureKey,\n variableKey,\n });\n },\n [client],\n );\n\n return {\n getFeatureFlagVariable,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,aAAA,GAAAD,OAAA;AAwBA;AACA;AACA;AACA;AACA;AACO,SAASE,kBAAkBA,CAAA,EAA+B;EAC/D,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,sBAAsB,GAAG,IAAAC,kBAAW,EACxC,CAAC;IACCC,WAAW;IACXC,UAAU;IACVC;EACgC,CAAC,KAAgC;IACjE,OAAON,MAAM,CAACE,sBAAsB,CAAC;MACnCE,WAAW;MACXC,UAAU;MACVC;IACF,CAAC,CAAC;EACJ,CAAC,EACD,CAACN,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
@@ -7,6 +7,7 @@ export interface ITrackConversionHookResult {
7
7
  * @throws `KameleoonError` with one of the following `type` s:
8
8
  *
9
9
  * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.
10
+ * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
10
11
  * - `KameleoonException.StorageWrite` Couldn't update storage data.
11
12
  */
12
13
  trackConversion: (params: TrackConversionParamsType) => void;
@@ -15,8 +15,16 @@ function useTrackConversion() {
15
15
  const {
16
16
  client
17
17
  } = (0, _useKameleoon.useKameleoon)();
18
- const trackConversion = (0, _react.useCallback)(params => {
19
- client.trackConversion(params);
18
+ const trackConversion = (0, _react.useCallback)(({
19
+ visitorCode,
20
+ goalId,
21
+ revenue
22
+ }) => {
23
+ client.trackConversion({
24
+ visitorCode,
25
+ goalId,
26
+ revenue
27
+ });
20
28
  }, [client]);
21
29
  return {
22
30
  trackConversion
@@ -1 +1 @@
1
- {"version":3,"file":"useTrackConversion.js","names":["_react","require","_useKameleoon","useTrackConversion","client","useKameleoon","trackConversion","useCallback","params"],"sources":["../src/useTrackConversion.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { TrackConversionParamsType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface ITrackConversionHookResult {\n /**\n * Creates and adds `Conversion` data to the visitor with specified parameters and executes `flushData`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter.\n *\n * @param {TrackConversionParamsType} params - `visitorCode`, `goalId` and `revenue` parameters for data tracking.\n * @throws `KameleoonError` with one of the following `type` s:\n * \n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.\n * - `KameleoonException.StorageWrite` Couldn't update storage data.\n */\n trackConversion: (params: TrackConversionParamsType) => void;\n}\n\n/**\n * A React Hook that returns trackConversion function which tracks conversion.\n *\n * @returns {ITrackConversionHookResult} an object containing the `trackConversion` function.\n */\nexport function useTrackConversion(): ITrackConversionHookResult {\n const { client } = useKameleoon();\n\n const trackConversion = useCallback(\n (params: TrackConversionParamsType): void => {\n client.trackConversion(params);\n },\n [client],\n );\n\n return {\n trackConversion,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAeA;AACA;AACA;AACA;AACA;AACO,SAASE,kBAAkBA,CAAA,EAA+B;EAC/D,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,eAAe,GAAG,IAAAC,kBAAW,EAChCC,MAAiC,IAAW;IAC3CJ,MAAM,CAACE,eAAe,CAACE,MAAM,CAAC;EAChC,CAAC,EACD,CAACJ,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"useTrackConversion.js","names":["_react","require","_useKameleoon","useTrackConversion","client","useKameleoon","trackConversion","useCallback","visitorCode","goalId","revenue"],"sources":["../src/useTrackConversion.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { TrackConversionParamsType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface ITrackConversionHookResult {\n /**\n * Creates and adds `Conversion` data to the visitor with specified parameters and executes `flushData`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter.\n *\n * @param {TrackConversionParamsType} params - `visitorCode`, `goalId` and `revenue` parameters for data tracking.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data.\n */\n trackConversion: (params: TrackConversionParamsType) => void;\n}\n\n/**\n * A React Hook that returns trackConversion function which tracks conversion.\n *\n * @returns {ITrackConversionHookResult} an object containing the `trackConversion` function.\n */\nexport function useTrackConversion(): ITrackConversionHookResult {\n const { client } = useKameleoon();\n\n const trackConversion = useCallback(\n ({ visitorCode, goalId, revenue }: TrackConversionParamsType): void => {\n client.trackConversion({ visitorCode, goalId, revenue });\n },\n [client],\n );\n\n return {\n trackConversion,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAgBA;AACA;AACA;AACA;AACA;AACO,SAASE,kBAAkBA,CAAA,EAA+B;EAC/D,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,eAAe,GAAG,IAAAC,kBAAW,EACjC,CAAC;IAAEC,WAAW;IAAEC,MAAM;IAAEC;EAAmC,CAAC,KAAW;IACrEN,MAAM,CAACE,eAAe,CAAC;MAAEE,WAAW;MAAEC,MAAM;MAAEC;IAAQ,CAAC,CAAC;EAC1D,CAAC,EACD,CAACN,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
@@ -9,6 +9,7 @@ export interface ITriggerExperimentHookResult {
9
9
  *
10
10
  * - `KameleoonException.ExperimentConfigurationNotFound` No configuration found for provided `experimentId`.
11
11
  * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.
12
+ * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
12
13
  * - `KameleoonException.StorageRead` Couldn't find associated experiment by provided `experimentId` and `visitorCode` inside the storage.
13
14
  * - `KameleoonException.NotTargeted` Current visitor is not targeted.
14
15
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.
@@ -1 +1 @@
1
- {"version":3,"file":"useTriggerExperiment.js","names":["_react","require","_useKameleoon","useTriggerExperiment","client","useKameleoon","triggerExperiment","useCallback","visitorCode","experimentId"],"sources":["../src/useTriggerExperiment.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface ITriggerExperimentHookResult {\n /**\n * Triggers experiment by assigning the variation to the user with `visitorCode`, if the variation is already assigned just returns it's id. Note: returned id `0` indicates default variation. At the same time executes `flushData` without sending extra request.\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @param {number} experimentId - id of experiment running for the current visitor.\n * @returns {number} associated variationId which is successfully searched/assigned.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.ExperimentConfigurationNotFound` No configuration found for provided `experimentId`.\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.\n * - `KameleoonException.StorageRead` Couldn't find associated experiment by provided `experimentId` and `visitorCode` inside the storage.\n * - `KameleoonException.NotTargeted` Current visitor is not targeted.\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n */\n triggerExperiment: (visitorCode: string, experimentId: number) => number;\n}\n\n/**\n * A React Hook that returns `triggerExperiment` function which triggers experiment.\n *\n * @returns {ITriggerExperimentHookResult} an object containing the `triggerExperiment` function.\n */\nexport function useTriggerExperiment(): ITriggerExperimentHookResult {\n const { client } = useKameleoon();\n\n const triggerExperiment = useCallback(\n (visitorCode: string, experimentId: number): number => {\n return client.triggerExperiment(visitorCode, experimentId);\n },\n [client],\n );\n\n return {\n triggerExperiment,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAoBA;AACA;AACA;AACA;AACA;AACO,SAASE,oBAAoBA,CAAA,EAAiC;EACnE,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,iBAAiB,GAAG,IAAAC,kBAAW,EACnC,CAACC,WAAmB,EAAEC,YAAoB,KAAa;IACrD,OAAOL,MAAM,CAACE,iBAAiB,CAACE,WAAW,EAAEC,YAAY,CAAC;EAC5D,CAAC,EACD,CAACL,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"useTriggerExperiment.js","names":["_react","require","_useKameleoon","useTriggerExperiment","client","useKameleoon","triggerExperiment","useCallback","visitorCode","experimentId"],"sources":["../src/useTriggerExperiment.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface ITriggerExperimentHookResult {\n /**\n * Triggers experiment by assigning the variation to the user with `visitorCode`, if the variation is already assigned just returns it's id. Note: returned id `0` indicates default variation. At the same time executes `flushData` without sending extra request.\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @param {number} experimentId - id of experiment running for the current visitor.\n * @returns {number} associated variationId which is successfully searched/assigned.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.ExperimentConfigurationNotFound` No configuration found for provided `experimentId`.\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageRead` Couldn't find associated experiment by provided `experimentId` and `visitorCode` inside the storage.\n * - `KameleoonException.NotTargeted` Current visitor is not targeted.\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n */\n triggerExperiment: (visitorCode: string, experimentId: number) => number;\n}\n\n/**\n * A React Hook that returns `triggerExperiment` function which triggers experiment.\n *\n * @returns {ITriggerExperimentHookResult} an object containing the `triggerExperiment` function.\n */\nexport function useTriggerExperiment(): ITriggerExperimentHookResult {\n const { client } = useKameleoon();\n\n const triggerExperiment = useCallback(\n (visitorCode: string, experimentId: number): number => {\n return client.triggerExperiment(visitorCode, experimentId);\n },\n [client],\n );\n\n return {\n triggerExperiment,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAqBA;AACA;AACA;AACA;AACA;AACO,SAASE,oBAAoBA,CAAA,EAAiC;EACnE,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,iBAAiB,GAAG,IAAAC,kBAAW,EACnC,CAACC,WAAmB,EAAEC,YAAoB,KAAa;IACrD,OAAOL,MAAM,CAACE,iBAAiB,CAACE,WAAW,EAAEC,YAAY,CAAC;EAC5D,CAAC,EACD,CAACL,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
@@ -9,6 +9,7 @@ export interface IVisitorExperimentsHookResult {
9
9
  * @throws `KameleoonError` with one of the following `type` s:
10
10
  *
11
11
  * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.
12
+ * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
12
13
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.
13
14
  */
14
15
  getVisitorExperiments: (visitorCode: string, isAllocated?: boolean) => ExperimentType[];
@@ -1 +1 @@
1
- {"version":3,"file":"useVisitorExperiments.js","names":["_react","require","_useKameleoon","useVisitorExperiments","client","useKameleoon","getVisitorExperiments","useCallback","visitorCode","isAllocated"],"sources":["../src/useVisitorExperiments.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { ExperimentType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IVisitorExperimentsHookResult {\n /**\n * Returns a list of experiments that the visitor with `visitorCode` is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated if the experiment will be triggered).\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @param {boolean | undefined} isAllocated - boolean value indicating that only experiments *allocated* for visitor will be returned. Default value is `true`.\n * @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n */\n getVisitorExperiments: (\n visitorCode: string,\n isAllocated?: boolean,\n ) => ExperimentType[];\n}\n\n/**\n * A React Hook that returns `getVisitorExperiments` function which returns a list of experiments that the visitor with `visitorCode` is targeted by.\n *\n * @returns {IVisitorExperimentsHookResult} an object containing the `getVisitorExperiments` function.\n */\nexport function useVisitorExperiments(): IVisitorExperimentsHookResult {\n const { client } = useKameleoon();\n\n const getVisitorExperiments = useCallback(\n (visitorCode: string, isAllocated?: boolean): ExperimentType[] => {\n return client.getVisitorExperiments(visitorCode, isAllocated);\n },\n [client],\n );\n\n return {\n getVisitorExperiments,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAoBA;AACA;AACA;AACA;AACA;AACO,SAASE,qBAAqBA,CAAA,EAAkC;EACrE,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,qBAAqB,GAAG,IAAAC,kBAAW,EACvC,CAACC,WAAmB,EAAEC,WAAqB,KAAuB;IAChE,OAAOL,MAAM,CAACE,qBAAqB,CAACE,WAAW,EAAEC,WAAW,CAAC;EAC/D,CAAC,EACD,CAACL,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"useVisitorExperiments.js","names":["_react","require","_useKameleoon","useVisitorExperiments","client","useKameleoon","getVisitorExperiments","useCallback","visitorCode","isAllocated"],"sources":["../src/useVisitorExperiments.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { ExperimentType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IVisitorExperimentsHookResult {\n /**\n * Returns a list of experiments that the visitor with `visitorCode` is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated if the experiment will be triggered).\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @param {boolean | undefined} isAllocated - boolean value indicating that only experiments *allocated* for visitor will be returned. Default value is `true`.\n * @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n */\n getVisitorExperiments: (\n visitorCode: string,\n isAllocated?: boolean,\n ) => ExperimentType[];\n}\n\n/**\n * A React Hook that returns `getVisitorExperiments` function which returns a list of experiments that the visitor with `visitorCode` is targeted by.\n *\n * @returns {IVisitorExperimentsHookResult} an object containing the `getVisitorExperiments` function.\n */\nexport function useVisitorExperiments(): IVisitorExperimentsHookResult {\n const { client } = useKameleoon();\n\n const getVisitorExperiments = useCallback(\n (visitorCode: string, isAllocated?: boolean): ExperimentType[] => {\n return client.getVisitorExperiments(visitorCode, isAllocated);\n },\n [client],\n );\n\n return {\n getVisitorExperiments,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAqBA;AACA;AACA;AACA;AACA;AACO,SAASE,qBAAqBA,CAAA,EAAkC;EACrE,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,qBAAqB,GAAG,IAAAC,kBAAW,EACvC,CAACC,WAAmB,EAAEC,WAAqB,KAAuB;IAChE,OAAOL,MAAM,CAACE,qBAAqB,CAACE,WAAW,EAAEC,WAAW,CAAC;EAC/D,CAAC,EACD,CAACL,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
@@ -8,6 +8,7 @@ export interface IVisitorFeatureFlagsHookResult {
8
8
  * @throws `KameleoonError` with one of the following `type` s:
9
9
  *
10
10
  * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.
11
+ * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
11
12
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.
12
13
  * - `KameleoonException.NotTargeted` - Current visitor is not targeted.
13
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useVisitorFeatureFlags.js","names":["_react","require","_useKameleoon","useVisitorFeatureFlags","client","useKameleoon","getVisitorFeatureFlags","useCallback","visitorCode"],"sources":["../src/useVisitorFeatureFlags.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { FeatureFlagType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IVisitorFeatureFlagsHookResult {\n /**\n * Returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted.\n */\n getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];\n}\n\n/**\n * A React Hook that returns `getVisitorFeatureFlags` function which returns a list of feature flags that the visitor with `visitorCode` that is targeted by.\n *\n * @returns {IVisitorFeatureFlagsHookResult} an object containing the `getVisitorFeatureFlags` function.\n */\nexport function useVisitorFeatureFlags(): IVisitorFeatureFlagsHookResult {\n const { client } = useKameleoon();\n\n const getVisitorFeatureFlags = useCallback(\n (visitorCode: string): FeatureFlagType[] => {\n return client.getVisitorFeatureFlags(visitorCode);\n },\n [client],\n );\n\n return {\n getVisitorFeatureFlags,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAiBA;AACA;AACA;AACA;AACA;AACO,SAASE,sBAAsBA,CAAA,EAAmC;EACvE,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,sBAAsB,GAAG,IAAAC,kBAAW,EACvCC,WAAmB,IAAwB;IAC1C,OAAOJ,MAAM,CAACE,sBAAsB,CAACE,WAAW,CAAC;EACnD,CAAC,EACD,CAACJ,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"useVisitorFeatureFlags.js","names":["_react","require","_useKameleoon","useVisitorFeatureFlags","client","useKameleoon","getVisitorFeatureFlags","useCallback","visitorCode"],"sources":["../src/useVisitorFeatureFlags.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { FeatureFlagType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IVisitorFeatureFlagsHookResult {\n /**\n * Returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted.\n */\n getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];\n}\n\n/**\n * A React Hook that returns `getVisitorFeatureFlags` function which returns a list of feature flags that the visitor with `visitorCode` that is targeted by.\n *\n * @returns {IVisitorFeatureFlagsHookResult} an object containing the `getVisitorFeatureFlags` function.\n */\nexport function useVisitorFeatureFlags(): IVisitorFeatureFlagsHookResult {\n const { client } = useKameleoon();\n\n const getVisitorFeatureFlags = useCallback(\n (visitorCode: string): FeatureFlagType[] => {\n return client.getVisitorFeatureFlags(visitorCode);\n },\n [client],\n );\n\n return {\n getVisitorFeatureFlags,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAkBA;AACA;AACA;AACA;AACA;AACO,SAASE,sBAAsBA,CAAA,EAAmC;EACvE,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,0BAAY,GAAE;EAEjC,MAAMC,sBAAsB,GAAG,IAAAC,kBAAW,EACvCC,WAAmB,IAAwB;IAC1C,OAAOJ,MAAM,CAACE,sBAAsB,CAACE,WAAW,CAAC;EACnD,CAAC,EACD,CAACJ,MAAM,CAAC,CACT;EAED,OAAO;IACLE;EACF,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kameleoon/react-sdk",
3
- "version": "7.2.3",
3
+ "version": "7.2.4",
4
4
  "description": "Kameleoon React SDK",
5
5
  "files": [
6
6
  "dist"