polished and testing exports
This commit is contained in:
1 parent
9b4457d96e
commit
dd7db5032a
17 files changed
+269
-53
No files matched your search
@@ -76,6 +76,26 @@ export function mapActiveExportFeedOptions(
|
||||
}));
|
||||
}
|
||||
|
||||
/** Column keys from an export feed template (fields[] or legacy mappings). */
|
||||
export function fieldKeysFromExportTemplate(template: unknown): string[] {
|
||||
if (!template || typeof template !== "object") return [];
|
||||
const t = template as { fields?: unknown; mappings?: unknown };
|
||||
if (Array.isArray(t.fields) && t.fields.length > 0) {
|
||||
const keys: string[] = [];
|
||||
for (const f of t.fields) {
|
||||
if (!f || typeof f !== "object") continue;
|
||||
const row = f as { key?: unknown; name?: unknown };
|
||||
const key = String(row.key ?? row.name ?? "").trim();
|
||||
if (key) keys.push(key);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
if (t.mappings && typeof t.mappings === "object" && !Array.isArray(t.mappings)) {
|
||||
return Object.keys(t.mappings as Record<string, unknown>);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/** Which body the product export dialog should show. */
|
||||
export function resolveExportDialogBody(input: {
|
||||
loading: boolean;
|
||||
|
||||
Reference in new issue
Block a user