@documenso/embed-solid 0.5.0 → 0.6.0

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.
@@ -0,0 +1,19 @@
1
+ import { CssVars } from './css-vars';
2
+ import { DeepPartial, EnvelopeEditorSettings } from './features-type';
3
+ export type EmbedCreateEnvelopeProps = {
4
+ className?: string;
5
+ host?: string;
6
+ presignToken: string;
7
+ externalId?: string;
8
+ type: "DOCUMENT" | "TEMPLATE";
9
+ css?: string | undefined;
10
+ cssVars?: (CssVars & Record<string, string>) | undefined;
11
+ darkModeDisabled?: boolean | undefined;
12
+ features?: DeepPartial<EnvelopeEditorSettings> & Record<string, any>;
13
+ onEnvelopeCreated?: (data: {
14
+ externalId: string | null;
15
+ envelopeId: number;
16
+ }) => void;
17
+ };
18
+ declare function EmbedCreateEnvelope(props: EmbedCreateEnvelopeProps): import("solid-js").JSX.Element;
19
+ export default EmbedCreateEnvelope;
@@ -0,0 +1,47 @@
1
+ export type DeepPartial<T> = T extends object ? {
2
+ [K in keyof T]?: DeepPartial<T[K]>;
3
+ } : T;
4
+ /**
5
+ * Envelope editor settings (features) for create/edit envelope embeds.
6
+ * Matches ZEnvelopeEditorSettingsSchema from the app.
7
+ */
8
+ export type EnvelopeEditorSettings = {
9
+ general: {
10
+ allowConfigureEnvelopeTitle: boolean;
11
+ allowUploadAndRecipientStep: boolean;
12
+ allowAddFieldsStep: boolean;
13
+ allowPreviewStep: boolean;
14
+ minimizeLeftSidebar: boolean;
15
+ };
16
+ /** If null, envelope settings will not be available to be seen/updated. */
17
+ settings: {
18
+ allowConfigureSignatureTypes: boolean;
19
+ allowConfigureLanguage: boolean;
20
+ allowConfigureDateFormat: boolean;
21
+ allowConfigureTimezone: boolean;
22
+ allowConfigureRedirectUrl: boolean;
23
+ allowConfigureDistribution: boolean;
24
+ allowConfigureExpirationPeriod: boolean;
25
+ allowConfigureEmailSender: boolean;
26
+ allowConfigureEmailReplyTo: boolean;
27
+ } | null;
28
+ actions: {
29
+ allowAttachments: boolean;
30
+ };
31
+ /** If null, no adjustments to envelope items will be allowed. */
32
+ envelopeItems: {
33
+ allowConfigureTitle: boolean;
34
+ allowConfigureOrder: boolean;
35
+ allowUpload: boolean;
36
+ allowDelete: boolean;
37
+ } | null;
38
+ /** If null, recipients will not be configurable at all. */
39
+ recipients: {
40
+ allowConfigureSigningOrder: boolean;
41
+ allowConfigureDictateNextSigner: boolean;
42
+ allowApproverRole: boolean;
43
+ allowViewerRole: boolean;
44
+ allowCCerRole: boolean;
45
+ allowAssistantRole: boolean;
46
+ } | null;
47
+ };
package/dist/index.d.mts CHANGED
@@ -4,8 +4,13 @@ export { default as EmbedCreateDocumentV1 } from './create-document';
4
4
  export { default as EmbedCreateTemplateV1 } from './create-template';
5
5
  export { default as EmbedUpdateDocumentV1 } from './update-document';
6
6
  export { default as EmbedUpdateTemplateV1 } from './update-template';
7
+ export { default as EmbedCreateEnvelopeV2 } from './create-envelope';
8
+ export { default as EmbedUpdateEnvelopeV2 } from './update-envelope';
9
+ export type { EnvelopeEditorSettings } from './features-type';
7
10
  export { default as unstable_EmbedCreateDocument } from './create-document';
8
11
  export { default as unstable_EmbedCreateTemplate } from './create-template';
9
12
  export { default as unstable_EmbedUpdateDocument } from './update-document';
10
13
  export { default as unstable_EmbedUpdateTemplate } from './update-template';
14
+ export { default as unstable_EmbedCreateEnvelope } from './create-envelope';
15
+ export { default as unstable_EmbedUpdateEnvelope } from './update-envelope';
11
16
  export { default as unstable_EmbedMultiSignDocument } from './multisign-document';
package/dist/index.d.ts CHANGED
@@ -4,8 +4,13 @@ export { default as EmbedCreateDocumentV1 } from './create-document';
4
4
  export { default as EmbedCreateTemplateV1 } from './create-template';
5
5
  export { default as EmbedUpdateDocumentV1 } from './update-document';
6
6
  export { default as EmbedUpdateTemplateV1 } from './update-template';
7
+ export { default as EmbedCreateEnvelopeV2 } from './create-envelope';
8
+ export { default as EmbedUpdateEnvelopeV2 } from './update-envelope';
9
+ export type { EnvelopeEditorSettings } from './features-type';
7
10
  export { default as unstable_EmbedCreateDocument } from './create-document';
8
11
  export { default as unstable_EmbedCreateTemplate } from './create-template';
9
12
  export { default as unstable_EmbedUpdateDocument } from './update-document';
10
13
  export { default as unstable_EmbedUpdateTemplate } from './update-template';
14
+ export { default as unstable_EmbedCreateEnvelope } from './create-envelope';
15
+ export { default as unstable_EmbedUpdateEnvelope } from './update-envelope';
11
16
  export { default as unstable_EmbedMultiSignDocument } from './multisign-document';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("solid-js/web"),r=require("solid-js");var k=n.template("<iframe>");function g(e){const m=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&a.searchParams.set("externalId",e.externalId),`${a}#${d}`});function i(t){if(c?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"field-signed":e.onFieldSigned?.();break;case"field-unsigned":e.onFieldUnsigned?.();break}}let c;return r.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=k(),d=c;return typeof d=="function"?n.use(d,t):c=t,n.effect(a=>{var o=e.className,s=m();return o!==a.e&&n.className(t,a.e=o),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var h=n.template("<iframe>");function v(e){const m=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps})));return`${new URL(`/embed/sign/${e.token}`,t)}#${d}`});function i(t){if(c?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"document-rejected":e.onDocumentRejected?.(t.data.data);break}}let c;return r.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=h(),d=c;return typeof d=="function"?n.use(d,t):c=t,n.effect(a=>{var o=e.className,s=m();return o!==a.e&&n.className(t,a.e=o),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var D=n.template("<iframe>");function l(e){const m=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL("/embed/v1/authoring/document/create",t);return a.searchParams.set("token",e.presignToken),a.hash=d,a.toString()});function i(t){c?.contentWindow===t.source&&t.data.type==="document-created"&&e.onDocumentCreated?.({documentId:t.data.documentId,externalId:t.data.externalId})}let c;return r.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=D(),d=c;return typeof d=="function"?n.use(d,t):c=t,n.effect(a=>{var o=e.className,s=m();return o!==a.e&&n.className(t,a.e=o),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var w=n.template("<iframe>");function u(e){const m=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL("/embed/v1/authoring/template/create",t);return a.searchParams.set("token",e.presignToken),a.hash=d,a.toString()});function i(t){c?.contentWindow===t.source&&t.data.type==="template-created"&&e.onTemplateCreated?.({templateId:t.data.templateId,externalId:t.data.externalId})}let c;return r.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=w(),d=c;return typeof d=="function"?n.use(d,t):c=t,n.effect(a=>{var o=e.className,s=m();return o!==a.e&&n.className(t,a.e=o),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var M=n.template("<iframe>");function f(e){const m=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,onlyEditFields:e.onlyEditFields,...e.additionalProps}))),a=new URL(`/embed/v1/authoring/document/edit/${e.documentId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=d,a.toString()});function i(t){c?.contentWindow===t.source&&t.data.type==="document-updated"&&e.onDocumentUpdated?.({documentId:t.data.documentId,externalId:t.data.externalId})}let c;return r.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=M(),d=c;return typeof d=="function"?n.use(d,t):c=t,n.effect(a=>{var o=e.className,s=m();return o!==a.e&&n.className(t,a.e=o),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var I=n.template("<iframe>");function b(e){const m=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,onlyEditFields:e.onlyEditFields,...e.additionalProps}))),a=new URL(`/embed/v1/authoring/template/edit/${e.templateId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=d,a.toString()});function i(t){c?.contentWindow===t.source&&t.data.type==="template-updated"&&e.onTemplateUpdated?.({templateId:t.data.templateId,externalId:t.data.externalId})}let c;return r.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=I(),d=c;return typeof d=="function"?n.use(d,t):c=t,n.effect(a=>{var o=e.className,s=m();return o!==a.e&&n.className(t,a.e=o),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var E=n.template("<iframe>");function U(e){const m=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps}))),a=new URL("/embed/v1/multisign",t);for(const o of e.tokens)a.searchParams.append("token",o);return`${a}#${d}`});function i(t){if(c?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"document-rejected":e.onDocumentRejected?.(t.data.data);break;case"all-documents-completed":e.onAllDocumentsCompleted?.(t.data.data);break}}let c;return r.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=E(),d=c;return typeof d=="function"?n.use(d,t):c=t,n.effect(a=>{var o=e.className,s=m();return o!==a.e&&n.className(t,a.e=o),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}exports.EmbedCreateDocumentV1=l;exports.EmbedCreateTemplateV1=u;exports.EmbedDirectTemplate=g;exports.EmbedSignDocument=v;exports.EmbedUpdateDocumentV1=f;exports.EmbedUpdateTemplateV1=b;exports.unstable_EmbedCreateDocument=l;exports.unstable_EmbedCreateTemplate=u;exports.unstable_EmbedMultiSignDocument=U;exports.unstable_EmbedUpdateDocument=f;exports.unstable_EmbedUpdateTemplate=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("solid-js/web"),r=require("solid-js");var h=n.template("<iframe>");function g(e){const i=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&a.searchParams.set("externalId",e.externalId),`${a}#${d}`});function m(t){if(o?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"field-signed":e.onFieldSigned?.();break;case"field-unsigned":e.onFieldUnsigned?.();break}}let o;return r.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=h(),d=o;return typeof d=="function"?n.use(d,t):o=t,n.effect(a=>{var c=e.className,s=i();return c!==a.e&&n.className(t,a.e=c),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var E=n.template("<iframe>");function I(e){const i=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps})));return`${new URL(`/embed/sign/${e.token}`,t)}#${d}`});function m(t){if(o?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"document-rejected":e.onDocumentRejected?.(t.data.data);break}}let o;return r.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=E(),d=o;return typeof d=="function"?n.use(d,t):o=t,n.effect(a=>{var c=e.className,s=i();return c!==a.e&&n.className(t,a.e=c),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var w=n.template("<iframe>");function l(e){const i=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL("/embed/v1/authoring/document/create",t);return a.searchParams.set("token",e.presignToken),a.hash=d,a.toString()});function m(t){o?.contentWindow===t.source&&t.data.type==="document-created"&&e.onDocumentCreated?.({documentId:t.data.documentId,externalId:t.data.externalId})}let o;return r.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=w(),d=o;return typeof d=="function"?n.use(d,t):o=t,n.effect(a=>{var c=e.className,s=i();return c!==a.e&&n.className(t,a.e=c),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var D=n.template("<iframe>");function u(e){const i=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL("/embed/v1/authoring/template/create",t);return a.searchParams.set("token",e.presignToken),a.hash=d,a.toString()});function m(t){o?.contentWindow===t.source&&t.data.type==="template-created"&&e.onTemplateCreated?.({templateId:t.data.templateId,externalId:t.data.externalId})}let o;return r.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=D(),d=o;return typeof d=="function"?n.use(d,t):o=t,n.effect(a=>{var c=e.className,s=i();return c!==a.e&&n.className(t,a.e=c),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var M=n.template("<iframe>");function f(e){const i=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,onlyEditFields:e.onlyEditFields,...e.additionalProps}))),a=new URL(`/embed/v1/authoring/document/edit/${e.documentId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=d,a.toString()});function m(t){o?.contentWindow===t.source&&t.data.type==="document-updated"&&e.onDocumentUpdated?.({documentId:t.data.documentId,externalId:t.data.externalId})}let o;return r.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=M(),d=o;return typeof d=="function"?n.use(d,t):o=t,n.effect(a=>{var c=e.className,s=i();return c!==a.e&&n.className(t,a.e=c),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var U=n.template("<iframe>");function b(e){const i=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,onlyEditFields:e.onlyEditFields,...e.additionalProps}))),a=new URL(`/embed/v1/authoring/template/edit/${e.templateId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=d,a.toString()});function m(t){o?.contentWindow===t.source&&t.data.type==="template-updated"&&e.onTemplateUpdated?.({templateId:t.data.templateId,externalId:t.data.externalId})}let o;return r.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=U(),d=o;return typeof d=="function"?n.use(d,t):o=t,n.effect(a=>{var c=e.className,s=i();return c!==a.e&&n.className(t,a.e=c),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var y=n.template("<iframe>");function v(e){const i=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,type:e.type,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled}))),a=new URL("/embed/v2/authoring/envelope/create",t);return a.searchParams.set("token",e.presignToken),a.hash=d,a.toString()});function m(t){o?.contentWindow===t.source&&t.data.type==="envelope-created"&&e.onEnvelopeCreated?.({envelopeId:t.data.envelopeId,externalId:t.data.externalId})}let o;return r.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=y(),d=o;return typeof d=="function"?n.use(d,t):o=t,n.effect(a=>{var c=e.className,s=i();return c!==a.e&&n.className(t,a.e=c),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var _=n.template("<iframe>");function k(e){const i=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled}))),a=new URL(`/embed/v2/authoring/envelope/edit/${e.envelopeId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=d,a.toString()});function m(t){o?.contentWindow===t.source&&t.data.type==="envelope-updated"&&e.onEnvelopeUpdated?.({envelopeId:t.data.envelopeId,externalId:t.data.externalId})}let o;return r.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=_(),d=o;return typeof d=="function"?n.use(d,t):o=t,n.effect(a=>{var c=e.className,s=i();return c!==a.e&&n.className(t,a.e=c),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var N=n.template("<iframe>");function $(e){const i=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps}))),a=new URL("/embed/v1/multisign",t);for(const c of e.tokens)a.searchParams.append("token",c);return`${a}#${d}`});function m(t){if(o?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"document-rejected":e.onDocumentRejected?.(t.data.data);break;case"all-documents-completed":e.onAllDocumentsCompleted?.(t.data.data);break}}let o;return r.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=N(),d=o;return typeof d=="function"?n.use(d,t):o=t,n.effect(a=>{var c=e.className,s=i();return c!==a.e&&n.className(t,a.e=c),s!==a.t&&n.setAttribute(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}exports.EmbedCreateDocumentV1=l;exports.EmbedCreateEnvelopeV2=v;exports.EmbedCreateTemplateV1=u;exports.EmbedDirectTemplate=g;exports.EmbedSignDocument=I;exports.EmbedUpdateDocumentV1=f;exports.EmbedUpdateEnvelopeV2=k;exports.EmbedUpdateTemplateV1=b;exports.unstable_EmbedCreateDocument=l;exports.unstable_EmbedCreateEnvelope=v;exports.unstable_EmbedCreateTemplate=u;exports.unstable_EmbedMultiSignDocument=$;exports.unstable_EmbedUpdateDocument=f;exports.unstable_EmbedUpdateEnvelope=k;exports.unstable_EmbedUpdateTemplate=b;
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { effect as i, className as m, setAttribute as l, use as u, template as f } from "solid-js/web";
2
- import { createMemo as b, onMount as k } from "solid-js";
3
- var h = /* @__PURE__ */ f("<iframe>");
4
- function _(e) {
5
- const s = b(() => {
2
+ import { createMemo as b, onMount as v } from "solid-js";
3
+ var k = /* @__PURE__ */ f("<iframe>");
4
+ function x(e) {
5
+ const c = b(() => {
6
6
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
7
7
  name: e.name,
8
8
  lockName: e.lockName,
@@ -36,25 +36,27 @@ function _(e) {
36
36
  }
37
37
  }
38
38
  let d;
39
- return k(() => {
39
+ return v(() => {
40
40
  window.addEventListener("message", r);
41
41
  }), (() => {
42
- var t = h(), n = d;
42
+ var t = k(), n = d;
43
43
  return typeof n == "function" ? u(n, t) : d = t, i((a) => {
44
- var c = e.className, o = s();
45
- return c !== a.e && m(t, a.e = c), o !== a.t && l(t, "src", a.t = o), a;
44
+ var o = e.className, s = c();
45
+ return o !== a.e && m(t, a.e = o), s !== a.t && l(t, "src", a.t = s), a;
46
46
  }, {
47
47
  e: void 0,
48
48
  t: void 0
49
49
  }), t;
50
50
  })();
51
51
  }
52
- var v = /* @__PURE__ */ f("<iframe>");
53
- function M(e) {
54
- const s = b(() => {
52
+ var h = /* @__PURE__ */ f("<iframe>");
53
+ function $(e) {
54
+ const c = b(() => {
55
55
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
56
56
  name: e.name,
57
57
  lockName: e.lockName,
58
+ email: e.email,
59
+ lockEmail: e.lockEmail,
58
60
  css: e.css,
59
61
  cssVars: e.cssVars,
60
62
  darkModeDisabled: e.darkModeDisabled,
@@ -81,13 +83,13 @@ function M(e) {
81
83
  }
82
84
  }
83
85
  let d;
84
- return k(() => {
86
+ return v(() => {
85
87
  window.addEventListener("message", r);
86
88
  }), (() => {
87
- var t = v(), n = d;
89
+ var t = h(), n = d;
88
90
  return typeof n == "function" ? u(n, t) : d = t, i((a) => {
89
- var c = e.className, o = s();
90
- return c !== a.e && m(t, a.e = c), o !== a.t && l(t, "src", a.t = o), a;
91
+ var o = e.className, s = c();
92
+ return o !== a.e && m(t, a.e = o), s !== a.t && l(t, "src", a.t = s), a;
91
93
  }, {
92
94
  e: void 0,
93
95
  t: void 0
@@ -96,7 +98,7 @@ function M(e) {
96
98
  }
97
99
  var g = /* @__PURE__ */ f("<iframe>");
98
100
  function R(e) {
99
- const s = b(() => {
101
+ const c = b(() => {
100
102
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
101
103
  externalId: e.externalId,
102
104
  features: e.features,
@@ -114,22 +116,22 @@ function R(e) {
114
116
  });
115
117
  }
116
118
  let d;
117
- return k(() => {
119
+ return v(() => {
118
120
  window.addEventListener("message", r);
119
121
  }), (() => {
120
122
  var t = g(), n = d;
121
123
  return typeof n == "function" ? u(n, t) : d = t, i((a) => {
122
- var c = e.className, o = s();
123
- return c !== a.e && m(t, a.e = c), o !== a.t && l(t, "src", a.t = o), a;
124
+ var o = e.className, s = c();
125
+ return o !== a.e && m(t, a.e = o), s !== a.t && l(t, "src", a.t = s), a;
124
126
  }, {
125
127
  e: void 0,
126
128
  t: void 0
127
129
  }), t;
128
130
  })();
129
131
  }
130
- var D = /* @__PURE__ */ f("<iframe>");
131
- function $(e) {
132
- const s = b(() => {
132
+ var I = /* @__PURE__ */ f("<iframe>");
133
+ function C(e) {
134
+ const c = b(() => {
133
135
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
134
136
  externalId: e.externalId,
135
137
  features: e.features,
@@ -147,22 +149,22 @@ function $(e) {
147
149
  });
148
150
  }
149
151
  let d;
150
- return k(() => {
152
+ return v(() => {
151
153
  window.addEventListener("message", r);
152
154
  }), (() => {
153
- var t = D(), n = d;
155
+ var t = I(), n = d;
154
156
  return typeof n == "function" ? u(n, t) : d = t, i((a) => {
155
- var c = e.className, o = s();
156
- return c !== a.e && m(t, a.e = c), o !== a.t && l(t, "src", a.t = o), a;
157
+ var o = e.className, s = c();
158
+ return o !== a.e && m(t, a.e = o), s !== a.t && l(t, "src", a.t = s), a;
157
159
  }, {
158
160
  e: void 0,
159
161
  t: void 0
160
162
  }), t;
161
163
  })();
162
164
  }
163
- var w = /* @__PURE__ */ f("<iframe>");
165
+ var E = /* @__PURE__ */ f("<iframe>");
164
166
  function N(e) {
165
- const s = b(() => {
167
+ const c = b(() => {
166
168
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
167
169
  token: e.presignToken,
168
170
  externalId: e.externalId,
@@ -182,22 +184,22 @@ function N(e) {
182
184
  });
183
185
  }
184
186
  let d;
185
- return k(() => {
187
+ return v(() => {
186
188
  window.addEventListener("message", r);
187
189
  }), (() => {
188
- var t = w(), n = d;
190
+ var t = E(), n = d;
189
191
  return typeof n == "function" ? u(n, t) : d = t, i((a) => {
190
- var c = e.className, o = s();
191
- return c !== a.e && m(t, a.e = c), o !== a.t && l(t, "src", a.t = o), a;
192
+ var o = e.className, s = c();
193
+ return o !== a.e && m(t, a.e = o), s !== a.t && l(t, "src", a.t = s), a;
192
194
  }, {
193
195
  e: void 0,
194
196
  t: void 0
195
197
  }), t;
196
198
  })();
197
199
  }
198
- var I = /* @__PURE__ */ f("<iframe>");
199
- function x(e) {
200
- const s = b(() => {
200
+ var w = /* @__PURE__ */ f("<iframe>");
201
+ function V(e) {
202
+ const c = b(() => {
201
203
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
202
204
  externalId: e.externalId,
203
205
  features: e.features,
@@ -216,22 +218,87 @@ function x(e) {
216
218
  });
217
219
  }
218
220
  let d;
219
- return k(() => {
221
+ return v(() => {
220
222
  window.addEventListener("message", r);
221
223
  }), (() => {
222
- var t = I(), n = d;
224
+ var t = w(), n = d;
223
225
  return typeof n == "function" ? u(n, t) : d = t, i((a) => {
224
- var c = e.className, o = s();
225
- return c !== a.e && m(t, a.e = c), o !== a.t && l(t, "src", a.t = o), a;
226
+ var o = e.className, s = c();
227
+ return o !== a.e && m(t, a.e = o), s !== a.t && l(t, "src", a.t = s), a;
226
228
  }, {
227
229
  e: void 0,
228
230
  t: void 0
229
231
  }), t;
230
232
  })();
231
233
  }
232
- var E = /* @__PURE__ */ f("<iframe>");
233
- function C(e) {
234
- const s = b(() => {
234
+ var D = /* @__PURE__ */ f("<iframe>");
235
+ function S(e) {
236
+ const c = b(() => {
237
+ const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
238
+ externalId: e.externalId,
239
+ type: e.type,
240
+ features: e.features,
241
+ css: e.css,
242
+ cssVars: e.cssVars,
243
+ darkModeDisabled: e.darkModeDisabled
244
+ }))), a = new URL("/embed/v2/authoring/envelope/create", t);
245
+ return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
246
+ });
247
+ function r(t) {
248
+ d?.contentWindow === t.source && t.data.type === "envelope-created" && e.onEnvelopeCreated?.({
249
+ envelopeId: t.data.envelopeId,
250
+ externalId: t.data.externalId
251
+ });
252
+ }
253
+ let d;
254
+ return v(() => {
255
+ window.addEventListener("message", r);
256
+ }), (() => {
257
+ var t = D(), n = d;
258
+ return typeof n == "function" ? u(n, t) : d = t, i((a) => {
259
+ var o = e.className, s = c();
260
+ return o !== a.e && m(t, a.e = o), s !== a.t && l(t, "src", a.t = s), a;
261
+ }, {
262
+ e: void 0,
263
+ t: void 0
264
+ }), t;
265
+ })();
266
+ }
267
+ var U = /* @__PURE__ */ f("<iframe>");
268
+ function L(e) {
269
+ const c = b(() => {
270
+ const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
271
+ externalId: e.externalId,
272
+ features: e.features,
273
+ css: e.css,
274
+ cssVars: e.cssVars,
275
+ darkModeDisabled: e.darkModeDisabled
276
+ }))), a = new URL(`/embed/v2/authoring/envelope/edit/${e.envelopeId}`, t);
277
+ return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
278
+ });
279
+ function r(t) {
280
+ d?.contentWindow === t.source && t.data.type === "envelope-updated" && e.onEnvelopeUpdated?.({
281
+ envelopeId: t.data.envelopeId,
282
+ externalId: t.data.externalId
283
+ });
284
+ }
285
+ let d;
286
+ return v(() => {
287
+ window.addEventListener("message", r);
288
+ }), (() => {
289
+ var t = U(), n = d;
290
+ return typeof n == "function" ? u(n, t) : d = t, i((a) => {
291
+ var o = e.className, s = c();
292
+ return o !== a.e && m(t, a.e = o), s !== a.t && l(t, "src", a.t = s), a;
293
+ }, {
294
+ e: void 0,
295
+ t: void 0
296
+ }), t;
297
+ })();
298
+ }
299
+ var y = /* @__PURE__ */ f("<iframe>");
300
+ function O(e) {
301
+ const c = b(() => {
235
302
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
236
303
  name: e.name,
237
304
  lockName: e.lockName,
@@ -241,8 +308,8 @@ function C(e) {
241
308
  allowDocumentRejection: e.allowDocumentRejection,
242
309
  ...e.additionalProps
243
310
  }))), a = new URL("/embed/v1/multisign", t);
244
- for (const c of e.tokens)
245
- a.searchParams.append("token", c);
311
+ for (const o of e.tokens)
312
+ a.searchParams.append("token", o);
246
313
  return `${a}#${n}`;
247
314
  });
248
315
  function r(t) {
@@ -266,13 +333,13 @@ function C(e) {
266
333
  }
267
334
  }
268
335
  let d;
269
- return k(() => {
336
+ return v(() => {
270
337
  window.addEventListener("message", r);
271
338
  }), (() => {
272
- var t = E(), n = d;
339
+ var t = y(), n = d;
273
340
  return typeof n == "function" ? u(n, t) : d = t, i((a) => {
274
- var c = e.className, o = s();
275
- return c !== a.e && m(t, a.e = c), o !== a.t && l(t, "src", a.t = o), a;
341
+ var o = e.className, s = c();
342
+ return o !== a.e && m(t, a.e = o), s !== a.t && l(t, "src", a.t = s), a;
276
343
  }, {
277
344
  e: void 0,
278
345
  t: void 0
@@ -281,14 +348,18 @@ function C(e) {
281
348
  }
282
349
  export {
283
350
  R as EmbedCreateDocumentV1,
284
- $ as EmbedCreateTemplateV1,
285
- _ as EmbedDirectTemplate,
286
- M as EmbedSignDocument,
351
+ S as EmbedCreateEnvelopeV2,
352
+ C as EmbedCreateTemplateV1,
353
+ x as EmbedDirectTemplate,
354
+ $ as EmbedSignDocument,
287
355
  N as EmbedUpdateDocumentV1,
288
- x as EmbedUpdateTemplateV1,
356
+ L as EmbedUpdateEnvelopeV2,
357
+ V as EmbedUpdateTemplateV1,
289
358
  R as unstable_EmbedCreateDocument,
290
- $ as unstable_EmbedCreateTemplate,
291
- C as unstable_EmbedMultiSignDocument,
359
+ S as unstable_EmbedCreateEnvelope,
360
+ C as unstable_EmbedCreateTemplate,
361
+ O as unstable_EmbedMultiSignDocument,
292
362
  N as unstable_EmbedUpdateDocument,
293
- x as unstable_EmbedUpdateTemplate
363
+ L as unstable_EmbedUpdateEnvelope,
364
+ V as unstable_EmbedUpdateTemplate
294
365
  };
@@ -8,6 +8,8 @@ export type EmbedSignDocumentProps = {
8
8
  darkModeDisabled?: boolean | undefined;
9
9
  name?: string | undefined;
10
10
  lockName?: boolean | undefined;
11
+ email?: string | undefined;
12
+ lockEmail?: boolean | undefined;
11
13
  allowDocumentRejection?: boolean | undefined;
12
14
  additionalProps?: Record<string, string | number | boolean> | undefined;
13
15
  onDocumentReady?: () => void;
@@ -0,0 +1,19 @@
1
+ import { CssVars } from './css-vars';
2
+ import { DeepPartial, EnvelopeEditorSettings } from './features-type';
3
+ export type EmbedUpdateEnvelopeProps = {
4
+ className?: string;
5
+ host?: string;
6
+ presignToken: string;
7
+ externalId?: string;
8
+ envelopeId: string;
9
+ css?: string | undefined;
10
+ cssVars?: (CssVars & Record<string, string>) | undefined;
11
+ darkModeDisabled?: boolean | undefined;
12
+ features?: DeepPartial<EnvelopeEditorSettings> & Record<string, any>;
13
+ onEnvelopeUpdated?: (data: {
14
+ externalId: string | null;
15
+ envelopeId: string;
16
+ }) => void;
17
+ };
18
+ declare function EmbedUpdateEnvelope(props: EmbedUpdateEnvelopeProps): import("solid-js").JSX.Element;
19
+ export default EmbedUpdateEnvelope;
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@documenso/embed-solid",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/documenso/embeds",
8
+ "directory": "packages/solid"
9
+ },
5
10
  "files": [
6
11
  "dist"
7
12
  ],