@qaiddev/quests-embed 1.10.2 → 1.11.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/dist/svg.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The embed's own icons, built as DOM nodes.
3
+ *
4
+ * They used to be SVG strings written with `innerHTML`. Building them with
5
+ * `createElementNS` keeps the embed free of HTML sinks, so it runs on pages
6
+ * that enforce Trusted Types (`require-trusted-types-for 'script'`).
7
+ */
8
+ /** An icon: the `<svg>` element's attributes and one `<path>`'s. */
9
+ export interface IconSpec {
10
+ svg: Record<string, string>;
11
+ path: Record<string, string>;
12
+ }
13
+ export declare const CLOSE_ICON: IconSpec;
14
+ export declare const CHECK_ICON: IconSpec;
15
+ /** The chevron that says "there is more below". */
16
+ export declare const SCROLL_CUE_ICON: IconSpec;
17
+ /** Build an icon as a detached `<svg>` element. */
18
+ export declare function svgIcon(spec: IconSpec): SVGSVGElement;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The embed's one Trusted Types policy, `qaid-embed`.
3
+ *
4
+ * On a page that sets `require-trusted-types-for 'script'`, assigning a plain
5
+ * string to `script.src` throws. The embed computes every script URL it sets
6
+ * itself (its own stage-two file, the quests module), so it passes each one
7
+ * through this policy, which only signs URLs the embed registered a moment
8
+ * before. A partner allows it with `trusted-types qaid-embed`.
9
+ *
10
+ * The policy is created once per page and kept on `window`, because embed.js,
11
+ * the bundle it loads, and thumbs-embed (which keeps its own copy of this
12
+ * file) all want the same name, and a page's `trusted-types` directive
13
+ * refuses a second policy of one name unless it says `'allow-duplicates'`.
14
+ *
15
+ * When the browser has no Trusted Types, or the page's directive does not
16
+ * list `qaid-embed`, the URL comes back as a plain string. The assignment
17
+ * then works or throws exactly as it would have; callers catch it.
18
+ *
19
+ * ES5-clean on purpose: embed.js, which runs on the oldest browsers we
20
+ * support, bundles this file too.
21
+ */
22
+ export declare var POLICY_NAME: string;
23
+ /**
24
+ * A value for `script.src`: a TrustedScriptURL from the `qaid-embed` policy
25
+ * when one exists, else the string itself.
26
+ */
27
+ export declare function trustedScriptUrl(url: string): string;
28
+ /** @internal Test seam: forget the page's policy. */
29
+ export declare function _resetTrustedTypes(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qaiddev/quests-embed",
3
- "version": "1.10.2",
3
+ "version": "1.11.0",
4
4
  "description": "Any Questions for your Users?",
5
5
  "type": "module",
6
6
  "main": "./dist/qaid-quests.umd.cjs",