@verdocs/web-sdk 4.2.115 → 4.2.117

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,h as t,H as o,c as i,g as s}from"./p-5207d80c.js";import{VerdocsEndpoint as r,updateField as l,deleteField as a}from"@verdocs/js-sdk";import{g as d,u as c}from"./p-784ac100.js";import{g as n}from"./p-9e371467.js";import{g as p}from"./p-1b0294d4.js";import{S as h}from"./p-fd97809c.js";import"./p-83317d11.js";import"./p-a706bac9.js";const f=class{constructor(t){e(this,t),this.checked=!1,this.name="",this.label="",this.value="",this.theme="light",this.disabled=!1}render(){return t(o,{key:"81036ae0ba0f74e5ef75722462bf9bc726ab438e",class:{disabled:this.disabled,[this.theme]:!0}},t("label",{key:"30a436a445a8ef50bcc2f5679e9aa0d2569ac2ce"},t("input",{key:"9dfbfde6d616f1a317815e00617d81a08aa85964",type:"checkbox",value:this.value,name:this.name,checked:this.checked,disabled:this.disabled}),t("span",{key:"f0319a2eedc97d8ec91dc675f36f52d0e07dee9d"},this.label)))}};f.style='@charset "UTF-8";@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-checkbox{line-height:18px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-checkbox label>input[type=checkbox]{display:none}verdocs-checkbox label>input[type=checkbox]+*::before{content:"";width:20px;height:20px;-ms-flex-negative:0;flex-shrink:0;margin-right:8px;line-height:20px;border-radius:2px;border-style:solid;border-width:0.1rem;display:inline-block;vertical-align:bottom;border-color:#aeb4bf}verdocs-checkbox label>input[type=checkbox]:checked+*{color:#55bc81}verdocs-checkbox label>input[type=checkbox]:checked+*::before{content:"✓";color:white;text-align:center;background:#55bc81;border-color:#55bc81}verdocs-checkbox.dark label>input[type=checkbox]+*::before{border-color:#ffffff}verdocs-checkbox.dark label>input[type=checkbox]:checked+*::before{background:#55bc81;border-color:#55bc81}';const b=class{constructor(t){e(this,t),this.message=""}render(){return t(o,{key:"0e55b2356678698f8ff73fecf719bbdc81f0b24a"},t("div",{key:"e4a1572dde8ebc1890deca3ebc9883db0c4a1d29",class:"inner"},this.message))}};b.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-component-error{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;padding:15px;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-component-error .inner{-ms-flex:1;flex:1;height:300px;display:-ms-flexbox;display:flex;font-size:18px;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 20px;background:#ffffff;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}';const m=class{constructor(t){e(this,t),this.value="",this.label="",this.options=void 0,this.disabled=!1}render(){return t(o,{key:"190e18d69d6e891867c4c02d0e9053607b372b1f",class:"input-field"},t("label",{key:"32a613ab516b76a45ecf5cdd61874a079fb05f07"},this.label?t("div",{class:"input-label"},this.label+":"):t("div",null),t("select",{key:"d5347e5bca7dd01d0a9b71817028b0303753cf97",class:"input-element",disabled:this.disabled},this.options.map((e=>t("option",{value:e.value,selected:e.value===this.value},e.label))))))}};m.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-select-input{font-family:"Inter", "Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 0 10px 0;display:block}verdocs-select-input .input-element{-webkit-box-sizing:border-box;box-sizing:border-box;background:#ffffff;border:1px solid #cccccc;border-radius:4px;background:#ffffff;color:#092c4c;width:100%;font-size:16px;height:28px;padding:2px 8px}verdocs-select-input .input-element::-webkit-input-placeholder{color:#aaaaaa;opacity:1}verdocs-select-input .input-element::-moz-placeholder{color:#aaaaaa;opacity:1}verdocs-select-input .input-element:-ms-input-placeholder{color:#aaaaaa;opacity:1}verdocs-select-input .input-element::-ms-input-placeholder{color:#aaaaaa;opacity:1}verdocs-select-input .input-element::placeholder{color:#aaaaaa;opacity:1}verdocs-select-input .input-label{display:block;color:#555570;font-weight:700;font-size:14px;margin:0 0 4px 0}';const u=e=>e.charAt(0).toUpperCase()+e.slice(1),x='<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>',v='<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>',g=class{constructor(t){e(this,t),this.close=i(this,"close",7),this.delete=i(this,"delete",7),this.settingsChanged=i(this,"settingsChanged",7),this.sdkError=i(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.label="",this.type="textbox",this.name="",this.required=!1,this.roleName="",this.group="",this.fieldType="",this.options=[],this.placeholder="",this.defaultValue="",this.showingHelp=!1}async componentWillLoad(){var e,t,o;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 p(this.endpoint,this.templateId),this.fieldStore=d(this.templateId),this.roleStore=n(this.templateId),this.resetForm()}catch(i){console.log("[FIELD PROPERTIES] Error loading template",i),this.loading=!1,null===(e=this.sdkError)||void 0===e||e.emit(new h(i.message,null===(t=i.response)||void 0===t?void 0:t.status,null===(o=i.response)||void 0===o?void 0:o.data))}}resetForm(){const e=this.fieldStore.get("fields").find((e=>e.name===this.fieldName));e?(console.log("[FIELD PROPERTIES]",e),this.type=e.type,this.name=e.name,this.label=e.label,this.group=e.group,this.roleName=e.role_name,this.required=e.required,this.fieldType=e.type,this.options=e.options||[],this.placeholder=e.placeholder||"",this.defaultValue=e.default||"",this.dirty=!1,this.loading=!1,this.cleanupOptions()):console.log(`[FIELD PROPERTIES] Unable to find field "${this.fieldName}" in fields`)}handleCancel(e){var t,o;e.stopPropagation(),this.resetForm(),null===(t=this.close)||void 0===t||t.emit(),null===(o=document.getElementById("verdocs-template-field-properties"))||void 0===o||o.remove()}handleSave(e){e.stopPropagation();const t={name:this.name,role_name:this.roleName,required:this.required,label:this.label,group:this.group,placeholder:this.placeholder,default:this.defaultValue,options:this.options};console.log("[FIELD PROPERTIES] Will update",this.fieldName,t),l(this.endpoint,this.templateId,this.fieldName,t).then((e=>{var t,o,i;console.log("[FIELD PROPERTIES] Updated",e),c(this.fieldStore,this.fieldName,e),null===(t=this.settingsChanged)||void 0===t||t.emit({fieldName:this.fieldName,field:e}),null===(o=this.close)||void 0===o||o.emit(),null===(i=document.getElementById("verdocs-template-field-properties"))||void 0===i||i.remove()})).catch((()=>{console.log("[FIELD PROPERTIES] Update failed",e)}))}async handleDelete(e){e.stopPropagation(),a(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)}))}cleanupOptions(){this.options=[...this.options.filter((e=>""!==(e.id||"").trim()||""!==(e.label||"").trim()))],this.options.find((e=>!e.id&&!e.label))||(this.options=[...this.options,{id:"",label:""}])}render(){var e;return this.endpoint.session?this.endpoint.session&&this.fieldStore.get("fields").some((e=>e.name===this.fieldName))?this.helpText&&this.showingHelp?t(o,null,t("h6",null,u(this.fieldType)," Settings ",t("div",{style:{flex:"1"}}),t("div",{class:"help-icon",innerHTML:v,onClick:()=>this.showingHelp=!1})),t("p",{class:"instructions",innerHTML:this.helpText})):t(o,{id:"verdocs-template-field-properties"},t("h6",null,u(this.fieldType.replace(/_/g," "))," Settings ",t("div",{style:{flex:"1"}}),this.helpText&&t("div",{class:"help-icon",innerHTML:v,onClick:()=>this.showingHelp=!0})),t("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},t("div",{class:"row"},t("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}})),t("div",{class:"row"},t("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}})),t("div",{class:"row"},t("div",{class:"input-label"},"Role:"),t("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)&&t("div",{class:"row",style:{marginTop:"10px",marginBottom:"10px"}},t("verdocs-text-input",{id:"verdocs-field-value",label:"Default Value",value:this.defaultValue,autocomplete:"off",placeholder:"Pre-filled value...",onInput:e=>{this.defaultValue=e.target.value,this.dirty=!0}})),"radio"===this.type&&t("div",{class:"row"},t("verdocs-text-input",{id:"verdocs-field-label",label:"Group",value:this.group,autocomplete:"off",helpText:"Enable exclusive selections. Only one option within the same group may be selected at a time.",placeholder:"Group...",onInput:e=>{this.group=(e.target.value||"").trim().toLowerCase().replace(/[^a-z0-9]/g,""),this.dirty=!0}})),["textbox","textarea"].includes(this.type)&&t("div",{class:"row",style:{marginTop:"10px",marginBottom:"10px"}},t("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}})),t("div",{class:"row",style:{marginTop:"15px",marginBottom:"15px"}},t("label",{htmlFor:"verdocs-is-required",class:"input-label"},"Required"),t("verdocs-checkbox",{id:"verdocs-is-required",name:"is-required",checked:this.required,value:"on",onInput:e=>{this.required=e.target.checked,this.dirty=!0}})),"dropdown"===this.type&&t("div",{class:"row",style:{marginTop:"15px",marginBottom:"15px"}},t("label",{htmlFor:"verdocs-is-required",class:"input-label"},"Options")),"dropdown"===this.type&&t("div",{class:"options"},t("div",{class:"options-header"},t("div",{class:"options-header-label"},"ID"),t("dev",{class:"options-header-label"},"Label")),this.options.map(((e,o)=>t("div",{class:"row option-row",key:o},t("verdocs-text-input",{id:`verdocs-option-id-${e.id}`,value:e.id,placeholder:"Unique ID",onInput:e=>{this.options[o].id=e.target.value,this.dirty=!0,this.cleanupOptions()}}),t("verdocs-text-input",{id:`verdocs-option-label-${e.id}`,value:e.value,placeholder:"Display label",onInput:e=>{this.options[o].label=e.target.label,this.dirty=!0,this.cleanupOptions()}}),t("button",{innerHTML:x,class:"remove-button",onClick:()=>{this.options=this.options.filter((t=>t.id!==e.id)),this.dirty=!0,this.cleanupOptions()}}))))),t("div",{class:"buttons"},t("button",{class:"delete-button",disabled:this.dirty,onClick:e=>this.handleDelete(e),innerHTML:x}),t("div",{style:{flex:"1"}}),t("verdocs-button",{size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:e=>this.handleCancel(e)}),t("verdocs-button",{size:"small",label:"Save",disabled:!this.dirty,onClick:e=>this.handleSave(e)})))):t(o,{class:"empty"}):t(o,null,t("verdocs-component-error",{message:"You must be authenticated to use this module."}))}get el(){return s(this)}};g.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}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 0 rgba(0, 0, 0, 0.1215686275);box-shadow:2px 2px 10px 0 rgba(0, 0, 0, 0.1215686275)}@media all and (max-width: 600px){verdocs-template-field-properties{padding:10px;-webkit-transform:scale(0.8);transform:scale(0.8)}}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 .options-header{gap:10px;margin:0 0 5px 0;display:-ms-flexbox;display:flex;color:#ffffff;font-size:14px;padding:5px 8px;font-weight:700;text-align:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center;background-color:#333333}verdocs-template-field-properties .options-header-label{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;font-weight:700;font-size:14px}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:rgb(165, 0, 33)}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 1px 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{f as verdocs_checkbox,b as verdocs_component_error,m as verdocs_select_input,g as verdocs_template_field_properties}