vcomply-workflow-engine 7.4.4 → 7.4.5

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.
@@ -47929,6 +47929,7 @@ class AddMultipleResponsibilityWithTabComponent {
47929
47929
  assigneesList: [],
47930
47930
  reviewerList: [],
47931
47931
  parentResponsibility: [],
47932
+ peopleDropdownNames: [],
47932
47933
  memberId: '',
47933
47934
  };
47934
47935
  this.isLoader = false;
@@ -48009,6 +48010,7 @@ class AddMultipleResponsibilityWithTabComponent {
48009
48010
  assigneesList: [],
48010
48011
  reviewerList: [],
48011
48012
  parentResponsibility: [],
48013
+ peopleDropdownNames: [],
48012
48014
  memberId: '',
48013
48015
  };
48014
48016
  this.uploadedFiles = [];
@@ -48501,6 +48503,7 @@ class AddMultipleResponsibilityWithTabComponent {
48501
48503
  assignorsList: [],
48502
48504
  assigneesList: [],
48503
48505
  reviewerList: [],
48506
+ peopleDropdownNames: [],
48504
48507
  memberId: '',
48505
48508
  };
48506
48509
  this.isFileEmpty = false;
@@ -48595,23 +48598,26 @@ class AddMultipleResponsibilityWithTabComponent {
48595
48598
  this.templateInfo.rcList.push(rc);
48596
48599
  }
48597
48600
  // Assignee
48601
+ if (this.hasValue(element[RESPONSIBILITY.assigneeIndex.name])) {
48602
+ this.addPeopleDropdownName(element[RESPONSIBILITY.assigneeIndex.name]);
48603
+ }
48598
48604
  if (element[RESPONSIBILITY.assigneeIndex.id]) {
48605
+ const people = this.parsePeopleListCell(element[RESPONSIBILITY.assigneeIndex.name]);
48599
48606
  const assignee = {
48600
- nameAndEmail: element[RESPONSIBILITY.assigneeIndex.name],
48601
- // name: element[11].split(' (')[0],
48602
- name: element[RESPONSIBILITY.assigneeIndex.name].split(' (')[0],
48603
- email: element[RESPONSIBILITY.assigneeIndex.email].split(' (')[1].replace(')', ''),
48607
+ nameAndEmail: people.nameAndEmail,
48608
+ name: people.name,
48609
+ email: people.email,
48604
48610
  member_id: element[RESPONSIBILITY.assigneeIndex.id],
48605
48611
  };
48606
48612
  this.templateInfo.assigneesList.push(assignee);
48607
48613
  }
48608
48614
  // Reviewer
48609
48615
  if (element[RESPONSIBILITY.reviewerIndex.id]) {
48616
+ const people = this.parsePeopleListCell(element[RESPONSIBILITY.reviewerIndex.name]);
48610
48617
  const reviewer = {
48611
- nameAndEmail: element[RESPONSIBILITY.reviewerIndex.name],
48612
- // name: element[11].split(' (')[0],
48613
- name: element[RESPONSIBILITY.reviewerIndex.name].split(' (')[0],
48614
- email: element[RESPONSIBILITY.reviewerIndex.email].split(' (')[1].replace(')', ''),
48618
+ nameAndEmail: people.nameAndEmail,
48619
+ name: people.name,
48620
+ email: people.email,
48615
48621
  employee_id: element[RESPONSIBILITY.reviewerIndex.id],
48616
48622
  my_member_id: element[RESPONSIBILITY.reviewerIndex.id],
48617
48623
  };
@@ -48619,6 +48625,13 @@ class AddMultipleResponsibilityWithTabComponent {
48619
48625
  }
48620
48626
  /* Checking if the element[2] is not empty and not equal to space. If it is not empty and not
48621
48627
  equal to space, it will create an object and push it to the assignorsList array. */
48628
+ if (this.hasValue(element[RESPONSIBILITY.assignorIndex.name])) {
48629
+ this.addPeopleDropdownName(element[RESPONSIBILITY.assignorIndex.name]);
48630
+ if (this.hasValue(element[RESPONSIBILITY.assignorIndex.email])) {
48631
+ this.addPeopleDropdownName(element[RESPONSIBILITY.assignorIndex.email]);
48632
+ this.addPeopleDropdownName(`${String(element[RESPONSIBILITY.assignorIndex.name]).trim()} (${String(element[RESPONSIBILITY.assignorIndex.email]).trim()})`);
48633
+ }
48634
+ }
48622
48635
  if (element[RESPONSIBILITY.assignorIndex.id]) {
48623
48636
  const assignor = {
48624
48637
  nameAndEmail: element[RESPONSIBILITY.assignorIndex.name],
@@ -48631,12 +48644,12 @@ class AddMultipleResponsibilityWithTabComponent {
48631
48644
  this.templateInfo.assignorsList.push(assignor);
48632
48645
  }
48633
48646
  });
48647
+ this.collectEmailDisplayNamesFromSheet(tempList);
48634
48648
  /* Creating a list of child categories and attaching them to their parent program */
48635
48649
  if (this.templateInfo.categoryList?.length) {
48636
48650
  this.templateInfo.categoryList.forEach((program, i) => {
48637
- const index = (tempList[0] || []).findIndex((cell) => cell == program?.programId);
48638
- if (index !== -1) {
48639
- const childCategory = [];
48651
+ const childCategory = [];
48652
+ this.getProgramCategoryIdColumns(tempList[0], program?.programId).forEach((index) => {
48640
48653
  for (let j = 1; true; j++) {
48641
48654
  if (tempList[j] && tempList[j][index]) {
48642
48655
  childCategory.push({
@@ -48648,11 +48661,69 @@ class AddMultipleResponsibilityWithTabComponent {
48648
48661
  break;
48649
48662
  }
48650
48663
  }
48651
- this.templateInfo.categoryList[i]['childCategory'] = childCategory;
48652
- }
48664
+ });
48665
+ this.templateInfo.categoryList[i]['childCategory'] = childCategory;
48653
48666
  });
48654
48667
  }
48655
48668
  }
48669
+ /**
48670
+ * Child categories live in later Data-sheet columns whose header is the program id.
48671
+ * Skip the program listing id columns (22-29 area) — those same ids also appear there
48672
+ * for the first program of each type, which would attach the wrong names.
48673
+ */
48674
+ getProgramCategoryIdColumns(headerRow = [], programId) {
48675
+ if (programId == null || programId === '') {
48676
+ return [];
48677
+ }
48678
+ const programListingIdColumns = new Set([
48679
+ RESPONSIBILITY.programIndex.regulations.id,
48680
+ RESPONSIBILITY.programIndex.standards.id,
48681
+ RESPONSIBILITY.programIndex.internalControls.id,
48682
+ RESPONSIBILITY.programIndex.others.id,
48683
+ ]);
48684
+ const indexes = [];
48685
+ (headerRow || []).forEach((cell, index) => {
48686
+ if (!programListingIdColumns.has(index) && cell == programId) {
48687
+ indexes.push(index);
48688
+ }
48689
+ });
48690
+ return indexes;
48691
+ }
48692
+ parsePeopleListCell(value) {
48693
+ const nameAndEmail = value == null ? '' : String(value).trim();
48694
+ const emailMatch = nameAndEmail.match(/\(([^)]*@[^)]*)\)\s*$/);
48695
+ return {
48696
+ nameAndEmail,
48697
+ name: nameAndEmail.replace(/\s*\([^)]*@[^)]*\)\s*$/, '').trim() || nameAndEmail,
48698
+ email: emailMatch ? emailMatch[1].trim() : '',
48699
+ };
48700
+ }
48701
+ addPeopleDropdownName(value) {
48702
+ if (!this.hasValue(value)) {
48703
+ return;
48704
+ }
48705
+ if (!this.templateInfo.peopleDropdownNames) {
48706
+ this.templateInfo.peopleDropdownNames = [];
48707
+ }
48708
+ const name = String(value).trim();
48709
+ const alreadyAdded = this.templateInfo.peopleDropdownNames.some((existing) => this.normalizeDropdownValue(existing) === this.normalizeDropdownValue(name));
48710
+ if (!alreadyAdded) {
48711
+ this.templateInfo.peopleDropdownNames.push(name);
48712
+ }
48713
+ }
48714
+ collectEmailDisplayNamesFromSheet(tempList = []) {
48715
+ (tempList || []).forEach((row) => {
48716
+ (row || []).forEach((cell) => {
48717
+ if (cell == null) {
48718
+ return;
48719
+ }
48720
+ const text = String(cell);
48721
+ if (/\([^)]*@[^)]*\)/.test(text)) {
48722
+ this.addPeopleDropdownName(text);
48723
+ }
48724
+ });
48725
+ });
48726
+ }
48656
48727
  getProgramDetails(element, index, type) {
48657
48728
  if (element[index.id] && typeof element[index.id] === 'number') {
48658
48729
  return {
@@ -49164,21 +49235,6 @@ class AddMultipleResponsibilityWithTabComponent {
49164
49235
  });
49165
49236
  return names;
49166
49237
  }
49167
- getAssignorDropdownNames() {
49168
- const names = [];
49169
- (this.templateInfo?.assignorsList || []).forEach((assignor) => {
49170
- if (this.hasValue(assignor?.nameAndEmail)) {
49171
- names.push(String(assignor.nameAndEmail).trim());
49172
- }
49173
- if (this.hasValue(assignor?.name)) {
49174
- names.push(String(assignor.name).trim());
49175
- }
49176
- if (this.hasValue(assignor?.name) && this.hasValue(assignor?.email)) {
49177
- names.push(`${String(assignor.name).trim()} (${String(assignor.email).trim()})`);
49178
- }
49179
- });
49180
- return names;
49181
- }
49182
49238
  /**
49183
49239
  * Entrusted By in the xlsx dropdown is the people list in `Name (email)` form
49184
49240
  * (same source as Entrusted To / Reviewer), not the assignor name-only column.
@@ -49187,33 +49243,79 @@ class AddMultipleResponsibilityWithTabComponent {
49187
49243
  if (!this.hasValue(value)) {
49188
49244
  return true;
49189
49245
  }
49190
- if (this.returnIds(value, 'entrusted_to')) {
49246
+ const normalized = this.normalizeDropdownValue(value);
49247
+ const valueEmail = this.extractDropdownEmail(value);
49248
+ const valueName = this.extractDropdownName(value);
49249
+ const dropdownNames = this.templateInfo?.peopleDropdownNames || [];
49250
+ if (dropdownNames.some((name) => this.normalizeDropdownValue(name) === normalized)) {
49191
49251
  return true;
49192
49252
  }
49193
- if (this.returnIds(value, 'reviewer')?.name) {
49253
+ if (valueEmail &&
49254
+ dropdownNames.some((name) => {
49255
+ const nameEmail = this.extractDropdownEmail(name);
49256
+ return (nameEmail === valueEmail ||
49257
+ this.normalizeDropdownValue(name) === valueEmail);
49258
+ })) {
49194
49259
  return true;
49195
49260
  }
49196
- const peopleNames = [
49197
- ...this.getAssignorDropdownNames(),
49198
- ...this.getTemplateListNames(this.templateInfo?.assigneesList, 'nameAndEmail'),
49199
- ...this.getTemplateListNames(this.templateInfo?.reviewerList, 'nameAndEmail'),
49261
+ const users = [
49262
+ ...(this.templateInfo?.assignorsList || []),
49263
+ ...(this.templateInfo?.assigneesList || []),
49264
+ ...(this.templateInfo?.reviewerList || []),
49200
49265
  ];
49201
- const normalized = String(value).trim().toLowerCase();
49202
- return peopleNames.some((name) => String(name).trim().toLowerCase() === normalized);
49266
+ return users.some((user) => {
49267
+ const constructed = this.hasValue(user?.name) && this.hasValue(user?.email)
49268
+ ? `${String(user.name).trim()} (${String(user.email).trim()})`
49269
+ : '';
49270
+ const candidates = [
49271
+ user?.nameAndEmail,
49272
+ user?.name,
49273
+ user?.email,
49274
+ constructed,
49275
+ ];
49276
+ if (candidates.some((candidate) => this.hasValue(candidate) &&
49277
+ this.normalizeDropdownValue(candidate) === normalized)) {
49278
+ return true;
49279
+ }
49280
+ if (valueEmail &&
49281
+ this.hasValue(user?.email) &&
49282
+ this.normalizeDropdownValue(user.email) === valueEmail) {
49283
+ return true;
49284
+ }
49285
+ if (valueName &&
49286
+ this.hasValue(user?.name) &&
49287
+ this.normalizeDropdownValue(user.name) === valueName) {
49288
+ return true;
49289
+ }
49290
+ return (!!valueEmail &&
49291
+ candidates.some((candidate) => this.hasValue(candidate) &&
49292
+ this.extractDropdownEmail(candidate) === valueEmail));
49293
+ });
49294
+ }
49295
+ normalizeDropdownValue(value) {
49296
+ return String(value ?? '')
49297
+ .replace(/[\u200B-\u200D\uFEFF]/g, '')
49298
+ .replace(/\u00a0/g, ' ')
49299
+ .replace(/\s+/g, ' ')
49300
+ .trim()
49301
+ .toLowerCase();
49302
+ }
49303
+ extractDropdownEmail(value) {
49304
+ const match = String(value ?? '').match(/\(([^)]*@[^)]*)\)\s*$/);
49305
+ return match ? this.normalizeDropdownValue(match[1]) : '';
49306
+ }
49307
+ extractDropdownName(value) {
49308
+ return this.normalizeDropdownValue(String(value ?? '').replace(/\s*\([^)]*@[^)]*\)\s*$/, ''));
49203
49309
  }
49204
49310
  isInStaticDropdown(value, options) {
49205
- if (!this.hasValue(value)) {
49206
- return true;
49207
- }
49208
- const normalized = String(value).trim().toLowerCase();
49209
- return options.some((option) => option.toLowerCase() === normalized);
49311
+ return this.isInDropdownList(value, options);
49210
49312
  }
49211
49313
  isInDropdownList(value, options) {
49212
49314
  if (!this.hasValue(value)) {
49213
49315
  return true;
49214
49316
  }
49215
- const normalized = String(value).trim();
49216
- return options.some((option) => option === normalized);
49317
+ const normalized = this.normalizeDropdownValue(value);
49318
+ return (options || []).some((option) => this.normalizeDropdownValue(option) === normalized);
49217
49319
  }
49218
49320
  isValidDropdownDay(value) {
49219
49321
  if (!this.hasValue(value)) {