@acorex/connectivity 18.2.1 → 18.2.3

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 (25) hide show
  1. package/esm2022/mock/lib/conversation/chat/chat.mock.data.mjs +42 -0
  2. package/esm2022/mock/lib/conversation/chat/chat.mock.service.mjs +14 -0
  3. package/esm2022/mock/lib/conversation/chat/chat.seeder.mjs +19 -0
  4. package/esm2022/mock/lib/conversation/chat/index.mjs +3 -0
  5. package/esm2022/mock/lib/conversation/comments/comment.mock.service.mjs +4 -3
  6. package/esm2022/mock/lib/conversation/comments/comment.seeder.mjs +3 -2
  7. package/esm2022/mock/lib/conversation/conversation.module.mjs +78 -0
  8. package/esm2022/mock/lib/form-management/form-management-mock.module.mjs +1 -11
  9. package/esm2022/mock/lib/mock.module.mjs +5 -14
  10. package/esm2022/mock/lib/text-template-management/category.seeder.mjs +3 -3
  11. package/esm2022/mock/lib/text-template-management/template.seeder.mjs +3 -3
  12. package/esm2022/mock/lib/text-template-management/text-template-management.mock.data.mjs +28 -28
  13. package/fesm2022/acorex-connectivity-mock.mjs +177 -64
  14. package/fesm2022/acorex-connectivity-mock.mjs.map +1 -1
  15. package/mock/lib/conversation/chat/chat.mock.data.d.ts +4 -0
  16. package/mock/lib/conversation/chat/chat.mock.service.d.ts +5 -0
  17. package/mock/lib/conversation/chat/chat.seeder.d.ts +8 -0
  18. package/mock/lib/conversation/chat/index.d.ts +2 -0
  19. package/mock/lib/conversation/comments/comment.mock.service.d.ts +2 -2
  20. package/mock/lib/conversation/conversation.module.d.ts +7 -0
  21. package/mock/lib/mock.module.d.ts +2 -1
  22. package/mock/lib/text-template-management/text-template-management.mock.data.d.ts +2 -2
  23. package/package.json +1 -1
  24. package/esm2022/mock/lib/form-management/designer-connector.mock.service.mjs +0 -11
  25. package/mock/lib/form-management/designer-connector.mock.service.d.ts +0 -6
@@ -1,16 +1,17 @@
1
- import { AXPCommentServiceImpl, AXMCommentService } from '@acorex/modules/conversation';
2
1
  import { AXMNotificationService } from '@acorex/modules/notification-management';
3
- import { AXPDataGenerator, AXPDexieEntityStorageService, AXPEntityStorageService, AXP_DATA_SEEDER_TOKEN } from '@acorex/platform/common';
2
+ import { AXPDataGenerator, AXPDexieEntityStorageService, AXP_DATA_SEEDER_TOKEN, AXPEntityStorageService } from '@acorex/platform/common';
4
3
  import * as i0 from '@angular/core';
5
4
  import { inject, Injectable, NgModule } from '@angular/core';
6
5
  import { APPLICATION_SOURCE_NAME, MODULE_SOURCE_NAME, ENTITY_SOURCE_NAME, FEATURE_SOURCE_NAME, PERMISSION_SOURCE_NAME, PROPERTY_SOURCE_NAME } from '@acorex/modules/application-management';
6
+ import { AXMCommentService } from '@acorex/modules/backend';
7
+ import * as i1 from '@acorex/modules/conversation';
8
+ import { AXMConverstionModuleConst, AXMChatServiceImpl, AXMCommentServiceImpl, AXMChatModule, AXMChatService } from '@acorex/modules/conversation';
7
9
  import { AXPSessionService } from '@acorex/platform/auth';
8
10
  import { AXP_WIDGET_DATASOURCE_PROVIDER } from '@acorex/platform/layout/builder';
9
- import { AXPDesignerConnectorAbstract } from '@acorex/platform/layout/designer';
10
11
  import { convertArrayToDataSource } from '@acorex/components/common';
11
12
  import { LANGUAGE_SOURCE_NAME, CULTURE_SOURCE_NAME, TIMEZONE_SOURCE_NAME } from '@acorex/modules/localization-management';
12
13
  import { CURRENCY_SOURCE_NAME, COUNTRY_SOURCE_NAME } from '@acorex/modules/platform-management';
13
- import { CATEGORY_SOURCE_NAME, TEMPLATE_SOURCE_NAME } from '@acorex/modules/template-management';
14
+ import { AXMTextTemplateManagementModuleConst } from '@acorex/modules/text-template-management';
14
15
 
15
16
  const APPLICATIONS = Array.from({ length: 5 }).map((_, i) => {
16
17
  const source = ['appOne', 'appTwo', 'appThree', 'myCoolApp', 'awesomeApp', 'superApp'];
@@ -141,6 +142,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
141
142
  type: Injectable
142
143
  }] });
143
144
 
145
+ const generateChatUser = () => ({
146
+ id: AXPDataGenerator.uuid(),
147
+ userName: AXPDataGenerator.firstName().toLowerCase(),
148
+ firstName: AXPDataGenerator.firstName(),
149
+ lastName: AXPDataGenerator.lastName(),
150
+ picture: null, // Can replace with a mock image URL if needed
151
+ });
152
+ const generateChatMessage = () => ({
153
+ content: `${AXPDataGenerator.pick([
154
+ 'Hello!',
155
+ 'How are you?',
156
+ 'Can we schedule a meeting?',
157
+ 'Looking forward to your response.',
158
+ 'This is a test message.',
159
+ 'Let’s catch up soon!',
160
+ 'Good job on this!',
161
+ 'Here is the update you requested.',
162
+ ])}`,
163
+ contentType: AXPDataGenerator.pick(['text', 'image', 'video']),
164
+ hasSeen: AXPDataGenerator.boolean(),
165
+ createdAt: AXPDataGenerator.date(new Date(2021), new Date()),
166
+ createdBy: generateChatUser(),
167
+ });
168
+ const CHAT = Array.from({ length: 10 }).map(() => {
169
+ const roomMembersCount = AXPDataGenerator.number(2, 10);
170
+ const roomMembers = Array.from({ length: roomMembersCount }).map(() => generateChatUser());
171
+ return {
172
+ id: AXPDataGenerator.uuid(),
173
+ title: AXPDataGenerator.pick([
174
+ 'General Discussion',
175
+ 'Project Alpha',
176
+ 'Team Meeting',
177
+ 'Client Communication',
178
+ 'Random Chat',
179
+ ]),
180
+ lastMessage: generateChatMessage(),
181
+ roomMembers,
182
+ unreadCount: AXPDataGenerator.number(0, 20),
183
+ };
184
+ });
185
+
186
+ class AXPChatDataSeeder {
187
+ constructor() {
188
+ this.storageService = inject(AXPDexieEntityStorageService);
189
+ }
190
+ async seed() {
191
+ await this.storageService.initial(`${AXMConverstionModuleConst.moduleName}.${AXMConverstionModuleConst.chatName}`, CHAT);
192
+ }
193
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPChatDataSeeder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
194
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPChatDataSeeder }); }
195
+ }
196
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPChatDataSeeder, decorators: [{
197
+ type: Injectable
198
+ }] });
199
+
200
+ class AXMChatMockService extends AXMChatServiceImpl {
201
+ async getTotalUnread() {
202
+ const chatList = await super.storageService.getAll(`${AXMConverstionModuleConst.moduleName}.${AXMConverstionModuleConst.chatName}`);
203
+ const totalUnread = chatList.reduce((acc, curr) => (acc += curr.unreadCount > 0), 0);
204
+ return totalUnread;
205
+ }
206
+ async markChatAsRead(roomId) {
207
+ const oldChat = await super.getOne(roomId);
208
+ await super.updateOne(roomId, { ...oldChat, unreadCount: 0 });
209
+ return;
210
+ }
211
+ }
212
+
144
213
  // import { AXPDataGenerator, AXPEntityStorageService } from '@acorex/platform/common';
145
214
  // import {
146
215
  // AXPComment,
@@ -218,7 +287,7 @@ class AXPCommentDataSeeder {
218
287
  this.storageService = inject(AXPDexieEntityStorageService);
219
288
  }
220
289
  async seed() {
221
- await this.storageService.initial('comments', COMMENTS);
290
+ await this.storageService.initial(`${AXMConverstionModuleConst.moduleName}.${AXMConverstionModuleConst.commentName}`, COMMENTS);
222
291
  }
223
292
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPCommentDataSeeder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
224
293
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPCommentDataSeeder }); }
@@ -227,7 +296,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
227
296
  type: Injectable
228
297
  }] });
229
298
 
230
- class AXMCommentMockService extends AXPCommentServiceImpl {
299
+ class AXMCommentMockService extends AXMCommentServiceImpl {
231
300
  constructor() {
232
301
  super(...arguments);
233
302
  this.sessionService = inject(AXPSessionService);
@@ -270,6 +339,7 @@ class AXMCommentMockService extends AXPCommentServiceImpl {
270
339
  return 'done';
271
340
  }
272
341
  async like(payload) {
342
+ debugger;
273
343
  const comment = await super.getOne(payload.messageId);
274
344
  if (comment) {
275
345
  const isLiked = !comment.isLiked;
@@ -300,6 +370,75 @@ class AXMCommentMockService extends AXPCommentServiceImpl {
300
370
  }
301
371
  }
302
372
 
373
+ class AXCConversationMockModule {
374
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXCConversationMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
375
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXCConversationMockModule, imports: [i1.AXMChatModule] }); }
376
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXCConversationMockModule, providers: [
377
+ {
378
+ provide: AXP_DATA_SEEDER_TOKEN,
379
+ useClass: AXPChatDataSeeder,
380
+ multi: true,
381
+ },
382
+ {
383
+ provide: AXP_DATA_SEEDER_TOKEN,
384
+ useClass: AXPCommentDataSeeder,
385
+ multi: true,
386
+ },
387
+ {
388
+ provide: AXMCommentService,
389
+ useClass: AXMCommentMockService,
390
+ },
391
+ // {
392
+ // provide: AXMChatService,
393
+ // useClass: AXMChatMockService,
394
+ // },
395
+ ], imports: [AXMChatModule.forRoot({
396
+ provider: [
397
+ {
398
+ provide: AXMChatService,
399
+ useClass: AXMChatMockService,
400
+ },
401
+ ],
402
+ })] }); }
403
+ }
404
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXCConversationMockModule, decorators: [{
405
+ type: NgModule,
406
+ args: [{
407
+ imports: [
408
+ AXMChatModule.forRoot({
409
+ provider: [
410
+ {
411
+ provide: AXMChatService,
412
+ useClass: AXMChatMockService,
413
+ },
414
+ ],
415
+ }),
416
+ ],
417
+ exports: [],
418
+ declarations: [],
419
+ providers: [
420
+ {
421
+ provide: AXP_DATA_SEEDER_TOKEN,
422
+ useClass: AXPChatDataSeeder,
423
+ multi: true,
424
+ },
425
+ {
426
+ provide: AXP_DATA_SEEDER_TOKEN,
427
+ useClass: AXPCommentDataSeeder,
428
+ multi: true,
429
+ },
430
+ {
431
+ provide: AXMCommentService,
432
+ useClass: AXMCommentMockService,
433
+ },
434
+ // {
435
+ // provide: AXMChatService,
436
+ // useClass: AXMChatMockService,
437
+ // },
438
+ ],
439
+ }]
440
+ }] });
441
+
303
442
  class AXPMockWidgetDataSourceProvider {
304
443
  async items() {
305
444
  return [
@@ -336,24 +475,10 @@ class AXPMockWidgetDataSourceProvider {
336
475
  }
337
476
  }
338
477
 
339
- class AXPMockDesignerConnector extends AXPDesignerConnectorAbstract {
340
- //#region Save and load Widgets
341
- save() {
342
- throw new Error('Method not implemented.');
343
- }
344
- load(id) {
345
- throw new Error('Method not implemented.');
346
- }
347
- }
348
-
349
478
  class AXCFormManagementMockModule {
350
479
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXCFormManagementMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
351
480
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXCFormManagementMockModule }); }
352
481
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXCFormManagementMockModule, providers: [
353
- {
354
- provide: AXPDesignerConnectorAbstract,
355
- useClass: AXPMockDesignerConnector,
356
- },
357
482
  {
358
483
  provide: AXP_WIDGET_DATASOURCE_PROVIDER,
359
484
  useClass: AXPMockWidgetDataSourceProvider,
@@ -368,10 +493,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
368
493
  exports: [],
369
494
  declarations: [],
370
495
  providers: [
371
- {
372
- provide: AXPDesignerConnectorAbstract,
373
- useClass: AXPMockDesignerConnector,
374
- },
375
496
  {
376
497
  provide: AXP_WIDGET_DATASOURCE_PROVIDER,
377
498
  useClass: AXPMockWidgetDataSourceProvider,
@@ -710,13 +831,13 @@ const TEXT_TEMPLATE_CATEGORY = [
710
831
  {
711
832
  id: AXPDataGenerator.uuid(),
712
833
  name: 'security',
713
- title: 'Security'
834
+ title: 'Security',
714
835
  },
715
836
  {
716
837
  id: AXPDataGenerator.uuid(),
717
838
  name: 'marketing',
718
- title: 'Marketing'
719
- }
839
+ title: 'Marketing',
840
+ },
720
841
  ];
721
842
  const TEXT_TEMPLATES = [
722
843
  {
@@ -742,14 +863,14 @@ const TEXT_TEMPLATES = [
742
863
  `,
743
864
  category: TEXT_TEMPLATE_CATEGORY[0],
744
865
  type: 'template',
745
- templateVariables: [
746
- {
747
- name: 'user_name',
748
- title: 'User Name',
749
- type: 'string',
750
- required: true,
751
- },
752
- ],
866
+ // templateVariables: [
867
+ // {
868
+ // name: 'user_name',
869
+ // title: 'User Name',
870
+ // type: 'string',
871
+ // required: true,
872
+ // },
873
+ // ],
753
874
  },
754
875
  {
755
876
  id: AXPDataGenerator.uuid(),
@@ -778,14 +899,14 @@ const TEXT_TEMPLATES = [
778
899
  `,
779
900
  category: TEXT_TEMPLATE_CATEGORY[0],
780
901
  type: 'template',
781
- templateVariables: [
782
- {
783
- name: 'user_name',
784
- title: 'User Name',
785
- type: 'string',
786
- required: true,
787
- },
788
- ],
902
+ // templateVariables: [
903
+ // {
904
+ // name: 'user_name',
905
+ // title: 'User Name',
906
+ // type: 'string',
907
+ // required: true,
908
+ // },
909
+ // ],
789
910
  },
790
911
  {
791
912
  id: AXPDataGenerator.uuid(),
@@ -812,14 +933,14 @@ const TEXT_TEMPLATES = [
812
933
  `,
813
934
  category: TEXT_TEMPLATE_CATEGORY[1],
814
935
  type: 'template',
815
- templateVariables: [
816
- {
817
- name: 'user_name',
818
- title: 'User Name',
819
- type: 'string',
820
- required: true,
821
- },
822
- ],
936
+ // templateVariables: [
937
+ // {
938
+ // name: 'user_name',
939
+ // title: 'User Name',
940
+ // type: 'string',
941
+ // required: true,
942
+ // },
943
+ // ],
823
944
  },
824
945
  ];
825
946
 
@@ -828,7 +949,7 @@ class AXPTextTemplateCategoryDataSeeder {
828
949
  this.storageService = inject(AXPDexieEntityStorageService);
829
950
  }
830
951
  async seed() {
831
- await this.storageService.initial(CATEGORY_SOURCE_NAME, TEXT_TEMPLATE_CATEGORY);
952
+ await this.storageService.initial(`${AXMTextTemplateManagementModuleConst.moduleName}.${AXMTextTemplateManagementModuleConst.categoryEntity}`, TEXT_TEMPLATE_CATEGORY);
832
953
  }
833
954
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPTextTemplateCategoryDataSeeder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
834
955
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPTextTemplateCategoryDataSeeder }); }
@@ -842,7 +963,7 @@ class AXPTextTemplateDataSeeder {
842
963
  this.storageService = inject(AXPDexieEntityStorageService);
843
964
  }
844
965
  async seed() {
845
- await this.storageService.initial(TEMPLATE_SOURCE_NAME, TEXT_TEMPLATES);
966
+ await this.storageService.initial(`${AXMTextTemplateManagementModuleConst.moduleName}.${AXMTextTemplateManagementModuleConst.templateEntity}`, TEXT_TEMPLATES);
846
967
  }
847
968
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPTextTemplateDataSeeder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
848
969
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPTextTemplateDataSeeder }); }
@@ -853,7 +974,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
853
974
 
854
975
  class AXCMockModule {
855
976
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXCMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
856
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXCMockModule, imports: [AXCFormManagementMockModule] }); }
977
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXCMockModule, imports: [AXCFormManagementMockModule, AXCConversationMockModule] }); }
857
978
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXCMockModule, providers: [
858
979
  AXPDexieEntityStorageService,
859
980
  {
@@ -909,16 +1030,12 @@ class AXCMockModule {
909
1030
  useClass: AXPCultureDataSeeder,
910
1031
  multi: true,
911
1032
  },
912
- {
913
- provide: AXMCommentService,
914
- useClass: AXMCommentMockService,
915
- },
916
- ], imports: [AXCFormManagementMockModule] }); }
1033
+ ], imports: [AXCFormManagementMockModule, AXCConversationMockModule] }); }
917
1034
  }
918
1035
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXCMockModule, decorators: [{
919
1036
  type: NgModule,
920
1037
  args: [{
921
- imports: [AXCFormManagementMockModule],
1038
+ imports: [AXCFormManagementMockModule, AXCConversationMockModule],
922
1039
  exports: [],
923
1040
  declarations: [],
924
1041
  providers: [
@@ -976,10 +1093,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
976
1093
  useClass: AXPCultureDataSeeder,
977
1094
  multi: true,
978
1095
  },
979
- {
980
- provide: AXMCommentService,
981
- useClass: AXMCommentMockService,
982
- },
983
1096
  ],
984
1097
  }]
985
1098
  }] });