// Copyright © 2022-2026 Partium, Inc. DBA Partium import { Observable } from 'rxjs'; import { ServiceProvider } from './service-provider'; import { PartiumConfig } from '../models/partium-config'; import { BaseLoginInitService } from './base-login-init.service'; import { Organization } from './organization/models/organization'; /** * Service that provides functionality to locally store and retrieve a list of recently viewed parts. * The max length of the list can be controlled with the maxPartHistoryLength parameter passed in the Partium config in init. * (only part-ids are stored) */ export interface RecentPartsService { /** * Adds a part to the recent part list * This adds the part to the beginning of the recent parts list. If the part was already contained in the list it is moved to the beginning * * @param partiumPartId id of the recent part */ addRecentPart(partiumPartId: string): Promise; /** * Returns the recent parts partium-ids as array. * It is sorted by when it was added, the first item is the most recent one. * * @return observable that resolves with the array of recent parts partiumIds */ getRecentParts(): Observable; } export declare class RecentPartsServiceImpl extends BaseLoginInitService implements RecentPartsService { private localStorageService; private initialized; private initialized$; private recentPartIds$; private maxPartHistoryLength; constructor(serviceProvider: ServiceProvider); onCreate(): void; /** * Initializes the RecentPartsService: Loads the recent parts from the localstorage * and configures the service based on the passed Partium configuration. * * Note: Should be called at the start of a session * to ensure the correct recent parts are loaded */ init(config: PartiumConfig, userEmail: string, currentOrganization$: Observable): Observable; addRecentPart(partiumPartId: string): Promise; private saveToLocalStorage; getRecentParts(): Observable; private loadRecentPartIds; /** * Loads the recent parts from local storage and returns them. * * @return array that contains the ids of the recent parts loaded from the localstorage */ private getRecentPartIdsFromLocalStorage; /** * Clear memory (not storage) * Called on logout. */ reset(): void; }