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:
@@ -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),
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user