@documenso/embed-solid 0.2.0 → 0.2.1-rc.0

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.
@@ -11,6 +11,7 @@ export type EmbedDirectTemplateProps = {
11
11
  lockEmail?: boolean | undefined;
12
12
  name?: string | undefined;
13
13
  lockName?: boolean | undefined;
14
+ additionalProps?: Record<string, string | number | boolean> | undefined;
14
15
  onDocumentReady?: () => void;
15
16
  onDocumentCompleted?: (data: {
16
17
  token: string;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("solid-js");function u(e,d,o){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 s(e,d,o){k(e)||(o==null?e.removeAttribute(d):e.setAttribute(d,o))}function f(e,d){k(e)||(d==null?e.removeAttribute("class"):e.className=d)}function b(e,d,o){return m.untrack(()=>e(d,o))}function k(e){return!!m.sharedConfig.context&&!m.sharedConfig.done&&(!e||e.isConnected)}var g=u("<iframe>");function D(e){const d=m.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}))),n=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&n.searchParams.set("externalId",e.externalId),`${n}#${a}`});function o(t){var a,n,i,r,l;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":(i=e.onDocumentError)==null||i.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}}let c;return m.onMount(()=>{window.addEventListener("message",o)}),(()=>{var t=g(),a=c;return typeof a=="function"?b(a,t):c=t,m.createRenderEffect(n=>{var i=e.className,r=d();return i!==n.e&&f(t,n.e=i),r!==n.t&&s(t,"src",n.t=r),n},{e:void 0,t:void 0}),t})()}var E=u("<iframe>");function v(e){const d=m.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})));return`${new URL(`/embed/sign/${e.token}`,t)}#${a}`});function o(t){var a,n,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":(i=e.onDocumentError)==null||i.call(e,t.data.data);break}}let c;return m.onMount(()=>{window.addEventListener("message",o)}),(()=>{var t=E(),a=c;return typeof a=="function"?b(a,t):c=t,m.createRenderEffect(n=>{var i=e.className,r=d();return i!==n.e&&f(t,n.e=i),r!==n.t&&s(t,"src",n.t=r),n},{e:void 0,t:void 0}),t})()}exports.EmbedDirectTemplate=D;exports.EmbedSignDocument=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("solid-js");function r(e,d,m){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 s(e,d,m){k(e)||(m==null?e.removeAttribute(d):e.setAttribute(d,m))}function f(e,d){k(e)||(d==null?e.removeAttribute("class"):e.className=d)}function b(e,d,m){return l.untrack(()=>e(d,m))}function k(e){return!!l.sharedConfig.context&&!l.sharedConfig.done&&(!e||e.isConnected)}var g=r("<iframe>");function D(e){const d=l.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 m(t){var a,n,i,o,u;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":(i=e.onDocumentError)==null||i.call(e,t.data.data);break;case"field-signed":(o=e.onFieldSigned)==null||o.call(e);break;case"field-unsigned":(u=e.onFieldUnsigned)==null||u.call(e);break}}let c;return l.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=g(),a=c;return typeof a=="function"?b(a,t):c=t,l.createRenderEffect(n=>{var i=e.className,o=d();return i!==n.e&&f(t,n.e=i),o!==n.t&&s(t,"src",n.t=o),n},{e:void 0,t:void 0}),t})()}var E=r("<iframe>");function h(e){const d=l.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 m(t){var a,n,i,o;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":(i=e.onDocumentError)==null||i.call(e,t.data.data);break;case"document-rejected":(o=e.onDocumentRejected)==null||o.call(e,t.data.data);break}}let c;return l.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=E(),a=c;return typeof a=="function"?b(a,t):c=t,l.createRenderEffect(n=>{var i=e.className,o=d();return i!==n.e&&f(t,n.e=i),o!==n.t&&s(t,"src",n.t=o),n},{e:void 0,t:void 0}),t})()}exports.EmbedDirectTemplate=D;exports.EmbedSignDocument=h;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { sharedConfig as r, untrack as N, createMemo as u, onMount as s, createRenderEffect as f } from "solid-js";
1
+ import { sharedConfig as u, untrack as N, createMemo as r, onMount as s, createRenderEffect as f } from "solid-js";
2
2
  function b(e, d, m) {
3
3
  let c;
4
4
  const t = () => {
@@ -8,20 +8,20 @@ function b(e, d, m) {
8
8
  return a.cloneNode = a, a;
9
9
  }
10
10
  function k(e, d, m) {
11
- D(e) || (m == null ? e.removeAttribute(d) : e.setAttribute(d, m));
11
+ w(e) || (m == null ? e.removeAttribute(d) : e.setAttribute(d, m));
12
12
  }
13
- function g(e, d) {
14
- D(e) || (d == null ? e.removeAttribute("class") : e.className = d);
13
+ function D(e, d) {
14
+ w(e) || (d == null ? e.removeAttribute("class") : e.className = d);
15
15
  }
16
- function v(e, d, m) {
16
+ function g(e, d, m) {
17
17
  return N(() => e(d, m));
18
18
  }
19
- function D(e) {
20
- return !!r.context && !r.done && (!e || e.isConnected);
19
+ function w(e) {
20
+ return !!u.context && !u.done && (!e || e.isConnected);
21
21
  }
22
22
  var h = /* @__PURE__ */ b("<iframe>");
23
- function y(e) {
24
- const d = u(() => {
23
+ function R(e) {
24
+ const d = r(() => {
25
25
  const t = e.host || "https://app.documenso.com", a = btoa(encodeURIComponent(JSON.stringify({
26
26
  name: e.name,
27
27
  lockName: e.lockName,
@@ -29,7 +29,8 @@ function y(e) {
29
29
  lockEmail: e.lockEmail,
30
30
  css: e.css,
31
31
  cssVars: e.cssVars,
32
- darkModeDisabled: e.darkModeDisabled
32
+ darkModeDisabled: e.darkModeDisabled,
33
+ ...e.additionalProps
33
34
  }))), n = new URL(`/embed/direct/${e.token}`, t);
34
35
  return e.externalId && n.searchParams.set("externalId", e.externalId), `${n}#${a}`;
35
36
  });
@@ -59,29 +60,31 @@ function y(e) {
59
60
  window.addEventListener("message", m);
60
61
  }), (() => {
61
62
  var t = h(), a = c;
62
- return typeof a == "function" ? v(a, t) : c = t, f((n) => {
63
+ return typeof a == "function" ? g(a, t) : c = t, f((n) => {
63
64
  var i = e.className, o = d();
64
- return i !== n.e && g(t, n.e = i), o !== n.t && k(t, "src", n.t = o), n;
65
+ return i !== n.e && D(t, n.e = i), o !== n.t && k(t, "src", n.t = o), n;
65
66
  }, {
66
67
  e: void 0,
67
68
  t: void 0
68
69
  }), t;
69
70
  })();
70
71
  }
71
- var E = /* @__PURE__ */ b("<iframe>");
72
- function M(e) {
73
- const d = u(() => {
72
+ var v = /* @__PURE__ */ b("<iframe>");
73
+ function y(e) {
74
+ const d = r(() => {
74
75
  const t = e.host || "https://app.documenso.com", a = btoa(encodeURIComponent(JSON.stringify({
75
76
  name: e.name,
76
77
  lockName: e.lockName,
77
78
  css: e.css,
78
79
  cssVars: e.cssVars,
79
- darkModeDisabled: e.darkModeDisabled
80
+ darkModeDisabled: e.darkModeDisabled,
81
+ allowDocumentRejection: e.allowDocumentRejection,
82
+ ...e.additionalProps
80
83
  })));
81
84
  return `${new URL(`/embed/sign/${e.token}`, t)}#${a}`;
82
85
  });
83
86
  function m(t) {
84
- var a, n, i;
87
+ var a, n, i, o;
85
88
  if ((c == null ? void 0 : c.contentWindow) === t.source)
86
89
  switch (t.data.action) {
87
90
  case "document-ready":
@@ -93,16 +96,19 @@ function M(e) {
93
96
  case "document-error":
94
97
  (i = e.onDocumentError) == null || i.call(e, t.data.data);
95
98
  break;
99
+ case "document-rejected":
100
+ (o = e.onDocumentRejected) == null || o.call(e, t.data.data);
101
+ break;
96
102
  }
97
103
  }
98
104
  let c;
99
105
  return s(() => {
100
106
  window.addEventListener("message", m);
101
107
  }), (() => {
102
- var t = E(), a = c;
103
- return typeof a == "function" ? v(a, t) : c = t, f((n) => {
108
+ var t = v(), a = c;
109
+ return typeof a == "function" ? g(a, t) : c = t, f((n) => {
104
110
  var i = e.className, o = d();
105
- return i !== n.e && g(t, n.e = i), o !== n.t && k(t, "src", n.t = o), n;
111
+ return i !== n.e && D(t, n.e = i), o !== n.t && k(t, "src", n.t = o), n;
106
112
  }, {
107
113
  e: void 0,
108
114
  t: void 0
@@ -110,6 +116,6 @@ function M(e) {
110
116
  })();
111
117
  }
112
118
  export {
113
- y as EmbedDirectTemplate,
114
- M as EmbedSignDocument
119
+ R as EmbedDirectTemplate,
120
+ y as EmbedSignDocument
115
121
  };
@@ -8,6 +8,8 @@ export type EmbedSignDocumentProps = {
8
8
  darkModeDisabled?: boolean | undefined;
9
9
  name?: string | undefined;
10
10
  lockName?: boolean | undefined;
11
+ allowDocumentRejection?: boolean | undefined;
12
+ additionalProps?: Record<string, string | number | boolean> | undefined;
11
13
  onDocumentReady?: () => void;
12
14
  onDocumentCompleted?: (data: {
13
15
  token: string;
@@ -15,6 +17,12 @@ export type EmbedSignDocumentProps = {
15
17
  recipientId: number;
16
18
  }) => void;
17
19
  onDocumentError?: (error: string) => void;
20
+ onDocumentRejected?: (data: {
21
+ token: string;
22
+ documentId: number;
23
+ recipientId: number;
24
+ reason: string;
25
+ }) => void;
18
26
  };
19
27
  declare function EmbedSignDocument(props: EmbedSignDocumentProps): import("solid-js").JSX.Element;
20
28
  export default EmbedSignDocument;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-solid",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-rc.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"