@superdoc-dev/esign 1.5.0 → 2.0.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/README.md +11 -11
- package/dist/__tests__/signature.test.d.ts +2 -0
- package/dist/__tests__/signature.test.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +245 -219
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/signature.d.ts +2 -0
- package/dist/utils/signature.d.ts.map +1 -0
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -37,22 +37,22 @@ function App() {
|
|
|
37
37
|
|
|
38
38
|
fields={{
|
|
39
39
|
document: [
|
|
40
|
-
{ id: '
|
|
41
|
-
{ id: '
|
|
42
|
-
{ id: '
|
|
43
|
-
{ id: '
|
|
44
|
-
{ id: '
|
|
45
|
-
{ id: '
|
|
40
|
+
{ id: '1', value: 'John Doe' },
|
|
41
|
+
{ id: '2', value: new Date().toLocaleDateString() },
|
|
42
|
+
{ id: '3', value: 'SuperDoc' },
|
|
43
|
+
{ id: '4', value: 'Premium' },
|
|
44
|
+
{ id: '5', value: 'CA' },
|
|
45
|
+
{ id: '6', value: '123 Main St, Anytown, USA' }
|
|
46
46
|
],
|
|
47
47
|
signer: [
|
|
48
48
|
{
|
|
49
|
-
id: '
|
|
49
|
+
id: '7',
|
|
50
50
|
type: 'signature',
|
|
51
51
|
validation: { required: true },
|
|
52
52
|
label: 'Type your full name'
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
id: '
|
|
55
|
+
id: '8',
|
|
56
56
|
type: 'checkbox',
|
|
57
57
|
validation: { required: true },
|
|
58
58
|
label: 'I accept the terms'
|
|
@@ -118,11 +118,11 @@ See [Python, Node.js, and more examples](https://docs.superdoc.dev/solutions/esi
|
|
|
118
118
|
timestamp: "2024-01-15T10:30:00Z",
|
|
119
119
|
duration: 45000,
|
|
120
120
|
documentFields: [
|
|
121
|
-
{ id: "
|
|
121
|
+
{ id: "1", value: "John Doe" }
|
|
122
122
|
],
|
|
123
123
|
signerFields: [
|
|
124
|
-
{ id: "
|
|
125
|
-
{ id: "
|
|
124
|
+
{ id: "7", value: "John Doe" },
|
|
125
|
+
{ id: "8", value: true }
|
|
126
126
|
],
|
|
127
127
|
auditTrail: [
|
|
128
128
|
{ type: "ready", timestamp: "..." },
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/signature.test.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { textToImageDataUrl } from './utils/signature';
|
|
1
2
|
import { SignatureInput, CheckboxInput } from './defaults';
|
|
2
3
|
import type * as Types from './types';
|
|
3
4
|
export * from './types';
|
|
5
|
+
export { textToImageDataUrl };
|
|
4
6
|
export { SignatureInput, CheckboxInput };
|
|
5
7
|
declare const SuperDocESign: import('react').ForwardRefExoticComponent<Types.SuperDocESignProps & import('react').RefAttributes<Types.SuperDocESignHandle>>;
|
|
6
8
|
export default SuperDocESign;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AACtC,OAAO,EACL,cAAc,EACd,aAAa,EAGd,MAAM,YAAY,CAAC;AAEpB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAIzC,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,aAAa,EAGd,MAAM,YAAY,CAAC;AAEpB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAIzC,QAAA,MAAM,aAAa,gIAuflB,CAAC;AAIF,eAAe,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var ye=Object.create;var J=Object.defineProperty;var be=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,we=Object.prototype.hasOwnProperty;var Ce=(i,c,r,n)=>{if(c&&typeof c=="object"||typeof c=="function")for(let o of xe(c))!we.call(i,o)&&o!==r&&J(i,o,{get:()=>c[o],enumerable:!(n=be(c,o))||n.enumerable});return i};var De=(i,c,r)=>(r=i!=null?ye(Se(i)):{},Ce(c||!i||!i.__esModule?J(r,"default",{value:i,enumerable:!0}):r,i));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),a=require("react"),Q=i=>{const c=globalThis.document.createElement("canvas"),r=c.getContext("2d"),n=30;r.font=`italic ${n}px cursive`;const u=r.measureText(i).width,f=n*1.3,g=4,M=6;return c.width=Math.ceil(u+g*2)+20,c.height=Math.ceil(f+M*2),r.font=`italic ${n}px cursive`,r.fillStyle="black",r.textAlign="center",r.textBaseline="middle",r.fillText(i,c.width/2,c.height/2),c.toDataURL("image/png")},Z=({value:i,onChange:c,isDisabled:r,label:n})=>l.jsxs("div",{className:"superdoc-esign-signature-input",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n&&l.jsx("label",{children:n}),l.jsx("input",{type:"text",value:String(i||""),onChange:o=>c(o.target.value),disabled:r,placeholder:"Type your full name",style:{fontFamily:"cursive",fontSize:"18px"}})]}),ee=({value:i,onChange:c,isDisabled:r,label:n})=>l.jsxs("label",{className:"superdoc-esign-checkbox-input",style:{display:"flex",gap:"8px"},children:[l.jsx("input",{type:"checkbox",checked:!!i,onChange:o=>c(o.target.checked),disabled:r}),l.jsx("span",{children:n})]}),je=i=>({onClick:r,fileName:n,isDisabled:o,isDownloading:u})=>{const f=i?.label||"Download",g=o||u;return l.jsxs("button",{onClick:r,disabled:g,className:`superdoc-esign-btn superdoc-esign-btn--download${u?" superdoc-esign-btn--loading":""}`,style:{padding:"8px 16px",borderRadius:"6px",border:"1px solid #d0d5dd",background:"#ffffff",color:"#333",cursor:g?"not-allowed":"pointer",opacity:g?.7:1,fontSize:"16px",fontWeight:"bold",display:"inline-flex",alignItems:"center",gap:"8px",transition:"opacity 0.2s ease"},children:[u&&l.jsx("span",{className:"superdoc-esign-spinner"}),u?"Downloading...":f,!u&&n&&` (${n})`]})},Me=i=>({onClick:r,isValid:n,isDisabled:o,isSubmitting:u})=>{const f=i?.label||"Submit",g=!n||o||u;return l.jsxs("button",{onClick:r,disabled:g,className:`superdoc-esign-btn superdoc-esign-btn--submit${u?" superdoc-esign-btn--loading":""}`,style:{padding:"12px 24px",borderRadius:"6px",border:"none",background:"#007bff",color:"#fff",cursor:g?"not-allowed":"pointer",opacity:g&&!u?.5:1,fontSize:"16px",fontWeight:"bold",display:"inline-flex",alignItems:"center",gap:"8px",transition:"opacity 0.2s ease"},children:[u&&l.jsx("span",{className:"superdoc-esign-spinner superdoc-esign-spinner--light"}),u?"Submitting...":f]})},te=a.forwardRef((i,c)=>{const{eventId:r,document:n,fields:o={},download:u,submit:f,onSubmit:g,onDownload:M,onStateChange:F,onFieldChange:A,onFieldsDiscovered:q,isDisabled:h=!1,className:ne,style:se,documentHeight:oe="600px"}=i,[b,_]=a.useState(!n.validation?.scroll?.required),[m,B]=a.useState(new Map),[x,V]=a.useState(!1),[v,U]=a.useState(!1),[N,z]=a.useState(!1),[O,$]=a.useState([]),[H,re]=a.useState(!1),R=a.useRef(null),T=a.useRef(null),ae=a.useRef(Date.now()),S=a.useRef(o),w=a.useRef([]),P=a.useRef(q);S.current=o,P.current=q,a.useEffect(()=>{w.current=O},[O]);const y=a.useCallback(e=>{if(!T.current?.activeEditor)return;const t=T.current.activeEditor,d=S.current.signer?.find(s=>s.id===e.id);if(e.type==="table"&&Array.isArray(e.value)){const D=t.helpers?.structuredContentCommands?.getStructuredContentTablesById?.(e.id,t.state)||[];if(D.length){const{node:k,pos:fe}=D[0],X=k.childCount;if(X>1){let j=t.state.tr;for(let E=X-1;E>=1;E--){let Y=1;for(let I=0;I<E;I++)Y+=k.child(I).nodeSize;const he=k.child(E),G=fe+Y,ve=G+he.nodeSize;j=j.delete(j.mapping.map(G),j.mapping.map(ve))}t.view?.dispatch(j)}t.commands?.appendRowsToStructuredContentTable?.({id:e.id,rows:e.value,copyRowStyle:!0})}return}let p;d?.type==="signature"&&e.value?p={json:{type:"image",attrs:{src:typeof e.value=="string"&&e.value.startsWith("data:image/")?e.value:Q(String(e.value)),alt:"Signature"}}}:p={text:String(e.value??"")},e.id&&t.commands?.updateStructuredContentById?.(e.id,p)},[]),W=a.useCallback(e=>{if(!e)return;const t=e.helpers.structuredContentCommands.getStructuredContentTags(e.state),d=new Map;S.current.document?.forEach(s=>{s.id&&d.set(s.id,s.value)}),S.current.signer?.forEach(s=>{s.value!==void 0&&d.set(s.id,s.value)});const p=t.map(({node:s})=>({id:s.attrs.id,label:s.attrs.label,value:d.get(s.attrs.id)??s.textContent??""})).filter(s=>s.id);p.length>0&&(P.current?.(p),(S.current.document||[]).filter(s=>s.value!==void 0).forEach(s=>y({id:s.id,value:s.value,type:s.type})),(S.current.signer||[]).filter(s=>s.value!==void 0).forEach(s=>y({id:s.id,value:s.value})))},[y]),C=e=>{const t={...e,timestamp:new Date().toISOString()},d=globalThis?.__SUPERDOC_AUDIT_MOCK__;d&&d(t);const p=[...w.current,t];return w.current=p,$(p),p};a.useEffect(()=>{if(!R.current)return;let e=!1,t=null;return(async()=>{const{SuperDoc:p}=await import("superdoc");e||(t=new p({selector:R.current,document:n.source,documentMode:"viewing",modules:{comments:!1},layoutMode:n.layoutMode,layoutMargins:n.layoutMargins,onReady:()=>{e||(t?.activeEditor&&W(t.activeEditor),C({type:"ready"}),re(!0))}}),T.current=t)})(),()=>{e=!0,t&&typeof t.destroy=="function"&&t.destroy(),T.current=null}},[n.source,n.mode,n.layoutMode,n.layoutMargins?.top,n.layoutMargins?.bottom,n.layoutMargins?.left,n.layoutMargins?.right,W]),a.useEffect(()=>{if(!n.validation?.scroll?.required||!H)return;const e=R.current;if(!e)return;const t=()=>{const{scrollTop:d,scrollHeight:p,clientHeight:s}=e,D=d/(p-s);(D>=.95||p<=s)&&(_(!0),C({type:"scroll",data:{percent:Math.round(D*100)}}))};return e.addEventListener("scroll",t),t(),()=>e.removeEventListener("scroll",t)},[n.validation?.scroll?.required,H]);const ie=a.useCallback((e,t)=>{B(d=>{const p=d.get(e),s=new Map(d);return s.set(e,t),y({id:e,value:t}),C({type:"field_change",data:{fieldId:e,value:t,previousValue:p}}),A?.({id:e,value:t,previousValue:p}),s})},[A,y]),L=a.useCallback(()=>n.validation?.scroll?.required&&!b?!1:(o.signer||[]).every(e=>{if(!e.validation?.required)return!0;const t=m.get(e.id);return t&&(typeof t!="string"||t.trim())}),[b,o.signer,m,n.validation?.scroll?.required]);a.useEffect(()=>{const e=L();V(e),F?.({scrolled:b,fields:m,isValid:e,isSubmitting:v})},[b,m,v,L,F]);const ce=a.useCallback(async()=>{if(h||N)return;z(!0);const e={eventId:r,documentSource:n.source,fields:{document:o.document||[],signer:(o.signer||[]).map(t=>({id:t.id,value:m.get(t.id)??null}))},fileName:u?.fileName||"document.pdf"};try{await M?.(e)}finally{z(!1)}},[h,N,r,n.source,o,m,u,M]),le=a.useCallback(async()=>{if(!x||h||v)return;U(!0),C({type:"submit"});const e=C({type:"submit"}),t={eventId:r,timestamp:new Date().toISOString(),duration:Math.floor((Date.now()-ae.current)/1e3),auditTrail:e,documentFields:o.document||[],signerFields:(o.signer||[]).map(d=>({id:d.id,value:m.get(d.id)??null})),isFullyCompleted:x};try{await g(t)}finally{U(!1)}},[x,h,v,r,o,m,g]),ue=e=>{const t=e.component||de(e.type);return l.jsx(t,{value:m.get(e.id)??null,onChange:d=>ie(e.id,d),isDisabled:h,label:e.label},e.id)},de=e=>{switch(e){case"signature":case"text":return Z;case"checkbox":return ee}},pe=()=>{const e=u?.component||je(u);return e?l.jsx(e,{onClick:ce,fileName:u?.fileName,isDisabled:h,isDownloading:N}):null},ge=()=>{if(n.mode==="download")return null;const e=f?.component||Me(f);return l.jsx("div",{className:"superdoc-esign-actions superdoc-esign-form-actions",children:l.jsx(e,{onClick:le,isValid:x,isDisabled:h,isSubmitting:v})})},K=pe(),me=ge();return a.useImperativeHandle(c,()=>({getState:()=>({scrolled:b,fields:m,isValid:x,isSubmitting:v}),getAuditTrail:()=>w.current,reset:()=>{_(!n.validation?.scroll?.required),B(new Map),V(!1),w.current=[],$([])},updateFieldInDocument:y}),[b,m,x,v,n.validation?.scroll?.required,y]),l.jsxs("div",{className:`superdoc-esign-container ${ne||""}`,style:se,children:[l.jsxs("div",{className:"superdoc-esign-document","data-testid":"superdoc-esign-document",children:[K&&l.jsx("div",{className:"superdoc-esign-document-toolbar",children:l.jsx("div",{className:"superdoc-esign-document-controls",children:K})}),l.jsx("div",{ref:R,className:"superdoc-esign-document-viewer","data-testid":"superdoc-scroll-container",style:{height:oe,overflow:"auto"}})]}),l.jsxs("div",{className:"superdoc-esign-controls","data-testid":"superdoc-esign-controls",children:[o.signer&&o.signer.length>0&&l.jsx("div",{className:"superdoc-esign-fields","data-testid":"superdoc-esign-fields",children:o.signer.map(ue)}),me]})]})});te.displayName="SuperDocESign";exports.CheckboxInput=ee;exports.SignatureInput=Z;exports.default=te;exports.textToImageDataUrl=Q;
|
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import { jsxs as b, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ye, useState as v, useRef as C, useEffect as A, useCallback as D, useImperativeHandle as ve } from "react";
|
|
3
|
+
const be = (u) => {
|
|
4
|
+
const l = globalThis.document.createElement("canvas"), s = l.getContext("2d"), o = 30;
|
|
5
|
+
s.font = `italic ${o}px cursive`;
|
|
6
|
+
const a = s.measureText(u).width, m = o * 1.3, p = 4, R = 6;
|
|
7
|
+
return l.width = Math.ceil(a + p * 2) + 20, l.height = Math.ceil(m + R * 2), s.font = `italic ${o}px cursive`, s.fillStyle = "black", s.textAlign = "center", s.textBaseline = "middle", s.fillText(u, l.width / 2, l.height / 2), l.toDataURL("image/png");
|
|
8
|
+
}, xe = ({
|
|
9
|
+
value: u,
|
|
10
|
+
onChange: l,
|
|
11
|
+
isDisabled: s,
|
|
12
|
+
label: o
|
|
13
|
+
}) => /* @__PURE__ */ b(
|
|
9
14
|
"div",
|
|
10
15
|
{
|
|
11
16
|
className: "superdoc-esign-signature-input",
|
|
12
17
|
style: { display: "flex", flexDirection: "column", gap: "8px" },
|
|
13
18
|
children: [
|
|
14
|
-
|
|
15
|
-
/* @__PURE__ */
|
|
19
|
+
o && /* @__PURE__ */ d("label", { children: o }),
|
|
20
|
+
/* @__PURE__ */ d(
|
|
16
21
|
"input",
|
|
17
22
|
{
|
|
18
23
|
type: "text",
|
|
19
|
-
value: String(
|
|
20
|
-
onChange: (
|
|
21
|
-
disabled:
|
|
24
|
+
value: String(u || ""),
|
|
25
|
+
onChange: (r) => l(r.target.value),
|
|
26
|
+
disabled: s,
|
|
22
27
|
placeholder: "Type your full name",
|
|
23
28
|
style: {
|
|
24
29
|
fontFamily: "cursive",
|
|
@@ -28,34 +33,34 @@ const ge = ({
|
|
|
28
33
|
)
|
|
29
34
|
]
|
|
30
35
|
}
|
|
31
|
-
),
|
|
32
|
-
value:
|
|
33
|
-
onChange:
|
|
34
|
-
isDisabled:
|
|
35
|
-
label:
|
|
36
|
-
}) => /* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
36
|
+
), we = ({
|
|
37
|
+
value: u,
|
|
38
|
+
onChange: l,
|
|
39
|
+
isDisabled: s,
|
|
40
|
+
label: o
|
|
41
|
+
}) => /* @__PURE__ */ b("label", { className: "superdoc-esign-checkbox-input", style: { display: "flex", gap: "8px" }, children: [
|
|
42
|
+
/* @__PURE__ */ d(
|
|
38
43
|
"input",
|
|
39
44
|
{
|
|
40
45
|
type: "checkbox",
|
|
41
|
-
checked: !!
|
|
42
|
-
onChange: (
|
|
43
|
-
disabled:
|
|
46
|
+
checked: !!u,
|
|
47
|
+
onChange: (r) => l(r.target.checked),
|
|
48
|
+
disabled: s
|
|
44
49
|
}
|
|
45
50
|
),
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
] }),
|
|
48
|
-
onClick:
|
|
49
|
-
fileName:
|
|
50
|
-
isDisabled:
|
|
51
|
+
/* @__PURE__ */ d("span", { children: o })
|
|
52
|
+
] }), Se = (u) => ({
|
|
53
|
+
onClick: s,
|
|
54
|
+
fileName: o,
|
|
55
|
+
isDisabled: r,
|
|
51
56
|
isDownloading: a
|
|
52
57
|
}) => {
|
|
53
|
-
const
|
|
54
|
-
return /* @__PURE__ */
|
|
58
|
+
const m = u?.label || "Download", p = r || a;
|
|
59
|
+
return /* @__PURE__ */ b(
|
|
55
60
|
"button",
|
|
56
61
|
{
|
|
57
|
-
onClick:
|
|
58
|
-
disabled:
|
|
62
|
+
onClick: s,
|
|
63
|
+
disabled: p,
|
|
59
64
|
className: `superdoc-esign-btn superdoc-esign-btn--download${a ? " superdoc-esign-btn--loading" : ""}`,
|
|
60
65
|
style: {
|
|
61
66
|
padding: "8px 16px",
|
|
@@ -63,8 +68,8 @@ const ge = ({
|
|
|
63
68
|
border: "1px solid #d0d5dd",
|
|
64
69
|
background: "#ffffff",
|
|
65
70
|
color: "#333",
|
|
66
|
-
cursor:
|
|
67
|
-
opacity:
|
|
71
|
+
cursor: p ? "not-allowed" : "pointer",
|
|
72
|
+
opacity: p ? 0.7 : 1,
|
|
68
73
|
fontSize: "16px",
|
|
69
74
|
fontWeight: "bold",
|
|
70
75
|
display: "inline-flex",
|
|
@@ -73,24 +78,24 @@ const ge = ({
|
|
|
73
78
|
transition: "opacity 0.2s ease"
|
|
74
79
|
},
|
|
75
80
|
children: [
|
|
76
|
-
a && /* @__PURE__ */
|
|
77
|
-
a ? "Downloading..." :
|
|
78
|
-
!a &&
|
|
81
|
+
a && /* @__PURE__ */ d("span", { className: "superdoc-esign-spinner" }),
|
|
82
|
+
a ? "Downloading..." : m,
|
|
83
|
+
!a && o && ` (${o})`
|
|
79
84
|
]
|
|
80
85
|
}
|
|
81
86
|
);
|
|
82
|
-
},
|
|
83
|
-
onClick:
|
|
84
|
-
isValid:
|
|
85
|
-
isDisabled:
|
|
87
|
+
}, Ce = (u) => ({
|
|
88
|
+
onClick: s,
|
|
89
|
+
isValid: o,
|
|
90
|
+
isDisabled: r,
|
|
86
91
|
isSubmitting: a
|
|
87
92
|
}) => {
|
|
88
|
-
const
|
|
89
|
-
return /* @__PURE__ */
|
|
93
|
+
const m = u?.label || "Submit", p = !o || r || a;
|
|
94
|
+
return /* @__PURE__ */ b(
|
|
90
95
|
"button",
|
|
91
96
|
{
|
|
92
|
-
onClick:
|
|
93
|
-
disabled:
|
|
97
|
+
onClick: s,
|
|
98
|
+
disabled: p,
|
|
94
99
|
className: `superdoc-esign-btn superdoc-esign-btn--submit${a ? " superdoc-esign-btn--loading" : ""}`,
|
|
95
100
|
style: {
|
|
96
101
|
padding: "12px 24px",
|
|
@@ -98,8 +103,8 @@ const ge = ({
|
|
|
98
103
|
border: "none",
|
|
99
104
|
background: "#007bff",
|
|
100
105
|
color: "#fff",
|
|
101
|
-
cursor:
|
|
102
|
-
opacity:
|
|
106
|
+
cursor: p ? "not-allowed" : "pointer",
|
|
107
|
+
opacity: p && !a ? 0.5 : 1,
|
|
103
108
|
fontSize: "16px",
|
|
104
109
|
fontWeight: "bold",
|
|
105
110
|
display: "inline-flex",
|
|
@@ -108,300 +113,321 @@ const ge = ({
|
|
|
108
113
|
transition: "opacity 0.2s ease"
|
|
109
114
|
},
|
|
110
115
|
children: [
|
|
111
|
-
a && /* @__PURE__ */
|
|
112
|
-
a ? "Submitting..." :
|
|
116
|
+
a && /* @__PURE__ */ d("span", { className: "superdoc-esign-spinner superdoc-esign-spinner--light" }),
|
|
117
|
+
a ? "Submitting..." : m
|
|
113
118
|
]
|
|
114
119
|
}
|
|
115
120
|
);
|
|
116
|
-
},
|
|
117
|
-
(
|
|
121
|
+
}, De = ye(
|
|
122
|
+
(u, l) => {
|
|
118
123
|
const {
|
|
119
|
-
eventId:
|
|
120
|
-
document:
|
|
121
|
-
fields:
|
|
124
|
+
eventId: s,
|
|
125
|
+
document: o,
|
|
126
|
+
fields: r = {},
|
|
122
127
|
download: a,
|
|
123
|
-
submit:
|
|
124
|
-
onSubmit:
|
|
125
|
-
onDownload:
|
|
126
|
-
onStateChange:
|
|
127
|
-
onFieldChange:
|
|
128
|
-
onFieldsDiscovered:
|
|
128
|
+
submit: m,
|
|
129
|
+
onSubmit: p,
|
|
130
|
+
onDownload: R,
|
|
131
|
+
onStateChange: _,
|
|
132
|
+
onFieldChange: z,
|
|
133
|
+
onFieldsDiscovered: U,
|
|
129
134
|
isDisabled: f = !1,
|
|
130
|
-
className:
|
|
131
|
-
style:
|
|
132
|
-
documentHeight:
|
|
133
|
-
} =
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}, [
|
|
137
|
-
const
|
|
135
|
+
className: te,
|
|
136
|
+
style: ne,
|
|
137
|
+
documentHeight: oe = "600px"
|
|
138
|
+
} = u, [x, $] = v(!o.validation?.scroll?.required), [g, H] = v(/* @__PURE__ */ new Map()), [w, O] = v(!1), [h, j] = v(!1), [q, P] = v(!1), [W, L] = v([]), [K, re] = v(!1), k = C(null), F = C(null), se = C(Date.now()), S = C(r), M = C([]), X = C(U);
|
|
139
|
+
S.current = r, X.current = U, A(() => {
|
|
140
|
+
M.current = W;
|
|
141
|
+
}, [W]);
|
|
142
|
+
const y = D((e) => {
|
|
138
143
|
if (!F.current?.activeEditor) return;
|
|
139
|
-
const t = F.current.activeEditor,
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
const t = F.current.activeEditor, i = S.current.signer?.find((n) => n.id === e.id);
|
|
145
|
+
if (e.type === "table" && Array.isArray(e.value)) {
|
|
146
|
+
const T = t.helpers?.structuredContentCommands?.getStructuredContentTablesById?.(e.id, t.state) || [];
|
|
147
|
+
if (T.length) {
|
|
148
|
+
const { node: B, pos: me } = T[0], Q = B.childCount;
|
|
149
|
+
if (Q > 1) {
|
|
150
|
+
let E = t.state.tr;
|
|
151
|
+
for (let I = Q - 1; I >= 1; I--) {
|
|
152
|
+
let Z = 1;
|
|
153
|
+
for (let V = 0; V < I; V++)
|
|
154
|
+
Z += B.child(V).nodeSize;
|
|
155
|
+
const fe = B.child(I), ee = me + Z, he = ee + fe.nodeSize;
|
|
156
|
+
E = E.delete(E.mapping.map(ee), E.mapping.map(he));
|
|
157
|
+
}
|
|
158
|
+
t.view?.dispatch(E);
|
|
159
|
+
}
|
|
160
|
+
t.commands?.appendRowsToStructuredContentTable?.({
|
|
161
|
+
id: e.id,
|
|
162
|
+
rows: e.value,
|
|
163
|
+
copyRowStyle: !0
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
let c;
|
|
169
|
+
i?.type === "signature" && e.value ? c = {
|
|
142
170
|
json: {
|
|
143
171
|
type: "image",
|
|
144
|
-
attrs: { src: typeof e.value == "string" && e.value.startsWith("data:image/") ? e.value :
|
|
172
|
+
attrs: { src: typeof e.value == "string" && e.value.startsWith("data:image/") ? e.value : be(String(e.value)), alt: "Signature" }
|
|
145
173
|
}
|
|
146
|
-
} :
|
|
147
|
-
}, [])
|
|
148
|
-
function Z(e) {
|
|
149
|
-
const t = globalThis.document.createElement("canvas"), o = t.getContext("2d"), r = 30;
|
|
150
|
-
o.font = `italic ${r}px cursive`;
|
|
151
|
-
const g = o.measureText(e).width, ce = r * 1.3, le = 4, de = 6;
|
|
152
|
-
return t.width = Math.ceil(g + le * 2) + 20, t.height = Math.ceil(ce + de * 2), o.font = `italic ${r}px cursive`, o.fillStyle = "black", o.textAlign = "center", o.textBaseline = "middle", o.fillText(e, t.width / 2, t.height / 2), t.toDataURL("image/png");
|
|
153
|
-
}
|
|
154
|
-
const L = M(
|
|
174
|
+
} : c = { text: String(e.value ?? "") }, e.id && t.commands?.updateStructuredContentById?.(e.id, c);
|
|
175
|
+
}, []), Y = D(
|
|
155
176
|
(e) => {
|
|
156
177
|
if (!e) return;
|
|
157
178
|
const t = e.helpers.structuredContentCommands.getStructuredContentTags(
|
|
158
179
|
e.state
|
|
159
|
-
),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}),
|
|
163
|
-
|
|
180
|
+
), i = /* @__PURE__ */ new Map();
|
|
181
|
+
S.current.document?.forEach((n) => {
|
|
182
|
+
n.id && i.set(n.id, n.value);
|
|
183
|
+
}), S.current.signer?.forEach((n) => {
|
|
184
|
+
n.value !== void 0 && i.set(n.id, n.value);
|
|
164
185
|
});
|
|
165
|
-
const
|
|
166
|
-
id:
|
|
167
|
-
label:
|
|
168
|
-
value:
|
|
169
|
-
})).filter((
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
186
|
+
const c = t.map(({ node: n }) => ({
|
|
187
|
+
id: n.attrs.id,
|
|
188
|
+
label: n.attrs.label,
|
|
189
|
+
value: i.get(n.attrs.id) ?? n.textContent ?? ""
|
|
190
|
+
})).filter((n) => n.id);
|
|
191
|
+
c.length > 0 && (X.current?.(c), (S.current.document || []).filter((n) => n.value !== void 0).forEach(
|
|
192
|
+
(n) => y({
|
|
193
|
+
id: n.id,
|
|
194
|
+
value: n.value,
|
|
195
|
+
type: n.type
|
|
196
|
+
})
|
|
197
|
+
), (S.current.signer || []).filter((n) => n.value !== void 0).forEach(
|
|
198
|
+
(n) => y({
|
|
199
|
+
id: n.id,
|
|
200
|
+
value: n.value
|
|
177
201
|
})
|
|
178
202
|
));
|
|
179
203
|
},
|
|
180
|
-
[
|
|
181
|
-
),
|
|
204
|
+
[y]
|
|
205
|
+
), N = (e) => {
|
|
182
206
|
const t = {
|
|
183
207
|
...e,
|
|
184
208
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
return
|
|
209
|
+
}, i = globalThis?.__SUPERDOC_AUDIT_MOCK__;
|
|
210
|
+
i && i(t);
|
|
211
|
+
const c = [...M.current, t];
|
|
212
|
+
return M.current = c, L(c), c;
|
|
189
213
|
};
|
|
190
|
-
|
|
191
|
-
if (!
|
|
214
|
+
A(() => {
|
|
215
|
+
if (!k.current) return;
|
|
192
216
|
let e = !1, t = null;
|
|
193
217
|
return (async () => {
|
|
194
|
-
const { SuperDoc:
|
|
195
|
-
e || (t = new
|
|
196
|
-
selector:
|
|
197
|
-
document:
|
|
218
|
+
const { SuperDoc: c } = await import("superdoc");
|
|
219
|
+
e || (t = new c({
|
|
220
|
+
selector: k.current,
|
|
221
|
+
document: o.source,
|
|
198
222
|
documentMode: "viewing",
|
|
199
223
|
modules: {
|
|
200
224
|
comments: !1
|
|
201
225
|
},
|
|
202
|
-
layoutMode
|
|
203
|
-
|
|
226
|
+
// @ts-expect-error - layoutMode is not supported in SuperDoc v1.1.0 yet
|
|
227
|
+
layoutMode: o.layoutMode,
|
|
228
|
+
layoutMargins: o.layoutMargins,
|
|
204
229
|
onReady: () => {
|
|
205
|
-
e || (t?.activeEditor &&
|
|
230
|
+
e || (t?.activeEditor && Y(t.activeEditor), N({ type: "ready" }), re(!0));
|
|
206
231
|
}
|
|
207
232
|
}), F.current = t);
|
|
208
233
|
})(), () => {
|
|
209
234
|
e = !0, t && typeof t.destroy == "function" && t.destroy(), F.current = null;
|
|
210
235
|
};
|
|
211
236
|
}, [
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
]),
|
|
221
|
-
if (!
|
|
222
|
-
const e =
|
|
237
|
+
o.source,
|
|
238
|
+
o.mode,
|
|
239
|
+
o.layoutMode,
|
|
240
|
+
o.layoutMargins?.top,
|
|
241
|
+
o.layoutMargins?.bottom,
|
|
242
|
+
o.layoutMargins?.left,
|
|
243
|
+
o.layoutMargins?.right,
|
|
244
|
+
Y
|
|
245
|
+
]), A(() => {
|
|
246
|
+
if (!o.validation?.scroll?.required || !K) return;
|
|
247
|
+
const e = k.current;
|
|
223
248
|
if (!e) return;
|
|
224
249
|
const t = () => {
|
|
225
|
-
const { scrollTop:
|
|
226
|
-
(
|
|
250
|
+
const { scrollTop: i, scrollHeight: c, clientHeight: n } = e, T = i / (c - n);
|
|
251
|
+
(T >= 0.95 || c <= n) && ($(!0), N({
|
|
227
252
|
type: "scroll",
|
|
228
|
-
data: { percent: Math.round(
|
|
253
|
+
data: { percent: Math.round(T * 100) }
|
|
229
254
|
}));
|
|
230
255
|
};
|
|
231
256
|
return e.addEventListener("scroll", t), t(), () => e.removeEventListener("scroll", t);
|
|
232
|
-
}, [
|
|
233
|
-
const
|
|
257
|
+
}, [o.validation?.scroll?.required, K]);
|
|
258
|
+
const ae = D(
|
|
234
259
|
(e, t) => {
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
return
|
|
260
|
+
H((i) => {
|
|
261
|
+
const c = i.get(e), n = new Map(i);
|
|
262
|
+
return n.set(e, t), y({
|
|
238
263
|
id: e,
|
|
239
264
|
value: t
|
|
240
|
-
}),
|
|
265
|
+
}), N({
|
|
241
266
|
type: "field_change",
|
|
242
|
-
data: { fieldId: e, value: t, previousValue:
|
|
243
|
-
}),
|
|
267
|
+
data: { fieldId: e, value: t, previousValue: c }
|
|
268
|
+
}), z?.({
|
|
244
269
|
id: e,
|
|
245
270
|
value: t,
|
|
246
|
-
previousValue:
|
|
247
|
-
}),
|
|
271
|
+
previousValue: c
|
|
272
|
+
}), n;
|
|
248
273
|
});
|
|
249
274
|
},
|
|
250
|
-
[
|
|
251
|
-
),
|
|
275
|
+
[z, y]
|
|
276
|
+
), G = D(() => o.validation?.scroll?.required && !x ? !1 : (r.signer || []).every((e) => {
|
|
252
277
|
if (!e.validation?.required) return !0;
|
|
253
|
-
const t =
|
|
278
|
+
const t = g.get(e.id);
|
|
254
279
|
return t && (typeof t != "string" || t.trim());
|
|
255
|
-
}), [x,
|
|
256
|
-
|
|
257
|
-
const e =
|
|
258
|
-
|
|
280
|
+
}), [x, r.signer, g, o.validation?.scroll?.required]);
|
|
281
|
+
A(() => {
|
|
282
|
+
const e = G();
|
|
283
|
+
O(e), _?.({
|
|
259
284
|
scrolled: x,
|
|
260
|
-
fields:
|
|
285
|
+
fields: g,
|
|
261
286
|
isValid: e,
|
|
262
287
|
isSubmitting: h
|
|
263
288
|
});
|
|
264
|
-
}, [x,
|
|
265
|
-
const
|
|
266
|
-
if (f ||
|
|
267
|
-
|
|
289
|
+
}, [x, g, h, G, _]);
|
|
290
|
+
const ie = D(async () => {
|
|
291
|
+
if (f || q) return;
|
|
292
|
+
P(!0);
|
|
268
293
|
const e = {
|
|
269
|
-
eventId:
|
|
270
|
-
documentSource:
|
|
294
|
+
eventId: s,
|
|
295
|
+
documentSource: o.source,
|
|
271
296
|
fields: {
|
|
272
|
-
document:
|
|
273
|
-
signer: (
|
|
297
|
+
document: r.document || [],
|
|
298
|
+
signer: (r.signer || []).map((t) => ({
|
|
274
299
|
id: t.id,
|
|
275
|
-
value:
|
|
300
|
+
value: g.get(t.id) ?? null
|
|
276
301
|
}))
|
|
277
302
|
},
|
|
278
303
|
fileName: a?.fileName || "document.pdf"
|
|
279
304
|
};
|
|
280
305
|
try {
|
|
281
|
-
await
|
|
306
|
+
await R?.(e);
|
|
282
307
|
} finally {
|
|
283
|
-
|
|
308
|
+
P(!1);
|
|
284
309
|
}
|
|
285
310
|
}, [
|
|
286
311
|
f,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
312
|
+
q,
|
|
313
|
+
s,
|
|
314
|
+
o.source,
|
|
315
|
+
r,
|
|
316
|
+
g,
|
|
292
317
|
a,
|
|
293
|
-
|
|
294
|
-
]),
|
|
295
|
-
if (!
|
|
296
|
-
|
|
297
|
-
const e =
|
|
298
|
-
eventId:
|
|
318
|
+
R
|
|
319
|
+
]), ce = D(async () => {
|
|
320
|
+
if (!w || f || h) return;
|
|
321
|
+
j(!0), N({ type: "submit" });
|
|
322
|
+
const e = N({ type: "submit" }), t = {
|
|
323
|
+
eventId: s,
|
|
299
324
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
300
|
-
duration: Math.floor((Date.now() -
|
|
325
|
+
duration: Math.floor((Date.now() - se.current) / 1e3),
|
|
301
326
|
auditTrail: e,
|
|
302
|
-
documentFields:
|
|
303
|
-
signerFields: (
|
|
304
|
-
id:
|
|
305
|
-
value:
|
|
327
|
+
documentFields: r.document || [],
|
|
328
|
+
signerFields: (r.signer || []).map((i) => ({
|
|
329
|
+
id: i.id,
|
|
330
|
+
value: g.get(i.id) ?? null
|
|
306
331
|
})),
|
|
307
|
-
isFullyCompleted:
|
|
332
|
+
isFullyCompleted: w
|
|
308
333
|
};
|
|
309
334
|
try {
|
|
310
|
-
await
|
|
335
|
+
await p(t);
|
|
311
336
|
} finally {
|
|
312
|
-
|
|
337
|
+
j(!1);
|
|
313
338
|
}
|
|
314
|
-
}, [
|
|
315
|
-
const t = e.component ||
|
|
316
|
-
return /* @__PURE__ */
|
|
339
|
+
}, [w, f, h, s, r, g, p]), le = (e) => {
|
|
340
|
+
const t = e.component || de(e.type);
|
|
341
|
+
return /* @__PURE__ */ d(
|
|
317
342
|
t,
|
|
318
343
|
{
|
|
319
|
-
value:
|
|
320
|
-
onChange: (
|
|
344
|
+
value: g.get(e.id) ?? null,
|
|
345
|
+
onChange: (i) => ae(e.id, i),
|
|
321
346
|
isDisabled: f,
|
|
322
347
|
label: e.label
|
|
323
348
|
},
|
|
324
349
|
e.id
|
|
325
350
|
);
|
|
326
|
-
},
|
|
351
|
+
}, de = (e) => {
|
|
327
352
|
switch (e) {
|
|
328
353
|
case "signature":
|
|
329
354
|
case "text":
|
|
330
|
-
return
|
|
355
|
+
return xe;
|
|
331
356
|
case "checkbox":
|
|
332
|
-
return
|
|
357
|
+
return we;
|
|
333
358
|
}
|
|
334
|
-
},
|
|
335
|
-
const e = a?.component ||
|
|
336
|
-
return e ? /* @__PURE__ */
|
|
359
|
+
}, ue = () => {
|
|
360
|
+
const e = a?.component || Se(a);
|
|
361
|
+
return e ? /* @__PURE__ */ d(
|
|
337
362
|
e,
|
|
338
363
|
{
|
|
339
|
-
onClick:
|
|
364
|
+
onClick: ie,
|
|
340
365
|
fileName: a?.fileName,
|
|
341
366
|
isDisabled: f,
|
|
342
|
-
isDownloading:
|
|
367
|
+
isDownloading: q
|
|
343
368
|
}
|
|
344
369
|
) : null;
|
|
345
|
-
},
|
|
346
|
-
if (
|
|
370
|
+
}, pe = () => {
|
|
371
|
+
if (o.mode === "download")
|
|
347
372
|
return null;
|
|
348
|
-
const e =
|
|
349
|
-
return /* @__PURE__ */
|
|
373
|
+
const e = m?.component || Ce(m);
|
|
374
|
+
return /* @__PURE__ */ d("div", { className: "superdoc-esign-actions superdoc-esign-form-actions", children: /* @__PURE__ */ d(
|
|
350
375
|
e,
|
|
351
376
|
{
|
|
352
|
-
onClick:
|
|
353
|
-
isValid:
|
|
377
|
+
onClick: ce,
|
|
378
|
+
isValid: w,
|
|
354
379
|
isDisabled: f,
|
|
355
380
|
isSubmitting: h
|
|
356
381
|
}
|
|
357
382
|
) });
|
|
358
|
-
},
|
|
359
|
-
return
|
|
360
|
-
|
|
383
|
+
}, J = ue(), ge = pe();
|
|
384
|
+
return ve(
|
|
385
|
+
l,
|
|
361
386
|
() => ({
|
|
362
387
|
getState: () => ({
|
|
363
388
|
scrolled: x,
|
|
364
|
-
fields:
|
|
365
|
-
isValid:
|
|
389
|
+
fields: g,
|
|
390
|
+
isValid: w,
|
|
366
391
|
isSubmitting: h
|
|
367
392
|
}),
|
|
368
|
-
getAuditTrail: () =>
|
|
393
|
+
getAuditTrail: () => M.current,
|
|
369
394
|
reset: () => {
|
|
370
|
-
|
|
395
|
+
$(!o.validation?.scroll?.required), H(/* @__PURE__ */ new Map()), O(!1), M.current = [], L([]);
|
|
371
396
|
},
|
|
372
|
-
updateFieldInDocument:
|
|
397
|
+
updateFieldInDocument: y
|
|
373
398
|
}),
|
|
374
399
|
[
|
|
375
400
|
x,
|
|
376
|
-
|
|
377
|
-
|
|
401
|
+
g,
|
|
402
|
+
w,
|
|
378
403
|
h,
|
|
379
|
-
|
|
380
|
-
|
|
404
|
+
o.validation?.scroll?.required,
|
|
405
|
+
y
|
|
381
406
|
]
|
|
382
|
-
), /* @__PURE__ */
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
|
|
385
|
-
/* @__PURE__ */
|
|
407
|
+
), /* @__PURE__ */ b("div", { className: `superdoc-esign-container ${te || ""}`, style: ne, children: [
|
|
408
|
+
/* @__PURE__ */ b("div", { className: "superdoc-esign-document", "data-testid": "superdoc-esign-document", children: [
|
|
409
|
+
J && /* @__PURE__ */ d("div", { className: "superdoc-esign-document-toolbar", children: /* @__PURE__ */ d("div", { className: "superdoc-esign-document-controls", children: J }) }),
|
|
410
|
+
/* @__PURE__ */ d(
|
|
386
411
|
"div",
|
|
387
412
|
{
|
|
388
|
-
ref:
|
|
413
|
+
ref: k,
|
|
389
414
|
className: "superdoc-esign-document-viewer",
|
|
390
415
|
"data-testid": "superdoc-scroll-container",
|
|
391
|
-
style: { height:
|
|
416
|
+
style: { height: oe, overflow: "auto" }
|
|
392
417
|
}
|
|
393
418
|
)
|
|
394
419
|
] }),
|
|
395
|
-
/* @__PURE__ */
|
|
396
|
-
|
|
397
|
-
|
|
420
|
+
/* @__PURE__ */ b("div", { className: "superdoc-esign-controls", "data-testid": "superdoc-esign-controls", children: [
|
|
421
|
+
r.signer && r.signer.length > 0 && /* @__PURE__ */ d("div", { className: "superdoc-esign-fields", "data-testid": "superdoc-esign-fields", children: r.signer.map(le) }),
|
|
422
|
+
ge
|
|
398
423
|
] })
|
|
399
424
|
] });
|
|
400
425
|
}
|
|
401
426
|
);
|
|
402
|
-
|
|
427
|
+
De.displayName = "SuperDocESign";
|
|
403
428
|
export {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
429
|
+
we as CheckboxInput,
|
|
430
|
+
xe as SignatureInput,
|
|
431
|
+
De as default,
|
|
432
|
+
be as textToImageDataUrl
|
|
407
433
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export type FieldValue = string | boolean | number | null | undefined;
|
|
2
|
+
export type TableFieldValue = string[][];
|
|
2
3
|
export interface FieldReference {
|
|
3
4
|
id: string;
|
|
4
5
|
}
|
|
5
6
|
export interface DocumentField extends FieldReference {
|
|
6
|
-
|
|
7
|
+
type?: 'text' | 'table';
|
|
8
|
+
value: FieldValue | TableFieldValue;
|
|
7
9
|
}
|
|
8
10
|
export interface SignerField extends FieldReference {
|
|
9
11
|
type: 'signature' | 'checkbox' | 'text';
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAA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E,KAAK,CAAC,aAAa,CAAC,CAAC;IACrC,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACtC,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,CAAC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,SAAS,GAAG,aAAa,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src/utils/signature.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,MAyBjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/esign",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-next.1",
|
|
4
4
|
"description": "React eSignature component for SuperDoc",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"superdoc",
|
|
42
42
|
"esign",
|
|
43
43
|
"esignature",
|
|
44
|
-
"electronic-signature",
|
|
45
44
|
"clickwrap",
|
|
46
45
|
"agreement",
|
|
47
46
|
"document",
|
|
@@ -57,7 +56,7 @@
|
|
|
57
56
|
"peerDependencies": {
|
|
58
57
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
59
58
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
60
|
-
"superdoc": "^
|
|
59
|
+
"superdoc": "^1.9.0"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
62
|
"@commitlint/cli": "^20.1.0",
|
|
@@ -82,7 +81,7 @@
|
|
|
82
81
|
"react": "^19.2.0",
|
|
83
82
|
"react-dom": "^19.2.0",
|
|
84
83
|
"semantic-release": "^24.2.9",
|
|
85
|
-
"superdoc": "
|
|
84
|
+
"superdoc": "1.9.0",
|
|
86
85
|
"typescript": "^5.9.2",
|
|
87
86
|
"typescript-eslint": "^8.44.1",
|
|
88
87
|
"vite": "^7.1.7",
|