domma-cms 1.66.2 → 1.66.3
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/CHANGELOG.md +4 -0
- package/admin/js/lib/shared/contacts-view.js +30 -30
- package/admin/js/templates/contacts.html +2 -1
- package/docs/DommaFeatures.md +1 -1
- package/package.json +1 -1
- package/plugins/_lib/admin/mail/body-menu.js +1 -1
- package/plugins/_lib/admin/mail/cms-host.js +1 -1
- package/plugins/_lib/admin/mail/compose-window.js +1 -1
- package/plugins/_lib/admin/mail/contacts.js +1 -1
- package/plugins/_lib/admin/mail/diagnostics-section.js +1 -1
- package/plugins/_lib/admin/mail/drag-drop.js +1 -1
- package/plugins/_lib/admin/mail/folder-tree.js +1 -1
- package/plugins/_lib/admin/mail/font-controls.js +1 -1
- package/plugins/_lib/admin/mail/fonts.js +1 -1
- package/plugins/_lib/admin/mail/host-context.js +1 -1
- package/plugins/_lib/admin/mail/identity.js +1 -1
- package/plugins/_lib/admin/mail/image-senders-section.js +1 -1
- package/plugins/_lib/admin/mail/keyboard.js +1 -1
- package/plugins/_lib/admin/mail/mail.html +1 -1
- package/plugins/_lib/admin/mail/message-actions.js +1 -1
- package/plugins/_lib/admin/mail/oauth-panel.js +1 -1
- package/plugins/_lib/admin/mail/panes.js +1 -1
- package/plugins/_lib/admin/mail/reader-kit.js +1 -1
- package/plugins/_lib/admin/mail/reader-runtime.js +1 -1
- package/plugins/_lib/admin/mail/reader-view.js +1 -1
- package/plugins/_lib/admin/mail/resizable.js +1 -1
- package/plugins/_lib/admin/mail/restore-spam.js +1 -1
- package/plugins/_lib/admin/mail/rules.js +1 -1
- package/plugins/_lib/admin/mail/scheduling.js +1 -1
- package/plugins/_lib/admin/mail/section-kit.js +1 -1
- package/plugins/_lib/admin/mail/security-note.js +1 -1
- package/plugins/_lib/admin/mail/settings-section.js +1 -1
- package/plugins/_lib/admin/mail/templates.js +1 -1
- package/plugins/_lib/admin/mail/threads.js +1 -1
- package/plugins/_lib/admin/mail/vacation.js +1 -1
- package/plugins/_lib/admin/mail/when-closed.js +1 -1
- package/plugins/_lib/admin/ui/dates.js +1 -1
- package/plugins/_lib/admin/ui/resizable.js +1 -1
- package/plugins/_lib/contacts/mailContact.js +31 -4
- package/plugins/_lib/contacts/model.js +1 -1
- package/plugins/_lib/domma-mail-contacts.lock.json +7 -7
- package/plugins/_lib/domma-mail.lock.json +80 -80
- package/plugins/_lib/mail/accountFileStore.js +1 -1
- package/plugins/_lib/mail/accountRepository.js +1 -1
- package/plugins/_lib/mail/accountRoutes.js +1 -1
- package/plugins/_lib/mail/bodyTokenProvider.js +1 -1
- package/plugins/_lib/mail/bodyTokens.js +1 -1
- package/plugins/_lib/mail/compose.js +1 -1
- package/plugins/_lib/mail/defaults.js +1 -1
- package/plugins/_lib/mail/envelope.js +1 -1
- package/plugins/_lib/mail/folderActions.js +1 -1
- package/plugins/_lib/mail/folderRuntime.js +1 -1
- package/plugins/_lib/mail/folders.js +1 -1
- package/plugins/_lib/mail/imapPoolRuntime.js +1 -1
- package/plugins/_lib/mail/mbox.js +1 -1
- package/plugins/_lib/mail/message-action.js +1 -1
- package/plugins/_lib/mail/messageSecurity.js +1 -1
- package/plugins/_lib/mail/messageSecurityProvider.js +1 -1
- package/plugins/_lib/mail/networkAddresses.js +1 -1
- package/plugins/_lib/mail/networkPolicy.js +1 -1
- package/plugins/_lib/mail/oauthAccounts.js +1 -1
- package/plugins/_lib/mail/oauthRouteRuntime.js +1 -1
- package/plugins/_lib/mail/oauthRuntime.js +1 -1
- package/plugins/_lib/mail/pollSchedule.js +1 -1
- package/plugins/_lib/mail/poller.js +1 -1
- package/plugins/_lib/mail/pollerRuntime.js +1 -1
- package/plugins/_lib/mail/priority.js +1 -1
- package/plugins/_lib/mail/publicMailbox.js +1 -1
- package/plugins/_lib/mail/readRuntime.js +1 -1
- package/plugins/_lib/mail/render.js +1 -1
- package/plugins/_lib/mail/ruleRunner.js +1 -1
- package/plugins/_lib/mail/schedulerRuntime.js +1 -1
- package/plugins/_lib/mail/secretProvider.js +1 -1
- package/plugins/_lib/mail/secretbox.js +1 -1
- package/plugins/_lib/mail/senderAuth.js +1 -1
- package/plugins/_lib/mail/sieve.js +1 -1
- package/plugins/_lib/mail/smtpService.js +1 -1
- package/plugins/_lib/mail/snoozeRuntime.js +1 -1
- package/plugins/_lib/mail/store.js +1 -1
- package/plugins/_lib/mail/subscriptions.js +1 -1
- package/plugins/_lib/mail/syncPlan.js +1 -1
- package/plugins/_lib/mail/syncRuntime.js +1 -1
- package/plugins/_lib/mail/syncSelection.js +1 -1
- package/plugins/_lib/mail/unreadBadge.js +1 -1
- package/plugins/_lib/mail/unsubscribe.js +1 -1
- package/plugins/_lib/mail/vacationRuntime.js +1 -1
- package/plugins/_lib/mail/write.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{arrangeContacts as Wt,countContacts as Ht,DEFAULT_SETTINGS as Je,duplicateBody as Kt,initials as Yt,normaliseSettings as Ve,primaryEmail as oe,primaryPhone as Ee,withGroup as Qe}from"../contacts-arrange.js";export function createContactsView(
|
|
1
|
+
import{arrangeContacts as Wt,countContacts as Ht,DEFAULT_SETTINGS as Je,duplicateBody as Kt,initials as Yt,normaliseSettings as Ve,primaryEmail as oe,primaryPhone as Ee,withGroup as Qe}from"../contacts-arrange.js";export function createContactsView(d){const{$:_t,M:s,E:i,I:$e,D:Ce,_:zt,S:Jt,apiRequest:Xe,loadWhatsAppCalling:Ze,protectToolEditor:et,mountToolTrash:tt,mountGroupBatch:at,orphanToolDrafts:ot,SHAPES:nt,whileLoading:st,addBannerAction:lt,mountRelated:ct,relatedMenuItems:rt,relatedProviders:it,helpPopovers:ne,onceClosed:ue,openMenuAt:Y,promptWith:dt,settingsStore:ut,sidebarCount:pt,viewLifetime:mt,openEmail:ft}=d,Te=ut("contacts.settings",Ve),$=(D,p="GET",U)=>d.readOnly&&p!=="GET"?Promise.reject(new Error("This Contacts preview is read-only.")):Xe(D,{method:p,...U!==void 0?{body:JSON.stringify(U)}:{}}),pe={company:"Company",jobTitle:"Job title",website:"Website",billingEmail:"Billing email",vatNumber:"VAT number",companyNumber:"Company number",reference:"Their reference",paymentTerms:"Payment terms",currency:"Preferred currency",accountName:"Account name",bankName:"Bank",sortCode:"Sort code",accountNumber:"Account number",iban:"IBAN",bic:"BIC / SWIFT"},yt=["accountName","bankName","sortCode","accountNumber","iban","bic"],A={addresses:{title:"Addresses",add:"Add address",empty:"No address yet.",help:'Tick "Use for invoices" on the one an invoice should be addressed to.',columns:[{key:"label",placeholder:"Label (Office, Home\u2026)"},{key:"line1",placeholder:"Address line 1",wide:!0},{key:"line2",placeholder:"Address line 2",wide:!0},{key:"city",placeholder:"City"},{key:"region",placeholder:"County / Region"},{key:"postcode",placeholder:"Postcode"},{key:"country",placeholder:"Country"},{key:"isBilling",label:"Use for invoices",check:!0}]},emails:{title:"More email addresses",add:"Add email",empty:"None.",help:"Besides the main email above. Search finds a contact by these too.",columns:[{key:"label",placeholder:"Label (Accounts, Personal\u2026)"},{key:"address",placeholder:"name@example.com",wide:!0}]},phones:{title:"More phone numbers",add:"Add phone",empty:"None.",help:"Besides the main phone above. Call in the menu uses the main one, or the first of these.",columns:[{key:"label",placeholder:"Label (Mobile, Office\u2026)"},{key:"number",placeholder:"+44 \u2026",wide:!0}]}},bt=`
|
|
2
2
|
<div class="ct-row{{selClass}}" data-id="{{id}}" tabindex="0">
|
|
3
3
|
<input type="checkbox" class="ct-select" aria-label="Select {{name}}" data-bind-checked="selected">
|
|
4
4
|
<button type="button" class="ct-fav{{favClass}}" title="{{favTitle}}" aria-label="{{favTitle}}">\u2605</button>
|
|
@@ -11,34 +11,34 @@ import{arrangeContacts as Wt,countContacts as Ht,DEFAULT_SETTINGS as Je,duplicat
|
|
|
11
11
|
<span class="ct-col ct-phone">{{phone}}</span>
|
|
12
12
|
<span class="ct-col ct-groups"><span class="ct-groups-text" title="{{groupsText}}">{{groupsText}}</span></span>
|
|
13
13
|
<button type="button" class="ct-kebab" aria-label="Actions for {{name}}" title="Actions">\u22EE</button>
|
|
14
|
-
</div>`,
|
|
14
|
+
</div>`,ht='<button type="button" class="ct-chip{{cls}}" data-chip="{{key}}" title="{{title}}">{{label}} <b>{{count}}</b></button>',vt='<button type="button" class="ct-chip{{cls}}" data-group="{{name}}" aria-pressed="{{on}}">{{name}}</button>',gt=`
|
|
15
15
|
<div class="ct-group-row" data-group="{{name}}" tabindex="0">
|
|
16
16
|
<span>{{name}}</span><small>{{countText}}</small>
|
|
17
17
|
<button type="button" class="btn btn-sm btn-ghost" data-act="show">Show</button>
|
|
18
18
|
<button type="button" class="btn btn-sm btn-ghost" data-act="rename" data-bind-disabled="locked" title="{{lockTitle}}">Rename</button>
|
|
19
19
|
<button type="button" class="btn btn-sm btn-ghost text-danger" data-act="delete" data-bind-disabled="locked" title="{{lockTitle}}">Delete</button>
|
|
20
|
-
</div>`,kt="Groups are shared by everyone who uses Contacts, so renaming or deleting one changes their contacts too. Only the person who created a group can do that, or someone whose role has Manage groups in Contacts (admins do, unless it was taken away). Groups made before creators were recorded belong to the Manage groups holders. You can still file your own contacts in any group.";function me(D){const
|
|
20
|
+
</div>`,kt="Groups are shared by everyone who uses Contacts, so renaming or deleting one changes their contacts too. Only the person who created a group can do that, or someone whose role has Manage groups in Contacts (admins do, unless it was taken away). Groups made before creators were recorded belong to the Manage groups holders. You can still file your own contacts in any group.";function me(D){const p=document.createElement("template");return p.innerHTML=D.trim(),p.content.firstElementChild}const B=(D,p,U=`${p}s`)=>`${D} ${D===1?p:U}`,v=mt(d.routePattern??/^#\/contacts\b/);return{templateUrl:d.templateUrl??"/admin/js/templates/contacts.html",onUnmount(){v.dispose?.()},async onMount(D){v.reset();const p=D.get(0);(d.readOnly||d.editorOnly)&&(p.dataset.contactsReadOnly="true"),d.editorOnly&&(p.dataset.contactsEditor="true");let U=!1;v.add(()=>{U=!0});const y=()=>!U,se=await Ze();if(!y())return;const wt=p.querySelector(".ct-loading"),Q={editor:null,settings:null,groups:null};let Oe=[];it("contact").then(e=>{y()&&(Oe=e)});const M=s.observable(Te.read()),g=s.observable([]),C=s.observable([]),le=s.observable(!0),F=s.observable(!1),ce=s.observable(""),X=s.observable([]),re=s.observable(null),xe=s.observable(""),N=s.observable({kind:"all"}),b=s.observable(new Set),Ae=s.observable(!1),Ne=s.computed(()=>Ht(g.value,C.value)),St=s.computed(()=>Wt(g.value,{query:xe.value,filter:N.value,sort:M.value.sort,favouritesFirst:M.value.favouritesFirst})),P=s.observable([]);v.add(s.effect(()=>{const e=b.value;P.value=St.value.map(t=>({id:t.id,name:t.name||"Unnamed",sub:[t.jobTitle,t.company&&!M.value.showCompany?t.company:""].filter(Boolean).join(" \xB7 "),initials:Yt(t.name),company:t.company||"",email:oe(t),phone:Ee(t),groupsText:(t.groups||[]).join(", "),favClass:t.favourite===!0?" is-on":"",favTitle:t.favourite===!0?"Starred - click to unstar":"Star this contact",selected:e.has(t.id),selClass:e.has(t.id)?" is-selected":""}))}));const Le=s.observable([]);v.add(s.effect(()=>{const e=Ne.value,t=N.value;Le.value=[{key:"all",label:"All",count:e.all,title:"Everyone",cls:t.kind==="all"?" is-active":""},{key:"fav",label:"\u2605 Starred",count:e.fav,title:"Only starred contacts",cls:t.kind==="fav"?" is-active":""},...C.value.map(a=>({key:`group:${a}`,label:a,count:e.groups[a]??0,title:`Only the ${a} group`,cls:t.kind==="group"&&t.value===a?" is-active":""}))]})),v.add(s.effect(()=>{const e=N.value;e.kind==="group"&&!C.value.includes(e.value)&&(N.value={kind:"all"})}));const Et={loadError:ce,rows:P,chips:Le,loading:le,query:xe,searchFocus:Ae,firstLoad:s.computed(()=>le.value&&!F.value),hasOrphans:s.computed(()=>X.value.length>0),orphanText:s.computed(()=>{const e=X.value;return e.length?e.length===1?`You left unsaved changes to "${e[0].name}", which has since been deleted.`:`You left unsaved changes to ${B(e.length,"contact")} that have since been deleted.`:""}),hasRows:s.computed(()=>P.value.length>0),isEmpty:s.computed(()=>F.value&&!ce.value&&P.value.length===0),emptyText:s.computed(()=>g.value.length?"No contacts match. Clear the search or pick All.":d.readOnly?"No contacts yet. Close the preview to add or import contacts.":"No contacts yet. New contact adds one, or \u22EE > Import brings a file in."),countText:s.computed(()=>{if(!F.value)return"";const e=P.value.length,t=g.value.length;return e===t?B(t,"contact"):`${e} of ${t}`}),hasSelection:s.computed(()=>b.value.size>0),selectionText:s.computed(()=>`${B(b.value.size,"contact")} selected`),allSelected:s.computed(()=>P.value.length>0&&P.value.every(e=>b.value.has(e.id)))};v.add(s.effect(()=>Te.write(M.value)));const $t=(e,t)=>{M.value=Ve({...M.peek(),[e]:t})},G=e=>g.peek().find(t=>t.id===e),Ct=e=>{g.value=g.peek().map(t=>t.id===e.id?e:t)};let ie=0;async function _(){const e=++ie;le.value=!0;const t=Promise.all([$("/contacts/contacts"),$("/contacts/groups"),Ot()]);fe();try{const[a,n,c]=F.peek()?await t:await st(wt,t,nt.iconRows);if(!y()||e!==ie)return;g.value=Array.isArray(a)?a:a?.data??[],C.value=Array.isArray(n)?n:[],Z=c,ce.value="",F.value=!0,Me()}catch{if(!y()||e!==ie)return;ce.value="Could not load this list. Your items have not been removed.",i.toast("Failed to load contacts.",{type:"error"})}finally{y()&&e===ie&&(le.value=!1)}}async function Tt(){try{const e=await $("/contacts/groups");y()&&(C.value=Array.isArray(e)?e:C.peek())}catch{}}async function fe(){try{const e=await $("/contacts/groups/access");y()&&(re.value=new Map((e?.groups||[]).map(t=>[t.name,t.canManage===!0])))}catch{y()&&(re.value=new Map)}}const ye=e=>re.peek()?.get(e)===!0;let Z=null;async function Ot(){try{const e=await $("/contacts/trash");return new Set((Array.isArray(e)?e:[]).map(t=>t.id))}catch{return null}}const Be=e=>{if(Z)for(const t of e)Z.add(t)};function Me(){if(F.peek()){if(!Z){X.value=[];return}X.value=ot("contacts",[...g.peek().map(e=>e.id),...Z]).map(({id:e,draft:t})=>({id:e,name:String(t.values?.fields?.name||"").trim()||"Unnamed"}))}}v.add(s.effect(()=>{g.value,C.value,F.peek()&&pt("#/contacts")}));async function ee(e,t,a){try{const n=await $(`/contacts/contacts/${e}`,"PUT",t);return y()&&Ct(n),a&&i.toast(a,{type:"success"}),n||null}catch(n){return i.toast(n?.message||"Failed to update the contact.",{type:"error"}),null}}async function Pe(e){const t=G(e);if(M.peek().confirmDelete&&!await i.confirm("Move this contact to Trash? You can restore it later."))return!1;try{if(await $(`/contacts/contacts/${e}`,"DELETE"),Be([e]),y()){g.value=g.peek().filter(n=>n.id!==e);const a=new Set(b.peek());a.delete(e)&&(b.value=a)}return i.toast(`${t?.name?"Contact":"It"} deleted.`,{type:"success"}),!0}catch{return i.toast("Failed to delete the contact.",{type:"error"}),!1}}async function xt(e){const t=G(e);if(t)try{const a=await $("/contacts/contacts","POST",Kt(t));if(!y())return;if(g.value=[...g.peek(),a],Q.editor){i.toast("Copied.",{type:"success"});return}i.toast("Copied - the copy is open to edit.",{type:"success"}),W(a.id)}catch{i.toast("Failed to duplicate the contact.",{type:"error"})}}async function te(e){if(C.peek().includes(e))return!0;try{return await $("/contacts/groups","POST",{name:e}),await Tt(),!0}catch(t){return i.toast(t?.message||"Could not create the group.",{type:"error"}),!1}}async function At(e,t,a){const n=G(e);n&&(a&&!await te(t)||await ee(e,{groups:Qe(n.groups,t,a)},a?`Added to ${t}.`:`Removed from ${t}.`))}async function Ge(e){const t=String(await i.prompt("New group name:")??"").trim();t&&await He.run(e,t)}async function De(e,t){try{await navigator.clipboard.writeText(e),i.toast(`${t} copied.`,{type:"success"})}catch{i.toast("The browser would not allow copying.",{type:"error"})}}async function Nt(){const e=[...b.peek()];if(e.length&&await i.confirm(`Delete ${B(e.length,"contact")}? You can restore it from Trash.`))try{const t=await $("/contacts/contacts/bulk","DELETE",{ids:e});if(!y())return;const a=t?.deletedIds??[];Be(a),g.value=g.peek().filter(n=>!a.includes(n.id)),b.value=new Set(t?.failedIds??[]),i.toast(`${B(t?.deleted??e.length,"contact")} moved to Trash${t?.failedIds?.length?` \xB7 ${t.failedIds.length} failed (still selected)`:""}.`,{type:t?.failedIds?.length?"warning":"success"})}catch{i.toast("Bulk delete failed.",{type:"error"})}}async function Lt(e){await He.run([...b.peek()],e)}const Ie=e=>{const t=new Set(b.peek());t.delete(e)||t.add(e),b.value=t};async function Re(){try{const e=await $("/contacts/export"),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),a=URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download="contacts.json",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(a),1e3),i.toast("Contacts exported.",{type:"success"})}catch{i.toast("Export failed.",{type:"error"})}}const de=p.querySelector(".ct-import-file");de.addEventListener("change",async()=>{const e=de.files?.[0];if(de.value="",!!e)try{const t=JSON.parse(await e.text()),a=Array.isArray(t)?t:t.contacts;if(!Array.isArray(a))throw new Error("Invalid format");const n=await $("/contacts/import","POST",{contacts:a});i.toast(`Imported ${B(n?.imported??0,"contact")}.`,{type:"success"}),y()&&await _()}catch{i.toast("Import failed. The file must be a contacts JSON export.",{type:"error"})}});function W(e,{draftId:t=null}={}){if(d.readOnly){e&&G(e)&&d.openDetails?.(G(e));return}const a=e?G(e):null;e&&!a||be("editor",n=>Bt(a,t,n))}function be(e,t){if(Q[e]||!y())return;const a={};Q[e]=a;const n=()=>{Q[e]===a&&(Q[e]=null)};try{t(n)}catch(c){n(),i.toast("Could not open that panel.",{type:"error"}),console.error(c)}}function Bt(e,t,a){const n=i.slideover({title:e?"Edit contact":t?"New contact (from unsaved changes)":"New contact",size:"lg",position:"right"}),c=(o,r,{type:E="text",mono:k=!1,placeholder:O="",wide:L=!1}={})=>`
|
|
21
21
|
<div${L?' class="ct-wide"':""}>
|
|
22
22
|
<label class="form-label" for="ct-f-${o}">${r}</label>
|
|
23
|
-
<input id="ct-f-${o}" type="${E}" class="form-input${
|
|
23
|
+
<input id="ct-f-${o}" type="${E}" class="form-input${k?" font-mono":""}" placeholder="${O}" data-model="${o}.value">
|
|
24
24
|
</div>`,T=o=>`
|
|
25
25
|
<div class="ct-repeater" data-repeater="${o}">
|
|
26
26
|
<div class="ct-subhead">
|
|
27
|
-
<strong>${
|
|
27
|
+
<strong>${A[o].title} <span data-help="${A[o].help}"></span></strong>
|
|
28
28
|
<button type="button" class="btn btn-sm btn-ghost" data-add="${o}">
|
|
29
|
-
<span data-icon="plus" data-icon-size="13"></span> ${
|
|
29
|
+
<span data-icon="plus" data-icon-size="13"></span> ${A[o].add}</button>
|
|
30
30
|
</div>
|
|
31
31
|
<div class="ct-repeater-list"></div>
|
|
32
|
-
<p class="text-muted text-sm contacts-empty-row">${
|
|
33
|
-
</div>`,
|
|
32
|
+
<p class="text-muted text-sm contacts-empty-row">${A[o].empty}</p>
|
|
33
|
+
</div>`,u=me(`
|
|
34
34
|
<div class="ct-panel">
|
|
35
35
|
<div class="ct-grid">
|
|
36
36
|
<div class="ct-wide">
|
|
37
37
|
<label class="form-label" for="ct-f-name">Name <span class="text-danger">*</span></label>
|
|
38
38
|
<input id="ct-f-name" type="text" class="form-input" placeholder="Full name" data-model="name.value">
|
|
39
39
|
</div>
|
|
40
|
-
${
|
|
41
|
-
${
|
|
40
|
+
${c("email","Email",{type:"email",placeholder:"email@example.com"})}
|
|
41
|
+
${c("phone","Phone",{placeholder:"+44 \u2026"})}
|
|
42
42
|
<div class="ct-wide">
|
|
43
43
|
<label class="form-label" for="ct-f-notes">Notes</label>
|
|
44
44
|
<textarea id="ct-f-notes" class="form-input" rows="3" placeholder="Optional notes\u2026" data-model="notes.value"></textarea>
|
|
@@ -63,15 +63,15 @@ import{arrangeContacts as Wt,countContacts as Ht,DEFAULT_SETTINGS as Je,duplicat
|
|
|
63
63
|
<details class="ct-section">
|
|
64
64
|
<summary>Company, bank & invoicing <span class="ct-section-sum" data-bind-text="billingSummary.value"></span></summary>
|
|
65
65
|
<div class="ct-section-body">
|
|
66
|
-
<p class="ct-panel-meta" style="margin:0">Everything an invoice needs. The Invoices Tool reads these when you bill this contact
|
|
66
|
+
<p class="ct-panel-meta" style="margin:0">Everything an invoice needs. ${d.editorOnly?"Stored with this contact for your billing records.":"The Invoices Tool reads these when you bill this contact."}</p>
|
|
67
67
|
<div class="ct-grid">
|
|
68
|
-
${
|
|
69
|
-
${
|
|
70
|
-
${
|
|
71
|
-
${
|
|
72
|
-
${
|
|
73
|
-
${
|
|
74
|
-
${
|
|
68
|
+
${c("company","Company",{placeholder:"Acme Ltd"})}
|
|
69
|
+
${c("jobTitle","Job title",{placeholder:"Finance Manager"})}
|
|
70
|
+
${c("website","Website",{placeholder:"acme.co.uk"})}
|
|
71
|
+
${c("billingEmail","Billing email",{type:"email",placeholder:"accounts@acme.co.uk"})}
|
|
72
|
+
${c("vatNumber","VAT number",{mono:!0,placeholder:"GB123456789"})}
|
|
73
|
+
${c("companyNumber","Company number",{mono:!0,placeholder:"01234567"})}
|
|
74
|
+
${c("reference","Their reference",{placeholder:"PO-4471"})}
|
|
75
75
|
<div>
|
|
76
76
|
<label class="form-label" for="ct-f-paymentTerms">Payment terms (days)
|
|
77
77
|
<span data-help="Days they have to pay. Empty uses the invoice default."></span></label>
|
|
@@ -90,12 +90,12 @@ import{arrangeContacts as Wt,countContacts as Ht,DEFAULT_SETTINGS as Je,duplicat
|
|
|
90
90
|
<div>
|
|
91
91
|
<div class="ct-subhead"><strong>Bank details <span data-help="Printed on an invoice so it can be paid."></span></strong></div>
|
|
92
92
|
<div class="ct-grid">
|
|
93
|
-
${
|
|
94
|
-
${
|
|
95
|
-
${
|
|
96
|
-
${
|
|
97
|
-
${
|
|
98
|
-
${
|
|
93
|
+
${c("accountName","Account name",{placeholder:"Acme Ltd"})}
|
|
94
|
+
${c("bankName","Bank",{placeholder:"Barclays"})}
|
|
95
|
+
${c("sortCode","Sort code",{mono:!0,placeholder:"20-00-00"})}
|
|
96
|
+
${c("accountNumber","Account number",{mono:!0,placeholder:"12345678"})}
|
|
97
|
+
${c("iban","IBAN",{mono:!0,placeholder:"GB29 NWBK 6016 1331 9268 19"})}
|
|
98
|
+
${c("bic","BIC / SWIFT",{mono:!0,placeholder:"NWBKGB2L"})}
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
101
|
${T("addresses")}
|
|
@@ -114,7 +114,7 @@ import{arrangeContacts as Wt,countContacts as Ht,DEFAULT_SETTINGS as Je,duplicat
|
|
|
114
114
|
<small class="ct-panel-meta" data-bind-text="meta"></small>
|
|
115
115
|
<div class="ct-panel-actions">
|
|
116
116
|
${se.available?'<button type="button" class="btn btn-sm btn-outline" data-on-click="whatsappNow" title="Open the WhatsApp caller with their number">WhatsApp call</button>':""}
|
|
117
|
-
<button type="button" class="btn btn-sm btn-ghost text-danger" data-on-click="del" data-if="
|
|
117
|
+
<button type="button" class="btn btn-sm btn-ghost text-danger" data-on-click="del" data-if="canDelete">
|
|
118
118
|
<span data-icon="trash" data-icon-size="13"></span> Delete
|
|
119
119
|
</button>
|
|
120
120
|
<span class="spacer"></span>
|
|
@@ -122,10 +122,10 @@ import{arrangeContacts as Wt,countContacts as Ht,DEFAULT_SETTINGS as Je,duplicat
|
|
|
122
122
|
<button type="button" class="btn btn-sm btn-primary" data-on-click="save" data-bind-disabled="cannotSave.value">
|
|
123
123
|
<span data-icon="save" data-icon-size="13"></span> Save</button>
|
|
124
124
|
</div>
|
|
125
|
-
</div>`),
|
|
125
|
+
</div>`),h=o=>o==null?"":String(o),l={name:s.observable(h(e?.name)),email:s.observable(h(e?.email)),phone:s.observable(h(e?.phone)),notes:s.observable(h(e?.notes)),favourite:s.observable(e?.favourite===!0),chosen:s.observable(Array.isArray(e?.groups)?[...e.groups]:[]),isEdit:!!e,canDelete:!!e&&!d.editorOnly,meta:e?`Added ${e.createdAt?Ce(e.createdAt).format("D MMM YYYY"):"earlier"}${e.updatedAt?`, last changed ${Ce(e.updatedAt).format("D MMM YYYY HH:mm")}`:""}. Ctrl+Enter saves.`:"Ctrl+Enter saves."};for(const o of Object.keys(pe))l[o]=s.observable(h(e?.[o]));const f=Object.fromEntries(Object.keys(A).map(o=>[o,s.observable(0)]));l.pick=s.observable([]);const I=s.effect(()=>{const o=l.chosen.value;l.pick.value=[...new Set([...C.value,...o])].map(r=>({name:r,on:String(o.includes(r)),cls:o.includes(r)?" is-active":""}))});l.noGroups=s.computed(()=>l.pick.value.length===0),l.cannotSave=s.computed(()=>!l.name.value.trim()),l.billingSummary=s.computed(()=>{const o=[];l.company.value.trim()&&o.push(l.company.value.trim()),l.vatNumber.value.trim()&&o.push("VAT"),(l.sortCode.value.trim()||l.iban.value.trim())&&o.push("bank details");const r=f.addresses.value;return r&&o.push(B(r,"address","addresses")),o.join(" \xB7 ")}),l.extraSummary=s.computed(()=>{const o=f.emails.value+f.phones.value;return o?B(o,"more"):""});function z(o,r){const E=A[o],k=u.querySelector(`[data-repeater="${o}"]`),O=k.querySelector(".ct-repeater-list");O.replaceChildren(),k.querySelector(".contacts-empty-row").style.display=r.length?"none":"",r.forEach((L,R)=>{const j=document.createElement("div");j.className="contacts-row";for(const x of E.columns){if(x.check){const we=document.createElement("label");we.className="form-check contacts-row-check";const q=document.createElement("input");q.type="checkbox",q.className="form-check-input",q.dataset.key=x.key,q.checked=L[x.key]===!0,q.addEventListener("change",()=>{q.checked&&O.querySelectorAll(`input[data-key="${x.key}"]`).forEach(ze=>{ze!==q&&(ze.checked=!1)})});const Se=document.createElement("span");Se.className="form-check-label",Se.textContent=x.label,we.append(q,Se),j.appendChild(we);continue}const V=document.createElement("input");V.type="text",V.className="form-input"+(x.wide?" contacts-row-wide":""),V.dataset.key=x.key,V.placeholder=x.placeholder??"",V.value=L[x.key]??"",j.appendChild(V)}const J=document.createElement("button");J.type="button",J.className="btn btn-sm btn-ghost contacts-row-remove",J.title="Remove",J.textContent="\xD7",J.addEventListener("click",()=>{const x=m(o,{keepBlank:!0});x.splice(R,1),z(o,x)}),j.appendChild(J),O.appendChild(j)}),f[o].value=r.length}function m(o,{keepBlank:r=!1}={}){const E=A[o],k=[...u.querySelectorAll(`[data-repeater="${o}"] .contacts-row`)].map(O=>{const L={};for(const R of E.columns){const j=O.querySelector(`[data-key="${R.key}"]`);L[R.key]=R.check?j?.checked===!0:(j?.value??"").trim()}return L});return r?k:k.filter(O=>Object.entries(O).some(([L,R])=>L!=="label"&&R!==""&&R!==!1))}u.addEventListener("click",o=>{const r=o.target.closest("[data-add]");if(r){const k=r.dataset.add;z(k,[...m(k,{keepBlank:!0}),{}]),u.querySelector(`[data-repeater="${k}"] .contacts-row:last-child input`)?.focus();return}const E=o.target.closest(".ct-pick [data-group]");if(E){const k=E.dataset.group,O=l.chosen.peek();l.chosen.value=O.includes(k)?O.filter(L=>L!==k):[...O,k]}});const w=()=>{const o={name:l.name.peek().trim(),email:l.email.peek().trim(),phone:l.phone.peek().trim(),notes:l.notes.peek().trim(),favourite:l.favourite.peek()===!0,groups:[...l.chosen.peek()]};for(const r of Object.keys(pe))o[r]=String(l[r].peek()??"").trim();for(const r of Object.keys(A))o[r]=m(r);return o};let K=!1,S=e?.id??null;const ae=o=>{u.inert=o,u.classList.toggle("is-saving",o)},Ye=async()=>{if(K||l.cannotSave.peek())return;K=!0,ae(!0);let o=!1;try{const r=w();for(const k of r.groups)C.peek().includes(k)||await te(k);let E;if(S){if(E=await ee(S,r,"Contact saved."),!E)return}else E=await $("/contacts/contacts","POST",r),S=E.id,y()&&(g.value=[...g.peek(),E]),i.toast("Contact added.",{type:"success"});ke.saved({id:E.id??S,was:String(E.updatedAt??"")}),o=await n.close()!==!1}catch(r){i.toast(r?.message||"Failed to save the contact.",{type:"error"})}finally{K=!1,o||ae(!1)}};n.element.appendChild(u),e&&ct(u.querySelector(".related-box"),"contact",e.id,{onOpen:()=>n.close(),name:e.name});const Ut=ne(u);for(const o of Object.keys(A))z(o,Array.isArray(e?.[o])?e[o]:[]);u.querySelector(".ct-pick").innerHTML=vt;const Ft=s.applyBindings(l,u,{methods:{save:Ye,whatsappNow:()=>se.open({phone:l.phone.peek().trim()||Ee(e||{}),name:l.name.peek().trim()}),cancel:()=>n.close(),del:async()=>{e&&await Pe(e.id)&&(ke?.discard(),n.close())},async newGroup(){const o=String(await i.prompt("New group name:")??"").trim();!o||!await te(o)||l.chosen.peek().includes(o)||(l.chosen.value=[...l.chosen.peek(),o])}}});l.billingSummary.peek()&&(u.querySelector(".ct-section").open=!0),u.addEventListener("keydown",o=>{(o.ctrlKey||o.metaKey)&&o.key==="Enter"&&(o.preventDefault(),Ye())}),$e.scan(u),ue(n,()=>{I?.(),Ft.dispose(),Ut(),a(),y()&&setTimeout(()=>{y()&&Me()},0)});const _e=["name","email","phone","notes","favourite","chosen",...Object.keys(pe)],ke=et({so:n,panel:u,tool:"contacts",id:e?.id??t,lifetime:v,was:e?String(e.updatedAt??""):void 0,gone:!!t,noun:"contact",persist:o=>{for(const r of yt)delete o.fields?.[r];return o},read:()=>({fields:Object.fromEntries(_e.map(o=>[o,l[o].peek()])),lists:Object.fromEntries(Object.keys(A).map(o=>[o,m(o,{keepBlank:!0})]))}),write:o=>{for(const r of _e)r in(o.fields||{})&&(l[r].value=o.fields[r]);for(const r of Object.keys(A))z(r,Array.isArray(o.lists?.[r])?o.lists[r]:[]);l.billingSummary.peek()&&(u.querySelector(".ct-section").open=!0)}});t&&ke.asked.then(o=>{o==="thrown"&&n.close()}),n.open(),setTimeout(()=>u.querySelector("#ct-f-name")?.focus(),60)}function Mt(){be("settings",Pt)}function Pt(e){const t=i.slideover({title:"Contacts settings",size:"sm",position:"right"}),a=(l,f,I)=>`
|
|
126
126
|
<div class="ct-setting-row">
|
|
127
|
-
<label class="form-label" for="ct-set-${
|
|
128
|
-
<input id="ct-set-${
|
|
127
|
+
<label class="form-label" for="ct-set-${l}" style="margin:0">${f}${I?` <span data-help="${I}"></span>`:""}</label>
|
|
128
|
+
<input id="ct-set-${l}" type="checkbox" class="form-switch" data-model="${l}.value">
|
|
129
129
|
</div>`,n=me(`
|
|
130
130
|
<div class="ct-panel">
|
|
131
131
|
<div>
|
|
@@ -161,7 +161,7 @@ import{arrangeContacts as Wt,countContacts as Ht,DEFAULT_SETTINGS as Je,duplicat
|
|
|
161
161
|
<span class="spacer"></span>
|
|
162
162
|
<button type="button" class="btn btn-sm btn-primary" data-on-click="done">Done</button>
|
|
163
163
|
</div>
|
|
164
|
-
</div>`),l
|
|
164
|
+
</div>`),c=l=>s.computed({read:()=>M.value[l],write:f=>$t(l,f)}),T=Object.fromEntries(Object.keys(Je).map(l=>[l,c(l)]));t.element.appendChild(n);const u=ne(n),h=s.applyBindings(T,n,{methods:{done:()=>t.close(),reset:()=>{M.value={...Je}}}});ue(t,()=>{h.dispose(),u(),e()}),t.open()}async function je(e){if(!ye(e))return;const t=String(await dt("Rename the group to:",{},e)??"").trim();if(!(!t||t===e||!y()))try{await $(`/contacts/groups/${encodeURIComponent(e)}`,"PUT",{newName:t}),y()&&await _(),i.toast("Group renamed.",{type:"success"})}catch(a){i.toast(a?.message||"Failed to rename the group.",{type:"error"})}}async function qe(e){if(ye(e)&&!(!await i.confirm("Delete this group? Its contacts stay - they are just no longer in it.",{title:"Delete group",confirmText:"Delete group"})||!y()))try{await $(`/contacts/groups/${encodeURIComponent(e)}`,"DELETE"),y()&&await _(),i.toast("Group deleted.",{type:"success"})}catch(t){i.toast(t?.message||"Failed to delete the group.",{type:"error"})}}function he(e,t={}){const a=e.map(n=>({name:n.name,address:oe(n)})).filter(n=>n.address);a.length&&ft(a.length===1?{to:a,...t}:{bcc:a,...t})}function Ue(e,{panel:t=null}={}){const a=!ye(e),n=a?" (not yours to change)":"",c=g.peek().filter(h=>(h.groups||[]).includes(e)),T=c.map(h=>h.id),u=c.filter(h=>oe(h));return[{label:"Show only this group",icon:"filter",action:()=>{N.value={kind:"group",value:e},t?.close()}},{label:`Select its ${B(T.length,"contact")}`,icon:"check-square",disabled:!T.length,action:()=>{N.value={kind:"group",value:e},b.value=new Set(T),t?.close()}},{label:"Email this group\u2026",icon:"mail",disabled:!u.length,action:()=>{t?.close(),he(u)}},{type:"divider"},{label:`Rename\u2026${n}`,icon:"edit",disabled:a,action:()=>je(e)},{label:`Delete\u2026${n}`,icon:"trash",danger:!0,disabled:a,action:()=>qe(e)},...t?[]:[{type:"divider"},{label:"Manage groups\u2026",icon:"folder",action:ve}]]}function ve(){be("groups",Gt)}function Gt(e){const t=i.slideover({title:"Groups",size:"sm",position:"right"}),a=me(`
|
|
165
165
|
<div class="ct-panel">
|
|
166
166
|
<form class="ct-add-group" data-on-submit="add">
|
|
167
167
|
<input type="text" class="form-input" placeholder="New group name\u2026" aria-label="New group name" data-model="draft.value">
|
|
@@ -175,4 +175,4 @@ import{arrangeContacts as Wt,countContacts as Ht,DEFAULT_SETTINGS as Je,duplicat
|
|
|
175
175
|
<div class="ct-groups-rows" data-each="list.value key=name"></div>
|
|
176
176
|
</div>
|
|
177
177
|
<p class="text-muted" data-if="noGroups.value">No groups yet. Add one above.</p>
|
|
178
|
-
</div>`),n=s.observable(""),
|
|
178
|
+
</div>`),n=s.observable(""),c={draft:n,list:s.observable([]),someLocked:s.observable(!1)};let T=!1;fe();const u=s.effect(()=>{const m=Ne.value.groups,w=re.value,K=C.value.map(S=>{const ae=!(w&&w.get(S)===!0);return{name:S,countText:B(m[S]??0,"contact"),locked:ae,lockTitle:ae?"Only its creator, or someone allowed to manage every group, can change this group":""}});c.list.value=K,c.someLocked.value=w!==null&&K.some(S=>S.locked)});c.hasGroups=s.computed(()=>c.list.value.length>0),c.noGroups=s.computed(()=>c.list.value.length===0),c.cannotAdd=s.computed(()=>!n.value.trim());let h=!1;async function l(){const m=n.peek().trim();if(!(!m||h)){h=!0;try{await te(m)&&(await fe(),!T&&n.peek().trim()===m&&(n.value=""),i.toast("Group added.",{type:"success"}))}finally{h=!1}}}a.addEventListener("click",m=>{const w=m.target.closest("[data-act]"),S=m.target.closest(".ct-group-row")?.dataset.group;if(S){if(!w){N.value={kind:"group",value:S},t.close();return}w.disabled||(w.dataset.act==="show"?(N.value={kind:"group",value:S},t.close()):w.dataset.act==="rename"?je(S):w.dataset.act==="delete"&&qe(S))}}),a.addEventListener("keydown",m=>{const w=m.target.closest?.(".ct-group-row");!w||m.target!==w||(m.key==="F10"&&m.shiftKey?(m.preventDefault(),Y(w)):m.key==="Enter"&&(m.preventDefault(),N.value={kind:"group",value:w.dataset.group},t.close()))});const f=i.contextMenu(a,{cursor:"glyph",match:".ct-group-row",inherit:!1,density:"compact",items:m=>m?.dataset.group?Ue(m.dataset.group,{panel:t}):[]});t.element.appendChild(a);const I=ne(a);a.querySelector(".ct-groups-rows").innerHTML=gt;const z=s.applyBindings(c,a,{methods:{add:()=>(l(),!1)}});ue(t,()=>{T=!0,u?.(),z.dispose(),I(),f?.destroy?.(),e()}),t.open()}lt(D,{id:"contacts-settings",icon:"settings",title:"Contacts settings",onClick:Mt}),p.querySelector(".ct-rows").innerHTML=bt,p.querySelector(".ct-chips").innerHTML=ht;const H=p.querySelector(".ct-list"),Fe=p.querySelector(".ct-bar"),ge=p.querySelector(".ct-chips-row"),We=p.querySelector(".ct-bulk");v.add(ne(p,{position:"bottom"}));const Dt=s.applyBindings(Et,p,{methods:{create:()=>W(null),retry:_,reviewOrphan:()=>{const e=X.peek()[0];e&&W(null,{draftId:e.id})},bulkDelete:Nt,clearSelection:()=>{b.value=new Set}}});v.add(()=>Dt.dispose()),!d.readOnly&&!d.editorOnly&&tt({root:p,toolbar:p.querySelector(".ct-bar"),tool:"contacts",endpoint:"/contacts",itemPath:"/contacts",label:"Contacts",titleOf:e=>e.name,reload:_,lifetime:v});const He=d.readOnly||d.editorOnly?null:at({root:p,ensureGroup:te,byId:G,patch:ee,withGroup:Qe,lifetime:v});v.add(s.effect(()=>{const e=M.value;H.classList.toggle("is-compact",e.density==="compact");const t={company:!e.showCompany,email:!e.showEmail,phone:!e.showPhone,groups:!e.showGroups};for(const[n,c]of Object.entries(t))H.classList.toggle(`hide-${n}`,c);const a=d.readOnly||d.editorOnly?["minmax(10rem, 1.4fr)"]:["1.1rem","1.5rem","minmax(10rem, 1.4fr)"];t.company||a.push("minmax(0, 1fr)"),t.email||a.push("minmax(0, 1.2fr)"),t.phone||a.push("minmax(0, .9fr)"),t.groups||a.push("minmax(0, 1fr)"),a.push("1.75rem"),H.style.setProperty("--ct-cols",a.join(" "))}));const It=i.contextMenu(H,{cursor:"glyph",match:".ct-row",inherit:!1,density:"compact",items:e=>{const t=e.dataset.id,a=G(t);if(!a)return[];const n=oe(a),c=Ee(a),T=a.groups||[],u=f=>f.filter(I=>I.visible!==!1&&(!(d.readOnly||d.editorOnly)||["View contact","Copy email","Copy phone",...d.editorOnly?["Edit\u2026"]:[]].includes(I.label))),h=b.peek().has(t)?[...b.peek()].map(G).filter(f=>f&&oe(f)):[],l=rt(Oe,t,f=>f.label.replace("{name}",a.name||"them"));return u([{label:d.readOnly?"View contact":"Edit\u2026",icon:d.readOnly?"eye":"edit",action:()=>W(t)},...l,{type:"divider"},{label:`Email ${n}`,icon:"mail",visible:!!n,action:()=>he([a])},{label:`Email the ${h.length} selected\u2026`,icon:"mail",visible:h.length>1,action:()=>he(h)},{label:`Call ${c}`,icon:"phone",visible:!!c,action:()=>{location.href=`tel:${c.replace(/[^\d+]/g,"")}`}},{label:"Call on WhatsApp\u2026",icon:"phone",visible:se.available&&!!c,action:()=>se.open({phone:c,name:a.name})},{label:"Copy email",icon:"copy",visible:!!n,action:()=>De(n,"Email")},{label:"Copy phone",icon:"copy",visible:!!c,action:()=>De(c,"Phone")},{type:"divider",visible:!!(n||c)},{label:a.favourite===!0?"Unstar":"Star",icon:"star",action:()=>ee(t,{favourite:a.favourite!==!0})},{label:"Groups",icon:"folder",submenu:[...C.peek().map(f=>({label:`${T.includes(f)?"\u2713 ":""}${f}`,action:()=>At(t,f,!T.includes(f))})),...C.peek().length?[{type:"divider"}]:[],{label:"New group\u2026",action:()=>Ge([t])}]},{label:"Duplicate",icon:"copy",action:()=>xt(t)},{label:b.peek().has(t)?"Deselect":"Select",icon:"check-square",action:()=>Ie(t)},{type:"divider"},{label:"Delete",icon:"trash",danger:!0,action:()=>Pe(t)}])}});v.add(()=>It?.destroy?.());const Rt=i.contextMenu(ge,{cursor:"glyph",match:".ct-chip",inherit:!1,density:"compact",items:e=>{const t=e?.dataset.chip||"";return t.startsWith("group:")?Ue(t.slice(6)):[{label:t==="fav"?"Show only starred":"Show everyone",icon:"filter",action:()=>{N.value=t==="fav"?{kind:"fav"}:{kind:"all"}}},{type:"divider"},{label:"Manage groups\u2026",icon:"folder",action:ve}]}});v.add(()=>Rt?.destroy?.()),ge.addEventListener("keydown",e=>{const t=e.target.closest?.(".ct-chip");t&&e.key==="F10"&&e.shiftKey&&(e.preventDefault(),Y(t))});const jt=i.contextMenu(Fe,{cursor:"glyph",match:".ct-more",inherit:!1,density:"compact",items:()=>d.readOnly||d.editorOnly?[{label:"Export all (JSON)",icon:"download",action:Re}]:[{label:"Manage groups\u2026",icon:"folder",action:ve},{type:"divider"},{label:"Export all (JSON)",icon:"download",action:Re},{label:"Import from file\u2026",icon:"upload",action:()=>de.click()},{type:"divider"},{label:"Select all shown",icon:"check-square",disabled:!P.peek().length,action:()=>{b.value=new Set(P.peek().map(e=>e.id))}},{label:"Clear selection",icon:"x",disabled:!b.peek().size,action:()=>{b.value=new Set}}]});v.add(()=>jt?.destroy?.());const qt=i.contextMenu(We,{cursor:"glyph",match:".ct-bulk-group",inherit:!1,density:"compact",items:()=>[...C.peek().map(e=>({label:e,action:()=>Lt(e)})),...C.peek().length?[{type:"divider"}]:[],{label:"New group\u2026",action:()=>Ge([...b.peek()])}]});v.add(()=>qt?.destroy?.()),Fe.addEventListener("click",e=>{const t=e.target.closest(".ct-more");t&&Y(t)}),We.addEventListener("click",e=>{const t=e.target.closest(".ct-bulk-group");t&&Y(t)}),ge.addEventListener("click",e=>{const t=e.target.closest(".ct-chip");if(!t)return;const a=t.dataset.chip;N.value=a==="fav"?{kind:"fav"}:a.startsWith("group:")?{kind:"group",value:a.slice(6)}:{kind:"all"}}),H.addEventListener("click",e=>{if(e.target.closest(".ct-select-all"))return;const t=e.target.closest(".ct-row");if(!t||(d.readOnly||d.editorOnly)&&e.target.closest(".ct-fav, .ct-select"))return;const a=t.dataset.id;if(e.target.closest(".ct-kebab"))return Y(e.target.closest(".ct-kebab"));if(!e.target.closest(".ct-select")){if(e.target.closest(".ct-fav")){const n=G(a);n&&ee(a,{favourite:n.favourite!==!0});return}W(a)}}),H.addEventListener("change",e=>{if(e.target.matches(".ct-select")&&Ie(e.target.closest(".ct-row").dataset.id),e.target.matches(".ct-select-all")){const t=P.peek().map(a=>a.id);b.value=e.target.checked?new Set(t):new Set}}),H.addEventListener("keydown",e=>{const t=e.target.closest?.(".ct-row");!t||e.target!==t||(e.key==="Enter"?(e.preventDefault(),W(t.dataset.id)):e.key==="F10"&&e.shiftKey&&(e.preventDefault(),Y(t.querySelector(".ct-kebab")||t)))});const Ke=e=>{e.ctrlKey||e.metaKey||e.altKey||e.target.closest?.("input, textarea, select, [contenteditable], .dm-slideover")||(e.key==="/"?(e.preventDefault(),Ae.value=!0):(e.key==="n"||e.key==="N")&&(e.preventDefault(),W(null)))};document.addEventListener("keydown",Ke),v.add(()=>document.removeEventListener("keydown",Ke)),$e.scan(p),await _()}}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- Source: @domma-mail/core 0.
|
|
1
|
+
<!-- Source: @domma-mail/core 0.27.0, packages/core/src/admin/contacts/view.html. -->
|
|
2
2
|
<!-- No heading: the banner above (admin/js/lib/plugin-chrome.js) is the title.
|
|
3
3
|
Everything that changes is bound (M.applyBindings) - see admin/js/views/contacts.js, which also
|
|
4
4
|
inserts the row and chip templates: the router renders this file through _.render, eating any {{…}}.
|
|
@@ -184,6 +184,7 @@
|
|
|
184
184
|
</style>
|
|
185
185
|
|
|
186
186
|
<style>
|
|
187
|
+
[data-contacts-read-only][data-contacts-editor] [data-on-click="create"]{display:inline-flex!important}
|
|
187
188
|
[data-contacts-read-only] .ct-head > span:nth-child(2){display:none}
|
|
188
189
|
@media(max-width:640px){[data-contacts-read-only] .ct-row{grid-template-columns:minmax(0,1fr) 1.75rem}}
|
|
189
190
|
[data-contacts-read-only] .ct-select,[data-contacts-read-only] .ct-select-all,[data-contacts-read-only] .ct-fav,[data-contacts-read-only] [data-on-click="create"],[data-contacts-read-only] .ct-bulk{display:none!important}</style>
|
package/docs/DommaFeatures.md
CHANGED
|
@@ -345,7 +345,7 @@ Fast, file-based and friendly.
|
|
|
345
345
|
|
|
346
346
|
- **Media library** - upload by button or by dropping files anywhere on the screen (images, documents, audio, video; 10 MB default limit). Tiles with thumbnail, size, age and type; filter All / Images / Video / Audio / Documents / Other; sort newest, oldest, name or largest. Details slideover with rename, Copy address and Copy for a page (Markdown); right-click menu, F2 to rename, Delete key. Replacing a same-named file asks first.
|
|
347
347
|
- **Files in folders** - the built-in screen lists the top of the library; when there are files in folders it says how many, and they keep working at their addresses (`GET /api/media/_folders`). Managing folders is Media Pro.
|
|
348
|
-
- **Media Pro** (paid, `media-pro`, marketplace; in the Pro bundle since CMS 1.36.0) - takes over the Media screen and every image picker. Nested folders that are real folders (`/media/products/shoes/red.jpg`), drag to move, upload a whole folder keeping its shape, select several (move, tag, shrink, zip, Trash). Moving or renaming anything updates pages, collections and settings that use it and adds a redirect in the SEO Tool; blocks, forms, menus, custom.css and other Tools' data are reported and kept working by that redirect. Used-on list per file, Tidy up (unused, duplicates, big pictures, no alt text), alt text, caption, credit and tags with each file, Replace keeping the address, Shrink (optionally to WebP), upload rules (longest side, remove location data, store as WebP), Trash with restore, thumbnails, `[media-gallery folder="…" /]`. 0.2.0: pages offer phones smaller copies (`srcset`), a focal point per picture is kept in crops, and Claude writes alt text for a person to check, included in the plan (the Manager holds the key: site-manager `mediaAltRoutes.js`, `tools/media-alt`; 5,000 per site per month). Over the same files as the built-in Tool: a lapsed licence loses no file and breaks no address. Hooks in core: `BUILT_IN_TOOLS` takes `media`, `admin.mediaPicker` in a manifest, `openImageEditor(file, {api})`, `mediaUploader(zone, {url})`.
|
|
348
|
+
- **Media Pro** (paid, `media-pro`, marketplace; in the Pro bundle since CMS 1.36.0) - takes over the Media screen and every image picker. Nested folders that are real folders (`/media/products/shoes/red.jpg`), drag to move, upload a whole folder keeping its shape, select several (move, tag, shrink, zip, Trash). Moving or renaming anything updates pages, collections and settings that use it and adds a redirect in the SEO Tool; blocks, forms, menus, custom.css and other Tools' data are reported and kept working by that redirect. Used-on list per file, Tidy up (unused, duplicates, big pictures, no alt text), alt text, caption, credit and tags with each file, Replace keeping the address, Shrink (optionally to WebP), upload rules (longest side, remove location data, store as WebP), Trash with restore, thumbnails, `[media-gallery folder="…" /]`. 0.2.0: pages offer phones smaller copies (`srcset`), a focal point per picture is kept in crops, and Claude writes alt text for a person to check, included in the plan (the Manager holds the key: site-manager `mediaAltRoutes.js`, `tools/media-alt`; 5,000 per site per month). Over the same files as the built-in Tool: a lapsed licence loses no file and breaks no address. Hooks in core: `BUILT_IN_TOOLS` takes `media`, `admin.mediaPicker` in a manifest, `openImageEditor(file, {api})`, `mediaUploader(zone, {url})`. Media Pro 0.3.0 + File Store 0.5.0 (marketplace): with the File Store on the site, files are copied both ways - **Import from the File Store** into the Media folder on screen (your own and shared-with-you files; Media's upload rules, never over another file), **Copy to the File Store** into one of your own folders (the File Store's quota and limits), and **Copy to Media** on the File Store's own file and selection menus (File Store `host.addSelectionMenu` for add-ons).
|
|
349
349
|
- Where: **Content > Media**; `content/media/`; `config/server.json` `uploads.maxFileSize`
|
|
350
350
|
- Since: 0.5.0
|
|
351
351
|
- **Image editor** - edit JPEG, PNG, WebP, GIF or TIFF in place: crop (aspect lock), resize, rotate, flip, colour presets (grayscale, sepia, warm, cool, enhance, sharpen, soften, invert), adjustments, watermark (position, scale, opacity), border (solid, mirror, repeat) and output format (JPEG, PNG, WebP with quality). Save as a copy or overwrite.
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/body-menu.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The reading pane's right-click menu - the pure parts.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/cms-host.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** The CMS shell boundary. Standalone never imports this adapter. */
|
|
4
4
|
const version = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/compose-window.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
const {createMailHost} = await import(new URL(`./host-context.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/contacts.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Recipient suggestions from the host address book.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/diagnostics-section.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The settings section that answers "which build is this, and what went wrong".
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/drag-drop.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Drag identities include the mailbox and source folder: UIDs alone are not unique. */
|
|
4
4
|
const PROTECTED_USES = new Set(['\\Inbox', '\\Sent', '\\Drafts', '\\Trash', '\\Junk', '\\Archive', '\\All', '\\Flagged']);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/folder-tree.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Mail folder presentation, shared by the Mail Reader and Email Pro.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/font-controls.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/fonts.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The fonts and sizes the mail editor offers - pure, so both the compose
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/host-context.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Services supplied by the application that hosts the shared mail interface. */
|
|
4
4
|
export function createMailApi({getToken, fetch: request = globalThis.fetch, onUnauthorized = () => {}}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/identity.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Who a mailbox sends as, and what it signs off with.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/image-senders-section.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The settings section for senders whose images always load.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/keyboard.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Keyboard navigation for the reader.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/message-actions.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* What other Tools add to a message's menu - Booking's "Book Sam...".
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/oauth-panel.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* "Sign in with Microsoft / Google" for a mailbox - the part of the mailbox
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/panes.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Pane sizing for the mail reader, shared by the Mail Reader and Email Pro.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/reader-kit.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The reader view's decisions that need no DOM - escaping, the mailbox form's
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/reader-runtime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
const {createMailHost} = await import(new URL(`./host-context.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/reader-view.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Existing CMS entry point for the shared mail view. */
|
|
4
4
|
const version = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/resizable.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The mail reader's resizable slideovers.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/restore-spam.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Undo restores both junk status and the original folder, following each UID remap. */
|
|
4
4
|
export async function restoreSpam({api, base, account, from, destination, uids, spam}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/scheduling.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/section-kit.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/security-note.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* What the reader says about a signed or encrypted (S/MIME) message.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/settings-section.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Browser preferences for the shared mail reader. */
|
|
4
4
|
export const READ_DELAY_KEY = 'domma-mail.mark-read-seconds';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/templates.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/threads.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Grouping messages into conversations.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/vacation.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The automatic reply, and everything that must stop it.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.27.0, packages/core/src/admin/mail/when-closed.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Run code when a Domma modal or slideover actually closes.
|