@kameleoon/react-sdk 8.5.2 → 9.0.1

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 (141) hide show
  1. package/CHANGELOG.md +479 -0
  2. package/CHANGELOG_INTERNAL.md +3 -0
  3. package/README.md +26 -133
  4. package/dist/KameleoonContext.d.ts +3 -3
  5. package/dist/KameleoonContext.js +1 -1
  6. package/dist/KameleoonContext.js.map +1 -1
  7. package/dist/KameleoonProvider.d.ts +6 -6
  8. package/dist/KameleoonProvider.js +1 -1
  9. package/dist/KameleoonProvider.js.map +1 -1
  10. package/dist/createClient.d.ts +6 -0
  11. package/dist/createClient.js +2 -0
  12. package/dist/createClient.js.map +1 -0
  13. package/dist/index.d.ts +11 -24
  14. package/dist/index.js +1 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/interfaces/useData.d.ts +80 -0
  17. package/dist/interfaces/useData.js +2 -0
  18. package/dist/interfaces/useData.js.map +1 -0
  19. package/dist/interfaces/useFeatureFlag.d.ts +101 -0
  20. package/dist/interfaces/useFeatureFlag.js +2 -0
  21. package/dist/interfaces/useFeatureFlag.js.map +1 -0
  22. package/dist/interfaces/useInitialize.d.ts +23 -0
  23. package/dist/interfaces/useInitialize.js +2 -0
  24. package/dist/interfaces/useInitialize.js.map +1 -0
  25. package/dist/{useSetLegalConsent.d.ts → interfaces/useVisitorCode.d.ts} +12 -7
  26. package/dist/interfaces/useVisitorCode.js +2 -0
  27. package/dist/interfaces/useVisitorCode.js.map +1 -0
  28. package/dist/useData.d.ts +13 -0
  29. package/dist/useData.js +2 -0
  30. package/dist/useData.js.map +1 -0
  31. package/dist/useFeatureFlag.d.ts +15 -0
  32. package/dist/useFeatureFlag.js +2 -0
  33. package/dist/useFeatureFlag.js.map +1 -0
  34. package/dist/useInitialize.d.ts +6 -17
  35. package/dist/useInitialize.js +1 -1
  36. package/dist/useInitialize.js.map +1 -1
  37. package/dist/useKameleoon.d.ts +4 -4
  38. package/dist/useKameleoon.js +1 -1
  39. package/dist/useKameleoon.js.map +1 -1
  40. package/dist/useVisitorCode.d.ts +9 -0
  41. package/dist/useVisitorCode.js +2 -0
  42. package/dist/useVisitorCode.js.map +1 -0
  43. package/package.json +11 -15
  44. package/dist/eventSource/browserEventSource.d.ts +0 -4
  45. package/dist/eventSource/browserEventSource.js +0 -2
  46. package/dist/eventSource/browserEventSource.js.map +0 -1
  47. package/dist/eventSource/index.d.ts +0 -2
  48. package/dist/eventSource/index.js +0 -2
  49. package/dist/eventSource/index.js.map +0 -1
  50. package/dist/eventSource/nativeEventSource.d.ts +0 -4
  51. package/dist/eventSource/nativeEventSource.js +0 -2
  52. package/dist/eventSource/nativeEventSource.js.map +0 -1
  53. package/dist/kameleoonClient.d.ts +0 -7
  54. package/dist/kameleoonClient.js +0 -2
  55. package/dist/kameleoonClient.js.map +0 -1
  56. package/dist/kameleoonUtils/browserUtils.d.ts +0 -13
  57. package/dist/kameleoonUtils/browserUtils.js +0 -2
  58. package/dist/kameleoonUtils/browserUtils.js.map +0 -1
  59. package/dist/kameleoonUtils/nativeUtils.d.ts +0 -12
  60. package/dist/kameleoonUtils/nativeUtils.js +0 -2
  61. package/dist/kameleoonUtils/nativeUtils.js.map +0 -1
  62. package/dist/requester.d.ts +0 -9
  63. package/dist/requester.js +0 -2
  64. package/dist/requester.js.map +0 -1
  65. package/dist/storage/index.d.ts +0 -2
  66. package/dist/storage/index.js +0 -2
  67. package/dist/storage/index.js.map +0 -1
  68. package/dist/storage/localStorage.d.ts +0 -4
  69. package/dist/storage/localStorage.js +0 -2
  70. package/dist/storage/localStorage.js.map +0 -1
  71. package/dist/storage/nativeStorage.d.ts +0 -14
  72. package/dist/storage/nativeStorage.js +0 -2
  73. package/dist/storage/nativeStorage.js.map +0 -1
  74. package/dist/types.d.ts +0 -21
  75. package/dist/types.js +0 -2
  76. package/dist/types.js.map +0 -1
  77. package/dist/useAddData.d.ts +0 -22
  78. package/dist/useAddData.js +0 -2
  79. package/dist/useAddData.js.map +0 -1
  80. package/dist/useBrowserVisitorCode.d.ts +0 -17
  81. package/dist/useBrowserVisitorCode.js +0 -2
  82. package/dist/useBrowserVisitorCode.js.map +0 -1
  83. package/dist/useConfigurationUpdate.d.ts +0 -17
  84. package/dist/useConfigurationUpdate.js +0 -2
  85. package/dist/useConfigurationUpdate.js.map +0 -1
  86. package/dist/useEngineTrackingCode.d.ts +0 -5
  87. package/dist/useEngineTrackingCode.js +0 -2
  88. package/dist/useEngineTrackingCode.js.map +0 -1
  89. package/dist/useFeatureFlagActive.d.ts +0 -24
  90. package/dist/useFeatureFlagActive.js +0 -2
  91. package/dist/useFeatureFlagActive.js.map +0 -1
  92. package/dist/useFeatureFlagVariationKey.d.ts +0 -23
  93. package/dist/useFeatureFlagVariationKey.js +0 -2
  94. package/dist/useFeatureFlagVariationKey.js.map +0 -1
  95. package/dist/useFeatureFlags.d.ts +0 -18
  96. package/dist/useFeatureFlags.js +0 -2
  97. package/dist/useFeatureFlags.js.map +0 -1
  98. package/dist/useFeatureVariable.d.ts +0 -26
  99. package/dist/useFeatureVariable.js +0 -2
  100. package/dist/useFeatureVariable.js.map +0 -1
  101. package/dist/useFeatureVariables.d.ts +0 -25
  102. package/dist/useFeatureVariables.js +0 -2
  103. package/dist/useFeatureVariables.js.map +0 -1
  104. package/dist/useFlush.d.ts +0 -22
  105. package/dist/useFlush.js +0 -2
  106. package/dist/useFlush.js.map +0 -1
  107. package/dist/useNativeVisitorCode.d.ts +0 -16
  108. package/dist/useNativeVisitorCode.js +0 -2
  109. package/dist/useNativeVisitorCode.js.map +0 -1
  110. package/dist/useReactNativeVisitorCode.d.ts +0 -19
  111. package/dist/useReactNativeVisitorCode.js +0 -2
  112. package/dist/useReactNativeVisitorCode.js.map +0 -1
  113. package/dist/useReactVisitorCode.d.ts +0 -19
  114. package/dist/useReactVisitorCode.js +0 -2
  115. package/dist/useReactVisitorCode.js.map +0 -1
  116. package/dist/useRemoteData.d.ts +0 -19
  117. package/dist/useRemoteData.js +0 -2
  118. package/dist/useRemoteData.js.map +0 -1
  119. package/dist/useRemoteVisitorData.d.ts +0 -23
  120. package/dist/useRemoteVisitorData.js +0 -2
  121. package/dist/useRemoteVisitorData.js.map +0 -1
  122. package/dist/useSetLegalConsent.js +0 -2
  123. package/dist/useSetLegalConsent.js.map +0 -1
  124. package/dist/useTrackConversion.d.ts +0 -20
  125. package/dist/useTrackConversion.js +0 -2
  126. package/dist/useTrackConversion.js.map +0 -1
  127. package/dist/useVisitorFeatureFlags.d.ts +0 -22
  128. package/dist/useVisitorFeatureFlags.js +0 -2
  129. package/dist/useVisitorFeatureFlags.js.map +0 -1
  130. package/dist/useVisitorWarehouseAudience.d.ts +0 -24
  131. package/dist/useVisitorWarehouseAudience.js +0 -2
  132. package/dist/useVisitorWarehouseAudience.js.map +0 -1
  133. package/dist/visitorCodeManager/index.d.ts +0 -2
  134. package/dist/visitorCodeManager/index.js +0 -2
  135. package/dist/visitorCodeManager/index.js.map +0 -1
  136. package/dist/visitorCodeManager/reactNativeVisitorCodeManager.d.ts +0 -8
  137. package/dist/visitorCodeManager/reactNativeVisitorCodeManager.js +0 -2
  138. package/dist/visitorCodeManager/reactNativeVisitorCodeManager.js.map +0 -1
  139. package/dist/visitorCodeManager/reactVisitorCodeManager.d.ts +0 -8
  140. package/dist/visitorCodeManager/reactVisitorCodeManager.js +0 -2
  141. package/dist/visitorCodeManager/reactVisitorCodeManager.js.map +0 -1
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import {\n KameleoonCore,\n SDKConfigurationType,\n} from '@kameleoon/javascript-sdk-core';\nimport {\n ReactNativeVisitorCodeManagerConstructor,\n ReactVisitorCodeManagerConstructor,\n} from './visitorCodeManager';\n\n/**\n * @param {string} siteCode - client's siteCode defined on Kameleoon platform\n * @param {Partial<SDKConfigurationType> | undefined} configuration - client's configuration\n * */\nexport type SDKParameters = {\n siteCode: string;\n configuration?: Partial<SDKConfigurationType>;\n};\n\nexport type KameleoonContextType = {\n client: KameleoonCore;\n visitorCodeManager:\n | ReactVisitorCodeManagerConstructor\n | ReactNativeVisitorCodeManagerConstructor;\n};\n\n// TODO: Below types will be removed soon with new breaking release\nexport type ClientGetVisitorCodeParametersType = {\n domain: string;\n defaultVisitorCode?: string;\n};\n\nexport type MobileGetVisitorCodeParametersType = {\n defaultVisitorCode?: string;\n};\n"],"mappings":""}
@@ -1,22 +0,0 @@
1
- import { KameleoonDataType } from '@kameleoon/javascript-sdk-core';
2
- export interface IAddDataHookResult {
3
- /**
4
- * 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.
5
- *
6
- * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.
7
- * @param {KameleoonDataType[]} data - number of instances of any type of `KameleoonData`, can be added solely in array or as a sequential arguments.
8
- * @throws `KameleoonError` with one of the following `type` s:
9
- *
10
- * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.
11
- * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
12
- * - `KameleoonException.StorageWrite` Couldn't update storage data.
13
- * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
14
- */
15
- addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;
16
- }
17
- /**
18
- * A React Hook that returns `addData` function for adding targeting data to the Kameleoon storage.
19
- *
20
- * @returns {IAddDataHookResult} an object containing the `addData` function.
21
- */
22
- export declare function useAddData(): IAddDataHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useAddData=useAddData;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useAddData(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(a){for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];b.addData.apply(b,[a].concat(d))},[b]);return{addData:c}}
2
- //# sourceMappingURL=useAddData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAddData.js","names":["useAddData","a","useKameleoon","client","addData","useCallback","visitorCode","c","arguments","length","data","Array","e","apply","concat"],"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 the `kameleoonClient` completed it's `initialize` call.\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":"uKAyBO,QAAS,CAAAA,UAAUA,CAAA,CAAuB,KAAAC,CAAA,CAC5B,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAO,CAAG,GAAAC,kBAAW,EACzB,SAACC,CAAmB,CAAyC,SAAAC,CAAA,CAAAC,SAAA,CAAAC,MAAA,CAApCC,CAAI,CAAAC,KAAA,GAAAJ,CAAA,CAAAA,CAAA,MAAAK,CAAA,GAAAA,CAAA,CAAAL,CAAA,CAAAK,CAAA,GAAJF,CAAI,CAAAE,CAAA,IAAAJ,SAAA,CAAAI,CAAA,EAC3BT,CAAM,CAACC,OAAO,CAAAS,KAAA,CAAdV,CAAM,EAASG,CAAW,EAAAQ,MAAA,CAAKJ,CAAI,EACrC,CAAC,CACD,CAACP,CAAM,CAAC,CACT,CAED,MAAO,CACLC,OAAO,CAAPA,CACF,CACF"}
@@ -1,17 +0,0 @@
1
- export interface IBrowserVisitorCodeHookResult {
2
- /**
3
- * Obtains visitor code from browser cookie, if no cookie exists returns new random visitor code (or the specified default value).
4
- *
5
- * @param {string} domain - domain to be set to browser cookie along with visitor code.
6
- * @param {string | undefined} defaultVisitorCode - visitor code to be used instead of randomly generated visitor code in case there is no visitor code saved in browser cookie.
7
- * @returns {string} result visitor code.
8
- */
9
- getBrowserVisitorCode: (domain: string, defaultVisitorCode?: string) => string;
10
- }
11
- /**
12
- * @deprecated This hook is deprecated and will be removed in a future update. For handling legal consent, please use the `useReactVisitorCode` hook instead. Note that legal consent functionality is exclusively available through `useReactVisitorCode` and not via `useBrowserVisitorCode`.
13
- *
14
- * A React Hook that returns `getBrowserVisitorCode` function which obtains the Kameleoon visitorCode.
15
- * @returns {IBrowserVisitorCodeHookResult} an object containing the `getBrowserVisitorCode` function.
16
- */
17
- export declare function useBrowserVisitorCode(): IBrowserVisitorCodeHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useBrowserVisitorCode=useBrowserVisitorCode;var _react=require("react"),_browserUtils=require("./kameleoonUtils/browserUtils");function useBrowserVisitorCode(){var a=(0,_react.useCallback)(function(a,b){return _browserUtils.BrowserUtils.getVisitorCode(a,b)},[]);return{getBrowserVisitorCode:a}}
2
- //# sourceMappingURL=useBrowserVisitorCode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBrowserVisitorCode.js","names":["useBrowserVisitorCode","getBrowserVisitorCode","useCallback","domain","defaultVisitorCode","BrowserUtils","getVisitorCode"],"sources":["../src/useBrowserVisitorCode.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { BrowserUtils } from './kameleoonUtils/browserUtils';\n\nexport interface IBrowserVisitorCodeHookResult {\n /**\n * Obtains visitor code from browser cookie, if no cookie exists returns new random visitor code (or the specified default value).\n *\n * @param {string} domain - domain to be set to browser cookie along with visitor code.\n * @param {string | undefined} defaultVisitorCode - visitor code to be used instead of randomly generated visitor code in case there is no visitor code saved in browser cookie.\n * @returns {string} result visitor code.\n */\n getBrowserVisitorCode: (\n domain: string,\n defaultVisitorCode?: string,\n ) => string;\n}\n\n/**\n * @deprecated This hook is deprecated and will be removed in a future update. For handling legal consent, please use the `useReactVisitorCode` hook instead. Note that legal consent functionality is exclusively available through `useReactVisitorCode` and not via `useBrowserVisitorCode`.\n *\n * A React Hook that returns `getBrowserVisitorCode` function which obtains the Kameleoon visitorCode.\n * @returns {IBrowserVisitorCodeHookResult} an object containing the `getBrowserVisitorCode` function.\n */\nexport function useBrowserVisitorCode(): IBrowserVisitorCodeHookResult {\n const getBrowserVisitorCode = useCallback(\n (domain: string, defaultVisitorCode?: string): string => {\n return BrowserUtils.getVisitorCode(domain, defaultVisitorCode);\n },\n [],\n );\n\n return {\n getBrowserVisitorCode,\n };\n}\n"],"mappings":"2MAuBO,QAAS,CAAAA,qBAAqBA,CAAA,CAAkC,CACrE,GAAM,CAAAC,CAAqB,CAAG,GAAAC,kBAAW,EACvC,SAACC,CAAc,CAAEC,CAA2B,CAAa,CACvD,MAAO,CAAAC,0BAAY,CAACC,cAAc,CAACH,CAAM,CAAEC,CAAkB,CAC/D,CAAC,CACD,EAAE,CACH,CAED,MAAO,CACLH,qBAAqB,CAArBA,CACF,CACF"}
@@ -1,17 +0,0 @@
1
- export interface IConfigurationUpdateHookResult {
2
- /**
3
- * Fires a callback on client configuration update. Note: this method only works for server sent events of real time update.
4
- *
5
- * @param {() => void} callback - callback function with no parameters that will be called upon configuration update.
6
- * @throws `KameleoonError` with one of the following `type` s:
7
- *
8
- * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
9
- */
10
- onConfigurationUpdate: (callback: () => void) => void;
11
- }
12
- /**
13
- * A React Hook that returns `onConfigurationUpdate` function which fires a callback on client configuration update.
14
- *
15
- * @returns {IConfigurationUpdateHookResult} an object containing the `onConfigurationUpdate` function.
16
- */
17
- export declare function useConfigurationUpdate(): IConfigurationUpdateHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useConfigurationUpdate=useConfigurationUpdate;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useConfigurationUpdate(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(a){b.onConfigurationUpdate(a)},[b]);return{onConfigurationUpdate:c}}
2
- //# sourceMappingURL=useConfigurationUpdate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useConfigurationUpdate.js","names":["useConfigurationUpdate","a","useKameleoon","client","onConfigurationUpdate","useCallback","callback"],"sources":["../src/useConfigurationUpdate.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IConfigurationUpdateHookResult {\n /**\n * Fires a callback on client configuration update. Note: this method only works for server sent events of real time update.\n *\n * @param {() => void} callback - callback function with no parameters that will be called upon configuration update.\n * @throws `KameleoonError` with one of the following `type` s:\n * \n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.\n */\n onConfigurationUpdate: (callback: () => void) => void;\n}\n\n/**\n * A React Hook that returns `onConfigurationUpdate` function which fires a callback on client configuration update.\n *\n * @returns {IConfigurationUpdateHookResult} an object containing the `onConfigurationUpdate` function.\n */\nexport function useConfigurationUpdate(): IConfigurationUpdateHookResult {\n const { client } = useKameleoon();\n\n const onConfigurationUpdate = useCallback(\n (callback: () => void): void => {\n client.onConfigurationUpdate(callback);\n },\n [client],\n );\n\n return {\n onConfigurationUpdate,\n };\n}\n"],"mappings":"+LAoBO,QAAS,CAAAA,sBAAsBA,CAAA,CAAmC,KAAAC,CAAA,CACpD,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAqB,CAAG,GAAAC,kBAAW,EACvC,SAACC,CAAoB,CAAW,CAC9BH,CAAM,CAACC,qBAAqB,CAACE,CAAQ,CACvC,CAAC,CACD,CAACH,CAAM,CAAC,CACT,CAED,MAAO,CACLC,qBAAqB,CAArBA,CACF,CACF"}
@@ -1,5 +0,0 @@
1
- export interface IEngineTrackingCodeHookResult {
2
- }
3
- export declare function useEngineTrackingCode(): {
4
- getEngineTrackingCode: (visitorCode: string) => string;
5
- };
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useEngineTrackingCode=useEngineTrackingCode;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useEngineTrackingCode(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(a){return b.getEngineTrackingCode(a)},[b]);return{getEngineTrackingCode:c}}
2
- //# sourceMappingURL=useEngineTrackingCode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useEngineTrackingCode.js","names":["useEngineTrackingCode","a","useKameleoon","client","getEngineTrackingCode","useCallback","visitorCode"],"sources":["../src/useEngineTrackingCode.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IEngineTrackingCodeHookResult {\n /**\n * Returns Kameleoon tracking code for the current visitor. Tracking code is built of the feature flag variations that were assigned during the last 5 seconds.\n * See [Kameleoon Automation API](https://developers.kameleoon.com/apis/activation-api-js/api-reference#trigger-1) for the details\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {string} Kameleoon tracking code\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 */\n}\n\nexport function useEngineTrackingCode() {\n const { client } = useKameleoon();\n\n const getEngineTrackingCode = useCallback(\n (visitorCode: string): string => {\n return client.getEngineTrackingCode(visitorCode);\n },\n [client],\n );\n\n return {\n getEngineTrackingCode,\n };\n}\n"],"mappings":"6LAiBO,QAAS,CAAAA,qBAAqBA,CAAA,CAAG,KAAAC,CAAA,CACnB,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAqB,CAAG,GAAAC,kBAAW,EACvC,SAACC,CAAmB,CAAa,CAC/B,MAAO,CAAAH,CAAM,CAACC,qBAAqB,CAACE,CAAW,CACjD,CAAC,CACD,CAACH,CAAM,CAAC,CACT,CAED,MAAO,CACLC,qBAAqB,CAArBA,CACF,CACF"}
@@ -1,24 +0,0 @@
1
- export interface IFeatureFlagActiveHookResult {
2
- /**
3
- * 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.
4
- *
5
- * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.
6
- * @param {string} featureKey - a unique key for feature flag.
7
- * @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`.
8
- * @throws `KameleoonError` with one of the following `type` s:
9
- *
10
- * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.
11
- * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
12
- * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
13
- * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`.
14
- * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.
15
- * - `KameleoonException.NotTargeted` - Current visitor is not targeted.
16
- */
17
- isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;
18
- }
19
- /**
20
- * A React Hook that returns `isFeatureFlagActive` function which indicates whether the visitor with `visitorCode` has `featureKey` active for him.
21
- *
22
- * @returns {IFeatureFlagActiveHookResult} an object containing the `isFeatureFlagActive` function.
23
- */
24
- export declare function useFeatureFlagActive(): IFeatureFlagActiveHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFeatureFlagActive=useFeatureFlagActive;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useFeatureFlagActive(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(a,c){return b.isFeatureFlagActive(a,c)},[b]);return{isFeatureFlagActive:c}}
2
- //# sourceMappingURL=useFeatureFlagActive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFeatureFlagActive.js","names":["useFeatureFlagActive","a","useKameleoon","client","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 the `kameleoonClient` completed it's `initialize` call.\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `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":"2LA2BO,QAAS,CAAAA,oBAAoBA,CAAA,CAAiC,KAAAC,CAAA,CAChD,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAmB,CAAG,GAAAC,kBAAW,EACrC,SAACC,CAAmB,CAAEC,CAAkB,CAAc,CACpD,MAAO,CAAAJ,CAAM,CAACC,mBAAmB,CAACE,CAAW,CAAEC,CAAU,CAC3D,CAAC,CACD,CAACJ,CAAM,CAAC,CACT,CAED,MAAO,CACLC,mBAAmB,CAAnBA,CACF,CACF"}
@@ -1,23 +0,0 @@
1
- export interface IFeatureFlagVariationKeyHookResult {
2
- /**
3
- * 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.
4
- *
5
- * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.
6
- * @param {string} featureKey - a unique key for feature flag.
7
- * @returns {string} a string containing variable key for the allocated feature flag variation for the provided visitor.
8
- * @throws `KameleoonError` with one of the following `type` s:
9
- *
10
- * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.
11
- * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
12
- * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
13
- * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`.
14
- * - `KameleoonException.NotTargeted` - Current visitor is not targeted.
15
- */
16
- getFeatureFlagVariationKey: (visitorCode: string, featureKey: string) => string;
17
- }
18
- /**
19
- * A React Hook that returns `getFeatureFlagVariationKey` function which returns variation key for the visitor under `visitorCode` in the found feature flag.
20
- *
21
- * @returns {IFeatureFlagVariationKeyHookResult} an object containing the `getFeatureFlagVariationKey` function.
22
- */
23
- export declare function useFeatureFlagVariationKey(): IFeatureFlagVariationKeyHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFeatureFlagVariationKey=useFeatureFlagVariationKey;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useFeatureFlagVariationKey(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(a,c){return b.getFeatureFlagVariationKey(a,c)},[b]);return{getFeatureFlagVariationKey:c}}
2
- //# sourceMappingURL=useFeatureFlagVariationKey.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFeatureFlagVariationKey.js","names":["useFeatureFlagVariationKey","a","useKameleoon","client","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 the `kameleoonClient` completed it's `initialize` call.\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `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":"uMA6BO,QAAS,CAAAA,0BAA0BA,CAAA,CAAuC,KAAAC,CAAA,CAC5D,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAA0B,CAAG,GAAAC,kBAAW,EAC5C,SAACC,CAAmB,CAAEC,CAAkB,CAAa,CACnD,MAAO,CAAAJ,CAAM,CAACC,0BAA0B,CAACE,CAAW,CAAEC,CAAU,CAClE,CAAC,CACD,CAACJ,CAAM,CAAC,CACT,CAED,MAAO,CACLC,0BAA0B,CAA1BA,CACF,CACF"}
@@ -1,18 +0,0 @@
1
- import { FeatureFlagType } from '@kameleoon/javascript-sdk-core';
2
- export interface IFeatureFlagsHookResult {
3
- /**
4
- * Returns a list of feature flags stored in the client configuration.
5
- *
6
- * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields.
7
- * @throws `KameleoonError` with one of the following `type` s:
8
- *
9
- * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
10
- */
11
- getFeatureFlags: () => FeatureFlagType[];
12
- }
13
- /**
14
- * A React Hook that returns `getFeatureFlags` function which returns a list of feature flags.
15
- *
16
- * @returns {IFeatureFlagsHookResult} an object containing the `getFeatureFlags` function.
17
- */
18
- export declare function useFeatureFlags(): IFeatureFlagsHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFeatureFlags=useFeatureFlags;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useFeatureFlags(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(){return b.getFeatureFlags()},[b]);return{getFeatureFlags:c}}
2
- //# sourceMappingURL=useFeatureFlags.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFeatureFlags.js","names":["useFeatureFlags","a","useKameleoon","client","getFeatureFlags","useCallback"],"sources":["../src/useFeatureFlags.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { FeatureFlagType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IFeatureFlagsHookResult {\n /**\n * Returns a list of feature flags stored in the client configuration.\n *\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.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.\n */\n getFeatureFlags: () => FeatureFlagType[];\n}\n\n/**\n * A React Hook that returns `getFeatureFlags` function which returns a list of feature flags.\n *\n * @returns {IFeatureFlagsHookResult} an object containing the `getFeatureFlags` function.\n */\nexport function useFeatureFlags(): IFeatureFlagsHookResult {\n const { client } = useKameleoon();\n\n const getFeatureFlags = useCallback((): FeatureFlagType[] => {\n return client.getFeatureFlags();\n }, [client]);\n\n return {\n getFeatureFlags,\n };\n}\n"],"mappings":"iLAqBO,QAAS,CAAAA,eAAeA,CAAA,CAA4B,KAAAC,CAAA,CACtC,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAe,CAAG,GAAAC,kBAAW,EAAC,UAAyB,CAC3D,MAAO,CAAAF,CAAM,CAACC,eAAe,EAC/B,CAAC,CAAE,CAACD,CAAM,CAAC,CAAC,CAEZ,MAAO,CACLC,eAAe,CAAfA,CACF,CACF"}
@@ -1,26 +0,0 @@
1
- import { FeatureFlagVariableType, GetFeatureFlagVariableParamsType } from '@kameleoon/javascript-sdk-core';
2
- export interface IFeatureVariableHookResult {
3
- /**
4
- * 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.
5
- *
6
- * @param {GetFeatureFlagVariableParamsType} params - `visitorCode`, `featureKey` and `variableKey` parameters to return variable.
7
- * @return {FeatureFlagVariableType} a variable object containing `type` and `value` fields. You can check the `type` field against `VariableType` enum. For example, if the `type` is `VariableType.BOOLEAN` then `value` will be a `boolean` type.
8
- * @throws `KameleoonError` with one of the following `type` s:
9
- *
10
- * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.
11
- * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
12
- * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
13
- * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`.
14
- * - `KameleoonException.FeatureFlagVariableNotFound` - No feature variable was found for provided `visitorCode` and `variableKey`
15
- * - `KameleoonException.NotTargeted` - Current visitor is not targeted.
16
- * - `KameleoonException.JSONParse` - Couldn't pass JSON value.
17
- * - `KameleoonException.NumberParse` - Couldn't pass Number value.
18
- */
19
- getFeatureFlagVariable: (params: GetFeatureFlagVariableParamsType) => FeatureFlagVariableType;
20
- }
21
- /**
22
- * A React Hook that returns `getFeatureFlagVariable` function which retrieves a feature variable.
23
- *
24
- * @returns {IFeatureVariableHookResult} an object containing the `getFeatureFlagVariable` function.
25
- */
26
- export declare function useFeatureVariable(): IFeatureVariableHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFeatureVariable=useFeatureVariable;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useFeatureVariable(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(a){var c=a.visitorCode,d=a.featureKey,e=a.variableKey;return b.getFeatureFlagVariable({visitorCode:c,featureKey:d,variableKey:e})},[b]);return{getFeatureFlagVariable:c}}
2
- //# sourceMappingURL=useFeatureVariable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFeatureVariable.js","names":["useFeatureVariable","a","useKameleoon","client","getFeatureFlagVariable","useCallback","visitorCode","featureKey","variableKey"],"sources":["../src/useFeatureVariable.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport {\n FeatureFlagVariableType,\n GetFeatureFlagVariableParamsType,\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 {FeatureFlagVariableType} a variable object containing `type` and `value` fields. You can check the `type` field against `VariableType` enum. For example, if the `type` is `VariableType.BOOLEAN` then `value` will be a `boolean` type.\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 the `kameleoonClient` completed it's `initialize` call.\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `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 ) => FeatureFlagVariableType;\n}\n\n/**\n * A React Hook that returns `getFeatureFlagVariable` function which retrieves a feature variable.\n *\n * @returns {IFeatureVariableHookResult} 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): FeatureFlagVariableType => {\n return client.getFeatureFlagVariable({\n visitorCode,\n featureKey,\n variableKey,\n });\n },\n [client],\n );\n\n return {\n getFeatureFlagVariable,\n };\n}\n"],"mappings":"uLAkCO,QAAS,CAAAA,kBAAkBA,CAAA,CAA+B,KAAAC,CAAA,CAC5C,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAsB,CAAG,GAAAC,kBAAW,EACxC,SAAAJ,CAAA,CAIiE,IAH/D,CAAAK,CAAW,CAAAL,CAAA,CAAXK,WAAW,CACXC,CAAU,CAAAN,CAAA,CAAVM,UAAU,CACVC,CAAW,CAAAP,CAAA,CAAXO,WAAW,CAEX,MAAO,CAAAL,CAAM,CAACC,sBAAsB,CAAC,CACnCE,WAAW,CAAXA,CAAW,CACXC,UAAU,CAAVA,CAAU,CACVC,WAAW,CAAXA,CACF,CAAC,CACH,CAAC,CACD,CAACL,CAAM,CAAC,CACT,CAED,MAAO,CACLC,sBAAsB,CAAtBA,CACF,CACF"}
@@ -1,25 +0,0 @@
1
- import { FeatureVariableResultType } from '@kameleoon/javascript-sdk-core';
2
- export interface IFeatureVariablesHookResult {
3
- /**
4
- * Returns a list of variables 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.
5
- *
6
- * @param {string} visitorCode - a unique visitor identifier, shouldn't exceed 255 characters.
7
- * @param {string} featureKey - a unique key for feature flag.
8
- * @return {FeatureVariableResultType[]} a list of variable objects containing `key`, `type` and `value` fields. You can check the `type` field against `VariableType` enum. For example, if the `type` is `VariableType.BOOLEAN` then `value` will be a `boolean` type.
9
- * @throws `KameleoonError` with one of the following `type` s:
10
- * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
11
- * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
12
- * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call
13
- * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`
14
- * - `KameleoonException.FeatureFlagVariationNotFound` - No feature variation was found for provided `visitorCode` and `variationKey`
15
- * - `KameleoonException.JSONParse` - Couldn't pass JSON value
16
- * - `KameleoonException.NumberParse` - Couldn't pass Number value
17
- */
18
- getFeatureFlagVariables: (visitorCode: string, featureKey: string) => FeatureVariableResultType[];
19
- }
20
- /**
21
- * A React Hook that returns `getFeatureFlagVariables` function which retrieves a list of feature variables.
22
- *
23
- * @returns {IFeatureVariablesHookResult} an object containing the `getFeatureFlagVariables` function.
24
- */
25
- export declare function useFeatureVariables(): IFeatureVariablesHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFeatureVariables=useFeatureVariables;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useFeatureVariables(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(a,c){return b.getFeatureFlagVariables(a,c)},[b]);return{getFeatureFlagVariables:c}}
2
- //# sourceMappingURL=useFeatureVariables.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFeatureVariables.js","names":["useFeatureVariables","a","useKameleoon","client","getFeatureFlagVariables","useCallback","visitorCode","featureKey"],"sources":["../src/useFeatureVariables.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { FeatureVariableResultType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IFeatureVariablesHookResult {\n /**\n * Returns a list of variables 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 - a unique visitor identifier, shouldn't exceed 255 characters.\n * @param {string} featureKey - a unique key for feature flag.\n * @return {FeatureVariableResultType[]} a list of variable objects containing `key`, `type` and `value` fields. You can check the `type` field against `VariableType` enum. For example, if the `type` is `VariableType.BOOLEAN` then `value` will be a `boolean` type.\n * @throws `KameleoonError` with one of the following `type` s:\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagVariationNotFound` - No feature variation was found for provided `visitorCode` and `variationKey`\n * - `KameleoonException.JSONParse` - Couldn't pass JSON value\n * - `KameleoonException.NumberParse` - Couldn't pass Number value\n */\n getFeatureFlagVariables: (\n visitorCode: string,\n featureKey: string,\n ) => FeatureVariableResultType[];\n}\n\n/**\n * A React Hook that returns `getFeatureFlagVariables` function which retrieves a list of feature variables.\n *\n * @returns {IFeatureVariablesHookResult} an object containing the `getFeatureFlagVariables` function.\n */\nexport function useFeatureVariables(): IFeatureVariablesHookResult {\n const { client } = useKameleoon();\n\n const getFeatureFlagVariables = useCallback(\n (visitorCode, featureKey): FeatureVariableResultType[] => {\n return client.getFeatureFlagVariables(visitorCode, featureKey);\n },\n [client],\n );\n\n return {\n getFeatureFlagVariables,\n };\n}\n"],"mappings":"yLA+BO,QAAS,CAAAA,mBAAmBA,CAAA,CAAgC,KAAAC,CAAA,CAC9C,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAuB,CAAG,GAAAC,kBAAW,EACzC,SAACC,CAAW,CAAEC,CAAU,CAAkC,CACxD,MAAO,CAAAJ,CAAM,CAACC,uBAAuB,CAACE,CAAW,CAAEC,CAAU,CAC/D,CAAC,CACD,CAACJ,CAAM,CAAC,CACT,CAED,MAAO,CACLC,uBAAuB,CAAvBA,CACF,CACF"}
@@ -1,22 +0,0 @@
1
- export interface IFlushHookResult {
2
- /**
3
- * Takes visitor associated kameleoon data and sends the data tracking request with collected data sent data is removed from `KameleoonClient` instance but not from the storage for correct targeting checks.
4
- * If no visitor is passed, then data for all visitors is sent and removed from `KameleoonClient` instance. Moreover, regardless of visitor code input
5
- * execution starts with sending all previously failed tracking requests which were stored locally during the offline mode and then proceeds further.
6
- *
7
- * @param {string | undefined} visitorCode - unique visitor identification string, can't exceed 255 characters length.
8
- * @param {boolean | undefined} isUniqueIdentifier - an optional parameter for specifying if the visitorCode is a unique identifier, default value is `false`
9
- * @throws `KameleoonError` with one of the following `type` s:
10
- *
11
- * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
12
- * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
13
- * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
14
- */
15
- flush: (visitorCode?: string, isUniqueIdentifier?: boolean) => void;
16
- }
17
- /**
18
- * A React Hook that returns `flush` function
19
- *
20
- * @returns {IFlushHookResult} an object containing the `flush` function.
21
- */
22
- export declare function useFlush(): IFlushHookResult;
package/dist/useFlush.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFlush=useFlush;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useFlush(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(a,c){b.flush(a,c)},[b]);return{flush:c}}
2
- //# sourceMappingURL=useFlush.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFlush.js","names":["useFlush","a","useKameleoon","client","flush","useCallback","visitorCode","isUniqueIdentifier"],"sources":["../src/useFlush.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IFlushHookResult {\n /**\n * Takes visitor associated kameleoon data and sends the data tracking request with collected data sent data is removed from `KameleoonClient` instance but not from the storage for correct targeting checks.\n * If no visitor is passed, then data for all visitors is sent and removed from `KameleoonClient` instance. Moreover, regardless of visitor code input\n * execution starts with sending all previously failed tracking requests which were stored locally during the offline mode and then proceeds further.\n *\n * @param {string | undefined} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @param {boolean | undefined} isUniqueIdentifier - an optional parameter for specifying if the visitorCode is a unique identifier, default value is `false`\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 the `kameleoonClient` completed it's `initialize` call.\n */\n flush: (visitorCode?: string, isUniqueIdentifier?: boolean) => void;\n}\n\n/**\n * A React Hook that returns `flush` function\n *\n * @returns {IFlushHookResult} an object containing the `flush` function.\n */\nexport function useFlush(): IFlushHookResult {\n const { client } = useKameleoon();\n\n const flush = useCallback(\n (visitorCode?: string, isUniqueIdentifier?: boolean): void => {\n client.flush(visitorCode, isUniqueIdentifier);\n },\n [client],\n );\n\n return {\n flush,\n };\n}\n"],"mappings":"mKAyBO,QAAS,CAAAA,QAAQA,CAAA,CAAqB,KAAAC,CAAA,CACxB,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAK,CAAG,GAAAC,kBAAW,EACvB,SAACC,CAAoB,CAAEC,CAA4B,CAAW,CAC5DJ,CAAM,CAACC,KAAK,CAACE,CAAW,CAAEC,CAAkB,CAC9C,CAAC,CACD,CAACJ,CAAM,CAAC,CACT,CAED,MAAO,CACLC,KAAK,CAALA,CACF,CACF"}
@@ -1,16 +0,0 @@
1
- export interface INativeVisitorCodeHookResult {
2
- /**
3
- * Obtains visitor code from the storage, if no visitor code exists returns a new random visitor code (or the specified default value).
4
- *
5
- * @param {string | undefined} defaultVisitorCode - visitor code to be used instead of randomly generated visitor code in case there is no visitor code saved in storage.
6
- * @returns {string} result visitor code.
7
- */
8
- getNativeVisitorCode: (defaultVisitorCode?: string) => string;
9
- }
10
- /**
11
- * @deprecated This hook is deprecated and will be removed in a future update. For handling legal consent, please use the `useReactNativeVisitorCode` hook instead. Note that legal consent functionality is exclusively available through `useReactNativeVisitorCode` and not via `useNativeVisitorCode`.
12
- *
13
- * A React Hook that returns `getNativeVisitorCode function which obtains the Kameleoon visitorCode.
14
- * @returns {INativeVisitorCodeHookResult} an object containing the `getNativeVisitorCode` function.
15
- */
16
- export declare function useNativeVisitorCode(): INativeVisitorCodeHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useNativeVisitorCode=useNativeVisitorCode;var _react=require("react"),_nativeUtils=require("./kameleoonUtils/nativeUtils");function useNativeVisitorCode(){var a=(0,_react.useCallback)(function(a){return _nativeUtils.NativeUtils.getVisitorCode(a)},[]);return{getNativeVisitorCode:a}}
2
- //# sourceMappingURL=useNativeVisitorCode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNativeVisitorCode.js","names":["useNativeVisitorCode","getNativeVisitorCode","useCallback","defaultVisitorCode","NativeUtils","getVisitorCode"],"sources":["../src/useNativeVisitorCode.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { NativeUtils } from './kameleoonUtils/nativeUtils';\n\nexport interface INativeVisitorCodeHookResult {\n /**\n * Obtains visitor code from the storage, if no visitor code exists returns a new random visitor code (or the specified default value).\n *\n * @param {string | undefined} defaultVisitorCode - visitor code to be used instead of randomly generated visitor code in case there is no visitor code saved in storage.\n * @returns {string} result visitor code.\n */\n getNativeVisitorCode: (defaultVisitorCode?: string) => string;\n}\n\n/**\n * @deprecated This hook is deprecated and will be removed in a future update. For handling legal consent, please use the `useReactNativeVisitorCode` hook instead. Note that legal consent functionality is exclusively available through `useReactNativeVisitorCode` and not via `useNativeVisitorCode`.\n *\n * A React Hook that returns `getNativeVisitorCode function which obtains the Kameleoon visitorCode.\n * @returns {INativeVisitorCodeHookResult} an object containing the `getNativeVisitorCode` function.\n */\nexport function useNativeVisitorCode(): INativeVisitorCodeHookResult {\n const getNativeVisitorCode = useCallback(\n (defaultVisitorCode?: string): string => {\n return NativeUtils.getVisitorCode(defaultVisitorCode);\n },\n [],\n );\n\n return {\n getNativeVisitorCode,\n };\n}\n"],"mappings":"uMAmBO,QAAS,CAAAA,oBAAoBA,CAAA,CAAiC,CACnE,GAAM,CAAAC,CAAoB,CAAG,GAAAC,kBAAW,EACtC,SAACC,CAA2B,CAAa,CACvC,MAAO,CAAAC,wBAAW,CAACC,cAAc,CAACF,CAAkB,CACtD,CAAC,CACD,EAAE,CACH,CAED,MAAO,CACLF,oBAAoB,CAApBA,CACF,CACF"}
@@ -1,19 +0,0 @@
1
- export interface IReactNativeVisitorCodeHookResult {
2
- /**
3
- * Obtains visitor code from the storage, if no visitor code exists returns a new random visitor code (or the specified default value).
4
- *
5
- * @param {string | undefined} defaultVisitorCode - visitor code to be used instead of randomly generated visitor code in case there is no visitor code saved in storage.
6
- * @returns {string} result visitor code.
7
- * @throws `KameleoonError` with one of the following `type` s:
8
- *
9
- * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
10
- * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
11
- */
12
- getReactNativeVisitorCode: (defaultVisitorCode?: string) => string;
13
- }
14
- /**
15
- * A React Hook that returns `getReactNativeVisitorCode function which obtains the Kameleoon visitorCode.
16
- *
17
- * @returns {IReactNativeVisitorCodeHookResult} an object containing the `getReactNativeVisitorCode` function.
18
- */
19
- export declare function useReactNativeVisitorCode(): IReactNativeVisitorCodeHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useReactNativeVisitorCode=useReactNativeVisitorCode;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useReactNativeVisitorCode(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.visitorCodeManager,c=(0,_react.useCallback)(function(a){return b.obtainVisitorCode(a)},[]);return{getReactNativeVisitorCode:c}}
2
- //# sourceMappingURL=useReactNativeVisitorCode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useReactNativeVisitorCode.js","names":["useReactNativeVisitorCode","a","useKameleoon","visitorCodeManager","getReactNativeVisitorCode","useCallback","defaultVisitorCode","obtainVisitorCode"],"sources":["../src/useReactNativeVisitorCode.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IReactNativeVisitorCodeHookResult {\n /**\n * Obtains visitor code from the storage, if no visitor code exists returns a new random visitor code (or the specified default value).\n *\n * @param {string | undefined} defaultVisitorCode - visitor code to be used instead of randomly generated visitor code in case there is no visitor code saved in storage.\n * @returns {string} result visitor code.\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 */\n getReactNativeVisitorCode: (defaultVisitorCode?: string) => string;\n}\n\n/**\n * A React Hook that returns `getReactNativeVisitorCode function which obtains the Kameleoon visitorCode.\n *\n * @returns {IReactNativeVisitorCodeHookResult} an object containing the `getReactNativeVisitorCode` function.\n */\nexport function useReactNativeVisitorCode(): IReactNativeVisitorCodeHookResult {\n const { visitorCodeManager } = useKameleoon();\n\n const getReactNativeVisitorCode = useCallback(\n (defaultVisitorCode?: string): string => {\n return visitorCodeManager.obtainVisitorCode(defaultVisitorCode);\n },\n [],\n );\n\n return {\n getReactNativeVisitorCode,\n };\n}\n"],"mappings":"qMAsBO,QAAS,CAAAA,yBAAyBA,CAAA,CAAsC,KAAAC,CAAA,CAC9C,GAAAC,2BAAY,GAAE,CAArCC,CAAkB,CAAAF,CAAA,CAAlBE,kBAAkB,CAEpBC,CAAyB,CAAG,GAAAC,kBAAW,EAC3C,SAACC,CAA2B,CAAa,CACvC,MAAO,CAAAH,CAAkB,CAACI,iBAAiB,CAACD,CAAkB,CAChE,CAAC,CACD,EAAE,CACH,CAED,MAAO,CACLF,yBAAyB,CAAzBA,CACF,CACF"}
@@ -1,19 +0,0 @@
1
- export interface IReactVisitorCodeHookResult {
2
- /**
3
- * Obtains visitor code from browser cookie, if no cookie exists returns new random visitor code (or the specified default value).
4
- *
5
- * @param {string | undefined} defaultVisitorCode - visitor code to be used instead of randomly generated visitor code in case there is no visitor code saved in browser cookie.
6
- * @returns {string} result visitor code.
7
- * @throws `KameleoonError` with one of the following `type` s:
8
- *
9
- * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
10
- * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
11
- */
12
- getReactVisitorCode: (defaultVisitorCode?: string) => string;
13
- }
14
- /**
15
- * A React Hook that returns `getReactVisitorCode` function which obtains the Kameleoon visitorCode.
16
- *
17
- * @returns {IReactVisitorCodeHookResult} an object containing the `getReactVisitorCode` function.
18
- */
19
- export declare function useReactVisitorCode(): IReactVisitorCodeHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useReactVisitorCode=useReactVisitorCode;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useReactVisitorCode(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.visitorCodeManager,c=(0,_react.useCallback)(function(a){return b.obtainVisitorCode(a)},[]);return{getReactVisitorCode:c}}
2
- //# sourceMappingURL=useReactVisitorCode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useReactVisitorCode.js","names":["useReactVisitorCode","a","useKameleoon","visitorCodeManager","getReactVisitorCode","useCallback","defaultVisitorCode","obtainVisitorCode"],"sources":["../src/useReactVisitorCode.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IReactVisitorCodeHookResult {\n /**\n * Obtains visitor code from browser cookie, if no cookie exists returns new random visitor code (or the specified default value).\n *\n * @param {string | undefined} defaultVisitorCode - visitor code to be used instead of randomly generated visitor code in case there is no visitor code saved in browser cookie.\n * @returns {string} result visitor code.\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 */\n getReactVisitorCode: (defaultVisitorCode?: string) => string;\n}\n\n/**\n * A React Hook that returns `getReactVisitorCode` function which obtains the Kameleoon visitorCode.\n *\n * @returns {IReactVisitorCodeHookResult} an object containing the `getReactVisitorCode` function.\n */\nexport function useReactVisitorCode(): IReactVisitorCodeHookResult {\n const { visitorCodeManager } = useKameleoon();\n\n const getReactVisitorCode = useCallback(\n (defaultVisitorCode?: string): string => {\n return visitorCodeManager.obtainVisitorCode(defaultVisitorCode);\n },\n [],\n );\n\n return {\n getReactVisitorCode,\n };\n}\n"],"mappings":"yLAsBO,QAAS,CAAAA,mBAAmBA,CAAA,CAAgC,KAAAC,CAAA,CAClC,GAAAC,2BAAY,GAAE,CAArCC,CAAkB,CAAAF,CAAA,CAAlBE,kBAAkB,CAEpBC,CAAmB,CAAG,GAAAC,kBAAW,EACrC,SAACC,CAA2B,CAAa,CACvC,MAAO,CAAAH,CAAkB,CAACI,iBAAiB,CAACD,CAAkB,CAChE,CAAC,CACD,EAAE,CACH,CAED,MAAO,CACLF,mBAAmB,CAAnBA,CACF,CACF"}
@@ -1,19 +0,0 @@
1
- import { JSONType } from '@kameleoon/javascript-sdk-core';
2
- export interface IRemoteDataHookResult {
3
- /**
4
- * Returns a data which is stored for specified siteCode on a remote Kameleoon server.
5
- *
6
- * @param {string} key - unique key that the data you try to get is associated with.
7
- * @returns {Promise<JSONType>} promise with retrieving data for specific key.
8
- * @throws `KameleoonError` with one of the following `type` s:
9
- *
10
- * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server.
11
- */
12
- getRemoteData: (key: string) => Promise<JSONType>;
13
- }
14
- /**
15
- * A React Hook that returns asynchronous getRemoteData function which retrieves data from Kameleoon server.
16
- *
17
- * @returns {IRemoteDataHookResult} an object containing the `getRemoteData` function.
18
- */
19
- export declare function useRemoteData(): IRemoteDataHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.useRemoteData=useRemoteData;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function _regeneratorRuntime(){"use strict";function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"==e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator.return&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),x},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),l(b),x},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function useRemoteData(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(){var a=_asyncToGenerator(_regeneratorRuntime().mark(function c(a){return _regeneratorRuntime().wrap(function d(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,b.getRemoteData(a);case 2:return c.abrupt("return",c.sent);case 3:case"end":return c.stop();}},c)}));return function(b){return a.apply(this,arguments)}}(),[b]);return{getRemoteData:c}}
2
- //# sourceMappingURL=useRemoteData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useRemoteData.js","names":["useRemoteData","a","useKameleoon","client","getRemoteData","useCallback","_asyncToGenerator","_regeneratorRuntime","mark","c","key","wrap","d","prev","next","abrupt","sent","stop","b","apply","arguments"],"sources":["../src/useRemoteData.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { JSONType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IRemoteDataHookResult {\n /**\n * Returns a data which is stored for specified siteCode on a remote Kameleoon server.\n *\n * @param {string} key - unique key that the data you try to get is associated with.\n * @returns {Promise<JSONType>} promise with retrieving data for specific key.\n * @throws `KameleoonError` with one of the following `type` s:\n * \n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server.\n */\n getRemoteData: (key: string) => Promise<JSONType>;\n}\n\n/**\n * A React Hook that returns asynchronous getRemoteData function which retrieves data from Kameleoon server.\n *\n * @returns {IRemoteDataHookResult} an object containing the `getRemoteData` function.\n */\nexport function useRemoteData(): IRemoteDataHookResult {\n const { client } = useKameleoon();\n\n const getRemoteData = useCallback(\n async (key: string): Promise<JSONType> => {\n return await client.getRemoteData(key);\n },\n [client],\n );\n\n return {\n getRemoteData,\n };\n}\n"],"mappings":"s0OAsBO,QAAS,CAAAA,aAAaA,CAAA,CAA0B,KAAAC,CAAA,CAClC,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAa,CAAG,GAAAC,kBAAW,iBAAAJ,CAAA,CAAAK,iBAAA,CAAAC,mBAAA,GAAAC,IAAA,CAC/B,SAAAC,EAAOC,CAAW,SAAAH,mBAAA,GAAAI,IAAA,UAAAC,EAAAH,CAAA,iBAAAA,CAAA,CAAAI,IAAA,CAAAJ,CAAA,CAAAK,IAAA,gBAAAL,CAAA,CAAAK,IAAA,GACHX,CAAM,CAACC,aAAa,CAACM,CAAG,CAAC,eAAAD,CAAA,CAAAM,MAAA,UAAAN,CAAA,CAAAO,IAAA,0BAAAP,CAAA,CAAAQ,IAAA,MAAAR,CAAA,EACvC,mBAAAS,CAAA,SAAAjB,CAAA,CAAAkB,KAAA,MAAAC,SAAA,MACD,CAACjB,CAAM,CAAC,CACT,CAED,MAAO,CACLC,aAAa,CAAbA,CACF,CACF"}
@@ -1,23 +0,0 @@
1
- import { KameleoonDataType, RemoteVisitorDataParamsType } from '@kameleoon/javascript-sdk-core';
2
- export interface IRemoteVisitorDataHookResult {
3
- /**
4
- * An asynchronous method for retrieving custom data for the latest visit of `visitorCode` from Kameleoon Data API and optionally adding it to the storage so that other methods could decide whether the current visitor is targeted or not.
5
- *
6
- * @param {RemoteVisitorDataParamsType} remoteVisitorDataParameters - `visitorCode`, `shouldAddData` and `filters` parameters
7
- * @returns {KameleoonDataType[]} promise resolved to an array of `KameleoonData` instances
8
- * @throws `KameleoonError` with one of the following `type` s:
9
- *
10
- * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
11
- * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
12
- * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server
13
- * - `KameleoonException.VisitAmount` - Visit amount must be a number between 1 and 25
14
- * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call
15
- */
16
- getRemoteVisitorData: ({ visitorCode, shouldAddData, filters, }: RemoteVisitorDataParamsType) => Promise<KameleoonDataType[]>;
17
- }
18
- /**
19
- * A React Hook that returns asynchronous getRemoteVisitorData function which retrieves data from Kameleoon server and optionally adds it to storage.
20
- *
21
- * @returns {IRemoteVisitorDataHookResult} an object containing the `getRemoteVisitorData` function.
22
- */
23
- export declare function useRemoteVisitorData(): IRemoteVisitorDataHookResult;
@@ -1,2 +0,0 @@
1
- "use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.useRemoteVisitorData=useRemoteVisitorData;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function _regeneratorRuntime(){"use strict";function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"==e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator.return&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),x},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),l(b),x},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function useRemoteVisitorData(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(){var a=_asyncToGenerator(_regeneratorRuntime().mark(function c(a){return _regeneratorRuntime().wrap(function d(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,b.getRemoteVisitorData(a);case 2:return c.abrupt("return",c.sent);case 3:case"end":return c.stop();}},c)}));return function(b){return a.apply(this,arguments)}}(),[b]);return{getRemoteVisitorData:c}}
2
- //# sourceMappingURL=useRemoteVisitorData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useRemoteVisitorData.js","names":["useRemoteVisitorData","a","useKameleoon","client","getRemoteVisitorData","useCallback","_asyncToGenerator","_regeneratorRuntime","mark","c","params","wrap","d","prev","next","abrupt","sent","stop","b","apply","arguments"],"sources":["../src/useRemoteVisitorData.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\nimport {\n KameleoonDataType,\n RemoteVisitorDataParamsType,\n} from '@kameleoon/javascript-sdk-core';\n\nexport interface IRemoteVisitorDataHookResult {\n /**\n * An asynchronous method for retrieving custom data for the latest visit of `visitorCode` from Kameleoon Data API and optionally adding it to the storage so that other methods could decide whether the current visitor is targeted or not.\n *\n * @param {RemoteVisitorDataParamsType} remoteVisitorDataParameters - `visitorCode`, `shouldAddData` and `filters` parameters\n * @returns {KameleoonDataType[]} promise resolved to an array of `KameleoonData` instances\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.RemoteData` - Couldn't retrieve data from Kameleoon server\n * - `KameleoonException.VisitAmount` - Visit amount must be a number between 1 and 25\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n getRemoteVisitorData: ({\n visitorCode,\n shouldAddData,\n filters,\n }: RemoteVisitorDataParamsType) => Promise<KameleoonDataType[]>;\n}\n\n/**\n * A React Hook that returns asynchronous getRemoteVisitorData function which retrieves data from Kameleoon server and optionally adds it to storage.\n *\n * @returns {IRemoteVisitorDataHookResult} an object containing the `getRemoteVisitorData` function.\n */\nexport function useRemoteVisitorData(): IRemoteVisitorDataHookResult {\n const { client } = useKameleoon();\n\n const getRemoteVisitorData = useCallback(\n async (\n params: RemoteVisitorDataParamsType,\n ): Promise<KameleoonDataType[]> => {\n return await client.getRemoteVisitorData(params);\n },\n [client],\n );\n\n return {\n getRemoteVisitorData,\n };\n}\n"],"mappings":"o1OAiCO,QAAS,CAAAA,oBAAoBA,CAAA,CAAiC,KAAAC,CAAA,CAChD,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAoB,CAAG,GAAAC,kBAAW,iBAAAJ,CAAA,CAAAK,iBAAA,CAAAC,mBAAA,GAAAC,IAAA,CACtC,SAAAC,EACEC,CAAmC,SAAAH,mBAAA,GAAAI,IAAA,UAAAC,EAAAH,CAAA,iBAAAA,CAAA,CAAAI,IAAA,CAAAJ,CAAA,CAAAK,IAAA,gBAAAL,CAAA,CAAAK,IAAA,GAEtBX,CAAM,CAACC,oBAAoB,CAACM,CAAM,CAAC,eAAAD,CAAA,CAAAM,MAAA,UAAAN,CAAA,CAAAO,IAAA,0BAAAP,CAAA,CAAAQ,IAAA,MAAAR,CAAA,EACjD,mBAAAS,CAAA,SAAAjB,CAAA,CAAAkB,KAAA,MAAAC,SAAA,MACD,CAACjB,CAAM,CAAC,CACT,CAED,MAAO,CACLC,oBAAoB,CAApBA,CACF,CACF"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useSetLegalConsent=useSetLegalConsent;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useSetLegalConsent(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=a.visitorCodeManager,d=(0,_react.useCallback)(function(a,d){b.setUserConsent({visitorCode:a,consent:d,setData:c.setData.bind(c)})},[b]);return{setLegalConsent:d}}
2
- //# sourceMappingURL=useSetLegalConsent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSetLegalConsent.js","names":["useSetLegalConsent","a","useKameleoon","client","visitorCodeManager","setLegalConsent","useCallback","visitorCode","consent","setUserConsent","setData","bind"],"sources":["../src/useSetLegalConsent.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface ISetLegalConsentHookResult {\n /**\n * Sets or updates the legal consent status for a visitor identified by their unique visitor code, affecting values in the response cookies based on the consent status.\n *\n * @param {string} visitorCode - unique visitor identifier, shouldn't exceed 255 characters.\n * @param {boolean} consent - a value representing the legal consent status. - 'true' indicates the\n * visitor has given legal consent. - 'false' indicates the visitor has withdrawn or not\n * provided legal consent.\n * @returns {void}\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 */\n setLegalConsent: (visitorCode: string, consent: boolean) => void;\n}\n\n/**\n * A React Hook that returns setLegalConsent function which sets or updates the legal consent status for a visitor identified by their unique visitor code, affecting values in the response cookies based on the consent status.\n *\n * @returns {ISetLegalConsentHookResult} an object containing the `setLegalConsent` function.\n */\nexport function useSetLegalConsent(): ISetLegalConsentHookResult {\n const { client, visitorCodeManager } = useKameleoon();\n\n const setLegalConsent = useCallback(\n (visitorCode: string, consent: boolean): void => {\n client.setUserConsent({\n visitorCode,\n consent,\n setData: visitorCodeManager.setData.bind(visitorCodeManager),\n });\n },\n [client],\n );\n\n return {\n setLegalConsent,\n };\n}\n"],"mappings":"uLAyBO,QAAS,CAAAA,kBAAkBA,CAAA,CAA+B,KAAAC,CAAA,CACxB,GAAAC,2BAAY,GAAE,CAA7CC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAAEC,CAAkB,CAAAH,CAAA,CAAlBG,kBAAkB,CAE5BC,CAAe,CAAG,GAAAC,kBAAW,EACjC,SAACC,CAAmB,CAAEC,CAAgB,CAAW,CAC/CL,CAAM,CAACM,cAAc,CAAC,CACpBF,WAAW,CAAXA,CAAW,CACXC,OAAO,CAAPA,CAAO,CACPE,OAAO,CAAEN,CAAkB,CAACM,OAAO,CAACC,IAAI,CAACP,CAAkB,CAC7D,CAAC,CACH,CAAC,CACD,CAACD,CAAM,CAAC,CACT,CAED,MAAO,CACLE,eAAe,CAAfA,CACF,CACF"}