@kameleoon/react-sdk 8.5.2 → 9.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 +472 -0
- package/CHANGELOG_INTERNAL.md +3 -0
- package/README.md +26 -133
- package/dist/KameleoonContext.d.ts +2 -2
- package/dist/KameleoonContext.js +1 -1
- package/dist/KameleoonContext.js.map +1 -1
- package/dist/KameleoonProvider.d.ts +5 -5
- package/dist/KameleoonProvider.js +1 -1
- package/dist/KameleoonProvider.js.map +1 -1
- package/dist/createClient.d.ts +6 -0
- package/dist/createClient.js +2 -0
- package/dist/createClient.js.map +1 -0
- package/dist/index.d.ts +11 -24
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/useData.d.ts +80 -0
- package/dist/interfaces/useData.js +2 -0
- package/dist/interfaces/useData.js.map +1 -0
- package/dist/interfaces/useFeatureFlag.d.ts +101 -0
- package/dist/interfaces/useFeatureFlag.js +2 -0
- package/dist/interfaces/useFeatureFlag.js.map +1 -0
- package/dist/interfaces/useInitialize.d.ts +23 -0
- package/dist/interfaces/useInitialize.js +2 -0
- package/dist/interfaces/useInitialize.js.map +1 -0
- package/dist/{useSetLegalConsent.d.ts → interfaces/useVisitorCode.d.ts} +12 -7
- package/dist/interfaces/useVisitorCode.js +2 -0
- package/dist/interfaces/useVisitorCode.js.map +1 -0
- package/dist/useData.d.ts +13 -0
- package/dist/useData.js +2 -0
- package/dist/useData.js.map +1 -0
- package/dist/useFeatureFlag.d.ts +15 -0
- package/dist/useFeatureFlag.js +2 -0
- package/dist/useFeatureFlag.js.map +1 -0
- package/dist/useInitialize.d.ts +6 -17
- package/dist/useInitialize.js +1 -1
- package/dist/useInitialize.js.map +1 -1
- package/dist/useKameleoon.d.ts +4 -4
- package/dist/useKameleoon.js +1 -1
- package/dist/useKameleoon.js.map +1 -1
- package/dist/useVisitorCode.d.ts +9 -0
- package/dist/useVisitorCode.js +2 -0
- package/dist/useVisitorCode.js.map +1 -0
- package/package.json +8 -14
- package/dist/eventSource/browserEventSource.d.ts +0 -4
- package/dist/eventSource/browserEventSource.js +0 -2
- package/dist/eventSource/browserEventSource.js.map +0 -1
- package/dist/eventSource/index.d.ts +0 -2
- package/dist/eventSource/index.js +0 -2
- package/dist/eventSource/index.js.map +0 -1
- package/dist/eventSource/nativeEventSource.d.ts +0 -4
- package/dist/eventSource/nativeEventSource.js +0 -2
- package/dist/eventSource/nativeEventSource.js.map +0 -1
- package/dist/kameleoonClient.d.ts +0 -7
- package/dist/kameleoonClient.js +0 -2
- package/dist/kameleoonClient.js.map +0 -1
- package/dist/kameleoonUtils/browserUtils.d.ts +0 -13
- package/dist/kameleoonUtils/browserUtils.js +0 -2
- package/dist/kameleoonUtils/browserUtils.js.map +0 -1
- package/dist/kameleoonUtils/nativeUtils.d.ts +0 -12
- package/dist/kameleoonUtils/nativeUtils.js +0 -2
- package/dist/kameleoonUtils/nativeUtils.js.map +0 -1
- package/dist/requester.d.ts +0 -9
- package/dist/requester.js +0 -2
- package/dist/requester.js.map +0 -1
- package/dist/storage/index.d.ts +0 -2
- package/dist/storage/index.js +0 -2
- package/dist/storage/index.js.map +0 -1
- package/dist/storage/localStorage.d.ts +0 -4
- package/dist/storage/localStorage.js +0 -2
- package/dist/storage/localStorage.js.map +0 -1
- package/dist/storage/nativeStorage.d.ts +0 -14
- package/dist/storage/nativeStorage.js +0 -2
- package/dist/storage/nativeStorage.js.map +0 -1
- package/dist/types.d.ts +0 -21
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/useAddData.d.ts +0 -22
- package/dist/useAddData.js +0 -2
- package/dist/useAddData.js.map +0 -1
- package/dist/useBrowserVisitorCode.d.ts +0 -17
- package/dist/useBrowserVisitorCode.js +0 -2
- package/dist/useBrowserVisitorCode.js.map +0 -1
- package/dist/useConfigurationUpdate.d.ts +0 -17
- package/dist/useConfigurationUpdate.js +0 -2
- package/dist/useConfigurationUpdate.js.map +0 -1
- package/dist/useEngineTrackingCode.d.ts +0 -5
- package/dist/useEngineTrackingCode.js +0 -2
- package/dist/useEngineTrackingCode.js.map +0 -1
- package/dist/useFeatureFlagActive.d.ts +0 -24
- package/dist/useFeatureFlagActive.js +0 -2
- package/dist/useFeatureFlagActive.js.map +0 -1
- package/dist/useFeatureFlagVariationKey.d.ts +0 -23
- package/dist/useFeatureFlagVariationKey.js +0 -2
- package/dist/useFeatureFlagVariationKey.js.map +0 -1
- package/dist/useFeatureFlags.d.ts +0 -18
- package/dist/useFeatureFlags.js +0 -2
- package/dist/useFeatureFlags.js.map +0 -1
- package/dist/useFeatureVariable.d.ts +0 -26
- package/dist/useFeatureVariable.js +0 -2
- package/dist/useFeatureVariable.js.map +0 -1
- package/dist/useFeatureVariables.d.ts +0 -25
- package/dist/useFeatureVariables.js +0 -2
- package/dist/useFeatureVariables.js.map +0 -1
- package/dist/useFlush.d.ts +0 -22
- package/dist/useFlush.js +0 -2
- package/dist/useFlush.js.map +0 -1
- package/dist/useNativeVisitorCode.d.ts +0 -16
- package/dist/useNativeVisitorCode.js +0 -2
- package/dist/useNativeVisitorCode.js.map +0 -1
- package/dist/useReactNativeVisitorCode.d.ts +0 -19
- package/dist/useReactNativeVisitorCode.js +0 -2
- package/dist/useReactNativeVisitorCode.js.map +0 -1
- package/dist/useReactVisitorCode.d.ts +0 -19
- package/dist/useReactVisitorCode.js +0 -2
- package/dist/useReactVisitorCode.js.map +0 -1
- package/dist/useRemoteData.d.ts +0 -19
- package/dist/useRemoteData.js +0 -2
- package/dist/useRemoteData.js.map +0 -1
- package/dist/useRemoteVisitorData.d.ts +0 -23
- package/dist/useRemoteVisitorData.js +0 -2
- package/dist/useRemoteVisitorData.js.map +0 -1
- package/dist/useSetLegalConsent.js +0 -2
- package/dist/useSetLegalConsent.js.map +0 -1
- package/dist/useTrackConversion.d.ts +0 -20
- package/dist/useTrackConversion.js +0 -2
- package/dist/useTrackConversion.js.map +0 -1
- package/dist/useVisitorFeatureFlags.d.ts +0 -22
- package/dist/useVisitorFeatureFlags.js +0 -2
- package/dist/useVisitorFeatureFlags.js.map +0 -1
- package/dist/useVisitorWarehouseAudience.d.ts +0 -24
- package/dist/useVisitorWarehouseAudience.js +0 -2
- package/dist/useVisitorWarehouseAudience.js.map +0 -1
- package/dist/visitorCodeManager/index.d.ts +0 -2
- package/dist/visitorCodeManager/index.js +0 -2
- package/dist/visitorCodeManager/index.js.map +0 -1
- package/dist/visitorCodeManager/reactNativeVisitorCodeManager.d.ts +0 -8
- package/dist/visitorCodeManager/reactNativeVisitorCodeManager.js +0 -2
- package/dist/visitorCodeManager/reactNativeVisitorCodeManager.js.map +0 -1
- package/dist/visitorCodeManager/reactVisitorCodeManager.d.ts +0 -8
- package/dist/visitorCodeManager/reactVisitorCodeManager.js +0 -2
- package/dist/visitorCodeManager/reactVisitorCodeManager.js.map +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useTrackConversion=useTrackConversion;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useTrackConversion(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(a){var c=a.visitorCode,d=a.goalId,e=a.revenue,f=a.isUniqueIdentifier;b.trackConversion({visitorCode:c,goalId:d,revenue:e,isUniqueIdentifier:f})},[b]);return{trackConversion:c}}
|
|
2
|
-
//# sourceMappingURL=useTrackConversion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTrackConversion.js","names":["useTrackConversion","a","useKameleoon","client","trackConversion","useCallback","visitorCode","goalId","revenue","isUniqueIdentifier"],"sources":["../src/useTrackConversion.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { TrackConversionParamsType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface ITrackConversionHookResult {\n /**\n * Creates and adds `Conversion` data to the visitor with specified parameters and executes `flushData`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter.\n *\n * @param {TrackConversionParamsType} params - `visitorCode`, `goalId`, `revenue` and `isUniqueIdentifier` parameters for data tracking.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data.\n */\n trackConversion: (params: TrackConversionParamsType) => void;\n}\n\n/**\n * A React Hook that returns trackConversion function which tracks conversion.\n *\n * @returns {ITrackConversionHookResult} an object containing the `trackConversion` function.\n */\nexport function useTrackConversion(): ITrackConversionHookResult {\n const { client } = useKameleoon();\n\n const trackConversion = useCallback(\n ({\n visitorCode,\n goalId,\n revenue,\n isUniqueIdentifier,\n }: TrackConversionParamsType): void => {\n client.trackConversion({\n visitorCode,\n goalId,\n revenue,\n isUniqueIdentifier,\n });\n },\n [client],\n );\n\n return {\n trackConversion,\n };\n}\n"],"mappings":"uLAuBO,QAAS,CAAAA,kBAAkBA,CAAA,CAA+B,KAAAC,CAAA,CAC5C,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAe,CAAG,GAAAC,kBAAW,EACjC,SAAAJ,CAAA,CAKuC,IAJrC,CAAAK,CAAW,CAAAL,CAAA,CAAXK,WAAW,CACXC,CAAM,CAAAN,CAAA,CAANM,MAAM,CACNC,CAAO,CAAAP,CAAA,CAAPO,OAAO,CACPC,CAAkB,CAAAR,CAAA,CAAlBQ,kBAAkB,CAElBN,CAAM,CAACC,eAAe,CAAC,CACrBE,WAAW,CAAXA,CAAW,CACXC,MAAM,CAANA,CAAM,CACNC,OAAO,CAAPA,CAAO,CACPC,kBAAkB,CAAlBA,CACF,CAAC,CACH,CAAC,CACD,CAACN,CAAM,CAAC,CACT,CAED,MAAO,CACLC,eAAe,CAAfA,CACF,CACF"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { FeatureFlagType } from '@kameleoon/javascript-sdk-core';
|
|
2
|
-
export interface IVisitorFeatureFlagsHookResult {
|
|
3
|
-
/**
|
|
4
|
-
* 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).
|
|
5
|
-
*
|
|
6
|
-
* @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.
|
|
7
|
-
* @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields.
|
|
8
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
9
|
-
*
|
|
10
|
-
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.
|
|
11
|
-
* - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
|
|
12
|
-
* - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
|
|
13
|
-
* - `KameleoonException.NotTargeted` - Current visitor is not targeted.
|
|
14
|
-
*/
|
|
15
|
-
getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A React Hook that returns `getVisitorFeatureFlags` function which returns a list of feature flags that the visitor with `visitorCode` that is targeted by.
|
|
19
|
-
*
|
|
20
|
-
* @returns {IVisitorFeatureFlagsHookResult} an object containing the `getVisitorFeatureFlags` function.
|
|
21
|
-
*/
|
|
22
|
-
export declare function useVisitorFeatureFlags(): IVisitorFeatureFlagsHookResult;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useVisitorFeatureFlags=useVisitorFeatureFlags;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function useVisitorFeatureFlags(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(a){return b.getVisitorFeatureFlags(a)},[b]);return{getVisitorFeatureFlags:c}}
|
|
2
|
-
//# sourceMappingURL=useVisitorFeatureFlags.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useVisitorFeatureFlags.js","names":["useVisitorFeatureFlags","a","useKameleoon","client","getVisitorFeatureFlags","useCallback","visitorCode"],"sources":["../src/useVisitorFeatureFlags.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { FeatureFlagType } from '@kameleoon/javascript-sdk-core';\nimport { useKameleoon } from './useKameleoon';\n\nexport interface IVisitorFeatureFlagsHookResult {\n /**\n * Returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).\n *\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted.\n */\n getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];\n}\n\n/**\n * A React Hook that returns `getVisitorFeatureFlags` function which returns a list of feature flags that the visitor with `visitorCode` that is targeted by.\n *\n * @returns {IVisitorFeatureFlagsHookResult} an object containing the `getVisitorFeatureFlags` function.\n */\nexport function useVisitorFeatureFlags(): IVisitorFeatureFlagsHookResult {\n const { client } = useKameleoon();\n\n const getVisitorFeatureFlags = useCallback(\n (visitorCode: string): FeatureFlagType[] => {\n return client.getVisitorFeatureFlags(visitorCode);\n },\n [client],\n );\n\n return {\n getVisitorFeatureFlags,\n };\n}\n"],"mappings":"+LAyBO,QAAS,CAAAA,sBAAsBA,CAAA,CAAmC,KAAAC,CAAA,CACpD,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAAsB,CAAG,GAAAC,kBAAW,EACxC,SAACC,CAAmB,CAAwB,CAC1C,MAAO,CAAAH,CAAM,CAACC,sBAAsB,CAACE,CAAW,CAClD,CAAC,CACD,CAACH,CAAM,CAAC,CACT,CAED,MAAO,CACLC,sBAAsB,CAAtBA,CACF,CACF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { GetVisitorWarehouseAudienceParamsType, CustomData } from '@kameleoon/javascript-sdk-core';
|
|
2
|
-
export interface IVisitorWarehouseAudienceHookResult {
|
|
3
|
-
/**
|
|
4
|
-
* An asynchronous method that returns a `CustomData` instance, containing data associated with a visitor's warehouse audiences
|
|
5
|
-
* which is stored for specified visitorCode on a remote Kameleoon server
|
|
6
|
-
* Retrieved data will be added to storage under the specified `customDataIndex`
|
|
7
|
-
*
|
|
8
|
-
* @param {GetVisitorWarehouseAudienceParamsType} parameters - an object with parameters of a type `GetVisitorWarehouseAudienceParamsType`, see the type for details
|
|
9
|
-
*
|
|
10
|
-
* @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`
|
|
11
|
-
* @throws `KameleoonError` with one of the following `type` s:
|
|
12
|
-
*
|
|
13
|
-
* - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
|
|
14
|
-
* - `KameleoonException.VisitorCodeEmpty` - The visitor code is empty
|
|
15
|
-
* - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server
|
|
16
|
-
*/
|
|
17
|
-
getVisitorWarehouseAudience: ({ visitorCode, customDataIndex, warehouseKey, }: GetVisitorWarehouseAudienceParamsType) => Promise<CustomData | null>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* A React Hook that returns asynchronous `getVisitorWarehouseAudience` function which retrieves warehouse audiences data
|
|
21
|
-
*
|
|
22
|
-
* @returns {IVisitorWarehouseAudienceHookResult} an object containing the `getVisitorWarehouseAudience` function.
|
|
23
|
-
*/
|
|
24
|
-
export declare function useVisitorWarehouseAudience(): IVisitorWarehouseAudienceHookResult;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.useVisitorWarehouseAudience=useVisitorWarehouseAudience;var _react=require("react"),_useKameleoon2=require("./useKameleoon");function _regeneratorRuntime(){"use strict";function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"==e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator.return&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),x},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),l(b),x},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function useVisitorWarehouseAudience(){var a=(0,_useKameleoon2.useKameleoon)(),b=a.client,c=(0,_react.useCallback)(function(){var a=_asyncToGenerator(_regeneratorRuntime().mark(function c(a){return _regeneratorRuntime().wrap(function d(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,b.getVisitorWarehouseAudience(a);case 2:return c.abrupt("return",c.sent);case 3:case"end":return c.stop();}},c)}));return function(b){return a.apply(this,arguments)}}(),[b]);return{getVisitorWarehouseAudience:c}}
|
|
2
|
-
//# sourceMappingURL=useVisitorWarehouseAudience.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useVisitorWarehouseAudience.js","names":["useVisitorWarehouseAudience","a","useKameleoon","client","getVisitorWarehouseAudience","useCallback","_asyncToGenerator","_regeneratorRuntime","mark","c","params","wrap","d","prev","next","abrupt","sent","stop","b","apply","arguments"],"sources":["../src/useVisitorWarehouseAudience.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useKameleoon } from './useKameleoon';\nimport {\n GetVisitorWarehouseAudienceParamsType,\n CustomData,\n} from '@kameleoon/javascript-sdk-core';\n\nexport interface IVisitorWarehouseAudienceHookResult {\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\n/**\n * A React Hook that returns asynchronous `getVisitorWarehouseAudience` function which retrieves warehouse audiences data\n *\n * @returns {IVisitorWarehouseAudienceHookResult} an object containing the `getVisitorWarehouseAudience` function.\n */\nexport function useVisitorWarehouseAudience(): IVisitorWarehouseAudienceHookResult {\n const { client } = useKameleoon();\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 getVisitorWarehouseAudience,\n };\n}\n"],"mappings":"k2OAkCO,QAAS,CAAAA,2BAA2BA,CAAA,CAAwC,KAAAC,CAAA,CAC9D,GAAAC,2BAAY,GAAE,CAAzBC,CAAM,CAAAF,CAAA,CAANE,MAAM,CAERC,CAA2B,CAAG,GAAAC,kBAAW,iBAAAJ,CAAA,CAAAK,iBAAA,CAAAC,mBAAA,GAAAC,IAAA,CAC7C,SAAAC,EACEC,CAA6C,SAAAH,mBAAA,GAAAI,IAAA,UAAAC,EAAAH,CAAA,iBAAAA,CAAA,CAAAI,IAAA,CAAAJ,CAAA,CAAAK,IAAA,gBAAAL,CAAA,CAAAK,IAAA,GAEhCX,CAAM,CAACC,2BAA2B,CAACM,CAAM,CAAC,eAAAD,CAAA,CAAAM,MAAA,UAAAN,CAAA,CAAAO,IAAA,0BAAAP,CAAA,CAAAQ,IAAA,MAAAR,CAAA,EACxD,mBAAAS,CAAA,SAAAjB,CAAA,CAAAkB,KAAA,MAAAC,SAAA,MACD,CAACjB,CAAM,CAAC,CACT,CAED,MAAO,CACLC,2BAA2B,CAA3BA,CACF,CACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ReactNativeVisitorCodeManagerConstructor",{enumerable:!0,get:function get(){return _reactNativeVisitorCodeManager.ReactNativeVisitorCodeManagerConstructor}}),Object.defineProperty(exports,"ReactVisitorCodeManagerConstructor",{enumerable:!0,get:function get(){return _reactVisitorCodeManager.ReactVisitorCodeManagerConstructor}});var _reactVisitorCodeManager=require("./reactVisitorCodeManager"),_reactNativeVisitorCodeManager=require("./reactNativeVisitorCodeManager");
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/visitorCodeManager/index.ts"],"sourcesContent":["export { ReactVisitorCodeManagerConstructor } from './reactVisitorCodeManager';\nexport { ReactNativeVisitorCodeManagerConstructor } from './reactNativeVisitorCodeManager';\n"],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { VisitorCodeManager } from '@kameleoon/javascript-sdk-core';
|
|
2
|
-
export declare class ReactNativeVisitorCodeManagerConstructor extends VisitorCodeManager {
|
|
3
|
-
private storage;
|
|
4
|
-
constructor();
|
|
5
|
-
obtainVisitorCode(defaultVisitorCode?: string): string;
|
|
6
|
-
getData(): string;
|
|
7
|
-
setData(visitorCode: string): void;
|
|
8
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReactNativeVisitorCodeManagerConstructor=void 0;var _javascriptSdkCore=require("@kameleoon/javascript-sdk-core"),_storage=require("../storage");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),b&&_setPrototypeOf(a,b)}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _possibleConstructorReturn(a,b){if(b&&("object"===_typeof(b)||"function"==typeof b))return b;if(void 0!==b)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var ReactNativeVisitorCodeManagerConstructor=function(a){function b(){var a;return _classCallCheck(this,b),a=c.call(this),_defineProperty(_assertThisInitialized(a),"storage",void 0),a.storage=new _storage.NativeStorageConstructor().initialize(_javascriptSdkCore.KameleoonStorageKey.VisitorCode),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"obtainVisitorCode",value:function obtainVisitorCode(a){return this.getVisitorCode({defaultVisitorCode:a,setData:this.setData.bind(this),getData:this.getData.bind(this)})}},{key:"getData",value:function getData(){var a=this.storage.read();return a.ok?a.data:""}},{key:"setData",value:function setData(a){this.storage.write(a)}}]),b}(_javascriptSdkCore.VisitorCodeManager);exports.ReactNativeVisitorCodeManagerConstructor=ReactNativeVisitorCodeManagerConstructor;
|
|
2
|
-
//# sourceMappingURL=reactNativeVisitorCodeManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactNativeVisitorCodeManager.js","names":["ReactNativeVisitorCodeManagerConstructor","a","b","_classCallCheck","c","call","_defineProperty","_assertThisInitialized","storage","NativeStorageConstructor","initialize","KameleoonStorageKey","VisitorCode","_inherits","_createSuper","_createClass","key","value","obtainVisitorCode","defaultVisitorCode","getVisitorCode","setData","bind","getData","readResult","read","ok","data","visitorCode","write","VisitorCodeManager","exports"],"sources":["../../src/visitorCodeManager/reactNativeVisitorCodeManager.ts"],"sourcesContent":["import {\n VisitorCodeManager,\n IExternalStorage,\n KameleoonStorageKey,\n} from '@kameleoon/javascript-sdk-core';\nimport { NativeStorageConstructor } from 'src/storage';\n\nexport class ReactNativeVisitorCodeManagerConstructor extends VisitorCodeManager {\n private storage: IExternalStorage<string>;\n\n constructor() {\n super();\n\n this.storage = new NativeStorageConstructor().initialize<string>(\n KameleoonStorageKey.VisitorCode,\n );\n }\n\n public obtainVisitorCode(defaultVisitorCode?: string): string {\n return this.getVisitorCode({\n defaultVisitorCode,\n setData: this.setData.bind(this),\n getData: this.getData.bind(this),\n });\n }\n\n public getData(): string {\n const readResult = this.storage.read();\n\n if (readResult.ok) {\n return readResult.data;\n }\n\n return '';\n }\n\n public setData(visitorCode: string): void {\n // --- Note ---\n // `write` result is ignored because there is no exceptions for `mmkv` write operation\n this.storage.write(visitorCode);\n }\n}\n"],"mappings":"w9FAOa,CAAAA,wCAAwC,UAAAC,CAAA,EAGnD,SAAAC,EAAA,CAAc,KAAAD,CAAA,QAAAE,eAAA,MAAAD,CAAA,EAAAD,CAAA,CAAAG,CAAA,CAAAC,IAAA,OAAAC,eAAA,CAAAC,sBAAA,CAAAN,CAAA,oBAGZA,CAAA,CAAKO,OAAO,CAAG,GAAI,CAAAC,iCAAwB,EAAE,CAACC,UAAU,CACtDC,sCAAmB,CAACC,WAAW,CAChC,CAAAX,CACH,CAACY,SAAA,CAAAX,CAAA,CAAAD,CAAA,MAAAG,CAAA,CAAAU,YAAA,CAAAZ,CAAA,SAAAa,YAAA,CAAAb,CAAA,GAAAc,GAAA,qBAAAC,KAAA,CAED,SAAAC,kBAAyBC,CAA2B,CAAU,CAC5D,MAAO,KAAI,CAACC,cAAc,CAAC,CACzBD,kBAAkB,CAAlBA,CAAkB,CAClBE,OAAO,CAAE,IAAI,CAACA,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC,CAChCC,OAAO,CAAE,IAAI,CAACA,OAAO,CAACD,IAAI,CAAC,IAAI,CACjC,CAAC,CACH,CAAC,GAAAN,GAAA,WAAAC,KAAA,CAED,SAAAM,QAAA,CAAyB,CACvB,GAAM,CAAAC,CAAU,CAAG,IAAI,CAAChB,OAAO,CAACiB,IAAI,EAAE,CAAC,MAEnC,CAAAD,CAAU,CAACE,EAAE,CACRF,CAAU,CAACG,IAAI,CAGjB,EACT,CAAC,GAAAX,GAAA,WAAAC,KAAA,CAED,SAAAI,QAAeO,CAAmB,CAAQ,CAGxC,IAAI,CAACpB,OAAO,CAACqB,KAAK,CAACD,CAAW,CAChC,CAAC,IAAA1B,CAAA,EAjC2D4B,qCAAkB,EAAAC,OAAA,CAAA/B,wCAAA,CAAAA,wCAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { VisitorCodeManager } from '@kameleoon/javascript-sdk-core';
|
|
2
|
-
export declare class ReactVisitorCodeManagerConstructor extends VisitorCodeManager {
|
|
3
|
-
private domain?;
|
|
4
|
-
constructor(domain?: string);
|
|
5
|
-
obtainVisitorCode(defaultVisitorCode?: string): string;
|
|
6
|
-
getData(): string;
|
|
7
|
-
setData(visitorCode: string): void;
|
|
8
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var _javascriptSdkCore=require("@kameleoon/javascript-sdk-core");Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReactVisitorCodeManagerConstructor=void 0;function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),b&&_setPrototypeOf(a,b)}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _possibleConstructorReturn(a,b){if(b&&("object"===_typeof(b)||"function"==typeof b))return b;if(void 0!==b)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var ReactVisitorCodeManagerConstructor=function(a){function b(a){var d;return _classCallCheck(this,b),d=c.call(this),_defineProperty(_assertThisInitialized(d),"domain",void 0),d.domain=a,d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"obtainVisitorCode",value:function obtainVisitorCode(a){return this.getVisitorCode({defaultVisitorCode:a,setData:this.setData.bind(this),getData:this.getData.bind(this)})}},{key:"getData",value:function getData(){var a=document.cookie;if(a){var b=this.getCookieVisitorCode(a);if(b.ok&&b.data)return b.data}return""}},{key:"setData",value:function setData(a){var b=this.getResultCookie({domain:this.domain,visitorCode:a});document.cookie=b}}]),b}(_javascriptSdkCore.VisitorCodeManager);exports.ReactVisitorCodeManagerConstructor=ReactVisitorCodeManagerConstructor;
|
|
2
|
-
//# sourceMappingURL=reactVisitorCodeManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactVisitorCodeManager.js","names":["_javascriptSdkCore","require","Object","defineProperty","exports","value","ReactVisitorCodeManagerConstructor","_typeof","a","Symbol","iterator","constructor","prototype","_classCallCheck","b","TypeError","_defineProperties","c","d","length","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_inherits","create","_setPrototypeOf","setPrototypeOf","bind","__proto__","_createSuper","_isNativeReflectConstruct","_getPrototypeOf","e","Reflect","construct","arguments","apply","_possibleConstructorReturn","_assertThisInitialized","ReferenceError","sham","Proxy","Boolean","valueOf","call","getPrototypeOf","_defineProperty","_toPrimitive","toPrimitive","String","Number","domain","obtainVisitorCode","defaultVisitorCode","getVisitorCode","setData","getData","cookie","document","visitorCodeResult","getCookieVisitorCode","ok","data","visitorCode","resultCookie","getResultCookie","VisitorCodeManager"],"sources":["../../src/visitorCodeManager/reactVisitorCodeManager.ts"],"sourcesContent":["import { VisitorCodeManager } from '@kameleoon/javascript-sdk-core';\n\nexport class ReactVisitorCodeManagerConstructor extends VisitorCodeManager {\n private domain?: string;\n\n constructor(domain?: string) {\n super();\n\n this.domain = domain;\n }\n\n public obtainVisitorCode(defaultVisitorCode?: string): string {\n return this.getVisitorCode({\n defaultVisitorCode,\n setData: this.setData.bind(this),\n getData: this.getData.bind(this),\n });\n }\n\n public getData(): string {\n const cookie = document.cookie;\n\n if (cookie) {\n const visitorCodeResult = this.getCookieVisitorCode(cookie);\n\n if (visitorCodeResult.ok && visitorCodeResult.data) {\n return visitorCodeResult.data;\n }\n }\n\n return '';\n }\n\n public setData(visitorCode: string): void {\n const resultCookie = this.getResultCookie({\n domain: this.domain,\n visitorCode,\n });\n\n document.cookie = resultCookie;\n }\n}\n"],"mappings":"aAAA,IAAAA,kBAAA,CAAAC,OAAA,mCAAoEC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,kCAAA,iBAAAC,QAAAC,CAAA,mCAAAD,OAAA,oBAAAE,MAAA,mBAAAA,MAAA,CAAAC,QAAA,UAAAF,CAAA,gBAAAA,CAAA,WAAAA,CAAA,SAAAA,CAAA,qBAAAC,MAAA,EAAAD,CAAA,CAAAG,WAAA,G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