@documenso/embed-vue 0.2.0 → 0.2.1-rc.1

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.
@@ -0,0 +1,34 @@
1
+ import { CssVars } from './css-vars';
2
+ export type EmbedCreateDocumentProps = {
3
+ className?: string;
4
+ host?: string;
5
+ presignToken: string;
6
+ externalId?: string;
7
+ css?: string | undefined;
8
+ cssVars?: (CssVars & Record<string, string>) | undefined;
9
+ darkModeDisabled?: boolean | undefined;
10
+ features?: {
11
+ allowConfigureSignatureTypes?: boolean;
12
+ allowConfigureLanguage?: boolean;
13
+ allowConfigureDateFormat?: boolean;
14
+ allowConfigureTimezone?: boolean;
15
+ allowConfigureRedirectUrl?: boolean;
16
+ allowConfigureCommunication?: boolean;
17
+ };
18
+ additionalProps?: Record<string, string | number | boolean> | undefined;
19
+ onDocumentCreated?: (data: {
20
+ externalId: string;
21
+ documentId: number;
22
+ }) => void;
23
+ };
24
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<EmbedCreateDocumentProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToOption<EmbedCreateDocumentProps>>>, {}, {}>;
25
+ export default _default;
26
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
27
+ type __VLS_TypePropsToOption<T> = {
28
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
29
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
30
+ } : {
31
+ type: import('vue').PropType<T[K]>;
32
+ required: true;
33
+ };
34
+ };
@@ -0,0 +1,34 @@
1
+ import { CssVars } from './css-vars';
2
+ export type EmbedCreateTemplateProps = {
3
+ className?: string;
4
+ host?: string;
5
+ presignToken: string;
6
+ externalId?: string;
7
+ css?: string | undefined;
8
+ cssVars?: (CssVars & Record<string, string>) | undefined;
9
+ darkModeDisabled?: boolean | undefined;
10
+ features?: {
11
+ allowConfigureSignatureTypes?: boolean;
12
+ allowConfigureLanguage?: boolean;
13
+ allowConfigureDateFormat?: boolean;
14
+ allowConfigureTimezone?: boolean;
15
+ allowConfigureRedirectUrl?: boolean;
16
+ allowConfigureCommunication?: boolean;
17
+ };
18
+ additionalProps?: Record<string, string | number | boolean> | undefined;
19
+ onTemplateCreated?: (data: {
20
+ externalId: string;
21
+ templateId: number;
22
+ }) => void;
23
+ };
24
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<EmbedCreateTemplateProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToOption<EmbedCreateTemplateProps>>>, {}, {}>;
25
+ export default _default;
26
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
27
+ type __VLS_TypePropsToOption<T> = {
28
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
29
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
30
+ } : {
31
+ type: import('vue').PropType<T[K]>;
32
+ required: true;
33
+ };
34
+ };
@@ -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.d.mts CHANGED
@@ -1,2 +1,4 @@
1
1
  export { default as EmbedDirectTemplate } from './direct-template.vue';
2
2
  export { default as EmbedSignDocument } from './sign-document.vue';
3
+ export { default as unstable_EmbedCreateDocument } from './create-document.vue';
4
+ export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export { default as EmbedDirectTemplate } from './direct-template.vue';
2
2
  export { default as EmbedSignDocument } from './sign-document.vue';
3
+ export { default as unstable_EmbedCreateDocument } from './create-document.vue';
4
+ export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
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 t=require("vue"),p=["src"],f=t.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(d){const e=d,s=t.ref();t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",o=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}#${o}`});function c(n){var o,a,m,i,l,u;if(((o=s.value)==null?void 0:o.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.call(e,n.data.data);break;case"document-error":(i=e.onDocumentError)==null||i.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,o)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(n.className),src:r.value},null,10,p))}}),k=["src"],_=t.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(d){const e=d,s=t.ref();t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",o=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)}#${o}`});function c(n){var o,a,m,i,l;if(((o=s.value)==null?void 0:o.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.call(e,n.data.data);break;case"document-error":(i=e.onDocumentError)==null||i.call(e,n.data.data);break;case"document-rejected":(l=e.onDocumentRejected)==null||l.call(e,n.data.data);break}}return(n,o)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(n.className),src:r.value},null,10,k))}}),b=["src"],y=t.defineComponent({__name:"create-document",props:{className:{},host:{},presignToken:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onDocumentCreated:{type:Function}},setup(d){const e=d,s=t.ref();t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",o=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",n)}#${o}`});function c(n){var o,a;if(((o=s.value)==null?void 0:o.contentWindow)===n.source)switch(n.data.type){case"document-completed":(a=e.onDocumentCreated)==null||a.call(e,{documentId:n.data.documentId,externalId:n.data.externalId});break}}return(n,o)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(n.className),src:r.value},null,10,b))}}),D=["src"],g=t.defineComponent({__name:"create-template",props:{className:{},host:{},presignToken:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onTemplateCreated:{type:Function}},setup(d){const e=d,s=t.ref();t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",o=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",n)}#${o}`});function c(n){var o,a;if(((o=s.value)==null?void 0:o.contentWindow)===n.source)switch(n.data.type){case"template-completed":(a=e.onTemplateCreated)==null||a.call(e,{templateId:n.data.templateId,externalId:n.data.externalId});break}}return(n,o)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(n.className),src:r.value},null,10,D))}});exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=_;exports.unstable_EmbedCreateDocument=y;exports.unstable_EmbedCreateTemplate=g;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
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";
2
- const g = ["src"], E = /* @__PURE__ */ u({
1
+ import { defineComponent as l, ref as u, onMounted as p, onUnmounted as _, computed as f, openBlock as k, createElementBlock as b, normalizeClass as y } from "vue";
2
+ const g = ["src"], N = /* @__PURE__ */ l({
3
3
  __name: "direct-template",
4
4
  props: {
5
5
  className: {},
@@ -13,21 +13,22 @@ 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(() => {
25
- window.addEventListener("message", c);
23
+ setup(c) {
24
+ const e = c, o = u();
25
+ p(() => {
26
+ window.addEventListener("message", s);
26
27
  }), _(() => {
27
- window.removeEventListener("message", c);
28
+ window.removeEventListener("message", s);
28
29
  });
29
- const m = y(() => {
30
- const n = e.host || "https://app.documenso.com", o = btoa(
30
+ const d = f(() => {
31
+ const a = e.host || "https://app.documenso.com", n = btoa(
31
32
  encodeURIComponent(
32
33
  JSON.stringify({
33
34
  name: e.name,
@@ -36,41 +37,42 @@ 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
- ), a = new URL(`/embed/direct/${e.token}`, n);
43
- return e.externalId && a.searchParams.set("externalId", e.externalId), `${a}#${o}`;
44
+ ), t = new URL(`/embed/direct/${e.token}`, a);
45
+ return e.externalId && t.searchParams.set("externalId", e.externalId), `${t}#${n}`;
44
46
  });
45
- function c(n) {
46
- var o, a, s, d, i, l;
47
- if (((o = t.value) == null ? void 0 : o.contentWindow) === n.source)
48
- switch (n.data.action) {
47
+ function s(a) {
48
+ var n, t, r, i, m, D;
49
+ if (((n = o.value) == null ? void 0 : n.contentWindow) === a.source)
50
+ switch (a.data.action) {
49
51
  case "document-ready":
50
- (a = e.onDocumentReady) == null || a.call(e);
52
+ (t = e.onDocumentReady) == null || t.call(e);
51
53
  break;
52
54
  case "document-completed":
53
- (s = e.onDocumentCompleted) == null || s.call(e, n.data.data);
55
+ (r = e.onDocumentCompleted) == null || r.call(e, a.data.data);
54
56
  break;
55
57
  case "document-error":
56
- (d = e.onDocumentError) == null || d.call(e, n.data.data);
58
+ (i = e.onDocumentError) == null || i.call(e, a.data.data);
57
59
  break;
58
60
  case "field-signed":
59
- (i = e.onFieldSigned) == null || i.call(e);
61
+ (m = e.onFieldSigned) == null || m.call(e);
60
62
  break;
61
63
  case "field-unsigned":
62
- (l = e.onFieldUnsigned) == null || l.call(e);
64
+ (D = e.onFieldUnsigned) == null || D.call(e);
63
65
  break;
64
66
  }
65
67
  }
66
- return (n, o) => (b(), D("iframe", {
68
+ return (a, n) => (k(), b("iframe", {
67
69
  ref_key: "__iframe",
68
- ref: t,
69
- class: p(n.className),
70
- src: m.value
70
+ ref: o,
71
+ class: y(a.className),
72
+ src: d.value
71
73
  }, null, 10, g));
72
74
  }
73
- }), h = ["src"], F = /* @__PURE__ */ u({
75
+ }), h = ["src"], U = /* @__PURE__ */ l({
74
76
  __name: "sign-document",
75
77
  props: {
76
78
  className: {},
@@ -81,55 +83,177 @@ 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(() => {
91
- window.addEventListener("message", c);
93
+ setup(c) {
94
+ const e = c, o = u();
95
+ p(() => {
96
+ window.addEventListener("message", s);
92
97
  }), _(() => {
93
- window.removeEventListener("message", c);
98
+ window.removeEventListener("message", s);
94
99
  });
95
- const m = y(() => {
96
- const n = e.host || "https://app.documenso.com", o = btoa(
100
+ const d = f(() => {
101
+ const a = e.host || "https://app.documenso.com", n = btoa(
97
102
  encodeURIComponent(
98
103
  JSON.stringify({
99
104
  name: e.name,
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
- return `${new URL(`/embed/sign/${e.token}`, n)}#${o}`;
114
+ return `${new URL(`/embed/sign/${e.token}`, a)}#${n}`;
108
115
  });
109
- function c(n) {
110
- var o, a, s, d;
111
- if (((o = t.value) == null ? void 0 : o.contentWindow) === n.source)
112
- switch (n.data.action) {
116
+ function s(a) {
117
+ var n, t, r, i, m;
118
+ if (((n = o.value) == null ? void 0 : n.contentWindow) === a.source)
119
+ switch (a.data.action) {
113
120
  case "document-ready":
114
- (a = e.onDocumentReady) == null || a.call(e);
121
+ (t = e.onDocumentReady) == null || t.call(e);
115
122
  break;
116
123
  case "document-completed":
117
- (s = e.onDocumentCompleted) == null || s.call(e, n.data.data);
124
+ (r = e.onDocumentCompleted) == null || r.call(e, a.data.data);
118
125
  break;
119
126
  case "document-error":
120
- (d = e.onDocumentError) == null || d.call(e, n.data.data);
127
+ (i = e.onDocumentError) == null || i.call(e, a.data.data);
128
+ break;
129
+ case "document-rejected":
130
+ (m = e.onDocumentRejected) == null || m.call(e, a.data.data);
121
131
  break;
122
132
  }
123
133
  }
124
- return (n, o) => (b(), D("iframe", {
134
+ return (a, n) => (k(), b("iframe", {
125
135
  ref_key: "__iframe",
126
- ref: t,
127
- class: p(n.className),
128
- src: m.value
136
+ ref: o,
137
+ class: y(a.className),
138
+ src: d.value
129
139
  }, null, 10, h));
130
140
  }
141
+ }), w = ["src"], M = /* @__PURE__ */ l({
142
+ __name: "create-document",
143
+ props: {
144
+ className: {},
145
+ host: {},
146
+ presignToken: {},
147
+ externalId: {},
148
+ css: {},
149
+ cssVars: {},
150
+ darkModeDisabled: { type: Boolean },
151
+ features: {},
152
+ additionalProps: {},
153
+ onDocumentCreated: { type: Function }
154
+ },
155
+ setup(c) {
156
+ const e = c, o = u();
157
+ p(() => {
158
+ window.addEventListener("message", s);
159
+ }), _(() => {
160
+ window.removeEventListener("message", s);
161
+ });
162
+ const d = f(() => {
163
+ const a = e.host || "https://app.documenso.com", n = btoa(
164
+ encodeURIComponent(
165
+ JSON.stringify({
166
+ token: e.presignToken,
167
+ externalId: e.externalId,
168
+ features: e.features,
169
+ css: e.css,
170
+ cssVars: e.cssVars,
171
+ darkModeDisabled: e.darkModeDisabled,
172
+ ...e.additionalProps
173
+ })
174
+ )
175
+ );
176
+ return `${new URL("/embed/v1/authoring/document/create", a)}#${n}`;
177
+ });
178
+ function s(a) {
179
+ var n, t;
180
+ if (((n = o.value) == null ? void 0 : n.contentWindow) === a.source)
181
+ switch (a.data.type) {
182
+ case "document-completed":
183
+ (t = e.onDocumentCreated) == null || t.call(e, {
184
+ documentId: a.data.documentId,
185
+ externalId: a.data.externalId
186
+ });
187
+ break;
188
+ }
189
+ }
190
+ return (a, n) => (k(), b("iframe", {
191
+ ref_key: "__iframe",
192
+ ref: o,
193
+ class: y(a.className),
194
+ src: d.value
195
+ }, null, 10, w));
196
+ }
197
+ }), I = ["src"], R = /* @__PURE__ */ l({
198
+ __name: "create-template",
199
+ props: {
200
+ className: {},
201
+ host: {},
202
+ presignToken: {},
203
+ externalId: {},
204
+ css: {},
205
+ cssVars: {},
206
+ darkModeDisabled: { type: Boolean },
207
+ features: {},
208
+ additionalProps: {},
209
+ onTemplateCreated: { type: Function }
210
+ },
211
+ setup(c) {
212
+ const e = c, o = u();
213
+ p(() => {
214
+ window.addEventListener("message", s);
215
+ }), _(() => {
216
+ window.removeEventListener("message", s);
217
+ });
218
+ const d = f(() => {
219
+ const a = e.host || "https://app.documenso.com", n = btoa(
220
+ encodeURIComponent(
221
+ JSON.stringify({
222
+ token: e.presignToken,
223
+ externalId: e.externalId,
224
+ features: e.features,
225
+ css: e.css,
226
+ cssVars: e.cssVars,
227
+ darkModeDisabled: e.darkModeDisabled,
228
+ ...e.additionalProps
229
+ })
230
+ )
231
+ );
232
+ return `${new URL("/embed/v1/authoring/template/create", a)}#${n}`;
233
+ });
234
+ function s(a) {
235
+ var n, t;
236
+ if (((n = o.value) == null ? void 0 : n.contentWindow) === a.source)
237
+ switch (a.data.type) {
238
+ case "template-completed":
239
+ (t = e.onTemplateCreated) == null || t.call(e, {
240
+ templateId: a.data.templateId,
241
+ externalId: a.data.externalId
242
+ });
243
+ break;
244
+ }
245
+ }
246
+ return (a, n) => (k(), b("iframe", {
247
+ ref_key: "__iframe",
248
+ ref: o,
249
+ class: y(a.className),
250
+ src: d.value
251
+ }, null, 10, I));
252
+ }
131
253
  });
132
254
  export {
133
- E as EmbedDirectTemplate,
134
- F as EmbedSignDocument
255
+ N as EmbedDirectTemplate,
256
+ U as EmbedSignDocument,
257
+ M as unstable_EmbedCreateDocument,
258
+ R as unstable_EmbedCreateTemplate
135
259
  };
@@ -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.1",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"