Lime Web Components API Documentation - v6.24.0
    Preparing search index...

    Interface ProblemProviderAlpha

    Interface that packages implement to provide problems to the platform.

    Providers are responsible for:

    • Storing and managing their own problems
    • Defining problem types with display information
    • Supplying actions users can take on problems
    • Responding to queries from the platform

    The platform aggregates problems from all registered providers.

    Provider implementation

    class EmailProblemProvider implements ProblemProvider {
    id = 'email-integration';
    title = 'Email Integration';
    description = 'Problems related to email sending and delivery';
    icon = 'envelope';

    private types: ProblemType[] = [
    { id: 'delivery-failed', title: 'Delivery Failed' }
    ];

    private statuses: ProblemStatus[] = [
    { id: 'open', title: 'Open' },
    { id: 'resolved', title: 'Resolved' }
    ];

    getTypes(): ProblemType[] { return this.types; }
    getType(type: string): ProblemType | undefined {
    return this.types.find(t => t.id === type);
    }
    getStatuses(): ProblemStatus[] { return this.statuses; }
    getStatus(status: string): ProblemStatus | undefined {
    return this.statuses.find(s => s.id === status);
    }
    // ... implement remaining methods
    }

    Registering a provider

    const repository = platform.get(PlatformServiceName.ProblemRepository);
    repository.registerProvider(new EmailProblemProvider());
    interface ProblemProvider {
        description: string;
        icon: string | Icon;
        id: string;
        title: string;
        get(id: string): Promise<Omit<Problem<unknown>, "providerId">>;
        getActions(problem: Problem): Action<AnyCommand>[];
        getBulkActions?(problems: Problem<unknown>[]): Action<AnyCommand>[];
        getCount(options?: ProblemQueryOptions): Promise<number>;
        getMetadataComponent?(problem: Problem): ComponentDescriptor<unknown>;
        getProblems(
            options?: ProblemQueryOptions,
        ): Promise<Omit<Problem<unknown>, "providerId">[]>;
        getStatus(status: string): ProblemStatus;
        getStatuses(): ProblemStatus[];
        getType(type: string): ProblemType;
        getTypes(): ProblemType[];
        getViews?(problem: Problem): ProblemView[];
    }
    Index

    Properties

    description: string

    Description of what problems this provider handles.

    icon: string | Icon

    Icon representing this provider.

    Can be either a string referencing an icon name from the platform's icon library, or an Icon object with additional properties like color.

    Icon

    id: string

    Unique identifier for this provider.

    Used to identify the provider in the repository and to link problems back to their source. Should be a stable, lowercase identifier using hyphens for word separation (e.g., 'email-integration', 'external-crm-sync').

    The platform uses this id to set Problem.providerId when returning problems to consumers.

    title: string

    Human-readable title for the provider.

    Should clearly identify the source of problems (e.g., 'Email Integration', 'External CRM Sync').

    Methods

    • Alpha

      Retrieves a specific problem by its id.

      Parameters

      • id: string

        The unique identifier of the problem within this provider.

      Returns Promise<Omit<Problem<unknown>, "providerId">>

      A promise resolving to the problem if found, or undefined if no problem with that id exists.

    • Alpha

      Returns available actions for a specific problem.

      Actions allow users to take action on problems (e.g., retry, dismiss, navigate to configuration). Each action wraps a command that executes when triggered.

      Parameters

      • problem: Problem

        The problem to get actions for.

      Returns Action<AnyCommand>[]

      An array of actions available for this problem. Return an empty array [] if no actions are available.

      Action

    • Alpha

      Returns available actions for a selection of problems.

      Bulk actions let users act on multiple problems at once (e.g., retry all failed imports in a single operation). The provider decides which actions make sense across a set of problems and constructs the command payload accordingly.

      When this method is not implemented, the platform does not offer bulk actions for this provider.

      Parameters

      • problems: Problem<unknown>[]

        The selected problems to get bulk actions for.

      Returns Action<AnyCommand>[]

      An array of actions available for the selection. Return an empty array [] if no bulk actions apply.

      getBulkActions(problems: Problem[]): Action[] {
      const messageIds = problems
      .map(p => p.id);

      if (messageIds.length === 0) {
      return [];
      }

      const command = new BulkRetryImportCommand();
      command.messageIds = messageIds;

      return [
      {
      label: 'Retry import',
      icon: 'refresh',
      command: command,
      },
      ];
      }
    • Alpha

      Returns the count of problems matching the query options.

      Should return the total count of matching problems, not affected by pagination (limit/offset).

      Parameters

      • Optionaloptions: ProblemQueryOptions

        Query options for filtering. Pagination options (limit/offset) should be ignored when counting.

      Returns Promise<number>

      A promise resolving to the number of matching problems.

    • Alpha

      Returns a web component descriptor for rendering custom metadata in the problem detail dialog.

      The component is responsible for rendering the problem's Problem.metadata. Any properties specified in ComponentDescriptor.props are set on the created element.

      When this method is not implemented or returns undefined, the detail dialog renders without a metadata section.

      Parameters

      • problem: Problem

        The problem whose metadata should be rendered.

      Returns ComponentDescriptor<unknown>

      A component descriptor, or undefined if no custom metadata rendering is needed for this problem.

      getMetadataComponent(problem: Problem): ComponentDescriptor | undefined {
      if (problem.type === 'delivery-failed') {
      return {
      name: 'email-delivery-metadata',
      props: { problem },
      };
      }

      return undefined;
      }
    • Alpha

      Retrieves problems from this provider.

      Implement filtering based on the provided options where supported. Unsupported filters should be silently ignored.

      Parameters

      • Optionaloptions: ProblemQueryOptions

        Query options for filtering and pagination. All properties are optional. Providers should handle what they support and ignore the rest.

      Returns Promise<Omit<Problem<unknown>, "providerId">[]>

      A promise resolving to an array of problems matching the query.

    • Alpha

      Returns all statuses supported by this provider.

      Used by the platform to render status filters and understand the provider's workflow.

      Returns ProblemStatus[]

      An array of all statuses this provider uses. Return an empty array [] if this provider doesn't track status.

    • Alpha

      Returns display information for a problem type.

      Problem types are provider-specific identifiers (e.g., 'delivery-failed', 'connection-error'). This method provides the human-readable title, description, and icon for each type.

      Parameters

      Returns ProblemType

      Display information for the type, or undefined if the type is not recognized by this provider.

    • Alpha

      Returns all problem types supported by this provider.

      Used by the platform to render type filters and understand the provider's problem categories.

      Returns ProblemType[]

      An array of all problem types this provider can produce.

    • Alpha

      Returns additional views to display in the problem detail dialog.

      Each view appears alongside the default detail panel. The provider controls the label and rendered component for every view; the platform decides how to present them (tabs, panels, etc.).

      When this method is not implemented or returns an empty array, the detail dialog renders without additional views.

      Parameters

      • problem: Problem

        The problem being viewed in the detail dialog.

      Returns ProblemView[]

      An array of view descriptors. Return an empty array [] if no additional views are needed for this problem.

      getViews(problem: Problem): ProblemView[] {
      return [
      {
      id: 'raw-email',
      label: 'Raw Email',
      icon: 'email',
      component: {
      name: 'email-raw-content',
      props: { problem },
      },
      },
      {
      id: 'audit-log',
      label: 'Audit Log',
      icon: { name: 'history', color: 'gray' },
      component: {
      name: 'email-audit-log',
      props: { problemId: problem.id },
      },
      },
      ];
      }