function checkFile(data){
  // reset messages in case of back navigation
  $('div[aria-controls="dimensions"] .slds-setup-assistant__item').addClass('slds-hide');
  $('li[aria-label="fields-valid"]').removeClass('slds-hide');
  
  // check for extra fields
  if(array.results.file.length>0) {
    $('li[aria-label="product-fields-invalid-count"]').removeClass('slds-hide');
  }
  // check all the fields are there
  var keys = Object.keys(data[0]);
  ['_id', 'name', 'url', 'imageUrl', 'price',	'listPrice', 'rating', 'numRatings'].forEach(function(e) {
    if(keys.indexOf(e)<0){
      $('li[aria-label="product-fields-invalid"]').removeClass('slds-hide');
      $('#dimensions').attr('aria-invalid', '1')
      $('li[aria-label="fields-valid"]').addClass('slds-hide');
    }
  });
  ['category', 'itemClass', 'style', 'brand'].forEach(function(e) {
    if(keys.indexOf(e)<0){
      $('li[aria-label="dimension-fields-invalid"]').removeClass('slds-hide');
      $('#dimensions').attr('aria-invalid', '1')
      $('li[aria-label="fields-valid"]').addClass('slds-hide');
    }
  });
  // check there are enough products
  if(data.length>14){var label = 'valid'} else {var label = 'invalid'; $('#dimensions').attr('aria-invalid', '1')};
  $('li[aria-label="product-count-' + label + '"]').find('h3').html(data.length + ' product row(s) processed');
  $('li[aria-label="product-count-' + label + '"]').removeClass('slds-hide');
  // check there are enough categories
  if(array.catalog.dimensions.categories.length>2){var label = 'valid'} else {var label = 'invalid'};
  $('li[aria-label="category-count-' + label + '"]').find('h3').html(array.catalog.dimensions.categories.length + ' category option(s) identified');
  $('li[aria-label="category-count-' + label + '"]').removeClass('slds-hide');
}
// Run key checks on the uploaded data
Run key checks on the uploaded data
Run key checks on the uploaded data
function checkFile(data){
  $('div[aria-controls="dimensions"] .slds-setup-assistant__item').addClass('slds-hide');
  $('li[aria-label="fields-valid"]').removeClass('slds-hide');
  if(array.results.file.length>0) {
    $('li[aria-label="product-fields-invalid-count"]').removeClass('slds-hide');
  }
  var keys = Object.keys(data[0]);
  ['_id', 'name', 'url', 'imageUrl', 'price',	'listPrice', 'rating', 'numRatings'].forEach(function(e) {
    if(keys.indexOf(e)<0){
      $('li[aria-label="product-fields-invalid"]').removeClass('slds-hide');
      $('#dimensions').attr('aria-invalid', '1')
      $('li[aria-label="fields-valid"]').addClass('slds-hide');
    }
  });
  ['category', 'itemClass', 'style', 'brand'].forEach(function(e) {
    if(keys.indexOf(e)<0){
      $('li[aria-label="dimension-fields-invalid"]').removeClass('slds-hide');
      $('#dimensions').attr('aria-invalid', '1')
      $('li[aria-label="fields-valid"]').addClass('slds-hide');
    }
  });
  if(data.length>14){var label = 'valid'} else {var label = 'invalid'; $('#dimensions').attr('aria-invalid', '1')};
  $('li[aria-label="product-count-' + label + '"]').find('h3').html(data.length + ' product row(s) processed');
  $('li[aria-label="product-count-' + label + '"]').removeClass('slds-hide');
  if(array.catalog.dimensions.categories.length>2){var label = 'valid'} else {var label = 'invalid'};
  $('li[aria-label="category-count-' + label + '"]').find('h3').html(array.catalog.dimensions.categories.length + ' category option(s) identified');
  $('li[aria-label="category-count-' + label + '"]').removeClass('slds-hide');
}
function checkFile ( data ) { $ ( 'div[aria-controls="dimensions"] .slds-setup-assistant__item' ) . addClass ( 'slds-hide' ) ; $ ( 'li[aria-label="fields-valid"]' ) . removeClass ( 'slds-hide' ) ; if ( array . results . file . length > 0 ) { $ ( 'li[aria-label="product-fields-invalid-count"]' ) . removeClass ( 'slds-hide' ) ; } var keys = Object . keys ( data [ 0 ] ) ; [ '_id' , 'name' , 'url' , 'imageUrl' , 'price' , 'listPrice' , 'rating' , 'numRatings' ] . forEach ( function ( e ) { if ( keys . indexOf ( e ) < 0 ) { $ ( 'li[aria-label="product-fields-invalid"]' ) . removeClass ( 'slds-hide' ) ; $ ( '#dimensions' ) . attr ( 'aria-invalid' , '1' ) $ ( 'li[aria-label="fields-valid"]' ) . addClass ( 'slds-hide' ) ; } } ) ; [ 'category' , 'itemClass' , 'style' , 'brand' ] . forEach ( function ( e ) { if ( keys . indexOf ( e ) < 0 ) { $ ( 'li[aria-label="dimension-fields-invalid"]' ) . removeClass ( 'slds-hide' ) ; $ ( '#dimensions' ) . attr ( 'aria-invalid' , '1' ) $ ( 'li[aria-label="fields-valid"]' ) . addClass ( 'slds-hide' ) ; } } ) ; if ( data . length > 14 ) { var label = 'valid' } else { var label = 'invalid' ; $ ( '#dimensions' ) . attr ( 'aria-invalid' , '1' ) } ; $ ( 'li[aria-label="product-count-' + label + '"]' ) . find ( 'h3' ) . html ( data . length + ' product row(s) processed' ) ; $ ( 'li[aria-label="product-count-' + label + '"]' ) . removeClass ( 'slds-hide' ) ; if ( array . catalog . dimensions . categories . length > 2 ) { var label = 'valid' } else { var label = 'invalid' } ; $ ( 'li[aria-label="category-count-' + label + '"]' ) . find ( 'h3' ) . html ( array . catalog . dimensions . categories . length + ' category option(s) identified' ) ; $ ( 'li[aria-label="category-count-' + label + '"]' ) . removeClass ( 'slds-hide' ) ; }
Run key checks on the uploaded data
Run key checks on the uploaded data
// reset messages in case of back navigation // check for extra fields // check all the fields are there // check there are enough products // check there are enough categories