@documenso/embed-preact 0.2.2 → 0.2.3

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
@@ -4,3 +4,4 @@ export { default as unstable_EmbedCreateDocument } from './create-document';
4
4
  export { default as unstable_EmbedCreateTemplate } from './create-template';
5
5
  export { default as unstable_EmbedUpdateDocument } from './update-document';
6
6
  export { default as unstable_EmbedUpdateTemplate } from './update-template';
7
+ export { default as unstable_EmbedMultiSignDocument } from './multisign-document';
package/dist/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export { default as unstable_EmbedCreateDocument } from './create-document';
4
4
  export { default as unstable_EmbedCreateTemplate } from './create-template';
5
5
  export { default as unstable_EmbedUpdateDocument } from './update-document';
6
6
  export { default as unstable_EmbedUpdateTemplate } from './update-template';
7
+ export { default as unstable_EmbedMultiSignDocument } from './multisign-document';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("preact"),s=require("preact/hooks");var b=0;function r(e,c,i,d,t,n){c||(c={});var a,o,m=c;if("ref"in m)for(o in m={},c)o=="ref"?a=c[o]:m[o]=c[o];var u={type:e,props:m,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--b,__i:-1,__u:0,__source:t,__self:n};return f.options.vnode&&f.options.vnode(u),u}function g(e){const c=s.useRef(null);function i(){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 d(t){var n,a,o,m,u,l;if(((n=c.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(o=e.onDocumentCompleted)==null||o.call(e,t.data.data);break;case"document-error":(m=e.onDocumentError)==null||m.call(e,t.data.data);break;case"field-signed":(u=e.onFieldSigned)==null||u.call(e);break;case"field-unsigned":(l=e.onFieldUnsigned)==null||l.call(e);break}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),r("iframe",{ref:c,className:e.className,src:i()})}function k(e){const c=s.useRef(null);function i(){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 d(t){var n,a,o,m,u;if(((n=c.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(o=e.onDocumentCompleted)==null||o.call(e,t.data.data);break;case"document-error":(m=e.onDocumentError)==null||m.call(e,t.data.data);break;case"document-rejected":(u=e.onDocumentRejected)==null||u.call(e,t.data.data);break}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),r("iframe",{ref:c,className:e.className,src:i()})}function w(e){const c=s.useRef(null);function i(){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 d(t){var n,a;if(((n=c.current)==null?void 0:n.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}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),r("iframe",{ref:c,className:e.className,src:i()})}function h(e){const c=s.useRef(null);function i(){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 d(t){var n,a;if(((n=c.current)==null?void 0:n.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}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),r("iframe",{ref:c,className:e.className,src:i()})}function E(e){const c=s.useRef(null);function i(){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 d(t){var n,a;if(((n=c.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.type){case"document-updated":(a=e.onDocumentUpdated)==null||a.call(e,{documentId:t.data.documentId,externalId:t.data.externalId});break}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),r("iframe",{ref:c,className:e.className,src:i()})}function _(e){const c=s.useRef(null);function i(){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 d(t){var n,a;if(((n=c.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.type){case"template-updated":(a=e.onTemplateUpdated)==null||a.call(e,{templateId:t.data.templateId,externalId:t.data.externalId});break}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),r("iframe",{ref:c,className:e.className,src:i()})}exports.EmbedDirectTemplate=g;exports.EmbedSignDocument=k;exports.unstable_EmbedCreateDocument=w;exports.unstable_EmbedCreateTemplate=h;exports.unstable_EmbedUpdateDocument=E;exports.unstable_EmbedUpdateTemplate=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("preact"),s=require("preact/hooks");var b=0;function l(e,c,o,d,t,n){c||(c={});var a,i,m=c;if("ref"in m)for(i in m={},c)i=="ref"?a=c[i]:m[i]=c[i];var u={type:e,props:m,key:o,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--b,__i:-1,__u:0,__source:t,__self:n};return f.options.vnode&&f.options.vnode(u),u}function k(e){const c=s.useRef(null);function o(){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 d(t){var n,a,i,m,u,r;if(((n=c.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(i=e.onDocumentCompleted)==null||i.call(e,t.data.data);break;case"document-error":(m=e.onDocumentError)==null||m.call(e,t.data.data);break;case"field-signed":(u=e.onFieldSigned)==null||u.call(e);break;case"field-unsigned":(r=e.onFieldUnsigned)==null||r.call(e);break}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),l("iframe",{ref:c,className:e.className,src:o()})}function g(e){const c=s.useRef(null);function o(){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 d(t){var n,a,i,m,u;if(((n=c.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(i=e.onDocumentCompleted)==null||i.call(e,t.data.data);break;case"document-error":(m=e.onDocumentError)==null||m.call(e,t.data.data);break;case"document-rejected":(u=e.onDocumentRejected)==null||u.call(e,t.data.data);break}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),l("iframe",{ref:c,className:e.className,src:o()})}function w(e){const c=s.useRef(null);function o(){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 d(t){var n,a;if(((n=c.current)==null?void 0:n.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}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),l("iframe",{ref:c,className:e.className,src:o()})}function h(e){const c=s.useRef(null);function o(){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 d(t){var n,a;if(((n=c.current)==null?void 0:n.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}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),l("iframe",{ref:c,className:e.className,src:o()})}function E(e){const c=s.useRef(null);function o(){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 d(t){var n,a;if(((n=c.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.type){case"document-updated":(a=e.onDocumentUpdated)==null||a.call(e,{documentId:t.data.documentId,externalId:t.data.externalId});break}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),l("iframe",{ref:c,className:e.className,src:o()})}function D(e){const c=s.useRef(null);function o(){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 d(t){var n,a;if(((n=c.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.type){case"template-updated":(a=e.onTemplateUpdated)==null||a.call(e,{templateId:t.data.templateId,externalId:t.data.externalId});break}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),l("iframe",{ref:c,className:e.className,src:o()})}function _(e){const c=s.useRef(null);function o(){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 i of e.tokens)a.searchParams.append("token",i);return`${a}#${n}`}function d(t){var n,a,i,m,u,r;if(((n=c.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(i=e.onDocumentCompleted)==null||i.call(e,t.data.data);break;case"document-error":(m=e.onDocumentError)==null||m.call(e,t.data.data);break;case"document-rejected":(u=e.onDocumentRejected)==null||u.call(e,t.data.data);break;case"all-documents-completed":(r=e.onAllDocumentsCompleted)==null||r.call(e,t.data.data);break}}return s.useEffect(()=>{window.addEventListener("message",d)},[]),s.useEffect(()=>()=>{window.removeEventListener("message",d)},[]),l("iframe",{ref:c,className:e.className,src:o()})}exports.EmbedDirectTemplate=k;exports.EmbedSignDocument=g;exports.unstable_EmbedCreateDocument=w;exports.unstable_EmbedCreateTemplate=h;exports.unstable_EmbedMultiSignDocument=_;exports.unstable_EmbedUpdateDocument=E;exports.unstable_EmbedUpdateTemplate=D;
package/dist/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  import { options as b } from "preact";
2
- import { useRef as l, useEffect as i } from "preact/hooks";
2
+ import { useRef as u, useEffect as m } from "preact/hooks";
3
3
  var k = 0;
4
- function u(e, d, s, c, a, n) {
4
+ function r(e, d, i, c, a, n) {
5
5
  d || (d = {});
6
- var t, o, m = d;
7
- if ("ref" in m) for (o in m = {}, d) o == "ref" ? t = d[o] : m[o] = d[o];
8
- var r = { type: e, props: m, key: s, ref: t, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --k, __i: -1, __u: 0, __source: a, __self: n };
9
- return b.vnode && b.vnode(r), r;
6
+ var t, s, o = d;
7
+ if ("ref" in o) for (s in o = {}, d) s == "ref" ? t = d[s] : o[s] = d[s];
8
+ var l = { type: e, props: o, key: i, ref: t, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --k, __i: -1, __u: 0, __source: a, __self: n };
9
+ return b.vnode && b.vnode(l), l;
10
10
  }
11
11
  function h(e) {
12
- const d = l(null);
13
- function s() {
12
+ const d = u(null);
13
+ function i() {
14
14
  const a = e.host || "https://app.documenso.com", n = btoa(
15
15
  encodeURIComponent(
16
16
  JSON.stringify({
@@ -28,35 +28,35 @@ function h(e) {
28
28
  return e.externalId && t.searchParams.set("externalId", e.externalId), `${t}#${n}`;
29
29
  }
30
30
  function c(a) {
31
- var n, t, o, m, r, f;
31
+ var n, t, s, o, l, f;
32
32
  if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
33
33
  switch (a.data.action) {
34
34
  case "document-ready":
35
35
  (t = e.onDocumentReady) == null || t.call(e);
36
36
  break;
37
37
  case "document-completed":
38
- (o = e.onDocumentCompleted) == null || o.call(e, a.data.data);
38
+ (s = e.onDocumentCompleted) == null || s.call(e, a.data.data);
39
39
  break;
40
40
  case "document-error":
41
- (m = e.onDocumentError) == null || m.call(e, a.data.data);
41
+ (o = e.onDocumentError) == null || o.call(e, a.data.data);
42
42
  break;
43
43
  case "field-signed":
44
- (r = e.onFieldSigned) == null || r.call(e);
44
+ (l = e.onFieldSigned) == null || l.call(e);
45
45
  break;
46
46
  case "field-unsigned":
47
47
  (f = e.onFieldUnsigned) == null || f.call(e);
48
48
  break;
49
49
  }
50
50
  }
51
- return i(() => {
51
+ return m(() => {
52
52
  window.addEventListener("message", c);
53
- }, []), i(() => () => {
53
+ }, []), m(() => () => {
54
54
  window.removeEventListener("message", c);
55
- }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: s() });
55
+ }, []), /* @__PURE__ */ r("iframe", { ref: d, className: e.className, src: i() });
56
56
  }
57
57
  function _(e) {
58
- const d = l(null);
59
- function s() {
58
+ const d = u(null);
59
+ function i() {
60
60
  const a = e.host || "https://app.documenso.com", n = btoa(
61
61
  encodeURIComponent(
62
62
  JSON.stringify({
@@ -73,32 +73,32 @@ function _(e) {
73
73
  return `${new URL(`/embed/sign/${e.token}`, a)}#${n}`;
74
74
  }
75
75
  function c(a) {
76
- var n, t, o, m, r;
76
+ var n, t, s, o, l;
77
77
  if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
78
78
  switch (a.data.action) {
79
79
  case "document-ready":
80
80
  (t = e.onDocumentReady) == null || t.call(e);
81
81
  break;
82
82
  case "document-completed":
83
- (o = e.onDocumentCompleted) == null || o.call(e, a.data.data);
83
+ (s = e.onDocumentCompleted) == null || s.call(e, a.data.data);
84
84
  break;
85
85
  case "document-error":
86
- (m = e.onDocumentError) == null || m.call(e, a.data.data);
86
+ (o = e.onDocumentError) == null || o.call(e, a.data.data);
87
87
  break;
88
88
  case "document-rejected":
89
- (r = e.onDocumentRejected) == null || r.call(e, a.data.data);
89
+ (l = e.onDocumentRejected) == null || l.call(e, a.data.data);
90
90
  break;
91
91
  }
92
92
  }
93
- return i(() => {
93
+ return m(() => {
94
94
  window.addEventListener("message", c);
95
- }, []), i(() => () => {
95
+ }, []), m(() => () => {
96
96
  window.removeEventListener("message", c);
97
- }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: s() });
97
+ }, []), /* @__PURE__ */ r("iframe", { ref: d, className: e.className, src: i() });
98
98
  }
99
- function I(e) {
100
- const d = l(null);
101
- function s() {
99
+ function D(e) {
100
+ const d = u(null);
101
+ function i() {
102
102
  const a = e.host || "https://app.documenso.com", n = btoa(
103
103
  encodeURIComponent(
104
104
  JSON.stringify({
@@ -125,15 +125,15 @@ function I(e) {
125
125
  break;
126
126
  }
127
127
  }
128
- return i(() => {
128
+ return m(() => {
129
129
  window.addEventListener("message", c);
130
- }, []), i(() => () => {
130
+ }, []), m(() => () => {
131
131
  window.removeEventListener("message", c);
132
- }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: s() });
132
+ }, []), /* @__PURE__ */ r("iframe", { ref: d, className: e.className, src: i() });
133
133
  }
134
- function D(e) {
135
- const d = l(null);
136
- function s() {
134
+ function I(e) {
135
+ const d = u(null);
136
+ function i() {
137
137
  const a = e.host || "https://app.documenso.com", n = btoa(
138
138
  encodeURIComponent(
139
139
  JSON.stringify({
@@ -160,15 +160,15 @@ function D(e) {
160
160
  break;
161
161
  }
162
162
  }
163
- return i(() => {
163
+ return m(() => {
164
164
  window.addEventListener("message", c);
165
- }, []), i(() => () => {
165
+ }, []), m(() => () => {
166
166
  window.removeEventListener("message", c);
167
- }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: s() });
167
+ }, []), /* @__PURE__ */ r("iframe", { ref: d, className: e.className, src: i() });
168
168
  }
169
169
  function E(e) {
170
- const d = l(null);
171
- function s() {
170
+ const d = u(null);
171
+ function i() {
172
172
  const a = e.host || "https://app.documenso.com", n = btoa(
173
173
  encodeURIComponent(
174
174
  JSON.stringify({
@@ -199,15 +199,15 @@ function E(e) {
199
199
  break;
200
200
  }
201
201
  }
202
- return i(() => {
202
+ return m(() => {
203
203
  window.addEventListener("message", c);
204
- }, []), i(() => () => {
204
+ }, []), m(() => () => {
205
205
  window.removeEventListener("message", c);
206
- }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: s() });
206
+ }, []), /* @__PURE__ */ r("iframe", { ref: d, className: e.className, src: i() });
207
207
  }
208
208
  function U(e) {
209
- const d = l(null);
210
- function s() {
209
+ const d = u(null);
210
+ function i() {
211
211
  const a = e.host || "https://app.documenso.com", n = btoa(
212
212
  encodeURIComponent(
213
213
  JSON.stringify({
@@ -237,17 +237,65 @@ function U(e) {
237
237
  break;
238
238
  }
239
239
  }
240
- return i(() => {
240
+ return m(() => {
241
+ window.addEventListener("message", c);
242
+ }, []), m(() => () => {
243
+ window.removeEventListener("message", c);
244
+ }, []), /* @__PURE__ */ r("iframe", { ref: d, className: e.className, src: i() });
245
+ }
246
+ function N(e) {
247
+ const d = u(null);
248
+ function i() {
249
+ const a = e.host || "https://app.documenso.com", n = btoa(
250
+ encodeURIComponent(
251
+ JSON.stringify({
252
+ name: e.name,
253
+ lockName: e.lockName,
254
+ css: e.css,
255
+ cssVars: e.cssVars,
256
+ darkModeDisabled: e.darkModeDisabled,
257
+ allowDocumentRejection: e.allowDocumentRejection,
258
+ ...e.additionalProps
259
+ })
260
+ )
261
+ ), t = new URL("/embed/v1/multisign", a);
262
+ for (const s of e.tokens)
263
+ t.searchParams.append("token", s);
264
+ return `${t}#${n}`;
265
+ }
266
+ function c(a) {
267
+ var n, t, s, o, l, f;
268
+ if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
269
+ switch (a.data.action) {
270
+ case "document-ready":
271
+ (t = e.onDocumentReady) == null || t.call(e);
272
+ break;
273
+ case "document-completed":
274
+ (s = e.onDocumentCompleted) == null || s.call(e, a.data.data);
275
+ break;
276
+ case "document-error":
277
+ (o = e.onDocumentError) == null || o.call(e, a.data.data);
278
+ break;
279
+ case "document-rejected":
280
+ (l = e.onDocumentRejected) == null || l.call(e, a.data.data);
281
+ break;
282
+ case "all-documents-completed":
283
+ (f = e.onAllDocumentsCompleted) == null || f.call(e, a.data.data);
284
+ break;
285
+ }
286
+ }
287
+ return m(() => {
241
288
  window.addEventListener("message", c);
242
- }, []), i(() => () => {
289
+ }, []), m(() => () => {
243
290
  window.removeEventListener("message", c);
244
- }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: s() });
291
+ }, []), /* @__PURE__ */ r("iframe", { ref: d, className: e.className, src: i() });
245
292
  }
246
293
  export {
247
294
  h as EmbedDirectTemplate,
248
295
  _ as EmbedSignDocument,
249
- I as unstable_EmbedCreateDocument,
250
- D as unstable_EmbedCreateTemplate,
296
+ D as unstable_EmbedCreateDocument,
297
+ I as unstable_EmbedCreateTemplate,
298
+ N as unstable_EmbedMultiSignDocument,
251
299
  E as unstable_EmbedUpdateDocument,
252
300
  U as unstable_EmbedUpdateTemplate
253
301
  };
@@ -0,0 +1,38 @@
1
+ import { h } from 'preact';
2
+ import { CssVars } from './css-vars';
3
+ export type EmbedMultiSignDocumentProps = {
4
+ className?: string;
5
+ host?: string;
6
+ tokens: string[];
7
+ css?: string | undefined;
8
+ cssVars?: (CssVars & Record<string, string>) | undefined;
9
+ darkModeDisabled?: boolean | undefined;
10
+ name?: string | undefined;
11
+ lockName?: boolean | undefined;
12
+ allowDocumentRejection?: boolean | undefined;
13
+ additionalProps?: Record<string, string | number | boolean> | undefined;
14
+ onDocumentReady?: () => void;
15
+ onDocumentCompleted?: (data: {
16
+ token: string;
17
+ documentId: number;
18
+ recipientId: number;
19
+ }) => void;
20
+ onDocumentError?: (error: string) => void;
21
+ onDocumentRejected?: (data: {
22
+ token: string;
23
+ documentId: number;
24
+ recipientId: number;
25
+ reason: string;
26
+ }) => void;
27
+ onAllDocumentsCompleted?: (data: {
28
+ documents: Array<{
29
+ token: string;
30
+ documentId: number;
31
+ recipientId: number;
32
+ action: "document-completed" | "document-rejected";
33
+ reason?: string;
34
+ }>;
35
+ }) => void;
36
+ };
37
+ declare function EmbedMultiSignDocument(props: EmbedMultiSignDocumentProps): h.JSX.Element;
38
+ export default EmbedMultiSignDocument;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-preact",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"