@dataclouder/ngx-lessons 0.0.29 → 0.0.31

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 (50) hide show
  1. package/fesm2022/dataclouder-ngx-lessons.mjs +1205 -514
  2. package/fesm2022/dataclouder-ngx-lessons.mjs.map +1 -1
  3. package/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.d.ts +6 -8
  4. package/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.d.ts +11 -0
  5. package/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.d.ts +39 -38
  6. package/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.d.ts +22 -0
  7. package/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.d.ts +32 -37
  8. package/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.d.ts +7 -17
  9. package/lib/components/lesson-mini-components/components/ComponentBuilder.d.ts +7 -2
  10. package/lib/components/lesson-mini-components/components/lessons.clases.d.ts +17 -42
  11. package/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.d.ts +13 -0
  12. package/lib/components/lesson-mini-components/components/speaker/speaker.component.d.ts +12 -0
  13. package/lib/services/lesson-ai.service.d.ts +18 -0
  14. package/lib/services/lesson-notion.service.d.ts +35 -0
  15. package/lib/services/lesson-utils.service.d.ts +34 -0
  16. package/package.json +3 -2
  17. package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.html +40 -35
  18. package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.scss +15 -2
  19. package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.ts +16 -18
  20. package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.css +1 -0
  21. package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.html +46 -0
  22. package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.ts +52 -0
  23. package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.html +54 -92
  24. package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.ts +268 -230
  25. package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.css +1 -0
  26. package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.html +72 -0
  27. package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.ts +60 -0
  28. package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.html +23 -27
  29. package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.ts +247 -186
  30. package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.ts +2 -2
  31. package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.html +3 -3
  32. package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.ts +28 -46
  33. package/src/lib/components/lesson-mini-components/components/ComponentBuilder.ts +23 -15
  34. package/src/lib/components/lesson-mini-components/components/lessons.clases.ts +32 -66
  35. package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.html +62 -58
  36. package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.ts +2 -2
  37. package/src/lib/components/lesson-mini-components/components/selector/selector.component.html +1 -2
  38. package/src/lib/components/lesson-mini-components/components/selector/selector.component.ts +2 -2
  39. package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.html +5 -27
  40. package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.ts +38 -25
  41. package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.html +9 -7
  42. package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.ts +30 -26
  43. package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.ts +2 -2
  44. package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.ts +2 -2
  45. package/src/lib/services/lesson-ai.service.ts +103 -0
  46. package/src/lib/services/lesson-notion.service.ts +161 -0
  47. package/src/lib/services/lesson-utils.service.ts +181 -0
  48. package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.spec.ts +0 -25
  49. package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.spec.ts +0 -25
  50. package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.spec.ts +0 -25
@@ -1,26 +1,24 @@
1
1
  import { EventEmitter, OnInit } from '@angular/core';
2
2
  import { MenuItem } from 'primeng/api';
3
3
  import { ILesson, ILessonWithTaken } from '../../lesson-mini-components/components/lessons.clases';
4
+ import { OnActionEvent } from '@dataclouder/ngx-core';
4
5
  import * as i0 from "@angular/core";
5
6
  declare enum EventCard {
6
7
  Edit = "edit",
7
- Remove = "remove",
8
- Take = "take",
8
+ Delete = "delete",
9
+ Select = "select",
9
10
  Qr = "qr"
10
11
  }
11
12
  export declare class DcLessonCardComponent implements OnInit {
12
13
  lesson: ILessonWithTaken | ILesson | any;
13
- isAdmin: boolean;
14
- take: EventEmitter<any>;
15
- edit: EventEmitter<any>;
16
- remove: EventEmitter<any>;
17
- qr: EventEmitter<any>;
14
+ showOptions: boolean;
15
+ onAction: EventEmitter<OnActionEvent>;
18
16
  coverUrl: string;
19
17
  eventType: typeof EventCard;
20
18
  items: MenuItem[];
21
19
  ngOnInit(): void;
22
20
  eventCard(eventType: EventCard): void;
23
21
  static ɵfac: i0.ɵɵFactoryDeclaration<DcLessonCardComponent, never>;
24
- static ɵcmp: i0.ɵɵComponentDeclaration<DcLessonCardComponent, "dc-lesson-card", never, { "lesson": { "alias": "lesson"; "required": false; }; "isAdmin": { "alias": "isAdmin"; "required": false; }; }, { "take": "take"; "edit": "edit"; "remove": "remove"; "qr": "qr"; }, never, never, true, never>;
22
+ static ɵcmp: i0.ɵɵComponentDeclaration<DcLessonCardComponent, "dc-lesson-card", never, { "lesson": { "alias": "lesson"; "required": false; }; "showOptions": { "alias": "showOptions"; "required": false; }; }, { "onAction": "onAction"; }, never, never, true, never>;
25
23
  }
26
24
  export {};
@@ -0,0 +1,11 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import { LessonComponentEnum } from '../../lesson-mini-components/components/lessons.clases';
3
+ import * as i0 from "@angular/core";
4
+ export declare class DCLessonComponentAdderComponent {
5
+ #private;
6
+ componentAdded: EventEmitter<any>;
7
+ lessonComponentEnum: typeof LessonComponentEnum;
8
+ openComponentBuilder(type: LessonComponentEnum): void;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<DCLessonComponentAdderComponent, never>;
10
+ static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonComponentAdderComponent, "dc-lesson-component-adder", never, {}, { "componentAdded": "componentAdded"; }, never, never, true, never>;
11
+ }
@@ -1,59 +1,60 @@
1
- import { ChangeDetectorRef, ComponentRef, ElementRef, OnInit, ViewContainerRef } from '@angular/core';
2
- import { ActivatedRoute, Router } from '@angular/router';
3
- import { Observable } from 'rxjs';
1
+ import { ComponentRef, ElementRef, ViewContainerRef } from '@angular/core';
4
2
  import BalloonEditor from '@ckeditor/ckeditor5-build-balloon-block';
5
- import { DialogService } from 'primeng/dynamicdialog';
6
3
  import { StorageImageSettings } from '@dataclouder/ngx-cloud-storage';
7
- import { ToastAlertsAbstractService } from '@dataclouder/ngx-core';
8
- import { LessonComponentEnum, ILesson, LessonComponentInterface, LessonsAbstractService } from '../../lesson-mini-components/components/lessons.clases';
9
- import { NotionAbstractService } from '../../../models/notion.models';
10
- import { MenuItem } from 'primeng/api';
4
+ import { LessonComponentEnum, ILesson, LessonComponentInterface, DynamicContentComponent } from '../../lesson-mini-components/components/lessons.clases';
5
+ import { ComponentBuildData } from '../../lesson-mini-components/components/ComponentBuilder';
11
6
  import * as i0 from "@angular/core";
12
- export declare class DCLessonEditorComponent implements OnInit {
13
- private lessonService;
14
- private toastService;
15
- private notionService;
16
- private _activatedRoute;
17
- private router;
18
- private cdr;
19
- private dialogService;
7
+ export declare class DCLessonEditorComponent {
8
+ #private;
20
9
  target: ViewContainerRef;
21
10
  dhtml: ElementRef;
22
- editor: typeof BalloonEditor;
23
- coverStorageSettings: StorageImageSettings;
24
- lessonComponentEnum: typeof LessonComponentEnum;
25
- lessonId: string;
26
- lesson: any;
11
+ readonly lessonId: import("@angular/core").Signal<string>;
12
+ lesson: import("@angular/core").WritableSignal<ILesson>;
13
+ isCropperVisible: import("@angular/core").WritableSignal<boolean>;
14
+ isLoadingLesson: import("@angular/core").WritableSignal<boolean>;
15
+ coverBackground: import("@angular/core").Signal<string>;
16
+ readonly dynamicComponentsArray: import("@angular/core").Signal<DynamicContentComponent[]>;
27
17
  components: {
28
18
  [key: string]: ComponentRef<LessonComponentInterface>;
29
19
  };
30
- isRendered: boolean;
31
- cover: string;
32
- isCropperVisible: boolean;
33
- items: MenuItem[];
34
- constructor(lessonService: LessonsAbstractService, toastService: ToastAlertsAbstractService, notionService: NotionAbstractService, _activatedRoute: ActivatedRoute, router: Router, cdr: ChangeDetectorRef, dialogService: DialogService);
35
- ngOnInit(): void;
36
- getLessonIfId(): Promise<void>;
37
- updateCover(): void;
20
+ editor: typeof BalloonEditor;
21
+ lessonComponentEnum: typeof LessonComponentEnum;
22
+ coverStorageSettings: StorageImageSettings;
23
+ constructor();
24
+ /**
25
+ * Updates a specific property on the lesson signal.
26
+ * Used for ngModelChange events to simulate two-way binding with signals.
27
+ * @param property The key of the ILesson property to update.
28
+ * @param value The new value for the property.
29
+ */
30
+ updateLessonProperty<K extends keyof ILesson>(property: K, value: ILesson[K]): void;
38
31
  onTagRemove(tag: any): void;
39
32
  onTagAdd(tag: {
40
33
  value: string;
41
34
  input: any;
42
35
  }): void;
43
- saveLesson(event?: Event): Promise<ILesson>;
44
- validateAudios(): Promise<void>;
45
- togleRender(_event?: any): void;
46
- openComponentBuilder(type: string): Observable<any>;
47
- uploadCover(imageUploaded: any): void;
36
+ saveLesson(event?: Event): Promise<ILesson | undefined>;
37
+ /**
38
+ * Handles the event emitted when a component is added via the adder component.
39
+ * @param result The configuration data returned from the component builder dialog. Expected format: { obj: LessonComponentConfiguration }
40
+ */
41
+ onComponentAdded(result: ComponentBuildData): void;
48
42
  openCropper(): void;
49
- isLoadingLesson: boolean;
50
43
  generateByAI(): Promise<void>;
51
- onImageSelected(event: any): void;
44
+ /**
45
+ * Handles the image upload event, updates the lesson signal via the service, and saves.
46
+ * @param event The image upload event data.
47
+ */
52
48
  onImageUploaded(event: any): Promise<void>;
49
+ /**
50
+ * Imports lesson content from Notion using the LessonNotionService.
51
+ */
53
52
  importFromNotion(): Promise<void>;
54
- extractNotionPageId(url: string): string;
55
- linkWithNotion(notionPageId: string): Promise<void>;
53
+ /**
54
+ * Calls the LessonNotionService to improve the lesson using AI based on Notion content.
55
+ */
56
56
  improveNotionWithAI(): Promise<void>;
57
+ showComponentDetails(data: any): void;
57
58
  static ɵfac: i0.ɵɵFactoryDeclaration<DCLessonEditorComponent, never>;
58
59
  static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonEditorComponent, "dc-lesson-editor", never, {}, {}, never, never, true, never>;
59
60
  }
@@ -0,0 +1,22 @@
1
+ import { EventEmitter, WritableSignal } from '@angular/core';
2
+ import { ILesson } from '../../lesson-mini-components/components/lessons.clases';
3
+ import * as i0 from "@angular/core";
4
+ export declare class DCLessonMetadataEditorComponent {
5
+ lesson: WritableSignal<ILesson | undefined>;
6
+ isLoadingLesson: WritableSignal<boolean>;
7
+ saveRequest: EventEmitter<void>;
8
+ importNotionRequest: EventEmitter<void>;
9
+ improveNotionRequest: EventEmitter<void>;
10
+ generateAIRequest: EventEmitter<void>;
11
+ propertyChange: EventEmitter<{
12
+ property: keyof ILesson;
13
+ value: any;
14
+ }>;
15
+ onPropertyChange<K extends keyof ILesson>(property: K, value: ILesson[K]): void;
16
+ emitSaveRequest(): void;
17
+ emitImportNotionRequest(): void;
18
+ emitImproveNotionRequest(): void;
19
+ emitGenerateAIRequest(): void;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<DCLessonMetadataEditorComponent, never>;
21
+ static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonMetadataEditorComponent, "dc-lesson-metadata-editor", never, { "lesson": { "alias": "lesson"; "required": true; }; "isLoadingLesson": { "alias": "isLoadingLesson"; "required": true; }; }, { "saveRequest": "saveRequest"; "importNotionRequest": "importNotionRequest"; "improveNotionRequest": "improveNotionRequest"; "generateAIRequest": "generateAIRequest"; "propertyChange": "propertyChange"; }, never, never, true, never>;
22
+ }
@@ -1,42 +1,37 @@
1
- import { ComponentRef, ElementRef, OnInit, Renderer2, ViewContainerRef } from '@angular/core';
2
- import { UntypedFormGroup } from '@angular/forms';
3
- import { ActivatedRoute } from '@angular/router';
4
- import { ILesson, LessonsAbstractService } from '../../lesson-mini-components/components/lessons.clases';
5
- import { ToastAlertsAbstractService } from '@dataclouder/ngx-core';
6
- import { LessonComponentInterface } from '../../lesson-mini-components/components/lessons.clases';
7
- import { AgentCardsAbstractService, DCConversationPromptBuilderService, IAgentCard, IMiniAgentCard } from '@dataclouder/ngx-agent-cards';
1
+ import { ElementRef } from '@angular/core';
2
+ import { FormGroup, FormControl } from '@angular/forms';
3
+ import { ILesson } from '../../lesson-mini-components/components/lessons.clases';
4
+ import { IAgentCard, IMiniAgentCard } from '@dataclouder/ngx-agent-cards';
8
5
  import * as i0 from "@angular/core";
9
- export declare class DCLessonRendererComponent implements OnInit {
10
- private renderer;
11
- private viewContainerRef;
12
- private activatedRoute;
13
- private toastrService;
14
- private lessonService;
15
- private agentCardsService;
16
- private conversationBuilder;
17
- lesson: ILesson;
18
- test: boolean;
19
- dynamicLesson: ElementRef;
20
- lessonId: string;
21
- dataText: string;
22
- components: {
23
- [key: string]: ComponentRef<LessonComponentInterface>;
24
- };
25
- mainForm: UntypedFormGroup;
26
- imageCover: string;
27
- chatVisible: boolean;
28
- constructor(renderer: Renderer2, viewContainerRef: ViewContainerRef, activatedRoute: ActivatedRoute, toastrService: ToastAlertsAbstractService, lessonService: LessonsAbstractService, agentCardsService: AgentCardsAbstractService, conversationBuilder: DCConversationPromptBuilderService);
29
- ngOnInit(): void;
30
- initLesson(): Promise<void>;
31
- getLessonIfId(): Promise<void>;
32
- private renderLesson;
33
- private addComponentToNode;
34
- private createComponentReferenceWithJson;
6
+ export declare class DCLessonRendererComponent {
7
+ lessonInput: import("@angular/core").InputSignal<ILesson>;
8
+ lessonIdInput: import("@angular/core").InputSignal<string>;
9
+ test: import("@angular/core").InputSignal<boolean>;
10
+ dynamicLesson: ElementRef<HTMLElement>;
11
+ private readonly renderer;
12
+ private readonly viewContainerRef;
13
+ private readonly toastrService;
14
+ private readonly lessonService;
15
+ private readonly lessonAIService;
16
+ lesson: import("@angular/core").WritableSignal<ILesson>;
17
+ chatVisible: import("@angular/core").WritableSignal<boolean>;
18
+ agentMasterLesson: import("@angular/core").WritableSignal<IAgentCard>;
19
+ evaluatorAgentCard: import("@angular/core").WritableSignal<IMiniAgentCard>;
20
+ imageCover: import("@angular/core").Signal<string>;
21
+ private components;
22
+ mainForm: FormGroup<{
23
+ [key: string]: FormControl<any>;
24
+ }>;
25
+ constructor();
26
+ private _clearLessonRendering;
27
+ private _renderLesson;
28
+ private _parseAndCreateComponents;
29
+ private _aggregateFormControls;
30
+ private _injectComponentsIntoDom;
31
+ private _addComponentToNode;
32
+ private _createComponentReferenceWithJson;
35
33
  evaluateForms(): Promise<void>;
36
- agentMasterLesson: IAgentCard;
37
- evaluatorAgentCard: IMiniAgentCard;
38
34
  startAI(): Promise<void>;
39
- private getDefualtLessonEvaluatorAgentCard;
40
35
  static ɵfac: i0.ɵɵFactoryDeclaration<DCLessonRendererComponent, never>;
41
- static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonRendererComponent, "dc-lesson-renderer", never, { "lesson": { "alias": "lesson"; "required": false; }; "test": { "alias": "test"; "required": false; }; }, {}, never, never, true, never>;
36
+ static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonRendererComponent, "dc-lesson-renderer", never, { "lessonInput": { "alias": "lessonInput"; "required": false; "isSignal": true; }; "lessonIdInput": { "alias": "lessonIdInput"; "required": false; "isSignal": true; }; "test": { "alias": "test"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
42
37
  }
@@ -1,11 +1,10 @@
1
- import { ChangeDetectorRef, EventEmitter, OnInit, Type, QueryList, OnDestroy } from '@angular/core';
1
+ import { ChangeDetectorRef, OnInit, Type, QueryList, OnDestroy } from '@angular/core';
2
2
  import { NgComponentOutlet } from '@angular/common';
3
3
  import { ActivatedRoute, Router } from '@angular/router';
4
4
  import { Subscription } from 'rxjs';
5
- import { ICustomFilter, PaginationBase, PColumn, ToastAlertsAbstractService } from '@dataclouder/ngx-core';
5
+ import { ICustomFilter, OnActionEvent, PaginationBase, PColumn, ToastAlertsAbstractService } from '@dataclouder/ngx-core';
6
6
  import { LessonsAbstractService } from '../../lesson-mini-components/components/lessons.clases';
7
7
  import { DcLessonCardComponent } from '../dc-lesson-card/dc-lesson-card.component';
8
- import { MenuItem } from 'node_modules/primeng/api/menuitem';
9
8
  import * as i0 from "@angular/core";
10
9
  export declare class DCLessonListComponent extends PaginationBase implements OnInit, OnDestroy {
11
10
  private cdr;
@@ -13,16 +12,10 @@ export declare class DCLessonListComponent extends PaginationBase implements OnI
13
12
  route: ActivatedRoute;
14
13
  private lessonsService;
15
14
  private toastrService;
16
- isAdmin: boolean;
15
+ showOptions: boolean;
17
16
  customCardComponent?: Type<DcLessonCardComponent>;
18
17
  customFilters: ICustomFilter[];
19
- viewType: 'table' | 'card';
20
- actions: MenuItem[];
21
- onTakeLesson: EventEmitter<any>;
22
- onEditLesson: EventEmitter<any>;
23
- onRemoveLesson: EventEmitter<any>;
24
- qr: EventEmitter<any>;
25
- onNewLesson: EventEmitter<any>;
18
+ viewType: 'table' | 'cards';
26
19
  columns: PColumn[];
27
20
  outlets: QueryList<NgComponentOutlet>;
28
21
  cardComponent: Type<DcLessonCardComponent>;
@@ -36,15 +29,12 @@ export declare class DCLessonListComponent extends PaginationBase implements OnI
36
29
  private clearcardEventSubs;
37
30
  ngOnDestroy(): void;
38
31
  getPaginatedLessons(paginator: any): Promise<void>;
39
- goToLessonDetails(id: string): void;
40
32
  search(searchText: string): void;
41
- private generateQR;
42
- private takeLesson;
43
- private editLesson;
44
33
  private removeLesson;
45
34
  newLesson(): void;
46
- filterChanged(filters: any): void;
35
+ applyFilterBarEvent(filterEvent: OnActionEvent): void;
47
36
  protected loadData(): Promise<void>;
37
+ doOrEmitAction(actionEvent: OnActionEvent): void;
48
38
  static ɵfac: i0.ɵɵFactoryDeclaration<DCLessonListComponent, never>;
49
- static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonListComponent, "dc-lesson-list", never, { "isAdmin": { "alias": "isAdmin"; "required": false; }; "customCardComponent": { "alias": "customCardComponent"; "required": false; }; "customFilters": { "alias": "customFilters"; "required": false; }; "viewType": { "alias": "viewType"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; }, { "onTakeLesson": "onTakeLesson"; "onEditLesson": "onEditLesson"; "onRemoveLesson": "onRemoveLesson"; "qr": "qr"; "onNewLesson": "onNewLesson"; }, never, never, true, never>;
39
+ static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonListComponent, "dc-lesson-list", never, { "showOptions": { "alias": "showOptions"; "required": false; }; "customCardComponent": { "alias": "customCardComponent"; "required": false; }; "customFilters": { "alias": "customFilters"; "required": false; }; "viewType": { "alias": "viewType"; "required": false; }; }, {}, never, never, true, never>;
50
40
  }
@@ -1,10 +1,14 @@
1
1
  import { FormBuilder, FormControl } from '@angular/forms';
2
2
  import { DynamicDialogRef } from 'primeng/dynamicdialog';
3
- import { LessonComponentEnum, LessonCompSettings } from './lessons.clases';
3
+ import { LessonComponentConfiguration, LessonComponentEnum, LessonCompSettings } from './lessons.clases';
4
4
  import * as i0 from "@angular/core";
5
5
  export type LessonCompSettingsForm = {
6
6
  [K in keyof Required<LessonCompSettings>]: FormControl<LessonCompSettings[K]>;
7
7
  };
8
+ export interface ComponentBuildData {
9
+ str: string;
10
+ obj: LessonComponentConfiguration;
11
+ }
8
12
  export declare class ComponentBuilder {
9
13
  protected formBuilder: FormBuilder;
10
14
  protected ref: DynamicDialogRef;
@@ -18,8 +22,9 @@ export declare class ComponentBuilder {
18
22
  explanation: FormControl<string>;
19
23
  }>;
20
24
  get questionType(): LessonComponentEnum;
21
- private getCode;
25
+ protected getCode(): LessonComponentConfiguration;
22
26
  showCode(): void;
27
+ getComponentData(): ComponentBuildData;
23
28
  copyToClipboard(): Promise<void>;
24
29
  static ɵfac: i0.ɵɵFactoryDeclaration<ComponentBuilder, never>;
25
30
  static ɵcmp: i0.ɵɵComponentDeclaration<ComponentBuilder, "app-component-builder", never, {}, {}, never, never, true, never>;
@@ -7,6 +7,8 @@ import { TextWriterBuiderComponent } from './text-writer/text-writer-buider/text
7
7
  import { TextWriterComponent } from './text-writer/text-writer.component';
8
8
  import { TranslationSwitcherBuilderComponent } from './translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component';
9
9
  import { TranslationSwitcherComponent } from './translationSwitcher/translationSwitcher.component';
10
+ import { SpeakerBuilderComponent } from './speaker/speaker-builder/speaker-builder.component';
11
+ import { SpeakerComponent } from './speaker/speaker.component';
10
12
  export type LessonComponentsType = 'selector' | 'speaker' | 'text-writer' | 'verb-summary' | 'word-summary';
11
13
  export declare enum LessonComponentEnum {
12
14
  Selector = "selector",
@@ -18,11 +20,13 @@ export declare enum LessonComponentEnum {
18
20
  }
19
21
  export declare const LessonComponentBuilders: {
20
22
  selector: typeof SelectorBuilderComponent;
23
+ speaker: typeof SpeakerBuilderComponent;
21
24
  textWriter: typeof TextWriterBuiderComponent;
22
25
  translationSwitcher: typeof TranslationSwitcherBuilderComponent;
23
26
  };
24
27
  export declare const LessonComponents: {
25
28
  selector: typeof SelectorComponent;
29
+ speaker: typeof SpeakerComponent;
26
30
  textWriter: typeof TextWriterComponent;
27
31
  translationSwitcher: typeof TranslationSwitcherComponent;
28
32
  };
@@ -35,10 +39,11 @@ export interface LessonCompSettings {
35
39
  hint?: string;
36
40
  explanation?: string;
37
41
  }
38
- export interface LessonComponentConfiguration {
39
- id: string;
42
+ export interface LessonComponentConfiguration<T extends LessonCompSettings = LessonCompSettings> {
43
+ id?: string;
40
44
  component: LessonComponentEnum;
41
- settings: LessonCompSettings;
45
+ settings?: T;
46
+ inputs?: Record<string, any>;
42
47
  }
43
48
  export interface StorageFile {
44
49
  bucket: string;
@@ -49,24 +54,18 @@ export interface AudioStorage extends StorageFile {
49
54
  text?: string;
50
55
  voiceType?: string;
51
56
  }
52
- export interface SpeakerCompConfiguration extends LessonComponentConfiguration {
57
+ export interface SpeakerCompConfiguration extends LessonComponentConfiguration<LessonCompSettings & {
58
+ voice: string;
59
+ }> {
53
60
  audio: AudioStorage;
54
- settings: LessonCompSettings & {
55
- voice: string;
56
- };
57
61
  }
58
62
  export interface LessonComponentInterface {
59
- config: LessonComponentConfiguration;
63
+ config: LessonComponentConfiguration<any>;
60
64
  control?: UntypedFormControl;
61
65
  validate?(): boolean | null;
62
66
  evaluate?(): boolean | null;
63
67
  }
64
68
  export declare const LESSONS_TOKEN: InjectionToken<LessonsAbstractService>;
65
- export interface StorageFile {
66
- bucket: string;
67
- url: string;
68
- path: string;
69
- }
70
69
  export interface ImgStorageData extends StorageFile {
71
70
  fullPath: string;
72
71
  resolutions: any;
@@ -75,10 +74,11 @@ export interface ImgStorageData extends StorageFile {
75
74
  export type LessonImage = ImgStorageData & {
76
75
  type: string;
77
76
  };
78
- export interface LessonComponentConfiguration {
77
+ export interface DynamicContentComponent {
79
78
  id: string;
80
79
  component: LessonComponentEnum;
81
- settings: LessonCompSettings;
80
+ inputs: Record<string, any>;
81
+ config: LessonComponentConfiguration<any>;
82
82
  }
83
83
  type StorageType = StorageFile & {
84
84
  type: string;
@@ -101,7 +101,8 @@ export interface ILesson {
101
101
  authorEmail: string;
102
102
  tags: string[];
103
103
  media: Media;
104
- components: Array<LessonComponentConfiguration>;
104
+ components: Array<LessonComponentConfiguration<any>>;
105
+ dynamicComponents: Record<string, DynamicContentComponent>;
105
106
  baseLang: string;
106
107
  targetLang: string;
107
108
  generatedByAI: boolean;
@@ -123,32 +124,6 @@ export declare abstract class LessonsAbstractService {
123
124
  abstract extractTextFromHtml(html: string): string;
124
125
  }
125
126
  export declare function provideLessonsService(serviceImplementation: Type<LessonsAbstractService>): Provider[];
126
- export interface LessonComponentConfiguration {
127
- id: string;
128
- component: LessonComponentEnum;
129
- settings: LessonCompSettings;
130
- }
131
- export interface StorageFile {
132
- bucket: string;
133
- url: string;
134
- path: string;
135
- }
136
- export interface AudioStorage extends StorageFile {
137
- text?: string;
138
- voiceType?: string;
139
- }
140
- export interface SpeakerCompConfiguration extends LessonComponentConfiguration {
141
- audio: AudioStorage;
142
- settings: LessonCompSettings & {
143
- voice: string;
144
- };
145
- }
146
- export interface LessonComponentInterface {
147
- config: LessonComponentConfiguration;
148
- control?: UntypedFormControl;
149
- validate?(): boolean | null;
150
- evaluate?(): boolean | null;
151
- }
152
127
  export declare const LangCodeDescription: {
153
128
  es: string;
154
129
  en: string;
@@ -0,0 +1,13 @@
1
+ import { ComponentBuilder } from '../../ComponentBuilder';
2
+ import { TTSGenerated } from '@dataclouder/ngx-tts';
3
+ import { LessonComponentConfiguration, LessonCompSettings } from '../../lessons.clases';
4
+ import * as i0 from "@angular/core";
5
+ export declare class SpeakerBuilderComponent extends ComponentBuilder {
6
+ tts: import("@angular/core").WritableSignal<TTSGenerated>;
7
+ handleTtsGenerated(event: TTSGenerated): void;
8
+ protected getCode(): LessonComponentConfiguration<LessonCompSettings & {
9
+ voice: string;
10
+ }>;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<SpeakerBuilderComponent, never>;
12
+ static ɵcmp: i0.ɵɵComponentDeclaration<SpeakerBuilderComponent, "app-speaker-builder", never, {}, {}, never, never, true, never>;
13
+ }
@@ -0,0 +1,12 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { SpeakerCompConfiguration } from '../lessons.clases';
3
+ import { TTSGenerated } from '@dataclouder/ngx-tts';
4
+ import * as i0 from "@angular/core";
5
+ export declare class SpeakerComponent implements OnInit {
6
+ ngOnInit(): void;
7
+ config: SpeakerCompConfiguration;
8
+ tts: TTSGenerated | undefined;
9
+ speach(): void;
10
+ static ɵfac: i0.ɵɵFactoryDeclaration<SpeakerComponent, never>;
11
+ static ɵcmp: i0.ɵɵComponentDeclaration<SpeakerComponent, "app-speaker", never, { "config": { "alias": "config"; "required": false; }; "tts": { "alias": "tts"; "required": false; }; }, {}, never, never, true, never>;
12
+ }
@@ -0,0 +1,18 @@
1
+ import { IAgentCard, IMiniAgentCard } from '@dataclouder/ngx-agent-cards';
2
+ import { ILesson } from '../components/lesson-mini-components/components/lessons.clases';
3
+ import * as i0 from "@angular/core";
4
+ export declare class LessonAIService {
5
+ private readonly lessonService;
6
+ constructor();
7
+ /**
8
+ * Generates the necessary agent cards for a lesson chat session.
9
+ * @param lesson The lesson data.
10
+ * @returns An object containing the master agent card and the evaluator agent card.
11
+ */
12
+ generateAgentCards(lesson: ILesson): Promise<{
13
+ masterAgent: IAgentCard;
14
+ evaluatorAgent: IMiniAgentCard;
15
+ } | null>;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<LessonAIService, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<LessonAIService>;
18
+ }
@@ -0,0 +1,35 @@
1
+ import { ILesson } from '../components/lesson-mini-components/components/lessons.clases';
2
+ import * as i0 from "@angular/core";
3
+ export declare class LessonNotionService {
4
+ #private;
5
+ isLoading: import("@angular/core").WritableSignal<boolean>;
6
+ /**
7
+ * Extracts the Notion Page ID from a URL.
8
+ * @param url The Notion page URL.
9
+ * @returns The extracted page ID or null if invalid.
10
+ */
11
+ private extractNotionPageId;
12
+ /**
13
+ * Links an existing lesson with a Notion page ID by updating the lesson's extras.
14
+ * @param lesson The current lesson data.
15
+ * @param notionPageId The Notion page ID to link.
16
+ * @returns The updated lesson data from the backend or undefined on failure.
17
+ */
18
+ linkLessonWithNotion(lesson: ILesson, notionPageId: string): Promise<ILesson | undefined>;
19
+ /**
20
+ * Handles the process of importing lesson content from Notion.
21
+ * It prompts the user for a URL if necessary, extracts the ID, fetches content,
22
+ * and potentially links the lesson if it's an existing one.
23
+ * @param currentLesson The current lesson data (can be a new or existing lesson).
24
+ * @param lessonId The current lesson ID (null if it's a new lesson).
25
+ * @returns The fetched HTML content from Notion, or null if the process fails.
26
+ */
27
+ importAndLinkLessonFromNotion(currentLesson: ILesson | undefined, lessonId: string | null): Promise<string | null>;
28
+ /**
29
+ * Fetches content from the linked Notion page for AI improvement (placeholder).
30
+ * @param lesson The current lesson data.
31
+ */
32
+ improveLessonWithNotionAI(lesson: ILesson | undefined): Promise<void>;
33
+ static ɵfac: i0.ɵɵFactoryDeclaration<LessonNotionService, never>;
34
+ static ɵprov: i0.ɵɵInjectableDeclaration<LessonNotionService>;
35
+ }
@@ -0,0 +1,34 @@
1
+ import { WritableSignal } from '@angular/core';
2
+ import { ILesson } from '../components/lesson-mini-components/components/lessons.clases';
3
+ import * as i0 from "@angular/core";
4
+ export declare class LessonUtilsService {
5
+ #private;
6
+ constructor();
7
+ /**
8
+ * Validates if audios need generation for the given lesson.
9
+ * Currently logs a placeholder message.
10
+ * @param lesson The lesson object (or signal) to validate.
11
+ */
12
+ validateAudios(lesson: ILesson | undefined): void;
13
+ /**
14
+ * Updates the lesson signal with a new cover image.
15
+ * @param lessonSignal The signal holding the lesson data.
16
+ * @param imageUploaded The image data object from the upload event.
17
+ */
18
+ uploadCover(lessonSignal: WritableSignal<ILesson | undefined>, imageUploaded: any): void;
19
+ /**
20
+ * Generates lesson content using AI. Assumes the lesson is already saved.
21
+ * @param lessonId The ID of the lesson to generate content for.
22
+ * @returns The updated lesson object after AI generation, or null on failure.
23
+ */
24
+ generateByAI(lessonId: string): Promise<ILesson | null>;
25
+ /**
26
+ * Cleans orphaned components from the lesson's dynamicComponents.
27
+ * An orphaned component is one present in dynamicComponents but its ID is not found in the textCoded HTML.
28
+ * @param lesson The lesson object to clean.
29
+ * @returns A new lesson object with orphaned components removed from dynamicComponents.
30
+ */
31
+ cleanOrphanedComponents(lesson: ILesson): ILesson;
32
+ static ɵfac: i0.ɵɵFactoryDeclaration<LessonUtilsService, never>;
33
+ static ɵprov: i0.ɵɵInjectableDeclaration<LessonUtilsService>;
34
+ }
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@dataclouder/ngx-lessons",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=18.0.0",
6
6
  "@angular/core": ">=18.0.0",
7
7
  "@angular/cdk": ">=18.0.0",
8
8
  "@dataclouder/ngx-core": ">=0.0.1",
9
- "@dataclouder/ngx-cloud-storage": ">=0.0.1"
9
+ "@dataclouder/ngx-cloud-storage": ">=0.0.1",
10
+ "@dataclouder/ngx-agent-cards": ">=0.0.1"
10
11
  },
11
12
  "dependencies": {
12
13
  "tslib": "^2.3.0"