@documenso/embed-preact 0.2.1 → 0.2.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 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/update/${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/update/${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 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=_;
package/dist/index.mjs CHANGED
@@ -182,7 +182,7 @@ function E(e) {
182
182
  })
183
183
  )
184
184
  ), t = new URL(
185
- `/embed/v1/authoring/document/update/${e.documentId}`,
185
+ `/embed/v1/authoring/document/edit/${e.documentId}`,
186
186
  a
187
187
  );
188
188
  return t.searchParams.set("token", e.presignToken), t.hash = n, t.toString();
@@ -220,7 +220,7 @@ function U(e) {
220
220
  })
221
221
  )
222
222
  ), t = new URL(
223
- `/embed/v1/authoring/template/update/${e.templateId}`,
223
+ `/embed/v1/authoring/template/edit/${e.templateId}`,
224
224
  a
225
225
  );
226
226
  return t.searchParams.set("token", e.presignToken), t.hash = n, t.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-preact",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"