const summaryMobileEl = {
  summaryAside: '.summary__aside',
  backToTop : '#back-to-top',
  canDisplayPayPal: '#canDisplayPayPalOnBasketPage',
};

export function addClassToSummaryAside(data) {
  const payPalEnabled = data?.paymentInfos?.payPalEnabled;
  const clickAndCollectOnly = data.clickAndCollectOnly;
  const canDisplayPayPal = $(summaryMobileEl.canDisplayPayPal).val() === 'true';
  const isPayPalAllowed = payPalEnabled && clickAndCollectOnly && canDisplayPayPal;
  const $aside = $(summaryMobileEl.summaryAside);
  const $backToTop = $(summaryMobileEl.backToTop);

  if (isPayPalAllowed === false) {
    $aside.addClass('single-button');
    $backToTop.addClass('single-button');
  } else {
    $aside.removeClass('single-button');
    $backToTop.removeClass('single-button');
  }
}
