@kameleoon/react-sdk 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/Feature.d.ts +11 -0
  2. package/dist/Feature.js +26 -0
  3. package/dist/Feature.js.map +1 -0
  4. package/dist/KameleoonContext.d.ts +3 -0
  5. package/dist/KameleoonContext.js +6 -0
  6. package/dist/KameleoonContext.js.map +1 -0
  7. package/dist/KameleoonError.d.ts +5 -0
  8. package/dist/KameleoonError.js +31 -0
  9. package/dist/KameleoonError.js.map +1 -0
  10. package/dist/KameleoonProvider.d.ts +14 -0
  11. package/dist/KameleoonProvider.js +25 -0
  12. package/dist/KameleoonProvider.js.map +1 -0
  13. package/dist/ProviderError.d.ts +3 -0
  14. package/dist/ProviderError.js +29 -0
  15. package/dist/ProviderError.js.map +1 -0
  16. package/dist/compose.d.ts +8 -0
  17. package/dist/compose.js +58 -0
  18. package/dist/compose.js.map +1 -0
  19. package/dist/constants.d.ts +24 -0
  20. package/dist/constants.js +31 -0
  21. package/dist/constants.js.map +1 -0
  22. package/dist/getKameleoonException.d.ts +2 -0
  23. package/dist/getKameleoonException.js +34 -0
  24. package/dist/getKameleoonException.js.map +1 -0
  25. package/dist/index.d.ts +42 -0
  26. package/dist/index.js +106 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/kameleoonClient.d.ts +16 -0
  29. package/dist/kameleoonClient.js +17 -0
  30. package/dist/kameleoonClient.js.map +1 -0
  31. package/dist/stories/Form.d.ts +30 -0
  32. package/dist/stories/Form.js +215 -0
  33. package/dist/stories/Form.js.map +1 -0
  34. package/dist/stories/FormHOC.d.ts +2 -0
  35. package/dist/stories/FormHOC.js +41 -0
  36. package/dist/stories/FormHOC.js.map +1 -0
  37. package/dist/stories/FormHook.d.ts +2 -0
  38. package/dist/stories/FormHook.js +74 -0
  39. package/dist/stories/FormHook.js.map +1 -0
  40. package/dist/stories/FormRenderProps.d.ts +3 -0
  41. package/dist/stories/FormRenderProps.js +24 -0
  42. package/dist/stories/FormRenderProps.js.map +1 -0
  43. package/dist/stories/Radio.d.ts +8 -0
  44. package/dist/stories/Radio.js +9 -0
  45. package/dist/stories/Radio.js.map +1 -0
  46. package/dist/stories/constants.d.ts +16 -0
  47. package/dist/stories/constants.js +21 -0
  48. package/dist/stories/constants.js.map +1 -0
  49. package/dist/types.d.ts +37 -0
  50. package/dist/types.js +4 -0
  51. package/dist/types.js.map +1 -0
  52. package/dist/useActivateFeature.d.ts +14 -0
  53. package/dist/useActivateFeature.js +35 -0
  54. package/dist/useActivateFeature.js.map +1 -0
  55. package/dist/useAddData.d.ts +14 -0
  56. package/dist/useAddData.js +49 -0
  57. package/dist/useAddData.js.map +1 -0
  58. package/dist/useBrowser.d.ts +13 -0
  59. package/dist/useBrowser.js +22 -0
  60. package/dist/useBrowser.js.map +1 -0
  61. package/dist/useConversion.d.ts +14 -0
  62. package/dist/useConversion.js +18 -0
  63. package/dist/useConversion.js.map +1 -0
  64. package/dist/useCustomData.d.ts +13 -0
  65. package/dist/useCustomData.js +18 -0
  66. package/dist/useCustomData.js.map +1 -0
  67. package/dist/useDevice.d.ts +12 -0
  68. package/dist/useDevice.js +16 -0
  69. package/dist/useDevice.js.map +1 -0
  70. package/dist/useError.d.ts +7 -0
  71. package/dist/useError.js +34 -0
  72. package/dist/useError.js.map +1 -0
  73. package/dist/useErrors.d.ts +7 -0
  74. package/dist/useErrors.js +42 -0
  75. package/dist/useErrors.js.map +1 -0
  76. package/dist/useFeature.d.ts +5 -0
  77. package/dist/useFeature.js +104 -0
  78. package/dist/useFeature.js.map +1 -0
  79. package/dist/useFeatureVariable.d.ts +15 -0
  80. package/dist/useFeatureVariable.js +41 -0
  81. package/dist/useFeatureVariable.js.map +1 -0
  82. package/dist/useFlush.d.ts +11 -0
  83. package/dist/useFlush.js +19 -0
  84. package/dist/useFlush.js.map +1 -0
  85. package/dist/useKameleoon.d.ts +10 -0
  86. package/dist/useKameleoon.js +20 -0
  87. package/dist/useKameleoon.js.map +1 -0
  88. package/dist/usePageView.d.ts +14 -0
  89. package/dist/usePageView.js +18 -0
  90. package/dist/usePageView.js.map +1 -0
  91. package/dist/useRetrieveDataFromRemoteSource.d.ts +12 -0
  92. package/dist/useRetrieveDataFromRemoteSource.js +79 -0
  93. package/dist/useRetrieveDataFromRemoteSource.js.map +1 -0
  94. package/dist/useRunWhenReady.d.ts +14 -0
  95. package/dist/useRunWhenReady.js +23 -0
  96. package/dist/useRunWhenReady.js.map +1 -0
  97. package/dist/useTrackingConversion.d.ts +13 -0
  98. package/dist/useTrackingConversion.js +19 -0
  99. package/dist/useTrackingConversion.js.map +1 -0
  100. package/dist/useTriggerExperiment.d.ts +17 -0
  101. package/dist/useTriggerExperiment.js +32 -0
  102. package/dist/useTriggerExperiment.js.map +1 -0
  103. package/dist/useVariationAssociatedData.d.ts +16 -0
  104. package/dist/useVariationAssociatedData.js +30 -0
  105. package/dist/useVariationAssociatedData.js.map +1 -0
  106. package/dist/useVisitorCode.d.ts +12 -0
  107. package/dist/useVisitorCode.js +19 -0
  108. package/dist/useVisitorCode.js.map +1 -0
  109. package/dist/withActivateFeature.d.ts +17 -0
  110. package/dist/withActivateFeature.js +28 -0
  111. package/dist/withActivateFeature.js.map +1 -0
  112. package/dist/withAddData.d.ts +16 -0
  113. package/dist/withAddData.js +65 -0
  114. package/dist/withAddData.js.map +1 -0
  115. package/dist/withBrowser.d.ts +16 -0
  116. package/dist/withBrowser.js +35 -0
  117. package/dist/withBrowser.js.map +1 -0
  118. package/dist/withConversion.d.ts +17 -0
  119. package/dist/withConversion.js +31 -0
  120. package/dist/withConversion.js.map +1 -0
  121. package/dist/withCustomData.d.ts +16 -0
  122. package/dist/withCustomData.js +31 -0
  123. package/dist/withCustomData.js.map +1 -0
  124. package/dist/withDevice.d.ts +15 -0
  125. package/dist/withDevice.js +29 -0
  126. package/dist/withDevice.js.map +1 -0
  127. package/dist/withFeature.d.ts +6 -0
  128. package/dist/withFeature.js +31 -0
  129. package/dist/withFeature.js.map +1 -0
  130. package/dist/withFeatureVariable.d.ts +17 -0
  131. package/dist/withFeatureVariable.js +28 -0
  132. package/dist/withFeatureVariable.js.map +1 -0
  133. package/dist/withFlush.d.ts +14 -0
  134. package/dist/withFlush.js +36 -0
  135. package/dist/withFlush.js.map +1 -0
  136. package/dist/withKameleoon.d.ts +13 -0
  137. package/dist/withKameleoon.js +33 -0
  138. package/dist/withKameleoon.js.map +1 -0
  139. package/dist/withPageView.d.ts +17 -0
  140. package/dist/withPageView.js +31 -0
  141. package/dist/withPageView.js.map +1 -0
  142. package/dist/withRetrieveDataFromRemoteSource.d.ts +14 -0
  143. package/dist/withRetrieveDataFromRemoteSource.js +28 -0
  144. package/dist/withRetrieveDataFromRemoteSource.js.map +1 -0
  145. package/dist/withRunWhenReady.d.ts +16 -0
  146. package/dist/withRunWhenReady.js +28 -0
  147. package/dist/withRunWhenReady.js.map +1 -0
  148. package/dist/withTrackingConversion.d.ts +16 -0
  149. package/dist/withTrackingConversion.js +36 -0
  150. package/dist/withTrackingConversion.js.map +1 -0
  151. package/dist/withTriggerExperiment.d.ts +19 -0
  152. package/dist/withTriggerExperiment.js +30 -0
  153. package/dist/withTriggerExperiment.js.map +1 -0
  154. package/dist/withVariationAssociatedData.d.ts +18 -0
  155. package/dist/withVariationAssociatedData.js +30 -0
  156. package/dist/withVariationAssociatedData.js.map +1 -0
  157. package/dist/withVisitorCode.d.ts +15 -0
  158. package/dist/withVisitorCode.js +36 -0
  159. package/dist/withVisitorCode.js.map +1 -0
  160. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { IFeature, IFeatureParams } from './types';
3
+ interface IFeatureProps extends IFeatureParams {
4
+ children: (props: IFeature) => JSX.Element;
5
+ }
6
+ /**
7
+ * A React Render Props that gives a wrapped component access
8
+ * to the status of a feature flag and its variables
9
+ */
10
+ export declare function Feature(props: IFeatureProps): JSX.Element;
11
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Feature = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var useFeature_1 = require("./useFeature");
17
+ /**
18
+ * A React Render Props that gives a wrapped component access
19
+ * to the status of a feature flag and its variables
20
+ */
21
+ function Feature(props) {
22
+ var result = (0, useFeature_1.useFeature)(__assign({}, props));
23
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props.children(result) }, void 0);
24
+ }
25
+ exports.Feature = Feature;
26
+ //# sourceMappingURL=Feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Feature.js","sourceRoot":"","sources":["../src/Feature.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,2CAA0C;AAM1C;;;GAGG;AACH,SAAgB,OAAO,CAAC,KAAoB;IAC1C,IAAM,MAAM,GAAG,IAAA,uBAAU,eAAM,KAAK,EAAG,CAAC;IAExC,OAAO,2DAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAI,CAAC;AACvC,CAAC;AAJD,0BAIC"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { KameleoonClient } from 'kameleoon-client-javascript';
3
+ export declare const KameleoonContext: import("react").Context<KameleoonClient | null>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KameleoonContext = void 0;
4
+ var react_1 = require("react");
5
+ exports.KameleoonContext = (0, react_1.createContext)(null);
6
+ //# sourceMappingURL=KameleoonContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KameleoonContext.js","sourceRoot":"","sources":["../src/KameleoonContext.ts"],"names":[],"mappings":";;;AACA,+BAAsC;AAEzB,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAAyB,IAAI,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { KameleoonException } from './constants';
2
+ export declare class KameleoonError extends Error {
3
+ type: KameleoonException;
4
+ constructor(type: KameleoonException);
5
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.KameleoonError = void 0;
19
+ var KameleoonError = /** @class */ (function (_super) {
20
+ __extends(KameleoonError, _super);
21
+ function KameleoonError(type) {
22
+ var _this = _super.call(this, "Error: ".concat(type)) || this;
23
+ _this.name = 'KameleoonError';
24
+ _this.message = "".concat(_this.name, ".").concat(type);
25
+ _this.type = type;
26
+ return _this;
27
+ }
28
+ return KameleoonError;
29
+ }(Error));
30
+ exports.KameleoonError = KameleoonError;
31
+ //# sourceMappingURL=KameleoonError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KameleoonError.js","sourceRoot":"","sources":["../src/KameleoonError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA;IAAoC,kCAAK;IAGvC,wBAAY,IAAwB;QAApC,YACE,kBAAM,iBAAU,IAAI,CAAE,CAAC,SAIxB;QAHC,KAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,KAAI,CAAC,OAAO,GAAG,UAAG,KAAI,CAAC,IAAI,cAAI,IAAI,CAAE,CAAC;QACtC,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACnB,CAAC;IACH,qBAAC;AAAD,CAAC,AATD,CAAoC,KAAK,GASxC;AATY,wCAAc"}
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ import { KameleoonClient } from 'kameleoon-client-javascript';
3
+ interface IKameleoonProviderProps {
4
+ /** Child elements of the provider */
5
+ children: ReactNode;
6
+ /** An instance of KameleoonClient */
7
+ client: KameleoonClient;
8
+ }
9
+ /**
10
+ * A Provider that wraps the project and provides an access to SDK APIs
11
+ */
12
+ declare function KameleoonProvider({ client, children, }: IKameleoonProviderProps): JSX.Element;
13
+ declare const _default: import("react").MemoExoticComponent<typeof KameleoonProvider>;
14
+ export default _default;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ var jsx_runtime_1 = require("react/jsx-runtime");
15
+ var react_1 = require("react");
16
+ var KameleoonContext_1 = require("./KameleoonContext");
17
+ /**
18
+ * A Provider that wraps the project and provides an access to SDK APIs
19
+ */
20
+ function KameleoonProvider(_a) {
21
+ var client = _a.client, children = _a.children;
22
+ return ((0, jsx_runtime_1.jsx)(KameleoonContext_1.KameleoonContext.Provider, __assign({ value: client }, { children: children }), void 0));
23
+ }
24
+ exports.default = (0, react_1.memo)(KameleoonProvider);
25
+ //# sourceMappingURL=KameleoonProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KameleoonProvider.js","sourceRoot":"","sources":["../src/KameleoonProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAAwC;AAExC,uDAAsD;AAStD;;GAEG;AACH,SAAS,iBAAiB,CAAC,EAGD;QAFxB,MAAM,YAAA,EACN,QAAQ,cAAA;IAER,OAAO,CACL,uBAAC,mCAAgB,CAAC,QAAQ,aAAC,KAAK,EAAE,MAAM,gBACrC,QAAQ,YACiB,CAC7B,CAAC;AACJ,CAAC;AAED,kBAAe,IAAA,YAAI,EAAC,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare class ProviderError extends Error {
2
+ constructor(method: string);
3
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ProviderError = void 0;
19
+ var ProviderError = /** @class */ (function (_super) {
20
+ __extends(ProviderError, _super);
21
+ function ProviderError(method) {
22
+ var _this = _super.call(this, "".concat(method, " must be used within a KameleoonProvider'")) || this;
23
+ _this.name = 'ProviderError';
24
+ return _this;
25
+ }
26
+ return ProviderError;
27
+ }(Error));
28
+ exports.ProviderError = ProviderError;
29
+ //# sourceMappingURL=ProviderError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProviderError.js","sourceRoot":"","sources":["../src/ProviderError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;IAAmC,iCAAK;IACtC,uBAAY,MAAc;QAA1B,YACE,kBAAM,UAAG,MAAM,8CAA2C,CAAC,SAE5D;QADC,KAAI,CAAC,IAAI,GAAG,eAAe,CAAC;;IAC9B,CAAC;IACH,oBAAC;AAAD,CAAC,AALD,CAAmC,KAAK,GAKvC;AALY,sCAAa"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Composes single-argument high order components.
3
+ *
4
+ * @param funcs High order components to be composed.
5
+ * @returns A function obtained by composing the argument HOCs,
6
+ * which is used as single high order component wrapper.
7
+ */
8
+ export default function compose(...funcs: Function[]): Function;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
+ if (ar || !(i in from)) {
21
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
+ ar[i] = from[i];
23
+ }
24
+ }
25
+ return to.concat(ar || Array.prototype.slice.call(from));
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ /* eslint-disable @typescript-eslint/ban-types */
29
+ /**
30
+ * Composes single-argument high order components.
31
+ *
32
+ * @param funcs High order components to be composed.
33
+ * @returns A function obtained by composing the argument HOCs,
34
+ * which is used as single high order component wrapper.
35
+ */
36
+ function compose() {
37
+ var funcs = [];
38
+ for (var _i = 0; _i < arguments.length; _i++) {
39
+ funcs[_i] = arguments[_i];
40
+ }
41
+ if (funcs.length === 0) {
42
+ throw new Error('compose should be given at least one argument');
43
+ }
44
+ if (funcs.length === 1) {
45
+ return funcs[0];
46
+ }
47
+ return funcs.reduce(function (a, b) {
48
+ return function () {
49
+ var args = [];
50
+ for (var _i = 0; _i < arguments.length; _i++) {
51
+ args[_i] = arguments[_i];
52
+ }
53
+ return a(b.apply(void 0, __spreadArray([], __read(args), false)));
54
+ };
55
+ });
56
+ }
57
+ exports.default = compose;
58
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAiD;AACjD;;;;;;GAMG;AACH,SAAwB,OAAO;IAAC,eAAoB;SAApB,UAAoB,EAApB,qBAAoB,EAApB,IAAoB;QAApB,0BAAoB;;IAClD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;KAClE;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,OAAO,KAAK,CAAC,MAAM,CACjB,UAAC,CAAC,EAAE,CAAC;QACH,OAAA;YAAC,cAAmB;iBAAnB,UAAmB,EAAnB,qBAAmB,EAAnB,IAAmB;gBAAnB,yBAAmB;;YAClB,OAAA,CAAC,CAAC,CAAC,wCAAI,IAAI,WAAE;QAAb,CAAa;IADf,CACe,CAClB,CAAC;AACJ,CAAC;AAdD,0BAcC"}
@@ -0,0 +1,24 @@
1
+ export declare const KAMELEOON_SDK_LOCAL_STORAGE_KEY = "kameleoonJavaScriptClientData";
2
+ export declare const PRODUCTION = "production";
3
+ export declare enum Browser {
4
+ Chrome = "CHROME",
5
+ Internet_Explorer = "INTERNET_EXPLORER",
6
+ Firefox = "FIREFOX",
7
+ Safari = "SAFARI",
8
+ Opera = "OPERA",
9
+ Other = "OTHER"
10
+ }
11
+ export declare enum FeatureResultField {
12
+ IsActive = "isActive",
13
+ Variables = "variables"
14
+ }
15
+ export declare enum KameleoonException {
16
+ ExperimentConfigurationNotFound = "ExperimentConfigurationNotFound",
17
+ FeatureConfigurationNotFound = "FeatureConfigurationNotFound",
18
+ VariationConfigurationNotFound = "VariationConfigurationNotFound",
19
+ VariationConfigurationTimedOut = "VariationConfigurationTimedOut",
20
+ NotTargeted = "NotTargeted",
21
+ NotActivated = "NotActivated",
22
+ CredentialsNotFound = "CredentialsNotFound",
23
+ NoDataWasRetrievedFromRemoteServer = "NoDataWasRetrievedFromRemoteServer"
24
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KameleoonException = exports.FeatureResultField = exports.Browser = exports.PRODUCTION = exports.KAMELEOON_SDK_LOCAL_STORAGE_KEY = void 0;
4
+ exports.KAMELEOON_SDK_LOCAL_STORAGE_KEY = 'kameleoonJavaScriptClientData';
5
+ exports.PRODUCTION = 'production';
6
+ var Browser;
7
+ (function (Browser) {
8
+ Browser["Chrome"] = "CHROME";
9
+ Browser["Internet_Explorer"] = "INTERNET_EXPLORER";
10
+ Browser["Firefox"] = "FIREFOX";
11
+ Browser["Safari"] = "SAFARI";
12
+ Browser["Opera"] = "OPERA";
13
+ Browser["Other"] = "OTHER";
14
+ })(Browser = exports.Browser || (exports.Browser = {}));
15
+ var FeatureResultField;
16
+ (function (FeatureResultField) {
17
+ FeatureResultField["IsActive"] = "isActive";
18
+ FeatureResultField["Variables"] = "variables";
19
+ })(FeatureResultField = exports.FeatureResultField || (exports.FeatureResultField = {}));
20
+ var KameleoonException;
21
+ (function (KameleoonException) {
22
+ KameleoonException["ExperimentConfigurationNotFound"] = "ExperimentConfigurationNotFound";
23
+ KameleoonException["FeatureConfigurationNotFound"] = "FeatureConfigurationNotFound";
24
+ KameleoonException["VariationConfigurationNotFound"] = "VariationConfigurationNotFound";
25
+ KameleoonException["VariationConfigurationTimedOut"] = "VariationConfigurationTimedOut";
26
+ KameleoonException["NotTargeted"] = "NotTargeted";
27
+ KameleoonException["NotActivated"] = "NotActivated";
28
+ KameleoonException["CredentialsNotFound"] = "CredentialsNotFound";
29
+ KameleoonException["NoDataWasRetrievedFromRemoteServer"] = "NoDataWasRetrievedFromRemoteServer";
30
+ })(KameleoonException = exports.KameleoonException || (exports.KameleoonException = {}));
31
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,+BAA+B,GAAG,+BAA+B,CAAC;AAClE,QAAA,UAAU,GAAG,YAAY,CAAC;AAEvC,IAAY,OAOX;AAPD,WAAY,OAAO;IACjB,4BAAiB,CAAA;IACjB,kDAAuC,CAAA;IACvC,8BAAmB,CAAA;IACnB,4BAAiB,CAAA;IACjB,0BAAe,CAAA;IACf,0BAAe,CAAA;AACjB,CAAC,EAPW,OAAO,GAAP,eAAO,KAAP,eAAO,QAOlB;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,2CAAqB,CAAA;IACrB,6CAAuB,CAAA;AACzB,CAAC,EAHW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAG7B;AAED,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,yFAAmE,CAAA;IACnE,mFAA6D,CAAA;IAC7D,uFAAiE,CAAA;IACjE,uFAAiE,CAAA;IACjE,iDAA2B,CAAA;IAC3B,mDAA6B,CAAA;IAC7B,iEAA2C,CAAA;IAC3C,+FAAyE,CAAA;AAC3E,CAAC,EATW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAS7B"}
@@ -0,0 +1,2 @@
1
+ import { KameleoonError } from './KameleoonError';
2
+ export declare function getKameleoonException(error: Error): KameleoonError;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.getKameleoonException = void 0;
20
+ var constants_1 = require("./constants");
21
+ var KameleoonError_1 = require("./KameleoonError");
22
+ function isKameleoonException(type) {
23
+ return Object.values(constants_1.KameleoonException).some(function (item) { return item === type; });
24
+ }
25
+ function getKameleoonException(error) {
26
+ // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars
27
+ var _a = __read(error.message.split('.'), 2), _ = _a[0], type = _a[1];
28
+ if (isKameleoonException(type)) {
29
+ return new KameleoonError_1.KameleoonError(type);
30
+ }
31
+ throw new Error("Error doesn't descend from KameleoonException");
32
+ }
33
+ exports.getKameleoonException = getKameleoonException;
34
+ //# sourceMappingURL=getKameleoonException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getKameleoonException.js","sourceRoot":"","sources":["../src/getKameleoonException.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,yCAAiD;AACjD,mDAAkD;AAElD,SAAS,oBAAoB,CAAC,IAAa;IACzC,OAAO,MAAM,CAAC,MAAM,CAAC,8BAAkB,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,KAAK,IAAI,EAAb,CAAa,CAAC,CAAC;AACzE,CAAC;AAED,SAAgB,qBAAqB,CAAC,KAAY;IAChD,mGAAmG;IAC7F,IAAA,KAAA,OAAY,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAA,EAAnC,CAAC,QAAA,EAAE,IAAI,QAA4B,CAAC;IAE3C,IAAI,oBAAoB,CAAC,IAAI,CAAC,EAAE;QAC9B,OAAO,IAAI,+BAAc,CAAC,IAAI,CAAC,CAAC;KACjC;IAED,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;AACnE,CAAC;AATD,sDASC"}
@@ -0,0 +1,42 @@
1
+ export { KameleoonContext } from './KameleoonContext';
2
+ export { KAMELEOON_SDK_LOCAL_STORAGE_KEY, Browser, KameleoonException, } from './constants';
3
+ export { Browser as IBrowser, Conversion as IConversion, Device as IDevice, PageView as IPageView, DeviceType, } from 'kameleoon-client-javascript/dist/data';
4
+ export { default as compose } from './compose';
5
+ export { default as KameleoonProvider } from './KameleoonProvider';
6
+ export * from './types';
7
+ export { createClient } from './kameleoonClient';
8
+ export { Feature } from './Feature';
9
+ export { useKameleoon } from './useKameleoon';
10
+ export { useFeature } from './useFeature';
11
+ export { useVisitorCode } from './useVisitorCode';
12
+ export { useTriggerExperiment } from './useTriggerExperiment';
13
+ export { useActivateFeature } from './useActivateFeature';
14
+ export { useVariationAssociatedData } from './useVariationAssociatedData';
15
+ export { useFeatureVariable } from './useFeatureVariable';
16
+ export { useTrackingConversion } from './useTrackingConversion';
17
+ export { useRetrieveDataFromRemoteSource } from './useRetrieveDataFromRemoteSource';
18
+ export { useAddData } from './useAddData';
19
+ export { useFlush } from './useFlush';
20
+ export { useBrowser } from './useBrowser';
21
+ export { usePageView } from './usePageView';
22
+ export { useConversion } from './useConversion';
23
+ export { useCustomData } from './useCustomData';
24
+ export { useDevice } from './useDevice';
25
+ export { useRunWhenReady } from './useRunWhenReady';
26
+ export { withKameleoon } from './withKameleoon';
27
+ export { withFeature } from './withFeature';
28
+ export { withVisitorCode } from './withVisitorCode';
29
+ export { withTriggerExperiment } from './withTriggerExperiment';
30
+ export { withActivateFeature } from './withActivateFeature';
31
+ export { withVariationAssociatedData } from './withVariationAssociatedData';
32
+ export { withRetrieveDataFromRemoteSource } from './withRetrieveDataFromRemoteSource';
33
+ export { withFeatureVariable } from './withFeatureVariable';
34
+ export { withTrackingConversion } from './withTrackingConversion';
35
+ export { withAddData } from './withAddData';
36
+ export { withFlush } from './withFlush';
37
+ export { withBrowser } from './withBrowser';
38
+ export { withDevice } from './withDevice';
39
+ export { withPageView } from './withPageView';
40
+ export { withConversion } from './withConversion';
41
+ export { withCustomData } from './withCustomData';
42
+ export { withRunWhenReady } from './withRunWhenReady';
package/dist/index.js ADDED
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.withRunWhenReady = exports.withCustomData = exports.withConversion = exports.withPageView = exports.withDevice = exports.withBrowser = exports.withFlush = exports.withAddData = exports.withTrackingConversion = exports.withFeatureVariable = exports.withRetrieveDataFromRemoteSource = exports.withVariationAssociatedData = exports.withActivateFeature = exports.withTriggerExperiment = exports.withVisitorCode = exports.withFeature = exports.withKameleoon = exports.useRunWhenReady = exports.useDevice = exports.useCustomData = exports.useConversion = exports.usePageView = exports.useBrowser = exports.useFlush = exports.useAddData = exports.useRetrieveDataFromRemoteSource = exports.useTrackingConversion = exports.useFeatureVariable = exports.useVariationAssociatedData = exports.useActivateFeature = exports.useTriggerExperiment = exports.useVisitorCode = exports.useFeature = exports.useKameleoon = exports.Feature = exports.createClient = exports.KameleoonProvider = exports.compose = exports.DeviceType = exports.IPageView = exports.IDevice = exports.IConversion = exports.IBrowser = exports.KameleoonException = exports.Browser = exports.KAMELEOON_SDK_LOCAL_STORAGE_KEY = exports.KameleoonContext = void 0;
17
+ var KameleoonContext_1 = require("./KameleoonContext");
18
+ Object.defineProperty(exports, "KameleoonContext", { enumerable: true, get: function () { return KameleoonContext_1.KameleoonContext; } });
19
+ var constants_1 = require("./constants");
20
+ Object.defineProperty(exports, "KAMELEOON_SDK_LOCAL_STORAGE_KEY", { enumerable: true, get: function () { return constants_1.KAMELEOON_SDK_LOCAL_STORAGE_KEY; } });
21
+ Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return constants_1.Browser; } });
22
+ Object.defineProperty(exports, "KameleoonException", { enumerable: true, get: function () { return constants_1.KameleoonException; } });
23
+ var data_1 = require("kameleoon-client-javascript/dist/data");
24
+ Object.defineProperty(exports, "IBrowser", { enumerable: true, get: function () { return data_1.Browser; } });
25
+ Object.defineProperty(exports, "IConversion", { enumerable: true, get: function () { return data_1.Conversion; } });
26
+ Object.defineProperty(exports, "IDevice", { enumerable: true, get: function () { return data_1.Device; } });
27
+ Object.defineProperty(exports, "IPageView", { enumerable: true, get: function () { return data_1.PageView; } });
28
+ Object.defineProperty(exports, "DeviceType", { enumerable: true, get: function () { return data_1.DeviceType; } });
29
+ var compose_1 = require("./compose");
30
+ Object.defineProperty(exports, "compose", { enumerable: true, get: function () { return __importDefault(compose_1).default; } });
31
+ var KameleoonProvider_1 = require("./KameleoonProvider");
32
+ Object.defineProperty(exports, "KameleoonProvider", { enumerable: true, get: function () { return __importDefault(KameleoonProvider_1).default; } });
33
+ __exportStar(require("./types"), exports);
34
+ var kameleoonClient_1 = require("./kameleoonClient");
35
+ Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return kameleoonClient_1.createClient; } });
36
+ var Feature_1 = require("./Feature");
37
+ Object.defineProperty(exports, "Feature", { enumerable: true, get: function () { return Feature_1.Feature; } });
38
+ var useKameleoon_1 = require("./useKameleoon");
39
+ Object.defineProperty(exports, "useKameleoon", { enumerable: true, get: function () { return useKameleoon_1.useKameleoon; } });
40
+ var useFeature_1 = require("./useFeature");
41
+ Object.defineProperty(exports, "useFeature", { enumerable: true, get: function () { return useFeature_1.useFeature; } });
42
+ var useVisitorCode_1 = require("./useVisitorCode");
43
+ Object.defineProperty(exports, "useVisitorCode", { enumerable: true, get: function () { return useVisitorCode_1.useVisitorCode; } });
44
+ var useTriggerExperiment_1 = require("./useTriggerExperiment");
45
+ Object.defineProperty(exports, "useTriggerExperiment", { enumerable: true, get: function () { return useTriggerExperiment_1.useTriggerExperiment; } });
46
+ var useActivateFeature_1 = require("./useActivateFeature");
47
+ Object.defineProperty(exports, "useActivateFeature", { enumerable: true, get: function () { return useActivateFeature_1.useActivateFeature; } });
48
+ var useVariationAssociatedData_1 = require("./useVariationAssociatedData");
49
+ Object.defineProperty(exports, "useVariationAssociatedData", { enumerable: true, get: function () { return useVariationAssociatedData_1.useVariationAssociatedData; } });
50
+ var useFeatureVariable_1 = require("./useFeatureVariable");
51
+ Object.defineProperty(exports, "useFeatureVariable", { enumerable: true, get: function () { return useFeatureVariable_1.useFeatureVariable; } });
52
+ var useTrackingConversion_1 = require("./useTrackingConversion");
53
+ Object.defineProperty(exports, "useTrackingConversion", { enumerable: true, get: function () { return useTrackingConversion_1.useTrackingConversion; } });
54
+ var useRetrieveDataFromRemoteSource_1 = require("./useRetrieveDataFromRemoteSource");
55
+ Object.defineProperty(exports, "useRetrieveDataFromRemoteSource", { enumerable: true, get: function () { return useRetrieveDataFromRemoteSource_1.useRetrieveDataFromRemoteSource; } });
56
+ var useAddData_1 = require("./useAddData");
57
+ Object.defineProperty(exports, "useAddData", { enumerable: true, get: function () { return useAddData_1.useAddData; } });
58
+ var useFlush_1 = require("./useFlush");
59
+ Object.defineProperty(exports, "useFlush", { enumerable: true, get: function () { return useFlush_1.useFlush; } });
60
+ var useBrowser_1 = require("./useBrowser");
61
+ Object.defineProperty(exports, "useBrowser", { enumerable: true, get: function () { return useBrowser_1.useBrowser; } });
62
+ var usePageView_1 = require("./usePageView");
63
+ Object.defineProperty(exports, "usePageView", { enumerable: true, get: function () { return usePageView_1.usePageView; } });
64
+ var useConversion_1 = require("./useConversion");
65
+ Object.defineProperty(exports, "useConversion", { enumerable: true, get: function () { return useConversion_1.useConversion; } });
66
+ var useCustomData_1 = require("./useCustomData");
67
+ Object.defineProperty(exports, "useCustomData", { enumerable: true, get: function () { return useCustomData_1.useCustomData; } });
68
+ var useDevice_1 = require("./useDevice");
69
+ Object.defineProperty(exports, "useDevice", { enumerable: true, get: function () { return useDevice_1.useDevice; } });
70
+ var useRunWhenReady_1 = require("./useRunWhenReady");
71
+ Object.defineProperty(exports, "useRunWhenReady", { enumerable: true, get: function () { return useRunWhenReady_1.useRunWhenReady; } });
72
+ var withKameleoon_1 = require("./withKameleoon");
73
+ Object.defineProperty(exports, "withKameleoon", { enumerable: true, get: function () { return withKameleoon_1.withKameleoon; } });
74
+ var withFeature_1 = require("./withFeature");
75
+ Object.defineProperty(exports, "withFeature", { enumerable: true, get: function () { return withFeature_1.withFeature; } });
76
+ var withVisitorCode_1 = require("./withVisitorCode");
77
+ Object.defineProperty(exports, "withVisitorCode", { enumerable: true, get: function () { return withVisitorCode_1.withVisitorCode; } });
78
+ var withTriggerExperiment_1 = require("./withTriggerExperiment");
79
+ Object.defineProperty(exports, "withTriggerExperiment", { enumerable: true, get: function () { return withTriggerExperiment_1.withTriggerExperiment; } });
80
+ var withActivateFeature_1 = require("./withActivateFeature");
81
+ Object.defineProperty(exports, "withActivateFeature", { enumerable: true, get: function () { return withActivateFeature_1.withActivateFeature; } });
82
+ var withVariationAssociatedData_1 = require("./withVariationAssociatedData");
83
+ Object.defineProperty(exports, "withVariationAssociatedData", { enumerable: true, get: function () { return withVariationAssociatedData_1.withVariationAssociatedData; } });
84
+ var withRetrieveDataFromRemoteSource_1 = require("./withRetrieveDataFromRemoteSource");
85
+ Object.defineProperty(exports, "withRetrieveDataFromRemoteSource", { enumerable: true, get: function () { return withRetrieveDataFromRemoteSource_1.withRetrieveDataFromRemoteSource; } });
86
+ var withFeatureVariable_1 = require("./withFeatureVariable");
87
+ Object.defineProperty(exports, "withFeatureVariable", { enumerable: true, get: function () { return withFeatureVariable_1.withFeatureVariable; } });
88
+ var withTrackingConversion_1 = require("./withTrackingConversion");
89
+ Object.defineProperty(exports, "withTrackingConversion", { enumerable: true, get: function () { return withTrackingConversion_1.withTrackingConversion; } });
90
+ var withAddData_1 = require("./withAddData");
91
+ Object.defineProperty(exports, "withAddData", { enumerable: true, get: function () { return withAddData_1.withAddData; } });
92
+ var withFlush_1 = require("./withFlush");
93
+ Object.defineProperty(exports, "withFlush", { enumerable: true, get: function () { return withFlush_1.withFlush; } });
94
+ var withBrowser_1 = require("./withBrowser");
95
+ Object.defineProperty(exports, "withBrowser", { enumerable: true, get: function () { return withBrowser_1.withBrowser; } });
96
+ var withDevice_1 = require("./withDevice");
97
+ Object.defineProperty(exports, "withDevice", { enumerable: true, get: function () { return withDevice_1.withDevice; } });
98
+ var withPageView_1 = require("./withPageView");
99
+ Object.defineProperty(exports, "withPageView", { enumerable: true, get: function () { return withPageView_1.withPageView; } });
100
+ var withConversion_1 = require("./withConversion");
101
+ Object.defineProperty(exports, "withConversion", { enumerable: true, get: function () { return withConversion_1.withConversion; } });
102
+ var withCustomData_1 = require("./withCustomData");
103
+ Object.defineProperty(exports, "withCustomData", { enumerable: true, get: function () { return withCustomData_1.withCustomData; } });
104
+ var withRunWhenReady_1 = require("./withRunWhenReady");
105
+ Object.defineProperty(exports, "withRunWhenReady", { enumerable: true, get: function () { return withRunWhenReady_1.withRunWhenReady; } });
106
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,yCAIqB;AAHnB,4HAAA,+BAA+B,OAAA;AAC/B,oGAAA,OAAO,OAAA;AACP,+GAAA,kBAAkB,OAAA;AAEpB,8DAM+C;AAL7C,gGAAA,OAAO,OAAY;AACnB,mGAAA,UAAU,OAAe;AACzB,+FAAA,MAAM,OAAW;AACjB,iGAAA,QAAQ,OAAa;AACrB,kGAAA,UAAU,OAAA;AAEZ,qCAA+C;AAAtC,mHAAA,OAAO,OAAW;AAC3B,yDAAmE;AAA1D,uIAAA,OAAO,OAAqB;AACrC,0CAAwB;AACxB,qDAAiD;AAAxC,+GAAA,YAAY,OAAA;AACrB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,2EAA0E;AAAjE,wIAAA,0BAA0B,OAAA;AACnC,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,qFAAoF;AAA3E,kJAAA,+BAA+B,OAAA;AACxC,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,6EAA4E;AAAnE,0IAAA,2BAA2B,OAAA;AACpC,uFAAsF;AAA7E,oJAAA,gCAAgC,OAAA;AACzC,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,16 @@
1
+ import { SDKConfiguration } from 'kameleoon-client-javascript/dist/interfaces/interfaces';
2
+ import { KameleoonClient } from 'kameleoon-client-javascript';
3
+ export interface ICreateClientParams {
4
+ /** Code of the website you want to run experiments on */
5
+ siteCode: string;
6
+ /** Visitor code is an optional parameter, if used it will automatically
7
+ * create custom data to check if visitor is targeted
8
+ */
9
+ visitorCode?: string;
10
+ /** JSON object filled with configuration parameters */
11
+ options?: SDKConfiguration;
12
+ }
13
+ /**
14
+ * Creates an instance of KameleoonClient
15
+ */
16
+ export declare function createClient({ siteCode, visitorCode, options, }: ICreateClientParams): KameleoonClient;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createClient = void 0;
4
+ var kameleoon_client_javascript_1 = require("kameleoon-client-javascript");
5
+ /**
6
+ * Creates an instance of KameleoonClient
7
+ */
8
+ function createClient(_a) {
9
+ var siteCode = _a.siteCode, visitorCode = _a.visitorCode, options = _a.options;
10
+ var client = new kameleoon_client_javascript_1.KameleoonClient(siteCode, options);
11
+ var userId = visitorCode !== null && visitorCode !== void 0 ? visitorCode : client.obtainVisitorCode('');
12
+ client.addData(userId, new kameleoon_client_javascript_1.KameleoonData.CustomData(1, userId));
13
+ client.flush(userId);
14
+ return client;
15
+ }
16
+ exports.createClient = createClient;
17
+ //# sourceMappingURL=kameleoonClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kameleoonClient.js","sourceRoot":"","sources":["../src/kameleoonClient.ts"],"names":[],"mappings":";;;AACA,2EAA6E;AAa7E;;GAEG;AACH,SAAgB,YAAY,CAAC,EAIP;QAHpB,QAAQ,cAAA,EACR,WAAW,iBAAA,EACX,OAAO,aAAA;IAEP,IAAM,MAAM,GAAG,IAAI,6CAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtD,IAAM,MAAM,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAE3D,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,2CAAa,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAChE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAErB,OAAO,MAAM,CAAC;AAChB,CAAC;AAZD,oCAYC"}
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { KameleoonClient } from 'kameleoon-client-javascript';
3
+ import { DataInterface } from 'kameleoon-client-javascript/dist/interfaces/interfaces';
4
+ import { IFeature, RemoteSourceResultType, VariationAssociatedDataType } from '../types';
5
+ import { KameleoonException } from '../constants';
6
+ import { IBrowser, IDevice, IConversion, IPageView, Browser, DeviceType } from '..';
7
+ import { KameleoonError } from '../KameleoonError';
8
+ export interface IFormProps {
9
+ variationAssociatedDataError?: KameleoonError | null;
10
+ triggerExperimentError?: KameleoonError | null;
11
+ activateFeatureError?: KameleoonError | null;
12
+ featureErrors: KameleoonException[];
13
+ client?: KameleoonClient;
14
+ feature: IFeature['feature'];
15
+ isRenderProps?: boolean;
16
+ getVisitorCode?: (topLevelDomain: string, defaultVisitorCode?: string) => string;
17
+ hasFeature?: (featureKey: string | number, visitorCode?: string) => boolean;
18
+ addData?: (visitorCode: string, ...dataTypes: DataInterface[]) => void;
19
+ addBrowser?: (browser: Browser) => IBrowser;
20
+ addPageView?: (url: string, title: string, referrer?: number) => IPageView;
21
+ addDevice?: (device: DeviceType) => IDevice;
22
+ addConversion?: (goalId: number, revenue?: number, negative?: boolean) => IConversion;
23
+ getVariationAssociatedData?: (variationId: number) => VariationAssociatedDataType;
24
+ retrieveDataFromRemoteSource?: (key: string) => Promise<RemoteSourceResultType>;
25
+ getVariationId?: (visitorCode: string, experimentId: number) => number;
26
+ runWhenReady?: (successCallback: () => void, errorCallback: () => void, timeout?: number) => void;
27
+ }
28
+ declare function Form({ variationAssociatedDataError, triggerExperimentError, activateFeatureError, featureErrors, client, feature, isRenderProps, getVisitorCode, hasFeature, addData, addBrowser, addPageView, addDevice, addConversion, getVariationAssociatedData, retrieveDataFromRemoteSource, getVariationId, runWhenReady, }: IFormProps): JSX.Element;
29
+ declare const _default: React.MemoExoticComponent<typeof Form>;
30
+ export default _default;