@consenti/api 0.5.0 → 0.6.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/README.md +143 -11
- package/dist/chunk-7NKW7UTJ.js +2 -0
- package/dist/chunk-7NKW7UTJ.js.map +1 -0
- package/dist/dashboard/assets/{ApiConfig-dmDLJNfI.js → ApiConfig-DLPkgWsM.js} +1 -1
- package/dist/dashboard/assets/{ArchivedProfileList-ChWp1RHE.js → ArchivedProfileList-fRvXAaWy.js} +1 -1
- package/dist/dashboard/assets/{AuditLog-3lekUOk8.js → AuditLog-9flkPiEQ.js} +1 -1
- package/dist/dashboard/assets/{ChangePassword-BYlF08cE.js → ChangePassword-D--mNLLR.js} +1 -1
- package/dist/dashboard/assets/{ConfirmDialog-sMBVcbiI.js → ConfirmDialog-CJAqYRfE.js} +1 -1
- package/dist/dashboard/assets/{ConsentList-DLDBSjxO.js → ConsentList-CyddMOrW.js} +1 -1
- package/dist/dashboard/assets/{ConsentTemplateEditor-0iB6G95-.js → ConsentTemplateEditor-DZGFzkTA.js} +1 -1
- package/dist/dashboard/assets/{ConsentTemplateList-BnU_nL8h.js → ConsentTemplateList-CwNVxHyZ.js} +1 -1
- package/dist/dashboard/assets/{HeadingTagInput-7owwn9Vj.js → HeadingTagInput-DGKZYLTR.js} +1 -1
- package/dist/dashboard/assets/{HowItWorks-B05y-6xX.js → HowItWorks-10CyO4Kp.js} +1 -1
- package/dist/dashboard/assets/{PermissionGate-D45f3WrO.js → PermissionGate-CkaZ9DKx.js} +1 -1
- package/dist/dashboard/assets/PreviewPane-ArCfR0c9.js +38 -0
- package/dist/dashboard/assets/{ProfileEditor-CuMRNzdM.js → ProfileEditor-BNUxXKMk.js} +1 -1
- package/dist/dashboard/assets/{ProfileList-CFZ_i1zk.js → ProfileList-Ti5ZML_L.js} +1 -1
- package/dist/dashboard/assets/{ProfileVersionHistory-40HtQSrd.js → ProfileVersionHistory-D2KtUROF.js} +1 -1
- package/dist/dashboard/assets/{RecordDetailModal-hpJgK02E.js → RecordDetailModal-4OyHjtux.js} +1 -1
- package/dist/dashboard/assets/{Reports-BlvcycZ8.js → Reports-CHpF_j2k.js} +1 -1
- package/dist/dashboard/assets/{RoleList-CTeQdx6f.js → RoleList-BICQW5gU.js} +1 -1
- package/dist/dashboard/assets/{Select-CeC6GRyb.js → Select-C7q2vevu.js} +1 -1
- package/dist/dashboard/assets/{Settings-DLsvGtMh.js → Settings-BlOcU0wL.js} +1 -1
- package/dist/dashboard/assets/{SetupWizard-BVzGrBm2.js → SetupWizard-DReZ5DWr.js} +1 -1
- package/dist/dashboard/assets/{Table-CcBP7eXS.js → Table-C59yMXY2.js} +1 -1
- package/dist/dashboard/assets/{TenantList-DLgPnlVv.js → TenantList-Bbwcxyo8.js} +1 -1
- package/dist/dashboard/assets/{UITemplateEditor-B9EBcvOB.js → UITemplateEditor-CR7TnHBH.js} +1 -1
- package/dist/dashboard/assets/{UITemplateList-CGYRRlCh.js → UITemplateList-NKwDQJAw.js} +1 -1
- package/dist/dashboard/assets/{UserList-BbpiUrVr.js → UserList-DMk0_UF0.js} +1 -1
- package/dist/dashboard/assets/{VendorList-mlOlW7ht.js → VendorList-BawJ8Kyc.js} +1 -1
- package/dist/dashboard/assets/{VisitorList-Dne7xkNx.js → VisitorList-BVSFRtul.js} +1 -1
- package/dist/dashboard/assets/check-BAoHs1bd.js +1 -0
- package/dist/dashboard/assets/{copy-FTaGH7-z.js → copy-DjZpSOQM.js} +1 -1
- package/dist/dashboard/assets/{external-link-5y29qnhn.js → external-link-CFayXpKz.js} +1 -1
- package/dist/dashboard/assets/{index-BaYVhd1M.js → index-D7qdwIxs.js} +2 -2
- package/dist/dashboard/assets/{profiles-D-hvl_fK.js → profiles-Jb6uV-0U.js} +1 -1
- package/dist/dashboard/assets/{roles-DZyZwZDr.js → roles-ChXEt79v.js} +1 -1
- package/dist/dashboard/assets/{rotate-ccw-clock-C5cVu2_f.js → rotate-ccw-clock-503u3yEE.js} +1 -1
- package/dist/dashboard/assets/{search-mdMD-WTj.js → search-B05qPv24.js} +1 -1
- package/dist/dashboard/assets/{square-pen-BoEcHaSW.js → square-pen-BX2H18m3.js} +1 -1
- package/dist/dashboard/assets/{templates-DLMsZs7d.js → templates-DalUjETH.js} +1 -1
- package/dist/dashboard/assets/{trash-BVDX09Xe.js → trash-Bfqti-Og.js} +1 -1
- package/dist/dashboard/assets/{useHashQuery-wXzkY-tk.js → useHashQuery-DzYBqPIg.js} +1 -1
- package/dist/dashboard/assets/{users-BLTbK4tk.js → users-CDdO4hYQ.js} +1 -1
- package/dist/dashboard/assets/x-Clw5rGTJ.js +1 -0
- package/dist/dashboard/index.html +1 -1
- package/dist/dist-MNR4WETI.js +2 -0
- package/dist/index.cjs +77 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -9
- package/dist/index.d.ts +45 -9
- package/dist/index.js +76 -74
- package/dist/index.js.map +1 -1
- package/dist/widget/widget.js +1 -1
- package/package.json +3 -2
- package/scripts/migrate-to-consenti-prefix.mjs +196 -0
- package/dist/chunk-COR72NFQ.js +0 -2
- package/dist/chunk-COR72NFQ.js.map +0 -1
- package/dist/dashboard/assets/PreviewPane-Czax39la.js +0 -38
- package/dist/dashboard/assets/check-IM5PInrX.js +0 -1
- package/dist/dashboard/assets/x-CtCy0YcJ.js +0 -1
- package/dist/dist-QJYW5KUK.js +0 -2
- /package/dist/{dist-QJYW5KUK.js.map → dist-MNR4WETI.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./check-IM5PInrX.js";import{t}from"./copy-FTaGH7-z.js";import{t as n}from"./rotate-ccw-clock-C5cVu2_f.js";import{t as r}from"./square-pen-BoEcHaSW.js";import{t as i}from"./trash-BVDX09Xe.js";import{t as a}from"./ConfirmDialog-sMBVcbiI.js";import{A as o,D as s,M as c,S as l,T as u,_ as d,k as f,o as p,s as m,v as h}from"./index-BaYVhd1M.js";import{t as g}from"./Table-CcBP7eXS.js";import{t as _}from"./profiles-D-hvl_fK.js";import{t as v}from"./dist-GoiMJCTt.js";import{t as y}from"./PermissionGate-D45f3WrO.js";var b={name:`book-copy`,size:24,node:[[`path`,{d:`M5 7a2 2 0 0 0-2 2v11`,key:`1yhqjt`}],[`path`,{d:`M5.803 18H5a2 2 0 0 0 0 4h9.5a.5.5 0 0 0 .5-.5V21`,key:`edzzo5`}],[`path`,{d:`M9 15V4a2 2 0 0 1 2-2h9.5a.5.5 0 0 1 .5.5v14a.5.5 0 0 1-.5.5H11a2 2 0 0 1 0-4h10`,key:`1nwzrg`}]]};b.node;var x=d(b),S={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};S.node;var C=d(S),w={name:`power-off`,size:24,node:[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};w.node;var T=d(w),E={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};E.node;var D=d(E);function O({content:e,children:t}){let[n,r]=f(null),i=s(null),a=()=>{if(!i.current)return;let e=i.current.getBoundingClientRect(),t=e.top-6-8,n=window.innerHeight-e.bottom-6-8;r(t>=n?{bottom:window.innerHeight-e.top+6,left:e.left+e.width/2,placement:`top`,maxHeight:Math.max(t,40)}:{top:e.bottom+6,left:e.left+e.width/2,placement:`bottom`,maxHeight:Math.max(n,40)})},o=()=>r(null);return l(`span`,{ref:i,class:`relative inline-flex items-center`,onMouseEnter:a,onMouseLeave:o,onFocus:a,onBlur:o,children:[t,n&&h(l(`span`,{role:`tooltip`,class:`fixed -translate-x-1/2 z-50 min-w-max max-w-xs overflow-y-auto bg-gray-900 text-white text-xs rounded px-2.5 py-1.5 shadow-lg pointer-events-none`,style:{left:n.left,maxHeight:n.maxHeight,...n.placement===`top`?{bottom:n.bottom}:{top:n.top}},children:[n.placement===`top`?l(`span`,{class:`absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-gray-900`}):l(`span`,{class:`absolute bottom-full left-1/2 -translate-x-1/2 border-4 border-transparent border-b-gray-900`}),e]}),document.body)]})}function k({current:s}){let d=m();p(d(`profiles.title`));let[b,S]=f([]),[w,E]=f(!0),[k,A]=f(null),[j,M]=f(null),[N,P]=f(null),[F,I]=f(null),[L,R]=f(null),[z,B]=f(``),{requestConfirm:V,dialog:H}=a(),U=e=>{navigator.clipboard.writeText(e).then(()=>{M(e),setTimeout(()=>M(t=>t===e?null:t),1500)}).catch(()=>{})},W=()=>{E(!0),_.listSummary().then(S).catch(()=>{}).finally(()=>E(!1))};o(()=>{W()},[]);let G=async(e,t)=>{if(await V({title:d(`profiles.dialog.delete.title`,{name:t}),message:d(`profiles.dialog.delete.message`)})){B(``);try{await _.delete(e)}catch(e){B(u(e,d(`profiles.error.delete`)))}W()}},K=async e=>{if(await V({title:d(`profiles.dialog.copy.title`,{name:e.name}),message:d(`profiles.dialog.copy.message`)})){A(e.id),B(``);try{await _.copy(e.id),W()}catch(e){B(u(e,d(`profiles.error.copy`)))}finally{A(null)}}},q=async(e,t)=>{P(e),B(``);try{let n=await _.activate(e,t?{choice:t}:void 0);if(n.requiresChoice){R(e),I(n.conflict);return}W()}catch(e){B(u(e,d(`profiles.error.activate`)))}finally{P(t=>t===e?null:t)}},J=async()=>{let e=L;I(null),R(null),e&&await q(e,`deactivate`)},Y=async e=>{if(e.isActive){if(!await V({title:`Deactivate profile "${e.name}"?`,message:`This will remove the profile JSON files for this compliance group.`}))return;P(e.id),B(``);try{await _.deactivate(e.id),W()}catch(e){B(u(e,d(`profiles.error.deactivate`)))}finally{P(null)}}else await q(e.id)},X=b.length,Z=d(X===1?`profiles.countSingular`:`profiles.count`,{n:X});return l(c,{children:[H,z&&l(`div`,{class:`mb-4 flex items-start justify-between gap-3 rounded-lg border border-red-200 bg-red-50 px-4 py-2.5 text-sm text-red-700`,children:[l(`span`,{children:z}),l(`button`,{type:`button`,onClick:()=>B(``),class:`text-red-400 hover:text-red-600`,"aria-label":d(`common.close`),children:`×`})]}),F&&h(l(`div`,{class:`fixed inset-0 z-50 flex items-center justify-center`,children:[l(`div`,{class:`absolute inset-0 bg-black/40`,onClick:()=>{I(null),R(null)},"aria-hidden":`true`}),l(`div`,{class:`relative bg-white rounded-xl shadow-2xl p-6 w-full max-w-md mx-4 space-y-4`,children:[l(`h3`,{class:`text-sm font-semibold text-gray-900`,children:d(`profileEditor.conflict.title`)}),l(`p`,{class:`text-sm text-gray-600`,children:d(`profileEditor.conflict.message`,{name:F.name})}),l(`div`,{class:`flex flex-col gap-2 pt-1`,children:[l(`button`,{type:`button`,onClick:J,class:`w-full bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 transition-colors`,children:d(`profileEditor.conflict.deactivate`,{name:F.name})}),l(`button`,{type:`button`,onClick:()=>{I(null),R(null)},class:`w-full border border-gray-300 text-gray-700 px-4 py-2 rounded-lg text-sm hover:bg-gray-50 transition-colors`,children:d(`common.cancel`)})]})]})]}),document.body),l(`div`,{class:`flex justify-between items-center mb-4`,children:[l(`p`,{class:`text-sm text-gray-500`,children:Z}),l(`div`,{class:`flex items-center gap-2`,children:[l(`a`,{href:`#/banners/profiles/archived`,class:`border border-gray-300 text-gray-600 px-4 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 transition-colors flex items-center gap-1.5`,children:[l(n,{size:14,"aria-hidden":`true`}),d(`profiles.archived.cta`)]}),l(y,{perm:`profile:create`,children:l(`a`,{href:`#/banners/profiles/new`,class:`bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 transition-colors`,children:d(`profiles.newProfile`)})})]})]}),l(g,{loading:w,keyFn:e=>e.id,rows:b,search:{placeholder:d(`profiles.search.placeholder`),keys:e=>[e.name,e.id,e.consentTemplateName,e.uiTemplateName]},filters:[{label:d(`profiles.filter.status`),options:[{value:`active`,label:d(`profiles.filter.active`)},{value:`inactive`,label:d(`profiles.filter.inactive`)}],predicate:(e,t)=>t===`active`===e.isActive}],columns:[{key:`name`,label:d(`profiles.col.name`),render:n=>{let r=n;return l(`div`,{children:[l(`div`,{class:`font-medium text-sm text-gray-900`,children:r.name}),l(`div`,{class:`flex items-center gap-1 mt-0.5`,children:[l(`span`,{class:`text-xs text-gray-400 font-mono`,children:r.id}),l(`button`,{onClick:e=>{e.stopPropagation(),U(r.id)},class:`text-gray-400 hover:text-gray-600 transition-colors`,"aria-label":d(`profiles.action.copyId`),title:d(`profiles.action.copyId`),children:j===r.id?l(e,{size:11,className:`text-green-500`,"aria-hidden":`true`}):l(t,{size:11,"aria-hidden":`true`})})]})]})}},{key:`defaultLocale`,label:d(`profiles.col.defaultLocale`)},{key:`complianceGroup`,label:`Compliance Group`,render:n=>{let r=n,i=r.complianceGroup??r.customComplianceGroup;if(!r.complianceGroup)return r.customComplianceGroup?l(`div`,{children:[l(`div`,{class:`font-medium text-sm text-gray-900`,children:r.customComplianceGroup}),l(`div`,{class:`flex items-center gap-1`,children:[l(`span`,{class:`text-sm text-gray-700 font-mono`,children:i}),l(`button`,{onClick:e=>{e.stopPropagation(),U(i)},class:`text-gray-400 hover:text-gray-600 transition-colors`,"aria-label":d(`profiles.action.copySlug`),title:d(`profiles.action.copySlug`),children:j===i?l(e,{size:11,className:`text-green-500`,"aria-hidden":`true`}):l(t,{size:11,"aria-hidden":`true`})})]})]}):l(`span`,{class:`text-xs text-gray-400`,children:`—`});let a=v[r.complianceGroup],o=a?.label??r.complianceGroup,s=a?.compliances??[];return l(`div`,{children:[l(`div`,{class:`font-medium text-sm text-gray-900`,children:o}),l(`div`,{class:`flex items-center gap-1.5`,children:[l(`span`,{class:`text-sm text-gray-700`,children:i}),l(`button`,{onClick:e=>{e.stopPropagation(),U(i)},class:`text-gray-400 hover:text-gray-600 transition-colors`,"aria-label":d(`profiles.action.copySlug`),title:d(`profiles.action.copySlug`),children:j===i?l(e,{size:11,className:`text-green-500`,"aria-hidden":`true`}):l(t,{size:11,"aria-hidden":`true`})}),s.length>0&&l(O,{content:l(`div`,{class:`space-y-0.5`,children:s.map(e=>l(`div`,{class:`text-xs`,children:e},e))}),children:l(C,{size:13,className:`text-gray-400 cursor-help`,"aria-hidden":`true`})})]})]})}},{key:`isActive`,label:`Status`,render:e=>{let t=e;return l(`span`,{class:`text-xs font-medium px-2 py-0.5 rounded-full ${t.isActive?`bg-green-100 text-green-700`:`bg-gray-100 text-gray-500`}`,children:t.isActive?`Active`:`Inactive`})}},{key:`templates`,label:d(`profiles.col.templates`),render:e=>{let t=e;return l(`div`,{class:`text-xs text-gray-500 space-y-0.5`,children:[t.consentTemplateName&&l(`div`,{children:[`Consent: `,l(`span`,{class:`text-gray-700`,children:t.consentTemplateName})]}),t.uiTemplateName&&l(`div`,{children:[`UI: `,l(`span`,{class:`text-gray-700`,children:t.uiTemplateName})]}),!t.consentTemplateName&&!t.uiTemplateName&&l(`span`,{class:`text-gray-300`,children:`—`})]})}},{key:`createdAt`,label:d(`profiles.col.created`),render:e=>{let t=e;return l(`div`,{class:`text-xs text-gray-500`,children:[l(`div`,{children:new Date(t.createdAt).toLocaleDateString()}),t.updatedAt&&t.updatedAt!==t.createdAt&&l(`div`,{class:`text-gray-400`,children:[`upd `,new Date(t.updatedAt).toLocaleDateString()]})]})}},{key:`actions`,label:``,render:e=>{let t=e;return l(`div`,{class:`flex gap-2 items-center`,children:[l(`a`,{href:`#/banners/profiles/${t.id}`,class:`text-blue-600 hover:text-blue-800 text-xs`,title:d(`common.edit`),"aria-label":d(`common.edit`),children:l(r,{size:14,"aria-hidden":`true`})}),l(`a`,{href:`#/banners/profiles/${t.id}/history`,class:`text-gray-500 hover:text-gray-700 text-xs`,title:`Version history`,"aria-label":`Version history`,children:l(n,{size:14,"aria-hidden":`true`})}),l(y,{perm:`profile:update`,children:l(`button`,{onClick:()=>Y(t),disabled:N===t.id,class:`text-xs disabled:opacity-50 ${t.isActive?`text-amber-500 hover:text-amber-700`:`text-green-600 hover:text-green-800`}`,title:t.isActive?`Deactivate`:`Activate`,"aria-label":t.isActive?`Deactivate`:`Activate`,children:t.isActive?l(T,{size:14,"aria-hidden":`true`}):l(D,{size:14,"aria-hidden":`true`})})}),l(y,{perm:`profile:create`,children:l(`button`,{onClick:()=>K(t),disabled:k===t.id,class:`text-gray-500 hover:text-blue-600 text-xs disabled:opacity-50`,title:d(`common.duplicate`),"aria-label":d(`common.duplicate`),children:k===t.id?`…`:l(x,{size:14,"aria-hidden":`true`})})}),l(y,{perm:`profile:delete`,children:l(`button`,{onClick:()=>G(t.id,t.name),class:`text-red-500 hover:text-red-700 text-xs`,title:d(`common.delete`),"aria-label":d(`common.delete`),children:l(i,{size:14,"aria-hidden":`true`})})})]})}}],emptyText:d(`profiles.empty`)})]})}export{k as ProfileList};
|
|
1
|
+
import{t as e}from"./check-BAoHs1bd.js";import{t}from"./copy-DjZpSOQM.js";import{t as n}from"./rotate-ccw-clock-503u3yEE.js";import{t as r}from"./square-pen-BX2H18m3.js";import{t as i}from"./trash-Bfqti-Og.js";import{t as a}from"./ConfirmDialog-CJAqYRfE.js";import{A as o,D as s,M as c,S as l,T as u,_ as d,k as f,o as p,s as m,v as h}from"./index-D7qdwIxs.js";import{t as g}from"./Table-C59yMXY2.js";import{t as _}from"./profiles-Jb6uV-0U.js";import{t as v}from"./dist-GoiMJCTt.js";import{t as y}from"./PermissionGate-CkaZ9DKx.js";var b={name:`book-copy`,size:24,node:[[`path`,{d:`M5 7a2 2 0 0 0-2 2v11`,key:`1yhqjt`}],[`path`,{d:`M5.803 18H5a2 2 0 0 0 0 4h9.5a.5.5 0 0 0 .5-.5V21`,key:`edzzo5`}],[`path`,{d:`M9 15V4a2 2 0 0 1 2-2h9.5a.5.5 0 0 1 .5.5v14a.5.5 0 0 1-.5.5H11a2 2 0 0 1 0-4h10`,key:`1nwzrg`}]]};b.node;var x=d(b),S={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};S.node;var C=d(S),w={name:`power-off`,size:24,node:[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};w.node;var T=d(w),E={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};E.node;var D=d(E);function O({content:e,children:t}){let[n,r]=f(null),i=s(null),a=()=>{if(!i.current)return;let e=i.current.getBoundingClientRect(),t=e.top-6-8,n=window.innerHeight-e.bottom-6-8;r(t>=n?{bottom:window.innerHeight-e.top+6,left:e.left+e.width/2,placement:`top`,maxHeight:Math.max(t,40)}:{top:e.bottom+6,left:e.left+e.width/2,placement:`bottom`,maxHeight:Math.max(n,40)})},o=()=>r(null);return l(`span`,{ref:i,class:`relative inline-flex items-center`,onMouseEnter:a,onMouseLeave:o,onFocus:a,onBlur:o,children:[t,n&&h(l(`span`,{role:`tooltip`,class:`fixed -translate-x-1/2 z-50 min-w-max max-w-xs overflow-y-auto bg-gray-900 text-white text-xs rounded px-2.5 py-1.5 shadow-lg pointer-events-none`,style:{left:n.left,maxHeight:n.maxHeight,...n.placement===`top`?{bottom:n.bottom}:{top:n.top}},children:[n.placement===`top`?l(`span`,{class:`absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-gray-900`}):l(`span`,{class:`absolute bottom-full left-1/2 -translate-x-1/2 border-4 border-transparent border-b-gray-900`}),e]}),document.body)]})}function k({current:s}){let d=m();p(d(`profiles.title`));let[b,S]=f([]),[w,E]=f(!0),[k,A]=f(null),[j,M]=f(null),[N,P]=f(null),[F,I]=f(null),[L,R]=f(null),[z,B]=f(``),{requestConfirm:V,dialog:H}=a(),U=e=>{navigator.clipboard.writeText(e).then(()=>{M(e),setTimeout(()=>M(t=>t===e?null:t),1500)}).catch(()=>{})},W=()=>{E(!0),_.listSummary().then(S).catch(()=>{}).finally(()=>E(!1))};o(()=>{W()},[]);let G=async(e,t)=>{if(await V({title:d(`profiles.dialog.delete.title`,{name:t}),message:d(`profiles.dialog.delete.message`)})){B(``);try{await _.delete(e)}catch(e){B(u(e,d(`profiles.error.delete`)))}W()}},K=async e=>{if(await V({title:d(`profiles.dialog.copy.title`,{name:e.name}),message:d(`profiles.dialog.copy.message`)})){A(e.id),B(``);try{await _.copy(e.id),W()}catch(e){B(u(e,d(`profiles.error.copy`)))}finally{A(null)}}},q=async(e,t)=>{P(e),B(``);try{let n=await _.activate(e,t?{choice:t}:void 0);if(n.requiresChoice){R(e),I(n.conflict);return}W()}catch(e){B(u(e,d(`profiles.error.activate`)))}finally{P(t=>t===e?null:t)}},J=async()=>{let e=L;I(null),R(null),e&&await q(e,`deactivate`)},Y=async e=>{if(e.isActive){if(!await V({title:`Deactivate profile "${e.name}"?`,message:`This will remove the profile JSON files for this compliance group.`}))return;P(e.id),B(``);try{await _.deactivate(e.id),W()}catch(e){B(u(e,d(`profiles.error.deactivate`)))}finally{P(null)}}else await q(e.id)},X=b.length,Z=d(X===1?`profiles.countSingular`:`profiles.count`,{n:X});return l(c,{children:[H,z&&l(`div`,{class:`mb-4 flex items-start justify-between gap-3 rounded-lg border border-red-200 bg-red-50 px-4 py-2.5 text-sm text-red-700`,children:[l(`span`,{children:z}),l(`button`,{type:`button`,onClick:()=>B(``),class:`text-red-400 hover:text-red-600`,"aria-label":d(`common.close`),children:`×`})]}),F&&h(l(`div`,{class:`fixed inset-0 z-50 flex items-center justify-center`,children:[l(`div`,{class:`absolute inset-0 bg-black/40`,onClick:()=>{I(null),R(null)},"aria-hidden":`true`}),l(`div`,{class:`relative bg-white rounded-xl shadow-2xl p-6 w-full max-w-md mx-4 space-y-4`,children:[l(`h3`,{class:`text-sm font-semibold text-gray-900`,children:d(`profileEditor.conflict.title`)}),l(`p`,{class:`text-sm text-gray-600`,children:d(`profileEditor.conflict.message`,{name:F.name})}),l(`div`,{class:`flex flex-col gap-2 pt-1`,children:[l(`button`,{type:`button`,onClick:J,class:`w-full bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 transition-colors`,children:d(`profileEditor.conflict.deactivate`,{name:F.name})}),l(`button`,{type:`button`,onClick:()=>{I(null),R(null)},class:`w-full border border-gray-300 text-gray-700 px-4 py-2 rounded-lg text-sm hover:bg-gray-50 transition-colors`,children:d(`common.cancel`)})]})]})]}),document.body),l(`div`,{class:`flex justify-between items-center mb-4`,children:[l(`p`,{class:`text-sm text-gray-500`,children:Z}),l(`div`,{class:`flex items-center gap-2`,children:[l(`a`,{href:`#/banners/profiles/archived`,class:`border border-gray-300 text-gray-600 px-4 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 transition-colors flex items-center gap-1.5`,children:[l(n,{size:14,"aria-hidden":`true`}),d(`profiles.archived.cta`)]}),l(y,{perm:`profile:create`,children:l(`a`,{href:`#/banners/profiles/new`,class:`bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 transition-colors`,children:d(`profiles.newProfile`)})})]})]}),l(g,{loading:w,keyFn:e=>e.id,rows:b,search:{placeholder:d(`profiles.search.placeholder`),keys:e=>[e.name,e.id,e.consentTemplateName,e.uiTemplateName]},filters:[{label:d(`profiles.filter.status`),options:[{value:`active`,label:d(`profiles.filter.active`)},{value:`inactive`,label:d(`profiles.filter.inactive`)}],predicate:(e,t)=>t===`active`===e.isActive}],columns:[{key:`name`,label:d(`profiles.col.name`),render:n=>{let r=n;return l(`div`,{children:[l(`div`,{class:`font-medium text-sm text-gray-900`,children:r.name}),l(`div`,{class:`flex items-center gap-1 mt-0.5`,children:[l(`span`,{class:`text-xs text-gray-400 font-mono`,children:r.id}),l(`button`,{onClick:e=>{e.stopPropagation(),U(r.id)},class:`text-gray-400 hover:text-gray-600 transition-colors`,"aria-label":d(`profiles.action.copyId`),title:d(`profiles.action.copyId`),children:j===r.id?l(e,{size:11,className:`text-green-500`,"aria-hidden":`true`}):l(t,{size:11,"aria-hidden":`true`})})]})]})}},{key:`defaultLocale`,label:d(`profiles.col.defaultLocale`)},{key:`complianceGroup`,label:`Compliance Group`,render:n=>{let r=n,i=r.complianceGroup??r.customComplianceGroup;if(!r.complianceGroup)return r.customComplianceGroup?l(`div`,{children:[l(`div`,{class:`font-medium text-sm text-gray-900`,children:r.customComplianceGroup}),l(`div`,{class:`flex items-center gap-1`,children:[l(`span`,{class:`text-sm text-gray-700 font-mono`,children:i}),l(`button`,{onClick:e=>{e.stopPropagation(),U(i)},class:`text-gray-400 hover:text-gray-600 transition-colors`,"aria-label":d(`profiles.action.copySlug`),title:d(`profiles.action.copySlug`),children:j===i?l(e,{size:11,className:`text-green-500`,"aria-hidden":`true`}):l(t,{size:11,"aria-hidden":`true`})})]})]}):l(`span`,{class:`text-xs text-gray-400`,children:`—`});let a=v[r.complianceGroup],o=a?.label??r.complianceGroup,s=a?.compliances??[];return l(`div`,{children:[l(`div`,{class:`font-medium text-sm text-gray-900`,children:o}),l(`div`,{class:`flex items-center gap-1.5`,children:[l(`span`,{class:`text-sm text-gray-700`,children:i}),l(`button`,{onClick:e=>{e.stopPropagation(),U(i)},class:`text-gray-400 hover:text-gray-600 transition-colors`,"aria-label":d(`profiles.action.copySlug`),title:d(`profiles.action.copySlug`),children:j===i?l(e,{size:11,className:`text-green-500`,"aria-hidden":`true`}):l(t,{size:11,"aria-hidden":`true`})}),s.length>0&&l(O,{content:l(`div`,{class:`space-y-0.5`,children:s.map(e=>l(`div`,{class:`text-xs`,children:e},e))}),children:l(C,{size:13,className:`text-gray-400 cursor-help`,"aria-hidden":`true`})})]})]})}},{key:`isActive`,label:`Status`,render:e=>{let t=e;return l(`span`,{class:`text-xs font-medium px-2 py-0.5 rounded-full ${t.isActive?`bg-green-100 text-green-700`:`bg-gray-100 text-gray-500`}`,children:t.isActive?`Active`:`Inactive`})}},{key:`templates`,label:d(`profiles.col.templates`),render:e=>{let t=e;return l(`div`,{class:`text-xs text-gray-500 space-y-0.5`,children:[t.consentTemplateName&&l(`div`,{children:[`Consent: `,l(`span`,{class:`text-gray-700`,children:t.consentTemplateName})]}),t.uiTemplateName&&l(`div`,{children:[`UI: `,l(`span`,{class:`text-gray-700`,children:t.uiTemplateName})]}),!t.consentTemplateName&&!t.uiTemplateName&&l(`span`,{class:`text-gray-300`,children:`—`})]})}},{key:`createdAt`,label:d(`profiles.col.created`),render:e=>{let t=e;return l(`div`,{class:`text-xs text-gray-500`,children:[l(`div`,{children:new Date(t.createdAt).toLocaleDateString()}),t.updatedAt&&t.updatedAt!==t.createdAt&&l(`div`,{class:`text-gray-400`,children:[`upd `,new Date(t.updatedAt).toLocaleDateString()]})]})}},{key:`actions`,label:``,render:e=>{let t=e;return l(`div`,{class:`flex gap-2 items-center`,children:[l(`a`,{href:`#/banners/profiles/${t.id}`,class:`text-blue-600 hover:text-blue-800 text-xs`,title:d(`common.edit`),"aria-label":d(`common.edit`),children:l(r,{size:14,"aria-hidden":`true`})}),l(`a`,{href:`#/banners/profiles/${t.id}/history`,class:`text-gray-500 hover:text-gray-700 text-xs`,title:`Version history`,"aria-label":`Version history`,children:l(n,{size:14,"aria-hidden":`true`})}),l(y,{perm:`profile:update`,children:l(`button`,{onClick:()=>Y(t),disabled:N===t.id,class:`text-xs disabled:opacity-50 ${t.isActive?`text-amber-500 hover:text-amber-700`:`text-green-600 hover:text-green-800`}`,title:t.isActive?`Deactivate`:`Activate`,"aria-label":t.isActive?`Deactivate`:`Activate`,children:t.isActive?l(T,{size:14,"aria-hidden":`true`}):l(D,{size:14,"aria-hidden":`true`})})}),l(y,{perm:`profile:create`,children:l(`button`,{onClick:()=>K(t),disabled:k===t.id,class:`text-gray-500 hover:text-blue-600 text-xs disabled:opacity-50`,title:d(`common.duplicate`),"aria-label":d(`common.duplicate`),children:k===t.id?`…`:l(x,{size:14,"aria-hidden":`true`})})}),l(y,{perm:`profile:delete`,children:l(`button`,{onClick:()=>G(t.id,t.name),class:`text-red-500 hover:text-red-700 text-xs`,title:d(`common.delete`),"aria-label":d(`common.delete`),children:l(i,{size:14,"aria-hidden":`true`})})})]})}}],emptyText:d(`profiles.empty`)})]})}export{k as ProfileList};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{t as e}from"./x-
|
|
1
|
+
import{t as e}from"./x-Clw5rGTJ.js";import{A as t,M as n,S as r,_ as i,h as a,k as o,o as s}from"./index-D7qdwIxs.js";import{t as c}from"./profiles-Jb6uV-0U.js";import{t as l}from"./Select-C7q2vevu.js";var u={name:`git-compare`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]};u.node;var d=i(u);function f(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=n-1;a>=0;a--)for(let n=r-1;n>=0;n--)i[a][n]=e[a]===t[n]?i[a+1][n+1]+1:Math.max(i[a+1][n],i[a][n+1]);let a=[],o=0,s=0;for(;o<n&&s<r;)e[o]===t[s]?(a.push({type:`same`,line:e[o]}),o++,s++):i[o+1][s]>=i[o][s+1]?(a.push({type:`del`,line:e[o]}),o++):(a.push({type:`add`,line:t[s]}),s++);for(;o<n;)a.push({type:`del`,line:e[o]}),o++;for(;s<r;)a.push({type:`add`,line:t[s]}),s++;return a}function p(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/("(?:\\u[a-fA-F0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(?:true|false)\b|\bnull\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g,e=>{let t=`#fcd34d`;return/^"/.test(e)?t=/:\s*$/.test(e)?`#7dd3fc`:`#86efac`:e===`true`||e===`false`?t=`#c4b5fd`:e===`null`&&(t=`#9ca3af`),`<span style="color:${t}">${e}</span>`})}function m({id:i,current:u,initialVersion:m,compareVersion:h}){let[g,_]=o(``);s(`Version History — ${g||i}`);let[v,y]=o([]),[b,x]=o(null),[S,C]=o(`default`),[w,T]=o(null),[E,D]=o(!0),[O,k]=o(!1),[A,j]=o(!1),[M,N]=o(h!==void 0),[P,F]=o(h??null),[I,L]=o(null),[R,z]=o(!1);t(()=>{c.get(i).then(e=>_(e.name)).catch(()=>j(!0)),c.listVersions(i).then(e=>{y(e);let t=m!==void 0&&e.some(e=>e.version===m)?m:e[0]?.version;if(t!==void 0&&x(t),h!==void 0&&!e.some(e=>e.version===h)){let n=e.findIndex(e=>e.version===t);F(e[n+1]?.version??null)}}).catch(()=>{}).finally(()=>D(!1))},[i]),t(()=>{b!==null&&(k(!0),c.getVersion(i,String(b),S).then(e=>T(JSON.stringify(e,null,2))).catch(()=>T(null)).finally(()=>k(!1)))},[i,b,S]),t(()=>{!M||P===null?L(null):(z(!0),c.getVersion(i,String(P),S).then(e=>L(JSON.stringify(e,null,2))).catch(()=>L(null)).finally(()=>z(!1)))},[i,P,S,M]);let B=v.find(e=>e.version===b),V=B?[`default`,...B.locales.filter(e=>e!=="default")].map(e=>({value:e,label:e})):[{value:`default`,label:`default`}],H=v.filter(e=>e.version!==b).map(e=>({value:String(e.version),label:`v${e.version} — ${new Date(e.createdAt).toLocaleDateString()}`})),U=()=>{N(e=>{let t=!e;if(t&&P===null){let e=v.findIndex(e=>e.version===b);F(v[e+1]?.version??null)}return t})},W=w!==null&&I!==null?f(I.split(`
|
|
2
2
|
`),w.split(`
|
|
3
3
|
`)):null;return r(n,{children:[r(`div`,{class:`mb-4`,children:r(`a`,{href:A?`#/banners/profiles/archived`:`#/banners/profiles/${i}`,class:`inline-flex items-center gap-1 text-sm text-gray-500 hover:text-gray-700 transition-colors`,children:[r(a,{size:14,"aria-hidden":`true`}),A?`Back to archived profiles`:`Back to profile`]})}),E?r(`div`,{class:`text-sm text-gray-400`,children:`Loading…`}):v.length===0?r(`div`,{class:`text-sm text-gray-400`,children:`No version files found. Versions are written when a profile is saved with file storage enabled.`}):r(`div`,{class:`flex gap-0 h-[calc(100vh-10rem)] border border-gray-200 rounded-lg overflow-hidden`,children:[r(`aside`,{class:`w-32 shrink-0 border-r border-gray-200 bg-gray-50 overflow-y-auto`,children:[r(`div`,{class:`px-3 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wide border-b border-gray-200`,children:`Versions`}),r(`ul`,{children:v.map(e=>r(`li`,{children:r(`button`,{type:`button`,onClick:()=>{x(e.version),C(`default`),P===e.version&&F(null)},class:`w-full text-left px-3 py-2.5 text-sm transition-colors ${b===e.version?`bg-blue-600 text-white`:`text-gray-700 hover:bg-gray-100`}`,children:[r(`div`,{class:`font-mono font-semibold`,children:[`v`,e.version]}),r(`div`,{class:`text-[10px] mt-0.5 ${b===e.version?`text-blue-200`:`text-gray-400`}`,children:new Date(e.createdAt).toLocaleDateString()})]})},e.version))})]}),r(`div`,{class:`flex-1 flex flex-col overflow-hidden`,children:[b!==null&&r(`div`,{class:`flex items-center gap-3 px-4 py-2.5 border-b border-gray-200 bg-white flex-wrap`,children:[r(`span`,{class:`text-sm font-mono font-medium text-gray-700`,children:[`v`,b]}),r(`div`,{class:`w-48`,children:r(l,{options:V,value:S,onChange:e=>C(e),placeholder:`Select locale…`})}),r(`button`,{type:`button`,onClick:U,disabled:v.length<2,class:`flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded-md transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${M?`bg-blue-600 text-white`:`text-gray-600 hover:bg-gray-100 border border-gray-200`}`,title:v.length<2?`Need at least two versions to compare`:`Compare with another version`,children:[r(d,{size:13,"aria-hidden":`true`}),` Compare`]}),M&&r(n,{children:[r(`span`,{class:`text-xs text-gray-400`,children:`vs`}),r(`div`,{class:`w-48`,children:r(l,{options:H,value:P===null?``:String(P),onChange:e=>F(Number(e)),placeholder:`Compare against…`})}),r(`button`,{type:`button`,onClick:()=>{N(!1),F(null)},class:`text-gray-400 hover:text-gray-700`,"aria-label":`Close compare`,title:`Close compare`,children:r(e,{size:14,"aria-hidden":`true`})})]})]}),r(`div`,{class:`flex-1 overflow-auto bg-gray-950 p-4`,children:O||M&&R?r(`span`,{class:`text-gray-400 text-sm`,children:`Loading…`}):w===null?r(`span`,{class:`text-gray-500 text-sm`,children:`File not found for this version/locale.`}):M?P===null?r(`span`,{class:`text-gray-500 text-sm`,children:`Pick a version to compare against.`}):I===null?r(`span`,{class:`text-gray-500 text-sm`,children:[`File not found for v`,P,` at this locale.`]}):W&&W.every(e=>e.type===`same`)?r(`span`,{class:`text-gray-500 text-sm`,children:[`No differences between v`,P,` and v`,b,` for this locale.`]}):r(`div`,{class:`text-xs font-mono leading-relaxed`,children:W.map((e,t)=>r(`div`,{class:`px-2 whitespace-pre-wrap ${e.type===`add`?`bg-green-900/30`:e.type===`del`?`bg-red-900/30`:``}`,children:[r(`span`,{class:`select-none mr-2 ${e.type===`add`?`text-green-500`:e.type===`del`?`text-red-500`:`text-gray-600`}`,children:e.type===`add`?`+`:e.type===`del`?`-`:` `}),r(`span`,{dangerouslySetInnerHTML:{__html:p(e.line)}})]},t))}):r(`pre`,{class:`text-xs text-gray-200 whitespace-pre-wrap font-mono leading-relaxed`,dangerouslySetInnerHTML:{__html:p(w)}})})]})]})]})}export{m as ProfileVersionHistory};
|
package/dist/dashboard/assets/{RecordDetailModal-hpJgK02E.js → RecordDetailModal-4OyHjtux.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./x-
|
|
1
|
+
import{t as e}from"./x-Clw5rGTJ.js";import{A as t,D as n,S as r,s as i,v as a}from"./index-D7qdwIxs.js";var o=`record-detail-title`;function s({open:s,title:c,fields:l,onClose:u}){let d=i(),f=n(null),p=n(null);return t(()=>{if(!s)return;f.current?.focus();let e=e=>{if(e.key===`Escape`){u();return}if(e.key!==`Tab`)return;let t=p.current;if(!t)return;let n=Array.from(t.querySelectorAll(`button, [href], input, [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`disabled`));if(!n.length)return;let r=n[0],i=n[n.length-1];e.shiftKey?document.activeElement===r&&(e.preventDefault(),i.focus()):document.activeElement===i&&(e.preventDefault(),r.focus())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[s,u]),s?a(r(`div`,{class:`fixed inset-0 z-50 flex items-center justify-center`,children:[r(`div`,{class:`absolute inset-0 bg-black/40`,onClick:u,"aria-hidden":`true`}),r(`div`,{ref:p,role:`dialog`,"aria-modal":`true`,"aria-labelledby":o,class:`relative bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-lg mx-4 max-h-[85vh] flex flex-col`,children:[r(`div`,{class:`flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700 shrink-0`,children:[r(`h3`,{id:o,class:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:c}),r(`button`,{ref:f,type:`button`,onClick:u,"aria-label":d(`common.close`),class:`text-gray-400 hover:text-gray-600 dark:hover:text-gray-200`,children:r(e,{size:18,"aria-hidden":`true`})})]}),r(`dl`,{class:`px-6 py-4 space-y-3 overflow-y-auto`,children:l.map(e=>r(`div`,{children:[r(`dt`,{class:`text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide`,children:e.label}),r(`dd`,{class:`text-sm text-gray-800 dark:text-gray-200 mt-0.5 break-words`,children:e.value})]},e.label))})]})]}),document.body):null}function c({value:e}){return e==null?r(`span`,{class:`text-gray-400`,children:`—`}):r(`pre`,{class:`text-xs bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded p-2 overflow-x-auto`,children:JSON.stringify(e,null,2)})}export{s as n,c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,E as t,M as n,S as r,a as i,i as a,k as o,n as s,o as c,r as l,s as u,w as d}from"./index-
|
|
1
|
+
import{A as e,E as t,M as n,S as r,a as i,i as a,k as o,n as s,o as c,r as l,s as u,w as d}from"./index-D7qdwIxs.js";var f={optIn:(e={})=>{let n=new URLSearchParams;e.profileId&&n.set(`profileId`,e.profileId),e.complianceGroup&&n.set(`complianceGroup`,e.complianceGroup),e.from&&n.set(`from`,e.from),e.to&&n.set(`to`,e.to),e.locale&&n.set(`locale`,e.locale);let r=n.toString();return t(`/analytics/opt-in${r?`?${r}`:``}`)}};function p({current:t}){let p=u();c(p(`reports.title`));let[m,h]=o(null),[g,_]=o(null),[v,y]=o(``),[b,x]=o(``),[S,C]=o(!0),w=()=>{C(!0);let e={};v&&(e.from=v),b&&(e.to=b),Promise.all([s.categories().then(h).catch(()=>{}),f.optIn(e).then(_).catch(()=>{})]).finally(()=>C(!1))};e(()=>{w()},[]);let T=m?Object.entries(m).map(([e,t])=>({label:e,granted:t.granted,denied:t.denied,objected:t.objected})):[],E=g?Object.entries(g.byLocale).map(([e,t])=>({label:e,granted:t.granted,denied:t.denied,objected:t.managed})):[],D=g?g.byDate.map(e=>({date:e.date,count:e.total})):[];return r(n,{children:r(`div`,{class:`space-y-6`,children:[r(`form`,{class:`flex flex-wrap items-end gap-3 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4`,onSubmit:e=>{e.preventDefault(),w()},children:[r(`div`,{children:[r(`label`,{class:`block text-xs text-gray-500 dark:text-gray-400 mb-1`,for:`reports-from`,children:p(`reports.filters.from`)}),r(`input`,{id:`reports-from`,type:`date`,value:v,onChange:e=>y(e.target.value),class:`text-sm border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded px-2 py-1.5`})]}),r(`div`,{children:[r(`label`,{class:`block text-xs text-gray-500 dark:text-gray-400 mb-1`,for:`reports-to`,children:p(`reports.filters.to`)}),r(`input`,{id:`reports-to`,type:`date`,value:b,onChange:e=>x(e.target.value),class:`text-sm border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded px-2 py-1.5`})]}),r(`button`,{type:`submit`,class:`px-3 py-1.5 text-sm rounded bg-blue-600 text-white hover:bg-blue-700 transition-colors`,children:p(`reports.filters.apply`)}),r(`button`,{type:`button`,onClick:()=>d(`/export/consents?format=csv`),class:`ml-auto text-sm text-blue-600 dark:text-blue-400 hover:underline`,children:p(`common.exportCsv`)})]}),S?r(`p`,{role:`status`,"aria-live":`polite`,class:`text-gray-400 text-sm`,children:p(`common.loading`)}):r(n,{children:[g&&r(`div`,{class:`grid grid-cols-2 lg:grid-cols-4 gap-4`,children:[r(a,{label:p(`reports.optin.total`),value:g.total}),r(a,{label:p(`reports.optin.granted`),value:`${g.grantedPct}%`}),r(a,{label:p(`reports.optin.denied`),value:`${g.deniedPct}%`}),r(a,{label:p(`reports.optin.managed`),value:`${g.managedPct}%`})]}),r(`div`,{class:`bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-5`,children:[r(`p`,{class:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-3`,children:p(`reports.optin.byDate`)}),r(i,{data:D,ariaLabel:p(`reports.optin.byDateAria`),noDataLabel:p(`dashboard.chart.noData`)})]}),r(`div`,{class:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[r(`div`,{class:`bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-5`,children:[r(`p`,{class:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-3`,children:p(`reports.category.title`)}),r(l,{rows:T,noDataLabel:p(`dashboard.chart.noData`),grantedLabel:p(`reports.legend.granted`),deniedLabel:p(`reports.legend.denied`),objectedLabel:p(`reports.legend.objected`)})]}),r(`div`,{class:`bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-5`,children:[r(`p`,{class:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-3`,children:p(`reports.optin.byLocale`)}),r(l,{rows:E,noDataLabel:p(`dashboard.chart.noData`),grantedLabel:p(`reports.legend.granted`),deniedLabel:p(`reports.legend.denied`),objectedLabel:p(`reports.legend.managed`)})]})]})]})]})})}export{p as Reports};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./check-
|
|
1
|
+
import{t as e}from"./check-BAoHs1bd.js";import{t}from"./trash-Bfqti-Og.js";import{t as n}from"./ConfirmDialog-CJAqYRfE.js";import{t as r}from"./x-Clw5rGTJ.js";import{A as i,M as a,S as o,T as s,_ as c,k as l,o as u,s as d}from"./index-D7qdwIxs.js";import{t as f}from"./roles-ChXEt79v.js";var p={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};p.node;var m=c(p),h={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};h.node;var g=c(h),_=`role_super_admin`;function v(e){let t={};for(let n of e){let e=n.name.includes(`:`)?n.name.split(`:`)[0]:`other`;(t[e]??=[]).push(n)}return Object.entries(t).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({group:e,items:t}))}function y({initial:t,onSave:n,onCancel:i,saving:a}){let s=d(),[c,u]=l(t?.name??``),[f,p]=l(t?.description??``),m=!c.trim();return o(`form`,{onSubmit:e=>{e.preventDefault(),!m&&n(c.trim(),f.trim())},class:`border border-blue-200 bg-blue-50 rounded-lg p-3 space-y-2`,children:[o(`div`,{children:[o(`label`,{for:`role-name`,class:`block text-xs font-medium text-gray-600 mb-0.5`,children:[s(`roles.form.roleNameLabel`),` `,o(`span`,{class:`text-red-500`,"aria-hidden":`true`,children:`*`})]}),o(`input`,{id:`role-name`,class:`w-full border rounded px-2 py-1.5 text-sm ${m?`border-red-300 bg-red-50`:`border-gray-300 bg-white`}`,value:c,onInput:e=>u(e.target.value),placeholder:s(`roles.form.roleNamePlaceholder`),autoFocus:!0,required:!0,"aria-required":`true`,"aria-invalid":m}),m&&o(`p`,{role:`alert`,class:`text-xs text-red-500 mt-0.5`,children:s(`common.required`)})]}),o(`div`,{children:[o(`label`,{for:`role-desc`,class:`block text-xs font-medium text-gray-600 mb-0.5`,children:s(`roles.form.descriptionLabel`)}),o(`input`,{id:`role-desc`,class:`w-full border border-gray-300 bg-white rounded px-2 py-1.5 text-sm`,value:f,onInput:e=>p(e.target.value),placeholder:s(`roles.form.descriptionPlaceholder`)})]}),o(`div`,{class:`flex gap-2 pt-1`,children:[o(`button`,{type:`submit`,disabled:a||m,class:`flex items-center gap-1.5 px-3 py-1.5 bg-blue-600 text-white text-xs font-medium rounded hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:[o(e,{size:12,"aria-hidden":`true`}),` `,s(a?`common.saving`:`common.save`)]}),o(`button`,{type:`button`,onClick:i,class:`flex items-center gap-1.5 px-3 py-1.5 text-xs text-gray-600 hover:bg-gray-100 rounded transition-colors`,children:[o(r,{size:12,"aria-hidden":`true`}),` `,s(`common.cancel`)]})]})]})}function b({current:e}){let r=d();u(r(`roles.title`));let[c,p]=l([]),[h,b]=l([]),[x,S]=l(null),[C,w]=l([]),[T,E]=l(!0),[D,O]=l(!1),[k,A]=l(null),[j,M]=l(!1),[N,P]=l(``),{requestConfirm:F,dialog:I}=n(),L=()=>{E(!0),Promise.all([f.list(),f.allPermissions()]).then(([e,t])=>{p(e),b(t)}).catch(()=>P(r(`roles.error.load`))).finally(()=>E(!1))};i(L,[]);let R=e=>{k!==e.id&&(S(e),f.permissions(e.id).then(w).catch(()=>{}))},z=async e=>{if(!x)return;let t=C.some(t=>t.id===e.id);try{t?(await f.revokePermission(x.id,e.id),w(t=>t.filter(t=>t.id!==e.id))):(await f.assignPermission(x.id,e.id),w(t=>[...t,e]))}catch(e){P(s(e,r(`roles.error.perm`)))}},B=async(e,t)=>{M(!0),P(``);try{let n=await f.create({name:e,description:t||void 0});O(!1),L(),S(n),f.permissions(n.id).then(w).catch(()=>{})}catch(e){P(s(e,r(`roles.error.create`)))}finally{M(!1)}},V=async(e,t,n)=>{M(!0),P(``);try{await f.update(e,{name:t,description:n||void 0}),A(null),L(),x?.id===e&&S(e=>e&&{...e,name:t,description:n})}catch(e){P(s(e,r(`roles.error.update`)))}finally{M(!1)}},H=async e=>{if(await F({title:r(`roles.dialog.delete.title`,{name:e.name}),message:r(`roles.dialog.delete.message`)}))try{await f.delete(e.id),x?.id===e.id&&(S(null),w([])),L()}catch(e){P(s(e,r(`roles.error.delete`)))}},U=v(h);return o(a,{children:[I,N&&o(`p`,{role:`alert`,class:`text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2 mb-4`,children:N}),T?o(`p`,{role:`status`,"aria-live":`polite`,class:`text-gray-400 text-sm`,children:r(`common.loading`)}):o(`div`,{class:`grid grid-cols-1 md:grid-cols-[280px_1fr] gap-6 items-start`,children:[o(`div`,{children:[o(`div`,{class:`flex items-center justify-between mb-2`,children:[o(`h2`,{class:`text-sm font-semibold text-gray-700`,children:r(`roles.list.heading`)}),o(`button`,{onClick:()=>{O(!0),A(null)},class:`flex items-center gap-1 text-xs text-blue-600 hover:underline`,children:[o(g,{size:12,"aria-hidden":`true`}),` `,r(`common.newRole`)]})]}),o(`div`,{class:`space-y-2`,children:[D&&o(y,{onSave:B,onCancel:()=>O(!1),saving:j}),c.map(e=>{let n=x?.id===e.id;if(k===e.id)return o(y,{initial:{name:e.name,description:e.description??``},onSave:(t,n)=>V(e.id,t,n),onCancel:()=>A(null),saving:j},e.id);let i=e.id===_;return o(`div`,{class:`group flex items-start gap-2 px-3 py-2.5 rounded-lg border text-sm transition-colors cursor-pointer ${n?`border-blue-500 bg-blue-50`:`border-gray-200 bg-white hover:border-gray-300`}`,onClick:()=>R(e),role:`button`,tabIndex:0,onKeyDown:t=>t.key===`Enter`&&R(e),"aria-pressed":n,children:[o(`div`,{class:`flex-1 min-w-0`,children:[o(`p`,{class:`font-medium ${n?`text-blue-700`:`text-gray-700`}`,children:e.name}),e.description&&o(`p`,{class:`text-xs text-gray-400 mt-0.5 truncate`,children:e.description})]}),i?o(`span`,{class:`shrink-0 text-xs text-gray-400 mt-0.5`,title:r(`roles.superAdminLocked`),children:r(`common.locked`)}):o(`div`,{class:`flex gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity mt-0.5`,children:[o(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),A(e.id),O(!1)},class:`p-1 text-gray-400 hover:text-blue-600 rounded transition-colors`,"aria-label":r(`roles.aria.editRole`),title:r(`roles.aria.editRole`),children:o(m,{size:13,"aria-hidden":`true`})}),o(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),H(e)},class:`p-1 text-gray-400 hover:text-red-600 rounded transition-colors`,"aria-label":r(`roles.aria.deleteRole`),title:r(`roles.aria.deleteRole`),children:o(t,{size:13,"aria-hidden":`true`})})]})]},e.id)}),c.length===0&&!D&&o(`p`,{class:`text-sm text-gray-400 text-center py-6`,children:r(`roles.list.empty`)})]})]}),o(`div`,{children:[o(`h2`,{class:`text-sm font-semibold text-gray-700 mb-2`,children:x?r(`roles.perms.heading`,{name:x.name}):r(`roles.perms.selectPrompt`)}),x?o(`div`,{class:`space-y-4`,children:[x.id===_&&o(`p`,{class:`text-xs text-amber-700 bg-amber-50 border border-amber-200 rounded px-3 py-2`,children:r(`roles.superAdminLocked`)}),U.map(({group:e,items:t})=>o(`div`,{class:`bg-white border border-gray-200 rounded-lg overflow-hidden`,children:[o(`div`,{class:`px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between`,children:[o(`span`,{class:`text-xs font-semibold text-gray-600 uppercase tracking-wide`,children:e}),x.id!==_&&o(`div`,{class:`flex gap-2`,children:o(`button`,{type:`button`,class:`text-xs text-blue-600 hover:underline`,onClick:()=>{(t.every(e=>C.some(t=>t.id===e.id))?t.filter(e=>C.some(t=>t.id===e.id)):t.filter(e=>!C.some(t=>t.id===e.id))).forEach(e=>z(e))},children:t.every(e=>C.some(t=>t.id===e.id))?r(`common.revokeAll`):r(`common.grantAll`)})})]}),o(`div`,{class:`divide-y divide-gray-50`,children:t.map(e=>{let t=C.some(t=>t.id===e.id);return o(`label`,{class:`flex items-center gap-3 px-4 py-2.5 transition-colors ${x.id===_?`cursor-not-allowed opacity-70`:`hover:bg-gray-50 cursor-pointer`}`,children:[o(`input`,{type:`checkbox`,checked:t,disabled:x.id===_,onChange:()=>z(e),class:`w-4 h-4 accent-blue-600 rounded shrink-0`}),o(`div`,{class:`min-w-0`,children:[o(`p`,{class:`text-sm font-medium text-gray-700 font-mono`,children:e.name}),e.description&&o(`p`,{class:`text-xs text-gray-400 mt-0.5`,children:e.description})]}),t&&o(`span`,{class:`ml-auto shrink-0 text-xs text-green-600 bg-green-50 px-1.5 py-0.5 rounded-full`,children:r(`common.granted`)})]},e.id)})})]},e)),h.length===0&&o(`p`,{class:`text-sm text-gray-400`,children:r(`roles.perms.noPerms`)})]}):o(`div`,{class:`bg-white border border-gray-200 rounded-lg p-8 text-center`,children:o(`p`,{class:`text-sm text-gray-400`,children:r(`roles.perms.clickPrompt`)})})]})]})]})}export{b as RoleList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./search-
|
|
1
|
+
import{t as e}from"./search-B05qPv24.js";import{A as t,D as n,S as r,g as i,k as a}from"./index-D7qdwIxs.js";function o({options:o,value:s,onChange:c,placeholder:l=`Select…`,searchable:u,disabled:d,id:f,class:p}){let[m,h]=a(!1),[g,_]=a(``),v=n(null),y=n(null),b=o.find(e=>e.value===s),x=g?o.filter(e=>e.label.toLowerCase().includes(g.toLowerCase())||e.value.toLowerCase().includes(g.toLowerCase())):o;return t(()=>{m&&u&&setTimeout(()=>y.current?.focus(),10),m||_(``)},[m,u]),t(()=>{let e=e=>{v.current&&!v.current.contains(e.target)&&h(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),r(`div`,{ref:v,class:`relative ${p??``}`,children:[r(`button`,{id:f,type:`button`,disabled:d,onClick:()=>h(e=>!e),onKeyDown:e=>{e.key===`Escape`&&h(!1),e.key===`Enter`&&!m&&h(!0)},class:`w-full flex items-center justify-between gap-2 border border-gray-300 rounded px-3 py-2 text-sm bg-white text-left ${d?`opacity-50 cursor-not-allowed`:`cursor-pointer hover:border-gray-400`}`,"aria-haspopup":`listbox`,"aria-expanded":m,children:[r(`span`,{class:b?`text-gray-900`:`text-gray-400`,children:b?.label??l}),r(i,{size:14,className:`shrink-0 text-gray-400 transition-transform ${m?`rotate-180`:``}`,"aria-hidden":`true`})]}),m&&r(`div`,{class:`absolute z-50 mt-1 w-full bg-white border border-gray-200 rounded shadow-lg max-h-56 flex flex-col`,role:`listbox`,children:[u&&r(`div`,{class:`px-2 pt-2 pb-1 border-b border-gray-100`,children:r(`div`,{class:`flex items-center gap-1.5 border border-gray-300 rounded px-2 py-1`,children:[r(e,{size:12,className:`text-gray-400 shrink-0`,"aria-hidden":`true`}),r(`input`,{ref:y,type:`text`,class:`flex-1 text-sm outline-none bg-transparent`,placeholder:`Search…`,value:g,onInput:e=>_(e.target.value),"aria-label":`Search options`})]})}),r(`ul`,{class:`overflow-y-auto flex-1`,children:[x.length===0&&r(`li`,{class:`px-3 py-2 text-sm text-gray-400`,children:`No results`}),x.map(e=>r(`li`,{role:`option`,"aria-selected":e.value===s,onClick:()=>{c(e.value),h(!1)},class:`px-3 py-2 text-sm cursor-pointer transition-colors ${e.value===s?`bg-blue-50 text-blue-700 font-medium`:`hover:bg-gray-50 text-gray-700`}`,children:e.label},e.value))]})]})]})}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,M as t,S as n,k as r,o as i,s as a,w as o,x as s}from"./index-
|
|
1
|
+
import{A as e,M as t,S as n,k as r,o as i,s as a,w as o,x as s}from"./index-D7qdwIxs.js";function c({current:c}){let{user:l}=s(),u=a();i(u(`settings.title`));let[d]=r(!0);return e(()=>{},[]),n(t,{children:n(`div`,{class:`max-w-2xl space-y-4`,children:[n(`div`,{class:`bg-white rounded-lg border border-gray-200 p-5`,children:[n(`h2`,{class:`text-sm font-semibold text-gray-700 mb-3`,children:u(`settings.account.heading`)}),n(`div`,{class:`space-y-2 text-sm text-gray-600`,children:[n(`p`,{children:[n(`span`,{class:`font-medium`,children:u(`settings.account.email`)}),` `,l?.email]}),n(`p`,{children:[n(`span`,{class:`font-medium`,children:u(`settings.account.roles`)}),` `,l?.roles.join(`, `)]}),n(`p`,{children:[n(`span`,{class:`font-medium`,children:u(`settings.account.id`)}),` `,n(`span`,{class:`font-mono`,children:l?.sub})]})]}),n(`div`,{class:`mt-4 pt-4 border-t border-gray-100`,children:n(`a`,{href:`#/settings/change-password`,class:`text-sm text-blue-600 hover:underline`,children:u(`settings.account.changePassword`)})})]}),n(`div`,{class:`bg-white rounded-lg border border-gray-200 p-5`,children:[n(`h2`,{class:`text-sm font-semibold text-gray-700 mb-2`,children:u(`settings.export.heading`)}),n(`p`,{class:`text-xs text-gray-500 mb-3`,children:u(`settings.export.hint`)}),n(`div`,{class:`flex flex-wrap gap-3`,children:[n(`button`,{onClick:()=>o(`/export/consents?format=csv`),class:`text-sm text-blue-600 hover:underline`,children:u(`settings.export.consentCsv`)}),n(`button`,{onClick:()=>o(`/export/consents/xlsx`),class:`text-sm text-blue-600 hover:underline`,children:u(`settings.export.consentXlsx`)}),n(`button`,{onClick:()=>o(`/export/consents?format=json`),class:`text-sm text-blue-600 hover:underline`,children:u(`settings.export.consentJson`)}),n(`button`,{onClick:()=>o(`/export/audit?format=csv`),class:`text-sm text-blue-600 hover:underline`,children:u(`settings.export.auditCsv`)})]})]}),n(`div`,{class:`bg-white rounded-lg border border-gray-200 p-5`,children:[n(`h2`,{class:`text-sm font-semibold text-gray-700 mb-2`,children:u(`settings.about.heading`)}),n(`p`,{class:`text-xs text-gray-500`,children:[u(`settings.about.text`),n(`br`,{}),u(`settings.about.license`)]})]})]})})}export{c as Settings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./check-
|
|
1
|
+
import{t as e}from"./check-BAoHs1bd.js";import{t}from"./external-link-CFayXpKz.js";import{A as n,S as r,T as i,g as a,k as o,m as s,s as c,t as l,y as u}from"./index-D7qdwIxs.js";var d=[`welcome`,`config`,`profiles`,`confirmation`];function f({step:e}){return r(`div`,{class:`flex items-center justify-center gap-2 mb-8`,children:d.map((t,n)=>{let i=n+1;return r(`div`,{class:`h-2 rounded-full transition-all ${e>i?`w-2 bg-green-500`:e===i?`w-6 bg-blue-600`:`w-2 bg-gray-200`}`},t)})})}function p({value:e}){return e==null?r(`span`,{class:`text-gray-400`,children:`—`}):Array.isArray(e)?e.length?r(`span`,{class:`text-gray-700`,children:e.map(String).join(`, `)}):r(`span`,{class:`text-gray-400`,children:`—`}):typeof e==`object`?r(`div`,{class:`pl-3 border-l-2 border-gray-100 space-y-1 mt-1`,children:Object.entries(e).map(([e,t])=>r(`div`,{class:`flex flex-wrap items-baseline gap-x-2 text-xs`,children:[r(`span`,{class:`text-gray-500 font-medium`,children:e}),r(p,{value:t})]},e))}):r(`span`,{class:`text-gray-700`,children:String(e)})}function m({title:e,value:t}){return r(`div`,{class:`border border-gray-200 rounded-lg p-4`,children:[r(`p`,{class:`text-sm font-semibold text-gray-800 mb-2`,children:e}),r(p,{value:t})]})}function h({mode:e}){return r(`span`,{class:`text-[11px] px-1.5 py-0.5 rounded ${e===`strict`?`bg-red-100 text-red-700`:e===`honor`?`bg-amber-100 text-amber-700`:`bg-gray-100 text-gray-600`}`,children:[`GPC: `,e]})}function g({group:e,checked:t,onToggle:n}){let[i,c]=o(!1);return r(`div`,{class:`border border-gray-200 rounded-lg overflow-hidden`,children:[r(`div`,{class:`flex items-center gap-3 p-3 bg-white`,children:[r(`input`,{type:`checkbox`,checked:t,onChange:n,class:`w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500`,"aria-label":e.label}),r(`button`,{type:`button`,onClick:()=>c(e=>!e),class:`flex-1 flex items-center justify-between text-left`,children:[r(`span`,{class:`text-sm font-medium text-gray-800`,children:e.label}),r(i?a:s,{size:16,class:`text-gray-400`})]})]}),i&&r(`div`,{class:`px-3 pb-3 pt-0 bg-gray-50 border-t border-gray-100`,children:[r(`p`,{class:`text-xs text-gray-600 leading-relaxed mb-2`,children:e.description}),r(`div`,{class:`flex flex-wrap gap-1.5`,children:[r(h,{mode:e.defaultGpc}),e.allowsTcf&&r(`span`,{class:`text-[11px] px-1.5 py-0.5 rounded bg-blue-100 text-blue-700`,children:`TCF`}),e.requiresCpraCategory&&r(`span`,{class:`text-[11px] px-1.5 py-0.5 rounded bg-orange-100 text-orange-700`,children:`CPRA categories`}),e.requiresDpdpaDisclosure&&r(`span`,{class:`text-[11px] px-1.5 py-0.5 rounded bg-violet-100 text-violet-700`,children:`DPDPA disclosure`}),e.allowsLegitimateInterest&&r(`span`,{class:`text-[11px] px-1.5 py-0.5 rounded bg-green-100 text-green-700`,children:`Legitimate interest`})]})]})]})}function _({onComplete:a}){let s=c(),{appName:d,appLogoPath:p}=u(),[h,_]=o(1),[v,y]=o(null),[b,x]=o([]),[S,C]=o(new Set),[w,T]=o(0),[E,D]=o(!1),[O,k]=o(``);n(()=>{l.config().then(y).catch(()=>{}),l.complianceGroups().then(e=>{x(e),C(new Set(e.map(e=>e.id)))}).catch(()=>{})},[]);let A=async e=>{D(!0);try{await l.complete()}catch{}finally{a(),window.location.hash=e}},j=e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},M=()=>{C(e=>e.size===b.length?new Set:new Set(b.map(e=>e.id)))},N=async()=>{D(!0),k(``);try{let e=[...S];if(e.length>0){let{seeded:t}=await l.seedProfiles(e);T(t.length)}else T(0);_(4)}catch(e){k(i(e,s(`setupWizard.profiles.error`)))}finally{D(!1)}};return r(`div`,{class:`min-h-screen bg-gray-50 flex flex-col items-center justify-center p-4`,children:r(`div`,{class:`bg-white rounded-xl shadow-sm border border-gray-200 p-8 w-full max-w-2xl`,children:[p&&r(`img`,{src:p,alt:d,class:`h-10 w-auto mx-auto mb-6 object-contain`}),r(f,{step:h}),h===1&&r(`div`,{class:`text-center`,children:[r(`h1`,{class:`text-xl font-bold text-gray-900 mb-2`,children:s(`setupWizard.welcome.title`,{appName:d})}),r(`p`,{class:`text-sm text-gray-500 leading-relaxed mb-6 max-w-md mx-auto`,children:s(`setupWizard.welcome.body`)}),r(`div`,{class:`flex items-center justify-center gap-4 mb-8 text-sm`,children:[r(`a`,{href:`https://consenti.dev/docs?utm_source=dashboard&utm_medium=setup-wizard&utm_campaign=consenti-api`,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center gap-1 text-blue-600 hover:text-blue-800 hover:underline`,children:[s(`setupWizard.welcome.docsLink`),` `,r(t,{size:12,"aria-hidden":`true`})]}),r(`a`,{href:`#/how-it-works`,class:`text-blue-600 hover:text-blue-800 hover:underline`,children:s(`setupWizard.welcome.howItWorksLink`)})]}),r(`button`,{type:`button`,onClick:()=>_(2),class:`w-full bg-blue-600 text-white rounded-lg px-4 py-2.5 text-sm font-medium hover:bg-blue-700 transition-colors`,children:s(`setupWizard.welcome.getStarted`)})]}),h===2&&r(`div`,{children:[r(`h2`,{class:`text-lg font-semibold text-gray-900 mb-1`,children:s(`setupWizard.config.title`)}),r(`p`,{class:`text-sm text-gray-500 mb-5`,children:s(`setupWizard.config.subtitle`)}),v?r(`div`,{class:`space-y-3 max-h-96 overflow-y-auto pr-1`,children:Object.entries(v.config).map(([e,t])=>r(m,{title:e,value:t},e))}):r(`p`,{class:`text-sm text-gray-400`,children:s(`common.loading`)}),r(`div`,{class:`flex items-center justify-between mt-6`,children:[r(`button`,{type:`button`,onClick:()=>_(1),class:`text-sm text-gray-500 hover:text-gray-700`,children:s(`setupWizard.back`)}),r(`button`,{type:`button`,onClick:()=>_(3),class:`bg-blue-600 text-white rounded-lg px-4 py-2.5 text-sm font-medium hover:bg-blue-700 transition-colors`,children:s(`setupWizard.continue`)})]})]}),h===3&&r(`div`,{children:[r(`h2`,{class:`text-lg font-semibold text-gray-900 mb-1`,children:s(`setupWizard.profiles.title`)}),r(`p`,{class:`text-sm text-gray-500 mb-4`,children:s(`setupWizard.profiles.subtitle`)}),r(`label`,{class:`flex items-center gap-2 mb-3 text-sm text-gray-700`,children:[r(`input`,{type:`checkbox`,checked:S.size===b.length&&b.length>0,onChange:M,class:`w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500`}),s(`setupWizard.profiles.selectAll`)]}),r(`div`,{class:`space-y-2 max-h-80 overflow-y-auto pr-1`,children:b.map(e=>r(g,{group:e,checked:S.has(e.id),onToggle:()=>j(e.id)},e.id))}),O&&r(`p`,{role:`alert`,class:`text-sm text-red-600 mt-3`,children:O}),r(`div`,{class:`flex items-center justify-between mt-6`,children:[r(`button`,{type:`button`,onClick:()=>_(2),class:`text-sm text-gray-500 hover:text-gray-700`,children:s(`setupWizard.back`)}),r(`button`,{type:`button`,disabled:E,onClick:()=>void N(),class:`bg-blue-600 text-white rounded-lg px-4 py-2.5 text-sm font-medium hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:E?s(`common.saving`):S.size>0?s(`setupWizard.profiles.installAndContinue`):s(`setupWizard.profiles.skipAndContinue`)})]})]}),h===4&&r(`div`,{class:`text-center`,children:[r(`div`,{class:`w-12 h-12 rounded-full bg-green-100 text-green-600 flex items-center justify-center mx-auto mb-4`,children:r(e,{size:24,"aria-hidden":`true`})}),r(`h1`,{class:`text-xl font-bold text-gray-900 mb-2`,children:s(`setupWizard.confirmation.title`)}),r(`p`,{class:`text-sm text-gray-500 mb-6`,children:w>0?s(`setupWizard.confirmation.seededSummary`,{count:w}):s(`setupWizard.confirmation.noneSeeded`)}),v&&(v.usingJsonStorage||v.usingDefaultCredentials)&&r(`div`,{class:`text-left bg-amber-50 border border-amber-200 rounded-lg p-4 mb-6`,children:[r(`p`,{class:`text-xs font-semibold text-amber-800 mb-2`,children:s(`setupWizard.confirmation.readinessTitle`)}),r(`ul`,{class:`space-y-1 text-xs text-amber-700 list-disc list-inside`,children:[v.usingJsonStorage&&r(`li`,{children:s(`setupWizard.confirmation.readinessJsonStorage`)}),v.usingDefaultCredentials&&r(`li`,{children:s(`setupWizard.confirmation.readinessDefaultCredentials`)})]})]}),r(`div`,{class:`flex items-center justify-center gap-3`,children:[r(`button`,{type:`button`,disabled:E,onClick:()=>void A(`#/how-it-works`),class:`border border-gray-300 text-gray-700 rounded-lg px-4 py-2.5 text-sm font-medium hover:bg-gray-50 disabled:opacity-50 transition-colors`,children:s(`setupWizard.confirmation.howItWorks`)}),r(`button`,{type:`button`,disabled:E,onClick:()=>void A(`#/`),class:`bg-blue-600 text-white rounded-lg px-4 py-2.5 text-sm font-medium hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:s(`setupWizard.confirmation.goToDashboard`)})]})]})]})})}export{_ as SetupWizard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./search-
|
|
1
|
+
import{t as e}from"./search-B05qPv24.js";import{O as t,S as n,k as r,s as i}from"./index-D7qdwIxs.js";function a({columns:a,rows:o,keyFn:s,loading:c,emptyText:l,search:u,filters:d}){let f=i(),p=l??f(`common.noData`),[m,h]=r(``),[g,_]=r({}),v=t(()=>{let e=o;if(u&&m.trim()){let t=m.trim().toLowerCase();e=e.filter(e=>u.keys(e).some(e=>e?.toLowerCase().includes(t)))}return d&&d.forEach((t,n)=>{let r=g[n];r&&(e=e.filter(e=>t.predicate(e,r)))}),e},[o,m,g,u,d]);if(c)return n(`div`,{role:`status`,"aria-live":`polite`,class:`flex items-center justify-center py-12 text-gray-400 dark:text-gray-500 text-sm`,children:f(`common.loading`)});let y=!!u||d&&d.length>0;return n(`div`,{children:[y&&n(`div`,{class:`flex flex-wrap items-center gap-2 mb-3`,children:[u&&n(`div`,{class:`relative flex-1 min-w-[200px] max-w-sm`,children:[n(e,{size:14,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400`,"aria-hidden":`true`}),n(`input`,{type:`search`,value:m,onInput:e=>h(e.target.value),placeholder:u.placeholder??f(`common.search`),"aria-label":u.placeholder??f(`common.search`),class:`w-full pl-8 pr-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200`})]}),d?.map((e,t)=>n(`select`,{value:g[t]??``,onChange:e=>_(n=>({...n,[t]:e.target.value})),"aria-label":e.label,class:`text-sm border border-gray-300 dark:border-gray-600 rounded-lg px-2.5 py-1.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200`,children:[n(`option`,{value:``,children:e.label}),e.options.map(e=>n(`option`,{value:e.value,children:e.label},e.value))]},e.label))]}),n(`div`,{class:`overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800`,children:n(`table`,{class:`min-w-full text-sm`,children:[n(`thead`,{children:n(`tr`,{class:`bg-gray-50 dark:bg-gray-700/50 border-b border-gray-200 dark:border-gray-700`,children:a.map(e=>n(`th`,{scope:`col`,class:`px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide`,children:e.label},e.key))})}),n(`tbody`,{children:v.length===0?n(`tr`,{children:n(`td`,{colSpan:a.length,class:`px-4 py-8 text-center text-gray-400 dark:text-gray-500`,children:o.length===0?p:f(`common.noResults`)})}):v.map(e=>n(`tr`,{class:`border-b border-gray-100 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/40 transition-colors`,children:a.map(t=>n(`td`,{class:`px-4 py-3 text-gray-700 dark:text-gray-300`,children:t.render?t.render(e):String(e[t.key]??``)},t.key))},s(e)))})]})})]})}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./ConfirmDialog-
|
|
1
|
+
import{t as e}from"./ConfirmDialog-CJAqYRfE.js";import{A as t,E as n,M as r,S as i,T as a,k as o,o as s,s as c}from"./index-D7qdwIxs.js";import{t as l}from"./Table-C59yMXY2.js";function u({current:u}){let d=c();s(d(`sites.title`));let[f,p]=o([]),[m,h]=o(!0),[g,_]=o(!1),[v,y]=o(``),[b,x]=o(``),[S,C]=o(``),{requestConfirm:w,dialog:T}=e(),E=()=>{h(!0),n(`/tenants`).then(p).catch(()=>{}).finally(()=>h(!1))};t(()=>{E()},[]);let D=async()=>{if(v.trim()&&b.trim()){_(!0),C(``);try{await n(`/tenants`,{method:`POST`,body:JSON.stringify({name:v.trim(),slug:b.trim()})}),y(``),x(``),E()}catch(e){C(a(e,d(`sites.error.create`)))}finally{_(!1)}}},O=async(e,t)=>{await w({title:d(`sites.dialog.delete.title`,{name:t}),message:d(`sites.dialog.delete.message`)})&&(await n(`/tenants/${e}`,{method:`DELETE`}).catch(()=>{}),E())};return i(r,{children:[T,i(`div`,{class:`mb-4 bg-white rounded-lg border border-gray-200 p-4`,children:[i(`p`,{class:`text-sm font-medium text-gray-700 mb-3`,children:d(`sites.createNew`)}),i(`div`,{class:`flex gap-2 flex-wrap`,children:[i(`input`,{type:`text`,placeholder:d(`sites.namePlaceholder`),value:v,onInput:e=>y(e.target.value),class:`border border-gray-300 rounded px-3 py-1.5 text-sm w-40`,"aria-label":d(`sites.namePlaceholder`)}),i(`input`,{type:`text`,placeholder:d(`sites.slugPlaceholder`),value:b,onInput:e=>x(e.target.value),class:`border border-gray-300 rounded px-3 py-1.5 text-sm w-40`,"aria-label":d(`sites.slugPlaceholder`)}),i(`button`,{onClick:D,disabled:g,class:`bg-blue-600 text-white text-sm px-3 py-1.5 rounded hover:bg-blue-700 disabled:opacity-50`,children:d(`common.create`)})]}),S&&i(`p`,{class:`text-sm text-red-600 mt-2`,children:S})]}),i(l,{loading:m,keyFn:e=>e.id,rows:f,columns:[{key:`name`,label:d(`sites.col.name`)},{key:`slug`,label:d(`sites.col.slug`),render:e=>i(`span`,{class:`font-mono text-xs`,children:e.slug})},{key:`id`,label:d(`sites.col.id`),render:e=>i(`span`,{class:`font-mono text-xs text-gray-400`,children:e.id})},{key:`createdAt`,label:d(`sites.col.created`),render:e=>new Date(e.createdAt).toLocaleDateString()},{key:`actions`,label:``,render:e=>{let t=e;return t.id==="default"?i(`span`,{class:`text-xs text-gray-400`,children:d(`common.default`)}):i(`button`,{onClick:()=>O(t.id,t.name),class:`text-xs text-red-500 hover:underline`,children:d(`common.delete`)})}}],emptyText:d(`sites.empty`)})]})}export{u as TenantList};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"./HeadingTagInput-7owwn9Vj.js";import{t as n}from"./PreviewPane-Czax39la.js";import{t as r}from"./ConfirmDialog-sMBVcbiI.js";import{t as i}from"./x-CtCy0YcJ.js";import{A as a,M as o,S as s,T as c,_ as l,k as u,l as d,o as f,p,s as m,u as h}from"./index-BaYVhd1M.js";import{n as g}from"./templates-DLMsZs7d.js";import{a as _,c as v,d as y,f as b,l as x,r as S,u as C}from"./templates-CIyMjskA.js";var w={name:`eraser`,size:24,node:[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]};w.node;var T=l(w),E={name:`focus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}]]};E.node;var D=l(E),O={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};O.node;var k=l(O),A={name:`heading`,size:24,node:[[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M6 20V4`,key:`1w1bmo`}],[`path`,{d:`M18 20V4`,key:`o2hl4u`}]]};A.node;var j=l(A),M={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};M.node;var N=l(M);function P({value:e,onChange:t}){return s(`div`,{class:`flex items-center gap-3`,children:[s(`input`,{type:`range`,min:`0`,max:`100`,class:`flex-1 h-1.5 rounded-full appearance-none bg-gray-200 accent-blue-600 cursor-pointer`,value:e,onInput:e=>t(parseInt(e.target.value))}),s(`span`,{class:`text-sm font-mono text-gray-700 w-10 text-right shrink-0`,children:[e,`%`]})]})}var F=[`primary`,`secondary`,`accent`,`text`],I=[`custom`,`submit`,`manage`,`close`,`link`],L={primary:`Primary`,secondary:`Secondary`,accent:`Accent`,text:`Text`},R={custom:`Custom (grant)`,submit:`Submit (save toggles)`,manage:`Manage (open modal)`,close:`Close (dismiss)`,link:`Link (open URL)`},z={custom:`Grants exactly the selected cookies below. Mandatory cookies are always granted regardless of this selection.`,submit:`Submits whatever consent already exists — the live toggle states in this modal, or mandatory-only in a banner. Ignores cookie selection entirely; two "submit" buttons always produce the same result no matter their labels.`,manage:`Opens the preference modal. Does not change consent by itself.`,close:`Dismisses without saving any consent.`,link:`Opens the URL below in a new tab. Does not change consent.`};function B({btn:t,onChange:n,onRemove:r,extraCookies:i}){let a=(e,r)=>n({...t,[e]:r}),o=!t.id.trim(),c=t.action===`link`&&!t.url?.trim();return s(`div`,{class:`border border-gray-100 rounded p-2.5 bg-gray-50 space-y-2`,children:s(`div`,{class:`grid grid-cols-[1fr_1fr_1fr_2fr_auto] gap-2 items-start`,children:[s(`div`,{children:[s(`label`,{class:`block text-xs text-gray-500 mb-0.5`,children:[`Button ID `,s(`span`,{class:`text-red-500`,children:`*`})]}),s(`input`,{class:`w-full border rounded px-2 py-1 text-xs font-mono ${o?`border-red-300 bg-red-50`:`border-gray-300`}`,value:t.id,onInput:e=>a(`id`,e.target.value),placeholder:`accept-all`}),o?s(`p`,{class:`text-xs text-red-500 mt-0.5`,children:`Required`}):s(`p`,{class:`text-xs text-gray-400 mt-0.5`,children:`Machine id, not display text — text is authored per-locale in the profile.`})]}),s(`div`,{children:[s(`label`,{class:`block text-xs text-gray-500 mb-0.5`,children:`Style`}),s(`select`,{class:`w-full border border-gray-300 rounded px-2 py-1 text-xs`,value:t.type,onChange:e=>a(`type`,e.target.value),children:F.map(e=>s(`option`,{value:e,children:L[e]},e))})]}),s(`div`,{children:[s(`label`,{class:`block text-xs text-gray-500 mb-0.5`,children:`Action`}),s(`select`,{class:`w-full border border-gray-300 rounded px-2 py-1 text-xs`,value:t.action,onChange:e=>{let r=e.target.value;n({...t,action:r,cookies:r===`custom`?t.cookies??`*`:void 0,url:r===`link`?t.url??``:void 0,type:r===`link`&&t.type!==`text`?`text`:t.type})},children:I.map(e=>s(`option`,{value:e,children:R[e]},e))}),s(`p`,{class:`text-xs text-gray-400 mt-0.5`,children:z[t.action]})]}),t.action===`custom`?s(`div`,{children:[s(`label`,{class:`block text-xs text-gray-500 mb-0.5`,children:[`Cookies to grant `,s(`span`,{class:`text-red-500`,children:`*`})]}),s(e,{value:t.cookies,onChange:e=>a(`cookies`,e),showSpecial:!0,extraCookies:i}),!t.cookies&&s(`p`,{class:`text-xs text-red-500 mt-0.5`,children:`Required for custom action`})]}):t.action===`link`?s(`div`,{children:[s(`label`,{class:`block text-xs text-gray-500 mb-0.5`,children:[`URL `,s(`span`,{class:`text-red-500`,children:`*`})]}),s(`input`,{type:`url`,class:`w-full border rounded px-2 py-1 text-xs ${c?`border-red-300 bg-red-50`:`border-gray-300`}`,value:t.url??``,onInput:e=>a(`url`,e.target.value),placeholder:`https://example.com/privacy`}),c&&s(`p`,{class:`text-xs text-red-500 mt-0.5`,children:`Required for link action`})]}):s(`div`,{}),s(`div`,{class:`flex items-end pb-0.5`,children:s(`button`,{type:`button`,onClick:r,class:`text-red-400 hover:text-red-600 text-lg leading-none p-0.5`,title:`Remove button`,children:`✕`})})]})})}function V({buttons:e,onChange:t,cookieOptions:n}){return s(`div`,{class:`space-y-2`,children:[e.map((r,i)=>s(B,{btn:r,onChange:n=>t(e.map((e,t)=>t===i?n:e)),onRemove:()=>t(e.filter((e,t)=>t!==i)),extraCookies:n},i)),s(`button`,{type:`button`,onClick:()=>t([...e,{id:``,type:`primary`,action:`custom`,cookies:`*`}]),class:`text-xs text-blue-600 hover:underline`,children:`+ Add Button`})]})}var H=[`top`,`bottom`,`middle`,`left-bottom`,`right-bottom`];function U({label:e,value:n,onChange:r,cookieOptions:a}){let o=m(),c=(e,t)=>r({...n,[e]:t});return s(`div`,{class:`space-y-5`,children:[e&&s(`p`,{class:`text-xs text-gray-500 italic`,children:e}),s(`div`,{class:`grid grid-cols-2 lg:grid-cols-3 gap-4`,children:[s(`div`,{children:[s(`label`,{class:`block text-xs font-medium text-gray-600 mb-1`,children:[`Position `,s(`span`,{class:`text-red-500`,children:`*`})]}),s(`select`,{class:`w-full border border-gray-300 rounded px-2 py-1.5 text-sm`,value:n.position,onChange:e=>c(`position`,e.target.value),children:H.map(e=>s(`option`,{value:e,children:e},e))})]}),s(t,{value:n.headingTag,onChange:e=>c(`headingTag`,e)}),s(`div`,{children:[s(`label`,{class:`block text-xs font-medium text-gray-600 mb-1`,children:`Overlay opacity`}),s(P,{value:n.overlayOpacity,onChange:e=>c(`overlayOpacity`,e)}),s(`p`,{class:`text-xs text-gray-400 mt-0.5`,children:`0% = transparent (page still interactive) · 100% = darkened`})]}),s(`div`,{children:[s(`label`,{class:`block text-xs font-medium text-gray-600 mb-1`,children:o(`uiTemplates.editor.stackButtonsOnBreakpoint`)}),s(`input`,{type:`number`,min:`0`,max:`2560`,class:`w-full border border-gray-300 rounded px-2 py-1.5 text-sm`,value:n.stackButtonsOnBreakpoint??576,onChange:e=>c(`stackButtonsOnBreakpoint`,parseInt(e.target.value,10)||0)}),s(`p`,{class:`text-xs text-gray-400 mt-0.5`,children:o(`uiTemplates.editor.stackButtonsOnBreakpointHint`)})]}),s(`div`,{class:`flex flex-col justify-center gap-4 pb-1`,children:[s(`label`,{class:`flex items-center gap-2 text-xs font-medium text-gray-600 cursor-pointer`,children:[s(`input`,{type:`checkbox`,class:`w-4 h-4`,checked:n.showClose,onChange:e=>c(`showClose`,e.target.checked)}),`Show `,s(i,{size:10,className:`inline-block mx-0.5`}),` close button`]}),s(`label`,{class:`flex items-center gap-2 text-xs font-medium text-gray-600 cursor-pointer`,children:[s(`input`,{type:`checkbox`,class:`w-4 h-4`,checked:n.showLocaleSwitcher??!1,onChange:e=>c(`showLocaleSwitcher`,e.target.checked)}),`🌐 Show locale switcher`]})]}),s(`div`,{class:`flex items-center pb-1`})]}),s(`div`,{children:[s(`h4`,{class:`text-xs font-semibold text-gray-600 mb-2 uppercase tracking-wide`,children:`Buttons`}),s(V,{buttons:n.buttons,onChange:e=>c(`buttons`,e),cookieOptions:a})]})]})}var W=[`left`,`right`,`center`];function G({value:e,onChange:n,cookieOptions:r}){let a=m(),o=(t,r)=>n({...e,[t]:r});return s(`div`,{class:`space-y-5`,children:[s(`div`,{class:`grid grid-cols-2 lg:grid-cols-3 gap-4`,children:[s(`div`,{children:[s(`label`,{class:`block text-xs font-medium text-gray-600 mb-1`,children:[`Position `,s(`span`,{class:`text-red-500`,children:`*`})]}),s(`select`,{class:`w-full border border-gray-300 rounded px-2 py-1.5 text-sm`,value:e.position,onChange:e=>o(`position`,e.target.value),children:W.map(e=>s(`option`,{value:e,children:e},e))})]}),s(t,{value:e.headingTag,onChange:e=>o(`headingTag`,e)}),s(`div`,{children:[s(`label`,{class:`block text-xs font-medium text-gray-600 mb-1`,children:`Overlay opacity`}),s(P,{value:e.overlayOpacity,onChange:e=>o(`overlayOpacity`,e)}),s(`p`,{class:`text-xs text-gray-400 mt-0.5`,children:`0% = transparent (page still interactive) · 100% = darkened`})]}),[[`showClose`,s(`span`,{class:`flex items-center gap-1`,children:[`Show `,s(i,{size:10}),` close button`]})],[`showLocaleSwitcher`,`🌐 Show locale switcher`],[`showForgetMe`,a(`uiTemplates.editor.showForgetMe`)],[`persistent`,`Persistent (block outside-click dismiss)`],[`hasSubheading`,`Include subheading field`],[`trapFocus`,a(`uiTemplates.editor.trapFocus`)]].map(([t,n])=>s(`label`,{class:`flex items-center gap-2 text-xs font-medium text-gray-600 cursor-pointer`,title:t===`trapFocus`?a(`uiTemplates.editor.trapFocusHint`):t===`showForgetMe`?a(`uiTemplates.editor.showForgetMeHint`):void 0,children:[s(`input`,{type:`checkbox`,class:`w-4 h-4`,checked:e[t],onChange:e=>o(t,e.target.checked)}),n]},t))]}),s(`div`,{children:[s(`h4`,{class:`text-xs font-semibold text-gray-600 mb-2 uppercase tracking-wide`,children:`Buttons`}),s(V,{buttons:e.buttons,onChange:e=>o(`buttons`,e),cookieOptions:r})]})]})}var K=[{key:`headingTag`,Icon:j,label:`uiTemplates.editor.fieldInfo.headingTag.label`,description:`uiTemplates.editor.fieldInfo.headingTag.description`,highlights:`uiTemplates.editor.fieldInfo.headingTag.highlights`},{key:`style`,Icon:d,label:`uiTemplates.editor.fieldInfo.style.label`,description:`uiTemplates.editor.fieldInfo.style.description`,highlights:`uiTemplates.editor.fieldInfo.style.highlights`},{key:`action`,Icon:N,label:`uiTemplates.editor.fieldInfo.action.label`,description:`uiTemplates.editor.fieldInfo.action.description`,highlights:`uiTemplates.editor.fieldInfo.action.highlights`},{key:`cookies`,Icon:p,label:`uiTemplates.editor.fieldInfo.cookies.label`,description:`uiTemplates.editor.fieldInfo.cookies.description`,highlights:`uiTemplates.editor.fieldInfo.cookies.highlights`},{key:`trapFocus`,Icon:D,label:`uiTemplates.editor.fieldInfo.trapFocus.label`,description:`uiTemplates.editor.fieldInfo.trapFocus.description`,highlights:`uiTemplates.editor.fieldInfo.trapFocus.highlights`},{key:`buttonId`,Icon:k,label:`uiTemplates.editor.fieldInfo.buttonId.label`,description:`uiTemplates.editor.fieldInfo.buttonId.description`,highlights:`uiTemplates.editor.fieldInfo.buttonId.highlights`},{key:`localeSwitcher`,Icon:h,label:`uiTemplates.editor.fieldInfo.localeSwitcher.label`,description:`uiTemplates.editor.fieldInfo.localeSwitcher.description`,highlights:`uiTemplates.editor.fieldInfo.localeSwitcher.highlights`},{key:`forgetMe`,Icon:T,label:`uiTemplates.editor.fieldInfo.forgetMe.label`,description:`uiTemplates.editor.fieldInfo.forgetMe.description`,highlights:`uiTemplates.editor.fieldInfo.forgetMe.highlights`}];function q({t:e}){let[t,n]=u(0),r=K[t];return s(`div`,{class:`bg-white border border-gray-200 rounded-lg p-5 xl:sticky xl:top-4`,children:[s(`p`,{class:`text-xs text-gray-400 mb-3 uppercase tracking-wide font-semibold`,children:e(`uiTemplates.editor.fieldInfo.title`)}),s(`div`,{class:`flex flex-wrap gap-1.5 mb-4`,children:K.map((r,i)=>s(`button`,{type:`button`,onClick:()=>n(i),class:`text-xs px-2.5 py-1 rounded-full border transition-colors ${t===i?`bg-blue-600 text-white border-blue-600`:`border-gray-300 text-gray-600 hover:border-blue-400`}`,children:e(r.label)},r.key))}),s(`div`,{class:`space-y-2`,children:[s(`div`,{class:`flex items-center gap-2`,children:[s(r.Icon,{size:18,className:`text-gray-600 shrink-0`}),s(`h4`,{class:`font-semibold text-gray-800 text-sm`,children:e(r.label)})]}),s(`p`,{class:`text-xs text-gray-600 leading-relaxed`,children:e(r.description)}),s(`ul`,{class:`list-disc list-inside space-y-1`,children:e(r.highlights).split(`
|
|
1
|
+
import{n as e,t}from"./HeadingTagInput-DGKZYLTR.js";import{t as n}from"./PreviewPane-ArCfR0c9.js";import{t as r}from"./ConfirmDialog-CJAqYRfE.js";import{t as i}from"./x-Clw5rGTJ.js";import{A as a,M as o,S as s,T as c,_ as l,k as u,l as d,o as f,p,s as m,u as h}from"./index-D7qdwIxs.js";import{n as g}from"./templates-DalUjETH.js";import{a as _,c as v,d as y,f as b,l as x,r as S,u as C}from"./templates-CIyMjskA.js";var w={name:`eraser`,size:24,node:[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]};w.node;var T=l(w),E={name:`focus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}]]};E.node;var D=l(E),O={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};O.node;var k=l(O),A={name:`heading`,size:24,node:[[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M6 20V4`,key:`1w1bmo`}],[`path`,{d:`M18 20V4`,key:`o2hl4u`}]]};A.node;var j=l(A),M={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};M.node;var N=l(M);function P({value:e,onChange:t}){return s(`div`,{class:`flex items-center gap-3`,children:[s(`input`,{type:`range`,min:`0`,max:`100`,class:`flex-1 h-1.5 rounded-full appearance-none bg-gray-200 accent-blue-600 cursor-pointer`,value:e,onInput:e=>t(parseInt(e.target.value))}),s(`span`,{class:`text-sm font-mono text-gray-700 w-10 text-right shrink-0`,children:[e,`%`]})]})}var F=[`primary`,`secondary`,`accent`,`text`],I=[`custom`,`submit`,`manage`,`close`,`link`],L={primary:`Primary`,secondary:`Secondary`,accent:`Accent`,text:`Text`},R={custom:`Custom (grant)`,submit:`Submit (save toggles)`,manage:`Manage (open modal)`,close:`Close (dismiss)`,link:`Link (open URL)`},z={custom:`Grants exactly the selected cookies below. Mandatory cookies are always granted regardless of this selection.`,submit:`Submits whatever consent already exists — the live toggle states in this modal, or mandatory-only in a banner. Ignores cookie selection entirely; two "submit" buttons always produce the same result no matter their labels.`,manage:`Opens the preference modal. Does not change consent by itself.`,close:`Dismisses without saving any consent.`,link:`Opens the URL below in a new tab. Does not change consent.`};function B({btn:t,onChange:n,onRemove:r,extraCookies:i}){let a=(e,r)=>n({...t,[e]:r}),o=!t.id.trim(),c=t.action===`link`&&!t.url?.trim();return s(`div`,{class:`border border-gray-100 rounded p-2.5 bg-gray-50 space-y-2`,children:s(`div`,{class:`grid grid-cols-[1fr_1fr_1fr_2fr_auto] gap-2 items-start`,children:[s(`div`,{children:[s(`label`,{class:`block text-xs text-gray-500 mb-0.5`,children:[`Button ID `,s(`span`,{class:`text-red-500`,children:`*`})]}),s(`input`,{class:`w-full border rounded px-2 py-1 text-xs font-mono ${o?`border-red-300 bg-red-50`:`border-gray-300`}`,value:t.id,onInput:e=>a(`id`,e.target.value),placeholder:`accept-all`}),o?s(`p`,{class:`text-xs text-red-500 mt-0.5`,children:`Required`}):s(`p`,{class:`text-xs text-gray-400 mt-0.5`,children:`Machine id, not display text — text is authored per-locale in the profile.`})]}),s(`div`,{children:[s(`label`,{class:`block text-xs text-gray-500 mb-0.5`,children:`Style`}),s(`select`,{class:`w-full border border-gray-300 rounded px-2 py-1 text-xs`,value:t.type,onChange:e=>a(`type`,e.target.value),children:F.map(e=>s(`option`,{value:e,children:L[e]},e))})]}),s(`div`,{children:[s(`label`,{class:`block text-xs text-gray-500 mb-0.5`,children:`Action`}),s(`select`,{class:`w-full border border-gray-300 rounded px-2 py-1 text-xs`,value:t.action,onChange:e=>{let r=e.target.value;n({...t,action:r,cookies:r===`custom`?t.cookies??`*`:void 0,url:r===`link`?t.url??``:void 0,type:r===`link`&&t.type!==`text`?`text`:t.type})},children:I.map(e=>s(`option`,{value:e,children:R[e]},e))}),s(`p`,{class:`text-xs text-gray-400 mt-0.5`,children:z[t.action]})]}),t.action===`custom`?s(`div`,{children:[s(`label`,{class:`block text-xs text-gray-500 mb-0.5`,children:[`Cookies to grant `,s(`span`,{class:`text-red-500`,children:`*`})]}),s(e,{value:t.cookies,onChange:e=>a(`cookies`,e),showSpecial:!0,extraCookies:i}),!t.cookies&&s(`p`,{class:`text-xs text-red-500 mt-0.5`,children:`Required for custom action`})]}):t.action===`link`?s(`div`,{children:[s(`label`,{class:`block text-xs text-gray-500 mb-0.5`,children:[`URL `,s(`span`,{class:`text-red-500`,children:`*`})]}),s(`input`,{type:`url`,class:`w-full border rounded px-2 py-1 text-xs ${c?`border-red-300 bg-red-50`:`border-gray-300`}`,value:t.url??``,onInput:e=>a(`url`,e.target.value),placeholder:`https://example.com/privacy`}),c&&s(`p`,{class:`text-xs text-red-500 mt-0.5`,children:`Required for link action`})]}):s(`div`,{}),s(`div`,{class:`flex items-end pb-0.5`,children:s(`button`,{type:`button`,onClick:r,class:`text-red-400 hover:text-red-600 text-lg leading-none p-0.5`,title:`Remove button`,children:`✕`})})]})})}function V({buttons:e,onChange:t,cookieOptions:n}){return s(`div`,{class:`space-y-2`,children:[e.map((r,i)=>s(B,{btn:r,onChange:n=>t(e.map((e,t)=>t===i?n:e)),onRemove:()=>t(e.filter((e,t)=>t!==i)),extraCookies:n},i)),s(`button`,{type:`button`,onClick:()=>t([...e,{id:``,type:`primary`,action:`custom`,cookies:`*`}]),class:`text-xs text-blue-600 hover:underline`,children:`+ Add Button`})]})}var H=[`top`,`bottom`,`middle`,`left-bottom`,`right-bottom`];function U({label:e,value:n,onChange:r,cookieOptions:a}){let o=m(),c=(e,t)=>r({...n,[e]:t});return s(`div`,{class:`space-y-5`,children:[e&&s(`p`,{class:`text-xs text-gray-500 italic`,children:e}),s(`div`,{class:`grid grid-cols-2 lg:grid-cols-3 gap-4`,children:[s(`div`,{children:[s(`label`,{class:`block text-xs font-medium text-gray-600 mb-1`,children:[`Position `,s(`span`,{class:`text-red-500`,children:`*`})]}),s(`select`,{class:`w-full border border-gray-300 rounded px-2 py-1.5 text-sm`,value:n.position,onChange:e=>c(`position`,e.target.value),children:H.map(e=>s(`option`,{value:e,children:e},e))})]}),s(t,{value:n.headingTag,onChange:e=>c(`headingTag`,e)}),s(`div`,{children:[s(`label`,{class:`block text-xs font-medium text-gray-600 mb-1`,children:`Overlay opacity`}),s(P,{value:n.overlayOpacity,onChange:e=>c(`overlayOpacity`,e)}),s(`p`,{class:`text-xs text-gray-400 mt-0.5`,children:`0% = transparent (page still interactive) · 100% = darkened`})]}),s(`div`,{children:[s(`label`,{class:`block text-xs font-medium text-gray-600 mb-1`,children:o(`uiTemplates.editor.stackButtonsOnBreakpoint`)}),s(`input`,{type:`number`,min:`0`,max:`2560`,class:`w-full border border-gray-300 rounded px-2 py-1.5 text-sm`,value:n.stackButtonsOnBreakpoint??576,onChange:e=>c(`stackButtonsOnBreakpoint`,parseInt(e.target.value,10)||0)}),s(`p`,{class:`text-xs text-gray-400 mt-0.5`,children:o(`uiTemplates.editor.stackButtonsOnBreakpointHint`)})]}),s(`div`,{class:`flex flex-col justify-center gap-4 pb-1`,children:[s(`label`,{class:`flex items-center gap-2 text-xs font-medium text-gray-600 cursor-pointer`,children:[s(`input`,{type:`checkbox`,class:`w-4 h-4`,checked:n.showClose,onChange:e=>c(`showClose`,e.target.checked)}),`Show `,s(i,{size:10,className:`inline-block mx-0.5`}),` close button`]}),s(`label`,{class:`flex items-center gap-2 text-xs font-medium text-gray-600 cursor-pointer`,children:[s(`input`,{type:`checkbox`,class:`w-4 h-4`,checked:n.showLocaleSwitcher??!1,onChange:e=>c(`showLocaleSwitcher`,e.target.checked)}),`🌐 Show locale switcher`]})]}),s(`div`,{class:`flex items-center pb-1`})]}),s(`div`,{children:[s(`h4`,{class:`text-xs font-semibold text-gray-600 mb-2 uppercase tracking-wide`,children:`Buttons`}),s(V,{buttons:n.buttons,onChange:e=>c(`buttons`,e),cookieOptions:a})]})]})}var W=[`left`,`right`,`center`];function G({value:e,onChange:n,cookieOptions:r}){let a=m(),o=(t,r)=>n({...e,[t]:r});return s(`div`,{class:`space-y-5`,children:[s(`div`,{class:`grid grid-cols-2 lg:grid-cols-3 gap-4`,children:[s(`div`,{children:[s(`label`,{class:`block text-xs font-medium text-gray-600 mb-1`,children:[`Position `,s(`span`,{class:`text-red-500`,children:`*`})]}),s(`select`,{class:`w-full border border-gray-300 rounded px-2 py-1.5 text-sm`,value:e.position,onChange:e=>o(`position`,e.target.value),children:W.map(e=>s(`option`,{value:e,children:e},e))})]}),s(t,{value:e.headingTag,onChange:e=>o(`headingTag`,e)}),s(`div`,{children:[s(`label`,{class:`block text-xs font-medium text-gray-600 mb-1`,children:`Overlay opacity`}),s(P,{value:e.overlayOpacity,onChange:e=>o(`overlayOpacity`,e)}),s(`p`,{class:`text-xs text-gray-400 mt-0.5`,children:`0% = transparent (page still interactive) · 100% = darkened`})]}),[[`showClose`,s(`span`,{class:`flex items-center gap-1`,children:[`Show `,s(i,{size:10}),` close button`]})],[`showLocaleSwitcher`,`🌐 Show locale switcher`],[`showForgetMe`,a(`uiTemplates.editor.showForgetMe`)],[`persistent`,`Persistent (block outside-click dismiss)`],[`hasSubheading`,`Include subheading field`],[`trapFocus`,a(`uiTemplates.editor.trapFocus`)]].map(([t,n])=>s(`label`,{class:`flex items-center gap-2 text-xs font-medium text-gray-600 cursor-pointer`,title:t===`trapFocus`?a(`uiTemplates.editor.trapFocusHint`):t===`showForgetMe`?a(`uiTemplates.editor.showForgetMeHint`):void 0,children:[s(`input`,{type:`checkbox`,class:`w-4 h-4`,checked:e[t],onChange:e=>o(t,e.target.checked)}),n]},t))]}),s(`div`,{children:[s(`h4`,{class:`text-xs font-semibold text-gray-600 mb-2 uppercase tracking-wide`,children:`Buttons`}),s(V,{buttons:e.buttons,onChange:e=>o(`buttons`,e),cookieOptions:r})]})]})}var K=[{key:`headingTag`,Icon:j,label:`uiTemplates.editor.fieldInfo.headingTag.label`,description:`uiTemplates.editor.fieldInfo.headingTag.description`,highlights:`uiTemplates.editor.fieldInfo.headingTag.highlights`},{key:`style`,Icon:d,label:`uiTemplates.editor.fieldInfo.style.label`,description:`uiTemplates.editor.fieldInfo.style.description`,highlights:`uiTemplates.editor.fieldInfo.style.highlights`},{key:`action`,Icon:N,label:`uiTemplates.editor.fieldInfo.action.label`,description:`uiTemplates.editor.fieldInfo.action.description`,highlights:`uiTemplates.editor.fieldInfo.action.highlights`},{key:`cookies`,Icon:p,label:`uiTemplates.editor.fieldInfo.cookies.label`,description:`uiTemplates.editor.fieldInfo.cookies.description`,highlights:`uiTemplates.editor.fieldInfo.cookies.highlights`},{key:`trapFocus`,Icon:D,label:`uiTemplates.editor.fieldInfo.trapFocus.label`,description:`uiTemplates.editor.fieldInfo.trapFocus.description`,highlights:`uiTemplates.editor.fieldInfo.trapFocus.highlights`},{key:`buttonId`,Icon:k,label:`uiTemplates.editor.fieldInfo.buttonId.label`,description:`uiTemplates.editor.fieldInfo.buttonId.description`,highlights:`uiTemplates.editor.fieldInfo.buttonId.highlights`},{key:`localeSwitcher`,Icon:h,label:`uiTemplates.editor.fieldInfo.localeSwitcher.label`,description:`uiTemplates.editor.fieldInfo.localeSwitcher.description`,highlights:`uiTemplates.editor.fieldInfo.localeSwitcher.highlights`},{key:`forgetMe`,Icon:T,label:`uiTemplates.editor.fieldInfo.forgetMe.label`,description:`uiTemplates.editor.fieldInfo.forgetMe.description`,highlights:`uiTemplates.editor.fieldInfo.forgetMe.highlights`}];function q({t:e}){let[t,n]=u(0),r=K[t];return s(`div`,{class:`bg-white border border-gray-200 rounded-lg p-5 xl:sticky xl:top-4`,children:[s(`p`,{class:`text-xs text-gray-400 mb-3 uppercase tracking-wide font-semibold`,children:e(`uiTemplates.editor.fieldInfo.title`)}),s(`div`,{class:`flex flex-wrap gap-1.5 mb-4`,children:K.map((r,i)=>s(`button`,{type:`button`,onClick:()=>n(i),class:`text-xs px-2.5 py-1 rounded-full border transition-colors ${t===i?`bg-blue-600 text-white border-blue-600`:`border-gray-300 text-gray-600 hover:border-blue-400`}`,children:e(r.label)},r.key))}),s(`div`,{class:`space-y-2`,children:[s(`div`,{class:`flex items-center gap-2`,children:[s(r.Icon,{size:18,className:`text-gray-600 shrink-0`}),s(`h4`,{class:`font-semibold text-gray-800 text-sm`,children:e(r.label)})]}),s(`p`,{class:`text-xs text-gray-600 leading-relaxed`,children:e(r.description)}),s(`ul`,{class:`list-disc list-inside space-y-1`,children:e(r.highlights).split(`
|
|
2
2
|
`).map((e,t)=>s(`li`,{class:`text-xs text-gray-600 leading-relaxed`,children:e},t))})]})]})}var J={position:`bottom`,overlayOpacity:.5,showClose:!0,headingTag:`h2`,buttons:[]},Y={position:`center`,overlayOpacity:.5,showClose:!0,persistent:!1,headingTag:`h2`,hasSubheading:!1,buttons:[]};function X(e,t,n){return e.buttons.length===0&&t.buttons.length===0&&n.buttons.length===0}function Z({id:e,current:t}){let i=m(),l=!e||e===`new`,[d,p]=u(``),[h,w]=u(``),[T,E]=u(`main`),[D,O]=u(l?J:y().mainBanner),[k,A]=u(l?J:y().gpcBanner),[j,M]=u(l?Y:y().preferenceModal),[N,P]=u(``),[F,I]=u(!1),[L,R]=u(!l);f(i(L?`uiTemplates.editor.title.edit`:l?`uiTemplates.editor.title.new`:`uiTemplates.editor.title.edit`));let{requestConfirm:z,dialog:B}=r();a(()=>{!l&&e&&g.get(e).then(e=>{p(e.name),O({...e.mainBanner,buttons:b(e.mainBanner.buttons)}),A({...e.gpcBanner,buttons:b(e.gpcBanner.buttons)}),M({...e.preferenceModal,buttons:b(e.preferenceModal.buttons)})}).catch(()=>P(i(`uiTemplates.editor.error.notFound`))).finally(()=>R(!1))},[e,l]);let V=_(x(),v(),{mainBanner:D,gpcBanner:k,preferenceModal:j},`en`,{en:C(v(),{mainBanner:D,gpcBanner:k,preferenceModal:j})},{}),H=async()=>{let t=!0;d.trim()?w(``):(w(i(`uiTemplates.editor.nameRequired`)),t=!1);let n=[...D.buttons,...k.buttons,...j.buttons];if(n.some(e=>!e.id.trim()))P(i(`uiTemplates.editor.error.buttons`));else{for(let e of[D.buttons,k.buttons,j.buttons]){let t=e.map(e=>e.id.trim());if(new Set(t).size!==t.length){P(i(`uiTemplates.editor.error.uniqueButtonIds`));return}}if(n.some(e=>e.action===`custom`&&!e.cookies))P(i(`uiTemplates.editor.error.customButtons`));else if(t){if(!l&&e){let t=await g.profileUsage(e).catch(()=>[]);if(t.length>0){let e=t.map(e=>`"${e.name}"`).join(`, `);if(!await z({title:i(t.length===1?`uiTemplates.editor.confirmUpdate.titleSingular`:`uiTemplates.editor.confirmUpdate.title`,{n:t.length}),message:i(`uiTemplates.editor.confirmUpdate.message`,{names:e})}))return}}P(``),I(!0);try{let t={name:d,mainBanner:{...D,buttons:S(D.buttons)},gpcBanner:{...k,buttons:S(k.buttons)},preferenceModal:{...j,buttons:S(j.buttons)}};l?await g.create(t):await g.update(e,t),window.location.hash=`#/banners/ui-templates`}catch(e){P(c(e,i(`uiTemplates.editor.error.failed`)))}finally{I(!1)}}}},W=[{key:`main`,label:i(`uiTemplates.editor.tabMain`)},{key:`gpc`,label:i(`uiTemplates.editor.tabGpc`)},{key:`modal`,label:i(`uiTemplates.editor.tabModal`)}],K=W.findIndex(e=>e.key===T),Z=K===0,Q=K===W.length-1;return L?s(`p`,{class:`text-sm text-gray-400`,role:`status`,"aria-live":`polite`,children:i(`uiTemplates.editor.loading`)}):s(o,{children:[B,s(`div`,{class:`space-y-5`,children:[s(`div`,{class:`bg-white border border-gray-200 rounded-lg p-5`,children:[s(`label`,{for:`ui-template-name`,class:`block text-sm font-medium text-gray-700 mb-1`,children:[i(`uiTemplates.editor.name`),` `,s(`span`,{class:`text-red-500`,"aria-hidden":`true`,children:`*`})]}),s(`input`,{id:`ui-template-name`,class:`w-full border rounded px-3 py-2 text-sm ${h?`border-red-400 bg-red-50`:`border-gray-300`}`,value:d,onInput:e=>{p(e.target.value),w(``)},placeholder:i(`uiTemplates.editor.namePlaceholder`),required:!0,"aria-required":`true`}),h&&s(`p`,{role:`alert`,class:`text-xs text-red-500 mt-1`,children:h})]}),l&&X(D,k,j)&&s(`div`,{class:`bg-amber-50 border border-amber-200 rounded-lg p-4 flex items-center justify-between gap-4`,children:[s(`p`,{class:`text-sm text-amber-800`,children:i(`uiTemplates.editor.loadDefaultsPrompt`)}),s(`button`,{type:`button`,onClick:()=>{let e=y();O(e.mainBanner),A(e.gpcBanner),M(e.preferenceModal)},class:`shrink-0 bg-amber-700 text-white text-xs px-3 py-1.5 rounded hover:bg-amber-800 transition-colors`,children:i(`uiTemplates.editor.loadDefaultsBtn`)})]}),s(`div`,{class:`grid grid-cols-1 xl:grid-cols-[2fr_1fr] gap-5 items-start`,children:[s(`div`,{class:`bg-white border border-gray-200 rounded-lg overflow-hidden`,children:[s(`div`,{class:`flex items-center border-b border-gray-200 px-5 py-3 gap-2`,children:[W.map((e,t)=>s(`div`,{class:`flex items-center gap-2`,children:[s(`span`,{class:`flex items-center justify-center w-6 h-6 rounded-full text-xs font-bold ${t===K?`bg-blue-600 text-white`:t<K?`bg-blue-100 text-blue-600`:`bg-gray-100 text-gray-400`}`,children:t+1}),s(`span`,{class:`text-sm font-medium ${t===K?`text-blue-600`:t<K?`text-blue-400`:`text-gray-400`}`,children:e.label}),t<W.length-1&&s(`span`,{class:`mx-1 text-gray-300 text-xs select-none`,children:`›`})]},e.key)),s(`span`,{class:`ml-auto text-xs text-gray-400`,children:i(`uiTemplates.editor.wizard.stepOf`,{step:K+1,total:W.length})})]}),s(`div`,{class:`p-5`,children:[T===`main`&&s(U,{label:i(`uiTemplates.editor.mainBannerHint`),value:D,onChange:O}),T===`gpc`&&s(U,{label:i(`uiTemplates.editor.gpcBannerHint`),value:k,onChange:A}),T===`modal`&&s(G,{value:j,onChange:M})]}),N&&s(`div`,{class:`px-5 pb-4`,children:s(`p`,{role:`alert`,class:`text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2`,children:N})}),s(`div`,{class:`flex items-center justify-between border-t border-gray-100 px-5 py-4`,children:[s(`div`,{class:`flex gap-2`,children:[!Z&&s(`button`,{type:`button`,onClick:()=>{Z||E(W[K-1].key)},class:`px-4 py-2 rounded-lg text-sm text-gray-600 border border-gray-300 hover:bg-gray-50 transition-colors`,children:i(`uiTemplates.editor.wizard.back`)}),s(`a`,{href:`#/banners/ui-templates`,class:`px-4 py-2 rounded-lg text-sm text-gray-500 hover:bg-gray-100 transition-colors`,children:i(`common.cancel`)})]}),s(`div`,{children:Q?s(`button`,{type:`button`,onClick:H,disabled:F,class:`bg-blue-600 text-white px-5 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:i(F?`common.saving`:l?`uiTemplates.editor.action.create`:`uiTemplates.editor.action.save`)}):s(`button`,{type:`button`,onClick:()=>{Q||E(W[K+1].key)},class:`bg-blue-600 text-white px-5 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 transition-colors`,children:i(`uiTemplates.editor.wizard.next`)})})]})]}),s(q,{t:i})]}),s(n,{draft:V,expandable:!0,previewMode:T})]})]})}export{Z as UITemplateEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./copy-
|
|
1
|
+
import{t as e}from"./copy-DjZpSOQM.js";import{t}from"./square-pen-BX2H18m3.js";import{t as n}from"./trash-Bfqti-Og.js";import{t as r}from"./ConfirmDialog-CJAqYRfE.js";import{A as i,C as a,M as o,S as s,k as c,o as l,s as u,v as d}from"./index-D7qdwIxs.js";import{t as f}from"./Table-C59yMXY2.js";import{n as p}from"./templates-DalUjETH.js";function m({current:m}){let h=u();l(h(`uiTemplates.title`));let[g,_]=c([]),[v,y]=c(!0),[b,x]=c(null),[S,C]=c(null),{requestConfirm:w,dialog:T}=r(),E=()=>{y(!0),p.list().then(_).catch(()=>_([])).finally(()=>y(!1))};i(()=>{E()},[]);let D=async(e,t)=>{if(await w({title:h(`uiTemplates.dialog.delete.title`,{name:t}),message:h(`uiTemplates.dialog.delete.message`)}))try{await p.delete(e),E()}catch(e){if(e instanceof a&&e.status===422)try{let t=JSON.parse(e.message);if(t.details?.profiles?.length){x(t.details.profiles);return}}catch{}}},O=async(e,t)=>{try{let n=await p.profileUsage(e);if(n.length>0){C({id:e,name:t,profiles:n.map(e=>({id:e.id,name:e.name,isActive:e.isActive??!1}))});return}}catch{}window.location.hash=`#/banners/ui-templates/${e}`},k=async(e,t)=>{await p.copy(e,`${t} (Copy)`).catch(()=>null),E()},A=g.length,j=h(A===1?`uiTemplates.countSingular`:`uiTemplates.count`,{n:A});return s(o,{children:[T,b&&d(s(`div`,{class:`fixed inset-0 z-50 flex items-center justify-center`,children:[s(`div`,{class:`absolute inset-0 bg-black/40`,onClick:()=>x(null),"aria-hidden":`true`}),s(`div`,{class:`relative bg-white rounded-xl shadow-2xl p-6 w-full max-w-md mx-4 space-y-4`,children:[s(`h3`,{class:`text-sm font-semibold text-gray-900`,children:`Cannot delete template`}),s(`p`,{class:`text-sm text-gray-600`,children:`This UI template is used by the following profiles. Delete or reassign those profiles first:`}),s(`ul`,{class:`space-y-1 max-h-48 overflow-y-auto`,children:b.map(e=>s(`li`,{class:`flex items-center gap-2 text-sm`,children:[s(`span`,{class:`text-xs px-1.5 py-0.5 rounded-full font-medium ${e.isActive?`bg-green-100 text-green-700`:`bg-gray-100 text-gray-500`}`,children:e.isActive?`Active`:`Inactive`}),s(`a`,{href:`#/banners/profiles/${e.id}`,class:`text-blue-600 hover:underline`,onClick:()=>x(null),children:e.name})]},e.id))}),s(`button`,{type:`button`,onClick:()=>x(null),class:`w-full border border-gray-300 text-gray-700 px-4 py-2 rounded-lg text-sm hover:bg-gray-50 transition-colors`,children:h(`common.close`)})]})]}),document.body),S&&d(s(`div`,{class:`fixed inset-0 z-50 flex items-center justify-center`,children:[s(`div`,{class:`absolute inset-0 bg-black/40`,onClick:()=>C(null),"aria-hidden":`true`}),s(`div`,{class:`relative bg-white rounded-xl shadow-2xl p-6 w-full max-w-md mx-4 space-y-4`,children:[s(`h3`,{class:`text-sm font-semibold text-gray-900`,children:`Template used in profiles`}),s(`p`,{class:`text-sm text-gray-600`,children:`This template is used in the following profiles. After editing, open and save each profile for changes to take effect in their JSON files:`}),s(`ul`,{class:`space-y-1 max-h-48 overflow-y-auto`,children:S.profiles.map(e=>s(`li`,{class:`flex items-center gap-2 text-sm`,children:[s(`span`,{class:`text-xs px-1.5 py-0.5 rounded-full font-medium ${e.isActive?`bg-green-100 text-green-700`:`bg-gray-100 text-gray-500`}`,children:e.isActive?`Active`:`Inactive`}),s(`span`,{class:`text-gray-700`,children:e.name})]},e.id))}),s(`div`,{class:`flex flex-col gap-2`,children:[s(`button`,{type:`button`,onClick:()=>{let e=S.id;C(null),window.location.hash=`#/banners/ui-templates/${e}`},class:`w-full bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 transition-colors`,children:`Continue to edit`}),s(`button`,{type:`button`,onClick:()=>C(null),class:`w-full border border-gray-300 text-gray-700 px-4 py-2 rounded-lg text-sm hover:bg-gray-50 transition-colors`,children:h(`common.cancel`)})]})]})]}),document.body),s(`div`,{class:`flex justify-between items-center mb-4`,children:[s(`p`,{class:`text-sm text-gray-500`,children:j}),s(`a`,{href:`#/banners/ui-templates/new`,class:`bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 transition-colors`,children:h(`uiTemplates.new`)})]}),s(f,{loading:v,keyFn:e=>e.id,rows:g,emptyText:h(`uiTemplates.empty.title`),search:{placeholder:h(`uiTemplates.search.placeholder`),keys:e=>[e.name]},columns:[{key:`name`,label:h(`uiTemplates.col.name`),render:e=>s(`span`,{class:`font-medium text-sm text-gray-900`,children:e.name})},{key:`positions`,label:h(`uiTemplates.col.positions`),render:e=>{let t=e;return s(`div`,{class:`flex flex-wrap gap-3 text-xs text-gray-500`,children:[s(`span`,{children:[h(`uiTemplates.mainBanner`),` `,s(`span`,{class:`text-gray-700`,children:t.mainBanner.position})]}),s(`span`,{children:[h(`uiTemplates.gpcBanner`),` `,s(`span`,{class:`text-gray-700`,children:t.gpcBanner.position})]}),s(`span`,{children:[h(`uiTemplates.modal`),` `,s(`span`,{class:`text-gray-700`,children:t.preferenceModal.position})]})]})}},{key:`buttons`,label:h(`uiTemplates.col.buttons`),render:e=>s(`div`,{class:`flex flex-wrap gap-1`,children:Object.entries(e.mainBanner.buttons).map(([e,t])=>s(`span`,{class:`text-xs px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full`,children:[t.type,`: `,e]},e))})},{key:`updatedAt`,label:h(`common.updated`),render:e=>s(`span`,{class:`text-xs text-gray-500`,children:new Date(e.updatedAt).toLocaleDateString()})},{key:`actions`,label:``,render:r=>{let i=r;return s(`div`,{class:`flex items-center gap-3 justify-end`,children:[s(`button`,{onClick:()=>k(i.id,i.name),class:`text-gray-400 hover:text-blue-600 transition-colors`,title:h(`common.duplicate`),"aria-label":h(`common.duplicate`),children:s(e,{size:14,"aria-hidden":`true`})}),s(`button`,{onClick:()=>O(i.id,i.name),class:`text-blue-600 hover:text-blue-800 transition-colors`,title:h(`common.edit`),"aria-label":h(`common.edit`),children:s(t,{size:14,"aria-hidden":`true`})}),s(`button`,{onClick:()=>D(i.id,i.name),class:`text-red-400 hover:text-red-600 transition-colors`,title:h(`common.delete`),"aria-label":h(`common.delete`),children:s(n,{size:14,"aria-hidden":`true`})})]})}}]})]})}export{m as UITemplateList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./ConfirmDialog-sMBVcbiI.js";import{A as t,E as n,M as r,S as i,T as a,d as o,f as s,k as c,o as l,s as u,x as d}from"./index-BaYVhd1M.js";import{t as ee}from"./Table-CcBP7eXS.js";import{n as te}from"./RecordDetailModal-hpJgK02E.js";import{t as f}from"./users-BLTbK4tk.js";import{t as p}from"./PermissionGate-D45f3WrO.js";import{t as m}from"./roles-DZyZwZDr.js";var h=`role_super_admin`;function g({current:g}){let{user:_}=d(),v=u();l(v(`users.title`));let[y,b]=c([]),[x,S]=c([]),[C,w]=c([]),[T,E]=c(!0),[D,O]=c(!1),[k,A]=c({name:``,email:``,password:``,confirmPassword:``,roleId:``,allowedTenants:[]}),[j,M]=c(!1),[N,P]=c(!1),[F,I]=c(``),[L,R]=c(null),[z,B]=c([]),[V,H]=c(``),[U,W]=c(``),[G,K]=c(``),[q,J]=c(!1),[Y,X]=c(null),Z=window.__CONSENTI_CONFIG__?.authMode===`local`,ne=_?.roles.includes(`super_admin`)??!1,{requestConfirm:Q,dialog:re}=e(),$=()=>{E(!0),Promise.all([f.list(),m.list(),n(`/tenants`).catch(()=>[])]).then(([e,t,n])=>{b(e),S(t),w(n)}).catch(()=>{}).finally(()=>E(!1))};t($,[]);let ie=e=>{A(t=>({...t,allowedTenants:t.allowedTenants.includes(e)?t.allowedTenants.filter(t=>t!==e):[...t.allowedTenants,e]}))},ae=async e=>{if(e.preventDefault(),k.password!==k.confirmPassword)I(v(`users.createForm.passwordMismatch`));else{I(``);try{await f.create({name:k.name,email:k.email,password:k.password,roleId:k.roleId||void 0,...k.allowedTenants.length>0?{allowedTenants:k.allowedTenants}:{}}),O(!1),A({name:``,email:``,password:``,confirmPassword:``,roleId:``,allowedTenants:[]}),M(!1),P(!1),$()}catch(e){I(a(e,v(`users.createForm.error`)))}}},oe=async(e,t)=>{await Q({title:v(`users.dialog.delete.title`,{name:t}),message:v(`users.dialog.delete.message`)})&&(await f.delete(e).catch(()=>{}),$())},se=async e=>{await f.update(e.id,{isActive:!e.isActive}).catch(()=>{}),$()},ce=e=>{R(e),B(e.allowedTenants??[]),H(``),W(``),K(``),J(!1)},le=async()=>{if(L){if(U&&U!==G)H(v(`users.createForm.passwordMismatch`));else if(U&&U.length<12)H(v(`users.edit.passwordTooShort`));else try{await f.update(L.id,{allowedTenants:z,...U?{password:U}:{}}),R(null),$()}catch(e){H(a(e,v(`users.edit.error.save`)))}}},ue=e=>{B(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};return i(r,{children:[re,i(te,{open:!!Y,title:v(`users.detail.title`),onClose:()=>X(null),fields:Y?[{label:v(`common.name`),value:Y.name},{label:v(`common.email`),value:Y.email},{label:v(`users.col.status`),value:Y.isActive?v(`users.status.active`):v(`users.status.inactive`)},{label:v(`common.created`),value:new Date(Y.createdAt).toLocaleString()},{label:v(`users.allowedSites`),value:Y.allowedTenants?.length?Y.allowedTenants.join(`, `):v(`users.detail.allSites`)}]:[]}),i(`div`,{class:`flex justify-between items-center mb-4`,children:[i(`p`,{class:`text-sm text-gray-500`,children:v(`users.count`,{n:y.length})}),i(p,{perm:`user:create`,children:i(`button`,{onClick:()=>O(!D),class:`bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 transition-colors`,children:v(D?`common.cancel`:`users.newUser`)})})]}),L&&i(`div`,{class:`fixed inset-0 z-50 flex items-center justify-center`,children:[i(`div`,{class:`absolute inset-0 bg-black/40`,onClick:()=>R(null),"aria-hidden":`true`}),i(`div`,{class:`relative bg-white rounded-xl shadow-2xl p-6 w-full max-w-sm mx-4 space-y-4`,children:[i(`h3`,{class:`text-sm font-semibold text-gray-900`,children:v(`users.edit.title`,{name:L.name})}),C.length>0&&i(`div`,{children:[i(`p`,{class:`text-xs font-medium text-gray-700 mb-1.5`,children:[v(`users.allowedSites`),i(`span`,{class:`ml-1.5 font-normal text-gray-400`,children:v(`users.allowedSitesHint`)})]}),i(`div`,{class:`flex flex-wrap gap-2`,children:C.map(e=>i(`label`,{class:`flex items-center gap-1.5 px-2.5 py-1.5 border rounded text-xs cursor-pointer select-none transition-colors ${z.includes(e.id)?`border-blue-400 bg-blue-50 text-blue-700`:`border-gray-200 text-gray-600 hover:border-gray-300`}`,children:[i(`input`,{type:`checkbox`,class:`accent-blue-600`,checked:z.includes(e.id),onChange:()=>ue(e.id)}),e.name||e.slug]},e.id))})]}),Z&&ne&&i(`div`,{children:[i(`p`,{class:`text-xs font-medium text-gray-700 mb-1.5`,children:[v(`users.edit.resetPassword`),i(`span`,{class:`ml-1.5 font-normal text-gray-400`,children:v(`users.edit.resetPasswordHint`)})]}),i(`div`,{class:`space-y-2`,children:[i(`div`,{class:`relative`,children:[i(`input`,{class:`w-full border border-gray-300 rounded px-3 py-2 pr-9 text-sm`,placeholder:v(`users.createForm.passwordPlaceholder`),"aria-label":v(`users.edit.newPassword`),type:q?`text`:`password`,value:U,onInput:e=>W(e.target.value)}),i(`button`,{type:`button`,class:`absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600`,onClick:()=>J(e=>!e),"aria-label":v(q?`common.hidePassword`:`common.showPassword`),title:v(q?`common.hidePassword`:`common.showPassword`),children:i(q?s:o,{size:15,"aria-hidden":`true`})})]}),i(`input`,{class:`w-full border border-gray-300 rounded px-3 py-2 text-sm`,placeholder:v(`users.createForm.confirmPasswordPlaceholder`),"aria-label":v(`users.edit.confirmNewPassword`),type:q?`text`:`password`,value:G,onInput:e=>K(e.target.value)})]})]}),V&&i(`p`,{class:`text-xs text-red-600`,children:V}),i(`div`,{class:`flex justify-end gap-2 pt-1`,children:[i(`button`,{type:`button`,onClick:()=>R(null),class:`px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg transition-colors`,children:`Cancel`}),i(`button`,{type:`button`,onClick:le,class:`px-4 py-2 text-sm font-medium bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:`Save`})]})]})]}),D&&i(`form`,{onSubmit:ae,class:`bg-white border border-gray-200 rounded-lg p-5 mb-4 space-y-3`,children:[i(`h3`,{class:`text-sm font-semibold text-gray-700`,children:v(`users.createForm.title`)}),i(`div`,{class:`grid grid-cols-2 gap-3`,children:[i(`input`,{class:`border border-gray-300 rounded px-3 py-2 text-sm`,placeholder:v(`users.createForm.namePlaceholder`),"aria-label":v(`common.name`),required:!0,value:k.name,onInput:e=>A(t=>({...t,name:e.target.value}))}),i(`input`,{class:`border border-gray-300 rounded px-3 py-2 text-sm`,placeholder:v(`users.createForm.emailPlaceholder`),"aria-label":v(`common.email`),type:`email`,required:!0,value:k.email,onInput:e=>A(t=>({...t,email:e.target.value}))}),i(`div`,{class:`relative`,children:[i(`input`,{class:`w-full border border-gray-300 rounded px-3 py-2 pr-9 text-sm`,placeholder:v(`users.createForm.passwordPlaceholder`),"aria-label":v(`users.createForm.passwordPlaceholder`),type:j?`text`:`password`,required:!0,value:k.password,onInput:e=>A(t=>({...t,password:e.target.value}))}),i(`button`,{type:`button`,class:`absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600`,onClick:()=>M(e=>!e),"aria-label":v(j?`common.hidePassword`:`common.showPassword`),title:v(j?`common.hidePassword`:`common.showPassword`),children:i(j?s:o,{size:15,"aria-hidden":`true`})})]}),i(`div`,{class:`relative`,children:[i(`input`,{class:`w-full border rounded px-3 py-2 pr-9 text-sm ${k.confirmPassword&&k.password!==k.confirmPassword?`border-red-300 bg-red-50`:`border-gray-300`}`,placeholder:v(`users.createForm.confirmPasswordPlaceholder`),"aria-label":v(`users.createForm.confirmPasswordPlaceholder`),type:N?`text`:`password`,required:!0,value:k.confirmPassword,onInput:e=>A(t=>({...t,confirmPassword:e.target.value}))}),i(`button`,{type:`button`,class:`absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600`,onClick:()=>P(e=>!e),"aria-label":v(N?`common.hidePassword`:`common.showPassword`),title:v(N?`common.hidePassword`:`common.showPassword`),children:i(N?s:o,{size:15,"aria-hidden":`true`})})]}),i(`select`,{class:`border border-gray-300 rounded px-3 py-2 text-sm col-span-2`,value:k.roleId,"aria-label":v(`common.roles`),onChange:e=>A(t=>({...t,roleId:e.target.value})),children:[i(`option`,{value:``,children:v(`users.createForm.selectRole`)}),x.map(e=>i(`option`,{value:e.id,children:e.name},e.id))]})]}),C.length>0&&i(`div`,{children:[i(`p`,{class:`text-xs font-medium text-gray-700 mb-1.5`,children:[v(`users.allowedSites`),i(`span`,{class:`ml-1.5 font-normal text-gray-400`,children:v(`users.allowedSitesHint`)})]}),i(`div`,{class:`flex flex-wrap gap-2`,children:C.map(e=>i(`label`,{class:`flex items-center gap-1.5 px-2.5 py-1.5 border rounded text-xs cursor-pointer select-none transition-colors ${k.allowedTenants.includes(e.id)?`border-blue-400 bg-blue-50 text-blue-700`:`border-gray-200 text-gray-600 hover:border-gray-300`}`,children:[i(`input`,{type:`checkbox`,class:`accent-blue-600`,checked:k.allowedTenants.includes(e.id),onChange:()=>ie(e.id)}),e.name||e.slug]},e.id))})]}),k.confirmPassword&&k.password!==k.confirmPassword&&i(`p`,{role:`alert`,class:`text-xs text-red-600`,children:v(`users.createForm.passwordMismatch`)}),F&&i(`p`,{role:`alert`,class:`text-sm text-red-600`,children:F}),i(`button`,{type:`submit`,class:`bg-blue-600 text-white px-4 py-2 rounded text-sm`,children:v(`common.create`)})]}),i(ee,{loading:T,keyFn:e=>e.id,rows:y,search:{placeholder:v(`common.search`),keys:e=>[e.name,e.email]},columns:[{key:`name`,label:v(`common.name`),render:e=>{let t=e;return i(`button`,{onClick:()=>X(t),class:`text-blue-600 dark:text-blue-400 hover:underline`,children:t.name})}},{key:`email`,label:v(`common.email`)},{key:`isActive`,label:v(`users.col.status`),render:e=>{let t=e;return i(`span`,{class:`text-xs font-medium px-2 py-0.5 rounded-full ${t.isActive?`bg-green-100 text-green-700`:`bg-gray-100 text-gray-500`}`,children:t.isActive?v(`users.status.active`):v(`users.status.inactive`)})}},{key:`createdAt`,label:v(`common.created`),render:e=>new Date(e.createdAt).toLocaleDateString()},{key:`actions`,label:``,render:e=>{let t=e;return t.id===_?.sub?i(`span`,{class:`text-xs text-gray-400`,children:v(`common.you`)}):t.roles?.some(e=>e.id===h)?i(`span`,{class:`text-xs text-gray-400`,title:v(`users.superAdminLocked`),children:v(`common.locked`)}):i(`div`,{class:`flex gap-2`,children:[i(p,{perm:`user:update`,children:[i(`button`,{onClick:()=>ce(t),class:`text-xs text-gray-600 hover:underline`,children:v(`common.edit`)}),i(`button`,{onClick:()=>se(t),class:`text-xs text-blue-600 hover:underline`,children:t.isActive?v(`users.action.deactivate`):v(`users.action.activate`)})]}),i(p,{perm:`user:delete`,children:i(`button`,{onClick:()=>oe(t.id,t.name),class:`text-xs text-red-500 hover:underline`,children:v(`common.delete`)})})]})}}]})]})}export{g as UserList};
|
|
1
|
+
import{t as e}from"./ConfirmDialog-CJAqYRfE.js";import{A as t,E as n,M as r,S as i,T as a,d as o,f as s,k as c,o as l,s as u,x as d}from"./index-D7qdwIxs.js";import{t as ee}from"./Table-C59yMXY2.js";import{n as te}from"./RecordDetailModal-4OyHjtux.js";import{t as f}from"./users-CDdO4hYQ.js";import{t as p}from"./PermissionGate-CkaZ9DKx.js";import{t as m}from"./roles-ChXEt79v.js";var h=`role_super_admin`;function g({current:g}){let{user:_}=d(),v=u();l(v(`users.title`));let[y,b]=c([]),[x,S]=c([]),[C,w]=c([]),[T,E]=c(!0),[D,O]=c(!1),[k,A]=c({name:``,email:``,password:``,confirmPassword:``,roleId:``,allowedTenants:[]}),[j,M]=c(!1),[N,P]=c(!1),[F,I]=c(``),[L,R]=c(null),[z,B]=c([]),[V,H]=c(``),[U,W]=c(``),[G,K]=c(``),[q,J]=c(!1),[Y,X]=c(null),Z=window.__CONSENTI_CONFIG__?.authMode===`local`,ne=_?.roles.includes(`super_admin`)??!1,{requestConfirm:Q,dialog:re}=e(),$=()=>{E(!0),Promise.all([f.list(),m.list(),n(`/tenants`).catch(()=>[])]).then(([e,t,n])=>{b(e),S(t),w(n)}).catch(()=>{}).finally(()=>E(!1))};t($,[]);let ie=e=>{A(t=>({...t,allowedTenants:t.allowedTenants.includes(e)?t.allowedTenants.filter(t=>t!==e):[...t.allowedTenants,e]}))},ae=async e=>{if(e.preventDefault(),k.password!==k.confirmPassword)I(v(`users.createForm.passwordMismatch`));else{I(``);try{await f.create({name:k.name,email:k.email,password:k.password,roleId:k.roleId||void 0,...k.allowedTenants.length>0?{allowedTenants:k.allowedTenants}:{}}),O(!1),A({name:``,email:``,password:``,confirmPassword:``,roleId:``,allowedTenants:[]}),M(!1),P(!1),$()}catch(e){I(a(e,v(`users.createForm.error`)))}}},oe=async(e,t)=>{await Q({title:v(`users.dialog.delete.title`,{name:t}),message:v(`users.dialog.delete.message`)})&&(await f.delete(e).catch(()=>{}),$())},se=async e=>{await f.update(e.id,{isActive:!e.isActive}).catch(()=>{}),$()},ce=e=>{R(e),B(e.allowedTenants??[]),H(``),W(``),K(``),J(!1)},le=async()=>{if(L){if(U&&U!==G)H(v(`users.createForm.passwordMismatch`));else if(U&&U.length<12)H(v(`users.edit.passwordTooShort`));else try{await f.update(L.id,{allowedTenants:z,...U?{password:U}:{}}),R(null),$()}catch(e){H(a(e,v(`users.edit.error.save`)))}}},ue=e=>{B(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};return i(r,{children:[re,i(te,{open:!!Y,title:v(`users.detail.title`),onClose:()=>X(null),fields:Y?[{label:v(`common.name`),value:Y.name},{label:v(`common.email`),value:Y.email},{label:v(`users.col.status`),value:Y.isActive?v(`users.status.active`):v(`users.status.inactive`)},{label:v(`common.created`),value:new Date(Y.createdAt).toLocaleString()},{label:v(`users.allowedSites`),value:Y.allowedTenants?.length?Y.allowedTenants.join(`, `):v(`users.detail.allSites`)}]:[]}),i(`div`,{class:`flex justify-between items-center mb-4`,children:[i(`p`,{class:`text-sm text-gray-500`,children:v(`users.count`,{n:y.length})}),i(p,{perm:`user:create`,children:i(`button`,{onClick:()=>O(!D),class:`bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-blue-700 transition-colors`,children:v(D?`common.cancel`:`users.newUser`)})})]}),L&&i(`div`,{class:`fixed inset-0 z-50 flex items-center justify-center`,children:[i(`div`,{class:`absolute inset-0 bg-black/40`,onClick:()=>R(null),"aria-hidden":`true`}),i(`div`,{class:`relative bg-white rounded-xl shadow-2xl p-6 w-full max-w-sm mx-4 space-y-4`,children:[i(`h3`,{class:`text-sm font-semibold text-gray-900`,children:v(`users.edit.title`,{name:L.name})}),C.length>0&&i(`div`,{children:[i(`p`,{class:`text-xs font-medium text-gray-700 mb-1.5`,children:[v(`users.allowedSites`),i(`span`,{class:`ml-1.5 font-normal text-gray-400`,children:v(`users.allowedSitesHint`)})]}),i(`div`,{class:`flex flex-wrap gap-2`,children:C.map(e=>i(`label`,{class:`flex items-center gap-1.5 px-2.5 py-1.5 border rounded text-xs cursor-pointer select-none transition-colors ${z.includes(e.id)?`border-blue-400 bg-blue-50 text-blue-700`:`border-gray-200 text-gray-600 hover:border-gray-300`}`,children:[i(`input`,{type:`checkbox`,class:`accent-blue-600`,checked:z.includes(e.id),onChange:()=>ue(e.id)}),e.name||e.slug]},e.id))})]}),Z&&ne&&i(`div`,{children:[i(`p`,{class:`text-xs font-medium text-gray-700 mb-1.5`,children:[v(`users.edit.resetPassword`),i(`span`,{class:`ml-1.5 font-normal text-gray-400`,children:v(`users.edit.resetPasswordHint`)})]}),i(`div`,{class:`space-y-2`,children:[i(`div`,{class:`relative`,children:[i(`input`,{class:`w-full border border-gray-300 rounded px-3 py-2 pr-9 text-sm`,placeholder:v(`users.createForm.passwordPlaceholder`),"aria-label":v(`users.edit.newPassword`),type:q?`text`:`password`,value:U,onInput:e=>W(e.target.value)}),i(`button`,{type:`button`,class:`absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600`,onClick:()=>J(e=>!e),"aria-label":v(q?`common.hidePassword`:`common.showPassword`),title:v(q?`common.hidePassword`:`common.showPassword`),children:i(q?s:o,{size:15,"aria-hidden":`true`})})]}),i(`input`,{class:`w-full border border-gray-300 rounded px-3 py-2 text-sm`,placeholder:v(`users.createForm.confirmPasswordPlaceholder`),"aria-label":v(`users.edit.confirmNewPassword`),type:q?`text`:`password`,value:G,onInput:e=>K(e.target.value)})]})]}),V&&i(`p`,{class:`text-xs text-red-600`,children:V}),i(`div`,{class:`flex justify-end gap-2 pt-1`,children:[i(`button`,{type:`button`,onClick:()=>R(null),class:`px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg transition-colors`,children:`Cancel`}),i(`button`,{type:`button`,onClick:le,class:`px-4 py-2 text-sm font-medium bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:`Save`})]})]})]}),D&&i(`form`,{onSubmit:ae,class:`bg-white border border-gray-200 rounded-lg p-5 mb-4 space-y-3`,children:[i(`h3`,{class:`text-sm font-semibold text-gray-700`,children:v(`users.createForm.title`)}),i(`div`,{class:`grid grid-cols-2 gap-3`,children:[i(`input`,{class:`border border-gray-300 rounded px-3 py-2 text-sm`,placeholder:v(`users.createForm.namePlaceholder`),"aria-label":v(`common.name`),required:!0,value:k.name,onInput:e=>A(t=>({...t,name:e.target.value}))}),i(`input`,{class:`border border-gray-300 rounded px-3 py-2 text-sm`,placeholder:v(`users.createForm.emailPlaceholder`),"aria-label":v(`common.email`),type:`email`,required:!0,value:k.email,onInput:e=>A(t=>({...t,email:e.target.value}))}),i(`div`,{class:`relative`,children:[i(`input`,{class:`w-full border border-gray-300 rounded px-3 py-2 pr-9 text-sm`,placeholder:v(`users.createForm.passwordPlaceholder`),"aria-label":v(`users.createForm.passwordPlaceholder`),type:j?`text`:`password`,required:!0,value:k.password,onInput:e=>A(t=>({...t,password:e.target.value}))}),i(`button`,{type:`button`,class:`absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600`,onClick:()=>M(e=>!e),"aria-label":v(j?`common.hidePassword`:`common.showPassword`),title:v(j?`common.hidePassword`:`common.showPassword`),children:i(j?s:o,{size:15,"aria-hidden":`true`})})]}),i(`div`,{class:`relative`,children:[i(`input`,{class:`w-full border rounded px-3 py-2 pr-9 text-sm ${k.confirmPassword&&k.password!==k.confirmPassword?`border-red-300 bg-red-50`:`border-gray-300`}`,placeholder:v(`users.createForm.confirmPasswordPlaceholder`),"aria-label":v(`users.createForm.confirmPasswordPlaceholder`),type:N?`text`:`password`,required:!0,value:k.confirmPassword,onInput:e=>A(t=>({...t,confirmPassword:e.target.value}))}),i(`button`,{type:`button`,class:`absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600`,onClick:()=>P(e=>!e),"aria-label":v(N?`common.hidePassword`:`common.showPassword`),title:v(N?`common.hidePassword`:`common.showPassword`),children:i(N?s:o,{size:15,"aria-hidden":`true`})})]}),i(`select`,{class:`border border-gray-300 rounded px-3 py-2 text-sm col-span-2`,value:k.roleId,"aria-label":v(`common.roles`),onChange:e=>A(t=>({...t,roleId:e.target.value})),children:[i(`option`,{value:``,children:v(`users.createForm.selectRole`)}),x.map(e=>i(`option`,{value:e.id,children:e.name},e.id))]})]}),C.length>0&&i(`div`,{children:[i(`p`,{class:`text-xs font-medium text-gray-700 mb-1.5`,children:[v(`users.allowedSites`),i(`span`,{class:`ml-1.5 font-normal text-gray-400`,children:v(`users.allowedSitesHint`)})]}),i(`div`,{class:`flex flex-wrap gap-2`,children:C.map(e=>i(`label`,{class:`flex items-center gap-1.5 px-2.5 py-1.5 border rounded text-xs cursor-pointer select-none transition-colors ${k.allowedTenants.includes(e.id)?`border-blue-400 bg-blue-50 text-blue-700`:`border-gray-200 text-gray-600 hover:border-gray-300`}`,children:[i(`input`,{type:`checkbox`,class:`accent-blue-600`,checked:k.allowedTenants.includes(e.id),onChange:()=>ie(e.id)}),e.name||e.slug]},e.id))})]}),k.confirmPassword&&k.password!==k.confirmPassword&&i(`p`,{role:`alert`,class:`text-xs text-red-600`,children:v(`users.createForm.passwordMismatch`)}),F&&i(`p`,{role:`alert`,class:`text-sm text-red-600`,children:F}),i(`button`,{type:`submit`,class:`bg-blue-600 text-white px-4 py-2 rounded text-sm`,children:v(`common.create`)})]}),i(ee,{loading:T,keyFn:e=>e.id,rows:y,search:{placeholder:v(`common.search`),keys:e=>[e.name,e.email]},columns:[{key:`name`,label:v(`common.name`),render:e=>{let t=e;return i(`button`,{onClick:()=>X(t),class:`text-blue-600 dark:text-blue-400 hover:underline`,children:t.name})}},{key:`email`,label:v(`common.email`)},{key:`isActive`,label:v(`users.col.status`),render:e=>{let t=e;return i(`span`,{class:`text-xs font-medium px-2 py-0.5 rounded-full ${t.isActive?`bg-green-100 text-green-700`:`bg-gray-100 text-gray-500`}`,children:t.isActive?v(`users.status.active`):v(`users.status.inactive`)})}},{key:`createdAt`,label:v(`common.created`),render:e=>new Date(e.createdAt).toLocaleDateString()},{key:`actions`,label:``,render:e=>{let t=e;return t.id===_?.sub?i(`span`,{class:`text-xs text-gray-400`,children:v(`common.you`)}):t.roles?.some(e=>e.id===h)?i(`span`,{class:`text-xs text-gray-400`,title:v(`users.superAdminLocked`),children:v(`common.locked`)}):i(`div`,{class:`flex gap-2`,children:[i(p,{perm:`user:update`,children:[i(`button`,{onClick:()=>ce(t),class:`text-xs text-gray-600 hover:underline`,children:v(`common.edit`)}),i(`button`,{onClick:()=>se(t),class:`text-xs text-blue-600 hover:underline`,children:t.isActive?v(`users.action.deactivate`):v(`users.action.activate`)})]}),i(p,{perm:`user:delete`,children:i(`button`,{onClick:()=>oe(t.id,t.name),class:`text-xs text-red-500 hover:underline`,children:v(`common.delete`)})})]})}}]})]})}export{g as UserList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,E as t,M as n,S as r,T as i,k as a,o,s}from"./index-
|
|
1
|
+
import{A as e,E as t,M as n,S as r,T as i,k as a,o,s}from"./index-D7qdwIxs.js";import{t as c}from"./debounce-DlvAAT2V.js";import{t as l}from"./PermissionGate-CkaZ9DKx.js";function u(){let n=s(),[o,c]=a(null),[l,u]=a(!0),[d,f]=a(!1),[p,m]=a(!1),[h,g]=a(``),[_,v]=a(``),y=(e=!1)=>{u(!0),g(``),t(`/tcf/registration-status${e?`?refresh=true`:``}`).then(c).catch(e=>g(i(e,n(`tcfRegistration.loadError`)))).finally(()=>u(!1))};if(e(()=>{y()},[]),l)return null;if(h)return r(`p`,{role:`alert`,class:`text-sm text-red-600 mb-5`,children:h});if(!o?.enabled||o.confirmed)return null;let b=async()=>{m(!0),v(``);try{await t(`/tcf/confirm-registration`,{method:`POST`,body:JSON.stringify({acknowledge:!0})}),f(!1),y()}catch(e){v(i(e,n(`tcfRegistration.confirmError`)))}finally{m(!1)}};return r(`div`,{role:`alert`,class:`mb-5 p-4 bg-red-50 border border-red-200 rounded-lg text-sm text-red-900 space-y-3`,children:[r(`p`,{class:`font-semibold`,children:n(`tcfRegistration.title`)}),r(`p`,{children:n(`tcfRegistration.body`,{cmpId:o.cmpId??0,cmpVersion:o.cmpVersion??0})}),o.cmpListEntry?.deregistered&&r(`p`,{class:`font-medium`,children:n(`tcfRegistration.deregistered`,{date:o.cmpListEntry.deletedDate??``})}),o.cmpListEntry&&!o.cmpListEntry.found&&!o.cmpListEntry.deregistered&&r(`p`,{children:n(`tcfRegistration.notFound`)}),_&&r(`p`,{class:`font-medium`,children:_}),r(`label`,{class:`flex items-start gap-2 text-red-900`,children:[r(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked),class:`mt-0.5 w-4 h-4 rounded border-red-300`}),r(`span`,{children:n(`tcfRegistration.checkbox`,{cmpId:o.cmpId??0,cmpVersion:o.cmpVersion??0})})]}),r(`div`,{class:`flex items-center gap-3`,children:[r(`button`,{type:`button`,disabled:!d||p,onClick:()=>void b(),class:`bg-red-600 text-white rounded-lg px-4 py-2 text-xs font-medium hover:bg-red-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:n(p?`common.saving`:`tcfRegistration.confirmButton`)}),r(`button`,{type:`button`,disabled:p,onClick:()=>{v(``),y(!0)},class:`text-xs text-red-700 hover:text-red-900 underline disabled:opacity-40`,children:n(`tcfRegistration.refreshStatus`)})]})]})}function d(){let n=s(),[o,c]=a(null),[l,u]=a(!0),[d,f]=a(!1),[p,m]=a(!1),[h,g]=a(``),[_,v]=a(``),y=()=>{u(!0),g(``),t(`/gpp/registration-status`).then(c).catch(e=>g(i(e,n(`gppRegistration.loadError`)))).finally(()=>u(!1))};if(e(()=>{y()},[]),l)return null;if(h)return r(`p`,{role:`alert`,class:`text-sm text-red-600 mb-5`,children:h});if(!o?.enabled||o.confirmed)return null;let b=async()=>{m(!0),v(``);try{await t(`/gpp/confirm-registration`,{method:`POST`,body:JSON.stringify({acknowledge:!0})}),f(!1),y()}catch(e){v(i(e,n(`gppRegistration.confirmError`)))}finally{m(!1)}};return r(`div`,{role:`alert`,class:`mb-5 p-4 bg-red-50 border border-red-200 rounded-lg text-sm text-red-900 space-y-3`,children:[r(`p`,{class:`font-semibold`,children:n(`gppRegistration.title`)}),r(`p`,{children:n(`gppRegistration.body`,{cmpId:o.cmpId??0,cmpVersion:o.cmpVersion??0})}),_&&r(`p`,{class:`font-medium`,children:_}),r(`label`,{class:`flex items-start gap-2 text-red-900`,children:[r(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked),class:`mt-0.5 w-4 h-4 rounded border-red-300`}),r(`span`,{children:n(`gppRegistration.checkbox`,{cmpId:o.cmpId??0,cmpVersion:o.cmpVersion??0})})]}),r(`button`,{type:`button`,disabled:!d||p,onClick:()=>void b(),class:`bg-red-600 text-white rounded-lg px-4 py-2 text-xs font-medium hover:bg-red-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:n(p?`common.saving`:`gppRegistration.confirmButton`)})]})}function f(){let e=window.location.hash.match(/[?&]page=(\d+)/);return e?Math.max(1,parseInt(e[1],10)):1}function p(e){if(!Number.isFinite(e)||e<1)return;let t=(window.location.hash.split(`?`)[0]??`/vendors`).replace(/^#/,``);window.location.hash=e===1?t:`${t}?page=${e}`}function m({current:i}){let m=s();o(m(`vendors.title`));let[h,g]=a([]),[_,v]=a(0),[y,b]=a(0),[x,S]=a(f),[C,w]=a(1),[T,E]=a(``),[D,O]=a(!0),[k,A]=a(``),j=(e,n)=>{O(!0),A(``);let r=new URLSearchParams;e&&r.set(`q`,e),r.set(`page`,String(n)),r.set(`limit`,`25`),t(`/tcf/vendors?${r.toString()}`).then(e=>{g(e.vendors),v(e.total),b(e.vendorListVersion),w(e.totalPages),S(Number.isFinite(e.page)&&e.page>=1?e.page:1)}).catch(e=>{A(e instanceof Error?e.message:`GVL not available. Enable tcf.enabled in server config.`)}).finally(()=>O(!1))};e(()=>{j(T,x)},[]);let M=c(e=>{E(e),S(1),p(1),j(e,1)},500),N=e=>{S(e),p(e),j(T,e)};return r(n,{children:[r(l,{perm:`settings:update`,children:[r(u,{}),r(d,{})]}),r(`div`,{class:`mb-5 p-4 bg-blue-50 border border-blue-200 rounded-lg text-sm text-blue-900 space-y-2`,children:[r(`p`,{class:`font-semibold`,children:m(`vendors.info.title`)}),r(`p`,{children:[`The `,r(`strong`,{children:`IAB Transparency & Consent Framework (TCF)`}),` is an industry standard used by ad-tech platforms across Europe. The `,r(`strong`,{children:`Global Vendor List (GVL)`}),` is a public registry — maintained by the IAB — of every registered ad-tech vendor (Google, Meta, etc.) and the "purposes" they require consent for (e.g. Purpose 1 = store/access info, Purpose 3 = create personalised ads).`]}),r(`p`,{children:[`When TCF is enabled on a profile, Consenti generates a `,r(`strong`,{children:`TC String`}),` alongside the normal consent record. Ad platforms read this string from the cookie to know which vendors and purposes the visitor accepted. Without a valid TC String, compliant ad platforms will not fire their tags.`]}),r(`p`,{children:[`This list is `,r(`strong`,{children:`read-only reference data`}),` — it is fetched automatically from the IAB and refreshed every 7 days. You do not need to sync or edit it manually. Use it to look up a vendor's numeric ID and the purpose IDs they need, then attach those IDs to the relevant cookie in your profile config.`]}),r(`p`,{class:`text-xs text-blue-700`,children:`TCF is only relevant if your site runs IAB-registered ad-tech vendors and you need to pass a TC String to their tags. If you only need GDPR / CCPA consent for your own first-party cookies, you can ignore this page.`})]}),r(`div`,{class:`mb-4 flex items-center gap-3`,children:[r(`input`,{type:`text`,placeholder:m(`vendors.searchPlaceholder`),"aria-label":m(`vendors.searchPlaceholder`),value:T,onChange:e=>M(e.target.value),class:`border border-gray-300 rounded px-3 py-1.5 text-sm w-64`}),y>0&&r(`span`,{class:`text-xs text-gray-500`,children:m(`vendors.gvlMeta`,{version:y,total:_})})]}),k&&r(`div`,{role:`alert`,class:`p-4 bg-amber-50 border border-amber-200 rounded text-sm text-amber-800`,children:k}),D&&r(`p`,{role:`status`,"aria-live":`polite`,class:`text-sm text-gray-500`,children:m(`vendors.loading`)}),!D&&!k&&h.length===0&&r(`p`,{class:`text-sm text-gray-500`,children:m(`vendors.noResults`)}),!D&&h.length>0&&r(n,{children:[r(`div`,{class:`max-h-[60vh] overflow-y-auto rounded border border-gray-200`,children:r(`table`,{class:`w-full text-xs`,children:[r(`thead`,{class:`bg-gray-50`,children:r(`tr`,{children:[r(`th`,{scope:`col`,class:`text-left px-3 py-2 text-gray-600`,children:m(`vendors.col.id`)}),r(`th`,{scope:`col`,class:`text-left px-3 py-2 text-gray-600`,children:m(`vendors.col.name`)}),r(`th`,{scope:`col`,class:`text-left px-3 py-2 text-gray-600`,children:m(`vendors.col.purposes`)}),r(`th`,{scope:`col`,class:`text-left px-3 py-2 text-gray-600`,children:m(`vendors.col.liPurposes`)}),r(`th`,{scope:`col`,class:`text-left px-3 py-2 text-gray-600`,children:m(`vendors.col.specialPurposes`)})]})}),r(`tbody`,{children:h.map(e=>r(`tr`,{class:`border-t border-gray-100 dark:hover:bg-gray-800 hover:bg-gray-50`,children:[r(`td`,{class:`px-3 py-2 font-mono text-gray-500`,children:e.id}),r(`td`,{class:`px-3 py-2 font-medium text-gray-800`,children:e.name}),r(`td`,{class:`px-3 py-2 text-gray-600`,children:(e.purposes??[]).join(`, `)||`—`}),r(`td`,{class:`px-3 py-2 text-gray-600`,children:(e.legIntPurposes??[]).join(`, `)||`—`}),r(`td`,{class:`px-3 py-2 text-gray-600`,children:(e.specialPurposes??[]).join(`, `)||`—`})]},e.id))})]})}),r(`nav`,{"aria-label":`Vendor list pagination`,class:`mt-3 flex items-center justify-between text-xs text-gray-500`,children:[r(`span`,{children:m(`vendors.pagination`,{page:x,totalPages:C,total:_})}),r(`div`,{class:`flex items-center gap-1`,children:[r(`button`,{onClick:()=>N(x-1),disabled:x<=1,"aria-label":m(`common.prev`),class:`px-2 py-1 border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed`,children:m(`vendors.prev`)}),Array.from({length:Math.min(5,C)},(e,t)=>{let n=Math.max(1,Math.min(x-2,C-4))+t;return r(`button`,{onClick:()=>N(n),"aria-current":n===x?`page`:void 0,class:`px-2 py-1 border rounded ${n===x?`border-blue-500 bg-blue-50 text-blue-700 font-medium`:`border-gray-300 hover:bg-gray-50`}`,children:n},n)}),r(`button`,{onClick:()=>N(x+1),disabled:x>=C,"aria-label":m(`common.next`),class:`px-2 py-1 border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed`,children:m(`vendors.next`)})]})]})]})]})}export{m as VendorList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,D as t,E as n,M as r,S as i,k as a,o,s}from"./index-
|
|
1
|
+
import{A as e,D as t,E as n,M as r,S as i,k as a,o,s}from"./index-D7qdwIxs.js";import{n as c,t as l}from"./useHashQuery-DzYBqPIg.js";import{n as u}from"./RecordDetailModal-4OyHjtux.js";var d={list:e=>{let t=new URLSearchParams;return e?.page&&t.set(`page`,String(e.page)),e?.limit&&t.set(`limit`,String(e.limit)),e?.q&&t.set(`q`,e.q),n(`/visitors?${t}`)},noticeShown:e=>n(`/visitors/${e}/notice-shown`)},f=`#/visitors`;function p({current:n}){let p=s();o(p(`visitors.title`));let{params:m,setParams:h}=l(f),[g,_]=a([]),[v,y]=a(0),[b,x]=a(()=>Number(m.get(`page`))||1),[S,C]=a(()=>Number(m.get(`limit`))||25),[w,T]=a(!0),[E,D]=a(()=>m.get(`q`)??``),[O,k]=a(null),A=e=>{k(e)},j=(e,t,n)=>{T(!0),d.list({page:e,limit:t,...n?{q:n}:{}}).then(e=>{_(e.items),y(e.total)}).catch(()=>{}).finally(()=>T(!1))};e(()=>{j(b,S,E)},[b,S]);let M=t(!0);return e(()=>{if(M.current){M.current=!1;return}let e=setTimeout(()=>{x(1),j(1,S,E)},300);return()=>clearTimeout(e)},[E]),e(()=>{h({page:b>1?b:void 0,limit:S===25?void 0:S,q:E||void 0})},[b,S,E]),i(r,{children:[i(u,{open:!!O,title:p(`visitors.detail.title`),onClose:()=>k(null),fields:O?[{label:p(`visitors.col.visitorId`),value:i(`span`,{class:`font-mono text-xs`,children:O.visitorId})},{label:p(`visitors.col.country`),value:O.country??`—`},{label:p(`visitors.detail.region`),value:O.region??`—`},{label:p(`visitors.detail.city`),value:O.city??`—`},{label:p(`visitors.col.firstSeen`),value:new Date(O.firstSeen).toLocaleString()},{label:p(`visitors.col.lastSeen`),value:new Date(O.lastSeen).toLocaleString()}]:[]}),i(c,{loading:w,rows:g,keyFn:e=>e.id,searchValue:E,onSearchChange:D,searchPlaceholder:p(`visitors.searchPlaceholder`),total:v,page:b,pageSize:S,onPage:x,onPageSize:e=>{C(e),x(1)},columns:[{key:`visitorId`,label:p(`visitors.col.visitorId`),render:e=>{let t=e;return i(`button`,{onClick:()=>A(t),class:`font-mono text-xs text-blue-600 dark:text-blue-400 hover:underline`,children:[t.visitorId.slice(0,16),`…`]})}},{key:`country`,label:p(`visitors.col.country`),render:e=>e.country??`—`},{key:`firstSeen`,label:p(`visitors.col.firstSeen`),render:e=>new Date(e.firstSeen).toLocaleDateString()},{key:`lastSeen`,label:p(`visitors.col.lastSeen`),render:e=>new Date(e.lastSeen).toLocaleDateString()}],emptyText:p(`visitors.empty`)})]})}export{p as VisitorList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./index-D7qdwIxs.js";var t={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./index-
|
|
1
|
+
import{_ as e}from"./index-D7qdwIxs.js";var t={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./index-
|
|
1
|
+
import{_ as e}from"./index-D7qdwIxs.js";var t={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};t.node;var n=e(t);export{n as t};
|