@lumerahq/ui 0.7.3 → 0.7.4

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 { c as automationStatuses, q as getAutomationRunFileDownloadUrl, w as listAutomationRunFiles } from "./automations-NGijzdAj.js";
4
+ import { c as automationStatuses, q as getAutomationRunFileDownloadUrl, w as listAutomationRunFiles } from "./automations-BS2Ot6Vw.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-CSxc9EhA.js";
6
+ import { u as useAutomationRun } from "./use-automation-run-AieycPD9.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-NGijzdAj.js";
1
+ import { p as parentApiRequest, B as BridgeError } from "./automations-BS2Ot6Vw.js";
2
2
  const API_PREFIX = "/api";
3
3
  const buildUrl = (path) => {
4
4
  const normalized = path.startsWith("/") ? path : `/${path}`;
@@ -1,10 +1,18 @@
1
1
  const DEFAULT_TIMEOUT_MS = 15e3;
2
2
  const parseParentOrigins = (value) => (value ?? "").split(",").map((item) => item.trim()).filter(Boolean);
3
+ const uniqueStrings = (values) => {
4
+ const seen = /* @__PURE__ */ new Set();
5
+ return values.filter((value) => {
6
+ if (!value || seen.has(value)) return false;
7
+ seen.add(value);
8
+ return true;
9
+ });
10
+ };
3
11
  const EXPECTED_PARENT_ORIGIN = "https://*.lumerahq.com";
4
- const EXPECTED_PARENT_ORIGINS = [
12
+ const EXPECTED_PARENT_ORIGINS = uniqueStrings([
5
13
  ...parseParentOrigins(void 0),
6
14
  EXPECTED_PARENT_ORIGIN
7
- ].filter(Boolean);
15
+ ]);
8
16
  class BridgeError extends Error {
9
17
  status;
10
18
  response;
@@ -23,6 +31,7 @@ let storedHostPayload;
23
31
  let storedHostOrigin;
24
32
  let suppressRouteBroadcast = false;
25
33
  let lastBroadcastRoute = "";
34
+ let hasStoredHostPayload = false;
26
35
  function getAppProjectExternalId() {
27
36
  return storedHostPayload?.app?.projectExternalId;
28
37
  }
@@ -80,6 +89,13 @@ function getShareableAppUrl(options) {
80
89
  }
81
90
  const log = (...args) => {
82
91
  };
92
+ const cacheHostPayload = (payload, options) => {
93
+ storedHostPayload = payload;
94
+ if (options?.origin) {
95
+ storedHostOrigin = options.origin;
96
+ }
97
+ hasStoredHostPayload = true;
98
+ };
83
99
  const generateId = () => {
84
100
  if (typeof crypto !== "undefined" && crypto.randomUUID) {
85
101
  return crypto.randomUUID();
@@ -244,9 +260,6 @@ const ensureRouteSync = () => {
244
260
  });
245
261
  };
246
262
  const handleMessage = (event) => {
247
- if (event.source !== window.parent) {
248
- return;
249
- }
250
263
  if (!isAllowedParentOrigin(event.origin, window.location.origin)) {
251
264
  log("Ignoring message from unexpected origin", {
252
265
  expected: EXPECTED_PARENT_ORIGINS,
@@ -255,10 +268,12 @@ const handleMessage = (event) => {
255
268
  });
256
269
  return;
257
270
  }
271
+ if (event.source && event.source !== window.parent) ;
258
272
  const { type, payload } = event.data ?? {};
259
273
  if (type === "init") {
260
- storedHostOrigin = event.origin;
261
- storedHostPayload = payload;
274
+ cacheHostPayload(payload, {
275
+ origin: event.origin
276
+ });
262
277
  initListeners.forEach((listener) => listener(payload));
263
278
  return;
264
279
  }
@@ -313,16 +328,19 @@ const postReadyMessage = () => {
313
328
  message: "Playground mode"
314
329
  };
315
330
  log("Playground mode: init from VB", payload);
316
- storedHostPayload = payload;
331
+ cacheHostPayload(payload);
317
332
  setTimeout(() => initListeners.forEach((listener) => listener(payload)), 0);
318
333
  } else {
319
334
  log("Playground mode: /api/me returned no user, continuing");
335
+ cacheHostPayload(void 0);
320
336
  setTimeout(() => initListeners.forEach((listener) => listener(void 0)), 0);
321
337
  }
322
338
  } catch (err) {
339
+ cacheHostPayload(void 0);
323
340
  setTimeout(() => initListeners.forEach((listener) => listener(void 0)), 0);
324
341
  }
325
342
  } else {
343
+ cacheHostPayload(void 0);
326
344
  setTimeout(() => initListeners.forEach((listener) => listener(void 0)), 0);
327
345
  }
328
346
  return;
@@ -334,7 +352,7 @@ const postReadyMessage = () => {
334
352
  const onInitMessage = (listener) => {
335
353
  ensureListener();
336
354
  initListeners.add(listener);
337
- if (isPlaygroundMode() && storedHostPayload) {
355
+ if (hasStoredHostPayload) {
338
356
  setTimeout(() => listener(storedHostPayload), 0);
339
357
  }
340
358
  return () => initListeners.delete(listener);
@@ -1,4 +1,4 @@
1
- import { A, a, D, b, c, R } from "../RecordSheet-DJL4aph1.js";
1
+ import { A, a, D, b, c, R } from "../RecordSheet-RdrsJW-k.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-CEBrg3zE.js";
2
- import { u as u2 } from "../use-automation-run-CSxc9EhA.js";
1
+ import { u, a, b, c, d, e } from "../use-sql-table-CQPrB7SP.js";
2
+ import { u as u2 } from "../use-automation-run-AieycPD9.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-DJL4aph1.js";
2
- import { u, a as a2, b as b2, c as c2, d, e } from "./use-sql-table-CEBrg3zE.js";
3
- import { u as u2 } from "./use-automation-run-CSxc9EhA.js";
4
- import { B, E, c as c3, d as d2, e as e2, f, h, j, k, l, g, m, n, q, r, t, s, a as a3, u as u3, i, v, w, x, y, z, o, p, A as A2, C, b as b3 } from "./automations-NGijzdAj.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-BIZPZp2T.js";
1
+ import { A, a, D, b, c, R } from "./RecordSheet-RdrsJW-k.js";
2
+ import { u, a as a2, b as b2, c as c2, d, e } from "./use-sql-table-CQPrB7SP.js";
3
+ import { u as u2 } from "./use-automation-run-AieycPD9.js";
4
+ import { B, E, c as c3, d as d2, e as e2, f, h, j, k, l, g, m, n, q, r, t, s, a as a3, u as u3, i, v, w, x, y, z, o, p, A as A2, C, b as b3 } from "./automations-BS2Ot6Vw.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-IxGsOnrw.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;AAkBH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,KAC+E,CAAC;AAWnH;;;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,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,eAAO,MAAM,gBAAgB,QAAO,IA2EnC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAkB/F,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,GAAU,SAAS,aAAa,KAAG,OAAO,CAAC,cAAc,CAgDrF,CAAC"}
package/dist/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { B, E, c, d, e, f, h, j, k, l, g, m, n, q, r, t, s, a, u, i, v, w, x, y, z, o, p, A, C, b } from "../automations-NGijzdAj.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-BIZPZp2T.js";
1
+ import { B, E, c, d, e, f, h, j, k, l, g, m, n, q, r, t, s, a, u, i, v, w, x, y, z, o, p, A, C, b } from "../automations-BS2Ot6Vw.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-IxGsOnrw.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 { k as ensureAutomationRun, h as createAutomationRun, d as cancelAutomationRun, c as automationStatuses, n as getAutomationRun } from "./automations-NGijzdAj.js";
3
+ import { k as ensureAutomationRun, h as createAutomationRun, d as cancelAutomationRun, c as automationStatuses, n as getAutomationRun } from "./automations-BS2Ot6Vw.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 { y as listRunsByAgent, c as automationStatuses, h as createAutomationRun, o as onInitMessage } from "./automations-NGijzdAj.js";
4
- import { u as uploadFile, i as pbSql, k as pbUpdateRecord } from "./api-BIZPZp2T.js";
3
+ import { y as listRunsByAgent, c as automationStatuses, h as createAutomationRun, o as onInitMessage } from "./automations-BS2Ot6Vw.js";
4
+ import { u as uploadFile, i as pbSql, k as pbUpdateRecord } from "./api-IxGsOnrw.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.3",
3
+ "version": "0.7.4",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "*.css"