import {
calculateAmountFromPoints,
calculatePointsFromAmount,
calculateFinalAmount,
calculateMaxRedeemablePoints,
validatePointsRedemption
} from '@loyaltylt/sdk';
// Points rules from backend
const pointsRules = {
points_per_currency: 10, // 10 points per 1 EUR
currency_amount: 1,
points_redemption_enabled: true,
points_per_currency_redemption: 100, // 100 points = 1 EUR
currency_amount_redemption: 1,
min_points_for_redemption: 100,
max_points_per_redemption: 5000
};
// Calculate discount from points
const discount = calculateAmountFromPoints(500, pointsRules);
// Result: 5.00 (500 points = 5 EUR)
// Calculate points earned from purchase
const pointsEarned = calculatePointsFromAmount(25.00, pointsRules);
// Result: 250 (25 EUR = 250 points)
// Calculate final amount after points discount
const finalAmount = calculateFinalAmount(50.00, 500, pointsRules);
// Result: 45.00 (50 EUR - 5 EUR discount)
// Get max redeemable points for amount
const maxPoints = calculateMaxRedeemablePoints(30.00, 5000, pointsRules);
// Result: 3000 (enough to cover 30 EUR)
// Validate redemption
const validation = validatePointsRedemption(500, 1000, pointsRules);
// Result: { isValid: true }