@dynamatix/gb-schemas 2.3.283 → 2.3.285

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.
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-welcome-call.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-welcome-call.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAosBhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4D,CAAC;AAEnF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"applicant-welcome-call.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-welcome-call.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAyrBhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4D,CAAC;AAEnF,eAAe,gBAAgB,CAAC"}
@@ -341,7 +341,7 @@ welcomeCallSchema.virtual('otherApplicantsNameAndDOB').get(function () {
341
341
  return 'N/A';
342
342
  }
343
343
  // Format each other applicant as: "First and middle names, last name, Date of birth"
344
- const formattedApplicants = otherApplicants.map((applicant) => {
344
+ const formattedApplicants = otherApplicants.map((applicant, index) => {
345
345
  // Check if applicant is an ObjectId (not populated)
346
346
  if (typeof applicant === 'string' || (applicant.constructor && applicant.constructor.name === 'ObjectId')) {
347
347
  return null; // Skip unpopulated references
@@ -379,11 +379,17 @@ welcomeCallSchema.virtual('otherApplicantsNameAndDOB').get(function () {
379
379
  }
380
380
  }
381
381
  }
382
- // Format as "First and middle names, last name, Date of birth"
383
- return `${fullFirstName}, ${lastName}, ${formattedDOB}`;
384
- }).filter((line) => line && line.trim() !== ', ,' && line.trim() !== '');
385
- // Join all applicants with newline
386
- return formattedApplicants.join('\n');
382
+ const isLast = index === otherApplicants.length - 1;
383
+ const comma = isLast ? '' : ',';
384
+ // Format as an HTML line (with bold labels and inline values)
385
+ return `
386
+ <div class="applicant-line">
387
+ <span>${fullFirstName}, ${lastName}, ${formattedDOB}${comma}</span>
388
+ </div>
389
+ `;
390
+ }).filter((line) => line && line.trim() !== '');
391
+ // Join all applicants as HTML (no \n needed)
392
+ return formattedApplicants.join('');
387
393
  }
388
394
  }
389
395
  // If application not populated or no applicants, return "N/A"
@@ -561,7 +567,6 @@ welcomeCallSchema.virtual('initialRatePercentage').get(function () {
561
567
  });
562
568
  // Virtual property for finance summary HTML
563
569
  welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
564
- console.log('financeSummaryHtml virtual field called');
565
570
  let application = null;
566
571
  if (this.applicantId && typeof this.applicantId === 'object' && !(typeof this.applicantId.toHexString === 'function') && this.applicantId.applicationId) {
567
572
  application = this.applicantId.applicationId;
@@ -570,11 +575,9 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
570
575
  application = this.applicationId;
571
576
  }
572
577
  else {
573
- console.log('No application found');
574
- return 'N/A';
578
+ return '-';
575
579
  }
576
580
  if (application) {
577
- console.log('Application data:', JSON.stringify(application, null, 2));
578
581
  // Initialize summary data
579
582
  let product = '';
580
583
  let financeTerm = '';
@@ -584,47 +587,40 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
584
587
  // Get product information (first 3 characters)
585
588
  if (application.selectedProduct && typeof application.selectedProduct === 'string') {
586
589
  product = application.selectedProduct;
587
- console.log('Product from selectedProduct:', product);
588
590
  }
589
591
  else if (application.productId && typeof application.productId === 'object' && application.productId.selectedProduct) {
590
592
  product = application.productId.selectedProduct;
591
- console.log('Product from productId:', product);
593
+ }
594
+ else {
595
+ product = '-';
592
596
  }
593
597
  // Get finance term from productId if available
594
598
  if (application.productId && typeof application.productId === 'object') {
595
599
  if (application.productId.numberOfYearsToRepay !== undefined && application.productId.numberOfYearsToRepay !== null) {
596
600
  financeTerm = `${application.productId.numberOfYearsToRepay} year finance term`;
597
- console.log('Finance term from productId:', financeTerm);
598
601
  }
599
602
  }
600
603
  else {
601
- console.log('No productId found or not populated');
604
+ financeTerm = '-';
602
605
  }
603
- // Note: productFeatures is a separate collection that needs to be populated in form configuration
604
- // If you need productFeatures data, it should be populated separately in the form config
605
606
  // Get rental income from mortgage - mortgageId is at application level
606
607
  let mortgage = null;
607
608
  if (application.mortgageId && typeof application.mortgageId === 'object') {
608
609
  mortgage = application.mortgageId;
609
610
  }
610
611
  if (mortgage) {
611
- console.log('Mortgage data:', JSON.stringify(mortgage, null, 2));
612
612
  // Get rental income - check if it exists (even if 0)
613
613
  if (mortgage.monthlyRentalIncome !== undefined && mortgage.monthlyRentalIncome !== null) {
614
- // Format the rental income value
615
- const rentalValue = typeof mortgage.monthlyRentalIncome === 'string'
616
- ? mortgage.monthlyRentalIncome
617
- : mortgage.monthlyRentalIncome.toString();
614
+ // Convert to number first, then format
615
+ const numericValue = Number(mortgage.monthlyRentalIncome);
616
+ const rentalValue = isNaN(numericValue) ? '0.00' : numericValue.toFixed(2);
618
617
  rentalIncome = `£${rentalValue}`;
619
- console.log('Rental income:', rentalIncome);
620
618
  }
621
619
  // Get finance amount from loanRequired
622
620
  if (mortgage.loanRequired !== undefined && mortgage.loanRequired !== null) {
623
- const financeValue = typeof mortgage.loanRequired === 'string'
624
- ? mortgage.loanRequired
625
- : mortgage.loanRequired.toString();
621
+ const numericValue = Number(mortgage.loanRequired);
622
+ const financeValue = isNaN(numericValue) ? '0.00' : numericValue.toFixed(2);
626
623
  monthlyFinance = `£${financeValue}`;
627
- console.log('Monthly finance (loanRequired):', monthlyFinance);
628
624
  }
629
625
  // Get occupancy information from mortgage
630
626
  if (mortgage.proposedTenantsLids && Array.isArray(mortgage.proposedTenantsLids) && mortgage.proposedTenantsLids.length > 0) {
@@ -632,12 +628,11 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
632
628
  const firstTenant = mortgage.proposedTenantsLids[0];
633
629
  if (firstTenant && typeof firstTenant === 'object' && firstTenant.name) {
634
630
  occupancy = firstTenant.name;
635
- console.log('Occupancy:', occupancy);
636
- }
637
- else {
638
- occupancy = '-';
639
631
  }
640
632
  }
633
+ else {
634
+ occupancy = '-';
635
+ }
641
636
  }
642
637
  // Create HTML content
643
638
  const summaryContent = `
@@ -647,11 +642,9 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
647
642
  <div><p class="text-bold">Rental Income:</p> <span>${rentalIncome}</span></div>
648
643
  <div><p class="text-bold">Occupancy:</p> <span>${occupancy}</span></div>
649
644
  `;
650
- console.log('Final summary content:', summaryContent);
651
645
  return summaryContent;
652
646
  }
653
- console.log('No application found');
654
- return 'N/A';
647
+ return '-';
655
648
  });
656
649
  applyAuditMiddleware(welcomeCallSchema, "ApplicantWelcomeCall");
657
650
  // Apply workflow plugin to the schema
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "2.3.283",
3
+ "version": "2.3.285",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",