projects/congarevenuecloud/ecommerce/src/lib/modules/cart/services/user-view.service.ts
User view service returns the configurable view of cart item fields to be displayed for a user on cart page.
import { UserViewService, AObjectService} from '@congarevenuecloud/ecommerce';
constructor(private userViewService: UserViewService) {}
// or
export class MyService extends AObjectService {
private userViewService: UserViewService = this.injector.get(UserViewService);
}
AObjectService
Properties |
Methods |
| createUserView | |||||||||||||||
createUserView(views: Array<CartColumnView>, flowName: string)
|
|||||||||||||||
|
This method creates the CartColumnView for a given user. Set the created view as default by setting 'IsDefault' flag in the payload to true. Example:
Parameters :
Returns :
Observable<Array<CartColumnView>>
an observable list of CartColumnView records created. |
| deleteView | |||||||||||||||
deleteView(viewName: string, flowName: string)
|
|||||||||||||||
|
This method deletes the view name for a given flow in the system. Deleting the default flow is not allowed. Example:
Parameters :
Returns :
Observable<boolean>
an observable instance of a boolean indicating sucess upon completion of delete operation. |
| getAllViews | ||||||||||
getAllViews(flowName: string)
|
||||||||||
Decorators :
@MemoizeWithHash()
|
||||||||||
|
This method retrieves the list of display columns associated with cart item fields, for a given flow.
To optimize performance, it uses Example:
Parameters :
Returns :
Observable<Array<CartColumnView>>
an observable instance representing the list of CartColumnView. |
| getCartItemDisplayColumns | ||||||||||
getCartItemDisplayColumns(flowName: string)
|
||||||||||
|
This method retrieves the list of display columns for cart line items, configured for a given flow. Returns the displays configured with DisplayType as 'Cart Line Item'. Example:
Parameters :
an observable list of ConfigCustomDisplayColumns. |
| getDefaultView | ||||||||||
getDefaultView(flowName: string)
|
||||||||||
|
This method retrieves the display columns associated with cart item fields, matching the default user view. If default user view is not specified, it matches the default public view corresponding to the flowName provided. Example:
Parameters :
Returns :
Observable<CartColumnView>
an observable instance of CartColumnView. |
| getMyView | ||||||||||
getMyView(flowName: string)
|
||||||||||
|
This method retrieves the display columns associated with cart item fields, matching the default user view. If default user view is not specified, it matches the default public view corresponding to the flowName provided. Example:
Parameters :
Returns :
Observable<CartColumnView>
an observable instance of CartColumnView. |
| getViewByName | |||||||||||||||
getViewByName(viewName: string, flowName: string)
|
|||||||||||||||
|
This method retrieves the display columns associated with cart item fields, matching the view name passed for a given flow. Example:
Parameters :
Returns :
Observable<CartColumnView>
an observable instance of CartColumnView. |
| onInit |
onInit()
|
|
Returns :
void
|
| updateUserView | |||||||||||||||
updateUserView(views: Array<CartColumnView>, flowName: string)
|
|||||||||||||||
|
This method updates the existing CartColumnView for a given user. Example:
Parameters :
Returns :
Observable<Array<CartColumnView>>
an observable list of CartColumnView records updated. |
| apiService |
Type : ApiService
|
Default value : this.injector.get(ApiService)
|
| cartColumnViews |
Type : Array<CartColumnView>
|
| displayColumns |
Type : Array<ConfigCustomDisplayColumns>
|
Default value : null
|
| storefrontService |
Type : StorefrontService
|
Default value : this.injector.get(StorefrontService)
|
| type |
Default value : CartColumnView
|
| views$ |
Type : BehaviorSubject<Array<CartColumnView>>
|
Default value : new BehaviorSubject<Array<CartColumnView>>(null)
|