35 lines
843 B
JavaScript
35 lines
843 B
JavaScript
/**
|
|
* Universal Cookie Consent
|
|
* integration/index.js
|
|
*
|
|
* Public integration API.
|
|
*
|
|
* Jurisdiction resolution is performed before the Consent Core is created.
|
|
* The resolved jurisdiction becomes Core configuration; it does not become
|
|
* a consent decision.
|
|
*/
|
|
|
|
import { createConsentEngine } from "../core/consent.js";
|
|
import { resolveConsentContext } from "./context.js";
|
|
|
|
export { resolveConsentContext } from "./context.js";
|
|
|
|
export function createIntegratedConsentEngine({
|
|
jurisdiction = {},
|
|
core = {}
|
|
} = {}) {
|
|
const context = resolveConsentContext(jurisdiction);
|
|
|
|
const engine = createConsentEngine({
|
|
...core,
|
|
jurisdiction: context.resolution.jurisdiction.id
|
|
});
|
|
|
|
return Object.freeze({
|
|
...engine,
|
|
getJurisdictionContext() {
|
|
return context;
|
|
}
|
|
});
|
|
}
|