File
Description
The storefront record is the backbone to the customer experience. It drives catalog, pricing and interface.
Usage
import { StorefrontService, AObjectService } from '@congarevenuecloud/ecommerce';
constructor(private storefrontService: StorefrontService) {}
// or
export class MyService extends AObjectService {
private storefrontService: StorefrontService = this.injector.get(StorefrontService);
}
Extends
Methods
|
getAssetActions
|
getAssetActions()
|
Method to fetch all enabled asset action within the flow associated to storefront.
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.
|
|
getConfigSettings
|
getConfigSettings()
|
Retrieves all custom setting properties associated with the flow linked to the storefront.
Example:
import { StorefrontService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs';
export class SomeComponent {
let configurations = {};
constructor(private storefrontService: StorefrontService) {}
ngOnInit() {
this.storefrontService.getConfigSettings().subscribe(configSettings => {
this.configurations = configSettings;
});
}
}
Returns : Observable<Object>
An Observable that emits configuration settings as an object.
|
|
getDiscovery
|
getDiscovery()
|
Method returns the string value of EnableDiscoveryOn property from config system properties associated to the storefront flow.
Example:
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}
ngOnInit(){
this.storefrontService.getDiscovery();
}
}
string value of EnableDiscoveryOn property.
Example:
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}
ngOnInit(){
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:
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}
ngOnInit(){
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>>
observable list containing displays associated with the flow.
Example:
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}
ngOnInit(){
this.storefrontService.getDisplays();
}
}
|
|
getFlowCustomSettings
|
getFlowCustomSettings(flowName: string)
|
This method returns the config system properties defined on a given flow.
Example:
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}
ngOnInit(){
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:
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}
ngOnInit(){
this.storefrontService.getFlowCustomSettings();
}
}
|
|
getPollingConfig
|
getPollingConfig()
|
This method fetches the configuration data related to the maximum number of retries and delay duration
for pricing circuit from the ConfigSystemProperties for flow associated to Storefront and returns an Observable emitting an object containing
these values.
Example:
import { StorefrontService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs';
export class SomeComponent {
maxRetries: number;
delay: number;
retryData$: Observable<{ maxRetries: number, delay: number }>;
constructor(private pricingService: PricingService) {}
ngOnInit() {
this.pricingService.getPollingConfig().subscribe(data => {
this.maxRetries = data.maxRetries;
this.delay = data.delay;
});
// or
this.retryData$ = this.pricingService.getPollingConfig();
}
}
for pricing circuit.
See PollingDispatcher for more details on the structure and fields required.
An Observable emitting an object containing the maximum number of retries and delay duration
for pricing circuit.
|
|
getSettingsByKey
|
getSettingsByKey(key: SettingsName)
|
Fetches the settings based on the given key.
This method retrieves specific settings that control various aspects of the configuration.
The key helps identify which setting needs to be fetched.
Example Usage:
import { StorefrontService, SettingsName } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs';
export class SomeComponent {
setting$: Observable<Object>;
specificField: any;
constructor(private storefrontService: StorefrontService) {}
ngOnInit() {
this.setting$ = this.storefrontService.getSettingsByKey(SettingsName.SOME_SETTING);
this.setting$.subscribe(setting => {
this.specificField = setting['desiredField'];
});
}
}
See SettingsName for the list of available settings.
Parameters :
| Name |
Type |
Optional |
Description |
| key |
SettingsName
|
No
|
- The setting to retrieve, which should be taken from the
SettingsName enum.
|
Returns : Observable<Object>
An observable that emits the requested setting or null if not available.
|
|
getSettingsName
|
getSettingsName(flowName: string, settingName: string)
|
This method returns the assets system properties based on flow and setting name.
Example:
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}
ngOnInit(){
this.storefrontService.getSettingsName();
}
}
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.
Example:
import { StorefrontService } from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor(private storefrontService: StorefrontService) {}
ngOnInit(){
this.storefrontService.getSettingsName();
}
}
|
|
getStorefront
|
getStorefront()
|
Retrieves the storefront record
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
|
|
getStorefrontsByName
|
|
Retrieves the list of a storefront records based on the provided storefront name.
|
getStorefrontsByName(storefrontName: string, page: number, limit: number, sortField?: string)
|
Retrieves the list of a storefront records based on the provided storefront name.
Parameters :
| Name |
Type |
Optional |
Default value |
Description |
| storefrontName |
string
|
No
|
|
The name of the storefront to look up.
|
| page |
number
|
No
|
1
|
The page number to retrieve. Defaults to 1.
|
| limit |
number
|
No
|
1
|
The number of 'Storefront' records to include in the result set. Defaults to 1.
|
| sortField |
string
|
Yes
|
|
The field by which to sort the 'Storefront' records (optional
|
An observable containing the 'Storefront' record.
|
|
isABOEnabled
|
isABOEnabled()
|
Method verifies whether ABO is enabled within the flow associated to storefront.
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:
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:
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.
If the flag is not defined, it defaults to false.
Example:
import { Component, OnInit } from '@angular/core';
import { StorefrontService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs';
export class MyComponent implements OnInit {
isOneTimeChangeEnabled$: Observable<boolean>;
constructor(private storefrontService: StorefrontService) {}
ngOnInit() {
this.isOneTimeChangeEnabled$ = this.storefrontService.isOneTimeChangeEnabled();
this.isOneTimeChangeEnabled$.subscribe(isEnabled => {
});
}
}
Returns : Observable<boolean>
An Observable indicating whether EnableOneTimeChange is enabled
Example:
import { Component, OnInit } from '@angular/core';
import { StorefrontService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs';
export class MyComponent implements OnInit {
isOneTimeChangeEnabled$: Observable<boolean>;
constructor(private storefrontService: StorefrontService) {}
ngOnInit() {
this.isOneTimeChangeEnabled$ = this.storefrontService.isOneTimeChangeEnabled();
this.isOneTimeChangeEnabled$.subscribe(isEnabled => {
});
}
}
|
|
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:
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:
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
|
|
Public
STORAGE_KEY
|
Type : string
|
Default value : PlatformConstants.STOREFRONT_ID
|
|
type
|
Default value : Storefront
|