@kameleoon/react-sdk 4.0.0 → 4.0.3

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 (143) hide show
  1. package/README.md +17 -20
  2. package/dist/Feature.d.ts +11 -0
  3. package/dist/Feature.js +26 -0
  4. package/dist/Feature.js.map +1 -0
  5. package/dist/KameleoonContext.d.ts +3 -0
  6. package/dist/KameleoonContext.js +6 -0
  7. package/dist/KameleoonContext.js.map +1 -0
  8. package/dist/KameleoonError.d.ts +5 -0
  9. package/dist/KameleoonError.js +31 -0
  10. package/dist/KameleoonError.js.map +1 -0
  11. package/dist/KameleoonProvider.d.ts +14 -0
  12. package/dist/KameleoonProvider.js +25 -0
  13. package/dist/KameleoonProvider.js.map +1 -0
  14. package/dist/ProviderError.d.ts +3 -0
  15. package/dist/ProviderError.js +29 -0
  16. package/dist/ProviderError.js.map +1 -0
  17. package/dist/compose.d.ts +8 -0
  18. package/dist/compose.js +58 -0
  19. package/dist/compose.js.map +1 -0
  20. package/dist/constants.d.ts +24 -0
  21. package/dist/constants.js +31 -0
  22. package/dist/constants.js.map +1 -0
  23. package/dist/getKameleoonException.d.ts +2 -0
  24. package/dist/getKameleoonException.js +34 -0
  25. package/dist/getKameleoonException.js.map +1 -0
  26. package/dist/index.d.ts +42 -0
  27. package/dist/index.js +106 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/kameleoonClient.d.ts +16 -0
  30. package/dist/kameleoonClient.js +17 -0
  31. package/dist/kameleoonClient.js.map +1 -0
  32. package/dist/types.d.ts +37 -0
  33. package/dist/types.js +4 -0
  34. package/dist/types.js.map +1 -0
  35. package/dist/useActivateFeature.d.ts +14 -0
  36. package/dist/useActivateFeature.js +35 -0
  37. package/dist/useActivateFeature.js.map +1 -0
  38. package/dist/useAddData.d.ts +14 -0
  39. package/dist/useAddData.js +49 -0
  40. package/dist/useAddData.js.map +1 -0
  41. package/dist/useBrowser.d.ts +13 -0
  42. package/dist/useBrowser.js +22 -0
  43. package/dist/useBrowser.js.map +1 -0
  44. package/dist/useConversion.d.ts +14 -0
  45. package/dist/useConversion.js +18 -0
  46. package/dist/useConversion.js.map +1 -0
  47. package/dist/useCustomData.d.ts +13 -0
  48. package/dist/useCustomData.js +18 -0
  49. package/dist/useCustomData.js.map +1 -0
  50. package/dist/useDevice.d.ts +12 -0
  51. package/dist/useDevice.js +16 -0
  52. package/dist/useDevice.js.map +1 -0
  53. package/dist/useError.d.ts +7 -0
  54. package/dist/useError.js +18 -0
  55. package/dist/useError.js.map +1 -0
  56. package/dist/useErrors.d.ts +7 -0
  57. package/dist/useErrors.js +42 -0
  58. package/dist/useErrors.js.map +1 -0
  59. package/dist/useFeature.d.ts +5 -0
  60. package/dist/useFeature.js +104 -0
  61. package/dist/useFeature.js.map +1 -0
  62. package/dist/useFeatureVariable.d.ts +15 -0
  63. package/dist/useFeatureVariable.js +41 -0
  64. package/dist/useFeatureVariable.js.map +1 -0
  65. package/dist/useFlush.d.ts +11 -0
  66. package/dist/useFlush.js +19 -0
  67. package/dist/useFlush.js.map +1 -0
  68. package/dist/useKameleoon.d.ts +10 -0
  69. package/dist/useKameleoon.js +20 -0
  70. package/dist/useKameleoon.js.map +1 -0
  71. package/dist/usePageView.d.ts +14 -0
  72. package/dist/usePageView.js +18 -0
  73. package/dist/usePageView.js.map +1 -0
  74. package/dist/useRetrieveDataFromRemoteSource.d.ts +12 -0
  75. package/dist/useRetrieveDataFromRemoteSource.js +79 -0
  76. package/dist/useRetrieveDataFromRemoteSource.js.map +1 -0
  77. package/dist/useRunWhenReady.d.ts +14 -0
  78. package/dist/useRunWhenReady.js +23 -0
  79. package/dist/useRunWhenReady.js.map +1 -0
  80. package/dist/useTrackingConversion.d.ts +13 -0
  81. package/dist/useTrackingConversion.js +19 -0
  82. package/dist/useTrackingConversion.js.map +1 -0
  83. package/dist/useTriggerExperiment.d.ts +17 -0
  84. package/dist/useTriggerExperiment.js +32 -0
  85. package/dist/useTriggerExperiment.js.map +1 -0
  86. package/dist/useVariationAssociatedData.d.ts +16 -0
  87. package/dist/useVariationAssociatedData.js +30 -0
  88. package/dist/useVariationAssociatedData.js.map +1 -0
  89. package/dist/useVisitorCode.d.ts +12 -0
  90. package/dist/useVisitorCode.js +19 -0
  91. package/dist/useVisitorCode.js.map +1 -0
  92. package/dist/withActivateFeature.d.ts +17 -0
  93. package/dist/withActivateFeature.js +28 -0
  94. package/dist/withActivateFeature.js.map +1 -0
  95. package/dist/withAddData.d.ts +16 -0
  96. package/dist/withAddData.js +65 -0
  97. package/dist/withAddData.js.map +1 -0
  98. package/dist/withBrowser.d.ts +16 -0
  99. package/dist/withBrowser.js +35 -0
  100. package/dist/withBrowser.js.map +1 -0
  101. package/dist/withConversion.d.ts +17 -0
  102. package/dist/withConversion.js +31 -0
  103. package/dist/withConversion.js.map +1 -0
  104. package/dist/withCustomData.d.ts +16 -0
  105. package/dist/withCustomData.js +31 -0
  106. package/dist/withCustomData.js.map +1 -0
  107. package/dist/withDevice.d.ts +15 -0
  108. package/dist/withDevice.js +29 -0
  109. package/dist/withDevice.js.map +1 -0
  110. package/dist/withFeature.d.ts +6 -0
  111. package/dist/withFeature.js +31 -0
  112. package/dist/withFeature.js.map +1 -0
  113. package/dist/withFeatureVariable.d.ts +17 -0
  114. package/dist/withFeatureVariable.js +28 -0
  115. package/dist/withFeatureVariable.js.map +1 -0
  116. package/dist/withFlush.d.ts +14 -0
  117. package/dist/withFlush.js +36 -0
  118. package/dist/withFlush.js.map +1 -0
  119. package/dist/withKameleoon.d.ts +13 -0
  120. package/dist/withKameleoon.js +33 -0
  121. package/dist/withKameleoon.js.map +1 -0
  122. package/dist/withPageView.d.ts +17 -0
  123. package/dist/withPageView.js +31 -0
  124. package/dist/withPageView.js.map +1 -0
  125. package/dist/withRetrieveDataFromRemoteSource.d.ts +14 -0
  126. package/dist/withRetrieveDataFromRemoteSource.js +28 -0
  127. package/dist/withRetrieveDataFromRemoteSource.js.map +1 -0
  128. package/dist/withRunWhenReady.d.ts +16 -0
  129. package/dist/withRunWhenReady.js +28 -0
  130. package/dist/withRunWhenReady.js.map +1 -0
  131. package/dist/withTrackingConversion.d.ts +16 -0
  132. package/dist/withTrackingConversion.js +36 -0
  133. package/dist/withTrackingConversion.js.map +1 -0
  134. package/dist/withTriggerExperiment.d.ts +19 -0
  135. package/dist/withTriggerExperiment.js +30 -0
  136. package/dist/withTriggerExperiment.js.map +1 -0
  137. package/dist/withVariationAssociatedData.d.ts +18 -0
  138. package/dist/withVariationAssociatedData.js +30 -0
  139. package/dist/withVariationAssociatedData.js.map +1 -0
  140. package/dist/withVisitorCode.d.ts +15 -0
  141. package/dist/withVisitorCode.js +36 -0
  142. package/dist/withVisitorCode.js.map +1 -0
  143. package/package.json +3 -2
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { UnknownPropsType, Without } from './types';
3
+ interface IWithRunWhenReadyData {
4
+ /**
5
+ * @param successCallback - callback which will be executed on successful client initialization
6
+ * @param errorCallback - callback which will be executed if client wasn't able to initialize during the timeout
7
+ * @param timeout - timeout which is given to perform HTTP call for initialization in ms (by default: 2 seconds)
8
+ */
9
+ runWhenReady: (successCallback: () => void, errorCallback: () => void, timeout?: number) => void;
10
+ }
11
+ /**
12
+ * A React HOC that gives a wrapped component access to callback function which makes sure that
13
+ * Kameleoon Client will be initialized properly using HTTP call within the specified timeout
14
+ */
15
+ export declare function withRunWhenReady<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithRunWhenReadyData>>;
16
+ export {};
@@ -0,0 +1,28 @@
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.withRunWhenReady = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var useRunWhenReady_1 = require("./useRunWhenReady");
17
+ /**
18
+ * A React HOC that gives a wrapped component access to callback function which makes sure that
19
+ * Kameleoon Client will be initialized properly using HTTP call within the specified timeout
20
+ */
21
+ function withRunWhenReady(Component) {
22
+ return function WrappedComponent(props) {
23
+ var runWhenReady = (0, useRunWhenReady_1.useRunWhenReady)().runWhenReady;
24
+ return (0, jsx_runtime_1.jsx)(Component, __assign({ runWhenReady: runWhenReady }, props), void 0);
25
+ };
26
+ }
27
+ exports.withRunWhenReady = withRunWhenReady;
28
+ //# sourceMappingURL=withRunWhenReady.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withRunWhenReady.js","sourceRoot":"","sources":["../src/withRunWhenReady.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,qDAAoD;AAepD;;;GAGG;AACH,SAAgB,gBAAgB,CAC9B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QACnC,IAAA,YAAY,GAAK,IAAA,iCAAe,GAAE,aAAtB,CAAuB;QAE3C,OAAO,uBAAC,SAAS,aAAC,YAAY,EAAE,YAAY,IAAO,KAAe,UAAI,CAAC;IACzE,CAAC,CAAC;AACJ,CAAC;AARD,4CAQC"}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { UnknownPropsType, Without } from './types';
3
+ interface IWithTrackingConversion {
4
+ /**
5
+ * @param visitorCode - unique identifier of the user
6
+ * @param goalId - unique identifier of the goal
7
+ * @param revenue - revenue of the conversion
8
+ */
9
+ trackConversion: (visitorCode: string, goalId: number, revenue?: number) => void;
10
+ }
11
+ /**
12
+ * A React HOC that gives a wrapped component access to callback function
13
+ * which tracks conversion
14
+ */
15
+ export declare function withTrackingConversion<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithTrackingConversion>>;
16
+ export {};
@@ -0,0 +1,36 @@
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.withTrackingConversion = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_1 = require("react");
17
+ var ProviderError_1 = require("./ProviderError");
18
+ var KameleoonContext_1 = require("./KameleoonContext");
19
+ /**
20
+ * A React HOC that gives a wrapped component access to callback function
21
+ * which tracks conversion
22
+ */
23
+ function withTrackingConversion(Component) {
24
+ return function WrappedComponent(props) {
25
+ var client = (0, react_1.useContext)(KameleoonContext_1.KameleoonContext);
26
+ var trackConversion = (0, react_1.useCallback)(function (visitorCode, goalId, revenue) {
27
+ if (!client) {
28
+ throw new ProviderError_1.ProviderError('withTrackingConversion');
29
+ }
30
+ return client.trackConversion(visitorCode, goalId, revenue);
31
+ }, [client]);
32
+ return ((0, jsx_runtime_1.jsx)(Component, __assign({ trackConversion: trackConversion }, props), void 0));
33
+ };
34
+ }
35
+ exports.withTrackingConversion = withTrackingConversion;
36
+ //# sourceMappingURL=withTrackingConversion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withTrackingConversion.js","sourceRoot":"","sources":["../src/withTrackingConversion.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAuD;AAEvD,iDAAgD;AAChD,uDAAsD;AAetD;;;GAGG;AACH,SAAgB,sBAAsB,CACpC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAM,eAAe,GAAG,IAAA,mBAAW,EACjC,UAAC,WAAmB,EAAE,MAAc,EAAE,OAAgB;YACpD,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,6BAAa,CAAC,wBAAwB,CAAC,CAAC;aACnD;YAED,OAAO,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,OAAO,CACL,uBAAC,SAAS,aAAC,eAAe,EAAE,eAAe,IAAO,KAAe,UAAI,CACtE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AArBD,wDAqBC"}
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { KameleoonError } from './KameleoonError';
3
+ import { UnknownPropsType, Without } from './types';
4
+ interface IWithTriggerExperiment {
5
+ /**
6
+ * @param visitorCode - unique identifier of the user
7
+ * @param experimentId - unique identifier of the experiment you want to expose to a user
8
+ */
9
+ getVariationId: (visitorCode: string, experimentId: number) => number;
10
+ triggerExperimentError: KameleoonError | null;
11
+ }
12
+ /**
13
+ * A React HOC that gives a wrapped component access to callback function which triggers experiment
14
+ * If such a user has never been associated with any variation, the SDK returns a randomly selected variation.
15
+ * If a user with a given visitorCode is already registered with a variation,
16
+ * it will detect the previously registered variation and return the variationID
17
+ */
18
+ export declare function withTriggerExperiment<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithTriggerExperiment>>;
19
+ export {};
@@ -0,0 +1,30 @@
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.withTriggerExperiment = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var useTriggerExperiment_1 = require("./useTriggerExperiment");
17
+ /**
18
+ * A React HOC that gives a wrapped component access to callback function which triggers experiment
19
+ * If such a user has never been associated with any variation, the SDK returns a randomly selected variation.
20
+ * If a user with a given visitorCode is already registered with a variation,
21
+ * it will detect the previously registered variation and return the variationID
22
+ */
23
+ function withTriggerExperiment(Component) {
24
+ return function WrappedComponent(props) {
25
+ var _a = (0, useTriggerExperiment_1.useTriggerExperiment)(), getVariationId = _a.getVariationId, triggerExperimentError = _a.error;
26
+ return ((0, jsx_runtime_1.jsx)(Component, __assign({ getVariationId: getVariationId, triggerExperimentError: triggerExperimentError }, props), void 0));
27
+ };
28
+ }
29
+ exports.withTriggerExperiment = withTriggerExperiment;
30
+ //# sourceMappingURL=withTriggerExperiment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withTriggerExperiment.js","sourceRoot":"","sources":["../src/withTriggerExperiment.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,+DAA8D;AAW9D;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QACrC,IAAA,KACJ,IAAA,2CAAoB,GAAE,EADhB,cAAc,oBAAA,EAAS,sBAAsB,WAC7B,CAAC;QAEzB,OAAO,CACL,uBAAC,SAAS,aACR,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,sBAAsB,IACzC,KAAe,UACpB,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAfD,sDAeC"}
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { UnknownPropsType, Without, VariationAssociatedDataType } from './types';
3
+ import { KameleoonError } from './KameleoonError';
4
+ interface IWithVariationAssociatedData {
5
+ /**
6
+ * @param variationId - unique identifier of the variation you want to obtain associated data for
7
+ */
8
+ getVariationAssociatedData: (variationId: number) => VariationAssociatedDataType;
9
+ variationAssociatedDataError: KameleoonError | null;
10
+ }
11
+ /**
12
+ * A React HOC that gives a wrapped component access to callback function which
13
+ * retrieves JSON data associated with a variation.
14
+ * The JSON data usually represents some metadata of the variation,
15
+ * and can be configured on our web application interface or via our Automation API.
16
+ */
17
+ export declare function withVariationAssociatedData<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithVariationAssociatedData>>;
18
+ export {};
@@ -0,0 +1,30 @@
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.withVariationAssociatedData = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var useVariationAssociatedData_1 = require("./useVariationAssociatedData");
17
+ /**
18
+ * A React HOC that gives a wrapped component access to callback function which
19
+ * retrieves JSON data associated with a variation.
20
+ * The JSON data usually represents some metadata of the variation,
21
+ * and can be configured on our web application interface or via our Automation API.
22
+ */
23
+ function withVariationAssociatedData(Component) {
24
+ return function WrappedComponent(props) {
25
+ var _a = (0, useVariationAssociatedData_1.useVariationAssociatedData)(), getVariationAssociatedData = _a.getVariationAssociatedData, variationAssociatedDataError = _a.error;
26
+ return ((0, jsx_runtime_1.jsx)(Component, __assign({ getVariationAssociatedData: getVariationAssociatedData, variationAssociatedDataError: variationAssociatedDataError }, props), void 0));
27
+ };
28
+ }
29
+ exports.withVariationAssociatedData = withVariationAssociatedData;
30
+ //# sourceMappingURL=withVariationAssociatedData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withVariationAssociatedData.js","sourceRoot":"","sources":["../src/withVariationAssociatedData.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMA,2EAA0E;AAa1E;;;;;GAKG;AACH,SAAgB,2BAA2B,CACzC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QACrC,IAAA,KACJ,IAAA,uDAA0B,GAAE,EADtB,0BAA0B,gCAAA,EAAS,4BAA4B,WACzC,CAAC;QAE/B,OAAO,CACL,uBAAC,SAAS,aACR,0BAA0B,EAAE,0BAA0B,EACtD,4BAA4B,EAAE,4BAA4B,IACrD,KAAe,UACpB,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAfD,kEAeC"}
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { UnknownPropsType, Without } from './types';
3
+ interface IWithVisitorCode {
4
+ /**
5
+ * @param topLevelDomain - current top level domain for the concerned site
6
+ * @param defaultVisitorCode - this parameter will be used as the visitorCode
7
+ */
8
+ getVisitorCode: (topLevelDomain: string, defaultVisitorCode?: string) => string;
9
+ }
10
+ /**
11
+ * A React HOC that gives a wrapped component access to callback function
12
+ * which obtains the Kameleoon visitorCode for the current visitor
13
+ */
14
+ export declare function withVisitorCode<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithVisitorCode>>;
15
+ export {};
@@ -0,0 +1,36 @@
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.withVisitorCode = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_1 = require("react");
17
+ var KameleoonContext_1 = require("./KameleoonContext");
18
+ var ProviderError_1 = require("./ProviderError");
19
+ /**
20
+ * A React HOC that gives a wrapped component access to callback function
21
+ * which obtains the Kameleoon visitorCode for the current visitor
22
+ */
23
+ function withVisitorCode(Component) {
24
+ return function WrappedComponent(props) {
25
+ var client = (0, react_1.useContext)(KameleoonContext_1.KameleoonContext);
26
+ var getVisitorCode = (0, react_1.useCallback)(function (topLevelDomain, defaultVisitorCode) {
27
+ if (!client) {
28
+ throw new ProviderError_1.ProviderError('withVisitorCode');
29
+ }
30
+ return client.obtainVisitorCode(topLevelDomain, defaultVisitorCode);
31
+ }, [client]);
32
+ return (0, jsx_runtime_1.jsx)(Component, __assign({ getVisitorCode: getVisitorCode }, props), void 0);
33
+ };
34
+ }
35
+ exports.withVisitorCode = withVisitorCode;
36
+ //# sourceMappingURL=withVisitorCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withVisitorCode.js","sourceRoot":"","sources":["../src/withVisitorCode.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAuD;AAEvD,uDAAsD;AACtD,iDAAgD;AAahD;;;GAGG;AACH,SAAgB,eAAe,CAC7B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAM,cAAc,GAAG,IAAA,mBAAW,EAChC,UAAC,cAAsB,EAAE,kBAA2B;YAClD,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,6BAAa,CAAC,iBAAiB,CAAC,CAAC;aAC5C;YAED,OAAO,MAAM,CAAC,iBAAiB,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QACtE,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,cAAc,EAAE,cAAc,IAAO,KAAe,UAAI,CAAC;IAC7E,CAAC,CAAC;AACJ,CAAC;AAnBD,0CAmBC"}
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@kameleoon/react-sdk",
3
- "version": "4.0.0",
3
+ "version": "4.0.3",
4
4
  "description": "Kameleoon React SDK",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
8
8
  "main": "dist/index.js",
9
9
  "scripts": {
10
- "clear": "rimraf dist",
10
+ "clear": "rimraf dist && rimraf tsconfig.tsbuildinfo",
11
11
  "start": "npm run clear && tsc -w",
12
12
  "build": "npm run clear && tsc",
13
13
  "deploy": "npm publish --tag latest --access public",
14
+ "deploy-nexus": "npm publish --registry=https://nexus.kameleoon.net/repository/npm-kameleoon/",
14
15
  "release": "../../scripts/release.sh react-sdk",
15
16
  "update-documentation": "../../scripts/update_documentation.sh react",
16
17
  "test": "jest",