@kameleoon/react-sdk 4.0.3 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/dist/Feature.js.map +1 -1
- package/dist/KameleoonContext.d.ts +1 -1
- package/dist/KameleoonProvider.d.ts +3 -3
- package/dist/KameleoonProvider.js.map +1 -1
- package/dist/ProviderError.js +1 -1
- package/dist/ProviderError.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/kameleoonClient.d.ts +2 -2
- package/dist/kameleoonClient.js +73 -5
- package/dist/kameleoonClient.js.map +1 -1
- package/dist/useActivateFeature.js +2 -4
- package/dist/useActivateFeature.js.map +1 -1
- package/dist/useAddData.d.ts +1 -1
- package/dist/useAsyncVisitorCode.d.ts +12 -0
- package/dist/useAsyncVisitorCode.js +56 -0
- package/dist/useAsyncVisitorCode.js.map +1 -0
- package/dist/useBrowser.d.ts +1 -1
- package/dist/useBrowser.js +3 -3
- package/dist/useBrowser.js.map +1 -1
- package/dist/useConversion.d.ts +1 -1
- package/dist/useConversion.js +2 -2
- package/dist/useConversion.js.map +1 -1
- package/dist/useCustomData.d.ts +1 -1
- package/dist/useCustomData.js +2 -2
- package/dist/useCustomData.js.map +1 -1
- package/dist/useDevice.d.ts +1 -1
- package/dist/useDevice.js +2 -2
- package/dist/useDevice.js.map +1 -1
- package/dist/useFeature.js +8 -11
- package/dist/useFeature.js.map +1 -1
- package/dist/useKameleoon.d.ts +1 -1
- package/dist/usePageView.d.ts +1 -1
- package/dist/usePageView.js +2 -2
- package/dist/usePageView.js.map +1 -1
- package/dist/withAddData.d.ts +1 -1
- package/dist/withAddData.js +2 -39
- package/dist/withAddData.js.map +1 -1
- package/dist/withAsyncVisitorCode.d.ts +15 -0
- package/dist/withAsyncVisitorCode.js +75 -0
- package/dist/withAsyncVisitorCode.js.map +1 -0
- package/dist/withBrowser.d.ts +1 -1
- package/dist/withBrowser.js +3 -3
- package/dist/withBrowser.js.map +1 -1
- package/dist/withConversion.d.ts +1 -1
- package/dist/withConversion.js +2 -2
- package/dist/withConversion.js.map +1 -1
- package/dist/withCustomData.d.ts +1 -1
- package/dist/withCustomData.js +3 -3
- package/dist/withCustomData.js.map +1 -1
- package/dist/withDevice.d.ts +1 -1
- package/dist/withDevice.js +2 -2
- package/dist/withDevice.js.map +1 -1
- package/dist/withKameleoon.d.ts +1 -1
- package/dist/withPageView.d.ts +1 -1
- package/dist/withPageView.js +2 -2
- package/dist/withPageView.js.map +1 -1
- package/package.json +15 -11
package/README.md
CHANGED
|
@@ -296,6 +296,8 @@ A callback function `getVisitorCode()` retrieves the Kameleoon `visitorCode` for
|
|
|
296
296
|
|
|
297
297
|
For more information, refer to [this article](https://developers.kameleoon.com/back-front-bridge.html).
|
|
298
298
|
|
|
299
|
+
There is also an alternative `getAsyncVisitorCode()` callback, which is asynchronous and is meant for *ReactNative* applications.
|
|
300
|
+
|
|
299
301
|
##### Please Note:
|
|
300
302
|
_If you provide your own `visitorCode`, its uniqueness must be guaranteed on your end - the SDK cannot check it. Also note that the length of `visitorCode` is **limited to 255 characters**. Any excess characters will throw an exception._
|
|
301
303
|
|
|
@@ -361,6 +363,60 @@ class MyComponent extends React.Component {
|
|
|
361
363
|
export default withVisitorCode(MyComponent);
|
|
362
364
|
```
|
|
363
365
|
|
|
366
|
+
### `useAsyncVisitorCode`
|
|
367
|
+
#### Returns
|
|
368
|
+
- A callback function `getAsyncVisitorCode()`.
|
|
369
|
+
|
|
370
|
+
#### Example
|
|
371
|
+
```jsx
|
|
372
|
+
import { useState } from 'react';
|
|
373
|
+
import { uuidv4 } from 'uuid';
|
|
374
|
+
import { useAsyncVisitorCode } from '@kameleoon/react-sdk';
|
|
375
|
+
|
|
376
|
+
function MyComponent(): JSX.Element {
|
|
377
|
+
const { getAsyncVisitorCode } = useAsyncVisitorCode();
|
|
378
|
+
const [visitorCode, setVisitorCode] = useState<string>('');
|
|
379
|
+
|
|
380
|
+
async function retrieveVisitorCode(): Promise<void> {
|
|
381
|
+
// Without defaultVisitorCode argument
|
|
382
|
+
const result = await getAsyncVisitorCode('example.com');
|
|
383
|
+
// With defaultVisitorCode argument
|
|
384
|
+
const result = await getAsyncVisitorCode('example.com', uuidv4());
|
|
385
|
+
|
|
386
|
+
setVisitorCode(result);
|
|
387
|
+
}
|
|
388
|
+
...
|
|
389
|
+
}
|
|
390
|
+
```
|
|
391
|
+
### `withAsyncVisitorCode`
|
|
392
|
+
#### Arguments
|
|
393
|
+
- `Component: React.Component` - component which will be enhanced with the prop `getAsyncVisitorCode()`.
|
|
394
|
+
|
|
395
|
+
#### Returns
|
|
396
|
+
- A wrapped component with additional props as described above.
|
|
397
|
+
|
|
398
|
+
#### Example
|
|
399
|
+
```jsx
|
|
400
|
+
import { uuidv4 } from 'uuid';
|
|
401
|
+
import { withAsyncVisitorCode } from '@kameleoon/react-sdk';
|
|
402
|
+
|
|
403
|
+
class MyComponent extends React.Component {
|
|
404
|
+
async componentDidMount(): Promise<void> {
|
|
405
|
+
const { getAsyncVisitorCode } = this.props;
|
|
406
|
+
|
|
407
|
+
// Without defaultVisitorCode argument
|
|
408
|
+
const visitorCode = await getAsyncVisitorCode('example.com');
|
|
409
|
+
|
|
410
|
+
// With defaultVisitorCode argument
|
|
411
|
+
const visitorCode = await getAsyncVisitorCode('example.com', uuidv4());
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
...
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export default withVisitorCode(MyComponent);
|
|
418
|
+
```
|
|
419
|
+
|
|
364
420
|
## Triggering an experiment
|
|
365
421
|
A callback function `getVariationId()` takes `visitorCode` and `experimentId` as mandatory arguments to register a variation for a given user.
|
|
366
422
|
|
package/dist/Feature.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Feature.js","sourceRoot":"","sources":["../src/Feature.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Feature.js","sourceRoot":"","sources":["../src/Feature.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { KameleoonClient } from 'kameleoon-
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { KameleoonClient } from '@kameleoon/javascript-sdk-core';
|
|
3
3
|
interface IKameleoonProviderProps {
|
|
4
4
|
/** Child elements of the provider */
|
|
5
5
|
children: ReactNode;
|
|
@@ -10,5 +10,5 @@ interface IKameleoonProviderProps {
|
|
|
10
10
|
* A Provider that wraps the project and provides an access to SDK APIs
|
|
11
11
|
*/
|
|
12
12
|
declare function KameleoonProvider({ client, children, }: IKameleoonProviderProps): JSX.Element;
|
|
13
|
-
declare const _default:
|
|
13
|
+
declare const _default: React.MemoExoticComponent<typeof KameleoonProvider>;
|
|
14
14
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KameleoonProvider.js","sourceRoot":"","sources":["../src/KameleoonProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"KameleoonProvider.js","sourceRoot":"","sources":["../src/KameleoonProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAA+C;AAE/C,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.js
CHANGED
|
@@ -19,7 +19,7 @@ exports.ProviderError = void 0;
|
|
|
19
19
|
var ProviderError = /** @class */ (function (_super) {
|
|
20
20
|
__extends(ProviderError, _super);
|
|
21
21
|
function ProviderError(method) {
|
|
22
|
-
var _this = _super.call(this, "".concat(method, " must be used within a KameleoonProvider
|
|
22
|
+
var _this = _super.call(this, "".concat(method, " must be used within a KameleoonProvider")) || this;
|
|
23
23
|
_this.name = 'ProviderError';
|
|
24
24
|
return _this;
|
|
25
25
|
}
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"ProviderError.js","sourceRoot":"","sources":["../src/ProviderError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;IAAmC,iCAAK;IACtC,uBAAY,MAAc;QAA1B,YACE,kBAAM,UAAG,MAAM,6CAA0C,CAAC,SAE3D;QADC,KAAI,CAAC,IAAI,GAAG,eAAe,CAAC;;IAC9B,CAAC;IACH,oBAAC;AAAD,CAAC,AALD,CAAmC,KAAK,GAKvC;AALY,sCAAa"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { KameleoonContext } from './KameleoonContext';
|
|
2
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-
|
|
3
|
+
export { Browser as IBrowser, Conversion as IConversion, Device as IDevice, PageView as IPageView, DeviceType, } from '@kameleoon/javascript-sdk-core/dist/data';
|
|
4
4
|
export { default as compose } from './compose';
|
|
5
5
|
export { default as KameleoonProvider } from './KameleoonProvider';
|
|
6
6
|
export * from './types';
|
|
@@ -9,6 +9,7 @@ export { Feature } from './Feature';
|
|
|
9
9
|
export { useKameleoon } from './useKameleoon';
|
|
10
10
|
export { useFeature } from './useFeature';
|
|
11
11
|
export { useVisitorCode } from './useVisitorCode';
|
|
12
|
+
export { useAsyncVisitorCode } from './useAsyncVisitorCode';
|
|
12
13
|
export { useTriggerExperiment } from './useTriggerExperiment';
|
|
13
14
|
export { useActivateFeature } from './useActivateFeature';
|
|
14
15
|
export { useVariationAssociatedData } from './useVariationAssociatedData';
|
|
@@ -26,6 +27,7 @@ export { useRunWhenReady } from './useRunWhenReady';
|
|
|
26
27
|
export { withKameleoon } from './withKameleoon';
|
|
27
28
|
export { withFeature } from './withFeature';
|
|
28
29
|
export { withVisitorCode } from './withVisitorCode';
|
|
30
|
+
export { withAsyncVisitorCode } from './withAsyncVisitorCode';
|
|
29
31
|
export { withTriggerExperiment } from './withTriggerExperiment';
|
|
30
32
|
export { withActivateFeature } from './withActivateFeature';
|
|
31
33
|
export { withVariationAssociatedData } from './withVariationAssociatedData';
|
package/dist/index.js
CHANGED
|
@@ -13,14 +13,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.withRunWhenReady = exports.withCustomData = exports.withConversion = exports.withPageView = exports.withDevice = exports.withBrowser = exports.withFlush = exports.withAddData = exports.withTrackingConversion = exports.withFeatureVariable = exports.withRetrieveDataFromRemoteSource = exports.withVariationAssociatedData = exports.withActivateFeature = exports.withTriggerExperiment = exports.withVisitorCode = exports.withFeature = exports.withKameleoon = exports.useRunWhenReady = exports.useDevice = exports.useCustomData = exports.useConversion = exports.usePageView = exports.useBrowser = exports.useFlush = exports.useAddData = exports.useRetrieveDataFromRemoteSource = exports.useTrackingConversion = exports.useFeatureVariable = exports.useVariationAssociatedData = exports.useActivateFeature = exports.useTriggerExperiment = exports.useVisitorCode = exports.useFeature = exports.useKameleoon = exports.Feature = exports.createClient = exports.KameleoonProvider = exports.compose = exports.DeviceType = exports.IPageView = exports.IDevice = exports.IConversion = exports.IBrowser = exports.KameleoonException = exports.Browser = exports.KAMELEOON_SDK_LOCAL_STORAGE_KEY = exports.KameleoonContext = void 0;
|
|
16
|
+
exports.withRunWhenReady = exports.withCustomData = exports.withConversion = exports.withPageView = exports.withDevice = exports.withBrowser = exports.withFlush = exports.withAddData = exports.withTrackingConversion = exports.withFeatureVariable = exports.withRetrieveDataFromRemoteSource = exports.withVariationAssociatedData = exports.withActivateFeature = exports.withTriggerExperiment = exports.withAsyncVisitorCode = exports.withVisitorCode = exports.withFeature = exports.withKameleoon = exports.useRunWhenReady = exports.useDevice = exports.useCustomData = exports.useConversion = exports.usePageView = exports.useBrowser = exports.useFlush = exports.useAddData = exports.useRetrieveDataFromRemoteSource = exports.useTrackingConversion = exports.useFeatureVariable = exports.useVariationAssociatedData = exports.useActivateFeature = exports.useTriggerExperiment = exports.useAsyncVisitorCode = exports.useVisitorCode = exports.useFeature = exports.useKameleoon = exports.Feature = exports.createClient = exports.KameleoonProvider = exports.compose = exports.DeviceType = exports.IPageView = exports.IDevice = exports.IConversion = exports.IBrowser = exports.KameleoonException = exports.Browser = exports.KAMELEOON_SDK_LOCAL_STORAGE_KEY = exports.KameleoonContext = void 0;
|
|
17
17
|
var KameleoonContext_1 = require("./KameleoonContext");
|
|
18
18
|
Object.defineProperty(exports, "KameleoonContext", { enumerable: true, get: function () { return KameleoonContext_1.KameleoonContext; } });
|
|
19
19
|
var constants_1 = require("./constants");
|
|
20
20
|
Object.defineProperty(exports, "KAMELEOON_SDK_LOCAL_STORAGE_KEY", { enumerable: true, get: function () { return constants_1.KAMELEOON_SDK_LOCAL_STORAGE_KEY; } });
|
|
21
21
|
Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return constants_1.Browser; } });
|
|
22
22
|
Object.defineProperty(exports, "KameleoonException", { enumerable: true, get: function () { return constants_1.KameleoonException; } });
|
|
23
|
-
var data_1 = require("kameleoon-
|
|
23
|
+
var data_1 = require("@kameleoon/javascript-sdk-core/dist/data");
|
|
24
24
|
Object.defineProperty(exports, "IBrowser", { enumerable: true, get: function () { return data_1.Browser; } });
|
|
25
25
|
Object.defineProperty(exports, "IConversion", { enumerable: true, get: function () { return data_1.Conversion; } });
|
|
26
26
|
Object.defineProperty(exports, "IDevice", { enumerable: true, get: function () { return data_1.Device; } });
|
|
@@ -41,6 +41,8 @@ var useFeature_1 = require("./useFeature");
|
|
|
41
41
|
Object.defineProperty(exports, "useFeature", { enumerable: true, get: function () { return useFeature_1.useFeature; } });
|
|
42
42
|
var useVisitorCode_1 = require("./useVisitorCode");
|
|
43
43
|
Object.defineProperty(exports, "useVisitorCode", { enumerable: true, get: function () { return useVisitorCode_1.useVisitorCode; } });
|
|
44
|
+
var useAsyncVisitorCode_1 = require("./useAsyncVisitorCode");
|
|
45
|
+
Object.defineProperty(exports, "useAsyncVisitorCode", { enumerable: true, get: function () { return useAsyncVisitorCode_1.useAsyncVisitorCode; } });
|
|
44
46
|
var useTriggerExperiment_1 = require("./useTriggerExperiment");
|
|
45
47
|
Object.defineProperty(exports, "useTriggerExperiment", { enumerable: true, get: function () { return useTriggerExperiment_1.useTriggerExperiment; } });
|
|
46
48
|
var useActivateFeature_1 = require("./useActivateFeature");
|
|
@@ -75,6 +77,8 @@ var withFeature_1 = require("./withFeature");
|
|
|
75
77
|
Object.defineProperty(exports, "withFeature", { enumerable: true, get: function () { return withFeature_1.withFeature; } });
|
|
76
78
|
var withVisitorCode_1 = require("./withVisitorCode");
|
|
77
79
|
Object.defineProperty(exports, "withVisitorCode", { enumerable: true, get: function () { return withVisitorCode_1.withVisitorCode; } });
|
|
80
|
+
var withAsyncVisitorCode_1 = require("./withAsyncVisitorCode");
|
|
81
|
+
Object.defineProperty(exports, "withAsyncVisitorCode", { enumerable: true, get: function () { return withAsyncVisitorCode_1.withAsyncVisitorCode; } });
|
|
78
82
|
var withTriggerExperiment_1 = require("./withTriggerExperiment");
|
|
79
83
|
Object.defineProperty(exports, "withTriggerExperiment", { enumerable: true, get: function () { return withTriggerExperiment_1.withTriggerExperiment; } });
|
|
80
84
|
var withActivateFeature_1 = require("./withActivateFeature");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,yCAIqB;AAHnB,4HAAA,+BAA+B,OAAA;AAC/B,oGAAA,OAAO,OAAA;AACP,+GAAA,kBAAkB,OAAA;AAEpB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,yCAIqB;AAHnB,4HAAA,+BAA+B,OAAA;AAC/B,oGAAA,OAAO,OAAA;AACP,+GAAA,kBAAkB,OAAA;AAEpB,iEAMkD;AALhD,gGAAA,OAAO,OAAY;AACnB,mGAAA,UAAU,OAAe;AACzB,+FAAA,MAAM,OAAW;AACjB,iGAAA,QAAQ,OAAa;AACrB,kGAAA,UAAU,OAAA;AAEZ,qCAA+C;AAAtC,mHAAA,OAAO,OAAW;AAC3B,yDAAmE;AAA1D,uIAAA,OAAO,OAAqB;AACrC,0CAAwB;AACxB,qDAAiD;AAAxC,+GAAA,YAAY,OAAA;AACrB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,2EAA0E;AAAjE,wIAAA,0BAA0B,OAAA;AACnC,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,qFAAoF;AAA3E,kJAAA,+BAA+B,OAAA;AACxC,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,6EAA4E;AAAnE,0IAAA,2BAA2B,OAAA;AACpC,uFAAsF;AAA7E,oJAAA,gCAAgC,OAAA;AACzC,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SDKConfiguration } from 'kameleoon-
|
|
2
|
-
import { KameleoonClient } from 'kameleoon-
|
|
1
|
+
import { SDKConfiguration } from '@kameleoon/javascript-sdk-core/dist/interfaces/interfaces';
|
|
2
|
+
import { KameleoonClient } from '@kameleoon/javascript-sdk-core';
|
|
3
3
|
export interface ICreateClientParams {
|
|
4
4
|
/** Code of the website you want to run experiments on */
|
|
5
5
|
siteCode: string;
|
package/dist/kameleoonClient.js
CHANGED
|
@@ -1,16 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.createClient = void 0;
|
|
4
|
-
var
|
|
40
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
5
41
|
/**
|
|
6
42
|
* Creates an instance of KameleoonClient
|
|
7
43
|
*/
|
|
8
44
|
function createClient(_a) {
|
|
9
45
|
var siteCode = _a.siteCode, visitorCode = _a.visitorCode, options = _a.options;
|
|
10
|
-
var client = new
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
46
|
+
var client = new javascript_sdk_core_1.KameleoonClient(siteCode, options);
|
|
47
|
+
var isBrowser = window && window.document;
|
|
48
|
+
function addTargeting(kameleoonClient, code) {
|
|
49
|
+
var _this = this;
|
|
50
|
+
kameleoonClient.runWhenReady(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0: return [4 /*yield*/, client.addData(code, new javascript_sdk_core_1.KameleoonData.CustomData(1, visitorCode))];
|
|
54
|
+
case 1:
|
|
55
|
+
_a.sent();
|
|
56
|
+
return [2 /*return*/];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}); }, function () { }, 1000);
|
|
60
|
+
client.flush(visitorCode);
|
|
61
|
+
}
|
|
62
|
+
if (visitorCode) {
|
|
63
|
+
addTargeting(client, visitorCode);
|
|
64
|
+
return client;
|
|
65
|
+
}
|
|
66
|
+
if (isBrowser) {
|
|
67
|
+
addTargeting(client, client.obtainVisitorCode(''));
|
|
68
|
+
return client;
|
|
69
|
+
}
|
|
70
|
+
var generatedVisitorCode = '';
|
|
71
|
+
client
|
|
72
|
+
.obtainAsyncVisitorCode('')
|
|
73
|
+
.then(function (code) {
|
|
74
|
+
generatedVisitorCode = code;
|
|
75
|
+
})
|
|
76
|
+
.catch(function () {
|
|
77
|
+
generatedVisitorCode = '';
|
|
78
|
+
})
|
|
79
|
+
.finally(function () {
|
|
80
|
+
addTargeting(client, generatedVisitorCode);
|
|
81
|
+
});
|
|
14
82
|
return client;
|
|
15
83
|
}
|
|
16
84
|
exports.createClient = createClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kameleoonClient.js","sourceRoot":"","sources":["../src/kameleoonClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kameleoonClient.js","sourceRoot":"","sources":["../src/kameleoonClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sEAAgF;AAahF;;GAEG;AACH,SAAgB,YAAY,CAAC,EAIP;QAHpB,QAAQ,cAAA,EACR,WAAW,iBAAA,EACX,OAAO,aAAA;IAEP,IAAM,MAAM,GAAG,IAAI,qCAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtD,IAAM,SAAS,GAAG,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC;IAE5C,SAAS,YAAY,CAAC,eAAgC,EAAE,IAAY;QAApE,iBAaC;QAZC,eAAe,CAAC,YAAY,CAC1B;;;4BACE,qBAAM,MAAM,CAAC,OAAO,CAClB,IAAI,EACJ,IAAI,mCAAa,CAAC,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,CAC7C,EAAA;;wBAHD,SAGC,CAAC;;;;aACH,EACD,cAAO,CAAC,EACR,IAAI,CACL,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,WAAW,EAAE;QACf,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAElC,OAAO,MAAM,CAAC;KACf;IAED,IAAI,SAAS,EAAE;QACb,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;QAEnD,OAAO,MAAM,CAAC;KACf;IAED,IAAI,oBAAoB,GAAG,EAAE,CAAC;IAE9B,MAAM;SACH,sBAAsB,CAAC,EAAE,CAAC;SAC1B,IAAI,CAAC,UAAC,IAAY;QACjB,oBAAoB,GAAG,IAAI,CAAC;IAC9B,CAAC,CAAC;SACD,KAAK,CAAC;QACL,oBAAoB,GAAG,EAAE,CAAC;IAC5B,CAAC,CAAC;SACD,OAAO,CAAC;QACP,YAAY,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEL,OAAO,MAAM,CAAC;AAChB,CAAC;AAjDD,oCAiDC"}
|
|
@@ -5,24 +5,22 @@ var react_1 = require("react");
|
|
|
5
5
|
var useKameleoon_1 = require("./useKameleoon");
|
|
6
6
|
var ProviderError_1 = require("./ProviderError");
|
|
7
7
|
var useError_1 = require("./useError");
|
|
8
|
-
var useVisitorCode_1 = require("./useVisitorCode");
|
|
9
8
|
/**
|
|
10
9
|
* A React Hook that returns callback function which activates a feature toggle
|
|
11
10
|
*/
|
|
12
11
|
function useActivateFeature() {
|
|
13
12
|
var client = (0, useKameleoon_1.useKameleoon)().client;
|
|
14
13
|
var _a = (0, useError_1.useError)(), error = _a.error, setError = _a.setError;
|
|
15
|
-
var getVisitorCode = (0, useVisitorCode_1.useVisitorCode)().getVisitorCode;
|
|
16
14
|
var hasFeature = (0, react_1.useCallback)(function (featureKey, visitorCode) {
|
|
17
15
|
try {
|
|
18
|
-
var userCode = visitorCode !== null && visitorCode !== void 0 ? visitorCode :
|
|
16
|
+
var userCode = visitorCode !== null && visitorCode !== void 0 ? visitorCode : client.generateRandomString();
|
|
19
17
|
return client.activateFeature(userCode, featureKey);
|
|
20
18
|
}
|
|
21
19
|
catch (unknownError) {
|
|
22
20
|
setError(unknownError);
|
|
23
21
|
return false;
|
|
24
22
|
}
|
|
25
|
-
}, [client,
|
|
23
|
+
}, [client, setError]);
|
|
26
24
|
if (!client) {
|
|
27
25
|
throw new ProviderError_1.ProviderError('useActivateFeature');
|
|
28
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActivateFeature.js","sourceRoot":"","sources":["../src/useActivateFeature.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,+CAA8C;AAC9C,iDAAgD;AAEhD,uCAAsC;
|
|
1
|
+
{"version":3,"file":"useActivateFeature.js","sourceRoot":"","sources":["../src/useActivateFeature.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,+CAA8C;AAC9C,iDAAgD;AAEhD,uCAAsC;AAWtC;;GAEG;AACH,SAAgB,kBAAkB;IACxB,IAAA,MAAM,GAAK,IAAA,2BAAY,GAAE,OAAnB,CAAoB;IAC5B,IAAA,KAAsB,IAAA,mBAAQ,GAAE,EAA9B,KAAK,WAAA,EAAE,QAAQ,cAAe,CAAC;IAEvC,IAAM,UAAU,GAAG,IAAA,mBAAW,EAC5B,UAAC,UAA2B,EAAE,WAAoB;QAChD,IAAI;YACF,IAAM,QAAQ,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,MAAM,CAAC,oBAAoB,EAAE,CAAC;YAE9D,OAAO,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;SACrD;QAAC,OAAO,YAAY,EAAE;YACrB,QAAQ,CAAC,YAAY,CAAC,CAAC;YAEvB,OAAO,KAAK,CAAC;SACd;IACH,CAAC,EACD,CAAC,MAAM,EAAE,QAAQ,CAAC,CACnB,CAAC;IAEF,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,6BAAa,CAAC,oBAAoB,CAAC,CAAC;KAC/C;IAED,OAAO;QACL,UAAU,YAAA;QACV,KAAK,OAAA;KACN,CAAC;AACJ,CAAC;AA3BD,gDA2BC"}
|
package/dist/useAddData.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataInterface as IData } from 'kameleoon-
|
|
1
|
+
import { DataInterface as IData } from '@kameleoon/javascript-sdk-core/dist/interfaces/interfaces';
|
|
2
2
|
interface AddDataHookResult {
|
|
3
3
|
/**
|
|
4
4
|
* @param visitorCode - unique identifier of the user
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface AsyncVisitorCodeHookResult {
|
|
2
|
+
/**
|
|
3
|
+
* @param topLevelDomain - current top level domain for the concerned site
|
|
4
|
+
* @param defaultVisitorCode - this parameter will be used as the visitorCode
|
|
5
|
+
*/
|
|
6
|
+
getAsyncVisitorCode: (topLevelDomain: string, defaultVisitorCode?: string) => Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A React Hook that returns callback function which obtains the Kameleoon visitorCode asynchronously for the current visitor
|
|
10
|
+
*/
|
|
11
|
+
export declare function useAsyncVisitorCode(): AsyncVisitorCodeHookResult;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.useAsyncVisitorCode = void 0;
|
|
40
|
+
var react_1 = require("react");
|
|
41
|
+
var useKameleoon_1 = require("./useKameleoon");
|
|
42
|
+
/**
|
|
43
|
+
* A React Hook that returns callback function which obtains the Kameleoon visitorCode asynchronously for the current visitor
|
|
44
|
+
*/
|
|
45
|
+
function useAsyncVisitorCode() {
|
|
46
|
+
var _this = this;
|
|
47
|
+
var client = (0, useKameleoon_1.useKameleoon)().client;
|
|
48
|
+
var getAsyncVisitorCode = (0, react_1.useCallback)(function (topLevelDomain, defaultVisitorCode) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
49
|
+
return [2 /*return*/, client.obtainAsyncVisitorCode(topLevelDomain, defaultVisitorCode)];
|
|
50
|
+
}); }); }, [client]);
|
|
51
|
+
return {
|
|
52
|
+
getAsyncVisitorCode: getAsyncVisitorCode,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
exports.useAsyncVisitorCode = useAsyncVisitorCode;
|
|
56
|
+
//# sourceMappingURL=useAsyncVisitorCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAsyncVisitorCode.js","sourceRoot":"","sources":["../src/useAsyncVisitorCode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAoC;AACpC,+CAA8C;AAa9C;;GAEG;AACH,SAAgB,mBAAmB;IAAnC,iBAeC;IAdS,IAAA,MAAM,GAAK,IAAA,2BAAY,GAAE,OAAnB,CAAoB;IAElC,IAAM,mBAAmB,GAAG,IAAA,mBAAW,EACrC,UACE,cAAsB,EACtB,kBAA2B;QAE3B,sBAAA,MAAM,CAAC,sBAAsB,CAAC,cAAc,EAAE,kBAAkB,CAAC,EAAA;aAAA,EACnE,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO;QACL,mBAAmB,qBAAA;KACpB,CAAC;AACJ,CAAC;AAfD,kDAeC"}
|
package/dist/useBrowser.d.ts
CHANGED
package/dist/useBrowser.js
CHANGED
|
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useBrowser = void 0;
|
|
7
7
|
var react_1 = require("react");
|
|
8
|
-
var
|
|
9
|
-
var data_1 = __importDefault(require("kameleoon-
|
|
8
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
9
|
+
var data_1 = __importDefault(require("@kameleoon/javascript-sdk-core/dist/data"));
|
|
10
10
|
/**
|
|
11
11
|
* A React Hook that returns callback function which adds browser type
|
|
12
12
|
*/
|
|
13
13
|
function useBrowser() {
|
|
14
14
|
var addBrowser = (0, react_1.useCallback)(function (browser) {
|
|
15
|
-
return new
|
|
15
|
+
return new javascript_sdk_core_1.KameleoonData.Browser(data_1.default.browsers[browser]);
|
|
16
16
|
}, []);
|
|
17
17
|
return {
|
|
18
18
|
addBrowser: addBrowser,
|
package/dist/useBrowser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBrowser.js","sourceRoot":"","sources":["../src/useBrowser.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"useBrowser.js","sourceRoot":"","sources":["../src/useBrowser.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAoC;AACpC,sEAA+D;AAC/D,kFAAqF;AAUrF;;GAEG;AACH,SAAgB,UAAU;IACxB,IAAM,UAAU,GAAG,IAAA,mBAAW,EAC5B,UAAC,OAAgB;QACf,OAAA,IAAI,mCAAa,CAAC,OAAO,CAAC,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAAjD,CAAiD,EACnD,EAAE,CACH,CAAC;IAEF,OAAO;QACL,UAAU,YAAA;KACX,CAAC;AACJ,CAAC;AAVD,gCAUC"}
|
package/dist/useConversion.d.ts
CHANGED
package/dist/useConversion.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useConversion = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
|
-
var
|
|
5
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
6
6
|
/**
|
|
7
7
|
* A React Hook that returns callback function which adds conversion
|
|
8
8
|
*/
|
|
9
9
|
function useConversion() {
|
|
10
10
|
var addConversion = (0, react_1.useCallback)(function (goalId, revenue, negative) {
|
|
11
|
-
return new
|
|
11
|
+
return new javascript_sdk_core_1.KameleoonData.Conversion(goalId, revenue, negative);
|
|
12
12
|
}, []);
|
|
13
13
|
return {
|
|
14
14
|
addConversion: addConversion,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConversion.js","sourceRoot":"","sources":["../src/useConversion.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"useConversion.js","sourceRoot":"","sources":["../src/useConversion.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,sEAA+D;AAgB/D;;GAEG;AACH,SAAgB,aAAa;IAC3B,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAC,MAAc,EAAE,OAAgB,EAAE,QAAkB;QACnD,OAAA,IAAI,mCAAa,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC;IAAvD,CAAuD,EACzD,EAAE,CACH,CAAC;IAEF,OAAO;QACL,aAAa,eAAA;KACd,CAAC;AACJ,CAAC;AAVD,sCAUC"}
|
package/dist/useCustomData.d.ts
CHANGED
package/dist/useCustomData.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCustomData = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
|
-
var
|
|
5
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
6
6
|
/**
|
|
7
7
|
* A React Hook that returns callback function which adds custom data
|
|
8
8
|
*/
|
|
9
9
|
function useCustomData() {
|
|
10
10
|
var addCustomData = (0, react_1.useCallback)(function (index, value) {
|
|
11
|
-
return new
|
|
11
|
+
return new javascript_sdk_core_1.KameleoonData.CustomData(index, value);
|
|
12
12
|
}, []);
|
|
13
13
|
return {
|
|
14
14
|
addCustomData: addCustomData,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCustomData.js","sourceRoot":"","sources":["../src/useCustomData.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"useCustomData.js","sourceRoot":"","sources":["../src/useCustomData.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,sEAA+D;AAW/D;;GAEG;AACH,SAAgB,aAAa;IAC3B,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAC,KAAa,EAAE,KAAa;QAC3B,OAAA,IAAI,mCAAa,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC;IAA1C,CAA0C,EAC5C,EAAE,CACH,CAAC;IAEF,OAAO;QACL,aAAa,eAAA;KACd,CAAC;AACJ,CAAC;AAVD,sCAUC"}
|
package/dist/useDevice.d.ts
CHANGED
package/dist/useDevice.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useDevice = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
|
-
var
|
|
5
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
6
6
|
/**
|
|
7
7
|
* A React Hook that returns a callback function which adds interest
|
|
8
8
|
*/
|
|
9
9
|
function useDevice() {
|
|
10
|
-
var addDevice = (0, react_1.useCallback)(function (device) { return new
|
|
10
|
+
var addDevice = (0, react_1.useCallback)(function (device) { return new javascript_sdk_core_1.KameleoonData.Device(device); }, []);
|
|
11
11
|
return {
|
|
12
12
|
addDevice: addDevice,
|
|
13
13
|
};
|
package/dist/useDevice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDevice.js","sourceRoot":"","sources":["../src/useDevice.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"useDevice.js","sourceRoot":"","sources":["../src/useDevice.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,sEAA+D;AAa/D;;GAEG;AACH,SAAgB,SAAS;IACvB,IAAM,SAAS,GAAG,IAAA,mBAAW,EAC3B,UAAC,MAAkB,IAAc,OAAA,IAAI,mCAAa,CAAC,MAAM,CAAC,MAAM,CAAC,EAAhC,CAAgC,EACjE,EAAE,CACH,CAAC;IAEF,OAAO;QACL,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AATD,8BASC"}
|
package/dist/useFeature.js
CHANGED
|
@@ -32,7 +32,6 @@ var react_1 = require("react");
|
|
|
32
32
|
var useActivateFeature_1 = require("./useActivateFeature");
|
|
33
33
|
var useFeatureVariable_1 = require("./useFeatureVariable");
|
|
34
34
|
var constants_1 = require("./constants");
|
|
35
|
-
var useVisitorCode_1 = require("./useVisitorCode");
|
|
36
35
|
var useKameleoon_1 = require("./useKameleoon");
|
|
37
36
|
var useErrors_1 = require("./useErrors");
|
|
38
37
|
/**
|
|
@@ -43,14 +42,12 @@ function useFeature(_a) {
|
|
|
43
42
|
var featureKey = _a.featureKey, variableKeys = _a.variableKeys, visitorCode = _a.visitorCode;
|
|
44
43
|
var _c = (0, useActivateFeature_1.useActivateFeature)(), hasFeature = _c.hasFeature, activateFeatureError = _c.error;
|
|
45
44
|
var _d = (0, useFeatureVariable_1.useFeatureVariable)(), getFeatureVariable = _d.getFeatureVariable, featureVariableError = _d.error;
|
|
46
|
-
var getVisitorCode = (0, useVisitorCode_1.useVisitorCode)().getVisitorCode;
|
|
47
45
|
var client = (0, useKameleoon_1.useKameleoon)().client;
|
|
48
46
|
var _e = __read((0, react_1.useState)((_b = {},
|
|
49
47
|
_b[constants_1.FeatureResultField.IsActive] = false,
|
|
50
48
|
_b[constants_1.FeatureResultField.Variables] = [],
|
|
51
49
|
_b)), 2), feature = _e[0], setFeature = _e[1];
|
|
52
50
|
var _f = (0, useErrors_1.useErrors)(), errors = _f.errors, setErrors = _f.setErrors;
|
|
53
|
-
var userCode = visitorCode !== null && visitorCode !== void 0 ? visitorCode : getVisitorCode('');
|
|
54
51
|
function getVariableObject(key, value) {
|
|
55
52
|
var _a;
|
|
56
53
|
if (value) {
|
|
@@ -75,18 +72,18 @@ function useFeature(_a) {
|
|
|
75
72
|
}, [variableKeys, getFeatureVariable, featureKey]);
|
|
76
73
|
(0, react_1.useEffect)(function () {
|
|
77
74
|
var _a;
|
|
78
|
-
var _b, _c, _d;
|
|
79
|
-
var
|
|
75
|
+
var _b, _c, _d, _e;
|
|
76
|
+
var featureFlagArray = (_b = client.configurations) === null || _b === void 0 ? void 0 : _b.configuration.featureFlags.filter(function (item) {
|
|
80
77
|
return item.identificationKey === featureKey;
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
});
|
|
79
|
+
if (Array.isArray(featureFlagArray) && featureFlagArray.length) {
|
|
80
|
+
var currentEnvironment = (_e = (_d = (_c = featureFlagArray[0]) === null || _c === void 0 ? void 0 : _c.environment) === null || _d === void 0 ? void 0 : _d.key) !== null && _e !== void 0 ? _e : constants_1.PRODUCTION;
|
|
84
81
|
setFeature((_a = {},
|
|
85
|
-
_a[constants_1.FeatureResultField.IsActive] = hasFeature(featureKey,
|
|
82
|
+
_a[constants_1.FeatureResultField.IsActive] = hasFeature(featureKey, visitorCode),
|
|
86
83
|
_a[constants_1.FeatureResultField.Variables] = getVariablesArray(currentEnvironment),
|
|
87
84
|
_a));
|
|
88
85
|
}
|
|
89
|
-
|
|
86
|
+
else {
|
|
90
87
|
setFeature(function (prevFeature) {
|
|
91
88
|
var _a;
|
|
92
89
|
return (__assign(__assign({}, prevFeature), (_a = {}, _a[constants_1.FeatureResultField.IsActive] = false, _a)));
|
|
@@ -94,7 +91,7 @@ function useFeature(_a) {
|
|
|
94
91
|
}
|
|
95
92
|
// getVariablesArray put in dependencies creates an infinite loop
|
|
96
93
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
97
|
-
}, [
|
|
94
|
+
}, [visitorCode, featureKey, hasFeature]);
|
|
98
95
|
(0, react_1.useEffect)(function () {
|
|
99
96
|
setErrors([activateFeatureError === null || activateFeatureError === void 0 ? void 0 : activateFeatureError.type, featureVariableError === null || featureVariableError === void 0 ? void 0 : featureVariableError.type]);
|
|
100
97
|
}, [activateFeatureError, featureVariableError, setErrors]);
|
package/dist/useFeature.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFeature.js","sourceRoot":"","sources":["../src/useFeature.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAyD;AACzD,2DAA0D;AAC1D,2DAA0D;AAE1D,yCAA6D;AAC7D
|
|
1
|
+
{"version":3,"file":"useFeature.js","sourceRoot":"","sources":["../src/useFeature.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAyD;AACzD,2DAA0D;AAC1D,2DAA0D;AAE1D,yCAA6D;AAC7D,+CAA8C;AAC9C,yCAAwC;AAExC;;GAEG;AACH,SAAgB,UAAU,CAAC,EAIV;;QAHf,UAAU,gBAAA,EACV,YAAY,kBAAA,EACZ,WAAW,iBAAA;IAEL,IAAA,KAA8C,IAAA,uCAAkB,GAAE,EAAhE,UAAU,gBAAA,EAAS,oBAAoB,WAAyB,CAAC;IACnE,IAAA,KACJ,IAAA,uCAAkB,GAAE,EADd,kBAAkB,wBAAA,EAAS,oBAAoB,WACjC,CAAC;IACf,IAAA,MAAM,GAAK,IAAA,2BAAY,GAAE,OAAnB,CAAoB;IAE5B,IAAA,KAAA,OAAwB,IAAA,gBAAQ;QACpC,GAAC,8BAAkB,CAAC,QAAQ,IAAG,KAAK;QACpC,GAAC,8BAAkB,CAAC,SAAS,IAAG,EAAE;YAClC,IAAA,EAHK,OAAO,QAAA,EAAE,UAAU,QAGxB,CAAC;IACG,IAAA,KAAwB,IAAA,qBAAS,GAAE,EAAjC,MAAM,YAAA,EAAE,SAAS,eAAgB,CAAC;IAE1C,SAAS,iBAAiB,CACxB,GAAW,EACX,KAA8B;;QAE9B,IAAI,KAAK,EAAE;YACT;gBACE,GAAC,GAAG,IAAG,KAAK;mBACZ;SACH;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAM,iBAAiB,GAAG,IAAA,mBAAW,EACnC,UAAC,WAAmB;QAClB,IAAM,cAAc,GAAG,EAAE,CAAC;QAC1B,IAAM,uBAAuB,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;QAE1D,IAAI,KAAK,CAAC,OAAO,CAAC,uBAAuB,CAAC,EAAE;YAC1C,uBAAuB,CAAC,OAAO,CAAC,UAAC,GAAG;gBAClC,cAAc,CAAC,IAAI,CACjB,iBAAiB,CAAC,GAAG,EAAE,kBAAkB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAC5D,CAAC;YACJ,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,cAAc,CAAC,IAAI,CACjB,iBAAiB,CACf,uBAAuB,EACvB,kBAAkB,CAAC,UAAU,EAAE,uBAAuB,CAAC,CACxD,CACF,CAAC;SACH;QAED,OAAO,cAAc,CAAC;IACxB,CAAC,EACD,CAAC,YAAY,EAAE,kBAAkB,EAAE,UAAU,CAAC,CAC/C,CAAC;IAEF,IAAA,iBAAS,EAAC;;;QACR,IAAM,gBAAgB,GACpB,MAAA,MAAM,CAAC,cAAc,0CAAE,aAAa,CAAC,YAAY,CAAC,MAAM,CACtD,UAAC,IAA6B;YAC5B,OAAA,IAAI,CAAC,iBAAiB,KAAK,UAAU;QAArC,CAAqC,CACxC,CAAC;QAEJ,IAAI,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,CAAC,MAAM,EAAE;YAC9D,IAAM,kBAAkB,GACtB,MAAA,MAAA,MAAA,gBAAgB,CAAC,CAAC,CAAC,0CAAE,WAAW,0CAAE,GAAG,mCAAI,sBAAU,CAAC;YAEtD,UAAU;gBACR,GAAC,8BAAkB,CAAC,QAAQ,IAAG,UAAU,CAAC,UAAU,EAAE,WAAW,CAAC;gBAClE,GAAC,8BAAkB,CAAC,SAAS,IAAG,iBAAiB,CAAC,kBAAkB,CAAC;oBACrE,CAAC;SACJ;aAAM;YACL,UAAU,CAAC,UAAC,WAAW;;gBAAK,OAAA,uBACvB,WAAW,gBACb,8BAAkB,CAAC,QAAQ,IAAG,KAAK,OACpC;YAH0B,CAG1B,CAAC,CAAC;SACL;QACD,iEAAiE;QACjE,uDAAuD;IACzD,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IAE1C,IAAA,iBAAS,EAAC;QACR,SAAS,CAAC,CAAC,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,IAAI,EAAE,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,IAAI,CAAC,CAAC,CAAC;IACtE,CAAC,EAAE,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC;IAE5D,OAAO,EAAE,OAAO,SAAA,EAAE,MAAM,QAAA,EAAE,CAAC;AAC7B,CAAC;AApFD,gCAoFC"}
|
package/dist/useKameleoon.d.ts
CHANGED
package/dist/usePageView.d.ts
CHANGED
package/dist/usePageView.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.usePageView = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
|
-
var
|
|
5
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
6
6
|
/**
|
|
7
7
|
* A React Hook that returns callback function which adds page view
|
|
8
8
|
*/
|
|
9
9
|
function usePageView() {
|
|
10
10
|
var addPageView = (0, react_1.useCallback)(function (url, title, referrer) {
|
|
11
|
-
return new
|
|
11
|
+
return new javascript_sdk_core_1.KameleoonData.PageView(url, title, referrer);
|
|
12
12
|
}, []);
|
|
13
13
|
return {
|
|
14
14
|
addPageView: addPageView,
|
package/dist/usePageView.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePageView.js","sourceRoot":"","sources":["../src/usePageView.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"usePageView.js","sourceRoot":"","sources":["../src/usePageView.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,sEAA+D;AAY/D;;GAEG;AACH,SAAgB,WAAW;IACzB,IAAM,WAAW,GAAG,IAAA,mBAAW,EAC7B,UAAC,GAAW,EAAE,KAAa,EAAE,QAAiB;QAC5C,OAAA,IAAI,mCAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC;IAAhD,CAAgD,EAClD,EAAE,CACH,CAAC;IAEF,OAAO;QACL,WAAW,aAAA;KACZ,CAAC;AACJ,CAAC;AAVD,kCAUC"}
|
package/dist/withAddData.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DataInterface as IData } from 'kameleoon-
|
|
2
|
+
import { DataInterface as IData } from '@kameleoon/javascript-sdk-core/dist/interfaces/interfaces';
|
|
3
3
|
import { UnknownPropsType, Without } from './types';
|
|
4
4
|
interface IWithAddData {
|
|
5
5
|
/**
|
package/dist/withAddData.js
CHANGED
|
@@ -10,54 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
-
if (!m) return o;
|
|
16
|
-
var i = m.call(o), r, ar = [], e;
|
|
17
|
-
try {
|
|
18
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
-
}
|
|
20
|
-
catch (error) { e = { error: error }; }
|
|
21
|
-
finally {
|
|
22
|
-
try {
|
|
23
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
-
}
|
|
25
|
-
finally { if (e) throw e.error; }
|
|
26
|
-
}
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
30
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31
|
-
if (ar || !(i in from)) {
|
|
32
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33
|
-
ar[i] = from[i];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
|
-
};
|
|
38
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
14
|
exports.withAddData = void 0;
|
|
40
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
-
var
|
|
42
|
-
var KameleoonContext_1 = require("./KameleoonContext");
|
|
43
|
-
var ProviderError_1 = require("./ProviderError");
|
|
16
|
+
var useAddData_1 = require("./useAddData");
|
|
44
17
|
/**
|
|
45
18
|
* A React HOC that gives a wrapped component access to callback function
|
|
46
19
|
* which adds various data to associate this data with the current user
|
|
47
20
|
*/
|
|
48
21
|
function withAddData(Component) {
|
|
49
22
|
return function WrappedComponent(props) {
|
|
50
|
-
var
|
|
51
|
-
var addData = (0, react_1.useCallback)(function (visitorCode) {
|
|
52
|
-
var dataTypes = [];
|
|
53
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
54
|
-
dataTypes[_i - 1] = arguments[_i];
|
|
55
|
-
}
|
|
56
|
-
if (!client) {
|
|
57
|
-
throw new ProviderError_1.ProviderError('withAddData');
|
|
58
|
-
}
|
|
59
|
-
return client.addData.apply(client, __spreadArray([visitorCode], __read(dataTypes), false));
|
|
60
|
-
}, [client]);
|
|
23
|
+
var addData = (0, useAddData_1.useAddData)().addData;
|
|
61
24
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addData: addData }, props), void 0);
|
|
62
25
|
};
|
|
63
26
|
}
|
package/dist/withAddData.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAddData.js","sourceRoot":"","sources":["../src/withAddData.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withAddData.js","sourceRoot":"","sources":["../src/withAddData.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,2CAA0C;AAU1C;;;GAGG;AACH,SAAgB,WAAW,CACzB,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QACnC,IAAA,OAAO,GAAK,IAAA,uBAAU,GAAE,QAAjB,CAAkB;QAEjC,OAAO,uBAAC,SAAS,aAAC,OAAO,EAAE,OAAO,IAAO,KAAe,UAAI,CAAC;IAC/D,CAAC,CAAC;AACJ,CAAC;AARD,kCAQC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UnknownPropsType, Without } from './types';
|
|
3
|
+
interface IWithAsyncVisitorCode {
|
|
4
|
+
/**
|
|
5
|
+
* @param topLevelDomain - current top level domain for the concerned site
|
|
6
|
+
* @param defaultVisitorCode - this parameter will be used as the visitorCode
|
|
7
|
+
*/
|
|
8
|
+
getAsyncVisitorCode: (topLevelDomain: string, defaultVisitorCode?: string) => Promise<string>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A React HOC that gives a wrapped component access to callback function
|
|
12
|
+
* which obtains the Kameleoon visitorCode asynchronously for the current visitor
|
|
13
|
+
*/
|
|
14
|
+
export declare function withAsyncVisitorCode<Props extends UnknownPropsType>(Component: React.ComponentType<Props>): React.ComponentType<Props & Without<Props, IWithAsyncVisitorCode>>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
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
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.withAsyncVisitorCode = void 0;
|
|
51
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
52
|
+
var react_1 = require("react");
|
|
53
|
+
var KameleoonContext_1 = require("./KameleoonContext");
|
|
54
|
+
var ProviderError_1 = require("./ProviderError");
|
|
55
|
+
/**
|
|
56
|
+
* A React HOC that gives a wrapped component access to callback function
|
|
57
|
+
* which obtains the Kameleoon visitorCode asynchronously for the current visitor
|
|
58
|
+
*/
|
|
59
|
+
function withAsyncVisitorCode(Component) {
|
|
60
|
+
return function WrappedComponent(props) {
|
|
61
|
+
var _this = this;
|
|
62
|
+
var client = (0, react_1.useContext)(KameleoonContext_1.KameleoonContext);
|
|
63
|
+
var getAsyncVisitorCode = (0, react_1.useCallback)(function (topLevelDomain, defaultVisitorCode) { return __awaiter(_this, void 0, void 0, function () {
|
|
64
|
+
return __generator(this, function (_a) {
|
|
65
|
+
if (!client) {
|
|
66
|
+
throw new ProviderError_1.ProviderError('withAsyncVisitorCode');
|
|
67
|
+
}
|
|
68
|
+
return [2 /*return*/, client.obtainAsyncVisitorCode(topLevelDomain, defaultVisitorCode)];
|
|
69
|
+
});
|
|
70
|
+
}); }, [client]);
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)(Component, __assign({ getAsyncVisitorCode: getAsyncVisitorCode }, props), void 0));
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
exports.withAsyncVisitorCode = withAsyncVisitorCode;
|
|
75
|
+
//# sourceMappingURL=withAsyncVisitorCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withAsyncVisitorCode.js","sourceRoot":"","sources":["../src/withAsyncVisitorCode.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAuD;AAEvD,uDAAsD;AACtD,iDAAgD;AAahD;;;GAGG;AACH,SAAgB,oBAAoB,CAClC,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAAtC,iBA0BN;QAzBC,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,mCAAgB,CAAC,CAAC;QAE5C,IAAM,mBAAmB,GAAG,IAAA,mBAAW,EACrC,UACE,cAAsB,EACtB,kBAA2B;;gBAE3B,IAAI,CAAC,MAAM,EAAE;oBACX,MAAM,IAAI,6BAAa,CAAC,sBAAsB,CAAC,CAAC;iBACjD;gBAED,sBAAO,MAAM,CAAC,sBAAsB,CAClC,cAAc,EACd,kBAAkB,CACnB,EAAC;;aACH,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,OAAO,CACL,uBAAC,SAAS,aACR,mBAAmB,EAAE,mBAAmB,IACnC,KAAe,UACpB,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AA9BD,oDA8BC"}
|
package/dist/withBrowser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Browser as IBrowser } from 'kameleoon-
|
|
2
|
+
import { Browser as IBrowser } from '@kameleoon/javascript-sdk-core/dist/data';
|
|
3
3
|
import { Browser } from './constants';
|
|
4
4
|
import { UnknownPropsType, Without } from './types';
|
|
5
5
|
interface IWithBrowser {
|
package/dist/withBrowser.js
CHANGED
|
@@ -17,8 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.withBrowser = void 0;
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var react_1 = require("react");
|
|
20
|
-
var data_1 = __importDefault(require("kameleoon-
|
|
21
|
-
var
|
|
20
|
+
var data_1 = __importDefault(require("@kameleoon/javascript-sdk-core/dist/data"));
|
|
21
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
22
22
|
/**
|
|
23
23
|
* A React HOC that gives a wrapped component access to callback function
|
|
24
24
|
* which adds browser type
|
|
@@ -26,7 +26,7 @@ var kameleoon_client_javascript_1 = require("kameleoon-client-javascript");
|
|
|
26
26
|
function withBrowser(Component) {
|
|
27
27
|
return function WrappedComponent(props) {
|
|
28
28
|
var addBrowser = (0, react_1.useCallback)(function (browser) {
|
|
29
|
-
return new
|
|
29
|
+
return new javascript_sdk_core_1.KameleoonData.Browser(data_1.default.browsers[browser]);
|
|
30
30
|
}, []);
|
|
31
31
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addBrowser: addBrowser }, props), void 0);
|
|
32
32
|
};
|
package/dist/withBrowser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withBrowser.js","sourceRoot":"","sources":["../src/withBrowser.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C
|
|
1
|
+
{"version":3,"file":"withBrowser.js","sourceRoot":"","sources":["../src/withBrowser.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,kFAAqF;AACrF,sEAA+D;AAW/D;;;GAGG;AACH,SAAgB,WAAW,CACzB,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,UAAU,GAAG,IAAA,mBAAW,EAAC,UAAC,OAAgB;YAC9C,OAAO,IAAI,mCAAa,CAAC,OAAO,CAAC,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3D,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,uBAAC,SAAS,aAAC,UAAU,EAAE,UAAU,IAAO,KAAe,UAAI,CAAC;IACrE,CAAC,CAAC;AACJ,CAAC;AAVD,kCAUC"}
|
package/dist/withConversion.d.ts
CHANGED
package/dist/withConversion.js
CHANGED
|
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.withConversion = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
var react_1 = require("react");
|
|
17
|
-
var
|
|
17
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
18
18
|
/**
|
|
19
19
|
* A React HOC that gives a wrapped component access to callback function
|
|
20
20
|
* which adds conversion
|
|
@@ -22,7 +22,7 @@ var kameleoon_client_javascript_1 = require("kameleoon-client-javascript");
|
|
|
22
22
|
function withConversion(Component) {
|
|
23
23
|
return function WrappedComponent(props) {
|
|
24
24
|
var addConversion = (0, react_1.useCallback)(function (goalId, revenue, negative) {
|
|
25
|
-
return new
|
|
25
|
+
return new javascript_sdk_core_1.KameleoonData.Conversion(goalId, revenue, negative);
|
|
26
26
|
}, []);
|
|
27
27
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addConversion: addConversion }, props), void 0);
|
|
28
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withConversion.js","sourceRoot":"","sources":["../src/withConversion.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"withConversion.js","sourceRoot":"","sources":["../src/withConversion.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,sEAA+D;AAiB/D;;;GAGG;AACH,SAAgB,cAAc,CAC5B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAC,MAAc,EAAE,OAAgB,EAAE,QAAkB;YACnD,OAAO,IAAI,mCAAa,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC,EACD,EAAE,CACH,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,aAAa,EAAE,aAAa,IAAO,KAAe,UAAI,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAbD,wCAaC"}
|
package/dist/withCustomData.d.ts
CHANGED
package/dist/withCustomData.js
CHANGED
|
@@ -14,15 +14,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.withCustomData = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
var react_1 = require("react");
|
|
17
|
-
var
|
|
17
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
18
18
|
/**
|
|
19
19
|
* A React HOC that gives a wrapped component access to callback function
|
|
20
20
|
* which adds custom data
|
|
21
21
|
*/
|
|
22
22
|
function withCustomData(Component) {
|
|
23
23
|
return function WrappedComponent(props) {
|
|
24
|
-
var addCustomData = (0, react_1.useCallback)(function (
|
|
25
|
-
return new
|
|
24
|
+
var addCustomData = (0, react_1.useCallback)(function (index, value) {
|
|
25
|
+
return new javascript_sdk_core_1.KameleoonData.CustomData(index, value);
|
|
26
26
|
}, []);
|
|
27
27
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addCustomData: addCustomData }, props), void 0);
|
|
28
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withCustomData.js","sourceRoot":"","sources":["../src/withCustomData.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"withCustomData.js","sourceRoot":"","sources":["../src/withCustomData.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAC3C,sEAA+D;AAY/D;;;GAGG;AACH,SAAgB,cAAc,CAC5B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAC,KAAa,EAAE,KAAa;YAC3B,OAAO,IAAI,mCAAa,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC,EACD,EAAE,CACH,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,aAAa,EAAE,aAAa,IAAO,KAAe,UAAI,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAbD,wCAaC"}
|
package/dist/withDevice.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Device as IDevice, DeviceType } from 'kameleoon-
|
|
2
|
+
import { Device as IDevice, DeviceType } from '@kameleoon/javascript-sdk-core/dist/data';
|
|
3
3
|
import { UnknownPropsType, Without } from './types';
|
|
4
4
|
interface IWithDevice {
|
|
5
5
|
/**
|
package/dist/withDevice.js
CHANGED
|
@@ -14,14 +14,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.withDevice = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
var react_1 = require("react");
|
|
17
|
-
var
|
|
17
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
18
18
|
/**
|
|
19
19
|
* A React HOC that gives a wrapped component access to callback function
|
|
20
20
|
* which adds device type
|
|
21
21
|
*/
|
|
22
22
|
function withDevice(Component) {
|
|
23
23
|
return function WrappedComponent(props) {
|
|
24
|
-
var addDevice = (0, react_1.useCallback)(function (device) { return new
|
|
24
|
+
var addDevice = (0, react_1.useCallback)(function (device) { return new javascript_sdk_core_1.KameleoonData.Device(device); }, []);
|
|
25
25
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addDevice: addDevice }, props), void 0);
|
|
26
26
|
};
|
|
27
27
|
}
|
package/dist/withDevice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withDevice.js","sourceRoot":"","sources":["../src/withDevice.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAK3C,
|
|
1
|
+
{"version":3,"file":"withDevice.js","sourceRoot":"","sources":["../src/withDevice.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAK3C,sEAA+D;AAU/D;;;GAGG;AACH,SAAgB,UAAU,CACxB,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,SAAS,GAAG,IAAA,mBAAW,EAC3B,UAAC,MAAkB,IAAc,OAAA,IAAI,mCAAa,CAAC,MAAM,CAAC,MAAM,CAAC,EAAhC,CAAgC,EACjE,EAAE,CACH,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,SAAS,EAAE,SAAS,IAAO,KAAe,UAAI,CAAC;IACnE,CAAC,CAAC;AACJ,CAAC;AAXD,gCAWC"}
|
package/dist/withKameleoon.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { KameleoonClient } from 'kameleoon-
|
|
2
|
+
import { KameleoonClient } from '@kameleoon/javascript-sdk-core';
|
|
3
3
|
import { UnknownPropsType, Without } from './types';
|
|
4
4
|
interface IWithKameleoonProps {
|
|
5
5
|
/** An instance of KameleoonClient */
|
package/dist/withPageView.d.ts
CHANGED
package/dist/withPageView.js
CHANGED
|
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.withPageView = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
var react_1 = require("react");
|
|
17
|
-
var
|
|
17
|
+
var javascript_sdk_core_1 = require("@kameleoon/javascript-sdk-core");
|
|
18
18
|
/**
|
|
19
19
|
* A React HOC that gives a wrapped component access to callback function
|
|
20
20
|
* which adds page view
|
|
@@ -22,7 +22,7 @@ var kameleoon_client_javascript_1 = require("kameleoon-client-javascript");
|
|
|
22
22
|
function withPageView(Component) {
|
|
23
23
|
return function WrappedComponent(props) {
|
|
24
24
|
var addPageView = (0, react_1.useCallback)(function (url, title, referrer) {
|
|
25
|
-
return new
|
|
25
|
+
return new javascript_sdk_core_1.KameleoonData.PageView(url, title, referrer);
|
|
26
26
|
}, []);
|
|
27
27
|
return (0, jsx_runtime_1.jsx)(Component, __assign({ addPageView: addPageView }, props), void 0);
|
|
28
28
|
};
|
package/dist/withPageView.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPageView.js","sourceRoot":"","sources":["../src/withPageView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,
|
|
1
|
+
{"version":3,"file":"withPageView.js","sourceRoot":"","sources":["../src/withPageView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,sEAA+D;AAY/D;;;GAGG;AACH,SAAgB,YAAY,CAC1B,SAAqC;IAErC,OAAO,SAAS,gBAAgB,CAAC,KAAY;QAC3C,IAAM,WAAW,GAAG,IAAA,mBAAW,EAC7B,UAAC,GAAW,EAAE,KAAa,EAAE,QAAiB;YAC5C,OAAO,IAAI,mCAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC1D,CAAC,EACD,EAAE,CACH,CAAC;QAEF,OAAO,uBAAC,SAAS,aAAC,WAAW,EAAE,WAAW,IAAO,KAAe,UAAI,CAAC;IACvE,CAAC,CAAC;AACJ,CAAC;AAbD,oCAaC"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kameleoon/react-sdk",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "Kameleoon React SDK",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"build": "npm run clear && tsc",
|
|
10
|
+
"clean": "rimraf dist && rimraf tsconfig.tsbuildinfo",
|
|
11
|
+
"build": "npm run clean && tsc",
|
|
13
12
|
"deploy": "npm publish --tag latest --access public",
|
|
14
13
|
"deploy-nexus": "npm publish --registry=https://nexus.kameleoon.net/repository/npm-kameleoon/",
|
|
15
|
-
"release": "../../scripts/release.sh react-sdk",
|
|
16
|
-
"update-documentation": "../../scripts/update_documentation.sh react",
|
|
17
|
-
"test": "jest",
|
|
14
|
+
"release": "/bin/bash ../../scripts/release.sh react-sdk",
|
|
15
|
+
"update-documentation": "/bin/bash ../../scripts/update_documentation.sh react",
|
|
16
|
+
"test": "jest --silent",
|
|
17
|
+
"test:dev": "jest",
|
|
18
18
|
"test:watch": "jest --watch",
|
|
19
|
-
"test:coverage": "jest --coverage"
|
|
20
|
-
"test:update": "jest --updateSnapshot"
|
|
19
|
+
"test:coverage": "jest --coverage"
|
|
21
20
|
},
|
|
22
21
|
"homepage": "https://developers.kameleoon.com/react-js-sdk.html",
|
|
23
22
|
"publishConfig": {
|
|
@@ -36,11 +35,16 @@
|
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
37
|
"@types/validator": "^13.6.3",
|
|
39
|
-
"kameleoon-
|
|
38
|
+
"@kameleoon/javascript-sdk-core": "*",
|
|
40
39
|
"validator": "^13.6.0"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
42
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
43
|
+
"@testing-library/react": "^12.1.5",
|
|
44
|
+
"@types/jest": "^29.0.0",
|
|
43
45
|
"@types/react": "^17.0.24",
|
|
46
|
+
"jest": "^29.0.2",
|
|
47
|
+
"jest-environment-jsdom": "^29.0.2",
|
|
44
48
|
"react": "^17.0.2",
|
|
45
49
|
"rimraf": "^3.0.2",
|
|
46
50
|
"typescript": "^4.4.4"
|
|
@@ -48,4 +52,4 @@
|
|
|
48
52
|
"commitlint": {
|
|
49
53
|
"extends": "@commitlint/config-conventional"
|
|
50
54
|
}
|
|
51
|
-
}
|
|
55
|
+
}
|