@kameleoon/react-sdk 9.5.4 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/KameleoonContext.js.map +1 -1
- package/dist/KameleoonProvider.js.map +1 -1
- package/dist/createClient.js +1 -1
- package/dist/createClient.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/useData.d.ts +4 -5
- package/dist/interfaces/useData.js.map +1 -1
- package/dist/interfaces/useFeatureFlag.js.map +1 -1
- package/dist/interfaces/useInitialize.d.ts +5 -16
- package/dist/interfaces/useInitialize.js.map +1 -1
- package/dist/interfaces/useVisitorCode.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/useData.js +1 -1
- package/dist/useData.js.map +1 -1
- package/dist/useFeatureFlag.js.map +1 -1
- package/dist/useInitialize.d.ts +0 -1
- package/dist/useInitialize.js +1 -1
- package/dist/useInitialize.js.map +1 -1
- package/dist/useKameleoon.js.map +1 -1
- package/dist/useVisitorCode.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.0.0 (2024-10-03)
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
- `isUniqueIdentifier` parameter has been removed from methods [`flush`][flush], [`getRemoteVisitorData`][getremotevisitordata] and [`trackConversion`][trackconversion]
|
|
8
|
+
- Method [`initialize`][initialize] no more accepts `useCache` boolean parameter. Using storage cached client configuration on failed configuration request is now default behavior.
|
|
9
|
+
- Previously deprecated method [`onConfigurationUpdate`][onconfigurationupdate] has been removed from SDKs. Use [`onEvent`][onevent] method with `EventType.ConfigurationUpdate` to achieve the same effect.
|
|
10
|
+
- Previously deprecated field [`domain`][domain] of `SDKConfiguration` has been removed from SDKs. Use [`cookieDomain`][domain] field of `SDKConfiguration` instead.
|
|
11
|
+
- Parameter `text` of `KameleoonResponseType` used in custom [`requester`][requester] implementation is now mandatory, for the vast majority of implementations like `fetch`, `axios` or `node-fetch` it won't require any changes.
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- `FeatureVariableType` returned from the methods obtaining feature flag variables can now have two new `VariableType`s - `VariableType.JS` containing a `string` of JavaScript code and `VariableType.CSS` containing a string with CSS code
|
|
16
|
+
- Added new [`UniqueIdentifier`][uniqueidentifier] data to be used instead of removed `isUniqueIdentifier` parameters in some methods
|
|
17
|
+
- Added new [`SDKConfiguration`][sdkconfiguration] parameter `trackingInterval` to set the interval between SDK tracking network requests in _milliseconds_, default value is `1000`, which is also maximum interval, minimum value is `100`
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`getEngineTrackingCode`][getenginetrackingcode] method now correctly sets `triggerExperiment` parameter based on variable types
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @kameleoon/javascript-sdk@4.0.0
|
|
24
|
+
|
|
25
|
+
[uniqueidentifier]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#uniqueidentifier
|
|
26
|
+
[sdkconfiguration]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#arguments
|
|
27
|
+
[flush]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#flush
|
|
28
|
+
[getremotevisitordata]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#getremotevisitordata
|
|
29
|
+
[trackconversion]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#trackconversion
|
|
30
|
+
[getenginetrackingcode]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#getenginetrackingcode
|
|
31
|
+
[onconfigurationupdate]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk/#onconfigurationupdate
|
|
32
|
+
[onevent]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk/#onevent
|
|
33
|
+
[domain]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#configuration-parameters
|
|
34
|
+
[requester]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk/#requester
|
|
35
|
+
[initialize]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#initialize
|
|
36
|
+
|
|
3
37
|
## 9.5.4 (2024-08-30)
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KameleoonContext.js","names":["_react","_interopRequireDefault","require","Object","defineProperty","exports","value","KameleoonContext","a","__esModule","default","React","createContext"],"sources":["../src/KameleoonContext.ts"],"sourcesContent":["import React from 'react';\nimport { KameleoonClient } from '@kameleoon/javascript-sdk';\n\nexport const KameleoonContext = React.createContext<KameleoonClient | null>(\n null,\n);\n"],"mappings":"aAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WAA0BC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,gBAAA,iBAAAN,uBAAAO,CAAA,SAAAA,CAAA,EAAAA,CAAA,CAAAC,UAAA,CAAAD,CAAA,EAAAE,OAAA,CAAAF,CAAA,EAGnB,KAAM,CAAAD,gBAAgB,CAAAF,OAAA,CAAAE,gBAAA,CAAGI,cAAK,CAACC,aAAa,CACjD,IACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"KameleoonContext.js","names":["_react","_interopRequireDefault","require","Object","defineProperty","exports","value","KameleoonContext","a","__esModule","default","React","createContext"],"sources":["../src/KameleoonContext.ts"],"sourcesContent":["import React from 'react';\nimport { KameleoonClient } from '@kameleoon/javascript-sdk';\n\nexport const KameleoonContext = React.createContext<KameleoonClient | null>(\n null,\n);\n"],"mappings":"aAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WAA0BC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,gBAAA,iBAAAN,uBAAAO,CAAA,SAAAA,CAAA,EAAAA,CAAA,CAAAC,UAAA,CAAAD,CAAA,EAAAE,OAAA,CAAAF,CAAA,EAGnB,KAAM,CAAAD,gBAAgB,CAAAF,OAAA,CAAAE,gBAAA,CAAGI,cAAK,CAACC,aAAa,CACjD,IACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KameleoonProvider.js","names":["KameleoonProvider","a","client","children","_react","default","createElement","_KameleoonContext","KameleoonContext","Provider","value","_default","exports","React","memo"],"sources":["../src/KameleoonProvider.tsx"],"sourcesContent":["import React from 'react';\nimport { KameleoonClient } from '@kameleoon/javascript-sdk';\nimport { KameleoonContext } from './KameleoonContext';\n\nexport interface IKameleoonProviderProps {\n /** Child elements of the provider. */\n children: React.ReactNode;\n /** An instance of Kameleoon SDK. */\n client: KameleoonClient;\n}\n\n/**\n * A Provider that wraps the project and provides an access to SDK APIs\n */\nfunction KameleoonProvider({\n client,\n children,\n}: IKameleoonProviderProps): React.JSX.Element {\n return (\n <KameleoonContext.Provider value={client}>\n {children}\n </KameleoonContext.Provider>\n );\n}\n\nexport default React.memo(KameleoonProvider);\n"],"mappings":"uQAcA,QAAS,CAAAA,iBAAiBA,CAAAC,CAAA,CAGqB,IAHpB,CACzBC,MAAM,CAANA,CAAM,CACNC,QAAQ,CAARA,CACuB,CAAC,CAAAF,CAAA,CACxB,MACE,CAAAG,MAAA,CAAAC,OAAA,CAAAC,aAAA,CAACC,iBAAA,CAAAC,gBAAgB,CAACC,QAAQ,EAACC,KAAK,CAAER,CAAO,EACtCC,CACwB,CAE/B,CAAC,IAAAQ,QAAA,CAAAC,OAAA,CAAAP,OAAA,CAEcQ,cAAK,CAACC,IAAI,CAACd,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"KameleoonProvider.js","names":["KameleoonProvider","a","client","children","_react","default","createElement","_KameleoonContext","KameleoonContext","Provider","value","_default","exports","React","memo"],"sources":["../src/KameleoonProvider.tsx"],"sourcesContent":["import React from 'react';\nimport { KameleoonClient } from '@kameleoon/javascript-sdk';\nimport { KameleoonContext } from './KameleoonContext';\n\nexport interface IKameleoonProviderProps {\n /** Child elements of the provider. */\n children: React.ReactNode;\n /** An instance of Kameleoon SDK. */\n client: KameleoonClient;\n}\n\n/**\n * A Provider that wraps the project and provides an access to SDK APIs\n */\nfunction KameleoonProvider({\n client,\n children,\n}: IKameleoonProviderProps): React.JSX.Element {\n return (\n <KameleoonContext.Provider value={client}>\n {children}\n </KameleoonContext.Provider>\n );\n}\n\nexport default React.memo(KameleoonProvider);\n"],"mappings":"uQAcA,QAAS,CAAAA,iBAAiBA,CAAAC,CAAA,CAGqB,IAHpB,CACzBC,MAAM,CAANA,CAAM,CACNC,QAAQ,CAARA,CACuB,CAAC,CAAAF,CAAA,CACxB,MACE,CAAAG,MAAA,CAAAC,OAAA,CAAAC,aAAA,CAACC,iBAAA,CAAAC,gBAAgB,CAACC,QAAQ,EAACC,KAAK,CAAER,CAAO,EACtCC,CACwB,CAE/B,CAAC,IAAAQ,QAAA,CAAAC,OAAA,CAAAP,OAAA,CAEcQ,cAAK,CAACC,IAAI,CAACd,iBAAiB,CAAC","ignoreList":[]}
|
package/dist/createClient.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _javascriptSdk=require("@kameleoon/javascript-sdk");Object.defineProperty(exports,"__esModule",{value:!0}),exports.createClient=createClient;function createClient(a){let{siteCode:b,configuration:c,externals:d}=a;const e=new _javascriptSdk.KameleoonClient({siteCode:b,configuration:c,externals:d,_internals:{packageInfo:{type:_javascriptSdk.SdkLanguageType.REACT,version:"
|
|
1
|
+
"use strict";var _javascriptSdk=require("@kameleoon/javascript-sdk");Object.defineProperty(exports,"__esModule",{value:!0}),exports.createClient=createClient;function createClient(a){let{siteCode:b,configuration:c,externals:d}=a;const e=new _javascriptSdk.KameleoonClient({siteCode:b,configuration:c,externals:d,_internals:{packageInfo:{type:_javascriptSdk.SdkLanguageType.REACT,version:"10.0.0"},prng:null===d||void 0===d?void 0:d.prng}});return e}
|
|
2
2
|
//# sourceMappingURL=createClient.js.map
|
package/dist/createClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.js","names":["_javascriptSdk","require","Object","defineProperty","exports","value","createClient","a","siteCode","configuration","externals","client","KameleoonClient","_internals","packageInfo","type","SdkLanguageType","REACT","version","prng"],"sources":["../src/createClient.ts"],"sourcesContent":["import { KameleoonClient, SdkLanguageType } from '@kameleoon/javascript-sdk';\nimport { SDKParameters } from './types';\n\n/**\n * Creates an instance of KameleoonClient\n * @param parameters {SDKParameters} - parameters of an SDK\n */\nexport function createClient({\n siteCode,\n configuration,\n externals,\n}: SDKParameters): KameleoonClient {\n const client = new KameleoonClient({\n siteCode,\n configuration,\n externals,\n _internals: {\n packageInfo: {\n type: SdkLanguageType.REACT,\n version: process.env.npm_package_version as string,\n },\n prng: externals?.prng,\n },\n });\n\n return client;\n}\n"],"mappings":"aAAA,IAAAA,cAAA,CAAAC,OAAA,8BAA6EC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,YAAA,CAAAA,YAAA,CAOtE,QAAS,CAAAA,YAAYA,CAAAC,CAAA,CAIO,IAJN,CAC3BC,QAAQ,CAARA,CAAQ,CACRC,aAAa,CAAbA,CAAa,CACbC,SAAS,CAATA,CACa,CAAC,CAAAH,CAAA,CACd,KAAM,CAAAI,CAAM,CAAG,GAAI,CAAAC,8BAAe,CAAC,CACjCJ,QAAQ,CAARA,CAAQ,CACRC,aAAa,CAAbA,CAAa,CACbC,SAAS,CAATA,CAAS,CACTG,UAAU,CAAE,CACVC,WAAW,CAAE,CACXC,IAAI,CAAEC,8BAAe,CAACC,KAAK,CAC3BC,OAAO,
|
|
1
|
+
{"version":3,"file":"createClient.js","names":["_javascriptSdk","require","Object","defineProperty","exports","value","createClient","a","siteCode","configuration","externals","client","KameleoonClient","_internals","packageInfo","type","SdkLanguageType","REACT","version","prng"],"sources":["../src/createClient.ts"],"sourcesContent":["import { KameleoonClient, SdkLanguageType } from '@kameleoon/javascript-sdk';\nimport { SDKParameters } from './types';\n\n/**\n * Creates an instance of KameleoonClient\n * @param parameters {SDKParameters} - parameters of an SDK\n */\nexport function createClient({\n siteCode,\n configuration,\n externals,\n}: SDKParameters): KameleoonClient {\n const client = new KameleoonClient({\n siteCode,\n configuration,\n externals,\n _internals: {\n packageInfo: {\n type: SdkLanguageType.REACT,\n version: process.env.npm_package_version as string,\n },\n prng: externals?.prng,\n },\n });\n\n return client;\n}\n"],"mappings":"aAAA,IAAAA,cAAA,CAAAC,OAAA,8BAA6EC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,YAAA,CAAAA,YAAA,CAOtE,QAAS,CAAAA,YAAYA,CAAAC,CAAA,CAIO,IAJN,CAC3BC,QAAQ,CAARA,CAAQ,CACRC,aAAa,CAAbA,CAAa,CACbC,SAAS,CAATA,CACa,CAAC,CAAAH,CAAA,CACd,KAAM,CAAAI,CAAM,CAAG,GAAI,CAAAC,8BAAe,CAAC,CACjCJ,QAAQ,CAARA,CAAQ,CACRC,aAAa,CAAbA,CAAa,CACbC,SAAS,CAATA,CAAS,CACTG,UAAU,CAAE,CACVC,WAAW,CAAE,CACXC,IAAI,CAAEC,8BAAe,CAACC,KAAK,CAC3BC,OAAO,SACT,CAAC,CACDC,IAAI,QAAET,CAAS,WAATA,CAAS,QAATA,CAAS,CAAES,IACnB,CACF,CAAC,CAAC,CAEF,MAAO,CAAAR,CACT","ignoreList":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _exportNames={KameleoonProvider:!0,IKameleoonProviderProps:!0,useData:!0,useInitialize:!0,useFeatureFlag:!0,useVisitorCode:!0,IUseData:!0,IUseInitialize:!0,IUseFeatureFlag:!0,IUseVisitorCode:!0,KameleoonContext:!0,useKameleoon:!0,createClient:!0,SDKParameters:!0,ExternalsType:!0};var _javascriptSdk=require("@kameleoon/javascript-sdk");Object.defineProperty(exports,"__esModule",{value:!0});Object.defineProperty(exports,"ExternalsType",{enumerable:!0,get:function(){return _types.ExternalsType}}),Object.defineProperty(exports,"IKameleoonProviderProps",{enumerable:!0,get:function(){return _KameleoonProvider.IKameleoonProviderProps}}),Object.defineProperty(exports,"IUseData",{enumerable:!0,get:function(){return _useData2.default}}),Object.defineProperty(exports,"IUseFeatureFlag",{enumerable:!0,get:function(){return _useFeatureFlag2.default}}),Object.defineProperty(exports,"IUseInitialize",{enumerable:!0,get:function(){return _useInitialize2.default}}),Object.defineProperty(exports,"IUseVisitorCode",{enumerable:!0,get:function(){return _useVisitorCode2.default}}),Object.defineProperty(exports,"KameleoonContext",{enumerable:!0,get:function(){return _KameleoonContext.KameleoonContext}}),Object.defineProperty(exports,"KameleoonProvider",{enumerable:!0,get:function(){return _KameleoonProvider.default}}),Object.defineProperty(exports,"SDKParameters",{enumerable:!0,get:function(){return _types.SDKParameters}}),Object.defineProperty(exports,"createClient",{enumerable:!0,get:function(){return _createClient.createClient}}),Object.defineProperty(exports,"useData",{enumerable:!0,get:function(){return _useData.useData}}),Object.defineProperty(exports,"useFeatureFlag",{enumerable:!0,get:function(){return _useFeatureFlag.useFeatureFlag}}),Object.defineProperty(exports,"useInitialize",{enumerable:!0,get:function(){return _useInitialize.useInitialize}}),Object.defineProperty(exports,"useKameleoon",{enumerable:!0,get:function(){return _useKameleoon.useKameleoon}}),Object.defineProperty(exports,"useVisitorCode",{enumerable:!0,get:function(){return _useVisitorCode.useVisitorCode}});Object.keys(_javascriptSdk).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||a in exports&&exports[a]===_javascriptSdk[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function(){return _javascriptSdk[a]}})});var _KameleoonProvider=_interopRequireWildcard(require("./KameleoonProvider")),_useData=require("./useData"),_useInitialize=require("./useInitialize"),_useFeatureFlag=require("./useFeatureFlag"),_useVisitorCode=require("./useVisitorCode"),_useData2=_interopRequireDefault(require("./interfaces/useData")),_useInitialize2=_interopRequireDefault(require("./interfaces/useInitialize")),_useFeatureFlag2=_interopRequireDefault(require("./interfaces/useFeatureFlag")),_useVisitorCode2=_interopRequireDefault(require("./interfaces/useVisitorCode")),_KameleoonContext=require("./KameleoonContext"),_useKameleoon=require("./useKameleoon"),_createClient=require("./createClient"),_types=require("./types");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=typeof b&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&
|
|
1
|
+
"use strict";var _exportNames={KameleoonProvider:!0,IKameleoonProviderProps:!0,useData:!0,useInitialize:!0,useFeatureFlag:!0,useVisitorCode:!0,IUseData:!0,IUseInitialize:!0,IUseFeatureFlag:!0,IUseVisitorCode:!0,KameleoonContext:!0,useKameleoon:!0,createClient:!0,SDKParameters:!0,ExternalsType:!0};var _javascriptSdk=require("@kameleoon/javascript-sdk");Object.defineProperty(exports,"__esModule",{value:!0});Object.defineProperty(exports,"ExternalsType",{enumerable:!0,get:function(){return _types.ExternalsType}}),Object.defineProperty(exports,"IKameleoonProviderProps",{enumerable:!0,get:function(){return _KameleoonProvider.IKameleoonProviderProps}}),Object.defineProperty(exports,"IUseData",{enumerable:!0,get:function(){return _useData2.default}}),Object.defineProperty(exports,"IUseFeatureFlag",{enumerable:!0,get:function(){return _useFeatureFlag2.default}}),Object.defineProperty(exports,"IUseInitialize",{enumerable:!0,get:function(){return _useInitialize2.default}}),Object.defineProperty(exports,"IUseVisitorCode",{enumerable:!0,get:function(){return _useVisitorCode2.default}}),Object.defineProperty(exports,"KameleoonContext",{enumerable:!0,get:function(){return _KameleoonContext.KameleoonContext}}),Object.defineProperty(exports,"KameleoonProvider",{enumerable:!0,get:function(){return _KameleoonProvider.default}}),Object.defineProperty(exports,"SDKParameters",{enumerable:!0,get:function(){return _types.SDKParameters}}),Object.defineProperty(exports,"createClient",{enumerable:!0,get:function(){return _createClient.createClient}}),Object.defineProperty(exports,"useData",{enumerable:!0,get:function(){return _useData.useData}}),Object.defineProperty(exports,"useFeatureFlag",{enumerable:!0,get:function(){return _useFeatureFlag.useFeatureFlag}}),Object.defineProperty(exports,"useInitialize",{enumerable:!0,get:function(){return _useInitialize.useInitialize}}),Object.defineProperty(exports,"useKameleoon",{enumerable:!0,get:function(){return _useKameleoon.useKameleoon}}),Object.defineProperty(exports,"useVisitorCode",{enumerable:!0,get:function(){return _useVisitorCode.useVisitorCode}});Object.keys(_javascriptSdk).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||a in exports&&exports[a]===_javascriptSdk[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function(){return _javascriptSdk[a]}})});var _KameleoonProvider=_interopRequireWildcard(require("./KameleoonProvider")),_useData=require("./useData"),_useInitialize=require("./useInitialize"),_useFeatureFlag=require("./useFeatureFlag"),_useVisitorCode=require("./useVisitorCode"),_useData2=_interopRequireDefault(require("./interfaces/useData")),_useInitialize2=_interopRequireDefault(require("./interfaces/useInitialize")),_useFeatureFlag2=_interopRequireDefault(require("./interfaces/useFeatureFlag")),_useVisitorCode2=_interopRequireDefault(require("./interfaces/useVisitorCode")),_KameleoonContext=require("./KameleoonContext"),_useKameleoon=require("./useKameleoon"),_createClient=require("./createClient"),_types=require("./types");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=typeof b&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&{}.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e.default=b,d&&d.set(b,e),e}
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_javascriptSdk","require","Object","defineProperty","exports","value","enumerable","get","_types","ExternalsType","_KameleoonProvider","IKameleoonProviderProps","_useData2","default","_useFeatureFlag2","_useInitialize2","_useVisitorCode2","_KameleoonContext","KameleoonContext","SDKParameters","_createClient","createClient","_useData","useData","_useFeatureFlag","useFeatureFlag","_useInitialize","useInitialize","_useKameleoon","useKameleoon","_useVisitorCode","useVisitorCode","keys","forEach","a","prototype","hasOwnProperty","call","_exportNames","_interopRequireWildcard","_interopRequireDefault","__esModule","_getRequireWildcardCache","WeakMap","b","c","d","has","e","__proto__","f","getOwnPropertyDescriptor","g","set"],"sources":["../src/index.ts"],"sourcesContent":["export * from '@kameleoon/javascript-sdk';\nexport {\n default as KameleoonProvider,\n IKameleoonProviderProps,\n} from './KameleoonProvider';\nexport { useData } from './useData';\nexport { useInitialize } from './useInitialize';\nexport { useFeatureFlag } from './useFeatureFlag';\nexport { useVisitorCode } from './useVisitorCode';\nexport { default as IUseData } from './interfaces/useData';\nexport { default as IUseInitialize } from './interfaces/useInitialize';\nexport { default as IUseFeatureFlag } from './interfaces/useFeatureFlag';\nexport { default as IUseVisitorCode } from './interfaces/useVisitorCode';\nexport { KameleoonContext } from './KameleoonContext';\nexport { useKameleoon } from './useKameleoon';\nexport { createClient } from './createClient';\nexport { SDKParameters, ExternalsType } from './types';\n"],"mappings":"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
|
|
1
|
+
{"version":3,"file":"index.js","names":["_javascriptSdk","require","Object","defineProperty","exports","value","enumerable","get","_types","ExternalsType","_KameleoonProvider","IKameleoonProviderProps","_useData2","default","_useFeatureFlag2","_useInitialize2","_useVisitorCode2","_KameleoonContext","KameleoonContext","SDKParameters","_createClient","createClient","_useData","useData","_useFeatureFlag","useFeatureFlag","_useInitialize","useInitialize","_useKameleoon","useKameleoon","_useVisitorCode","useVisitorCode","keys","forEach","a","prototype","hasOwnProperty","call","_exportNames","_interopRequireWildcard","_interopRequireDefault","__esModule","_getRequireWildcardCache","WeakMap","b","c","d","has","e","__proto__","f","getOwnPropertyDescriptor","g","set"],"sources":["../src/index.ts"],"sourcesContent":["export * from '@kameleoon/javascript-sdk';\nexport {\n default as KameleoonProvider,\n IKameleoonProviderProps,\n} from './KameleoonProvider';\nexport { useData } from './useData';\nexport { useInitialize } from './useInitialize';\nexport { useFeatureFlag } from './useFeatureFlag';\nexport { useVisitorCode } from './useVisitorCode';\nexport { default as IUseData } from './interfaces/useData';\nexport { default as IUseInitialize } from './interfaces/useInitialize';\nexport { default as IUseFeatureFlag } from './interfaces/useFeatureFlag';\nexport { default as IUseVisitorCode } from './interfaces/useVisitorCode';\nexport { KameleoonContext } from './KameleoonContext';\nexport { useKameleoon } from './useKameleoon';\nexport { createClient } from './createClient';\nexport { SDKParameters, ExternalsType } from './types';\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -19,18 +19,17 @@ export default interface IUseData {
|
|
|
19
19
|
* execution starts with sending all previously failed tracking requests which were stored locally during the offline mode and then proceeds further.
|
|
20
20
|
*
|
|
21
21
|
* @param {string | undefined} visitorCode - unique visitor identification string, can't exceed 255 characters length.
|
|
22
|
-
* @param {boolean | undefined} isUniqueIdentifier - an optional parameter for specifying if the visitorCode is a unique identifier, default value is `false`
|
|
23
22
|
* @throws `KameleoonError` with one of the following `type` s:
|
|
24
23
|
*
|
|
25
24
|
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
26
25
|
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
27
26
|
* - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
|
|
28
27
|
*/
|
|
29
|
-
flush: (visitorCode?: string
|
|
28
|
+
flush: (visitorCode?: string) => void;
|
|
30
29
|
/**
|
|
31
30
|
* Creates and adds `Conversion` data to the visitor with specified parameters and executes `flushData`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter.
|
|
32
31
|
*
|
|
33
|
-
* @param {TrackConversionParamsType} params - `visitorCode`, `goalId
|
|
32
|
+
* @param {TrackConversionParamsType} params - `visitorCode`, `goalId` and `revenue` parameters for data tracking.
|
|
34
33
|
* @throws `KameleoonError` with one of the following `type` s:
|
|
35
34
|
*
|
|
36
35
|
* - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.
|
|
@@ -51,7 +50,7 @@ export default interface IUseData {
|
|
|
51
50
|
/**
|
|
52
51
|
* 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.
|
|
53
52
|
*
|
|
54
|
-
* @param {RemoteVisitorDataParamsType} remoteVisitorDataParameters - `visitorCode`, `shouldAddData
|
|
53
|
+
* @param {RemoteVisitorDataParamsType} remoteVisitorDataParameters - `visitorCode`, `shouldAddData` and `filters` parameters
|
|
55
54
|
* @returns {KameleoonDataType[]} promise resolved to an array of `KameleoonData` instances
|
|
56
55
|
* @throws `KameleoonError` with one of the following `type` s:
|
|
57
56
|
*
|
|
@@ -61,7 +60,7 @@ export default interface IUseData {
|
|
|
61
60
|
* - `KameleoonException.VisitAmount` - Visit amount must be a number between 1 and 25
|
|
62
61
|
* - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call
|
|
63
62
|
*/
|
|
64
|
-
getRemoteVisitorData: ({ visitorCode, shouldAddData, filters,
|
|
63
|
+
getRemoteVisitorData: ({ visitorCode, shouldAddData, filters, }: RemoteVisitorDataParamsType) => Promise<KameleoonDataType[]>;
|
|
65
64
|
/**
|
|
66
65
|
* An asynchronous method that returns a `CustomData` instance, containing data associated with a visitor's warehouse audiences
|
|
67
66
|
* which is stored for specified visitorCode on a remote Kameleoon server
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useData.js","names":[],"sources":["../../src/interfaces/useData.ts"],"sourcesContent":["import {\n CustomData,\n GetVisitorWarehouseAudienceParamsType,\n JSONType,\n KameleoonDataType,\n RemoteVisitorDataParamsType,\n TrackConversionParamsType,\n} from '@kameleoon/javascript-sdk';\n\nexport default interface IUseData {\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 * 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 * @
|
|
1
|
+
{"version":3,"file":"useData.js","names":[],"sources":["../../src/interfaces/useData.ts"],"sourcesContent":["import {\n CustomData,\n GetVisitorWarehouseAudienceParamsType,\n JSONType,\n KameleoonDataType,\n RemoteVisitorDataParamsType,\n TrackConversionParamsType,\n} from '@kameleoon/javascript-sdk';\n\nexport default interface IUseData {\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 * 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 * @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) => void;\n /**\n * Creates and adds `Conversion` data to the visitor with specified parameters and executes `flushData`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter.\n *\n * @param {TrackConversionParamsType} params - `visitorCode`, `goalId` and `revenue` parameters for data tracking.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data.\n */\n trackConversion: (params: TrackConversionParamsType) => void;\n /**\n * 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 * 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 * An asynchronous method that returns a `CustomData` instance, containing data associated with a visitor's warehouse audiences\n * which is stored for specified visitorCode on a remote Kameleoon server\n * Retrieved data will be added to storage under the specified `customDataIndex`\n *\n * @param {GetVisitorWarehouseAudienceParamsType} parameters - an object with parameters of a type `GetVisitorWarehouseAudienceParamsType`, see the type for details\n *\n * @returns {Promise<CustomData | null>} `Promise` containing an instance of `CustomData` containing data associated with a visitor's warehouse audiences or `null` if the data was retrieved successfully but nothing was found under the specified `warehouseKey`\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 */\n getVisitorWarehouseAudience: ({\n visitorCode,\n customDataIndex,\n warehouseKey,\n }: GetVisitorWarehouseAudienceParamsType) => Promise<CustomData | null>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFeatureFlag.js","names":[],"sources":["../../src/interfaces/useFeatureFlag.ts"],"sourcesContent":["import {\n FeatureFlagType,\n KameleoonVariationType,\n FeatureFlagVariableType,\n FeatureVariableResultType,\n GetFeatureFlagVariableParamsType,\n} from '@kameleoon/javascript-sdk';\n\nexport default interface IUseFeatureFlag {\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 * Note: This method **sends** tracking data\n * Triggered Events: `EventType.Evaluation`\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 * 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 *\n * Note: This method **sends** tracking data\n * Triggered Events: `EventType.Evaluation`\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 * 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 * Note: This method **sends** tracking data\n * Triggered Events: `EventType.Evaluation`\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 * Returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).\n *\n *\n * Note: This method **doesn't send** tracking data\n * Triggered Events: `EventType.Evaluation` (For each feature flag evaluated)\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted.\n */\n getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];\n /**\n * @method getActiveFeatureFlags - method collecting all active feature flags information including it's variation and variables for the visitor\n *\n *\n * Note: This method **doesn't send** tracking data\n * Triggered Events: `EventType.Evaluation` (For each feature flag evaluated)\n *\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {Map<string, KameleoonVariationType>} a map of feature flags with `featureKey` as a key and `KameleoonVariationType` as a value\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.StorageRead` - Couldn't read storage data\n * - `KameleoonException.JSONParse` - Couldn't parse JSON value\n * - `KameleoonException.NumberParse` - Couldn't parse Number value\n */\n getActiveFeatureFlags: (\n visitorCode: string,\n ) => Map<string, KameleoonVariationType>;\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 * Note: This method **doesn't send** tracking data\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.\n */\n getFeatureFlags: () => FeatureFlagType[];\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 *\n * Note: This method **sends** tracking data\n * Triggered Events: `EventType.Evaluation`\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 * 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 getEngineTrackingCode: (visitorCode: string) => string;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"useFeatureFlag.js","names":[],"sources":["../../src/interfaces/useFeatureFlag.ts"],"sourcesContent":["import {\n FeatureFlagType,\n KameleoonVariationType,\n FeatureFlagVariableType,\n FeatureVariableResultType,\n GetFeatureFlagVariableParamsType,\n} from '@kameleoon/javascript-sdk';\n\nexport default interface IUseFeatureFlag {\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 * Note: This method **sends** tracking data\n * Triggered Events: `EventType.Evaluation`\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 * 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 *\n * Note: This method **sends** tracking data\n * Triggered Events: `EventType.Evaluation`\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 * 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 * Note: This method **sends** tracking data\n * Triggered Events: `EventType.Evaluation`\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 * Returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).\n *\n *\n * Note: This method **doesn't send** tracking data\n * Triggered Events: `EventType.Evaluation` (For each feature flag evaluated)\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted.\n */\n getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];\n /**\n * @method getActiveFeatureFlags - method collecting all active feature flags information including it's variation and variables for the visitor\n *\n *\n * Note: This method **doesn't send** tracking data\n * Triggered Events: `EventType.Evaluation` (For each feature flag evaluated)\n *\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {Map<string, KameleoonVariationType>} a map of feature flags with `featureKey` as a key and `KameleoonVariationType` as a value\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.StorageRead` - Couldn't read storage data\n * - `KameleoonException.JSONParse` - Couldn't parse JSON value\n * - `KameleoonException.NumberParse` - Couldn't parse Number value\n */\n getActiveFeatureFlags: (\n visitorCode: string,\n ) => Map<string, KameleoonVariationType>;\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 * Note: This method **doesn't send** tracking data\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.\n */\n getFeatureFlags: () => FeatureFlagType[];\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 *\n * Note: This method **sends** tracking data\n * Triggered Events: `EventType.Evaluation`\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 * 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 getEngineTrackingCode: (visitorCode: string) => string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -3,28 +3,17 @@ export default interface IUseInitialize {
|
|
|
3
3
|
/**
|
|
4
4
|
* An asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Triggered Events: `EventType.ConfigurationUpdate` (On each successful configuration update while using Real Time Update)
|
|
7
|
+
*
|
|
8
|
+
* @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail
|
|
9
|
+
* @throws `KameleoonError` with one of the following `type` s:
|
|
8
10
|
*
|
|
9
11
|
* - `KameleoonException.StorageWrite` Couldn't update storage data.
|
|
10
12
|
* - `KameleoonException.StorageRead` - Couldn't read storage data.
|
|
11
13
|
* - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api.
|
|
12
14
|
* - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed
|
|
13
15
|
*/
|
|
14
|
-
initialize: (
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated
|
|
17
|
-
* use `onEvent(EventType.ConfigurationUpdate, callback)` instead
|
|
18
|
-
* Will be removed in the next major release
|
|
19
|
-
*
|
|
20
|
-
* Fires a callback on client configuration update. Note: this method only works for server sent events of real time update.
|
|
21
|
-
*
|
|
22
|
-
* @param {() => void} callback - callback function with no parameters that will be called upon configuration update.
|
|
23
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
24
|
-
*
|
|
25
|
-
* - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
|
|
26
|
-
*/
|
|
27
|
-
onConfigurationUpdate: (callback: () => void) => void;
|
|
16
|
+
initialize: () => Promise<boolean>;
|
|
28
17
|
/**
|
|
29
18
|
* @method onEvent - fires a callback on a specified Kameleoon `EventType`. Each event can only have one according callback.
|
|
30
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInitialize.js","names":[],"sources":["../../src/interfaces/useInitialize.ts"],"sourcesContent":["import { EventCallbackType, EventType } from '@kameleoon/javascript-sdk';\n\nexport default interface IUseInitialize {\n /**\n * An asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached.\n *\n *
|
|
1
|
+
{"version":3,"file":"useInitialize.js","names":[],"sources":["../../src/interfaces/useInitialize.ts"],"sourcesContent":["import { EventCallbackType, EventType } from '@kameleoon/javascript-sdk';\n\nexport default interface IUseInitialize {\n /**\n * An asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached.\n *\n * Triggered Events: `EventType.ConfigurationUpdate` (On each successful configuration update while using Real Time Update)\n *\n * @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.StorageWrite` Couldn't update storage data.\n * - `KameleoonException.StorageRead` - Couldn't read storage data.\n * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api.\n * - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed\n */\n initialize: () => Promise<boolean>;\n /**\n * @method onEvent - fires a callback on a specified Kameleoon `EventType`. Each event can only have one according callback.\n *\n * Note: SDK methods are marked with the `EventType` they trigger if any.\n *\n * @param {EventCallbackType<EventType>} callback - callback function with parameters that will be called upon event\n *\n * Parameter type depends on the `EventType` passed:\n * - `EventType.Evaluation` - `EvaluationEventDataType`\n * - `EventType.ConfigurationUpdate` - `ConfigurationUpdateEventDataType`\n *\n * @returns {void}\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 onEvent: <E extends EventType>(\n event: E,\n callback: EventCallbackType<E>,\n ) => void;\n /**\n * Checks if client is initialized.\n *\n * @returns {boolean} - `true` if client is initialized, `false` otherwise.\n */\n isInitialized: () => boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVisitorCode.js","names":[],"sources":["../../src/interfaces/useVisitorCode.ts"],"sourcesContent":["export default interface IUseVisitorCode {\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 * 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 getVisitorCode: (defaultVisitorCode?: string) => string;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"useVisitorCode.js","names":[],"sources":["../../src/interfaces/useVisitorCode.ts"],"sourcesContent":["export default interface IUseVisitorCode {\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 * 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 getVisitorCode: (defaultVisitorCode?: string) => string;\n}\n"],"mappings":"","ignoreList":[]}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import {\n SDKParameters as CoreSDKParameters,\n ExternalsType as CoreExternalsType,\n IExternalPRNG,\n} from '@kameleoon/javascript-sdk';\n\nexport type ExternalsType = CoreExternalsType & {\n prng?: IExternalPRNG;\n};\n\n/**\n * @param {IExternalStorage | undefined} storage - external storage implementation\n * @param {IExternalEventSource | undefined} eventSource - external event source implementation\n * @param {IExternalVisitorCodeManager | undefined} visitorCodeManager - external visitor code manager implementation\n * @param {IExternalRequester | undefined} requester - external requester implementation\n * @param {IExternalPRNG | undefined} prng - external PRNG implementation\n * */\nexport type SDKParameters = Omit<CoreSDKParameters, '_internals'> & {\n externals?: ExternalsType;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import {\n SDKParameters as CoreSDKParameters,\n ExternalsType as CoreExternalsType,\n IExternalPRNG,\n} from '@kameleoon/javascript-sdk';\n\nexport type ExternalsType = CoreExternalsType & {\n prng?: IExternalPRNG;\n};\n\n/**\n * @param {IExternalStorage | undefined} storage - external storage implementation\n * @param {IExternalEventSource | undefined} eventSource - external event source implementation\n * @param {IExternalVisitorCodeManager | undefined} visitorCodeManager - external visitor code manager implementation\n * @param {IExternalRequester | undefined} requester - external requester implementation\n * @param {IExternalPRNG | undefined} prng - external PRNG implementation\n * */\nexport type SDKParameters = Omit<CoreSDKParameters, '_internals'> & {\n externals?: ExternalsType;\n};\n"],"mappings":"","ignoreList":[]}
|
package/dist/useData.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useData=useData;var _react=require("react"),_useKameleoon=require("./useKameleoon");function useData(){const a=(0,_useKameleoon.useKameleoon)(),b=(0,_react.useCallback)(function(b){for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];a.addData(b,...d)},[a]),c=(0,_react.useCallback)(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useData=useData;var _react=require("react"),_useKameleoon=require("./useKameleoon");function useData(){const a=(0,_useKameleoon.useKameleoon)(),b=(0,_react.useCallback)(function(b){for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];a.addData(b,...d)},[a]),c=(0,_react.useCallback)(b=>{a.flush(b)},[a]),d=(0,_react.useCallback)(b=>{let{visitorCode:c,goalId:d,revenue:e}=b;a.trackConversion({visitorCode:c,goalId:d,revenue:e})},[a]),e=(0,_react.useCallback)(async b=>await a.getRemoteData(b),[a]),f=(0,_react.useCallback)(async b=>await a.getRemoteVisitorData(b),[a]),g=(0,_react.useCallback)(async b=>await a.getVisitorWarehouseAudience(b),[a]);return{getRemoteData:e,getRemoteVisitorData:f,getVisitorWarehouseAudience:g,trackConversion:d,addData:b,flush:c}}
|
|
2
2
|
//# sourceMappingURL=useData.js.map
|
package/dist/useData.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useData.js","names":["useData","client","useKameleoon","addData","useCallback","visitorCode","c","arguments","length","data","Array","e","flush","
|
|
1
|
+
{"version":3,"file":"useData.js","names":["useData","client","useKameleoon","addData","useCallback","visitorCode","c","arguments","length","data","Array","e","flush","trackConversion","b","goalId","revenue","getRemoteData","key","getRemoteVisitorData","params","getVisitorWarehouseAudience"],"sources":["../src/useData.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport {\n CustomData,\n GetVisitorWarehouseAudienceParamsType,\n JSONType,\n KameleoonDataType,\n RemoteVisitorDataParamsType,\n TrackConversionParamsType,\n} from '@kameleoon/javascript-sdk';\nimport { useKameleoon } from './useKameleoon';\nimport IUseData from './interfaces/useData';\n\n/**\n * A React Hook that returns methods related to SDK data management\n *\n * @returns {IUseData} an object containing the following methods:\n * - `addData`\n * - `flush`\n * - `trackConversion`\n * - `getRemoteData`\n * - `getRemoteVisitorData`\n * - `getVisitorWarehouseAudience`\n */\nexport function useData(): IUseData {\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 const flush = useCallback(\n (visitorCode?: string): void => {\n client.flush(visitorCode);\n },\n [client],\n );\n\n const trackConversion = useCallback(\n ({ visitorCode, goalId, revenue }: TrackConversionParamsType): void => {\n client.trackConversion({\n visitorCode,\n goalId,\n revenue,\n });\n },\n [client],\n );\n\n const getRemoteData = useCallback(\n async (key: string): Promise<JSONType> => {\n return await client.getRemoteData(key);\n },\n [client],\n );\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 const getVisitorWarehouseAudience = useCallback(\n async (\n params: GetVisitorWarehouseAudienceParamsType,\n ): Promise<CustomData | null> => {\n return await client.getVisitorWarehouseAudience(params);\n },\n [client],\n );\n\n return {\n getRemoteData,\n getRemoteVisitorData,\n getVisitorWarehouseAudience,\n trackConversion,\n addData,\n flush,\n };\n}\n"],"mappings":"gKAuBO,QAAS,CAAAA,OAAOA,CAAA,CAAa,MAC5B,CAAAC,CAAM,CAAG,GAAAC,0BAAY,EAAC,CAAC,CAEvBC,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,EAC3BV,CAAM,CAACE,OAAO,CAACE,CAAW,CAAE,GAAGI,CAAI,CACrC,CAAC,CACD,CAACR,CAAM,CACT,CAAC,CAEKW,CAAK,CAAG,GAAAR,kBAAW,EACtBC,CAAoB,EAAW,CAC9BJ,CAAM,CAACW,KAAK,CAACP,CAAW,CAC1B,CAAC,CACD,CAACJ,CAAM,CACT,CAAC,CAEKY,CAAe,CAAG,GAAAT,kBAAW,EACjCU,CAAA,EAAuE,IAAtE,CAAET,WAAW,CAAXA,CAAW,CAAEU,MAAM,CAANA,CAAM,CAAEC,OAAO,CAAPA,CAAmC,CAAC,CAAAF,CAAA,CAC1Db,CAAM,CAACY,eAAe,CAAC,CACrBR,WAAW,CAAXA,CAAW,CACXU,MAAM,CAANA,CAAM,CACNC,OAAO,CAAPA,CACF,CAAC,CACH,CAAC,CACD,CAACf,CAAM,CACT,CAAC,CAEKgB,CAAa,CAAG,GAAAb,kBAAW,EAC/B,KAAO,CAAAc,CAAW,EACT,KAAM,CAAAjB,CAAM,CAACgB,aAAa,CAACC,CAAG,CACtC,CACD,CAACjB,CAAM,CACT,CAAC,CAEKkB,CAAoB,CAAG,GAAAf,kBAAW,EACtC,KACE,CAAAgB,CAAmC,EAE5B,KAAM,CAAAnB,CAAM,CAACkB,oBAAoB,CAACC,CAAM,CAChD,CACD,CAACnB,CAAM,CACT,CAAC,CAEKoB,CAA2B,CAAG,GAAAjB,kBAAW,EAC7C,KACE,CAAAgB,CAA6C,EAEtC,KAAM,CAAAnB,CAAM,CAACoB,2BAA2B,CAACD,CAAM,CACvD,CACD,CAACnB,CAAM,CACT,CAAC,CAED,MAAO,CACLgB,aAAa,CAAbA,CAAa,CACbE,oBAAoB,CAApBA,CAAoB,CACpBE,2BAA2B,CAA3BA,CAA2B,CAC3BR,eAAe,CAAfA,CAAe,CACfV,OAAO,CAAPA,CAAO,CACPS,KAAK,CAALA,CACF,CACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFeatureFlag.js","names":["useFeatureFlag","client","useKameleoon","isFeatureFlagActive","useCallback","visitorCode","featureKey","getFeatureFlagVariationKey","getFeatureFlagVariable","b","variableKey","getVisitorFeatureFlags","getActiveFeatureFlags","getFeatureFlags","getFeatureFlagVariables","getEngineTrackingCode"],"sources":["../src/useFeatureFlag.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport IUseFeatureFlag from './interfaces/useFeatureFlag';\nimport { useKameleoon } from './useKameleoon';\nimport {\n FeatureFlagType,\n FeatureFlagVariableType,\n FeatureVariableResultType,\n KameleoonVariationType,\n GetFeatureFlagVariableParamsType,\n} from '@kameleoon/javascript-sdk';\n\n/**\n * A React Hook that returns methods related to SDK feature flag\n * and feature experimentation management\n *\n * @returns {IUseFeatureFlag} an object containing the following methods:\n * - `isFeatureFlagActive`,\n * - `getFeatureFlagVariationKey`,\n * - `getFeatureFlagVariable`,\n * - `getVisitorFeatureFlags`,\n * - `getActiveFeatureFlags`,\n * - `getFeatureFlags`,\n * - `getFeatureFlagVariables`,\n * - `getEngineTrackingCode`\n */\nexport function useFeatureFlag(): IUseFeatureFlag {\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 const getFeatureFlagVariationKey = useCallback(\n (visitorCode: string, featureKey: string): string => {\n return client.getFeatureFlagVariationKey(visitorCode, featureKey);\n },\n [client],\n );\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 const getVisitorFeatureFlags = useCallback(\n (visitorCode: string): FeatureFlagType[] => {\n return client.getVisitorFeatureFlags(visitorCode);\n },\n [client],\n );\n\n const getActiveFeatureFlags = useCallback(\n (visitorCode: string): Map<string, KameleoonVariationType> => {\n return client.getActiveFeatureFlags(visitorCode);\n },\n [client],\n );\n\n const getFeatureFlags = useCallback((): FeatureFlagType[] => {\n return client.getFeatureFlags();\n }, [client]);\n\n const getFeatureFlagVariables = useCallback(\n (visitorCode, featureKey): FeatureVariableResultType[] => {\n return client.getFeatureFlagVariables(visitorCode, featureKey);\n },\n [client],\n );\n\n const getEngineTrackingCode = useCallback(\n (visitorCode: string): string => {\n return client.getEngineTrackingCode(visitorCode);\n },\n [client],\n );\n\n return {\n getActiveFeatureFlags,\n getFeatureFlags,\n isFeatureFlagActive,\n getEngineTrackingCode,\n getVisitorFeatureFlags,\n getFeatureFlagVariable,\n getFeatureFlagVariables,\n getFeatureFlagVariationKey,\n };\n}\n"],"mappings":"8KAyBO,QAAS,CAAAA,cAAcA,CAAA,CAAoB,MAC1C,CAAAC,CAAM,CAAG,GAAAC,0BAAY,EAAC,CAAC,CAEvBC,CAAmB,CAAG,GAAAC,kBAAW,EACrC,CAACC,CAAmB,CAAEC,CAAkB,GAC/BL,CAAM,CAACE,mBAAmB,CAACE,CAAW,CAAEC,CAAU,CAC1D,CACD,CAACL,CAAM,CACT,CAAC,CAEKM,CAA0B,CAAG,GAAAH,kBAAW,EAC5C,CAACC,CAAmB,CAAEC,CAAkB,GAC/BL,CAAM,CAACM,0BAA0B,CAACF,CAAW,CAAEC,CAAU,CACjE,CACD,CAACL,CAAM,CACT,CAAC,CAEKO,CAAsB,CAAG,GAAAJ,kBAAW,EACxCK,CAAA,EAIiE,IAJhE,CACCJ,WAAW,CAAXA,CAAW,CACXC,UAAU,CAAVA,CAAU,CACVI,WAAW,CAAXA,CACgC,CAAC,CAAAD,CAAA,CACjC,MAAO,CAAAR,CAAM,CAACO,sBAAsB,CAAC,CACnCH,WAAW,CAAXA,CAAW,CACXC,UAAU,CAAVA,CAAU,CACVI,WAAW,CAAXA,CACF,CAAC,CACH,CAAC,CACD,CAACT,CAAM,CACT,CAAC,CAEKU,CAAsB,CAAG,GAAAP,kBAAW,EACvCC,CAAmB,EACXJ,CAAM,CAACU,sBAAsB,CAACN,CAAW,CACjD,CACD,CAACJ,CAAM,CACT,CAAC,CAEKW,CAAqB,CAAG,GAAAR,kBAAW,EACtCC,CAAmB,EACXJ,CAAM,CAACW,qBAAqB,CAACP,CAAW,CAChD,CACD,CAACJ,CAAM,CACT,CAAC,CAEKY,CAAe,CAAG,GAAAT,kBAAW,EAAC,IAC3BH,CAAM,CAACY,eAAe,CAAC,CAC/B,CAAE,CAACZ,CAAM,CAAC,CAAC,CAENa,CAAuB,CAAG,GAAAV,kBAAW,EACzC,CAACC,CAAW,CAAEC,CAAU,GACfL,CAAM,CAACa,uBAAuB,CAACT,CAAW,CAAEC,CAAU,CAC9D,CACD,CAACL,CAAM,CACT,CAAC,CAEKc,CAAqB,CAAG,GAAAX,kBAAW,EACtCC,CAAmB,EACXJ,CAAM,CAACc,qBAAqB,CAACV,CAAW,CAChD,CACD,CAACJ,CAAM,CACT,CAAC,CAED,MAAO,CACLW,qBAAqB,CAArBA,CAAqB,CACrBC,eAAe,CAAfA,CAAe,CACfV,mBAAmB,CAAnBA,CAAmB,CACnBY,qBAAqB,CAArBA,CAAqB,CACrBJ,sBAAsB,CAAtBA,CAAsB,CACtBH,sBAAsB,CAAtBA,CAAsB,CACtBM,uBAAuB,CAAvBA,CAAuB,CACvBP,0BAA0B,CAA1BA,CACF,CACF"}
|
|
1
|
+
{"version":3,"file":"useFeatureFlag.js","names":["useFeatureFlag","client","useKameleoon","isFeatureFlagActive","useCallback","visitorCode","featureKey","getFeatureFlagVariationKey","getFeatureFlagVariable","b","variableKey","getVisitorFeatureFlags","getActiveFeatureFlags","getFeatureFlags","getFeatureFlagVariables","getEngineTrackingCode"],"sources":["../src/useFeatureFlag.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport IUseFeatureFlag from './interfaces/useFeatureFlag';\nimport { useKameleoon } from './useKameleoon';\nimport {\n FeatureFlagType,\n FeatureFlagVariableType,\n FeatureVariableResultType,\n KameleoonVariationType,\n GetFeatureFlagVariableParamsType,\n} from '@kameleoon/javascript-sdk';\n\n/**\n * A React Hook that returns methods related to SDK feature flag\n * and feature experimentation management\n *\n * @returns {IUseFeatureFlag} an object containing the following methods:\n * - `isFeatureFlagActive`,\n * - `getFeatureFlagVariationKey`,\n * - `getFeatureFlagVariable`,\n * - `getVisitorFeatureFlags`,\n * - `getActiveFeatureFlags`,\n * - `getFeatureFlags`,\n * - `getFeatureFlagVariables`,\n * - `getEngineTrackingCode`\n */\nexport function useFeatureFlag(): IUseFeatureFlag {\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 const getFeatureFlagVariationKey = useCallback(\n (visitorCode: string, featureKey: string): string => {\n return client.getFeatureFlagVariationKey(visitorCode, featureKey);\n },\n [client],\n );\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 const getVisitorFeatureFlags = useCallback(\n (visitorCode: string): FeatureFlagType[] => {\n return client.getVisitorFeatureFlags(visitorCode);\n },\n [client],\n );\n\n const getActiveFeatureFlags = useCallback(\n (visitorCode: string): Map<string, KameleoonVariationType> => {\n return client.getActiveFeatureFlags(visitorCode);\n },\n [client],\n );\n\n const getFeatureFlags = useCallback((): FeatureFlagType[] => {\n return client.getFeatureFlags();\n }, [client]);\n\n const getFeatureFlagVariables = useCallback(\n (visitorCode, featureKey): FeatureVariableResultType[] => {\n return client.getFeatureFlagVariables(visitorCode, featureKey);\n },\n [client],\n );\n\n const getEngineTrackingCode = useCallback(\n (visitorCode: string): string => {\n return client.getEngineTrackingCode(visitorCode);\n },\n [client],\n );\n\n return {\n getActiveFeatureFlags,\n getFeatureFlags,\n isFeatureFlagActive,\n getEngineTrackingCode,\n getVisitorFeatureFlags,\n getFeatureFlagVariable,\n getFeatureFlagVariables,\n getFeatureFlagVariationKey,\n };\n}\n"],"mappings":"8KAyBO,QAAS,CAAAA,cAAcA,CAAA,CAAoB,MAC1C,CAAAC,CAAM,CAAG,GAAAC,0BAAY,EAAC,CAAC,CAEvBC,CAAmB,CAAG,GAAAC,kBAAW,EACrC,CAACC,CAAmB,CAAEC,CAAkB,GAC/BL,CAAM,CAACE,mBAAmB,CAACE,CAAW,CAAEC,CAAU,CAC1D,CACD,CAACL,CAAM,CACT,CAAC,CAEKM,CAA0B,CAAG,GAAAH,kBAAW,EAC5C,CAACC,CAAmB,CAAEC,CAAkB,GAC/BL,CAAM,CAACM,0BAA0B,CAACF,CAAW,CAAEC,CAAU,CACjE,CACD,CAACL,CAAM,CACT,CAAC,CAEKO,CAAsB,CAAG,GAAAJ,kBAAW,EACxCK,CAAA,EAIiE,IAJhE,CACCJ,WAAW,CAAXA,CAAW,CACXC,UAAU,CAAVA,CAAU,CACVI,WAAW,CAAXA,CACgC,CAAC,CAAAD,CAAA,CACjC,MAAO,CAAAR,CAAM,CAACO,sBAAsB,CAAC,CACnCH,WAAW,CAAXA,CAAW,CACXC,UAAU,CAAVA,CAAU,CACVI,WAAW,CAAXA,CACF,CAAC,CACH,CAAC,CACD,CAACT,CAAM,CACT,CAAC,CAEKU,CAAsB,CAAG,GAAAP,kBAAW,EACvCC,CAAmB,EACXJ,CAAM,CAACU,sBAAsB,CAACN,CAAW,CACjD,CACD,CAACJ,CAAM,CACT,CAAC,CAEKW,CAAqB,CAAG,GAAAR,kBAAW,EACtCC,CAAmB,EACXJ,CAAM,CAACW,qBAAqB,CAACP,CAAW,CAChD,CACD,CAACJ,CAAM,CACT,CAAC,CAEKY,CAAe,CAAG,GAAAT,kBAAW,EAAC,IAC3BH,CAAM,CAACY,eAAe,CAAC,CAC/B,CAAE,CAACZ,CAAM,CAAC,CAAC,CAENa,CAAuB,CAAG,GAAAV,kBAAW,EACzC,CAACC,CAAW,CAAEC,CAAU,GACfL,CAAM,CAACa,uBAAuB,CAACT,CAAW,CAAEC,CAAU,CAC9D,CACD,CAACL,CAAM,CACT,CAAC,CAEKc,CAAqB,CAAG,GAAAX,kBAAW,EACtCC,CAAmB,EACXJ,CAAM,CAACc,qBAAqB,CAACV,CAAW,CAChD,CACD,CAACJ,CAAM,CACT,CAAC,CAED,MAAO,CACLW,qBAAqB,CAArBA,CAAqB,CACrBC,eAAe,CAAfA,CAAe,CACfV,mBAAmB,CAAnBA,CAAmB,CACnBY,qBAAqB,CAArBA,CAAqB,CACrBJ,sBAAsB,CAAtBA,CAAsB,CACtBH,sBAAsB,CAAtBA,CAAsB,CACtBM,uBAAuB,CAAvBA,CAAuB,CACvBP,0BAA0B,CAA1BA,CACF,CACF","ignoreList":[]}
|
package/dist/useInitialize.d.ts
CHANGED
package/dist/useInitialize.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useInitialize=useInitialize;var _react=require("react"),_useKameleoon=require("./useKameleoon");function useInitialize(){const a=(0,_useKameleoon.useKameleoon)(),b=(0,_react.useCallback)(async
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useInitialize=useInitialize;var _react=require("react"),_useKameleoon=require("./useKameleoon");function useInitialize(){const a=(0,_useKameleoon.useKameleoon)(),b=(0,_react.useCallback)(async()=>await a.initialize(),[a]),c=(0,_react.useCallback)((b,c)=>{a.onEvent(b,c)},[a]),d=(0,_react.useCallback)(()=>a.isInitialized(),[a]);return{onEvent:c,initialize:b,isInitialized:d}}
|
|
2
2
|
//# sourceMappingURL=useInitialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInitialize.js","names":["useInitialize","client","useKameleoon","initialize","useCallback","
|
|
1
|
+
{"version":3,"file":"useInitialize.js","names":["useInitialize","client","useKameleoon","initialize","useCallback","onEvent","event","callback","isInitialized"],"sources":["../src/useInitialize.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\nimport IUseInitialize from './interfaces/useInitialize';\nimport { EventCallbackType, EventType } from '@kameleoon/javascript-sdk';\n\n/**\n * A React Hook that returns methods related to SDK setup and configuration\n *\n * @returns {IUseInitialize} an object containing the following methods:\n * - `initialize`\n * - `isInitialized`\n * - `onEvent`\n */\nexport function useInitialize(): IUseInitialize {\n const client = useKameleoon();\n\n const initialize = useCallback(async (): Promise<boolean> => {\n return await client.initialize();\n }, [client]);\n\n const onEvent = useCallback(\n <E extends EventType>(event: E, callback: EventCallbackType<E>): void => {\n client.onEvent(event, callback);\n },\n [client],\n );\n\n const isInitialized = useCallback((): boolean => {\n return client.isInitialized();\n }, [client]);\n\n return {\n onEvent,\n initialize,\n isInitialized,\n };\n}\n"],"mappings":"4KAaO,QAAS,CAAAA,aAAaA,CAAA,CAAmB,MACxC,CAAAC,CAAM,CAAG,GAAAC,0BAAY,EAAC,CAAC,CAEvBC,CAAU,CAAG,GAAAC,kBAAW,EAAC,SACtB,KAAM,CAAAH,CAAM,CAACE,UAAU,CAAC,CAChC,CAAE,CAACF,CAAM,CAAC,CAAC,CAENI,CAAO,CAAG,GAAAD,kBAAW,EACzB,CAAsBE,CAAQ,CAAEC,CAA8B,GAAW,CACvEN,CAAM,CAACI,OAAO,CAACC,CAAK,CAAEC,CAAQ,CAChC,CAAC,CACD,CAACN,CAAM,CACT,CAAC,CAEKO,CAAa,CAAG,GAAAJ,kBAAW,EAAC,IACzBH,CAAM,CAACO,aAAa,CAAC,CAC7B,CAAE,CAACP,CAAM,CAAC,CAAC,CAEZ,MAAO,CACLI,OAAO,CAAPA,CAAO,CACPF,UAAU,CAAVA,CAAU,CACVK,aAAa,CAAbA,CACF,CACF","ignoreList":[]}
|
package/dist/useKameleoon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKameleoon.js","names":["useKameleoon","context","useContext","KameleoonContext","Error"],"sources":["../src/useKameleoon.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { KameleoonClient } from '@kameleoon/javascript-sdk';\nimport { KameleoonContext } from './KameleoonContext';\n\n/**\n * A React Hook that validates if context is used within a KameleoonProvider and returns it.\n *\n * @returns {KameleoonClient} an instance of KameleoonClient\n * @throws Kameleoon SDK hooks must be used within a KameleoonProvider.\n */\nexport function useKameleoon(): KameleoonClient {\n const context = useContext(KameleoonContext);\n\n if (!context) {\n throw new Error(\n 'Kameleoon SDK hooks must be used within a KameleoonProvider',\n );\n }\n\n return context;\n}\n"],"mappings":"kLAUO,QAAS,CAAAA,YAAYA,CAAA,CAAoB,CAC9C,KAAM,CAAAC,CAAO,CAAG,GAAAC,iBAAU,EAACC,kCAAgB,CAAC,CAE5C,GAAI,CAACF,CAAO,CACV,KAAM,IAAI,CAAAG,KAAK,CACb,6DACF,CAAC,CAGH,MAAO,CAAAH,CACT"}
|
|
1
|
+
{"version":3,"file":"useKameleoon.js","names":["useKameleoon","context","useContext","KameleoonContext","Error"],"sources":["../src/useKameleoon.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { KameleoonClient } from '@kameleoon/javascript-sdk';\nimport { KameleoonContext } from './KameleoonContext';\n\n/**\n * A React Hook that validates if context is used within a KameleoonProvider and returns it.\n *\n * @returns {KameleoonClient} an instance of KameleoonClient\n * @throws Kameleoon SDK hooks must be used within a KameleoonProvider.\n */\nexport function useKameleoon(): KameleoonClient {\n const context = useContext(KameleoonContext);\n\n if (!context) {\n throw new Error(\n 'Kameleoon SDK hooks must be used within a KameleoonProvider',\n );\n }\n\n return context;\n}\n"],"mappings":"kLAUO,QAAS,CAAAA,YAAYA,CAAA,CAAoB,CAC9C,KAAM,CAAAC,CAAO,CAAG,GAAAC,iBAAU,EAACC,kCAAgB,CAAC,CAE5C,GAAI,CAACF,CAAO,CACV,KAAM,IAAI,CAAAG,KAAK,CACb,6DACF,CAAC,CAGH,MAAO,CAAAH,CACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVisitorCode.js","names":["useVisitorCode","client","useKameleoon","setLegalConsent","useCallback","visitorCode","consent","getVisitorCode","defaultVisitorCode"],"sources":["../src/useVisitorCode.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\nimport IUseVisitorCode from './interfaces/useVisitorCode';\n\n/**\n * A React Hook that returns methods related to visitor code and consent\n *\n * @returns {IUseVisitorCode} an object containing the following methods:\n * - `setLegalConsent`\n * - `getVisitorCode`\n */\nexport function useVisitorCode(): IUseVisitorCode {\n const client = useKameleoon();\n\n const setLegalConsent = useCallback(\n (visitorCode: string, consent: boolean): void => {\n client.setLegalConsent(visitorCode, consent);\n },\n [client],\n );\n\n const getVisitorCode = useCallback((defaultVisitorCode?: string): string => {\n return client.getVisitorCode(defaultVisitorCode);\n }, []);\n\n return {\n setLegalConsent,\n getVisitorCode,\n };\n}\n"],"mappings":"8KAWO,QAAS,CAAAA,cAAcA,CAAA,CAAoB,MAC1C,CAAAC,CAAM,CAAG,GAAAC,0BAAY,EAAC,CAAC,CAEvBC,CAAe,CAAG,GAAAC,kBAAW,EACjC,CAACC,CAAmB,CAAEC,CAAgB,GAAW,CAC/CL,CAAM,CAACE,eAAe,CAACE,CAAW,CAAEC,CAAO,CAC7C,CAAC,CACD,CAACL,CAAM,CACT,CAAC,CAEKM,CAAc,CAAG,GAAAH,kBAAW,EAAEI,CAA2B,EACtDP,CAAM,CAACM,cAAc,CAACC,CAAkB,CAChD,CAAE,EAAE,CAAC,CAEN,MAAO,CACLL,eAAe,CAAfA,CAAe,CACfI,cAAc,CAAdA,CACF,CACF"}
|
|
1
|
+
{"version":3,"file":"useVisitorCode.js","names":["useVisitorCode","client","useKameleoon","setLegalConsent","useCallback","visitorCode","consent","getVisitorCode","defaultVisitorCode"],"sources":["../src/useVisitorCode.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\nimport IUseVisitorCode from './interfaces/useVisitorCode';\n\n/**\n * A React Hook that returns methods related to visitor code and consent\n *\n * @returns {IUseVisitorCode} an object containing the following methods:\n * - `setLegalConsent`\n * - `getVisitorCode`\n */\nexport function useVisitorCode(): IUseVisitorCode {\n const client = useKameleoon();\n\n const setLegalConsent = useCallback(\n (visitorCode: string, consent: boolean): void => {\n client.setLegalConsent(visitorCode, consent);\n },\n [client],\n );\n\n const getVisitorCode = useCallback((defaultVisitorCode?: string): string => {\n return client.getVisitorCode(defaultVisitorCode);\n }, []);\n\n return {\n setLegalConsent,\n getVisitorCode,\n };\n}\n"],"mappings":"8KAWO,QAAS,CAAAA,cAAcA,CAAA,CAAoB,MAC1C,CAAAC,CAAM,CAAG,GAAAC,0BAAY,EAAC,CAAC,CAEvBC,CAAe,CAAG,GAAAC,kBAAW,EACjC,CAACC,CAAmB,CAAEC,CAAgB,GAAW,CAC/CL,CAAM,CAACE,eAAe,CAACE,CAAW,CAAEC,CAAO,CAC7C,CAAC,CACD,CAACL,CAAM,CACT,CAAC,CAEKM,CAAc,CAAG,GAAAH,kBAAW,EAAEI,CAA2B,EACtDP,CAAM,CAACM,cAAc,CAACC,CAAkB,CAChD,CAAE,EAAE,CAAC,CAEN,MAAO,CACLL,eAAe,CAAfA,CAAe,CACfI,cAAc,CAAdA,CACF,CACF","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kameleoon/react-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Kameleoon React SDK",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
],
|
|
37
37
|
"license": "ISC",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@kameleoon/javascript-sdk": "
|
|
39
|
+
"@kameleoon/javascript-sdk": "4.0.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|