@nyaruka/temba-components 0.111.2 → 0.111.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
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.111.3](https://github.com/nyaruka/temba-components/compare/v0.111.2...v0.111.3)
|
|
8
|
+
|
|
9
|
+
- Add full doc redirect [`0b4330a`](https://github.com/nyaruka/temba-components/commit/0b4330a67d79262be318e5c77b5044ee413c21e3)
|
|
10
|
+
|
|
7
11
|
#### [v0.111.2](https://github.com/nyaruka/temba-components/compare/v0.111.1...v0.111.2)
|
|
8
12
|
|
|
13
|
+
> 8 November 2024
|
|
14
|
+
|
|
9
15
|
- Don't include org_id unless its in page [`7af31f5`](https://github.com/nyaruka/temba-components/commit/7af31f540bde1494a7ba646cfc5649140cf93585)
|
|
10
16
|
|
|
11
17
|
#### [v0.111.1](https://github.com/nyaruka/temba-components/compare/v0.111.0...v0.111.1)
|
package/dist/temba-components.js
CHANGED
|
@@ -1420,7 +1420,7 @@ let br=Ks,yr=!1;const _r=["es","fr","pt"],{setLocale:xr}=(t=>(function(t){if(yr)
|
|
|
1420
1420
|
flex-direction: row;
|
|
1421
1421
|
margin-left: 0.6em;
|
|
1422
1422
|
}
|
|
1423
|
-
`}handleSlotClicked(){this.open=!0}updated(t){if(super.updated(t),t.has("open")&&(this.open?this.fetchForm():void 0!==t.get("open")&&(this.open?window.setTimeout((()=>{this.body=this.getLoading(),this.submitting=!1}),500):this.setBody(""))),t.has("body")&&this.open&&this.body&&!this.fetching){this.shadowRoot.querySelector("temba-dialog").focusFirstInput()}}getLoading(){return Z`<temba-loading units="6" size="8"></temba-loading>`}updatePrimaryButton(){const t=this.shadowRoot.querySelector("#wizard-form");t&&(this.wizardStep=parseInt(t.dataset.step),this.wizardStepCount=parseInt(t.dataset.steps)),this.noSubmit||this.updateComplete.then((()=>{const t=this.shadowRoot.querySelector("input[type='submit'],button[type='submit']");this.buttons=t?[{type:ml.SECONDARY,name:"Cancel",closes:!0},{type:ml.PRIMARY,name:t.value}]:[{type:ml.SECONDARY,name:"Ok",closes:!0}],this.submitting=!1}))}setBody(t){const e=this.shadowRoot.querySelector(".scripts");for(const t of e.children)t.remove();const i=this.ownerDocument.createElement("div");i.innerHTML=t;const o=i.getElementsByTagName("script"),n=[];for(let t=o.length-1;t>=0;t--){const e=this.ownerDocument.createElement("script"),i=o[t].innerText;o[t].src&&-1===o[t].src.indexOf("web-dev-server")?(e.src=o[t].src,e.type="text/javascript",e.async=!0,e.onload=function(){},n.push(e)):i&&(e.appendChild(this.ownerDocument.createTextNode(i)),n.push(e)),o[t].remove()}const s=!!i.querySelector(".success-script");return s||(this.body=$r(i.innerHTML)),this.updateComplete.then((()=>{for(const t of n)e.appendChild(t)})),!s}getHeaders(){const t=this.headers;return t["X-PJAX"]=1,t}fetchForm(){this.fetching=!0,this.body=this.getLoading(),Zt(this.endpoint,null,this.getHeaders()).then((t=>{0==t.body.indexOf("<!DOCTYPE HTML>")?document.location=t.url:(this.setBody(t.body),this.fetching=!1,this.updateComplete.then((()=>{this.updatePrimaryButton(),this.fireCustomEvent(Le.Loaded,{body:this.getBody()})})))}))}submit(t={}){this.submitting=!0;const e=this.shadowRoot.querySelector("form");let i=e?function(t){const e=[];for(let i=0;i<t.elements.length;i++){const o=t.elements[i];if(o.name&&!o.disabled&&"file"!==o.type&&"reset"!==o.type&&"submit"!==o.type&&"button"!==o.type)if("select-multiple"===o.type)for(let t=0;t<o.options.length;t++)o.options[t].selected&&o.options[t].value&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(o.options[t].value));else if("checkbox"!==o.type&&"radio"!==o.type||o.checked){let t=o.value;!t&&o.checked&&(t="1"),t&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(t))}}return e.join("&")}(e):"";t&&Object.keys(t).forEach((e=>{i+=(i.length>1?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t[e])})),Qt(this.endpoint,i,this.getHeaders(),"application/x-www-form-urlencoded").then((t=>{window.setTimeout((()=>{let e=t.headers.get("temba-success")
|
|
1423
|
+
`}handleSlotClicked(){this.open=!0}updated(t){if(super.updated(t),t.has("open")&&(this.open?this.fetchForm():void 0!==t.get("open")&&(this.open?window.setTimeout((()=>{this.body=this.getLoading(),this.submitting=!1}),500):this.setBody(""))),t.has("body")&&this.open&&this.body&&!this.fetching){this.shadowRoot.querySelector("temba-dialog").focusFirstInput()}}getLoading(){return Z`<temba-loading units="6" size="8"></temba-loading>`}updatePrimaryButton(){const t=this.shadowRoot.querySelector("#wizard-form");t&&(this.wizardStep=parseInt(t.dataset.step),this.wizardStepCount=parseInt(t.dataset.steps)),this.noSubmit||this.updateComplete.then((()=>{const t=this.shadowRoot.querySelector("input[type='submit'],button[type='submit']");this.buttons=t?[{type:ml.SECONDARY,name:"Cancel",closes:!0},{type:ml.PRIMARY,name:t.value}]:[{type:ml.SECONDARY,name:"Ok",closes:!0}],this.submitting=!1}))}setBody(t){const e=this.shadowRoot.querySelector(".scripts");for(const t of e.children)t.remove();const i=this.ownerDocument.createElement("div");i.innerHTML=t;const o=i.getElementsByTagName("script"),n=[];for(let t=o.length-1;t>=0;t--){const e=this.ownerDocument.createElement("script"),i=o[t].innerText;o[t].src&&-1===o[t].src.indexOf("web-dev-server")?(e.src=o[t].src,e.type="text/javascript",e.async=!0,e.onload=function(){},n.push(e)):i&&(e.appendChild(this.ownerDocument.createTextNode(i)),n.push(e)),o[t].remove()}const s=!!i.querySelector(".success-script");return s||(this.body=$r(i.innerHTML)),this.updateComplete.then((()=>{for(const t of n)e.appendChild(t)})),!s}getHeaders(){const t=this.headers;return t["X-PJAX"]=1,t}fetchForm(){this.fetching=!0,this.body=this.getLoading(),Zt(this.endpoint,null,this.getHeaders()).then((t=>{0==t.body.indexOf("<!DOCTYPE HTML>")?(this.open=!1,document.location=t.url):(this.setBody(t.body),this.fetching=!1,this.updateComplete.then((()=>{this.updatePrimaryButton(),this.fireCustomEvent(Le.Loaded,{body:this.getBody()})})))}))}submit(t={}){this.submitting=!0;const e=this.shadowRoot.querySelector("form");let i=e?function(t){const e=[];for(let i=0;i<t.elements.length;i++){const o=t.elements[i];if(o.name&&!o.disabled&&"file"!==o.type&&"reset"!==o.type&&"submit"!==o.type&&"button"!==o.type)if("select-multiple"===o.type)for(let t=0;t<o.options.length;t++)o.options[t].selected&&o.options[t].value&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(o.options[t].value));else if("checkbox"!==o.type&&"radio"!==o.type||o.checked){let t=o.value;!t&&o.checked&&(t="1"),t&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(t))}}return e.join("&")}(e):"";t&&Object.keys(t).forEach((e=>{i+=(i.length>1?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t[e])})),Qt(this.endpoint,i,this.getHeaders(),"application/x-www-form-urlencoded").then((t=>{window.setTimeout((()=>{let e=t.headers.get("temba-success");if(!e&&t.url&&-1===t.url.indexOf(this.endpoint)&&(e=t.url),e)"hide"===e?this.updateComplete.then((()=>{this.open=!1,this.fireCustomEvent(Le.Submitted)})):(this.fireCustomEvent(Le.Redirected,{url:e}),this.open=!1);else{if(0==t.body.indexOf("<!DOCTYPE HTML>"))return this.open=!1,void(document.location=t.url);this.setBody(t.body)&&this.updateComplete.then((()=>{this.updatePrimaryButton()}))}}),1e3)})).catch((t=>{console.error(t)}))}handleDialogClick(t){const e=t.detail.button,i=t.detail.detail;e.disabled||e.submitting||(e.primary||e.destructive)&&(this.suspendSubmit||this.submit()),i.closes&&(this.open=!1,this.fetching=!1,this.cancelName=void 0)}handleDialogHidden(){this.open=!1,this.fetching=!1}isDestructive(){return this.endpoint&&(this.endpoint.indexOf("delete")>-1||this.endpoint.indexOf("interrupt")>-1)}handleGotoStep(t){const e=t.target.dataset.gotoStep;e&&this.submit({wizard_goto_step:e})}getBody(){return this.shadowRoot.querySelector(".modax-body")}render(){const t=[],e=this.shadowRoot.querySelector("#wizard-form");if(e){const i=(e.getAttribute("data-completed")||"").split(",").filter((t=>t.length>0));for(let e=0;e<this.wizardStepCount;e++)t.push(Z`<div
|
|
1424
1424
|
data-goto-step=${i[e]}
|
|
1425
1425
|
@click=${this.handleGotoStep.bind(this)}
|
|
1426
1426
|
class="${jt({"step-ball":!0,active:this.wizardStep-1===e,complete:e<i.length})}"
|