@dataclouder/ngx-lessons 0.1.15 → 0.1.17

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,11 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { PipeTransform, InjectionToken, Type, Provider, OnInit, EventEmitter, OnDestroy, AfterViewInit, QueryList, ComponentRef, ViewContainerRef, Renderer2, ElementRef, WritableSignal } from '@angular/core';
2
+ import { PipeTransform, InjectionToken, Type, Provider, OnInit, ComponentRef, EventEmitter, ViewContainerRef, Renderer2, ElementRef, WritableSignal } from '@angular/core';
3
3
  import { ISimpleAgent, IConversationSettings, IConversationFlow, SimpleAgentTask, WordData, ChatEvent } from '@dataclouder/ngx-agent-cards';
4
- import { NgComponentOutlet } from '@angular/common';
5
4
  import { MenuItem } from 'primeng/api';
6
- import { EntityCommunicationService, FiltersConfig, IFilterQueryResponse, IExtensionable, ILearnable, IAuditable, IManageable, IReactable, OnActionEvent, EntityBaseListComponent, ICustomFilter, PColumn, EntityBaseFormComponent, UiStateService, MobileService, PaginationBase, ListFilterBarOptions } from '@dataclouder/ngx-core';
5
+ import { EntityCommunicationService, FiltersConfig, IFilterQueryResponse, IExtensionable, ILearnable, IAuditable, IManageable, IReactable, EntityBaseListComponent, ICustomFilter, PColumn, OnActionEvent, EntityBaseFormComponent, UiStateService, MobileService, PaginationBase, ListFilterBarOptions } from '@dataclouder/ngx-core';
7
6
  import * as _angular_forms from '@angular/forms';
8
- import { FormBuilder, FormControl, FormArray, UntypedFormControl, UntypedFormArray, FormGroup } from '@angular/forms';
7
+ import { FormBuilder, FormControl, FormArray, UntypedFormControl, FormGroup, UntypedFormArray } from '@angular/forms';
9
8
  import { DynamicDialogRef } from 'primeng/dynamicdialog';
10
9
  import { TTSGenerated } from '@dataclouder/ngx-ai-services';
11
10
  import { IAssetable, StorageImageSettings, AspectType, ResolutionType } from '@dataclouder/ngx-cloud-storage';
@@ -82,9 +81,9 @@ type LessonCompSettingsForm = {
82
81
  };
83
82
  interface ComponentBuildData {
84
83
  str: string;
85
- obj: LessonComponentConfiguration;
84
+ obj: IDynamicContentComponent;
86
85
  }
87
- declare abstract class ComponentBuilder {
86
+ declare abstract class ComponentBuilder implements OnInit {
88
87
  inputs: Record<string, any>;
89
88
  id: string;
90
89
  abstract componentName: string;
@@ -98,8 +97,18 @@ declare abstract class ComponentBuilder {
98
97
  hint: FormControl<string>;
99
98
  explanation: FormControl<string>;
100
99
  }>;
100
+ ngOnInit(): void;
101
+ protected populateForm(): void;
101
102
  get questionType(): LessonComponentEnum;
102
- protected getCode(): LessonComponentConfiguration;
103
+ protected getFormValue(): Partial<{
104
+ response: string;
105
+ responses: string;
106
+ options: any;
107
+ text: string;
108
+ hint: string;
109
+ explanation: string;
110
+ }>;
111
+ protected getCode(): IDynamicContentComponent;
103
112
  showCode(): void;
104
113
  getComponentData(): ComponentBuildData;
105
114
  copyToClipboard(): Promise<void>;
@@ -151,13 +160,13 @@ declare class TranslationSwitcherComponent implements OnInit {
151
160
  static ɵcmp: i0.ɵɵComponentDeclaration<TranslationSwitcherComponent, "app-translation-switcher", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
152
161
  }
153
162
 
154
- declare class SpeakerBuilderComponent extends ComponentBuilder {
163
+ declare class SpeakerBuilderComponent extends ComponentBuilder implements OnInit {
155
164
  componentName: string;
165
+ form: FormGroup;
156
166
  tts: i0.WritableSignal<TTSGenerated>;
157
167
  handleTtsGenerated(event: TTSGenerated): void;
158
- protected getCode(): LessonComponentConfiguration<LessonCompSettings & {
159
- voice: string;
160
- }>;
168
+ ngOnInit(): void;
169
+ protected getFormValue(): any;
161
170
  static ɵfac: i0.ɵɵFactoryDeclaration<SpeakerBuilderComponent, never>;
162
171
  static ɵcmp: i0.ɵɵComponentDeclaration<SpeakerBuilderComponent, "app-speaker-builder", never, {}, {}, never, never, true, never>;
163
172
  }
@@ -166,9 +175,10 @@ declare class SpeakerComponent implements OnInit {
166
175
  ngOnInit(): void;
167
176
  config: SpeakerCompConfiguration;
168
177
  tts: TTSGenerated | undefined;
178
+ text: string;
169
179
  speach(): void;
170
180
  static ɵfac: i0.ɵɵFactoryDeclaration<SpeakerComponent, never>;
171
- static ɵcmp: i0.ɵɵComponentDeclaration<SpeakerComponent, "app-speaker", never, { "config": { "alias": "config"; "required": false; }; "tts": { "alias": "tts"; "required": false; }; }, {}, never, never, true, never>;
181
+ static ɵcmp: i0.ɵɵComponentDeclaration<SpeakerComponent, "app-speaker", never, { "config": { "alias": "config"; "required": false; }; "tts": { "alias": "tts"; "required": false; }; "text": { "alias": "text"; "required": false; }; }, {}, never, never, true, never>;
172
182
  }
173
183
 
174
184
  declare class SelectorBuilderComponent extends ComponentBuilder implements OnInit {
@@ -214,25 +224,25 @@ declare class DefaultLessonsService extends EntityCommunicationService<ILesson>
214
224
 
215
225
  type LessonComponentsType = 'selector' | 'speaker' | 'text-writer' | 'verb-summary' | 'word-summary';
216
226
  declare enum LessonComponentEnum {
217
- Selector = "selector",
218
- Speaker = "speaker",
219
- TextWriter = "textWriter",
220
- VerbSummary = "verbSummary",
221
- WordSummary = "wordSummary",
222
- TranslationSwitcher = "translationSwitcher",
223
- PlayWord = "playWord"
227
+ Selector = "Selector",
228
+ Speaker = "Speaker",
229
+ TextWriter = "TextWriter",
230
+ VerbSummary = "VerbSummary",
231
+ WordSummary = "WordSummary",
232
+ TranslationSwitcher = "TranslationSwitcher",
233
+ PlayWord = "PlayWord"
224
234
  }
225
235
  declare const LessonComponentBuilders: {
226
- selector: typeof SelectorBuilderComponent;
227
- speaker: typeof SpeakerBuilderComponent;
228
- textWriter: typeof TextWriterBuiderComponent;
229
- translationSwitcher: typeof TranslationSwitcherBuilderComponent;
236
+ Selector: typeof SelectorBuilderComponent;
237
+ Speaker: typeof SpeakerBuilderComponent;
238
+ TextWriter: typeof TextWriterBuiderComponent;
239
+ TranslationSwitcher: typeof TranslationSwitcherBuilderComponent;
230
240
  };
231
241
  declare const LessonComponents: {
232
- selector: typeof SelectorComponent;
233
- speaker: typeof SpeakerComponent;
234
- textWriter: typeof TextWriterComponent;
235
- translationSwitcher: typeof TranslationSwitcherComponent;
242
+ Selector: typeof SelectorComponent;
243
+ Speaker: typeof SpeakerComponent;
244
+ TextWriter: typeof TextWriterComponent;
245
+ TranslationSwitcher: typeof TranslationSwitcherComponent;
236
246
  };
237
247
  declare function getLessonComponentClass(type: LessonComponentsType): any;
238
248
  interface LessonCompSettings {
@@ -281,11 +291,11 @@ interface ImgStorageData extends StorageFile {
281
291
  type LessonImage = ImgStorageData & {
282
292
  type: string;
283
293
  };
284
- interface DynamicContentComponent {
285
- id: string;
286
- component: LessonComponentEnum;
294
+ interface IDynamicContentComponent {
295
+ id?: string;
296
+ component: string;
287
297
  inputs: Record<string, any>;
288
- config: LessonComponentConfiguration<any>;
298
+ config?: LessonComponentConfiguration<any>;
289
299
  }
290
300
  type StorageType = StorageFile & {
291
301
  type: string;
@@ -317,7 +327,7 @@ interface ILesson {
317
327
  tags: string[];
318
328
  media: Media;
319
329
  format: 'html' | 'markdown';
320
- dynamicComponents: Record<string, DynamicContentComponent>;
330
+ dynamicComponents: Record<string, IDynamicContentComponent>;
321
331
  baseLang: string;
322
332
  targetLang: string;
323
333
  extensions?: IExtensionable;
@@ -346,49 +356,18 @@ interface LessonPrompts {
346
356
  }
347
357
  declare function provideLessonsService(serviceImplementation: Type<DefaultLessonsService>): Provider[];
348
358
 
349
- declare enum EventCard {
350
- Edit = "edit",
351
- Delete = "delete",
352
- Select = "select",
353
- Qr = "qr",
354
- Clone = "clone"
355
- }
356
- declare class DcLessonCardComponent implements OnInit {
357
- userService: UserService;
358
- lesson: ILessonWithTaken | ILesson | any;
359
- showOptions: boolean;
360
- cardHeight: string;
361
- onAction: EventEmitter<OnActionEvent>;
362
- coverUrl: string;
363
- eventType: typeof EventCard;
364
- items: MenuItem[];
365
- ngOnInit(): void;
366
- eventCard(eventType: EventCard): void;
367
- static ɵfac: i0.ɵɵFactoryDeclaration<DcLessonCardComponent, never>;
368
- static ɵcmp: i0.ɵɵComponentDeclaration<DcLessonCardComponent, "dc-lesson-card", never, { "lesson": { "alias": "lesson"; "required": false; }; "showOptions": { "alias": "showOptions"; "required": false; }; "cardHeight": { "alias": "cardHeight"; "required": false; }; }, { "onAction": "onAction"; }, never, never, true, never>;
369
- }
370
-
371
- declare class DCLessonListComponent extends EntityBaseListComponent<ILesson> implements OnDestroy, AfterViewInit {
372
- userService: UserService;
373
- customCardComponent?: Type<DcLessonCardComponent>;
359
+ declare class DCLessonListComponent extends EntityBaseListComponent<ILesson> {
360
+ userService: UserService<any>;
374
361
  customFilters: ICustomFilter[];
375
362
  protected entityCommunicationService: DefaultLessonsService;
376
- outlets: QueryList<NgComponentOutlet>;
377
- cardComponent: Type<DcLessonCardComponent>;
378
363
  columns: PColumn[];
379
- private cardEventSubs;
380
364
  constructor();
381
- ngOnInit(): Promise<void>;
382
- ngAfterViewInit(): void;
383
- ngOnDestroy(): void;
384
365
  getCustomButtons(item: ILesson): MenuItem[];
385
366
  handleAction(actionEvent: OnActionEvent): void;
386
367
  applyFilterBarEvent(filterEvent: OnActionEvent): void;
387
- private subscribeToCardEvents;
388
- private clearCardEventSubs;
389
368
  protected loadData(): Promise<void>;
390
369
  static ɵfac: i0.ɵɵFactoryDeclaration<DCLessonListComponent, never>;
391
- static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonListComponent, "dc-lesson-list", never, { "customCardComponent": { "alias": "customCardComponent"; "required": false; }; "customFilters": { "alias": "customFilters"; "required": false; }; }, {}, never, never, true, never>;
370
+ static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonListComponent, "dc-lesson-list", never, { "customFilters": { "alias": "customFilters"; "required": false; }; }, {}, never, never, true, never>;
392
371
  }
393
372
 
394
373
  declare class DCLessonFormComponent {
@@ -433,7 +412,7 @@ declare class DCLessonEditorComponent extends EntityBaseFormComponent<ILesson> {
433
412
  private ngxVertexService;
434
413
  private dynamicComponentsBuilderService;
435
414
  isLoadingLesson: i0.WritableSignal<boolean>;
436
- readonly dynamicComponentsArray: i0.Signal<DynamicContentComponent[]>;
415
+ readonly dynamicComponentsArray: i0.Signal<IDynamicContentComponent[]>;
437
416
  components: {
438
417
  [key: string]: ComponentRef<LessonComponentInterface>;
439
418
  };
@@ -458,7 +437,7 @@ declare class DCLessonEditorComponent extends EntityBaseFormComponent<ILesson> {
458
437
  onNewDynamicComponent(result: ComponentBuildData): void;
459
438
  showComponentDetails(data: any): void;
460
439
  generateBanner(): Promise<void>;
461
- editComponent(comp: any): void;
440
+ editComponent(comp: IDynamicContentComponent): void;
462
441
  onAssetUpdate(event: {
463
442
  assets: Partial<IAssetable>;
464
443
  }): void;
@@ -466,6 +445,28 @@ declare class DCLessonEditorComponent extends EntityBaseFormComponent<ILesson> {
466
445
  static ɵcmp: i0.ɵɵComponentDeclaration<DCLessonEditorComponent, "dc-lesson-editor", never, {}, {}, never, never, true, never>;
467
446
  }
468
447
 
448
+ declare enum EventCard {
449
+ Edit = "edit",
450
+ Delete = "delete",
451
+ Select = "select",
452
+ Qr = "qr",
453
+ Clone = "clone"
454
+ }
455
+ declare class DcLessonCardComponent implements OnInit {
456
+ userService: UserService<any>;
457
+ lesson: ILessonWithTaken | ILesson | any;
458
+ showOptions: boolean;
459
+ cardHeight: string;
460
+ onAction: EventEmitter<OnActionEvent>;
461
+ coverUrl: string;
462
+ eventType: typeof EventCard;
463
+ items: MenuItem[];
464
+ ngOnInit(): void;
465
+ eventCard(eventType: EventCard): void;
466
+ static ɵfac: i0.ɵɵFactoryDeclaration<DcLessonCardComponent, never>;
467
+ static ɵcmp: i0.ɵɵComponentDeclaration<DcLessonCardComponent, "dc-lesson-card", never, { "lesson": { "alias": "lesson"; "required": false; }; "showOptions": { "alias": "showOptions"; "required": false; }; "cardHeight": { "alias": "cardHeight"; "required": false; }; }, { "onAction": "onAction"; }, never, never, true, never>;
468
+ }
469
+
469
470
  declare class LessonsV2Component {
470
471
  static ɵfac: i0.ɵɵFactoryDeclaration<LessonsV2Component, never>;
471
472
  static ɵcmp: i0.ɵɵComponentDeclaration<LessonsV2Component, "app-lessonsv2", never, {}, {}, never, never, true, never>;
@@ -478,7 +479,7 @@ declare class LessonRendererService {
478
479
  mainForm: FormGroup<{
479
480
  [key: string]: FormControl<any>;
480
481
  }>;
481
- renderLesson(lessonData: ILesson, viewContainerRef: ViewContainerRef, dynamicLessonElement: HTMLElement, renderer: Renderer2): {
482
+ buildAndRenderDynamicComponents(lessonData: ILesson, viewContainerRef: ViewContainerRef, dynamicLessonElement: HTMLElement, renderer: Renderer2): {
482
483
  [key: string]: ComponentRef<LessonComponentInterface>;
483
484
  };
484
485
  clearLessonRendering(dynamicLessonElement: HTMLElement): void;
@@ -501,7 +502,7 @@ declare class LessonRendererService {
501
502
 
502
503
  declare class LessonConversationService {
503
504
  lessonsService: DefaultLessonsService;
504
- userService: UserService;
505
+ userService: UserService<any>;
505
506
  conversationSettings: i0.WritableSignal<IConversationSettings>;
506
507
  conversationFlow: i0.WritableSignal<IConversationFlow>;
507
508
  evalAgentTask: i0.WritableSignal<SimpleAgentTask>;
@@ -698,7 +699,7 @@ declare class CourseFormComponent extends EntityBaseFormComponent<ICourse> imple
698
699
  declare class CourseListComponent extends PaginationBase implements OnInit {
699
700
  private toastService;
700
701
  private courseService;
701
- userService: UserService;
702
+ userService: UserService<any>;
702
703
  private cdr;
703
704
  viewType: 'table' | 'card';
704
705
  readonly onlyView: i0.InputSignal<boolean>;
@@ -718,4 +719,4 @@ declare class CourseListComponent extends PaginationBase implements OnInit {
718
719
  }
719
720
 
720
721
  export { ComponentBuilder, ComponentWithForm, CourseDetailComponent, CourseFormComponent, CourseListComponent, CourseService, CoursesAdminComponent, CoursesComponent, CoursesService, DCLessonEditorComponent, DCLessonFormComponent, DCLessonListComponent, DCLessonRendererComponent, DcLessonCardComponent, DefaultDynamicComponentBuilders, DefaultDynamicComponents, DefaultLessonsService, DynamicComponentsRegisterService, 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 };
721
- export type { AudioStorage, ComponentBuildData, ContentMetadata, DynamicComponentData, DynamicComponentMap, DynamicContentComponent, ILesson, ILessonExtra, ILessonTaken, ILessonWithTaken, ILessonsSettings, ImgStorageData, InputCompoennt, LessonCompSettings, LessonCompSettingsForm, LessonComponentConfiguration, LessonComponentInterface, LessonComponentsType, LessonImage, LessonPrompts, Media, NotionDBResponse, NotionPageResponse, SpeakerCompConfiguration, StorageFile, TextContent };
722
+ export type { AudioStorage, ComponentBuildData, ContentMetadata, DynamicComponentData, DynamicComponentMap, IDynamicContentComponent, 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.15",
3
+ "version": "0.1.17",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=18.0.0",
6
6
  "@angular/core": ">=18.0.0",