chore: 📦 NPm build
This commit is contained in:
parent
a0b454817d
commit
ac9fdd0473
8 changed files with 119 additions and 33 deletions
2
dist/browser/cookie-cn.css
vendored
2
dist/browser/cookie-cn.css
vendored
|
|
@ -50,7 +50,7 @@
|
|||
transform: scale(0.99);
|
||||
}
|
||||
|
||||
/** 5.0.2 */
|
||||
/** 5.0.3 */
|
||||
/* FENETRE D'ACCUEIL */
|
||||
/* Title settings */
|
||||
/* Text settings */
|
||||
|
|
|
|||
2
dist/browser/cookie-cn.js
vendored
2
dist/browser/cookie-cn.js
vendored
File diff suppressed because one or more lines are too long
19
dist/browser/typings/ts/index.d.ts
vendored
19
dist/browser/typings/ts/index.d.ts
vendored
|
|
@ -1,4 +1,4 @@
|
|||
/** 5.0.2 */
|
||||
/** 5.0.3 */
|
||||
export default class CookieNotice {
|
||||
browserCookieName: string;
|
||||
/** Cookie life time */
|
||||
|
|
@ -24,7 +24,6 @@ export default class CookieNotice {
|
|||
cookieLinkShowCustomizeModalList: NodeListOf<HTMLElement>;
|
||||
modalWrapper: HTMLDivElement;
|
||||
template: HTMLDivElement;
|
||||
bannerDetailsAreExpanded: boolean;
|
||||
restrictCloseModal: boolean;
|
||||
static noConflict: (deep?: boolean) => typeof CookieNotice;
|
||||
constructor(config: Record<string, CookieOptions>);
|
||||
|
|
@ -79,6 +78,13 @@ export default class CookieNotice {
|
|||
* @param value
|
||||
*/
|
||||
containsCookieStatus(key: string): boolean;
|
||||
/**
|
||||
* Get a cookie status
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
getCookieStatus(key: string): CookieStatus;
|
||||
/**
|
||||
* Set the cookie value
|
||||
*
|
||||
|
|
@ -209,13 +215,20 @@ export default class CookieNotice {
|
|||
* Get the actual page: banner or modal (with cookie choices)
|
||||
*/
|
||||
isOnBannerPage(): boolean;
|
||||
/**
|
||||
* Invert cookie status
|
||||
*
|
||||
* @param status
|
||||
* @returns Inverted cookie status, `wait` will give `false`.
|
||||
*/
|
||||
private invertCookieStatus;
|
||||
}
|
||||
declare enum CookieStatus {
|
||||
true = "true",
|
||||
false = "false",
|
||||
wait = "wait"
|
||||
}
|
||||
type CookieStatusList = Record<string, keyof typeof CookieStatus>;
|
||||
type CookieStatusList = Record<string, CookieStatus>;
|
||||
type CookiePolicy = {
|
||||
sameSite: CookiePolicySameSite;
|
||||
secure: string;
|
||||
|
|
|
|||
50
dist/esm/ts/index.js
vendored
50
dist/esm/ts/index.js
vendored
|
|
@ -1,4 +1,4 @@
|
|||
/** 5.0.2 */
|
||||
/** 5.0.3 */
|
||||
export default class CookieNotice {
|
||||
constructor(config) {
|
||||
this.browserCookieName = "cn-init";
|
||||
|
|
@ -76,7 +76,6 @@ export default class CookieNotice {
|
|||
this.acceptAllBtn = acceptAllBtn;
|
||||
this.denyAllBtn = denyAllBtn;
|
||||
this.customizeBtn = customizeBtn;
|
||||
this.bannerDetailsAreExpanded = false;
|
||||
this.template = template;
|
||||
const memoryTemplate = this.template.cloneNode(true);
|
||||
this.template.remove();
|
||||
|
|
@ -250,6 +249,20 @@ export default class CookieNotice {
|
|||
return (Object.keys(statusList).find((cookieName) => cookieName === key) !==
|
||||
undefined);
|
||||
}
|
||||
/**
|
||||
* Get a cookie status
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
getCookieStatus(key) {
|
||||
const statusList = this.getCookieStatusList();
|
||||
const cookieIndex = Object.keys(statusList).find((cookieName) => cookieName === key);
|
||||
if (cookieIndex === undefined) {
|
||||
throw new Error(`Cookie options ${key} not found in list`);
|
||||
}
|
||||
return statusList[cookieIndex];
|
||||
}
|
||||
/**
|
||||
* Set the cookie value
|
||||
*
|
||||
|
|
@ -560,18 +573,12 @@ export default class CookieNotice {
|
|||
cnSwitch.dataset.name = cookieName;
|
||||
cnSwitch.setAttribute("aria-labelledby", `${cookieName}-desc`);
|
||||
cnSwitch.setAttribute("aria-describedby", `${cookieName}-desc`);
|
||||
const toggleCookie = (activate) => {
|
||||
this.setCookieStatus(cookieName, activate ? CookieStatus.true : CookieStatus.false, cookieConfig);
|
||||
const toggleCookie = (cookieName) => {
|
||||
const cookieStatus = this.getCookieStatus(cookieName);
|
||||
this.setCookieStatus(cookieName, this.invertCookieStatus(cookieStatus), cookieConfig);
|
||||
};
|
||||
this.addEvent(cnSwitch, "click", () => {
|
||||
toggleCookie(cnSwitchInput.checked);
|
||||
cnSwitch.ariaChecked = cnSwitchInput.checked ? "true" : "false";
|
||||
});
|
||||
this.addEventKbdValidate(cnSwitch, () => {
|
||||
toggleCookie(cnSwitchInput.checked);
|
||||
cnSwitchInput.checked = !cnSwitchInput.checked;
|
||||
cnSwitch.ariaChecked = cnSwitchInput.checked ? "true" : "false";
|
||||
});
|
||||
this.addEvent(cnSwitchInput, "click", () => toggleCookie(cookieName));
|
||||
this.addEventKbdValidate(cnSwitch, () => cnSwitchInput.click());
|
||||
this.cookiesUnorderedList.append(cookie);
|
||||
if (!this.hasBrowserCookie()) {
|
||||
// * Ldcweb cookie is not set.
|
||||
|
|
@ -645,6 +652,23 @@ export default class CookieNotice {
|
|||
isOnBannerPage() {
|
||||
return this.modalContainer.classList.contains("d-none");
|
||||
}
|
||||
/**
|
||||
* Invert cookie status
|
||||
*
|
||||
* @param status
|
||||
* @returns Inverted cookie status, `wait` will give `false`.
|
||||
*/
|
||||
invertCookieStatus(status) {
|
||||
switch (status) {
|
||||
case CookieStatus.true:
|
||||
case CookieStatus.wait:
|
||||
return CookieStatus.false;
|
||||
case CookieStatus.false:
|
||||
return CookieStatus.true;
|
||||
default:
|
||||
throw new Error(`Un handled cookie status ${status}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
var CookieStatus;
|
||||
(function (CookieStatus) {
|
||||
|
|
|
|||
19
dist/typings/ts/index.d.ts
vendored
19
dist/typings/ts/index.d.ts
vendored
|
|
@ -1,4 +1,4 @@
|
|||
/** 5.0.2 */
|
||||
/** 5.0.3 */
|
||||
export default class CookieNotice {
|
||||
browserCookieName: string;
|
||||
/** Cookie life time */
|
||||
|
|
@ -24,7 +24,6 @@ export default class CookieNotice {
|
|||
cookieLinkShowCustomizeModalList: NodeListOf<HTMLElement>;
|
||||
modalWrapper: HTMLDivElement;
|
||||
template: HTMLDivElement;
|
||||
bannerDetailsAreExpanded: boolean;
|
||||
restrictCloseModal: boolean;
|
||||
static noConflict: (deep?: boolean) => typeof CookieNotice;
|
||||
constructor(config: Record<string, CookieOptions>);
|
||||
|
|
@ -79,6 +78,13 @@ export default class CookieNotice {
|
|||
* @param value
|
||||
*/
|
||||
containsCookieStatus(key: string): boolean;
|
||||
/**
|
||||
* Get a cookie status
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
getCookieStatus(key: string): CookieStatus;
|
||||
/**
|
||||
* Set the cookie value
|
||||
*
|
||||
|
|
@ -209,13 +215,20 @@ export default class CookieNotice {
|
|||
* Get the actual page: banner or modal (with cookie choices)
|
||||
*/
|
||||
isOnBannerPage(): boolean;
|
||||
/**
|
||||
* Invert cookie status
|
||||
*
|
||||
* @param status
|
||||
* @returns Inverted cookie status, `wait` will give `false`.
|
||||
*/
|
||||
private invertCookieStatus;
|
||||
}
|
||||
declare enum CookieStatus {
|
||||
true = "true",
|
||||
false = "false",
|
||||
wait = "wait"
|
||||
}
|
||||
type CookieStatusList = Record<string, keyof typeof CookieStatus>;
|
||||
type CookieStatusList = Record<string, CookieStatus>;
|
||||
type CookiePolicy = {
|
||||
sameSite: CookiePolicySameSite;
|
||||
secure: string;
|
||||
|
|
|
|||
2
dist/umd/css/standard.css
vendored
2
dist/umd/css/standard.css
vendored
|
|
@ -50,7 +50,7 @@
|
|||
transform: scale(0.99);
|
||||
}
|
||||
|
||||
/** 5.0.2 */
|
||||
/** 5.0.3 */
|
||||
/* FENETRE D'ACCUEIL */
|
||||
/* Title settings */
|
||||
/* Text settings */
|
||||
|
|
|
|||
56
dist/umd/main.js
vendored
56
dist/umd/main.js
vendored
|
|
@ -39,7 +39,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
/** 5.0.2 */
|
||||
/** 5.0.3 */
|
||||
var CookieNotice = /*#__PURE__*/function () {
|
||||
/** Cookie expiration date as specified in the cookie itself */
|
||||
|
||||
|
|
@ -135,7 +135,6 @@ var CookieNotice = /*#__PURE__*/function () {
|
|||
this.acceptAllBtn = acceptAllBtn;
|
||||
this.denyAllBtn = denyAllBtn;
|
||||
this.customizeBtn = customizeBtn;
|
||||
this.bannerDetailsAreExpanded = false;
|
||||
this.template = template;
|
||||
var memoryTemplate = this.template.cloneNode(true);
|
||||
this.template.remove();
|
||||
|
|
@ -364,6 +363,25 @@ var CookieNotice = /*#__PURE__*/function () {
|
|||
}) !== undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a cookie status
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
}, {
|
||||
key: "getCookieStatus",
|
||||
value: function getCookieStatus(key) {
|
||||
var statusList = this.getCookieStatusList();
|
||||
var cookieIndex = Object.keys(statusList).find(function (cookieName) {
|
||||
return cookieName === key;
|
||||
});
|
||||
if (cookieIndex === undefined) {
|
||||
throw new Error("Cookie options ".concat(key, " not found in list"));
|
||||
}
|
||||
return statusList[cookieIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cookie value
|
||||
*
|
||||
|
|
@ -746,17 +764,15 @@ var CookieNotice = /*#__PURE__*/function () {
|
|||
cnSwitch.dataset.name = cookieName;
|
||||
cnSwitch.setAttribute("aria-labelledby", "".concat(cookieName, "-desc"));
|
||||
cnSwitch.setAttribute("aria-describedby", "".concat(cookieName, "-desc"));
|
||||
var toggleCookie = function toggleCookie(activate) {
|
||||
_this10.setCookieStatus(cookieName, activate ? CookieStatus.true : CookieStatus.false, cookieConfig);
|
||||
var toggleCookie = function toggleCookie(cookieName) {
|
||||
var cookieStatus = _this10.getCookieStatus(cookieName);
|
||||
_this10.setCookieStatus(cookieName, _this10.invertCookieStatus(cookieStatus), cookieConfig);
|
||||
};
|
||||
_this10.addEvent(cnSwitch, "click", function () {
|
||||
toggleCookie(cnSwitchInput.checked);
|
||||
cnSwitch.ariaChecked = cnSwitchInput.checked ? "true" : "false";
|
||||
_this10.addEvent(cnSwitchInput, "click", function () {
|
||||
return toggleCookie(cookieName);
|
||||
});
|
||||
_this10.addEventKbdValidate(cnSwitch, function () {
|
||||
toggleCookie(cnSwitchInput.checked);
|
||||
cnSwitchInput.checked = !cnSwitchInput.checked;
|
||||
cnSwitch.ariaChecked = cnSwitchInput.checked ? "true" : "false";
|
||||
return cnSwitchInput.click();
|
||||
});
|
||||
_this10.cookiesUnorderedList.append(cookie);
|
||||
if (!_this10.hasBrowserCookie()) {
|
||||
|
|
@ -843,6 +859,26 @@ var CookieNotice = /*#__PURE__*/function () {
|
|||
value: function isOnBannerPage() {
|
||||
return this.modalContainer.classList.contains("d-none");
|
||||
}
|
||||
|
||||
/**
|
||||
* Invert cookie status
|
||||
*
|
||||
* @param status
|
||||
* @returns Inverted cookie status, `wait` will give `false`.
|
||||
*/
|
||||
}, {
|
||||
key: "invertCookieStatus",
|
||||
value: function invertCookieStatus(status) {
|
||||
switch (status) {
|
||||
case CookieStatus.true:
|
||||
case CookieStatus.wait:
|
||||
return CookieStatus.false;
|
||||
case CookieStatus.false:
|
||||
return CookieStatus.true;
|
||||
default:
|
||||
throw new Error("Un handled cookie status ".concat(status));
|
||||
}
|
||||
}
|
||||
}]);
|
||||
}();
|
||||
|
||||
|
|
|
|||
2
dist/umd/main.js.map
vendored
2
dist/umd/main.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue