export const getSelectedFilterData = (items, current) => {
  let value = {};
  items.forEach((group) => {
    if (group.options[current]) {
      value = group.options[current];
    }
  });

  return value;
};

export const replaceWithDynamicValue = (htmlString) => {
  return htmlString
    .replace(/{{discount_percentage}}/g, '10%')
    .replace(/{{discount_value}}/g, '$5.00')
    .replace(/{{regular_price}}/g, '$50.00')
    .replace(/{{regular_price_with_tax}}/g, '$55.00')
    .replace(/{{sale_price}}/g, '$45.00')
    .replace(/{{sale_price_with_tax}}/g, '$48.00')
    .replace(/{{stock_quantity}}/g, '12')
    .replace(/{{category_name}}/g, 'Clothing')
    .replace(/{{tag_name}}/g, 'Summer Sale')
    .replace(/{{brand_name}}/g, 'Nike');
};

export const handleCopy = (value) => {
  window.navigator.clipboard.writeText(value);
};

export const BADGE_CONTENT_PLACEHOLDERS = [
  '{{discount_percentage}}',
  '{{discount_value}}',
  '{{regular_price}}',
  '{{regular_price_with_tax}}',
  '{{sale_price}}',
  '{{sale_price_with_tax}}',
  '{{stock_quantity}}',
  '{{category_name}}',
  '{{tag_name}}',
  '{{brand_name}}',
];
