@secmia/openui-flow 4.2.5 → 4.2.8

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/dist/index.mjs CHANGED
@@ -565,6 +565,7 @@ function useAdaptiveFlow({
565
565
  return {
566
566
  ...state,
567
567
  step: action.step,
568
+ hasEvaluated: true,
568
569
  missingRequirements: action.missingRequirements,
569
570
  transitions: [...state.transitions, action.transition].slice(-100)
570
571
  };
@@ -589,6 +590,7 @@ function useAdaptiveFlow({
589
590
  const [context, setContext] = React.useState(() => withDefaults(initialValue));
590
591
  const [runtime, dispatch] = React.useReducer(runtimeReducer, {
591
592
  step: normalizedCompleteStep,
593
+ hasEvaluated: false,
592
594
  missingRequirements: [],
593
595
  transitions: [],
594
596
  busy: false,
@@ -600,6 +602,7 @@ function useAdaptiveFlow({
600
602
  });
601
603
  const {
602
604
  step,
605
+ hasEvaluated,
603
606
  missingRequirements,
604
607
  transitions,
605
608
  busy,
@@ -883,6 +886,7 @@ function useAdaptiveFlow({
883
886
  return {
884
887
  context,
885
888
  step,
889
+ hasEvaluated,
886
890
  completeStep: normalizedCompleteStep,
887
891
  requirements: normalizedRequirements,
888
892
  missingRequirements,
@@ -929,6 +933,7 @@ function AdaptiveFlow({
929
933
  const {
930
934
  context,
931
935
  step,
936
+ hasEvaluated,
932
937
  completeStep: normalizedCompleteStep,
933
938
  requirements: normalizedRequirements,
934
939
  missingRequirements: missing,
@@ -966,9 +971,11 @@ function AdaptiveFlow({
966
971
  () => oauthProviders && oauthProviders.length > 0 ? oauthProviders : defaultOAuthProviders,
967
972
  [oauthProviders]
968
973
  );
974
+ const completedCount = hasEvaluated ? normalizedRequirements.length - missing.length : 0;
969
975
  const needsJobTitle = normalizedRequirements.includes("has_job_title");
970
- const stepLabel = stepTitles?.[step] ?? defaultStepTitle[step] ?? step;
976
+ const stepLabel = hasEvaluated ? stepTitles?.[step] ?? defaultStepTitle[step] ?? step : "Loading flow";
971
977
  const defaultView = /* @__PURE__ */ jsxs(Fragment, { children: [
978
+ !hasEvaluated ? /* @__PURE__ */ jsx("div", { className: classNames?.info, style: uiStyles.info, children: "Evaluating required steps..." }) : null,
972
979
  step === "COLLECT_EMAIL" ? /* @__PURE__ */ jsx(
973
980
  EmailBlock,
974
981
  {
@@ -1066,7 +1073,7 @@ function AdaptiveFlow({
1066
1073
  /* @__PURE__ */ jsx("h2", { className: classNames?.title, style: uiStyles.title, children: stepLabel })
1067
1074
  ] }),
1068
1075
  /* @__PURE__ */ jsxs("div", { className: classNames?.badge, style: uiStyles.badge, children: [
1069
- normalizedRequirements.length - missing.length,
1076
+ completedCount,
1070
1077
  "/",
1071
1078
  normalizedRequirements.length
1072
1079
  ] })
@@ -1378,10 +1385,11 @@ var defaultStyles = {
1378
1385
  gap: 12,
1379
1386
  width: "100%",
1380
1387
  maxWidth: 560,
1381
- border: "1px solid #e5e7eb",
1388
+ border: "1px solid #cbd5e1",
1382
1389
  borderRadius: 14,
1383
1390
  padding: 16,
1384
- background: "#ffffff",
1391
+ background: "#f8fafc",
1392
+ color: "#0f172a",
1385
1393
  fontFamily: "system-ui, -apple-system, Segoe UI, Roboto, sans-serif"
1386
1394
  },
1387
1395
  headerRow: {
@@ -1394,7 +1402,7 @@ var defaultStyles = {
1394
1402
  fontSize: 12,
1395
1403
  textTransform: "uppercase",
1396
1404
  letterSpacing: 1.2,
1397
- color: "#6b7280",
1405
+ color: "#475569",
1398
1406
  marginBottom: 4
1399
1407
  },
1400
1408
  title: {
@@ -1403,12 +1411,13 @@ var defaultStyles = {
1403
1411
  lineHeight: "28px"
1404
1412
  },
1405
1413
  badge: {
1406
- border: "1px solid #d1d5db",
1414
+ border: "1px solid #cbd5e1",
1407
1415
  borderRadius: 999,
1408
1416
  padding: "4px 10px",
1409
1417
  fontSize: 12,
1410
1418
  fontWeight: 600,
1411
- color: "#374151"
1419
+ color: "#1e293b",
1420
+ background: "#ffffff"
1412
1421
  },
1413
1422
  success: {
1414
1423
  border: "1px solid #bbf7d0",
@@ -1436,7 +1445,7 @@ var defaultStyles = {
1436
1445
  },
1437
1446
  caption: {
1438
1447
  margin: 0,
1439
- color: "#4b5563",
1448
+ color: "#334155",
1440
1449
  fontSize: 14
1441
1450
  },
1442
1451
  formRow: {
@@ -1451,19 +1460,22 @@ var defaultStyles = {
1451
1460
  },
1452
1461
  input: {
1453
1462
  width: "100%",
1454
- border: "1px solid #d1d5db",
1463
+ border: "1px solid #94a3b8",
1455
1464
  borderRadius: 8,
1456
1465
  height: 40,
1457
1466
  padding: "0 12px",
1458
- fontSize: 14
1467
+ fontSize: 14,
1468
+ background: "#ffffff",
1469
+ color: "#0f172a"
1459
1470
  },
1460
1471
  button: {
1461
- border: "1px solid #d1d5db",
1472
+ border: "1px solid #94a3b8",
1462
1473
  borderRadius: 8,
1463
1474
  height: 40,
1464
1475
  padding: "0 14px",
1465
1476
  fontWeight: 600,
1466
1477
  background: "#ffffff",
1478
+ color: "#0f172a",
1467
1479
  whiteSpace: "nowrap",
1468
1480
  cursor: "pointer"
1469
1481
  },
@@ -1488,10 +1500,11 @@ var defaultStyles = {
1488
1500
  },
1489
1501
  oauthButton: {
1490
1502
  flex: 1,
1491
- border: "1px solid #d1d5db",
1503
+ border: "1px solid #94a3b8",
1492
1504
  borderRadius: 8,
1493
1505
  padding: "10px 12px",
1494
- background: "#f9fafb",
1506
+ background: "#ffffff",
1507
+ color: "#0f172a",
1495
1508
  cursor: "pointer"
1496
1509
  }
1497
1510
  };