mirror of
https://github.com/warmbly/warmbly.git
synced 2026-10-05 16:02:10 +00:00
feat: send nothing to TypeSafe when an import's header row holds an address, date or number, skip placeholder Column N headers, accept only the options each column was offered, never infer Subscribed, Categories or Email, prefer an exact existing field name before a folded match on the server as the client does, compute value kinds once per preview, and make Enter in the empty field search a no-op
This commit is contained in:
@@ -800,8 +800,14 @@ export function TargetPicker({
|
||||
onChange({ index: value.index, target: "custom", custom_key: name });
|
||||
}
|
||||
|
||||
// Enter takes an exact name first, then the first match; with nothing
|
||||
// typed it does nothing, so it can never remap a column by accident.
|
||||
function pickFirst() {
|
||||
if (standard.length > 0) pickStandard(standard[0].id);
|
||||
if (q === "") return;
|
||||
const exactStd = standard.find((t) => t.label.toLowerCase() === q.toLowerCase());
|
||||
if (exactStd) pickStandard(exactStd.id);
|
||||
else if (existingKeys.includes(q)) pickExisting(q);
|
||||
else if (standard.length > 0) pickStandard(standard[0].id);
|
||||
else if (custom.length > 0) pickExisting(custom[0]);
|
||||
else if (canCreate) pickNew(q);
|
||||
else return;
|
||||
|
||||
@@ -96,6 +96,7 @@ describe("existing custom fields", () => {
|
||||
it("folds the way the server does", () => {
|
||||
expect(foldCustomKey(" Company.URL ")).toBe("companyurl");
|
||||
expect(foldCustomKey("Revenue ($)")).toBe("revenue");
|
||||
expect(foldCustomKey("Area m²")).toBe("aream²");
|
||||
});
|
||||
|
||||
it("reads both spellings of a custom mapping", () => {
|
||||
|
||||
Reference in New Issue
Block a user