@blocksdiy/react-common 1.61.2 → 1.62.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.
@@ -12,6 +12,12 @@ export declare function IframeBridgeProvider({ iframeApi, children }: {
12
12
  iframeApi: IframeApi;
13
13
  children: ReactNode;
14
14
  }): import("react").JSX.Element;
15
+ /**
16
+ * The origins the platform window embedding an app may have: the bare platform domain or an
17
+ * account's host on it (`b-<accountId>` or a custom subdomain). Never files.<domain>: it serves
18
+ * user uploads, which must not drive the app.
19
+ */
20
+ export declare const platformParentOrigin: () => RegExp;
15
21
  /**
16
22
  * Hook for iframe-side code to access the platform's api and connection state.
17
23
  *
@@ -1 +1 @@
1
- {"version":3,"file":"iframe-bridge-provider.d.ts","sourceRoot":"","sources":["../../src/iframe-communication/iframe-bridge-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,mCAAmC,CAAC;AAI3C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAO1G;AAkBD;;;;;;GAMG;AACH,wBAAgB,WAAW;;;;EAI1B"}
1
+ {"version":3,"file":"iframe-bridge-provider.d.ts","sourceRoot":"","sources":["../../src/iframe-communication/iframe-bridge-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,mCAAmC,CAAC;AAI3C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAO1G;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,QAAO,MAC6D,CAAC;AAkBtG;;;;;;GAMG;AACH,wBAAgB,WAAW;;;;EAI1B"}
@@ -14,6 +14,12 @@ import { useBridgeConnection } from "./use-bridge-connection.js";
14
14
  export function IframeBridgeProvider({ iframeApi, children }) {
15
15
  return (_jsxs(BridgeProvider, { children: [_jsx(PlatformConnection, { iframeApi: iframeApi }), children] }));
16
16
  }
17
+ /**
18
+ * The origins the platform window embedding an app may have: the bare platform domain or an
19
+ * account's host on it (`b-<accountId>` or a custom subdomain). Never files.<domain>: it serves
20
+ * user uploads, which must not drive the app.
21
+ */
22
+ export const platformParentOrigin = () => new RegExp(`^${getProtocol()}://((?!files\\.)[a-z0-9-]+\\.)?${getDomain().replace(/\./g, "\\.")}$`);
17
23
  /** Owns the penpal connection to the parent platform window. Renders nothing. */
18
24
  function PlatformConnection({ iframeApi }) {
19
25
  useBridgeConnection({
@@ -22,7 +28,7 @@ function PlatformConnection({ iframeApi }) {
22
28
  methods: iframeApi,
23
29
  createMessenger: () => new WindowMessenger({
24
30
  remoteWindow: window.parent,
25
- allowedOrigins: [new RegExp(`^${getProtocol()}://(b-\\d+\\.)?${getDomain().replace(/\./g, "\\.")}$`)],
31
+ allowedOrigins: [platformParentOrigin()],
26
32
  }),
27
33
  });
28
34
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocksdiy/react-common",
3
- "version": "1.61.2",
3
+ "version": "1.62.0",
4
4
  "type": "module",
5
5
  "description": "React common",
6
6
  "keywords": [],
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@ag-ui/client": "0.0.59",
36
- "@blocksdiy/blocks-client-api": "1.29.0",
36
+ "@blocksdiy/blocks-client-api": "1.30.0",
37
37
  "@copilotkit/react-core": "1.70.2",
38
38
  "@radix-ui/react-slot": "^1.2.3",
39
39
  "@vapi-ai/web": "^2.5.2",