@dataclouder/ngx-lessons 0.1.4 → 0.1.6

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/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import * as i0 from '@angular/core';
2
- import { PipeTransform, InjectionToken, Type, Provider, OnInit, EventEmitter, OnDestroy, AfterViewInit, QueryList, ViewContainerRef, ElementRef, ComponentRef, WritableSignal } from '@angular/core';
3
- import { ISimpleAgent, WordData, IAgentCard, SimpleAgentTask, IConversationSettings, IConversationFlow, ChatEvent } from '@dataclouder/ngx-agent-cards';
2
+ import { PipeTransform, InjectionToken, Type, Provider, OnInit, EventEmitter, OnDestroy, AfterViewInit, QueryList, ComponentRef, ViewContainerRef, Renderer2, ElementRef, WritableSignal } from '@angular/core';
3
+ import { ISimpleAgent, IConversationSettings, IConversationFlow, SimpleAgentTask, WordData, ChatEvent } from '@dataclouder/ngx-agent-cards';
4
4
  import { NgComponentOutlet } from '@angular/common';
5
5
  import { MenuItem } from 'primeng/api';
6
- import { EntityCommunicationService, FiltersConfig, IFilterQueryResponse, IExtensionable, ILearnable, IAuditable, IManageable, IReactable, OnActionEvent, EntityBaseListComponent, ICustomFilter, PColumn, UiStateService, EntityBaseFormComponent, PaginationBase, ListFilterBarOptions } from '@dataclouder/ngx-core';
6
+ import { EntityCommunicationService, FiltersConfig, IFilterQueryResponse, IExtensionable, ILearnable, IAuditable, IManageable, IReactable, OnActionEvent, EntityBaseListComponent, ICustomFilter, PColumn, EntityBaseFormComponent, UiStateService, PaginationBase, ListFilterBarOptions } from '@dataclouder/ngx-core';
7
7
  import * as _angular_forms from '@angular/forms';
8
8
  import { FormBuilder, FormControl, FormArray, UntypedFormControl, UntypedFormArray, FormGroup } from '@angular/forms';
9
9
  import { DynamicDialogRef } from 'primeng/dynamicdialog';
10
10
  import { TTSGenerated } from '@dataclouder/ngx-vertex';
11
- import { IAssetable, StorageImageSettings, CloudStorageData, AspectType, ResolutionType } from '@dataclouder/ngx-cloud-storage';
12
- import * as _dataclouder_ngx_lessons from '@dataclouder/ngx-lessons';
11
+ import { IAssetable, StorageImageSettings, AspectType, ResolutionType } from '@dataclouder/ngx-cloud-storage';
12
+ import { UserService } from '@dataclouder/ngx-users';
13
13
  import BalloonEditor from '@ckeditor/ckeditor5-build-balloon-block';
14
14
  import * as _angular_router from '@angular/router';
15
15
  import { FormlyFieldConfig } from '@ngx-formly/core';
@@ -30,11 +30,6 @@ declare const LangCodeDescriptionEs: {
30
30
  fr: string;
31
31
  ja: string;
32
32
  };
33
- declare class LangDescTranslationPipe implements PipeTransform {
34
- transform(value: string, lang: string): boolean;
35
- static ɵfac: i0.ɵɵFactoryDeclaration<LangDescTranslationPipe, never>;
36
- static ɵpipe: i0.ɵɵPipeDeclaration<LangDescTranslationPipe, "langDesc", true>;
37
- }
38
33
  declare class FlagLanguagePipe implements PipeTransform {
39
34
  transform(lang: string): string;
40
35
  static ɵfac: i0.ɵɵFactoryDeclaration<FlagLanguagePipe, never>;
@@ -318,9 +313,11 @@ interface ILesson {
318
313
  id: string;
319
314
  title: string;
320
315
  description: string;
316
+ markdown: string;
321
317
  textCoded: string;
322
318
  tags: string[];
323
319
  media: Media;
320
+ format: 'html' | 'markdown';
324
321
  components: Array<LessonComponentConfiguration<any>>;
325
322
  dynamicComponents: Record<string, DynamicContentComponent>;
326
323
  baseLang: string;
@@ -359,6 +356,7 @@ declare enum EventCard {
359
356
  Clone = "clone"
360
357
  }
361
358
  declare class DcLessonCardComponent implements OnInit {
359
+ userService: UserService;
362
360
  lesson: ILessonWithTaken | ILesson | any;
363
361
  showOptions: boolean;
364
362
  cardHeight: string;
@@ -399,29 +397,53 @@ declare class DCLessonFormComponent {
399
397
  static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonFormComponent, "dc-lesson-form", never, {}, {}, never, never, true, never>;
400
398
  }
401
399
 
402
- declare class DCLessonEditorComponent {
403
- #private;
400
+ declare class DCLessonEditorComponent extends EntityBaseFormComponent<ILesson> {
401
+ private lessonFormEditorService;
402
+ private markdownService;
403
+ form: FormGroup<{
404
+ version: _angular_forms.FormControl<string>;
405
+ id: _angular_forms.FormControl<string>;
406
+ name: _angular_forms.FormControl<string>;
407
+ title: _angular_forms.FormControl<string>;
408
+ description: _angular_forms.FormControl<string>;
409
+ format: _angular_forms.FormControl<string>;
410
+ lang: _angular_forms.FormControl<string>;
411
+ characterCard: _angular_forms.FormControl<any>;
412
+ conversationSettings: _angular_forms.FormControl<any>;
413
+ metaApp: _angular_forms.FormControl<any>;
414
+ conversationFlow: _angular_forms.FormControl<any>;
415
+ textCoded: _angular_forms.FormControl<string>;
416
+ manageable: FormGroup<any>;
417
+ learnable: FormGroup<{
418
+ level: _angular_forms.FormControl<number | null>;
419
+ takenCount: _angular_forms.FormControl<number | null>;
420
+ tags: _angular_forms.FormArray<_angular_forms.FormControl<string | null>>;
421
+ }>;
422
+ }>;
423
+ readonly formatOptions: {
424
+ label: string;
425
+ value: string;
426
+ }[];
427
+ protected entityCommunicationService: DefaultLessonsService;
428
+ htmlTemporal: string;
429
+ protected patchForm(entity: ILesson): void;
430
+ private activatedRoute;
431
+ private lessonNotionService;
432
+ private lessonUtilsService;
404
433
  lessonsService: DefaultLessonsService;
434
+ private loadingBarService;
405
435
  private defaultLessonsService;
406
436
  private promptService;
407
437
  private ngxVertexService;
408
- private cdr;
409
438
  private dynamicComponentsBuilderService;
410
- target: ViewContainerRef;
411
- dhtml: ElementRef;
412
- lessonId: i0.Signal<string>;
413
- lesson: i0.WritableSignal<ILesson>;
414
439
  isLoadingLesson: i0.WritableSignal<boolean>;
415
- lessonForm: FormGroup;
416
- coverImageUrl: i0.Signal<string>;
417
- readonly dynamicComponentsArray: i0.Signal<_dataclouder_ngx_lessons.DynamicContentComponent[]>;
440
+ readonly dynamicComponentsArray: i0.Signal<any[]>;
418
441
  components: {
419
442
  [key: string]: ComponentRef<LessonComponentInterface>;
420
443
  };
421
444
  editor: typeof BalloonEditor;
422
445
  lessonComponentEnum: typeof LessonComponentEnum;
423
446
  coverStorageSettings: StorageImageSettings;
424
- constructor();
425
447
  /**
426
448
  * Updates a specific property on the lesson signal.
427
449
  * Used for ngModelChange events to simulate two-way binding with signals.
@@ -429,41 +451,70 @@ declare class DCLessonEditorComponent {
429
451
  * @param value The new value for the property.
430
452
  */
431
453
  updateLessonProperty<K extends keyof ILesson>(property: K, value: ILesson[K]): void;
454
+ updateHtmlTextCoded(_: string, value: string): void;
432
455
  onAssetsChange(updatedAssets: IAssetable): void;
433
- onTagRemove(tag: any): void;
434
- onTagAdd(tag: {
435
- value: string;
436
- input: any;
437
- }): void;
438
456
  saveLesson(event?: Event): Promise<ILesson | undefined>;
439
457
  /**
440
458
  * Handles the event emitted when a component is added via the adder component.
441
459
  * @param result The configuration data returned from the component builder dialog. Expected format: { obj: LessonComponentConfiguration }
442
460
  */
443
461
  onComponentAdded(result: ComponentBuildData): void;
444
- /**
445
- * Handles the image upload event, updates the lesson signal via the service, and saves.
446
- * @param event The image upload event data.
447
- */
448
- onImageUploaded(event: any): Promise<void>;
449
- /**
450
- * Imports lesson content from Notion using the LessonNotionService.
451
- */
452
- importFromNotion(): Promise<void>;
453
- /**
454
- * Calls the LessonNotionService to improve the lesson using AI based on Notion content.
455
- */
456
462
  improveNotionWithAI(): Promise<void>;
457
463
  showComponentDetails(data: any): void;
458
464
  generateBanner(): Promise<void>;
459
- promptsVisible: boolean;
460
- prompts: any;
461
- showPrompts(): void;
462
465
  editComponent(comp: any): void;
466
+ onAssetUpdate(event: {
467
+ assets: Partial<IAssetable>;
468
+ }): void;
463
469
  static ɵfac: i0.ɵɵFactoryDeclaration<DCLessonEditorComponent, never>;
464
470
  static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonEditorComponent, "dc-lesson-editor", never, {}, {}, never, never, true, never>;
465
471
  }
466
472
 
473
+ declare class LessonsV2Component {
474
+ static ɵfac: i0.ɵɵFactoryDeclaration<LessonsV2Component, never>;
475
+ static ɵcmp: i0.ɵɵComponentDeclaration<LessonsV2Component, "app-lessonsv2", never, {}, {}, never, never, true, never>;
476
+ }
477
+
478
+ declare class LessonRendererService {
479
+ private readonly dynamicComponentsService;
480
+ private readonly toastrService;
481
+ private components;
482
+ mainForm: FormGroup<{
483
+ [key: string]: FormControl<any>;
484
+ }>;
485
+ renderLesson(lessonData: ILesson, viewContainerRef: ViewContainerRef, dynamicLessonElement: HTMLElement, renderer: Renderer2): {
486
+ [key: string]: ComponentRef<LessonComponentInterface>;
487
+ };
488
+ clearLessonRendering(dynamicLessonElement: HTMLElement): void;
489
+ private parseAndCreateComponents;
490
+ private createComponentReferenceWithJson;
491
+ private aggregateFormControls;
492
+ private injectComponentsIntoDom;
493
+ private addComponentToNode;
494
+ evaluateForms(): {
495
+ rates: {
496
+ correct: number;
497
+ incorrect: number;
498
+ score: number;
499
+ };
500
+ takenLesson: ILessonTaken | null;
501
+ } | null;
502
+ static ɵfac: i0.ɵɵFactoryDeclaration<LessonRendererService, never>;
503
+ static ɵprov: i0.ɵɵInjectableDeclaration<LessonRendererService>;
504
+ }
505
+
506
+ declare class LessonConversationService {
507
+ private readonly lessonAIService;
508
+ private readonly userDataExchange;
509
+ conversationSettings: i0.WritableSignal<IConversationSettings>;
510
+ conversationFlow: i0.WritableSignal<IConversationFlow>;
511
+ evalAgentTask: i0.WritableSignal<SimpleAgentTask>;
512
+ initializeConversationFlow(): void;
513
+ startAI(lesson: ILesson, settings: ILessonsSettings): Promise<IConversationSettings | null>;
514
+ static ɵfac: i0.ɵɵFactoryDeclaration<LessonConversationService, never>;
515
+ static ɵprov: i0.ɵɵInjectableDeclaration<LessonConversationService>;
516
+ }
517
+
467
518
  interface ILessonsSettings {
468
519
  additionalPrompt: string;
469
520
  }
@@ -472,36 +523,21 @@ declare class DCLessonRendererComponent implements OnInit {
472
523
  lessonIdInput: i0.InputSignal<string>;
473
524
  settings: i0.InputSignal<ILessonsSettings>;
474
525
  wordClicked: EventEmitter<WordData>;
475
- dynamicLesson: ElementRef<HTMLElement>;
526
+ dynamicLesson: i0.Signal<ElementRef<HTMLElement>>;
476
527
  private readonly renderer;
477
528
  private readonly viewContainerRef;
478
529
  private readonly toastrService;
479
530
  private lessonsService;
480
- private readonly lessonAIService;
481
- private readonly userDataExchange;
482
- private readonly dynamicComponentsService;
483
531
  readonly uiStateService: UiStateService;
532
+ readonly lessonRendererService: LessonRendererService;
533
+ readonly lessonConversationService: LessonConversationService;
484
534
  lesson: i0.WritableSignal<ILesson>;
485
- agentMasterLesson: i0.WritableSignal<IAgentCard>;
486
- evaluatorAgentCard: i0.WritableSignal<SimpleAgentTask>;
487
- conversationSettings: i0.WritableSignal<IConversationSettings>;
488
- evalAgentTask: i0.WritableSignal<SimpleAgentTask>;
489
- conversationFlow: i0.WritableSignal<IConversationFlow>;
490
535
  imageCover: i0.Signal<string>;
491
536
  private components;
492
- mainForm: FormGroup<{
493
- [key: string]: FormControl<any>;
494
- }>;
537
+ mainForm: FormGroup;
495
538
  private previousTextCoded;
496
539
  constructor();
497
540
  ngOnInit(): void;
498
- private _clearLessonRendering;
499
- private _renderLesson;
500
- private _parseAndCreateComponents;
501
- private _aggregateFormControls;
502
- private _injectComponentsIntoDom;
503
- private _addComponentToNode;
504
- private _createComponentReferenceWithJson;
505
541
  evaluateForms(): Promise<void>;
506
542
  startAI(): Promise<void>;
507
543
  onVisibleChange(isVisible: boolean): void;
@@ -563,43 +599,68 @@ declare class CoursesComponent {
563
599
  static ɵcmp: i0.ɵɵComponentDeclaration<CoursesComponent, "app-courses", never, {}, {}, never, never, true, never>;
564
600
  }
565
601
 
566
- declare class CourseDetailComponent {
567
- static ɵfac: i0.ɵɵFactoryDeclaration<CourseDetailComponent, never>;
568
- static ɵcmp: i0.ɵɵComponentDeclaration<CourseDetailComponent, "app-course-detail", never, {}, {}, never, never, true, never>;
569
- }
570
-
571
- interface AuditDate {
572
- createdAt?: string;
573
- updatedAt?: string;
574
- }
575
- interface ICourseRelation {
602
+ interface ICourseLesson {
603
+ _id: any;
576
604
  id: string;
577
- name: string;
605
+ title: string;
578
606
  description: string;
607
+ generated: boolean;
579
608
  }
580
- interface ICourse extends AuditDate {
581
- _id: string;
609
+ interface ICourseModule {
610
+ _id: any;
582
611
  id: string;
583
- name?: string;
584
- image?: CloudStorageData;
585
- description?: string;
586
- type?: string;
587
- relation?: ICourseRelation;
612
+ title: string;
613
+ description: string;
614
+ lessonCount: number;
615
+ lessons: ICourseLesson[];
616
+ }
617
+ interface ICourse {
618
+ _id?: any;
619
+ id?: string;
620
+ name: string;
621
+ description: string;
622
+ authorId: string;
623
+ targetLang: string;
624
+ baseLang: string;
625
+ moduleCount: number;
626
+ totalLessons: number;
627
+ modules: ICourseModule[];
628
+ auditable: IAuditable;
588
629
  }
589
630
 
590
631
  declare class CourseService extends EntityCommunicationService<ICourse> {
591
632
  constructor();
633
+ generateLanguageCourse(base: string, target: string, id?: string): Promise<ICourse>;
634
+ autogenerateLessons(id: string): Promise<void>;
592
635
  static ɵfac: i0.ɵɵFactoryDeclaration<CourseService, never>;
593
636
  static ɵprov: i0.ɵɵInjectableDeclaration<CourseService>;
594
637
  }
595
638
 
639
+ declare class CourseDetailComponent implements OnInit {
640
+ protected entityCommunicationService: CourseService;
641
+ private activatedRoute;
642
+ private messageService;
643
+ courseId: string;
644
+ course: i0.WritableSignal<ICourse>;
645
+ generatingLessons: i0.WritableSignal<boolean>;
646
+ generatingLesson: i0.WritableSignal<string>;
647
+ ngOnInit(): void;
648
+ generatePendingLessons(): Promise<void>;
649
+ generateLesson(lessonId: string): Promise<void>;
650
+ private loadCourse;
651
+ static ɵfac: i0.ɵɵFactoryDeclaration<CourseDetailComponent, never>;
652
+ static ɵcmp: i0.ɵɵComponentDeclaration<CourseDetailComponent, "app-course-detail", never, {}, {}, never, never, true, never>;
653
+ }
654
+
596
655
  declare class CourseFormComponent extends EntityBaseFormComponent<ICourse> {
597
656
  protected entityCommunicationService: CourseService;
657
+ private loadingBarService;
598
658
  private fb;
599
659
  languageOptions: {
600
660
  value: string;
601
661
  label: string;
602
662
  }[];
663
+ constructor();
603
664
  form: FormGroup;
604
665
  readonly onSave: i0.OutputEmitterRef<any>;
605
666
  storageImgSettings: {
@@ -614,6 +675,7 @@ declare class CourseFormComponent extends EntityBaseFormComponent<ICourse> {
614
675
  protected patchForm(entity: ICourse): void;
615
676
  save(): Promise<ICourse | undefined>;
616
677
  handleImageUpload(event: any): void;
678
+ generateCourse(): Promise<void>;
617
679
  static ɵfac: i0.ɵɵFactoryDeclaration<CourseFormComponent, never>;
618
680
  static ɵcmp: i0.ɵɵComponentDeclaration<CourseFormComponent, "app-source-form", never, {}, { "onSave": "onSave"; }, never, never, true, never>;
619
681
  }
@@ -621,6 +683,7 @@ declare class CourseFormComponent extends EntityBaseFormComponent<ICourse> {
621
683
  declare class CourseListComponent extends PaginationBase implements OnInit {
622
684
  private toastService;
623
685
  private courseService;
686
+ private userService;
624
687
  private cdr;
625
688
  viewType: 'table' | 'card';
626
689
  readonly onlyView: i0.InputSignal<boolean>;
@@ -639,5 +702,5 @@ declare class CourseListComponent extends PaginationBase implements OnInit {
639
702
  static ɵcmp: i0.ɵɵComponentDeclaration<CourseListComponent, "app-course-list", never, { "viewType": { "alias": "viewType"; "required": false; }; "onlyView": { "alias": "onlyView"; "required": false; "isSignal": true; }; }, { "onSelect": "onSelect"; }, never, never, true, never>;
640
703
  }
641
704
 
642
- export { ComponentBuilder, ComponentWithForm, CourseDetailComponent, CourseFormComponent, CourseListComponent, CourseService, CoursesAdminComponent, CoursesComponent, CoursesService, DCLessonEditorComponent, DCLessonFormComponent, DCLessonListComponent, DCLessonRendererComponent, DcLessonCardComponent, DefaultLessonsService, DynamicComponentBuilders, DynamicComponents, DynamicComponentsService, FlagLanguagePipe, LESSONS_TOKEN, LangCodeDescription, LangCodeDescriptionEs, LangDescTranslationPipe, LessonComponentBuilders, LessonComponentEnum, LessonComponents, LessonDynamicComponent, NOTION_SERVICE_TOKEN, NotionAbstractService, NotionExportType, SelectorBuilderComponent, SelectorComponent, TextWriterBuiderComponent, TextWriterComponent, TranslationSwitcherBuilderComponent, TranslationSwitcherComponent, getLanguageSimpleAgent, getLessonComponentClass, provideLessonsService, provideNotionService };
705
+ export { ComponentBuilder, ComponentWithForm, CourseDetailComponent, CourseFormComponent, CourseListComponent, CourseService, CoursesAdminComponent, CoursesComponent, CoursesService, DCLessonEditorComponent, DCLessonFormComponent, DCLessonListComponent, DCLessonRendererComponent, DcLessonCardComponent, DefaultLessonsService, DynamicComponentBuilders, DynamicComponents, DynamicComponentsService, FlagLanguagePipe, LESSONS_TOKEN, LangCodeDescription, LangCodeDescriptionEs, LessonComponentBuilders, LessonComponentEnum, LessonComponents, LessonConversationService, LessonDynamicComponent, LessonRendererService, LessonsV2Component, NOTION_SERVICE_TOKEN, NotionAbstractService, NotionExportType, SelectorBuilderComponent, SelectorComponent, TextWriterBuiderComponent, TextWriterComponent, TranslationSwitcherBuilderComponent, TranslationSwitcherComponent, getLanguageSimpleAgent, getLessonComponentClass, provideLessonsService, provideNotionService };
643
706
  export type { AudioStorage, ComponentBuildData, ContentMetadata, DynamicComponentData, DynamicContentComponent, ILesson, ILessonExtra, ILessonTaken, ILessonWithTaken, ILessonsSettings, ImgStorageData, InputCompoennt, LessonCompSettings, LessonCompSettingsForm, LessonComponentConfiguration, LessonComponentInterface, LessonComponentsType, LessonImage, LessonPrompts, Media, NotionDBResponse, NotionPageResponse, SpeakerCompConfiguration, StorageFile, TextContent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataclouder/ngx-lessons",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=18.0.0",
6
6
  "@angular/core": ">=18.0.0",