@superleapai/flow-ui 2.2.10 → 2.3.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.
package/README.md CHANGED
@@ -503,7 +503,7 @@ FlowUI.createSummaryRow(label, value)
503
503
  #### Alerts
504
504
 
505
505
  ```javascript
506
- FlowUI.renderAlerts(container, messages, type)
506
+ FlowUI.showToast(message, type)
507
507
  // type: error, info, success
508
508
  ```
509
509
 
@@ -175,7 +175,7 @@
175
175
  variant = "outline";
176
176
  }
177
177
  var btnClassName = join(
178
- "!text-reg-12 my-2 flex-1 !px-0 !py-0",
178
+ "!text-reg-12 my-2 flex-1",
179
179
  cell.currentMonth ? "" : "text-typography-quaternary-text"
180
180
  );
181
181
  var btn = Button.create({
@@ -221,15 +221,13 @@
221
221
  e.stopPropagation();
222
222
  navigator.clipboard.writeText(fileUrl).then(
223
223
  function () {
224
- if (global.FlowUI && global.FlowUI.renderAlerts) {
225
- const ac = document.getElementById("alerts");
226
- if (ac) global.FlowUI.renderAlerts(ac, ["Link copied"], "success");
224
+ if (global.FlowUI && global.FlowUI.showToast) {
225
+ global.FlowUI.showToast("Link copied", "success");
227
226
  }
228
227
  },
229
228
  function () {
230
- if (global.FlowUI && global.FlowUI.renderAlerts) {
231
- const ac = document.getElementById("alerts");
232
- if (ac) global.FlowUI.renderAlerts(ac, ["Copy failed"], "error");
229
+ if (global.FlowUI && global.FlowUI.showToast) {
230
+ global.FlowUI.showToast("Copy failed", "error");
233
231
  }
234
232
  }
235
233
  );
@@ -425,11 +423,8 @@
425
423
  async function uploadFile(file) {
426
424
  const error = validateFile(file);
427
425
  if (error) {
428
- if (global.FlowUI && global.FlowUI.renderAlerts) {
429
- const alertsContainer = document.getElementById("alerts");
430
- if (alertsContainer) {
431
- global.FlowUI.renderAlerts(alertsContainer, [error], "error");
432
- }
426
+ if (global.FlowUI && global.FlowUI.showToast) {
427
+ global.FlowUI.showToast(error, "error");
433
428
  }
434
429
  return;
435
430
  }
@@ -457,15 +452,8 @@
457
452
  uploadingFiles = uploadingFiles.filter((f) => f.file !== file);
458
453
  renderUploadingList();
459
454
  updateStatus();
460
- if (global.FlowUI && global.FlowUI.renderAlerts) {
461
- const alertsContainer = document.getElementById("alerts");
462
- if (alertsContainer) {
463
- global.FlowUI.renderAlerts(
464
- alertsContainer,
465
- [`Failed to upload "${file.name}": ${error.message}`],
466
- "error"
467
- );
468
- }
455
+ if (global.FlowUI && global.FlowUI.showToast) {
456
+ global.FlowUI.showToast(`Failed to upload "${file.name}": ${error.message}`, "error");
469
457
  }
470
458
  }
471
459
  }
@@ -478,11 +466,8 @@
478
466
  // Check max files limit
479
467
  if (multiple && maxFiles && uploadedFiles.length + files.length > maxFiles) {
480
468
  const message = `You can only upload ${maxFiles} file${maxFiles !== 1 ? "s" : ""}`;
481
- if (global.FlowUI && global.FlowUI.renderAlerts) {
482
- const alertsContainer = document.getElementById("alerts");
483
- if (alertsContainer) {
484
- global.FlowUI.renderAlerts(alertsContainer, [message], "error");
485
- }
469
+ if (global.FlowUI && global.FlowUI.showToast) {
470
+ global.FlowUI.showToast(message, "error");
486
471
  }
487
472
  input.value = "";
488
473
  return;
package/core/crm.js CHANGED
@@ -237,12 +237,13 @@
237
237
 
238
238
  /**
239
239
  * Tell the CRM to navigate to a path.
240
- * @param {string} path
240
+ * @param {string} url
241
+ * @param {boolean} [newTab=false]
241
242
  */
242
- function navigate(path) {
243
+ function navigate(url, newTab) {
243
244
  var bridge = getBridge();
244
245
  if (bridge && bridge.isConnected()) {
245
- bridge.send("crm:navigate", { path: path });
246
+ bridge.send("crm:navigate", { url: url, new_tab: !!newTab });
246
247
  }
247
248
  }
248
249
 
package/core/flow.js CHANGED
@@ -1332,42 +1332,6 @@
1332
1332
  });
1333
1333
  }
1334
1334
 
1335
- // ============================================================================
1336
- // ALERT COMPONENT
1337
- // ============================================================================
1338
-
1339
- /**
1340
- * Render alerts/errors
1341
- * Uses Alert component when available for design-system styling.
1342
- * @param {HTMLElement} container - Container element for alerts
1343
- * @param {Array} messages - Array of error/info messages (strings) or { title?, description } objects
1344
- * @param {string} type - Alert type: "error" | "info" | "success" | "warning" | "destructive" | "default"
1345
- */
1346
- function renderAlerts(container, messages = [], type = "error") {
1347
- if (!container) {return;}
1348
- container.innerHTML = "";
1349
-
1350
- const Alert = getComponent("Alert");
1351
- const useAlertComponent = Alert && typeof Alert.create === "function";
1352
-
1353
- messages.forEach((msg) => {
1354
- const description = typeof msg === "string" ? msg : (msg.description || msg.title || "");
1355
- const title = typeof msg === "object" && msg.title ? msg.title : "";
1356
-
1357
- if (useAlertComponent && (description || title)) {
1358
- const variantMap = { error: "error", info: "info", success: "success" };
1359
- const variant = variantMap[type] || type;
1360
- const alertEl = Alert.create({ title, description, variant });
1361
- if (alertEl) container.appendChild(alertEl);
1362
- } else {
1363
- const div = document.createElement("div");
1364
- div.className = `alert alert--${type}`;
1365
- div.textContent = description || title;
1366
- container.appendChild(div);
1367
- }
1368
- });
1369
- }
1370
-
1371
1335
  // ============================================================================
1372
1336
  // TABLE COMPONENT
1373
1337
  // ============================================================================
@@ -1702,9 +1666,8 @@
1702
1666
  // Stepper
1703
1667
  renderStepper,
1704
1668
 
1705
- // Alerts (now shows toast notifications)
1669
+ // Alerts
1706
1670
  showToast,
1707
- renderAlerts, // Legacy support for static alerts
1708
1671
 
1709
1672
  // Table
1710
1673
  createDataTable,