@documenso/embed-solid 0.2.3 → 0.4.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.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,9 @@
1
1
  export { default as EmbedDirectTemplate } from './direct-template';
2
2
  export { default as EmbedSignDocument } from './sign-document';
3
+ export { default as EmbedCreateDocumentV1 } from './create-document';
4
+ export { default as EmbedCreateTemplateV1 } from './create-template';
5
+ export { default as EmbedUpdateDocumentV1 } from './update-document';
6
+ export { default as EmbedUpdateTemplateV1 } from './update-template';
3
7
  export { default as unstable_EmbedCreateDocument } from './create-document';
4
8
  export { default as unstable_EmbedCreateTemplate } from './create-template';
5
9
  export { default as unstable_EmbedUpdateDocument } from './update-document';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export { default as EmbedDirectTemplate } from './direct-template';
2
2
  export { default as EmbedSignDocument } from './sign-document';
3
+ export { default as EmbedCreateDocumentV1 } from './create-document';
4
+ export { default as EmbedCreateTemplateV1 } from './create-template';
5
+ export { default as EmbedUpdateDocumentV1 } from './update-document';
6
+ export { default as EmbedUpdateTemplateV1 } from './update-template';
3
7
  export { default as unstable_EmbedCreateDocument } from './create-document';
4
8
  export { default as unstable_EmbedCreateTemplate } from './create-template';
5
9
  export { default as unstable_EmbedUpdateDocument } from './update-document';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("solid-js");function m(e,r,s){let c;const t=()=>{const a=document.createElement("template");return a.innerHTML=e,a.content.firstChild},n=()=>(c||(c=t())).cloneNode(!0);return n.cloneNode=n,n}function u(e,r,s){k(e)||(s==null?e.removeAttribute(r):e.setAttribute(r,s))}function l(e,r){k(e)||(r==null?e.removeAttribute("class"):e.className=r)}function f(e,r,s){return i.untrack(()=>e(r,s))}function k(e){return!!i.sharedConfig.context&&!i.sharedConfig.done&&(!e||e.isConnected)}var g=m("<iframe>");function h(e){const r=i.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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}#${n}`});function s(t){var n,a,d,o,b;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.action){case"document-ready":(n=e.onDocumentReady)==null||n.call(e);break;case"document-completed":(a=e.onDocumentCompleted)==null||a.call(e,t.data.data);break;case"document-error":(d=e.onDocumentError)==null||d.call(e,t.data.data);break;case"field-signed":(o=e.onFieldSigned)==null||o.call(e);break;case"field-unsigned":(b=e.onFieldUnsigned)==null||b.call(e);break}}let c;return i.onMount(()=>{window.addEventListener("message",s)}),(()=>{var t=g(),n=c;return typeof n=="function"?f(n,t):c=t,i.createRenderEffect(a=>{var d=e.className,o=r();return d!==a.e&&l(t,a.e=d),o!==a.t&&u(t,"src",a.t=o),a},{e:void 0,t:void 0}),t})()}var v=m("<iframe>");function D(e){const r=i.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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)}#${n}`});function s(t){var n,a,d,o;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.action){case"document-ready":(n=e.onDocumentReady)==null||n.call(e);break;case"document-completed":(a=e.onDocumentCompleted)==null||a.call(e,t.data.data);break;case"document-error":(d=e.onDocumentError)==null||d.call(e,t.data.data);break;case"document-rejected":(o=e.onDocumentRejected)==null||o.call(e,t.data.data);break}}let c;return i.onMount(()=>{window.addEventListener("message",s)}),(()=>{var t=v(),n=c;return typeof n=="function"?f(n,t):c=t,i.createRenderEffect(a=>{var d=e.className,o=r();return d!==a.e&&l(t,a.e=d),o!==a.t&&u(t,"src",a.t=o),a},{e:void 0,t:void 0}),t})()}var w=m("<iframe>");function M(e){const r=i.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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=n,a.toString()});function s(t){var n;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.type){case"document-created":(n=e.onDocumentCreated)==null||n.call(e,{documentId:t.data.documentId,externalId:t.data.externalId});break}}let c;return i.onMount(()=>{window.addEventListener("message",s)}),(()=>{var t=w(),n=c;return typeof n=="function"?f(n,t):c=t,i.createRenderEffect(a=>{var d=e.className,o=r();return d!==a.e&&l(t,a.e=d),o!==a.t&&u(t,"src",a.t=o),a},{e:void 0,t:void 0}),t})()}var I=m("<iframe>");function E(e){const r=i.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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=n,a.toString()});function s(t){var n;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.type){case"template-created":(n=e.onTemplateCreated)==null||n.call(e,{templateId:t.data.templateId,externalId:t.data.externalId});break}}let c;return i.onMount(()=>{window.addEventListener("message",s)}),(()=>{var t=I(),n=c;return typeof n=="function"?f(n,t):c=t,i.createRenderEffect(a=>{var d=e.className,o=r();return d!==a.e&&l(t,a.e=d),o!==a.t&&u(t,"src",a.t=o),a},{e:void 0,t:void 0}),t})()}var R=m("<iframe>");function U(e){const r=i.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL(`/embed/v1/authoring/document/edit/${e.documentId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=n,a.toString()});function s(t){var n;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.type){case"document-updated":(n=e.onDocumentUpdated)==null||n.call(e,{documentId:t.data.documentId,externalId:t.data.externalId});break}}let c;return i.onMount(()=>{window.addEventListener("message",s)}),(()=>{var t=R(),n=c;return typeof n=="function"?f(n,t):c=t,i.createRenderEffect(a=>{var d=e.className,o=r();return d!==a.e&&l(t,a.e=d),o!==a.t&&u(t,"src",a.t=o),a},{e:void 0,t:void 0}),t})()}var y=m("<iframe>");function N(e){const r=i.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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/edit/${e.templateId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=n,a.toString()});function s(t){var n;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.type){case"template-updated":(n=e.onTemplateUpdated)==null||n.call(e,{templateId:t.data.templateId,externalId:t.data.externalId});break}}let c;return i.onMount(()=>{window.addEventListener("message",s)}),(()=>{var t=y(),n=c;return typeof n=="function"?f(n,t):c=t,i.createRenderEffect(a=>{var d=e.className,o=r();return d!==a.e&&l(t,a.e=d),o!==a.t&&u(t,"src",a.t=o),a},{e:void 0,t:void 0}),t})()}var $=m("<iframe>");function C(e){const r=i.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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 d of e.tokens)a.searchParams.append("token",d);return`${a}#${n}`});function s(t){var n,a,d,o,b;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.action){case"document-ready":(n=e.onDocumentReady)==null||n.call(e);break;case"document-completed":(a=e.onDocumentCompleted)==null||a.call(e,t.data.data);break;case"document-error":(d=e.onDocumentError)==null||d.call(e,t.data.data);break;case"document-rejected":(o=e.onDocumentRejected)==null||o.call(e,t.data.data);break;case"all-documents-completed":(b=e.onAllDocumentsCompleted)==null||b.call(e,t.data.data);break}}let c;return i.onMount(()=>{window.addEventListener("message",s)}),(()=>{var t=$(),n=c;return typeof n=="function"?f(n,t):c=t,i.createRenderEffect(a=>{var d=e.className,o=r();return d!==a.e&&l(t,a.e=d),o!==a.t&&u(t,"src",a.t=o),a},{e:void 0,t:void 0}),t})()}exports.EmbedDirectTemplate=h;exports.EmbedSignDocument=D;exports.unstable_EmbedCreateDocument=M;exports.unstable_EmbedCreateTemplate=E;exports.unstable_EmbedMultiSignDocument=C;exports.unstable_EmbedUpdateDocument=U;exports.unstable_EmbedUpdateTemplate=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("solid-js");function m(e,o,i){let d;const t=()=>{const a=document.createElement("template");return a.innerHTML=e,a.content.firstChild},n=()=>(d||(d=t())).cloneNode(!0);return n.cloneNode=n,n}function l(e,o,i){b(e)||(i==null?e.removeAttribute(o):e.setAttribute(o,i))}function u(e,o){b(e)||(o==null?e.removeAttribute("class"):e.className=o)}function f(e,o,i){return c.untrack(()=>e(o,i))}function b(e){return!!c.sharedConfig.context&&!c.sharedConfig.done&&(!e||e.isConnected)}var D=m("<iframe>");function E(e){const o=c.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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}#${n}`});function i(t){if(d?.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 d;return c.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=D(),n=d;return typeof n=="function"?f(n,t):d=t,c.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&u(t,a.e=r),s!==a.t&&l(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var w=m("<iframe>");function M(e){const o=c.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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)}#${n}`});function i(t){if(d?.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 d;return c.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=w(),n=d;return typeof n=="function"?f(n,t):d=t,c.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&u(t,a.e=r),s!==a.t&&l(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var I=m("<iframe>");function k(e){const o=c.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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=n,a.toString()});function i(t){if(d?.contentWindow===t.source)switch(t.data.type){case"document-created":e.onDocumentCreated?.({documentId:t.data.documentId,externalId:t.data.externalId});break}}let d;return c.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=I(),n=d;return typeof n=="function"?f(n,t):d=t,c.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&u(t,a.e=r),s!==a.t&&l(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var y=m("<iframe>");function g(e){const o=c.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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=n,a.toString()});function i(t){if(d?.contentWindow===t.source)switch(t.data.type){case"template-created":e.onTemplateCreated?.({templateId:t.data.templateId,externalId:t.data.externalId});break}}let d;return c.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=y(),n=d;return typeof n=="function"?f(n,t):d=t,c.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&u(t,a.e=r),s!==a.t&&l(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var U=m("<iframe>");function h(e){const o=c.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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=n,a.toString()});function i(t){if(d?.contentWindow===t.source)switch(t.data.type){case"document-updated":e.onDocumentUpdated?.({documentId:t.data.documentId,externalId:t.data.externalId});break}}let d;return c.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=U(),n=d;return typeof n=="function"?f(n,t):d=t,c.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&u(t,a.e=r),s!==a.t&&l(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var R=m("<iframe>");function v(e){const o=c.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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=n,a.toString()});function i(t){if(d?.contentWindow===t.source)switch(t.data.type){case"template-updated":e.onTemplateUpdated?.({templateId:t.data.templateId,externalId:t.data.externalId});break}}let d;return c.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=R(),n=d;return typeof n=="function"?f(n,t):d=t,c.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&u(t,a.e=r),s!==a.t&&l(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var _=m("<iframe>");function C(e){const o=c.createMemo(()=>{const t=e.host||"https://app.documenso.com",n=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 r of e.tokens)a.searchParams.append("token",r);return`${a}#${n}`});function i(t){if(d?.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 d;return c.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=_(),n=d;return typeof n=="function"?f(n,t):d=t,c.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&u(t,a.e=r),s!==a.t&&l(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}exports.EmbedCreateDocumentV1=k;exports.EmbedCreateTemplateV1=g;exports.EmbedDirectTemplate=E;exports.EmbedSignDocument=M;exports.EmbedUpdateDocumentV1=h;exports.EmbedUpdateTemplateV1=v;exports.unstable_EmbedCreateDocument=k;exports.unstable_EmbedCreateTemplate=g;exports.unstable_EmbedMultiSignDocument=C;exports.unstable_EmbedUpdateDocument=h;exports.unstable_EmbedUpdateTemplate=v;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { sharedConfig as g, untrack as D, createMemo as m, onMount as r, createRenderEffect as l } from "solid-js";
2
- function u(e, i, s) {
1
+ import { untrack as v, sharedConfig as h, createMemo as i, onMount as m, createRenderEffect as l } from "solid-js";
2
+ function u(e, c, r) {
3
3
  let d;
4
4
  const t = () => {
5
5
  const a = document.createElement("template");
@@ -7,21 +7,21 @@ function u(e, i, s) {
7
7
  }, n = () => (d || (d = t())).cloneNode(!0);
8
8
  return n.cloneNode = n, n;
9
9
  }
10
- function f(e, i, s) {
11
- v(e) || (s == null ? e.removeAttribute(i) : e.setAttribute(i, s));
10
+ function f(e, c, r) {
11
+ g(e) || (r == null ? e.removeAttribute(c) : e.setAttribute(c, r));
12
12
  }
13
- function b(e, i) {
14
- v(e) || (i == null ? e.removeAttribute("class") : e.className = i);
13
+ function b(e, c) {
14
+ g(e) || (c == null ? e.removeAttribute("class") : e.className = c);
15
15
  }
16
- function k(e, i, s) {
17
- return D(() => e(i, s));
16
+ function k(e, c, r) {
17
+ return v(() => e(c, r));
18
18
  }
19
- function v(e) {
20
- return !!g.context && !g.done && (!e || e.isConnected);
19
+ function g(e) {
20
+ return !!h.context && !h.done && (!e || e.isConnected);
21
21
  }
22
- var w = /* @__PURE__ */ u("<iframe>");
23
- function $(e) {
24
- const i = m(() => {
22
+ var D = /* @__PURE__ */ u("<iframe>");
23
+ function N(e) {
24
+ const c = i(() => {
25
25
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
26
26
  name: e.name,
27
27
  lockName: e.lockName,
@@ -34,44 +34,43 @@ function $(e) {
34
34
  }))), a = new URL(`/embed/direct/${e.token}`, t);
35
35
  return e.externalId && a.searchParams.set("externalId", e.externalId), `${a}#${n}`;
36
36
  });
37
- function s(t) {
38
- var n, a, c, o, h;
39
- if ((d == null ? void 0 : d.contentWindow) === t.source)
37
+ function r(t) {
38
+ if (d?.contentWindow === t.source)
40
39
  switch (t.data.action) {
41
40
  case "document-ready":
42
- (n = e.onDocumentReady) == null || n.call(e);
41
+ e.onDocumentReady?.();
43
42
  break;
44
43
  case "document-completed":
45
- (a = e.onDocumentCompleted) == null || a.call(e, t.data.data);
44
+ e.onDocumentCompleted?.(t.data.data);
46
45
  break;
47
46
  case "document-error":
48
- (c = e.onDocumentError) == null || c.call(e, t.data.data);
47
+ e.onDocumentError?.(t.data.data);
49
48
  break;
50
49
  case "field-signed":
51
- (o = e.onFieldSigned) == null || o.call(e);
50
+ e.onFieldSigned?.();
52
51
  break;
53
52
  case "field-unsigned":
54
- (h = e.onFieldUnsigned) == null || h.call(e);
53
+ e.onFieldUnsigned?.();
55
54
  break;
56
55
  }
57
56
  }
58
57
  let d;
59
- return r(() => {
60
- window.addEventListener("message", s);
58
+ return m(() => {
59
+ window.addEventListener("message", r);
61
60
  }), (() => {
62
- var t = w(), n = d;
61
+ var t = D(), n = d;
63
62
  return typeof n == "function" ? k(n, t) : d = t, l((a) => {
64
- var c = e.className, o = i();
65
- return c !== a.e && b(t, a.e = c), o !== a.t && f(t, "src", a.t = o), a;
63
+ var o = e.className, s = c();
64
+ return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
66
65
  }, {
67
66
  e: void 0,
68
67
  t: void 0
69
68
  }), t;
70
69
  })();
71
70
  }
72
- var I = /* @__PURE__ */ u("<iframe>");
73
- function x(e) {
74
- const i = m(() => {
71
+ var w = /* @__PURE__ */ u("<iframe>");
72
+ function R(e) {
73
+ const c = i(() => {
75
74
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
76
75
  name: e.name,
77
76
  lockName: e.lockName,
@@ -83,41 +82,40 @@ function x(e) {
83
82
  })));
84
83
  return `${new URL(`/embed/sign/${e.token}`, t)}#${n}`;
85
84
  });
86
- function s(t) {
87
- var n, a, c, o;
88
- if ((d == null ? void 0 : d.contentWindow) === t.source)
85
+ function r(t) {
86
+ if (d?.contentWindow === t.source)
89
87
  switch (t.data.action) {
90
88
  case "document-ready":
91
- (n = e.onDocumentReady) == null || n.call(e);
89
+ e.onDocumentReady?.();
92
90
  break;
93
91
  case "document-completed":
94
- (a = e.onDocumentCompleted) == null || a.call(e, t.data.data);
92
+ e.onDocumentCompleted?.(t.data.data);
95
93
  break;
96
94
  case "document-error":
97
- (c = e.onDocumentError) == null || c.call(e, t.data.data);
95
+ e.onDocumentError?.(t.data.data);
98
96
  break;
99
97
  case "document-rejected":
100
- (o = e.onDocumentRejected) == null || o.call(e, t.data.data);
98
+ e.onDocumentRejected?.(t.data.data);
101
99
  break;
102
100
  }
103
101
  }
104
102
  let d;
105
- return r(() => {
106
- window.addEventListener("message", s);
103
+ return m(() => {
104
+ window.addEventListener("message", r);
107
105
  }), (() => {
108
- var t = I(), n = d;
106
+ var t = w(), n = d;
109
107
  return typeof n == "function" ? k(n, t) : d = t, l((a) => {
110
- var c = e.className, o = i();
111
- return c !== a.e && b(t, a.e = c), o !== a.t && f(t, "src", a.t = o), a;
108
+ var o = e.className, s = c();
109
+ return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
112
110
  }, {
113
111
  e: void 0,
114
112
  t: void 0
115
113
  }), t;
116
114
  })();
117
115
  }
118
- var U = /* @__PURE__ */ u("<iframe>");
116
+ var I = /* @__PURE__ */ u("<iframe>");
119
117
  function C(e) {
120
- const i = m(() => {
118
+ const c = i(() => {
121
119
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
122
120
  externalId: e.externalId,
123
121
  features: e.features,
@@ -128,12 +126,11 @@ function C(e) {
128
126
  }))), a = new URL("/embed/v1/authoring/document/create", t);
129
127
  return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
130
128
  });
131
- function s(t) {
132
- var n;
133
- if ((d == null ? void 0 : d.contentWindow) === t.source)
129
+ function r(t) {
130
+ if (d?.contentWindow === t.source)
134
131
  switch (t.data.type) {
135
132
  case "document-created":
136
- (n = e.onDocumentCreated) == null || n.call(e, {
133
+ e.onDocumentCreated?.({
137
134
  documentId: t.data.documentId,
138
135
  externalId: t.data.externalId
139
136
  });
@@ -141,13 +138,13 @@ function C(e) {
141
138
  }
142
139
  }
143
140
  let d;
144
- return r(() => {
145
- window.addEventListener("message", s);
141
+ return m(() => {
142
+ window.addEventListener("message", r);
146
143
  }), (() => {
147
- var t = U(), n = d;
144
+ var t = I(), n = d;
148
145
  return typeof n == "function" ? k(n, t) : d = t, l((a) => {
149
- var c = e.className, o = i();
150
- return c !== a.e && b(t, a.e = c), o !== a.t && f(t, "src", a.t = o), a;
146
+ var o = e.className, s = c();
147
+ return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
151
148
  }, {
152
149
  e: void 0,
153
150
  t: void 0
@@ -155,8 +152,8 @@ function C(e) {
155
152
  })();
156
153
  }
157
154
  var E = /* @__PURE__ */ u("<iframe>");
158
- function S(e) {
159
- const i = m(() => {
155
+ function $(e) {
156
+ const c = i(() => {
160
157
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
161
158
  externalId: e.externalId,
162
159
  features: e.features,
@@ -167,12 +164,11 @@ function S(e) {
167
164
  }))), a = new URL("/embed/v1/authoring/template/create", t);
168
165
  return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
169
166
  });
170
- function s(t) {
171
- var n;
172
- if ((d == null ? void 0 : d.contentWindow) === t.source)
167
+ function r(t) {
168
+ if (d?.contentWindow === t.source)
173
169
  switch (t.data.type) {
174
170
  case "template-created":
175
- (n = e.onTemplateCreated) == null || n.call(e, {
171
+ e.onTemplateCreated?.({
176
172
  templateId: t.data.templateId,
177
173
  externalId: t.data.externalId
178
174
  });
@@ -180,22 +176,22 @@ function S(e) {
180
176
  }
181
177
  }
182
178
  let d;
183
- return r(() => {
184
- window.addEventListener("message", s);
179
+ return m(() => {
180
+ window.addEventListener("message", r);
185
181
  }), (() => {
186
182
  var t = E(), n = d;
187
183
  return typeof n == "function" ? k(n, t) : d = t, l((a) => {
188
- var c = e.className, o = i();
189
- return c !== a.e && b(t, a.e = c), o !== a.t && f(t, "src", a.t = o), a;
184
+ var o = e.className, s = c();
185
+ return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
190
186
  }, {
191
187
  e: void 0,
192
188
  t: void 0
193
189
  }), t;
194
190
  })();
195
191
  }
196
- var M = /* @__PURE__ */ u("<iframe>");
197
- function L(e) {
198
- const i = m(() => {
192
+ var U = /* @__PURE__ */ u("<iframe>");
193
+ function x(e) {
194
+ const c = i(() => {
199
195
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
200
196
  token: e.presignToken,
201
197
  externalId: e.externalId,
@@ -203,16 +199,16 @@ function L(e) {
203
199
  css: e.css,
204
200
  cssVars: e.cssVars,
205
201
  darkModeDisabled: e.darkModeDisabled,
202
+ onlyEditFields: e.onlyEditFields,
206
203
  ...e.additionalProps
207
204
  }))), a = new URL(`/embed/v1/authoring/document/edit/${e.documentId}`, t);
208
205
  return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
209
206
  });
210
- function s(t) {
211
- var n;
212
- if ((d == null ? void 0 : d.contentWindow) === t.source)
207
+ function r(t) {
208
+ if (d?.contentWindow === t.source)
213
209
  switch (t.data.type) {
214
210
  case "document-updated":
215
- (n = e.onDocumentUpdated) == null || n.call(e, {
211
+ e.onDocumentUpdated?.({
216
212
  documentId: t.data.documentId,
217
213
  externalId: t.data.externalId
218
214
  });
@@ -220,13 +216,13 @@ function L(e) {
220
216
  }
221
217
  }
222
218
  let d;
223
- return r(() => {
224
- window.addEventListener("message", s);
219
+ return m(() => {
220
+ window.addEventListener("message", r);
225
221
  }), (() => {
226
- var t = M(), n = d;
222
+ var t = U(), n = d;
227
223
  return typeof n == "function" ? k(n, t) : d = t, l((a) => {
228
- var c = e.className, o = i();
229
- return c !== a.e && b(t, a.e = c), o !== a.t && f(t, "src", a.t = o), a;
224
+ var o = e.className, s = c();
225
+ return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
230
226
  }, {
231
227
  e: void 0,
232
228
  t: void 0
@@ -235,23 +231,23 @@ function L(e) {
235
231
  }
236
232
  var y = /* @__PURE__ */ u("<iframe>");
237
233
  function V(e) {
238
- const i = m(() => {
234
+ const c = i(() => {
239
235
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
240
236
  externalId: e.externalId,
241
237
  features: e.features,
242
238
  css: e.css,
243
239
  cssVars: e.cssVars,
244
240
  darkModeDisabled: e.darkModeDisabled,
241
+ onlyEditFields: e.onlyEditFields,
245
242
  ...e.additionalProps
246
243
  }))), a = new URL(`/embed/v1/authoring/template/edit/${e.templateId}`, t);
247
244
  return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
248
245
  });
249
- function s(t) {
250
- var n;
251
- if ((d == null ? void 0 : d.contentWindow) === t.source)
246
+ function r(t) {
247
+ if (d?.contentWindow === t.source)
252
248
  switch (t.data.type) {
253
249
  case "template-updated":
254
- (n = e.onTemplateUpdated) == null || n.call(e, {
250
+ e.onTemplateUpdated?.({
255
251
  templateId: t.data.templateId,
256
252
  externalId: t.data.externalId
257
253
  });
@@ -259,22 +255,22 @@ function V(e) {
259
255
  }
260
256
  }
261
257
  let d;
262
- return r(() => {
263
- window.addEventListener("message", s);
258
+ return m(() => {
259
+ window.addEventListener("message", r);
264
260
  }), (() => {
265
261
  var t = y(), n = d;
266
262
  return typeof n == "function" ? k(n, t) : d = t, l((a) => {
267
- var c = e.className, o = i();
268
- return c !== a.e && b(t, a.e = c), o !== a.t && f(t, "src", a.t = o), a;
263
+ var o = e.className, s = c();
264
+ return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
269
265
  }, {
270
266
  e: void 0,
271
267
  t: void 0
272
268
  }), t;
273
269
  })();
274
270
  }
275
- var N = /* @__PURE__ */ u("<iframe>");
276
- function O(e) {
277
- const i = m(() => {
271
+ var M = /* @__PURE__ */ u("<iframe>");
272
+ function S(e) {
273
+ const c = i(() => {
278
274
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
279
275
  name: e.name,
280
276
  lockName: e.lockName,
@@ -284,39 +280,38 @@ function O(e) {
284
280
  allowDocumentRejection: e.allowDocumentRejection,
285
281
  ...e.additionalProps
286
282
  }))), a = new URL("/embed/v1/multisign", t);
287
- for (const c of e.tokens)
288
- a.searchParams.append("token", c);
283
+ for (const o of e.tokens)
284
+ a.searchParams.append("token", o);
289
285
  return `${a}#${n}`;
290
286
  });
291
- function s(t) {
292
- var n, a, c, o, h;
293
- if ((d == null ? void 0 : d.contentWindow) === t.source)
287
+ function r(t) {
288
+ if (d?.contentWindow === t.source)
294
289
  switch (t.data.action) {
295
290
  case "document-ready":
296
- (n = e.onDocumentReady) == null || n.call(e);
291
+ e.onDocumentReady?.();
297
292
  break;
298
293
  case "document-completed":
299
- (a = e.onDocumentCompleted) == null || a.call(e, t.data.data);
294
+ e.onDocumentCompleted?.(t.data.data);
300
295
  break;
301
296
  case "document-error":
302
- (c = e.onDocumentError) == null || c.call(e, t.data.data);
297
+ e.onDocumentError?.(t.data.data);
303
298
  break;
304
299
  case "document-rejected":
305
- (o = e.onDocumentRejected) == null || o.call(e, t.data.data);
300
+ e.onDocumentRejected?.(t.data.data);
306
301
  break;
307
302
  case "all-documents-completed":
308
- (h = e.onAllDocumentsCompleted) == null || h.call(e, t.data.data);
303
+ e.onAllDocumentsCompleted?.(t.data.data);
309
304
  break;
310
305
  }
311
306
  }
312
307
  let d;
313
- return r(() => {
314
- window.addEventListener("message", s);
308
+ return m(() => {
309
+ window.addEventListener("message", r);
315
310
  }), (() => {
316
- var t = N(), n = d;
311
+ var t = M(), n = d;
317
312
  return typeof n == "function" ? k(n, t) : d = t, l((a) => {
318
- var c = e.className, o = i();
319
- return c !== a.e && b(t, a.e = c), o !== a.t && f(t, "src", a.t = o), a;
313
+ var o = e.className, s = c();
314
+ return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
320
315
  }, {
321
316
  e: void 0,
322
317
  t: void 0
@@ -324,11 +319,15 @@ function O(e) {
324
319
  })();
325
320
  }
326
321
  export {
327
- $ as EmbedDirectTemplate,
328
- x as EmbedSignDocument,
322
+ C as EmbedCreateDocumentV1,
323
+ $ as EmbedCreateTemplateV1,
324
+ N as EmbedDirectTemplate,
325
+ R as EmbedSignDocument,
326
+ x as EmbedUpdateDocumentV1,
327
+ V as EmbedUpdateTemplateV1,
329
328
  C as unstable_EmbedCreateDocument,
330
- S as unstable_EmbedCreateTemplate,
331
- O as unstable_EmbedMultiSignDocument,
332
- L as unstable_EmbedUpdateDocument,
329
+ $ as unstable_EmbedCreateTemplate,
330
+ S as unstable_EmbedMultiSignDocument,
331
+ x as unstable_EmbedUpdateDocument,
333
332
  V as unstable_EmbedUpdateTemplate
334
333
  };
@@ -16,6 +16,7 @@ export type EmbedUpdateDocumentProps = {
16
16
  allowConfigureRedirectUrl?: boolean;
17
17
  allowConfigureCommunication?: boolean;
18
18
  };
19
+ onlyEditFields?: boolean | undefined;
19
20
  additionalProps?: Record<string, string | number | boolean> | undefined;
20
21
  onDocumentUpdated?: (data: {
21
22
  externalId: string;
@@ -16,6 +16,7 @@ export type EmbedUpdateTemplateProps = {
16
16
  allowConfigureRedirectUrl?: boolean;
17
17
  allowConfigureCommunication?: boolean;
18
18
  };
19
+ onlyEditFields?: boolean | undefined;
19
20
  additionalProps?: Record<string, string | number | boolean> | undefined;
20
21
  onTemplateUpdated?: (data: {
21
22
  externalId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-solid",
3
- "version": "0.2.3",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"
@@ -37,7 +37,7 @@
37
37
  "devDependencies": {
38
38
  "@documenso/embed": "*",
39
39
  "vite-plugin-solid": "^2.10.2",
40
- "vite": "^5.4.2",
40
+ "vite": "^7.0.0",
41
41
  "vite-plugin-dts": "^4.1.0"
42
42
  }
43
43
  }