@dargmuesli/nuxt-cookie-control 5.7.0 → 5.8.0

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.
Files changed (105) hide show
  1. package/README.md +1 -1
  2. package/dist/module.d.ts +2 -59
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +4 -167
  5. package/dist/runtime/composables.ts +5 -0
  6. package/dist/runtime/constants.ts +3 -0
  7. package/dist/runtime/locale/ar.ts +20 -0
  8. package/dist/runtime/locale/az.ts +20 -0
  9. package/dist/runtime/locale/bg.ts +21 -0
  10. package/dist/runtime/locale/cs.ts +20 -0
  11. package/dist/runtime/locale/da.ts +20 -0
  12. package/dist/runtime/locale/de.ts +21 -0
  13. package/dist/runtime/locale/en.ts +20 -0
  14. package/dist/runtime/locale/es.ts +20 -0
  15. package/dist/runtime/locale/fi.ts +21 -0
  16. package/dist/runtime/locale/fr.ts +20 -0
  17. package/dist/runtime/locale/hr.ts +21 -0
  18. package/dist/runtime/locale/hu.ts +21 -0
  19. package/dist/runtime/locale/index.ts +55 -0
  20. package/dist/runtime/locale/it.ts +20 -0
  21. package/dist/runtime/locale/ja.ts +20 -0
  22. package/dist/runtime/locale/ko.ts +20 -0
  23. package/dist/runtime/locale/lt.ts +20 -0
  24. package/dist/runtime/locale/nl.ts +21 -0
  25. package/dist/runtime/locale/no.ts +21 -0
  26. package/dist/runtime/locale/oc.ts +20 -0
  27. package/dist/runtime/locale/pl.ts +21 -0
  28. package/dist/runtime/locale/pt.ts +21 -0
  29. package/dist/runtime/locale/ru.ts +20 -0
  30. package/dist/runtime/locale/sk.ts +20 -0
  31. package/dist/runtime/locale/sv.ts +21 -0
  32. package/dist/runtime/locale/tr.ts +20 -0
  33. package/dist/runtime/locale/uk.ts +20 -0
  34. package/dist/runtime/methods.ts +49 -0
  35. package/dist/runtime/plugin.ts +51 -0
  36. package/dist/runtime/set-vars/{native.mjs → native.ts} +2 -2
  37. package/dist/runtime/set-vars/ponyfill.ts +5 -0
  38. package/dist/runtime/types.ts +156 -0
  39. package/dist/types.d.ts +16 -1
  40. package/package.json +20 -13
  41. package/dist/runtime/composables.d.ts +0 -2
  42. package/dist/runtime/composables.mjs +0 -2
  43. package/dist/runtime/constants.d.ts +0 -2
  44. package/dist/runtime/constants.mjs +0 -1
  45. package/dist/runtime/locale/ar.d.ts +0 -3
  46. package/dist/runtime/locale/ar.mjs +0 -17
  47. package/dist/runtime/locale/az.d.ts +0 -3
  48. package/dist/runtime/locale/az.mjs +0 -17
  49. package/dist/runtime/locale/cs.d.ts +0 -3
  50. package/dist/runtime/locale/cs.mjs +0 -17
  51. package/dist/runtime/locale/da.d.ts +0 -3
  52. package/dist/runtime/locale/da.mjs +0 -17
  53. package/dist/runtime/locale/de.d.ts +0 -3
  54. package/dist/runtime/locale/de.mjs +0 -17
  55. package/dist/runtime/locale/en.d.ts +0 -3
  56. package/dist/runtime/locale/en.mjs +0 -17
  57. package/dist/runtime/locale/es.d.ts +0 -3
  58. package/dist/runtime/locale/es.mjs +0 -17
  59. package/dist/runtime/locale/fi.d.ts +0 -3
  60. package/dist/runtime/locale/fi.mjs +0 -17
  61. package/dist/runtime/locale/fr.d.ts +0 -3
  62. package/dist/runtime/locale/fr.mjs +0 -17
  63. package/dist/runtime/locale/hr.d.ts +0 -3
  64. package/dist/runtime/locale/hr.mjs +0 -17
  65. package/dist/runtime/locale/hu.d.ts +0 -3
  66. package/dist/runtime/locale/hu.mjs +0 -17
  67. package/dist/runtime/locale/index.d.ts +0 -1
  68. package/dist/runtime/locale/index.mjs +0 -52
  69. package/dist/runtime/locale/it.d.ts +0 -3
  70. package/dist/runtime/locale/it.mjs +0 -17
  71. package/dist/runtime/locale/ja.d.ts +0 -3
  72. package/dist/runtime/locale/ja.mjs +0 -17
  73. package/dist/runtime/locale/ko.d.ts +0 -3
  74. package/dist/runtime/locale/ko.mjs +0 -17
  75. package/dist/runtime/locale/lt.d.ts +0 -3
  76. package/dist/runtime/locale/lt.mjs +0 -17
  77. package/dist/runtime/locale/nl.d.ts +0 -3
  78. package/dist/runtime/locale/nl.mjs +0 -17
  79. package/dist/runtime/locale/no.d.ts +0 -3
  80. package/dist/runtime/locale/no.mjs +0 -17
  81. package/dist/runtime/locale/oc.d.ts +0 -3
  82. package/dist/runtime/locale/oc.mjs +0 -17
  83. package/dist/runtime/locale/pl.d.ts +0 -3
  84. package/dist/runtime/locale/pl.mjs +0 -17
  85. package/dist/runtime/locale/pt.d.ts +0 -3
  86. package/dist/runtime/locale/pt.mjs +0 -17
  87. package/dist/runtime/locale/ru.d.ts +0 -3
  88. package/dist/runtime/locale/ru.mjs +0 -17
  89. package/dist/runtime/locale/sk.d.ts +0 -3
  90. package/dist/runtime/locale/sk.mjs +0 -17
  91. package/dist/runtime/locale/sv.d.ts +0 -3
  92. package/dist/runtime/locale/sv.mjs +0 -17
  93. package/dist/runtime/locale/tr.d.ts +0 -3
  94. package/dist/runtime/locale/tr.mjs +0 -17
  95. package/dist/runtime/locale/uk.d.ts +0 -3
  96. package/dist/runtime/locale/uk.mjs +0 -17
  97. package/dist/runtime/methods.d.ts +0 -9
  98. package/dist/runtime/methods.mjs +0 -25
  99. package/dist/runtime/plugin.d.ts +0 -2
  100. package/dist/runtime/plugin.mjs +0 -40
  101. package/dist/runtime/set-vars/native.d.ts +0 -1
  102. package/dist/runtime/set-vars/ponyfill.d.ts +0 -1
  103. package/dist/runtime/set-vars/ponyfill.mjs +0 -4
  104. package/dist/runtime/types.d.ts +0 -66
  105. package/dist/runtime/types.mjs +0 -57
@@ -1,17 +0,0 @@
1
- export default {
2
- accept: "\u041F\u0440\u0438\u043D\u0438\u043C\u0430\u0442\u044C",
3
- acceptAll: "\u041F\u0440\u0438\u0439\u043D\u044F\u0442\u0438 \u0443\u0441\u0456",
4
- bannerDescription: "\u041C\u0438 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0454\u043C\u043E \u0432\u043B\u0430\u0441\u043D\u0456 \u0444\u0430\u0439\u043B\u0438 cookie \u0442\u0430 \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0456 \u0444\u0430\u0439\u043B\u0438 cookie, \u0449\u043E\u0431 \u043C\u0438 \u043C\u043E\u0433\u043B\u0438 \u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u0432\u0430\u043C \u0446\u0435\u0439 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442 \u0456 \u043A\u0440\u0430\u0449\u0435 \u0437\u0440\u043E\u0437\u0443\u043C\u0456\u0442\u0438, \u044F\u043A \u0432\u0438 \u043D\u0438\u043C \u043A\u043E\u0440\u0438\u0441\u0442\u0443\u0454\u0442\u0435\u0441\u044F, \u0437 \u043C\u0435\u0442\u043E\u044E \u043F\u043E\u043A\u0440\u0430\u0449\u0435\u043D\u043D\u044F \u043F\u0440\u043E\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u0438\u0445 \u043D\u0430\u043C\u0438 \u043F\u043E\u0441\u043B\u0443\u0433. \u042F\u043A\u0449\u043E \u0432\u0438 \u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0443\u0454\u0442\u0435 \u043F\u0435\u0440\u0435\u0433\u043B\u044F\u0434, \u043C\u0438 \u0432\u0432\u0430\u0436\u0430\u0454\u043C\u043E, \u0449\u043E \u0432\u0438 \u043F\u0440\u0438\u0439\u043D\u044F\u043B\u0438 \u0444\u0430\u0439\u043B\u0438 cookie.",
5
- bannerTitle: "\u0424\u0430\u0439\u043B\u0438 cookie",
6
- close: "\u0417\u0430\u043A\u0440\u0438\u0442\u0438",
7
- cookiesFunctional: "\u0424\u0443\u043D\u043A\u0446\u0456\u043E\u043D\u0430\u043B\u044C\u043D\u0456 \u0444\u0430\u0439\u043B\u0438 cookie",
8
- cookiesNecessary: "\u041D\u0435\u043E\u0431\u0445\u0456\u0434\u043D\u0456 \u0444\u0430\u0439\u043B\u0438 cookie",
9
- cookiesOptional: "\u0424\u0430\u043A\u0443\u043B\u044C\u0442\u0430\u0442\u0438\u0432\u043D\u0456 \u0444\u0430\u0439\u043B\u0438 cookie",
10
- decline: "\u041F\u0440\u0438\u0439\u043C\u0430\u044E \u043D\u0435\u043E\u0431\u0445\u0456\u0434\u043D\u0435",
11
- declineAll: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0443\u0441\u0456",
12
- here: "\u0442\u0443\u0442",
13
- iframeBlocked: "\u0429\u043E\u0431 \u043F\u043E\u0431\u0430\u0447\u0438\u0442\u0438 \u0446\u0435, \u0443\u0432\u0456\u043C\u043A\u043D\u0456\u0442\u044C \u0444\u0443\u043D\u043A\u0446\u0456\u043E\u043D\u0430\u043B\u044C\u043D\u0456 \u0444\u0430\u0439\u043B\u0438 cookie",
14
- manageCookies: "\u041A\u0435\u0440\u0443\u0432\u0430\u0442\u0438 \u0444\u0430\u0439\u043B\u0430\u043C\u0438 cookie",
15
- save: "\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438",
16
- settingsUnsaved: "\u0423 \u0432\u0430\u0441 \u0454 \u043D\u0435\u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u0456 \u043D\u0430\u043B\u0430\u0448\u0442\u0443\u0432\u0430\u043D\u043D\u044F"
17
- };
@@ -1,9 +0,0 @@
1
- import { Cookie, ModuleOptions, Translatable } from './types';
2
- export declare const getAllCookieIdsString: (moduleOptions: ModuleOptions) => string;
3
- export declare const getCookie: (name: string) => any;
4
- export declare const getCookieId: (cookie: Cookie) => string;
5
- export declare const getCookieIds: (cookies: Cookie[]) => string[];
6
- export declare const removeCookie: (name: string) => any;
7
- export declare const resolveTranslatable: (translatable: Translatable, locale?: import("./types").Locale) => string;
8
- export declare const setCookie: (name: string, value: string, options: Cookies.CookieAttributes) => any;
9
- export declare const useResolveTranslatable: (locale?: import("./types").Locale) => (translatable: Translatable) => string;
@@ -1,25 +0,0 @@
1
- import Cookies from "js-cookie";
2
- import slugify from "@sindresorhus/slugify";
3
- import { LOCALE_DEFAULT } from "./constants.mjs";
4
- export const getAllCookieIdsString = (moduleOptions) => getCookieIds([
5
- ...moduleOptions.cookies.necessary,
6
- ...moduleOptions.cookies.optional
7
- ]).join("");
8
- export const getCookie = (name) => Cookies.get(name);
9
- export const getCookieId = (cookie) => cookie.id || slugify(resolveTranslatable(cookie.name));
10
- export const getCookieIds = (cookies) => cookies.map((cookie) => getCookieId(cookie));
11
- export const removeCookie = (name) => Cookies.remove(name);
12
- export const resolveTranslatable = (translatable, locale = LOCALE_DEFAULT) => {
13
- if (typeof translatable === "string")
14
- return translatable;
15
- if (!locale)
16
- throw new Error("No locale given for translatable that is not a string.");
17
- const result = translatable[locale];
18
- if (!result)
19
- throw new Error(`Could not get translation for locale ${locale}.`);
20
- return result;
21
- };
22
- export const setCookie = (name, value, options) => Cookies.set(name, value, { sameSite: "Strict", ...options });
23
- export const useResolveTranslatable = (locale = LOCALE_DEFAULT) => {
24
- return (translatable) => resolveTranslatable(translatable, locale);
25
- };
@@ -1,2 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
@@ -1,40 +0,0 @@
1
- import Cookies from "js-cookie";
2
- import { ref } from "vue";
3
- import { getAllCookieIdsString, getCookieId } from "./methods.mjs";
4
- import { defineNuxtPlugin } from "#imports";
5
- import moduleOptions from "#build/cookie-control-options";
6
- export default defineNuxtPlugin((_nuxtApp) => {
7
- const cookieIsConsentGiven = Cookies.get(
8
- moduleOptions.cookieNameIsConsentGiven
9
- );
10
- const cookieCookiesEnabledIds = Cookies.get(
11
- moduleOptions.cookieNameCookiesEnabledIds
12
- )?.split("|");
13
- const isConsentGiven = ref(
14
- cookieIsConsentGiven === void 0 ? void 0 : cookieIsConsentGiven === getAllCookieIdsString(moduleOptions)
15
- );
16
- const cookiesEnabled = ref(
17
- cookieCookiesEnabledIds === void 0 ? void 0 : [
18
- ...moduleOptions.cookies.necessary.filter(
19
- (cookieNecessary) => cookieCookiesEnabledIds.includes(getCookieId(cookieNecessary))
20
- ),
21
- ...moduleOptions.cookies.optional.filter(
22
- (cookieOptional) => cookieCookiesEnabledIds.includes(getCookieId(cookieOptional))
23
- )
24
- ]
25
- );
26
- const cookiesEnabledIds = ref(cookieCookiesEnabledIds);
27
- const isModalActive = ref();
28
- const state = {
29
- isConsentGiven,
30
- cookiesEnabled,
31
- cookiesEnabledIds,
32
- isModalActive,
33
- moduleOptions
34
- };
35
- return {
36
- provide: {
37
- cookies: state
38
- }
39
- };
40
- });
@@ -1 +0,0 @@
1
- export default function (variables: Record<string, string>): void;
@@ -1 +0,0 @@
1
- export default function (variables: Record<string, string>): void;
@@ -1,4 +0,0 @@
1
- import cssVars from "css-vars-ponyfill";
2
- export default function(variables) {
3
- cssVars({ variables });
4
- }
@@ -1,66 +0,0 @@
1
- import { Ref } from 'vue';
2
- export type Locale = 'ar' | 'az' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk';
3
- export type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
4
- export type Translatable = string | PartialRecord<Locale, string>;
5
- export declare enum CookieType {
6
- NECESSARY = "necessary",
7
- OPTIONAL = "optional"
8
- }
9
- export interface Cookie {
10
- description?: Translatable;
11
- id?: string;
12
- name: Translatable;
13
- links?: Record<string, string | null>;
14
- src?: string;
15
- targetCookieIds?: string[];
16
- }
17
- export interface LocaleStrings {
18
- accept: string;
19
- acceptAll: string;
20
- bannerDescription: string;
21
- bannerTitle: string;
22
- close: string;
23
- cookiesFunctional: string;
24
- cookiesNecessary: string;
25
- cookiesOptional: string;
26
- iframeBlocked: string;
27
- decline: string;
28
- declineAll: string;
29
- here: string;
30
- manageCookies: string;
31
- save: string;
32
- settingsUnsaved: string;
33
- }
34
- export interface ModuleOptions {
35
- barPosition: 'top-left' | 'top-right' | 'top-full' | 'bottom-left' | 'bottom-right' | 'bottom-full';
36
- closeModalOnClickOutside: boolean;
37
- colors: false | Record<string, any>;
38
- cookieExpiryOffsetMs: number;
39
- cookieNameCookiesEnabledIds: string;
40
- cookieNameIsConsentGiven: string;
41
- cookies: {
42
- necessary: Cookie[];
43
- optional: Cookie[];
44
- };
45
- domain: string;
46
- isAcceptNecessaryButtonEnabled: boolean;
47
- isControlButtonEnabled: boolean;
48
- isCookieIdVisible: boolean;
49
- isCssEnabled: boolean;
50
- isCssPonyfillEnabled: boolean;
51
- isDashInDescriptionEnabled: boolean;
52
- isIframeBlocked: boolean | {
53
- initialState: boolean;
54
- };
55
- isModalForced: boolean;
56
- locales: Locale[];
57
- localeTexts: PartialRecord<Locale, Partial<LocaleStrings>>;
58
- }
59
- export declare const DEFAULTS: Required<ModuleOptions>;
60
- export interface State {
61
- cookiesEnabled: Ref<Cookie[] | undefined>;
62
- cookiesEnabledIds: Ref<string[] | undefined>;
63
- isConsentGiven: Ref<boolean | undefined>;
64
- isModalActive: Ref<boolean>;
65
- moduleOptions: ModuleOptions;
66
- }
@@ -1,57 +0,0 @@
1
- import en from "./locale/en.mjs";
2
- export var CookieType = /* @__PURE__ */ ((CookieType2) => {
3
- CookieType2["NECESSARY"] = "necessary";
4
- CookieType2["OPTIONAL"] = "optional";
5
- return CookieType2;
6
- })(CookieType || {});
7
- export const DEFAULTS = {
8
- barPosition: "bottom-full",
9
- closeModalOnClickOutside: false,
10
- colors: {
11
- barBackground: "#000",
12
- barButtonBackground: "#fff",
13
- barButtonColor: "#000",
14
- barButtonHoverBackground: "#333",
15
- barButtonHoverColor: "#fff",
16
- barTextColor: "#fff",
17
- checkboxActiveBackground: "#000",
18
- checkboxActiveCircleBackground: "#fff",
19
- checkboxDisabledBackground: "#ddd",
20
- checkboxDisabledCircleBackground: "#fff",
21
- checkboxInactiveBackground: "#000",
22
- checkboxInactiveCircleBackground: "#fff",
23
- controlButtonBackground: "#fff",
24
- controlButtonHoverBackground: "#000",
25
- controlButtonIconColor: "#000",
26
- controlButtonIconHoverColor: "#fff",
27
- focusRingColor: "#808080",
28
- modalBackground: "#fff",
29
- modalButtonBackground: "#000",
30
- modalButtonColor: "#fff",
31
- modalButtonHoverBackground: "#333",
32
- modalButtonHoverColor: "#fff",
33
- modalOverlay: "#000",
34
- modalOverlayOpacity: 0.8,
35
- modalTextColor: "#000",
36
- modalUnsavedColor: "#fff"
37
- },
38
- cookies: {
39
- necessary: [],
40
- optional: []
41
- },
42
- cookieExpiryOffsetMs: 1e3 * 60 * 60 * 24 * 365,
43
- // one year
44
- cookieNameIsConsentGiven: "ncc_c",
45
- cookieNameCookiesEnabledIds: "ncc_e",
46
- isAcceptNecessaryButtonEnabled: true,
47
- isControlButtonEnabled: true,
48
- isCookieIdVisible: false,
49
- isCssEnabled: true,
50
- isCssPonyfillEnabled: false,
51
- isDashInDescriptionEnabled: true,
52
- isIframeBlocked: false,
53
- isModalForced: false,
54
- domain: "",
55
- locales: ["en"],
56
- localeTexts: { en }
57
- };