codicent-app-sdk 0.4.10 → 0.4.11

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.
@@ -1,5 +1,6 @@
1
1
  export interface CookieBannerProps {
2
2
  enabled: boolean;
3
+ showFloatingButton?: boolean;
3
4
  }
4
- export declare const CookieBanner: ({ enabled }: CookieBannerProps) => import("react/jsx-runtime").JSX.Element | null;
5
+ export declare const CookieBanner: ({ enabled, showFloatingButton }: CookieBannerProps) => import("react/jsx-runtime").JSX.Element | null;
5
6
  //# sourceMappingURL=CookieBanner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CookieBanner.d.ts","sourceRoot":"","sources":["../../../src/components/CookieBanner.tsx"],"names":[],"mappings":"AA4EA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,YAAY,gBAAiB,iBAAiB,mDAsJ1D,CAAC"}
1
+ {"version":3,"file":"CookieBanner.d.ts","sourceRoot":"","sources":["../../../src/components/CookieBanner.tsx"],"names":[],"mappings":"AA4EA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,oCAA6C,iBAAiB,mDAsJtF,CAAC"}
@@ -1 +1 @@
1
- "use strict";var e=require("react/jsx-runtime"),n=require("react"),a=require("@fluentui/react-components"),i=require("../hooks/useLocalization.js");const t="cookie-consent",s=a.makeStyles({banner:{position:"fixed",bottom:0,left:0,right:0,backgroundColor:a.tokens.colorNeutralBackground1,boxShadow:a.tokens.shadow16,padding:"16px 24px",zIndex:9999,display:"flex",flexDirection:"column",gap:"12px",borderTop:`1px solid ${a.tokens.colorNeutralStroke1}`},bannerActions:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",justifyContent:"flex-end"},bannerText:{flex:1,minWidth:"200px"},floatingButton:{position:"fixed",bottom:"16px",left:"16px",zIndex:9998},cookieRow:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",gap:"16px"},cookieInfo:{flex:1},cookieDescription:{color:a.tokens.colorNeutralForeground3,fontSize:a.tokens.fontSizeBase200,display:"block",marginTop:"2px"}});exports.CookieBanner=({enabled:o})=>{const{t:l}=i.default(),r=s(),c=()=>{if(!o)return null;const e=localStorage.getItem(t);if(!e)return null;try{return JSON.parse(e)}catch{return null}},[d,x]=n.useState(c),[k,p]=n.useState((()=>o&&null===c())),[h,u]=n.useState(!1),[g,j]=n.useState(!1),[m,f]=n.useState(!1);if(!o)return null;const v=(e,n)=>{const a={necessary:!0,analytics:e,marketing:n,timestamp:(new Date).toISOString()};localStorage.setItem(t,JSON.stringify(a)),x(a),p(!1),u(!1)},b=()=>v(!0,!0),N=()=>v(!1,!1),y=()=>{d?(j(d.analytics),f(d.marketing)):(j(!1),f(!1)),u(!0)};return e.jsxs(e.Fragment,{children:[k&&e.jsxs("div",{className:r.banner,role:"region","aria-label":l("Cookie-inställningar"),children:[e.jsx(a.Text,{className:r.bannerText,children:l("Vi använder cookies för att appen ska fungera. Du kan välja att neka icke-nödvändiga cookies eller justera dina inställningar.")}),e.jsxs("div",{className:r.bannerActions,children:[e.jsx(a.Button,{appearance:"subtle",onClick:y,children:l("Cookie-inställningar")}),e.jsx(a.Button,{appearance:"secondary",onClick:N,children:l("Neka icke-nödvändiga")}),e.jsx(a.Button,{appearance:"primary",onClick:b,children:l("Acceptera alla")})]})]}),!k&&d&&e.jsx("div",{className:r.floatingButton,children:e.jsxs(a.Button,{appearance:"subtle",size:"small",onClick:y,"aria-label":l("Ändra cookie-inställningar"),children:["🍪 ",l("Cookies")]})}),e.jsx(a.Dialog,{open:h,onOpenChange:(e,n)=>u(n.open),children:e.jsx(a.DialogSurface,{children:e.jsxs(a.DialogBody,{children:[e.jsx(a.DialogTitle,{children:l("Cookie-inställningar")}),e.jsxs(a.DialogContent,{children:[e.jsx(a.Text,{children:l("Hantera dina cookie-inställningar. Nödvändiga cookies kan inte inaktiveras.")}),e.jsx(a.Divider,{style:{margin:"16px 0 8px"}}),e.jsxs("div",{className:r.cookieRow,children:[e.jsxs("div",{className:r.cookieInfo,children:[e.jsx(a.Text,{weight:"semibold",children:l("Nödvändiga cookies")}),e.jsx(a.Text,{className:r.cookieDescription,children:l("Krävs för att appen ska fungera korrekt. Kan inte inaktiveras.")})]}),e.jsx(a.Switch,{checked:!0,disabled:!0,label:l("Alltid aktiv")})]}),e.jsx(a.Divider,{style:{margin:"8px 0"}}),e.jsxs("div",{className:r.cookieRow,children:[e.jsxs("div",{className:r.cookieInfo,children:[e.jsx(a.Text,{weight:"semibold",children:l("Analytiska cookies")}),e.jsx(a.Text,{className:r.cookieDescription,children:l("Hjälper oss förstå hur appen används så att vi kan förbättra den.")})]}),e.jsx(a.Switch,{checked:g,onChange:(e,n)=>j(n.checked),label:l(g?"Aktiv":"Inaktiv")})]}),e.jsx(a.Divider,{style:{margin:"8px 0"}}),e.jsxs("div",{className:r.cookieRow,children:[e.jsxs("div",{className:r.cookieInfo,children:[e.jsx(a.Text,{weight:"semibold",children:l("Marknadsföringscookies")}),e.jsx(a.Text,{className:r.cookieDescription,children:l("Används för att visa relevant innehåll och mäta kampanjer.")})]}),e.jsx(a.Switch,{checked:m,onChange:(e,n)=>f(n.checked),label:l(m?"Aktiv":"Inaktiv")})]})]}),e.jsxs(a.DialogActions,{children:[e.jsx(a.Button,{appearance:"subtle",onClick:N,children:l("Neka alla")}),e.jsx(a.Button,{appearance:"secondary",onClick:()=>v(g,m),children:l("Spara inställningar")}),e.jsx(a.Button,{appearance:"primary",onClick:b,children:l("Acceptera alla")})]})]})})})]})};
1
+ "use strict";var e=require("react/jsx-runtime"),n=require("react"),a=require("@fluentui/react-components"),i=require("../hooks/useLocalization.js");const t="cookie-consent",s=a.makeStyles({banner:{position:"fixed",bottom:0,left:0,right:0,backgroundColor:a.tokens.colorNeutralBackground1,boxShadow:a.tokens.shadow16,padding:"16px 24px",zIndex:9999,display:"flex",flexDirection:"column",gap:"12px",borderTop:`1px solid ${a.tokens.colorNeutralStroke1}`},bannerActions:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",justifyContent:"flex-end"},bannerText:{flex:1,minWidth:"200px"},floatingButton:{position:"fixed",bottom:"16px",left:"16px",zIndex:9998},cookieRow:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",gap:"16px"},cookieInfo:{flex:1},cookieDescription:{color:a.tokens.colorNeutralForeground3,fontSize:a.tokens.fontSizeBase200,display:"block",marginTop:"2px"}});exports.CookieBanner=({enabled:o,showFloatingButton:l=!1})=>{const{t:r}=i.default(),c=s(),d=()=>{if(!o)return null;const e=localStorage.getItem(t);if(!e)return null;try{return JSON.parse(e)}catch{return null}},[x,k]=n.useState(d),[p,h]=n.useState((()=>o&&null===d())),[u,g]=n.useState(!1),[j,m]=n.useState(!1),[f,v]=n.useState(!1);if(!o)return null;const b=(e,n)=>{const a={necessary:!0,analytics:e,marketing:n,timestamp:(new Date).toISOString()};localStorage.setItem(t,JSON.stringify(a)),k(a),h(!1),g(!1)},N=()=>b(!0,!0),y=()=>b(!1,!1),S=()=>{x?(m(x.analytics),v(x.marketing)):(m(!1),v(!1)),g(!0)};return e.jsxs(e.Fragment,{children:[p&&e.jsxs("div",{className:c.banner,role:"region","aria-label":r("Cookie-inställningar"),children:[e.jsx(a.Text,{className:c.bannerText,children:r("Vi använder cookies för att appen ska fungera. Du kan välja att neka icke-nödvändiga cookies eller justera dina inställningar.")}),e.jsxs("div",{className:c.bannerActions,children:[e.jsx(a.Button,{appearance:"subtle",onClick:S,children:r("Cookie-inställningar")}),e.jsx(a.Button,{appearance:"secondary",onClick:y,children:r("Neka icke-nödvändiga")}),e.jsx(a.Button,{appearance:"primary",onClick:N,children:r("Acceptera alla")})]})]}),l&&!p&&x&&e.jsx("div",{className:c.floatingButton,children:e.jsxs(a.Button,{appearance:"subtle",size:"small",onClick:S,"aria-label":r("Ändra cookie-inställningar"),children:["🍪 ",r("Cookies")]})}),e.jsx(a.Dialog,{open:u,onOpenChange:(e,n)=>g(n.open),children:e.jsx(a.DialogSurface,{children:e.jsxs(a.DialogBody,{children:[e.jsx(a.DialogTitle,{children:r("Cookie-inställningar")}),e.jsxs(a.DialogContent,{children:[e.jsx(a.Text,{children:r("Hantera dina cookie-inställningar. Nödvändiga cookies kan inte inaktiveras.")}),e.jsx(a.Divider,{style:{margin:"16px 0 8px"}}),e.jsxs("div",{className:c.cookieRow,children:[e.jsxs("div",{className:c.cookieInfo,children:[e.jsx(a.Text,{weight:"semibold",children:r("Nödvändiga cookies")}),e.jsx(a.Text,{className:c.cookieDescription,children:r("Krävs för att appen ska fungera korrekt. Kan inte inaktiveras.")})]}),e.jsx(a.Switch,{checked:!0,disabled:!0,label:r("Alltid aktiv")})]}),e.jsx(a.Divider,{style:{margin:"8px 0"}}),e.jsxs("div",{className:c.cookieRow,children:[e.jsxs("div",{className:c.cookieInfo,children:[e.jsx(a.Text,{weight:"semibold",children:r("Analytiska cookies")}),e.jsx(a.Text,{className:c.cookieDescription,children:r("Hjälper oss förstå hur appen används så att vi kan förbättra den.")})]}),e.jsx(a.Switch,{checked:j,onChange:(e,n)=>m(n.checked),label:r(j?"Aktiv":"Inaktiv")})]}),e.jsx(a.Divider,{style:{margin:"8px 0"}}),e.jsxs("div",{className:c.cookieRow,children:[e.jsxs("div",{className:c.cookieInfo,children:[e.jsx(a.Text,{weight:"semibold",children:r("Marknadsföringscookies")}),e.jsx(a.Text,{className:c.cookieDescription,children:r("Används för att visa relevant innehåll och mäta kampanjer.")})]}),e.jsx(a.Switch,{checked:f,onChange:(e,n)=>v(n.checked),label:r(f?"Aktiv":"Inaktiv")})]})]}),e.jsxs(a.DialogActions,{children:[e.jsx(a.Button,{appearance:"subtle",onClick:y,children:r("Neka alla")}),e.jsx(a.Button,{appearance:"secondary",onClick:()=>b(j,f),children:r("Spara inställningar")}),e.jsx(a.Button,{appearance:"primary",onClick:N,children:r("Acceptera alla")})]})]})})})]})};
@@ -1,5 +1,6 @@
1
1
  export interface CookieBannerProps {
2
2
  enabled: boolean;
3
+ showFloatingButton?: boolean;
3
4
  }
4
- export declare const CookieBanner: ({ enabled }: CookieBannerProps) => import("react/jsx-runtime").JSX.Element | null;
5
+ export declare const CookieBanner: ({ enabled, showFloatingButton }: CookieBannerProps) => import("react/jsx-runtime").JSX.Element | null;
5
6
  //# sourceMappingURL=CookieBanner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CookieBanner.d.ts","sourceRoot":"","sources":["../../../src/components/CookieBanner.tsx"],"names":[],"mappings":"AA4EA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,YAAY,gBAAiB,iBAAiB,mDAsJ1D,CAAC"}
1
+ {"version":3,"file":"CookieBanner.d.ts","sourceRoot":"","sources":["../../../src/components/CookieBanner.tsx"],"names":[],"mappings":"AA4EA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,oCAA6C,iBAAiB,mDAsJtF,CAAC"}
@@ -1 +1 @@
1
- import{jsxs as e,Fragment as n,jsx as a}from"react/jsx-runtime";import{useState as i}from"react";import{makeStyles as o,tokens as l,Text as r,Button as c,Dialog as t,DialogSurface as s,DialogBody as d,DialogTitle as p,DialogContent as k,Divider as h,Switch as m,DialogActions as g}from"@fluentui/react-components";import f from"../hooks/useLocalization.js";const u="cookie-consent",x=o({banner:{position:"fixed",bottom:0,left:0,right:0,backgroundColor:l.colorNeutralBackground1,boxShadow:l.shadow16,padding:"16px 24px",zIndex:9999,display:"flex",flexDirection:"column",gap:"12px",borderTop:`1px solid ${l.colorNeutralStroke1}`},bannerActions:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",justifyContent:"flex-end"},bannerText:{flex:1,minWidth:"200px"},floatingButton:{position:"fixed",bottom:"16px",left:"16px",zIndex:9998},cookieRow:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",gap:"16px"},cookieInfo:{flex:1},cookieDescription:{color:l.colorNeutralForeground3,fontSize:l.fontSizeBase200,display:"block",marginTop:"2px"}}),v=({enabled:o})=>{const{t:l}=f(),v=x(),b=()=>{if(!o)return null;const e=localStorage.getItem(u);if(!e)return null;try{return JSON.parse(e)}catch{return null}},[N,y]=i(b),[C,I]=i((()=>o&&null===b())),[w,S]=i(!1),[A,j]=i(!1),[D,z]=i(!1);if(!o)return null;const B=(e,n)=>{const a={necessary:!0,analytics:e,marketing:n,timestamp:(new Date).toISOString()};localStorage.setItem(u,JSON.stringify(a)),y(a),I(!1),S(!1)},O=()=>B(!0,!0),R=()=>B(!1,!1),T=()=>{N?(j(N.analytics),z(N.marketing)):(j(!1),z(!1)),S(!0)};return e(n,{children:[C&&e("div",{className:v.banner,role:"region","aria-label":l("Cookie-inställningar"),children:[a(r,{className:v.bannerText,children:l("Vi använder cookies för att appen ska fungera. Du kan välja att neka icke-nödvändiga cookies eller justera dina inställningar.")}),e("div",{className:v.bannerActions,children:[a(c,{appearance:"subtle",onClick:T,children:l("Cookie-inställningar")}),a(c,{appearance:"secondary",onClick:R,children:l("Neka icke-nödvändiga")}),a(c,{appearance:"primary",onClick:O,children:l("Acceptera alla")})]})]}),!C&&N&&a("div",{className:v.floatingButton,children:e(c,{appearance:"subtle",size:"small",onClick:T,"aria-label":l("Ändra cookie-inställningar"),children:["🍪 ",l("Cookies")]})}),a(t,{open:w,onOpenChange:(e,n)=>S(n.open),children:a(s,{children:e(d,{children:[a(p,{children:l("Cookie-inställningar")}),e(k,{children:[a(r,{children:l("Hantera dina cookie-inställningar. Nödvändiga cookies kan inte inaktiveras.")}),a(h,{style:{margin:"16px 0 8px"}}),e("div",{className:v.cookieRow,children:[e("div",{className:v.cookieInfo,children:[a(r,{weight:"semibold",children:l("Nödvändiga cookies")}),a(r,{className:v.cookieDescription,children:l("Krävs för att appen ska fungera korrekt. Kan inte inaktiveras.")})]}),a(m,{checked:!0,disabled:!0,label:l("Alltid aktiv")})]}),a(h,{style:{margin:"8px 0"}}),e("div",{className:v.cookieRow,children:[e("div",{className:v.cookieInfo,children:[a(r,{weight:"semibold",children:l("Analytiska cookies")}),a(r,{className:v.cookieDescription,children:l("Hjälper oss förstå hur appen används så att vi kan förbättra den.")})]}),a(m,{checked:A,onChange:(e,n)=>j(n.checked),label:l(A?"Aktiv":"Inaktiv")})]}),a(h,{style:{margin:"8px 0"}}),e("div",{className:v.cookieRow,children:[e("div",{className:v.cookieInfo,children:[a(r,{weight:"semibold",children:l("Marknadsföringscookies")}),a(r,{className:v.cookieDescription,children:l("Används för att visa relevant innehåll och mäta kampanjer.")})]}),a(m,{checked:D,onChange:(e,n)=>z(n.checked),label:l(D?"Aktiv":"Inaktiv")})]})]}),e(g,{children:[a(c,{appearance:"subtle",onClick:R,children:l("Neka alla")}),a(c,{appearance:"secondary",onClick:()=>B(A,D),children:l("Spara inställningar")}),a(c,{appearance:"primary",onClick:O,children:l("Acceptera alla")})]})]})})})]})};export{v as CookieBanner};
1
+ import{jsxs as e,Fragment as n,jsx as a}from"react/jsx-runtime";import{useState as i}from"react";import{makeStyles as o,tokens as l,Text as r,Button as t,Dialog as c,DialogSurface as s,DialogBody as d,DialogTitle as p,DialogContent as k,Divider as h,Switch as m,DialogActions as g}from"@fluentui/react-components";import f from"../hooks/useLocalization.js";const u="cookie-consent",x=o({banner:{position:"fixed",bottom:0,left:0,right:0,backgroundColor:l.colorNeutralBackground1,boxShadow:l.shadow16,padding:"16px 24px",zIndex:9999,display:"flex",flexDirection:"column",gap:"12px",borderTop:`1px solid ${l.colorNeutralStroke1}`},bannerActions:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",justifyContent:"flex-end"},bannerText:{flex:1,minWidth:"200px"},floatingButton:{position:"fixed",bottom:"16px",left:"16px",zIndex:9998},cookieRow:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",gap:"16px"},cookieInfo:{flex:1},cookieDescription:{color:l.colorNeutralForeground3,fontSize:l.fontSizeBase200,display:"block",marginTop:"2px"}}),v=({enabled:o,showFloatingButton:l=!1})=>{const{t:v}=f(),b=x(),N=()=>{if(!o)return null;const e=localStorage.getItem(u);if(!e)return null;try{return JSON.parse(e)}catch{return null}},[y,C]=i(N),[w,I]=i((()=>o&&null===N())),[S,A]=i(!1),[j,D]=i(!1),[z,B]=i(!1);if(!o)return null;const O=(e,n)=>{const a={necessary:!0,analytics:e,marketing:n,timestamp:(new Date).toISOString()};localStorage.setItem(u,JSON.stringify(a)),C(a),I(!1),A(!1)},R=()=>O(!0,!0),T=()=>O(!1,!1),F=()=>{y?(D(y.analytics),B(y.marketing)):(D(!1),B(!1)),A(!0)};return e(n,{children:[w&&e("div",{className:b.banner,role:"region","aria-label":v("Cookie-inställningar"),children:[a(r,{className:b.bannerText,children:v("Vi använder cookies för att appen ska fungera. Du kan välja att neka icke-nödvändiga cookies eller justera dina inställningar.")}),e("div",{className:b.bannerActions,children:[a(t,{appearance:"subtle",onClick:F,children:v("Cookie-inställningar")}),a(t,{appearance:"secondary",onClick:T,children:v("Neka icke-nödvändiga")}),a(t,{appearance:"primary",onClick:R,children:v("Acceptera alla")})]})]}),l&&!w&&y&&a("div",{className:b.floatingButton,children:e(t,{appearance:"subtle",size:"small",onClick:F,"aria-label":v("Ändra cookie-inställningar"),children:["🍪 ",v("Cookies")]})}),a(c,{open:S,onOpenChange:(e,n)=>A(n.open),children:a(s,{children:e(d,{children:[a(p,{children:v("Cookie-inställningar")}),e(k,{children:[a(r,{children:v("Hantera dina cookie-inställningar. Nödvändiga cookies kan inte inaktiveras.")}),a(h,{style:{margin:"16px 0 8px"}}),e("div",{className:b.cookieRow,children:[e("div",{className:b.cookieInfo,children:[a(r,{weight:"semibold",children:v("Nödvändiga cookies")}),a(r,{className:b.cookieDescription,children:v("Krävs för att appen ska fungera korrekt. Kan inte inaktiveras.")})]}),a(m,{checked:!0,disabled:!0,label:v("Alltid aktiv")})]}),a(h,{style:{margin:"8px 0"}}),e("div",{className:b.cookieRow,children:[e("div",{className:b.cookieInfo,children:[a(r,{weight:"semibold",children:v("Analytiska cookies")}),a(r,{className:b.cookieDescription,children:v("Hjälper oss förstå hur appen används så att vi kan förbättra den.")})]}),a(m,{checked:j,onChange:(e,n)=>D(n.checked),label:v(j?"Aktiv":"Inaktiv")})]}),a(h,{style:{margin:"8px 0"}}),e("div",{className:b.cookieRow,children:[e("div",{className:b.cookieInfo,children:[a(r,{weight:"semibold",children:v("Marknadsföringscookies")}),a(r,{className:b.cookieDescription,children:v("Används för att visa relevant innehåll och mäta kampanjer.")})]}),a(m,{checked:z,onChange:(e,n)=>B(n.checked),label:v(z?"Aktiv":"Inaktiv")})]})]}),e(g,{children:[a(t,{appearance:"subtle",onClick:T,children:v("Neka alla")}),a(t,{appearance:"secondary",onClick:()=>O(j,z),children:v("Spara inställningar")}),a(t,{appearance:"primary",onClick:R,children:v("Acceptera alla")})]})]})})})]})};export{v as CookieBanner};
package/dist/index.d.ts CHANGED
@@ -1132,8 +1132,9 @@ declare const BulkUploadDialog: (props: BulkUploadDialogProps) => react_jsx_runt
1132
1132
 
1133
1133
  interface CookieBannerProps {
1134
1134
  enabled: boolean;
1135
+ showFloatingButton?: boolean;
1135
1136
  }
1136
- declare const CookieBanner: ({ enabled }: CookieBannerProps) => react_jsx_runtime.JSX.Element | null;
1137
+ declare const CookieBanner: ({ enabled, showFloatingButton }: CookieBannerProps) => react_jsx_runtime.JSX.Element | null;
1137
1138
 
1138
1139
  declare class AppConfig {
1139
1140
  constructor();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codicent-app-sdk",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "SDK for building AI-powered applications with Codicent",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",