@dynamatix/gb-schemas 2.3.283 → 2.3.284

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;AA2rBhC,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,42 @@ 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
614
  // Format the rental income value
615
615
  const rentalValue = typeof mortgage.monthlyRentalIncome === 'string'
616
- ? mortgage.monthlyRentalIncome
617
- : mortgage.monthlyRentalIncome.toString();
616
+ ? mortgage.monthlyRentalIncome.toFixed(2)
617
+ : mortgage.monthlyRentalIncome.toString().toFixed(2);
618
618
  rentalIncome = `£${rentalValue}`;
619
- console.log('Rental income:', rentalIncome);
620
619
  }
621
620
  // Get finance amount from loanRequired
622
621
  if (mortgage.loanRequired !== undefined && mortgage.loanRequired !== null) {
623
622
  const financeValue = typeof mortgage.loanRequired === 'string'
624
- ? mortgage.loanRequired
625
- : mortgage.loanRequired.toString();
623
+ ? mortgage.loanRequired.toFixed(2)
624
+ : mortgage.loanRequired.toString().toFixed(2);
626
625
  monthlyFinance = `£${financeValue}`;
627
- console.log('Monthly finance (loanRequired):', monthlyFinance);
628
626
  }
629
627
  // Get occupancy information from mortgage
630
628
  if (mortgage.proposedTenantsLids && Array.isArray(mortgage.proposedTenantsLids) && mortgage.proposedTenantsLids.length > 0) {
@@ -632,12 +630,11 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
632
630
  const firstTenant = mortgage.proposedTenantsLids[0];
633
631
  if (firstTenant && typeof firstTenant === 'object' && firstTenant.name) {
634
632
  occupancy = firstTenant.name;
635
- console.log('Occupancy:', occupancy);
636
- }
637
- else {
638
- occupancy = '-';
639
633
  }
640
634
  }
635
+ else {
636
+ occupancy = '-';
637
+ }
641
638
  }
642
639
  // Create HTML content
643
640
  const summaryContent = `
@@ -647,11 +644,9 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
647
644
  <div><p class="text-bold">Rental Income:</p> <span>${rentalIncome}</span></div>
648
645
  <div><p class="text-bold">Occupancy:</p> <span>${occupancy}</span></div>
649
646
  `;
650
- console.log('Final summary content:', summaryContent);
651
647
  return summaryContent;
652
648
  }
653
- console.log('No application found');
654
- return 'N/A';
649
+ return '-';
655
650
  });
656
651
  applyAuditMiddleware(welcomeCallSchema, "ApplicantWelcomeCall");
657
652
  // 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.284",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",