@lumerahq/ui 0.7.0 → 0.7.1

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,9 +1,9 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import React__default, { forwardRef, createElement, useState, useLayoutEffect, useCallback } from "react";
4
- import { b as automationStatuses, n as getAutomationRunFileDownloadUrl, v as listAutomationRunFiles } from "./automations-Cooyxu8b.js";
4
+ import { b as automationStatuses, n as getAutomationRunFileDownloadUrl, v as listAutomationRunFiles } from "./automations-C-qXt1dk.js";
5
5
  import { p as clsx, o as cn, a as formatCellValue } from "./formatters-Baj7FkeG.js";
6
- import { u as useAutomationRun } from "./use-automation-run-BViXpbNQ.js";
6
+ import { u as useAutomationRun } from "./use-automation-run-BJqfJATj.js";
7
7
  import * as ReactDOM from "react-dom";
8
8
  const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
9
9
  const toCamelCase = (string) => string.replace(
@@ -1,4 +1,4 @@
1
- import { p as parentApiRequest, B as BridgeError } from "./automations-Cooyxu8b.js";
1
+ import { p as parentApiRequest, B as BridgeError } from "./automations-C-qXt1dk.js";
2
2
  const API_PREFIX = "/api";
3
3
  const buildUrl = (path) => {
4
4
  const normalized = path.startsWith("/") ? path : `/${path}`;
@@ -1,5 +1,10 @@
1
1
  const DEFAULT_TIMEOUT_MS = 15e3;
2
+ const parseParentOrigins = (value) => (value ?? "").split(",").map((item) => item.trim()).filter(Boolean);
2
3
  const EXPECTED_PARENT_ORIGIN = "https://*.lumerahq.com";
4
+ const EXPECTED_PARENT_ORIGINS = [
5
+ ...parseParentOrigins(void 0),
6
+ EXPECTED_PARENT_ORIGIN
7
+ ].filter(Boolean);
3
8
  class BridgeError extends Error {
4
9
  status;
5
10
  response;
@@ -25,23 +30,28 @@ const generateId = () => {
25
30
  }
26
31
  return `${Date.now()}-${Math.random().toString(16).slice(2)}`;
27
32
  };
28
- const isAllowedOrigin = (origin) => {
29
- if (!origin || !EXPECTED_PARENT_ORIGIN) return false;
30
- if (origin === EXPECTED_PARENT_ORIGIN) return true;
31
- if (origin.startsWith("http://localhost:")) return true;
32
- if (EXPECTED_PARENT_ORIGIN.includes("*")) {
33
- try {
34
- const originUrl = new URL(origin);
35
- const hostnameSuffix = EXPECTED_PARENT_ORIGIN.replace(/^https?:\/\//, "").replace(/^\*\./, "");
36
- const expectedProtocol = EXPECTED_PARENT_ORIGIN.startsWith("https") ? "https:" : "http:";
37
- const hostMatches = originUrl.hostname === hostnameSuffix || originUrl.hostname.endsWith(`.${hostnameSuffix}`);
38
- const protocolMatches = originUrl.protocol === expectedProtocol;
39
- return hostMatches && protocolMatches;
40
- } catch {
41
- return false;
42
- }
33
+ const matchesOriginPattern = (origin, pattern) => {
34
+ if (!origin || !pattern) return false;
35
+ if (origin === pattern) return true;
36
+ if (!pattern.includes("*")) {
37
+ return false;
43
38
  }
44
- return false;
39
+ try {
40
+ const originUrl = new URL(origin);
41
+ const hostnameSuffix = pattern.replace(/^https?:\/\//, "").replace(/^\*\./, "");
42
+ const expectedProtocol = pattern.startsWith("https") ? "https:" : "http:";
43
+ const hostMatches = originUrl.hostname === hostnameSuffix || originUrl.hostname.endsWith(`.${hostnameSuffix}`);
44
+ const protocolMatches = originUrl.protocol === expectedProtocol;
45
+ return hostMatches && protocolMatches;
46
+ } catch {
47
+ return false;
48
+ }
49
+ };
50
+ const isAllowedParentOrigin = (origin, currentOrigin) => {
51
+ if (!origin) return false;
52
+ if (origin === currentOrigin) return true;
53
+ if (origin.startsWith("http://localhost:")) return true;
54
+ return EXPECTED_PARENT_ORIGINS.some((pattern) => matchesOriginPattern(origin, pattern));
45
55
  };
46
56
  const PLAYGROUND_FLAG = "__playground__";
47
57
  const isPlaygroundMode = () => typeof window !== "undefined" && window.self !== window.top && window.name.includes(PLAYGROUND_FLAG);
@@ -95,10 +105,11 @@ const handleMessage = (event) => {
95
105
  if (event.source !== window.parent) {
96
106
  return;
97
107
  }
98
- if (!isAllowedOrigin(event.origin)) {
108
+ if (!isAllowedParentOrigin(event.origin, window.location.origin)) {
99
109
  log("Ignoring message from unexpected origin", {
100
- expected: EXPECTED_PARENT_ORIGIN,
101
- received: event.origin
110
+ expected: EXPECTED_PARENT_ORIGINS,
111
+ received: event.origin,
112
+ current: window.location.origin
102
113
  });
103
114
  return;
104
115
  }
@@ -1,4 +1,4 @@
1
- import { A, a, D, b, c, R } from "../RecordSheet-CMsi-WRF.js";
1
+ import { A, a, D, b, c, R } from "../RecordSheet-Gz6YUndK.js";
2
2
  export {
3
3
  A as AutomationRunList,
4
4
  a as AutomationRunner,
@@ -1,5 +1,5 @@
1
- import { u, a, b, c, d, e } from "../use-sql-table-DTWXek_R.js";
2
- import { u as u2 } from "../use-automation-run-BViXpbNQ.js";
1
+ import { u, a, b, c, d, e } from "../use-sql-table-9L14vGe4.js";
2
+ import { u as u2 } from "../use-automation-run-BJqfJATj.js";
3
3
  export {
4
4
  u as useAutomationAgent,
5
5
  u2 as useAutomationRun,
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A, a, D, b, c, R } from "./RecordSheet-CMsi-WRF.js";
2
- import { u, a as a2, b as b2, c as c2, d, e } from "./use-sql-table-DTWXek_R.js";
3
- import { u as u2 } from "./use-automation-run-BViXpbNQ.js";
4
- import { B, E, b as b3, c as c3, d as d2, e as e2, f, h, j, k, g, l, m, n, q, s, r, t, i, u as u3, v, w, x, y, o, p, z, A as A2, a as a3 } from "./automations-Cooyxu8b.js";
5
- import { g as g2, a as a4, p as p2, b as b4, c as c4, d as d3, e as e3, f as f2, h as h2, i as i2, j as j2, k as k2, l as l2, s as s2, u as u4 } from "./api-B2V4ej-2.js";
1
+ import { A, a, D, b, c, R } from "./RecordSheet-Gz6YUndK.js";
2
+ import { u, a as a2, b as b2, c as c2, d, e } from "./use-sql-table-9L14vGe4.js";
3
+ import { u as u2 } from "./use-automation-run-BJqfJATj.js";
4
+ import { B, E, b as b3, c as c3, d as d2, e as e2, f, h, j, k, g, l, m, n, q, s, r, t, i, u as u3, v, w, x, y, o, p, z, A as A2, a as a3 } from "./automations-C-qXt1dk.js";
5
+ import { g as g2, a as a4, p as p2, b as b4, c as c4, d as d3, e as e3, f as f2, h as h2, i as i2, j as j2, k as k2, l as l2, s as s2, u as u4 } from "./api-DUHGhS3m.js";
6
6
  import { o as o2, f as f3, a as a5, b as b5, c as c5, d as d4, e as e4, g as g3, h as h3, i as i3, j as j3, k as k3, l as l3, m as m2, n as n2, s as s3 } from "./formatters-Baj7FkeG.js";
7
7
  import { q as q2 } from "./query-client-DdOWay4_.js";
8
8
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../src/lib/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,KAC+E,CAAC;AAMnH;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,EAAE;QACR,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,kBAAkB;IAClB,MAAM,EAAE,MAA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CAAC;IACX,iDAAiD;IACjD,EAAE,EAAE,OAAO,CAAC;IACZ,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc;CAMxE;AAYD;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,SAAS,CAE5D;AAmSD;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,QAAO,OAAsE,CAAC;AAErG;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,QAAO,IAiEnC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAgB/F,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,GAAU,SAAS,aAAa,KAAG,OAAO,CAAC,cAAc,CA6CrF,CAAC"}
package/dist/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { B, E, b, c, d, e, f, h, j, k, g, l, m, n, q, s, r, t, i, u, v, w, x, y, o, p, z, A, a } from "../automations-Cooyxu8b.js";
2
- import { g as g2, a as a2, p as p2, b as b2, c as c2, d as d2, e as e2, f as f2, h as h2, i as i2, j as j2, k as k2, l as l2, s as s2, u as u2 } from "../api-B2V4ej-2.js";
1
+ import { B, E, b, c, d, e, f, h, j, k, g, l, m, n, q, s, r, t, i, u, v, w, x, y, o, p, z, A, a } from "../automations-C-qXt1dk.js";
2
+ import { g as g2, a as a2, p as p2, b as b2, c as c2, d as d2, e as e2, f as f2, h as h2, i as i2, j as j2, k as k2, l as l2, s as s2, u as u2 } from "../api-DUHGhS3m.js";
3
3
  import { o as o2, f as f3, a as a3, b as b3, c as c3, d as d3, e as e3, g as g3, h as h3, i as i3, j as j3, k as k3, l as l3, m as m2, n as n2, s as s3 } from "../formatters-Baj7FkeG.js";
4
4
  import { q as q2 } from "../query-client-DdOWay4_.js";
5
5
  export {
@@ -1,6 +1,6 @@
1
1
  import { useQueryClient, useMutation, useQuery } from "@tanstack/react-query";
2
2
  import { useState, useRef, useEffect, useCallback } from "react";
3
- import { j as ensureAutomationRun, f as createAutomationRun, c as cancelAutomationRun, b as automationStatuses, m as getAutomationRun } from "./automations-Cooyxu8b.js";
3
+ import { j as ensureAutomationRun, f as createAutomationRun, c as cancelAutomationRun, b as automationStatuses, m as getAutomationRun } from "./automations-C-qXt1dk.js";
4
4
  function useAutomationRun(options) {
5
5
  const {
6
6
  agentId,
@@ -1,7 +1,7 @@
1
1
  import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query";
2
2
  import { useState, useCallback, useEffect, useMemo } from "react";
3
- import { x as listRunsByAgent, b as automationStatuses, f as createAutomationRun, o as onInitMessage } from "./automations-Cooyxu8b.js";
4
- import { u as uploadFile, i as pbSql, k as pbUpdateRecord } from "./api-B2V4ej-2.js";
3
+ import { x as listRunsByAgent, b as automationStatuses, f as createAutomationRun, o as onInitMessage } from "./automations-C-qXt1dk.js";
4
+ import { u as uploadFile, i as pbSql, k as pbUpdateRecord } from "./api-DUHGhS3m.js";
5
5
  function useAutomationAgent({
6
6
  agentId,
7
7
  limit = 5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumerahq/ui",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "*.css"