UNPKG

bbcookiemanager

Version:

./README.md

171 lines (167 loc) 6.96 kB
/** * @fileoverview added by tsickle * Generated from: lib/bbcookiemanager.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {string} */ const CookieEvents = { onLoad: "BBCookieManagerOnLoad", onAccept: "BBCookieManagerOnAccept", onWidthdraw: "BBCookieManagerOnWithdraw", onDialogInit: "BBCookieManagerOnDialogInit", onDialogDisplay: "BBCookieManagerOnDialogDisplay", onMandatoryOnly: "BBCookieManagerOnMandatoryOnly", onDialogSettingsInit: "BBCookieManagerOnDialogSettingsInit", onDialogSettingsDisplay: "BBCookieManagerOnDialogSettingsDisplay", onDecline: "BBCookieManagerOnDecline", }; class BbCookieManagerComponent { /** * This function appends a DOM element with the “src” attribute into the parent node as the last child and set the cookie category attribute. The appended DOM element is disabled (e.g. script DOM element has attribute “text/plain” and the iframe DOM element does not have the “src” attribute). * @param {?} tag - DOM element which can contain “src” attribute or script HTML element * @param {?} categoryIdentifier - The cookie category identifier from 2B Advice PrIME application * @param {?} parentNode - DOM element where the “tag” is inserted as last child * @return {?} */ appendSrcTag(tag, categoryIdentifier, parentNode) { if (typeof bbCookieApi === "undefined") { console.log("In your page missing bb-manager.js file!"); } else { bbCookieApi.appendSrcTag(tag, categoryIdentifier, parentNode); } } /** * This function executes the callback function according to the web site visitor’s consent. The call back function is only executed if the visitor has consented to the category specified in the parameter “categoryIdentifier”. * @param {?} categoryIdentifier - The cookie category identifier from 2B Advice PrIME application * @param {?} callbackFunction - The function is executed when the cookie category is enabled * @return {?} */ callbackByCategory(categoryIdentifier, callbackFunction) { if (typeof bbCookieApi === "undefined") { console.log("In your page missing bb-manager.js file!"); } else { bbCookieApi.callbackByCategory(categoryIdentifier, callbackFunction); } } /** * This function registers a callback function for the cookie consent manager. Multiple bindings for the same cookie consent event is allowed. * @param {?} eventName - Name of the cookie manager event * @param {?} eventCallback - The javascript function which is fired after the event * @return {?} */ registerEvent(eventName, eventCallback) { if (typeof bbCookieApi === "undefined") { console.log("In your page missing bb-manager.js file!"); } else { bbCookieApi.registerEvent(eventName, eventCallback); } } /** * The API function renders the cookie declaration as a last child of the parent node. The render mode must be set. * @param {?} parentNode - DOM element where is the cookie declaration should be appended as a last child * @return {?} */ renderCookieDeclaration(parentNode) { if (typeof bbCookieApi === "undefined") { console.log("In your page missing bb-manager.js file!"); } else { bbCookieApi.renderCookieDeclaration(parentNode); } } /** * The API function renders the policy declaration as a last child of the parent node. The render mode must be set. * @param {?} parentNode - DOM element where is the policy declaration should be appended as a last child * @return {?} */ renderPolicyDeclaration(parentNode) { if (typeof bbCookieApi === "undefined") { console.log("In your page missing bb-ps.js file!"); } else { bbCookieApi.renderPolicyDeclaration(parentNode); } } /** * This function detects all tags of type=“text/plain” and enables/executes the tags according to the visitor’s consent. * * @return {?} */ runSrcTags() { if (typeof bbCookieApi === "undefined") { console.log("In your page missing bb-manager.js file!"); } else { bbCookieApi.runSrcTags(); } } /** * The API function sets a cookie for the website. If the cookie category for the cookie is disabled, then the cookie is not set. * @param {?} name - Name of the cookie * @param {?} value - Value of the cookie * @param {?} hours - Expiration time of the cookie (in hours) * @return {?} */ setCookie(name, value, hours) { if (typeof bbCookieApi === "undefined") { console.log("In your page missing bb-manager.js file!"); } else { bbCookieApi.setCookie(name, value, hours); } } /** * This API function displays the cookie consent banner. * * @return {?} */ showBanner() { if (typeof bbCookieApi === "undefined") { console.log("In your page missing bb-manager.js file!"); } else { bbCookieApi.showBanner(); } } /** * This API function displays the cookie consent dialog with the category selection. * * @return {?} */ showSettings() { if (typeof bbCookieApi === "undefined") { console.log("In your page missing bb-manager.js file!"); } else { bbCookieApi.showSettings(); } } /** * This API function disables all script HTML elements and HTML elements with the “src” attribute and removes website cookies which belong to categories which are not set as mandatory categories. * * @return {?} */ withdraw() { if (typeof bbCookieApi === "undefined") { console.log("In your page missing bb-manager.js file!"); } else { bbCookieApi.withdraw(); } } } /** * @fileoverview added by tsickle * Generated from: public_api.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * Generated from: bbcookiemanager.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { CookieEvents, BbCookieManagerComponent }; //# sourceMappingURL=bbcookiemanager.js.map