@archie/devtools 0.0.12 → 0.0.13

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.
@@ -1,6 +1,42 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
 
4
+ /** Only configured domains (Archie host origins) and optionally localhost in dev. "*" is never used. */
5
+ type InjectOptions = {
6
+ id?: string;
7
+ /**
8
+ * Origin(s) allowed to send postMessage commands to the inspector.
9
+ * If not set, uses Archie host origins + localhost when dev is true.
10
+ * "*" is not allowed; pass an array of concrete origins.
11
+ */
12
+ allowedOrigins?: string | string[];
13
+ /**
14
+ * Origin to which the inspector sends postMessage replies (the parent window).
15
+ * If not set and in an iframe, uses document.referrer origin — except when the page
16
+ * is a preview iframe (*.previews.staging.archie-platform.com), in which case you
17
+ * must pass the parent app origin (e.g. https://app.dev.archie-platform.com).
18
+ * "*" is not allowed.
19
+ */
20
+ targetOrigin?: string;
21
+ /**
22
+ * When true, allowedOrigins default includes localhost for local testing.
23
+ * When undefined, inferred from document.referrer (localhost or missing = dev).
24
+ */
25
+ dev?: boolean;
26
+ /**
27
+ * Where to load the inspector script from.
28
+ * - "remote" (default): load from REMOTE_INSPECTOR_SCRIPT_URL with a dynamic hash to avoid cache.
29
+ * - "local": load from the bundled module (import('./inspector.js')).
30
+ */
31
+ scriptSource?: 'remote' | 'local';
32
+ /**
33
+ * Override the remote script URL (e.g. your own CDN, a pinned version, or a URL with SRI hash).
34
+ * Only used when scriptSource is "remote" (default). Defaults to REMOTE_INSPECTOR_SCRIPT_URL.
35
+ * Example: 'https://my-cdn.com/inspector.standalone.js'
36
+ */
37
+ scriptUrl?: string;
38
+ };
39
+
4
40
  interface ArchieRouteObjectLike {
5
41
  id?: string;
6
42
  path?: string;
@@ -31,11 +67,12 @@ interface ArchieRouterLike {
31
67
  interface ArchieDevToolsRuntimeOptions {
32
68
  router: ArchieRouterLike;
33
69
  inspector?: boolean;
70
+ inspectorOptions?: InjectOptions;
34
71
  }
35
72
 
36
73
  interface ArchieDevToolProviderProps extends ArchieDevToolsRuntimeOptions {
37
74
  children: ReactNode;
38
75
  }
39
- declare function ArchieDevToolProvider({ children, router, inspector, }: ArchieDevToolProviderProps): react_jsx_runtime.JSX.Element;
76
+ declare function ArchieDevToolProvider({ children, router, inspector, inspectorOptions, }: ArchieDevToolProviderProps): react_jsx_runtime.JSX.Element;
40
77
 
41
78
  export { ArchieDevToolProvider, type ArchieDevToolProviderProps };
@@ -1,6 +1,42 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
 
4
+ /** Only configured domains (Archie host origins) and optionally localhost in dev. "*" is never used. */
5
+ type InjectOptions = {
6
+ id?: string;
7
+ /**
8
+ * Origin(s) allowed to send postMessage commands to the inspector.
9
+ * If not set, uses Archie host origins + localhost when dev is true.
10
+ * "*" is not allowed; pass an array of concrete origins.
11
+ */
12
+ allowedOrigins?: string | string[];
13
+ /**
14
+ * Origin to which the inspector sends postMessage replies (the parent window).
15
+ * If not set and in an iframe, uses document.referrer origin — except when the page
16
+ * is a preview iframe (*.previews.staging.archie-platform.com), in which case you
17
+ * must pass the parent app origin (e.g. https://app.dev.archie-platform.com).
18
+ * "*" is not allowed.
19
+ */
20
+ targetOrigin?: string;
21
+ /**
22
+ * When true, allowedOrigins default includes localhost for local testing.
23
+ * When undefined, inferred from document.referrer (localhost or missing = dev).
24
+ */
25
+ dev?: boolean;
26
+ /**
27
+ * Where to load the inspector script from.
28
+ * - "remote" (default): load from REMOTE_INSPECTOR_SCRIPT_URL with a dynamic hash to avoid cache.
29
+ * - "local": load from the bundled module (import('./inspector.js')).
30
+ */
31
+ scriptSource?: 'remote' | 'local';
32
+ /**
33
+ * Override the remote script URL (e.g. your own CDN, a pinned version, or a URL with SRI hash).
34
+ * Only used when scriptSource is "remote" (default). Defaults to REMOTE_INSPECTOR_SCRIPT_URL.
35
+ * Example: 'https://my-cdn.com/inspector.standalone.js'
36
+ */
37
+ scriptUrl?: string;
38
+ };
39
+
4
40
  interface ArchieRouteObjectLike {
5
41
  id?: string;
6
42
  path?: string;
@@ -31,11 +67,12 @@ interface ArchieRouterLike {
31
67
  interface ArchieDevToolsRuntimeOptions {
32
68
  router: ArchieRouterLike;
33
69
  inspector?: boolean;
70
+ inspectorOptions?: InjectOptions;
34
71
  }
35
72
 
36
73
  interface ArchieDevToolProviderProps extends ArchieDevToolsRuntimeOptions {
37
74
  children: ReactNode;
38
75
  }
39
- declare function ArchieDevToolProvider({ children, router, inspector, }: ArchieDevToolProviderProps): react_jsx_runtime.JSX.Element;
76
+ declare function ArchieDevToolProvider({ children, router, inspector, inspectorOptions, }: ArchieDevToolProviderProps): react_jsx_runtime.JSX.Element;
40
77
 
41
78
  export { ArchieDevToolProvider, type ArchieDevToolProviderProps };