@ikas/bp-storefront 1.4.0-beta.127 → 1.4.0-beta.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -338,11 +338,19 @@ export declare function getProductVariantFormattedBuyPrice(variant: IkasProductV
|
|
|
338
338
|
/**
|
|
339
339
|
* Get the applied campaign discount amount details for a product variant, including type and formatted value.
|
|
340
340
|
*
|
|
341
|
+
* How the discount value is interpreted depends on `campaign.type`:
|
|
342
|
+
* - `"FIXED_AMOUNT"` → the value is an absolute money amount, returned in `formattedPrice` (e.g. "$10.00"); `discountPercentage` stays null.
|
|
343
|
+
* - `"RATIO"` → the value is a percentage, returned in `discountPercentage` (e.g. "10" for 10% off); `formattedPrice` stays null.
|
|
344
|
+
*
|
|
345
|
+
* Both fixed and tiered campaigns are supported. For a tiered-discount campaign
|
|
346
|
+
* (`campaign.fixedDiscount` is null and the discount lives in `campaign.tieredDiscount.rules`),
|
|
347
|
+
* the first tier's amount (`campaign.tieredDiscount.rules[0].amount`) is used, matching the storefront runtime.
|
|
348
|
+
*
|
|
341
349
|
* @ai-category Pricing, ProductVariant
|
|
342
350
|
* @ai-related getProductVariantCampaignPrice, getProductVariantFormattedCampaignPrice, hasProductVariantDiscount
|
|
343
351
|
*
|
|
344
352
|
* @param variant - The product variant to check for applied campaigns
|
|
345
|
-
* @returns An object
|
|
353
|
+
* @returns An object `{ type, formattedPrice, discountPercentage }` — `formattedPrice` is set for FIXED_AMOUNT campaigns, `discountPercentage` for RATIO campaigns (fixed and tiered alike); the other field stays null. Returns null if no campaign is applied.
|
|
346
354
|
*
|
|
347
355
|
* @example
|
|
348
356
|
* ```typescript
|