@kameleoon/react-sdk 10.0.2 → 10.1.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 CHANGED
@@ -1,5 +1,49 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.1.0 (2024-11-14)
4
+
5
+ ### Features
6
+
7
+ - Enhanced top-level domain validation within the SDK. The implementation now includes automatic trimming of extraneous symbols.
8
+ - Enhanced [`logging`][logging]:
9
+ - Introduced [`log levels`][loglevels]:
10
+ - `None`
11
+ - `Error`
12
+ - `Warning`
13
+ - `Info`
14
+ - `Debug`
15
+ - Added support for [`custom logger`][customlogger] implementations.
16
+ - Introduced new evaluation methods for clarity and improved efficiency when working with the SDK:
17
+ - [`getVariation`][getVariation]
18
+ - [`getVariations`][getVariations]
19
+ - Introduced methods replace the deprecated ones:
20
+ - [`getFeatureFlags`][getFeatureFlags]
21
+ - [`getVisitorFeatureFlags`][getVisitorFeatureFlags]
22
+ - [`getActiveFeatureFlags`][getActiveFeatureFlags]
23
+ - [`getFeatureFlagVariationKey`][getFeatureFlagVariationKey]
24
+ - [`getFeatureFlagVariable`][getFeatureFlagVariable]
25
+ - [`getFeatureFlagVariables`][getFeatureFlagVariables]
26
+ - A new version of the [`isFeatureFlagActive`][isFeatureFlagActive] method now has a new overload, which contains an optional `track` parameter for managing the assigned variation tracking (default: `true`).
27
+
28
+ ### Patch Changes
29
+
30
+ - [`UniqueIdentifier`][uniqueidentifier] data is now correctly exported from the SDK
31
+ - Updated dependencies
32
+ - @kameleoon/javascript-sdk@4.1.0
33
+
34
+ [getVariation]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#getvariation
35
+ [getVariations]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#getvariations
36
+ [getFeatureFlags]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#getfeatureflags
37
+ [getVisitorFeatureFlags]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#getvisitorfeatureflags
38
+ [getActiveFeatureFlags]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#getactivefeatureflags
39
+ [getFeatureFlagVariationKey]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#getfeatureflagvariationkey
40
+ [getFeatureFlagVariable]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#getfeatureflagvariable
41
+ [getFeatureFlagVariables]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#getfeatureflagvariables
42
+ [isFeatureFlagActive]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#isfeatureflagactive
43
+ [logging]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#logging
44
+ [loglevels]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#log-levels
45
+ [customlogger]: https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/react-js-sdk#custom-handling-of-logs
46
+
3
47
  ## 10.0.2 (2024-11-08)
4
48
 
5
49
  ### Patch Changes
@@ -1,2 +1 @@
1
- "use strict";var _react=_interopRequireDefault(require("react"));Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonContext=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}const KameleoonContext=exports.KameleoonContext=_react.default.createContext(null);
2
- //# sourceMappingURL=KameleoonContext.js.map
1
+ "use strict";var _react=_interopRequireDefault(require("react"));Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonContext=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}const KameleoonContext=exports.KameleoonContext=_react.default.createContext(null);
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireDefault(require("react")),_KameleoonContext=require("./KameleoonContext");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function KameleoonProvider(a){let{client:b,children:c}=a;return _react.default.createElement(_KameleoonContext.KameleoonContext.Provider,{value:b},c)}var _default=exports.default=_react.default.memo(KameleoonProvider);
2
- //# sourceMappingURL=KameleoonProvider.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireDefault(require("react")),_KameleoonContext=require("./KameleoonContext");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function KameleoonProvider(a){let{client:b,children:c}=a;return _react.default.createElement(_KameleoonContext.KameleoonContext.Provider,{value:b},c)}var _default=exports.default=_react.default.memo(KameleoonProvider);
@@ -1,2 +1 @@
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.2"},prng:null===d||void 0===d?void 0:d.prng}});return e}
2
- //# sourceMappingURL=createClient.js.map
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.1.0"},prng:null===d||void 0===d?void 0:d.prng}});return e}
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";var _exportNames={KameleoonProvider:!0,IKameleoonProviderProps:!0,useData:!0,useFeatureFlag:!0,useInitialize:!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"),_useFeatureFlag=require("./useFeatureFlag"),_useInitialize=require("./useInitialize"),_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
- //# sourceMappingURL=index.js.map
1
+ "use strict";var _exportNames={KameleoonProvider:!0,IKameleoonProviderProps:!0,useData:!0,useFeatureFlag:!0,useInitialize:!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"),_useFeatureFlag=require("./useFeatureFlag"),_useInitialize=require("./useInitialize"),_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}
@@ -1,2 +1 @@
1
- "use strict";
2
- //# sourceMappingURL=useData.js.map
1
+ "use strict";
@@ -1,25 +1,78 @@
1
- import { FeatureFlagType, KameleoonVariationType, FeatureFlagVariableType, FeatureVariableResultType, GetFeatureFlagVariableParamsType } from '@kameleoon/javascript-sdk';
1
+ import { FeatureFlagType, KameleoonVariationType, FeatureFlagVariableType, FeatureVariableResultType, GetFeatureFlagVariableParamsType, GetVariationsParamsType, VariationType, GetVariationParamsType, IsFeatureFlagActiveParamsType } from '@kameleoon/javascript-sdk';
2
2
  export default interface IUseFeatureFlag {
3
3
  /**
4
- * Indicates whether the visitor with `visitorCode` has `featureKey` active for him, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request.
4
+ * Returns a variation for the visitor under `visitorCode` for the specified `featureKye`, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage
5
+ *
6
+ * Note: This method **sends** tracking data by default, but you can disable it by setting `track` to `false`
7
+ * Triggered Events: `EventType.Evaluation`
8
+ *
9
+ * @param {GetVariationParamsType} parameters - an object with parameters of a type `GetVariationParamsType`, see the type for details.
10
+ *
11
+ * @returns {VariationType} a variation object containing feature flag `key`, `id`, `experimentId` and `variables`, which is a `Map` of variable keys and values
12
+ * @throws `KameleoonError` with one of the following `type` s:
13
+ *
14
+ * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
15
+ * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
16
+ * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call
17
+ * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`
18
+ * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment
19
+ * */
20
+ getVariation: ({ visitorCode, featureKey, track, }: GetVariationParamsType) => VariationType;
21
+ /**
22
+ * Returns all variations for the visitor under `visitorCode` for all the feature flags, this method includes targeting check, finding the according variations exposed to the visitor and saving them to storage. By default the method obtains all the variations, but if `onlyActive` is set to `true`, only active variations will be returned (those that are not `off`)
23
+ *
24
+ * Note: This method **sends** tracking data by default, but you can disable it by setting `track` to `false`
25
+ * Triggered Events: `EventType.Evaluation` (For each feature flag evaluated)
26
+ *
27
+ * @param {GetVariationsParamsType} parameters - an object with parameters of a type `GetVariationsParamsType`, see the type for details.
28
+ *
29
+ * @returns {Map<string, VariationType>} a `Map` with variation keys and values, each value contains an object with feature flag `key`, `id`, `experimentId` and `variables`, which is a `Map` of variable keys and values
30
+ * @throws `KameleoonError` with one of the following `type` s:
31
+ *
32
+ * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
33
+ * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
34
+ * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call
35
+ */
36
+ getVariations: ({ visitorCode, onlyActive, track, }: GetVariationsParamsType) => Map<string, VariationType>;
37
+ /**
38
+ * @deprecated this method overload is deprecated and will be removed in the next major release. Please use `isFeatureFlagActive` overload with an object parameters instead.
39
+ * 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
5
40
  *
6
41
  * Note: This method **sends** tracking data
7
42
  * Triggered Events: `EventType.Evaluation`
8
43
  *
9
- * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length.
10
- * @param {string} featureKey - a unique key for feature flag.
11
- * @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`.
44
+ * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
45
+ * @param {string} featureKey - a unique key for feature flag
46
+ * @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`
12
47
  * @throws `KameleoonError` with one of the following `type` s:
13
48
  *
14
- * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.
49
+ * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
15
50
  * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
16
- * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
17
- * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`.
51
+ * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call
52
+ * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`
53
+ * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.
54
+ */
55
+ isFeatureFlagActive(visitorCode: string, featureKey: string): boolean;
56
+ /**
57
+ * 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
58
+ *
59
+ * Note: This method **sends** tracking data, unless `track` is set to `false`
60
+ * Triggered Events: `EventType.Evaluation`
61
+ *
62
+ * @param {IsFeatureFlagActiveParamsType} parameters - an object with parameters of a type `IsFeatureFlagActiveParamsType`, see the type for details.
63
+ * @throws `KameleoonError` with one of the following `type` s:
64
+ *
65
+ * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
66
+ * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
67
+ * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call
68
+ * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`
18
69
  * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.
19
- * - `KameleoonException.NotTargeted` - Current visitor is not targeted.
20
70
  */
21
- isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;
71
+ isFeatureFlagActive({ visitorCode, featureKey, track, }: IsFeatureFlagActiveParamsType): boolean;
72
+ isFeatureFlagActive(firstParam: string | IsFeatureFlagActiveParamsType, secondParam?: string): boolean;
22
73
  /**
74
+ * @deprecated this method is deprecated and will be removed in the next major release. Please use `getVariation` instead.
75
+ *
23
76
  * 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.
24
77
  *
25
78
  *
@@ -35,10 +88,11 @@ export default interface IUseFeatureFlag {
35
88
  * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
36
89
  * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
37
90
  * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`.
38
- * - `KameleoonException.NotTargeted` - Current visitor is not targeted.
39
91
  */
40
92
  getFeatureFlagVariationKey: (visitorCode: string, featureKey: string) => string;
41
93
  /**
94
+ * @deprecated this method is deprecated and will be removed in the next major release. Please use `getVariation` instead.
95
+ *
42
96
  * 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.
43
97
  *
44
98
  * Note: This method **sends** tracking data
@@ -53,12 +107,13 @@ export default interface IUseFeatureFlag {
53
107
  * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
54
108
  * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`.
55
109
  * - `KameleoonException.FeatureFlagVariableNotFound` - No feature variable was found for provided `visitorCode` and `variableKey`
56
- * - `KameleoonException.NotTargeted` - Current visitor is not targeted.
57
110
  * - `KameleoonException.JSONParse` - Couldn't pass JSON value.
58
111
  * - `KameleoonException.NumberParse` - Couldn't pass Number value.
59
112
  */
60
113
  getFeatureFlagVariable: (params: GetFeatureFlagVariableParamsType) => FeatureFlagVariableType;
61
114
  /**
115
+ * @deprecated this method is deprecated and will be removed in the next major release. Please use `getVariations` instead.
116
+ *
62
117
  * 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).
63
118
  *
64
119
  *
@@ -72,11 +127,12 @@ export default interface IUseFeatureFlag {
72
127
  * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded.
73
128
  * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty
74
129
  * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call.
75
- * - `KameleoonException.NotTargeted` - Current visitor is not targeted.
76
130
  */
77
131
  getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];
78
132
  /**
79
- * @method getActiveFeatureFlags - method collecting all active feature flags information including it's variation and variables for the visitor
133
+ * @deprecated this method is deprecated and will be removed in the next major release. Please use `getVariations` instead.
134
+ *
135
+ * Collects all active feature flags information including it's variation and variables for the visitor
80
136
  *
81
137
  *
82
138
  * Note: This method **doesn't send** tracking data
@@ -96,6 +152,8 @@ export default interface IUseFeatureFlag {
96
152
  */
97
153
  getActiveFeatureFlags: (visitorCode: string) => Map<string, KameleoonVariationType>;
98
154
  /**
155
+ * @deprecated this method is deprecated and will be removed in the next major release. Please use `getVariations` instead.
156
+ *
99
157
  * Returns a list of feature flags stored in the client configuration.
100
158
  *
101
159
  * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields.
@@ -107,6 +165,8 @@ export default interface IUseFeatureFlag {
107
165
  */
108
166
  getFeatureFlags: () => FeatureFlagType[];
109
167
  /**
168
+ * @deprecated this method is deprecated and will be removed in the next major release. Please use `getVariation` instead.
169
+ *
110
170
  * 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.
111
171
  *
112
172
  *
@@ -1,2 +1 @@
1
- "use strict";
2
- //# sourceMappingURL=useFeatureFlag.js.map
1
+ "use strict";
@@ -1,2 +1 @@
1
- "use strict";
2
- //# sourceMappingURL=useInitialize.js.map
1
+ "use strict";
@@ -0,0 +1,10 @@
1
+ import { LogLevel } from '@kameleoon/javascript-sdk-core';
2
+ export default interface IUseLog {
3
+ /**
4
+ * @method setLogLevel - sets the log level for the Kameleoon SDK
5
+ *
6
+ * @param {LogLevel} logLevel - a log level to be set
7
+ * @returns {void}
8
+ */
9
+ setLogLevel: (logLevel: LogLevel) => void;
10
+ }
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,2 +1 @@
1
- "use strict";
2
- //# sourceMappingURL=useVisitorCode.js.map
1
+ "use strict";
package/dist/types.d.ts CHANGED
@@ -8,6 +8,7 @@ export type ExternalsType = CoreExternalsType & {
8
8
  * @param {IExternalVisitorCodeManager | undefined} visitorCodeManager - external visitor code manager implementation
9
9
  * @param {IExternalRequester | undefined} requester - external requester implementation
10
10
  * @param {IExternalPRNG | undefined} prng - external PRNG implementation
11
+ * @param {IExternalLogger | undefined} logger - external logger implementation
11
12
  * */
12
13
  export type SDKParameters = Omit<CoreSDKParameters, '_internals'> & {
13
14
  externals?: ExternalsType;
package/dist/types.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
2
- //# sourceMappingURL=types.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
package/dist/useData.js CHANGED
@@ -1,2 +1 @@
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
- //# sourceMappingURL=useData.js.map
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}}
@@ -5,6 +5,8 @@ import IUseFeatureFlag from './interfaces/useFeatureFlag';
5
5
  *
6
6
  * @returns {IUseFeatureFlag} an object containing the following methods:
7
7
  * - `isFeatureFlagActive`,
8
+ * - `getVariation`
9
+ * - `getVariations`
8
10
  * - `getFeatureFlagVariationKey`,
9
11
  * - `getFeatureFlagVariable`,
10
12
  * - `getVisitorFeatureFlags`,
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFeatureFlag=useFeatureFlag;var _react=require("react"),_useKameleoon=require("./useKameleoon");function useFeatureFlag(){const a=(0,_useKameleoon.useKameleoon)(),b=(0,_react.useCallback)((b,c)=>a.isFeatureFlagActive(b,c),[a]),c=(0,_react.useCallback)((b,c)=>a.getFeatureFlagVariationKey(b,c),[a]),d=(0,_react.useCallback)(b=>{let{visitorCode:c,featureKey:d,variableKey:e}=b;return a.getFeatureFlagVariable({visitorCode:c,featureKey:d,variableKey:e})},[a]),e=(0,_react.useCallback)(b=>a.getVisitorFeatureFlags(b),[a]),f=(0,_react.useCallback)(b=>a.getActiveFeatureFlags(b),[a]),g=(0,_react.useCallback)(()=>a.getFeatureFlags(),[a]),h=(0,_react.useCallback)((b,c)=>a.getFeatureFlagVariables(b,c),[a]),i=(0,_react.useCallback)(b=>a.getEngineTrackingCode(b),[a]);return{getActiveFeatureFlags:f,getFeatureFlags:g,isFeatureFlagActive:b,getEngineTrackingCode:i,getVisitorFeatureFlags:e,getFeatureFlagVariable:d,getFeatureFlagVariables:h,getFeatureFlagVariationKey:c}}
2
- //# sourceMappingURL=useFeatureFlag.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFeatureFlag=useFeatureFlag;var _react=require("react"),_useKameleoon=require("./useKameleoon");function useFeatureFlag(){const a=(0,_useKameleoon.useKameleoon)(),b=(0,_react.useCallback)((b,c)=>{if("string"==typeof b){if(!c)throw new Error("[Kameleoon React SDK Error]: Overload is not used correctly. The second parameter must be provided when the first parameter is a string");return a.isFeatureFlagActive(b,c)}return a.isFeatureFlagActive(b)},[a]),c=(0,_react.useCallback)(b=>{let{visitorCode:c,featureKey:d,track:e}=b;return a.getVariation({visitorCode:c,featureKey:d,track:e})},[a]),d=(0,_react.useCallback)(b=>{let{visitorCode:c,onlyActive:d,track:e}=b;return a.getVariations({visitorCode:c,onlyActive:d,track:e})},[a]),e=(0,_react.useCallback)((b,c)=>a.getFeatureFlagVariationKey(b,c),[a]),f=(0,_react.useCallback)(b=>{let{visitorCode:c,featureKey:d,variableKey:e}=b;return a.getFeatureFlagVariable({visitorCode:c,featureKey:d,variableKey:e})},[a]),g=(0,_react.useCallback)(b=>a.getVisitorFeatureFlags(b),[a]),h=(0,_react.useCallback)(b=>a.getActiveFeatureFlags(b),[a]),i=(0,_react.useCallback)(()=>a.getFeatureFlags(),[a]),j=(0,_react.useCallback)((b,c)=>a.getFeatureFlagVariables(b,c),[a]),k=(0,_react.useCallback)(b=>a.getEngineTrackingCode(b),[a]);return{getActiveFeatureFlags:h,getVariation:c,getVariations:d,getFeatureFlags:i,isFeatureFlagActive:b,getEngineTrackingCode:k,getVisitorFeatureFlags:g,getFeatureFlagVariable:f,getFeatureFlagVariables:j,getFeatureFlagVariationKey:e}}
@@ -1,2 +1 @@
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
- //# sourceMappingURL=useInitialize.js.map
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}}
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useKameleoon=useKameleoon;var _react=require("react"),_KameleoonContext=require("./KameleoonContext");function useKameleoon(){const a=(0,_react.useContext)(_KameleoonContext.KameleoonContext);if(!a)throw new Error("Kameleoon SDK hooks must be used within a KameleoonProvider");return a}
2
- //# sourceMappingURL=useKameleoon.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useKameleoon=useKameleoon;var _react=require("react"),_KameleoonContext=require("./KameleoonContext");function useKameleoon(){const a=(0,_react.useContext)(_KameleoonContext.KameleoonContext);if(!a)throw new Error("Kameleoon SDK hooks must be used within a KameleoonProvider");return a}
@@ -0,0 +1,8 @@
1
+ import IUseLog from "./interfaces/useLog";
2
+ /**
3
+ * A React Hook that returns methods related to logging
4
+ *
5
+ * @returns {IUseLog} an object containing the following methods:
6
+ * - `setLogLevel`
7
+ */
8
+ export declare function useLog(): IUseLog;
package/dist/useLog.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useLog=useLog;var _react=require("react"),_useKameleoon=require("./useKameleoon");function useLog(){const a=(0,_useKameleoon.useKameleoon)(),b=(0,_react.useCallback)(b=>{a.setLogLevel(b)},[a]);return{setLogLevel:b}}
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useVisitorCode=useVisitorCode;var _react=require("react"),_useKameleoon=require("./useKameleoon");function useVisitorCode(){const a=(0,_useKameleoon.useKameleoon)(),b=(0,_react.useCallback)((b,c)=>{a.setLegalConsent(b,c)},[a]),c=(0,_react.useCallback)(b=>a.getVisitorCode(b),[]);return{setLegalConsent:b,getVisitorCode:c}}
2
- //# sourceMappingURL=useVisitorCode.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useVisitorCode=useVisitorCode;var _react=require("react"),_useKameleoon=require("./useKameleoon");function useVisitorCode(){const a=(0,_useKameleoon.useKameleoon)(),b=(0,_react.useCallback)((b,c)=>{a.setLegalConsent(b,c)},[a]),c=(0,_react.useCallback)(b=>a.getVisitorCode(b),[]);return{setLegalConsent:b,getVisitorCode:c}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kameleoon/react-sdk",
3
- "version": "10.0.2",
3
+ "version": "10.1.0",
4
4
  "description": "Kameleoon React SDK",
5
5
  "files": [
6
6
  "dist"
@@ -11,8 +11,10 @@
11
11
  "clean": "rimraf dist && rimraf tsconfig.tsbuildinfo",
12
12
  "dev": "npm run clean && tsc -w -p tsconfig.watch.json",
13
13
  "build": "npm run clean && npm run build:types && npm run build:js",
14
+ "build:test": "npm run clean && npm run build:js-source-maps",
14
15
  "build:types": "tsc --emitDeclarationOnly",
15
- "build:js": "babel src --out-dir dist --extensions \".ts,.tsx\" --source-maps true",
16
+ "build:js": "babel src --out-dir dist --extensions \".ts,.tsx\"",
17
+ "build:js-source-maps": "babel src --out-dir dist --extensions \".ts,.tsx\" --source-maps true",
16
18
  "deploy": "/bin/bash ../../scripts/deploy.sh react-sdk",
17
19
  "deploy-nexus": "/bin/bash ../../scripts/deploy_nexus.sh react-sdk",
18
20
  "update-documentation": "/bin/bash ../../scripts/update_documentation.sh react-sdk",
@@ -36,7 +38,7 @@
36
38
  ],
37
39
  "license": "ISC",
38
40
  "dependencies": {
39
- "@kameleoon/javascript-sdk": "4.0.2"
41
+ "@kameleoon/javascript-sdk": "4.1.0"
40
42
  },
41
43
  "peerDependencies": {
42
44
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
@@ -1 +0,0 @@
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 +0,0 @@
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":[]}
@@ -1 +0,0 @@
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.map DELETED
@@ -1 +0,0 @@
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 { useFeatureFlag } from './useFeatureFlag';\nexport { useInitialize } from './useInitialize';\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":"0SAAA,IAAAA,cAAA,CAAAC,OAAA,8BAA0CC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAH,MAAA,CAAAC,cAAA,CAAAC,OAAA,kBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAC,MAAA,CAAAC,aAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAC,OAAA,4BAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAG,kBAAA,CAAAC,uBAAA,IAAAT,MAAA,CAAAC,cAAA,CAAAC,OAAA,aAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAK,SAAA,CAAAC,OAAA,IAAAX,MAAA,CAAAC,cAAA,CAAAC,OAAA,oBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAO,gBAAA,CAAAD,OAAA,IAAAX,MAAA,CAAAC,cAAA,CAAAC,OAAA,mBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAQ,eAAA,CAAAF,OAAA,IAAAX,MAAA,CAAAC,cAAA,CAAAC,OAAA,oBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAS,gBAAA,CAAAH,OAAA,IAAAX,MAAA,CAAAC,cAAA,CAAAC,OAAA,qBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAU,iBAAA,CAAAC,gBAAA,IAAAhB,MAAA,CAAAC,cAAA,CAAAC,OAAA,sBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAG,kBAAA,CAAAG,OAAA,IAAAX,MAAA,CAAAC,cAAA,CAAAC,OAAA,kBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAC,MAAA,CAAAW,aAAA,IAAAjB,MAAA,CAAAC,cAAA,CAAAC,OAAA,iBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAa,aAAA,CAAAC,YAAA,IAAAnB,MAAA,CAAAC,cAAA,CAAAC,OAAA,YAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAe,QAAA,CAAAC,OAAA,IAAArB,MAAA,CAAAC,cAAA,CAAAC,OAAA,mBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAiB,eAAA,CAAAC,cAAA,IAAAvB,MAAA,CAAAC,cAAA,CAAAC,OAAA,kBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAmB,cAAA,CAAAC,aAAA,IAAAzB,MAAA,CAAAC,cAAA,CAAAC,OAAA,iBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAqB,aAAA,CAAAC,YAAA,IAAA3B,MAAA,CAAAC,cAAA,CAAAC,OAAA,mBAAAE,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAuB,eAAA,CAAAC,cAAA,IAAA7B,MAAA,CAAA8B,IAAA,CAAAhC,cAAA,EAAAiC,OAAA,UAAAC,CAAA,cAAAA,CAAA,iBAAAA,CAAA,EAAAhC,MAAA,CAAAiC,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,CAAAJ,CAAA,GAAAA,CAAA,IAAA9B,OAAA,EAAAA,OAAA,CAAA8B,CAAA,IAAAlC,cAAA,CAAAkC,CAAA,GAAAhC,MAAA,CAAAC,cAAA,CAAAC,OAAA,CAAA8B,CAAA,EAAA5B,UAAA,IAAAC,GAAA,SAAAA,CAAA,SAAAP,cAAA,CAAAkC,CAAA,WAAAxB,kBAAA,CAAA6B,uBAAA,CAAAtC,OAAA,yBAAAqB,QAAA,CAAArB,OAAA,cAAAuB,eAAA,CAAAvB,OAAA,qBAAAyB,cAAA,CAAAzB,OAAA,oBAAA6B,eAAA,CAAA7B,OAAA,qBAAAW,SAAA,CAAA4B,sBAAA,CAAAvC,OAAA,0BAAAc,eAAA,CAAAyB,sBAAA,CAAAvC,OAAA,gCAAAa,gBAAA,CAAA0B,sBAAA,CAAAvC,OAAA,iCAAAe,gBAAA,CAAAwB,sBAAA,CAAAvC,OAAA,iCAAAgB,iBAAA,CAAAhB,OAAA,uBAAA2B,aAAA,CAAA3B,OAAA,mBAAAmB,aAAA,CAAAnB,OAAA,mBAAAO,MAAA,CAAAP,OAAA,qBAAAuC,uBAAAN,CAAA,SAAAA,CAAA,EAAAA,CAAA,CAAAO,UAAA,CAAAP,CAAA,EAAArB,OAAA,CAAAqB,CAAA,WAAAQ,yBAAAR,CAAA,wBAAAS,OAAA,iBAAAC,CAAA,KAAAD,OAAA,CAAAE,CAAA,KAAAF,OAAA,QAAAD,wBAAA,SAAAA,CAAAR,CAAA,SAAAA,CAAA,CAAAW,CAAA,CAAAD,CAAA,GAAAV,CAAA,WAAAK,wBAAAK,CAAA,CAAAC,CAAA,MAAAA,CAAA,EAAAD,CAAA,EAAAA,CAAA,CAAAH,UAAA,QAAAG,CAAA,WAAAA,CAAA,mBAAAA,CAAA,qBAAAA,CAAA,QAAA/B,OAAA,CAAA+B,CAAA,MAAAE,CAAA,CAAAJ,wBAAA,CAAAG,CAAA,KAAAC,CAAA,EAAAA,CAAA,CAAAC,GAAA,CAAAH,CAAA,SAAAE,CAAA,CAAAvC,GAAA,CAAAqC,CAAA,MAAAI,CAAA,EAAAC,SAAA,OAAAC,CAAA,CAAAhD,MAAA,CAAAC,cAAA,EAAAD,MAAA,CAAAiD,wBAAA,SAAAjB,CAAA,IAAAU,CAAA,eAAAV,CAAA,KAAAE,cAAA,CAAAC,IAAA,CAAAO,CAAA,CAAAV,CAAA,OAAAkB,CAAA,CAAAF,CAAA,CAAAhD,MAAA,CAAAiD,wBAAA,CAAAP,CAAA,CAAAV,CAAA,OAAAkB,CAAA,GAAAA,CAAA,CAAA7C,GAAA,EAAA6C,CAAA,CAAAC,GAAA,EAAAnD,MAAA,CAAAC,cAAA,CAAA6C,CAAA,CAAAd,CAAA,CAAAkB,CAAA,EAAAJ,CAAA,CAAAd,CAAA,EAAAU,CAAA,CAAAV,CAAA,SAAAc,CAAA,CAAAnC,OAAA,CAAA+B,CAAA,CAAAE,CAAA,EAAAA,CAAA,CAAAO,GAAA,CAAAT,CAAA,CAAAI,CAAA,EAAAA,CAAA","ignoreList":[]}
@@ -1 +0,0 @@
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 +0,0 @@
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":[]}
@@ -1 +0,0 @@
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 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
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":[]}
@@ -1 +0,0 @@
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 +0,0 @@
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":[]}
@@ -1 +0,0 @@
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":[]}
@@ -1 +0,0 @@
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 +0,0 @@
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":[]}