@signsealer/embed 0.0.0-stage → 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mashdun LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ # @signsealer/embed
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **For the browser.** SignSealer's browser package: it holds no key. Your
4
+ server gets the session link with
5
+ [`@signsealer/sdk`](https://www.npmjs.com/package/@signsealer/sdk), which holds
6
+ your partner key, and your page mounts it with this one.
7
+
8
+ | Package | Where it runs | What it does | Holds a key? |
9
+ |---|---|---|---|
10
+ | `@signsealer/sdk` | Your server: Node 18+, edge runtimes | Asks for the session link (`partner.embedSession(id, { user, components })` → `url`), and everything else the API does | Yes, your secret key |
11
+ | `@signsealer/embed` (this one) | Your web page, in the browser | Mounts the session's screens in an iframe on your page | No |
12
+
13
+ A business's SignSealer screens — its documents, sending, templates, settings
14
+ and texting number — on your own page, for a partner on a Platform agreement.
15
+ No dependencies, about 6 KB, and nothing fetched, stored or sent anywhere but
16
+ the frame. `mount` called on a server, where there is no page, throws and says
17
+ to use `@signsealer/sdk` there.
18
+
19
+ Version 0.1.0. Not on npm yet: `publish embed` (a tag `embed-v<version>`)
20
+ publishes it.
21
+
22
+ ## How it fits
23
+
24
+ 1. Your server asks SignSealer for a session for the person looking at your
25
+ page, with your partner key:
26
+
27
+ ```js
28
+ import { SignSealerPartner } from "@signsealer/sdk";
29
+ const partner = new SignSealerPartner({ partnerKey: process.env.SIGNSEALER_PARTNER_KEY });
30
+ const { url } = await partner.embedSession(merchant.id, {
31
+ user: { external_id: user.id, name: user.name, email: user.email, role: "admin" },
32
+ components: ["documents", "send", "templates", "settings", "texting"],
33
+ });
34
+ ```
35
+
36
+ The `url` opens once, within five minutes: ask for it as the page loads,
37
+ and hand it to the page. Never put your partner key in a page.
38
+
39
+ 2. Your page mounts it:
40
+
41
+ ```js
42
+ import { SignSealerEmbed } from "@signsealer/embed";
43
+
44
+ const frame = SignSealerEmbed.mount(document.getElementById("signing"), {
45
+ url, // from your server
46
+ component: "templates", // the screen to open on; the first one the session names otherwise
47
+ theme: { primary: "#0a7700", font: "serif" },
48
+ });
49
+
50
+ frame
51
+ .on("document.sent", (e) => { if (e.delivery === "embedded") showLinks(e.links); })
52
+ .on("template.published", (e) => refreshTemplates(e.template_id))
53
+ .on("session.ended", () => reloadWithANewUrl());
54
+ ```
55
+
56
+ The frame resizes itself to its page as it changes; `resize` is there if you
57
+ want to know too.
58
+
59
+ ## Options
60
+
61
+ | Option | |
62
+ |---|---|
63
+ | `url` | The session's `url`. Anything that is not a SignSealer start link (`https://…/embed/start/es_…`, or `http://localhost` for a sandbox) is refused before a frame is made. |
64
+ | `component` | `documents`, `send`, `templates`, `settings` or `texting`: the screen to open on, if the session has it. |
65
+ | `theme.primary` | Your colour for buttons and links, `#` and six hex digits. The button text is black or white, whichever reads on it. |
66
+ | `theme.font` | `system` (the default), `sans`, `serif` or `rounded`: families every device has, so nothing is downloaded. |
67
+ | `title` | The frame's accessible name. `SignSealer` otherwise. |
68
+ | `height` | Its height in pixels until the screen says how tall it is. 480 otherwise. |
69
+
70
+ SignSealer checks the theme again, and draws it only if it is one of these.
71
+
72
+ ## Events
73
+
74
+ `frame.on(name, fn)`, `frame.off(name, fn)`; `"*"` hears every message.
75
+ Each event has `type` and `source: "signsealer-embed"`, and:
76
+
77
+ | Event | Carries |
78
+ |---|---|
79
+ | `ready` | `screen`: each page the person opens |
80
+ | `resize` | `height` |
81
+ | `document.sent` | `document_id`, `delivery` (`send` or `embedded`), and for `embedded` the `links`: `signer_id`, `sign_order`, `url`, `held` |
82
+ | `document.reminded`, `document.voided` | `document_id` |
83
+ | `template.saved`, `template.published` | `template_id` |
84
+ | `settings.saved` | nothing: the business's brand, delivery or reminders changed |
85
+ | `texting.applied` | nothing: its texting-number application was filed |
86
+ | `session.ended` | nothing: ask your server for a new `url` and mount again |
87
+
88
+ A message is heard only when it comes from this frame's own window and from
89
+ the origin of the `url` you mounted; anything else is dropped before it is
90
+ read. No message carries a token or anything a person typed, except the
91
+ signing links of a send whose links were asked to be handed back to you.
92
+
93
+ `frame.destroy()` stops listening and takes the frame off the page.
94
+
95
+ ## Where the frame may be
96
+
97
+ Only on your own sites: the https origins of your app's redirect addresses
98
+ and homepage (and localhost for a sandbox business), which SignSealer has
99
+ reviewed. Anywhere else the browser refuses to draw it.
100
+
101
+ The full guide: https://signsealer.com/docs/partners#embedded
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ /**
3
+ * @signsealer/embed — mount a business's SignSealer screens on your own page.
4
+ *
5
+ * Your server asks SignSealer for a session (`POST
6
+ * /v1/partner/businesses/{id}/sessions`, or `partner.embedSession()` in
7
+ * `@signsealer/sdk`) and hands its `url` to your page; this mounts it:
8
+ *
9
+ * const frame = SignSealerEmbed.mount(el, { url, component: "templates", theme: { primary: "#0a7700" } })
10
+ * .on("template.published", (e) => refresh(e.template_id))
11
+ * .on("session.ended", () => askYourServerForANewUrl());
12
+ *
13
+ * It makes the iframe, sizes it to its page, and hands you what the screens
14
+ * say as typed events. It listens only to messages from that one frame, on
15
+ * the origin of the URL it was given: a message from any other window or
16
+ * origin is dropped before anything reads it. No dependencies, nothing
17
+ * fetched, nothing stored, and no token or anything a person typed ever
18
+ * passes through it (but the signing links of a send you asked to have handed
19
+ * back, which is what you asked for).
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.SignSealerEmbed = exports.NO_PAGE_MESSAGE = exports.EMBED_VERSION = void 0;
23
+ exports.frameUrl = frameUrl;
24
+ exports.mount = mount;
25
+ exports.EMBED_VERSION = "0.1.0";
26
+ /** What `mount` throws where there is no page: on a server, the session's link comes from `@signsealer/sdk`. */
27
+ exports.NO_PAGE_MESSAGE = "This is SignSealer's browser package; on your server use @signsealer/sdk to get the session link.";
28
+ const COMPONENTS = ["documents", "send", "templates", "settings", "texting"];
29
+ const FONTS = ["system", "sans", "serif", "rounded"];
30
+ const START = /^\/embed\/start\/es_[0-9a-f]{48}$/;
31
+ const LOCAL = /^(localhost|127\.0\.0\.1|\[::1\])$/;
32
+ /* Taller than any screen; a larger number is not a height. */
33
+ const MAX_HEIGHT = 20000;
34
+ /**
35
+ * The address the frame opens: the session's start link, checked, with the
36
+ * screen and the theme asked for. Throws on anything else, before a frame
37
+ * exists, so a mistake is found on your page rather than inside the frame.
38
+ */
39
+ function frameUrl(options) {
40
+ let u;
41
+ try {
42
+ u = new URL(options.url);
43
+ }
44
+ catch {
45
+ throw new TypeError("SignSealerEmbed: url is the session's url, as SignSealer answered your server");
46
+ }
47
+ if (!(u.protocol === "https:" || (u.protocol === "http:" && LOCAL.test(u.hostname))) || !START.test(u.pathname)
48
+ || u.username || u.password) {
49
+ throw new TypeError("SignSealerEmbed: url is the session's url, https://…/embed/start/es_…, as SignSealer answered your server");
50
+ }
51
+ u.search = "";
52
+ u.hash = "";
53
+ if (options.component !== undefined) {
54
+ if (!COMPONENTS.includes(options.component))
55
+ throw new TypeError(`SignSealerEmbed: component is one of ${COMPONENTS.join(", ")}`);
56
+ u.searchParams.set("screen", options.component);
57
+ }
58
+ const t = options.theme;
59
+ if (t !== undefined && t !== null) {
60
+ if (t.primary !== undefined) {
61
+ if (typeof t.primary !== "string" || !/^#[0-9a-fA-F]{6}$/.test(t.primary)) {
62
+ throw new TypeError("SignSealerEmbed: theme.primary is # and six hex digits, like #0a7700");
63
+ }
64
+ u.searchParams.set("primary", t.primary.toLowerCase());
65
+ }
66
+ if (t.font !== undefined) {
67
+ if (!FONTS.includes(t.font))
68
+ throw new TypeError(`SignSealerEmbed: theme.font is one of ${FONTS.join(", ")}`);
69
+ u.searchParams.set("font", t.font);
70
+ }
71
+ }
72
+ return u;
73
+ }
74
+ /**
75
+ * Mount a session's screen in `target` (an element, or a selector for one on
76
+ * this page). Returns the mounted frame: `.on(name, fn)` for its events,
77
+ * `.destroy()` to take it away.
78
+ */
79
+ function mount(target, options) {
80
+ /* No `document`, and not handed an element that is on one (jsdom, a test's page): this is a server. */
81
+ if (typeof globalThis.document === "undefined" && !target?.ownerDocument) {
82
+ throw new Error(exports.NO_PAGE_MESSAGE);
83
+ }
84
+ const el = typeof target === "string" ? globalThis.document?.querySelector(target) : target;
85
+ if (!el)
86
+ throw new TypeError("SignSealerEmbed: no element to mount in");
87
+ const src = frameUrl(options);
88
+ const doc = el.ownerDocument;
89
+ const win = doc.defaultView;
90
+ if (!win)
91
+ throw new TypeError("SignSealerEmbed: the element is not on a page");
92
+ const origin = src.origin;
93
+ const iframe = doc.createElement("iframe");
94
+ iframe.setAttribute("title", options.title ?? "SignSealer");
95
+ iframe.setAttribute("referrerpolicy", "no-referrer");
96
+ iframe.style.width = "100%";
97
+ iframe.style.border = "0";
98
+ iframe.style.display = "block";
99
+ iframe.style.height = `${Number.isFinite(options.height) && options.height > 0 ? Math.min(options.height, MAX_HEIGHT) : 480}px`;
100
+ iframe.src = src.toString();
101
+ const listeners = new Map();
102
+ const emit = (name, event) => {
103
+ for (const fn of Array.from(listeners.get(name) ?? [])) {
104
+ try {
105
+ fn(event);
106
+ }
107
+ catch (e) {
108
+ /* One page's handler failing does not stop the next; it is still reported. */
109
+ setTimeout(() => { throw e; }, 0);
110
+ }
111
+ }
112
+ };
113
+ const onMessage = (e) => {
114
+ /* Only this frame, and only from the session's origin: any other window or origin could post the same shape. */
115
+ if (e.origin !== origin || e.source === null || e.source !== iframe.contentWindow)
116
+ return;
117
+ const data = e.data;
118
+ if (typeof data !== "object" || data === null)
119
+ return;
120
+ const m = data;
121
+ if (m.source !== "signsealer-embed" || typeof m.type !== "string" || m.type.length > 64)
122
+ return;
123
+ const event = { ...m };
124
+ if (event.type === "resize") {
125
+ const h = Number(event.height);
126
+ if (!Number.isFinite(h) || h < 0)
127
+ return;
128
+ iframe.style.height = `${Math.min(Math.ceil(h), MAX_HEIGHT)}px`;
129
+ }
130
+ emit(event.type, event);
131
+ emit("*", event);
132
+ };
133
+ win.addEventListener("message", onMessage);
134
+ el.appendChild(iframe);
135
+ const mounted = {
136
+ iframe,
137
+ origin,
138
+ on(name, fn) {
139
+ if (typeof fn !== "function")
140
+ throw new TypeError("SignSealerEmbed: on(name, fn) takes a function");
141
+ if (!listeners.has(name))
142
+ listeners.set(name, new Set());
143
+ listeners.get(name).add(fn);
144
+ return mounted;
145
+ },
146
+ off(name, fn) {
147
+ listeners.get(name)?.delete(fn);
148
+ return mounted;
149
+ },
150
+ destroy() {
151
+ win.removeEventListener("message", onMessage);
152
+ listeners.clear();
153
+ iframe.remove();
154
+ },
155
+ };
156
+ return mounted;
157
+ }
158
+ /** The one export most pages need. */
159
+ exports.SignSealerEmbed = { mount, frameUrl, version: exports.EMBED_VERSION };
160
+ exports.default = ex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CAAC;KACc,CAAC;IAClB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,sCAAsC;AACzB,QAAA,eAAe,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAA,aAAa,EAAW,CAAC;kBACrE,QAAA,eAAe"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @signsealer/embed — mount a business's SignSealer screens on your own page.
3
+ *
4
+ * Your server asks SignSealer for a session (`POST
5
+ * /v1/partner/businesses/{id}/sessions`, or `partner.embedSession()` in
6
+ * `@signsealer/sdk`) and hands its `url` to your page; this mounts it:
7
+ *
8
+ * const frame = SignSealerEmbed.mount(el, { url, component: "templates", theme: { primary: "#0a7700" } })
9
+ * .on("template.published", (e) => refresh(e.template_id))
10
+ * .on("session.ended", () => askYourServerForANewUrl());
11
+ *
12
+ * It makes the iframe, sizes it to its page, and hands you what the screens
13
+ * say as typed events. It listens only to messages from that one frame, on
14
+ * the origin of the URL it was given: a message from any other window or
15
+ * origin is dropped before anything reads it. No dependencies, nothing
16
+ * fetched, nothing stored, and no token or anything a person typed ever
17
+ * passes through it (but the signing links of a send you asked to have handed
18
+ * back, which is what you asked for).
19
+ */
20
+ /** The screens a session may open (`components` when the session was asked for). */
21
+ export type EmbedComponent = "documents" | "send" | "templates" | "settings" | "texting";
22
+ /** The fonts the frame may be drawn in: families every device has, so nothing is fetched. */
23
+ export type EmbedFont = "system" | "sans" | "serif" | "rounded";
24
+ export interface EmbedTheme {
25
+ /** Your brand's colour for buttons and links: `#` and six hex digits. */
26
+ primary?: string;
27
+ font?: EmbedFont;
28
+ }
29
+ export interface MountOptions {
30
+ /** The session's `url`, as SignSealer answered your server. It opens once, within five minutes. */
31
+ url: string;
32
+ /** The screen to open on, when the session has more than one. The first it names otherwise. */
33
+ component?: EmbedComponent;
34
+ theme?: EmbedTheme;
35
+ /** The frame's accessible name. */
36
+ title?: string;
37
+ /** Its height until the screen says how tall it is, in pixels. */
38
+ height?: number;
39
+ }
40
+ /** A signing link handed back to your page (a send with `delivery: "embedded"`). */
41
+ export interface HandedLink {
42
+ signer_id: string;
43
+ sign_order: number | null;
44
+ url: string | null;
45
+ /** Waiting for the signer's turn: their link comes later. */
46
+ held: boolean;
47
+ }
48
+ /** What each event carries. Every one also has `type` and `source: "signsealer-embed"`. */
49
+ export interface EmbedEventMap {
50
+ /** The screen is drawn (each page the person opens). */
51
+ ready: {
52
+ screen: string;
53
+ };
54
+ /** Its page is this tall; the frame is already resized to it. */
55
+ resize: {
56
+ height: number;
57
+ };
58
+ "document.sent": {
59
+ document_id: string | null;
60
+ delivery?: "send" | "embedded";
61
+ links?: HandedLink[];
62
+ };
63
+ "document.reminded": {
64
+ document_id: string | null;
65
+ };
66
+ "document.voided": {
67
+ document_id: string | null;
68
+ };
69
+ "template.saved": {
70
+ template_id: string;
71
+ };
72
+ "template.published": {
73
+ template_id: string;
74
+ };
75
+ /** The business's brand, delivery or reminders changed. */
76
+ "settings.saved": Record<string, never>;
77
+ /** The business's texting-number application was filed. */
78
+ "texting.applied": Record<string, never>;
79
+ /** The session ended or ran out: ask your server for a new `url` and mount again. */
80
+ "session.ended": Record<string, never>;
81
+ }
82
+ export type EmbedEventName = keyof EmbedEventMap;
83
+ export type EmbedEvent<K extends EmbedEventName = EmbedEventName> = EmbedEventMap[K] & {
84
+ type: K;
85
+ source: "signsealer-embed";
86
+ };
87
+ /** Every message, including a kind this version does not name yet. */
88
+ export type AnyEmbedEvent = {
89
+ type: string;
90
+ source: "signsealer-embed";
91
+ [key: string]: unknown;
92
+ };
93
+ export interface MountedEmbed {
94
+ readonly iframe: HTMLIFrameElement;
95
+ /** The origin messages are taken from: the session URL's. */
96
+ readonly origin: string;
97
+ on<K extends EmbedEventName>(name: K, fn: (event: EmbedEvent<K>) => void): MountedEmbed;
98
+ on(name: "*", fn: (event: AnyEmbedEvent) => void): MountedEmbed;
99
+ off(name: EmbedEventName | "*", fn: (event: never) => void): MountedEmbed;
100
+ /** Stop listening, and take the frame off the page. */
101
+ destroy(): void;
102
+ }
103
+ export declare const EMBED_VERSION = "0.1.0";
104
+ /** What `mount` throws where there is no page: on a server, the session's link comes from `@signsealer/sdk`. */
105
+ export declare const NO_PAGE_MESSAGE = "This is SignSealer's browser package; on your server use @signsealer/sdk to get the session link.";
106
+ /**
107
+ * The address the frame opens: the session's start link, checked, with the
108
+ * screen and the theme asked for. Throws on anything else, before a frame
109
+ * exists, so a mistake is found on your page rather than inside the frame.
110
+ */
111
+ export declare function frameUrl(options: Pick<MountOptions, "url" | "component" | "theme">): URL;
112
+ /**
113
+ * Mount a session's screen in `target` (an element, or a selector for one on
114
+ * this page). Returns the mounted frame: `.on(name, fn)` for its events,
115
+ * `.destroy()` to take it away.
116
+ */
117
+ export declare function mount(target: HTMLElement | string, options: MountOptions): MountedEmbed;
118
+ /** The one export most pages need. */
119
+ export declare const SignSealerEmbed: {
120
+ readonly mount: typeof mount;
121
+ readonly frameUrl: typeof frameUrl;
122
+ readonly version: "0.1.0";
123
+ };
124
+ export default SignSealerEmbed;
125
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,oFAAoF;AACpF,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;AAEzF,6FAA6F;AAC7F,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,UAAU;IACzB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,mGAAmG;IACnG,GAAG,EAAE,MAAM,CAAC;IACZ,+FAA+F;IAC/F,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,KAAK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AY,GAAG,YAAY,CAyEvF;AAED,sCAAsC;AACtC,eAAO,MAAM,eAAe;;;;CAAuD,CAAC;eACrE,eAAe"}
@@ -0,0 +1,156 @@
1
+ /**
2
+ * @signsealer/embed — mount a business's SignSealer screens on your own page.
3
+ *
4
+ * Your server asks SignSealer for a session (`POST
5
+ * /v1/partner/businesses/{id}/sessions`, or `partner.embedSession()` in
6
+ * `@signsealer/sdk`) and hands its `url` to your page; this mounts it:
7
+ *
8
+ * const frame = SignSealerEmbed.mount(el, { url, component: "templates", theme: { primary: "#0a7700" } })
9
+ * .on("template.published", (e) => refresh(e.template_id))
10
+ * .on("session.ended", () => askYourServerForANewUrl());
11
+ *
12
+ * It makes the iframe, sizes it to its page, and hands you what the screens
13
+ * say as typed events. It listens only to messages from that one frame, on
14
+ * the origin of the URL it was given: a message from any other window or
15
+ * origin is dropped before anything reads it. No dependencies, nothing
16
+ * fetched, nothing stored, and no token or anything a person typed ever
17
+ * passes through it (but the signing links of a send you asked to have handed
18
+ * back, which is what you asked for).
19
+ */
20
+ export const EMBED_VERSION = "0.1.0";
21
+ /** What `mount` throws where there is no page: on a server, the session's link comes from `@signsealer/sdk`. */
22
+ export const NO_PAGE_MESSAGE = "This is SignSealer's browser package; on your server use @signsealer/sdk to get the session link.";
23
+ const COMPONENTS = ["documents", "send", "templates", "settings", "texting"];
24
+ const FONTS = ["system", "sans", "serif", "rounded"];
25
+ const START = /^\/embed\/start\/es_[0-9a-f]{48}$/;
26
+ const LOCAL = /^(localhost|127\.0\.0\.1|\[::1\])$/;
27
+ /* Taller than any screen; a larger number is not a height. */
28
+ const MAX_HEIGHT = 20000;
29
+ /**
30
+ * The address the frame opens: the session's start link, checked, with the
31
+ * screen and the theme asked for. Throws on anything else, before a frame
32
+ * exists, so a mistake is found on your page rather than inside the frame.
33
+ */
34
+ export function frameUrl(options) {
35
+ let u;
36
+ try {
37
+ u = new URL(options.url);
38
+ }
39
+ catch {
40
+ throw new TypeError("SignSealerEmbed: url is the session's url, as SignSealer answered your server");
41
+ }
42
+ if (!(u.protocol === "https:" || (u.protocol === "http:" && LOCAL.test(u.hostname))) || !START.test(u.pathname)
43
+ || u.username || u.password) {
44
+ throw new TypeError("SignSealerEmbed: url is the session's url, https://…/embed/start/es_…, as SignSealer answered your server");
45
+ }
46
+ u.search = "";
47
+ u.hash = "";
48
+ if (options.component !== undefined) {
49
+ if (!COMPONENTS.includes(options.component))
50
+ throw new TypeError(`SignSealerEmbed: component is one of ${COMPONENTS.join(", ")}`);
51
+ u.searchParams.set("screen", options.component);
52
+ }
53
+ const t = options.theme;
54
+ if (t !== undefined && t !== null) {
55
+ if (t.primary !== undefined) {
56
+ if (typeof t.primary !== "string" || !/^#[0-9a-fA-F]{6}$/.test(t.primary)) {
57
+ throw new TypeError("SignSealerEmbed: theme.primary is # and six hex digits, like #0a7700");
58
+ }
59
+ u.searchParams.set("primary", t.primary.toLowerCase());
60
+ }
61
+ if (t.font !== undefined) {
62
+ if (!FONTS.includes(t.font))
63
+ throw new TypeError(`SignSealerEmbed: theme.font is one of ${FONTS.join(", ")}`);
64
+ u.searchParams.set("font", t.font);
65
+ }
66
+ }
67
+ return u;
68
+ }
69
+ /**
70
+ * Mount a session's screen in `target` (an element, or a selector for one on
71
+ * this page). Returns the mounted frame: `.on(name, fn)` for its events,
72
+ * `.destroy()` to take it away.
73
+ */
74
+ export function mount(target, options) {
75
+ /* No `document`, and not handed an element that is on one (jsdom, a test's page): this is a server. */
76
+ if (typeof globalThis.document === "undefined" && !target?.ownerDocument) {
77
+ throw new Error(NO_PAGE_MESSAGE);
78
+ }
79
+ const el = typeof target === "string" ? globalThis.document?.querySelector(target) : target;
80
+ if (!el)
81
+ throw new TypeError("SignSealerEmbed: no element to mount in");
82
+ const src = frameUrl(options);
83
+ const doc = el.ownerDocument;
84
+ const win = doc.defaultView;
85
+ if (!win)
86
+ throw new TypeError("SignSealerEmbed: the element is not on a page");
87
+ const origin = src.origin;
88
+ const iframe = doc.createElement("iframe");
89
+ iframe.setAttribute("title", options.title ?? "SignSealer");
90
+ iframe.setAttribute("referrerpolicy", "no-referrer");
91
+ iframe.style.width = "100%";
92
+ iframe.style.border = "0";
93
+ iframe.style.display = "block";
94
+ iframe.style.height = `${Number.isFinite(options.height) && options.height > 0 ? Math.min(options.height, MAX_HEIGHT) : 480}px`;
95
+ iframe.src = src.toString();
96
+ const listeners = new Map();
97
+ const emit = (name, event) => {
98
+ for (const fn of Array.from(listeners.get(name) ?? [])) {
99
+ try {
100
+ fn(event);
101
+ }
102
+ catch (e) {
103
+ /* One page's handler failing does not stop the next; it is still reported. */
104
+ setTimeout(() => { throw e; }, 0);
105
+ }
106
+ }
107
+ };
108
+ const onMessage = (e) => {
109
+ /* Only this frame, and only from the session's origin: any other window or origin could post the same shape. */
110
+ if (e.origin !== origin || e.source === null || e.source !== iframe.contentWindow)
111
+ return;
112
+ const data = e.data;
113
+ if (typeof data !== "object" || data === null)
114
+ return;
115
+ const m = data;
116
+ if (m.source !== "signsealer-embed" || typeof m.type !== "string" || m.type.length > 64)
117
+ return;
118
+ const event = { ...m };
119
+ if (event.type === "resize") {
120
+ const h = Number(event.height);
121
+ if (!Number.isFinite(h) || h < 0)
122
+ return;
123
+ iframe.style.height = `${Math.min(Math.ceil(h), MAX_HEIGHT)}px`;
124
+ }
125
+ emit(event.type, event);
126
+ emit("*", event);
127
+ };
128
+ win.addEventListener("message", onMessage);
129
+ el.appendChild(iframe);
130
+ const mounted = {
131
+ iframe,
132
+ origin,
133
+ on(name, fn) {
134
+ if (typeof fn !== "function")
135
+ throw new TypeError("SignSealerEmbed: on(name, fn) takes a function");
136
+ if (!listeners.has(name))
137
+ listeners.set(name, new Set());
138
+ listeners.get(name).add(fn);
139
+ return mounted;
140
+ },
141
+ off(name, fn) {
142
+ listeners.get(name)?.delete(fn);
143
+ return mounted;
144
+ },
145
+ destroy() {
146
+ win.removeEventListener("message", onMessage);
147
+ listeners.clear();
148
+ iframe.remove();
149
+ },
150
+ };
151
+ return mounted;
152
+ }
153
+ /** The one export most pages need. */
154
+ export const SignSealerEmbed = { mount, frameUrl, version: EMBED_VERSION };
155
+ export default SignSealerEmbed;
156
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAsEH,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AAErC,gHAAgH;AAChH,MAAM,CAAC,MAAM,eAAe,GAAG,mGAAmG,CAAC;AAEnI,MAAM,UAAU,GAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AAChG,MAAM,KAAK,GAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AACxE,MAAM,KAAK,GAAG,mCAAmC,CAAC;AAClD,MAAM,KAAK,GAAG,oCAAoC,CAAC;AACnD,8DAA8D;AAC9D,MAAM,UAAU,GAAG,KAAK,CAAC;AAEzB;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,OAA0D;IACjF,IAAI,CAAM,CAAC;IACX,IAAI,CAAC;QACH,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,SAAS,CAAC,+EAA+E,CAAC,CAAC;IACvG,CAAC;IACD,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;WACxG,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CAA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AAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YAC9C,SAAS,CAAC,KAAK,EAAE,CAAC;YAClB,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC;KACc,CAAC;IAClB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,sCAAsC;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAW,CAAC;AACpF,eAAe,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@signsealer/embed",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "SignSealer's browser package: mount a business's SignSealer screens (documents, send, templates, settings) in an iframe on your own web page. Holds no key; your server gets the session link with @signsealer/sdk. No dependencies, under 8 KB.",
5
+ "license": "MIT",
6
+ "homepage": "https://signsealer.com/docs/partners#embedded",
7
+ "bugs": {
8
+ "url": "https://signsealer.com/docs/partners",
9
+ "email": "support@signsealer.com"
10
+ },
11
+ "keywords": [
12
+ "signsealer",
13
+ "esignature",
14
+ "e-signature",
15
+ "embed",
16
+ "embedded-signing",
17
+ "iframe",
18
+ "browser",
19
+ "white-label",
20
+ "partner",
21
+ "platform"
22
+ ],
23
+ "type": "module",
24
+ "sideEffects": false,
25
+ "files": [
26
+ "dist",
27
+ "README.md",
28
+ "LICENSE"
29
+ ],
30
+ "main": "./dist/cjs/index.cjs",
31
+ "module": "./dist/esm/index.js",
32
+ "types": "./dist/esm/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/esm/index.d.ts",
36
+ "import": "./dist/esm/index.js",
37
+ "require": "./dist/cjs/index.cjs",
38
+ "default": "./dist/esm/index.js"
39
+ },
40
+ "./package.json": "./package.json"
41
+ },
42
+ "scripts": {
43
+ "build": "node ./build.mjs",
44
+ "typecheck": "tsc --noEmit -p tsconfig.json",
45
+ "prepublishOnly": "npm run build"
46
+ },
47
+ "devDependencies": {
48
+ "typescript": "^7.0.2"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ }
53
+ }