@guardian/ab-core
Advanced tools
Comparing version 5.0.0 to 6.0.0
# @guardian/ab-core | ||
## 6.0.0 | ||
### Major Changes | ||
- e9ac438: Members of the `OphanAPIConfig` are now **required**. Consumers must pass a | ||
record function, an error reporter and an object of server-side tests. | ||
With the previously optional members, failure to record tests to Ophan would | ||
fail silently. This has been the case in `dotcom-rendering` since Oct 2023. | ||
In order to update your code to work identically, you must now provide the | ||
following keys to the constructor’s argument. They are listed here along with | ||
the fallbacks previously applied: | ||
- `serverSideTests` → `{}` | ||
- `errorReporter` → `() => undefined` | ||
- `ophanRecord` → `() => undefined` | ||
Note that `errorReporter` has also been narrowed and it now receives a single | ||
parameter, which is still `unknown` due to the fact than anything can be thrown. | ||
## 5.0.0 | ||
@@ -4,0 +25,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { AbTestConfig, CoreAPI, OphanAPI } from "./index-49049993.js"; | ||
import { AbTestConfig, CoreAPI, OphanAPI } from "./index-de573d55.js"; | ||
declare class AB { | ||
@@ -3,0 +3,0 @@ private _allRunnableTests; |
@@ -1,3 +0,3 @@ | ||
import { CoreAPI, CoreAPIConfig } from "./index-49049993.js"; | ||
import { CoreAPI, CoreAPIConfig } from "./index-de573d55.js"; | ||
declare const initCore: (config: CoreAPIConfig) => CoreAPI; | ||
export { initCore }; |
@@ -1,3 +0,3 @@ | ||
export type { ABTest, ABTestAPI, AbTestConfig, CoreAPIConfig, Participations, Runnable, Variant } from "./index-49049993.js"; | ||
export type { ABTest, ABTestAPI, AbTestConfig, CoreAPIConfig, Participations, Runnable, Variant } from "./index-de573d55.js"; | ||
export { AB } from "./ab.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import { OphanAPI, OphanAPIConfig } from "./index-49049993.js"; | ||
import { OphanAPI, OphanAPIConfig } from "./index-de573d55.js"; | ||
declare const initOphan: (config: OphanAPIConfig) => OphanAPI; | ||
export { initOphan }; |
@@ -52,4 +52,4 @@ 'use strict'; | ||
} | ||
catch (err) { | ||
errorReporter(err, {}, false); | ||
catch (error) { | ||
errorReporter(error); | ||
} | ||
@@ -78,3 +78,3 @@ }; | ||
// Encountering an error should invalidate the logging process. | ||
errorReporter(error, {}, false); | ||
errorReporter(error); | ||
return {}; | ||
@@ -84,3 +84,3 @@ } | ||
const initOphan = (config) => { | ||
const { serverSideTests = {}, errorReporter = () => undefined, ophanRecord = () => undefined, } = config; | ||
const { serverSideTests, errorReporter, ophanRecord } = config; | ||
const registerCompleteEvents = (tests) => { | ||
@@ -87,0 +87,0 @@ return tests.forEach(registerCompleteEvent(true, errorReporter, ophanRecord)); |
@@ -1,2 +0,2 @@ | ||
import { AbTestConfig, CoreAPI, OphanAPI } from "./index-49049993.js"; | ||
import { AbTestConfig, CoreAPI, OphanAPI } from "./index-de573d55.js"; | ||
declare class AB { | ||
@@ -3,0 +3,0 @@ private _allRunnableTests; |
@@ -1,3 +0,3 @@ | ||
import { CoreAPI, CoreAPIConfig } from "./index-49049993.js"; | ||
import { CoreAPI, CoreAPIConfig } from "./index-de573d55.js"; | ||
declare const initCore: (config: CoreAPIConfig) => CoreAPI; | ||
export { initCore }; |
@@ -1,3 +0,3 @@ | ||
export type { ABTest, ABTestAPI, AbTestConfig, CoreAPIConfig, Participations, Runnable, Variant } from "./index-49049993.js"; | ||
export type { ABTest, ABTestAPI, AbTestConfig, CoreAPIConfig, Participations, Runnable, Variant } from "./index-de573d55.js"; | ||
export { AB } from "./ab.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import { OphanAPI, OphanAPIConfig } from "./index-49049993.js"; | ||
import { OphanAPI, OphanAPIConfig } from "./index-de573d55.js"; | ||
declare const initOphan: (config: OphanAPIConfig) => OphanAPI; | ||
export { initOphan }; |
@@ -47,4 +47,4 @@ const noop = () => { | ||
} | ||
catch (err) { | ||
errorReporter(err, {}, false); | ||
catch (error) { | ||
errorReporter(error); | ||
} | ||
@@ -73,3 +73,3 @@ }; | ||
// Encountering an error should invalidate the logging process. | ||
errorReporter(error, {}, false); | ||
errorReporter(error); | ||
return {}; | ||
@@ -79,3 +79,3 @@ } | ||
const initOphan = (config) => { | ||
const { serverSideTests = {}, errorReporter = () => undefined, ophanRecord = () => undefined, } = config; | ||
const { serverSideTests, errorReporter, ophanRecord } = config; | ||
const registerCompleteEvents = (tests) => { | ||
@@ -82,0 +82,0 @@ return tests.forEach(registerCompleteEvent(true, errorReporter, ophanRecord)); |
{ | ||
"name": "@guardian/ab-core", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"private": false, | ||
@@ -31,3 +31,3 @@ "description": "A client-side library for A/B & multivariate testing", | ||
"readme": "ERROR: No README data found!", | ||
"_id": "@guardian/ab-core@5.0.0" | ||
"_id": "@guardian/ab-core@6.0.0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94451
742