@widgetic/embed-sdk 2.0.7 → 2.0.8

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.
@@ -3,14 +3,13 @@
3
3
  * No API key.
4
4
  *
5
5
  * Order:
6
- * 1. <script data-api-url> / window.WIDGETIC_EMBED_API (local / Render tests)
7
- * 2. localhost:3000 when the host page is local
8
- * 3. CDN lookup script (no CORS — works on CodePen)
9
- * 4. Render gateway, then getApiUrl() / api.widgetic.com (new platform API)
6
+ * 1. <script data-api-url> / window.WIDGETIC_EMBED_API (explicit override: local runs, tests)
7
+ * 2. CDN lookup script (no CORS — works on CodePen)
8
+ * 3. getApiUrl() / api.widgetic.com (new platform API)
10
9
  *
11
10
  * api.widgetic.com is the new API host. Legacy REST is widgetic.com/api/v2.
12
- * Until DNS/proxy for api.widgetic.com points at the new gateway (today it can
13
- * 301 via old Varnish to widgetic.com), keep CDN + Render as fallbacks.
11
+ * The development gateways (the Render service, localhost:3000) are no longer
12
+ * tried on their own: a run against one passes its address as data-api-url.
14
13
  *
15
14
  * A gateway that answers 403 DOMAIN_NOT_ALLOWED has given its answer: the
16
15
  * embed's owner limited it to the websites they listed, and this page is not
@@ -18,6 +17,7 @@
18
17
  * (step 3) stands in for a gateway that cannot be reached, never for one that
19
18
  * said no.
20
19
  */
20
+ import { type GatewayRefusalCode } from "./embed-gateway-codes.js";
21
21
  /** The code the gateway puts on the 403 it sends to a website the embed's owner did not list. */
22
22
  export declare const EMBED_DOMAIN_REFUSAL_CODE = "DOMAIN_NOT_ALLOWED";
23
23
  /**
@@ -45,12 +45,22 @@ export type PublishedEmbedRefusal = {
45
45
  * refusal: it cannot be mistaken for "not found", which is the case where
46
46
  * falling back to another copy is right.
47
47
  */
48
+ export type PublishedEmbedFailure = {
49
+ /** Upper-case code for `data-widgetic-refused` (when set). */
50
+ gatewayCode: GatewayRefusalCode | "DOMAIN_NOT_ALLOWED";
51
+ /** Lower-case state for `widgetic:error` detail.code */
52
+ stateCode: string;
53
+ };
48
54
  export type PublishedEmbedLookup = {
49
55
  status: "found";
50
56
  payload: PublicEmbedPayload;
57
+ gatewayOrigin?: string;
51
58
  } | {
52
59
  status: "refused";
53
60
  refusal: PublishedEmbedRefusal;
61
+ } | {
62
+ status: "failed";
63
+ failure: PublishedEmbedFailure;
54
64
  } | {
55
65
  status: "not-found";
56
66
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Relays `widgetic:host` into the gateway frame and wrapper events back to the page.
3
+ */
4
+ /** Attaches the host bridge for a published iframe mount. */
5
+ export declare function attachPublishedHostBridge(host: HTMLElement, iframe: HTMLIFrameElement, embedUrl: string, compositionId: string): void;
6
+ export declare function detachPublishedHostBridge(host: HTMLElement): void;
7
+ /** Dispatches a host-level embed error (lookup refusal, not found, device restriction). */
8
+ export declare function dispatchPublishedHostError(host: HTMLElement, compositionId: string, code: string): void;