@nyaruka/temba-components 0.26.9 → 0.26.10
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 +9 -0
- package/dist/{d0cc86be.js → cbffa348.js} +213 -109
- package/dist/index.js +213 -109
- package/dist/static/icons/symbol-defs.svg +35 -4
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/templates/components-body.html +1 -1
- package/dist/templates/components-head.html +1 -1
- package/out-tsc/src/contacts/ContactBadges.js +97 -0
- package/out-tsc/src/contacts/ContactBadges.js.map +1 -0
- package/out-tsc/src/contacts/ContactFieldEditor.js +53 -41
- package/out-tsc/src/contacts/ContactFieldEditor.js.map +1 -1
- package/out-tsc/src/contacts/ContactFields.js +86 -29
- package/out-tsc/src/contacts/ContactFields.js.map +1 -1
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/label/Label.js +25 -0
- package/out-tsc/src/label/Label.js.map +1 -1
- package/out-tsc/src/list/TembaMenu.js +8 -6
- package/out-tsc/src/list/TembaMenu.js.map +1 -1
- package/out-tsc/src/store/Store.js +16 -0
- package/out-tsc/src/store/Store.js.map +1 -1
- package/out-tsc/src/tabpane/Tab.js +14 -1
- package/out-tsc/src/tabpane/Tab.js.map +1 -1
- package/out-tsc/src/tabpane/TabPane.js +35 -0
- package/out-tsc/src/tabpane/TabPane.js.map +1 -1
- package/out-tsc/src/textinput/TextInput.js +2 -2
- package/out-tsc/src/textinput/TextInput.js.map +1 -1
- package/out-tsc/src/vectoricon/VectorIcon.js +13 -2
- package/out-tsc/src/vectoricon/VectorIcon.js.map +1 -1
- package/out-tsc/temba-modules.js +6 -6
- package/out-tsc/temba-modules.js.map +1 -1
- package/package.json +1 -1
- package/src/contacts/ContactBadges.ts +104 -0
- package/src/contacts/ContactFieldEditor.ts +55 -41
- package/src/contacts/ContactFields.ts +99 -33
- package/src/interfaces.ts +3 -1
- package/src/label/Label.ts +25 -0
- package/src/list/TembaMenu.ts +7 -5
- package/src/store/Store.ts +24 -1
- package/src/tabpane/Tab.ts +14 -1
- package/src/tabpane/TabPane.ts +36 -0
- package/src/textinput/TextInput.ts +2 -2
- package/src/vectoricon/VectorIcon.ts +15 -2
- package/static/css/temba-components.css +3 -0
- package/static/icons/Read Me.txt +1 -1
- package/static/icons/SVG/bookmark-filled.svg +5 -0
- package/static/icons/SVG/bookmark.svg +1 -1
- package/static/icons/SVG/external-link1.svg +5 -0
- package/static/icons/SVG/globe.svg +5 -0
- package/static/icons/SVG/language.svg +5 -0
- package/static/icons/SVG/search.svg +5 -0
- package/static/icons/demo-external-svg.html +218 -165
- package/static/icons/demo-files/demo.css +6 -3
- package/static/icons/demo.html +253 -169
- package/static/icons/selection.json +318 -184
- package/static/icons/style.css +4 -0
- package/static/icons/symbol-defs.svg +35 -4
- package/temba-modules.ts +7 -6
|
@@ -107,9 +107,7 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
107
107
|
display: flex;
|
|
108
108
|
flex-direction: row;
|
|
109
109
|
align-items: stretch;
|
|
110
|
-
|
|
111
110
|
box-shadow: var(--widget-box-shadow);
|
|
112
|
-
|
|
113
111
|
caret-color: var(--input-caret);
|
|
114
112
|
}
|
|
115
113
|
|
|
@@ -134,6 +132,8 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
134
132
|
border-color: var(--color-focus);
|
|
135
133
|
background: var(--color-widget-bg-focused);
|
|
136
134
|
box-shadow: var(--widget-box-shadow-focused);
|
|
135
|
+
z-index: 10000;
|
|
136
|
+
position: relative;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
.input-container:hover {
|
|
@@ -286,7 +286,7 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
286
286
|
<slot></slot>
|
|
287
287
|
</div>
|
|
288
288
|
</temba-field>
|
|
289
|
-
`}}__decorate([e$2({type:Boolean})],TextInput.prototype,"textarea",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"datepicker",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"datetimepicker",void 0),__decorate([e$2({type:String})],TextInput.prototype,"placeholder",void 0),__decorate([e$2({type:String})],TextInput.prototype,"value",void 0),__decorate([e$2({type:String})],TextInput.prototype,"name",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"password",void 0),__decorate([e$2({type:Number})],TextInput.prototype,"maxlength",void 0),__decorate([e$2({type:Object})],TextInput.prototype,"inputElement",void 0),__decorate([e$2({type:Object})],TextInput.prototype,"dateElement",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"clearable",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"gsm",void 0),__decorate([e$2({type:String})],TextInput.prototype,"counter",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"loading",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"submitOnEnter",void 0),__decorate([e$2()],TextInput.prototype,"onBlur",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"disabled",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"autogrow",void 0);const DATE_FORMAT=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,getHTTPCookie=l=>{for(const n of document.cookie.split(";")){const e=n.indexOf("=");let t=n.substr(0,e),i=n.substr(e+1);if(t=t.trim(),i=i.trim(),t===l)return i}return null},getHeaders=(l={})=>{const n=getHTTPCookie("csrftoken"),e=n?{"X-CSRFToken":n}:{};return e["X-Requested-With"]="XMLHttpRequest",Object.keys(l).forEach((n=>{e[n]=l[n]})),e},getUrl=(l,n=null,e={})=>new Promise(((t,i)=>{const o={method:"GET",headers:getHeaders(e)};n&&(o.signal=n.signal),fetch(l,o).then((l=>{l.text().then((e=>{let i={};try{i=JSON.parse(e)}catch(l){}t({body:e,json:i,status:l.status,headers:l.headers,controller:n})}))})).catch((l=>{i(l)}))})),getClasses=l=>{const n=[];Object.keys(l).forEach((e=>{l[e]&&n.push(e)}));let e=n.join(" ");return e.trim().length>0&&(e=" "+e),e},fetchResultsPage=(l,n=null)=>new Promise(((e,t)=>{getUrl(l,n).then((l=>{e({results:l.json.results,next:l.json.next})})).catch((l=>t(l)))})),fetchResults=async l=>{if(!l)return new Promise((l=>l([])));let n=[],e=l;for(;e;){const l=await fetchResultsPage(e);l.results&&(n=n.concat(l.results)),e=l.next}return n},getAssetPage=l=>new Promise(((n,e)=>{getUrl(l).then((l=>{n({assets:l.json.results,next:l.json.next})})).catch((l=>e(l)))})),getAssets=async l=>{if(!l)return new Promise((l=>l([])));let n=[],e=l;for(;e;){const l=await getAssetPage(e);n=n.concat(l.assets),e=l.next}return n},postUrl=(l,n,e={},t=null)=>{const i=getHeaders(e);t&&(i["Content-Type"]=t);const o={method:"POST",headers:i,body:n};return new Promise(((n,e)=>{fetch(l,o).then((async l=>{l.text().then((e=>{let t={};try{t=JSON.parse(e)}catch(l){}n({body:e,json:t,status:l.status,headers:l.headers})}))})).catch((l=>{e(l)}))}))},postJSON=(l,n)=>postUrl(l,JSON.stringify(n),!1,"application/json"),range=(l,n)=>Array.from({length:n-l},((n,e)=>e+l)),serialize=function(l){const n=[];for(let e=0;e<l.elements.length;e++){const t=l.elements[e];if(t.name&&!t.disabled&&"file"!==t.type&&"reset"!==t.type&&"submit"!==t.type&&"button"!==t.type)if("select-multiple"===t.type)for(let l=0;l<t.options.length;l++)t.options[l].selected&&n.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.options[l].value));else("checkbox"!==t.type&&"radio"!==t.type||t.checked)&&n.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.value))}return n.join("&")},getScrollParent=l=>{const n=l.parentNode||l.host;if(n){const l=n instanceof HTMLElement&&window.getComputedStyle(n).overflowY,e=l&&!(l.includes("hidden")||l.includes("visible"));return n?e&&n.scrollHeight>=n.clientHeight?n:getScrollParent(n):null}return null},isElementVisible=(l,n)=>{n=n||document.body;const{top:e,bottom:t}=l.getBoundingClientRect(),i=n.getBoundingClientRect();return e<=i.top?t>i.top:t<i.bottom},HOUR=3600,DAY=24*HOUR,MONTH=30*DAY;class Stubbable{getCurrentDate(){return new Date}}const stubbable=new Stubbable,timeSince=(l,n={suffix:""})=>{const{compareDate:e,hideRecentText:t,suffix:i}=n,o=e||stubbable.getCurrentDate(),u=Math.floor((o.getTime()-l.getTime())/1e3);if(u<60)return e?u+"s"+i:!t&&i?i:"just now";if(u<HOUR)return Math.round(u/60)+"m"+i;if(u<=DAY)return Math.round(u/HOUR)+"h"+i;if(u<=MONTH)return Math.round(u/DAY)+"d"+i;if(u<6*MONTH)return Math.round(u/MONTH)+"mth"+i;return l.getDate()+" "+l.toDateString().match(/ [a-zA-Z]*/)[0].replace(" ","")+(l.getFullYear()==o.getFullYear()?"":" "+l.getFullYear())},isDate=l=>"[object Date]"===toString.call(l)||("function"==typeof l.replace&&l.replace(/^\s+|\s+$/gm,""),DATE_FORMAT.test(l)),throttle=(l,n)=>{let e=!0;return function(...t){e&&(e=!1,l.apply(this,t),setTimeout((()=>{e=!0}),n))}},truncate=(l,n)=>l.length>n?l.substring(0,n)+"...":l,oxford=(l,n="and")=>1===l.length?l[0]:2===l.length?"html"===l[0].type?$`${l[0]} ${n} ${l[1]}`:l.join(" "+n+" "):"html"===l[0].type?l.map(((e,t)=>t<l.length-1?$`${e}, `:$`${n} ${e}`)):l.join(", ")+n+l[l.length-1],oxfordFn=(l,n,e="and")=>oxford(l.map(n),e),oxfordNamed=(l,n="and")=>oxfordFn(l,(l=>l.name),n),setCookie=(l,n,e)=>{if(!e){const l=document.location.pathname;e=l.substring(0,l.indexOf("/",1))}const t=new Date;t.setTime(t.getTime()+2592e6),document.cookie=`${l}=${n};expires=${t.toUTCString()};path=${e}`},getCookie=l=>{let n=null;if(document.cookie&&""!=document.cookie){const e=document.cookie.split(";");for(let t=0;t<e.length;t++){const i=e[t].trim();if(i.substring(0,l.length+1)==l+"="){n=decodeURIComponent(i.substring(l.length+1));break}}}return n},getCookieBoolean=l=>"true"===(getCookie(l)||"");var COOKIE_KEYS,CustomEventType;!function(l){l.MENU_COLLAPSED="menu-collapsed",l.TICKET_SHOW_DETAILS="tickets.show-details"}(COOKIE_KEYS||(COOKIE_KEYS={})),function(l){l.Loaded="temba-loaded",l.Canceled="temba-canceled",l.CursorChanged="temba-cursor-changed",l.Refreshed="temba-refreshed",l.Selection="temba-selection",l.ButtonClicked="temba-button-clicked",l.DialogHidden="temba-dialog-hidden",l.ScrollThreshold="temba-scroll-threshold",l.ContentChanged="temba-content-changed",l.ContextChanged="temba-context-changed",l.FetchComplete="temba-fetch-complete",l.Submitted="temba-submitted",l.Redirected="temba-redirected",l.NoPath="temba-no-path",l.StoreUpdated="temba-store-updated"}(CustomEventType||(CustomEventType={}));class t{constructor(l=0,n=0){this.first=null,this.items=Object.create(null),this.last=null,this.max=l,this.size=0,this.ttl=n}has(l){return l in this.items}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(l){if(this.has(l)){const n=this.items[l];delete this.items[l],this.size--,null!==n.prev&&(n.prev.next=n.next),null!==n.next&&(n.next.prev=n.prev),this.first===n&&(this.first=n.next),this.last===n&&(this.last=n.prev)}return this}evict(l=!1){if(l||this.size>0){const l=this.first;delete this.items[l.key],this.size--,0===this.size?(this.first=null,this.last=null):(this.first=l.next,this.first.prev=null)}return this}get(l){let n;if(this.has(l)){const e=this.items[l];this.ttl>0&&e.expiry<=(new Date).getTime()?this.delete(l):(n=e.value,this.set(l,n,!0))}return n}keys(){return Object.keys(this.items)}set(l,n,e=!1){let t;if(e||this.has(l)){if(t=this.items[l],t.value=n,this.last!==t){const l=this.last,n=t.next,e=t.prev;this.first===t&&(this.first=t.next),t.next=null,t.prev=this.last,l.next=t,null!==e&&(e.next=n),null!==n&&(n.prev=e)}}else this.max>0&&this.size===this.max&&this.evict(!0),t=this.items[l]={expiry:this.ttl>0?(new Date).getTime()+this.ttl:this.ttl,key:l,prev:this.last,next:null,value:n},1==++this.size?this.first=t:this.last.next=t;return this.last=t,this}}function s(l=1e3,n=0){if(isNaN(l)||l<0)throw new TypeError("Invalid max value");if(isNaN(n)||n<0)throw new TypeError("Invalid ttl value");return new t(l,n)}class Store extends RapidElement{constructor(){super(...arguments),this.ttl=6e4,this.max=20,this.keyedAssets={},this.fields={},this.groups={},this.pinnedFields=[],this.pendingResolves={},this.fetching={}}firstUpdated(){this.cache=s(this.max,this.ttl);const l=[];this.completionEndpoint&&l.push(getUrl(this.completionEndpoint).then((l=>{this.schema=l.json.context,this.fnOptions=l.json.functions}))),this.fieldsEndpoint&&l.push(getAssets(this.fieldsEndpoint).then((l=>{this.keyedAssets.fields=[],this.pinnedFields=[],l.forEach((l=>{this.keyedAssets.fields.push(l.key),this.fields[l.key]=l,l.pinned&&this.pinnedFields.push(l)})),this.pinnedFields.sort(((l,n)=>n.priority-l.priority))}))),this.globalsEndpoint&&l.push(getAssets(this.globalsEndpoint).then((l=>{this.keyedAssets.globals=l.map((l=>l.key))}))),this.groupsEndpoint&&l.push(getAssets(this.groupsEndpoint).then((l=>{l.forEach((l=>{this.groups[l.uuid]=l}))}))),this.httpComplete=Promise.all(l)}setKeyedAssets(l,n){this.keyedAssets[l]=n}updated(l){super.updated(l)}getCompletionSchema(){return this.schema}getFunctions(){return this.fnOptions}getKeyedAssets(){return this.keyedAssets}getContactField(l){return this.fields[l]}getPinnedFields(){return this.pinnedFields}isDynamicGroup(l){const n=this.groups[l];return!(!n||!n.query)}getUrl(l,n){return!(n=n||{}).force&&this.cache.has(l)?new Promise((n=>{n(this.cache.get(l))})):getUrl(l,n.controller,n.headers||{}).then((n=>new Promise(((e,t)=>{n.status>=200&&n.status<=300?(this.cache.set(l,n),e(n)):t("Status: "+n.status)}))))}getResults(l,n){n=n||{};const e="results_"+l,t=this.cache.get(e);return!n.force&&t?new Promise((l=>{l(t)})):new Promise((n=>{const t=this.pendingResolves[l]||[];t.push(n),this.pendingResolves[l]=t,t.length<=1&&fetchResults(l).then((n=>{this.cache.set(e,n);const t=this.pendingResolves[l]||[];for(;t.length>0;){t.pop()(n)}}))}))}makeRequest(l,n){const e=this.fetching[l],t=(new Date).getTime();if(e&&t-e<500)return;this.fetching[l]=t,n=n||{};const i=this.cache.get(l);i&&!n.force?this.fireCustomEvent(CustomEventType.StoreUpdated,{url:l,data:i}):fetchResults(l).then((e=>{e=n.prepareData?n.prepareData(e):e,this.cache.set(l,e),this.fireCustomEvent(CustomEventType.StoreUpdated,{url:l,data:e}),delete this.fetching[l]}))}}__decorate([e$2({type:Number})],Store.prototype,"ttl",void 0),__decorate([e$2({type:Number})],Store.prototype,"max",void 0),__decorate([e$2({type:String,attribute:"completion"})],Store.prototype,"completionEndpoint",void 0),__decorate([e$2({type:String,attribute:"fields"})],Store.prototype,"fieldsEndpoint",void 0),__decorate([e$2({type:String,attribute:"groups"})],Store.prototype,"groupsEndpoint",void 0),__decorate([e$2({type:String,attribute:"globals"})],Store.prototype,"globalsEndpoint",void 0),__decorate([e$2({type:Object,attribute:!1})],Store.prototype,"schema",void 0),__decorate([e$2({type:Object,attribute:!1})],Store.prototype,"fnOptions",void 0),__decorate([e$2({type:Object,attribute:!1})],Store.prototype,"keyedAssets",void 0);class Options extends RapidElement{constructor(){super(...arguments),this.marginHorizontal=0,this.marginVertical=7,this.scrollPct=75,this.cursorIndex=-1,this.nameKey="name",this.loading=!1,this.getName=function(l){return l[this.nameKey||"name"]},this.renderInputOption=function(){return null},this.scrollHeight=0,this.triggerScroll=!1,this.scrollParent=null,this.setCursor=throttle((function(l){l!==this.cursorIndex&&(this.cursorIndex=l)}),50)}static get styles(){return r$2`
|
|
289
|
+
`}}__decorate([e$2({type:Boolean})],TextInput.prototype,"textarea",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"datepicker",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"datetimepicker",void 0),__decorate([e$2({type:String})],TextInput.prototype,"placeholder",void 0),__decorate([e$2({type:String})],TextInput.prototype,"value",void 0),__decorate([e$2({type:String})],TextInput.prototype,"name",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"password",void 0),__decorate([e$2({type:Number})],TextInput.prototype,"maxlength",void 0),__decorate([e$2({type:Object})],TextInput.prototype,"inputElement",void 0),__decorate([e$2({type:Object})],TextInput.prototype,"dateElement",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"clearable",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"gsm",void 0),__decorate([e$2({type:String})],TextInput.prototype,"counter",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"loading",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"submitOnEnter",void 0),__decorate([e$2()],TextInput.prototype,"onBlur",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"disabled",void 0),__decorate([e$2({type:Boolean})],TextInput.prototype,"autogrow",void 0);const DATE_FORMAT=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,getHTTPCookie=l=>{for(const n of document.cookie.split(";")){const e=n.indexOf("=");let t=n.substr(0,e),i=n.substr(e+1);if(t=t.trim(),i=i.trim(),t===l)return i}return null},getHeaders=(l={})=>{const n=getHTTPCookie("csrftoken"),e=n?{"X-CSRFToken":n}:{};return e["X-Requested-With"]="XMLHttpRequest",Object.keys(l).forEach((n=>{e[n]=l[n]})),e},getUrl=(l,n=null,e={})=>new Promise(((t,i)=>{const o={method:"GET",headers:getHeaders(e)};n&&(o.signal=n.signal),fetch(l,o).then((l=>{l.text().then((e=>{let i={};try{i=JSON.parse(e)}catch(l){}t({body:e,json:i,status:l.status,headers:l.headers,controller:n})}))})).catch((l=>{i(l)}))})),getClasses=l=>{const n=[];Object.keys(l).forEach((e=>{l[e]&&n.push(e)}));let e=n.join(" ");return e.trim().length>0&&(e=" "+e),e},fetchResultsPage=(l,n=null)=>new Promise(((e,t)=>{getUrl(l,n).then((l=>{e({results:l.json.results,next:l.json.next})})).catch((l=>t(l)))})),fetchResults=async l=>{if(!l)return new Promise((l=>l([])));let n=[],e=l;for(;e;){const l=await fetchResultsPage(e);l.results&&(n=n.concat(l.results)),e=l.next}return n},getAssetPage=l=>new Promise(((n,e)=>{getUrl(l).then((l=>{n({assets:l.json.results,next:l.json.next})})).catch((l=>e(l)))})),getAssets=async l=>{if(!l)return new Promise((l=>l([])));let n=[],e=l;for(;e;){const l=await getAssetPage(e);n=n.concat(l.assets),e=l.next}return n},postUrl=(l,n,e={},t=null)=>{const i=getHeaders(e);t&&(i["Content-Type"]=t);const o={method:"POST",headers:i,body:n};return new Promise(((n,e)=>{fetch(l,o).then((async l=>{l.text().then((e=>{let t={};try{t=JSON.parse(e)}catch(l){}n({body:e,json:t,status:l.status,headers:l.headers})}))})).catch((l=>{e(l)}))}))},postJSON=(l,n)=>postUrl(l,JSON.stringify(n),!1,"application/json"),range=(l,n)=>Array.from({length:n-l},((n,e)=>e+l)),serialize=function(l){const n=[];for(let e=0;e<l.elements.length;e++){const t=l.elements[e];if(t.name&&!t.disabled&&"file"!==t.type&&"reset"!==t.type&&"submit"!==t.type&&"button"!==t.type)if("select-multiple"===t.type)for(let l=0;l<t.options.length;l++)t.options[l].selected&&n.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.options[l].value));else("checkbox"!==t.type&&"radio"!==t.type||t.checked)&&n.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.value))}return n.join("&")},getScrollParent=l=>{const n=l.parentNode||l.host;if(n){const l=n instanceof HTMLElement&&window.getComputedStyle(n).overflowY,e=l&&!(l.includes("hidden")||l.includes("visible"));return n?e&&n.scrollHeight>=n.clientHeight?n:getScrollParent(n):null}return null},isElementVisible=(l,n)=>{n=n||document.body;const{top:e,bottom:t}=l.getBoundingClientRect(),i=n.getBoundingClientRect();return e<=i.top?t>i.top:t<i.bottom},HOUR=3600,DAY=24*HOUR,MONTH=30*DAY;class Stubbable{getCurrentDate(){return new Date}}const stubbable=new Stubbable,timeSince=(l,n={suffix:""})=>{const{compareDate:e,hideRecentText:t,suffix:i}=n,o=e||stubbable.getCurrentDate(),u=Math.floor((o.getTime()-l.getTime())/1e3);if(u<60)return e?u+"s"+i:!t&&i?i:"just now";if(u<HOUR)return Math.round(u/60)+"m"+i;if(u<=DAY)return Math.round(u/HOUR)+"h"+i;if(u<=MONTH)return Math.round(u/DAY)+"d"+i;if(u<6*MONTH)return Math.round(u/MONTH)+"mth"+i;return l.getDate()+" "+l.toDateString().match(/ [a-zA-Z]*/)[0].replace(" ","")+(l.getFullYear()==o.getFullYear()?"":" "+l.getFullYear())},isDate=l=>"[object Date]"===toString.call(l)||("function"==typeof l.replace&&l.replace(/^\s+|\s+$/gm,""),DATE_FORMAT.test(l)),throttle=(l,n)=>{let e=!0;return function(...t){e&&(e=!1,l.apply(this,t),setTimeout((()=>{e=!0}),n))}},truncate=(l,n)=>l.length>n?l.substring(0,n)+"...":l,oxford=(l,n="and")=>1===l.length?l[0]:2===l.length?"html"===l[0].type?$`${l[0]} ${n} ${l[1]}`:l.join(" "+n+" "):"html"===l[0].type?l.map(((e,t)=>t<l.length-1?$`${e}, `:$`${n} ${e}`)):l.join(", ")+n+l[l.length-1],oxfordFn=(l,n,e="and")=>oxford(l.map(n),e),oxfordNamed=(l,n="and")=>oxfordFn(l,(l=>l.name),n),setCookie=(l,n,e)=>{if(!e){const l=document.location.pathname;e=l.substring(0,l.indexOf("/",1))}const t=new Date;t.setTime(t.getTime()+2592e6),document.cookie=`${l}=${n};expires=${t.toUTCString()};path=${e}`},getCookie=l=>{let n=null;if(document.cookie&&""!=document.cookie){const e=document.cookie.split(";");for(let t=0;t<e.length;t++){const i=e[t].trim();if(i.substring(0,l.length+1)==l+"="){n=decodeURIComponent(i.substring(l.length+1));break}}}return n},getCookieBoolean=l=>"true"===(getCookie(l)||"");var COOKIE_KEYS,CustomEventType;!function(l){l.MENU_COLLAPSED="menu-collapsed",l.TICKET_SHOW_DETAILS="tickets.show-details"}(COOKIE_KEYS||(COOKIE_KEYS={})),function(l){l.Loaded="temba-loaded",l.Canceled="temba-canceled",l.CursorChanged="temba-cursor-changed",l.Refreshed="temba-refreshed",l.Selection="temba-selection",l.ButtonClicked="temba-button-clicked",l.DialogHidden="temba-dialog-hidden",l.ScrollThreshold="temba-scroll-threshold",l.ContentChanged="temba-content-changed",l.ContextChanged="temba-context-changed",l.FetchComplete="temba-fetch-complete",l.Submitted="temba-submitted",l.Redirected="temba-redirected",l.NoPath="temba-no-path",l.StoreUpdated="temba-store-updated"}(CustomEventType||(CustomEventType={}));class t{constructor(l=0,n=0){this.first=null,this.items=Object.create(null),this.last=null,this.max=l,this.size=0,this.ttl=n}has(l){return l in this.items}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(l){if(this.has(l)){const n=this.items[l];delete this.items[l],this.size--,null!==n.prev&&(n.prev.next=n.next),null!==n.next&&(n.next.prev=n.prev),this.first===n&&(this.first=n.next),this.last===n&&(this.last=n.prev)}return this}evict(l=!1){if(l||this.size>0){const l=this.first;delete this.items[l.key],this.size--,0===this.size?(this.first=null,this.last=null):(this.first=l.next,this.first.prev=null)}return this}get(l){let n;if(this.has(l)){const e=this.items[l];this.ttl>0&&e.expiry<=(new Date).getTime()?this.delete(l):(n=e.value,this.set(l,n,!0))}return n}keys(){return Object.keys(this.items)}set(l,n,e=!1){let t;if(e||this.has(l)){if(t=this.items[l],t.value=n,this.last!==t){const l=this.last,n=t.next,e=t.prev;this.first===t&&(this.first=t.next),t.next=null,t.prev=this.last,l.next=t,null!==e&&(e.next=n),null!==n&&(n.prev=e)}}else this.max>0&&this.size===this.max&&this.evict(!0),t=this.items[l]={expiry:this.ttl>0?(new Date).getTime()+this.ttl:this.ttl,key:l,prev:this.last,next:null,value:n},1==++this.size?this.first=t:this.last.next=t;return this.last=t,this}}function s(l=1e3,n=0){if(isNaN(l)||l<0)throw new TypeError("Invalid max value");if(isNaN(n)||n<0)throw new TypeError("Invalid ttl value");return new t(l,n)}class Store extends RapidElement{constructor(){super(...arguments),this.ttl=6e4,this.max=20,this.keyedAssets={},this.fields={},this.groups={},this.languages={},this.pinnedFields=[],this.pendingResolves={},this.fetching={}}firstUpdated(){this.cache=s(this.max,this.ttl);const l=[];this.completionEndpoint&&l.push(getUrl(this.completionEndpoint).then((l=>{this.schema=l.json.context,this.fnOptions=l.json.functions}))),this.fieldsEndpoint&&l.push(getAssets(this.fieldsEndpoint).then((l=>{this.keyedAssets.fields=[],this.pinnedFields=[],l.forEach((l=>{this.keyedAssets.fields.push(l.key),this.fields[l.key]=l,l.pinned&&this.pinnedFields.push(l)})),this.pinnedFields.sort(((l,n)=>n.priority-l.priority))}))),this.globalsEndpoint&&l.push(getAssets(this.globalsEndpoint).then((l=>{this.keyedAssets.globals=l.map((l=>l.key))}))),this.languagesEndpoint&&l.push(getAssets(this.languagesEndpoint).then((l=>{this.languages=l.reduce((function(l,n){return l[n.value]=n.name,l}),{})}))),this.groupsEndpoint&&l.push(getAssets(this.groupsEndpoint).then((l=>{l.forEach((l=>{this.groups[l.uuid]=l}))}))),this.httpComplete=Promise.all(l)}setKeyedAssets(l,n){this.keyedAssets[l]=n}updated(l){super.updated(l)}getCompletionSchema(){return this.schema}getFunctions(){return this.fnOptions}getKeyedAssets(){return this.keyedAssets}getContactField(l){return this.fields[l]}getPinnedFields(){return this.pinnedFields}getLanguageName(l){return this.languages[l]}isDynamicGroup(l){const n=this.groups[l];return!(!n||!n.query)}getUrl(l,n){return!(n=n||{}).force&&this.cache.has(l)?new Promise((n=>{n(this.cache.get(l))})):getUrl(l,n.controller,n.headers||{}).then((n=>new Promise(((e,t)=>{n.status>=200&&n.status<=300?(this.cache.set(l,n),e(n)):t("Status: "+n.status)}))))}getResults(l,n){n=n||{};const e="results_"+l,t=this.cache.get(e);return!n.force&&t?new Promise((l=>{l(t)})):new Promise((n=>{const t=this.pendingResolves[l]||[];t.push(n),this.pendingResolves[l]=t,t.length<=1&&fetchResults(l).then((n=>{this.cache.set(e,n);const t=this.pendingResolves[l]||[];for(;t.length>0;){t.pop()(n)}}))}))}makeRequest(l,n){const e=this.fetching[l],t=(new Date).getTime();if(e&&t-e<500)return;this.fetching[l]=t,n=n||{};const i=this.cache.get(l);i&&!n.force?this.fireCustomEvent(CustomEventType.StoreUpdated,{url:l,data:i}):fetchResults(l).then((e=>{e=n.prepareData?n.prepareData(e):e,this.cache.set(l,e),this.fireCustomEvent(CustomEventType.StoreUpdated,{url:l,data:e}),delete this.fetching[l]}))}}__decorate([e$2({type:Number})],Store.prototype,"ttl",void 0),__decorate([e$2({type:Number})],Store.prototype,"max",void 0),__decorate([e$2({type:String,attribute:"completion"})],Store.prototype,"completionEndpoint",void 0),__decorate([e$2({type:String,attribute:"fields"})],Store.prototype,"fieldsEndpoint",void 0),__decorate([e$2({type:String,attribute:"groups"})],Store.prototype,"groupsEndpoint",void 0),__decorate([e$2({type:String,attribute:"globals"})],Store.prototype,"globalsEndpoint",void 0),__decorate([e$2({type:String,attribute:"languages"})],Store.prototype,"languagesEndpoint",void 0),__decorate([e$2({type:Object,attribute:!1})],Store.prototype,"schema",void 0),__decorate([e$2({type:Object,attribute:!1})],Store.prototype,"fnOptions",void 0),__decorate([e$2({type:Object,attribute:!1})],Store.prototype,"keyedAssets",void 0);class Options extends RapidElement{constructor(){super(...arguments),this.marginHorizontal=0,this.marginVertical=7,this.scrollPct=75,this.cursorIndex=-1,this.nameKey="name",this.loading=!1,this.getName=function(l){return l[this.nameKey||"name"]},this.renderInputOption=function(){return null},this.scrollHeight=0,this.triggerScroll=!1,this.scrollParent=null,this.setCursor=throttle((function(l){l!==this.cursorIndex&&(this.cursorIndex=l)}),50)}static get styles(){return r$2`
|
|
290
290
|
.options-container {
|
|
291
291
|
background: var(--color-widget-bg-focused);
|
|
292
292
|
user-select: none;
|
|
@@ -3269,7 +3269,7 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
3269
3269
|
units="4"
|
|
3270
3270
|
style=${i$1(n)}
|
|
3271
3271
|
></temba-loading>`:this.summary?$` <div class="summary">${l}</div> `:null}
|
|
3272
|
-
`}}__decorate([e$2({type:Boolean})],ContactSearch.prototype,"fetching",void 0),__decorate([e$2({type:Boolean})],ContactSearch.prototype,"expanded",void 0),__decorate([e$2({type:String})],ContactSearch.prototype,"endpoint",void 0),__decorate([e$2({type:String})],ContactSearch.prototype,"placeholder",void 0),__decorate([e$2({type:String})],ContactSearch.prototype,"name",void 0),__decorate([e$2({type:String})],ContactSearch.prototype,"query",void 0),__decorate([e$2({type:Number})],ContactSearch.prototype,"inactiveThreshold",void 0),__decorate([e$2({type:Number})],ContactSearch.prototype,"inactiveDays",void 0),__decorate([e$2({attribute:!1})],ContactSearch.prototype,"summary",void 0);const ICON_VERSION=
|
|
3272
|
+
`}}__decorate([e$2({type:Boolean})],ContactSearch.prototype,"fetching",void 0),__decorate([e$2({type:Boolean})],ContactSearch.prototype,"expanded",void 0),__decorate([e$2({type:String})],ContactSearch.prototype,"endpoint",void 0),__decorate([e$2({type:String})],ContactSearch.prototype,"placeholder",void 0),__decorate([e$2({type:String})],ContactSearch.prototype,"name",void 0),__decorate([e$2({type:String})],ContactSearch.prototype,"query",void 0),__decorate([e$2({type:Number})],ContactSearch.prototype,"inactiveThreshold",void 0),__decorate([e$2({type:Number})],ContactSearch.prototype,"inactiveDays",void 0),__decorate([e$2({attribute:!1})],ContactSearch.prototype,"summary",void 0);const ICON_VERSION=12;class VectorIcon extends s$1{constructor(){super(),this.size=1,this.animationDuration=200,this.href="",this.steps=2,this.easing="cubic-bezier(0.68, -0.55, 0.265, 1.55)"}static get styles(){return r$2`
|
|
3273
3273
|
:host {
|
|
3274
3274
|
margin: auto;
|
|
3275
3275
|
--color1: var(--icon-color);
|
|
@@ -3350,21 +3350,22 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
3350
3350
|
margin: calc(-1 * var(--icon-circle-size));
|
|
3351
3351
|
background: var(--icon-background);
|
|
3352
3352
|
}
|
|
3353
|
-
`}firstUpdated(l){super.firstUpdated(l),l.has("animateChange")&&(l.has("animationDuration")||(this.animationDuration=this.steps*this.animationDuration),"spin"===this.animateChange&&(this.steps=3,this.animationDuration=400,this.easing="linear"))}updated(l){super.updated(l),l.has("animationStep")&&(this.lastName&&this.animationStep>=this.steps/2&&(this.lastName=null,this.requestUpdate()),setTimeout((()=>{this.animationStep>0&&this.animationStep<this.steps?this.animationStep++:this.animationStep=0}),this.animationDuration/this.steps)),l.has("name")&&this.animateChange&&(this.lastName=l.get("name"),this.lastName&&this.animateChange&&(this.animationStep=1))}render(){return $`
|
|
3353
|
+
`}firstUpdated(l){super.firstUpdated(l),l.has("animateChange")&&(l.has("animationDuration")||(this.animationDuration=this.steps*this.animationDuration),"spin"===this.animateChange&&(this.steps=3,this.animationDuration=400,this.easing="linear"))}handleClicked(){this.animateClick&&(this.animationStep=1)}updated(l){super.updated(l),l.has("animationStep")&&(this.lastName&&this.animationStep>=this.steps/2&&(this.lastName=null,this.requestUpdate()),setTimeout((()=>{this.animationStep>0&&this.animationStep<this.steps?this.animationStep++:this.animationStep=0}),this.animationDuration/this.steps)),l.has("name")&&this.animateChange&&(this.lastName=l.get("name"),this.lastName&&this.animateChange&&(this.animationStep=1))}render(){return $`
|
|
3354
3354
|
<div
|
|
3355
|
-
|
|
3355
|
+
@click=${this.handleClicked}
|
|
3356
|
+
class="wrapper ${getClasses({clickable:this.clickable,circled:this.circled,animate:!!this.animateChange||!!this.animateClick})}"
|
|
3356
3357
|
>
|
|
3357
3358
|
<svg
|
|
3358
3359
|
style="height:${this.size}em;width:${this.size}em;transition:transform ${this.animationDuration/this.steps}ms
|
|
3359
3360
|
${this.easing}"
|
|
3360
|
-
class="${getClasses({sheet:""===this.href,[this.animateChange]:!!this.animateChange,[this.animateChange+"-"+this.animationStep]:this.animationStep>0})}"
|
|
3361
|
+
class="${getClasses({sheet:""===this.href,[this.animateChange]:!!this.animateChange,[this.animateChange+"-"+this.animationStep]:this.animationStep>0,[this.animateClick]:!!this.animateClick,[this.animateClick+"-"+this.animationStep]:this.animationStep>0})}"
|
|
3361
3362
|
>
|
|
3362
3363
|
<use
|
|
3363
3364
|
href="${this.href?this.href:`${this.prefix||window.static_url||"/static/"}icons/symbol-defs.svg?v=${ICON_VERSION}#icon-${this.lastName||this.name||this.id}`}"
|
|
3364
3365
|
/>
|
|
3365
3366
|
</svg>
|
|
3366
3367
|
</div>
|
|
3367
|
-
`}}var OmniType;__decorate([e$2({type:String})],VectorIcon.prototype,"name",void 0),__decorate([e$2({type:String})],VectorIcon.prototype,"prefix",void 0),__decorate([e$2({type:String})],VectorIcon.prototype,"id",void 0),__decorate([e$2({type:Number})],VectorIcon.prototype,"size",void 0),__decorate([e$2({type:Boolean})],VectorIcon.prototype,"clickable",void 0),__decorate([e$2({type:Boolean})],VectorIcon.prototype,"circled",void 0),__decorate([e$2({type:String})],VectorIcon.prototype,"animateChange",void 0),__decorate([e$2({type:Number})],VectorIcon.prototype,"animationDuration",void 0),__decorate([e$2({type:String})],VectorIcon.prototype,"href",void 0),__decorate([e$2({type:Number,attribute:!1})],VectorIcon.prototype,"steps",void 0),__decorate([e$2({type:Number,attribute:!1})],VectorIcon.prototype,"animationStep",void 0),__decorate([e$2({type:String})],VectorIcon.prototype,"easing",void 0),function(l){l.Group="group",l.Contact="contact",l.Urn="urn"}(OmniType||(OmniType={}));const postNameStyle={color:"var(--color-text-dark)",padding:"0px 6px",fontSize:"12px"};class Omnibox extends RapidElement{constructor(){super(...arguments),this.groups=!1,this.contacts=!1,this.urns=!1,this.value=[],this.placeholder="Select recipients",this.disabled=!1}static get styles(){return r$2`
|
|
3368
|
+
`}}var OmniType;__decorate([e$2({type:String})],VectorIcon.prototype,"name",void 0),__decorate([e$2({type:String})],VectorIcon.prototype,"prefix",void 0),__decorate([e$2({type:String})],VectorIcon.prototype,"id",void 0),__decorate([e$2({type:Number})],VectorIcon.prototype,"size",void 0),__decorate([e$2({type:Boolean})],VectorIcon.prototype,"clickable",void 0),__decorate([e$2({type:Boolean})],VectorIcon.prototype,"circled",void 0),__decorate([e$2({type:String})],VectorIcon.prototype,"animateChange",void 0),__decorate([e$2({type:String})],VectorIcon.prototype,"animateClick",void 0),__decorate([e$2({type:Number})],VectorIcon.prototype,"animationDuration",void 0),__decorate([e$2({type:String})],VectorIcon.prototype,"href",void 0),__decorate([e$2({type:Number,attribute:!1})],VectorIcon.prototype,"steps",void 0),__decorate([e$2({type:Number,attribute:!1})],VectorIcon.prototype,"animationStep",void 0),__decorate([e$2({type:String})],VectorIcon.prototype,"easing",void 0),function(l){l.Group="group",l.Contact="contact",l.Urn="urn"}(OmniType||(OmniType={}));const postNameStyle={color:"var(--color-text-dark)",padding:"0px 6px",fontSize:"12px"};class Omnibox extends RapidElement{constructor(){super(...arguments),this.groups=!1,this.contacts=!1,this.urns=!1,this.value=[],this.placeholder="Select recipients",this.disabled=!1}static get styles(){return r$2`
|
|
3368
3369
|
temba-select:focus {
|
|
3369
3370
|
outline: none;
|
|
3370
3371
|
box-shadow: none;
|
|
@@ -3905,7 +3906,7 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
3905
3906
|
margin-left: 0.75em;
|
|
3906
3907
|
margin-right: 0.75em;
|
|
3907
3908
|
}
|
|
3908
|
-
`}setBubble(l,n){const e=findItem(this.root.items,l);return!(!e||!e.item)&&(e.item.bubble=n,this.requestUpdate("root"),!0)}getMenuItemState(l){let n={};return l&&(n=this.state[l],n||(n={},this.state[l]=n)),n}updated(l){l.has("value")&&this.setSelection((this.value||"").split("/")),l.has("submenu")&&!l.has("value")&&this.setSelection([this.submenu]),l.has("endpoint")&&(this.root={level:-1,endpoint:this.endpoint},this.wait||this.loadItems(this.root))}refresh(l=null){l||(l=[...this.selection]);const n=this.getMenuItemForSelection(l);n.endpoint?this.loadItems(n,!1):(l.pop(),this.refresh(l))}fireNoPath(l){const n=this.getMenuItem(),e={item:n.id,selection:"/"+this.selection.join("/"),endpoint:n.endpoint,path:l+"/"+this.pending.join("/")+document.location.search},t=this.selection.join("/");t.replace(e.path,""),this.selection=t.split("/"),this.fireCustomEvent(CustomEventType.NoPath,e),this.pending=[],this.requestUpdate("root")}loadItems(l,n=!0){l&&l.endpoint&&(l.loading=!0,this.httpComplete=fetchResults(l.endpoint).then((e=>{if(e.forEach((n=>{n.level=l.level+1,n.items&&n.items.forEach((n=>{n.level=l.level+2}))})),l.items=e,l.loading=!1,this.requestUpdate("root"),this.scrollSelectedIntoView(),this.pending&&this.pending.length>0){const l=this.pending.shift();if(l&&e.length>0){const n=findItem(e,l);n.item?this.handleItemClicked(null,n.item):this.fireNoPath(l)}}else if(n&&e.length>0&&this.selection.length>=1&&!l.inline)for(const l of e)if(!l.type){this.handleItemClicked(null,l);break}})))}handleItemClicked(l,n,e=null){if(e&&e.inline&&this.handleItemClicked(null,e),this.collapsed&&(this.collapsed=!1),l&&(l.preventDefault(),l.stopPropagation()),"modax-button"!=n.type)if(n.trigger)new Function(n.trigger)();else if(n.level,n.level>=this.selection.length?this.selection.push(n.vanity_id||n.id):this.selection.splice(n.level,this.selection.length-n.level,n.vanity_id||n.id),n.endpoint)this.loadItems(n,!n.href),this.dispatchEvent(new Event("change"));else{if(this.pending&&this.pending.length>0){const l=this.pending.shift(),n=this.getMenuItem();if(l&&n&&n.items&&n.items.length>0){const e=findItem(n.items,l).item;e?this.handleItemClicked(null,e):this.fireNoPath(l)}else this.fireNoPath(l)}else this.dispatchEvent(new Event("change"));this.requestUpdate("root")}else this.fireCustomEvent(CustomEventType.ButtonClicked,{title:n.name,href:n.href,on_submit:n.on_submit})}scrollSelectedIntoView(){window.setTimeout((()=>{this.shadowRoot.querySelectorAll(".selected").forEach((l=>{l.scrollIntoView({block:"end",behavior:"smooth"})}))}),0)}clickItem(l){const n=[...this.selection];n.splice(n.length-1,1,l);const e=this.getMenuItemForSelection(n);return!!e&&(this.handleItemClicked(null,e),this.scrollSelectedIntoView(),!0)}getMenuItem(){return this.getMenuItemForSelection([...this.selection])}getMenuItemForSelection(l){const n=[...l];let e=this.root.items,t=null;for(;n.length>0;){const l=n.splice(0,1)[0];if(!e)break;if(t=findItem(e,l).item,!t)break;e=t.items}return t}getSelection(){return this.selection}setSelection(l){this.pending=[...l],this.selection=[],this.wait&&(this.wait=!1,this.loadItems(this.root))}setSelectionPath(l){const n=l.split("/").filter((l=>!!l));this.clickItem(n[n.length-1])||(this.wait=!0,this.setSelection(n))}async setFocusedItem(l){const n=l.split("/").filter((l=>!!l));if(n.length>0){if(!findItem(this.root.items,n[0]).item)return}const e=[];let t=this.root;for(;n.length>0;){const l=n.shift();l&&(t.items||(this.loadItems(t,!1),await this.httpComplete),t=findItem(t.items,l).item,t?e.push(l):n.splice(0,n.length))}this.selection=e,this.requestUpdate("root")}isSelected(l){if(l.level<this.selection.length){return this.selection[l.level]==(l.vanity_id||l.id)}return!1}isExpanded(l){return!!this.selection.find((n=>n===l.vanity_id||l.id))}render(){if(!this.root||!this.root.items)return $`<temba-loading
|
|
3909
|
+
`}setBubble(l,n){const e=findItem(this.root.items,l);return!(!e||!e.item)&&(e.item.bubble=n,this.requestUpdate("root"),!0)}getMenuItemState(l){let n={};return l&&(n=this.state[l],n||(n={},this.state[l]=n)),n}updated(l){l.has("value")&&this.setSelection((this.value||"").split("/")),l.has("submenu")&&!l.has("value")&&this.setSelection([this.submenu]),l.has("endpoint")&&(this.root={level:-1,endpoint:this.endpoint},this.wait||this.loadItems(this.root))}refresh(l=null){l||(l=[...this.selection]);const n=this.getMenuItemForSelection(l);n&&(n.endpoint?this.loadItems(n,!1):(l.pop(),this.refresh(l)))}fireNoPath(l){const n=this.getMenuItem(),e={item:n.id,selection:"/"+this.selection.join("/"),endpoint:n.endpoint,path:l+"/"+this.pending.join("/")+document.location.search},t=this.selection.join("/");t.replace(e.path,""),this.selection=t.split("/"),this.fireCustomEvent(CustomEventType.NoPath,e),this.pending=[],this.requestUpdate("root")}loadItems(l,n=!0){l&&l.endpoint&&(l.loading=!0,this.httpComplete=fetchResults(l.endpoint).then((e=>{if(e.forEach((n=>{n.level=l.level+1,n.items&&n.items.forEach((n=>{n.level=l.level+2}))})),l.items=e,l.loading=!1,this.requestUpdate("root"),this.scrollSelectedIntoView(),this.pending&&this.pending.length>0){const l=this.pending.shift();if(l&&e.length>0){const n=findItem(e,l);n.item?this.handleItemClicked(null,n.item):this.fireNoPath(l)}}else if(n&&e.length>0&&this.selection.length>=1&&!l.inline)for(const l of e)if(!l.type){this.handleItemClicked(null,l);break}})))}handleItemClicked(l,n,e=null){if(e&&e.inline&&this.handleItemClicked(null,e),this.collapsed&&(this.collapsed=!1),l&&(l.preventDefault(),l.stopPropagation()),"modax-button"!=n.type)if(n.trigger)new Function(n.trigger)();else if(n.level,n.level>=this.selection.length?this.selection.push(n.vanity_id||n.id):this.selection.splice(n.level,this.selection.length-n.level,n.vanity_id||n.id),n.endpoint)this.loadItems(n,!n.href),this.dispatchEvent(new Event("change"));else{if(this.pending&&this.pending.length>0){const l=this.pending.shift(),n=this.getMenuItem();if(l&&n&&n.items&&n.items.length>0){const e=findItem(n.items,l).item;e?this.handleItemClicked(null,e):this.fireNoPath(l)}else this.fireNoPath(l)}else this.dispatchEvent(new Event("change"));this.requestUpdate("root")}else this.fireCustomEvent(CustomEventType.ButtonClicked,{title:n.name,href:n.href,on_submit:n.on_submit})}scrollSelectedIntoView(){window.setTimeout((()=>{this.shadowRoot.querySelectorAll(".selected").forEach((l=>{l.scrollIntoView({block:"end",behavior:"smooth"})}))}),0)}clickItem(l){const n=[...this.selection];n.splice(n.length-1,1,l);const e=this.getMenuItemForSelection(n);return!!e&&(this.handleItemClicked(null,e),this.scrollSelectedIntoView(),!0)}getMenuItem(){return this.getMenuItemForSelection([...this.selection])}getMenuItemForSelection(l){const n=[...l];let e=this.root.items,t=null;for(;n.length>0;){const l=n.splice(0,1)[0];if(!e)break;if(t=findItem(e,l).item,!t)break;e=t.items}return t}getSelection(){return this.selection}setSelection(l){this.pending=[...l],this.selection=[],this.wait&&(this.wait=!1,this.loadItems(this.root))}setSelectionPath(l){const n=l.split("/").filter((l=>!!l));this.clickItem(n[n.length-1])||(this.wait=!0,this.setSelection(n))}async setFocusedItem(l){const n=l.split("/").filter((l=>!!l));if(n.length>0){if(!findItem(this.root.items,n[0]).item)return}const e=[];let t=this.root;for(;n.length>0;){const l=n.shift();l&&(t.items||(this.loadItems(t,!1),await this.httpComplete),t=findItem(t.items,l).item,t?e.push(l):n.splice(0,n.length))}this.selection=e,this.requestUpdate("root")}isSelected(l){if(l.level<this.selection.length){return this.selection[l.level]==(l.vanity_id||l.id)}return!1}isExpanded(l){return!!this.selection.find((n=>n===l.vanity_id||l.id))}render(){if(!this.root||!this.root.items)return $`<temba-loading
|
|
3909
3910
|
units="3"
|
|
3910
3911
|
size="10"
|
|
3911
3912
|
direction="column"
|
|
@@ -4003,6 +4004,7 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4003
4004
|
margin: 0em 0em;
|
|
4004
4005
|
cursor: pointer;
|
|
4005
4006
|
display: flex;
|
|
4007
|
+
align-items: center;
|
|
4006
4008
|
border-radius: var(--curvature);
|
|
4007
4009
|
border-bottom-right-radius: 0px;
|
|
4008
4010
|
border-bottom-left-radius: 0px;
|
|
@@ -4035,23 +4037,44 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4035
4037
|
.pane.first {
|
|
4036
4038
|
border-top-left-radius: 0px;
|
|
4037
4039
|
}
|
|
4038
|
-
|
|
4040
|
+
|
|
4041
|
+
.badge {
|
|
4042
|
+
margin-left: 0.4em;
|
|
4043
|
+
}
|
|
4044
|
+
|
|
4045
|
+
.count {
|
|
4046
|
+
border-radius: 99px;
|
|
4047
|
+
background: rgba(0, 0, 0, 0.05);
|
|
4048
|
+
color: rgba(0, 0, 0, 0.5);
|
|
4049
|
+
font-size: 0.7em;
|
|
4050
|
+
font-weight: 400;
|
|
4051
|
+
padding: 0.1em 0.4em;
|
|
4052
|
+
min-width: 1em;
|
|
4053
|
+
text-align: center;
|
|
4054
|
+
}
|
|
4055
|
+
`}handleTabClick(l){this.index=parseInt(l.currentTarget.dataset.index),this.requestUpdate("index"),this.fireEvent(CustomEventType.ContextChanged)}updated(l){if(super.updated(l),l.has("index")&&this.children.length>this.index)for(let l=0;l<this.children.length;l++){const n=this.children[l];n.selected=l==this.index,n.selected?n.style.display="flex":n.style.display="none"}}getTab(l){return this.children.item(l)}render(){const l=[];for(const n of this.children)l.push(n);return $`
|
|
4039
4056
|
<div class="tabs">
|
|
4040
4057
|
${l.map(((l,n)=>$`
|
|
4041
4058
|
<div
|
|
4042
4059
|
@click=${this.handleTabClick}
|
|
4043
4060
|
data-index=${n}
|
|
4044
4061
|
class="tab ${n==this.index?"selected":""}"
|
|
4062
|
+
style="${l.selectionColor&&n==this.index?`color:${l.selectionColor};--icon-color:${l.selectionColor};`:""} ${l.selectionBackground&&n==this.index?`background-color:${l.selectionBackground};`:""}"
|
|
4045
4063
|
>
|
|
4046
4064
|
${l.icon?$`<temba-icon name=${l.icon} />`:null}
|
|
4047
4065
|
${l.name}
|
|
4066
|
+
${l.hasBadge()?$`
|
|
4067
|
+
<div class="badge">
|
|
4068
|
+
${l.count>0?$`<div class="count">${l.count}</div>`:null}
|
|
4069
|
+
</div>
|
|
4070
|
+
`:null}
|
|
4048
4071
|
</div>
|
|
4049
4072
|
`))}
|
|
4050
4073
|
</div>
|
|
4051
4074
|
<div class="pane ${0===this.index?"first":null}">
|
|
4052
4075
|
<slot></slot>
|
|
4053
4076
|
</div>
|
|
4054
|
-
`}}__decorate([e$2({type:Number})],TabPane.prototype,"index",void 0);class Tab extends RapidElement{constructor(){super(...arguments),this.selected=!1}static get styles(){return r$2`
|
|
4077
|
+
`}}__decorate([e$2({type:Number})],TabPane.prototype,"index",void 0);class Tab extends RapidElement{constructor(){super(...arguments),this.selected=!1,this.count=0}static get styles(){return r$2`
|
|
4055
4078
|
:host {
|
|
4056
4079
|
display: flex;
|
|
4057
4080
|
flex-direction: column;
|
|
@@ -4068,9 +4091,9 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4068
4091
|
// flex-direction: column;
|
|
4069
4092
|
// flex-grow: 1;
|
|
4070
4093
|
}
|
|
4071
|
-
`}render(){return $`<slot
|
|
4094
|
+
`}hasBadge(){return this.count>0}render(){return $`<slot
|
|
4072
4095
|
class="${getClasses({selected:this.selected})}"
|
|
4073
|
-
></slot
|
|
4096
|
+
></slot> `}}__decorate([e$2({type:String})],Tab.prototype,"name",void 0),__decorate([e$2({type:String})],Tab.prototype,"icon",void 0),__decorate([e$2({type:String})],Tab.prototype,"selectionColor",void 0),__decorate([e$2({type:String})],Tab.prototype,"selectionBackground",void 0),__decorate([e$2({type:Boolean})],Tab.prototype,"selected",void 0),__decorate([e$2({type:Number})],Tab.prototype,"count",void 0);class Label extends s$1{static get styles(){return r$2`
|
|
4074
4097
|
:host {
|
|
4075
4098
|
display: inline-block;
|
|
4076
4099
|
}
|
|
@@ -4115,6 +4138,27 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4115
4138
|
text-shadow: none;
|
|
4116
4139
|
}
|
|
4117
4140
|
|
|
4141
|
+
.tertiary {
|
|
4142
|
+
background: var(--color-label-tertiary);
|
|
4143
|
+
color: var(--color-label-tertiary-text);
|
|
4144
|
+
--icon-color: var(--color-label-tertiary-text);
|
|
4145
|
+
text-shadow: none;
|
|
4146
|
+
}
|
|
4147
|
+
|
|
4148
|
+
.tertiary {
|
|
4149
|
+
background: var(--color-label-tertiary);
|
|
4150
|
+
color: var(--color-label-tertiary-text);
|
|
4151
|
+
--icon-color: var(--color-label-tertiary-text);
|
|
4152
|
+
text-shadow: none;
|
|
4153
|
+
}
|
|
4154
|
+
|
|
4155
|
+
.tertiary {
|
|
4156
|
+
background: var(--color-label-tertiary);
|
|
4157
|
+
color: var(--color-label-tertiary-text);
|
|
4158
|
+
--icon-color: var(--color-label-tertiary-text);
|
|
4159
|
+
text-shadow: none;
|
|
4160
|
+
}
|
|
4161
|
+
|
|
4118
4162
|
.light {
|
|
4119
4163
|
background: var(--color-overlay-light);
|
|
4120
4164
|
color: var(--color-overlay-light-text);
|
|
@@ -4138,7 +4182,7 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4138
4182
|
}
|
|
4139
4183
|
`}render(){const l=this.backgroundColor&&this.textColor?{background:`${this.backgroundColor}`,color:`${this.textColor}`}:{};return $`
|
|
4140
4184
|
<div
|
|
4141
|
-
class="label ${getClasses({clickable:this.clickable,primary:this.primary,secondary:this.secondary,light:this.light,dark:this.dark,shadow:this.shadow})}"
|
|
4185
|
+
class="label ${getClasses({clickable:this.clickable,primary:this.primary,secondary:this.secondary,tertiary:this.tertiary,light:this.light,dark:this.dark,shadow:this.shadow})}"
|
|
4142
4186
|
style=${i$1(l)}
|
|
4143
4187
|
>
|
|
4144
4188
|
<div class="mask">
|
|
@@ -4146,31 +4190,7 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4146
4190
|
<slot></slot>
|
|
4147
4191
|
</div>
|
|
4148
4192
|
</div>
|
|
4149
|
-
`}}__decorate([e$2({type:Boolean})],Label.prototype,"clickable",void 0),__decorate([e$2({type:Boolean})],Label.prototype,"primary",void 0),__decorate([e$2({type:Boolean})],Label.prototype,"secondary",void 0),__decorate([e$2({type:Boolean})],Label.prototype,"light",void 0),__decorate([e$2({type:Boolean})],Label.prototype,"dark",void 0),__decorate([e$2({type:Boolean})],Label.prototype,"shadow",void 0),__decorate([e$2({type:String})],Label.prototype,"icon",void 0),__decorate([e$2()],Label.prototype,"backgroundColor",void 0),__decorate([e$2()],Label.prototype,"textColor",void 0);class
|
|
4150
|
-
.groups {
|
|
4151
|
-
display: flex;
|
|
4152
|
-
flex-wrap: wrap;
|
|
4153
|
-
}
|
|
4154
|
-
|
|
4155
|
-
temba-label {
|
|
4156
|
-
margin: 0.3em;
|
|
4157
|
-
}
|
|
4158
|
-
`}render(){return $`${this.data?$`
|
|
4159
|
-
<div class="groups">
|
|
4160
|
-
${this.data.groups.map((l=>$`
|
|
4161
|
-
<temba-label
|
|
4162
|
-
onclick="goto(event)"
|
|
4163
|
-
href="/contact/filter/${l.uuid}/"
|
|
4164
|
-
icon=${l.is_dynamic?"atom":"users"}
|
|
4165
|
-
clickable
|
|
4166
|
-
light
|
|
4167
|
-
shadow
|
|
4168
|
-
>
|
|
4169
|
-
${l.name}
|
|
4170
|
-
</temba-label>
|
|
4171
|
-
`))}
|
|
4172
|
-
</div>
|
|
4173
|
-
`:null}`}}class ContactName extends ContactStoreElement{constructor(){super(...arguments),this.size=20}static get styles(){return r$2`
|
|
4193
|
+
`}}__decorate([e$2({type:Boolean})],Label.prototype,"clickable",void 0),__decorate([e$2({type:Boolean})],Label.prototype,"primary",void 0),__decorate([e$2({type:Boolean})],Label.prototype,"secondary",void 0),__decorate([e$2({type:Boolean})],Label.prototype,"tertiary",void 0),__decorate([e$2({type:Boolean})],Label.prototype,"light",void 0),__decorate([e$2({type:Boolean})],Label.prototype,"dark",void 0),__decorate([e$2({type:Boolean})],Label.prototype,"shadow",void 0),__decorate([e$2({type:String})],Label.prototype,"icon",void 0),__decorate([e$2()],Label.prototype,"backgroundColor",void 0),__decorate([e$2()],Label.prototype,"textColor",void 0);class ContactName extends ContactStoreElement{constructor(){super(...arguments),this.size=20}static get styles(){return r$2`
|
|
4174
4194
|
:host {
|
|
4175
4195
|
display: flex;
|
|
4176
4196
|
}
|
|
@@ -4201,34 +4221,27 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4201
4221
|
height="${this.size}em"
|
|
4202
4222
|
src="${this.prefix||window.static_url||"/static/"}img/schemes/${l}.svg"
|
|
4203
4223
|
/>
|
|
4204
|
-
`}}__decorate([e$2({type:String})],ContactUrn.prototype,"urn",void 0),__decorate([e$2({type:Number})],ContactUrn.prototype,"size",void 0);class ContactFields extends ContactStoreElement{static get styles(){return r$2`
|
|
4224
|
+
`}}__decorate([e$2({type:String})],ContactUrn.prototype,"urn",void 0),__decorate([e$2({type:Number})],ContactUrn.prototype,"size",void 0);const MIN_FOR_FILTER=10;class ContactFields extends ContactStoreElement{static get styles(){return r$2`
|
|
4205
4225
|
:host {
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
flex-shrink: 1;
|
|
4226
|
+
--curvature-widget: 0px;
|
|
4227
|
+
border-radius: 6px;
|
|
4209
4228
|
}
|
|
4210
4229
|
|
|
4211
4230
|
.field {
|
|
4212
4231
|
display: flex;
|
|
4213
4232
|
margin: 0.3em 0.3em;
|
|
4214
4233
|
box-shadow: 0 0 0.2em rgba(0, 0, 0, 0.15);
|
|
4215
|
-
border-radius:
|
|
4234
|
+
border-radius: 0px;
|
|
4216
4235
|
align-items: center;
|
|
4217
4236
|
overflow: hidden;
|
|
4218
4237
|
}
|
|
4219
4238
|
|
|
4220
|
-
.
|
|
4221
|
-
|
|
4222
|
-
}
|
|
4223
|
-
|
|
4224
|
-
.field.unset {
|
|
4225
|
-
opacity: 0.4;
|
|
4226
|
-
}
|
|
4227
|
-
|
|
4228
|
-
.field.unset .label {
|
|
4239
|
+
.show-all .unset {
|
|
4240
|
+
display: block;
|
|
4229
4241
|
}
|
|
4230
4242
|
|
|
4231
|
-
.
|
|
4243
|
+
.unset {
|
|
4244
|
+
display: none;
|
|
4232
4245
|
}
|
|
4233
4246
|
|
|
4234
4247
|
.field:hover {
|
|
@@ -4239,8 +4252,8 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4239
4252
|
|
|
4240
4253
|
.label {
|
|
4241
4254
|
padding: 0.25em 1em;
|
|
4242
|
-
border-top-left-radius:
|
|
4243
|
-
border-bottom-left-radius:
|
|
4255
|
+
border-top-left-radius: 0px;
|
|
4256
|
+
border-bottom-left-radius: 0px;
|
|
4244
4257
|
color: #777;
|
|
4245
4258
|
font-size: 0.9em;
|
|
4246
4259
|
font-weight: 400;
|
|
@@ -4254,30 +4267,51 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4254
4267
|
overflow: hidden;
|
|
4255
4268
|
text-overflow: ellipsis;
|
|
4256
4269
|
padding: 0.25em 1em;
|
|
4257
|
-
border-top-right-radius:
|
|
4258
|
-
border-bottom-right-radius:
|
|
4270
|
+
border-top-right-radius: 0px;
|
|
4271
|
+
border-bottom-right-radius: 0px;
|
|
4259
4272
|
font-size: 0.9em;
|
|
4260
4273
|
}
|
|
4261
4274
|
|
|
4262
4275
|
temba-contact-field {
|
|
4263
|
-
margin: 0.3em;
|
|
4264
|
-
min-width: 320px;
|
|
4265
|
-
flex-grow: 1;
|
|
4266
4276
|
}
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4277
|
+
|
|
4278
|
+
.footer {
|
|
4279
|
+
margin-bottom: 0;
|
|
4280
|
+
display: flex;
|
|
4281
|
+
background: #fff;
|
|
4282
|
+
align-items: center;
|
|
4283
|
+
margin-top: 0.5em;
|
|
4284
|
+
}
|
|
4285
|
+
`}connectedCallback(){super.connectedCallback(),this.handleFieldChanged=this.handleFieldChanged.bind(this)}updated(l){super.updated(l),l.has("data")&&Object.keys(this.data.fields).length<=MIN_FOR_FILTER&&(this.showAll=!0)}handleFieldChanged(l){const n=l.currentTarget;this.data.fields[n.key]=n.value,postJSON("/api/v2/contacts.json?uuid="+this.data.uuid,{fields:{[n.key]:n.value}}).then((()=>{this.refresh()}))}handleToggle(l){const n=l.currentTarget;console.log(n.checked),this.showAll=n.checked}render(){if(this.data){const l=Object.entries(this.data.fields).filter((l=>this.pinned&&this.store.getContactField(l[0]).pinned||!this.pinned&&!this.store.getContactField(l[0]).pinned)).sort(((l,n)=>{const[e]=l,[t]=n;return e.localeCompare(t)})),n=l.map((l=>{const[n,e]=l,t=this.store.getContactField(n);return $`<temba-contact-field
|
|
4286
|
+
class=${e?"set":"unset"}
|
|
4287
|
+
key=${t.key}
|
|
4288
|
+
name=${t.label}
|
|
4289
|
+
value=${e}
|
|
4290
|
+
type=${t.value_type}
|
|
4272
4291
|
@change=${this.handleFieldChanged}
|
|
4273
|
-
></temba-contact-field>`}
|
|
4292
|
+
></temba-contact-field>`}));return $`
|
|
4293
|
+
<div class="${this.showAll||this.pinned?"show-all":""}">
|
|
4294
|
+
${n}
|
|
4295
|
+
</div>
|
|
4296
|
+
|
|
4297
|
+
${!this.pinned&&Object.keys(this.data.fields).length>=MIN_FOR_FILTER?$` <div class="footer">
|
|
4298
|
+
<div style="flex-grow: 1"></div>
|
|
4299
|
+
<div>
|
|
4300
|
+
<temba-checkbox
|
|
4301
|
+
?checked=${this.showAll}
|
|
4302
|
+
@change=${this.handleToggle}
|
|
4303
|
+
label="Show All"
|
|
4304
|
+
/>
|
|
4305
|
+
</div>
|
|
4306
|
+
</div>`:null}
|
|
4307
|
+
`}return null}}__decorate([e$2({type:Boolean})],ContactFields.prototype,"pinned",void 0),__decorate([e$2({type:Boolean})],ContactFields.prototype,"system",void 0),__decorate([e$2({type:Boolean})],ContactFields.prototype,"dirty",void 0),__decorate([e$2({type:Boolean})],ContactFields.prototype,"showAll",void 0);class ContactFieldEditor extends RapidElement{constructor(){super(...arguments),this.icon=navigator.clipboard?"copy":"",this.iconClass=""}static get styles(){return r$2`
|
|
4274
4308
|
.prefix {
|
|
4275
4309
|
background: rgba(0, 0, 0, 0.05);
|
|
4276
|
-
border-top-left-radius:
|
|
4277
|
-
border-bottom-left-radius:
|
|
4310
|
+
border-top-left-radius: var(--curvature-widget);
|
|
4311
|
+
border-bottom-left-radius: var(--curvature-widget);
|
|
4278
4312
|
color: #888;
|
|
4279
4313
|
cursor: pointer;
|
|
4280
|
-
width:
|
|
4314
|
+
width: 200px;
|
|
4281
4315
|
white-space: nowrap;
|
|
4282
4316
|
overflow: hidden;
|
|
4283
4317
|
text-overflow: ellipsis;
|
|
@@ -4285,10 +4319,14 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4285
4319
|
padding: 0em 0.5em;
|
|
4286
4320
|
}
|
|
4287
4321
|
|
|
4322
|
+
.wrapper {
|
|
4323
|
+
margin-bottom: -1px;
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4288
4326
|
.prefix .name {
|
|
4289
4327
|
padding: 0.5em 0em;
|
|
4290
4328
|
color: #888;
|
|
4291
|
-
width:
|
|
4329
|
+
width: 200px;
|
|
4292
4330
|
white-space: nowrap;
|
|
4293
4331
|
overflow: hidden;
|
|
4294
4332
|
text-overflow: ellipsis;
|
|
@@ -4302,8 +4340,8 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4302
4340
|
.popper {
|
|
4303
4341
|
padding: 0.5em 0.75em;
|
|
4304
4342
|
background: rgba(240, 240, 240, 1);
|
|
4305
|
-
border-top-right-radius:
|
|
4306
|
-
border-bottom-right-radius:
|
|
4343
|
+
border-top-right-radius: var(--curvature-widget);
|
|
4344
|
+
border-bottom-right-radius: var(--curvature-widget);
|
|
4307
4345
|
--icon-color: #888;
|
|
4308
4346
|
opacity: 0;
|
|
4309
4347
|
cursor: default;
|
|
@@ -4314,47 +4352,34 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4314
4352
|
z-index: 1000;
|
|
4315
4353
|
}
|
|
4316
4354
|
|
|
4317
|
-
|
|
4318
|
-
--icon-color:
|
|
4319
|
-
}
|
|
4320
|
-
|
|
4321
|
-
.popper.check {
|
|
4322
|
-
background: rgba(90, 145, 86, 0.15);
|
|
4323
|
-
}
|
|
4324
|
-
|
|
4325
|
-
.popper.none {
|
|
4326
|
-
opacity: 0;
|
|
4355
|
+
temba-icon[name='calendar'] {
|
|
4356
|
+
--icon-color: rgba(0, 0, 0, 0.2);
|
|
4327
4357
|
}
|
|
4328
4358
|
|
|
4329
|
-
|
|
4330
|
-
--icon-color:
|
|
4331
|
-
}
|
|
4332
|
-
|
|
4333
|
-
.popper.corner-down-left {
|
|
4334
|
-
// background: var(--color-primary-dark);
|
|
4335
|
-
// --icon-color: var(--color-text-light);
|
|
4336
|
-
opacity: 1;
|
|
4337
|
-
transform: scale(1);
|
|
4359
|
+
temba-icon:hover {
|
|
4360
|
+
--icon-color: rgba(0, 0, 0, 0.5);
|
|
4338
4361
|
}
|
|
4339
4362
|
|
|
4340
4363
|
temba-icon {
|
|
4341
4364
|
cursor: pointer;
|
|
4365
|
+
--icon-color: rgba(0, 0, 0, 0.3);
|
|
4342
4366
|
}
|
|
4343
4367
|
|
|
4344
|
-
temba-
|
|
4345
|
-
--icon-color: rgb(90, 145, 86);
|
|
4346
|
-
}
|
|
4347
|
-
|
|
4348
|
-
temba-textinput:hover .popper.copy {
|
|
4368
|
+
temba-textinput:hover .popper {
|
|
4349
4369
|
opacity: 1;
|
|
4350
4370
|
transform: scale(1);
|
|
4351
4371
|
}
|
|
4352
4372
|
|
|
4353
|
-
temba-textinput:focus .popper
|
|
4373
|
+
temba-textinput:focus .popper {
|
|
4354
4374
|
opacity: 1;
|
|
4355
4375
|
transform: scale(1);
|
|
4356
4376
|
}
|
|
4357
4377
|
|
|
4378
|
+
.unset temba-textinput:focus .popper,
|
|
4379
|
+
.unset temba-textinput:hover .popper {
|
|
4380
|
+
opacity: 0;
|
|
4381
|
+
}
|
|
4382
|
+
|
|
4358
4383
|
.copy.clicked temba-icon {
|
|
4359
4384
|
transform: scale(1.2);
|
|
4360
4385
|
}
|
|
@@ -4362,8 +4387,12 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4362
4387
|
temba-icon {
|
|
4363
4388
|
transition: all 200ms ease-in-out;
|
|
4364
4389
|
}
|
|
4365
|
-
|
|
4366
|
-
|
|
4390
|
+
|
|
4391
|
+
temba-icon[name='search'] {
|
|
4392
|
+
margin-right: 1em;
|
|
4393
|
+
}
|
|
4394
|
+
`}connectedCallback(){super.connectedCallback(),this.handleInput=this.handleInput.bind(this),this.handleSubmit=this.handleSubmit.bind(this)}handleIconClick(l){const n=l.target.getAttribute("name"),e=this.shadowRoot.querySelector("temba-textinput");"copy"===n&&navigator.clipboard&&(this.iconClass="clicked",navigator.clipboard.writeText(e.getDisplayValue()).then((()=>{window.setTimeout((()=>{this.iconClass=""}),300)}))),"search"===n&&this.fireCustomEvent(CustomEventType.ButtonClicked,{key:this.key,value:this.value}),l.preventDefault(),l.stopPropagation()}handleSubmit(){const l=this.shadowRoot.querySelector("temba-textinput");l.value!==this.value&&(this.value=l.value,this.fireEvent("change")),this.icon=navigator.clipboard?"copy":""}handleChange(l){l.preventDefault(),l.stopPropagation()}handleInput(l){if("Enter"===l.key){l.currentTarget.blur()}}render(){return $`
|
|
4395
|
+
<div class="wrapper ${this.value?"set":"unset"}">
|
|
4367
4396
|
<temba-textinput
|
|
4368
4397
|
value="${this.value?this.value:""}"
|
|
4369
4398
|
?datetimepicker=${"datetime"===this.type}
|
|
@@ -4373,25 +4402,100 @@ function __decorate(l,n,e,t){var i,o=arguments.length,u=o<3?n:null===t?t=Object.
|
|
|
4373
4402
|
>
|
|
4374
4403
|
<div class="prefix" slot="prefix">
|
|
4375
4404
|
<div class="name">${this.name}</div>
|
|
4405
|
+
${"datetime"===this.type?$`<div style="position: relative; padding-top: .75em;">
|
|
4406
|
+
<temba-icon name="calendar" animateclick="pulse" />
|
|
4407
|
+
</div>`:null}
|
|
4376
4408
|
</div>
|
|
4377
4409
|
|
|
4378
4410
|
<div class="postfix">
|
|
4379
|
-
${"datetime"===this.type?$`<div
|
|
4380
|
-
style="position: absolute; padding-top: .75em; padding-left: .75em;"
|
|
4381
|
-
>
|
|
4382
|
-
<temba-icon name="calendar" />
|
|
4383
|
-
</div>`:null}
|
|
4384
|
-
|
|
4385
4411
|
<div
|
|
4386
|
-
class="popper ${this.iconClass}
|
|
4412
|
+
class="popper ${this.iconClass}"
|
|
4387
4413
|
@click=${this.handleIconClick}
|
|
4388
4414
|
>
|
|
4389
|
-
|
|
4415
|
+
${this.value?$`
|
|
4416
|
+
<temba-icon
|
|
4417
|
+
name="search"
|
|
4418
|
+
animateclick="pulse"
|
|
4419
|
+
></temba-icon>
|
|
4420
|
+
</div>
|
|
4421
|
+
`:null}
|
|
4422
|
+
<temba-icon
|
|
4423
|
+
name="${this.icon}"
|
|
4424
|
+
animatechange="spin"
|
|
4425
|
+
animateclick="pulse"
|
|
4426
|
+
></temba-icon>
|
|
4390
4427
|
</div>
|
|
4391
4428
|
</div>
|
|
4392
4429
|
</temba-textinput>
|
|
4393
4430
|
</div>
|
|
4394
|
-
`}}
|
|
4431
|
+
`}}__decorate([e$2({type:String})],ContactFieldEditor.prototype,"key",void 0),__decorate([e$2({type:String})],ContactFieldEditor.prototype,"value",void 0),__decorate([e$2({type:String})],ContactFieldEditor.prototype,"name",void 0),__decorate([e$2({type:String})],ContactFieldEditor.prototype,"type",void 0),__decorate([e$2({type:String})],ContactFieldEditor.prototype,"icon",void 0),__decorate([e$2({type:String})],ContactFieldEditor.prototype,"iconClass",void 0);const STATUS={S:{name:"Stopped",icon:"x-octagon"},B:{name:"Blocked",icon:"slash"},V:{name:"Archived",icon:"archive"}};class ContactBadges extends ContactStoreElement{static get styles(){return r$2`
|
|
4432
|
+
temba-label {
|
|
4433
|
+
margin: 0.3em;
|
|
4434
|
+
}
|
|
4435
|
+
|
|
4436
|
+
.badges {
|
|
4437
|
+
display: flex;
|
|
4438
|
+
flex-wrap: wrap;
|
|
4439
|
+
}
|
|
4440
|
+
|
|
4441
|
+
.flow {
|
|
4442
|
+
}
|
|
4443
|
+
`}render(){if(this.data){const l=STATUS[this.data.status];return $`
|
|
4444
|
+
<div class="badges">
|
|
4445
|
+
${l&&"A"!==this.data.status?$`
|
|
4446
|
+
<temba-label
|
|
4447
|
+
class="status"
|
|
4448
|
+
icon="${l.icon}"
|
|
4449
|
+
onclick="goto(event)"
|
|
4450
|
+
href="/contact/${l.name.toLowerCase()}"
|
|
4451
|
+
clickable
|
|
4452
|
+
secondary
|
|
4453
|
+
shadow
|
|
4454
|
+
>
|
|
4455
|
+
${l.name}
|
|
4456
|
+
</temba-label>
|
|
4457
|
+
`:null}
|
|
4458
|
+
${this.data.flow?$`
|
|
4459
|
+
<temba-label
|
|
4460
|
+
class="flow"
|
|
4461
|
+
icon="flow"
|
|
4462
|
+
onclick="goto(event)"
|
|
4463
|
+
href="/contact/?search=flow+%3D+${encodeURIComponent('"'+this.data.flow.name+'"')}"
|
|
4464
|
+
clickable
|
|
4465
|
+
tertiary
|
|
4466
|
+
shadow
|
|
4467
|
+
>
|
|
4468
|
+
${this.data.flow.name}
|
|
4469
|
+
</temba-label>
|
|
4470
|
+
`:null}
|
|
4471
|
+
${this.data.language?$`
|
|
4472
|
+
<temba-label
|
|
4473
|
+
class="language"
|
|
4474
|
+
icon="globe"
|
|
4475
|
+
onclick="goto(event)"
|
|
4476
|
+
href="/contact/?search=language+%3D+${encodeURIComponent('"'+this.data.language+'"')}"
|
|
4477
|
+
clickable
|
|
4478
|
+
primary
|
|
4479
|
+
shadow
|
|
4480
|
+
>
|
|
4481
|
+
${this.store.getLanguageName(this.data.language)}
|
|
4482
|
+
</temba-label>
|
|
4483
|
+
`:null}
|
|
4484
|
+
${this.data.groups.map((l=>$`
|
|
4485
|
+
<temba-label
|
|
4486
|
+
class="group"
|
|
4487
|
+
onclick="goto(event)"
|
|
4488
|
+
href="/contact/filter/${l.uuid}/"
|
|
4489
|
+
icon=${l.is_dynamic?"atom":"users"}
|
|
4490
|
+
clickable
|
|
4491
|
+
light
|
|
4492
|
+
shadow
|
|
4493
|
+
>
|
|
4494
|
+
${l.name}
|
|
4495
|
+
</temba-label>
|
|
4496
|
+
`))}
|
|
4497
|
+
</div>
|
|
4498
|
+
`}return null}}function addCustomElement(l,n){window.customElements.get(l)||window.customElements.define(l,n)}addCustomElement("temba-anchor",Anchor),addCustomElement("temba-alert",Alert),addCustomElement("temba-store",Store),addCustomElement("temba-textinput",TextInput),addCustomElement("temba-completion",Completion),addCustomElement("temba-checkbox",Checkbox),addCustomElement("temba-select",Select),addCustomElement("temba-options",Options),addCustomElement("temba-loading",Loading),addCustomElement("temba-button",Button),addCustomElement("temba-omnibox",Omnibox),addCustomElement("temba-tip",Tip),addCustomElement("temba-contact-name",ContactName),addCustomElement("temba-contact-field",ContactFieldEditor),addCustomElement("temba-contact-fields",ContactFields),addCustomElement("temba-urn",ContactUrn),addCustomElement("temba-field",FormField),addCustomElement("temba-dialog",Dialog),addCustomElement("temba-modax",Modax),addCustomElement("temba-charcount",CharCount),addCustomElement("temba-contact-history",ContactHistory),addCustomElement("temba-contact-chat",ContactChat),addCustomElement("temba-contact-details",ContactDetails),addCustomElement("temba-ticket-list",TicketList),addCustomElement("temba-list",TembaList),addCustomElement("temba-label",Label),addCustomElement("temba-menu",TembaMenu),addCustomElement("temba-contact-search",ContactSearch),addCustomElement("temba-icon",VectorIcon),addCustomElement("temba-dropdown",Dropdown),addCustomElement("temba-tabs",TabPane),addCustomElement("temba-tab",Tab),addCustomElement("temba-contact-groups",ContactBadges);class AliasEditor extends s$1{constructor(){super(),this.path=[]}static get styles(){return r$2`
|
|
4395
4499
|
:host {
|
|
4396
4500
|
line-height: normal;
|
|
4397
4501
|
}
|