refactor(intake): extract product factory key helpers
This commit is contained in:
parent
8f8ea08155
commit
a30151a24a
@ -582,6 +582,11 @@ import {
|
||||
normalizeFirstQualityRowsForPayload,
|
||||
type ProductFirstQualityDisplayRow,
|
||||
} from "./firstQualityHelpers";
|
||||
import {
|
||||
getProductFactoryModelAutofillKey,
|
||||
getSkuFactoryModelKey,
|
||||
getSkuPackageGroupKey,
|
||||
} from "./productFactoryKeyHelpers";
|
||||
import {
|
||||
MATERIAL_TYPE_OPTIONS,
|
||||
PLANNING_LAYOUT_AUDIENCE_OPTIONS,
|
||||
@ -3554,21 +3559,6 @@ function resolveAutoAwareBarcode(
|
||||
return fallbackBarcode;
|
||||
}
|
||||
|
||||
function getSkuPackageGroupKey(sku: Pick<NonIntegratedSkuItem, "id" | "packageGroupId">) {
|
||||
return sku.packageGroupId.trim() || sku.id;
|
||||
}
|
||||
|
||||
function getSkuFactoryModelKey(sku: Pick<NonIntegratedSkuItem, "model">) {
|
||||
return sku.model.trim();
|
||||
}
|
||||
|
||||
function getProductFactoryModelAutofillKey(
|
||||
skuId: string,
|
||||
key: ProductFactoryEditableKey,
|
||||
) {
|
||||
return `${skuId}:${key}`;
|
||||
}
|
||||
|
||||
function hasPackageSharedFactoryRowContent(row: NonIntegratedFactoryRow) {
|
||||
return Array.from(PACKAGE_SHARED_PRODUCT_FACTORY_PURCHASING_KEYS).some((key) =>
|
||||
row[key].trim(),
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
import type { NonIntegratedSkuItem } from "./nonIntegratedStorage";
|
||||
import type { ProductFactoryEditableKey } from "./skuFieldConfig";
|
||||
|
||||
export function getSkuPackageGroupKey(
|
||||
sku: Pick<NonIntegratedSkuItem, "id" | "packageGroupId">,
|
||||
) {
|
||||
return sku.packageGroupId.trim() || sku.id;
|
||||
}
|
||||
|
||||
export function getSkuFactoryModelKey(
|
||||
sku: Pick<NonIntegratedSkuItem, "model">,
|
||||
) {
|
||||
return sku.model.trim();
|
||||
}
|
||||
|
||||
export function getProductFactoryModelAutofillKey(
|
||||
skuId: string,
|
||||
key: ProductFactoryEditableKey,
|
||||
) {
|
||||
return `${skuId}:${key}`;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user