import { Subject } from 'rxjs'; import { IRootState } from './redux/reducers/root-state'; /** * Dependency free uuid generator * * @param {*} [a] * @returns {string} */ export declare function uuid(a?: any): string; /** * The changed setting * * @export * @interface ISettingsChange */ export interface ISettingsChange { name: 'language' | 'defaultToken' | 'userToken' | 'sentinelEndPointUrl' | 'applicationToken' | 'currentOrderId'; old: any; new: any; } /** * A persisted state * * @export * @interface ISavedState */ export interface ISavedState { state: IRootState; } export declare type TDefaultCallUserType = 'employee' | 'customer' | undefined; /** * Settings for the EVA Redux SDK * * @export * @class Settings */ export declare class Settings { /** * The settings change stream * Not all settings are emitted. Only the following: * * - language * - defaultToken * - userToken * * @type {Subject} * @memberof Settings */ changes$: Subject; /** * The callback variant for the change stream * * @memberof Settings */ changeCallback: (changedSetting: ISettingsChange) => void; /** * Getter method for the defaultToken * * @type {string} * @memberof Settings */ get defaultToken(): string; /** * Sets the user token and emits the changed value * * @memberof Settings */ set defaultToken(token: string); /** * Getter method for the userToken * * @type {string} * @memberof Settings */ get userToken(): string; /** * Sets the user token and emits the changed value * * @memberof Settings */ set userToken(token: string); /** * Getter method for the applicationToken * * @type {string} * @memberof Settings */ get applicationToken(): string; /** * Sets the user token and emits the changed value * * @memberof Settings */ set applicationToken(token: string); /** * Getter method for the applicationToken * * @type {string} * @memberof Settings */ get currentOrderId(): number; /** * Sets the user token and emits the changed value * * @memberof Settings */ set currentOrderId(orderId: number); /** * Getter method for the language * * @type {string} * @memberof Settings */ get language(): string; /** * Sets the language and emits the changed value * * @memberof Settings */ set language(newLanguage: string); /** * Getter method for the sentinel endpoint * * @type {string} * @memberof Settings */ get sentinelEndPointUrl(): string | undefined; /** * Sets the sentinel endpoint and emits the changed value * * @memberof Settings */ set sentinelEndPointUrl(newEndpointUrl: string | undefined); /** * By default the sentinel will handle parseBarcode calls when it is * available. Use this setting to disable that behavior. * You can always use `sentinel.performance.parseBarcode(..)` manually * */ disableSentinelParseCode: boolean; /** * This setting can be used to keep using the last known sentinel endpoint * when the application configuration has none defined * Useful for debugging and fixed store deployments * */ preserveLastKnownSentinel: boolean; /** * The EVA backend end point URL that will be used for all requests * * @public * @type {string} * @memberof Settings */ endPointURL: string; /** * The EVA communicator backend end point URL that will be used for signalr * * @public * @type {string} * @memberof Settings */ communicatorEndPointURL?: string; /** * The client version used for calls from this SDK. * Used for the ClientVersion header field value * * @public * @type {string} * @memberof Settings */ readonly clientVersion: string; /** * The client name used for calls from this SDK. * Used for the ClientName header field value * * @public * @type {string} * @memberof Settings */ readonly clientName: string; /** * The app version used for calls from this SDK. * Used for the Eva-User-Agent header field value * * @public * @type {string} * @memberof Settings */ appVersion: string; /** * The app name used for calls from this SDK. * Used for the Eva-User-Agent header field value * * @public * @type {string} * @memberof Settings */ appName: string; /** * The default included product properties for services such as: * * - Core.GetOrder * - Core.GetShoppingCart * - Core.SearchProducts * - Core.GetProducts * - Core.GetBundleProductDetails * - Core.ListProductBundles * * This is not an exhaustive list. In a service request these can be either * called IncludedFields or ProductProperties. * * @type {string[]} */ defaultProductProperties: string[]; /** * The additional request options for the getShoppingCart state. * Defaults are set to retrieve the most logical data needed * before entering the checkout. Discounts, product requirements, etc. * * @type {EVA.Core.AdditionalOrderDataOptions} */ shoppingCartOptions: EVA.Core.AdditionalOrderDataOptions; /** * Optional chain to fetch availability indication for the products in the cart * */ enableGetShoppingCartProductAvailabilityIndication: boolean; /** * The additional request options for the getOrder state. * Defaults are set to retrieve the most logical data needed * during the checkout. Shipping methods, payment methods, etc. * * @type {EVA.Core.AdditionalOrderDataOptions} */ currentOrderOptions: EVA.Core.AdditionalOrderDataOptions; /** * The additional request options for the searchProducts state. * Defaults are to enable retrieving of availability and discounts * * @type {EVA.Core.SearchProductsOptions} */ productSearchOptions: EVA.Core.SearchProductsOptions; /** * Enables sorting of discount tiers on from value before calculating * tier change * * @type {boolean} * @memberof Settings */ enableDiscountTierSorting: boolean; /** * Add product to order placeholder are stacked by default * Meaning that if the product is already in the cart no placeholder will be * added * * @type {boolean} * @memberof Settings */ placeholderStacking: boolean; /** * Enabled debug logging for the SDK * * @type {boolean} * @memberof Settings */ enableLogging: boolean; /** * Can be used by clients to set the current station ID header value * This should always reflect the ID from the station of the `ListStationsForOrganization` response * * @type {number} */ currentStationID?: number; /** * Can be used to set the `EVA-Requested-OrganizationUnitID` header. * This is used to select a specific organization unit when making calls without * a specific user token by ID. * * @type {number} */ requestedOrganizationUnitID?: number; /** * Can be used to set the `EVA-Requested-OrganizationUnit-Query` header. * This is used to select a specific organization unit when making calls without * a specific user token using an exact match query on name and backend id. * * * @type {{ Name: string; BackendID: string; }} */ requestedOrganizationUnitQuery?: { Name: string; BackendID: string; }; /** * Can be used to set the `EVA-IDs-Mode` header which can be used to let the EVA * backend to use external identifiers instead of EVA identifiers for * things like products. * Is usually set using the service settings but can be overridden per call * using this setting * * @type {string} */ backendIdMode?: string; /** * Used to populate the `EVA-IDs-BackendSystemID` header which can be sent * along with the `EVA-IDs-Mode` header to enable response metadata to help * with mapping identifiers between EVA and an external system * * @type {string} */ backendIdSystemID?: string; /** * Whether this is an employee app or not, we will use to determine whether to add an extra property to some * services * * @see https://eva2015.atlassian.net/browse/OPTR-6866 * * @type {TDefaultCallUserType} * @memberof Settings */ defaultCallUserType: TDefaultCallUserType; /** * Cart changes post-login filter out older order lines. This ensure we do not * get changes from an anonymous cart being claimed. Newer lines can include * welcome gift for instance. * Default allowed age is 300000ms (5 minutes) * * @type {number} */ cartChangeLoginOrderLineAge: number; /** * The default anonymous token used for authentication * Access is provided using a getter and a setter for the changes$ feed * * @private * @type {string} * @memberof Settings */ private theDefaultToken; /** * The user token used for authentication * Access is provided using a getter and a setter for the changes$ feed * * @private * @type {string} * @memberof Settings */ private theUserToken; /** * The application token used for anonymous cart authentication * Access is provided using a getter and a setter for the changes$ feed * * @private * @type {string} * @memberof Settings */ private theApplicationToken; /** * The current order id * * @private * @type {number} */ private theCurrentOrderId; /** * The accept-language for all service calls * Access is provided using a getter and a setter for the changes$ feed * * @private * @type {string} * @memberof Settings */ private theLanguage; /** * The EVA Sentinel backend end point URL that will be used for on premise features * * @public * @type {string} * @memberof Settings */ theSentinelEndPointURL?: string; /** * Used to populate the `EVA-App-InstanceId` header which is useful for debugging and diagnostics in the back-end analytics * * @type {string} */ applicationInstanceId?: string; /** * Callback done before each fetch call * */ beforeFetch?: (params: { serviceContext: string; chainContext?: string; url: string; serviceName: string; requestPayload: any; }) => void; /** * Callback done after each fetch call * */ afterFetch?: (params: { serviceContext: string; chainContext?: string; url: string; serviceName: string; status: number; requestPayload: any | undefined; responsePayload: any | undefined; responseError?: any; }) => void; /** * The in memory state store for logged in users * * @private * @type {{ [userId: number]: ISavedState }} * @memberof Settings */ private stateMemory; /** * Saves a users state in memory for reuse * * @param {IRootState} state The state to preserve * @memberof Settings */ saveState(userId: number, state: IRootState): void; /** * Retrieves a previously stored state * * @param {number} userId The users identifier * @returns * @memberof Settings */ getSavedState(userId: number): ISavedState; /** * Removes any save state for a user * * @param {number} userId * @memberof Settings */ purgeSavedState(userId: number): void; /** * Removes all cached states * * @memberof Settings */ purgeAllSavedStates(): void; } export declare const settings: Settings;