Route kebab Customize through the prefilled policy wizard so existing methods and values can be renamed, reordered, and kept in that field order on the card after Finalize.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
adilallo
2026-08-21 13:51:37 -06:00
co-authored by Cursor
parent e9951f260b
commit 4006fe5c6c
31 changed files with 3062 additions and 1530 deletions
+21
View File
@@ -24,6 +24,15 @@ export function removeCoreValueChipFromDraft(
const nextDetails = hadDetail
? omitIdFromStringRecord(state.coreValueDetailsByChipId, chipId)
: undefined;
const hadBlocks =
Boolean(state.customMethodCardFieldBlocksById) &&
Object.prototype.hasOwnProperty.call(
state.customMethodCardFieldBlocksById,
chipId,
);
const nextBlocks = hadBlocks
? omitIdFromStringRecord(state.customMethodCardFieldBlocksById, chipId)
: undefined;
const out: Partial<CreateFlowState> = {
coreValuesChipsSnapshot: nextSnap,
@@ -33,6 +42,9 @@ export function removeCoreValueChipFromDraft(
if (hadDetail) {
out.coreValueDetailsByChipId = nextDetails;
}
if (hadBlocks) {
out.customMethodCardFieldBlocksById = nextBlocks;
}
return out;
}
@@ -77,6 +89,7 @@ export function duplicateCoreValueChipInDraft(
[newId]: structuredClone(inherited),
}
: { ...(state.coreValueDetailsByChipId ?? {}) };
const inheritedBlocks = state.customMethodCardFieldBlocksById?.[chipId];
return {
newId,
@@ -87,6 +100,14 @@ export function duplicateCoreValueChipInDraft(
...(Object.keys(nextDetails).length > 0
? { coreValueDetailsByChipId: nextDetails }
: {}),
...(inheritedBlocks !== undefined
? {
customMethodCardFieldBlocksById: {
...(state.customMethodCardFieldBlocksById ?? {}),
[newId]: structuredClone(inheritedBlocks),
},
}
: {}),
},
};
}