${function(){
const { campaign } = data;
const includeType = ['include_collections', 'include_products'];
if (campaign.category === 'buy_x_get_y' || (campaign.event_type === 'successful_order' && (includeType.includes(campaign.campaign_rule.order_condition.applicable_type) || includeType.includes(campaign.campaign_rule.reward_rule.applicable_type)))) {
let tab_1_text = 'tab1';
let tab_2_text = 'tab2';
if (campaign.category === 'buy_x_get_y') {
const {discount_type, prerequisite_value, prerequisite_type, obtain_product} = campaign.reward.discount_code_activity || {};
const x = prerequisite_value;
const y = obtain_product.product_count;
const obtain_value = obtain_product.obtain_value;
if (prerequisite_type === 'quantity') {
tab_1_text = `Buy ${x} of these item(s)`;
} else if (prerequisite_type === 'subtotal') {
tab_1_text = `Buy of these item(s)`;
}
if(obtain_product.obtain_type === 'free') {
tab_2_text = `Free gift(s)`;
}
if(obtain_product.obtain_type === 'percentage') {
tab_2_text = `Offer item(s) at ${parseInt(obtain_value)}% off`;
}
if(obtain_product.obtain_type === 'fixed_amount') {
tab_2_text = `Offer item(s) with off`;
}
} else {
tab_2_text=`The order purchases the following items (rewarding points for each item)`;
if (campaign.campaign_rule.order_condition.min_order_paid > 0) {
tab_1_text = `The order must include any of the following items, and the order amount must exceed .`;
} else {
tab_1_text = `The order must contain any of the following items.`;
}
}
return `