@documenso/embed-vue 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 o=require("vue"),k=["src"],f=o.defineComponent({__name:"direct-template",props:{className:{},host:{},token:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},email:{},lockEmail:{type:Boolean},name:{},lockName:{type:Boolean},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function},onFieldSigned:{type:Function},onFieldUnsigned:{type:Function}},setup(m){const e=m,c=o.ref();o.onMounted(()=>{window.addEventListener("message",s)}),o.onUnmounted(()=>{window.removeEventListener("message",s)});const i=o.computed(()=>{const n=e.host||"https://app.documenso.com",t=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}))),a=new URL(`/embed/direct/${e.token}`,n);return e.externalId&&a.searchParams.set("externalId",e.externalId),`${a}#${t}`});function s(n){var t,a,d,r,l,u;if(((t=c.value)==null?void 0:t.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(d=e.onDocumentCompleted)==null||d.call(e,n.data.data);break;case"document-error":(r=e.onDocumentError)==null||r.call(e,n.data.data);break;case"field-signed":(l=e.onFieldSigned)==null||l.call(e);break;case"field-unsigned":(u=e.onFieldUnsigned)==null||u.call(e);break}}return(n,t)=>(o.openBlock(),o.createElementBlock("iframe",{ref_key:"__iframe",ref:c,class:o.normalizeClass(n.className),src:i.value},null,10,k))}}),y=["src"],_=o.defineComponent({__name:"sign-document",props:{className:{},host:{},token:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},name:{},lockName:{type:Boolean},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function}},setup(m){const e=m,c=o.ref();o.onMounted(()=>{window.addEventListener("message",s)}),o.onUnmounted(()=>{window.removeEventListener("message",s)});const i=o.computed(()=>{const n=e.host||"https://app.documenso.com",t=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}`,n)}#${t}`});function s(n){var t,a,d,r;if(((t=c.value)==null?void 0:t.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(d=e.onDocumentCompleted)==null||d.call(e,n.data.data);break;case"document-error":(r=e.onDocumentError)==null||r.call(e,n.data.data);break}}return(n,t)=>(o.openBlock(),o.createElementBlock("iframe",{ref_key:"__iframe",ref:c,class:o.normalizeClass(n.className),src:i.value},null,10,y))}});exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),k=["src"],y=o.defineComponent({__name:"direct-template",props:{className:{},host:{},token:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},email:{},lockEmail:{type:Boolean},name:{},lockName:{type:Boolean},additionalProps:{},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function},onFieldSigned:{type:Function},onFieldUnsigned:{type:Function}},setup(i){const e=i,c=o.ref();o.onMounted(()=>{window.addEventListener("message",s)}),o.onUnmounted(()=>{window.removeEventListener("message",s)});const l=o.computed(()=>{const n=e.host||"https://app.documenso.com",t=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}`,n);return e.externalId&&a.searchParams.set("externalId",e.externalId),`${a}#${t}`});function s(n){var t,a,d,r,m,u;if(((t=c.value)==null?void 0:t.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(d=e.onDocumentCompleted)==null||d.call(e,n.data.data);break;case"document-error":(r=e.onDocumentError)==null||r.call(e,n.data.data);break;case"field-signed":(m=e.onFieldSigned)==null||m.call(e);break;case"field-unsigned":(u=e.onFieldUnsigned)==null||u.call(e);break}}return(n,t)=>(o.openBlock(),o.createElementBlock("iframe",{ref_key:"__iframe",ref:c,class:o.normalizeClass(n.className),src:l.value},null,10,k))}}),f=["src"],D=o.defineComponent({__name:"sign-document",props:{className:{},host:{},token:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},name:{},lockName:{type:Boolean},allowDocumentRejection:{type:Boolean},additionalProps:{},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function},onDocumentRejected:{type:Function}},setup(i){const e=i,c=o.ref();o.onMounted(()=>{window.addEventListener("message",s)}),o.onUnmounted(()=>{window.removeEventListener("message",s)});const l=o.computed(()=>{const n=e.host||"https://app.documenso.com",t=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}`,n)}#${t}`});function s(n){var t,a,d,r,m;if(((t=c.value)==null?void 0:t.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(d=e.onDocumentCompleted)==null||d.call(e,n.data.data);break;case"document-error":(r=e.onDocumentError)==null||r.call(e,n.data.data);break;case"document-rejected":(m=e.onDocumentRejected)==null||m.call(e,n.data.data);break}}return(n,t)=>(o.openBlock(),o.createElementBlock("iframe",{ref_key:"__iframe",ref:c,class:o.normalizeClass(n.className),src:l.value},null,10,f))}});exports.EmbedDirectTemplate=y;exports.EmbedSignDocument=D;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as u, ref as k, onMounted as f, onUnmounted as _, computed as y, openBlock as b, createElementBlock as D, normalizeClass as p } from "vue";
1
+ import { defineComponent as u, ref as k, onMounted as y, onUnmounted as D, computed as f, openBlock as _, createElementBlock as b, normalizeClass as p } from "vue";
2
2
  const g = ["src"], E = /* @__PURE__ */ u({
3
3
  __name: "direct-template",
4
4
  props: {
@@ -13,20 +13,21 @@ const g = ["src"], E = /* @__PURE__ */ u({
13
13
  lockEmail: { type: Boolean },
14
14
  name: {},
15
15
  lockName: { type: Boolean },
16
+ additionalProps: {},
16
17
  onDocumentReady: { type: Function },
17
18
  onDocumentCompleted: { type: Function },
18
19
  onDocumentError: { type: Function },
19
20
  onFieldSigned: { type: Function },
20
21
  onFieldUnsigned: { type: Function }
21
22
  },
22
- setup(r) {
23
- const e = r, t = k();
24
- f(() => {
23
+ setup(m) {
24
+ const e = m, t = k();
25
+ y(() => {
25
26
  window.addEventListener("message", c);
26
- }), _(() => {
27
+ }), D(() => {
27
28
  window.removeEventListener("message", c);
28
29
  });
29
- const m = y(() => {
30
+ const i = f(() => {
30
31
  const n = e.host || "https://app.documenso.com", o = btoa(
31
32
  encodeURIComponent(
32
33
  JSON.stringify({
@@ -36,14 +37,15 @@ const g = ["src"], E = /* @__PURE__ */ u({
36
37
  lockEmail: e.lockEmail,
37
38
  css: e.css,
38
39
  cssVars: e.cssVars,
39
- darkModeDisabled: e.darkModeDisabled
40
+ darkModeDisabled: e.darkModeDisabled,
41
+ ...e.additionalProps
40
42
  })
41
43
  )
42
44
  ), a = new URL(`/embed/direct/${e.token}`, n);
43
45
  return e.externalId && a.searchParams.set("externalId", e.externalId), `${a}#${o}`;
44
46
  });
45
47
  function c(n) {
46
- var o, a, s, d, i, l;
48
+ var o, a, s, d, r, l;
47
49
  if (((o = t.value) == null ? void 0 : o.contentWindow) === n.source)
48
50
  switch (n.data.action) {
49
51
  case "document-ready":
@@ -56,21 +58,21 @@ const g = ["src"], E = /* @__PURE__ */ u({
56
58
  (d = e.onDocumentError) == null || d.call(e, n.data.data);
57
59
  break;
58
60
  case "field-signed":
59
- (i = e.onFieldSigned) == null || i.call(e);
61
+ (r = e.onFieldSigned) == null || r.call(e);
60
62
  break;
61
63
  case "field-unsigned":
62
64
  (l = e.onFieldUnsigned) == null || l.call(e);
63
65
  break;
64
66
  }
65
67
  }
66
- return (n, o) => (b(), D("iframe", {
68
+ return (n, o) => (_(), b("iframe", {
67
69
  ref_key: "__iframe",
68
70
  ref: t,
69
71
  class: p(n.className),
70
- src: m.value
72
+ src: i.value
71
73
  }, null, 10, g));
72
74
  }
73
- }), h = ["src"], F = /* @__PURE__ */ u({
75
+ }), w = ["src"], F = /* @__PURE__ */ u({
74
76
  __name: "sign-document",
75
77
  props: {
76
78
  className: {},
@@ -81,18 +83,21 @@ const g = ["src"], E = /* @__PURE__ */ u({
81
83
  darkModeDisabled: { type: Boolean },
82
84
  name: {},
83
85
  lockName: { type: Boolean },
86
+ allowDocumentRejection: { type: Boolean },
87
+ additionalProps: {},
84
88
  onDocumentReady: { type: Function },
85
89
  onDocumentCompleted: { type: Function },
86
- onDocumentError: { type: Function }
90
+ onDocumentError: { type: Function },
91
+ onDocumentRejected: { type: Function }
87
92
  },
88
- setup(r) {
89
- const e = r, t = k();
90
- f(() => {
93
+ setup(m) {
94
+ const e = m, t = k();
95
+ y(() => {
91
96
  window.addEventListener("message", c);
92
- }), _(() => {
97
+ }), D(() => {
93
98
  window.removeEventListener("message", c);
94
99
  });
95
- const m = y(() => {
100
+ const i = f(() => {
96
101
  const n = e.host || "https://app.documenso.com", o = btoa(
97
102
  encodeURIComponent(
98
103
  JSON.stringify({
@@ -100,14 +105,16 @@ const g = ["src"], E = /* @__PURE__ */ u({
100
105
  lockName: e.lockName,
101
106
  css: e.css,
102
107
  cssVars: e.cssVars,
103
- darkModeDisabled: e.darkModeDisabled
108
+ darkModeDisabled: e.darkModeDisabled,
109
+ allowDocumentRejection: e.allowDocumentRejection,
110
+ ...e.additionalProps
104
111
  })
105
112
  )
106
113
  );
107
114
  return `${new URL(`/embed/sign/${e.token}`, n)}#${o}`;
108
115
  });
109
116
  function c(n) {
110
- var o, a, s, d;
117
+ var o, a, s, d, r;
111
118
  if (((o = t.value) == null ? void 0 : o.contentWindow) === n.source)
112
119
  switch (n.data.action) {
113
120
  case "document-ready":
@@ -119,14 +126,17 @@ const g = ["src"], E = /* @__PURE__ */ u({
119
126
  case "document-error":
120
127
  (d = e.onDocumentError) == null || d.call(e, n.data.data);
121
128
  break;
129
+ case "document-rejected":
130
+ (r = e.onDocumentRejected) == null || r.call(e, n.data.data);
131
+ break;
122
132
  }
123
133
  }
124
- return (n, o) => (b(), D("iframe", {
134
+ return (n, o) => (_(), b("iframe", {
125
135
  ref_key: "__iframe",
126
136
  ref: t,
127
137
  class: p(n.className),
128
- src: m.value
129
- }, null, 10, h));
138
+ src: i.value
139
+ }, null, 10, w));
130
140
  }
131
141
  });
132
142
  export {
@@ -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 const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<EmbedSignDocumentProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToOption<EmbedSignDocumentProps>>>, {}, {}>;
20
28
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-vue",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-rc.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"