@verdocs/web-sdk 2.3.51 → 2.3.52

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.
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as i,H as s,a as o}from"./p-14b44491.js";import{a as l}from"./p-7d5dbd9a.js";import"./p-05788c2b.js";import{V as r}from"./p-035f6b38.js";import{u as n,d}from"./p-feb442b1.js";import{g as a,u as p}from"./p-6eb2ce21.js";import{g as h}from"./p-7e4bacc0.js";import{g as c}from"./p-4381d111.js";import{S as f}from"./p-7a1b2643.js";import"./p-7648c449.js";const u=class{constructor(i){e(this,i),this.clickAway=t(this,"clickAway",7),this.moved=!1,this.anchor=void 0,this.voffset=0,this.align="left"}handleScroll(){this.calculatePosition()}handleResize(){this.calculatePosition()}handleClick(e){var t;this.element.contains(e.target)||null===(t=this.clickAway)||void 0===t||t.emit()}calculateLeft(){const e=document.getElementById(this.anchor);if(!e)return 0;const t=e.getBoundingClientRect();return"left"===this.align?Math.max(t.left,0):"right"===this.align?Math.max(t.left+t.width-this.portal.offsetWidth,0):Math.max(t.left-this.portal.offsetWidth/2+t.width/2,0)}calculateTop(){const e=document.getElementById(this.anchor);return e?e.getBoundingClientRect().bottom+this.voffset:0}calculatePosition(){this.portal.style.top=`${this.calculateTop()}px`,this.portal.style.left=`${this.calculateLeft()}px`}componentWillLoad(){var e;const t=`${this.anchor}-portal`;null===(e=document.getElementById(t))||void 0===e||e.remove(),this.portal=document.createElement("div"),this.portal.setAttribute("id",t),this.portal.style.zIndex="10001",this.portal.style.position="absolute",document.body.append(this.portal)}componentDidLoad(){this.portal.appendChild(this.element),this.calculatePosition()}disconnectedCallback(){this.moved?this.portal.remove():this.moved=!0}render(){return i(s,{ref:e=>this.element=e},i("slot",null))}};var v;u.style="";var m=void 0!==l&&(l.crypto||l.msCrypto);if(m&&m.getRandomValues){var x=new Uint8Array(16);v=function(){return m.getRandomValues(x),x}}if(!v){var b=new Array(16);v=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),b[t]=e>>>((3&t)<<3)&255;return b}}for(var g=v,w=[],y=0;y<256;++y)w[y]=(y+256).toString(16).substr(1);var k=function(e,t){var i=t||0;return w[e[i++]]+w[e[i++]]+w[e[i++]]+w[e[i++]]+"-"+w[e[i++]]+w[e[i++]]+"-"+w[e[i++]]+w[e[i++]]+"-"+w[e[i++]]+w[e[i++]]+"-"+w[e[i++]]+w[e[i++]]+w[e[i++]]+w[e[i++]]+w[e[i++]]+w[e[i++]]},I=g(),q=[1|I[0],I[1],I[2],I[3],I[4],I[5]],E=16383&(I[6]<<8|I[7]),L=0,T=0,C=function(e,t,i){var s=t&&i||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||g)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var l=0;l<16;++l)t[s+l]=o[l];return t||k(o)},P=C;P.v1=function(e,t,i){var s=t&&i||0,o=t||[],l=void 0!==(e=e||{}).clockseq?e.clockseq:E,r=void 0!==e.msecs?e.msecs:(new Date).getTime(),n=void 0!==e.nsecs?e.nsecs:T+1,d=r-L+(n-T)/1e4;if(d<0&&void 0===e.clockseq&&(l=l+1&16383),(d<0||r>L)&&void 0===e.nsecs&&(n=0),n>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");L=r,T=n,E=l;var a=(1e4*(268435455&(r+=122192928e5))+n)%4294967296;o[s++]=a>>>24&255,o[s++]=a>>>16&255,o[s++]=a>>>8&255,o[s++]=255&a;var p=r/4294967296*1e4&268435455;o[s++]=p>>>8&255,o[s++]=255&p,o[s++]=p>>>24&15|16,o[s++]=p>>>16&255,o[s++]=l>>>8|128,o[s++]=255&l;for(var h=e.node||q,c=0;c<6;++c)o[s+c]=h[c];return t||k(o)},P.v4=C;var M=P;const R=e=>e.charAt(0).toUpperCase()+e.slice(1),j='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#a50021"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>',D='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>',O=class{constructor(i){e(this,i),this.close=t(this,"close",7),this.delete=t(this,"delete",7),this.settingsChanged=t(this,"settingsChanged",7),this.sdkError=t(this,"sdkError",7),this.templateStore=null,this.fieldStore=null,this.roleStore=null,this.endpoint=r.getDefault(),this.templateId="",this.fieldName="",this.helpText="",this.dirty=!1,this.loading=!0,this.setting=null,this.label="",this.type="textbox",this.name="",this.required=!1,this.roleName="",this.group="",this.fieldType="",this.options=[],this.placeholder="",this.value="",this.leading=0,this.showingHelp=!1}async componentWillLoad(){var e,t,i,s,o,l,r;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[FIELD PROPERTIES] Missing required template ID ${this.templateId}`);if(!this.fieldName)return void console.error("[FIELD PROPERTIES] Missing required field name");if(!this.endpoint.session)return void console.log("[FIELD PROPERTIES] Unable to start builder session, must be authenticated");this.templateStore=await c(this.endpoint,this.templateId),this.fieldStore=await a(this.templateId),this.roleStore=await h(this.templateId);const o=this.fieldStore.get("fields").find((e=>e.name===this.fieldName));o?console.log("props",o):console.log(`[FIELD PROPERTIES] Unable to find field "${this.fieldName}" in fields`),this.type=o.type,this.name=o.name,this.label=o.label,this.group=o.name,this.roleName=o.role_name,this.required=o.required,this.fieldType=o.type,this.placeholder=(null===(e=o.setting)||void 0===e?void 0:e.placeholder)||"",this.value=(null===(t=o.setting)||void 0===t?void 0:t.result)||"",this.leading=(null===(i=o.setting)||void 0===i?void 0:i.leading)||0,this.setting=o.setting||{},this.options=(null===(s=o.setting)||void 0===s?void 0:s.options)||[],this.dirty=!1,this.loading=!1,console.log("Displaying settings for",this.setting)}catch(e){console.log("[FIELD PROPERTIES] Error loading template",e),this.loading=!1,null===(o=this.sdkError)||void 0===o||o.emit(new f(e.message,null===(l=e.response)||void 0===l?void 0:l.status,null===(r=e.response)||void 0===r?void 0:r.data))}}handleCancel(e){var t,i,s,o;e.stopPropagation();const l=this.fieldStore.get("fields").find((e=>e.name===this.fieldName));l&&(this.name=l.name,this.label=l.label,this.roleName=l.role_name,this.required=l.required,this.placeholder=(null===(t=l.setting)||void 0===t?void 0:t.placeholder)||"",this.value=(null===(i=l.setting)||void 0===i?void 0:i.result)||"",this.leading=(null===(s=l.setting)||void 0===s?void 0:s.leading)||0),this.dirty=!1,null===(o=this.close)||void 0===o||o.emit()}handleSave(e){e.stopPropagation();const t={name:this.name,label:this.label||null,required:this.required,role_name:this.roleName};"checkbox_group"===this.type||"radio_button_group"===this.type?(t.setting=this.setting,t.setting.options=this.options):"textarea"===this.type||"textbox"===this.type?(t.setting={...this.setting},t.setting.result=(this.value||"").trim()):"dropdown"===this.type&&(t.setting={x:this.setting.x,y:this.setting.y,options:this.options}),console.log("FP: Will update",this.fieldName,t),n(this.endpoint,this.templateId,this.fieldName,t).then((e=>{var i,s;this.dirty=!1;const o=[...this.fieldStore.get("fields").map((t=>t.name!==this.fieldName?t:{...t,...e}))];this.fieldStore.set("fields",o),null===(i=this.settingsChanged)||void 0===i||i.emit({fieldName:this.fieldName,settings:t,field:e}),null===(s=this.close)||void 0===s||s.emit()})).catch((()=>{console.log("Field update failed",e)}))}handleAddOption(e){e.stopPropagation();const t={name:this.name,required:this.required,role_name:this.roleName};this.options.push("radio_button_group"===this.type?{id:M(),value:`Option ${this.options.length+1}`,selected:!1,x:this.options.length>0?this.options[this.options.length-1].x:20,y:this.options.length>0?this.options[this.options.length-1].y-25:20}:{id:M(),value:`Option ${this.options.length+1}`,checked:!1,x:this.options.length>0?this.options[this.options.length-1].x:20,y:this.options.length>0?this.options[this.options.length-1].y-25:20}),t.setting={...this.setting},delete t.setting.result,t.setting.options=[...this.options],n(this.endpoint,this.templateId,this.fieldName,t).then((e=>{var i,s;this.dirty=!1,p(this.fieldStore,this.fieldName,e),this.fieldName=e.name,null===(i=this.settingsChanged)||void 0===i||i.emit({fieldName:this.fieldName,settings:t,field:e}),null===(s=this.close)||void 0===s||s.emit()})).catch((()=>{console.log("Field update failed",e)}))}async handleDelete(e){e.stopPropagation(),window.confirm("Are you sure you wish to remove this field? This action cannot be undone.")&&d(this.endpoint,this.templateId,this.fieldName).then((()=>{var e,t;this.fieldStore.set("fields",this.fieldStore.get("fields").filter((e=>e.name!==this.fieldName))),null===(e=this.delete)||void 0===e||e.emit({templateId:this.templateId,roleName:this.roleName}),null===(t=document.getElementById("verdocs-template-field-properties"))||void 0===t||t.remove()})).catch((e=>{console.log("[FIELD PROPERTIES] Deletion error",e)}))}render(){var e;return this.endpoint.session?this.endpoint.session&&this.fieldStore.get("fields").some((e=>e.name===this.fieldName))?this.helpText&&this.showingHelp?i(s,null,i("h6",null,R(this.fieldType)," Settings ",i("div",{style:{flex:"1"}}),i("div",{class:"help-icon",innerHTML:D,onClick:()=>this.showingHelp=!1})),i("p",{class:"instructions",innerHTML:this.helpText})):i(s,{id:"verdocs-template-field-properties"},i("h6",null,R(this.fieldType.replace(/_/g," "))," Settings ",i("div",{style:{flex:"1"}}),this.helpText&&i("div",{class:"help-icon",innerHTML:D,onClick:()=>this.showingHelp=!0})),i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("div",{class:"row"},i("verdocs-text-input",{id:"verdocs-field-name",label:"Field Name",value:this.name,autocomplete:"off",placeholder:"Field Name...",onInput:e=>{this.name=e.target.value,this.dirty=!0}})),i("div",{class:"row"},i("verdocs-text-input",{id:"verdocs-field-label",label:"Optional Label",value:this.label,autocomplete:"off",placeholder:"Optional Label...",onInput:e=>{this.label=e.target.value,this.dirty=!0}})),i("div",{class:"row"},i("div",{class:"input-label"},"Role:"),i("verdocs-select-input",{value:this.roleName,options:null===(e=this.roleStore.state)||void 0===e?void 0:e.roles.map((e=>({label:e.name,value:e.name}))),onInput:e=>{this.roleName=e.target.value,this.dirty=!0}})),["textbox","textarea"].includes(this.type)&&i("div",{class:"row",style:{marginTop:"10px",marginBottom:"10px"}},i("verdocs-text-input",{id:"verdocs-field-value",label:"Value",value:this.value,autocomplete:"off",placeholder:"Pre-defined value...",onInput:e=>{this.value=e.target.value,this.dirty=!0}})),["textbox","textarea"].includes(this.type)&&i("div",{class:"row",style:{marginTop:"10px",marginBottom:"10px"}},i("verdocs-text-input",{id:"verdocs-field-placeholder",label:"Placeholder",value:this.placeholder,autocomplete:"off",placeholder:"Placeholder...",onInput:e=>{this.placeholder=e.target.value,this.dirty=!0}})),i("div",{class:"row",style:{marginTop:"15px",marginBottom:"15px"}},i("label",{htmlFor:"verdocs-is-required",class:"input-label"},"Required"),i("verdocs-checkbox",{id:"verdocs-is-required",name:"is-required",checked:this.required,value:"on",onInput:e=>{this.required=e.target.checked,this.dirty=!0}})),["checkbox_group","radio_button_group"].includes(this.type)&&i("verdocs-button",{size:"small",onClick:e=>this.handleAddOption(e),label:"Add Option"}),["dropdown"].includes(this.type)&&i("div",{class:"options"},i("div",{class:"row",style:{marginTop:"15px",marginBottom:"15px",textAlign:"center",fontWeight:"700",fontSize:"14px",justifyContent:"center",backgroundColor:"#333333",padding:"5px 8px",color:"#ffffff"}},"Options"),i("div",{class:"row-header"},i("h6",null,"ID"),i("h6",null,"Label"),i("div",{style:{width:"34px"}})),this.options.map(((e,t)=>i("div",{class:"row option-row",key:t},i("verdocs-text-input",{id:`verdocs-option-id-${e.id}`,value:e.id,placeholder:"Unique ID",onInput:e=>{this.options[t].id=e.target.value,this.dirty=!0}}),i("verdocs-text-input",{id:`verdocs-option-value-${e.id}`,value:e.value,placeholder:"Display value",onInput:e=>{this.options[t].value=e.target.value,this.dirty=!0}}),i("button",{innerHTML:j,class:"remove-button",onClick:()=>{this.options=this.options.filter((t=>t.id!==e.id)),this.dirty=!0}})))),i("div",{class:"row-header"},i("button",{class:"add-option-button",onClick:()=>{this.options=[...this.options,{id:`option-${this.options.length+1}`,value:`Option ${this.options.length+1}`}],this.dirty=!0}},"Add Option"))),i("div",{class:"buttons"},i("button",{class:"delete-button",disabled:this.dirty,onClick:e=>this.handleDelete(e),innerHTML:j}),i("div",{style:{flex:"1"}}),i("verdocs-button",{size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:e=>this.handleCancel(e)}),i("verdocs-button",{size:"small",label:"Save",disabled:!this.dirty,onClick:e=>this.handleSave(e)})))):i(s,{class:"empty"}):i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}get el(){return o(this)}};O.style='verdocs-template-field-properties{padding:20px;display:block;border-radius:4px;background:#ffffff;border:1px solid #ccc;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;-webkit-box-shadow:2px 2px 10px 0px #0000001f;box-shadow:2px 2px 10px 0px #0000001f}verdocs-template-field-properties .buttons{display:-ms-flexbox;display:flex;margin-top:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-field-properties .buttons verdocs-button{margin-left:16px}verdocs-template-field-properties form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-field-properties form .row .input-label{display:block;color:#555570;font-weight:700;font-size:14px;margin:0 0 4px 0;-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-field-properties verdocs-select-input{-ms-flex:1;flex:1;margin:0}verdocs-template-field-properties verdocs-text-input{margin:0;-ms-flex:1;flex:1}verdocs-template-field-properties verdocs-text-input label{margin:0;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-field-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-field-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-field-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-field-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-field-properties .delete-button:active{background:#f3f3f3}verdocs-template-field-properties .delete-button svg{width:24px;height:24px}verdocs-template-field-properties h6{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;font-size:16px;font-weight:bold;margin:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;color:#092c4c}verdocs-template-field-properties h6 .help-icon{opacity:0.5}verdocs-template-field-properties h6 .help-icon:hover{opacity:1;cursor:pointer}verdocs-template-field-properties .row-header{gap:15px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-template-field-properties .row-header h6{margin-bottom:0}verdocs-template-field-properties .row-header verdocs-help-icon{-webkit-transform:scale(0.85);transform:scale(0.85)}verdocs-template-field-properties .row-header verdocs-help-icon svg{margin-bottom:-5px}verdocs-template-field-properties .row-header .add-button{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-field-properties .row-header .add-button:hover{opacity:1}verdocs-template-field-properties .row-header .add-button svg{width:32px;height:32px}verdocs-template-field-properties .option-row{margin:15px 0}verdocs-template-field-properties .option-row .remove-button{height:28px;display:-ms-flexbox;display:flex;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-field-properties .option-row .remove-button:active{background:#f3f3f3}verdocs-template-field-properties .option-row .remove-button:hover svg{stroke:#a50021}verdocs-template-field-properties .option-row .remove-button svg{width:20px;height:20px;stroke:#333333}verdocs-template-field-properties .options{background:#f3f3f3;padding:0 0 10px 0}verdocs-template-field-properties .options .row-header,verdocs-template-field-properties .options .option-row{padding:0 10px}verdocs-template-field-properties .options .add-option-button{border-radius:5px;border:1px solid #cccccc;background:#46497d;color:#ffffff;padding:3px 8px}verdocs-template-field-properties .options .option-row .input-element{font-size:14px}verdocs-template-field-properties .options verdocs-help-icon{opacity:1;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-field-properties .options verdocs-help-icon svg{fill:#ffffff}';export{u as verdocs_portal,O as verdocs_template_field_properties}