@foisit/angular-wrapper 1.2.0 β†’ 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +44 -162
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,88 +1,42 @@
1
- # πŸŽ™οΈ Foisit Angular Wrapper: Speak, and it’s Done.
1
+ # @foisit/angular-wrapper
2
2
 
3
- The **Foisit Angular Wrapper** brings voice interactivity to your Angular apps with the power of the **Foisit Assistant**. Imagine saying "background red" and watching your app come aliveβ€”now that's ✨magic✨!
3
+ Power your Angular apps with an AI-driven text assistant.
4
4
 
5
- ### **Why Foisit Angular Wrapper?**
6
-
7
- - 🧩 **Dynamic Commands**: Add or remove commands on the fly.
8
- - 🎨 **Visual Feedback**: Show visual cues when the assistant is active.
9
- - πŸš€ **Effortless Integration**: Set up voice commands in minutes with minimal code.
10
- - πŸ—£οΈ **Voice Feedback**: Interactive voice responses make the assistant engaging.
11
- - πŸ”„ **Double Activation**: Activate or put the assistant to sleep with a double-tap.
12
-
13
- ### 🌐 **Live Demo**
14
-
15
- πŸŽ‰ [Test the Angular Assistant here!](https://ng-foisit-demo.netlify.app/)
5
+ > [!NOTE]
6
+ > πŸŽ™οΈ **Coming Soon**: Voice recognition and responses are planned for a future release. Current support is focused on text-based interactions and AI intent matching.
16
7
 
17
8
  ---
18
9
 
19
10
  ## πŸš€ Installation
20
11
 
21
- Get started by installing the library:
22
-
23
12
  ```bash
24
13
  npm install @foisit/angular-wrapper
25
14
  ```
26
15
 
27
- or
28
-
29
- ```bash
30
- yarn add @foisit/angular-wrapper
31
- ```
32
-
33
16
  ---
34
17
 
35
- ## πŸ”§ Setup
36
-
37
- Here's how you can integrate the Foisit Assistant into your Angular app in just a few steps:
38
-
39
- ### Step 1: Import the `AssistantModule`
40
-
41
- #### Using `forRoot` in `app.module.ts`
18
+ ## πŸ”§ Basic Setup
42
19
 
43
- ```typescript
44
- import { NgModule } from '@angular/core';
45
- import { BrowserModule } from '@angular/platform-browser';
46
- import { AppComponent } from './app.component';
47
- import { AssistantModule } from '@foisit/angular-wrapper';
20
+ ### 1. Import `AssistantModule`
48
21
 
49
- @NgModule({
50
- declarations: [AppComponent],
51
- imports: [
52
- BrowserModule,
53
- AssistantModule.forRoot({
54
- activationCommand: 'John',
55
- fallbackResponse: 'Sorry, I didn’t understand that.',
56
- commands: [
57
- { command: 'show profile', action: () => console.log('Showing profile...') },
58
- { command: 'log out', action: () => console.log('Logging out...') },
59
- ],
60
- }),
61
- ],
62
- bootstrap: [AppComponent],
63
- })
64
- export class AppModule {}
65
- ```
22
+ Add `AssistantModule.forRoot()` to your `app.config.ts` (for Standalone) or `app.module.ts`.
66
23
 
67
- #### Or Using `app.config.ts` (Latest Versions)
24
+ #### `app.config.ts` (Standalone)
68
25
 
69
26
  ```typescript
70
- import { ApplicationConfig, provideZoneChangeDetection, importProvidersFrom } from '@angular/core';
71
- import { provideRouter } from '@angular/router';
72
- import { appRoutes } from './app.routes';
73
27
  import { AssistantModule } from '@foisit/angular-wrapper';
74
28
 
75
29
  export const appConfig: ApplicationConfig = {
76
30
  providers: [
77
- provideZoneChangeDetection({ eventCoalescing: true }),
78
- provideRouter(appRoutes),
79
31
  importProvidersFrom(
80
32
  AssistantModule.forRoot({
81
- activationCommand: 'John',
82
- fallbackResponse: 'Sorry, I didn’t understand that.',
33
+ enableSmartIntent: true,
34
+ introMessage: 'Welcome! How can I help?',
83
35
  commands: [
84
- { command: 'show profile', action: () => console.log('Showing profile...') },
85
- { command: 'log out', action: () => console.log('Logging out...') },
36
+ {
37
+ command: 'profile',
38
+ action: () => router.navigate(['/profile']),
39
+ },
86
40
  ],
87
41
  })
88
42
  ),
@@ -92,125 +46,53 @@ export const appConfig: ApplicationConfig = {
92
46
 
93
47
  ---
94
48
 
95
- ### Step 2: Interact with the Service πŸ—£οΈ
96
-
97
- Define and remove voice commands and inject the `AssistantService` into your components, start the party by calling `startListening()`.
49
+ ## πŸ›‘οΈ Critical Actions
98
50
 
99
- #### `app.component.ts`
51
+ Commands marked as `critical` will automatically trigger a confirmation flow in the UI.
100
52
 
101
53
  ```typescript
102
- import { Component, signal } from '@angular/core';
103
- import { AssistantService } from '@foisit/angular-wrapper';
104
-
105
- @Component({
106
- selector: 'app-root',
107
- templateUrl: './app.component.html',
108
- styleUrls: ['./app.component.scss'],
109
- })
110
- export class AppComponent {
111
- title = 'Angular Assistant Demo';
112
- color = signal('transparent'); // Reactive color signal
113
-
114
- constructor(private assistantService: AssistantService) {
115
- // Define voice commands
116
- this.assistantService.addCommand('background red', () => {
117
- this.color.set('red');
118
- });
119
-
120
- this.assistantService.addCommand('remove background', () => {
121
- this.color.set('transparent');
122
- });
123
-
124
- this.assistantService.addCommand('sleep', () => {
125
- this.assistantService.stopListening();
126
- });
127
-
128
- // Start listening immediately
129
- this.assistantService.startListening();
130
- }
131
- }
132
- ```
133
-
134
- ---
135
-
136
- ### Step 3: Craft the UI 🎨
137
-
138
- Create a clean UI to showcase your assistant's magic.
139
-
140
- #### `app.component.html`
141
-
142
- ```html
143
- <div
144
- class="content-container"
145
- [ngStyle]="{
146
- 'background-color': color(),
147
- 'padding': '20px'
148
- }"
149
- >
150
- <h1>πŸ§™β€β™‚οΈ Angular Assistant Demo</h1>
151
- <p>Say the magic words to see the assistant in action:</p>
152
- <ul>
153
- <li>πŸŸ₯ Say <strong>"background red"</strong> to make the background red.</li>
154
- <li>πŸ”„ Say <strong>"remove background"</strong> to reset the background.</li>
155
- <li>😴 Say <strong>"sleep"</strong> to put the assistant to rest.</li>
156
- </ul>
157
- <p>🎨 Current Background: <strong>{{ color() }}</strong></p>
158
- </div>
159
- ```
160
-
161
- ---
162
-
163
- ### Step 4: Run the App πŸƒ
164
-
165
- Start your Angular app and watch the magic happen! ✨
166
-
167
- ```bash
168
- ng serve
54
+ const config = {
55
+ commands: [
56
+ {
57
+ command: 'delete post',
58
+ critical: true,
59
+ description: 'permanently delete this post',
60
+ action: () => this.postService.delete(),
61
+ },
62
+ ],
63
+ };
169
64
  ```
170
65
 
171
66
  ---
172
67
 
173
- ## πŸ› οΈ API Reference
68
+ ## 🧠 AI Intent Matching
174
69
 
175
- ### `AssistantConfig`
70
+ Enable `enableSmartIntent: true` to allow the assistant to understand natural language.
176
71
 
177
- Configure your assistant's behavior with this object.
178
-
179
- | Property | Type | Description |
180
- | ------------------- | -------- | ------------------------------------------------- |
181
- | `activationCommand` | `string` | The keyword to wake the assistant. |
182
- | `fallbackResponse` | `string` | The message when a command isn’t recognized. |
183
- | `commands` | `Array` | A list of `{ command: string, action: Function }` |
184
-
185
- ---
186
-
187
- ### πŸ”‘ Service Methods
188
-
189
- | Method | Description |
190
- | ---------------- | --------------------------------------- |
191
- | `addCommand` | Dynamically add a new command. |
192
- | `removeCommand` | Remove an existing command dynamically. |
193
- | `startListening` | Start listening for voice commands. |
194
- | `stopListening` | Stop listening for voice commands. |
72
+ **User says:** _"Go to my profile"_
73
+ **Matched Command:** `{ command: 'profile', keywords: ['account', 'user settings'], ... }`
195
74
 
196
75
  ---
197
76
 
198
- ## 🌟 Features
77
+ ## πŸ› οΈ Service Usage: `AssistantService`
199
78
 
200
- - 🧩 **Dynamic Commands**: Add or remove commands on the fly.
201
- - 🎨 **Visual Feedback**: Show visual cues when the assistant is active.
202
- - πŸš€ **Easy Integration**: Integrate the assistant with just a few lines of code.
203
- - πŸ—£οΈ **Voice Feedback**: The assistant can respond with voice feedback.
204
- - πŸ”„ **Double Activation**: The assistant can be activated with a double-click and also put to sleep with a double-click when active.
79
+ Interact with the assistant dynamically from your components.
205
80
 
206
- ---
81
+ ```typescript
82
+ import { AssistantService } from '@foisit/angular-wrapper';
207
83
 
208
- ## 🀝 Contributing
84
+ @Component({...})
85
+ export class MyComponent {
86
+ constructor(private assistant: AssistantService) {}
209
87
 
210
- Want to make the assistant even better? PRs are welcomed! πŸ™Œ
88
+ addCommand() {
89
+ this.assistant.addCommand('clear', () => this.clearAll());
90
+ }
91
+ }
92
+ ```
211
93
 
212
94
  ---
213
95
 
214
- ## πŸ“„ License
96
+ ## πŸ‘‹ Gesture Activation
215
97
 
216
- This library is licensed under the MIT License.
98
+ Once integrated, a subtle **"Powered by Foisit"** watermark appears. **Double-click** it to open the chat overlay.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foisit/angular-wrapper",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.0.0",
6
6
  "@angular/core": "^19.0.0"