@superdoc-dev/esign 1.1.2 → 1.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react");var X={exports:{}},$={};/**
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react");var X={exports:{}},Y={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var ee;function ie(){if(ee)return $;ee=1;var p=Symbol.for("react.transitional.element"),v=Symbol.for("react.fragment");function g(s,a,u){var b=null;if(u!==void 0&&(b=""+u),a.key!==void 0&&(b=""+a.key),"key"in a){u={};for(var _ in a)_!=="key"&&(u[_]=a[_])}else u=a;return a=u.ref,{$$typeof:p,type:s,key:b,ref:a!==void 0?a:null,props:u}}return $.Fragment=v,$.jsx=g,$.jsxs=g,$}var L={};/**
9
+ */var ee;function ce(){if(ee)return Y;ee=1;var p=Symbol.for("react.transitional.element"),v=Symbol.for("react.fragment");function m(o,a,d){var h=null;if(d!==void 0&&(h=""+d),a.key!==void 0&&(h=""+a.key),"key"in a){d={};for(var _ in a)_!=="key"&&(d[_]=a[_])}else d=a;return a=d.ref,{$$typeof:p,type:o,key:h,ref:a!==void 0?a:null,props:d}}return Y.Fragment=v,Y.jsx=m,Y.jsxs=m,Y}var $={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,9 +14,9 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var te;function ue(){return te||(te=1,process.env.NODE_ENV!=="production"&&(function(){function p(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Q?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case y:return"Fragment";case E:return"Profiler";case W:return"StrictMode";case T:return"Suspense";case B:return"SuspenseList";case J:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case Z:return"Portal";case w:return e.displayName||"Context";case V:return(e._context.displayName||"Context")+".Consumer";case z:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case I:return n=e.displayName||null,n!==null?n:p(e.type)||"Memo";case O:n=e._payload,e=e._init;try{return p(e(n))}catch{}}return null}function v(e){return""+e}function g(e){try{v(e);var n=!1}catch{n=!0}if(n){n=console;var c=n.error,d=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",d),v(e)}}function s(e){if(e===y)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var n=p(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function a(){var e=k.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function b(e){if(x.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function _(e,n){function c(){j||(j=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function P(){var e=p(this.type);return H[e]||(H[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function U(e,n,c,d,N,Y){var t=c.ref;return e={$$typeof:q,type:e,key:n,props:c,_owner:d},(t!==void 0?t:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:P}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:N}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function D(e,n,c,d,N,Y){var t=n.children;if(t!==void 0)if(d)if(K(t)){for(d=0;d<t.length;d++)F(t[d]);Object.freeze&&Object.freeze(t)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else F(t);if(x.call(n,"key")){t=p(e);var r=Object.keys(n).filter(function(f){return f!=="key"});d=0<r.length?"{key: someKey, "+r.join(": ..., ")+": ...}":"{key: someKey}",G[t+d]||(r=0<r.length?"{"+r.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var te;function ue(){return te||(te=1,process.env.NODE_ENV!=="production"&&(function(){function p(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Q?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case y:return"Fragment";case b:return"Profiler";case U:return"StrictMode";case T:return"Suspense";case B:return"SuspenseList";case J:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case Z:return"Portal";case k:return e.displayName||"Context";case V:return(e._context.displayName||"Context")+".Consumer";case z:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case F:return n=e.displayName||null,n!==null?n:p(e.type)||"Memo";case O:n=e._payload,e=e._init;try{return p(e(n))}catch{}}return null}function v(e){return""+e}function m(e){try{v(e);var n=!1}catch{n=!0}if(n){n=console;var i=n.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),v(e)}}function o(e){if(e===y)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var n=p(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function a(){var e=w.A;return e===null?null:e.getOwner()}function d(){return Error("react-stack-top-frame")}function h(e){if(S.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function _(e,n){function i(){j||(j=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function q(){var e=p(this.type);return H[e]||(H[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function L(e,n,i,u,N,M){var t=i.ref;return e={$$typeof:W,type:e,key:n,props:i,_owner:u},(t!==void 0?t:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:q}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:N}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function P(e,n,i,u,N,M){var t=n.children;if(t!==void 0)if(u)if(K(t)){for(u=0;u<t.length;u++)D(t[u]);Object.freeze&&Object.freeze(t)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else D(t);if(S.call(n,"key")){t=p(e);var r=Object.keys(n).filter(function(f){return f!=="key"});u=0<r.length?"{key: someKey, "+r.join(": ..., ")+": ...}":"{key: someKey}",G[t+u]||(r=0<r.length?"{"+r.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,d,t,r,t),G[t+d]=!0)}if(t=null,c!==void 0&&(g(c),t=""+c),b(n)&&(g(n.key),t=""+n.key),"key"in n){c={};for(var o in n)o!=="key"&&(c[o]=n[o])}else c=n;return t&&_(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),U(e,t,c,a(),N,Y)}function F(e){h(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?h(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function h(e){return typeof e=="object"&&e!==null&&e.$$typeof===q}var A=i,q=Symbol.for("react.transitional.element"),Z=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),w=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),Q=Symbol.for("react.client.reference"),k=A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,x=Object.prototype.hasOwnProperty,K=Array.isArray,R=console.createTask?console.createTask:function(){return null};A={react_stack_bottom_frame:function(e){return e()}};var j,H={},M=A.react_stack_bottom_frame.bind(A,u)(),C=R(s(u)),G={};L.Fragment=y,L.jsx=function(e,n,c){var d=1e4>k.recentlyCreatedOwnerStacks++;return D(e,n,c,!1,d?Error("react-stack-top-frame"):M,d?R(s(e)):C)},L.jsxs=function(e,n,c){var d=1e4>k.recentlyCreatedOwnerStacks++;return D(e,n,c,!0,d?Error("react-stack-top-frame"):M,d?R(s(e)):C)}})()),L}var re;function de(){return re||(re=1,process.env.NODE_ENV==="production"?X.exports=ie():X.exports=ue()),X.exports}var m=de();const ne=({value:p,onChange:v,isDisabled:g,label:s})=>m.jsxs("div",{className:"superdoc-esign-signature-input",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[s&&m.jsx("label",{children:s}),m.jsx("input",{type:"text",value:String(p||""),onChange:a=>v(a.target.value),disabled:g,placeholder:"Type your full name",style:{fontFamily:"cursive",fontSize:"18px"}})]}),ae=({value:p,onChange:v,isDisabled:g,label:s})=>m.jsxs("label",{className:"superdoc-esign-checkbox-input",style:{display:"flex",gap:"8px"},children:[m.jsx("input",{type:"checkbox",checked:!!p,onChange:a=>v(a.target.checked),disabled:g}),m.jsx("span",{children:s})]}),fe=p=>({onClick:g,fileName:s,isDisabled:a})=>{const u=p?.label||"Download";return m.jsxs("button",{onClick:g,disabled:a,className:"superdoc-esign-btn",style:{padding:"10px 20px",borderRadius:"6px",border:"none",background:"#fff",color:"#333",cursor:a?"not-allowed":"pointer",opacity:a?.5:1,fontSize:"16px",fontWeight:"bold"},children:[u," ",s&&`(${s})`]})},pe=p=>({onClick:g,isValid:s,isDisabled:a,isSubmitting:u})=>{const b=()=>p?.label||"Submit";return m.jsx("button",{onClick:g,disabled:!s||a||u,className:"superdoc-esign-btn",style:{padding:"12px 24px",borderRadius:"6px",border:"none",background:"#007bff",color:"#fff",cursor:!s||a?"not-allowed":"pointer",opacity:!s||a?.5:1,fontSize:"16px",fontWeight:"bold"},children:b()})},oe=i.forwardRef((p,v)=>{const{eventId:g,document:s,fields:a={},download:u,submit:b,onSubmit:_,onDownload:P,onStateChange:U,onFieldChange:D,onFieldsDiscovered:F,isDisabled:h=!1,className:A,style:q,documentHeight:Z="600px"}=p,[y,W]=i.useState(!s.validation?.scroll?.required),[E,V]=i.useState(new Map),[w,z]=i.useState(!1),[T,B]=i.useState(!1),[I,O]=i.useState([]),[J,Q]=i.useState(!1),k=i.useRef(null),x=i.useRef(null),K=i.useRef(Date.now()),R=i.useRef(a);R.current=a;const j=i.useCallback(t=>{if(!x.current?.activeEditor)return;const r=x.current.activeEditor,o=R.current.signer?.find(l=>l.id===t.id);let f;o?.type==="signature"&&t.value?f={json:{type:"image",attrs:{src:typeof t.value=="string"&&t.value.startsWith("data:image/")?t.value:H(String(t.value)),alt:"Signature"}}}:f={text:String(t.value??"")},t.id&&r.commands.updateStructuredContentById(t.id,f)},[]);function H(t){const r=globalThis.document.createElement("canvas"),o=r.getContext("2d"),f=30;o.font=`italic ${f}px cursive`;const S=o.measureText(t).width,se=f*1.3,le=4,ce=6;return r.width=Math.ceil(S+le*2)+20,r.height=Math.ceil(se+ce*2),o.font=`italic ${f}px cursive`,o.fillStyle="black",o.textAlign="center",o.textBaseline="middle",o.fillText(t,r.width/2,r.height/2),r.toDataURL("image/png")}const M=i.useCallback(t=>{if(!t)return;const r=t.helpers.structuredContentCommands.getStructuredContentTags(t.state),o=new Map;R.current.document?.forEach(l=>{l.id&&o.set(l.id,l.value)}),R.current.signer?.forEach(l=>{l.value!==void 0&&o.set(l.id,l.value)});const f=r.map(({node:l})=>({id:l.attrs.id,label:l.attrs.label,value:o.get(l.attrs.id)??l.textContent??""})).filter(l=>l.id);f.length>0&&(F?.(f),[...R.current.document||[],...R.current.signer||[]].filter(S=>S.value!==void 0).forEach(S=>j({id:S.id,value:S.value})))},[F,j]),C=t=>{const r={...t,timestamp:new Date().toISOString()};O(o=>[...o,r])};i.useEffect(()=>k.current?((async()=>{const{SuperDoc:r}=await Promise.resolve().then(()=>require("./superdoc.es-DfpwGgyj.cjs")).then(f=>f.superdoc_es),o=new r({selector:k.current,document:s.source,documentMode:"viewing",onReady:()=>{o.activeEditor&&M(o.activeEditor),C({type:"ready"}),Q(!0)}});x.current=o})(),()=>{x.current&&(x.current.destroy(),x.current=null)}):void 0,[s.source,s.mode,M]),i.useEffect(()=>{if(!s.validation?.scroll?.required||!J)return;const t=k.current;if(!t)return;const r=()=>{const{scrollTop:o,scrollHeight:f,clientHeight:l}=t,S=o/(f-l);(S>=.95||f<=l)&&(W(!0),C({type:"scroll",data:{percent:Math.round(S*100)}}))};return t.addEventListener("scroll",r),r(),()=>t.removeEventListener("scroll",r)},[s.validation?.scroll?.required,J]);const G=i.useCallback((t,r)=>{V(o=>{const f=o.get(t),l=new Map(o);return l.set(t,r),j({id:t,value:r}),C({type:"field_change",data:{fieldId:t,value:r,previousValue:f}}),D?.({id:t,value:r,previousValue:f}),l})},[D,j]),e=i.useCallback(()=>s.validation?.scroll?.required&&!y?!1:(a.signer||[]).every(t=>{if(!t.validation?.required)return!0;const r=E.get(t.id);return r&&(typeof r!="string"||r.trim())}),[y,a.signer,E,s.validation?.scroll?.required]);i.useEffect(()=>{const t=e();z(t),U?.({scrolled:y,fields:E,isValid:t,isSubmitting:T})},[y,E,T,e,U]);const n=i.useCallback(async()=>{if(h)return;const t=await x.current?.export({exportType:["pdf"],isFinalDoc:!0,triggerDownload:!1});if(t&&P)P(t,u?.fileName||"document.pdf");else if(t){const r=URL.createObjectURL(t),o=globalThis.document.createElement("a");o.href=r,o.download=u?.fileName||"document.pdf",o.click(),URL.revokeObjectURL(r)}},[h,u,P]),c=i.useCallback(async()=>{if(!w||h||T)return;B(!0),C({type:"submit"});const t={eventId:g,timestamp:new Date().toISOString(),duration:Math.floor((Date.now()-K.current)/1e3),auditTrail:I,documentFields:a.document||[],signerFields:(a.signer||[]).map(r=>({id:r.id,value:E.get(r.id)??null})),isFullyCompleted:w};try{await _(t)}finally{B(!1)}},[w,h,T,g,I,a,E,_]),d=t=>{const r=t.component||N(t.type);return m.jsx(r,{value:E.get(t.id)??null,onChange:o=>G(t.id,o),isDisabled:h,label:t.label},t.id)},N=t=>{switch(t){case"signature":case"text":return ne;case"checkbox":return ae}},Y=()=>{const t=u?.component||fe(u),r=b?.component||pe(b);return m.jsxs("div",{className:"superdoc-esign-actions",style:{display:"flex",gap:"10px"},children:[s.mode!=="download"&&m.jsx(r,{onClick:c,isValid:w,isDisabled:h,isSubmitting:T}),m.jsx(t,{onClick:n,fileName:u?.fileName,isDisabled:h})]})};return i.useImperativeHandle(v,()=>({getState:()=>({scrolled:y,fields:E,isValid:w,isSubmitting:T}),getAuditTrail:()=>I,reset:()=>{W(!s.validation?.scroll?.required),V(new Map),z(!1),O([])}})),m.jsxs("div",{className:`superdoc-esign-container ${A||""}`,style:q,children:[m.jsx("div",{className:"superdoc-esign-document",children:m.jsx("div",{ref:k,style:{height:Z,overflow:"auto"}})}),m.jsxs("div",{className:"superdoc-esign-controls",style:{marginTop:"20px"},children:[a.signer&&a.signer.length>0&&m.jsx("div",{className:"superdoc-esign-fields",style:{marginBottom:"20px"},children:a.signer.map(d)}),Y()]})]})});oe.displayName="SuperDocESign";exports.CheckboxInput=ae;exports.SignatureInput=ne;exports.default=oe;
22
+ <%s key={someKey} {...props} />`,u,t,r,t),G[t+u]=!0)}if(t=null,i!==void 0&&(m(i),t=""+i),h(n)&&(m(n.key),t=""+n.key),"key"in n){i={};for(var s in n)s!=="key"&&(i[s]=n[s])}else i=n;return t&&_(i,typeof e=="function"?e.displayName||e.name||"Unknown":e),L(e,t,i,a(),N,M)}function D(e){E(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?E(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function E(e){return typeof e=="object"&&e!==null&&e.$$typeof===W}var A=c,W=Symbol.for("react.transitional.element"),Z=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),k=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),Q=Symbol.for("react.client.reference"),w=A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,S=Object.prototype.hasOwnProperty,K=Array.isArray,x=console.createTask?console.createTask:function(){return null};A={react_stack_bottom_frame:function(e){return e()}};var j,H={},I=A.react_stack_bottom_frame.bind(A,d)(),C=x(o(d)),G={};$.Fragment=y,$.jsx=function(e,n,i){var u=1e4>w.recentlyCreatedOwnerStacks++;return P(e,n,i,!1,u?Error("react-stack-top-frame"):I,u?x(o(e)):C)},$.jsxs=function(e,n,i){var u=1e4>w.recentlyCreatedOwnerStacks++;return P(e,n,i,!0,u?Error("react-stack-top-frame"):I,u?x(o(e)):C)}})()),$}var re;function de(){return re||(re=1,process.env.NODE_ENV==="production"?X.exports=ce():X.exports=ue()),X.exports}var g=de();const ne=({value:p,onChange:v,isDisabled:m,label:o})=>g.jsxs("div",{className:"superdoc-esign-signature-input",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[o&&g.jsx("label",{children:o}),g.jsx("input",{type:"text",value:String(p||""),onChange:a=>v(a.target.value),disabled:m,placeholder:"Type your full name",style:{fontFamily:"cursive",fontSize:"18px"}})]}),ae=({value:p,onChange:v,isDisabled:m,label:o})=>g.jsxs("label",{className:"superdoc-esign-checkbox-input",style:{display:"flex",gap:"8px"},children:[g.jsx("input",{type:"checkbox",checked:!!p,onChange:a=>v(a.target.checked),disabled:m}),g.jsx("span",{children:o})]}),fe=p=>({onClick:m,fileName:o,isDisabled:a})=>{const d=p?.label||"Download";return g.jsxs("button",{onClick:m,disabled:a,className:"superdoc-esign-btn",style:{padding:"10px 20px",borderRadius:"6px",border:"none",background:"#fff",color:"#333",cursor:a?"not-allowed":"pointer",opacity:a?.5:1,fontSize:"16px",fontWeight:"bold"},children:[d," ",o&&`(${o})`]})},me=p=>({onClick:m,isValid:o,isDisabled:a,isSubmitting:d})=>{const h=()=>p?.label||"Submit";return g.jsx("button",{onClick:m,disabled:!o||a||d,className:"superdoc-esign-btn",style:{padding:"12px 24px",borderRadius:"6px",border:"none",background:"#007bff",color:"#fff",cursor:!o||a?"not-allowed":"pointer",opacity:!o||a?.5:1,fontSize:"16px",fontWeight:"bold"},children:h()})},oe=c.forwardRef((p,v)=>{const{eventId:m,document:o,fields:a={},download:d,submit:h,onSubmit:_,onDownload:q,onStateChange:L,onFieldChange:P,onFieldsDiscovered:D,isDisabled:E=!1,className:A,style:W,documentHeight:Z="600px"}=p,[y,U]=c.useState(!o.validation?.scroll?.required),[b,V]=c.useState(new Map),[k,z]=c.useState(!1),[T,B]=c.useState(!1),[F,O]=c.useState([]),[J,Q]=c.useState(!1),w=c.useRef(null),S=c.useRef(null),K=c.useRef(Date.now()),x=c.useRef(a);x.current=a;const j=c.useCallback(t=>{if(!S.current?.activeEditor)return;const r=S.current.activeEditor,s=x.current.signer?.find(l=>l.id===t.id);let f;s?.type==="signature"&&t.value?f={json:{type:"image",attrs:{src:typeof t.value=="string"&&t.value.startsWith("data:image/")?t.value:H(String(t.value)),alt:"Signature"}}}:f={text:String(t.value??"")},t.id&&r.commands.updateStructuredContentById(t.id,f)},[]);function H(t){const r=globalThis.document.createElement("canvas"),s=r.getContext("2d"),f=30;s.font=`italic ${f}px cursive`;const R=s.measureText(t).width,se=f*1.3,le=4,ie=6;return r.width=Math.ceil(R+le*2)+20,r.height=Math.ceil(se+ie*2),s.font=`italic ${f}px cursive`,s.fillStyle="black",s.textAlign="center",s.textBaseline="middle",s.fillText(t,r.width/2,r.height/2),r.toDataURL("image/png")}const I=c.useCallback(t=>{if(!t)return;const r=t.helpers.structuredContentCommands.getStructuredContentTags(t.state),s=new Map;x.current.document?.forEach(l=>{l.id&&s.set(l.id,l.value)}),x.current.signer?.forEach(l=>{l.value!==void 0&&s.set(l.id,l.value)});const f=r.map(({node:l})=>({id:l.attrs.id,label:l.attrs.label,value:s.get(l.attrs.id)??l.textContent??""})).filter(l=>l.id);f.length>0&&(D?.(f),[...x.current.document||[],...x.current.signer||[]].filter(R=>R.value!==void 0).forEach(R=>j({id:R.id,value:R.value})))},[D,j]),C=t=>{const r={...t,timestamp:new Date().toISOString()};O(s=>[...s,r])};c.useEffect(()=>w.current?((async()=>{const{SuperDoc:r}=await Promise.resolve().then(()=>require("./superdoc.es-DfpwGgyj.cjs")).then(f=>f.superdoc_es),s=new r({selector:w.current,document:o.source,documentMode:"viewing",onReady:()=>{s.activeEditor&&I(s.activeEditor),C({type:"ready"}),Q(!0)}});S.current=s})(),()=>{S.current&&(S.current.destroy(),S.current=null)}):void 0,[o.source,o.mode,I]),c.useEffect(()=>{if(!o.validation?.scroll?.required||!J)return;const t=w.current;if(!t)return;const r=()=>{const{scrollTop:s,scrollHeight:f,clientHeight:l}=t,R=s/(f-l);(R>=.95||f<=l)&&(U(!0),C({type:"scroll",data:{percent:Math.round(R*100)}}))};return t.addEventListener("scroll",r),r(),()=>t.removeEventListener("scroll",r)},[o.validation?.scroll?.required,J]);const G=c.useCallback((t,r)=>{V(s=>{const f=s.get(t),l=new Map(s);return l.set(t,r),j({id:t,value:r}),C({type:"field_change",data:{fieldId:t,value:r,previousValue:f}}),P?.({id:t,value:r,previousValue:f}),l})},[P,j]),e=c.useCallback(()=>o.validation?.scroll?.required&&!y?!1:(a.signer||[]).every(t=>{if(!t.validation?.required)return!0;const r=b.get(t.id);return r&&(typeof r!="string"||r.trim())}),[y,a.signer,b,o.validation?.scroll?.required]);c.useEffect(()=>{const t=e();z(t),L?.({scrolled:y,fields:b,isValid:t,isSubmitting:T})},[y,b,T,e,L]);const n=c.useCallback(async()=>{if(E)return;const t={eventId:m,documentSource:o.source,fields:{document:a.document||[],signer:(a.signer||[]).map(r=>({id:r.id,value:b.get(r.id)??null}))},fileName:d?.fileName||"document.pdf"};await q?.(t)},[E,m,o.source,a,b,d,q]),i=c.useCallback(async()=>{if(!k||E||T)return;B(!0),C({type:"submit"});const t={eventId:m,timestamp:new Date().toISOString(),duration:Math.floor((Date.now()-K.current)/1e3),auditTrail:F,documentFields:a.document||[],signerFields:(a.signer||[]).map(r=>({id:r.id,value:b.get(r.id)??null})),isFullyCompleted:k};try{await _(t)}finally{B(!1)}},[k,E,T,m,F,a,b,_]),u=t=>{const r=t.component||N(t.type);return g.jsx(r,{value:b.get(t.id)??null,onChange:s=>G(t.id,s),isDisabled:E,label:t.label},t.id)},N=t=>{switch(t){case"signature":case"text":return ne;case"checkbox":return ae}},M=()=>{const t=d?.component||fe(d),r=h?.component||me(h);return g.jsxs("div",{className:"superdoc-esign-actions",style:{display:"flex",gap:"10px"},children:[o.mode!=="download"&&g.jsx(r,{onClick:i,isValid:k,isDisabled:E,isSubmitting:T}),g.jsx(t,{onClick:n,fileName:d?.fileName,isDisabled:E})]})};return c.useImperativeHandle(v,()=>({getState:()=>({scrolled:y,fields:b,isValid:k,isSubmitting:T}),getAuditTrail:()=>F,reset:()=>{U(!o.validation?.scroll?.required),V(new Map),z(!1),O([])}})),g.jsxs("div",{className:`superdoc-esign-container ${A||""}`,style:W,children:[g.jsx("div",{className:"superdoc-esign-document",children:g.jsx("div",{ref:w,style:{height:Z,overflow:"auto"}})}),g.jsxs("div",{className:"superdoc-esign-controls",style:{marginTop:"20px"},children:[a.signer&&a.signer.length>0&&g.jsx("div",{className:"superdoc-esign-fields",style:{marginBottom:"20px"},children:a.signer.map(u)}),M()]})]})});oe.displayName="SuperDocESign";exports.CheckboxInput=ae;exports.SignatureInput=ne;exports.default=oe;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import ce, { forwardRef as ue, useState as N, useRef as Z, useCallback as P, useEffect as re, useImperativeHandle as de } from "react";
2
- var Q = { exports: {} }, L = {};
2
+ var Q = { exports: {} }, $ = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.js
@@ -11,27 +11,27 @@ var Q = { exports: {} }, L = {};
11
11
  */
12
12
  var ne;
13
13
  function fe() {
14
- if (ne) return L;
14
+ if (ne) return $;
15
15
  ne = 1;
16
- var f = Symbol.for("react.transitional.element"), g = Symbol.for("react.fragment");
17
- function m(s, o, c) {
18
- var v = null;
19
- if (c !== void 0 && (v = "" + c), o.key !== void 0 && (v = "" + o.key), "key" in o) {
20
- c = {};
16
+ var m = Symbol.for("react.transitional.element"), g = Symbol.for("react.fragment");
17
+ function f(a, o, u) {
18
+ var b = null;
19
+ if (u !== void 0 && (b = "" + u), o.key !== void 0 && (b = "" + o.key), "key" in o) {
20
+ u = {};
21
21
  for (var _ in o)
22
- _ !== "key" && (c[_] = o[_]);
23
- } else c = o;
24
- return o = c.ref, {
25
- $$typeof: f,
26
- type: s,
27
- key: v,
22
+ _ !== "key" && (u[_] = o[_]);
23
+ } else u = o;
24
+ return o = u.ref, {
25
+ $$typeof: m,
26
+ type: a,
27
+ key: b,
28
28
  ref: o !== void 0 ? o : null,
29
- props: c
29
+ props: u
30
30
  };
31
31
  }
32
- return L.Fragment = g, L.jsx = m, L.jsxs = m, L;
32
+ return $.Fragment = g, $.jsx = f, $.jsxs = f, $;
33
33
  }
34
- var U = {};
34
+ var q = {};
35
35
  /**
36
36
  * @license React
37
37
  * react-jsx-runtime.development.js
@@ -42,17 +42,17 @@ var U = {};
42
42
  * LICENSE file in the root directory of this source tree.
43
43
  */
44
44
  var oe;
45
- function pe() {
45
+ function me() {
46
46
  return oe || (oe = 1, process.env.NODE_ENV !== "production" && (function() {
47
- function f(e) {
47
+ function m(e) {
48
48
  if (e == null) return null;
49
49
  if (typeof e == "function")
50
50
  return e.$$typeof === ee ? null : e.displayName || e.name || null;
51
51
  if (typeof e == "string") return e;
52
52
  switch (e) {
53
- case y:
53
+ case x:
54
54
  return "Fragment";
55
- case h:
55
+ case v:
56
56
  return "Profiler";
57
57
  case V:
58
58
  return "StrictMode";
@@ -76,12 +76,12 @@ function pe() {
76
76
  case B:
77
77
  var n = e.render;
78
78
  return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
- case M:
80
- return n = e.displayName || null, n !== null ? n : f(e.type) || "Memo";
79
+ case I:
80
+ return n = e.displayName || null, n !== null ? n : m(e.type) || "Memo";
81
81
  case C:
82
82
  n = e._payload, e = e._init;
83
83
  try {
84
- return f(e(n));
84
+ return m(e(n));
85
85
  } catch {
86
86
  }
87
87
  }
@@ -90,7 +90,7 @@ function pe() {
90
90
  function g(e) {
91
91
  return "" + e;
92
92
  }
93
- function m(e) {
93
+ function f(e) {
94
94
  try {
95
95
  g(e);
96
96
  var n = !1;
@@ -99,20 +99,20 @@ function pe() {
99
99
  }
100
100
  if (n) {
101
101
  n = console;
102
- var l = n.error, u = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
102
+ var l = n.error, c = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
103
  return l.call(
104
104
  n,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- u
106
+ c
107
107
  ), g(e);
108
108
  }
109
109
  }
110
- function s(e) {
111
- if (e === y) return "<>";
110
+ function a(e) {
111
+ if (e === x) return "<>";
112
112
  if (typeof e == "object" && e !== null && e.$$typeof === C)
113
113
  return "<...>";
114
114
  try {
115
- var n = f(e);
115
+ var n = m(e);
116
116
  return n ? "<" + n + ">" : "<...>";
117
117
  } catch {
118
118
  return "<...>";
@@ -122,11 +122,11 @@ function pe() {
122
122
  var e = T.A;
123
123
  return e === null ? null : e.getOwner();
124
124
  }
125
- function c() {
125
+ function u() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
- function v(e) {
129
- if (E.call(e, "key")) {
128
+ function b(e) {
129
+ if (y.call(e, "key")) {
130
130
  var n = Object.getOwnPropertyDescriptor(e, "key").get;
131
131
  if (n && n.isReactWarning) return !1;
132
132
  }
@@ -144,23 +144,23 @@ function pe() {
144
144
  configurable: !0
145
145
  });
146
146
  }
147
- function D() {
148
- var e = f(this.type);
147
+ function L() {
148
+ var e = m(this.type);
149
149
  return G[e] || (G[e] = !0, console.error(
150
150
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
151
  )), e = this.props.ref, e !== void 0 ? e : null;
152
152
  }
153
- function q(e, n, l, u, O, $) {
153
+ function W(e, n, l, c, O, Y) {
154
154
  var t = l.ref;
155
155
  return e = {
156
- $$typeof: W,
156
+ $$typeof: U,
157
157
  type: e,
158
158
  key: n,
159
159
  props: l,
160
- _owner: u
160
+ _owner: c
161
161
  }, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
162
162
  enumerable: !1,
163
- get: D
163
+ get: L
164
164
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
165
165
  configurable: !1,
166
166
  enumerable: !1,
@@ -180,64 +180,64 @@ function pe() {
180
180
  configurable: !1,
181
181
  enumerable: !1,
182
182
  writable: !0,
183
- value: $
183
+ value: Y
184
184
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
185
185
  }
186
- function F(e, n, l, u, O, $) {
186
+ function D(e, n, l, c, O, Y) {
187
187
  var t = n.children;
188
188
  if (t !== void 0)
189
- if (u)
189
+ if (c)
190
190
  if (te(t)) {
191
- for (u = 0; u < t.length; u++)
192
- I(t[u]);
191
+ for (c = 0; c < t.length; c++)
192
+ F(t[c]);
193
193
  Object.freeze && Object.freeze(t);
194
194
  } else
195
195
  console.error(
196
196
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
197
  );
198
- else I(t);
199
- if (E.call(n, "key")) {
200
- t = f(e);
198
+ else F(t);
199
+ if (y.call(n, "key")) {
200
+ t = m(e);
201
201
  var r = Object.keys(n).filter(function(d) {
202
202
  return d !== "key";
203
203
  });
204
- u = 0 < r.length ? "{key: someKey, " + r.join(": ..., ") + ": ...}" : "{key: someKey}", X[t + u] || (r = 0 < r.length ? "{" + r.join(": ..., ") + ": ...}" : "{}", console.error(
204
+ c = 0 < r.length ? "{key: someKey, " + r.join(": ..., ") + ": ...}" : "{key: someKey}", X[t + c] || (r = 0 < r.length ? "{" + r.join(": ..., ") + ": ...}" : "{}", console.error(
205
205
  `A props object containing a "key" prop is being spread into JSX:
206
206
  let props = %s;
207
207
  <%s {...props} />
208
208
  React keys must be passed directly to JSX without using spread:
209
209
  let props = %s;
210
210
  <%s key={someKey} {...props} />`,
211
- u,
211
+ c,
212
212
  t,
213
213
  r,
214
214
  t
215
- ), X[t + u] = !0);
215
+ ), X[t + c] = !0);
216
216
  }
217
- if (t = null, l !== void 0 && (m(l), t = "" + l), v(n) && (m(n.key), t = "" + n.key), "key" in n) {
217
+ if (t = null, l !== void 0 && (f(l), t = "" + l), b(n) && (f(n.key), t = "" + n.key), "key" in n) {
218
218
  l = {};
219
- for (var a in n)
220
- a !== "key" && (l[a] = n[a]);
219
+ for (var s in n)
220
+ s !== "key" && (l[s] = n[s]);
221
221
  } else l = n;
222
222
  return t && _(
223
223
  l,
224
224
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
225
- ), q(
225
+ ), W(
226
226
  e,
227
227
  t,
228
228
  l,
229
229
  o(),
230
230
  O,
231
- $
231
+ Y
232
232
  );
233
233
  }
234
- function I(e) {
235
- b(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === C && (e._payload.status === "fulfilled" ? b(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
234
+ function F(e) {
235
+ h(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === C && (e._payload.status === "fulfilled" ? h(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
236
236
  }
237
- function b(e) {
238
- return typeof e == "object" && e !== null && e.$$typeof === W;
237
+ function h(e) {
238
+ return typeof e == "object" && e !== null && e.$$typeof === U;
239
239
  }
240
- var A = ce, W = Symbol.for("react.transitional.element"), K = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), V = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), w = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), J = Symbol.for("react.suspense_list"), M = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), H = Symbol.for("react.activity"), ee = Symbol.for("react.client.reference"), T = A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, E = Object.prototype.hasOwnProperty, te = Array.isArray, x = console.createTask ? console.createTask : function() {
240
+ var A = ce, U = Symbol.for("react.transitional.element"), K = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), V = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), w = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), J = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), H = Symbol.for("react.activity"), ee = Symbol.for("react.client.reference"), T = A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, y = Object.prototype.hasOwnProperty, te = Array.isArray, E = console.createTask ? console.createTask : function() {
241
241
  return null;
242
242
  };
243
243
  A = {
@@ -245,52 +245,52 @@ React keys must be passed directly to JSX without using spread:
245
245
  return e();
246
246
  }
247
247
  };
248
- var k, G = {}, Y = A.react_stack_bottom_frame.bind(
248
+ var k, G = {}, M = A.react_stack_bottom_frame.bind(
249
249
  A,
250
- c
251
- )(), j = x(s(c)), X = {};
252
- U.Fragment = y, U.jsx = function(e, n, l) {
253
- var u = 1e4 > T.recentlyCreatedOwnerStacks++;
254
- return F(
250
+ u
251
+ )(), j = E(a(u)), X = {};
252
+ q.Fragment = x, q.jsx = function(e, n, l) {
253
+ var c = 1e4 > T.recentlyCreatedOwnerStacks++;
254
+ return D(
255
255
  e,
256
256
  n,
257
257
  l,
258
258
  !1,
259
- u ? Error("react-stack-top-frame") : Y,
260
- u ? x(s(e)) : j
259
+ c ? Error("react-stack-top-frame") : M,
260
+ c ? E(a(e)) : j
261
261
  );
262
- }, U.jsxs = function(e, n, l) {
263
- var u = 1e4 > T.recentlyCreatedOwnerStacks++;
264
- return F(
262
+ }, q.jsxs = function(e, n, l) {
263
+ var c = 1e4 > T.recentlyCreatedOwnerStacks++;
264
+ return D(
265
265
  e,
266
266
  n,
267
267
  l,
268
268
  !0,
269
- u ? Error("react-stack-top-frame") : Y,
270
- u ? x(s(e)) : j
269
+ c ? Error("react-stack-top-frame") : M,
270
+ c ? E(a(e)) : j
271
271
  );
272
272
  };
273
- })()), U;
273
+ })()), q;
274
274
  }
275
275
  var ae;
276
- function me() {
277
- return ae || (ae = 1, process.env.NODE_ENV === "production" ? Q.exports = fe() : Q.exports = pe()), Q.exports;
276
+ function pe() {
277
+ return ae || (ae = 1, process.env.NODE_ENV === "production" ? Q.exports = fe() : Q.exports = me()), Q.exports;
278
278
  }
279
- var p = me();
279
+ var p = pe();
280
280
  const ge = ({
281
- value: f,
281
+ value: m,
282
282
  onChange: g,
283
- isDisabled: m,
284
- label: s
283
+ isDisabled: f,
284
+ label: a
285
285
  }) => /* @__PURE__ */ p.jsxs("div", { className: "superdoc-esign-signature-input", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
286
- s && /* @__PURE__ */ p.jsx("label", { children: s }),
286
+ a && /* @__PURE__ */ p.jsx("label", { children: a }),
287
287
  /* @__PURE__ */ p.jsx(
288
288
  "input",
289
289
  {
290
290
  type: "text",
291
- value: String(f || ""),
291
+ value: String(m || ""),
292
292
  onChange: (o) => g(o.target.value),
293
- disabled: m,
293
+ disabled: f,
294
294
  placeholder: "Type your full name",
295
295
  style: {
296
296
  fontFamily: "cursive",
@@ -299,10 +299,10 @@ const ge = ({
299
299
  }
300
300
  )
301
301
  ] }), ve = ({
302
- value: f,
302
+ value: m,
303
303
  onChange: g,
304
- isDisabled: m,
305
- label: s
304
+ isDisabled: f,
305
+ label: a
306
306
  }) => /* @__PURE__ */ p.jsxs(
307
307
  "label",
308
308
  {
@@ -313,24 +313,24 @@ const ge = ({
313
313
  "input",
314
314
  {
315
315
  type: "checkbox",
316
- checked: !!f,
316
+ checked: !!m,
317
317
  onChange: (o) => g(o.target.checked),
318
- disabled: m
318
+ disabled: f
319
319
  }
320
320
  ),
321
- /* @__PURE__ */ p.jsx("span", { children: s })
321
+ /* @__PURE__ */ p.jsx("span", { children: a })
322
322
  ]
323
323
  }
324
- ), be = (f) => ({
325
- onClick: m,
326
- fileName: s,
324
+ ), be = (m) => ({
325
+ onClick: f,
326
+ fileName: a,
327
327
  isDisabled: o
328
328
  }) => {
329
- const c = f?.label || "Download";
329
+ const u = m?.label || "Download";
330
330
  return /* @__PURE__ */ p.jsxs(
331
331
  "button",
332
332
  {
333
- onClick: m,
333
+ onClick: f,
334
334
  disabled: o,
335
335
  className: "superdoc-esign-btn",
336
336
  style: {
@@ -345,24 +345,24 @@ const ge = ({
345
345
  fontWeight: "bold"
346
346
  },
347
347
  children: [
348
- c,
348
+ u,
349
349
  " ",
350
- s && `(${s})`
350
+ a && `(${a})`
351
351
  ]
352
352
  }
353
353
  );
354
- }, he = (f) => ({
355
- onClick: m,
356
- isValid: s,
354
+ }, he = (m) => ({
355
+ onClick: f,
356
+ isValid: a,
357
357
  isDisabled: o,
358
- isSubmitting: c
358
+ isSubmitting: u
359
359
  }) => {
360
- const v = () => f?.label || "Submit";
360
+ const b = () => m?.label || "Submit";
361
361
  return /* @__PURE__ */ p.jsx(
362
362
  "button",
363
363
  {
364
- onClick: m,
365
- disabled: !s || o || c,
364
+ onClick: f,
365
+ disabled: !a || o || u,
366
366
  className: "superdoc-esign-btn",
367
367
  style: {
368
368
  padding: "12px 24px",
@@ -370,40 +370,40 @@ const ge = ({
370
370
  border: "none",
371
371
  background: "#007bff",
372
372
  color: "#fff",
373
- cursor: !s || o ? "not-allowed" : "pointer",
374
- opacity: !s || o ? 0.5 : 1,
373
+ cursor: !a || o ? "not-allowed" : "pointer",
374
+ opacity: !a || o ? 0.5 : 1,
375
375
  fontSize: "16px",
376
376
  fontWeight: "bold"
377
377
  },
378
- children: v()
378
+ children: b()
379
379
  }
380
380
  );
381
381
  }, Ee = ue(
382
- (f, g) => {
382
+ (m, g) => {
383
383
  const {
384
- eventId: m,
385
- document: s,
384
+ eventId: f,
385
+ document: a,
386
386
  fields: o = {},
387
- download: c,
388
- submit: v,
387
+ download: u,
388
+ submit: b,
389
389
  onSubmit: _,
390
- onDownload: D,
391
- onStateChange: q,
392
- onFieldChange: F,
393
- onFieldsDiscovered: I,
394
- isDisabled: b = !1,
390
+ onDownload: L,
391
+ onStateChange: W,
392
+ onFieldChange: D,
393
+ onFieldsDiscovered: F,
394
+ isDisabled: h = !1,
395
395
  className: A,
396
- style: W,
396
+ style: U,
397
397
  documentHeight: K = "600px"
398
- } = f, [y, V] = N(
399
- !s.validation?.scroll?.required
400
- ), [h, z] = N(/* @__PURE__ */ new Map()), [w, B] = N(!1), [S, J] = N(!1), [M, C] = N([]), [H, ee] = N(!1), T = Z(null), E = Z(null), te = Z(Date.now()), x = Z(o);
401
- x.current = o;
398
+ } = m, [x, V] = N(
399
+ !a.validation?.scroll?.required
400
+ ), [v, z] = N(/* @__PURE__ */ new Map()), [w, B] = N(!1), [S, J] = N(!1), [I, C] = N([]), [H, ee] = N(!1), T = Z(null), y = Z(null), te = Z(Date.now()), E = Z(o);
401
+ E.current = o;
402
402
  const k = P((t) => {
403
- if (!E.current?.activeEditor) return;
404
- const r = E.current.activeEditor, a = x.current.signer?.find((i) => i.id === t.id);
403
+ if (!y.current?.activeEditor) return;
404
+ const r = y.current.activeEditor, s = E.current.signer?.find((i) => i.id === t.id);
405
405
  let d;
406
- a?.type === "signature" && t.value ? d = {
406
+ s?.type === "signature" && t.value ? d = {
407
407
  json: {
408
408
  type: "image",
409
409
  attrs: { src: typeof t.value == "string" && t.value.startsWith("data:image/") ? t.value : G(String(t.value)), alt: "Signature" }
@@ -414,34 +414,34 @@ const ge = ({
414
414
  );
415
415
  }, []);
416
416
  function G(t) {
417
- const r = globalThis.document.createElement("canvas"), a = r.getContext("2d"), d = 30;
418
- a.font = `italic ${d}px cursive`;
419
- const R = a.measureText(t).width, se = d * 1.3, ie = 4, le = 6;
420
- return r.width = Math.ceil(R + ie * 2) + 20, r.height = Math.ceil(se + le * 2), a.font = `italic ${d}px cursive`, a.fillStyle = "black", a.textAlign = "center", a.textBaseline = "middle", a.fillText(
417
+ const r = globalThis.document.createElement("canvas"), s = r.getContext("2d"), d = 30;
418
+ s.font = `italic ${d}px cursive`;
419
+ const R = s.measureText(t).width, se = d * 1.3, ie = 4, le = 6;
420
+ return r.width = Math.ceil(R + ie * 2) + 20, r.height = Math.ceil(se + le * 2), s.font = `italic ${d}px cursive`, s.fillStyle = "black", s.textAlign = "center", s.textBaseline = "middle", s.fillText(
421
421
  t,
422
422
  r.width / 2,
423
423
  r.height / 2
424
424
  ), r.toDataURL("image/png");
425
425
  }
426
- const Y = P(
426
+ const M = P(
427
427
  (t) => {
428
428
  if (!t) return;
429
429
  const r = t.helpers.structuredContentCommands.getStructuredContentTags(
430
430
  t.state
431
- ), a = /* @__PURE__ */ new Map();
432
- x.current.document?.forEach((i) => {
433
- i.id && a.set(i.id, i.value);
434
- }), x.current.signer?.forEach((i) => {
435
- i.value !== void 0 && a.set(i.id, i.value);
431
+ ), s = /* @__PURE__ */ new Map();
432
+ E.current.document?.forEach((i) => {
433
+ i.id && s.set(i.id, i.value);
434
+ }), E.current.signer?.forEach((i) => {
435
+ i.value !== void 0 && s.set(i.id, i.value);
436
436
  });
437
437
  const d = r.map(({ node: i }) => ({
438
438
  id: i.attrs.id,
439
439
  label: i.attrs.label,
440
- value: a.get(i.attrs.id) ?? i.textContent ?? ""
440
+ value: s.get(i.attrs.id) ?? i.textContent ?? ""
441
441
  })).filter((i) => i.id);
442
- d.length > 0 && (I?.(d), [
443
- ...x.current.document || [],
444
- ...x.current.signer || []
442
+ d.length > 0 && (F?.(d), [
443
+ ...E.current.document || [],
444
+ ...E.current.signer || []
445
445
  ].filter((R) => R.value !== void 0).forEach(
446
446
  (R) => k({
447
447
  id: R.id,
@@ -449,96 +449,98 @@ const ge = ({
449
449
  })
450
450
  ));
451
451
  },
452
- [I, k]
452
+ [F, k]
453
453
  ), j = (t) => {
454
454
  const r = {
455
455
  ...t,
456
456
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
457
457
  };
458
- C((a) => [...a, r]);
458
+ C((s) => [...s, r]);
459
459
  };
460
460
  re(() => T.current ? ((async () => {
461
- const { SuperDoc: r } = await import("./superdoc.es-CqejOF1J.js").then((d) => d.D), a = new r({
461
+ const { SuperDoc: r } = await import("./superdoc.es-CqejOF1J.js").then((d) => d.D), s = new r({
462
462
  selector: T.current,
463
- document: s.source,
463
+ document: a.source,
464
464
  documentMode: "viewing",
465
465
  onReady: () => {
466
- a.activeEditor && Y(a.activeEditor), j({ type: "ready" }), ee(!0);
466
+ s.activeEditor && M(s.activeEditor), j({ type: "ready" }), ee(!0);
467
467
  }
468
468
  });
469
- E.current = a;
469
+ y.current = s;
470
470
  })(), () => {
471
- E.current && (E.current.destroy(), E.current = null);
472
- }) : void 0, [s.source, s.mode, Y]), re(() => {
473
- if (!s.validation?.scroll?.required || !H) return;
471
+ y.current && (y.current.destroy(), y.current = null);
472
+ }) : void 0, [a.source, a.mode, M]), re(() => {
473
+ if (!a.validation?.scroll?.required || !H) return;
474
474
  const t = T.current;
475
475
  if (!t) return;
476
476
  const r = () => {
477
- const { scrollTop: a, scrollHeight: d, clientHeight: i } = t, R = a / (d - i);
477
+ const { scrollTop: s, scrollHeight: d, clientHeight: i } = t, R = s / (d - i);
478
478
  (R >= 0.95 || d <= i) && (V(!0), j({
479
479
  type: "scroll",
480
480
  data: { percent: Math.round(R * 100) }
481
481
  }));
482
482
  };
483
483
  return t.addEventListener("scroll", r), r(), () => t.removeEventListener("scroll", r);
484
- }, [s.validation?.scroll?.required, H]);
484
+ }, [a.validation?.scroll?.required, H]);
485
485
  const X = P(
486
486
  (t, r) => {
487
- z((a) => {
488
- const d = a.get(t), i = new Map(a);
487
+ z((s) => {
488
+ const d = s.get(t), i = new Map(s);
489
489
  return i.set(t, r), k({
490
490
  id: t,
491
491
  value: r
492
492
  }), j({
493
493
  type: "field_change",
494
494
  data: { fieldId: t, value: r, previousValue: d }
495
- }), F?.({
495
+ }), D?.({
496
496
  id: t,
497
497
  value: r,
498
498
  previousValue: d
499
499
  }), i;
500
500
  });
501
501
  },
502
- [F, k]
503
- ), e = P(() => s.validation?.scroll?.required && !y ? !1 : (o.signer || []).every((t) => {
502
+ [D, k]
503
+ ), e = P(() => a.validation?.scroll?.required && !x ? !1 : (o.signer || []).every((t) => {
504
504
  if (!t.validation?.required) return !0;
505
- const r = h.get(t.id);
505
+ const r = v.get(t.id);
506
506
  return r && (typeof r != "string" || r.trim());
507
- }), [y, o.signer, h, s.validation?.scroll?.required]);
507
+ }), [x, o.signer, v, a.validation?.scroll?.required]);
508
508
  re(() => {
509
509
  const t = e();
510
- B(t), q?.({
511
- scrolled: y,
512
- fields: h,
510
+ B(t), W?.({
511
+ scrolled: x,
512
+ fields: v,
513
513
  isValid: t,
514
514
  isSubmitting: S
515
515
  });
516
- }, [y, h, S, e, q]);
516
+ }, [x, v, S, e, W]);
517
517
  const n = P(async () => {
518
- if (b) return;
519
- const t = await E.current?.export({
520
- exportType: ["pdf"],
521
- isFinalDoc: !0,
522
- triggerDownload: !1
523
- });
524
- if (t && D)
525
- D(t, c?.fileName || "document.pdf");
526
- else if (t) {
527
- const r = URL.createObjectURL(t), a = globalThis.document.createElement("a");
528
- a.href = r, a.download = c?.fileName || "document.pdf", a.click(), URL.revokeObjectURL(r);
529
- }
530
- }, [b, c, D]), l = P(async () => {
531
- if (!w || b || S) return;
518
+ if (h) return;
519
+ const t = {
520
+ eventId: f,
521
+ documentSource: a.source,
522
+ fields: {
523
+ document: o.document || [],
524
+ signer: (o.signer || []).map((r) => ({
525
+ id: r.id,
526
+ value: v.get(r.id) ?? null
527
+ }))
528
+ },
529
+ fileName: u?.fileName || "document.pdf"
530
+ };
531
+ await L?.(t);
532
+ }, [h, f, a.source, o, v, u, L]), l = P(async () => {
533
+ if (!w || h || S) return;
532
534
  J(!0), j({ type: "submit" });
533
535
  const t = {
534
- eventId: m,
536
+ eventId: f,
535
537
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
536
538
  duration: Math.floor((Date.now() - te.current) / 1e3),
537
- auditTrail: M,
539
+ auditTrail: I,
538
540
  documentFields: o.document || [],
539
541
  signerFields: (o.signer || []).map((r) => ({
540
542
  id: r.id,
541
- value: h.get(r.id) ?? null
543
+ value: v.get(r.id) ?? null
542
544
  })),
543
545
  isFullyCompleted: w
544
546
  };
@@ -549,21 +551,21 @@ const ge = ({
549
551
  }
550
552
  }, [
551
553
  w,
552
- b,
554
+ h,
553
555
  S,
554
- m,
555
- M,
556
+ f,
557
+ I,
556
558
  o,
557
- h,
559
+ v,
558
560
  _
559
- ]), u = (t) => {
561
+ ]), c = (t) => {
560
562
  const r = t.component || O(t.type);
561
563
  return /* @__PURE__ */ p.jsx(
562
564
  r,
563
565
  {
564
- value: h.get(t.id) ?? null,
565
- onChange: (a) => X(t.id, a),
566
- isDisabled: b,
566
+ value: v.get(t.id) ?? null,
567
+ onChange: (s) => X(t.id, s),
568
+ isDisabled: h,
567
569
  label: t.label
568
570
  },
569
571
  t.id
@@ -576,20 +578,20 @@ const ge = ({
576
578
  case "checkbox":
577
579
  return ve;
578
580
  }
579
- }, $ = () => {
580
- const t = c?.component || be(c), r = v?.component || he(v);
581
+ }, Y = () => {
582
+ const t = u?.component || be(u), r = b?.component || he(b);
581
583
  return /* @__PURE__ */ p.jsxs(
582
584
  "div",
583
585
  {
584
586
  className: "superdoc-esign-actions",
585
587
  style: { display: "flex", gap: "10px" },
586
588
  children: [
587
- s.mode !== "download" && /* @__PURE__ */ p.jsx(
589
+ a.mode !== "download" && /* @__PURE__ */ p.jsx(
588
590
  r,
589
591
  {
590
592
  onClick: l,
591
593
  isValid: w,
592
- isDisabled: b,
594
+ isDisabled: h,
593
595
  isSubmitting: S
594
596
  }
595
597
  ),
@@ -597,8 +599,8 @@ const ge = ({
597
599
  t,
598
600
  {
599
601
  onClick: n,
600
- fileName: c?.fileName,
601
- isDisabled: b
602
+ fileName: u?.fileName,
603
+ isDisabled: h
602
604
  }
603
605
  )
604
606
  ]
@@ -607,20 +609,20 @@ const ge = ({
607
609
  };
608
610
  return de(g, () => ({
609
611
  getState: () => ({
610
- scrolled: y,
611
- fields: h,
612
+ scrolled: x,
613
+ fields: v,
612
614
  isValid: w,
613
615
  isSubmitting: S
614
616
  }),
615
- getAuditTrail: () => M,
617
+ getAuditTrail: () => I,
616
618
  reset: () => {
617
- V(!s.validation?.scroll?.required), z(/* @__PURE__ */ new Map()), B(!1), C([]);
619
+ V(!a.validation?.scroll?.required), z(/* @__PURE__ */ new Map()), B(!1), C([]);
618
620
  }
619
621
  })), /* @__PURE__ */ p.jsxs(
620
622
  "div",
621
623
  {
622
624
  className: `superdoc-esign-container ${A || ""}`,
623
- style: W,
625
+ style: U,
624
626
  children: [
625
627
  /* @__PURE__ */ p.jsx("div", { className: "superdoc-esign-document", children: /* @__PURE__ */ p.jsx(
626
628
  "div",
@@ -635,10 +637,10 @@ const ge = ({
635
637
  {
636
638
  className: "superdoc-esign-fields",
637
639
  style: { marginBottom: "20px" },
638
- children: o.signer.map(u)
640
+ children: o.signer.map(c)
639
641
  }
640
642
  ),
641
- $()
643
+ Y()
642
644
  ] })
643
645
  ]
644
646
  }
package/dist/types.d.ts CHANGED
@@ -61,7 +61,7 @@ export interface SuperDocESignProps {
61
61
  download?: DownloadConfig;
62
62
  submit?: SubmitConfig;
63
63
  onSubmit: (data: SubmitData) => void | Promise<void>;
64
- onDownload?: (blob: Blob, fileName: string) => void;
64
+ onDownload?: (data: DownloadData) => void | Promise<void>;
65
65
  onStateChange?: (state: SigningState) => void;
66
66
  onFieldChange?: (field: FieldChange) => void;
67
67
  onFieldsDiscovered?: (fields: FieldInfo[]) => void;
@@ -76,6 +76,15 @@ export interface SigningState {
76
76
  isValid: boolean;
77
77
  isSubmitting: boolean;
78
78
  }
79
+ export interface DownloadData {
80
+ eventId: string;
81
+ documentSource: string | File | Blob;
82
+ fields: {
83
+ document: DocumentField[];
84
+ signer: SignerFieldValue[];
85
+ };
86
+ fileName: string;
87
+ }
79
88
  export interface SubmitData {
80
89
  eventId: string;
81
90
  timestamp: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEtE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE;QACX,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CA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AAa,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3D,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC;AACxC,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG;IAAE,aAAa,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,UAAU,CAAC;CACnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/esign",
3
- "version": "1.1.2",
3
+ "version": "1.2.0-next.1",
4
4
  "description": "React eSignature component for SuperDoc",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",