@nyaruka/temba-components 0.159.6 → 0.160.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,8 +4,12 @@ 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.160.0](https://github.com/nyaruka/temba-components/compare/v0.159.6...v0.160.0)
8
+
7
9
  #### [v0.159.6](https://github.com/nyaruka/temba-components/compare/v0.159.5...v0.159.6)
8
10
 
11
+ > 25 June 2026
12
+
9
13
  - Promote a fully-translated language to a flow's default [`#1033`](https://github.com/nyaruka/temba-components/pull/1033)
10
14
  - Add label-create affordance to ContentList label dropdown [`#1031`](https://github.com/nyaruka/temba-components/pull/1031)
11
15
  - Fix empty contact fields tab from definition/data load race [`#1032`](https://github.com/nyaruka/temba-components/pull/1032)
@@ -11124,7 +11124,7 @@ background: #ccc;
11124
11124
  ${this.renderUploader()}
11125
11125
  </div>
11126
11126
  </div>
11127
- </div>`}}i([ft({type:String,attribute:!1})],Vu.prototype,"endpoint",void 0),i([ft({type:Boolean})],Vu.prototype,"pendingDrop",void 0),i([ft({type:Boolean})],Vu.prototype,"ignoreDrops",void 0),i([ft({type:String})],Vu.prototype,"icon",void 0),i([ft({type:String})],Vu.prototype,"accept",void 0),i([ft({type:Number})],Vu.prototype,"max",void 0),i([ft({type:Array})],Vu.prototype,"attachments",void 0),i([ft({type:Boolean,attribute:!1})],Vu.prototype,"uploading",void 0);let Zu="dev";try{Zu="0.159.6"}catch(t){}const Yu=Zu,Ku=[{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}],Gu=t=>Ku.filter(e=>"hidden"!==e.visibility&&(!e.filter||!!t&&t.includes(e.filter))),Xu=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"]),Qu=t=>Ku.find(e=>e.type===t),Ju=t=>t.map(t=>({value:t.type,name:t.name})),tp={type:"text",required:!1,maxLength:64,placeholder:"(optional)",helpText:"The name to use to reference this result in the flow"},ep={type:"checkbox",label:"Require rules to be localized",helpText:"Each language must specify its own rules for this node"},ip={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}},op={label:"Save Result",localizable:!1,items:["result_name"],collapsed:t=>!(t._isNew&&t.result_name),getValueCount:t=>!!t.result_name},np={type:"accordion",multi:!0,sections:[op,{label:"Localization",localizable:!1,items:["localizeRules","localizeCategories"],collapsed:!0,getValueCount:t=>!(!t.localizeRules&&!t.localizeCategories)}]},sp={type:"accordion",multi:!0,sections:[op]},rp={type:"accordion",multi:!0,sections:[op,{label:"Localization",localizable:!1,items:["localizeCategories"],collapsed:!0,getValueCount:t=>!!t.localizeCategories}]};function ap(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=Qu(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 lp(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 dp(t,e,i,o=[]){const n=[],s=[],r=[];return t.forEach(t=>{const a=ae(e,t.name),l=a?i.find(t=>t.uuid===a.exit_uuid):null,d=(null==l?void 0:l.uuid)||Xt(),c=(null==a?void 0:a.uuid)||Xt();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)||Xt(),type:t.case.type,arguments:t.case.arguments,category_uuid:c})}}),{categories:n,exits:s,cases:r}}function cp(t,e,i,o,n){const s=n.some(t=>re(t,"Other"))?null:ae(i,"Other"),r=s?o.find(t=>t.uuid===s.exit_uuid):null,a=(null==r?void 0:r.uuid)||Xt(),l=(null==s?void 0:s.uuid)||Xt();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 hp(t){return e=>{const i={};return t(e,i),{valid:0===Object.keys(i).length,errors:i}}}function up(t){return t.toLocalizationFormData?t.toLocalizationFormData:"categories"===t.localizable?ap: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 pp(t){return t.fromLocalizationFormData?t.fromLocalizationFormData:"categories"===t.localizable?lp: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 mp="undefined"!=typeof navigator&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);function gp(t){return 0!==t.button||!(!mp||!t.ctrlKey)}function fp(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 vp(t){const e=20*Math.round(t/20);return Math.max(e,0)}const bp="font-family:SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;font-size:0.95em",yp={[sc.ExpressionPrefix]:`color:${Sc.expression};font-weight:600;${bp}`,[sc.Identifier]:`color:${Sc.expression};${bp}`,[sc.FunctionName]:`color:${Sc.fn};font-weight:900;${bp}`,[sc.StringLiteral]:`color:${Sc.string};${bp}`,[sc.NumberLiteral]:`color:${Sc.number};${bp}`,[sc.Keyword]:`color:${Sc.keyword};${bp}`,[sc.Operator]:`color:${Sc.operator};${bp}`,[sc.ContextRef]:`color:${Sc.expression};${bp}`,[sc.Separator]:`color:${Sc.operator};${bp}`,[sc.Arrow]:`color:${Sc.operator};${bp}`,[sc.Bracket]:`color:${Sc.operator};${bp}`,[sc.Paren]:`color:${Sc.paren};${bp}`,[sc.Whitespace]:bp},xp=[[/claude|anthropic/i,"anthropic"],[/gpt|openai|o1|o3|o4/i,"openai"],[/gemini|google/i,"gemini"],[/azure|microsoft/i,"azure"],[/deepseek/i,"deepseek"]],wp=(t,e=!1)=>{const i=hc(t||"",e?Xd:Gd),o=[];for(const t of i){const e=!!yp[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=yp[t.type];if(!e){const e=t.text.split("\n");return Z`${e.map((t,e)=>Z`${e>0?Z`<br />`:null}${t}`)}`}const i=t.text.split("\n");return Z`${i.map((t,i)=>Z`${i>0?Z`<br />`:null}${t?Z`<span style="${e}">${t}</span>`:null}`)}`};return Z`${o.map(t=>{const e=Z`${t.tokens.map(n)}`;return t.isExpr?Z`<span style="hyphens:none">${e}</span>`:e})}`},_p=(t,e,i=3)=>Z`<div
11127
+ </div>`}}i([ft({type:String,attribute:!1})],Vu.prototype,"endpoint",void 0),i([ft({type:Boolean})],Vu.prototype,"pendingDrop",void 0),i([ft({type:Boolean})],Vu.prototype,"ignoreDrops",void 0),i([ft({type:String})],Vu.prototype,"icon",void 0),i([ft({type:String})],Vu.prototype,"accept",void 0),i([ft({type:Number})],Vu.prototype,"max",void 0),i([ft({type:Array})],Vu.prototype,"attachments",void 0),i([ft({type:Boolean,attribute:!1})],Vu.prototype,"uploading",void 0);let Zu="dev";try{Zu="0.160.0"}catch(t){}const Yu=Zu,Ku=[{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}],Gu=t=>Ku.filter(e=>"hidden"!==e.visibility&&(!e.filter||!!t&&t.includes(e.filter))),Xu=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"]),Qu=t=>Ku.find(e=>e.type===t),Ju=t=>t.map(t=>({value:t.type,name:t.name})),tp={type:"text",required:!1,maxLength:64,placeholder:"(optional)",helpText:"The name to use to reference this result in the flow"},ep={type:"checkbox",label:"Require rules to be localized",helpText:"Each language must specify its own rules for this node"},ip={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}},op={label:"Save Result",localizable:!1,items:["result_name"],collapsed:t=>!(t._isNew&&t.result_name),getValueCount:t=>!!t.result_name},np={type:"accordion",multi:!0,sections:[op,{label:"Localization",localizable:!1,items:["localizeRules","localizeCategories"],collapsed:!0,getValueCount:t=>!(!t.localizeRules&&!t.localizeCategories)}]},sp={type:"accordion",multi:!0,sections:[op]},rp={type:"accordion",multi:!0,sections:[op,{label:"Localization",localizable:!1,items:["localizeCategories"],collapsed:!0,getValueCount:t=>!!t.localizeCategories}]};function ap(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=Qu(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 lp(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 dp(t,e,i,o=[]){const n=[],s=[],r=[];return t.forEach(t=>{const a=ae(e,t.name),l=a?i.find(t=>t.uuid===a.exit_uuid):null,d=(null==l?void 0:l.uuid)||Xt(),c=(null==a?void 0:a.uuid)||Xt();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)||Xt(),type:t.case.type,arguments:t.case.arguments,category_uuid:c})}}),{categories:n,exits:s,cases:r}}function cp(t,e,i,o,n){const s=n.some(t=>re(t,"Other"))?null:ae(i,"Other"),r=s?o.find(t=>t.uuid===s.exit_uuid):null,a=(null==r?void 0:r.uuid)||Xt(),l=(null==s?void 0:s.uuid)||Xt();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 hp(t){return e=>{const i={};return t(e,i),{valid:0===Object.keys(i).length,errors:i}}}function up(t){return t.toLocalizationFormData?t.toLocalizationFormData:"categories"===t.localizable?ap: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 pp(t){return t.fromLocalizationFormData?t.fromLocalizationFormData:"categories"===t.localizable?lp: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 mp="undefined"!=typeof navigator&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);function gp(t){return 0!==t.button||!(!mp||!t.ctrlKey)}function fp(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 vp(t){const e=20*Math.round(t/20);return Math.max(e,0)}const bp="font-family:SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;font-size:0.95em",yp={[sc.ExpressionPrefix]:`color:${Sc.expression};font-weight:600;${bp}`,[sc.Identifier]:`color:${Sc.expression};${bp}`,[sc.FunctionName]:`color:${Sc.fn};font-weight:900;${bp}`,[sc.StringLiteral]:`color:${Sc.string};${bp}`,[sc.NumberLiteral]:`color:${Sc.number};${bp}`,[sc.Keyword]:`color:${Sc.keyword};${bp}`,[sc.Operator]:`color:${Sc.operator};${bp}`,[sc.ContextRef]:`color:${Sc.expression};${bp}`,[sc.Separator]:`color:${Sc.operator};${bp}`,[sc.Arrow]:`color:${Sc.operator};${bp}`,[sc.Bracket]:`color:${Sc.operator};${bp}`,[sc.Paren]:`color:${Sc.paren};${bp}`,[sc.Whitespace]:bp},xp=[[/claude|anthropic/i,"anthropic"],[/gpt|openai|o1|o3|o4/i,"openai"],[/gemini|google/i,"gemini"],[/azure|microsoft/i,"azure"],[/deepseek/i,"deepseek"]],wp=(t,e=!1)=>{const i=hc(t||"",e?Xd:Gd),o=[];for(const t of i){const e=!!yp[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=yp[t.type];if(!e){const e=t.text.split("\n");return Z`${e.map((t,e)=>Z`${e>0?Z`<br />`:null}${t}`)}`}const i=t.text.split("\n");return Z`${i.map((t,i)=>Z`${i>0?Z`<br />`:null}${t?Z`<span style="${e}">${t}</span>`:null}`)}`};return Z`${o.map(t=>{const e=Z`${t.tokens.map(n)}`;return t.isExpr?Z`<span style="hyphens:none">${e}</span>`:e})}`},_p=(t,e,i=3)=>Z`<div
11128
11128
  style="display: -webkit-box; -webkit-line-clamp: ${i}; -webkit-box-orient: vertical; overflow: hidden; word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;"
11129
11129
  title="${e}"
11130
11130
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyaruka/temba-components",
3
- "version": "0.159.6",
3
+ "version": "0.160.0",
4
4
  "description": "Web components to support rapidpro and related projects",
5
5
  "author": "Nyaruka <code@nyaruka.coim>",
6
6
  "main": "dist/index.js",