For Angular or web components that do not need any data from CMS (for example, login), you can use the CMS component of type CMSFlexComponent as a placeholder.
This CMS component contains the special flexType attribute. Spartacus use the flexType attribute in its CMS mapping instead of the original component type.
具體展現在下面的代碼裡:

for (const slot of source.contentSlots.contentSlot) {
if (Array.isArray(slot.components?.component)) {
for (const component of slot.components.component) {
const comp: ContentSlotComponentData = {
uid: component.uid,
typeCode: component.typeCode,
};
if (component.properties) {
comp.properties = component.properties;
}
if (component.typeCode === CMS_FLEX_COMPONENT_TYPE) {
comp.flexType = component.flexType;
} else if (component.typeCode === JSP_INCLUDE_CMS_COMPONENT_TYPE) {
comp.flexType = component.uid;
} else {
comp.flexType = component.typeCode;
}
if (!target.page.slots[slot.position].components) {
target.page.slots[slot.position].components = [];
}
target.page.slots[slot.position].components.push(comp);
}
}
}
如果typeCode等于CMSFlexComponent,則flexType賦成Component的FlexTypeCode.
SAP Spartacus的CMS mapping邏輯裡,使用Component的flexType字段。
如下圖所示: