@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.
- package/README.md +17 -20
- package/dist/Feature.d.ts +11 -0
- package/dist/Feature.js +26 -0
- package/dist/Feature.js.map +1 -0
- package/dist/KameleoonContext.d.ts +3 -0
- package/dist/KameleoonContext.js +6 -0
- package/dist/KameleoonContext.js.map +1 -0
- package/dist/KameleoonError.d.ts +5 -0
- package/dist/KameleoonError.js +31 -0
- package/dist/KameleoonError.js.map +1 -0
- package/dist/KameleoonProvider.d.ts +14 -0
- package/dist/KameleoonProvider.js +25 -0
- package/dist/KameleoonProvider.js.map +1 -0
- package/dist/ProviderError.d.ts +3 -0
- package/dist/ProviderError.js +29 -0
- package/dist/ProviderError.js.map +1 -0
- package/dist/compose.d.ts +8 -0
- package/dist/compose.js +58 -0
- package/dist/compose.js.map +1 -0
- package/dist/constants.d.ts +24 -0
- package/dist/constants.js +31 -0
- package/dist/constants.js.map +1 -0
- package/dist/getKameleoonException.d.ts +2 -0
- package/dist/getKameleoonException.js +34 -0
- package/dist/getKameleoonException.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/kameleoonClient.d.ts +16 -0
- package/dist/kameleoonClient.js +17 -0
- package/dist/kameleoonClient.js.map +1 -0
- package/dist/types.d.ts +37 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/useActivateFeature.d.ts +14 -0
- package/dist/useActivateFeature.js +35 -0
- package/dist/useActivateFeature.js.map +1 -0
- package/dist/useAddData.d.ts +14 -0
- package/dist/useAddData.js +49 -0
- package/dist/useAddData.js.map +1 -0
- package/dist/useBrowser.d.ts +13 -0
- package/dist/useBrowser.js +22 -0
- package/dist/useBrowser.js.map +1 -0
- package/dist/useConversion.d.ts +14 -0
- package/dist/useConversion.js +18 -0
- package/dist/useConversion.js.map +1 -0
- package/dist/useCustomData.d.ts +13 -0
- package/dist/useCustomData.js +18 -0
- package/dist/useCustomData.js.map +1 -0
- package/dist/useDevice.d.ts +12 -0
- package/dist/useDevice.js +16 -0
- package/dist/useDevice.js.map +1 -0
- package/dist/useError.d.ts +7 -0
- package/dist/useError.js +18 -0
- package/dist/useError.js.map +1 -0
- package/dist/useErrors.d.ts +7 -0
- package/dist/useErrors.js +42 -0
- package/dist/useErrors.js.map +1 -0
- package/dist/useFeature.d.ts +5 -0
- package/dist/useFeature.js +104 -0
- package/dist/useFeature.js.map +1 -0
- package/dist/useFeatureVariable.d.ts +15 -0
- package/dist/useFeatureVariable.js +41 -0
- package/dist/useFeatureVariable.js.map +1 -0
- package/dist/useFlush.d.ts +11 -0
- package/dist/useFlush.js +19 -0
- package/dist/useFlush.js.map +1 -0
- package/dist/useKameleoon.d.ts +10 -0
- package/dist/useKameleoon.js +20 -0
- package/dist/useKameleoon.js.map +1 -0
- package/dist/usePageView.d.ts +14 -0
- package/dist/usePageView.js +18 -0
- package/dist/usePageView.js.map +1 -0
- package/dist/useRetrieveDataFromRemoteSource.d.ts +12 -0
- package/dist/useRetrieveDataFromRemoteSource.js +79 -0
- package/dist/useRetrieveDataFromRemoteSource.js.map +1 -0
- package/dist/useRunWhenReady.d.ts +14 -0
- package/dist/useRunWhenReady.js +23 -0
- package/dist/useRunWhenReady.js.map +1 -0
- package/dist/useTrackingConversion.d.ts +13 -0
- package/dist/useTrackingConversion.js +19 -0
- package/dist/useTrackingConversion.js.map +1 -0
- package/dist/useTriggerExperiment.d.ts +17 -0
- package/dist/useTriggerExperiment.js +32 -0
- package/dist/useTriggerExperiment.js.map +1 -0
- package/dist/useVariationAssociatedData.d.ts +16 -0
- package/dist/useVariationAssociatedData.js +30 -0
- package/dist/useVariationAssociatedData.js.map +1 -0
- package/dist/useVisitorCode.d.ts +12 -0
- package/dist/useVisitorCode.js +19 -0
- package/dist/useVisitorCode.js.map +1 -0
- package/dist/withActivateFeature.d.ts +17 -0
- package/dist/withActivateFeature.js +28 -0
- package/dist/withActivateFeature.js.map +1 -0
- package/dist/withAddData.d.ts +16 -0
- package/dist/withAddData.js +65 -0
- package/dist/withAddData.js.map +1 -0
- package/dist/withBrowser.d.ts +16 -0
- package/dist/withBrowser.js +35 -0
- package/dist/withBrowser.js.map +1 -0
- package/dist/withConversion.d.ts +17 -0
- package/dist/withConversion.js +31 -0
- package/dist/withConversion.js.map +1 -0
- package/dist/withCustomData.d.ts +16 -0
- package/dist/withCustomData.js +31 -0
- package/dist/withCustomData.js.map +1 -0
- package/dist/withDevice.d.ts +15 -0
- package/dist/withDevice.js +29 -0
- package/dist/withDevice.js.map +1 -0
- package/dist/withFeature.d.ts +6 -0
- package/dist/withFeature.js +31 -0
- package/dist/withFeature.js.map +1 -0
- package/dist/withFeatureVariable.d.ts +17 -0
- package/dist/withFeatureVariable.js +28 -0
- package/dist/withFeatureVariable.js.map +1 -0
- package/dist/withFlush.d.ts +14 -0
- package/dist/withFlush.js +36 -0
- package/dist/withFlush.js.map +1 -0
- package/dist/withKameleoon.d.ts +13 -0
- package/dist/withKameleoon.js +33 -0
- package/dist/withKameleoon.js.map +1 -0
- package/dist/withPageView.d.ts +17 -0
- package/dist/withPageView.js +31 -0
- package/dist/withPageView.js.map +1 -0
- package/dist/withRetrieveDataFromRemoteSource.d.ts +14 -0
- package/dist/withRetrieveDataFromRemoteSource.js +28 -0
- package/dist/withRetrieveDataFromRemoteSource.js.map +1 -0
- package/dist/withRunWhenReady.d.ts +16 -0
- package/dist/withRunWhenReady.js +28 -0
- package/dist/withRunWhenReady.js.map +1 -0
- package/dist/withTrackingConversion.d.ts +16 -0
- package/dist/withTrackingConversion.js +36 -0
- package/dist/withTrackingConversion.js.map +1 -0
- package/dist/withTriggerExperiment.d.ts +19 -0
- package/dist/withTriggerExperiment.js +30 -0
- package/dist/withTriggerExperiment.js.map +1 -0
- package/dist/withVariationAssociatedData.d.ts +18 -0
- package/dist/withVariationAssociatedData.js +30 -0
- package/dist/withVariationAssociatedData.js.map +1 -0
- package/dist/withVisitorCode.d.ts +15 -0
- package/dist/withVisitorCode.js +36 -0
- package/dist/withVisitorCode.js.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -820,7 +820,7 @@ _The `triggerExperiment()` and `trackConversion()` callback functions also sends
|
|
|
820
820
|
#### `addData()`
|
|
821
821
|
##### Arguments
|
|
822
822
|
- `visitorCode: string` - unique identifier of the user.
|
|
823
|
-
- `dataTypes: DataInterface[]` - custom data types.
|
|
823
|
+
- `dataTypes: DataInterface[]` - custom data types which may be passed separated by a comma.
|
|
824
824
|
|
|
825
825
|
### `useAddData`
|
|
826
826
|
#### Returns
|
|
@@ -848,10 +848,10 @@ function MyComponent(): JSX.Element {
|
|
|
848
848
|
const visitorCode = getVisitorCode('example.com');
|
|
849
849
|
|
|
850
850
|
// Single data type passed
|
|
851
|
-
addData(visitorCode,
|
|
851
|
+
addData(visitorCode, addBrowser(Browser.Chrome));
|
|
852
852
|
|
|
853
853
|
// Several data types passed
|
|
854
|
-
addData(visitorCode,
|
|
854
|
+
addData(visitorCode, addBrowser(Browser.Chrome), addCustomData(1, 'some custom value'));
|
|
855
855
|
}, []);
|
|
856
856
|
|
|
857
857
|
...
|
|
@@ -882,13 +882,10 @@ class MyComponent extends React.Component {
|
|
|
882
882
|
const visitorCode = getVisitorCode('example.com');
|
|
883
883
|
|
|
884
884
|
// Single data type passed
|
|
885
|
-
addData(visitorCode,
|
|
885
|
+
addData(visitorCode, addBrowser(Browser.Chrome));
|
|
886
886
|
|
|
887
887
|
// Several data types passed
|
|
888
|
-
addData(visitorCode,
|
|
889
|
-
addBrowser(Browser.Chrome),
|
|
890
|
-
addCustomData(1, 'some custom value'),
|
|
891
|
-
]);
|
|
888
|
+
addData(visitorCode, addBrowser(Browser.Chrome), addCustomData(1, 'some custom value'));
|
|
892
889
|
}
|
|
893
890
|
|
|
894
891
|
...
|
|
@@ -935,7 +932,7 @@ function MyComponent(): JSX.Element {
|
|
|
935
932
|
useEffect(() => {
|
|
936
933
|
const visitorCode = getVisitorCode('example.com');
|
|
937
934
|
|
|
938
|
-
addData(visitorCode,
|
|
935
|
+
addData(visitorCode, addBrowser(Browser.Chrome));
|
|
939
936
|
flush(visitorCode);
|
|
940
937
|
}, []);
|
|
941
938
|
|
|
@@ -966,7 +963,7 @@ class MyComponent extends React.Component {
|
|
|
966
963
|
const { addData, addBrowser, flush, getVisitorCode } = this.props;
|
|
967
964
|
const visitorCode = getVisitorCode('example.com');
|
|
968
965
|
|
|
969
|
-
addData(visitorCode,
|
|
966
|
+
addData(visitorCode, addBrowser(Browser.Chrome));
|
|
970
967
|
flush(visitorCode);
|
|
971
968
|
}
|
|
972
969
|
|
|
@@ -1089,7 +1086,7 @@ function MyComponent(): JSX.Element {
|
|
|
1089
1086
|
useEffect(() => {
|
|
1090
1087
|
const visitorCode = getVisitorCode('example.com');
|
|
1091
1088
|
|
|
1092
|
-
addData(visitorCode,
|
|
1089
|
+
addData(visitorCode, addBrowser(Browser.Chrome));
|
|
1093
1090
|
}, []);
|
|
1094
1091
|
|
|
1095
1092
|
...
|
|
@@ -1118,7 +1115,7 @@ class MyComponent extends React.Component {
|
|
|
1118
1115
|
const { addData, addBrowser, getVisitorCode } = this.props;
|
|
1119
1116
|
const visitorCode = getVisitorCode('example.com');
|
|
1120
1117
|
|
|
1121
|
-
addData(visitorCode,
|
|
1118
|
+
addData(visitorCode, addBrowser(Browser.Chrome));
|
|
1122
1119
|
}
|
|
1123
1120
|
|
|
1124
1121
|
...
|
|
@@ -1159,7 +1156,7 @@ function MyComponent(): JSX.Element {
|
|
|
1159
1156
|
useEffect(() => {
|
|
1160
1157
|
const visitorCode = getVisitorCode('example.com');
|
|
1161
1158
|
|
|
1162
|
-
addData(visitorCode,
|
|
1159
|
+
addData(visitorCode, addPageView('example.com', 'title', 3));
|
|
1163
1160
|
}, []);
|
|
1164
1161
|
|
|
1165
1162
|
...
|
|
@@ -1190,7 +1187,7 @@ class MyComponent extends React.Component {
|
|
|
1190
1187
|
const { addData, addPageView, getVisitorCode } = this.props;
|
|
1191
1188
|
const visitorCode = getVisitorCode('example.com');
|
|
1192
1189
|
|
|
1193
|
-
addData(visitorCode,
|
|
1190
|
+
addData(visitorCode, addPageView('example.com', 'title', 3));
|
|
1194
1191
|
}
|
|
1195
1192
|
|
|
1196
1193
|
...
|
|
@@ -1232,7 +1229,7 @@ function MyComponent(): JSX.Element {
|
|
|
1232
1229
|
useEffect(() => {
|
|
1233
1230
|
const visitorCode = getVisitorCode('example.com');
|
|
1234
1231
|
|
|
1235
|
-
addData(visitorCode,
|
|
1232
|
+
addData(visitorCode, addConversion(32, 10, false));
|
|
1236
1233
|
}, []);
|
|
1237
1234
|
|
|
1238
1235
|
...
|
|
@@ -1260,7 +1257,7 @@ class MyComponent extends React.Component {
|
|
|
1260
1257
|
const { addData, addConversion, getVisitorCode } = this.props;
|
|
1261
1258
|
const visitorCode = getVisitorCode('example.com');
|
|
1262
1259
|
|
|
1263
|
-
addData(visitorCode,
|
|
1260
|
+
addData(visitorCode, addConversion(32, 10, false));
|
|
1264
1261
|
}
|
|
1265
1262
|
|
|
1266
1263
|
...
|
|
@@ -1305,7 +1302,7 @@ function MyComponent(): JSX.Element {
|
|
|
1305
1302
|
useEffect(() => {
|
|
1306
1303
|
const visitorCode = getVisitorCode('example.com');
|
|
1307
1304
|
|
|
1308
|
-
addData(visitorCode,
|
|
1305
|
+
addData(visitorCode, addCustomData(1, 'some custom value'));
|
|
1309
1306
|
}, []);
|
|
1310
1307
|
|
|
1311
1308
|
...
|
|
@@ -1333,7 +1330,7 @@ class MyComponent extends React.Component {
|
|
|
1333
1330
|
const { addData, addCustomData, getVisitorCode } = this.props;
|
|
1334
1331
|
const visitorCode = getVisitorCode('example.com');
|
|
1335
1332
|
|
|
1336
|
-
addData(visitorCode,
|
|
1333
|
+
addData(visitorCode, addCustomData(1, 'some custom value'));
|
|
1337
1334
|
}
|
|
1338
1335
|
|
|
1339
1336
|
...
|
|
@@ -1374,7 +1371,7 @@ function MyComponent(): JSX.Element {
|
|
|
1374
1371
|
useEffect(() => {
|
|
1375
1372
|
const visitorCode = getVisitorCode('example.com');
|
|
1376
1373
|
|
|
1377
|
-
addData(visitorCode,
|
|
1374
|
+
addData(visitorCode, addDevice(DeviceType.Desktop));
|
|
1378
1375
|
}, []);
|
|
1379
1376
|
|
|
1380
1377
|
...
|
|
@@ -1403,7 +1400,7 @@ class MyComponent extends React.Component {
|
|
|
1403
1400
|
const { addData, addDevice, getVisitorCode } = this.props;
|
|
1404
1401
|
const visitorCode = getVisitorCode('example.com');
|
|
1405
1402
|
|
|
1406
|
-
addData(visitorCode,
|
|
1403
|
+
addData(visitorCode, addDevice(DeviceType.Desktop));
|
|
1407
1404
|
}
|
|
1408
1405
|
|
|
1409
1406
|
...
|
|
@@ -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 {};
|
package/dist/Feature.js
ADDED
|
@@ -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 @@
|
|
|
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,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,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;
|
package/dist/compose.js
ADDED
|
@@ -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,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"}
|
package/dist/index.d.ts
ADDED
|
@@ -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';
|