text: import './component';
  import './config';
  import './preview';
  
  const Criteria = Shopware.Data.Criteria;
  const criteria = new Criteria(1, 25);
  criteria.addAssociation('crossSellings.assignedProducts.product');
  
  Shopware.Service('cmsService').registerCmsElement({
      name: 'cross-selling',
      label: 'sw-cms.elements.crossSelling.label',
      component: 'sw-cms-el-cross-selling',
      configComponent: 'sw-cms-el-config-cross-selling',
      previewComponent: 'sw-cms-el-preview-cross-selling',
      defaultConfig: {
          product: {
              source: 'static',
              value: null,
              required: true,
              entity: {
                  name: 'product',
                  criteria: criteria,
              },
          },
          displayMode: {
              source: 'static',
              value: 'standard',
          },
          boxLayout: {
              source: 'static',
              value: 'standard',
          },
          elMinWidth: {
              source: 'static',
              value: '300px',
          },
      },
      collect: function collect(elem) {
          const context = {
              ...Shopware.Context.api,
              inheritance: true,
          };
  
          const criteriaList = {};
  
          Object.keys(elem.config).forEach((configKey) => {
              if (['mapped', 'default'].includes(elem.config[configKey].source)) {
                  return;
              }
  
              const entity = elem.config[configKey].entity;
  
              if (entity && elem.config[configKey].value) {
                  const entityKey = entity.name;
                  const entityData = {
                      value: [elem.config[configKey].value],
                      key: configKey,
                      searchCriteria: entity.criteria ? entity.criteria : new Criteria(1, 25),
                      ...entity,
                  };
  
                  entityData.searchCriteria.setIds(entityData.value);
                  entityData.context = context;
  
                  criteriaList[`entity-${entityKey}`] = entityData;
              }
          });
  
          return criteriaList;
      },
  });
  