@dorydaniel/ai-banking-assistant-lib 0.0.3 → 0.0.4
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.
- package/esm2022/dorydaniel-ai-banking-assistant-lib.mjs +5 -0
- package/esm2022/lib/ai-banking-assistant-lib.component.mjs +72 -0
- package/esm2022/lib/ai-banking-assistant-lib.service.mjs +14 -0
- package/esm2022/public-api.mjs +6 -0
- package/fesm2022/dorydaniel-ai-banking-assistant-lib.mjs +95 -0
- package/fesm2022/dorydaniel-ai-banking-assistant-lib.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/ai-banking-assistant-lib.component.d.ts +14 -0
- package/lib/ai-banking-assistant-lib.service.d.ts +6 -0
- package/package.json +16 -3
- package/{src/public-api.ts → public-api.d.ts} +0 -4
- package/ng-package.json +0 -7
- package/src/lib/ai-banking-assistant-lib.component.html +0 -26
- package/src/lib/ai-banking-assistant-lib.component.spec.ts +0 -23
- package/src/lib/ai-banking-assistant-lib.component.ts +0 -77
- package/src/lib/ai-banking-assistant-lib.service.spec.ts +0 -16
- package/src/lib/ai-banking-assistant-lib.service.ts +0 -9
- package/src/styles.scss +0 -35
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public-api';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9yeWRhbmllbC1haS1iYW5raW5nLWFzc2lzdGFudC1saWIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wcm9qZWN0cy9haS1iYW5raW5nLWFzc2lzdGFudC1saWIvc3JjL2RvcnlkYW5pZWwtYWktYmFua2luZy1hc3Npc3RhbnQtbGliLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { Component, inject, Input } from '@angular/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class AiBankingAssistantLibComponent {
|
|
5
|
+
username = '';
|
|
6
|
+
transactionsUrl = '';
|
|
7
|
+
transactionRequest = {};
|
|
8
|
+
http = inject(HttpClient);
|
|
9
|
+
conversation = [
|
|
10
|
+
{
|
|
11
|
+
from: 'bot',
|
|
12
|
+
text: 'Hello! How can I assist you with your banking needs today?',
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
textareaKeydown(event) {
|
|
16
|
+
if (event.key === 'Enter') {
|
|
17
|
+
// Check if the Shift key was also held down
|
|
18
|
+
if (event.shiftKey) {
|
|
19
|
+
// Shift+Enter: Allow the default behavior (new line)
|
|
20
|
+
// No need to preventDefault();
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// Enter only: Prevent the default behavior (new line)
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
// Submit the form
|
|
26
|
+
this.conversation.push({
|
|
27
|
+
from: 'user',
|
|
28
|
+
text: event.target.value,
|
|
29
|
+
});
|
|
30
|
+
// // Clear the textarea after submission
|
|
31
|
+
// (event.target as HTMLTextAreaElement).value = '';
|
|
32
|
+
// (event.target as HTMLTextAreaElement).scrollTo(
|
|
33
|
+
// 0,
|
|
34
|
+
// (event.target as HTMLTextAreaElement).scrollHeight,
|
|
35
|
+
// );
|
|
36
|
+
if (event.target.value.toLowerCase() ===
|
|
37
|
+
'transactions') {
|
|
38
|
+
this.conversation.push({
|
|
39
|
+
from: 'bot',
|
|
40
|
+
text: 'Here are your recent transactions:',
|
|
41
|
+
});
|
|
42
|
+
this.http
|
|
43
|
+
.post(this.transactionsUrl, this.transactionRequest)
|
|
44
|
+
.subscribe((data) => {
|
|
45
|
+
data.forEach((tx) => {
|
|
46
|
+
this.conversation.push({
|
|
47
|
+
from: 'bot',
|
|
48
|
+
text: `- ${tx.description}: $${tx.amount.toFixed(2)}`,
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Clear the textarea after submission
|
|
54
|
+
event.target.value = '';
|
|
55
|
+
event.target.scrollTo(0, event.target.scrollHeight);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AiBankingAssistantLibComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
60
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: AiBankingAssistantLibComponent, isStandalone: true, selector: "lib-ai-banking-assistant-lib", inputs: { username: "username", transactionsUrl: "transactionsUrl", transactionRequest: "transactionRequest" }, ngImport: i0, template: "<div\n class=\"main-container text-white d-flex flex-column justify-content-between p-4\"\n>\n <h1 class=\"m-0\">Welcome {{ username }}!</h1>\n\n <div class=\"px-5 pt-5\">\n <div class=\"conversation-view p-3 mb-3\">\n @for (message of conversation; track $index) {\n <div\n class=\"p-2 {{\n message.from === 'user'\n ? 'float-end text-end user-message'\n : 'float-start text-start'\n }}\"\n >\n {{ message.text }}\n </div>\n }\n </div>\n <textarea\n class=\"rounded-4 w-100 p-3\"\n placeholder=\"Tell me what you need...\"\n (keydown)=\"textareaKeydown($event)\"\n ></textarea>\n </div>\n</div>\n", styles: [".main-container{min-height:400px;height:100%;background:linear-gradient(180deg,#6a2bd6,#2e0458)}.main-container .conversation-view{max-height:300px;overflow-y:auto}.main-container .conversation-view .user-message{width:75%}.main-container textarea{background-color:#290050;color:#fff;border:none;field-sizing:content;min-height:3lh;max-height:6lh;resize:none}.main-container textarea::placeholder{color:#d3d3d3}.main-container textarea:focus-visible{outline:none}\n"] });
|
|
61
|
+
}
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AiBankingAssistantLibComponent, decorators: [{
|
|
63
|
+
type: Component,
|
|
64
|
+
args: [{ selector: 'lib-ai-banking-assistant-lib', standalone: true, imports: [], template: "<div\n class=\"main-container text-white d-flex flex-column justify-content-between p-4\"\n>\n <h1 class=\"m-0\">Welcome {{ username }}!</h1>\n\n <div class=\"px-5 pt-5\">\n <div class=\"conversation-view p-3 mb-3\">\n @for (message of conversation; track $index) {\n <div\n class=\"p-2 {{\n message.from === 'user'\n ? 'float-end text-end user-message'\n : 'float-start text-start'\n }}\"\n >\n {{ message.text }}\n </div>\n }\n </div>\n <textarea\n class=\"rounded-4 w-100 p-3\"\n placeholder=\"Tell me what you need...\"\n (keydown)=\"textareaKeydown($event)\"\n ></textarea>\n </div>\n</div>\n", styles: [".main-container{min-height:400px;height:100%;background:linear-gradient(180deg,#6a2bd6,#2e0458)}.main-container .conversation-view{max-height:300px;overflow-y:auto}.main-container .conversation-view .user-message{width:75%}.main-container textarea{background-color:#290050;color:#fff;border:none;field-sizing:content;min-height:3lh;max-height:6lh;resize:none}.main-container textarea::placeholder{color:#d3d3d3}.main-container textarea:focus-visible{outline:none}\n"] }]
|
|
65
|
+
}], propDecorators: { username: [{
|
|
66
|
+
type: Input
|
|
67
|
+
}], transactionsUrl: [{
|
|
68
|
+
type: Input
|
|
69
|
+
}], transactionRequest: [{
|
|
70
|
+
type: Input
|
|
71
|
+
}] } });
|
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWktYmFua2luZy1hc3Npc3RhbnQtbGliLmNvbXBvbmVudC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HVlID0gJyc7XG4gICAgICAgIC8vIChldmVudC50YXJnZXQgYXMgSFRNTFRleHRBcmVhRWxlbWVudCkuc2Nyb2xsVG8oXG4gICAgICAgIC8vICAgMCxcbiAgICAgICAgLy8gICAoZXZlbnQudGFyZ2V0IGFzIEhUTUxUZXh0QXJlYUVsZW1lbnQpLnNjcm9sbEhlaWdodCxcbiAgICAgICAgLy8gKTtcblxuICAgICAgICBpZiAoXG4gICAgICAgICAgKGV2ZW50LnRhcmdldCBhcyBIVE1MVGV4dEFyZWFFbGVtZW50KS52YWx1ZS50b0xvd2VyQ2FzZSgpID09PVxuICAgICAgICAgICd0cmFuc2FjdGlvbnMnXG4gICAgICAgICkge1xuICAgICAgICAgIHRoaXMuY29udmVyc2F0aW9uLnB1c2goe1xuICAgICAgICAgICAgZnJvbTogJ2JvdCcsXG4gICAgICAgICAgICB0ZXh0OiAnSGVyZSBhcmUgeW91ciByZWNlbnQgdHJhbnNhY3Rpb25zOicsXG4gICAgICAgICAgfSk7XG4gICAgICAgICAgdGhpcy5odHRwXG4gICAgICAgICAgICAucG9zdDxcbiAgICAgICAgICAgICAgeyBhbW91bnQ6IG51bWJlcjsgZGVzY3JpcHRpb246IHN0cmluZyB9W11cbiAgICAgICAgICAgID4odGhpcy50cmFuc2FjdGlvbnNVcmwsIHRoaXMudHJhbnNhY3Rpb25SZXF1ZXN0KVxuICAgICAgICAgICAgLnN1YnNjcmliZSgoZGF0YSkgPT4ge1xuICAgICAgICAgICAgICBkYXRhLmZvckVhY2goKHR4KSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5jb252ZXJzYXRpb24ucHVzaCh7XG4gICAgICAgICAgICAgICAgICBmcm9tOiAnYm90JyxcbiAgICAgICAgICAgICAgICAgIHRleHQ6IGAtICR7dHguZGVzY3JpcHRpb259OiAkJHt0eC5hbW91bnQudG9GaXhlZCgyKX1gLFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH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iAgICA8L2Rpdj5cbiAgICA8dGV4dGFyZWFcbiAgICAgIGNsYXNzPVwicm91bmRlZC00IHctMTAwIHAtM1wiXG4gICAgICBwbGFjZWhvbGRlcj1cIlRlbGwgbWUgd2hhdCB5b3UgbmVlZC4uLlwiXG4gICAgICAoa2V5ZG93bik9XCJ0ZXh0YXJlYUtleWRvd24oJGV2ZW50KVwiXG4gICAgPjwvdGV4dGFyZWE+XG4gIDwvZGl2PlxuPC9kaXY+XG4iXX0=
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export class AiBankingAssistantLibService {
|
|
4
|
+
constructor() { }
|
|
5
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AiBankingAssistantLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AiBankingAssistantLibService, providedIn: 'root' });
|
|
7
|
+
}
|
|
8
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AiBankingAssistantLibService, decorators: [{
|
|
9
|
+
type: Injectable,
|
|
10
|
+
args: [{
|
|
11
|
+
providedIn: 'root'
|
|
12
|
+
}]
|
|
13
|
+
}], ctorParameters: () => [] });
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWktYmFua2luZy1hc3Npc3RhbnQtbGliLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9haS1iYW5raW5nLWFzc2lzdGFudC1saWIvc3JjL2xpYi9haS1iYW5raW5nLWFzc2lzdGFudC1saWIuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDOztBQUszQyxNQUFNLE9BQU8sNEJBQTRCO0lBRXZDLGdCQUFnQixDQUFDO3dHQUZOLDRCQUE0Qjs0R0FBNUIsNEJBQTRCLGNBRjNCLE1BQU07OzRGQUVQLDRCQUE0QjtrQkFIeEMsVUFBVTttQkFBQztvQkFDVixVQUFVLEVBQUUsTUFBTTtpQkFDbkIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBJbmplY3RhYmxlIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5cbkBJbmplY3RhYmxlKHtcbiAgcHJvdmlkZWRJbjogJ3Jvb3QnXG59KVxuZXhwb3J0IGNsYXNzIEFpQmFua2luZ0Fzc2lzdGFudExpYlNlcnZpY2Uge1xuXG4gIGNvbnN0cnVjdG9yKCkgeyB9XG59XG4iXX0=
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of ai-banking-assistant-lib
|
|
3
|
+
*/
|
|
4
|
+
export * from './lib/ai-banking-assistant-lib.service';
|
|
5
|
+
export * from './lib/ai-banking-assistant-lib.component';
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2FpLWJhbmtpbmctYXNzaXN0YW50LWxpYi9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsd0NBQXdDLENBQUM7QUFDdkQsY0FBYywwQ0FBMEMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2YgYWktYmFua2luZy1hc3Npc3RhbnQtbGliXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvYWktYmFua2luZy1hc3Npc3RhbnQtbGliLnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvYWktYmFua2luZy1hc3Npc3RhbnQtbGliLmNvbXBvbmVudCc7XG4iXX0=
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, inject, Component, Input } from '@angular/core';
|
|
3
|
+
import { HttpClient } from '@angular/common/http';
|
|
4
|
+
|
|
5
|
+
class AiBankingAssistantLibService {
|
|
6
|
+
constructor() { }
|
|
7
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AiBankingAssistantLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AiBankingAssistantLibService, providedIn: 'root' });
|
|
9
|
+
}
|
|
10
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AiBankingAssistantLibService, decorators: [{
|
|
11
|
+
type: Injectable,
|
|
12
|
+
args: [{
|
|
13
|
+
providedIn: 'root'
|
|
14
|
+
}]
|
|
15
|
+
}], ctorParameters: () => [] });
|
|
16
|
+
|
|
17
|
+
class AiBankingAssistantLibComponent {
|
|
18
|
+
username = '';
|
|
19
|
+
transactionsUrl = '';
|
|
20
|
+
transactionRequest = {};
|
|
21
|
+
http = inject(HttpClient);
|
|
22
|
+
conversation = [
|
|
23
|
+
{
|
|
24
|
+
from: 'bot',
|
|
25
|
+
text: 'Hello! How can I assist you with your banking needs today?',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
textareaKeydown(event) {
|
|
29
|
+
if (event.key === 'Enter') {
|
|
30
|
+
// Check if the Shift key was also held down
|
|
31
|
+
if (event.shiftKey) {
|
|
32
|
+
// Shift+Enter: Allow the default behavior (new line)
|
|
33
|
+
// No need to preventDefault();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
// Enter only: Prevent the default behavior (new line)
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
// Submit the form
|
|
39
|
+
this.conversation.push({
|
|
40
|
+
from: 'user',
|
|
41
|
+
text: event.target.value,
|
|
42
|
+
});
|
|
43
|
+
// // Clear the textarea after submission
|
|
44
|
+
// (event.target as HTMLTextAreaElement).value = '';
|
|
45
|
+
// (event.target as HTMLTextAreaElement).scrollTo(
|
|
46
|
+
// 0,
|
|
47
|
+
// (event.target as HTMLTextAreaElement).scrollHeight,
|
|
48
|
+
// );
|
|
49
|
+
if (event.target.value.toLowerCase() ===
|
|
50
|
+
'transactions') {
|
|
51
|
+
this.conversation.push({
|
|
52
|
+
from: 'bot',
|
|
53
|
+
text: 'Here are your recent transactions:',
|
|
54
|
+
});
|
|
55
|
+
this.http
|
|
56
|
+
.post(this.transactionsUrl, this.transactionRequest)
|
|
57
|
+
.subscribe((data) => {
|
|
58
|
+
data.forEach((tx) => {
|
|
59
|
+
this.conversation.push({
|
|
60
|
+
from: 'bot',
|
|
61
|
+
text: `- ${tx.description}: $${tx.amount.toFixed(2)}`,
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// Clear the textarea after submission
|
|
67
|
+
event.target.value = '';
|
|
68
|
+
event.target.scrollTo(0, event.target.scrollHeight);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AiBankingAssistantLibComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
73
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: AiBankingAssistantLibComponent, isStandalone: true, selector: "lib-ai-banking-assistant-lib", inputs: { username: "username", transactionsUrl: "transactionsUrl", transactionRequest: "transactionRequest" }, ngImport: i0, template: "<div\n class=\"main-container text-white d-flex flex-column justify-content-between p-4\"\n>\n <h1 class=\"m-0\">Welcome {{ username }}!</h1>\n\n <div class=\"px-5 pt-5\">\n <div class=\"conversation-view p-3 mb-3\">\n @for (message of conversation; track $index) {\n <div\n class=\"p-2 {{\n message.from === 'user'\n ? 'float-end text-end user-message'\n : 'float-start text-start'\n }}\"\n >\n {{ message.text }}\n </div>\n }\n </div>\n <textarea\n class=\"rounded-4 w-100 p-3\"\n placeholder=\"Tell me what you need...\"\n (keydown)=\"textareaKeydown($event)\"\n ></textarea>\n </div>\n</div>\n", styles: [".main-container{min-height:400px;height:100%;background:linear-gradient(180deg,#6a2bd6,#2e0458)}.main-container .conversation-view{max-height:300px;overflow-y:auto}.main-container .conversation-view .user-message{width:75%}.main-container textarea{background-color:#290050;color:#fff;border:none;field-sizing:content;min-height:3lh;max-height:6lh;resize:none}.main-container textarea::placeholder{color:#d3d3d3}.main-container textarea:focus-visible{outline:none}\n"] });
|
|
74
|
+
}
|
|
75
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AiBankingAssistantLibComponent, decorators: [{
|
|
76
|
+
type: Component,
|
|
77
|
+
args: [{ selector: 'lib-ai-banking-assistant-lib', standalone: true, imports: [], template: "<div\n class=\"main-container text-white d-flex flex-column justify-content-between p-4\"\n>\n <h1 class=\"m-0\">Welcome {{ username }}!</h1>\n\n <div class=\"px-5 pt-5\">\n <div class=\"conversation-view p-3 mb-3\">\n @for (message of conversation; track $index) {\n <div\n class=\"p-2 {{\n message.from === 'user'\n ? 'float-end text-end user-message'\n : 'float-start text-start'\n }}\"\n >\n {{ message.text }}\n </div>\n }\n </div>\n <textarea\n class=\"rounded-4 w-100 p-3\"\n placeholder=\"Tell me what you need...\"\n (keydown)=\"textareaKeydown($event)\"\n ></textarea>\n </div>\n</div>\n", styles: [".main-container{min-height:400px;height:100%;background:linear-gradient(180deg,#6a2bd6,#2e0458)}.main-container .conversation-view{max-height:300px;overflow-y:auto}.main-container .conversation-view .user-message{width:75%}.main-container textarea{background-color:#290050;color:#fff;border:none;field-sizing:content;min-height:3lh;max-height:6lh;resize:none}.main-container textarea::placeholder{color:#d3d3d3}.main-container textarea:focus-visible{outline:none}\n"] }]
|
|
78
|
+
}], propDecorators: { username: [{
|
|
79
|
+
type: Input
|
|
80
|
+
}], transactionsUrl: [{
|
|
81
|
+
type: Input
|
|
82
|
+
}], transactionRequest: [{
|
|
83
|
+
type: Input
|
|
84
|
+
}] } });
|
|
85
|
+
|
|
86
|
+
/*
|
|
87
|
+
* Public API Surface of ai-banking-assistant-lib
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Generated bundle index. Do not edit.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
export { AiBankingAssistantLibComponent, AiBankingAssistantLibService };
|
|
95
|
+
//# sourceMappingURL=dorydaniel-ai-banking-assistant-lib.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dorydaniel-ai-banking-assistant-lib.mjs","sources":["../../../projects/ai-banking-assistant-lib/src/lib/ai-banking-assistant-lib.service.ts","../../../projects/ai-banking-assistant-lib/src/lib/ai-banking-assistant-lib.component.ts","../../../projects/ai-banking-assistant-lib/src/lib/ai-banking-assistant-lib.component.html","../../../projects/ai-banking-assistant-lib/src/public-api.ts","../../../projects/ai-banking-assistant-lib/src/dorydaniel-ai-banking-assistant-lib.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AiBankingAssistantLibService {\n\n constructor() { }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Component, inject, Input } from '@angular/core';\n\n@Component({\n selector: 'lib-ai-banking-assistant-lib',\n standalone: true,\n imports: [],\n templateUrl: './ai-banking-assistant-lib.component.html',\n styleUrls: ['../styles.scss'],\n})\nexport class AiBankingAssistantLibComponent {\n @Input() username: string = '';\n @Input() transactionsUrl: string = '';\n @Input() transactionRequest: any = {};\n\n private http = inject(HttpClient);\n\n conversation = [\n {\n from: 'bot',\n text: 'Hello! How can I assist you with your banking needs today?',\n },\n ];\n\n textareaKeydown(event: KeyboardEvent) {\n if (event.key === 'Enter') {\n // Check if the Shift key was also held down\n if (event.shiftKey) {\n // Shift+Enter: Allow the default behavior (new line)\n // No need to preventDefault();\n } else {\n // Enter only: Prevent the default behavior (new line)\n event.preventDefault();\n // Submit the form\n this.conversation.push({\n from: 'user',\n text: (event.target as HTMLTextAreaElement).value,\n });\n // // Clear the textarea after submission\n // (event.target as HTMLTextAreaElement).value = '';\n // (event.target as HTMLTextAreaElement).scrollTo(\n // 0,\n // (event.target as HTMLTextAreaElement).scrollHeight,\n // );\n\n if (\n (event.target as HTMLTextAreaElement).value.toLowerCase() ===\n 'transactions'\n ) {\n this.conversation.push({\n from: 'bot',\n text: 'Here are your recent transactions:',\n });\n this.http\n .post<\n { amount: number; description: string }[]\n >(this.transactionsUrl, this.transactionRequest)\n .subscribe((data) => {\n data.forEach((tx) => {\n this.conversation.push({\n from: 'bot',\n text: `- ${tx.description}: $${tx.amount.toFixed(2)}`,\n });\n });\n });\n }\n\n // Clear the textarea after submission\n (event.target as HTMLTextAreaElement).value = '';\n (event.target as HTMLTextAreaElement).scrollTo(\n 0,\n (event.target as HTMLTextAreaElement).scrollHeight,\n );\n }\n }\n }\n}\n","<div\n class=\"main-container text-white d-flex flex-column justify-content-between p-4\"\n>\n <h1 class=\"m-0\">Welcome {{ username }}!</h1>\n\n <div class=\"px-5 pt-5\">\n <div class=\"conversation-view p-3 mb-3\">\n @for (message of conversation; track $index) {\n <div\n class=\"p-2 {{\n message.from === 'user'\n ? 'float-end text-end user-message'\n : 'float-start text-start'\n }}\"\n >\n {{ message.text }}\n </div>\n }\n </div>\n <textarea\n class=\"rounded-4 w-100 p-3\"\n placeholder=\"Tell me what you need...\"\n (keydown)=\"textareaKeydown($event)\"\n ></textarea>\n </div>\n</div>\n","/*\n * Public API Surface of ai-banking-assistant-lib\n */\n\nexport * from './lib/ai-banking-assistant-lib.service';\nexport * from './lib/ai-banking-assistant-lib.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAKa,4BAA4B,CAAA;AAEvC,IAAA,WAAA,GAAA,GAAiB;wGAFN,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,4BAA4B,cAF3B,MAAM,EAAA,CAAA,CAAA;;4FAEP,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBAHxC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;MCMY,8BAA8B,CAAA;IAChC,QAAQ,GAAW,EAAE,CAAC;IACtB,eAAe,GAAW,EAAE,CAAC;IAC7B,kBAAkB,GAAQ,EAAE,CAAC;AAE9B,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAElC,IAAA,YAAY,GAAG;AACb,QAAA;AACE,YAAA,IAAI,EAAE,KAAK;AACX,YAAA,IAAI,EAAE,4DAA4D;AACnE,SAAA;KACF,CAAC;AAEF,IAAA,eAAe,CAAC,KAAoB,EAAA;AAClC,QAAA,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;;AAEzB,YAAA,IAAI,KAAK,CAAC,QAAQ,EAAE;;;aAGnB;iBAAM;;gBAEL,KAAK,CAAC,cAAc,EAAE,CAAC;;AAEvB,gBAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;AACrB,oBAAA,IAAI,EAAE,MAAM;A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AA8B,wMCV3C,qtBA0BA,EAAA,MAAA,EAAA,CAAA,mdAAA,CAAA,EAAA,CAAA,CAAA;;4FDhBa,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAP1C,SAAS;+BACE,8BAA8B,EAAA,UAAA,EAC5B,IAAI,EAAA,OAAA,EACP,EAAE,EAAA,QAAA,EAAA,qtBAAA,EAAA,MAAA,EAAA,CAAA,mdAAA,CAAA,EAAA,CAAA;8BAKF,QAAQ,EAAA,CAAA;sBAAhB,KAAK;gBACG,eAAe,EAAA,CAAA;sBAAvB,KAAK;gBACG,kBAAkB,EAAA,CAAA;sBAA1B,KAAK;;;AEbR;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class AiBankingAssistantLibComponent {
|
|
3
|
+
username: string;
|
|
4
|
+
transactionsUrl: string;
|
|
5
|
+
transactionRequest: any;
|
|
6
|
+
private http;
|
|
7
|
+
conversation: {
|
|
8
|
+
from: string;
|
|
9
|
+
text: string;
|
|
10
|
+
}[];
|
|
11
|
+
textareaKeydown(event: KeyboardEvent): void;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AiBankingAssistantLibComponent, never>;
|
|
13
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AiBankingAssistantLibComponent, "lib-ai-banking-assistant-lib", never, { "username": { "alias": "username"; "required": false; }; "transactionsUrl": { "alias": "transactionsUrl"; "required": false; }; "transactionRequest": { "alias": "transactionRequest"; "required": false; }; }, {}, never, never, true, never>;
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dorydaniel/ai-banking-assistant-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^18.2.0",
|
|
6
6
|
"@angular/core": "^18.2.0"
|
|
@@ -8,5 +8,18 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"tslib": "^2.3.0"
|
|
10
10
|
},
|
|
11
|
-
"sideEffects": false
|
|
12
|
-
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/dorydaniel-ai-banking-assistant-lib.mjs",
|
|
13
|
+
"typings": "index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./index.d.ts",
|
|
20
|
+
"esm2022": "./esm2022/dorydaniel-ai-banking-assistant-lib.mjs",
|
|
21
|
+
"esm": "./esm2022/dorydaniel-ai-banking-assistant-lib.mjs",
|
|
22
|
+
"default": "./fesm2022/dorydaniel-ai-banking-assistant-lib.mjs"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
package/ng-package.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<div
|
|
2
|
-
class="main-container text-white d-flex flex-column justify-content-between p-4"
|
|
3
|
-
>
|
|
4
|
-
<h1 class="m-0">Welcome {{ username }}!</h1>
|
|
5
|
-
|
|
6
|
-
<div class="px-5 pt-5">
|
|
7
|
-
<div class="conversation-view p-3 mb-3">
|
|
8
|
-
@for (message of conversation; track $index) {
|
|
9
|
-
<div
|
|
10
|
-
class="p-2 {{
|
|
11
|
-
message.from === 'user'
|
|
12
|
-
? 'float-end text-end user-message'
|
|
13
|
-
: 'float-start text-start'
|
|
14
|
-
}}"
|
|
15
|
-
>
|
|
16
|
-
{{ message.text }}
|
|
17
|
-
</div>
|
|
18
|
-
}
|
|
19
|
-
</div>
|
|
20
|
-
<textarea
|
|
21
|
-
class="rounded-4 w-100 p-3"
|
|
22
|
-
placeholder="Tell me what you need..."
|
|
23
|
-
(keydown)="textareaKeydown($event)"
|
|
24
|
-
></textarea>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { AiBankingAssistantLibComponent } from './ai-banking-assistant-lib.component';
|
|
4
|
-
|
|
5
|
-
describe('AiBankingAssistantLibComponent', () => {
|
|
6
|
-
let component: AiBankingAssistantLibComponent;
|
|
7
|
-
let fixture: ComponentFixture<AiBankingAssistantLibComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [AiBankingAssistantLibComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(AiBankingAssistantLibComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import { Component, inject, Input } from '@angular/core';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'lib-ai-banking-assistant-lib',
|
|
6
|
-
standalone: true,
|
|
7
|
-
imports: [],
|
|
8
|
-
templateUrl: './ai-banking-assistant-lib.component.html',
|
|
9
|
-
styleUrls: ['../styles.scss'],
|
|
10
|
-
})
|
|
11
|
-
export class AiBankingAssistantLibComponent {
|
|
12
|
-
@Input() username: string = '';
|
|
13
|
-
@Input() transactionsUrl: string = '';
|
|
14
|
-
@Input() transactionRequest: any = {};
|
|
15
|
-
|
|
16
|
-
private http = inject(HttpClient);
|
|
17
|
-
|
|
18
|
-
conversation = [
|
|
19
|
-
{
|
|
20
|
-
from: 'bot',
|
|
21
|
-
text: 'Hello! How can I assist you with your banking needs today?',
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
textareaKeydown(event: KeyboardEvent) {
|
|
26
|
-
if (event.key === 'Enter') {
|
|
27
|
-
// Check if the Shift key was also held down
|
|
28
|
-
if (event.shiftKey) {
|
|
29
|
-
// Shift+Enter: Allow the default behavior (new line)
|
|
30
|
-
// No need to preventDefault();
|
|
31
|
-
} else {
|
|
32
|
-
// Enter only: Prevent the default behavior (new line)
|
|
33
|
-
event.preventDefault();
|
|
34
|
-
// Submit the form
|
|
35
|
-
this.conversation.push({
|
|
36
|
-
from: 'user',
|
|
37
|
-
text: (event.target as HTMLTextAreaElement).value,
|
|
38
|
-
});
|
|
39
|
-
// // Clear the textarea after submission
|
|
40
|
-
// (event.target as HTMLTextAreaElement).value = '';
|
|
41
|
-
// (event.target as HTMLTextAreaElement).scrollTo(
|
|
42
|
-
// 0,
|
|
43
|
-
// (event.target as HTMLTextAreaElement).scrollHeight,
|
|
44
|
-
// );
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
(event.target as HTMLTextAreaElement).value.toLowerCase() ===
|
|
48
|
-
'transactions'
|
|
49
|
-
) {
|
|
50
|
-
this.conversation.push({
|
|
51
|
-
from: 'bot',
|
|
52
|
-
text: 'Here are your recent transactions:',
|
|
53
|
-
});
|
|
54
|
-
this.http
|
|
55
|
-
.post<
|
|
56
|
-
{ amount: number; description: string }[]
|
|
57
|
-
>(this.transactionsUrl, this.transactionRequest)
|
|
58
|
-
.subscribe((data) => {
|
|
59
|
-
data.forEach((tx) => {
|
|
60
|
-
this.conversation.push({
|
|
61
|
-
from: 'bot',
|
|
62
|
-
text: `- ${tx.description}: $${tx.amount.toFixed(2)}`,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Clear the textarea after submission
|
|
69
|
-
(event.target as HTMLTextAreaElement).value = '';
|
|
70
|
-
(event.target as HTMLTextAreaElement).scrollTo(
|
|
71
|
-
0,
|
|
72
|
-
(event.target as HTMLTextAreaElement).scrollHeight,
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { AiBankingAssistantLibService } from './ai-banking-assistant-lib.service';
|
|
4
|
-
|
|
5
|
-
describe('AiBankingAssistantLibService', () => {
|
|
6
|
-
let service: AiBankingAssistantLibService;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({});
|
|
10
|
-
service = TestBed.inject(AiBankingAssistantLibService);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should be created', () => {
|
|
14
|
-
expect(service).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|
package/src/styles.scss
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/* You can add global styles to this file, and also import other style files */
|
|
2
|
-
// @import "bootstrap/scss/bootstrap";
|
|
3
|
-
.main-container {
|
|
4
|
-
min-height: 400px;
|
|
5
|
-
height: 100%;
|
|
6
|
-
background: linear-gradient(180deg, #6a2bd6 0%, #2e0458 100%);
|
|
7
|
-
|
|
8
|
-
.conversation-view {
|
|
9
|
-
max-height: 300px;
|
|
10
|
-
overflow-y: auto;
|
|
11
|
-
.user-message {
|
|
12
|
-
width: calc(100% - 25%);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
textarea {
|
|
17
|
-
// resize: none;
|
|
18
|
-
background-color: #290050;
|
|
19
|
-
color: white;
|
|
20
|
-
border: none;
|
|
21
|
-
|
|
22
|
-
field-sizing: content;
|
|
23
|
-
min-height: 3lh; /* Set a minimum height (e.g., 2 lines high) */
|
|
24
|
-
max-height: 6lh; /* Optional: Set a maximum height before a scrollbar appears */
|
|
25
|
-
resize: none; /* Prevents the user from manually resizing with the handle */
|
|
26
|
-
// overflow: hidden; /* Hides the scrollbar initially */
|
|
27
|
-
|
|
28
|
-
&::placeholder {
|
|
29
|
-
color: #d3d3d3;
|
|
30
|
-
}
|
|
31
|
-
&:focus-visible {
|
|
32
|
-
outline: none;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "../../tsconfig.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"outDir": "../../out-tsc/lib",
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": true,
|
|
9
|
-
"inlineSources": true,
|
|
10
|
-
"types": []
|
|
11
|
-
},
|
|
12
|
-
"exclude": [
|
|
13
|
-
"**/*.spec.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
package/tsconfig.lib.prod.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "./tsconfig.lib.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"declarationMap": false
|
|
7
|
-
},
|
|
8
|
-
"angularCompilerOptions": {
|
|
9
|
-
"compilationMode": "partial"
|
|
10
|
-
}
|
|
11
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "../../tsconfig.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"outDir": "../../out-tsc/spec",
|
|
7
|
-
"types": [
|
|
8
|
-
"jasmine"
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"**/*.spec.ts",
|
|
13
|
-
"**/*.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|