@verdocs/web-sdk 1.12.33 → 1.12.35

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.
Files changed (81) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/verdocs-build.cjs.entry.js +13 -3
  3. package/dist/cjs/verdocs-button-panel_3.cjs.entry.js +6 -1
  4. package/dist/cjs/verdocs-progress-bar.cjs.entry.js +23 -0
  5. package/dist/cjs/verdocs-send.cjs.entry.js +5 -3
  6. package/dist/cjs/verdocs-template-create_3.cjs.entry.js +755 -0
  7. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  8. package/dist/collection/collection-manifest.json +1 -0
  9. package/dist/collection/components/controls/verdocs-progress-bar/verdocs-progress-bar.css +31 -0
  10. package/dist/collection/components/controls/verdocs-progress-bar/verdocs-progress-bar.js +84 -0
  11. package/dist/collection/components/controls/verdocs-progress-bar/verdocs-progress-bar.stories.js +12 -0
  12. package/dist/collection/components/embeds/verdocs-build/verdocs-build.js +27 -3
  13. package/dist/collection/components/embeds/verdocs-send/verdocs-send.css +1 -0
  14. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +4 -2
  15. package/dist/collection/components/templates/verdocs-template-create/verdocs-template-create.css +3 -1
  16. package/dist/collection/components/templates/verdocs-template-create/verdocs-template-create.js +20 -24
  17. package/dist/collection/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.js +7 -1
  18. package/dist/collection/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.stories.js +2 -1
  19. package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.css +2 -0
  20. package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.stories.js +1 -2
  21. package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +2 -0
  22. package/dist/components/index.d.ts +1 -0
  23. package/dist/components/index.js +1 -0
  24. package/dist/components/verdocs-build.js +79 -15
  25. package/dist/components/verdocs-progress-bar.d.ts +11 -0
  26. package/dist/components/verdocs-progress-bar.js +6 -0
  27. package/dist/components/verdocs-progress-bar2.js +38 -0
  28. package/dist/components/verdocs-send.js +5 -3
  29. package/dist/components/verdocs-template-create2.js +33 -31
  30. package/dist/components/verdocs-template-field-properties2.js +7 -1
  31. package/dist/components/verdocs-template-fields2.js +1 -1
  32. package/dist/components/verdocs-template-roles.js +1 -374
  33. package/dist/{esm/verdocs-template-roles.entry.js → components/verdocs-template-roles2.js} +100 -22
  34. package/dist/docs.json +119 -2
  35. package/dist/esm/loader.js +1 -1
  36. package/dist/esm/verdocs-build.entry.js +13 -3
  37. package/dist/esm/verdocs-button-panel_3.entry.js +6 -1
  38. package/dist/esm/verdocs-progress-bar.entry.js +19 -0
  39. package/dist/esm/verdocs-send.entry.js +5 -3
  40. package/dist/esm/verdocs-template-create_3.entry.js +749 -0
  41. package/dist/esm/verdocs-web-sdk.js +1 -1
  42. package/dist/esm-es5/loader.js +1 -1
  43. package/dist/esm-es5/verdocs-build.entry.js +1 -1
  44. package/dist/esm-es5/verdocs-button-panel_3.entry.js +1 -1
  45. package/dist/esm-es5/verdocs-progress-bar.entry.js +1 -0
  46. package/dist/esm-es5/verdocs-send.entry.js +1 -1
  47. package/dist/esm-es5/verdocs-template-create_3.entry.js +1 -0
  48. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  49. package/dist/types/components/controls/verdocs-progress-bar/verdocs-progress-bar.d.ts +18 -0
  50. package/dist/types/components/controls/verdocs-progress-bar/verdocs-progress-bar.stories.d.ts +8 -0
  51. package/dist/types/components/embeds/verdocs-build/verdocs-build.d.ts +6 -0
  52. package/dist/types/components/templates/verdocs-template-create/verdocs-template-create.d.ts +2 -0
  53. package/dist/types/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.d.ts +1 -0
  54. package/dist/types/components.d.ts +41 -0
  55. package/dist/verdocs-web-sdk/p-2413519c.system.entry.js +1 -0
  56. package/dist/verdocs-web-sdk/p-423b6ddf.entry.js +1 -0
  57. package/dist/verdocs-web-sdk/p-5cf14e4c.entry.js +1 -0
  58. package/dist/verdocs-web-sdk/p-6caf1137.system.js +1 -1
  59. package/dist/verdocs-web-sdk/p-6e1e787a.system.entry.js +1 -0
  60. package/dist/verdocs-web-sdk/p-a2cd33fd.system.entry.js +1 -0
  61. package/dist/verdocs-web-sdk/p-bcc9c2d8.entry.js +1 -0
  62. package/dist/verdocs-web-sdk/p-c4229602.system.entry.js +1 -0
  63. package/dist/verdocs-web-sdk/p-e4b18c52.entry.js +1 -0
  64. package/dist/verdocs-web-sdk/{p-0ba7360f.system.entry.js → p-fdbafc1f.system.entry.js} +1 -1
  65. package/dist/verdocs-web-sdk/p-fe2ab7b9.entry.js +1 -0
  66. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  67. package/package.json +1 -1
  68. package/dist/cjs/verdocs-template-create_2.cjs.entry.js +0 -473
  69. package/dist/cjs/verdocs-template-roles.cjs.entry.js +0 -304
  70. package/dist/esm/verdocs-template-create_2.entry.js +0 -468
  71. package/dist/esm-es5/verdocs-template-create_2.entry.js +0 -1
  72. package/dist/esm-es5/verdocs-template-roles.entry.js +0 -1
  73. package/dist/verdocs-web-sdk/p-0c5c9ebf.system.entry.js +0 -1
  74. package/dist/verdocs-web-sdk/p-13b8ec6f.system.entry.js +0 -1
  75. package/dist/verdocs-web-sdk/p-1da14840.entry.js +0 -1
  76. package/dist/verdocs-web-sdk/p-4ddd2113.system.entry.js +0 -1
  77. package/dist/verdocs-web-sdk/p-6f828ccb.system.entry.js +0 -1
  78. package/dist/verdocs-web-sdk/p-a2438331.entry.js +0 -1
  79. package/dist/verdocs-web-sdk/p-baf138a0.entry.js +0 -1
  80. package/dist/verdocs-web-sdk/p-cd0bdac3.entry.js +0 -1
  81. package/dist/verdocs-web-sdk/p-e890fc53.entry.js +0 -1
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,i,o){function a(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,n){function r(e){try{l(o.next(e))}catch(e){n(e)}}function s(e){try{l(o["throw"](e))}catch(e){n(e)}}function l(e){e.done?i(e.value):a(e.value).then(r,s)}l((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},o,a,n,r;return r={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function s(e){return function(t){return l([e,t])}}function l(r){if(o)throw new TypeError("Generator is already executing.");while(i)try{if(o=1,a&&(n=r[0]&2?a["return"]:r[0]?a["throw"]||((n=a["return"])&&n.call(a),0):a.next)&&!(n=n.call(a,r[1])).done)return n;if(a=0,n)r=[r[0]&2,n.value];switch(r[0]){case 0:case 1:n=r;break;case 4:i.label++;return{value:r[1],done:false};case 5:i.label++;a=r[1];r=[0];continue;case 7:r=i.ops.pop();i.trys.pop();continue;default:if(!(n=i.trys,n=n.length>0&&n[n.length-1])&&(r[0]===6||r[0]===2)){i=0;continue}if(r[0]===3&&(!n||r[1]>n[0]&&r[1]<n[3])){i.label=r[1];break}if(r[0]===6&&i.label<n[1]){i.label=n[1];n=r;break}if(n&&i.label<n[2]){i.label=n[2];i.ops.push(r);break}if(n[2])i.ops.pop();i.trys.pop();continue}r=t.call(e,i)}catch(e){r=[6,e];a=0}finally{o=n=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var o=0,a=t.length,n;o<a;o++){if(n||!(o in t)){if(!n)n=Array.prototype.slice.call(t,0,o);n[o]=t[o]}}return e.concat(n||Array.prototype.slice.call(t))};System.register(["./p-871407e9.system.js","./p-d46a428b.system.js","./p-69912cbf.system.js","./p-63398dca.system.js","./p-5c043400.system.js","./p-187b20b7.system.js","./p-9a20f533.system.js","./p-b1288daf.system.js","./p-0d81757b.system.js","./p-71b8bb54.system.js","./p-8ac64953.system.js","./p-db003554.system.js","./p-327858f0.system.js","./p-51a3ea62.system.js","./p-d50523fd.system.js"],(function(e){"use strict";var t,i,o,a,n,r,s,l,d,c,p,h,g,u,f,m,v,x,b;return{setters:[function(e){t=e.r;i=e.c;o=e.h;a=e.H},function(){},function(e){n=e.c;r=e.g},function(e){s=e.c},function(e){l=e.V},function(e){d=e.S},function(e){c=e.i},function(e){p=e.u;h=e.c},function(e){g=e.b;u=e.r;f=e.e;m=e.f;v=e.h},function(e){x=e.s},function(e){b=e.l},function(){},function(){},function(){},function(){}],execute:function(){var w='verdocs-template-create{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-create form{background-color:#ffffff;padding:12px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-create form .upload-box{-webkit-box-sizing:border-box;box-sizing:border-box;width:320px;text-align:center;padding:44px 18px 66px;border:2px dashed #979797;color:rgba(0, 0, 0, 0.54)}verdocs-template-create form .upload-box svg{width:64px;fill:#5c6575}verdocs-template-create .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end;padding:0 0 30px 0}verdocs-template-create .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-create ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-create ::-moz-placeholder{color:#aaaaaa}verdocs-template-create :-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::placeholder{color:#aaaaaa}';var y=" ";var q='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"></path></svg>';var C=e("verdocs_template_create",function(){function e(e){t(this,e);this.exit=i(this,"exit",7);this.next=i(this,"next",7);this.sdkError=i(this,"sdkError",7);this.endpoint=l.getDefault();this.file=undefined;this.creating=false}e.prototype.componentWillLoad=function(){this.endpoint.setTimeout(3e4);this.endpoint.loadSession()};e.prototype.handleFileChanged=function(e){var t;this.file=((t=e.target.files)===null||t===void 0?void 0:t[0])||null;console.log("[CREATE] Selected file",this.file)};e.prototype.handleUpload=function(e){e.stopPropagation();var t=document.getElementById("verdocs-template-create-file");t.click()};e.prototype.handleCancel=function(e){e.stopPropagation();this.exit.emit()};e.prototype.handleSubmit=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,o,a,l,c,p,h;var g=this;return __generator(this,(function(u){switch(u.label){case 0:e.stopPropagation();console.log("Submitting");if(!this.file){return[2]}this.creating=true;u.label=1;case 1:u.trys.push([1,4,,5]);return[4,n(this.endpoint,{name:this.file.name})];case 2:a=u.sent();console.log("[CREATE] Created template",a);return[4,s(this.endpoint,a.id,this.file)];case 3:l=u.sent();console.log("[CREATE] Created document",l);c=null;p=setInterval((function(){return __awaiter(g,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:console.log("[CREATE] Waiting for template to be processed...",l);return[4,r(this.endpoint,a.id)];case 1:c=t.sent();if(c===null||c===void 0?void 0:c.processed){console.log("[CREATE] Retrieved new template",c);if(p){clearInterval(p)}(e=this.next)===null||e===void 0?void 0:e.emit(c);this.creating=false}return[2]}}))}))}),3e3);return[3,5];case 4:h=u.sent();console.log("[CREATE] Error creating template",h);(t=this.sdkError)===null||t===void 0?void 0:t.emit(new d(h.message,(i=h.response)===null||i===void 0?void 0:i.status,(o=h.response)===null||o===void 0?void 0:o.data));this.creating=false;return[3,5];case 5:return[2]}}))}))};e.prototype.render=function(){var e=this;if(!this.endpoint.session){return o(a,null,o("verdocs-component-error",{message:"You must be authenticated to use this module."}))}return o("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},o("input",{type:"file",id:"verdocs-template-create-file",multiple:true,accept:"application/pdf",style:{display:"none"},onChange:function(t){return e.handleFileChanged(t)}}),this.creating?o("div",{class:"loader-wrapper"},o("verdocs-loader",null),o("div",{class:"loading-text"},"Processing, please wait...")):o("div",{class:"upload-box"},o("div",null,o("span",{innerHTML:q})),o("div",{style:{marginTop:"20px",fontSize:"20px",fontWeight:"bold",overflowWrap:"anywhere"}},this.file?this.file.name:"Drag a file here"),o("div",{style:{marginTop:"20px",marginBottom:"20px",fontSize:"16px",height:"20px"}},this.file?y:"Or, if you prefer..."),o("verdocs-button",{label:this.file?"Select a different file":"Select a file from your computer",size:"small",onClick:function(t){return e.handleUpload(t)}})),o("div",{class:"buttons"},o("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.creating}),o("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleSubmit(t)},disabled:!this.file||this.creating})))};return e}());C.style=w;var E="verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px #0000000f;box-shadow:0 0 10px 5px #0000000f}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{height:50px;display:-ms-flexbox;display:flex;-ms-flex:0 0 50px;flex:0 0 50px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio_button_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";var k='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>';var Z='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z"/></svg>';var _='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>';var V='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>';var H='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>';var M='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';var S='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';var I='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>';var A='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';var L='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';var z=[{id:"signature",tooltip:"Signature",icon:M},{id:"initial",tooltip:"Initials",icon:S},{id:"sep1",tooltip:"",icon:L},{id:"textbox",tooltip:"Text Box",icon:k},{id:"textarea",tooltip:"Text Area",icon:Z},{id:"checkbox_group",tooltip:"Check Box",icon:_},{id:"radio_button_group",tooltip:"Radio Button",icon:V},{id:"dropdown",tooltip:"Dropdown",icon:A},{id:"sep2",tooltip:"",icon:L},{id:"date",tooltip:"Date",icon:H},{id:"timestamp",tooltip:"Timestamp",icon:I}];var P=e("verdocs_template_fields",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.templateUpdated=i(this,"templateUpdated",7);this.pageHeights={};this.cachedPageInfo={};this.endpoint=l.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.selectedRoleName="";this.rerender=1}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,o,a,n,r,s;return __generator(this,(function(l){switch(l.label){case 0:l.trys.push([0,5,,6]);this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[BUILD] Unable to start builder session, must be authenticated");return[2]}l.label=1;case 1:l.trys.push([1,3,,4]);console.log("[FIELDS] Loading template ".concat(this.templateId),this.endpoint.session);return[4,b(this.endpoint,this.templateId,true)];case 2:l.sent();this.selectedRoleName=x.roleNames[0];console.log("Starting with role",this.selectedRoleName);return[3,4];case 3:r=l.sent();console.log("[FIELDS] Error loading template",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new d(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(i=r.response)===null||i===void 0?void 0:i.data));return[3,4];case 4:return[3,6];case 5:s=l.sent();console.log("[FIELDS] Error with preview session",s);(o=this.sdkError)===null||o===void 0?void 0:o.emit(new d(s.message,(a=s.response)===null||a===void 0?void 0:a.status,(n=s.response)===null||n===void 0?void 0:n.data));return[3,6];case 6:return[2]}}))}))};e.prototype.componentDidRender=function(){c.dynamicDrop(true);var e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var t=document.getElementById("verdocs-template-fields-toolbar");if(e&&t){console.log("[FIELDS] Moving toolbar");t.remove();e.append(t)}};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=null}};e.prototype.handleFieldChange=function(e,t,i){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){console.log("[FIELDS] handleFieldChange",e,t,i);this.rerender++;return[2]}))}))};e.prototype.attachFieldAttributes=function(e,t,i,o){var a=this;o.addEventListener("input",(function(e){return a.handleFieldChange(t,e)}));o.addEventListener("settingsChanged",(function(){var e;console.log("Settings",x.fields);a.selectedRoleName=t.role_name;console.log("settings changed",a.selectedRoleName,t);o.setAttribute("roleindex",g(x.roleNames,t.role_name));a.rerender++;o.setAttribute("rerender",a.rerender);(e=a.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:a.endpoint,template:x.template,event:"updated-field"})}));o.addEventListener("deleted",(function(){var e;console.log("deleted",a,t);o.remove();a.rerender++;(e=a.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:a.endpoint,template:x.template,event:"updated-field"})}));o.setAttribute("roleindex",i);o.setAttribute("pageNumber",e.pageNumber);o.setAttribute("xScale",e.xScale);o.setAttribute("yScale",e.yScale);o.setAttribute("name",t.name)};e.prototype.handlePageRendered=function(e){var t=this;var i=e.detail;console.log("[FIELDS] Page rendered",i.pageNumber,i);this.cachedPageInfo[i.pageNumber]=i;this.pageHeights[i.pageNumber]=i.naturalHeight;var o=x.fields.filter((function(e){return e.page_sequence===i.pageNumber}));o.forEach((function(e){var o=g(x.roleNames,e.role_name);var a=u(e,i,o,{disabled:true,editable:true,draggable:true});if(!a){return}if(Array.isArray(a)){a.forEach((function(a){t.attachFieldAttributes(i,e,o,a);c(a).draggable({listeners:{start:function(e){console.log("[FIELDS] Drag started",e.type,e.target)},move:function(e){var t=+(e.target.getAttribute("posX")||0);var i=+(e.target.getAttribute("posY")||0);var o=+(e.target.getAttribute("xScale")||1);var a=+(e.target.getAttribute("yScale")||1);var n=e.dx/o+t;var r=e.dy/a+i;e.target.setAttribute("posX",n);e.target.setAttribute("posy",r);f(e.target,"translate","".concat(n,"px, ").concat(r,"px"))},end:t.handleMoveField.bind(t)}})}))}else{t.attachFieldAttributes(i,e,o,a);c(a).draggable({listeners:{start:function(e){console.log("[FIELDS] Drag started",e.type,e.target)},move:function(e){var t=+(e.target.getAttribute("posX")||0);var i=+(e.target.getAttribute("posY")||0);var o=+(e.target.getAttribute("xScale")||1);var a=+(e.target.getAttribute("yScale")||1);var n=e.dx/o+t;var r=e.dy/a+i;e.target.setAttribute("posX",n);e.target.setAttribute("posy",r);f(e.target,"translate","".concat(n,"px, ").concat(r,"px"))},end:t.handleMoveField.bind(t)}})}}))};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,o,a,n,r,s,l,d,c,h,g,u,f,m,v,b,w,y,q;return __generator(this,(function(C){switch(C.label){case 0:t=e.target.getAttribute("pageNumber");i=this.cachedPageInfo[t],o=i.naturalWidth,a=o===void 0?612:o,n=i.naturalHeight,r=n===void 0?792:n,s=i.renderedHeight,l=s===void 0?792:s;console.log("[FIELDS] Drag ended",t,e.target);d=e.target.getBoundingClientRect();c=e.target.parentElement;h=c.getBoundingClientRect();g=Math.max(d.left-h.left,0);u=Math.max(l-(h.bottom-d.bottom),0);f=this.viewCoordinatesToPageCoordinates(g,u,t,a-e.rect.width,r-e.rect.height),m=f.x,v=f.y;b=e.target.getAttribute("name");w=+(e.target.getAttribute("option")||"0");y=x.fields.find((function(e){return e.name===b}));console.log("Will update",b,w,y);if(!y)return[3,2];switch(y.type){case"attachment":case"payment":case"initial":case"signature":case"date":case"dropdown":case"textarea":case"textbox":case"timestamp":y.setting.x=m;y.setting.y=v;break;case"checkbox_group":case"radio_button_group":{q=y.setting.options[w];if(q){q.x=m;q.y=v}}break}return[4,p(this.endpoint,this.templateId,b,y)];case 1:C.sent();this.handlePageRendered({detail:this.cachedPageInfo[t]});C.label=2;case 2:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var i=1;var o;do{o="".concat(e,"P").concat(t,"-").concat(i);console.log("testing field",o);i++}while(x.fields.some((function(e){return e.name===o})));console.log("Will use field name",o,x.fields);return o};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,i,o,a){var n=this.cachedPageInfo[i],r=n.xScale,s=r===void 0?1:r,l=n.yScale,d=l===void 0?1:l,c=n.renderedHeight,p=c===void 0?792:c;var h=Math.floor(Math.min(e/s,o));var g=Math.floor(Math.min(Math.max(p-t,0)/d,a));return{x:h,y:g}};e.prototype.handleClickPage=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,o,a,n,r,s,l,d,c,p,g,u,f,b,w,y;return __generator(this,(function(q){switch(q.label){case 0:if(!this.placing)return[3,2];console.log("Placing field",this.placing,t.sequence,e.offsetX,e.offsetY);o=t.sequence;a=e.offsetX;n=e.offsetY;r=m(this.placing);s=v(this.placing);l=this.cachedPageInfo[o];console.log("Cached page",l);d=l.naturalWidth,c=d===void 0?612:d,p=l.naturalHeight,g=p===void 0?792:p;u=this.viewCoordinatesToPageCoordinates(a,n,o,c-r,g-s);f=Math.floor(u.x);b=Math.floor(u.y);w={name:this.generateFieldName(this.placing,o),role_name:this.selectedRoleName,template_id:this.templateId,type:this.placing,required:true,page_sequence:o,validator:null,setting:{x:f,y:b}};switch(w.type){case"attachment":case"payment":w.setting={x:f,y:b};break;case"initial":case"signature":w.setting={x:f,y:b,result:""};break;case"checkbox_group":w.setting={minimum_checked:0,maximum_checked:1e3,options:[{id:"".concat(w.name,"-1"),value:"Option 1",checked:false,x:f,y:b}]};break;case"date":w.setting={x:f,y:b,width:r,height:s,result:""};break;case"dropdown":w.required=false;w.setting={x:f,y:b,width:r,height:s,value:null,placeholder:"Choose",options:[{id:"option-1",value:"Option 1"}]};break;case"radio_button_group":w.setting={options:[{id:"".concat(w.name,"-1"),value:"Option 1",selected:false,x:f,y:b}]};break;case"textarea":case"textbox":w.setting={x:f,y:b,width:r,height:s,result:"",leading:0,alignment:0,upperCase:false};break;case"timestamp":w.setting={x:f,y:b,width:r,height:s};break}if(w.type==="textarea"){w.type="textbox"}return[4,h(this.endpoint,this.templateId,w)];case 1:y=q.sent();console.log("Saved field",y);x.fields.push(y);this.placing=null;(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:x.template,event:"added-field"});this.handlePageRendered({detail:this.cachedPageInfo[o]});q.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;if(!this.endpoint.session){return o(a,null,o("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(x.loading||!x.template){return o(a,null,o("verdocs-loader",null))}var i=__spreadArray([],x.template.pages,true);i.sort((function(e,t){return e.sequence-t.sequence}));return o(a,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},"data-r":this.rerender,onSubmit:function(){console.log("onSubmit")}},o("div",{id:"verdocs-template-fields-toolbar"},z.map((function(e){return o("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,onClick:function(){if(e.tooltip){t.placing=e.id}}})}))),o("div",{class:"pages"},i.map((function(e){return o("verdocs-template-document-page",{templateId:e.template_id,documentId:e.document_id,pageNumber:e.sequence,virtualWidth:612,virtualHeight:792,onClick:function(i){return t.handleClickPage(i,e)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))))};return e}());P.style=E}}}));
@@ -1 +0,0 @@
1
- import{r as e,h as t,H as o,c as i,a as s}from"./p-e035df4b.js";import{c as r}from"./p-ec26fc38.js";import"./p-2bc0d9be.js";import{u as l,d as n}from"./p-feb442b1.js";import{V as p}from"./p-c58fd28c.js";import{s as a}from"./p-c903c4a7.js";import{l as d}from"./p-6685a532.js";import{S as c}from"./p-7a1b2643.js";import"./p-7291906c.js";import"./p-b28ef4bb.js";const h=class{constructor(t){e(this,t),this.showing=!1,this.icon=""}componentDidRender(){document.body.appendChild(this.panelEl),this.popperInstance&&this.popperInstance.destroy(),this.popperInstance=r(this.iconEl,this.panelEl,{})}disconnectedCallback(){this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null),this.panelEl&&this.panelEl.remove()}async showPanel(){var e,t;null===(e=this.panelEl)||void 0===e||e.setAttribute("data-show",""),null===(t=this.popperInstance)||void 0===t||t.update().catch((()=>{})),this.showing=!0,this.hiderEl=document.createElement("div"),this.hiderEl.style.zIndex="100",this.hiderEl.style.position="absolute",this.hiderEl.style.top="0px",this.hiderEl.style.left="0px",this.hiderEl.style.right="0px",this.hiderEl.style.bottom="0px",this.hiderEl.onclick=e=>{e.stopPropagation(),this.toggle()},document.body.appendChild(this.hiderEl)}async hidePanel(){var e,t;null===(e=this.panelEl)||void 0===e||e.removeAttribute("data-show"),null===(t=this.hiderEl)||void 0===t||t.remove(),this.showing=!1}async toggle(){this.showing?await this.hidePanel():await this.showPanel()}render(){return t(o,null,t("div",{class:"icon",innerHTML:this.icon,onClick:e=>(e.stopPropagation(),this.toggle()),ref:e=>this.iconEl=e}),t("div",{role:"tooltip",class:"verdocs-button-panel-content","data-popper-placement":"bottom",ref:e=>this.panelEl=e},t("div",{"data-popper-arrow":"true",class:"arrow"}),t("slot",null)))}};h.style='verdocs-button-panel{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:inline-block}verdocs-button-panel .icon{display:inline-block;cursor:pointer;opacity:0.6}verdocs-button-panel .icon svg{fill:#707ae5}verdocs-button-panel .icon:hover{opacity:1}.verdocs-button-panel-content{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;-webkit-box-shadow:0 0 10px 1px #999999;box-shadow:0 0 10px 1px #999999;display:none;background:#ffffff;color:#33364b;width:320px;font-weight:bold;padding:15px;font-size:14px;position:relative;border-radius:4px;z-index:10000}.verdocs-button-panel-content .arrow,.verdocs-button-panel-content .arrow::before{position:absolute;width:8px;height:8px;background:inherit}.verdocs-button-panel-content .arrow{visibility:hidden;top:-4px}.verdocs-button-panel-content .arrow::before{visibility:visible;content:"";-webkit-transform:rotate(45deg);transform:rotate(45deg)}.verdocs-button-panel-content[data-show]{display:block}.verdocs-button-panel-content[data-popper-placement^=top]>.arrow{bottom:-4px}.verdocs-button-panel-content[data-popper-placement^=bottom]>.arrow{top:-4px}.verdocs-button-panel-content[data-popper-placement^=left]>.arrow{right:-4px}.verdocs-button-panel-content[data-popper-placement^=right]>.arrow{left:-4px}.verdocs-button-panel-content h6{font-size:16px;font-weight:bold;margin:0 0 16px 0;color:#092c4c;border-bottom:1px solid #cccccc}';const f=class{constructor(t){e(this,t),this.value="",this.label="",this.options=void 0,this.disabled=!1}render(){return t(o,{class:"input-field"},t("label",null,this.label?t("div",{class:"input-label"},this.label+":"):t("div",null),t("select",{class:"input-element",disabled:this.disabled},this.options.map((e=>t("option",{value:e.value,selected:e.value===this.value},e.label))))))}};f.style='verdocs-select-input{font-family:"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;border:1px solid #707ae5;border-radius:4px;background:#ffffff;color:#000;width:100%;font-size:16px;height:28px;padding:4px 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-element:focus{border:1px solid #7d88ff}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),m='<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>',x=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.endpoint=p.getDefault(),this.templateId="",this.fieldName="",this.helpText="",this.dirty=!1,this.loading=!0,this.type="signature",this.setting=null,this.name="",this.roleName="",this.fieldType="",this.required=!1,this.options=[],this.placeholder="",this.defaultValue="",this.showingHelp=!1}async componentWillLoad(){var e,t,o,i,s;try{if(this.endpoint.loadSession(),!this.templateId)return void console.error("[FIELD PROPERTIES] Missing required template ID");if(!this.fieldName)return void console.error("[FIELD PROPERTIES] Missing required field name");if(!this.endpoint.session)return void console.error("[FIELD PROPERTIES] Unable to start builder session, must be authenticated");await d(this.endpoint,this.templateId);const o=a.fields.find((e=>e.name===this.fieldName));o||console.log(`[FIELD PROPERTIES] Unable to find field "${this.fieldName}" in template`),this.type=o.type,this.name=o.name,this.roleName=o.role_name,this.required=o.required,this.fieldType=o.type,this.placeholder=o.label,this.defaultValue=(null===(e=o.setting)||void 0===e?void 0:e.value)||"",this.setting=o.setting||{},this.options=(null===(t=o.setting)||void 0===t?void 0:t.options)||[],this.dirty=!1,this.loading=!1}catch(e){console.log("[FIELD PROPERTIES] Error loading template",e),this.loading=!1,null===(o=this.sdkError)||void 0===o||o.emit(new c(e.message,null===(i=e.response)||void 0===i?void 0:i.status,null===(s=e.response)||void 0===s?void 0:s.data))}}handleCancel(e){var t,o;e.stopPropagation();const i=a.fields.find((e=>e.name===this.fieldName));console.log("hc",e,i),i&&(this.name=i.name,this.roleName=i.role_name,this.required=i.required,this.placeholder=i.label,this.defaultValue=(null===(t=i.setting)||void 0===t?void 0:t.result)||""),this.dirty=!1,null===(o=this.close)||void 0===o||o.emit()}handleSave(e){e.stopPropagation();const t={name:this.name,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):"dropdown"===this.type&&(t.setting={x:this.setting.x,y:this.setting.y,options:this.options}),l(this.endpoint,this.templateId,this.fieldName,t).then((()=>{var e,t;this.dirty=!1;const o=a.fields.find((e=>e.name===this.fieldName));o&&(o.name=this.name,o.role_name=this.roleName,o.required=this.required,o.label=this.placeholder,o.setting.result=this.defaultValue),null===(e=this.settingsChanged)||void 0===e||e.emit({fieldName:this.fieldName}),null===(t=this.close)||void 0===t||t.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.")&&n(this.endpoint,this.templateId,this.fieldName).then((e=>{var t;console.log("Field deleted",e),a.fields=[...a.fields.filter((e=>e.name!==this.fieldName))],a.template.roles.forEach((e=>{e.fields=[...e.fields.filter((e=>e.name!==this.fieldName))]})),null===(t=this.delete)||void 0===t||t.emit({templateId:this.templateId,roleName:this.roleName})})).catch((e=>{console.log("Deletion error",e)}))}render(){return this.endpoint.session?this.endpoint.session&&a.template?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,null,t("h6",null,u(this.fieldType)," 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("div",{class:"input-label"},"Role:"),t("verdocs-select-input",{value:this.roleName,options:a.template.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("verdocs-text-input",{id:"verdocs-field-placeholder",label:"Placeholder",value:this.name,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"].includes(this.type)&&t("div",{class:"options"},t("div",{class:"row",style:{marginTop:"15px",marginBottom:"15px",textAlign:"center",fontWeight:"700",fontSize:"14px",justifyContent:"center",backgroundColor:"#333333",padding:"5px 8px",color:"#ffffff"}},"Options"),t("div",{class:"row-header"},t("h6",null,"ID"),t("h6",null,"Label"),t("div",{style:{width:"34px"}})),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}}),t("verdocs-text-input",{id:`verdocs-option-value-${e.id}`,value:e.value,placeholder:"Display value",onInput:e=>{this.options[o].value=e.target.value,this.dirty=!0}}),t("button",{innerHTML:m,class:"remove-button",onClick:()=>{this.options=this.options.filter((t=>t.id!==e.id)),this.dirty=!0}})))),t("div",{class:"row-header"},t("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"))),t("div",{class:"buttons"},t("button",{class:"delete-button",disabled:this.dirty,onClick:e=>this.handleDelete(e),innerHTML:m}),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)}};x.style='verdocs-template-field-properties{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}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{h as verdocs_button_panel,f as verdocs_select_input,x as verdocs_template_field_properties}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,o,r){function n(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,s){function l(e){try{i(r.next(e))}catch(e){s(e)}}function a(e){try{i(r["throw"](e))}catch(e){s(e)}}function i(e){e.done?o(e.value):n(e.value).then(l,a)}i((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,n,s,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return i([e,t])}}function i(l){if(r)throw new TypeError("Generator is already executing.");while(o)try{if(r=1,n&&(s=l[0]&2?n["return"]:l[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;if(n=0,s)l=[l[0]&2,s.value];switch(l[0]){case 0:case 1:s=l;break;case 4:o.label++;return{value:l[1],done:false};case 5:o.label++;n=l[1];l=[0];continue;case 7:l=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){o=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){o.label=l[1];break}if(l[0]===6&&o.label<s[1]){o.label=s[1];s=l;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(l);break}if(s[2])o.ops.pop();o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e];n=0}finally{r=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};System.register(["./p-871407e9.system.js","./p-9a20f533.system.js","./p-d46a428b.system.js","./p-8229e6df.system.js","./p-5c043400.system.js","./p-05eb4fed.system.js","./p-71b8bb54.system.js","./p-8ac64953.system.js","./p-0d81757b.system.js","./p-187b20b7.system.js","./p-d50523fd.system.js","./p-69912cbf.system.js","./p-db003554.system.js","./p-327858f0.system.js","./p-51a3ea62.system.js"],(function(e){"use strict";var t,o,r,n,s,l,a,i,d,c,p,u,m,f,v,g;return{setters:[function(e){t=e.r;o=e.c;r=e.h;n=e.H;s=e.F;l=e.a},function(e){a=e.i},function(){},function(e){i=e.u;d=e.c},function(e){c=e.V;p=e.T},function(e){u=e.g},function(e){m=e.s},function(e){f=e.l},function(e){v=e.b},function(e){g=e.S},function(){},function(){},function(){},function(){},function(){}],execute:function(){var h;var x='verdocs-template-roles{display:block;min-width:400px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#4c56cb;margin:0 0 10px 0}verdocs-template-roles>form .participants{position:relative}verdocs-template-roles>form .left-line{top:32px;left:11px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-template-roles>form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;min-height:35px;margin-left:40px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:6px 0 4px 0}verdocs-template-roles>form .row .row-roles{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles>form .row .icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-template-roles>form .row .sender{height:30px;display:-ms-flexbox;display:flex;font-size:14px;line-height:30px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 15px;border:1px solid #c6c9cc;background-color:#f5f5fa}verdocs-template-roles>form .row .complete{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;background-color:#f5f5fa;border:1px solid #aeb4bf}verdocs-template-roles>form .row .label{font-weight:bold;margin-right:6px;color:#33364b}verdocs-template-roles>form .row .settings-button{display:-ms-flexbox;display:flex;cursor:pointer;margin:0 0 0 9px}verdocs-template-roles>form .row .recipient{height:30px;display:-ms-flexbox;display:flex;font-size:14px;border-radius:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 6px;white-space:nowrap;border:2px solid #aeb4bf}verdocs-template-roles>form .row .recipient .type-icon{width:24px;height:24px;-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0.6;margin:0 12px 0 0}verdocs-template-roles>form .row .recipient.dragging{position:absolute}verdocs-template-roles>form .row .recipient.dragging+.dropzone{display:none !important}verdocs-template-roles>form .row .dropzone{width:14px;height:30px;display:none}verdocs-template-roles>form .row .dropzone svg{fill:#cccccc}verdocs-template-roles>form .row .dropzone.visible{margin:0 7px;display:-ms-flexbox;display:flex;-ms-flex:0 0 14px;flex:0 0 14px}verdocs-template-roles>form .row .dropzone.active{-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;background:#654dcb7f;border:1px dashed #654dcb}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .add-role{display:none}verdocs-template-roles.dragging form .row .recipient+.dropzone{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence .dropzone{opacity:0.5;-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;-ms-flex-align:center;align-items:center;background:#654dcb7f;-ms-flex-pack:center;justify-content:center;border:1px dashed #654dcb}verdocs-template-roles.dragging .row.add-sequence .dropzone.active{opacity:1}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:20px;height:20px;stroke:#666666;margin-bottom:-5px}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';var b=(h={},h[p.EVERYONE]="Everyone",h[p.EVERYONE_AS_CREATOR]="Everyone as Me",h[p.ORGANIZATION_MEMBER]="Organization member",h[p.ORGANIZATION_MEMBER_AS_CREATOR]="Organization Member as Me",h[p.CREATOR]="Me",h);var w='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';var y='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';var q='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';var R='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';var z='<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';var L='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';var k='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>';var E='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>';var M=e("verdocs_template_roles",function(){function e(e){t(this,e);this.next=o(this,"next",7);this.exit=o(this,"exit",7);this.sdkError=o(this,"sdkError",7);this.templateUpdated=o(this,"templateUpdated",7);this.sequences=[];this.endpoint=c.getDefault();this.templateId="";this.showingRoleDialog=null;this.showingSenderDialog=false;this.sender=null;this.forceRerender=1}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,r,n,s,l,a;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,5,,6]);this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}i.label=1;case 1:i.trys.push([1,3,,4]);console.log("[ROLES] Loading template ".concat(this.templateId),this.endpoint.session);return[4,f(this.endpoint,this.templateId,true)];case 2:i.sent();return[3,4];case 3:l=i.sent();console.log("[ROLES] Error loading template",l);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new g(l.message,(t=l.response)===null||t===void 0?void 0:t.status,(o=l.response)===null||o===void 0?void 0:o.data));return[3,4];case 4:this.sortTemplateRoles();this.renumberTemplateRoles();return[3,6];case 5:a=i.sent();console.log("[FIELDS] Error with preview session",a);(r=this.sdkError)===null||r===void 0?void 0:r.emit(new g(a.message,(n=a.response)===null||n===void 0?void 0:n.status,(s=a.response)===null||s===void 0?void 0:s.data));return[3,6];case 6:return[2]}}))}))};e.prototype.componentDidRender=function(){a.dynamicDrop(true);a(".recipient").draggable({listeners:{start:function e(t){t.target.classList.add("dragging");this.el.classList.add("dragging")}.bind(this),move:function e(t){var o=+(t.target.getAttribute("posX")||0);var r=+(t.target.getAttribute("posY")||0);var n=t.dx+o;var s=t.dy+r;t.target.setAttribute("posX",n);t.target.setAttribute("posy",s);t.target.style.transform="translate(".concat(n+100,"px, ").concat(s-40,"px)")}.bind(this),end:function e(t){t.target.classList.remove("dragging");this.el.classList.remove("dragging");t.target.setAttribute("posX",0);t.target.setAttribute("posy",0);t.target.style.transform="translate(0px, 0px)"}.bind(this)}});a(".dropzone").dropzone({overlap:.05,ondrop:function e(t){var o=this;var r,n;t.target.classList.remove("active");var s=t.relatedTarget.dataset.rolename;var l=+t.target.dataset.sequence;var a=+t.target.dataset.order;var d=(r=m.template)===null||r===void 0?void 0:r.roles.find((function(e){return e.name===s}));if(d){d.sequence=l;d.order=a;this.sortTemplateRoles();this.renumberTemplateRoles();this.forceRerender++;Promise.all((n=m.template)===null||n===void 0?void 0:n.roles.map((function(e){return i(o.endpoint,o.templateId,e.name,{sequence:e.sequence,order:e.order})}))).then((function(){var e;console.log("[ROLES] Updated roles");(e=o.templateUpdated)===null||e===void 0?void 0:e.emit({event:"updated-role",endpoint:o.endpoint,template:m.template})})).catch((function(e){return console.log("[ROLES] Role updates failed",e)}))}}.bind(this),ondropactivate:function(e){e.target.classList.add("visible")},ondropdeactivate:function(e){e.target.classList.remove("visible")},ondragenter:function(e){e.target.classList.add("active")},ondragleave:function(e){e.target.classList.remove("active")}})};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.handleSubmit=function(e){var t;e.stopPropagation();(t=this.next)===null||t===void 0?void 0:t.emit()};e.prototype.sortTemplateRoles=function(){var e;(e=m.template)===null||e===void 0?void 0:e.roles.sort((function(e,t){return e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence}))};e.prototype.extractSequenceNumbers=function(){var e=this;var t;this.sequences=[];(t=m.template)===null||t===void 0?void 0:t.roles.forEach((function(t){if(!e.sequences.includes(t.sequence)){e.sequences.push(t.sequence)}}))};e.prototype.renumberTemplateRoles=function(){this.extractSequenceNumbers();var e=[];this.sequences.sort((function(e,t){return e-t}));this.sequences.forEach((function(t,o){var r;(r=m.template)===null||r===void 0?void 0:r.roles.filter((function(e){return e.sequence===t})).forEach((function(t,r){if(!e.includes(t.name)){t.sequence=o+1;t.order=r+1;e.push(t.name)}}))}));this.extractSequenceNumbers()};e.prototype.getNextRoleName=function(){var e,t;var o="";var r=(e=m.template)===null||e===void 0?void 0:e.roles.length;do{r++;o="Recipient ".concat(r)}while(!o||((t=m.template)===null||t===void 0?void 0:t.roles.some((function(e){return e.name===o}))));return o};e.prototype.handleAddRole=function(e,t){var o=this;e.stopPropagation();var r=m.template.roles.filter((function(e){return e.sequence===t})).length+1;var n=this.getNextRoleName();console.log("Will create",n,t,r);d(this.endpoint,this.templateId,{template_id:this.templateId,name:n,full_name:"",email:"",phone:"",sequence:t,order:r,type:"signer",delegator:false}).then((function(e){var t;console.log("Created role",e);m.template.roles.push(e);o.renumberTemplateRoles();o.forceRerender++;(t=o.templateUpdated)===null||t===void 0?void 0:t.emit({event:"created-role",endpoint:o.endpoint,template:m.template})})).catch((function(e){console.log("Error creating role",e)}))};e.prototype.handleAddStep=function(e,t){var o=this;e.stopPropagation();var r=1;var n=this.getNextRoleName();console.log("Will create",n,t,r);d(this.endpoint,this.templateId,{template_id:this.templateId,name:n,full_name:"",email:"",phone:"",sequence:t,order:r,type:"signer",delegator:false}).then((function(e){console.log("Created role",e);m.template.roles.push(e);o.renumberTemplateRoles();o.forceRerender++})).catch((function(e){console.log("Error creating role",e)}))};e.prototype.render=function(){var e=this;var t;if(!this.endpoint.session){return r(n,null,r("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(m.loading||!m.template){return r(n,null,r("verdocs-loader",null))}var o=(((t=m.template)===null||t===void 0?void 0:t.roles)||[]).map((function(e){return e.name}));return r(n,null,r("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off","data-r":this.forceRerender},r("h5",null,"Roles and Workflow"),r("div",{class:"participants"},r("div",{class:"left-line"}),r("div",{class:"row"},r("div",{class:"icon",innerHTML:y}),r("div",{class:"row-roles"},r("div",{class:"sender"},r("span",{class:"label"},"Sender:")," ",b[m.template.sender]," ",r("div",{class:"settings-button",innerHTML:w,onClick:function(){return e.showingSenderDialog=true},"aria-role":"button"})))),r("div",{class:"row add-sequence","data-sequence":0},r("div",{class:"icon",innerHTML:z}),r("div",{class:"row-roles"},r("div",{class:"dropzone","data-sequence":0,"data-order":1},"Add Step"))),this.sequences.map((function(t){return r(s,null,r("div",{class:"row"},r("div",{class:"icon",innerHTML:q}),r("div",{class:"row-roles"},r("div",{class:"dropzone","data-order":.5,"data-sequence":t}),m.template.roles.filter((function(e){return e.sequence===t})).map((function(n){var l=!n.email;return l?r(s,null,r("div",{class:"recipient",style:{backgroundColor:u(v(o,n.name))},"data-rolename":n.name},r("span",{class:"type-icon",innerHTML:n.type==="signer"?L:n.type==="cc"?E:k}),n.name," ",r("div",{class:"settings-button",innerHTML:w,onClick:function(){return e.showingRoleDialog=n.name},"aria-role":"button"})),r("div",{class:"dropzone","data-order":n.order+.5,"data-sequence":t})):r(s,null,r("div",{class:"recipient",style:{borderColor:u(v(o,n.name))},"data-rolename":n.name},r("span",{class:"type-icon",innerHTML:n.type==="signer"?L:n.type==="cc"?E:k}),n.full_name," ",r("div",{class:"settings-button",innerHTML:w,onClick:function(){return e.showingRoleDialog=n.name},"aria-role":"button"})),r("div",{class:"dropzone","data-order":n.order+.5,"data-sequence":t}))})),r("button",{class:"add-role",innerHTML:z,onClick:function(o){return e.handleAddRole(o,t)}}))),e.sequences.length>0&&r("div",{class:"row add-sequence","data-sequence":t},r("div",{class:"row-roles"},r("div",{class:"icon",innerHTML:z}),r("div",{class:"dropzone","data-sequence":t+1,"data-order":1},"Add Step"))))})),r("div",{class:"row","data-sequence":this.sequences.length+1},r("div",{class:"row-roles"},r("div",{class:"icon",innerHTML:z}),r("button",{class:"add-step",innerHTML:z,onClick:function(t){return e.handleAddStep(t,e.sequences.length+1)}}))),r("div",{class:"row"},r("div",{class:"icon",innerHTML:R}),r("div",{class:"row-roles"},r("div",{class:"complete"},"Document Complete")))),o.length<1&&r("div",{class:"empty"},"You must add at least one Role before proceeding.",r("br",null)," Click the ",r("span",{innerHTML:z})," Add button above to get started."),r("div",{class:"buttons"},r("div",{class:"flex-fill"}),r("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)}}),r("verdocs-button",{label:"OK",size:"small",onClick:function(t){return e.handleSubmit(t)},disabled:o.length<1}))),this.showingRoleDialog&&r("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:function(){e.showingRoleDialog=null;e.forceRerender++},onDelete:function(t){var o;console.log("deleted",t.detail);e.renumberTemplateRoles();e.showingRoleDialog=null;e.forceRerender++;(o=e.templateUpdated)===null||o===void 0?void 0:o.emit({event:"deleted-role",endpoint:e.endpoint,template:m.template})}}),this.showingSenderDialog&&r("verdocs-template-sender",{endpoint:this.endpoint,templateId:this.templateId,onClose:function(){return e.showingSenderDialog=false}}))};Object.defineProperty(e.prototype,"el",{get:function(){return l(this)},enumerable:false,configurable:true});return e}());M.style=x}}}));
@@ -1 +0,0 @@
1
- var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))e[o]=t[o]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,n,i){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,s){function l(e){try{a(i.next(e))}catch(e){s(e)}}function r(e){try{a(i["throw"](e))}catch(e){s(e)}}function a(e){e.done?n(e.value):o(e.value).then(l,r)}a((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,o,s,l;return l={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function r(e){return function(t){return a([e,t])}}function a(l){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,o&&(s=l[0]&2?o["return"]:l[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,l[1])).done)return s;if(o=0,s)l=[l[0]&2,s.value];switch(l[0]){case 0:case 1:s=l;break;case 4:n.label++;return{value:l[1],done:false};case 5:n.label++;o=l[1];l=[0];continue;case 7:l=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1];s=l;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(l);break}if(s[2])n.ops.pop();n.trys.pop();continue}l=t.call(e,n)}catch(e){l=[6,e];o=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};System.register(["./p-871407e9.system.js","./p-d46a428b.system.js","./p-5c043400.system.js","./p-7efdefa3.system.js","./p-05eb4fed.system.js","./p-71b8bb54.system.js","./p-8ac64953.system.js","./p-0d81757b.system.js","./p-187b20b7.system.js","./p-d50523fd.system.js","./p-69912cbf.system.js","./p-db003554.system.js","./p-327858f0.system.js","./p-51a3ea62.system.js"],(function(e){"use strict";var t,n,i,o,s,l,r,a,c,d,p,u;return{setters:[function(e){t=e.r;n=e.c;i=e.h;o=e.H},function(){},function(e){s=e.V},function(e){l=e.i;r=e.a},function(e){a=e.g},function(e){c=e.s},function(e){d=e.l},function(e){p=e.b},function(e){u=e.S},function(){},function(){},function(){},function(){},function(){}],execute:function(){var f='verdocs-send{display:-ms-flexbox;display:flex;padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid #97979744}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:#00000089}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';var v='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>';var h='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';var m='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';var x='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';var g=e("verdocs_send",function(){function e(e){t(this,e);this.send=n(this,"send",7);this.exit=n(this,"exit",7);this.sdkError=n(this,"sdkError",7);this.levels=[];this.endpoint=s.getDefault();this.templateId=null;this.containerId="verdocs-send-".concat(Math.random().toString(36).substring(2,11));this.rolesAtLevel={};this.showPickerForId="";this.sessionContacts=[];this.rolesCompleted={}}e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.rolesCompleted={};return[2]}))}))};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i,o,s,l,r;return __generator(this,(function(a){switch(a.label){case 0:s=this.endpoint.loadSession();if(!this.templateId){console.log("[SEND] Missing required template ID ".concat(this.templateId));return[2]}a.label=1;case 1:a.trys.push([1,3,,4]);console.log("[SEND] Loading template ".concat(this.templateId));return[4,d(this.endpoint,this.templateId,true)];case 2:a.sent();if((e=c.template)===null||e===void 0?void 0:e.roles){l={};this.rolesCompleted={};c.template.roles.forEach((function(e){var t=e.sequence-1;l[t]||(l[t]=[]);var n="r-".concat(t,"-").concat(l[t].length);l[t].push(__assign(__assign({},e),{id:n}))}));this.rolesAtLevel=l;this.levels=Object.keys(l).map((function(e){return+e}));this.levels.sort((function(e,t){return e-t}))}return[3,4];case 3:r=a.sent();console.log("[SEND] Error loading template",r);(t=this.sdkError)===null||t===void 0?void 0:t.emit(new u(r.message,(n=r.response)===null||n===void 0?void 0:n.status,(i=r.response)===null||i===void 0?void 0:i.data));return[3,4];case 4:if((o=s.session)===null||o===void 0?void 0:o.profile){this.sessionContacts.push({id:s.session.profile.id,name:"".concat(s.session.profile.first_name," ").concat(s.session.profile.last_name),email:s.session.profile.email,phone:s.session.profile.phone})}return[2]}}))}))};e.prototype.getLevelIcon=function(e){if(e<0){return i("div",{class:"level-icon",innerHTML:h})}else if(e>=this.levels.length){return i("div",{class:"level-icon",innerHTML:x})}else{return i("div",{class:"level-icon",innerHTML:m})}};e.prototype.handleSelectContact=function(e,t){e.preventDefault();this.rolesCompleted[t.id]=__assign(__assign({},t),e.detail);this.showPickerForId=""};e.prototype.handleClickRole=function(e,t){e.stopPropagation();this.showPickerForId=t.id};e.prototype.handleSend=function(e){var t;e.stopPropagation();(t=this.send)===null||t===void 0?void 0:t.emit({roles:Object.values(this.rolesCompleted),name:c.template.name,template_id:this.templateId})};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.render=function(){var e=this;var t=c.template.roles.map((function(e){return e.name}))||[];var n=Object.values(this.rolesCompleted).filter((function(e){return l(e.email)||r(e.phone)}));var s=n.length>=t.length;return i(o,{class:{}},i("div",{class:"recipients"},i("div",{class:"left-line"}),i("div",{class:"level level-start"},this.getLevelIcon(-1),i("div",{class:"complete"},"Send Envelope")),this.levels.map((function(n){return i("div",{class:"level level-".concat(n)},e.getLevelIcon(n),e.rolesAtLevel[n].map((function(n){var o,s,l;return i("div",{class:"recipient",style:{backgroundColor:a(p(t,n.name))},onClick:function(t){return e.handleClickRole(t,n)}},(s=(o=e.rolesCompleted[n.id])===null||o===void 0?void 0:o.full_name)!==null&&s!==void 0?s:n.name,i("div",{class:"icon",innerHTML:v}),e.showPickerForId===n.id&&i("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(t){return e.handleSelectContact(t,n)},contactSuggestions:e.sessionContacts,templateRole:(l=e.rolesCompleted[n.id])!==null&&l!==void 0?l:n,onSearchContacts:function(e){return console.log("Search",e.detail)}}))})))})),i("div",{class:"level level-done"},this.getLevelIcon(this.levels.length),i("div",{class:"complete"},"Signing Complete"))),i("div",{class:"buttons"},i("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)}}),i("verdocs-button",{label:"Send",size:"small",disabled:!s,onClick:function(t){return e.handleSend(t)}})))};return e}());g.style=f}}}));
@@ -1 +0,0 @@
1
- import{r as e,c as i,h as s,H as t}from"./p-e035df4b.js";import"./p-2bc0d9be.js";import{V as o}from"./p-c58fd28c.js";import{i as l,a as n}from"./p-e662f81b.js";import{g as d}from"./p-6de76553.js";import{s as a}from"./p-c903c4a7.js";import{l as r}from"./p-6685a532.js";import{b as p}from"./p-fb86b102.js";import{S as c}from"./p-7a1b2643.js";import"./p-7291906c.js";import"./p-b28ef4bb.js";import"./p-7448182b.js";import"./p-aa124212.js";import"./p-ab01f71e.js";const x=class{constructor(s){e(this,s),this.send=i(this,"send",7),this.exit=i(this,"exit",7),this.sdkError=i(this,"sdkError",7),this.levels=[],this.endpoint=o.getDefault(),this.templateId=null,this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`,this.rolesAtLevel={},this.showPickerForId="",this.sessionContacts=[],this.rolesCompleted={}}async reset(){this.rolesCompleted={}}async componentWillLoad(){var e,i,s,t,o;const l=this.endpoint.loadSession();if(this.templateId){try{if(console.log(`[SEND] Loading template ${this.templateId}`),await r(this.endpoint,this.templateId,!0),null===(e=a.template)||void 0===e?void 0:e.roles){const e={};this.rolesCompleted={},a.template.roles.forEach((i=>{const s=i.sequence-1;e[s]||(e[s]=[]);const t=`r-${s}-${e[s].length}`;e[s].push({...i,id:t})})),this.rolesAtLevel=e,this.levels=Object.keys(e).map((e=>+e)),this.levels.sort(((e,i)=>e-i))}}catch(e){console.log("[SEND] Error loading template",e),null===(i=this.sdkError)||void 0===i||i.emit(new c(e.message,null===(s=e.response)||void 0===s?void 0:s.status,null===(t=e.response)||void 0===t?void 0:t.data))}(null===(o=l.session)||void 0===o?void 0:o.profile)&&this.sessionContacts.push({id:l.session.profile.id,name:`${l.session.profile.first_name} ${l.session.profile.last_name}`,email:l.session.profile.email,phone:l.session.profile.phone})}else console.log(`[SEND] Missing required template ID ${this.templateId}`)}getLevelIcon(e){return s("div",e<0?{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>'}:e>=this.levels.length?{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>'}:{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>'})}handleSelectContact(e,i){e.preventDefault(),this.rolesCompleted[i.id]={...i,...e.detail},this.showPickerForId=""}handleClickRole(e,i){e.stopPropagation(),this.showPickerForId=i.id}handleSend(e){var i;e.stopPropagation(),null===(i=this.send)||void 0===i||i.emit({roles:Object.values(this.rolesCompleted),name:a.template.name,template_id:this.templateId})}handleCancel(e){var i;e.stopPropagation(),null===(i=this.exit)||void 0===i||i.emit()}render(){const e=a.template.roles.map((e=>e.name))||[],i=Object.values(this.rolesCompleted).filter((e=>l(e.email)||n(e.phone))).length>=e.length;return s(t,{class:{}},s("div",{class:"recipients"},s("div",{class:"left-line"}),s("div",{class:"level level-start"},this.getLevelIcon(-1),s("div",{class:"complete"},"Send Envelope")),this.levels.map((i=>s("div",{class:`level level-${i}`},this.getLevelIcon(i),this.rolesAtLevel[i].map((i=>{var t,o,l;return s("div",{class:"recipient",style:{backgroundColor:d(p(e,i.name))},onClick:e=>this.handleClickRole(e,i)},null!==(o=null===(t=this.rolesCompleted[i.id])||void 0===t?void 0:t.full_name)&&void 0!==o?o:i.name,s("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>'}),this.showPickerForId===i.id&&s("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:e=>this.handleSelectContact(e,i),contactSuggestions:this.sessionContacts,templateRole:null!==(l=this.rolesCompleted[i.id])&&void 0!==l?l:i,onSearchContacts:e=>console.log("Search",e.detail)}))}))))),s("div",{class:"level level-done"},this.getLevelIcon(this.levels.length),s("div",{class:"complete"},"Signing Complete"))),s("div",{class:"buttons"},s("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e)}),s("verdocs-button",{label:"Send",size:"small",disabled:!i,onClick:e=>this.handleSend(e)})))}};x.style='verdocs-send{display:-ms-flexbox;display:flex;padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid #97979744}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:#00000089}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';export{x as verdocs_send}
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as s,H as i}from"./p-e035df4b.js";import"./p-2bc0d9be.js";import{V as o}from"./p-c58fd28c.js";import{l}from"./p-6685a532.js";import{S as a}from"./p-7a1b2643.js";import"./p-b28ef4bb.js";import"./p-c903c4a7.js";import"./p-7291906c.js";const r=class{constructor(s){e(this,s),this.sdkError=t(this,"sdkError",7),this.fields=[],this.endpoint=o.getDefault(),this.templateId=null,this.step="create",this.pdfUrl=null,this.template=null}async componentWillLoad(){var e,t,s;if(this.endpoint.loadSession(),this.endpoint.session){if(!this.templateId)return console.log("[BUILD] No template ID specified, showing upload option"),void(this.step="create");try{console.log(`[BUILD] Loading template ${this.templateId}`),await l(this.endpoint,this.templateId),this.step="fields"}catch(i){console.log("[BUILD] Error loading template",i),null===(e=this.sdkError)||void 0===e||e.emit(new a(i.message,null===(t=i.response)||void 0===t?void 0:t.status,null===(s=i.response)||void 0===s?void 0:s.data))}}else console.log("[BUILD] Unable to start builder session, must be authenticated")}handleCancel(e){console.log("Cancel",e.detail),this.step=""}handleTemplateCreated(e){console.log("Created",e.detail),this.step="fields"}render(){return this.endpoint.session?s(i,null,"create"===this.step&&s("verdocs-template-create",{onExit:e=>this.handleCancel(e),onNext:e=>this.handleTemplateCreated(e)}),"fields"===this.step&&s("verdocs-template-fields",null)):s(i,null,s("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};r.style='verdocs-build{display:-ms-flexbox;display:flex;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}';export{r as verdocs_build}
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as i,H as s}from"./p-e035df4b.js";import"./p-2bc0d9be.js";import{c as o,g as a}from"./p-b28ef4bb.js";import{c as l}from"./p-4cd5eb1f.js";import{V as r}from"./p-c58fd28c.js";import{S as n}from"./p-7a1b2643.js";import{i as d}from"./p-9b2db78f.js";import{u as h,c as p}from"./p-feb442b1.js";import{b as c,r as m,e as g,f as v,h as f}from"./p-fb86b102.js";import{s as x}from"./p-c903c4a7.js";import{l as u}from"./p-6685a532.js";import"./p-7448182b.js";import"./p-aa124212.js";import"./p-ab01f71e.js";import"./p-7291906c.js";const w=class{constructor(i){e(this,i),this.exit=t(this,"exit",7),this.next=t(this,"next",7),this.sdkError=t(this,"sdkError",7),this.endpoint=r.getDefault(),this.file=void 0,this.creating=!1}componentWillLoad(){this.endpoint.setTimeout(3e4),this.endpoint.loadSession()}handleFileChanged(e){var t;this.file=(null===(t=e.target.files)||void 0===t?void 0:t[0])||null,console.log("[CREATE] Selected file",this.file)}handleUpload(e){e.stopPropagation(),document.getElementById("verdocs-template-create-file").click()}handleCancel(e){e.stopPropagation(),this.exit.emit()}async handleSubmit(e){var t,i,s;if(e.stopPropagation(),console.log("Submitting"),this.file){this.creating=!0;try{const e=await o(this.endpoint,{name:this.file.name});console.log("[CREATE] Created template",e);const t=await l(this.endpoint,e.id,this.file);console.log("[CREATE] Created document",t);let i=null;const s=setInterval((async()=>{var o;console.log("[CREATE] Waiting for template to be processed...",t),i=await a(this.endpoint,e.id),(null==i?void 0:i.processed)&&(console.log("[CREATE] Retrieved new template",i),s&&clearInterval(s),null===(o=this.next)||void 0===o||o.emit(i),this.creating=!1)}),3e3)}catch(e){console.log("[CREATE] Error creating template",e),null===(t=this.sdkError)||void 0===t||t.emit(new n(e.message,null===(i=e.response)||void 0===i?void 0:i.status,null===(s=e.response)||void 0===s?void 0:s.data)),this.creating=!1}}}render(){return this.endpoint.session?i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("input",{type:"file",id:"verdocs-template-create-file",multiple:!0,accept:"application/pdf",style:{display:"none"},onChange:e=>this.handleFileChanged(e)}),this.creating?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),i("div",{class:"loading-text"},"Processing, please wait...")):i("div",{class:"upload-box"},i("div",null,i("span",{innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"></path></svg>'})),i("div",{style:{marginTop:"20px",fontSize:"20px",fontWeight:"bold",overflowWrap:"anywhere"}},this.file?this.file.name:"Drag a file here"),i("div",{style:{marginTop:"20px",marginBottom:"20px",fontSize:"16px",height:"20px"}},this.file?" ":"Or, if you prefer..."),i("verdocs-button",{label:this.file?"Select a different file":"Select a file from your computer",size:"small",onClick:e=>this.handleUpload(e)})),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.creating}),i("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleSubmit(e),disabled:!this.file||this.creating}))):i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};w.style='verdocs-template-create{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-create form{background-color:#ffffff;padding:12px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-create form .upload-box{-webkit-box-sizing:border-box;box-sizing:border-box;width:320px;text-align:center;padding:44px 18px 66px;border:2px dashed #979797;color:rgba(0, 0, 0, 0.54)}verdocs-template-create form .upload-box svg{width:64px;fill:#5c6575}verdocs-template-create .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end;padding:0 0 30px 0}verdocs-template-create .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-create ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-create ::-moz-placeholder{color:#aaaaaa}verdocs-template-create :-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::placeholder{color:#aaaaaa}';const b='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>',q=[{id:"signature",tooltip:"Signature",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>'},{id:"initial",tooltip:"Initials",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>'},{id:"sep1",tooltip:"",icon:b},{id:"textbox",tooltip:"Text Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>'},{id:"textarea",tooltip:"Text Area",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z"/></svg>'},{id:"checkbox_group",tooltip:"Check Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>'},{id:"radio_button_group",tooltip:"Radio Button",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>'},{id:"dropdown",tooltip:"Dropdown",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>'},{id:"sep2",tooltip:"",icon:b},{id:"date",tooltip:"Date",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>'},{id:"timestamp",tooltip:"Timestamp",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>'}],C=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.pageHeights={},this.cachedPageInfo={},this.endpoint=r.getDefault(),this.templateId=null,this.toolbarTargetId=null,this.placing=null,this.selectedRoleName="",this.rerender=1}async componentWillLoad(){var e,t,i,s,o,a;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[FIELDS] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[BUILD] Unable to start builder session, must be authenticated");try{console.log(`[FIELDS] Loading template ${this.templateId}`,this.endpoint.session),await u(this.endpoint,this.templateId,!0),this.selectedRoleName=x.roleNames[0],console.log("Starting with role",this.selectedRoleName)}catch(s){console.log("[FIELDS] Error loading template",s),null===(e=this.sdkError)||void 0===e||e.emit(new n(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}catch(e){console.log("[FIELDS] Error with preview session",e),null===(s=this.sdkError)||void 0===s||s.emit(new n(e.message,null===(o=e.response)||void 0===o?void 0:o.status,null===(a=e.response)||void 0===a?void 0:a.data))}}componentDidRender(){d.dynamicDrop(!0);const e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null,t=document.getElementById("verdocs-template-fields-toolbar");e&&t&&(console.log("[FIELDS] Moving toolbar"),t.remove(),e.append(t))}handleKeyDown(e){"Escape"===e.key&&(this.placing=null)}async handleFieldChange(e,t,i){console.log("[FIELDS] handleFieldChange",e,t,i),this.rerender++}attachFieldAttributes(e,t,i,s){s.addEventListener("input",(e=>this.handleFieldChange(t,e))),s.addEventListener("settingsChanged",(()=>{var e;console.log("Settings",x.fields),this.selectedRoleName=t.role_name,console.log("settings changed",this.selectedRoleName,t),s.setAttribute("roleindex",c(x.roleNames,t.role_name)),this.rerender++,s.setAttribute("rerender",this.rerender),null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:x.template,event:"updated-field"})})),s.addEventListener("deleted",(()=>{var e;console.log("deleted",this,t),s.remove(),this.rerender++,null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:x.template,event:"updated-field"})})),s.setAttribute("roleindex",i),s.setAttribute("pageNumber",e.pageNumber),s.setAttribute("xScale",e.xScale),s.setAttribute("yScale",e.yScale),s.setAttribute("name",t.name)}handlePageRendered(e){const t=e.detail;console.log("[FIELDS] Page rendered",t.pageNumber,t),this.cachedPageInfo[t.pageNumber]=t,this.pageHeights[t.pageNumber]=t.naturalHeight,x.fields.filter((e=>e.page_sequence===t.pageNumber)).forEach((e=>{const i=c(x.roleNames,e.role_name),s=m(e,t,i,{disabled:!0,editable:!0,draggable:!0});s&&(Array.isArray(s)?s.forEach((s=>{this.attachFieldAttributes(t,e,i,s),d(s).draggable({listeners:{start(e){console.log("[FIELDS] Drag started",e.type,e.target)},move(e){const t=+(e.target.getAttribute("posX")||0),i=+(e.target.getAttribute("posY")||0),s=+(e.target.getAttribute("xScale")||1),o=+(e.target.getAttribute("yScale")||1),a=e.dx/s+t,l=e.dy/o+i;e.target.setAttribute("posX",a),e.target.setAttribute("posy",l),g(e.target,"translate",`${a}px, ${l}px`)},end:this.handleMoveField.bind(this)}})})):(this.attachFieldAttributes(t,e,i,s),d(s).draggable({listeners:{start(e){console.log("[FIELDS] Drag started",e.type,e.target)},move(e){const t=+(e.target.getAttribute("posX")||0),i=+(e.target.getAttribute("posY")||0),s=+(e.target.getAttribute("xScale")||1),o=+(e.target.getAttribute("yScale")||1),a=e.dx/s+t,l=e.dy/o+i;e.target.setAttribute("posX",a),e.target.setAttribute("posy",l),g(e.target,"translate",`${a}px, ${l}px`)},end:this.handleMoveField.bind(this)}})))}))}async handleMoveField(e){const t=e.target.getAttribute("pageNumber"),{naturalWidth:i=612,naturalHeight:s=792,renderedHeight:o=792}=this.cachedPageInfo[t];console.log("[FIELDS] Drag ended",t,e.target);const a=e.target.getBoundingClientRect(),l=e.target.parentElement.getBoundingClientRect(),r=Math.max(a.left-l.left,0),n=Math.max(o-(l.bottom-a.bottom),0),{x:d,y:p}=this.viewCoordinatesToPageCoordinates(r,n,t,i-e.rect.width,s-e.rect.height),c=e.target.getAttribute("name"),m=+(e.target.getAttribute("option")||"0"),g=x.fields.find((e=>e.name===c));if(console.log("Will update",c,m,g),g){switch(g.type){case"attachment":case"payment":case"initial":case"signature":case"date":case"dropdown":case"textarea":case"textbox":case"timestamp":g.setting.x=d,g.setting.y=p;break;case"checkbox_group":case"radio_button_group":{const e=g.setting.options[m];e&&(e.x=d,e.y=p)}}await h(this.endpoint,this.templateId,c,g),this.handlePageRendered({detail:this.cachedPageInfo[t]})}}generateFieldName(e,t){let i,s=1;do{i=`${e}P${t}-${s}`,console.log("testing field",i),s++}while(x.fields.some((e=>e.name===i)));return console.log("Will use field name",i,x.fields),i}viewCoordinatesToPageCoordinates(e,t,i,s,o){const{xScale:a=1,yScale:l=1,renderedHeight:r=792}=this.cachedPageInfo[i];return{x:Math.floor(Math.min(e/a,s)),y:Math.floor(Math.min(Math.max(r-t,0)/l,o))}}async handleClickPage(e,t){var i;if(this.placing){console.log("Placing field",this.placing,t.sequence,e.offsetX,e.offsetY);const s=t.sequence,o=e.offsetX,a=e.offsetY,l=v(this.placing),r=f(this.placing),n=this.cachedPageInfo[s];console.log("Cached page",n);const{naturalWidth:d=612,naturalHeight:h=792}=n,c=this.viewCoordinatesToPageCoordinates(o,a,s,d-l,h-r),m=Math.floor(c.x),g=Math.floor(c.y),u={name:this.generateFieldName(this.placing,s),role_name:this.selectedRoleName,template_id:this.templateId,type:this.placing,required:!0,page_sequence:s,validator:null,setting:{x:m,y:g}};switch(u.type){case"attachment":case"payment":u.setting={x:m,y:g};break;case"initial":case"signature":u.setting={x:m,y:g,result:""};break;case"checkbox_group":u.setting={minimum_checked:0,maximum_checked:1e3,options:[{id:`${u.name}-1`,value:"Option 1",checked:!1,x:m,y:g}]};break;case"date":u.setting={x:m,y:g,width:l,height:r,result:""};break;case"dropdown":u.required=!1,u.setting={x:m,y:g,width:l,height:r,value:null,placeholder:"Choose",options:[{id:"option-1",value:"Option 1"}]};break;case"radio_button_group":u.setting={options:[{id:`${u.name}-1`,value:"Option 1",selected:!1,x:m,y:g}]};break;case"textarea":case"textbox":u.setting={x:m,y:g,width:l,height:r,result:"",leading:0,alignment:0,upperCase:!1};break;case"timestamp":u.setting={x:m,y:g,width:l,height:r}}"textarea"===u.type&&(u.type="textbox");const w=await p(this.endpoint,this.templateId,u);console.log("Saved field",w),x.fields.push(w),this.placing=null,null===(i=this.templateUpdated)||void 0===i||i.emit({endpoint:this.endpoint,template:x.template,event:"added-field"}),this.handlePageRendered({detail:this.cachedPageInfo[s]})}}render(){if(!this.endpoint.session)return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));if(x.loading||!x.template)return i(s,null,i("verdocs-loader",null));const e=[...x.template.pages];return e.sort(((e,t)=>e.sequence-t.sequence)),i(s,{class:this.placing?{[`placing-${this.placing}`]:!0}:{},"data-r":this.rerender,onSubmit:()=>{console.log("onSubmit")}},i("div",{id:"verdocs-template-fields-toolbar"},q.map((e=>i("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,onClick:()=>{e.tooltip&&(this.placing=e.id)}})))),i("div",{class:"pages"},e.map((e=>i("verdocs-template-document-page",{templateId:e.template_id,documentId:e.document_id,pageNumber:e.sequence,virtualWidth:612,virtualHeight:792,onClick:t=>this.handleClickPage(t,e),onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})))))}};C.style="verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px #0000000f;box-shadow:0 0 10px 5px #0000000f}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{height:50px;display:-ms-flexbox;display:flex;-ms-flex:0 0 50px;flex:0 0 50px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio_button_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";export{w as verdocs_template_create,C as verdocs_template_fields}
@@ -1 +0,0 @@
1
- import{r as e,c as o,h as t,H as s,F as r,a as l}from"./p-e035df4b.js";import{i}from"./p-9b2db78f.js";import"./p-2bc0d9be.js";import{u as a,c as n}from"./p-8027431e.js";import{V as d,T as p}from"./p-c58fd28c.js";import{g as c}from"./p-6de76553.js";import{s as m}from"./p-c903c4a7.js";import{l as v}from"./p-6685a532.js";import{b as h}from"./p-fb86b102.js";import{S as f}from"./p-7a1b2643.js";import"./p-7291906c.js";import"./p-b28ef4bb.js";import"./p-7448182b.js";import"./p-aa124212.js";import"./p-ab01f71e.js";const x={[p.EVERYONE]:"Everyone",[p.EVERYONE_AS_CREATOR]:"Everyone as Me",[p.ORGANIZATION_MEMBER]:"Organization member",[p.ORGANIZATION_MEMBER_AS_CREATOR]:"Organization Member as Me",[p.CREATOR]:"Me"},g='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>',u='<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>',b='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>',w='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>',y='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>',q=class{constructor(t){e(this,t),this.next=o(this,"next",7),this.exit=o(this,"exit",7),this.sdkError=o(this,"sdkError",7),this.templateUpdated=o(this,"templateUpdated",7),this.sequences=[],this.endpoint=d.getDefault(),this.templateId="",this.showingRoleDialog=null,this.showingSenderDialog=!1,this.sender=null,this.forceRerender=1}async componentWillLoad(){var e,o,t,s,r,l;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");try{console.log(`[ROLES] Loading template ${this.templateId}`,this.endpoint.session),await v(this.endpoint,this.templateId,!0)}catch(s){console.log("[ROLES] Error loading template",s),null===(e=this.sdkError)||void 0===e||e.emit(new f(s.message,null===(o=s.response)||void 0===o?void 0:o.status,null===(t=s.response)||void 0===t?void 0:t.data))}this.sortTemplateRoles(),this.renumberTemplateRoles()}catch(e){console.log("[FIELDS] Error with preview session",e),null===(s=this.sdkError)||void 0===s||s.emit(new f(e.message,null===(r=e.response)||void 0===r?void 0:r.status,null===(l=e.response)||void 0===l?void 0:l.data))}}componentDidRender(){i.dynamicDrop(!0),i(".recipient").draggable({listeners:{start:function(e){e.target.classList.add("dragging"),this.el.classList.add("dragging")}.bind(this),move:function(e){const o=+(e.target.getAttribute("posX")||0),t=+(e.target.getAttribute("posY")||0),s=e.dx+o,r=e.dy+t;e.target.setAttribute("posX",s),e.target.setAttribute("posy",r),e.target.style.transform=`translate(${s+100}px, ${r-40}px)`}.bind(this),end:function(e){e.target.classList.remove("dragging"),this.el.classList.remove("dragging"),e.target.setAttribute("posX",0),e.target.setAttribute("posy",0),e.target.style.transform="translate(0px, 0px)"}.bind(this)}}),i(".dropzone").dropzone({overlap:.05,ondrop:function(e){var o,t;e.target.classList.remove("active");const s=e.relatedTarget.dataset.rolename,r=+e.target.dataset.sequence,l=+e.target.dataset.order,i=null===(o=m.template)||void 0===o?void 0:o.roles.find((e=>e.name===s));i&&(i.sequence=r,i.order=l,this.sortTemplateRoles(),this.renumberTemplateRoles(),this.forceRerender++,Promise.all(null===(t=m.template)||void 0===t?void 0:t.roles.map((e=>a(this.endpoint,this.templateId,e.name,{sequence:e.sequence,order:e.order})))).then((()=>{var e;console.log("[ROLES] Updated roles"),null===(e=this.templateUpdated)||void 0===e||e.emit({event:"updated-role",endpoint:this.endpoint,template:m.template})})).catch((e=>console.log("[ROLES] Role updates failed",e))))}.bind(this),ondropactivate:e=>{e.target.classList.add("visible")},ondropdeactivate:e=>{e.target.classList.remove("visible")},ondragenter:e=>{e.target.classList.add("active")},ondragleave:e=>{e.target.classList.remove("active")}})}handleCancel(e){var o;e.stopPropagation(),null===(o=this.exit)||void 0===o||o.emit()}handleSubmit(e){var o;e.stopPropagation(),null===(o=this.next)||void 0===o||o.emit()}sortTemplateRoles(){var e;null===(e=m.template)||void 0===e||e.roles.sort(((e,o)=>e.sequence===o.sequence?e.order-o.order:e.sequence-o.sequence))}extractSequenceNumbers(){var e;this.sequences=[],null===(e=m.template)||void 0===e||e.roles.forEach((e=>{this.sequences.includes(e.sequence)||this.sequences.push(e.sequence)}))}renumberTemplateRoles(){this.extractSequenceNumbers();const e=[];this.sequences.sort(((e,o)=>e-o)),this.sequences.forEach(((o,t)=>{var s;null===(s=m.template)||void 0===s||s.roles.filter((e=>e.sequence===o)).forEach(((o,s)=>{e.includes(o.name)||(o.sequence=t+1,o.order=s+1,e.push(o.name))}))})),this.extractSequenceNumbers()}getNextRoleName(){var e,o;let t="",s=null===(e=m.template)||void 0===e?void 0:e.roles.length;do{s++,t=`Recipient ${s}`}while(!t||(null===(o=m.template)||void 0===o?void 0:o.roles.some((e=>e.name===t))));return t}handleAddRole(e,o){e.stopPropagation();const t=m.template.roles.filter((e=>e.sequence===o)).length+1,s=this.getNextRoleName();console.log("Will create",s,o,t),n(this.endpoint,this.templateId,{template_id:this.templateId,name:s,full_name:"",email:"",phone:"",sequence:o,order:t,type:"signer",delegator:!1}).then((e=>{var o;console.log("Created role",e),m.template.roles.push(e),this.renumberTemplateRoles(),this.forceRerender++,null===(o=this.templateUpdated)||void 0===o||o.emit({event:"created-role",endpoint:this.endpoint,template:m.template})})).catch((e=>{console.log("Error creating role",e)}))}handleAddStep(e,o){e.stopPropagation();const t=this.getNextRoleName();console.log("Will create",t,o,1),n(this.endpoint,this.templateId,{template_id:this.templateId,name:t,full_name:"",email:"",phone:"",sequence:o,order:1,type:"signer",delegator:!1}).then((e=>{console.log("Created role",e),m.template.roles.push(e),this.renumberTemplateRoles(),this.forceRerender++})).catch((e=>{console.log("Error creating role",e)}))}render(){var e;if(!this.endpoint.session)return t(s,null,t("verdocs-component-error",{message:"You must be authenticated to use this module."}));if(m.loading||!m.template)return t(s,null,t("verdocs-loader",null));const o=((null===(e=m.template)||void 0===e?void 0:e.roles)||[]).map((e=>e.name));return t(s,null,t("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off","data-r":this.forceRerender},t("h5",null,"Roles and Workflow"),t("div",{class:"participants"},t("div",{class:"left-line"}),t("div",{class:"row"},t("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>'}),t("div",{class:"row-roles"},t("div",{class:"sender"},t("span",{class:"label"},"Sender:")," ",x[m.template.sender]," ",t("div",{class:"settings-button",innerHTML:g,onClick:()=>this.showingSenderDialog=!0,"aria-role":"button"})))),t("div",{class:"row add-sequence","data-sequence":0},t("div",{class:"icon",innerHTML:u}),t("div",{class:"row-roles"},t("div",{class:"dropzone","data-sequence":0,"data-order":1},"Add Step"))),this.sequences.map((e=>t(r,null,t("div",{class:"row"},t("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>'}),t("div",{class:"row-roles"},t("div",{class:"dropzone","data-order":.5,"data-sequence":e}),m.template.roles.filter((o=>o.sequence===e)).map((s=>t(r,null,s.email?t("div",{class:"recipient",style:{borderColor:c(h(o,s.name))},"data-rolename":s.name},t("span",{class:"type-icon",innerHTML:"signer"===s.type?b:"cc"===s.type?y:w}),s.full_name," ",t("div",{class:"settings-button",innerHTML:g,onClick:()=>this.showingRoleDialog=s.name,"aria-role":"button"})):t("div",{class:"recipient",style:{backgroundColor:c(h(o,s.name))},"data-rolename":s.name},t("span",{class:"type-icon",innerHTML:"signer"===s.type?b:"cc"===s.type?y:w}),s.name," ",t("div",{class:"settings-button",innerHTML:g,onClick:()=>this.showingRoleDialog=s.name,"aria-role":"button"})),t("div",{class:"dropzone","data-order":s.order+.5,"data-sequence":e})))),t("button",{class:"add-role",innerHTML:u,onClick:o=>this.handleAddRole(o,e)}))),this.sequences.length>0&&t("div",{class:"row add-sequence","data-sequence":e},t("div",{class:"row-roles"},t("div",{class:"icon",innerHTML:u}),t("div",{class:"dropzone","data-sequence":e+1,"data-order":1},"Add Step")))))),t("div",{class:"row","data-sequence":this.sequences.length+1},t("div",{class:"row-roles"},t("div",{class:"icon",innerHTML:u}),t("button",{class:"add-step",innerHTML:u,onClick:e=>this.handleAddStep(e,this.sequences.length+1)}))),t("div",{class:"row"},t("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>'}),t("div",{class:"row-roles"},t("div",{class:"complete"},"Document Complete")))),o.length<1&&t("div",{class:"empty"},"You must add at least one Role before proceeding.",t("br",null)," Click the ",t("span",{innerHTML:u})," Add button above to get started."),t("div",{class:"buttons"},t("div",{class:"flex-fill"}),t("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e)}),t("verdocs-button",{label:"OK",size:"small",onClick:e=>this.handleSubmit(e),disabled:o.length<1}))),this.showingRoleDialog&&t("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:()=>{this.showingRoleDialog=null,this.forceRerender++},onDelete:e=>{var o;console.log("deleted",e.detail),this.renumberTemplateRoles(),this.showingRoleDialog=null,this.forceRerender++,null===(o=this.templateUpdated)||void 0===o||o.emit({event:"deleted-role",endpoint:this.endpoint,template:m.template})}}),this.showingSenderDialog&&t("verdocs-template-sender",{endpoint:this.endpoint,templateId:this.templateId,onClose:()=>this.showingSenderDialog=!1}))}get el(){return l(this)}};q.style='verdocs-template-roles{display:block;min-width:400px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#4c56cb;margin:0 0 10px 0}verdocs-template-roles>form .participants{position:relative}verdocs-template-roles>form .left-line{top:32px;left:11px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-template-roles>form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;min-height:35px;margin-left:40px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:6px 0 4px 0}verdocs-template-roles>form .row .row-roles{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles>form .row .icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-template-roles>form .row .sender{height:30px;display:-ms-flexbox;display:flex;font-size:14px;line-height:30px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 15px;border:1px solid #c6c9cc;background-color:#f5f5fa}verdocs-template-roles>form .row .complete{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;background-color:#f5f5fa;border:1px solid #aeb4bf}verdocs-template-roles>form .row .label{font-weight:bold;margin-right:6px;color:#33364b}verdocs-template-roles>form .row .settings-button{display:-ms-flexbox;display:flex;cursor:pointer;margin:0 0 0 9px}verdocs-template-roles>form .row .recipient{height:30px;display:-ms-flexbox;display:flex;font-size:14px;border-radius:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 6px;white-space:nowrap;border:2px solid #aeb4bf}verdocs-template-roles>form .row .recipient .type-icon{width:24px;height:24px;-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0.6;margin:0 12px 0 0}verdocs-template-roles>form .row .recipient.dragging{position:absolute}verdocs-template-roles>form .row .recipient.dragging+.dropzone{display:none !important}verdocs-template-roles>form .row .dropzone{width:14px;height:30px;display:none}verdocs-template-roles>form .row .dropzone svg{fill:#cccccc}verdocs-template-roles>form .row .dropzone.visible{margin:0 7px;display:-ms-flexbox;display:flex;-ms-flex:0 0 14px;flex:0 0 14px}verdocs-template-roles>form .row .dropzone.active{-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;background:#654dcb7f;border:1px dashed #654dcb}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .add-role{display:none}verdocs-template-roles.dragging form .row .recipient+.dropzone{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence .dropzone{opacity:0.5;-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;-ms-flex-align:center;align-items:center;background:#654dcb7f;-ms-flex-pack:center;justify-content:center;border:1px dashed #654dcb}verdocs-template-roles.dragging .row.add-sequence .dropzone.active{opacity:1}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:20px;height:20px;stroke:#666666;margin-bottom:-5px}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';export{q as verdocs_template_roles}