@nyaruka/temba-components 0.97.0 → 0.98.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 +6 -0
- package/dist/temba-components.js +4 -4
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/templates/TemplateEditor.js +2 -10
- package/out-tsc/src/templates/TemplateEditor.js.map +1 -1
- package/out-tsc/test/temba-template-editor.test.js +2 -18
- package/out-tsc/test/temba-template-editor.test.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/templates/unapproved.png +0 -0
- package/src/templates/TemplateEditor.ts +3 -16
- package/static/api/templates.json +116 -201
- package/test/temba-template-editor.test.ts +2 -22
- package/screenshots/truth/templates/french.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,14 @@ 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.98.0](https://github.com/nyaruka/temba-components/compare/v0.97.0...v0.98.0)
|
|
8
|
+
|
|
9
|
+
- Use base_template instead of array [`#442`](https://github.com/nyaruka/temba-components/pull/442)
|
|
10
|
+
|
|
7
11
|
#### [v0.97.0](https://github.com/nyaruka/temba-components/compare/v0.96.0...v0.97.0)
|
|
8
12
|
|
|
13
|
+
> 11 July 2024
|
|
14
|
+
|
|
9
15
|
- Make location fields have select box [`#441`](https://github.com/nyaruka/temba-components/pull/441)
|
|
10
16
|
- Update select searching [`5d2b096`](https://github.com/nyaruka/temba-components/commit/5d2b09639eaf6aae37876a8b30f0e8d41c663cd9)
|
|
11
17
|
|
package/dist/temba-components.js
CHANGED
|
@@ -7366,7 +7366,7 @@ background: #ccc;
|
|
|
7366
7366
|
-webkit-box-orient: vertical;
|
|
7367
7367
|
overflow: hidden;
|
|
7368
7368
|
}
|
|
7369
|
-
`,t([ge({type:String})],Kh.prototype,"email",void 0),t([ge({type:Number})],Kh.prototype,"scale",void 0),t([ge({type:Boolean})],Kh.prototype,"name",void 0),t([ge({type:Object,attribute:!1})],Kh.prototype,"user",void 0),t([ge({type:String,attribute:!1})],Kh.prototype,"background",void 0),t([ge({type:String,attribute:!1})],Kh.prototype,"initials",void 0),t([ge({type:String,attribute:!1})],Kh.prototype,"fullName",void 0);class Jh extends fe{constructor(){super(...arguments),this.
|
|
7369
|
+
`,t([ge({type:String})],Kh.prototype,"email",void 0),t([ge({type:Number})],Kh.prototype,"scale",void 0),t([ge({type:Boolean})],Kh.prototype,"name",void 0),t([ge({type:Object,attribute:!1})],Kh.prototype,"user",void 0),t([ge({type:String,attribute:!1})],Kh.prototype,"background",void 0),t([ge({type:String,attribute:!1})],Kh.prototype,"initials",void 0),t([ge({type:String,attribute:!1})],Kh.prototype,"fullName",void 0);class Jh extends fe{constructor(){super(...arguments),this.pickersLoading={}}static get styles(){return r`
|
|
7370
7370
|
.component {
|
|
7371
7371
|
background: #fff;
|
|
7372
7372
|
border: 1px solid var(--color-widget-border);
|
|
@@ -7472,7 +7472,7 @@ background: #ccc;
|
|
|
7472
7472
|
overflow-x: hidden;
|
|
7473
7473
|
padding-bottom: 0;
|
|
7474
7474
|
}
|
|
7475
|
-
`}firstUpdated(t){super.firstUpdated(t),t.has("variables")&&this.variables&&(this.currentVariables=this.variables.slice())}updated(t){super.updated(t),t.has("template")&&(this.currentVariables=this.variables)}handleTemplateChanged(t){const e=this.selectedTemplate;this.selectedTemplate=t.target.values[0],e&&(this.currentVariables=[])
|
|
7475
|
+
`}firstUpdated(t){super.firstUpdated(t),t.has("variables")&&this.variables&&(this.currentVariables=this.variables.slice())}updated(t){super.updated(t),t.has("template")&&(this.currentVariables=this.variables)}handleTemplateChanged(t){const e=this.selectedTemplate;this.selectedTemplate=t.target.values[0],e&&(this.currentVariables=[]),this.selectedTemplate?(this.translation=this.selectedTemplate.base_translation,this.translation?this.variables=new Array((this.translation.variables||[]).length).fill(""):this.variables=[]):(this.translation=null,this.variables=[]),this.fireCustomEvent(Le.ContextChanged,{template:this.selectedTemplate,translation:this.translation,variables:this.currentVariables})}handleAttachmentLoading(t){const e=t.target,i=parseInt(e.getAttribute("index"));this.pickersLoading[i]=t.detail.loading,this.requestUpdate()}handleAttachmentsChanged(t){const e=t.target,i=parseInt(e.getAttribute("index"));if(0===e.attachments.length)this.currentVariables[i]="";else{const t=e.attachments[0];t.url&&t.content_type?this.currentVariables[i]=`${t.content_type}:${t.url}`:this.currentVariables[i]=""}this.fireContentChange(),this.requestUpdate("currentVariables")}handleVariableChanged(t){const e=t.target,i=parseInt(e.getAttribute("index"));this.currentVariables[i]=e.value,this.fireContentChange()}fireContentChange(){this.fireCustomEvent(Le.ContentChanged,{template:this.selectedTemplate,translation:this.translation,variables:this.currentVariables})}renderVariables(t){var e;const i=new RegExp(`{{(${Object.keys(t.variables||[]).join("|")})}}`,"g");let o=null,n=[];return t.content&&t.content.trim().length>0&&(n=(null===(e=t.content)||void 0===e?void 0:e.split(i))||[]),o=n.length>0?n.map(((e,i)=>{if(i%2==0)return j`<span class="text">${e}</span>`;const o=t.variables[e],n=this.currentVariables||[];return j`<temba-completion
|
|
7476
7476
|
class="variable"
|
|
7477
7477
|
type="text"
|
|
7478
7478
|
value=${o<n.length?n[o]:null}
|
|
@@ -7519,7 +7519,7 @@ background: #ccc;
|
|
|
7519
7519
|
<div class="button-header">Template Buttons</div>
|
|
7520
7520
|
<div class="buttons">${e}</div>
|
|
7521
7521
|
</div>`}render(){let t=null;return this.translation?t=this.renderComponents(this.translation.components):this.selectedTemplate&&(t=j`<div class="error-message">
|
|
7522
|
-
|
|
7522
|
+
This template currently has no approved translations.
|
|
7523
7523
|
</div>`),j`
|
|
7524
7524
|
<div>
|
|
7525
7525
|
<temba-select
|
|
@@ -7538,7 +7538,7 @@ background: #ccc;
|
|
|
7538
7538
|
</temba-select>
|
|
7539
7539
|
${t?j` <div class="template">${t}</div>`:null}
|
|
7540
7540
|
</div>
|
|
7541
|
-
`}}Jh.shadowRootOptions={...lt.shadowRootOptions,delegatesFocus:!0},t([ge({type:String})],Jh.prototype,"url",void 0),t([ge({type:String})],Jh.prototype,"template",void 0),t([ge({type:Object})],Jh.prototype,"selectedTemplate",void 0),t([ge({type:
|
|
7541
|
+
`}}Jh.shadowRootOptions={...lt.shadowRootOptions,delegatesFocus:!0},t([ge({type:String})],Jh.prototype,"url",void 0),t([ge({type:String})],Jh.prototype,"template",void 0),t([ge({type:Object})],Jh.prototype,"selectedTemplate",void 0),t([ge({type:Array})],Jh.prototype,"variables",void 0),t([ge({type:Array})],Jh.prototype,"currentVariables",void 0),t([ge({type:Object,attribute:!1})],Jh.prototype,"translation",void 0),t([ge({type:Boolean})],Jh.prototype,"translating",void 0);
|
|
7542
7542
|
/**
|
|
7543
7543
|
* @license
|
|
7544
7544
|
* Copyright 2020 Google LLC
|