@nyaruka/temba-components 0.159.0 → 0.159.1
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 +7 -0
- package/dist/temba-components.js +18 -3
- package/dist/temba-components.js.map +1 -1
- package/package.json +1 -1
- package/src/events/eventRenderers.ts +29 -0
- package/src/events.ts +22 -0
- package/src/list/ContentList.ts +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [v0.159.1](https://github.com/nyaruka/temba-components/compare/v0.159.0...v0.159.1)
|
|
8
|
+
|
|
9
|
+
- Handle airtime_created events in contact chat [`#1020`](https://github.com/nyaruka/temba-components/pull/1020)
|
|
10
|
+
- Stabilize ContentList icon column width across parallel test runs [`#1021`](https://github.com/nyaruka/temba-components/pull/1021)
|
|
11
|
+
|
|
7
12
|
#### [v0.159.0](https://github.com/nyaruka/temba-components/compare/v0.158.1...v0.159.0)
|
|
8
13
|
|
|
14
|
+
> 27 May 2026
|
|
15
|
+
|
|
9
16
|
- Add ContactEvents timeline component replacing ContactPending [`#1019`](https://github.com/nyaruka/temba-components/pull/1019)
|
|
10
17
|
- Add ContentList layout polish: search UX, label dropdown, list subtitles [`#1016`](https://github.com/nyaruka/temba-components/pull/1016)
|
|
11
18
|
- Bump serialize-javascript from 6.0.2 to 7.0.5 [`#1017`](https://github.com/nyaruka/temba-components/pull/1017)
|
package/dist/temba-components.js
CHANGED
|
@@ -3477,7 +3477,7 @@ const{I:nh}=at,sh=t=>t,rh=()=>document.createComment(""),ah=(t,e,i)=>{const o=t.
|
|
|
3477
3477
|
</div>`}
|
|
3478
3478
|
<slot class="header" name="header"></slot>
|
|
3479
3479
|
<slot class="footer" name="footer"></slot>
|
|
3480
|
-
</div>`}}var xh;e([gt({type:Array})],yh.prototype,"messageGroups",void 0),e([gt({type:Boolean})],yh.prototype,"fetching",void 0),e([gt({type:Boolean,attribute:!1})],yh.prototype,"hideTopScroll",void 0),e([gt({type:Boolean,attribute:!1})],yh.prototype,"hideBottomScroll",void 0),e([gt({type:String,attribute:"avatar"})],yh.prototype,"defaultAvatar",void 0),e([gt({type:Boolean})],yh.prototype,"agent",void 0),e([gt({type:Boolean})],yh.prototype,"avatars",void 0),e([gt({type:Boolean,attribute:!1})],yh.prototype,"endOfHistory",void 0),e([gt({type:Object,attribute:!1})],yh.prototype,"oldestEventDate",void 0),e([gt({type:Boolean,attribute:!1})],yh.prototype,"showNewMessageNotification",void 0),e([gt({type:Object})],yh.prototype,"showMessageLogsAfter",void 0),e([gt({type:Boolean})],yh.prototype,"hasFooter",void 0),e([gt({type:Boolean})],yh.prototype,"showTimestamps",void 0),e([gt({type:String,attribute:!1})],yh.prototype,"searchHighlight",void 0),e([gt({type:String,attribute:!1})],yh.prototype,"highlightMessageUuid",void 0),function(t){t.AIRTIME_TRANSFERRED="airtime_transferred",t.BROADCAST_CREATED="broadcast_created",t.CALL_CREATED="call_created",t.CALL_MISSED="call_missed",t.CALL_RECEIVED="call_received",t.CHAT_STARTED="chat_started",t.CONTACT_FIELD_CHANGED="contact_field_changed",t.CONTACT_GROUPS_CHANGED="contact_groups_changed",t.CONTACT_LANGUAGE_CHANGED="contact_language_changed",t.CONTACT_NAME_CHANGED="contact_name_changed",t.CONTACT_STATUS_CHANGED="contact_status_changed",t.CONTACT_URNS_CHANGED="contact_urns_changed",t.EMAIL_CREATED="email_created",t.EMAIL_SENT="email_sent",t.ERROR="error",t.FAILURE="failure",t.FLOW_ENTERED="flow_entered",t.INPUT_LABELS_ADDED="input_labels_added",t.IVR_CREATED="ivr_created",t.MSG_CREATED="msg_created",t.MSG_RECEIVED="msg_received",t.OPTIN_REQUESTED="optin_requested",t.OPTIN_STARTED="optin_started",t.OPTIN_STOPPED="optin_stopped",t.RESTHOOK_CALLED="resthook_called",t.RUN_ENDED="run_ended",t.RUN_RESULT_CHANGED="run_result_changed",t.RUN_STARTED="run_started",t.SERVICE_CALLED="service_called",t.SESSION_TRIGGERED="session_triggered",t.TICKET_ASSIGNEE_CHANGED="ticket_assignee_changed",t.TICKET_CLOSED="ticket_closed",t.TICKET_NOTE_ADDED="ticket_note_added",t.TICKET_OPENED="ticket_opened",t.TICKET_REOPENED="ticket_reopened",t.TICKET_TOPIC_CHANGED="ticket_topic_changed",t.WARNING="warning",t.WEBHOOK_CALLED="webhook_called"}(xh||(xh={}));const wh=(t,e,i={})=>{const o=i.icon?V`<temba-label
|
|
3480
|
+
</div>`}}var xh;e([gt({type:Array})],yh.prototype,"messageGroups",void 0),e([gt({type:Boolean})],yh.prototype,"fetching",void 0),e([gt({type:Boolean,attribute:!1})],yh.prototype,"hideTopScroll",void 0),e([gt({type:Boolean,attribute:!1})],yh.prototype,"hideBottomScroll",void 0),e([gt({type:String,attribute:"avatar"})],yh.prototype,"defaultAvatar",void 0),e([gt({type:Boolean})],yh.prototype,"agent",void 0),e([gt({type:Boolean})],yh.prototype,"avatars",void 0),e([gt({type:Boolean,attribute:!1})],yh.prototype,"endOfHistory",void 0),e([gt({type:Object,attribute:!1})],yh.prototype,"oldestEventDate",void 0),e([gt({type:Boolean,attribute:!1})],yh.prototype,"showNewMessageNotification",void 0),e([gt({type:Object})],yh.prototype,"showMessageLogsAfter",void 0),e([gt({type:Boolean})],yh.prototype,"hasFooter",void 0),e([gt({type:Boolean})],yh.prototype,"showTimestamps",void 0),e([gt({type:String,attribute:!1})],yh.prototype,"searchHighlight",void 0),e([gt({type:String,attribute:!1})],yh.prototype,"highlightMessageUuid",void 0),function(t){t.AIRTIME_CREATED="airtime_created",t.AIRTIME_TRANSFERRED="airtime_transferred",t.BROADCAST_CREATED="broadcast_created",t.CALL_CREATED="call_created",t.CALL_MISSED="call_missed",t.CALL_RECEIVED="call_received",t.CHAT_STARTED="chat_started",t.CONTACT_FIELD_CHANGED="contact_field_changed",t.CONTACT_GROUPS_CHANGED="contact_groups_changed",t.CONTACT_LANGUAGE_CHANGED="contact_language_changed",t.CONTACT_NAME_CHANGED="contact_name_changed",t.CONTACT_STATUS_CHANGED="contact_status_changed",t.CONTACT_URNS_CHANGED="contact_urns_changed",t.EMAIL_CREATED="email_created",t.EMAIL_SENT="email_sent",t.ERROR="error",t.FAILURE="failure",t.FLOW_ENTERED="flow_entered",t.INPUT_LABELS_ADDED="input_labels_added",t.IVR_CREATED="ivr_created",t.MSG_CREATED="msg_created",t.MSG_RECEIVED="msg_received",t.OPTIN_REQUESTED="optin_requested",t.OPTIN_STARTED="optin_started",t.OPTIN_STOPPED="optin_stopped",t.RESTHOOK_CALLED="resthook_called",t.RUN_ENDED="run_ended",t.RUN_RESULT_CHANGED="run_result_changed",t.RUN_STARTED="run_started",t.SERVICE_CALLED="service_called",t.SESSION_TRIGGERED="session_triggered",t.TICKET_ASSIGNEE_CHANGED="ticket_assignee_changed",t.TICKET_CLOSED="ticket_closed",t.TICKET_NOTE_ADDED="ticket_note_added",t.TICKET_OPENED="ticket_opened",t.TICKET_REOPENED="ticket_reopened",t.TICKET_TOPIC_CHANGED="ticket_topic_changed",t.WARNING="warning",t.WEBHOOK_CALLED="webhook_called"}(xh||(xh={}));const wh=(t,e,i={})=>{const o=i.icon?V`<temba-label
|
|
3481
3481
|
icon=${i.icon}
|
|
3482
3482
|
type=${t}
|
|
3483
3483
|
?clickable=${!!i.href}
|
|
@@ -3519,7 +3519,11 @@ const{I:nh}=at,sh=t=>t,rh=()=>document.createComment(""),ah=(t,e,i)=>{const o=t.
|
|
|
3519
3519
|
>
|
|
3520
3520
|
<span style="font-size: 16px; line-height: 1.4;">${e}</span>
|
|
3521
3521
|
<span style="flex: 1; line-height: 1.4;">${t.text}</span>
|
|
3522
|
-
</div>`}return null})(t,e);break;case xh.
|
|
3522
|
+
</div>`}return null})(t,e);break;case xh.AIRTIME_CREATED:i=(t=>{var e,i;const o=null!==(i=null===(e=t._status)||void 0===e?void 0:e.status)&&void 0!==i?i:"created",n=V`${Ah(t.amount)} ${t.currency}`;switch(o){case"reversed":return V`<div>Airtime transfer reversed</div>`;case"rejected":case"cancelled":case"declined":return V`<div>Airtime transfer failed</div>`;case"completed":return V`<div style=${Eh}>
|
|
3523
|
+
Transferred ${n} of airtime
|
|
3524
|
+
</div>`;default:return V`<div style=${Eh}>
|
|
3525
|
+
Sending ${n} of airtime
|
|
3526
|
+
</div>`}})(t);break;case xh.AIRTIME_TRANSFERRED:i=(t=>0===parseFloat(t.amount)?V`<div>Airtime transfer failed</div>`:V`<div style=${Eh}>
|
|
3523
3527
|
Transferred ${Ah(t.amount)} ${t.currency} of airtime
|
|
3524
3528
|
</div>`)(t);break;case xh.CALL_CREATED:case xh.CALL_MISSED:case xh.CALL_RECEIVED:i=(t=>t.type===xh.CALL_CREATED?V`<div>Call started</div>`:t.type===xh.CALL_MISSED?V`<div>Call missed</div>`:t.type===xh.CALL_RECEIVED?V`<div>Call answered</div>`:void 0)(t);break;case xh.CHAT_STARTED:i=(t=>t.params?V`<div>Chat referral</div>`:V`<div>Chat started</div>`)(t);break;case xh.CONTACT_FIELD_CHANGED:i=(t=>t.value&&t.value.text?V`<div style=${Eh}>
|
|
3525
3529
|
Updated ${Ch(t.field)} to ${Ah(t.value.text)}
|
|
@@ -9063,9 +9067,20 @@ const{I:nh}=at,sh=t=>t,rh=()=>document.createComment(""),ah=(t,e,i)=>{const o=t.
|
|
|
9063
9067
|
padding: 0 6px 0 0;
|
|
9064
9068
|
--icon-color: var(--text-3);
|
|
9065
9069
|
}
|
|
9070
|
+
/* Reserve the icon's footprint on the wrapper itself so the
|
|
9071
|
+
icon column's intrinsic width is the same whether
|
|
9072
|
+
<temba-icon> has upgraded or not — without this, the column
|
|
9073
|
+
briefly measures as just the cell's right-padding (6px) and
|
|
9074
|
+
the downstream pinned columns end up positioned ~14px to
|
|
9075
|
+
the left, which races with whatever moment we snapshot.
|
|
9076
|
+
<temba-icon size="1"> renders at 1em, so we reserve 1em
|
|
9077
|
+
square and let the icon paint into it. */
|
|
9066
9078
|
.icon-inner {
|
|
9067
9079
|
display: flex;
|
|
9068
9080
|
align-items: center;
|
|
9081
|
+
justify-content: center;
|
|
9082
|
+
width: 1em;
|
|
9083
|
+
height: 1em;
|
|
9069
9084
|
}
|
|
9070
9085
|
tr.row.selected .icon-cell {
|
|
9071
9086
|
--icon-color: var(--accent-700);
|
|
@@ -10758,7 +10773,7 @@ background: #ccc;
|
|
|
10758
10773
|
${this.renderUploader()}
|
|
10759
10774
|
</div>
|
|
10760
10775
|
</div>
|
|
10761
|
-
</div>`}}e([gt({type:String,attribute:!1})],Hu.prototype,"endpoint",void 0),e([gt({type:Boolean})],Hu.prototype,"pendingDrop",void 0),e([gt({type:Boolean})],Hu.prototype,"ignoreDrops",void 0),e([gt({type:String})],Hu.prototype,"icon",void 0),e([gt({type:String})],Hu.prototype,"accept",void 0),e([gt({type:Number})],Hu.prototype,"max",void 0),e([gt({type:Array})],Hu.prototype,"attachments",void 0),e([gt({type:Boolean,attribute:!1})],Hu.prototype,"uploading",void 0);let Wu="dev";try{Wu="0.159.
|
|
10776
|
+
</div>`}}e([gt({type:String,attribute:!1})],Hu.prototype,"endpoint",void 0),e([gt({type:Boolean})],Hu.prototype,"pendingDrop",void 0),e([gt({type:Boolean})],Hu.prototype,"ignoreDrops",void 0),e([gt({type:String})],Hu.prototype,"icon",void 0),e([gt({type:String})],Hu.prototype,"accept",void 0),e([gt({type:Number})],Hu.prototype,"max",void 0),e([gt({type:Array})],Hu.prototype,"attachments",void 0),e([gt({type:Boolean,attribute:!1})],Hu.prototype,"uploading",void 0);let Wu="dev";try{Wu="0.159.1"}catch(t){}const Vu=Wu,Zu=[{type:"has_any_word",name:"has any of the words",operands:1},{type:"has_all_words",name:"has all of the words",operands:1},{type:"has_phrase",name:"has the phrase",operands:1},{type:"has_only_phrase",name:"has only the phrase",operands:1},{type:"has_beginning",name:"starts with",operands:1},{type:"has_text",name:"has some text",operands:0,categoryName:"Has Text"},{type:"has_number",name:"has a number",operands:0,categoryName:"Has Number"},{type:"has_number_between",name:"has a number between",operands:2},{type:"has_number_lt",name:"has a number below",operands:1},{type:"has_number_lte",name:"has a number at or below",operands:1},{type:"has_number_eq",name:"has a number equal to",operands:1},{type:"has_number_gte",name:"has a number at or above",operands:1},{type:"has_number_gt",name:"has a number above",operands:1},{type:"has_date",name:"has a date",operands:0,categoryName:"Has Date"},{type:"has_date_lt",name:"has a date before",operands:1},{type:"has_date_eq",name:"has a date equal to",operands:1},{type:"has_date_gt",name:"has a date after",operands:1},{type:"has_time",name:"has a time",operands:0,categoryName:"Has Time"},{type:"has_phone",name:"has a phone number",operands:0,categoryName:"Has Phone"},{type:"has_email",name:"has an email",operands:0,categoryName:"Has Email"},{type:"has_state",name:"has state",operands:0,categoryName:"Has State",filter:"locations"},{type:"has_district",name:"has district",operands:1,categoryName:"Has District",filter:"locations"},{type:"has_ward",name:"has ward",operands:2,categoryName:"Has Ward",filter:"locations"},{type:"has_group",name:"is in the group",operands:1,visibility:"hidden"},{type:"has_category",name:"has the category",operands:0,visibility:"hidden"},{type:"has_error",name:"has an error",operands:0,categoryName:"Has Error",visibility:"hidden"},{type:"has_value",name:"is not empty",operands:0,categoryName:"Not Empty",visibility:"hidden"},{type:"has_pattern",name:"matches regex",operands:1}],Yu=t=>Zu.filter(e=>"hidden"!==e.visibility&&(!e.filter||!!t&&t.includes(e.filter))),Ku=new Set(["has_beginning","has_number","has_number_between","has_number_lt","has_number_lte","has_number_eq","has_number_gte","has_number_gt","has_pattern"]),Gu=t=>Zu.find(e=>e.type===t),Xu=t=>t.map(t=>({value:t.type,name:t.name})),Qu={type:"text",required:!1,maxLength:64,placeholder:"(optional)",helpText:"The name to use to reference this result in the flow"},Ju={type:"checkbox",label:"Require rules to be localized",helpText:"Each language must specify its own rules for this node"},tp={type:"checkbox",label:"Require categories to be localized",helpText:t=>{var e;const i=null===(e=t.result_name)||void 0===e?void 0:e.trim();if(i){return`Only enable if you plan to use @results.${i.toLowerCase().replace(/\s+/g,"_")}.category_localized`}return"Only enable if you plan to use category_localized in your expressions for this result"},conditions:{visible:t=>!!t.result_name}},ep={label:"Save Result",localizable:!1,items:["result_name"],collapsed:t=>!(t._isNew&&t.result_name),getValueCount:t=>!!t.result_name},ip={type:"accordion",multi:!0,sections:[ep,{label:"Localization",localizable:!1,items:["localizeRules","localizeCategories"],collapsed:!0,getValueCount:t=>!(!t.localizeRules&&!t.localizeCategories)}]},op={type:"accordion",multi:!0,sections:[ep]},np={type:"accordion",multi:!0,sections:[ep,{label:"Localization",localizable:!1,items:["localizeCategories"],collapsed:!0,getValueCount:t=>!!t.localizeCategories}]};function sp(t,e){var i,o;const n=(null===(i=t.router)||void 0===i?void 0:i.categories)||[],s={};n.forEach(t=>{const i=t.uuid,o=e[i];s[i]={originalName:t.name,localizedName:o&&o.name?Array.isArray(o.name)?o.name[0]||"":o.name:""}});const r=(null===(o=t.router)||void 0===o?void 0:o.cases)||[],a={};return r.forEach(t=>{var i,o;if(!(null===(i=t.arguments)||void 0===i?void 0:i.length)||!t.arguments.some(t=>t))return;const n=e[t.uuid],s=(null===(o=Gu(t.type))||void 0===o?void 0:o.name)||t.type;a[t.uuid]={operatorName:s,originalArguments:[...t.arguments],localizedArguments:(null==n?void 0:n.arguments)?[...n.arguments]:t.arguments.map(()=>"")}}),{categories:s,rules:a}}function rp(t,e){const i={};return t.categories&&Object.keys(t.categories).forEach(e=>{var o,n;const s=t.categories[e],r=(null===(o=s.localizedName)||void 0===o?void 0:o.trim())||"",a=(null===(n=s.originalName)||void 0===n?void 0:n.trim())||"";r&&r!==a&&(i[e]={name:[r]})}),t.rules&&Object.keys(t.rules).forEach(e=>{const o=t.rules[e],n=o.localizedArguments||[],s=o.originalArguments||[],r=n.some((t,e)=>(null==t?void 0:t.trim())&&t.trim()!==(s[e]||""));r&&(i[e]={arguments:n.map(t=>(null==t?void 0:t.trim())||"")})}),i}function ap(t,e,i,o=[]){const n=[],s=[],r=[];return t.forEach(t=>{const a=re(e,t.name),l=a?i.find(t=>t.uuid===a.exit_uuid):null,d=(null==l?void 0:l.uuid)||Gt(),c=(null==a?void 0:a.uuid)||Gt();if(n.push({uuid:c,name:t.name,exit_uuid:d}),s.push({uuid:d,destination_uuid:(null==l?void 0:l.destination_uuid)||null}),t.case){const e=t.case.arguments[0],i=o.find(t=>{var i;return(null===(i=t.arguments)||void 0===i?void 0:i[0])===e});r.push({uuid:(null==i?void 0:i.uuid)||Gt(),type:t.case.type,arguments:t.case.arguments,category_uuid:c})}}),{categories:n,exits:s,cases:r}}function lp(t,e,i,o,n){const s=n.some(t=>se(t,"Other"))?null:re(i,"Other"),r=s?o.find(t=>t.uuid===s.exit_uuid):null,a=(null==r?void 0:r.uuid)||Gt(),l=(null==s?void 0:s.uuid)||Gt();return t.push({uuid:l,name:"Other",exit_uuid:a}),e.push({uuid:a,destination_uuid:(null==r?void 0:r.destination_uuid)||null}),l}function dp(t){return e=>{const i={};return t(e,i),{valid:0===Object.keys(i).length,errors:i}}}function cp(t){return t.toLocalizationFormData?t.toLocalizationFormData:"categories"===t.localizable?sp:Array.isArray(t.localizable)?(e=t.localizable,(t,i)=>{const o={uuid:t.uuid};return e.forEach(t=>{const e=i[t];o[t]=Array.isArray(e)&&e[0]||""}),o}):void 0;var e}function hp(t){return t.fromLocalizationFormData?t.fromLocalizationFormData:"categories"===t.localizable?rp:Array.isArray(t.localizable)?(e=t.localizable,(t,i)=>{const o={};return e.forEach(e=>{const n=t[e];n&&""!==n.trim()&&n!==i[e]&&(o[e]=[n])}),o}):void 0;var e}const up="undefined"!=typeof navigator&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);function pp(t){return 0!==t.button||!(!up||!t.ctrlKey)}function mp(t){if(t.dependency){const e=t.dependency.name||t.dependency.key;return`Cannot find a ${t.dependency.type} for ${e}`}return t.description}function gp(t){const e=20*Math.round(t/20);return Math.max(e,0)}const fp="font-family:SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;font-size:0.95em",vp={[nc.ExpressionPrefix]:`color:${Cc.expression};font-weight:600;${fp}`,[nc.Identifier]:`color:${Cc.expression};${fp}`,[nc.FunctionName]:`color:${Cc.fn};font-weight:900;${fp}`,[nc.StringLiteral]:`color:${Cc.string};${fp}`,[nc.NumberLiteral]:`color:${Cc.number};${fp}`,[nc.Keyword]:`color:${Cc.keyword};${fp}`,[nc.Operator]:`color:${Cc.operator};${fp}`,[nc.ContextRef]:`color:${Cc.expression};${fp}`,[nc.Separator]:`color:${Cc.operator};${fp}`,[nc.Arrow]:`color:${Cc.operator};${fp}`,[nc.Bracket]:`color:${Cc.operator};${fp}`,[nc.Paren]:`color:${Cc.paren};${fp}`,[nc.Whitespace]:fp},bp=[[/claude|anthropic/i,"anthropic"],[/gpt|openai|o1|o3|o4/i,"openai"],[/gemini|google/i,"gemini"],[/azure|microsoft/i,"azure"],[/deepseek/i,"deepseek"]],yp=(t,e=!1)=>{const i=cc(t||"",e?Gd:Kd),o=[];for(const t of i){const e=!!vp[t.type],i=o[o.length-1];i&&i.isExpr===e?i.tokens.push(t):o.push({isExpr:e,tokens:[t]})}const n=t=>{const e=vp[t.type];if(!e){const e=t.text.split("\n");return V`${e.map((t,e)=>V`${e>0?V`<br />`:null}${t}`)}`}const i=t.text.split("\n");return V`${i.map((t,i)=>V`${i>0?V`<br />`:null}${t?V`<span style="${e}">${t}</span>`:null}`)}`};return V`${o.map(t=>{const e=V`${t.tokens.map(n)}`;return t.isExpr?V`<span style="hyphens:none">${e}</span>`:e})}`},xp=(t,e,i=3)=>V`<div
|
|
10762
10777
|
style="display: -webkit-box; -webkit-line-clamp: ${i}; -webkit-box-orient: vertical; overflow: hidden; word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;"
|
|
10763
10778
|
title="${e}"
|
|
10764
10779
|
>
|