@kameleoon/react-sdk 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -20
- package/package.json +2 -2
- package/CHANGELOG.md +0 -80
- package/dist/Feature.d.ts +0 -11
- package/dist/Feature.js +0 -26
- package/dist/Feature.js.map +0 -1
- package/dist/KameleoonContext.d.ts +0 -3
- package/dist/KameleoonContext.js +0 -6
- package/dist/KameleoonContext.js.map +0 -1
- package/dist/KameleoonError.d.ts +0 -5
- package/dist/KameleoonError.js +0 -31
- package/dist/KameleoonError.js.map +0 -1
- package/dist/KameleoonProvider.d.ts +0 -14
- package/dist/KameleoonProvider.js +0 -25
- package/dist/KameleoonProvider.js.map +0 -1
- package/dist/ProviderError.d.ts +0 -3
- package/dist/ProviderError.js +0 -29
- package/dist/ProviderError.js.map +0 -1
- package/dist/compose.d.ts +0 -8
- package/dist/compose.js +0 -58
- package/dist/compose.js.map +0 -1
- package/dist/constants.d.ts +0 -24
- package/dist/constants.js +0 -31
- package/dist/constants.js.map +0 -1
- package/dist/getKameleoonException.d.ts +0 -2
- package/dist/getKameleoonException.js +0 -34
- package/dist/getKameleoonException.js.map +0 -1
- package/dist/index.d.ts +0 -42
- package/dist/index.js +0 -105
- package/dist/index.js.map +0 -1
- package/dist/kameleoonClient.d.ts +0 -16
- package/dist/kameleoonClient.js +0 -17
- package/dist/kameleoonClient.js.map +0 -1
- package/dist/stories/Form.d.ts +0 -30
- package/dist/stories/Form.js +0 -215
- package/dist/stories/Form.js.map +0 -1
- package/dist/stories/FormHOC.d.ts +0 -2
- package/dist/stories/FormHOC.js +0 -41
- package/dist/stories/FormHOC.js.map +0 -1
- package/dist/stories/FormHook.d.ts +0 -2
- package/dist/stories/FormHook.js +0 -74
- package/dist/stories/FormHook.js.map +0 -1
- package/dist/stories/FormRenderProps.d.ts +0 -3
- package/dist/stories/FormRenderProps.js +0 -24
- package/dist/stories/FormRenderProps.js.map +0 -1
- package/dist/stories/Radio.d.ts +0 -8
- package/dist/stories/Radio.js +0 -9
- package/dist/stories/Radio.js.map +0 -1
- package/dist/stories/constants.d.ts +0 -16
- package/dist/stories/constants.js +0 -21
- package/dist/stories/constants.js.map +0 -1
- package/dist/types.d.ts +0 -37
- package/dist/types.js +0 -4
- package/dist/types.js.map +0 -1
- package/dist/useActivateFeature.d.ts +0 -14
- package/dist/useActivateFeature.js +0 -32
- package/dist/useActivateFeature.js.map +0 -1
- package/dist/useAddData.d.ts +0 -14
- package/dist/useAddData.js +0 -49
- package/dist/useAddData.js.map +0 -1
- package/dist/useBrowser.d.ts +0 -13
- package/dist/useBrowser.js +0 -22
- package/dist/useBrowser.js.map +0 -1
- package/dist/useConversion.d.ts +0 -14
- package/dist/useConversion.js +0 -18
- package/dist/useConversion.js.map +0 -1
- package/dist/useCustomData.d.ts +0 -13
- package/dist/useCustomData.js +0 -18
- package/dist/useCustomData.js.map +0 -1
- package/dist/useError.d.ts +0 -7
- package/dist/useError.js +0 -34
- package/dist/useError.js.map +0 -1
- package/dist/useErrors.d.ts +0 -7
- package/dist/useErrors.js +0 -42
- package/dist/useErrors.js.map +0 -1
- package/dist/useFeature.d.ts +0 -5
- package/dist/useFeature.js +0 -104
- package/dist/useFeature.js.map +0 -1
- package/dist/useFeatureVariable.d.ts +0 -15
- package/dist/useFeatureVariable.js +0 -45
- package/dist/useFeatureVariable.js.map +0 -1
- package/dist/useFlush.d.ts +0 -11
- package/dist/useFlush.js +0 -19
- package/dist/useFlush.js.map +0 -1
- package/dist/useInterest.d.ts +0 -12
- package/dist/useInterest.js +0 -16
- package/dist/useInterest.js.map +0 -1
- package/dist/useKameleoon.d.ts +0 -10
- package/dist/useKameleoon.js +0 -20
- package/dist/useKameleoon.js.map +0 -1
- package/dist/usePageView.d.ts +0 -14
- package/dist/usePageView.js +0 -18
- package/dist/usePageView.js.map +0 -1
- package/dist/useRetrieveDataFromRemoteSource.d.ts +0 -12
- package/dist/useRetrieveDataFromRemoteSource.js +0 -79
- package/dist/useRetrieveDataFromRemoteSource.js.map +0 -1
- package/dist/useRunWhenReady.d.ts +0 -14
- package/dist/useRunWhenReady.js +0 -23
- package/dist/useRunWhenReady.js.map +0 -1
- package/dist/useTrackingConversion.d.ts +0 -13
- package/dist/useTrackingConversion.js +0 -19
- package/dist/useTrackingConversion.js.map +0 -1
- package/dist/useTriggerExperiment.d.ts +0 -17
- package/dist/useTriggerExperiment.js +0 -32
- package/dist/useTriggerExperiment.js.map +0 -1
- package/dist/useVariationAssociatedData.d.ts +0 -16
- package/dist/useVariationAssociatedData.js +0 -30
- package/dist/useVariationAssociatedData.js.map +0 -1
- package/dist/useVisitorCode.d.ts +0 -12
- package/dist/useVisitorCode.js +0 -19
- package/dist/useVisitorCode.js.map +0 -1
- package/dist/withActivateFeature.d.ts +0 -17
- package/dist/withActivateFeature.js +0 -28
- package/dist/withActivateFeature.js.map +0 -1
- package/dist/withAddData.d.ts +0 -16
- package/dist/withAddData.js +0 -65
- package/dist/withAddData.js.map +0 -1
- package/dist/withBrowser.d.ts +0 -16
- package/dist/withBrowser.js +0 -35
- package/dist/withBrowser.js.map +0 -1
- package/dist/withConversion.d.ts +0 -17
- package/dist/withConversion.js +0 -31
- package/dist/withConversion.js.map +0 -1
- package/dist/withCustomData.d.ts +0 -16
- package/dist/withCustomData.js +0 -31
- package/dist/withCustomData.js.map +0 -1
- package/dist/withFeature.d.ts +0 -6
- package/dist/withFeature.js +0 -31
- package/dist/withFeature.js.map +0 -1
- package/dist/withFeatureVariable.d.ts +0 -17
- package/dist/withFeatureVariable.js +0 -28
- package/dist/withFeatureVariable.js.map +0 -1
- package/dist/withFlush.d.ts +0 -14
- package/dist/withFlush.js +0 -36
- package/dist/withFlush.js.map +0 -1
- package/dist/withInterest.d.ts +0 -15
- package/dist/withInterest.js +0 -31
- package/dist/withInterest.js.map +0 -1
- package/dist/withKameleoon.d.ts +0 -13
- package/dist/withKameleoon.js +0 -33
- package/dist/withKameleoon.js.map +0 -1
- package/dist/withPageView.d.ts +0 -17
- package/dist/withPageView.js +0 -31
- package/dist/withPageView.js.map +0 -1
- package/dist/withRetrieveDataFromRemoteSource.d.ts +0 -14
- package/dist/withRetrieveDataFromRemoteSource.js +0 -28
- package/dist/withRetrieveDataFromRemoteSource.js.map +0 -1
- package/dist/withRunWhenReady.d.ts +0 -16
- package/dist/withRunWhenReady.js +0 -28
- package/dist/withRunWhenReady.js.map +0 -1
- package/dist/withTrackingConversion.d.ts +0 -16
- package/dist/withTrackingConversion.js +0 -36
- package/dist/withTrackingConversion.js.map +0 -1
- package/dist/withTriggerExperiment.d.ts +0 -19
- package/dist/withTriggerExperiment.js +0 -30
- package/dist/withTriggerExperiment.js.map +0 -1
- package/dist/withVariationAssociatedData.d.ts +0 -18
- package/dist/withVariationAssociatedData.js +0 -30
- package/dist/withVariationAssociatedData.js.map +0 -1
- package/dist/withVisitorCode.d.ts +0 -15
- package/dist/withVisitorCode.js +0 -36
- package/dist/withVisitorCode.js.map +0 -1
package/README.md
CHANGED
|
@@ -470,8 +470,8 @@ If feature flag is not activated, `KameleoonException.FeatureConfigurationNotFou
|
|
|
470
470
|
|
|
471
471
|
#### `hasFeature()`
|
|
472
472
|
##### Arguments
|
|
473
|
-
- `visitorCode: string` - unique identifier of the user.
|
|
474
473
|
- `featureKey: string | number` - unique identifier or key of the feature you want to expose to a user.
|
|
474
|
+
- `visitorCode: string` (optional) - unique identifier of the user.
|
|
475
475
|
|
|
476
476
|
##### Returns
|
|
477
477
|
- A `value: boolean` of the feature that is registered for a given `visitorCode`.
|
|
@@ -502,7 +502,7 @@ function MyComponent(): JSX.Element {
|
|
|
502
502
|
// Handle exception
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
-
const feature = hasFeature(
|
|
505
|
+
const feature = hasFeature(featureKey, visitorCode);
|
|
506
506
|
}, []);
|
|
507
507
|
|
|
508
508
|
...
|
|
@@ -534,7 +534,7 @@ class MyComponent extends React.Component {
|
|
|
534
534
|
// Handle exception
|
|
535
535
|
}
|
|
536
536
|
|
|
537
|
-
const feature = hasFeature(
|
|
537
|
+
const feature = hasFeature(featureKey, visitorCode);
|
|
538
538
|
}
|
|
539
539
|
|
|
540
540
|
...
|
|
@@ -1346,43 +1346,44 @@ export default compose(
|
|
|
1346
1346
|
)(MyComponent);
|
|
1347
1347
|
```
|
|
1348
1348
|
|
|
1349
|
-
##
|
|
1350
|
-
A callback function `
|
|
1349
|
+
## Device
|
|
1350
|
+
A callback function `addDevice()` adds device.
|
|
1351
1351
|
|
|
1352
|
-
#### `
|
|
1352
|
+
#### `addDevice`
|
|
1353
1353
|
##### Arguments
|
|
1354
|
-
- `
|
|
1354
|
+
- `device: DeviceType` - device type: Phone, Tablet, Desktop.
|
|
1355
|
+
|
|
1355
1356
|
|
|
1356
1357
|
##### Returns
|
|
1357
|
-
- An instance of `
|
|
1358
|
+
- An instance of `Device: IDevice`.
|
|
1358
1359
|
|
|
1359
|
-
### `
|
|
1360
|
+
### `useDevice`
|
|
1360
1361
|
#### Returns
|
|
1361
|
-
- A callback function `
|
|
1362
|
+
- A callback function `addDevice()`.
|
|
1362
1363
|
|
|
1363
1364
|
#### Example
|
|
1364
1365
|
```jsx
|
|
1365
1366
|
import { useEffect } from 'react';
|
|
1366
|
-
import { useAddData,
|
|
1367
|
+
import { useAddData, useDevice, DeviceType, useVisitorCode } from '@kameleoon/react-sdk';
|
|
1367
1368
|
|
|
1368
1369
|
function MyComponent(): JSX.Element {
|
|
1369
1370
|
const { addData } = useAddData();
|
|
1370
1371
|
const { getVisitorCode } = useVisitorCode();
|
|
1371
|
-
const {
|
|
1372
|
+
const { addDevice } = useDevice();
|
|
1372
1373
|
|
|
1373
1374
|
useEffect(() => {
|
|
1374
1375
|
const visitorCode = getVisitorCode('example.com');
|
|
1375
1376
|
|
|
1376
|
-
addData(visitorCode, [
|
|
1377
|
+
addData(visitorCode, [addDevice(DeviceType.Desktop)]);
|
|
1377
1378
|
}, []);
|
|
1378
1379
|
|
|
1379
1380
|
...
|
|
1380
1381
|
}
|
|
1381
1382
|
```
|
|
1382
1383
|
|
|
1383
|
-
### `
|
|
1384
|
+
### `withDevice`
|
|
1384
1385
|
#### Arguments
|
|
1385
|
-
- `Component: React.Component` - component which will be enhanced with the prop `
|
|
1386
|
+
- `Component: React.Component` - component which will be enhanced with the prop `addDevice()`.
|
|
1386
1387
|
|
|
1387
1388
|
#### Returns
|
|
1388
1389
|
- A wrapped component with additional props as described above.
|
|
@@ -1392,16 +1393,17 @@ function MyComponent(): JSX.Element {
|
|
|
1392
1393
|
import {
|
|
1393
1394
|
withVisitorCode,
|
|
1394
1395
|
withAddData,
|
|
1395
|
-
|
|
1396
|
+
withDevice,
|
|
1397
|
+
DeviceType,
|
|
1396
1398
|
compose,
|
|
1397
1399
|
} from '@kameleoon/react-sdk';
|
|
1398
1400
|
|
|
1399
1401
|
class MyComponent extends React.Component {
|
|
1400
1402
|
componentDidMount() {
|
|
1401
|
-
const { addData,
|
|
1403
|
+
const { addData, addDevice, getVisitorCode } = this.props;
|
|
1402
1404
|
const visitorCode = getVisitorCode('example.com');
|
|
1403
1405
|
|
|
1404
|
-
addData(visitorCode, [
|
|
1406
|
+
addData(visitorCode, [addDevice(DeviceType.Desktop)]);
|
|
1405
1407
|
}
|
|
1406
1408
|
|
|
1407
1409
|
...
|
|
@@ -1409,7 +1411,7 @@ class MyComponent extends React.Component {
|
|
|
1409
1411
|
|
|
1410
1412
|
export default compose(
|
|
1411
1413
|
withAddData,
|
|
1412
|
-
|
|
1414
|
+
withDevice,
|
|
1413
1415
|
withVisitorCode,
|
|
1414
1416
|
)(MyComponent);
|
|
1415
1417
|
```
|
|
@@ -1441,4 +1443,4 @@ class MyComponent extends React.Component {
|
|
|
1441
1443
|
}
|
|
1442
1444
|
|
|
1443
1445
|
export default compose(withVisitorCode, withTriggerExperiment)(MyComponent);
|
|
1444
|
-
```
|
|
1446
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kameleoon/react-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Kameleoon React SDK",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@types/validator": "^13.6.3",
|
|
38
|
-
"kameleoon-client-javascript": "^1.0.
|
|
38
|
+
"kameleoon-client-javascript": "^1.0.9",
|
|
39
39
|
"validator": "^13.6.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
package/CHANGELOG.md
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
[Project Homepage](https://developers.kameleoon.com/react-js-sdk.html)
|
|
7
|
-
|
|
8
|
-
# 3.0.0 (2022-07-01)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Features
|
|
12
|
-
|
|
13
|
-
* error handling
|
|
14
|
-
|
|
15
|
-
### Breaking change
|
|
16
|
-
|
|
17
|
-
* `useFeature` hook and `withFeature` high-order component can no longer be used the same way
|
|
18
|
-
|
|
19
|
-
# 2.1.0 (2022-04-18)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### Features
|
|
23
|
-
|
|
24
|
-
* retrieve data from remote source
|
|
25
|
-
|
|
26
|
-
# 2.0.0 (2022-02-24)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Features
|
|
30
|
-
|
|
31
|
-
* add multi environment support
|
|
32
|
-
|
|
33
|
-
### Breaking change
|
|
34
|
-
|
|
35
|
-
* variableKeys became an object and no longer can be used as an array or a string
|
|
36
|
-
|
|
37
|
-
# 1.2.2 (2022-02-06)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
### Bug fixes
|
|
41
|
-
|
|
42
|
-
* bundle source and internal changelog
|
|
43
|
-
|
|
44
|
-
# 1.2.1 (2022-02-06)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
### Bug fixes
|
|
48
|
-
|
|
49
|
-
* decrease bundle size
|
|
50
|
-
|
|
51
|
-
# 1.2.0 (2022-01-27)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
### Bug Fixes
|
|
55
|
-
|
|
56
|
-
* linting issues
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
# 1.1.0 (2022-01-26)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
### Bug Fixes
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* package json
|
|
66
|
-
|
|
67
|
-
# 1.0.0 (2022-01-20)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
### Bug Fixes
|
|
71
|
-
|
|
72
|
-
* linting and addData
|
|
73
|
-
|
|
74
|
-
### Features
|
|
75
|
-
|
|
76
|
-
* add HOCs
|
|
77
|
-
* add render props
|
|
78
|
-
* test react sdk methods
|
|
79
|
-
* complete the documentation
|
|
80
|
-
* add createClient, provider and hooks
|
package/dist/Feature.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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
|
package/dist/Feature.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/KameleoonContext.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/KameleoonError.d.ts
DELETED
package/dist/KameleoonError.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/ProviderError.d.ts
DELETED
package/dist/ProviderError.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/compose.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
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
|
package/dist/compose.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/constants.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
|
package/dist/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export { KameleoonContext } from './KameleoonContext';
|
|
2
|
-
export { KAMELEOON_SDK_LOCAL_STORAGE_KEY, Browser, KameleoonException, } from './constants';
|
|
3
|
-
export { Browser as IBrowser, Conversion as IConversion, Interest as IInterest, PageView as IPageView, } 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 { useInterest } from './useInterest';
|
|
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 { withPageView } from './withPageView';
|
|
39
|
-
export { withConversion } from './withConversion';
|
|
40
|
-
export { withCustomData } from './withCustomData';
|
|
41
|
-
export { withInterest } from './withInterest';
|
|
42
|
-
export { withRunWhenReady } from './withRunWhenReady';
|