@kameleoon/react-sdk 8.5.0 → 8.5.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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createClient=createClient;var _javascriptSdkCore=require("@kameleoon/javascript-sdk-core"),_eventSource=require("./eventSource"),_visitorCodeManager=require("./visitorCodeManager"),_storage=require("./storage"),_requester=require("./requester");function createClient(a){var b=a.siteCode,c=a.configuration,d="undefined"!=typeof window&&!!window.document,e=d?new _storage.LocalStorageConstructor:new _storage.NativeStorageConstructor,f=d?new _eventSource.BrowserEventSourceConstructor:new _eventSource.NativeEventSourceConstructor,g=new _requester.RequestDispatcher((null===c||void 0===c?void 0:c.requestTimeout)||_javascriptSdkCore.DEFAULT_REQUEST_TIMEOUT),h=d?new _visitorCodeManager.ReactVisitorCodeManagerConstructor(null===c||void 0===c?void 0:c.domain):new _visitorCodeManager.ReactNativeVisitorCodeManagerConstructor,i=new _javascriptSdkCore.KameleoonCore({siteCode:b,configuration:c,internalConfiguration:{externalStorage:e,externalEventSource:f,externalVisitorCodeManager:h,externalRequestDispatcher:g,externalPackageInfo:{type:_javascriptSdkCore.SdkLanguageType.REACT,version:"8.5.0"}}});return{client:i,visitorCodeManager:h}}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createClient=createClient;var _javascriptSdkCore=require("@kameleoon/javascript-sdk-core"),_eventSource=require("./eventSource"),_visitorCodeManager=require("./visitorCodeManager"),_storage=require("./storage"),_requester=require("./requester");function createClient(a){var b=a.siteCode,c=a.configuration,d="undefined"!=typeof window&&!!window.document,e=d?new _storage.LocalStorageConstructor:new _storage.NativeStorageConstructor,f=d?new _eventSource.BrowserEventSourceConstructor:new _eventSource.NativeEventSourceConstructor,g=new _requester.RequestDispatcher((null===c||void 0===c?void 0:c.requestTimeout)||_javascriptSdkCore.DEFAULT_REQUEST_TIMEOUT),h=d?new _visitorCodeManager.ReactVisitorCodeManagerConstructor(null===c||void 0===c?void 0:c.domain):new _visitorCodeManager.ReactNativeVisitorCodeManagerConstructor,i=new _javascriptSdkCore.KameleoonCore({siteCode:b,configuration:c,internalConfiguration:{externalStorage:e,externalEventSource:f,externalVisitorCodeManager:h,externalRequestDispatcher:g,externalPackageInfo:{type:_javascriptSdkCore.SdkLanguageType.REACT,version:"8.5.1"}}});return{client:i,visitorCodeManager:h}}
2
2
  //# sourceMappingURL=kameleoonClient.js.map
@@ -1,2 +1,2 @@
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})},[b]);return{setLegalConsent:d}}
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
2
  //# sourceMappingURL=useSetLegalConsent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSetLegalConsent.js","names":["useSetLegalConsent","a","useKameleoon","client","visitorCodeManager","setLegalConsent","useCallback","visitorCode","consent","setUserConsent","setData"],"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,\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,OAC9B,CAAC,CACH,CAAC,CACD,CAACP,CAAM,CAAC,CACT,CAED,MAAO,CACLE,eAAe,CAAfA,CACF,CACF"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kameleoon/react-sdk",
3
- "version": "8.5.0",
3
+ "version": "8.5.1",
4
4
  "description": "Kameleoon React SDK",
5
5
  "files": [
6
6
  "dist"