@lotics/app-sdk 0.134.2 → 0.134.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.
@@ -1263,7 +1263,10 @@ var AGGREGATE_COUNT_COLUMN = "__count";
1263
1263
  var AGGREGATE_SUM_COLUMN = "__sum";
1264
1264
  var AGGREGATE_AVG_COLUMN = "__avg";
1265
1265
  var AGGREGATE_DAY_COLUMN = "__day";
1266
- function dayOf(cell) {
1266
+ var AGGREGATE_MAX_COLUMN = "__max";
1267
+ var AGGREGATE_MIN_COLUMN = "__min";
1268
+ function dayOf(cell, hour) {
1269
+ if (hour) return typeof cell === "string" && cell.length >= 13 ? `${cell.slice(0, 10)}T${cell.slice(11, 13)}:00` : null;
1267
1270
  return typeof cell === "string" && cell !== "" ? cell.slice(0, 10) : null;
1268
1271
  }
1269
1272
  function aggregateRows(rows, aggregate) {
@@ -1271,6 +1274,10 @@ function aggregateRows(rows, aggregate) {
1271
1274
  const day = aggregate.day;
1272
1275
  const sum = aggregate.sum;
1273
1276
  const avg = aggregate.avg;
1277
+ const extremes = (column, members, pick) => {
1278
+ const held = column === void 0 ? [] : members.flatMap((member) => typeof member[column] === "number" ? [member[column]] : []);
1279
+ return held.length === 0 ? null : held.reduce((a, b) => pick(a, b));
1280
+ };
1274
1281
  const keyOf = (row, column) => {
1275
1282
  const tiers = aggregate.bands?.[column];
1276
1283
  const cell = row[column] ?? null;
@@ -1280,7 +1287,7 @@ function aggregateRows(rows, aggregate) {
1280
1287
  const keyed = /* @__PURE__ */ new Map();
1281
1288
  for (const row of rows) {
1282
1289
  const keys = by.map((column) => keyOf(row, column));
1283
- const key = JSON.stringify([...keys, ...day === void 0 ? [] : [dayOf(row[day])]]);
1290
+ const key = JSON.stringify([...keys, ...day === void 0 ? [] : [dayOf(row[day], aggregate.hour === true)]]);
1284
1291
  keyed.set(key, { keys, members: [...keyed.get(key)?.members ?? [], row] });
1285
1292
  }
1286
1293
  return [...keyed.values()].map(({ keys, members }) => {
@@ -1293,10 +1300,12 @@ function aggregateRows(rows, aggregate) {
1293
1300
  return {
1294
1301
  [RECORD_ID_COLUMN]: null,
1295
1302
  ...Object.fromEntries(by.map((column, at) => [column, keys[at] ?? null])),
1296
- ...day === void 0 ? {} : { [AGGREGATE_DAY_COLUMN]: dayOf(first2?.[day]) },
1303
+ ...day === void 0 ? {} : { [AGGREGATE_DAY_COLUMN]: dayOf(first2?.[day], aggregate.hour === true) },
1297
1304
  [AGGREGATE_COUNT_COLUMN]: members.length,
1298
1305
  ...sum === void 0 ? {} : { [AGGREGATE_SUM_COLUMN]: figures.length === 0 ? null : sumDecimal(figures) },
1299
- ...avg === void 0 ? {} : { [AGGREGATE_AVG_COLUMN]: averaged.length === 0 ? null : divideDecimal(sumDecimal(averaged), averaged.length) }
1306
+ ...avg === void 0 ? {} : { [AGGREGATE_AVG_COLUMN]: averaged.length === 0 ? null : divideDecimal(sumDecimal(averaged), averaged.length) },
1307
+ ...aggregate.max === void 0 ? {} : { [AGGREGATE_MAX_COLUMN]: extremes(aggregate.max, members, Math.max) },
1308
+ ...aggregate.min === void 0 ? {} : { [AGGREGATE_MIN_COLUMN]: extremes(aggregate.min, members, Math.min) }
1300
1309
  };
1301
1310
  });
1302
1311
  }
@@ -1554,6 +1563,15 @@ var urlStateSubscribers = /* @__PURE__ */ new Set();
1554
1563
  var refetchSubscribers = /* @__PURE__ */ new Set();
1555
1564
  var nextRpcId = 0;
1556
1565
  var listenerInstalled = false;
1566
+ function replayOutsidePress() {
1567
+ const press = { bubbles: true, composed: true, cancelable: true, button: 0, pointerType: "mouse" };
1568
+ const root = document.documentElement;
1569
+ root.dispatchEvent(new PointerEvent("pointerdown", { ...press, isPrimary: true }));
1570
+ root.dispatchEvent(new MouseEvent("mousedown", press));
1571
+ root.dispatchEvent(new PointerEvent("pointerup", { ...press, isPrimary: true }));
1572
+ root.dispatchEvent(new MouseEvent("mouseup", press));
1573
+ root.dispatchEvent(new MouseEvent("click", press));
1574
+ }
1557
1575
  function ensureListener() {
1558
1576
  if (listenerInstalled) return;
1559
1577
  listenerInstalled = true;
@@ -1570,6 +1588,10 @@ function ensureListener() {
1570
1588
  for (const cb of openSubscribers) cb();
1571
1589
  return;
1572
1590
  }
1591
+ if (msg.type === "pressed-outside") {
1592
+ replayOutsidePress();
1593
+ return;
1594
+ }
1573
1595
  if (msg.type === "queriesChanged" && Array.isArray(msg.aliases)) {
1574
1596
  queriesChanged(
1575
1597
  msg.aliases.filter((a) => typeof a === "string"),
@@ -2038,6 +2060,7 @@ function rpcStandalone(op, payload) {
2038
2060
  case "comments.update":
2039
2061
  case "comments.delete":
2040
2062
  case "comments.counts":
2063
+ case "history":
2041
2064
  return rejectCommentsStandalone();
2042
2065
  case "outsideLink.list":
2043
2066
  case "outsideLink.create":
@@ -2073,7 +2096,7 @@ async function standaloneFolderSet(payload) {
2073
2096
  }
2074
2097
  function rejectCommentsStandalone() {
2075
2098
  return Promise.reject(
2076
- new Error("Comments are available only in embedded apps \u2014 a signed-in member is required.")
2099
+ new Error("Comments and a record's history are available only in embedded apps \u2014 a signed-in member is required.")
2077
2100
  );
2078
2101
  }
2079
2102
  async function standaloneMembers(p) {