// encore.service.ts
import { Injectable } from '@angular/core';
import Encore, { type PlacementOptions } from '@encorekit/web-sdk';
import { environment } from '../environments/environment';
@Injectable({ providedIn: 'root' })
export class EncoreService {
constructor() {
Encore.configure({ apiKey: environment.encoreApiKey });
}
identify(userId: string): void {
Encore.identify(userId); // replaces the auto-generated anonymous UUID
}
show(placementId: string, options?: PlacementOptions) {
return Encore.placement(placementId, options).show(); // never rejects; branch on result.status
}
}