@documenso/embed-solid 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
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;
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 C(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 C(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 E = /* @__PURE__ */ u("<iframe>");
130
+ var D = /* @__PURE__ */ f("<iframe>");
155
131
  function $(e) {
156
- const c = i(() => {
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 $(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 = E(), 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 U = /* @__PURE__ */ u("<iframe>");
193
- function x(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,
@@ -205,33 +176,28 @@ function x(e) {
205
176
  return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
206
177
  });
207
178
  function r(t) {
208
- if (d?.contentWindow === t.source)
209
- switch (t.data.type) {
210
- case "document-updated":
211
- e.onDocumentUpdated?.({
212
- documentId: t.data.documentId,
213
- externalId: t.data.externalId
214
- });
215
- break;
216
- }
179
+ d?.contentWindow === t.source && t.data.type === "document-updated" && e.onDocumentUpdated?.({
180
+ documentId: t.data.documentId,
181
+ externalId: t.data.externalId
182
+ });
217
183
  }
218
184
  let d;
219
- return m(() => {
185
+ return k(() => {
220
186
  window.addEventListener("message", r);
221
187
  }), (() => {
222
- var t = U(), n = d;
223
- return typeof n == "function" ? k(n, t) : d = t, l((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;
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;
226
192
  }, {
227
193
  e: void 0,
228
194
  t: void 0
229
195
  }), t;
230
196
  })();
231
197
  }
232
- var y = /* @__PURE__ */ u("<iframe>");
233
- function V(e) {
234
- const c = i(() => {
198
+ var I = /* @__PURE__ */ f("<iframe>");
199
+ function x(e) {
200
+ const s = b(() => {
235
201
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
236
202
  externalId: e.externalId,
237
203
  features: e.features,
@@ -244,33 +210,28 @@ function V(e) {
244
210
  return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
245
211
  });
246
212
  function r(t) {
247
- if (d?.contentWindow === t.source)
248
- switch (t.data.type) {
249
- case "template-updated":
250
- e.onTemplateUpdated?.({
251
- templateId: t.data.templateId,
252
- externalId: t.data.externalId
253
- });
254
- break;
255
- }
213
+ d?.contentWindow === t.source && t.data.type === "template-updated" && e.onTemplateUpdated?.({
214
+ templateId: t.data.templateId,
215
+ externalId: t.data.externalId
216
+ });
256
217
  }
257
218
  let d;
258
- return m(() => {
219
+ return k(() => {
259
220
  window.addEventListener("message", r);
260
221
  }), (() => {
261
- var t = y(), n = d;
262
- return typeof n == "function" ? k(n, t) : d = t, l((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;
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;
265
226
  }, {
266
227
  e: void 0,
267
228
  t: void 0
268
229
  }), t;
269
230
  })();
270
231
  }
271
- var M = /* @__PURE__ */ u("<iframe>");
272
- function S(e) {
273
- const c = i(() => {
232
+ var E = /* @__PURE__ */ f("<iframe>");
233
+ function C(e) {
234
+ const s = b(() => {
274
235
  const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
275
236
  name: e.name,
276
237
  lockName: e.lockName,
@@ -280,8 +241,8 @@ function S(e) {
280
241
  allowDocumentRejection: e.allowDocumentRejection,
281
242
  ...e.additionalProps
282
243
  }))), a = new URL("/embed/v1/multisign", t);
283
- for (const o of e.tokens)
284
- a.searchParams.append("token", o);
244
+ for (const c of e.tokens)
245
+ a.searchParams.append("token", c);
285
246
  return `${a}#${n}`;
286
247
  });
287
248
  function r(t) {
@@ -305,13 +266,13 @@ function S(e) {
305
266
  }
306
267
  }
307
268
  let d;
308
- return m(() => {
269
+ return k(() => {
309
270
  window.addEventListener("message", r);
310
271
  }), (() => {
311
- var t = M(), n = d;
312
- return typeof n == "function" ? k(n, t) : d = t, l((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;
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;
315
276
  }, {
316
277
  e: void 0,
317
278
  t: void 0
@@ -319,15 +280,15 @@ function S(e) {
319
280
  })();
320
281
  }
321
282
  export {
322
- C as EmbedCreateDocumentV1,
283
+ R as EmbedCreateDocumentV1,
323
284
  $ as EmbedCreateTemplateV1,
324
- N as EmbedDirectTemplate,
325
- R as EmbedSignDocument,
326
- x as EmbedUpdateDocumentV1,
327
- V as EmbedUpdateTemplateV1,
328
- C as unstable_EmbedCreateDocument,
285
+ _ as EmbedDirectTemplate,
286
+ M as EmbedSignDocument,
287
+ N as EmbedUpdateDocumentV1,
288
+ x as EmbedUpdateTemplateV1,
289
+ R as unstable_EmbedCreateDocument,
329
290
  $ as unstable_EmbedCreateTemplate,
330
- S as unstable_EmbedMultiSignDocument,
331
- x as unstable_EmbedUpdateDocument,
332
- V as unstable_EmbedUpdateTemplate
291
+ C as unstable_EmbedMultiSignDocument,
292
+ N as unstable_EmbedUpdateDocument,
293
+ x as unstable_EmbedUpdateTemplate
333
294
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-solid",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
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
  }