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