@sajn/embed-react 0.1.6 → 0.1.8
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -0
- package/dist/sign-document.d.ts +17 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as EmbedSignDocument } from './sign-document';
|
|
2
|
-
export type { Language, EmbedSignDocumentProps } from './sign-document';
|
|
2
|
+
export type { Language, SignatureInputMode, SignerCompletedData, SignerRejectedData, EmbedSignDocumentProps, } from './sign-document';
|
|
3
3
|
export { default as EmbedViewDocument } from './view-document';
|
|
4
4
|
export type { EmbedViewDocumentProps } from './view-document';
|
|
5
|
+
export type { CssVars } from './css-vars';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as EmbedSignDocument } from './sign-document';
|
|
2
|
-
export type { Language, EmbedSignDocumentProps } from './sign-document';
|
|
2
|
+
export type { Language, SignatureInputMode, SignerCompletedData, SignerRejectedData, EmbedSignDocumentProps, } from './sign-document';
|
|
3
3
|
export { default as EmbedViewDocument } from './view-document';
|
|
4
4
|
export type { EmbedViewDocumentProps } from './view-document';
|
|
5
|
+
export type { CssVars } from './css-vars';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),c=require("react");function d(e){const t=c.useRef(null);function o(){const n=e.host||"https://app.sajn.se",s=btoa(encodeURIComponent(JSON.stringify({language:e.language??"en",cssVars:e.cssVars,allowDocumentRejection:e.allowDocumentRejection,showScrollIndicator:e.showScrollIndicator??!0,...e.additionalProps})));return`${new URL(`/embed/sign/${e.documentId}?token=${e.token}`,n)}#${s}`}const a=c.useCallback(n=>{if(t.current?.contentWindow===n.source)switch(n.data.action){case"document-ready":t.current?.contentWindow?.postMessage({action:"embed-init"},new URL(e.host||"https://app.sajn.se").origin),e.onDocumentReady?.();break;case"signer-completed":e.onSignerCompleted?.(n.data.data);break;case"document-error":e.onDocumentError?.(n.data.data);break;case"signer-rejected":e.onSignerRejected?.(n.data.data);break}},[e.host,e.onDocumentReady,e.onSignerCompleted,e.onDocumentError,e.onSignerRejected]);return c.useEffect(()=>(window.addEventListener("message",a),()=>{window.removeEventListener("message",a)}),[a]),r.jsx("iframe",{ref:t,className:e.className,src:o()})}function u(e){const t=c.useRef(null);function o(){const n=e.host||"https://app.sajn.se",s=btoa(encodeURIComponent(JSON.stringify({language:e.language??"en",cssVars:e.cssVars,showScrollIndicator:e.showScrollIndicator??!0,...e.additionalProps})));return`${new URL(`/embed/view/${e.documentId}?token=${e.token}`,n)}#${s}`}const a=c.useCallback(n=>{if(t.current?.contentWindow===n.source)switch(n.data.action){case"document-ready":t.current?.contentWindow?.postMessage({action:"embed-init"},new URL(e.host||"https://app.sajn.se").origin),e.onDocumentReady?.();break;case"document-error":e.onDocumentError?.(n.data.data);break}},[e.host,e.onDocumentReady,e.onDocumentError]);return c.useEffect(()=>(window.addEventListener("message",a),()=>{window.removeEventListener("message",a)}),[a]),r.jsx("iframe",{ref:t,className:e.className,src:o()})}exports.EmbedSignDocument=d;exports.EmbedViewDocument=u;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),c=require("react");function d(e){const t=c.useRef(null);function o(){const n=e.host||"https://app.sajn.se",s=btoa(encodeURIComponent(JSON.stringify({language:e.language??"en",cssVars:e.cssVars,allowDocumentRejection:e.allowDocumentRejection,showScrollIndicator:e.showScrollIndicator??!0,signatureInputModes:e.signatureInputModes,...e.additionalProps})));return`${new URL(`/embed/sign/${e.documentId}?token=${e.token}`,n)}#${s}`}const a=c.useCallback(n=>{if(t.current?.contentWindow===n.source)switch(n.data.action){case"document-ready":t.current?.contentWindow?.postMessage({action:"embed-init"},new URL(e.host||"https://app.sajn.se").origin),e.onDocumentReady?.();break;case"signer-completed":e.onSignerCompleted?.(n.data.data);break;case"document-error":e.onDocumentError?.(n.data.data);break;case"signer-rejected":e.onSignerRejected?.(n.data.data);break}},[e.host,e.onDocumentReady,e.onSignerCompleted,e.onDocumentError,e.onSignerRejected]);return c.useEffect(()=>(window.addEventListener("message",a),()=>{window.removeEventListener("message",a)}),[a]),r.jsx("iframe",{ref:t,className:e.className,src:o()})}function u(e){const t=c.useRef(null);function o(){const n=e.host||"https://app.sajn.se",s=btoa(encodeURIComponent(JSON.stringify({language:e.language??"en",cssVars:e.cssVars,showScrollIndicator:e.showScrollIndicator??!0,...e.additionalProps})));return`${new URL(`/embed/view/${e.documentId}?token=${e.token}`,n)}#${s}`}const a=c.useCallback(n=>{if(t.current?.contentWindow===n.source)switch(n.data.action){case"document-ready":t.current?.contentWindow?.postMessage({action:"embed-init"},new URL(e.host||"https://app.sajn.se").origin),e.onDocumentReady?.();break;case"document-error":e.onDocumentError?.(n.data.data);break}},[e.host,e.onDocumentReady,e.onDocumentError]);return c.useEffect(()=>(window.addEventListener("message",a),()=>{window.removeEventListener("message",a)}),[a]),r.jsx("iframe",{ref:t,className:e.className,src:o()})}exports.EmbedSignDocument=d;exports.EmbedViewDocument=u;
|
package/dist/index.mjs
CHANGED
package/dist/sign-document.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { CssVars } from './css-vars';
|
|
2
2
|
export type Language = 'sv' | 'en' | 'no' | 'da' | 'fi' | 'de' | 'is' | 'es' | 'fr' | 'it';
|
|
3
|
+
export type SignatureInputMode = 'draw' | 'type' | 'upload';
|
|
4
|
+
export type SignerCompletedData = {
|
|
5
|
+
token: string;
|
|
6
|
+
documentId: string;
|
|
7
|
+
signerId: string;
|
|
8
|
+
failed?: string;
|
|
9
|
+
};
|
|
10
|
+
export type SignerRejectedData = {
|
|
11
|
+
token: string;
|
|
12
|
+
documentId: string;
|
|
13
|
+
signerId: string;
|
|
14
|
+
reason: string;
|
|
15
|
+
};
|
|
3
16
|
export type EmbedSignDocumentProps = {
|
|
4
17
|
language?: Language;
|
|
5
18
|
className?: string;
|
|
@@ -9,24 +22,16 @@ export type EmbedSignDocumentProps = {
|
|
|
9
22
|
cssVars?: (CssVars & Record<string, string>) | undefined;
|
|
10
23
|
allowDocumentRejection?: boolean | undefined;
|
|
11
24
|
showScrollIndicator?: boolean | undefined;
|
|
25
|
+
/** Which signature input modes the pad offers (default: all). Only narrows the workspace allowlist. */
|
|
26
|
+
signatureInputModes?: SignatureInputMode[] | undefined;
|
|
12
27
|
additionalProps?: Record<string, string | number | boolean> | undefined;
|
|
13
28
|
onDocumentReady?: () => void;
|
|
14
|
-
onSignerCompleted?: (data:
|
|
15
|
-
token: string;
|
|
16
|
-
documentId: string;
|
|
17
|
-
signerId: string;
|
|
18
|
-
failed?: string;
|
|
19
|
-
}) => void;
|
|
29
|
+
onSignerCompleted?: (data: SignerCompletedData) => void;
|
|
20
30
|
onDocumentError?: (data: {
|
|
21
31
|
code: string;
|
|
22
32
|
message: string;
|
|
23
33
|
}) => void;
|
|
24
|
-
onSignerRejected?: (data:
|
|
25
|
-
token: string;
|
|
26
|
-
documentId: string;
|
|
27
|
-
signerId: string;
|
|
28
|
-
reason: string;
|
|
29
|
-
}) => void;
|
|
34
|
+
onSignerRejected?: (data: SignerRejectedData) => void;
|
|
30
35
|
};
|
|
31
36
|
declare function EmbedSignDocument(props: EmbedSignDocumentProps): import("react/jsx-runtime").JSX.Element;
|
|
32
37
|
export default EmbedSignDocument;
|