@stackshift-ui/cookies 6.0.2 → 6.0.4-beta.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.
package/dist/cookies.js CHANGED
@@ -1 +1 @@
1
- "use strict";var F=Object.create;var f=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var h=(e,r)=>()=>(e&&(r=e(e=0)),r);var v=(e,r)=>{for(var s in r)f(e,s,{get:r[s],enumerable:!0})},B=(e,r,s,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of S(r))!E.call(e,o)&&o!==s&&f(e,o,{get:()=>r[o],enumerable:!(i=O(r,o))||i.enumerable});return e};var q=(e,r,s)=>(s=e!=null?F(V(e)):{},B(r||!e||!e.__esModule?f(s,"default",{value:e,enumerable:!0}):s,e)),z=e=>B(f({},"__esModule",{value:!0}),e);var d,$=h(()=>{"use strict";d=e=>{var r,s;return!(e!=null&&e.internalLink)&&!(e!=null&&e.externalLink)?"/page-not-found":(e==null?void 0:e.type)==="linkInternal"&&((s=(r=e==null?void 0:e.internalLink)==null?void 0:r.toLowerCase())!=null&&s.includes("home"))?"/":(e==null?void 0:e.type)==="linkInternal"?`/${e==null?void 0:e.internalLink}`:(e==null?void 0:e.type)==="linkExternal"?`${e==null?void 0:e.externalLink}`:"/"}});var A={};v(A,{Cookies_A:()=>N,default:()=>N});function N({title:e,description:r,allowCookieBtn:s,denyCookieBtn:i,config:o,contactLink:t,...y}){var l,p,a,c;let m=(l=o==null?void 0:o.cookiePolicy)==null?void 0:l.siteName,n=(p=o==null?void 0:o.cookiePolicy)==null?void 0:p.cookiePolicyPage,C=((c=(a=o==null?void 0:o.cookiePolicy)==null?void 0:a.consentModal)==null?void 0:c.position)||"bottom right";return(0,M.useEffect)(()=>{var u,b;let P={categories:{necessary:{enabled:!0,readOnly:!0},analytics:{enabled:o==null?void 0:o.enableAnalytics}},guiOptions:{consentModal:{position:C}},language:{default:"en",translations:{en:{consentModal:{title:e,description:"Cookies help us deliver our services. By using our services, you agree to our use of cookies.",acceptAllBtn:s,acceptNecessaryBtn:i||"Reject all",showPreferencesBtn:"Manage Individual preferences"},preferencesModal:{title:"Cookie Preferences",acceptAllBtn:s,acceptNecessaryBtn:i||"Reject all",savePreferencesBtn:"Accept current selection",closeIconLabel:"Close",sections:[{title:e,description:r},{title:"Strictly Necessary cookies",description:`These cookies are essential for the proper functioning of this website. <a href=${d(n)} target=${n==null?void 0:n.linkTarget} rel=${(n==null?void 0:n.linkTarget)==="_blank"?"noopener noreferrer":""}>${(b=(u=o==null?void 0:o.cookiePolicy)==null?void 0:u.cookiePolicyPage)==null?void 0:b.label}</a>.`,linkedCategory:"necessary"},{title:"Analytics",description:"These cookies are used to track and measure the use of this website.",linkedCategory:"analytics"},{title:"More information",description:`For any queries in relation to ${m}'s policy on cookies and your choices, please <a href=${d(t)} target=${t==null?void 0:t.linkTarget} rel=${(t==null?void 0:t.linkTarget)==="_blank"?"noopener noreferrer":""}>${t==null?void 0:t.label}</a>.`}]}}}},hideFromBots:!1};x.run(P)},[]),(0,T.jsx)("div",{...y})}var M,x,T,g=h(()=>{"use strict";M=require("react"),x=q(require("vanilla-cookieconsent"));$();T=require("react/jsx-runtime")});var D={};v(D,{Cookies:()=>I});module.exports=z(D);var w=require("react"),_=require("react/jsx-runtime"),j={variant_a:(0,w.lazy)(()=>Promise.resolve().then(()=>(g(),A)))},R="Cookies",I=({data:e})=>{var o,t,y,m,n,C,l,p,a,c,P,u;let r=e==null?void 0:e.variant,s=r&&j[r],i={title:(t=(o=e==null?void 0:e.variants)==null?void 0:o.heading)!=null?t:void 0,description:(m=(y=e==null?void 0:e.variants)==null?void 0:y.description)!=null?m:void 0,allowCookieBtn:(C=(n=e==null?void 0:e.variants)==null?void 0:n.acceptButtonLabel)!=null?C:void 0,denyCookieBtn:(p=(l=e==null?void 0:e.variants)==null?void 0:l.declineButtonLabel)!=null?p:void 0,config:(c=(a=e==null?void 0:e.variants)==null?void 0:a.config)!=null?c:void 0,contactLink:(u=(P=e==null?void 0:e.variants)==null?void 0:P.contactLink)!=null?u:void 0};return s?(0,_.jsx)(s,{...i,"data-testid":R}):null};I.displayName=R;0&&(module.exports={Cookies});
1
+ "use strict";var F=Object.create;var f=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var h=(e,r)=>()=>(e&&(r=e(e=0)),r);var v=(e,r)=>{for(var s in r)f(e,s,{get:r[s],enumerable:!0})},B=(e,r,s,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of S(r))!E.call(e,o)&&o!==s&&f(e,o,{get:()=>r[o],enumerable:!(i=O(r,o))||i.enumerable});return e};var q=(e,r,s)=>(s=e!=null?F(V(e)):{},B(r||!e||!e.__esModule?f(s,"default",{value:e,enumerable:!0}):s,e)),z=e=>B(f({},"__esModule",{value:!0}),e);var d,$=h(()=>{"use strict";d=e=>{var r,s;return!(e!=null&&e.internalLink)&&!(e!=null&&e.externalLink)?"/page-not-found":(e==null?void 0:e.type)==="linkInternal"&&((s=(r=e==null?void 0:e.internalLink)==null?void 0:r.toLowerCase())!=null&&s.includes("home"))?"/":(e==null?void 0:e.type)==="linkInternal"?`/${e==null?void 0:e.internalLink}`:(e==null?void 0:e.type)==="linkExternal"?`${e==null?void 0:e.externalLink}`:"/"}});var A={};v(A,{Cookies_A:()=>N,default:()=>N});function N({title:e,description:r,allowCookieBtn:s,denyCookieBtn:i,config:o,contactLink:t,...y}){var l,p,a,c;let m=(l=o==null?void 0:o.cookiePolicy)==null?void 0:l.siteName,n=(p=o==null?void 0:o.cookiePolicy)==null?void 0:p.cookiePolicyPage,C=((c=(a=o==null?void 0:o.cookiePolicy)==null?void 0:a.consentModal)==null?void 0:c.position)||"bottom right";return(0,M.useEffect)(()=>{var u,b;let P={categories:{necessary:{enabled:!0,readOnly:!0},analytics:{enabled:o==null?void 0:o.enableAnalytics}},guiOptions:{consentModal:{position:C}},language:{default:"en",translations:{en:{consentModal:{title:e,description:"Cookies help us deliver our services. By using our services, you agree to our use of cookies.",acceptAllBtn:s,acceptNecessaryBtn:i||"Reject all",showPreferencesBtn:"Manage Individual preferences"},preferencesModal:{title:"Cookie Preferences",acceptAllBtn:s,acceptNecessaryBtn:i||"Reject all",savePreferencesBtn:"Accept current selection",closeIconLabel:"Close",sections:[{title:e,description:r},{title:"Strictly Necessary cookies",description:`These cookies are essential for the proper functioning of this website. <a href=${d(n)} target=${n==null?void 0:n.linkTarget} rel=${(n==null?void 0:n.linkTarget)==="_blank"?"noopener noreferrer":""}>${(b=(u=o==null?void 0:o.cookiePolicy)==null?void 0:u.cookiePolicyPage)==null?void 0:b.label}</a>.`,linkedCategory:"necessary"},{title:"Analytics",description:"These cookies are used to track and measure the use of this website.",linkedCategory:"analytics"},{title:"More information",description:`For any queries in relation to ${m}'s policy on cookies and your choices, please <a href=${d(t)} target=${t==null?void 0:t.linkTarget} rel=${(t==null?void 0:t.linkTarget)==="_blank"?"noopener noreferrer":""}>${t==null?void 0:t.label}</a>.`}]}}}},hideFromBots:!1};x.run(P)},[]),(0,g.jsx)("div",{...y})}var M,x,g,T=h(()=>{"use strict";M=require("react"),x=q(require("vanilla-cookieconsent"));$();g=require("react/jsx-runtime")});var D={};v(D,{Cookies:()=>I});module.exports=z(D);var w=require("react"),_=require("react/jsx-runtime"),j={variant_a:(0,w.lazy)(()=>Promise.resolve().then(()=>(T(),A)))},R="Cookies",I=({data:e})=>{var o,t,y,m,n,C,l,p,a,c,P,u;let r=e==null?void 0:e.variant,s=r&&j[r],i={title:(t=(o=e==null?void 0:e.variants)==null?void 0:o.heading)!=null?t:void 0,description:(m=(y=e==null?void 0:e.variants)==null?void 0:y.description)!=null?m:void 0,allowCookieBtn:(C=(n=e==null?void 0:e.variants)==null?void 0:n.acceptButtonLabel)!=null?C:void 0,denyCookieBtn:(p=(l=e==null?void 0:e.variants)==null?void 0:l.declineButtonLabel)!=null?p:void 0,config:(c=(a=e==null?void 0:e.variants)==null?void 0:a.config)!=null?c:void 0,contactLink:(u=(P=e==null?void 0:e.variants)==null?void 0:P.contactLink)!=null?u:void 0};return s?(0,_.jsx)(s,{...i,"data-testid":R}):null};I.displayName=R;0&&(module.exports={Cookies});
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var x=(e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},d=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of f(t))!p.call(e,a)&&a!==r&&o(e,a,{get:()=>t[a],enumerable:!(u=L(t,a))||u.enumerable});return e};var c=e=>d(o({},"__esModule",{value:!0}),e);var s={};x(s,{extractLink:()=>m});module.exports=c(s);var m=e=>{var t,r;return!(e!=null&&e.internalLink)&&!(e!=null&&e.externalLink)?"/page-not-found":(e==null?void 0:e.type)==="linkInternal"&&((r=(t=e==null?void 0:e.internalLink)==null?void 0:t.toLowerCase())!=null&&r.includes("home"))?"/":(e==null?void 0:e.type)==="linkInternal"?`/${e==null?void 0:e.internalLink}`:(e==null?void 0:e.type)==="linkExternal"?`${e==null?void 0:e.externalLink}`:"/"};0&&(module.exports={extractLink});
1
+ "use strict";var o=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var x=(e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},d=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of f(t))!p.call(e,a)&&a!==r&&o(e,a,{get:()=>t[a],enumerable:!(u=L(t,a))||u.enumerable});return e};var s=e=>d(o({},"__esModule",{value:!0}),e);var m={};x(m,{extractLink:()=>c});module.exports=s(m);var c=e=>{var t,r;return!(e!=null&&e.internalLink)&&!(e!=null&&e.externalLink)?"/page-not-found":(e==null?void 0:e.type)==="linkInternal"&&((r=(t=e==null?void 0:e.internalLink)==null?void 0:t.toLowerCase())!=null&&r.includes("home"))?"/":(e==null?void 0:e.type)==="linkInternal"?`/${e==null?void 0:e.internalLink}`:(e==null?void 0:e.type)==="linkExternal"?`${e==null?void 0:e.externalLink}`:"/"};0&&(module.exports={extractLink});
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";var F=Object.create;var P=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var B=(e,r)=>()=>(e&&(r=e(e=0)),r);var $=(e,r)=>{for(var s in r)P(e,s,{get:r[s],enumerable:!0})},x=(e,r,s,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of S(r))!E.call(e,o)&&o!==s&&P(e,o,{get:()=>r[o],enumerable:!(i=O(r,o))||i.enumerable});return e};var q=(e,r,s)=>(s=e!=null?F(V(e)):{},x(r||!e||!e.__esModule?P(s,"default",{value:e,enumerable:!0}):s,e)),z=e=>x(P({},"__esModule",{value:!0}),e);var d,M=B(()=>{"use strict";d=e=>{var r,s;return!(e!=null&&e.internalLink)&&!(e!=null&&e.externalLink)?"/page-not-found":(e==null?void 0:e.type)==="linkInternal"&&((s=(r=e==null?void 0:e.internalLink)==null?void 0:r.toLowerCase())!=null&&s.includes("home"))?"/":(e==null?void 0:e.type)==="linkInternal"?`/${e==null?void 0:e.internalLink}`:(e==null?void 0:e.type)==="linkExternal"?`${e==null?void 0:e.externalLink}`:"/"}});var T={};$(T,{Cookies_A:()=>b,default:()=>b});function b({title:e,description:r,allowCookieBtn:s,denyCookieBtn:i,config:o,contactLink:t,...y}){var l,p,a,c;let m=(l=o==null?void 0:o.cookiePolicy)==null?void 0:l.siteName,n=(p=o==null?void 0:o.cookiePolicy)==null?void 0:p.cookiePolicyPage,C=((c=(a=o==null?void 0:o.cookiePolicy)==null?void 0:a.consentModal)==null?void 0:c.position)||"bottom right";return(0,N.useEffect)(()=>{var u,v;let f={categories:{necessary:{enabled:!0,readOnly:!0},analytics:{enabled:o==null?void 0:o.enableAnalytics}},guiOptions:{consentModal:{position:C}},language:{default:"en",translations:{en:{consentModal:{title:e,description:"Cookies help us deliver our services. By using our services, you agree to our use of cookies.",acceptAllBtn:s,acceptNecessaryBtn:i||"Reject all",showPreferencesBtn:"Manage Individual preferences"},preferencesModal:{title:"Cookie Preferences",acceptAllBtn:s,acceptNecessaryBtn:i||"Reject all",savePreferencesBtn:"Accept current selection",closeIconLabel:"Close",sections:[{title:e,description:r},{title:"Strictly Necessary cookies",description:`These cookies are essential for the proper functioning of this website. <a href=${d(n)} target=${n==null?void 0:n.linkTarget} rel=${(n==null?void 0:n.linkTarget)==="_blank"?"noopener noreferrer":""}>${(v=(u=o==null?void 0:o.cookiePolicy)==null?void 0:u.cookiePolicyPage)==null?void 0:v.label}</a>.`,linkedCategory:"necessary"},{title:"Analytics",description:"These cookies are used to track and measure the use of this website.",linkedCategory:"analytics"},{title:"More information",description:`For any queries in relation to ${m}'s policy on cookies and your choices, please <a href=${d(t)} target=${t==null?void 0:t.linkTarget} rel=${(t==null?void 0:t.linkTarget)==="_blank"?"noopener noreferrer":""}>${t==null?void 0:t.label}</a>.`}]}}}},hideFromBots:!1};A.run(f)},[]),(0,g.jsx)("div",{...y})}var N,A,g,h=B(()=>{"use strict";N=require("react"),A=q(require("vanilla-cookieconsent"));M();g=require("react/jsx-runtime")});var D={};$(D,{Cookies:()=>I,Cookies_A:()=>b});module.exports=z(D);var w=require("react"),_=require("react/jsx-runtime"),j={variant_a:(0,w.lazy)(()=>Promise.resolve().then(()=>(h(),T)))},R="Cookies",I=({data:e})=>{var o,t,y,m,n,C,l,p,a,c,f,u;let r=e==null?void 0:e.variant,s=r&&j[r],i={title:(t=(o=e==null?void 0:e.variants)==null?void 0:o.heading)!=null?t:void 0,description:(m=(y=e==null?void 0:e.variants)==null?void 0:y.description)!=null?m:void 0,allowCookieBtn:(C=(n=e==null?void 0:e.variants)==null?void 0:n.acceptButtonLabel)!=null?C:void 0,denyCookieBtn:(p=(l=e==null?void 0:e.variants)==null?void 0:l.declineButtonLabel)!=null?p:void 0,config:(c=(a=e==null?void 0:e.variants)==null?void 0:a.config)!=null?c:void 0,contactLink:(u=(f=e==null?void 0:e.variants)==null?void 0:f.contactLink)!=null?u:void 0};return s?(0,_.jsx)(s,{...i,"data-testid":R}):null};I.displayName=R;h();0&&(module.exports={Cookies,Cookies_A});
2
+ "use strict";var F=Object.create;var P=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var B=(e,r)=>()=>(e&&(r=e(e=0)),r);var $=(e,r)=>{for(var s in r)P(e,s,{get:r[s],enumerable:!0})},x=(e,r,s,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of S(r))!E.call(e,o)&&o!==s&&P(e,o,{get:()=>r[o],enumerable:!(i=O(r,o))||i.enumerable});return e};var q=(e,r,s)=>(s=e!=null?F(V(e)):{},x(r||!e||!e.__esModule?P(s,"default",{value:e,enumerable:!0}):s,e)),z=e=>x(P({},"__esModule",{value:!0}),e);var d,M=B(()=>{"use strict";d=e=>{var r,s;return!(e!=null&&e.internalLink)&&!(e!=null&&e.externalLink)?"/page-not-found":(e==null?void 0:e.type)==="linkInternal"&&((s=(r=e==null?void 0:e.internalLink)==null?void 0:r.toLowerCase())!=null&&s.includes("home"))?"/":(e==null?void 0:e.type)==="linkInternal"?`/${e==null?void 0:e.internalLink}`:(e==null?void 0:e.type)==="linkExternal"?`${e==null?void 0:e.externalLink}`:"/"}});var g={};$(g,{Cookies_A:()=>b,default:()=>b});function b({title:e,description:r,allowCookieBtn:s,denyCookieBtn:i,config:o,contactLink:t,...y}){var l,p,a,c;let m=(l=o==null?void 0:o.cookiePolicy)==null?void 0:l.siteName,n=(p=o==null?void 0:o.cookiePolicy)==null?void 0:p.cookiePolicyPage,C=((c=(a=o==null?void 0:o.cookiePolicy)==null?void 0:a.consentModal)==null?void 0:c.position)||"bottom right";return(0,N.useEffect)(()=>{var u,v;let f={categories:{necessary:{enabled:!0,readOnly:!0},analytics:{enabled:o==null?void 0:o.enableAnalytics}},guiOptions:{consentModal:{position:C}},language:{default:"en",translations:{en:{consentModal:{title:e,description:"Cookies help us deliver our services. By using our services, you agree to our use of cookies.",acceptAllBtn:s,acceptNecessaryBtn:i||"Reject all",showPreferencesBtn:"Manage Individual preferences"},preferencesModal:{title:"Cookie Preferences",acceptAllBtn:s,acceptNecessaryBtn:i||"Reject all",savePreferencesBtn:"Accept current selection",closeIconLabel:"Close",sections:[{title:e,description:r},{title:"Strictly Necessary cookies",description:`These cookies are essential for the proper functioning of this website. <a href=${d(n)} target=${n==null?void 0:n.linkTarget} rel=${(n==null?void 0:n.linkTarget)==="_blank"?"noopener noreferrer":""}>${(v=(u=o==null?void 0:o.cookiePolicy)==null?void 0:u.cookiePolicyPage)==null?void 0:v.label}</a>.`,linkedCategory:"necessary"},{title:"Analytics",description:"These cookies are used to track and measure the use of this website.",linkedCategory:"analytics"},{title:"More information",description:`For any queries in relation to ${m}'s policy on cookies and your choices, please <a href=${d(t)} target=${t==null?void 0:t.linkTarget} rel=${(t==null?void 0:t.linkTarget)==="_blank"?"noopener noreferrer":""}>${t==null?void 0:t.label}</a>.`}]}}}},hideFromBots:!1};A.run(f)},[]),(0,T.jsx)("div",{...y})}var N,A,T,h=B(()=>{"use strict";N=require("react"),A=q(require("vanilla-cookieconsent"));M();T=require("react/jsx-runtime")});var D={};$(D,{Cookies:()=>I,Cookies_A:()=>b});module.exports=z(D);var w=require("react"),_=require("react/jsx-runtime"),j={variant_a:(0,w.lazy)(()=>Promise.resolve().then(()=>(h(),g)))},R="Cookies",I=({data:e})=>{var o,t,y,m,n,C,l,p,a,c,f,u;let r=e==null?void 0:e.variant,s=r&&j[r],i={title:(t=(o=e==null?void 0:e.variants)==null?void 0:o.heading)!=null?t:void 0,description:(m=(y=e==null?void 0:e.variants)==null?void 0:y.description)!=null?m:void 0,allowCookieBtn:(C=(n=e==null?void 0:e.variants)==null?void 0:n.acceptButtonLabel)!=null?C:void 0,denyCookieBtn:(p=(l=e==null?void 0:e.variants)==null?void 0:l.declineButtonLabel)!=null?p:void 0,config:(c=(a=e==null?void 0:e.variants)==null?void 0:a.config)!=null?c:void 0,contactLink:(u=(f=e==null?void 0:e.variants)==null?void 0:f.contactLink)!=null?u:void 0};return s?(0,_.jsx)(s,{...i,"data-testid":R}):null};I.displayName=R;h();0&&(module.exports={Cookies,Cookies_A});
package/dist/types.d.ts CHANGED
@@ -18,6 +18,7 @@ export interface LabeledRoute extends ConditionalLink {
18
18
  linkType?: string;
19
19
  _type?: string;
20
20
  linkInternal?: any;
21
+ linkExternal?: string;
21
22
  }
22
23
  export interface ConditionalLink {
23
24
  type?: string;
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@stackshift-ui/cookies",
3
3
  "description": "",
4
- "version": "6.0.2",
4
+ "version": "6.0.4-beta.0",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
8
8
  "module": "./dist/index.mjs",
9
9
  "types": "./dist/index.d.ts",
10
10
  "files": [
11
- "dist/**"
11
+ "dist/**",
12
+ "src"
12
13
  ],
13
14
  "author": "WebriQ <info@webriq.com>",
14
15
  "devDependencies": {
@@ -28,13 +29,13 @@
28
29
  "typescript": "^5.6.2",
29
30
  "vite-tsconfig-paths": "^5.0.1",
30
31
  "vitest": "^2.1.1",
31
- "@stackshift-ui/typescript-config": "6.0.2",
32
- "@stackshift-ui/eslint-config": "6.0.2"
32
+ "@stackshift-ui/eslint-config": "6.0.2",
33
+ "@stackshift-ui/typescript-config": "6.0.2"
33
34
  },
34
35
  "dependencies": {
35
36
  "vanilla-cookieconsent": "3.0.1",
36
- "@stackshift-ui/scripts": "6.0.2",
37
- "@stackshift-ui/system": "6.0.2"
37
+ "@stackshift-ui/system": "6.0.3",
38
+ "@stackshift-ui/scripts": "6.0.2"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "@stackshift-ui/system": ">=0.0.0",
@@ -0,0 +1,12 @@
1
+ import { cleanup, render, screen } from "@testing-library/react";
2
+ import { afterEach, describe, test } from "vitest";
3
+ import { Cookies } from "./cookies";
4
+
5
+ describe.concurrent("cookies", () => {
6
+ afterEach(cleanup);
7
+
8
+ test.skip("Dummy test - test if renders without errors", ({ expect }) => {
9
+ render(<Cookies data={{ variant: "variant_a" }} />);
10
+ // @todo: add proper test for variant_a
11
+ });
12
+ });
@@ -0,0 +1,49 @@
1
+ // Cookie Consent for GDPR (using Orestbida)
2
+ // https://cookieconsent.orestbida.com/
3
+
4
+ import { lazy } from "react";
5
+
6
+ import { ConsentModalPosition } from "vanilla-cookieconsent";
7
+ import { SectionsProps } from "./types";
8
+
9
+ const Variants = {
10
+ variant_a: lazy(() => import("./cookies_a")),
11
+ };
12
+
13
+ export interface CookiesProps {
14
+ title?: string;
15
+ description?: string;
16
+ allowCookieBtn?: string;
17
+ denyCookieBtn?: string;
18
+ config?: {
19
+ enableAnalytics: boolean;
20
+ cookiePolicy?: {
21
+ siteName: string;
22
+ cookiePolicyPage?: any;
23
+ consentModal?: {
24
+ position: ConsentModalPosition;
25
+ };
26
+ };
27
+ };
28
+ contactLink?: any;
29
+ }
30
+
31
+ const displayName = "Cookies";
32
+
33
+ export const Cookies: React.FC<SectionsProps> = ({ data }) => {
34
+ const variant = data?.variant;
35
+ const Variant = variant && Variants[variant as keyof typeof Variants];
36
+
37
+ const props = {
38
+ title: data?.variants?.heading ?? undefined,
39
+ description: data?.variants?.description ?? undefined,
40
+ allowCookieBtn: data?.variants?.acceptButtonLabel ?? undefined,
41
+ denyCookieBtn: data?.variants?.declineButtonLabel ?? undefined,
42
+ config: data?.variants?.config ?? undefined,
43
+ contactLink: data?.variants?.contactLink ?? undefined,
44
+ };
45
+
46
+ return Variant ? <Variant {...props} data-testid={displayName} /> : null;
47
+ };
48
+
49
+ Cookies.displayName = displayName;
@@ -0,0 +1,96 @@
1
+ import { useEffect } from "react";
2
+
3
+ import * as CookieConsent from "vanilla-cookieconsent";
4
+ import { CookiesProps } from ".";
5
+ import { extractLink } from "./helper";
6
+
7
+ export default function Cookies_A({
8
+ title,
9
+ description,
10
+ allowCookieBtn,
11
+ denyCookieBtn,
12
+ config,
13
+ contactLink,
14
+ ...props
15
+ }: CookiesProps) {
16
+ const siteName = config?.cookiePolicy?.siteName;
17
+ const cookieConfigLink = config?.cookiePolicy?.cookiePolicyPage;
18
+ const cookieModalPosition = config?.cookiePolicy?.consentModal?.position || "bottom right";
19
+
20
+ useEffect(() => {
21
+ const cookieConfigOptions: CookieConsent.CookieConsentConfig = {
22
+ categories: {
23
+ necessary: {
24
+ enabled: true,
25
+ readOnly: true,
26
+ },
27
+ analytics: {
28
+ enabled: config?.enableAnalytics,
29
+ },
30
+ },
31
+ guiOptions: {
32
+ consentModal: {
33
+ position: cookieModalPosition,
34
+ },
35
+ },
36
+ language: {
37
+ default: "en",
38
+ translations: {
39
+ en: {
40
+ consentModal: {
41
+ title,
42
+ description:
43
+ "Cookies help us deliver our services. By using our services, you agree to our use of cookies.",
44
+ acceptAllBtn: allowCookieBtn,
45
+ acceptNecessaryBtn: denyCookieBtn || "Reject all",
46
+ showPreferencesBtn: "Manage Individual preferences",
47
+ },
48
+ preferencesModal: {
49
+ title: "Cookie Preferences",
50
+ acceptAllBtn: allowCookieBtn,
51
+ acceptNecessaryBtn: denyCookieBtn || "Reject all",
52
+ savePreferencesBtn: "Accept current selection",
53
+ closeIconLabel: "Close",
54
+ sections: [
55
+ {
56
+ title,
57
+ description,
58
+ },
59
+ {
60
+ title: "Strictly Necessary cookies",
61
+ description: `These cookies are essential for the proper functioning of this website. <a href=${extractLink(
62
+ cookieConfigLink,
63
+ )} target=${cookieConfigLink?.linkTarget} rel=${
64
+ cookieConfigLink?.linkTarget === "_blank" ? "noopener noreferrer" : ""
65
+ }>${config?.cookiePolicy?.cookiePolicyPage?.label}</a>.`,
66
+ linkedCategory: "necessary",
67
+ },
68
+ {
69
+ title: "Analytics",
70
+ description:
71
+ "These cookies are used to track and measure the use of this website.",
72
+ linkedCategory: "analytics",
73
+ },
74
+ {
75
+ title: "More information",
76
+ description: `For any queries in relation to ${siteName}\'s policy on cookies and your choices, please <a href=${extractLink(
77
+ contactLink,
78
+ )} target=${contactLink?.linkTarget} rel=${
79
+ contactLink?.linkTarget === "_blank" ? "noopener noreferrer" : ""
80
+ }>${contactLink?.label}</a>.`,
81
+ },
82
+ ],
83
+ },
84
+ },
85
+ },
86
+ },
87
+ hideFromBots: false,
88
+ };
89
+
90
+ CookieConsent.run(cookieConfigOptions);
91
+ }, []);
92
+
93
+ return <div {...props} />;
94
+ }
95
+
96
+ export { Cookies_A };
@@ -0,0 +1,25 @@
1
+ import { LabeledRoute } from "../types";
2
+
3
+ export const extractLink = (link: LabeledRoute): string => {
4
+ //not found page
5
+ if (!link?.internalLink && !link?.externalLink) {
6
+ return "/page-not-found";
7
+ }
8
+
9
+ //home page
10
+ if (link?.type === "linkInternal" && link?.internalLink?.toLowerCase()?.includes("home")) {
11
+ return "/";
12
+ }
13
+
14
+ //internal link
15
+ if (link?.type === "linkInternal") {
16
+ return `/${link?.internalLink}`;
17
+ }
18
+
19
+ //external link
20
+ if (link?.type === "linkExternal") {
21
+ return `${link?.externalLink}`;
22
+ }
23
+
24
+ return "/";
25
+ };
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ "use client";
2
+
3
+ // component exports
4
+ export * from "./cookies";
5
+ export * from "./cookies_a";
package/src/types.ts ADDED
@@ -0,0 +1,412 @@
1
+ export type StyleVariants<T extends string> = Record<T, string>;
2
+
3
+ export type Socials = "facebook" | "instagram" | "youtube" | "linkedin" | "twitter";
4
+ export interface MainImage {
5
+ image: SanityImage;
6
+ alt?: string;
7
+ }
8
+ export interface SanityImage {
9
+ priority?: boolean | false;
10
+ _type: "image";
11
+ asset: {
12
+ _ref: string;
13
+ _type: "reference";
14
+ };
15
+ }
16
+ export interface LabeledRoute extends ConditionalLink {
17
+ label?: string;
18
+ linkTarget?: string;
19
+ linkType?: string;
20
+ _type?: string;
21
+ linkInternal?: any;
22
+ linkExternal?: string;
23
+ }
24
+ export interface ConditionalLink {
25
+ type?: string;
26
+ internalLink?: string | null;
27
+ externalLink?: string | null;
28
+ }
29
+
30
+ export interface StatItems {
31
+ label?: string;
32
+ mainImage?: MainImage;
33
+ value?: string;
34
+ _key?: string;
35
+ _type?: string;
36
+ }
37
+
38
+ export interface Logo extends ConditionalLink {
39
+ alt?: string;
40
+ linkTarget?: string;
41
+ image?: SanityImage;
42
+ }
43
+
44
+ export interface Images {
45
+ image?: SanityImage;
46
+ _key?: string;
47
+ _type?: string;
48
+ alt?: string;
49
+ }
50
+
51
+ export interface ContactDetails {
52
+ addressInfo?: string;
53
+ contactInfo?: string;
54
+ emailInfo?: string;
55
+ _key?: string;
56
+ }
57
+
58
+ export interface SocialLink {
59
+ socialMedia?: string | null;
60
+ socialMediaLink?: string | null;
61
+ _key?: string | null;
62
+ _type?: string | null;
63
+ socialMediaIcon?: {
64
+ alt?: string;
65
+ image?: SanityImage;
66
+ } | null;
67
+ socialMediaPlatform?: string | null;
68
+ }
69
+
70
+ export interface LabeledRouteWithKey extends LabeledRoute {
71
+ _key?: string;
72
+ }
73
+
74
+ export interface ArrayOfImageTitleAndText {
75
+ mainImage?: {
76
+ alt?: string;
77
+ image?: SanityImage;
78
+ };
79
+ plainText?: string;
80
+ title?: string;
81
+ _key?: string;
82
+ _type?: string;
83
+ }
84
+
85
+ export interface FeaturedItem {
86
+ description?: string;
87
+ mainImage?: MainImage;
88
+ title?: string;
89
+ subtitle?: string;
90
+ _key?: string;
91
+ _type?: string;
92
+ }
93
+
94
+ export interface ArrayOfTitleAndText {
95
+ _key?: string;
96
+ plainText?: string;
97
+ title?: string;
98
+ }
99
+
100
+ export interface BlogPost extends SanityBody {
101
+ authors?: Author[] | null;
102
+ body?: any;
103
+ categories?: Category[] | null;
104
+ excerpt?: string | null;
105
+ link?: string | null;
106
+ mainImage?: SanityImage | null;
107
+ publishedAt?: string;
108
+ seo?: Seo | null;
109
+ slug?: SanitySlug | null;
110
+ title?: string;
111
+ }
112
+
113
+ export interface Seo {
114
+ _type?: string;
115
+ seoTitle?: string;
116
+ seoDescription?: string;
117
+ seoImage?: SanityImage;
118
+ seoKeywords?: string;
119
+ seoSynonyms?: string;
120
+ }
121
+
122
+ export interface SanitySlug {
123
+ current?: string;
124
+ _type?: "slug";
125
+ }
126
+
127
+ export interface SanityBody {
128
+ _createdAt?: string;
129
+ _id?: string;
130
+ _rev?: string;
131
+ _type?: string;
132
+ _updatedAt?: string;
133
+ }
134
+
135
+ export interface Author extends SanityBody {
136
+ link?: string | null;
137
+ bio?: string | null;
138
+ name?: string | null;
139
+ slug?: SanitySlug | null;
140
+ image?: SanityImage | null;
141
+ profile?: {
142
+ alt: string;
143
+ image: SanityImage;
144
+ } | null;
145
+ }
146
+
147
+ export interface Category extends SanityBody {
148
+ title?: string;
149
+ }
150
+
151
+ export interface Form {
152
+ id?: string | null;
153
+ buttonLabel?: string | null;
154
+ name?: string | null;
155
+ subtitle?: string | null;
156
+ fields?: FormFields[] | null;
157
+ thankYouPage?: ThankYouPage | null;
158
+ }
159
+
160
+ export interface FormFields {
161
+ name?: string;
162
+ placeholder?: string;
163
+ pricingType?: string;
164
+ type?: FormTypes;
165
+ _key?: string;
166
+ _type?: string;
167
+ isRequired?: boolean;
168
+ label?: string;
169
+ items?: string[];
170
+ }
171
+
172
+ export type FormTypes =
173
+ | "inputText"
174
+ | "inputEmail"
175
+ | "inputPassword"
176
+ | "inputNumber"
177
+ | "textarea"
178
+ | "inputFile"
179
+ | "inputRadio"
180
+ | "inputCheckbox"
181
+ | "inputSelect";
182
+
183
+ export interface ThankYouPage {
184
+ externalLink?: string | null;
185
+ internalLink?: string | null;
186
+ linkInternal?: any;
187
+ linkTarget?: string;
188
+ linkType?: string;
189
+ type?: string;
190
+ }
191
+
192
+ //Used on different sections
193
+ export interface SectionsProps {
194
+ template?: Template;
195
+ data?: Sections;
196
+ }
197
+
198
+ export interface Sections extends SanityBody {
199
+ label?: string;
200
+ variant?: string;
201
+ variants?: Variants;
202
+ _key?: string;
203
+ }
204
+
205
+ //*EDIT THIS SECTION WHEN CREATING/UPDATING SCHEMAS ON STUDIO */
206
+ export interface Variants {
207
+ template?: Template;
208
+ multipleMenus?: any;
209
+ arrayOfTitleAndText?: ArrayOfTitleAndText[] | null;
210
+ logo?: Logo | null;
211
+ primaryButton?: LabeledRoute | null;
212
+ secondaryButton?: LabeledRoute | null;
213
+ routes?: LabeledRouteWithKey[] | null;
214
+ menu?: LabeledRouteWithKey[] | null;
215
+ plans?: Plans[] | null;
216
+ formLinks?: LabeledRouteWithKey[] | null;
217
+ portfolios?: Portfolio[] | null;
218
+ portfoliosWithCategories?: PortfoliosWithCategories[] | null;
219
+ signInLink?: LabeledRoute | null;
220
+ signinLink?: LabeledRoute | null;
221
+ tags?: string[] | null;
222
+ posts?: BlogPost[] | null;
223
+ form?: Form | null;
224
+ collections?: Collection | null;
225
+ products?: CollectionProduct | null;
226
+ allProducts?: Collection[];
227
+ subtitle?: string | null;
228
+ caption?: string | null;
229
+ title?: string | null;
230
+ plainText?: string | null;
231
+ contactDescription?: string | null;
232
+ officeInformation?: string | null;
233
+ contactEmail?: string | null;
234
+ contactNumber?: string | null;
235
+ socialLinks?: SocialLink[] | null;
236
+ block?: any;
237
+ heading?: string | null;
238
+ acceptButtonLabel?: string | null;
239
+ declineButtonLabel?: string | null;
240
+ faqsWithCategories?: FaqsWithCategory[] | null;
241
+ faqs?: AskedQuestion[] | null;
242
+ arrayOfImageTitleAndText?: ArrayOfImageTitleAndText[] | null;
243
+ description?: string | null;
244
+ featuredItems?: FeaturedItem[] | null;
245
+ images?: Images[] | null;
246
+ contactDetails?: ContactDetails[] | null;
247
+ copyright?: string | null;
248
+ mainImage?: MainImage | null;
249
+ youtubeLink?: string | null;
250
+ banner?: any;
251
+ stats?: StatItems[] | null;
252
+ teams?: Team[] | null;
253
+ testimonials?: Testimonial[] | null;
254
+ selectStripeAccount?: string;
255
+ annualBilling?: string;
256
+ monthlyBilling?: string;
257
+ productDetails?: ProductDetail[];
258
+ btnLabel?: string;
259
+ selectAccount?: string;
260
+ hashtags?: string[];
261
+ numberOfPosts?: number;
262
+ text?: string;
263
+ button?: LabeledRoute;
264
+ features?: string[];
265
+ config: {
266
+ enableAnalytics: boolean;
267
+ cookiePolicy?: {
268
+ siteName: string;
269
+ cookiePolicyPage?: any;
270
+ };
271
+ consentModalPosition?: string;
272
+ };
273
+ contactLink?: LabeledRoute;
274
+ }
275
+
276
+ export interface Template {
277
+ bg?: string;
278
+ color?: string;
279
+ }
280
+
281
+ export type Plans = {
282
+ _key?: string | null;
283
+ _type?: "planItems" | null;
284
+ checkoutButtonName?: string | null;
285
+ description?: string | null;
286
+ monthlyPrice?: string | null;
287
+ planType?: string | null;
288
+ yearlyPrice?: string | null;
289
+ planIncludes?: string[] | null;
290
+ primaryButton?: LabeledRoute | null;
291
+ } & Record<string, string>;
292
+
293
+ export interface Portfolio {
294
+ dateAdded?: string | null;
295
+ mainImage?: MainImage | null;
296
+ primaryButton?: LabeledRoute | null;
297
+ title?: string | null;
298
+ _key?: string | null;
299
+ _type?: string | null;
300
+ }
301
+
302
+ export interface PortfoliosWithCategories {
303
+ category?: string | null;
304
+ content?: Content[] | null;
305
+ primaryButton?: LabeledRoute | null;
306
+ _key?: string | null;
307
+ _type?: string | null;
308
+ }
309
+
310
+ interface Content extends Portfolio {
311
+ description?: string | null;
312
+ subtitle?: string | null;
313
+ }
314
+
315
+ export interface Collection extends SanityBody {
316
+ collectionInfoVariant?: {
317
+ variant?: string;
318
+ } | null;
319
+ name?: string | null;
320
+ products?: CollectionProduct[] | null;
321
+ sections?: any; //todo
322
+ seo?: Seo | null;
323
+ slug?: SanitySlug | null;
324
+ }
325
+
326
+ export interface CollectionProduct extends SanityBody {
327
+ compareToPrice?: number | null;
328
+ description?: string | null;
329
+ ecwidProductId?: number | null;
330
+ name?: string | null;
331
+ price?: number | null;
332
+ productInfo?: ProductInfo | null;
333
+ productInfoVariant?: {
334
+ variant?: string;
335
+ } | null;
336
+ sections?: any; //todo
337
+ seo?: Seo | null;
338
+ slug?: SanitySlug | null;
339
+ }
340
+
341
+ //TODO, RECHECK PRODUCT INFO DATA FROM SANITY
342
+ interface ProductInfo {
343
+ btnLabel?: string | null;
344
+ images?: ProductInfoImage[] | null;
345
+ productDetails?: ProductDetail[] | null;
346
+ socialLinks?: SocialLink[] | null;
347
+ subtitle?: string | null;
348
+ }
349
+
350
+ //TODO, RECHECK PRODUCT INFO DATA FROM SANITY
351
+ export interface ProductDetail {
352
+ blockContent?: any;
353
+ contentType?: string;
354
+ tabName?: string;
355
+ _key?: string;
356
+ [key: string]: any;
357
+ }
358
+ interface ProductInfoImage {
359
+ alt?: string | null;
360
+ _key: string;
361
+ _type: string;
362
+ image?: SanityImage | null;
363
+ }
364
+
365
+ export interface FaqsWithCategory {
366
+ askedQuestions?: AskedQuestion[] | null;
367
+ category?: string | null;
368
+ _key?: string;
369
+ _type?: string;
370
+ }
371
+
372
+ export interface AskedQuestion {
373
+ answer?: string | null;
374
+ question?: string | null;
375
+ hidden?: boolean;
376
+ _key?: string;
377
+ _type?: string;
378
+ }
379
+
380
+ export interface Team {
381
+ jobTitle?: string;
382
+ mainImage?: MainImage;
383
+ name?: string;
384
+ plainText?: string;
385
+ _key?: string;
386
+ _type?: string;
387
+ }
388
+
389
+ export interface Testimonial {
390
+ jobTitle?: string;
391
+ mainImage?: MainImage;
392
+ name?: string;
393
+ rating?: string;
394
+ testimony?: string;
395
+ _key?: string;
396
+ _type?: string;
397
+ }
398
+
399
+ export declare interface Reference {
400
+ _type: string;
401
+ _ref: string;
402
+ _key?: string;
403
+ _weak?: boolean;
404
+ _strengthenOnPublish?: {
405
+ type: string;
406
+ weak?: boolean;
407
+ template?: {
408
+ id: string;
409
+ params: Record<string, string | number | boolean>;
410
+ };
411
+ };
412
+ }