File

projects/congarevenuecloud/elements/src/lib/constraint-rule/services/constraint-rule-message.service.ts

Description

Service is responsible to build and format the constraint rule messages to render on the view.

Index

Properties
Methods

Constructor

constructor(constraintRuleService: ConstraintRuleService, productService: ProductService, exceptionService: ExceptionService, primaryCartService: CartService, secondaryCartService: SecondaryCartService, araiService: AppliedRuleActionInfoService, productOptionService: ProductOptionService)
Parameters :
Name Type Optional
constraintRuleService ConstraintRuleService No
productService ProductService No
exceptionService ExceptionService No
primaryCartService CartService No
secondaryCartService SecondaryCartService No
araiService AppliedRuleActionInfoService No
productOptionService ProductOptionService No

Methods

addProductToCartFromRule
addProductToCartFromRule(ruleDetail: ConstraintRuleDetail | AppliedRuleActionInfo, product: Product, quantity: number)

Adds a product to the cart based on the associated constraint rule.

Parameters :
Name Type Optional Default value Description
ruleDetail ConstraintRuleDetail | AppliedRuleActionInfo No

Constraint rule detail object related to the action product to add to cart.

product Product No

Action product to add for the associated constraint rule.

quantity number No 1

Quantity of the given product to add to the cart.

Returns : Observable<void>
deleteProductFromCart
deleteProductFromCart(ruleDetail: ConstraintRuleDetail | AppliedRuleActionInfo, product: Product)

Removes a product from the cart based on the given constraint rule detail object.

Parameters :
Name Type Optional Description
ruleDetail ConstraintRuleDetail | AppliedRuleActionInfo No

Constraint rule detail object pertaining to the product to remove from the cart.

product Product No

the product to remove from the cart.

Returns : Observable<string>
getCartRuleGroups
getCartRuleGroups()

Returns an observable of the cart level rule groups.

refreshCartRules
refreshCartRules()

Refreshes the cart level constraint rules behavior subject.

refreshConfigRules
refreshConfigRules()

Refreshes the product configuration level constraint rules behavior subject.

Returns : any

Properties

cartRuleGroups$
Type : BehaviorSubject<ConstraintRuleGroups>
Default value : new BehaviorSubject<ConstraintRuleGroups>(null)

Groups of cart level constraint rules.

showRules$
Type : BehaviorSubject<boolean>
Default value : new BehaviorSubject<boolean>(true)

results matching ""

    No results matching ""