@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.d.mts CHANGED
@@ -286,6 +286,7 @@ type UseAdaptiveFlowOptions<TContext extends AdaptiveContextBase = AdaptiveConte
286
286
  type UseAdaptiveFlowResult<TContext extends AdaptiveContextBase, TRequirement extends string, TStep extends string> = {
287
287
  context: TContext;
288
288
  step: TStep;
289
+ hasEvaluated: boolean;
289
290
  completeStep: TStep;
290
291
  requirements: readonly TRequirement[];
291
292
  missingRequirements: TRequirement[];
package/dist/index.d.ts CHANGED
@@ -286,6 +286,7 @@ type UseAdaptiveFlowOptions<TContext extends AdaptiveContextBase = AdaptiveConte
286
286
  type UseAdaptiveFlowResult<TContext extends AdaptiveContextBase, TRequirement extends string, TStep extends string> = {
287
287
  context: TContext;
288
288
  step: TStep;
289
+ hasEvaluated: boolean;
289
290
  completeStep: TStep;
290
291
  requirements: readonly TRequirement[];
291
292
  missingRequirements: TRequirement[];
package/dist/index.js CHANGED
@@ -610,6 +610,7 @@ function useAdaptiveFlow({
610
610
  return {
611
611
  ...state,
612
612
  step: action.step,
613
+ hasEvaluated: true,
613
614
  missingRequirements: action.missingRequirements,
614
615
  transitions: [...state.transitions, action.transition].slice(-100)
615
616
  };
@@ -634,6 +635,7 @@ function useAdaptiveFlow({
634
635
  const [context, setContext] = React.useState(() => withDefaults(initialValue));
635
636
  const [runtime, dispatch] = React.useReducer(runtimeReducer, {
636
637
  step: normalizedCompleteStep,
638
+ hasEvaluated: false,
637
639
  missingRequirements: [],
638
640
  transitions: [],
639
641
  busy: false,
@@ -645,6 +647,7 @@ function useAdaptiveFlow({
645
647
  });
646
648
  const {
647
649
  step,
650
+ hasEvaluated,
648
651
  missingRequirements,
649
652
  transitions,
650
653
  busy,
@@ -928,6 +931,7 @@ function useAdaptiveFlow({
928
931
  return {
929
932
  context,
930
933
  step,
934
+ hasEvaluated,
931
935
  completeStep: normalizedCompleteStep,
932
936
  requirements: normalizedRequirements,
933
937
  missingRequirements,
@@ -974,6 +978,7 @@ function AdaptiveFlow({
974
978
  const {
975
979
  context,
976
980
  step,
981
+ hasEvaluated,
977
982
  completeStep: normalizedCompleteStep,
978
983
  requirements: normalizedRequirements,
979
984
  missingRequirements: missing,
@@ -1011,9 +1016,11 @@ function AdaptiveFlow({
1011
1016
  () => oauthProviders && oauthProviders.length > 0 ? oauthProviders : defaultOAuthProviders,
1012
1017
  [oauthProviders]
1013
1018
  );
1019
+ const completedCount = hasEvaluated ? normalizedRequirements.length - missing.length : 0;
1014
1020
  const needsJobTitle = normalizedRequirements.includes("has_job_title");
1015
- const stepLabel = stepTitles?.[step] ?? defaultStepTitle[step] ?? step;
1021
+ const stepLabel = hasEvaluated ? stepTitles?.[step] ?? defaultStepTitle[step] ?? step : "Loading flow";
1016
1022
  const defaultView = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1023
+ !hasEvaluated ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: classNames?.info, style: uiStyles.info, children: "Evaluating required steps..." }) : null,
1017
1024
  step === "COLLECT_EMAIL" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1018
1025
  EmailBlock,
1019
1026
  {
@@ -1111,7 +1118,7 @@ function AdaptiveFlow({
1111
1118
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: classNames?.title, style: uiStyles.title, children: stepLabel })
1112
1119
  ] }),
1113
1120
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: classNames?.badge, style: uiStyles.badge, children: [
1114
- normalizedRequirements.length - missing.length,
1121
+ completedCount,
1115
1122
  "/",
1116
1123
  normalizedRequirements.length
1117
1124
  ] })
@@ -1423,10 +1430,11 @@ var defaultStyles = {
1423
1430
  gap: 12,
1424
1431
  width: "100%",
1425
1432
  maxWidth: 560,
1426
- border: "1px solid #e5e7eb",
1433
+ border: "1px solid #cbd5e1",
1427
1434
  borderRadius: 14,
1428
1435
  padding: 16,
1429
- background: "#ffffff",
1436
+ background: "#f8fafc",
1437
+ color: "#0f172a",
1430
1438
  fontFamily: "system-ui, -apple-system, Segoe UI, Roboto, sans-serif"
1431
1439
  },
1432
1440
  headerRow: {
@@ -1439,7 +1447,7 @@ var defaultStyles = {
1439
1447
  fontSize: 12,
1440
1448
  textTransform: "uppercase",
1441
1449
  letterSpacing: 1.2,
1442
- color: "#6b7280",
1450
+ color: "#475569",
1443
1451
  marginBottom: 4
1444
1452
  },
1445
1453
  title: {
@@ -1448,12 +1456,13 @@ var defaultStyles = {
1448
1456
  lineHeight: "28px"
1449
1457
  },
1450
1458
  badge: {
1451
- border: "1px solid #d1d5db",
1459
+ border: "1px solid #cbd5e1",
1452
1460
  borderRadius: 999,
1453
1461
  padding: "4px 10px",
1454
1462
  fontSize: 12,
1455
1463
  fontWeight: 600,
1456
- color: "#374151"
1464
+ color: "#1e293b",
1465
+ background: "#ffffff"
1457
1466
  },
1458
1467
  success: {
1459
1468
  border: "1px solid #bbf7d0",
@@ -1481,7 +1490,7 @@ var defaultStyles = {
1481
1490
  },
1482
1491
  caption: {
1483
1492
  margin: 0,
1484
- color: "#4b5563",
1493
+ color: "#334155",
1485
1494
  fontSize: 14
1486
1495
  },
1487
1496
  formRow: {
@@ -1496,19 +1505,22 @@ var defaultStyles = {
1496
1505
  },
1497
1506
  input: {
1498
1507
  width: "100%",
1499
- border: "1px solid #d1d5db",
1508
+ border: "1px solid #94a3b8",
1500
1509
  borderRadius: 8,
1501
1510
  height: 40,
1502
1511
  padding: "0 12px",
1503
- fontSize: 14
1512
+ fontSize: 14,
1513
+ background: "#ffffff",
1514
+ color: "#0f172a"
1504
1515
  },
1505
1516
  button: {
1506
- border: "1px solid #d1d5db",
1517
+ border: "1px solid #94a3b8",
1507
1518
  borderRadius: 8,
1508
1519
  height: 40,
1509
1520
  padding: "0 14px",
1510
1521
  fontWeight: 600,
1511
1522
  background: "#ffffff",
1523
+ color: "#0f172a",
1512
1524
  whiteSpace: "nowrap",
1513
1525
  cursor: "pointer"
1514
1526
  },
@@ -1533,10 +1545,11 @@ var defaultStyles = {
1533
1545
  },
1534
1546
  oauthButton: {
1535
1547
  flex: 1,
1536
- border: "1px solid #d1d5db",
1548
+ border: "1px solid #94a3b8",
1537
1549
  borderRadius: 8,
1538
1550
  padding: "10px 12px",
1539
- background: "#f9fafb",
1551
+ background: "#ffffff",
1552
+ color: "#0f172a",
1540
1553
  cursor: "pointer"
1541
1554
  }
1542
1555
  };