@ukiahinsure/a2ui-react-adapter 0.1.16 → 0.1.17

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.js CHANGED
@@ -1173,7 +1173,7 @@ function mergePersistedListRowsIntoRoot(root, persistedRowsByPath, deletedItemId
1173
1173
  optimisticEffectiveRows,
1174
1174
  deletedItemIdsByPath.get(listPath)
1175
1175
  );
1176
- const normalizedRows = normalizeListRows(listPath, visibleRows, merged);
1176
+ const normalizedRows = normalizeListRows(listPath, visibleRows);
1177
1177
  merged[listPath] = cloneJsonArray(normalizedRows);
1178
1178
  setNestedValue(merged, listPath, cloneJsonArray(normalizedRows));
1179
1179
  }
@@ -1227,21 +1227,17 @@ function rememberPersistedListRows(persistedRowsByPath, deletedItemIdsByPath, ro
1227
1227
  );
1228
1228
  persistedRowsByPath.set(
1229
1229
  listPath,
1230
- normalizeListRows(listPath, visibleRows, root)
1230
+ normalizeListRows(listPath, visibleRows)
1231
1231
  );
1232
1232
  }
1233
1233
  }
1234
- function normalizeListRows(listPath, rows, root) {
1234
+ function normalizeListRows(listPath, rows) {
1235
1235
  const clonedRows = cloneJsonArray(rows);
1236
1236
  if (listPath !== "needs.providers") {
1237
1237
  return clonedRows;
1238
1238
  }
1239
- const rootProvider = root === void 0 ? void 0 : providerRowFromAliases(root);
1240
- if (clonedRows.length === 0 && rootProvider !== void 0) {
1241
- return [normalizeProviderRow(rootProvider)];
1242
- }
1243
1239
  return clonedRows.map(
1244
- (row) => isRecord(row) ? normalizeProviderRow(row, rootProvider) : row
1240
+ (row) => isRecord(row) ? normalizeProviderRow(row) : row
1245
1241
  );
1246
1242
  }
1247
1243
  function normalizeProviderRow(row, fallback) {
@@ -1264,24 +1260,12 @@ function normalizeProviderRow(row, fallback) {
1264
1260
  }
1265
1261
  return normalized;
1266
1262
  }
1267
- function providerRowFromAliases(source) {
1268
- const name = firstProviderName(source);
1269
- const location = firstProviderLocation(source);
1270
- if (name === void 0 && location === void 0) {
1271
- return void 0;
1272
- }
1273
- return {
1274
- itemId: "voice-primary-care-provider",
1275
- ...name === void 0 ? {} : { primary_care_provider: name },
1276
- ...location === void 0 ? {} : { primary_care_provider_location: location }
1277
- };
1278
- }
1279
1263
  function submittedProviderRowFromEvent(event) {
1280
1264
  if (event.actionName !== "flow.submit") {
1281
1265
  return void 0;
1282
1266
  }
1283
1267
  const listPath = event.context.listPath;
1284
- if (listPath !== "needs.providers" && !hasProviderSubmitFields(event.context)) {
1268
+ if (listPath !== "needs.providers") {
1285
1269
  return void 0;
1286
1270
  }
1287
1271
  const name = firstProviderName(event.context);
@@ -1808,7 +1792,7 @@ function A2UISurfaceHost({
1808
1792
  resolvedSurfaceMetadata?.fieldInteractions ?? []
1809
1793
  ),
1810
1794
  annotateActionControls(root),
1811
- suppressSkipForMandatoryFields(root, structure.fields),
1795
+ suppressSkipForMandatoryFields(root, structure.fields, resolvedSurfaceMetadata?.fieldInteractions ?? []),
1812
1796
  blockInvalidActionControls(root),
1813
1797
  setPendingGroupsDisabled(
1814
1798
  root,
@@ -2149,8 +2133,11 @@ function annotateActionControls(root) {
2149
2133
  }
2150
2134
  };
2151
2135
  }
2152
- function suppressSkipForMandatoryFields(root, fields) {
2153
- const requiredFields = fields.filter((field) => field.required);
2136
+ function suppressSkipForMandatoryFields(root, fields, groups) {
2137
+ const currentFields = new Set(groups.filter((group) => group.mode === "current").flatMap((group) => group.fields.map((binding) => binding.field)));
2138
+ const requiredFields = fields.filter(
2139
+ (field) => field.required && (groups.length === 0 || currentFields.has(field.field)) && !field.componentId.includes(":list-new:field:") && !field.componentId.includes(":list-row:field:")
2140
+ );
2154
2141
  if (requiredFields.length === 0 || requiredFields.every((field) => isOptionalCoverageField(field.field))) {
2155
2142
  return () => void 0;
2156
2143
  }