@kameleoon/react-sdk 1.2.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +86 -13
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/stories/Form.d.ts +4 -3
- package/dist/stories/Form.js +92 -35
- package/dist/stories/Form.js.map +1 -1
- package/dist/stories/FormHOC.js +12 -7
- package/dist/stories/FormHOC.js.map +1 -1
- package/dist/stories/FormHook.js +26 -19
- package/dist/stories/FormHook.js.map +1 -1
- package/dist/stories/constants.d.ts +4 -2
- package/dist/stories/constants.js +10 -8
- package/dist/stories/constants.js.map +1 -1
- package/dist/types.d.ts +10 -1
- package/dist/useConversion.d.ts +1 -1
- package/dist/useFeature.d.ts +1 -1
- package/dist/useFeature.js +16 -8
- package/dist/useFeature.js.map +1 -1
- package/dist/useRetrieveDataFromRemoteSource.d.ts +12 -0
- package/dist/useRetrieveDataFromRemoteSource.js +76 -0
- package/dist/useRetrieveDataFromRemoteSource.js.map +1 -0
- package/dist/useVariationAssociatedData.d.ts +2 -2
- package/dist/withActivateFeature.js +0 -1
- package/dist/withActivateFeature.js.map +1 -1
- package/dist/withAddData.js +0 -1
- package/dist/withAddData.js.map +1 -1
- package/dist/withBrowser.js +0 -1
- package/dist/withBrowser.js.map +1 -1
- package/dist/withConversion.d.ts +1 -1
- package/dist/withConversion.js +0 -1
- package/dist/withConversion.js.map +1 -1
- package/dist/withCustomData.js +0 -1
- package/dist/withCustomData.js.map +1 -1
- package/dist/withFeature.js +0 -1
- package/dist/withFeature.js.map +1 -1
- package/dist/withFeatureVariable.js.map +1 -1
- package/dist/withFlush.js +0 -1
- package/dist/withFlush.js.map +1 -1
- package/dist/withInterest.js +0 -1
- package/dist/withInterest.js.map +1 -1
- package/dist/withKameleoon.js +0 -1
- package/dist/withKameleoon.js.map +1 -1
- package/dist/withPageView.js +0 -1
- package/dist/withPageView.js.map +1 -1
- package/dist/withRetrieveDataFromRemoteSource.d.ts +14 -0
- package/dist/withRetrieveDataFromRemoteSource.js +28 -0
- package/dist/withRetrieveDataFromRemoteSource.js.map +1 -0
- package/dist/withTrackingConversion.d.ts +1 -1
- package/dist/withTrackingConversion.js +4 -6
- package/dist/withTrackingConversion.js.map +1 -1
- package/dist/withTriggerExperiment.d.ts +1 -1
- package/dist/withTriggerExperiment.js +1 -2
- package/dist/withTriggerExperiment.js.map +1 -1
- package/dist/withVariationAssociatedData.js.map +1 -1
- package/dist/withVisitorCode.js +0 -1
- package/dist/withVisitorCode.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,31 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
5
5
|
|
|
6
6
|
[Project Homepage](https://developers.kameleoon.com/react-js-sdk.html)
|
|
7
7
|
|
|
8
|
+
# 2.1.0 (2022-04-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* retrieve data from remote source
|
|
14
|
+
|
|
15
|
+
# 2.0.0 (2022-02-24)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add multi environment support
|
|
21
|
+
|
|
22
|
+
### Breaking change
|
|
23
|
+
|
|
24
|
+
* variableKeys became an object and no longer can be used as an array or a string
|
|
25
|
+
|
|
26
|
+
# 1.2.2 (2022-02-06)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug fixes
|
|
30
|
+
|
|
31
|
+
* bundle source and internal changelog
|
|
32
|
+
|
|
8
33
|
# 1.2.1 (2022-02-06)
|
|
9
34
|
|
|
10
35
|
|
package/README.md
CHANGED
|
@@ -29,8 +29,11 @@ A `KameleoonClient` created using `createClient()` to run experiments and retriv
|
|
|
29
29
|
- `siteCode: string` - code of the website on which experiments run. This unique code id can be found in our platform.
|
|
30
30
|
- `visitorCode: string` (optional) - visitor code is an optional parameter, if it is used, it automatically create custom data to check if visitor is targeted.
|
|
31
31
|
- `option: SDKConfiguration` (optional) - JSON object filled with configuration parameters.
|
|
32
|
-
- `actions_configuration_refresh_interval: number` (optional) -
|
|
33
|
-
- `visitor_data_maximum_size: number` (optional) -
|
|
32
|
+
- `actions_configuration_refresh_interval: number` (optional) - an option specifying the refresh interval, in minutes, of the configuration for experiments and feature flags (the active experiments and feature flags are fetched from the Kameleoon servers). It means that once you launch an experiment, pause it, or stop it the changes can take (at most) the duration of this interval to be propagated in production to your servers. If not specified, the **default interval is 60 minutes**.
|
|
33
|
+
- `visitor_data_maximum_size: number` (optional) - an option specifying the maximum amount of memory that [the map holding all the visitor data](https://developers.kameleoon.com/javascript-sdk.html#technical-considerations) (in particular custom data) can take (in MB on the browser LocalStorage). If specified, **max size is 5MB**. If not specified, the **default size is 1MB**.
|
|
34
|
+
- `environment: string` (optional) - an option specifying which feature flag configuration will be used, by default each feature flag is split into **production**, **staging**, **development**. If not specified, will be set to **default value** of **production**.
|
|
35
|
+
|
|
36
|
+
**NOTICE:** make sure not to use several client instances in one application with different `environment` as it is not fully supported yet and might lead to local storage configuration being overwritten and cause bugs.
|
|
34
37
|
|
|
35
38
|
#### Returns
|
|
36
39
|
- A `KameleoonClient` instance.
|
|
@@ -40,11 +43,12 @@ A `KameleoonClient` created using `createClient()` to run experiments and retriv
|
|
|
40
43
|
import { createClient } from '@kameleoon/react-sdk';
|
|
41
44
|
|
|
42
45
|
const client = createClient({
|
|
43
|
-
siteCode: '
|
|
46
|
+
siteCode: 'dfl102d38e',
|
|
44
47
|
visitorCode: '280295',
|
|
45
48
|
options: {
|
|
46
49
|
visitor_data_maximum_size: 1,
|
|
47
|
-
actions_configuration_refresh_interval: 60
|
|
50
|
+
actions_configuration_refresh_interval: 60,
|
|
51
|
+
environment: 'staging'
|
|
48
52
|
}
|
|
49
53
|
});
|
|
50
54
|
```
|
|
@@ -61,11 +65,12 @@ Use this provider in root level by wrapping your app to gain an access to `Kamel
|
|
|
61
65
|
import { KameleoonProvider, createClient } from '@kameleoon/react-sdk';
|
|
62
66
|
|
|
63
67
|
const client = createClient({
|
|
64
|
-
siteCode: '
|
|
68
|
+
siteCode: 'dfl102d38e'
|
|
65
69
|
visitorCode: '280295',
|
|
66
70
|
options: {
|
|
67
71
|
visitor_data_maximum_size: 1,
|
|
68
|
-
actions_configuration_refresh_interval: 60
|
|
72
|
+
actions_configuration_refresh_interval: 60,
|
|
73
|
+
environment: 'staging'
|
|
69
74
|
}
|
|
70
75
|
});
|
|
71
76
|
|
|
@@ -128,7 +133,7 @@ Returns the status of a feature flag and its variables.
|
|
|
128
133
|
#### Arguments
|
|
129
134
|
- `featureParams: IFeatureParams`
|
|
130
135
|
- `featureKey: string | number` - unique identifier or key of the feature you want to expose to a user.
|
|
131
|
-
- `
|
|
136
|
+
- `variableKeys: VariableKeysType` - keys for the variables on different environments.
|
|
132
137
|
- `visitorCode: string` (optional) - unique identifier of the user.
|
|
133
138
|
|
|
134
139
|
#### Returns
|
|
@@ -148,7 +153,7 @@ function MyComponent(): JSX.Element {
|
|
|
148
153
|
const { getVisitorCode } = useVisitorCode();
|
|
149
154
|
const { isActive } = useFeature({
|
|
150
155
|
featureKey: 'red-button',
|
|
151
|
-
|
|
156
|
+
variableKeys: { production: 'red-button' },
|
|
152
157
|
visitorCode: getVisitorCode('example.com'),
|
|
153
158
|
});
|
|
154
159
|
|
|
@@ -171,7 +176,7 @@ class MyComponent extends React.Component {
|
|
|
171
176
|
|
|
172
177
|
export default withFeature({
|
|
173
178
|
featureKey: 'red-button',
|
|
174
|
-
|
|
179
|
+
variableKeys: { production: 'red-button' },
|
|
175
180
|
visitorCode: '280295'
|
|
176
181
|
})(MyComponent);
|
|
177
182
|
```
|
|
@@ -180,7 +185,7 @@ export default withFeature({
|
|
|
180
185
|
#### Props
|
|
181
186
|
- `children: (featureResult: IFeature) => ReactNode` - child elements of `Feature`.
|
|
182
187
|
- `featureKey: string | number` - unique identifier or key of the feature you want to expose to a user.
|
|
183
|
-
- `
|
|
188
|
+
- `variableKeys: VariableKeysType` - keys for the variables on different environments.
|
|
184
189
|
- `visitorCode: string` - unique identifier of the user.
|
|
185
190
|
|
|
186
191
|
#### Returns
|
|
@@ -203,7 +208,7 @@ class MyComponent extends React.Component {
|
|
|
203
208
|
class MyCompWrapper extends React.Component {
|
|
204
209
|
render() {
|
|
205
210
|
return(
|
|
206
|
-
<Feature featureKey="red-button"
|
|
211
|
+
<Feature featureKey="red-button" variableKeys={{production: "red-button"}} visitorCode="280295">
|
|
207
212
|
(({isActive, variables}) => (
|
|
208
213
|
<MyComponent isActive={isActive} variables={variables} />
|
|
209
214
|
))
|
|
@@ -430,9 +435,9 @@ export default compose(withVisitorCode, withActivateFeature)(MyComponent);
|
|
|
430
435
|
```
|
|
431
436
|
|
|
432
437
|
## Obtain variation associated data
|
|
433
|
-
A callback function `getVariationAssociatedData()` which retrieves JSON data
|
|
438
|
+
A callback function `getVariationAssociatedData()` which retrieves JSON data associated with a variation. The JSON data usually represents some metadata of the variation, and can be configured on our web application interface or via our Automation API.
|
|
434
439
|
|
|
435
|
-
This
|
|
440
|
+
This callback function takes the `variationId` as a parameter and will return the data as a JavaScript object. It will throw an exception `(KameleoonException.VariationConfigurationNotFound)` if the `variationId` is wrong or corresponds to an experiment that is not yet online.
|
|
436
441
|
|
|
437
442
|
#### Exceptions Thrown
|
|
438
443
|
- `KameleoonException.VariationConfigurationNotFound` - Exception indicating that the requested variation ID has not been found in the internal configuration of the SDK. This is usually normal and means that the variation's corresponding experiment has not yet been activated on Kameleoon's side.
|
|
@@ -489,6 +494,74 @@ class MyComponent extends React.Component {
|
|
|
489
494
|
export default withVariationAssociatedData(MyComponent);
|
|
490
495
|
```
|
|
491
496
|
|
|
497
|
+
## Obtain data from remote source
|
|
498
|
+
An callback function `retrieveDataFromRemoteSource()` can be used to retrieve data using specific key and siteCode from Kameleoon provider. The Data is stored on a remote Kameleoon server. Usually data will be stored on our remote servers via the use of our Data API. This method, along with the availability of our highly scalable servers for this purpose, provides a convenient way to quickly store massive amounts of data that can be later retrieved for each of your visitors / users.
|
|
499
|
+
|
|
500
|
+
Note that since a server call is required, this mechanism is asynchronous, make sure to properly handle promise which will be returned from a function call.
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
#### Exceptions Thrown
|
|
504
|
+
- Local Error will be thrown if remote source data couldn't be accessed or retrieved data contains an empty JSON.
|
|
505
|
+
|
|
506
|
+
#### `retrieveDataFromRemoteSource()`
|
|
507
|
+
|
|
508
|
+
##### Arguments
|
|
509
|
+
- `key: string` - unique key for the current siteCode used to store data on the remote source (can be created via `POST` request to Kameleoon Data API). This field is mandatory.
|
|
510
|
+
|
|
511
|
+
##### Returns
|
|
512
|
+
- JSON object with the data posted to Kameleoon Data API.
|
|
513
|
+
|
|
514
|
+
#### Types
|
|
515
|
+
- `RemoteSourceDataType` can be used for handling data type.
|
|
516
|
+
|
|
517
|
+
### `useRetrieveDataFromRemoteSource`
|
|
518
|
+
#### Returns
|
|
519
|
+
- A callback function `retrieveDataFromRemoteSource()`.
|
|
520
|
+
|
|
521
|
+
#### Example
|
|
522
|
+
```jsx
|
|
523
|
+
import { useEffect, useCallback } from 'react';
|
|
524
|
+
import { useRetrieveDataFromRemoteSource, RemoteSourceDataType } from '@kameleoon/react-sdk';
|
|
525
|
+
|
|
526
|
+
function MyComponent(): JSX.Element {
|
|
527
|
+
const { retrieveDataFromRemoteSource } = useRetrieveDataFromRemoteSource();
|
|
528
|
+
|
|
529
|
+
const processRetrievedData = useCallback(async () => {
|
|
530
|
+
const data: RemoteSourceDataType = await retrieveDataFromRemoteSource('example-key');
|
|
531
|
+
// Your code
|
|
532
|
+
}, [retrieveDataFromRemoteSource]);
|
|
533
|
+
|
|
534
|
+
useEffect(() => {
|
|
535
|
+
processRetrievedData();
|
|
536
|
+
}, [processRetrievedData]);
|
|
537
|
+
|
|
538
|
+
...
|
|
539
|
+
}
|
|
540
|
+
```
|
|
541
|
+
### `withRetrieveDataFromRemoteSource`
|
|
542
|
+
#### Arguments
|
|
543
|
+
- `Component: React.Component` - component which will be enhanced with the prop `retrieveDataFromRemoteSource()`.
|
|
544
|
+
|
|
545
|
+
#### Returns
|
|
546
|
+
- A wrapped component with additional props as described above.
|
|
547
|
+
|
|
548
|
+
#### Example
|
|
549
|
+
```jsx
|
|
550
|
+
import { withRetrieveDataFromRemoteSource, RemoteSourceDataType } from '@kameleoon/react-sdk';
|
|
551
|
+
|
|
552
|
+
class MyComponent extends React.Component {
|
|
553
|
+
async componentDidMount() {
|
|
554
|
+
const { retrieveDataFromRemoteSource } = this.props;
|
|
555
|
+
const data: RemoteSourceDataType = await getVariationAssociatedData('example-key');
|
|
556
|
+
// Your code
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
...
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
export default withRetrieveDataFromRemoteSource(MyComponent);
|
|
563
|
+
```
|
|
564
|
+
|
|
492
565
|
## Obtain feature variable
|
|
493
566
|
A callback function `getFeatureVariable()` which retrieves a feature variable.
|
|
494
567
|
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FeatureResultField = exports.Browser = exports.KAMELEOON_SDK_LOCAL_STORAGE_KEY = void 0;
|
|
3
|
+
exports.FeatureResultField = exports.Browser = exports.PRODUCTION = exports.KAMELEOON_SDK_LOCAL_STORAGE_KEY = void 0;
|
|
4
4
|
exports.KAMELEOON_SDK_LOCAL_STORAGE_KEY = 'kameleoonJavaScriptClientData';
|
|
5
|
+
exports.PRODUCTION = 'production';
|
|
5
6
|
var Browser;
|
|
6
7
|
(function (Browser) {
|
|
7
8
|
Browser["Chrome"] = "CHROME";
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,+BAA+B,GAAG,+BAA+B,CAAC;
|
|
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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { KAMELEOON_SDK_LOCAL_STORAGE_KEY, Browser } from './constants';
|
|
|
3
3
|
export { Browser as IBrowser, Conversion as IConversion, Interest as IInterest, PageView as IPageView, } from 'kameleoon-client-javascript/dist/data';
|
|
4
4
|
export { default as compose } from './compose';
|
|
5
5
|
export { default as KameleoonProvider } from './KameleoonProvider';
|
|
6
|
+
export * from './types';
|
|
6
7
|
export { createClient } from './kameleoonClient';
|
|
7
8
|
export { Feature } from './Feature';
|
|
8
9
|
export { useKameleoon } from './useKameleoon';
|
|
@@ -13,6 +14,7 @@ export { useActivateFeature } from './useActivateFeature';
|
|
|
13
14
|
export { useVariationAssociatedData } from './useVariationAssociatedData';
|
|
14
15
|
export { useFeatureVariable } from './useFeatureVariable';
|
|
15
16
|
export { useTrackingConversion } from './useTrackingConversion';
|
|
17
|
+
export { useRetrieveDataFromRemoteSource } from './useRetrieveDataFromRemoteSource';
|
|
16
18
|
export { useAddData } from './useAddData';
|
|
17
19
|
export { useFlush } from './useFlush';
|
|
18
20
|
export { useBrowser } from './useBrowser';
|
|
@@ -26,6 +28,7 @@ export { withVisitorCode } from './withVisitorCode';
|
|
|
26
28
|
export { withTriggerExperiment } from './withTriggerExperiment';
|
|
27
29
|
export { withActivateFeature } from './withActivateFeature';
|
|
28
30
|
export { withVariationAssociatedData } from './withVariationAssociatedData';
|
|
31
|
+
export { withRetrieveDataFromRemoteSource } from './withRetrieveDataFromRemoteSource';
|
|
29
32
|
export { withFeatureVariable } from './withFeatureVariable';
|
|
30
33
|
export { withTrackingConversion } from './withTrackingConversion';
|
|
31
34
|
export { withAddData } from './withAddData';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
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
|
+
};
|
|
2
12
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
14
|
};
|
|
5
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.withInterest = exports.withCustomData = exports.withConversion = exports.withPageView = exports.withBrowser = exports.withFlush = exports.withAddData = exports.withTrackingConversion = exports.withFeatureVariable = exports.withVariationAssociatedData = exports.withActivateFeature = exports.withTriggerExperiment = exports.withVisitorCode = exports.withFeature = exports.withKameleoon = exports.useInterest = exports.useCustomData = exports.useConversion = exports.usePageView = exports.useBrowser = exports.useFlush = exports.useAddData = 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.IPageView = exports.IInterest = exports.IConversion = exports.IBrowser = exports.Browser = exports.KAMELEOON_SDK_LOCAL_STORAGE_KEY = exports.KameleoonContext = void 0;
|
|
16
|
+
exports.withInterest = exports.withCustomData = exports.withConversion = exports.withPageView = 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.useInterest = 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.IPageView = exports.IInterest = exports.IConversion = exports.IBrowser = exports.Browser = exports.KAMELEOON_SDK_LOCAL_STORAGE_KEY = exports.KameleoonContext = void 0;
|
|
7
17
|
var KameleoonContext_1 = require("./KameleoonContext");
|
|
8
18
|
Object.defineProperty(exports, "KameleoonContext", { enumerable: true, get: function () { return KameleoonContext_1.KameleoonContext; } });
|
|
9
19
|
var constants_1 = require("./constants");
|
|
@@ -18,6 +28,7 @@ var compose_1 = require("./compose");
|
|
|
18
28
|
Object.defineProperty(exports, "compose", { enumerable: true, get: function () { return __importDefault(compose_1).default; } });
|
|
19
29
|
var KameleoonProvider_1 = require("./KameleoonProvider");
|
|
20
30
|
Object.defineProperty(exports, "KameleoonProvider", { enumerable: true, get: function () { return __importDefault(KameleoonProvider_1).default; } });
|
|
31
|
+
__exportStar(require("./types"), exports);
|
|
21
32
|
var kameleoonClient_1 = require("./kameleoonClient");
|
|
22
33
|
Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return kameleoonClient_1.createClient; } });
|
|
23
34
|
var Feature_1 = require("./Feature");
|
|
@@ -38,6 +49,8 @@ var useFeatureVariable_1 = require("./useFeatureVariable");
|
|
|
38
49
|
Object.defineProperty(exports, "useFeatureVariable", { enumerable: true, get: function () { return useFeatureVariable_1.useFeatureVariable; } });
|
|
39
50
|
var useTrackingConversion_1 = require("./useTrackingConversion");
|
|
40
51
|
Object.defineProperty(exports, "useTrackingConversion", { enumerable: true, get: function () { return useTrackingConversion_1.useTrackingConversion; } });
|
|
52
|
+
var useRetrieveDataFromRemoteSource_1 = require("./useRetrieveDataFromRemoteSource");
|
|
53
|
+
Object.defineProperty(exports, "useRetrieveDataFromRemoteSource", { enumerable: true, get: function () { return useRetrieveDataFromRemoteSource_1.useRetrieveDataFromRemoteSource; } });
|
|
41
54
|
var useAddData_1 = require("./useAddData");
|
|
42
55
|
Object.defineProperty(exports, "useAddData", { enumerable: true, get: function () { return useAddData_1.useAddData; } });
|
|
43
56
|
var useFlush_1 = require("./useFlush");
|
|
@@ -64,6 +77,8 @@ var withActivateFeature_1 = require("./withActivateFeature");
|
|
|
64
77
|
Object.defineProperty(exports, "withActivateFeature", { enumerable: true, get: function () { return withActivateFeature_1.withActivateFeature; } });
|
|
65
78
|
var withVariationAssociatedData_1 = require("./withVariationAssociatedData");
|
|
66
79
|
Object.defineProperty(exports, "withVariationAssociatedData", { enumerable: true, get: function () { return withVariationAssociatedData_1.withVariationAssociatedData; } });
|
|
80
|
+
var withRetrieveDataFromRemoteSource_1 = require("./withRetrieveDataFromRemoteSource");
|
|
81
|
+
Object.defineProperty(exports, "withRetrieveDataFromRemoteSource", { enumerable: true, get: function () { return withRetrieveDataFromRemoteSource_1.withRetrieveDataFromRemoteSource; } });
|
|
67
82
|
var withFeatureVariable_1 = require("./withFeatureVariable");
|
|
68
83
|
Object.defineProperty(exports, "withFeatureVariable", { enumerable: true, get: function () { return withFeatureVariable_1.withFeatureVariable; } });
|
|
69
84
|
var withTrackingConversion_1 = require("./withTrackingConversion");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,yCAAuE;AAA9D,4HAAA,+BAA+B,OAAA;AAAE,oGAAA,OAAO,OAAA;AACjD,8DAK+C;AAJ7C,gGAAA,OAAO,OAAY;AACnB,mGAAA,UAAU,OAAe;AACzB,iGAAA,QAAQ,OAAa;AACrB,iGAAA,QAAQ,OAAa;AAEvB,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,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,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,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,+CAA8C;AAArC,4GAAA,YAAY,OAAA"}
|
package/dist/stories/Form.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AnyType, IFeature } from '../types';
|
|
3
2
|
import { KameleoonClient } from 'kameleoon-client-javascript';
|
|
4
|
-
import { IBrowser, IConversion, IInterest, IPageView, Browser } from '../';
|
|
5
3
|
import { DataInterface } from 'kameleoon-client-javascript/dist/interfaces/interfaces';
|
|
4
|
+
import { AnyType, IFeature, RemoteSourceDataType } from '../types';
|
|
5
|
+
import { IBrowser, IConversion, IInterest, IPageView, Browser } from '..';
|
|
6
6
|
export interface IFormProps {
|
|
7
7
|
client?: KameleoonClient;
|
|
8
8
|
feature: IFeature;
|
|
@@ -15,8 +15,9 @@ export interface IFormProps {
|
|
|
15
15
|
addInterest?: (index: number) => IInterest;
|
|
16
16
|
addConversion?: (goalId: number, revenue?: number, negative?: boolean) => IConversion;
|
|
17
17
|
getVariationAssociatedData?: (variationId: number) => AnyType;
|
|
18
|
+
retrieveDataFromRemoteSource?: (key: string) => Promise<RemoteSourceDataType>;
|
|
18
19
|
getVariationId?: (visitorCode: string, experimentId: number) => number;
|
|
19
20
|
}
|
|
20
|
-
declare function Form({ client, feature, isRenderProps, getVisitorCode, hasFeature, addData, addBrowser, addPageView, addInterest, addConversion, getVariationAssociatedData, getVariationId, }: IFormProps): JSX.Element;
|
|
21
|
+
declare function Form({ client, feature, isRenderProps, getVisitorCode, hasFeature, addData, addBrowser, addPageView, addInterest, addConversion, getVariationAssociatedData, retrieveDataFromRemoteSource, getVariationId, }: IFormProps): JSX.Element;
|
|
21
22
|
declare const _default: React.MemoExoticComponent<typeof Form>;
|
|
22
23
|
export default _default;
|
package/dist/stories/Form.js
CHANGED
|
@@ -10,6 +10,42 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
13
49
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
51
|
};
|
|
@@ -19,41 +55,18 @@ var react_1 = require("react");
|
|
|
19
55
|
var Radio_1 = __importDefault(require("./Radio"));
|
|
20
56
|
var constants_1 = require("./constants");
|
|
21
57
|
var constants_2 = require("../constants");
|
|
22
|
-
var __1 = require("
|
|
58
|
+
var __1 = require("..");
|
|
23
59
|
function Form(_a) {
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var _g = (0, react_1.useState)(
|
|
28
|
-
var _h = (0, react_1.useState)(
|
|
29
|
-
var _j = (0, react_1.useState)([]),
|
|
30
|
-
var _k = (0, react_1.useState)(),
|
|
31
|
-
var _l = (0, react_1.useState)(),
|
|
32
|
-
(0, react_1.
|
|
33
|
-
|
|
34
|
-
setVariationId(getVariationId(constants_1.USER_ID, constants_1.EXPERIMENT_ID));
|
|
35
|
-
}
|
|
36
|
-
}, [getVariationId, isRenderProps]);
|
|
37
|
-
(0, react_1.useEffect)(function () {
|
|
38
|
-
if (variationId && getVariationAssociatedData) {
|
|
39
|
-
setVariationData(getVariationAssociatedData(variationId));
|
|
40
|
-
}
|
|
41
|
-
}, [getVariationAssociatedData, variationId]);
|
|
42
|
-
(0, react_1.useEffect)(function () {
|
|
43
|
-
if (getVisitorCode) {
|
|
44
|
-
setVisitorCode(getVisitorCode(constants_1.KAMELEOON_URL));
|
|
45
|
-
}
|
|
46
|
-
}, [getVisitorCode]);
|
|
47
|
-
(0, react_1.useEffect)(function () {
|
|
48
|
-
if (hasFeature) {
|
|
49
|
-
setFeatureFlag(hasFeature(constants_1.USER_ID, constants_1.FEATURE_KEY));
|
|
50
|
-
}
|
|
51
|
-
}, [hasFeature]);
|
|
52
|
-
(0, react_1.useEffect)(function () {
|
|
53
|
-
if (feature.variables) {
|
|
54
|
-
setFeatureVariables(feature.variables);
|
|
55
|
-
}
|
|
56
|
-
}, [feature, isRenderProps]);
|
|
60
|
+
var _this = this;
|
|
61
|
+
var _b, _c, _d, _e, _f;
|
|
62
|
+
var client = _a.client, feature = _a.feature, isRenderProps = _a.isRenderProps, getVisitorCode = _a.getVisitorCode, hasFeature = _a.hasFeature, addData = _a.addData, addBrowser = _a.addBrowser, addPageView = _a.addPageView, addInterest = _a.addInterest, addConversion = _a.addConversion, getVariationAssociatedData = _a.getVariationAssociatedData, retrieveDataFromRemoteSource = _a.retrieveDataFromRemoteSource, getVariationId = _a.getVariationId;
|
|
63
|
+
var _g = (0, react_1.useState)(''), visitorCode = _g[0], setVisitorCode = _g[1];
|
|
64
|
+
var _h = (0, react_1.useState)(false), featureFlag = _h[0], setFeatureFlag = _h[1];
|
|
65
|
+
var _j = (0, react_1.useState)([]), featureVariables = _j[0], setFeatureVariables = _j[1];
|
|
66
|
+
var _k = (0, react_1.useState)([]), customData = _k[0], setCustomData = _k[1];
|
|
67
|
+
var _l = (0, react_1.useState)(), variationId = _l[0], setVariationId = _l[1];
|
|
68
|
+
var _m = (0, react_1.useState)(), variationData = _m[0], setVariationData = _m[1];
|
|
69
|
+
var _o = (0, react_1.useState)(null), remoteSourceData = _o[0], setRemoteSourceData = _o[1];
|
|
57
70
|
function displayCustomData() {
|
|
58
71
|
var kameleoonConfig = localStorage.getItem(constants_2.KAMELEOON_SDK_LOCAL_STORAGE_KEY);
|
|
59
72
|
if (kameleoonConfig && visitorCode) {
|
|
@@ -89,7 +102,51 @@ function Form(_a) {
|
|
|
89
102
|
displayCustomData();
|
|
90
103
|
}
|
|
91
104
|
}
|
|
92
|
-
|
|
105
|
+
var processRetrievedData = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
106
|
+
var data;
|
|
107
|
+
return __generator(this, function (_a) {
|
|
108
|
+
switch (_a.label) {
|
|
109
|
+
case 0:
|
|
110
|
+
if (!retrieveDataFromRemoteSource) return [3 /*break*/, 2];
|
|
111
|
+
return [4 /*yield*/, retrieveDataFromRemoteSource(constants_1.KAMELEOON_VISITOR_KEY)];
|
|
112
|
+
case 1:
|
|
113
|
+
data = _a.sent();
|
|
114
|
+
setRemoteSourceData(data);
|
|
115
|
+
_a.label = 2;
|
|
116
|
+
case 2: return [2 /*return*/];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}); }, [retrieveDataFromRemoteSource]);
|
|
120
|
+
(0, react_1.useEffect)(function () {
|
|
121
|
+
if (!isRenderProps && getVariationId) {
|
|
122
|
+
setVariationId(getVariationId(constants_1.USER_ID, constants_1.EXPERIMENT_ID));
|
|
123
|
+
}
|
|
124
|
+
}, [getVariationId, isRenderProps]);
|
|
125
|
+
(0, react_1.useEffect)(function () {
|
|
126
|
+
if (variationId && getVariationAssociatedData) {
|
|
127
|
+
setVariationData(getVariationAssociatedData(variationId));
|
|
128
|
+
}
|
|
129
|
+
}, [getVariationAssociatedData, variationId]);
|
|
130
|
+
(0, react_1.useEffect)(function () {
|
|
131
|
+
if (getVisitorCode) {
|
|
132
|
+
setVisitorCode(getVisitorCode(constants_1.KAMELEOON_URL));
|
|
133
|
+
}
|
|
134
|
+
}, [getVisitorCode]);
|
|
135
|
+
(0, react_1.useEffect)(function () {
|
|
136
|
+
if (hasFeature) {
|
|
137
|
+
setFeatureFlag(hasFeature(constants_1.USER_ID, constants_1.FEATURE_KEY));
|
|
138
|
+
}
|
|
139
|
+
}, [hasFeature]);
|
|
140
|
+
(0, react_1.useEffect)(function () {
|
|
141
|
+
if (feature.variables) {
|
|
142
|
+
setFeatureVariables(feature.variables);
|
|
143
|
+
}
|
|
144
|
+
}, [feature, isRenderProps]);
|
|
145
|
+
(0, react_1.useEffect)(function () {
|
|
146
|
+
processRetrievedData();
|
|
147
|
+
}, [processRetrievedData]);
|
|
148
|
+
return ((0, jsx_runtime_1.jsxs)("form", { children: [(0, jsx_runtime_1.jsx)("h1", { children: "Feature flag activation test" }, void 0), (0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Always active", isActive: true }, void 0), (0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Active only when feature flag is on", isActive: isRenderProps ? feature.isActive : featureFlag }, void 0), !isRenderProps && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Active only when kameleoon client is connected", isActive: Boolean(client) }, void 0), (0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Active only when visitor code is present", isActive: Boolean(visitorCode) }, void 0)] }, void 0)), (0, jsx_runtime_1.jsx)("h1", { children: "Feature flag variables test" }, void 0), (0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Active when string variable is present", isActive: Boolean((_b = featureVariables[0]) === null || _b === void 0 ? void 0 : _b[constants_1.FeatureVariables.STRING]) }, void 0), (0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Active when boolean variable is present", isActive: Boolean((_c = featureVariables[1]) === null || _c === void 0 ? void 0 : _c[constants_1.FeatureVariables.BOOLEAN]) }, void 0), (0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Active when number variable is present", isActive: Boolean((_d = featureVariables[2]) === null || _d === void 0 ? void 0 : _d[constants_1.FeatureVariables.NUMBER]) }, void 0), (0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Active when JSON variable is present", isActive: Boolean((_e = featureVariables[3]) === null || _e === void 0 ? void 0 : _e[constants_1.FeatureVariables.JSON]) }, void 0), (0, jsx_runtime_1.jsx)("h1", { children: "Multi Environment test" }, void 0), (0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Active only when client environment option is set to value different from the default 'production' (variables above will become inactive), make sure to disable other stories and clear local storage, as for now client is not capable of handling several environments simultaneously", isActive: Boolean((_f = featureVariables[0]) === null || _f === void 0 ? void 0 : _f[constants_1.FeatureVariables.MULTI_ENVIRONMENT]) }, void 0), (0, jsx_runtime_1.jsx)("h1", { children: "Remote Source Data test" }, void 0), (0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Active when data from the remote was received and it's not empty", isActive: Boolean(remoteSourceData) }, void 0), !isRenderProps && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h1", { children: "Feature flag associated variation test" }, void 0), (0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Active when experiment is triggered", isActive: Boolean(variationId) }, void 0), (0, jsx_runtime_1.jsx)(Radio_1.default, { title: "Active when variationData is present", isActive: Boolean(variationData) }, void 0), (0, jsx_runtime_1.jsx)("h1", { children: "Feature flag custom data test" }, void 0), (0, jsx_runtime_1.jsx)("br", {}, void 0), (0, jsx_runtime_1.jsx)("button", __assign({ type: "button", onClick: handleAddBrowser }, { children: "Add browser data" }), void 0), (0, jsx_runtime_1.jsx)("button", __assign({ type: "button", onClick: handleAddPageView }, { children: "Add page view data" }), void 0), (0, jsx_runtime_1.jsx)("button", __assign({ type: "button", onClick: handleAddInterest }, { children: "Add interest data" }), void 0), (0, jsx_runtime_1.jsx)("button", __assign({ type: "button", onClick: handleAddConversion }, { children: "Add conversion data" }), void 0), (0, jsx_runtime_1.jsx)("p", { children: "Custom data:" }, void 0), customData.map(function (item, index) {
|
|
149
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
93
150
|
return (0, jsx_runtime_1.jsx)("p", { children: JSON.stringify(item.data) }, index);
|
|
94
151
|
})] }, void 0))] }, void 0));
|
|
95
152
|
}
|
package/dist/stories/Form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../src/stories/Form.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../src/stories/Form.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAsE;AAStE,kDAA4B;AAC5B,yCAQqB;AACrB,0CAA+D;AAC/D,wBAA0E;AAyB1E,SAAS,IAAI,CAAC,EA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,KAAK,EAAC,sCAAsC,EAC5C,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,WAChC,EAEF,mFAAsC,EACtC,wCAAM,EACN,4CAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,gBAAgB,8CAEtC,EACT,4CAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,iBAAiB,gDAEvC,EACT,4CAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,iBAAiB,+CAEvC,EACT,4CAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,mBAAmB,iDAEzC,EACT,iEAAmB,EAClB,UAAU,CAAC,GAAG,CAAC,UAAC,IAAI,EAAE,KAAK;wBAC1B,oDAAoD;wBACpD,OAAO,wCAAgB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAjC,KAAK,CAAiC,CAAC;oBACxD,CAAC,CAAC,YACD,CACJ,YACI,CACR,CAAC;AACJ,CAAC;AACD,kBAAe,IAAA,YAAI,EAAC,IAAI,CAAC,CAAC"}
|
package/dist/stories/FormHOC.js
CHANGED
|
@@ -22,14 +22,19 @@ var Form_1 = __importDefault(require("./Form"));
|
|
|
22
22
|
function FormHOC(props) {
|
|
23
23
|
return (0, jsx_runtime_1.jsx)(Form_1.default, __assign({}, props, { isRenderProps: false }), void 0);
|
|
24
24
|
}
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
constants_1.
|
|
29
|
-
constants_1.
|
|
30
|
-
constants_1.
|
|
31
|
-
constants_1.FEATURE_VARIABLES.JSON,
|
|
25
|
+
var variableKeys = {
|
|
26
|
+
production: [
|
|
27
|
+
constants_1.FeatureVariables.STRING,
|
|
28
|
+
constants_1.FeatureVariables.BOOLEAN,
|
|
29
|
+
constants_1.FeatureVariables.NUMBER,
|
|
30
|
+
constants_1.FeatureVariables.JSON,
|
|
32
31
|
],
|
|
32
|
+
development: constants_1.FeatureVariables.MULTI_ENVIRONMENT,
|
|
33
|
+
staging: constants_1.FeatureVariables.MULTI_ENVIRONMENT,
|
|
34
|
+
};
|
|
35
|
+
var withKameleoonHOCs = (0, compose_1.default)(index_1.withKameleoon, index_1.withVisitorCode, index_1.withActivateFeature, index_1.withAddData, index_1.withBrowser, index_1.withPageView, index_1.withInterest, index_1.withConversion, index_1.withTriggerExperiment, index_1.withVariationAssociatedData, index_1.withRetrieveDataFromRemoteSource, (0, index_1.withFeature)({
|
|
36
|
+
featureKey: constants_1.FEATURE_KEY,
|
|
37
|
+
variableKeys: variableKeys,
|
|
33
38
|
visitorCode: constants_1.USER_ID,
|
|
34
39
|
}));
|
|
35
40
|
exports.default = withKameleoonHOCs(FormHOC);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormHOC.js","sourceRoot":"","sources":["../../src/stories/FormHOC.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uDAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"FormHOC.js","sourceRoot":"","sources":["../../src/stories/FormHOC.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uDAAiC;AACjC,yCAAqE;AACrE,kCAakB;AAClB,gDAA0C;AAE1C,SAAS,OAAO,CAAC,KAAiB;IAChC,OAAO,uBAAC,cAAI,eAAK,KAAK,IAAE,aAAa,EAAE,KAAK,YAAI,CAAC;AACnD,CAAC;AAED,IAAM,YAAY,GAAG;IACnB,UAAU,EAAE;QACV,4BAAgB,CAAC,MAAM;QACvB,4BAAgB,CAAC,OAAO;QACxB,4BAAgB,CAAC,MAAM;QACvB,4BAAgB,CAAC,IAAI;KACtB;IACD,WAAW,EAAE,4BAAgB,CAAC,iBAAiB;IAC/C,OAAO,EAAE,4BAAgB,CAAC,iBAAiB;CAC5C,CAAC;AAEF,IAAM,iBAAiB,GAAG,IAAA,iBAAO,EAC/B,qBAAa,EACb,uBAAe,EACf,2BAAmB,EACnB,mBAAW,EACX,mBAAW,EACX,oBAAY,EACZ,oBAAY,EACZ,sBAAc,EACd,6BAAqB,EACrB,mCAA2B,EAC3B,wCAAgC,EAChC,IAAA,mBAAW,EAAC;IACV,UAAU,EAAE,uBAAW;IACvB,YAAY,cAAA;IACZ,WAAW,EAAE,mBAAO;CACrB,CAAC,CACH,CAAC;AAEF,kBAAe,iBAAiB,CAAC,OAAO,CAAC,CAAC"}
|