// Copyright © 2022-2026 Partium, Inc. DBA Partium import { Observable } from 'rxjs'; import { PaginatedRequestService, EventContext, BaseLoginInitService, PartiumConfig } from '../../core'; import { Organization } from '../../core/services/organization/models/organization'; import { ServiceProvider } from '../../core/services/service-provider'; import { CSARequest } from '../models/csa-request'; import { CSARequestStatus } from '../models/csa-request-status'; import { Part } from '../models/part'; import { MultipleExpertSearches } from '../models/multiple-expert-searches'; import { CSARequestSearch } from '../models/csa-request-search'; import { SearchOutput } from '../../find'; interface ECREventContext extends EventContext { languageUi?: string; } /** * Service providing methods related to customer service assistance (also known as expert confirmation) */ export interface CustomerServiceAssistanceService { /** * Trigger the Partium-Backend to send a Customer-Service-Assistance request * with the given information. Additionally to the information passed to this * function, the call will also contain the state of the current * search-session. * * @param message an additional text-message for the CSA-support to read * @param language the language to display part- and filter-names in the * request * @param searchOutput (optional) the search-output-object containing the search-input and results to send along with the request * @param part reference to a part that this CSA-request is about * (optional) * @param additionalAssets additional image- or video-assets (optional) * @param ecrEventContext (optional) ECREventContext object to add the missing data that will be logged using the log format V2 * @returns an Observables that resolves with the result of the http-request * to the Partium backend */ sendCSARequest(message: string, language: string, searchOutput?: SearchOutput, part?: Part, additionalAssets?: string[], ecrEventContext?: ECREventContext): Observable; /** * Will trigger loading the information of all CSA-requests from the backend. * * @param paginationSize the size of page when fetching the csaRequests * (optional) * @param urlParams the params to be passed to the request for filtered results * (optional) * @returns observable that emits when all csa-requests were loaded from the * backend. */ getCSARequests(paginationSize?: number, urlParams?: Array): PaginatedRequestService; /** * Will trigger loading the multiple search data linked to a CSA-requests from the backend. * @param csaRequestId the id of the csa request linked to the multiple searches * @returns observable of type MultipleExpertSearches that emits when all from the * backend. */ getMultipleExpertSearches(csaRequestId: string): Observable; /** * Will link a search session to an ECR * @param csaRequestId the id of the csa request * @param searchSessionId the id of the searchSession to be linked to the CSARequest * @returns observable of type CSARequestSearch */ associateExpertSearchToCsaRequest(csaRequestId: string, searchSessionId: string): Observable; /** * Will set the abandoned status of a search session related to an ECR. It can be true or false. * @param csaRequestId the id of the csa request * @param searchSessionId the id of the searchSession to be unlinked to the CSARequest * @param abandoned boolean value that sets whether the state of the search linked to the CSARequest is true or false. Being true, linked while false is unlinked * @returns observable of type CSARequestSearch */ setExpertSearchAbandoned(csaRequestId: string, searchSessionId: string, abandoned: boolean): Observable; /** * Will update the quantity of the CSARequest. * * @param csaRequestId id of the request to be updated * (optional) * @param quantity the new quantity of the request * (optional) * @returns observable that emits when the updated csa-request */ updateCSARequestQuantity(csaRequestId: string, quantity: number): Observable; /** * Will trigger loading the information of the requested CSA-request from the backend. * * @param csaRequestId id of the CSA-request to load * @returns observable that emits the csa-request is loaded from the backend. */ getCSARequest(csaRequestId: string): Observable; /** * Set the status of a CSA-request as open. * Should be called when a CSA-agent first looked at the CSA-request. * * @param csaRequestId id of the CSA-request to set as open * @returns observable that emits a CSARequestStatus object. */ openCSARequest(csaRequestId: string): Observable; /** * Resolve a CSA-request with the correct part that was requested. * * @param csaRequestId id of the CSA-request to resolve * @param partId id of the correct part * @returns observable that emits a CSARequestStatus object. */ resolveCSARequest(csaRequestId: string, partId: string): Observable; /** * Will mark the CSA-request as not resolved. * Should be called, if the CSA-request could not be resolved * * @param csaRequestId id of the CSA-request that could not be resolved * @returns observable that emits a CSARequestStatus object. */ markNotResolvedCSARequest(csaRequestId: string): Observable; } export declare class CustomerServiceAssistanceServiceImpl extends BaseLoginInitService implements CustomerServiceAssistanceService { private MAX_RESULT_LIST_LENGTH; private httpsService; private assemblyHierarchyNodeService; private logService; constructor(serviceProvider: ServiceProvider); onCreate(): void; /** * Initializes the CustomerServiceAssistanceService * * Note: Should be called at the start of a session */ init(config: PartiumConfig, userEmail: string, currentOrganization$: Observable): Observable; sendCSARequest(message: string, language: string, searchOutput?: SearchOutput, part?: Part, additionalAssets?: string[], ecrEventContext?: ECREventContext): Observable; resolveCSARequest(csaRequestId: string, partId: string): Observable; private sendRequestInternal; private sendBackendRequest; private createRequestData; getCSARequests(paginationSize?: number, urlParams?: any[]): PaginatedRequestService; getMultipleExpertSearches(csaRequestId: string): Observable; setExpertSearchAbandoned(csaRequestId: string, searchSessionId: string, abandoned?: boolean): Observable; associateExpertSearchToCsaRequest(csaRequestId: string, searchSessionId: string): Observable; getCSARequest(csaRequestId: string): Observable; openCSARequest(csaRequestId: string): Observable; markNotResolvedCSARequest(csaRequestId: string): Observable; /** * Will update the quantity of the CSARequest. * * @param requestId id of the request to be updated * (optional) * @param quantity the new quantity of the request * (optional) * @returns observable that emits when the updated csa-request */ updateCSARequestQuantity(csaRequestId: string, quantity: number): Observable; /** * Load the requested CSA-requests from the server. * * @param csaRequestId the partium-ids of the CSA-request to fetch */ private loadCSARequestFromServer; /** * Ensure that fore every available text-search-type we send a value or ''. This is required to distinguish on the * backend-side, whether an smms-search was performed or not. */ private prepareSearchQueriesObj; } export {};