CouponInfo - itsManeka/amazing-scraper GitHub Wiki

amazing-scraper


amazing-scraper / CouponInfo

Interface: CouponInfo

Defined in: src/domain/entities/CouponInfo.ts:10

Information extracted from a product page's coupon link. promotionMerchantId is kept as a separate field from redirectMerchantId because the POST payload uses both, and they may diverge across different coupons.

When isIndividual === true, the coupon is an inline "individual" coupon shown directly on the product page (not a PSP coupon with its own /promotion/psp/ page). In this case, the optional metadata fields (discountText, description, termsUrl) are populated.

Properties

couponCode

couponCode: string | null

Defined in: src/domain/entities/CouponInfo.ts:20

Alphanumeric coupon code extracted from the product page text (e.g. "FJOVKLWWIZXM" from "com o cupom FJOVKLWWIZXM"). null when no code is found in the surrounding text.


description?

optional description: string | null

Defined in: src/domain/entities/CouponInfo.ts:37

Human-readable message shown in the inline block (normalised text), without the leading "off." prefix. Present only when isIndividual === true. null when message is empty.


discountPercent?

optional discountPercent: number | null

Defined in: src/domain/entities/CouponInfo.ts:54

Discount percentage extracted from "Aplicar cupom de X%" pattern. Present only when isApplicable === true. null when parsing fails.


discountText?

optional discountText: string | null

Defined in: src/domain/entities/CouponInfo.ts:31

Discount text extracted from the badge element (e.g. "R$20", "20%"). Present only when isIndividual === true. null when badge is not found.


isApplicable?

optional isApplicable: boolean

Defined in: src/domain/entities/CouponInfo.ts:49

Discriminant: set to true when this coupon is an "applicable" coupon (pattern "Aplicar cupom de X%" without specific coupon code). Present only when the coupon is both individual and applicable.


isIndividual?

optional isIndividual: true

Defined in: src/domain/entities/CouponInfo.ts:26

Discriminant: set to true when this coupon is an "individual" coupon (inline promotion shown directly on the product page, not a PSP coupon). undefined when this is a PSP-style coupon.


participatingProductsUrl?

optional participatingProductsUrl: string | null

Defined in: src/domain/entities/CouponInfo.ts:59

URL of the participating products page for applicable coupons. Present only when isApplicable === true. null when not found or not applicable.


promotionId

promotionId: string

Defined in: src/domain/entities/CouponInfo.ts:11


promotionMerchantId

promotionMerchantId: string

Defined in: src/domain/entities/CouponInfo.ts:14


redirectAsin

redirectAsin: string

Defined in: src/domain/entities/CouponInfo.ts:12


redirectMerchantId

redirectMerchantId: string

Defined in: src/domain/entities/CouponInfo.ts:13


termsUrl?

optional termsUrl: string | null

Defined in: src/domain/entities/CouponInfo.ts:43

Relative URL of the popover endpoint that serves the coupon terms (e.g. "/promotion/details/popup/ATVO4IBO0PTIE?ref=cxcw_bxgx_tc_..."). Present only when isIndividual === true. null when the modal attribute is absent.

⚠️ **GitHub.com Fallback** ⚠️