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