Skip to main content

Using plugin settings

The settings property is a dictionary (key: string, value: string) that contains the settings for the plugin that were configured for this environment on the Acuitas Marketplace portal. Here is an example of how to access these settings from your web component:

private _getApiEndpoint(): string {
return this.settings['api-endpoint'] || 'https://api.example.com/v1';
}

private _getApiKey(): string {
return this.settings['api-key'] || '';
}

private async _analyzeImage() {
if (!this.imaging.selectedImage) return;

try {
const response = await fetch(`${this._getApiEndpoint()}/analyze`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${this._getApiKey()}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
imageId: this.imaging.selectedImage.id,
customerId: this.context.customerId,
siteId: this.context.siteId
})
});

const result = await response.json();
// Handle the analysis result
} catch (error) {
console.error('Analysis failed:', error);
}
}