@documenso/embed-react 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 m=require("react/jsx-runtime"),c=require("react");function f(e){const d=c.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 s(t){var n,a,o,u,r,l;if(((n=d.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":(u=e.onDocumentError)==null||u.call(e,t.data.data);break;case"field-signed":(r=e.onFieldSigned)==null||r.call(e);break;case"field-unsigned":(l=e.onFieldUnsigned)==null||l.call(e);break}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),m.jsx("iframe",{ref:d,className:e.className,src:i()})}function b(e){const d=c.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 s(t){var n,a,o,u,r;if(((n=d.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":(u=e.onDocumentError)==null||u.call(e,t.data.data);break;case"document-rejected":(r=e.onDocumentRejected)==null||r.call(e,t.data.data);break}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),m.jsx("iframe",{ref:d,className:e.className,src:i()})}function g(e){const d=c.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 s(t){var n,a;if(((n=d.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 c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),m.jsx("iframe",{ref:d,className:e.className,src:i()})}function w(e){const d=c.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 s(t){var n,a;if(((n=d.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 c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),m.jsx("iframe",{ref:d,className:e.className,src:i()})}function k(e){const d=c.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 s(t){var n,a;if(((n=d.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 c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),m.jsx("iframe",{ref:d,className:e.className,src:i()})}function h(e){const d=c.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 s(t){var n,a;if(((n=d.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 c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),m.jsx("iframe",{ref:d,className:e.className,src:i()})}exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=b;exports.unstable_EmbedCreateDocument=g;exports.unstable_EmbedCreateTemplate=w;exports.unstable_EmbedUpdateDocument=k;exports.unstable_EmbedUpdateTemplate=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),c=require("react");function f(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&a.searchParams.set("externalId",e.externalId),`${a}#${n}`}function s(t){var n,a,i,o,u,r;if(((n=d.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":(o=e.onDocumentError)==null||o.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 c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function b(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps})));return`${new URL(`/embed/sign/${e.token}`,t)}#${n}`}function s(t){var n,a,i,o,u;if(((n=d.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":(o=e.onDocumentError)==null||o.call(e,t.data.data);break;case"document-rejected":(u=e.onDocumentRejected)==null||u.call(e,t.data.data);break}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function k(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL("/embed/v1/authoring/document/create",t);return a.searchParams.set("token",e.presignToken),a.hash=n,a.toString()}function s(t){var n,a;if(((n=d.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 c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function g(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL("/embed/v1/authoring/template/create",t);return a.searchParams.set("token",e.presignToken),a.hash=n,a.toString()}function s(t){var n,a;if(((n=d.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 c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function w(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL(`/embed/v1/authoring/document/edit/${e.documentId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=n,a.toString()}function s(t){var n,a;if(((n=d.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 c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function E(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL(`/embed/v1/authoring/template/edit/${e.templateId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=n,a.toString()}function s(t){var n,a;if(((n=d.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 c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function h(e){const d=c.useRef(null);function m(){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 s(t){var n,a,i,o,u,r;if(((n=d.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":(o=e.onDocumentError)==null||o.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 c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=b;exports.unstable_EmbedCreateDocument=k;exports.unstable_EmbedCreateTemplate=g;exports.unstable_EmbedMultiSignDocument=h;exports.unstable_EmbedUpdateDocument=w;exports.unstable_EmbedUpdateTemplate=E;
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { useRef as o, useEffect as s } from "react";
3
- function g(e) {
4
- const d = o(null);
5
- function i() {
6
- const t = e.host || "https://app.documenso.com", n = btoa(
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { useRef as r, useEffect as s } from "react";
3
+ function w(e) {
4
+ const d = r(null);
5
+ function m() {
6
+ const a = e.host || "https://app.documenso.com", n = btoa(
7
7
  encodeURIComponent(
8
8
  JSON.stringify({
9
9
  name: e.name,
@@ -16,24 +16,24 @@ function g(e) {
16
16
  ...e.additionalProps
17
17
  })
18
18
  )
19
- ), a = new URL(`/embed/direct/${e.token}`, t);
20
- return e.externalId && a.searchParams.set("externalId", e.externalId), `${a}#${n}`;
19
+ ), t = new URL(`/embed/direct/${e.token}`, a);
20
+ return e.externalId && t.searchParams.set("externalId", e.externalId), `${t}#${n}`;
21
21
  }
22
- function c(t) {
23
- var n, a, r, l, u, f;
24
- if (((n = d.current) == null ? void 0 : n.contentWindow) === t.source)
25
- switch (t.data.action) {
22
+ function c(a) {
23
+ var n, t, i, o, l, f;
24
+ if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
25
+ switch (a.data.action) {
26
26
  case "document-ready":
27
- (a = e.onDocumentReady) == null || a.call(e);
27
+ (t = e.onDocumentReady) == null || t.call(e);
28
28
  break;
29
29
  case "document-completed":
30
- (r = e.onDocumentCompleted) == null || r.call(e, t.data.data);
30
+ (i = e.onDocumentCompleted) == null || i.call(e, a.data.data);
31
31
  break;
32
32
  case "document-error":
33
- (l = e.onDocumentError) == null || l.call(e, t.data.data);
33
+ (o = e.onDocumentError) == null || o.call(e, a.data.data);
34
34
  break;
35
35
  case "field-signed":
36
- (u = e.onFieldSigned) == null || u.call(e);
36
+ (l = e.onFieldSigned) == null || l.call(e);
37
37
  break;
38
38
  case "field-unsigned":
39
39
  (f = e.onFieldUnsigned) == null || f.call(e);
@@ -44,12 +44,12 @@ function g(e) {
44
44
  window.addEventListener("message", c);
45
45
  }, []), s(() => () => {
46
46
  window.removeEventListener("message", c);
47
- }, []), /* @__PURE__ */ m("iframe", { ref: d, className: e.className, src: i() });
47
+ }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
48
48
  }
49
- function k(e) {
50
- const d = o(null);
51
- function i() {
52
- const t = e.host || "https://app.documenso.com", n = btoa(
49
+ function g(e) {
50
+ const d = r(null);
51
+ function m() {
52
+ const a = e.host || "https://app.documenso.com", n = btoa(
53
53
  encodeURIComponent(
54
54
  JSON.stringify({
55
55
  name: e.name,
@@ -62,23 +62,23 @@ function k(e) {
62
62
  })
63
63
  )
64
64
  );
65
- return `${new URL(`/embed/sign/${e.token}`, t)}#${n}`;
65
+ return `${new URL(`/embed/sign/${e.token}`, a)}#${n}`;
66
66
  }
67
- function c(t) {
68
- var n, a, r, l, u;
69
- if (((n = d.current) == null ? void 0 : n.contentWindow) === t.source)
70
- switch (t.data.action) {
67
+ function c(a) {
68
+ var n, t, i, o, l;
69
+ if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
70
+ switch (a.data.action) {
71
71
  case "document-ready":
72
- (a = e.onDocumentReady) == null || a.call(e);
72
+ (t = e.onDocumentReady) == null || t.call(e);
73
73
  break;
74
74
  case "document-completed":
75
- (r = e.onDocumentCompleted) == null || r.call(e, t.data.data);
75
+ (i = e.onDocumentCompleted) == null || i.call(e, a.data.data);
76
76
  break;
77
77
  case "document-error":
78
- (l = e.onDocumentError) == null || l.call(e, t.data.data);
78
+ (o = e.onDocumentError) == null || o.call(e, a.data.data);
79
79
  break;
80
80
  case "document-rejected":
81
- (u = e.onDocumentRejected) == null || u.call(e, t.data.data);
81
+ (l = e.onDocumentRejected) == null || l.call(e, a.data.data);
82
82
  break;
83
83
  }
84
84
  }
@@ -86,12 +86,12 @@ function k(e) {
86
86
  window.addEventListener("message", c);
87
87
  }, []), s(() => () => {
88
88
  window.removeEventListener("message", c);
89
- }, []), /* @__PURE__ */ m("iframe", { ref: d, className: e.className, src: i() });
89
+ }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
90
90
  }
91
91
  function h(e) {
92
- const d = o(null);
93
- function i() {
94
- const t = e.host || "https://app.documenso.com", n = btoa(
92
+ const d = r(null);
93
+ function m() {
94
+ const a = e.host || "https://app.documenso.com", n = btoa(
95
95
  encodeURIComponent(
96
96
  JSON.stringify({
97
97
  externalId: e.externalId,
@@ -102,17 +102,17 @@ function h(e) {
102
102
  ...e.additionalProps
103
103
  })
104
104
  )
105
- ), a = new URL("/embed/v1/authoring/document/create", t);
106
- return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
105
+ ), t = new URL("/embed/v1/authoring/document/create", a);
106
+ return t.searchParams.set("token", e.presignToken), t.hash = n, t.toString();
107
107
  }
108
- function c(t) {
109
- var n, a;
110
- if (((n = d.current) == null ? void 0 : n.contentWindow) === t.source)
111
- switch (t.data.type) {
108
+ function c(a) {
109
+ var n, t;
110
+ if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
111
+ switch (a.data.type) {
112
112
  case "document-created":
113
- (a = e.onDocumentCreated) == null || a.call(e, {
114
- documentId: t.data.documentId,
115
- externalId: t.data.externalId
113
+ (t = e.onDocumentCreated) == null || t.call(e, {
114
+ documentId: a.data.documentId,
115
+ externalId: a.data.externalId
116
116
  });
117
117
  break;
118
118
  }
@@ -121,12 +121,12 @@ function h(e) {
121
121
  window.addEventListener("message", c);
122
122
  }, []), s(() => () => {
123
123
  window.removeEventListener("message", c);
124
- }, []), /* @__PURE__ */ m("iframe", { ref: d, className: e.className, src: i() });
124
+ }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
125
125
  }
126
- function I(e) {
127
- const d = o(null);
128
- function i() {
129
- const t = e.host || "https://app.documenso.com", n = btoa(
126
+ function D(e) {
127
+ const d = r(null);
128
+ function m() {
129
+ const a = e.host || "https://app.documenso.com", n = btoa(
130
130
  encodeURIComponent(
131
131
  JSON.stringify({
132
132
  externalId: e.externalId,
@@ -137,17 +137,17 @@ function I(e) {
137
137
  ...e.additionalProps
138
138
  })
139
139
  )
140
- ), a = new URL("/embed/v1/authoring/template/create", t);
141
- return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
140
+ ), t = new URL("/embed/v1/authoring/template/create", a);
141
+ return t.searchParams.set("token", e.presignToken), t.hash = n, t.toString();
142
142
  }
143
- function c(t) {
144
- var n, a;
145
- if (((n = d.current) == null ? void 0 : n.contentWindow) === t.source)
146
- switch (t.data.type) {
143
+ function c(a) {
144
+ var n, t;
145
+ if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
146
+ switch (a.data.type) {
147
147
  case "template-created":
148
- (a = e.onTemplateCreated) == null || a.call(e, {
149
- templateId: t.data.templateId,
150
- externalId: t.data.externalId
148
+ (t = e.onTemplateCreated) == null || t.call(e, {
149
+ templateId: a.data.templateId,
150
+ externalId: a.data.externalId
151
151
  });
152
152
  break;
153
153
  }
@@ -156,12 +156,12 @@ function I(e) {
156
156
  window.addEventListener("message", c);
157
157
  }, []), s(() => () => {
158
158
  window.removeEventListener("message", c);
159
- }, []), /* @__PURE__ */ m("iframe", { ref: d, className: e.className, src: i() });
159
+ }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
160
160
  }
161
- function D(e) {
162
- const d = o(null);
163
- function i() {
164
- const t = e.host || "https://app.documenso.com", n = btoa(
161
+ function I(e) {
162
+ const d = r(null);
163
+ function m() {
164
+ const a = e.host || "https://app.documenso.com", n = btoa(
165
165
  encodeURIComponent(
166
166
  JSON.stringify({
167
167
  token: e.presignToken,
@@ -173,20 +173,20 @@ function D(e) {
173
173
  ...e.additionalProps
174
174
  })
175
175
  )
176
- ), a = new URL(
176
+ ), t = new URL(
177
177
  `/embed/v1/authoring/document/edit/${e.documentId}`,
178
- t
178
+ a
179
179
  );
180
- return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
180
+ return t.searchParams.set("token", e.presignToken), t.hash = n, t.toString();
181
181
  }
182
- function c(t) {
183
- var n, a;
184
- if (((n = d.current) == null ? void 0 : n.contentWindow) === t.source)
185
- switch (t.data.type) {
182
+ function c(a) {
183
+ var n, t;
184
+ if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
185
+ switch (a.data.type) {
186
186
  case "document-updated":
187
- (a = e.onDocumentUpdated) == null || a.call(e, {
188
- documentId: t.data.documentId,
189
- externalId: t.data.externalId
187
+ (t = e.onDocumentUpdated) == null || t.call(e, {
188
+ documentId: a.data.documentId,
189
+ externalId: a.data.externalId
190
190
  });
191
191
  break;
192
192
  }
@@ -195,12 +195,12 @@ function D(e) {
195
195
  window.addEventListener("message", c);
196
196
  }, []), s(() => () => {
197
197
  window.removeEventListener("message", c);
198
- }, []), /* @__PURE__ */ m("iframe", { ref: d, className: e.className, src: i() });
198
+ }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
199
199
  }
200
200
  function E(e) {
201
- const d = o(null);
202
- function i() {
203
- const t = e.host || "https://app.documenso.com", n = btoa(
201
+ const d = r(null);
202
+ function m() {
203
+ const a = e.host || "https://app.documenso.com", n = btoa(
204
204
  encodeURIComponent(
205
205
  JSON.stringify({
206
206
  externalId: e.externalId,
@@ -211,20 +211,20 @@ function E(e) {
211
211
  ...e.additionalProps
212
212
  })
213
213
  )
214
- ), a = new URL(
214
+ ), t = new URL(
215
215
  `/embed/v1/authoring/template/edit/${e.templateId}`,
216
- t
216
+ a
217
217
  );
218
- return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
218
+ return t.searchParams.set("token", e.presignToken), t.hash = n, t.toString();
219
219
  }
220
- function c(t) {
221
- var n, a;
222
- if (((n = d.current) == null ? void 0 : n.contentWindow) === t.source)
223
- switch (t.data.type) {
220
+ function c(a) {
221
+ var n, t;
222
+ if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
223
+ switch (a.data.type) {
224
224
  case "template-updated":
225
- (a = e.onTemplateUpdated) == null || a.call(e, {
226
- templateId: t.data.templateId,
227
- externalId: t.data.externalId
225
+ (t = e.onTemplateUpdated) == null || t.call(e, {
226
+ templateId: a.data.templateId,
227
+ externalId: a.data.externalId
228
228
  });
229
229
  break;
230
230
  }
@@ -233,13 +233,61 @@ function E(e) {
233
233
  window.addEventListener("message", c);
234
234
  }, []), s(() => () => {
235
235
  window.removeEventListener("message", c);
236
- }, []), /* @__PURE__ */ m("iframe", { ref: d, className: e.className, src: i() });
236
+ }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
237
+ }
238
+ function U(e) {
239
+ const d = r(null);
240
+ function m() {
241
+ const a = e.host || "https://app.documenso.com", n = btoa(
242
+ encodeURIComponent(
243
+ JSON.stringify({
244
+ name: e.name,
245
+ lockName: e.lockName,
246
+ css: e.css,
247
+ cssVars: e.cssVars,
248
+ darkModeDisabled: e.darkModeDisabled,
249
+ allowDocumentRejection: e.allowDocumentRejection,
250
+ ...e.additionalProps
251
+ })
252
+ )
253
+ ), t = new URL("/embed/v1/multisign", a);
254
+ for (const i of e.tokens)
255
+ t.searchParams.append("token", i);
256
+ return `${t}#${n}`;
257
+ }
258
+ function c(a) {
259
+ var n, t, i, o, l, f;
260
+ if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
261
+ switch (a.data.action) {
262
+ case "document-ready":
263
+ (t = e.onDocumentReady) == null || t.call(e);
264
+ break;
265
+ case "document-completed":
266
+ (i = e.onDocumentCompleted) == null || i.call(e, a.data.data);
267
+ break;
268
+ case "document-error":
269
+ (o = e.onDocumentError) == null || o.call(e, a.data.data);
270
+ break;
271
+ case "document-rejected":
272
+ (l = e.onDocumentRejected) == null || l.call(e, a.data.data);
273
+ break;
274
+ case "all-documents-completed":
275
+ (f = e.onAllDocumentsCompleted) == null || f.call(e, a.data.data);
276
+ break;
277
+ }
278
+ }
279
+ return s(() => {
280
+ window.addEventListener("message", c);
281
+ }, []), s(() => () => {
282
+ window.removeEventListener("message", c);
283
+ }, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
237
284
  }
238
285
  export {
239
- g as EmbedDirectTemplate,
240
- k as EmbedSignDocument,
286
+ w as EmbedDirectTemplate,
287
+ g as EmbedSignDocument,
241
288
  h as unstable_EmbedCreateDocument,
242
- I as unstable_EmbedCreateTemplate,
243
- D as unstable_EmbedUpdateDocument,
289
+ D as unstable_EmbedCreateTemplate,
290
+ U as unstable_EmbedMultiSignDocument,
291
+ I as unstable_EmbedUpdateDocument,
244
292
  E as unstable_EmbedUpdateTemplate
245
293
  };
@@ -0,0 +1,38 @@
1
+ import { CssVars } from './css-vars';
2
+ import * as React from "react";
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): React.JSX.Element;
38
+ export default EmbedMultiSignDocument;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-react",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"