File

projects/congarevenuecloud/ecommerce/src/lib/modules/store/services/storefront.service.ts

Description

The storefront record is the backbone to the customer experience. It drives catalog, pricing and interface.

Usage

Example :
import { StorefrontService, AObjectService } from '@congarevenuecloud/ecommerce';

constructor(private storefrontService: StorefrontService) {}

// or

export class MyService extends AObjectService {
private storefrontService: StorefrontService = this.injector.get(StorefrontService);
}

Extends

AObjectService

Index

Properties
Methods

Methods

getAssetActions
getAssetActions()

Method to fetch all enabled asset action within the flow associated to storefront.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
getAssetActions: string;
getAssetActions$: Observable<Array<string>>;
constructor(private storefrontService: StorefrontService){}
ngOnInit(){
this.storefrontService.getAssetActions().subscribe(s => this.getAssetActions = s);
// or
this.getAssetActions$ = this.storefrontService.getAssetActions();
}
}
Returns : Observable<Array<string>>

An Observable emitting an array of strings representing the asset actions.

getDiscovery
getDiscovery()

Method returns the string value of EnableDiscoveryOn property from config system properties associated to the storefront flow.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}

this.storefrontService.getDiscovery();
}
Returns : string

string value of EnableDiscoveryOn property.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}

this.storefrontService.getDiscovery();
}
getDisplays
getDisplays(flowName: string)
Decorators :
@MemoizeAll()

This method returns the displays based on the flow name set on the storefront record.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}

this.storefrontService.getDisplays();
}
Parameters :
Name Type Optional Default value Description
flowName string No 'system'

string value representing the flow name associated to storefront record. Defaulted to 'system'.

Returns : Observable<Array<Object>>

obesrvable list containing displays associated with the flow.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}

this.storefrontService.getDisplays();
}
getFlowCustomSettings
getFlowCustomSettings(flowName: string)

This method returns the config system properties defined on a given flow.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}

this.storefrontService.getFlowCustomSettings();
}
Parameters :
Name Type Optional Default value Description
flowName string No 'system'

string value representing the flow name associated to storefront record. Defaulted to 'system'.

Returns : Observable<Object>

observable of config system properties for the associated flow.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}

this.storefrontService.getFlowCustomSettings();
}
getSettingsName
getSettingsName(flowName: string, settingName: string)

This method returns the system properties based on flow and setting name.

Parameters :
Name Type Optional Default value Description
flowName string No 'system'

string value representing the flow name associated to storefront record. Defaulted to 'system'.

settingName string No 'assets'

string value representing the setting name . Defaulted to 'assets'.

Returns : Observable<Object>

observable of system properties for the associated flow and setting.

getStorefront
getStorefront()

Retrieves the storefront record

Example:

Example :
import { StorefrontService, Storefront } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
storefront: Storefront;
storefront$: Observable<Storefront>;
constructor(private storefrontService: StorefrontService){}
ngOnInit(){
this.storefrontService.getStorefront().subscribe(s => this.storefront = s);
// or
this.storefront$ = this.storefrontService.getStorefront();
}
}

an observable containing the storefront record

isABOEnabled
isABOEnabled()

Method verifies whether ABO is enabled within the flow associated to storefront.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
isABOEnabled: boolean;
isABOEnabled$: Observable<boolean>;
constructor(private storefrontService: StorefrontService){}
ngOnInit(){
this.storefrontService.isABOEnabled().subscribe(s => this.isABOEnabled = s);
// or
this.isABOEnabled$ = this.storefrontService.isABOEnabled();
}
}
Returns : Observable<boolean>

boolean observable of EnableABO property

isCartRevalidationEnabled
isCartRevalidationEnabled()

Method retrieves the EnableCartRevalidation property from config system properties.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
cartRevalidationEnabled: boolean;
cartRevalidationEnabled$: Observable<boolean>;
constructor(private storefrontService: StorefrontService){}
ngOnInit(){
this.storefrontService.isCartRevalidationEnabled().subscribe(s => this.cartRevalidationEnabled = s);
// or
this.cartRevalidationEnabled$ = this.storefrontService.isCartRevalidationEnabled();
}
}
Returns : Observable<boolean>

boolean observable of EnableCartRevalidation property

isFavoriteEnabled
isFavoriteEnabled()

Method retrieves the EnableFavorite property from config system properties.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
showFavorites: boolean;
showFavorites$: Observable<boolean>;
constructor(private storefrontService: StorefrontService){}
ngOnInit(){
this.storefrontService.isFavoriteEnabled().subscribe(s => this.showFavorites = s);
// or
this.showFavorites$ = this.storefrontService.isFavoriteEnabled();
}
}
Returns : Observable<boolean>

boolean observable of EnableFavorite property

isOneTimeChangeEnabled
isOneTimeChangeEnabled()

Method fetches the EnableOneTime Flag for asset flow to enable onetime product for amend action.

Returns : Observable<boolean>

An Observable indicating whether EnableOneTimeChange is enabled

isProductRecommendationEnabled
isProductRecommendationEnabled()

Method checks if Product Recommendation feature is enabled within the flow associated to storefront. Looks for EnableProductRecommendation in config system properties specified on the flow associated to Storefront. If no property is defined, the method defaults to evaluating it as true.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
productRecommendationEnabled: boolean;
productRecommendationEnabled$: Observable<boolean>;
constructor(private storefrontService: StorefrontService){}
ngOnInit(){
this.storefrontService.isProductRecommendationEnabled().subscribe(s => this.productRecommendationEnabled = s);
// or
this.productRecommendationEnabled$ = this.storefrontService.isProductRecommendationEnabled();
}
}
Returns : Observable<boolean>

boolean observable specifying whether the feature is enabled.

isPromotionEnabled
isPromotionEnabled()

Method verifies whether promotions are enabled within the flow associated to storefront.

Example:

Example :
import { StorefrontService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
isPromotionEnabled: boolean;
isPromotionEnabled$: Observable<boolean>;
constructor(private storefrontService: StorefrontService){}
ngOnInit(){
this.storefrontService.isPromotionEnabled().subscribe(s => this.isPromotionEnabled = s);
// or
this.isPromotionEnabled$ = this.storefrontService.isPromotionEnabled();
}
}
Returns : Observable<boolean>

boolean observable of EnablePromotions property

onInit
onInit()
Returns : void

Properties

type
Default value : Storefront

results matching ""

    No results matching ""