@angularai/smart-notify
v0.0.3
Published
<div align="center"> <h1>@angularai/smart-notify</h1> <p>π Intelligent notification system for Angular applications</p>
Readme
Overview
@angularai/smart-notify provides an intelligent notification system for Angular applications. Features AI-powered message optimization, smart timing, and context-aware notifications.
β¨ Features
- π§ AI-Optimized Messages: Improve notification clarity with AI
- β° Smart Timing: Optimal notification timing based on user behavior
- π― Context-Aware: Notifications adapt to user context
- π± Multi-Channel: Toast, push, email notification support
- π¨ Customizable: Flexible styling and positioning
- π§ Fully Typed: Complete TypeScript support
π¦ Installation
npm install @angularai/smart-notify @angularai/coreπ Quick Start
1. Import the Service
import { Component, inject } from '@angular/core';
import { SmartNotifyService } from '@angularai/smart-notify';
@Component({
selector: 'app-example',
template: `
<button (click)="showSuccess()">Show Success</button>
<button (click)="showError()">Show Error</button>
`
})
export class ExampleComponent {
private notify = inject(SmartNotifyService);
showSuccess() {
this.notify.success('Operation completed successfully!');
}
showError() {
this.notify.error('Something went wrong. Please try again.');
}
}2. Add the Container Component
import { Component } from '@angular/core';
import { NotificationContainerComponent } from '@angularai/smart-notify';
@Component({
selector: 'app-root',
standalone: true,
imports: [NotificationContainerComponent],
template: `
<notification-container position="top-right" />
<router-outlet />
`
})
export class AppComponent {}π API Reference
SmartNotifyService
@Injectable({ providedIn: 'root' })
export class SmartNotifyService {
// Show success notification
success(message: string, options?: NotifyOptions): void;
// Show error notification
error(message: string, options?: NotifyOptions): void;
// Show warning notification
warning(message: string, options?: NotifyOptions): void;
// Show info notification
info(message: string, options?: NotifyOptions): void;
// AI-optimized notification
smart(message: string, options?: SmartNotifyOptions): void;
// Clear all notifications
clear(): void;
}NotifyOptions Interface
interface NotifyOptions {
duration?: number; // Auto-dismiss time in ms
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
dismissible?: boolean;
icon?: string;
action?: { label: string; callback: () => void };
}NotificationContainerComponent
Inputs
| Input | Type | Default | Description |
|-------|------|---------|-------------|
| position | string | 'top-right' | Container position |
| maxNotifications | number | 5 | Max visible notifications |
| animationDuration | number | 300 | Animation duration in ms |
π§ Advanced Usage
AI-Optimized Notifications
import { Component, inject } from '@angular/core';
import { SmartNotifyService } from '@angularai/smart-notify';
@Component({ ... })
export class SmartNotifyComponent {
private notify = inject(SmartNotifyService);
showSmartNotification() {
// AI will optimize the message for clarity
this.notify.smart('ur order is procesing pls wait', {
provider: 'openai',
apiKey: 'your-api-key',
optimize: true
});
// Result: "Your order is being processed. Please wait."
}
}π¦ Related Packages
| Package | Description | |---------|-------------| | @angularai/core | Core AI functionality | | @angularai/emotion-ui | Emotion-aware UI |
π Related Projects
| Framework | Repository | Status | |-----------|-----------|--------| | Vue.js | @aivue | β Available | | React | @anthropic-ai/react | β Available | | Angular | @angularai | β Available | | Svelte | @svelteai | π‘ Planned |
π License
MIT Β© AngularAI
