@documenso/embed-react 0.2.1-rc.1 → 0.2.1-rc.2

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 l=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",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,m,o,u,r;if(((a=d.current)==null?void 0:a.contentWindow)===t.source)switch(t.data.action){case"document-ready":(n=e.onDocumentReady)==null||n.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.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:i()})}function b(e){const d=c.useRef(null);function i(){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,m,o,u;if(((a=d.current)==null?void 0:a.contentWindow)===t.source)switch(t.data.action){case"document-ready":(n=e.onDocumentReady)==null||n.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.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:i()})}function k(e){const d=c.useRef(null);function i(){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,n;if(((a=d.current)==null?void 0:a.contentWindow)===t.source)switch(t.data.type){case"document-completed":(n=e.onDocumentCreated)==null||n.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:i()})}function w(e){const d=c.useRef(null);function i(){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,n;if(((a=d.current)==null?void 0:a.contentWindow)===t.source)switch(t.data.type){case"template-completed":(n=e.onTemplateCreated)==null||n.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:i()})}exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=b;exports.unstable_EmbedCreateDocument=k;exports.unstable_EmbedCreateTemplate=w;
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 i(){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,m,u,o,r;if(((a=d.current)==null?void 0:a.contentWindow)===t.source)switch(t.data.action){case"document-ready":(n=e.onDocumentReady)==null||n.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.call(e,t.data.data);break;case"document-error":(u=e.onDocumentError)==null||u.call(e,t.data.data);break;case"field-signed":(o=e.onFieldSigned)==null||o.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:i()})}function b(e){const d=c.useRef(null);function i(){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,m,u,o;if(((a=d.current)==null?void 0:a.contentWindow)===t.source)switch(t.data.action){case"document-ready":(n=e.onDocumentReady)==null||n.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.call(e,t.data.data);break;case"document-error":(u=e.onDocumentError)==null||u.call(e,t.data.data);break;case"document-rejected":(o=e.onDocumentRejected)==null||o.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:i()})}function k(e){const d=c.useRef(null);function i(){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,n;if(((a=d.current)==null?void 0:a.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}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.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",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,n;if(((a=d.current)==null?void 0:a.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}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:i()})}exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=b;exports.unstable_EmbedCreateDocument=k;exports.unstable_EmbedCreateTemplate=w;
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { useRef as u, useEffect as m } from "react";
2
+ import { useRef as u, useEffect as i } from "react";
3
3
  function w(e) {
4
4
  const c = u(null);
5
- function i() {
5
+ function m() {
6
6
  const a = e.host || "https://app.documenso.com", t = btoa(
7
7
  encodeURIComponent(
8
8
  JSON.stringify({
@@ -40,15 +40,15 @@ function w(e) {
40
40
  break;
41
41
  }
42
42
  }
43
- return m(() => {
43
+ return i(() => {
44
44
  window.addEventListener("message", d);
45
- }, []), m(() => () => {
45
+ }, []), i(() => () => {
46
46
  window.removeEventListener("message", d);
47
- }, []), /* @__PURE__ */ r("iframe", { ref: c, className: e.className, src: i() });
47
+ }, []), /* @__PURE__ */ r("iframe", { ref: c, className: e.className, src: m() });
48
48
  }
49
49
  function g(e) {
50
50
  const c = u(null);
51
- function i() {
51
+ function m() {
52
52
  const a = e.host || "https://app.documenso.com", t = btoa(
53
53
  encodeURIComponent(
54
54
  JSON.stringify({
@@ -82,15 +82,15 @@ function g(e) {
82
82
  break;
83
83
  }
84
84
  }
85
- return m(() => {
85
+ return i(() => {
86
86
  window.addEventListener("message", d);
87
- }, []), m(() => () => {
87
+ }, []), i(() => () => {
88
88
  window.removeEventListener("message", d);
89
- }, []), /* @__PURE__ */ r("iframe", { ref: c, className: e.className, src: i() });
89
+ }, []), /* @__PURE__ */ r("iframe", { ref: c, className: e.className, src: m() });
90
90
  }
91
91
  function D(e) {
92
92
  const c = u(null);
93
- function i() {
93
+ function m() {
94
94
  const a = e.host || "https://app.documenso.com", t = btoa(
95
95
  encodeURIComponent(
96
96
  JSON.stringify({
@@ -110,7 +110,7 @@ function D(e) {
110
110
  var t, n;
111
111
  if (((t = c.current) == null ? void 0 : t.contentWindow) === a.source)
112
112
  switch (a.data.type) {
113
- case "document-completed":
113
+ case "document-created":
114
114
  (n = e.onDocumentCreated) == null || n.call(e, {
115
115
  documentId: a.data.documentId,
116
116
  externalId: a.data.externalId
@@ -118,15 +118,15 @@ function D(e) {
118
118
  break;
119
119
  }
120
120
  }
121
- return m(() => {
121
+ return i(() => {
122
122
  window.addEventListener("message", d);
123
- }, []), m(() => () => {
123
+ }, []), i(() => () => {
124
124
  window.removeEventListener("message", d);
125
- }, []), /* @__PURE__ */ r("iframe", { ref: c, className: e.className, src: i() });
125
+ }, []), /* @__PURE__ */ r("iframe", { ref: c, className: e.className, src: m() });
126
126
  }
127
127
  function h(e) {
128
128
  const c = u(null);
129
- function i() {
129
+ function m() {
130
130
  const a = e.host || "https://app.documenso.com", t = btoa(
131
131
  encodeURIComponent(
132
132
  JSON.stringify({
@@ -146,7 +146,7 @@ function h(e) {
146
146
  var t, n;
147
147
  if (((t = c.current) == null ? void 0 : t.contentWindow) === a.source)
148
148
  switch (a.data.type) {
149
- case "template-completed":
149
+ case "template-created":
150
150
  (n = e.onTemplateCreated) == null || n.call(e, {
151
151
  templateId: a.data.templateId,
152
152
  externalId: a.data.externalId
@@ -154,11 +154,11 @@ function h(e) {
154
154
  break;
155
155
  }
156
156
  }
157
- return m(() => {
157
+ return i(() => {
158
158
  window.addEventListener("message", d);
159
- }, []), m(() => () => {
159
+ }, []), i(() => () => {
160
160
  window.removeEventListener("message", d);
161
- }, []), /* @__PURE__ */ r("iframe", { ref: c, className: e.className, src: i() });
161
+ }, []), /* @__PURE__ */ r("iframe", { ref: c, className: e.className, src: m() });
162
162
  }
163
163
  export {
164
164
  w as EmbedDirectTemplate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-react",
3
- "version": "0.2.1-rc.1",
3
+ "version": "0.2.1-rc.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"