@documenso/embed-react 0.1.0 → 0.2.0-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.
@@ -0,0 +1,58 @@
1
+ export type CssVars = {
2
+ /** Base background color */
3
+ background?: string | null;
4
+ /** Base text color */
5
+ foreground?: string | null;
6
+ /** Muted/subtle background color */
7
+ muted?: string | null;
8
+ /** Muted/subtle text color */
9
+ mutedForeground?: string | null;
10
+ /** Popover/dropdown background color */
11
+ popover?: string | null;
12
+ /** Popover/dropdown text color */
13
+ popoverForeground?: string | null;
14
+ /** Card background color */
15
+ card?: string | null;
16
+ /** Card border color */
17
+ cardBorder?: string | null;
18
+ /** Card border tint/highlight color */
19
+ cardBorderTint?: string | null;
20
+ /** Card text color */
21
+ cardForeground?: string | null;
22
+ /** Field card background color */
23
+ fieldCard?: string | null;
24
+ /** Field card border color */
25
+ fieldCardBorder?: string | null;
26
+ /** Field card text color */
27
+ fieldCardForeground?: string | null;
28
+ /** Widget background color */
29
+ widget?: string | null;
30
+ /** Widget text color */
31
+ widgetForeground?: string | null;
32
+ /** Default border color */
33
+ border?: string | null;
34
+ /** Input field border color */
35
+ input?: string | null;
36
+ /** Primary action/button color */
37
+ primary?: string | null;
38
+ /** Primary action/button text color */
39
+ primaryForeground?: string | null;
40
+ /** Secondary action/button color */
41
+ secondary?: string | null;
42
+ /** Secondary action/button text color */
43
+ secondaryForeground?: string | null;
44
+ /** Accent/highlight color */
45
+ accent?: string | null;
46
+ /** Accent/highlight text color */
47
+ accentForeground?: string | null;
48
+ /** Destructive/danger action color */
49
+ destructive?: string | null;
50
+ /** Destructive/danger text color */
51
+ destructiveForeground?: string | null;
52
+ /** Focus ring color */
53
+ ring?: string | null;
54
+ /** Border radius size in REM units */
55
+ radius?: string | null;
56
+ /** Warning/alert color */
57
+ warning?: string | null;
58
+ };
@@ -1,3 +1,4 @@
1
+ import { CssVars } from './css-vars';
1
2
  import * as React from "react";
2
3
  export type EmbedDirectTemplateProps = {
3
4
  className?: string;
@@ -5,7 +6,8 @@ export type EmbedDirectTemplateProps = {
5
6
  token: string;
6
7
  externalId?: string;
7
8
  css?: string | undefined;
8
- cssVars?: Record<string, string> | undefined;
9
+ cssVars?: (CssVars & Record<string, string>) | undefined;
10
+ darkModeDisabled?: boolean | undefined;
9
11
  email?: string | undefined;
10
12
  lockEmail?: boolean | undefined;
11
13
  name?: string | undefined;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),c=require("react");function r(e){const d=c.useRef(null);function l(){const n=e.host||"https://app.documenso.com",t=btoa(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css})),a=new URL(`/embed/direct/${e.token}`,n);return e.externalId&&a.searchParams.set("externalId",e.externalId),`${a}#${t}`}function m(n){var t,a,i,u,s,o;if(((t=d.current)==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":(i=e.onDocumentCompleted)==null||i.call(e,n.data.data);break;case"document-error":(u=e.onDocumentError)==null||u.call(e,n.data.data);break;case"field-signed":(s=e.onFieldSigned)==null||s.call(e);break;case"field-unsigned":(o=e.onFieldUnsigned)==null||o.call(e);break}}return c.useEffect(()=>{window.addEventListener("message",m)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",m)},[]),f.jsx("iframe",{ref:d,className:e.className,src:l()})}function b(e){const d=c.useRef(null);function l(){const n=e.host||"https://app.documenso.com",t=btoa(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css}));return`${new URL(`/embed/sign/${e.token}`,n)}#${t}`}function m(n){var t,a,i,u;if(((t=d.current)==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":(i=e.onDocumentCompleted)==null||i.call(e,n.data.data);break;case"document-error":(u=e.onDocumentError)==null||u.call(e,n.data.data);break}}return c.useEffect(()=>{window.addEventListener("message",m)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",m)},[]),f.jsx("iframe",{ref:d,className:e.className,src:l()})}exports.EmbedDirectTemplate=r;exports.EmbedSignDocument=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),c=require("react");function f(e){const d=c.useRef(null);function u(){const a=e.host||"https://app.documenso.com",n=btoa(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled})),t=new URL(`/embed/direct/${e.token}`,a);return e.externalId&&t.searchParams.set("externalId",e.externalId),`${t}#${n}`}function i(a){var n,t,m,s,l,o;if(((n=d.current)==null?void 0:n.contentWindow)===a.source)switch(a.data.action){case"document-ready":(t=e.onDocumentReady)==null||t.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.call(e,a.data.data);break;case"document-error":(s=e.onDocumentError)==null||s.call(e,a.data.data);break;case"field-signed":(l=e.onFieldSigned)==null||l.call(e);break;case"field-unsigned":(o=e.onFieldUnsigned)==null||o.call(e);break}}return c.useEffect(()=>{window.addEventListener("message",i)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",i)},[]),r.jsx("iframe",{ref:d,className:e.className,src:u()})}function b(e){const d=c.useRef(null);function u(){const a=e.host||"https://app.documenso.com",n=btoa(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled}));return`${new URL(`/embed/sign/${e.token}`,a)}#${n}`}function i(a){var n,t,m,s;if(((n=d.current)==null?void 0:n.contentWindow)===a.source)switch(a.data.action){case"document-ready":(t=e.onDocumentReady)==null||t.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.call(e,a.data.data);break;case"document-error":(s=e.onDocumentError)==null||s.call(e,a.data.data);break}}return c.useEffect(()=>{window.addEventListener("message",i)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",i)},[]),r.jsx("iframe",{ref:d,className:e.className,src:u()})}exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=b;
package/dist/index.mjs CHANGED
@@ -1,78 +1,82 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import { useRef as r, useEffect as u } from "react";
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useRef as f, useEffect as l } from "react";
3
3
  function g(e) {
4
- const c = r(null);
5
- function l() {
6
- const n = e.host || "https://app.documenso.com", a = btoa(
4
+ const c = f(null);
5
+ function s() {
6
+ const a = e.host || "https://app.documenso.com", n = btoa(
7
7
  JSON.stringify({
8
8
  name: e.name,
9
9
  lockName: e.lockName,
10
10
  email: e.email,
11
11
  lockEmail: e.lockEmail,
12
- css: e.css
12
+ css: e.css,
13
+ cssVars: e.cssVars,
14
+ darkModeDisabled: e.darkModeDisabled
13
15
  })
14
- ), t = new URL(`/embed/direct/${e.token}`, n);
15
- return e.externalId && t.searchParams.set("externalId", e.externalId), `${t}#${a}`;
16
+ ), t = new URL(`/embed/direct/${e.token}`, a);
17
+ return e.externalId && t.searchParams.set("externalId", e.externalId), `${t}#${n}`;
16
18
  }
17
- function d(n) {
18
- var a, t, m, i, o, s;
19
- if (((a = c.current) == null ? void 0 : a.contentWindow) === n.source)
20
- switch (n.data.action) {
19
+ function d(a) {
20
+ var n, t, m, i, u, o;
21
+ if (((n = c.current) == null ? void 0 : n.contentWindow) === a.source)
22
+ switch (a.data.action) {
21
23
  case "document-ready":
22
24
  (t = e.onDocumentReady) == null || t.call(e);
23
25
  break;
24
26
  case "document-completed":
25
- (m = e.onDocumentCompleted) == null || m.call(e, n.data.data);
27
+ (m = e.onDocumentCompleted) == null || m.call(e, a.data.data);
26
28
  break;
27
29
  case "document-error":
28
- (i = e.onDocumentError) == null || i.call(e, n.data.data);
30
+ (i = e.onDocumentError) == null || i.call(e, a.data.data);
29
31
  break;
30
32
  case "field-signed":
31
- (o = e.onFieldSigned) == null || o.call(e);
33
+ (u = e.onFieldSigned) == null || u.call(e);
32
34
  break;
33
35
  case "field-unsigned":
34
- (s = e.onFieldUnsigned) == null || s.call(e);
36
+ (o = e.onFieldUnsigned) == null || o.call(e);
35
37
  break;
36
38
  }
37
39
  }
38
- return u(() => {
40
+ return l(() => {
39
41
  window.addEventListener("message", d);
40
- }, []), u(() => () => {
42
+ }, []), l(() => () => {
41
43
  window.removeEventListener("message", d);
42
- }, []), /* @__PURE__ */ f("iframe", { ref: c, className: e.className, src: l() });
44
+ }, []), /* @__PURE__ */ r("iframe", { ref: c, className: e.className, src: s() });
43
45
  }
44
46
  function w(e) {
45
- const c = r(null);
46
- function l() {
47
- const n = e.host || "https://app.documenso.com", a = btoa(
47
+ const c = f(null);
48
+ function s() {
49
+ const a = e.host || "https://app.documenso.com", n = btoa(
48
50
  JSON.stringify({
49
51
  name: e.name,
50
52
  lockName: e.lockName,
51
- css: e.css
53
+ css: e.css,
54
+ cssVars: e.cssVars,
55
+ darkModeDisabled: e.darkModeDisabled
52
56
  })
53
57
  );
54
- return `${new URL(`/embed/sign/${e.token}`, n)}#${a}`;
58
+ return `${new URL(`/embed/sign/${e.token}`, a)}#${n}`;
55
59
  }
56
- function d(n) {
57
- var a, t, m, i;
58
- if (((a = c.current) == null ? void 0 : a.contentWindow) === n.source)
59
- switch (n.data.action) {
60
+ function d(a) {
61
+ var n, t, m, i;
62
+ if (((n = c.current) == null ? void 0 : n.contentWindow) === a.source)
63
+ switch (a.data.action) {
60
64
  case "document-ready":
61
65
  (t = e.onDocumentReady) == null || t.call(e);
62
66
  break;
63
67
  case "document-completed":
64
- (m = e.onDocumentCompleted) == null || m.call(e, n.data.data);
68
+ (m = e.onDocumentCompleted) == null || m.call(e, a.data.data);
65
69
  break;
66
70
  case "document-error":
67
- (i = e.onDocumentError) == null || i.call(e, n.data.data);
71
+ (i = e.onDocumentError) == null || i.call(e, a.data.data);
68
72
  break;
69
73
  }
70
74
  }
71
- return u(() => {
75
+ return l(() => {
72
76
  window.addEventListener("message", d);
73
- }, []), u(() => () => {
77
+ }, []), l(() => () => {
74
78
  window.removeEventListener("message", d);
75
- }, []), /* @__PURE__ */ f("iframe", { ref: c, className: e.className, src: l() });
79
+ }, []), /* @__PURE__ */ r("iframe", { ref: c, className: e.className, src: s() });
76
80
  }
77
81
  export {
78
82
  g as EmbedDirectTemplate,
@@ -1,10 +1,12 @@
1
+ import { CssVars } from './css-vars';
1
2
  import * as React from "react";
2
3
  export type EmbedSignDocumentProps = {
3
4
  className?: string;
4
5
  host?: string;
5
6
  token: string;
6
7
  css?: string | undefined;
7
- cssVars?: Record<string, string> | undefined;
8
+ cssVars?: (CssVars & Record<string, string>) | undefined;
9
+ darkModeDisabled?: boolean | undefined;
8
10
  name?: string | undefined;
9
11
  lockName?: boolean | undefined;
10
12
  onDocumentReady?: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-react",
3
- "version": "0.1.0",
3
+ "version": "0.2.0-rc.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"