Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rental-agreement): security deposit #16661

Open
wants to merge 1 commit into
base: rental-agreement-application
Choose a base branch
from

Conversation

addi
Copy link
Contributor

@addi addi commented Oct 30, 2024

https://app.asana.com/0/1208271027457465/1208501204323908

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced a new application type for rental agreements, enhancing the template loading mechanism.
    • Added a comprehensive rental agreement template, including forms for prerequisites, rental housing information, and signing.
    • Implemented internationalization support for various sections of the rental agreement.
  • Documentation

    • Added README and various message files for localization and guidance on using the rental agreement features.
  • Configuration

    • Introduced new TypeScript and Babel configurations for the rental agreement module, streamlining development and testing processes.

@addi addi requested review from a team as code owners October 30, 2024 23:02
Copy link
Contributor

coderabbitai bot commented Oct 30, 2024

Walkthrough

The changes in this pull request introduce a new rental agreement application type within the template loader, along with several configuration files, forms, and internationalization messages specific to the rental agreement. A new module structure is created, including types, utility functions, and feature flags to support the new application type. The updates enhance the modularity and extensibility of the application, allowing for better management of rental agreement data and user interactions.

Changes

File Path Change Summary
libs/application/template-loader/src/lib/templateLoaders.ts Added new entry for ApplicationTypes.RENTAL_AGREEMENT with dynamic import from '@island.is/application/templates/rental-agreement'.
libs/application/templates/rental-agreement/.babelrc New Babel configuration file created, using preset @nx/react/babel.
libs/application/templates/rental-agreement/.eslintrc.json New ESLint configuration file created, extending rules from @nx/react.
libs/application/templates/rental-agreement/README.md New README file created with instructions for running unit tests.
libs/application/templates/rental-agreement/babel-jest.config.json New Jest configuration file added, specifying Babel presets for testing.
libs/application/templates/rental-agreement/jest.config.ts New Jest configuration file created, setting up test environment and coverage reporting.
libs/application/templates/rental-agreement/project.json New project configuration file added, defining library structure and targets for linting and testing.
libs/application/templates/rental-agreement/src/dataProviders/index.ts Exported new APIs: UserProfileApi, NationalRegistryUserApi, NationalRegistrySpouseApi.
libs/application/templates/rental-agreement/src/forms/RentalHousingInfo.ts New constant RentalHousingInfo added, organizing rental housing information.
libs/application/templates/rental-agreement/src/forms/prerequisites/externalData.ts New exported constant externalData introduced for handling external data in the application.
libs/application/templates/rental-agreement/src/forms/prerequisites/intro.ts New exported constant intro added for prerequisites section.
libs/application/templates/rental-agreement/src/forms/prerequisitesForm.ts New form PrerequisitesForm introduced, including components for prerequisites.
libs/application/templates/rental-agreement/src/forms/rentalAgreementForm.ts New form RentalAgreementForm defined, managing rental agreement details.
libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingCondition.ts New component RentalHousingCondition added for managing housing conditions.
libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingFireProtections.ts New component RentalHousingFireProtections added for fire protection requirements.
libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingLandlordInfo.ts New component RentalHousingLandlordInfo added for landlord information.
libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingPropertyInfo.ts New component RentalHousingPropertyInfo added for property information.
libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingSpecialProvisions.ts New component RentalHousingSpecialProvisions added for special provisions.
libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingTenantInfo.ts New component RentalHousingTenantInfo added for tenant information.
libs/application/templates/rental-agreement/src/forms/rentalPeriod.ts New section RentalPeriod added for managing rental period information.
libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodAmount.ts New component RentalPeriodAmount added for managing rental amounts.
libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodDetails.ts New component RentalPeriodDetails added for rental period details.
libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodOtherFees.ts New component RentalPeriodOtherFees added for additional fees.
libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodSecurityDeposit.ts New component RentalPeriodSecurityDeposit added for security deposit management.
libs/application/templates/rental-agreement/src/forms/signing.ts New section Signing added for the signing process.
libs/application/templates/rental-agreement/src/forms/summary.ts New section Summary added for summarizing the agreement.
libs/application/templates/rental-agreement/src/index.ts New entry point for the Rental Agreement Template, exporting components and functions.
libs/application/templates/rental-agreement/src/lib/RentalAgreementTemplate.ts New template for rental agreement application defined, including state management and events.
libs/application/templates/rental-agreement/src/lib/constants.ts New enumerations and function related to rental agreements introduced.
libs/application/templates/rental-agreement/src/lib/dataSchema.ts New schema validation structure for rental agreement data introduced.
libs/application/templates/rental-agreement/src/lib/messages/dataSchema.ts New internationalized messages for data schema validation introduced.
libs/application/templates/rental-agreement/src/lib/messages/housing/*.ts Several new files added for internationalized messages related to housing conditions, landlord details, etc.
libs/application/templates/rental-agreement/src/lib/types.ts New types related to external data for rental agreements defined.
libs/application/templates/rental-agreement/src/lib/utils.ts New utility functions for string manipulation and data retrieval added.
libs/application/templates/rental-agreement/tsconfig.json New TypeScript configuration file added for the rental agreement module.
libs/application/templates/rental-agreement/tsconfig.lib.json New TypeScript configuration file for library compilation added.
libs/application/templates/rental-agreement/tsconfig.spec.json New TypeScript configuration file for testing added.
libs/application/types/src/lib/ApplicationTypes.ts New entry for RENTAL_AGREEMENT added to the ApplicationTypes enum.
libs/application/types/src/lib/InstitutionContentfulIds.ts New entry added to InstitutionContentfulIds enum.
libs/application/types/src/lib/InstitutionMapper.ts New mapping for ApplicationTypes.RENTAL_AGREEMENT added.
libs/application/types/src/lib/InstitutionNationalIds.ts New entry added to InstitutionNationalIds enum.
libs/application/types/src/lib/InstitutionTypes.ts New entry added to InstitutionTypes enum.
libs/feature-flags/src/lib/features.ts New feature flag rentalAgreement added to control visibility.
tsconfig.base.json New path mapping added for rental agreement module.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RentalAgreementTemplate
    participant FormComponents
    participant API

    User->>RentalAgreementTemplate: Start Rental Agreement
    RentalAgreementTemplate->>FormComponents: Load Prerequisites Form
    FormComponents->>User: Display Prerequisites
    User->>FormComponents: Fill in Data
    FormComponents->>API: Submit Data
    API->>RentalAgreementTemplate: Process Data
    RentalAgreementTemplate->>User: Display Confirmation
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

🛑 Comments failed to post (61)
libs/application/templates/rental-agreement/src/lib/types.ts (1)

3-9: 🛠️ Refactor suggestion

Consider enhancing type safety and documentation

  1. The date field could benefit from a more specific type like ISO8601String or Date
  2. Consider adding JSDoc comments to document the interface's purpose and field usage
+/**
+ * External data structure for rental agreement applications
+ * Contains national registry information with status tracking
+ */
 export interface ExternalData {
   nationalRegistry: {
     data: NationalRegistryIndividual
-    date: string
+    date: ISO8601String // Consider creating a type alias for ISO8601String = string
     status: StatusProvider
   }
 }

Committable suggestion was skipped due to low confidence.

libs/application/templates/rental-agreement/src/lib/messages/dataSchema.ts (1)

1-14: 🛠️ Refactor suggestion

Consider enhancing type safety with TypeScript.

The implementation looks good but could benefit from explicit TypeScript types for better maintainability and type safety.

Consider applying this enhancement:

 import { defineMessages } from 'react-intl'
+
+type DataSchemaMessages = {
+  nationalId: { id: string; defaultMessage: string; description: string }
+  phoneNumber: { id: string; defaultMessage: string; description: string }
+}
 
-export const dataSchema = defineMessages({
+export const dataSchema = defineMessages<DataSchemaMessages>({
   nationalId: {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

import { defineMessages } from 'react-intl'

type DataSchemaMessages = {
  nationalId: { id: string; defaultMessage: string; description: string }
  phoneNumber: { id: string; defaultMessage: string; description: string }
}

export const dataSchema = defineMessages<DataSchemaMessages>({
  nationalId: {
    id: 'ra.application:dataSchema.national.id',
    defaultMessage: 'Kennitala er ekki á réttu formi',
    description: 'Error message when nationalid is wrong',
  },
  phoneNumber: {
    id: 'ra.application:dataSchema.phoneNumber',
    defaultMessage: 'Símanúmerið þarf að vera gilt.',
    description: 'Error message when phone number is invalid.',
  },
})
libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodOtherFees.ts (1)

7-23: 🛠️ Refactor suggestion

Consider enhancing the form structure and accessibility.

  1. The same title "Önnur gjöld" is repeated at three levels (subsection, multi-field, and text field), which might be confusing for users.
  2. A text field might not be the most appropriate format for fee input. Consider using a number field with currency validation.
  3. Missing helper text or description to guide users on what types of fees should be entered.

Consider applying these improvements:

 export const RentalPeriodOtherFees = buildSubSection({
   id: 'rentalPeriodOtherFees',
   title: 'Önnur gjöld',
   children: [
     buildMultiField({
       id: 'rentalPeriodOtherFeesDetails',
-      title: 'Önnur gjöld',
+      title: 'Upplýsingar um önnur gjöld', // "Information about other fees"
       children: [
         buildTextField({
           id: 'rentalPeriodOtherFeesInput',
-          title: 'Önnur gjöld',
-          format: 'text',
+          title: 'Upphæð', // "Amount"
+          format: 'number',
+          description: 'Vinsamlegast tilgreinið upphæð annarra gjalda ef einhver eru', // "Please specify the amount of other fees if any"
+          placeholder: '0',
+          variant: 'currency',
         }),
       ],
     }),
   ],
 })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

export const RentalPeriodOtherFees = buildSubSection({
  id: 'rentalPeriodOtherFees',
  title: 'Önnur gjöld',
  children: [
    buildMultiField({
      id: 'rentalPeriodOtherFeesDetails',
      title: 'Upplýsingar um önnur gjöld',
      children: [
        buildTextField({
          id: 'rentalPeriodOtherFeesInput',
          title: 'Upphæð',
          format: 'number',
          description: 'Vinsamlegast tilgreinið upphæð annarra gjalda ef einhver eru',
          placeholder: '0',
          variant: 'currency',
        }),
      ],
    }),
  ],
})
libs/application/templates/rental-agreement/src/forms/rentalPeriod.ts (2)

9-10: 🛠️ Refactor suggestion

Consider extracting the title to a translation file for better maintainability.

The hardcoded Icelandic title 'Tímabil og verð' should be moved to a translation file to support internationalization and improve reusability across different locales.

Consider applying this enhancement:

+import { useTranslations } from '@island.is/application/core'

 export const RentalPeriod = buildSection({
   id: 'rentalPeriod',
-  title: 'Tímabil og verð',
+  title: useTranslations('rental.agreement.period.title'),
   children: [
     // ...
   ],
 })

Committable suggestion was skipped due to low confidence.


8-17: 🛠️ Refactor suggestion

Consider adding TypeScript type annotations for better type safety.

The section configuration could benefit from explicit type annotations to ensure type safety and improve maintainability.

Consider applying this enhancement:

+import { BuildSectionProps } from '@island.is/application/core'

-export const RentalPeriod = buildSection({
+export const RentalPeriod = buildSection<BuildSectionProps>({
   id: 'rentalPeriod',
   title: 'Tímabil og verð',
   children: [
     RentalPeriodDetails,
     RentalPeriodAmount,
     RentalPeriodSecurityDeposit,
     RentalPeriodOtherFees,
   ],
 })

Committable suggestion was skipped due to low confidence.

libs/application/templates/rental-agreement/src/forms/signing.ts (1)

8-25: 🛠️ Refactor suggestion

Extract repeated strings and add i18n support.

The same title and description are duplicated across different levels. Consider:

  1. Using i18n keys instead of hardcoded strings
  2. Extracting common strings to constants

Here's a suggested refactor:

+import { defineMessages } from '@island.is/application/core'
+
+const messages = defineMessages({
+  sectionTitle: {
+    id: 'rental.agreement.signing.title',
+    defaultMessage: 'Undirritun',
+  },
+  signDescription: {
+    id: 'rental.agreement.signing.description',
+    defaultMessage: 'Vinsamlegast undirritið samninginn',
+  },
+})

 export const Signing: Section = buildSection({
   id: 'signing',
-  title: 'Undirritun',
+  title: messages.sectionTitle,
   children: [
     buildMultiField({
       id: 'signingInfo',
-      title: 'Undirritun',
-      description: 'Vinsamlegast undirritið samninginn',
+      title: messages.sectionTitle,
+      description: messages.signDescription,
       children: [
         buildDescriptionField({
           id: 'signingDescription',
-          title: 'Undirritun',
-          description: 'Vinsamlegast undirritið samninginn',
+          title: messages.sectionTitle,
+          description: messages.signDescription,
         }),
       ],
     }),
   ],
 })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

import { defineMessages } from '@island.is/application/core'

const messages = defineMessages({
  sectionTitle: {
    id: 'rental.agreement.signing.title',
    defaultMessage: 'Undirritun',
  },
  signDescription: {
    id: 'rental.agreement.signing.description',
    defaultMessage: 'Vinsamlegast undirritið samninginn',
  },
})

export const Signing: Section = buildSection({
  id: 'signing',
  title: messages.sectionTitle,
  children: [
    buildMultiField({
      id: 'signingInfo',
      title: messages.sectionTitle,
      description: messages.signDescription,
      children: [
        buildDescriptionField({
          id: 'signingDescription',
          title: messages.sectionTitle,
          description: messages.signDescription,
        }),
      ],
    }),
  ],
})
libs/application/templates/rental-agreement/src/forms/prerequisites/intro.ts (2)

9-9: 🛠️ Refactor suggestion

Update messages reference.

If implementing the specific import suggestion above, update this line accordingly.

-const messages = m.prerequisites.intro
+const messages = prerequisites.intro

Committable suggestion was skipped due to low confidence.


7-7: 🛠️ Refactor suggestion

Consider using specific imports for messages.

Instead of importing the entire messages namespace, consider importing only the required prerequisites.intro subset for better tree-shaking.

-import * as m from '../../lib/messages'
+import { prerequisites } from '../../lib/messages'

Committable suggestion was skipped due to low confidence.

libs/application/templates/rental-agreement/src/forms/RentalHousingInfo.ts (1)

10-21: 🛠️ Refactor suggestion

Enhance type safety and internationalization.

Two suggestions for improvement:

  1. Add type annotations to the configuration object for better type safety and documentation.
  2. Consider extracting the title to a translation file for better maintainability and reusability across different locales.

Here's how you could improve the code:

-export const RentalHousingInfo = buildSection({
+export const RentalHousingInfo = buildSection<BuildSectionProps>({
   id: 'rentalHousingInfo',
-  title: 'Húsnæðið',
+  title: m.rentalHousingInfo.title,
   children: [
     RentalHousingPropertyInfo,
     RentalHousingLandlordInfo,
     RentalHousingTenantInfo,
     RentalHousingSpecialProvisions,
     RentalHousingCondition,
     RentalHousingFireProtections,
   ],
 })

Don't forget to:

  1. Import the messages: import { m } from '../messages'
  2. Add the translation key in your messages file

Committable suggestion was skipped due to low confidence.

libs/application/templates/rental-agreement/src/forms/prerequisites/externalData.ts (1)

20-31: ⚠️ Potential issue

Internationalize submit field text.

The submit field configuration contains hardcoded text that should be internationalized:

  • Empty title string
  • Hardcoded Icelandic action name "Hefja umsókn"

Apply this diff to use i18n messages:

  submitField: buildSubmitField({
    id: 'toDraft',
-   title: '',
+   title: m.prerequisites.externalData.submitTitle,
    refetchApplicationAfterSubmit: true,
    actions: [
      {
        event: DefaultEvents.SUBMIT,
-       name: 'Hefja umsókn',
+       name: m.prerequisites.externalData.submitActionName,
        type: 'primary',
      },
    ],
  }),

Committable suggestion was skipped due to low confidence.

libs/application/templates/rental-agreement/src/lib/constants.ts (2)

20-39: 🛠️ Refactor suggestion

Consider grouping related enums under a namespace.

The housing category enums are closely related and could benefit from being grouped under a namespace for better organization and type safety.

+export namespace RentalHousing {
-export enum rentalHousingCategoryTypes {
+  export enum CategoryTypes {
   ENTIRE_HOME = 'entireHome',
   ROOM = 'room',
   COMMERCIAL = 'commercial',
 }

-export enum rentalHousingCategoryClass {
+  export enum CategoryClass {
   GENERAL_MARKET = 'generalMarket',
   SPECIAL_GROUPS = 'specialGroups',
 }

-export enum rentalHousingCategoryClassGroup {
+  export enum CategoryClassGroup {
   STUDENT_HOUSING = 'studentHousing',
   SENIOR_CITIZEN_HOUSING = 'seniorCitizenHousing',
   COMMUNE = 'commune',
   HALFWAY_HOUSE = 'halfwayHouse',
   SOCIAL_HOUSING = 'socialHousing',
   INCOME_BASED_HOUSING = 'incomeBasedHousing',
   EMPLOYEE_HOUSING = 'employeeHousing',
 }
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

export namespace RentalHousing {
  export enum CategoryTypes {
    ENTIRE_HOME = 'entireHome',
    ROOM = 'room',
    COMMERCIAL = 'commercial',
  }

  export enum CategoryClass {
    GENERAL_MARKET = 'generalMarket',
    SPECIAL_GROUPS = 'specialGroups',
  }

  export enum CategoryClassGroup {
    STUDENT_HOUSING = 'studentHousing',
    SENIOR_CITIZEN_HOUSING = 'seniorCitizenHousing',
    COMMUNE = 'commune',
    HALFWAY_HOUSE = 'halfwayHouse',
    SOCIAL_HOUSING = 'socialHousing',
    INCOME_BASED_HOUSING = 'incomeBasedHousing',
    EMPLOYEE_HOUSING = 'employeeHousing',
  }
}

58-64: 🛠️ Refactor suggestion

Improve maintainability of time conversion logic.

The function could benefit from the following improvements:

  1. Use camelCase for parameter naming (days instead of Days)
  2. Extract magic numbers into named constants
+const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
+
-export const pruneAfterDays = (Days: number): StateLifeCycle => {
+export const pruneAfterDays = (days: number): StateLifeCycle => {
   return {
     shouldBeListed: false,
     shouldBePruned: true,
-    whenToPrune: Days * 24 * 3600 * 1000,
+    whenToPrune: days * MILLISECONDS_PER_DAY,
   }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;

export const pruneAfterDays = (days: number): StateLifeCycle => {
  return {
    shouldBeListed: false,
    shouldBePruned: true,
    whenToPrune: days * MILLISECONDS_PER_DAY,
  }
}
libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingSpecialProvisions.ts (2)

1-8: 🛠️ Refactor suggestion

Consider exporting field types for reuse.

To improve reusability across different NextJS apps, consider exporting the field configuration types.

Add the following type definitions:

import { SubSection, TextField } from '@island.is/application/core'

export type RentalHousingSpecialProvisionsField = TextField & {
  maxLength?: number
  rows?: number
}

export type RentalHousingSpecialProvisionsSection = SubSection

7-7: 🛠️ Refactor suggestion

Consider using named imports for better tree-shaking.

Replace the namespace import with specific named imports to enable better tree-shaking.

-import * as m from '../../lib/messages'
+import { specialProvisions } from '../../lib/messages'

Committable suggestion was skipped due to low confidence.

libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodDetails.ts (3)

1-9: 🛠️ Refactor suggestion

Consider destructuring specific messages.

Instead of importing all messages with namespace import, consider destructuring only the required messages for better tree-shaking.

-import * as m from '../../lib/messages'
+import { rentalPeriodDetails } from '../../lib/messages'

Committable suggestion was skipped due to low confidence.


34-44: ⚠️ Potential issue

Add title for better accessibility.

The checkbox field has an empty title which might affect screen readers.

 buildCheckboxField({
   id: 'rentalPeriodDefinite',
-  title: '',
+  title: m.rentalPeriodDetails.rentalPeriodDefiniteTitle,
   options: [
     {
       value: 'true',
       label: m.rentalPeriodDetails.rentalPeriodDefiniteLabel,
     },
   ],
   spacing: 0,
 }),

Committable suggestion was skipped due to low confidence.


18-33: ⚠️ Potential issue

Add date validation and improve type safety.

The date fields lack validation rules, and the condition logic could be improved:

  1. Consider adding validation rules for dates
  2. The type assertion could be replaced with proper typing
 buildDateField({
   id: 'rentalPeriodStartDate',
   title: m.rentalPeriodDetails.startDateTitle,
   placeholder: m.rentalPeriodDetails.startDatePlaceholder,
+  validation: [
+    {
+      id: 'futureDate',
+      condition: (value) => new Date(value) > new Date(),
+      errorMessage: m.rentalPeriodDetails.startDateFutureError,
+    },
+  ],
 }),

Also, improve the condition logic:

-          condition: (answers) => {
-            const rentalPeriodDefinite: string[] =
-              answers.rentalPeriodDefinite as string[]
-
-            return rentalPeriodDefinite && rentalPeriodDefinite.includes('true')
-          },
+          condition: (answers) => 
+            answers.rentalPeriodDefinite?.includes('true') ?? false,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

        buildDateField({
          id: 'rentalPeriodStartDate',
          title: m.rentalPeriodDetails.startDateTitle,
          placeholder: m.rentalPeriodDetails.startDatePlaceholder,
        }),
        buildDateField({
          id: 'rentalPeriodEndDate',
          title: m.rentalPeriodDetails.endDateTitle,
          placeholder: m.rentalPeriodDetails.endDatePlaceholder,
          condition: (answers) => 
            answers.rentalPeriodDefinite?.includes('true') ?? false,
        }),
🧰 Tools
🪛 Biome

[error] 31-31: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

libs/application/templates/rental-agreement/src/lib/messages/housing/tenantDetails.ts (2)

1-3: 🛠️ Refactor suggestion

Consider adding TypeScript type definitions for better type safety.

While the code is functional, adding explicit types would improve maintainability and type safety.

Consider applying this improvement:

import { defineMessages } from 'react-intl'

+ type TenantDetailsMessages = {
+   subSectionName: { id: string; defaultMessage: string; description: string }
+   pageTitle: { id: string; defaultMessage: string; description: string }
+   pageDescription: { id: string; defaultMessage: string; description: string }
+   nationalIdInputLabel: { id: string; defaultMessage: string; description: string }
+   nationalIdHeaderLabel: { id: string; defaultMessage: string; description: string }
+   nameInputLabel: { id: string; defaultMessage: string; description: string }
+   emailInputLabel: { id: string; defaultMessage: string; description: string }
+   phoneInputLabel: { id: string; defaultMessage: string; description: string }
+   representativeLabel: { id: string; defaultMessage: string; description: string }
+ }

- export const tenantDetails = defineMessages({
+ export const tenantDetails = defineMessages<TenantDetailsMessages>({
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

import { defineMessages } from 'react-intl'

type TenantDetailsMessages = {
  subSectionName: { id: string; defaultMessage: string; description: string }
  pageTitle: { id: string; defaultMessage: string; description: string }
  pageDescription: { id: string; defaultMessage: string; description: string }
  nationalIdInputLabel: { id: string; defaultMessage: string; description: string }
  nationalIdHeaderLabel: { id: string; defaultMessage: string; description: string }
  nameInputLabel: { id: string; defaultMessage: string; description: string }
  emailInputLabel: { id: string; defaultMessage: string; description: string }
  phoneInputLabel: { id: string; defaultMessage: string; description: string }
  representativeLabel: { id: string; defaultMessage: string; description: string }
}

export const tenantDetails = defineMessages<TenantDetailsMessages>({

4-49: 🛠️ Refactor suggestion

Consider adding validation and error messages for form fields.

The messages cover the basic UI elements but lack validation-related messages that users might encounter when filling out the form.

Consider adding these additional messages:

export const tenantDetails = defineMessages({
  // ... existing messages ...
+ nationalIdInvalidFormat: {
+   id: 'ra.application:tenantDetails.nationalIdInvalidFormat',
+   defaultMessage: 'Kennitala er ekki á réttu formi',
+   description: 'Error message when national ID format is invalid',
+ },
+ emailInvalidFormat: {
+   id: 'ra.application:tenantDetails.emailInvalidFormat',
+   defaultMessage: 'Netfang er ekki á réttu formi',
+   description: 'Error message when email format is invalid',
+ },
+ phoneInvalidFormat: {
+   id: 'ra.application:tenantDetails.phoneInvalidFormat',
+   defaultMessage: 'Símanúmer er ekki á réttu formi',
+   description: 'Error message when phone number format is invalid',
+ },
})
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  subSectionName: {
    id: 'ra.application:tenantDetails.subSectionName',
    defaultMessage: 'Leigjandi',
    description: 'Tenant Details sub section name',
  },
  pageTitle: {
    id: 'ra.application:tenantDetails.pageTitle',
    defaultMessage: 'Skrá leigjanda',
    description: 'Tenant Details page title',
  },
  pageDescription: {
    id: 'ra.application:tenantDetails.pageDescription',
    defaultMessage:
      'Hér skal skrá leigjendur í húsnæðinu. Hægt er að bæta við eins mörgum leigjendum á samninginn eins og óskað er eftir.',
    description: 'Tenant Details page description',
  },
  nationalIdInputLabel: {
    id: 'ra.application:tenantDetails.nationalIdLabel',
    defaultMessage: 'Kennitala leigjanda',
    description: 'Tenant Details national id input label',
  },
  nationalIdHeaderLabel: {
    id: 'ra.application:tenantDetails.nationalIdHeaderLabel',
    defaultMessage: 'Kennitala',
    description: 'Tenant details national id header label',
  },
  nameInputLabel: {
    id: 'ra.application:tenantDetails.nameLabel',
    defaultMessage: 'Fullt nafn',
    description: 'Tenant Details name input label',
  },
  emailInputLabel: {
    id: 'ra.application:tenantDetails.emailLabel',
    defaultMessage: 'Netfang',
    description: 'Tenant Details email input label',
  },
  phoneInputLabel: {
    id: 'ra.application:tenantDetails.phoneLabel',
    defaultMessage: 'Símanúmer',
    description: 'Tenant Details phone input label',
  },
  representativeLabel: {
    id: 'ra.application:tenantDetails.representativeLabel',
    defaultMessage: 'Þessi aðili er umboðsaðili leigjanda',
    description: 'Tenant Details representative label',
  },
  nationalIdInvalidFormat: {
    id: 'ra.application:tenantDetails.nationalIdInvalidFormat',
    defaultMessage: 'Kennitala er ekki á réttu formi',
    description: 'Error message when national ID format is invalid',
  },
  emailInvalidFormat: {
    id: 'ra.application:tenantDetails.emailInvalidFormat',
    defaultMessage: 'Netfang er ekki á réttu formi',
    description: 'Error message when email format is invalid',
  },
  phoneInvalidFormat: {
    id: 'ra.application:tenantDetails.phoneInvalidFormat',
    defaultMessage: 'Símanúmer er ekki á réttu formi',
    description: 'Error message when phone number format is invalid',
  },
libs/application/templates/rental-agreement/src/lib/messages/housing/landlordDetails.ts (1)

4-50: 🛠️ Refactor suggestion

Consider enhancing type safety and message organization.

The message definitions are well-structured with consistent IDs and comprehensive descriptions. However, consider these improvements:

  1. Add explicit type annotations for better maintainability
  2. Group related messages using nested objects

Here's how you could refactor the code:

 import { defineMessages } from 'react-intl'
+
+type LandlordMessages = {
+  subSection: {
+    name: string
+    title: string
+    description: string
+  }
+  inputs: {
+    nationalId: string
+    name: string
+    email: string
+    phone: string
+    representative: string
+  }
+}
 
-export const landlordDetails = defineMessages({
+export const landlordDetails = defineMessages<LandlordMessages>({
+  subSection: {
     subSectionName: {
       id: 'ra.application:landlordDetails.subSectionName',
       defaultMessage: 'Leigusali',
       description: 'Landlord details subsection name',
     },
     pageTitle: {
       id: 'ra.application:landlordDetails.pageTitle',
       defaultMessage: 'Skrá leigusala',
       description: 'Landlord details page title',
     },
     pageDescription: {
       id: 'ra.application:landlordDetails.pageDescription',
       defaultMessage:
         'Hér skal skrá leigusala húsnæðis. Hægt er að bæta við eins mörgum leigusölum á samninginn eins og óskað er eftir.',
       description: 'Landlord details page description',
     },
+  },
+  inputs: {
     nationalIdInputLabel: {
       // ... rest of the input-related messages
     },
     // ... other input messages
+  }
 })

Committable suggestion was skipped due to low confidence.

libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingFireProtections.ts (3)

13-61: 🛠️ Refactor suggestion

Consider enhancing field descriptions with meaningful placeholders.

The current placeholder "0" could be more informative. Consider adding meaningful placeholders that indicate the expected input.

 buildTextField({
   id: 'rentalHousingFireProtectionsSmokeDetectors',
   title: m.housingFireProtections.smokeDetectorsLabel,
-  placeholder: '0',
+  placeholder: 'Enter number of smoke detectors',
   width: 'half',
   variant: 'number',
 }),

Committable suggestion was skipped due to low confidence.


1-8: 🛠️ Refactor suggestion

Consider using named imports for messages.

Replace the wildcard import with specific named imports to improve tree-shaking and make dependencies more explicit.

-import * as m from '../../lib/messages'
+import { housingFireProtections } from '../../lib/messages'

Committable suggestion was skipped due to low confidence.


25-38: ⚠️ Potential issue

Add validation constraints for numeric inputs.

The smoke detectors and fire extinguisher fields should have minimum value validation to ensure valid inputs.

 buildTextField({
   id: 'rentalHousingFireProtectionsSmokeDetectors',
   title: m.housingFireProtections.smokeDetectorsLabel,
   placeholder: '0',
   width: 'half',
   variant: 'number',
+  props: {
+    min: 0,
+    required: true
+  }
 }),

Committable suggestion was skipped due to low confidence.

libs/application/templates/rental-agreement/src/lib/messages/housing/housingFireProtections.ts (3)

29-29: ⚠️ Potential issue

Fix typo in description

There's a typo in the description: "dectectors" should be "detectors"

- description: 'Smoke dectectors label',
+ description: 'Smoke detectors label',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    description: 'Smoke detectors label',

1-2: 🛠️ Refactor suggestion

Consider adding TypeScript types for messages

To improve type safety and align with the coding guidelines, consider using TypeScript types for the message definitions.

- import { defineMessages } from 'react-intl'
+ import { defineMessages, MessageDescriptor } from 'react-intl'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

import { defineMessages, MessageDescriptor } from 'react-intl'


37-41: ⚠️ Potential issue

Update incorrect description for exitFireBlanketRequirements

The description mentions "Smoke detector and fire blanket requirements" but the message is about exits and fire blankets.

- description: 'Smoke detector and fire blanket requirements',
+ description: 'Exit routes and fire blanket requirements',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    id: 'ra.application:housingFireProtections.exitFireBlanketRequirements',
    defaultMessage:
      'Flóttaleiðir þurfa að vera auðrataðar og greiðfærar en ekki er gerð krafa um eldvarnarteppi.',
    description: 'Exit routes and fire blanket requirements',
  },
libs/application/templates/rental-agreement/src/lib/messages/rentalPeriod/rentalPeriodDetails.ts (1)

25-29: 🛠️ Refactor suggestion

Consider creating a shared date placeholder message.

The placeholder text "Veldu dagsetningu" is duplicated for both start and end date fields. Consider extracting it into a shared message to maintain consistency and reduce duplication.

+ commonDatePlaceholder: {
+   id: 'ra.application:rentalPeriodDetails.commonDatePlaceholder',
+   defaultMessage: 'Veldu dagsetningu',
+   description: 'Common date field placeholder',
+ },
  startDatePlaceholder: {
-   id: 'ra.application:rentalPeriodDetails.startDatePlaceholder',
-   defaultMessage: 'Veldu dagsetningu',
-   description: 'Start date placeholder',
+   id: 'ra.application:rentalPeriodDetails.startDatePlaceholder',
+   defaultMessage: '{commonDatePlaceholder}',
+   description: 'Start date placeholder',
  },
  endDatePlaceholder: {
-   id: 'ra.application:rentalPeriodDetails.endDatePlaceholder',
-   defaultMessage: 'Veldu dagsetningu',
-   description: 'End date placeholder',
+   id: 'ra.application:rentalPeriodDetails.endDatePlaceholder',
+   defaultMessage: '{commonDatePlaceholder}',
+   description: 'End date placeholder',
  },

Also applies to: 35-39

libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingTenantInfo.ts (1)

43-48: 🛠️ Refactor suggestion

Enhance email validation for better user experience.

Consider adding pattern validation or a custom validator to ensure proper email format beyond the basic HTML5 validation.

 email: {
   component: 'input',
   label: m.tenantDetails.emailInputLabel,
   type: 'email',
+  pattern: '[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$',
+  validation: ['email'],
   width: 'half',
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

            email: {
              component: 'input',
              label: m.tenantDetails.emailInputLabel,
              type: 'email',
              pattern: '[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$',
              validation: ['email'],
              width: 'half',
            },
libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingLandlordInfo.ts (2)

64-65: ⚠️ Potential issue

Add error handling for format functions.

The format functions should handle invalid input gracefully to prevent runtime errors.

 format: {
-  phone: (value) => formatPhoneNumber(value),
-  nationalId: (value) => formatNationalId(value),
+  phone: (value) => {
+    try {
+      return value ? formatPhoneNumber(value) : ''
+    } catch (error) {
+      console.error('Error formatting phone number:', error)
+      return value
+    }
+  },
+  nationalId: (value) => {
+    try {
+      return value ? formatNationalId(value) : ''
+    } catch (error) {
+      console.error('Error formatting national ID:', error)
+      return value
+    }
+  },
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

              phone: (value) => {
                try {
                  return value ? formatPhoneNumber(value) : ''
                } catch (error) {
                  console.error('Error formatting phone number:', error)
                  return value
                }
              },
              nationalId: (value) => {
                try {
                  return value ? formatNationalId(value) : ''
                } catch (error) {
                  console.error('Error formatting national ID:', error)
                  return value
                }
              },

25-61: ⚠️ Potential issue

Add field validation rules for required information.

Consider adding validation rules for critical fields:

  • Name and National ID should be required
  • Email should validate against a proper email pattern
  • Phone number should validate against Icelandic phone number format
 name: {
   component: 'input',
   label: m.landlordDetails.nameInputLabel,
   width: 'half',
+  required: true,
+  variant: 'text',
 },
 nationalId: {
   component: 'input',
   label: m.landlordDetails.nationalIdInputLabel,
   format: '######-####',
   width: 'half',
+  required: true,
+  validate: (value) => {
+    if (!value) return m.landlordDetails.nationalIdRequired
+    if (!/^\d{6}-?\d{4}$/.test(value)) return m.landlordDetails.nationalIdInvalid
+    return undefined
+  },
 },
 email: {
   component: 'input',
   label: m.landlordDetails.emailInputLabel,
   type: 'email',
   width: 'half',
+  validate: (value) => {
+    if (value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
+      return m.landlordDetails.emailInvalid
+    }
+    return undefined
+  },
 },

Committable suggestion was skipped due to low confidence.

libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingCondition.ts (3)

13-16: 🛠️ Refactor suggestion

Consider exporting TypeScript types for better reusability.

While the implementation is correct, consider exporting the form section type for better reusability across different NextJS apps.

Add type export above the implementation:

export type RentalHousingConditionType = ReturnType<typeof RentalHousingCondition>;

40-47: 🛠️ Refactor suggestion

Consider memoizing the condition function for better performance.

The condition function is recreated on every render. Consider memoizing it using useCallback for better performance.

import { useCallback } from 'react'

// In your component:
const inspectorCondition = useCallback((answers) => {
  const { inspectorOptions } = getApplicationAnswers(answers)
  return inspectorOptions === rentalHousingConditionInspector.INDEPENDENT_PARTY
}, [])

// Use in buildTextField:
condition: inspectorCondition,

63-71: ⚠️ Potential issue

Replace placeholder ID with a meaningful identifier.

The file upload field uses 'asdf' as its ID, which appears to be a placeholder. This should be replaced with a descriptive identifier that reflects its purpose.

-  id: 'asdf',
+  id: 'rentalHousingConditionPhotos',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

        buildFileUploadField({
          id: 'rentalHousingConditionPhotos',
          title: m.housingCondition.fileUploadTitle,
          uploadHeader: m.housingCondition.fileUploadTitle,
          uploadDescription: m.housingCondition.fileUploadDescription,
          uploadAccept: '.pdf, .doc, .docx, .rtf, .jpg, .jpeg, .png, .heic',
          uploadMultiple: true,
          forImageUpload: true,
        }),
libs/application/templates/rental-agreement/src/lib/messages/housing/specialProvisions.ts (1)

1-3: 🛠️ Refactor suggestion

Add TypeScript type definitions for better type safety.

Consider adding explicit type definitions to improve type safety and documentation:

import { defineMessages } from 'react-intl'

+ type MessageDescriptor = {
+   id: string
+   defaultMessage: string
+   description: string
+ }
+ 
+ type SpecialProvisionsMessages = {
+   subsection: Record<string, MessageDescriptor>
+   housingInfo: Record<string, MessageDescriptor>
+   housingRules: Record<string, MessageDescriptor>
+ }
+ 
- export const specialProvisions = {
+ export const specialProvisions: SpecialProvisionsMessages = {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

import { defineMessages } from 'react-intl'

type MessageDescriptor = {
  id: string
  defaultMessage: string
  description: string
}

type SpecialProvisionsMessages = {
  subsection: Record<string, MessageDescriptor>
  housingInfo: Record<string, MessageDescriptor>
  housingRules: Record<string, MessageDescriptor>
}

export const specialProvisions: SpecialProvisionsMessages = {
libs/application/templates/rental-agreement/src/lib/messages/prerequisites.ts (1)

34-39: 🛠️ Refactor suggestion

Consider splitting bullet points into separate messages.

The current implementation combines multiple bullet points into a single message, which could make maintenance and translation more challenging. Consider splitting them into separate messages for better maintainability and translation accuracy.

-    bullets: {
-      id: 'ra.application:prerequisites.intro.bullets#markdown',
-      defaultMessage:
-        '- Leigusamningur er skráður í Leiguskrá HMS þegar allir aðilar samningsins hafa undirritað rafrænt. \n- Skráning leigusamnings í Leiguskrá HMS er ein forsenda þess að leigjandi geti fengið greiddar húsnæðisbætur. \n- Hægt er að sækja um húsnæðisbætur samhliða skráningu á leigusamningnum og því þinglýsing óþörf. \n- Með rafrænni skráningu eru vottar óþarfi. \n- Staðfesting á brunavörnum og ástandi húsnæðis er hluti af leigusamningnum',
-      description: 'First bullet point about the application',
-    },
+    bullet1: {
+      id: 'ra.application:prerequisites.intro.bullet1',
+      defaultMessage: 'Leigusamningur er skráður í Leiguskrá HMS þegar allir aðilar samningsins hafa undirritað rafrænt.',
+      description: 'Bullet point about digital signatures',
+    },
+    bullet2: {
+      id: 'ra.application:prerequisites.intro.bullet2',
+      defaultMessage: 'Skráning leigusamnings í Leiguskrá HMS er ein forsenda þess að leigjandi geti fengið greiddar húsnæðisbætur.',
+      description: 'Bullet point about housing benefits requirement',
+    },
+    // ... continue for remaining bullets

Committable suggestion was skipped due to low confidence.

libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodAmount.ts (3)

72-79: 🛠️ Refactor suggestion

Use Date utility for consistent date handling.

Instead of manual string manipulation, consider using a date utility for better maintainability.

 buildDateField({
   id: 'rentalAmountIndexDate',
   title: m.rentalAmount.indexDateLabel,
   maxDate: new Date(),
-  defaultValue: new Date().toISOString().substring(0, 10),
+  defaultValue: format(new Date(), 'yyyy-MM-dd'),
   width: 'half',
   condition: rentalAmountIndexIsConnected,
 }),

Consider importing format from a date utility library like date-fns.

Committable suggestion was skipped due to low confidence.


24-27: 🛠️ Refactor suggestion

Add TypeScript type safety to the utility function.

The function could benefit from explicit TypeScript types for better maintainability and type safety.

-function rentalAmountIndexIsConnected(answers: FormValue) {
+function rentalAmountIndexIsConnected(answers: FormValue): boolean {
   const { isRentalAmountIndexConnected } = getApplicationAnswers(answers)
-  return isRentalAmountIndexConnected !== undefined
+  return isRentalAmountIndexConnected === true
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

function rentalAmountIndexIsConnected(answers: FormValue): boolean {
  const { isRentalAmountIndexConnected } = getApplicationAnswers(answers)
  return isRentalAmountIndexConnected === true
}

44-51: 🛠️ Refactor suggestion

Add minimum value validation for the rental amount.

While the maxLength is set, there's no validation to ensure the rental amount is positive.

 buildTextField({
   id: 'rentalAmount.amount',
   title: m.rentalAmount.inputLabel,
   placeholder: m.rentalAmount.inputPlaceholder,
   variant: 'currency',
   maxLength: 14,
+  min: 0,
   required: true,
 }),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

        buildTextField({
          id: 'rentalAmount.amount',
          title: m.rentalAmount.inputLabel,
          placeholder: m.rentalAmount.inputPlaceholder,
          variant: 'currency',
          maxLength: 14,
          min: 0,
          required: true,
        }),
libs/application/templates/rental-agreement/src/lib/utils.ts (2)

20-62: 🛠️ Refactor suggestion

Enhance type safety and error handling in getApplicationAnswers.

The function could benefit from:

  1. Type assertions or runtime checks for retrieved values
  2. Error handling for missing answers
  3. More modular structure for better reusability

Consider this improved implementation:

interface ApplicationAnswers {
  propertyCategoryTypeOptions: rentalHousingCategoryTypes | null;
  propertyCategoryClassOptions: rentalHousingCategoryClass | null;
  inspectorOptions: rentalHousingConditionInspector | null;
  isRentalAmountIndexConnected: AnswerOptions | null;
  rentalAmountIndexTypesOptions: rentalAmountIndexTypes | null;
  rentalAmountPaymentDateOptions: rentalAmountPaymentDateOptions | null;
}

const getAnswerValue = <T>(answers: Application['answers'], path: string): T | null => {
  try {
    return getValueViaPath<T>(answers, path);
  } catch (error) {
    console.warn(`Failed to retrieve answer for path: ${path}`, error);
    return null;
  }
};

export const getApplicationAnswers = (answers: Application['answers']): ApplicationAnswers => ({
  propertyCategoryTypeOptions: getAnswerValue(answers, 'registerPropertyCategoryType'),
  propertyCategoryClassOptions: getAnswerValue(answers, 'registerPropertyCategoryClass'),
  inspectorOptions: getAnswerValue(answers, 'rentalHousingConditionInspector'),
  isRentalAmountIndexConnected: getAnswerValue(answers, 'isRentalAmountIndexConnected'),
  rentalAmountIndexTypesOptions: getAnswerValue(answers, 'rentalAmountIndexTypes'),
  rentalAmountPaymentDateOptions: getAnswerValue(answers, 'rentalAmountPaymentDate'),
})

14-19: ⚠️ Potential issue

Add input validation and handle edge cases in string utilities.

The string manipulation functions need more robust error handling:

  1. insertAt should validate input parameters:

    • Check if str is defined
    • Ensure pos is within bounds
  2. formatNationalId has potential issues:

    • Doesn't handle empty strings properly
    • May fail with inputs shorter than 6 characters
    • Multiple hyphens aren't handled consistently
    • Returning '-' for invalid input could mask errors

Consider this safer implementation:

-export const insertAt = (str: string, sub: string, pos: number) =>
-  `${str.slice(0, pos)}${sub}${str.slice(pos)}`
+export const insertAt = (str: string, sub: string, pos: number): string => {
+  if (!str || pos < 0 || pos > str.length) {
+    throw new Error('Invalid input parameters');
+  }
+  return `${str.slice(0, pos)}${sub}${str.slice(pos)}`;
+}

-export const formatNationalId = (nationalId: string) =>
-  insertAt(nationalId.replace('-', ''), '-', 6) || '-'
+export const formatNationalId = (nationalId: string): string => {
+  if (!nationalId || nationalId.length < 7) {
+    throw new Error('Invalid national ID format');
+  }
+  const cleaned = nationalId.replace(/-/g, '');
+  return insertAt(cleaned, '-', 6);
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

export const insertAt = (str: string, sub: string, pos: number): string => {
  if (!str || pos < 0 || pos > str.length) {
    throw new Error('Invalid input parameters');
  }
  return `${str.slice(0, pos)}${sub}${str.slice(pos)}`;
}

export const formatNationalId = (nationalId: string): string => {
  if (!nationalId || nationalId.length < 7) {
    throw new Error('Invalid national ID format');
  }
  const cleaned = nationalId.replace(/-/g, '');
  return insertAt(cleaned, '-', 6);
}
libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingPropertyInfo.ts (4)

66-71: 🛠️ Refactor suggestion

Consider memoizing postal code options.

The postal code options mapping could be optimized to prevent unnecessary re-renders.

- options: () => {
-   return postalCodes.map((code) => {
-     return { value: `${code}`, label: `${code}` }
-   })
- },
+ options: () => postalCodes.map((code) => ({ 
+   value: code.toString(),
+   label: code.toString()
+ })),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

          options: () => postalCodes.map((code) => ({ 
            value: code.toString(),
            label: code.toString()
          })),
        }),

167-174: 🛠️ Refactor suggestion

Extract complex condition logic to a utility function.

The condition logic for category class group could be more readable if extracted to a separate function.

+ const isSpecialGroupsCategory = (answers: object) => {
+   const { propertyCategoryClassOptions } = getApplicationAnswers(answers)
+   return propertyCategoryClassOptions === rentalHousingCategoryClass.SPECIAL_GROUPS
+ }

- condition: (answers) => {
-   const { propertyCategoryClassOptions } = getApplicationAnswers(answers)
-   return (
-     propertyCategoryClassOptions === rentalHousingCategoryClass.SPECIAL_GROUPS
-   )
- },
+ condition: isSpecialGroupsCategory,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

          const isSpecialGroupsCategory = (answers: object) => {
            const { propertyCategoryClassOptions } = getApplicationAnswers(answers)
            return propertyCategoryClassOptions === rentalHousingCategoryClass.SPECIAL_GROUPS
          }

          condition: isSpecialGroupsCategory,

79-85: ⚠️ Potential issue

Add input validation for property size.

The size field should include numeric validation and unit constraints.

 buildTextField({
   id: 'registerPropertyInfoSize',
   title: messagesInfo.sizeLabel,
   placeholder: '',
   width: 'half',
   required: true,
+  variant: 'number',
+  format: '###.##',
+  minValue: 0,
+  maxValue: 1000,
 }),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

        buildTextField({
          id: 'registerPropertyInfoSize',
          title: messagesInfo.sizeLabel,
          placeholder: '',
          width: 'half',
          required: true,
          variant: 'number',
          format: '###.##',
          minValue: 0,
          maxValue: 1000,
        }),

99-129: 🛠️ Refactor suggestion

Enhance address validation and string formatting.

The current implementation has a few areas for improvement:

  1. The empty address check could be more robust
  2. String concatenation could be simplified using template literals
- condition: (answers) => answers.registerPropertyInfoAddress !== '',
+ condition: (answers) => Boolean(answers.registerPropertyInfoAddress?.trim()),

- answers.registerPropertyInfoAddress
-   ? `${answers.registerPropertyInfoAddress.toString()}, ${answers.registerPropertyInfoMunicipality.toString()}`
-   : '',
+ answers.registerPropertyInfoAddress
+   ? `${answers.registerPropertyInfoAddress}, ${answers.registerPropertyInfoMunicipality}`
+   : '',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      condition: (answers) => Boolean(answers.registerPropertyInfoAddress?.trim()),
      children: [
        buildStaticTableField({
          title: messagesInfoSummary.pageTitle,
          description: messagesInfoSummary.pageDescription,
          header: [
            messagesInfoSummary.tableHeaderPropertyId,
            messagesInfoSummary.tableHeaderAddress,
            messagesInfoSummary.tableHeaderUnitId,
            messagesInfoSummary.tableHeaderSize,
            messagesInfoSummary.tableHeaderNumOfRooms,
          ],
          rows({ answers }) {
            return [
              [
                answers.registerPropertyInfoPropertyId
                  ? `F${answers.registerPropertyInfoPropertyId}`
                  : '',
                answers.registerPropertyInfoAddress
                  ? `${answers.registerPropertyInfoAddress}, ${answers.registerPropertyInfoMunicipality}`
                  : '',
                answers.registerPropertyInfoUnitId
                  ? `${answers.registerPropertyInfoUnitId.toString()}`
                  : '',
                answers.registerPropertyInfoSize
                  ? `${answers.registerPropertyInfoSize.toString()} m²`
                  : '',
                answers.registerPropertyInfoNumOfRooms
                  ? `${answers.registerPropertyInfoNumOfRooms.toString()}`
                  : '',
              ],
libs/application/templates/rental-agreement/src/lib/messages/housing/registerProperty.ts (2)

19-23: 🛠️ Refactor suggestion

Parameterize external links in translations.

Consider extracting the HMS website URL to a configuration value and using message parameters instead of hardcoding it in the translation.

    pageDescription: {
      id: 'ra.application:registerProperty.info.pageDescription',
      defaultMessage:
-       'Finndu eignina með fasteignanúmeri eða heimilisfangi. Nánari upplýsingar er að finna í [fasteignaskrá HMS](https://hms.is/fasteignir).',
+       'Finndu eignina með fasteignanúmeri eða heimilisfangi. Nánari upplýsingar er að finna í [fasteignaskrá HMS]({hmsUrl}).',
      description: 'Register property page description',
    },

Committable suggestion was skipped due to low confidence.


1-3: 🛠️ Refactor suggestion

Add TypeScript type definitions for better type safety and maintainability.

Consider adding explicit type definitions to improve type safety and documentation.

import { defineMessages } from 'react-intl'
+ import { MessageDescriptor } from 'react-intl'

+ interface PropertyMessages {
+   subsection: Record<string, MessageDescriptor>
+   info: Record<string, MessageDescriptor>
+   infoSummary: Record<string, MessageDescriptor>
+   category: Record<string, MessageDescriptor>
+ }

- export const registerProperty = {
+ export const registerProperty: PropertyMessages = {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

import { defineMessages } from 'react-intl'
import { MessageDescriptor } from 'react-intl'

interface PropertyMessages {
  subsection: Record<string, MessageDescriptor>
  info: Record<string, MessageDescriptor>
  infoSummary: Record<string, MessageDescriptor>
  category: Record<string, MessageDescriptor>
}

export const registerProperty: PropertyMessages = {
libs/application/templates/rental-agreement/src/lib/messages/rentalInfo/securityDeposit.ts (5)

26-29: ⚠️ Potential issue

Update placeholder tooltip text

The tooltip message contains placeholder text "Tool tip" which should be replaced with actual helpful content.

   typeHeaderToolTip: {
     id: 'ra.application:securityDeposit.typeHeaderToolTip',
-    defaultMessage: 'Tool tip',
+    defaultMessage: 'Veldu tegund tryggingar fyrir leigusamninginn',
     description: 'security deposit type header tool tip',
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    id: 'ra.application:securityDeposit.typeHeaderToolTip',
    defaultMessage: 'Veldu tegund tryggingar fyrir leigusamninginn',
    description: 'security deposit type header tool tip',
  },

127-131: ⚠️ Potential issue

Update placeholder tooltip text

The tooltip message contains placeholder text "Tool tip" which should be replaced with actual helpful content.

   amountHeaderToolTip: {
     id: 'ra.application:securityDeposit.amountHeaderToolTip',
-    defaultMessage: 'Tool tip',
+    defaultMessage: 'Veldu upphæð tryggingar fyrir leigusamninginn',
     description: 'security deposit amount header tool tip',
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  amountHeaderToolTip: {
    id: 'ra.application:securityDeposit.amountHeaderToolTip',
    defaultMessage: 'Veldu upphæð tryggingar fyrir leigusamninginn',
    description: 'security deposit amount header tool tip',
  },

142-146: ⚠️ Potential issue

Fix duplicate message ID for 2-month selection

The message ID for 2-month selection incorrectly uses the same ID as 1-month selection.

   amountSelection2Month: {
-    id: 'ra.application:securityDeposit.amountSelection1Month',
+    id: 'ra.application:securityDeposit.amountSelection2Month',
     defaultMessage: '2 mánuðir af leiguverði',
     description: 'security deposit amount selection 2 months',
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  amountSelection2Month: {
    id: 'ra.application:securityDeposit.amountSelection2Month',
    defaultMessage: '2 mánuðir af leiguverði',
    description: 'security deposit amount selection 2 months',
  },

86-90: ⚠️ Potential issue

Fix incorrect placeholder text for third party guarantee

The placeholder text incorrectly asks for an institution name instead of the guarantor's name.

   thirdPartyGuaranteeInfoPlaceholder: {
     id: 'ra.application:securityDeposit.thirdPartyGuaranteeInfoPlaceholder',
-    defaultMessage: 'Skrifaðu hér hjá hvaða stofnun ábyrgðin er',
+    defaultMessage: 'Skrifaðu hér nafn ábyrgðaraðila',
     description: 'security deposit third party guarantee info placeholder',
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  thirdPartyGuaranteeInfoPlaceholder: {
    id: 'ra.application:securityDeposit.thirdPartyGuaranteeInfoPlaceholder',
    defaultMessage: 'Skrifaðu hér nafn ábyrgðaraðila',
    description: 'security deposit third party guarantee info placeholder',
  },

224-228: ⚠️ Potential issue

Fix spelling: "capitol" should be "capital"

The message ID and description contain a spelling error.

-  amountOtherCapitolError: {
-    id: 'ra.application:securityDeposit.amountOtherCapitolError',
+  amountOtherCapitalError: {
+    id: 'ra.application:securityDeposit.amountOtherCapitalError',
     defaultMessage: 'Upphæð tryggingar má ekki vera meira en 3x leiguverð',
-    description: 'security deposit amount other capitol error',
+    description: 'security deposit amount other capital error',
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  amountOtherCapitalError: {
    id: 'ra.application:securityDeposit.amountOtherCapitalError',
    defaultMessage: 'Upphæð tryggingar má ekki vera meira en 3x leiguverð',
    description: 'security deposit amount other capital error',
  },
libs/application/templates/rental-agreement/src/lib/RentalAgreementTemplate.ts (2)

38-38: 🛠️ Refactor suggestion

Review lifecycle pruning duration

Both the PREREQUISITES and DRAFT states have the lifecycle set to pruneAfterDays(1), which means the application will be pruned after one day if not completed. This duration might be too short for applicants to finish their application, potentially leading to a poor user experience.

Consider increasing the pruning duration to give applicants more time to complete the application. For example:

38-          lifecycle: pruneAfterDays(1),
38+          lifecycle: pruneAfterDays(7),
68-          lifecycle: pruneAfterDays(1),
68+          lifecycle: pruneAfterDays(7),

Also applies to: 68-68


84-86: ⚠️ Potential issue

Use consistent state references in transitions

In the 'on' event of the DRAFT state, the target state is specified as the string 'draft'. For consistency and to avoid potential typos, consider using the States.DRAFT constant instead.

Apply this diff to fix the inconsistency:

84             [DefaultEvents.SUBMIT]: {
85-              target: 'draft',
85+              target: States.DRAFT,
86             },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

          [DefaultEvents.SUBMIT]: {
            target: States.DRAFT,
          },
libs/application/templates/rental-agreement/src/lib/dataSchema.ts (6)

158-158: 🛠️ Refactor suggestion

Add validation for approveExternalData

The approveExternalData field lacks a validation error message. Adding a custom message will improve user feedback when the field is not approved.

Apply this diff to include an error message:

-approveExternalData: z.boolean().refine((v) => v),
+approveExternalData: z.boolean().refine((v) => v, {
+  message: 'You must approve the external data to proceed.',
+}),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  approveExternalData: z.boolean().refine((v) => v, {
    message: 'You must approve the external data to proceed.',
  }),

11-17: 🛠️ Refactor suggestion

Simplify the checkIfNegative function

The checkIfNegative function can be simplified by returning the boolean expression directly, eliminating the unnecessary if...else statement.

Apply this diff to simplify the function:

-const checkIfNegative = (inputNumber: string) => {
-  if (Number(inputNumber) < 0) {
-    return false
-  } else {
-    return true
-  }
-}
+const checkIfNegative = (inputNumber: string) => Number(inputNumber) >= 0
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

const checkIfNegative = (inputNumber: string) => Number(inputNumber) >= 0

160-164: 🛠️ Refactor suggestion

Improve error handling for nationalId validation

When validating nationalId, the error message is set in params, but it would be clearer to set it directly in the message field.

Apply this diff to set the error message:

.refine((val) => (val ? kennitala.isValid(val) : false), {
-  params: m.dataSchema.nationalId,
+  message: m.dataSchema.nationalId.defaultMessage,
})
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    nationalId: z
      .string()
      .refine((val) => (val ? kennitala.isValid(val) : false), {
        message: m.dataSchema.nationalId.defaultMessage,
      }),

34-38: 🛠️ Refactor suggestion

Consider using z.number() for numeric validation

Currently, the amount field is defined as a string and uses custom refinements to check for emptiness and negativity. Using z.number() provides built-in number validation and simplifies the schema.

Apply this diff to update the schema:

-amount: z
-  .string()
-  .refine((x) => Boolean(x), {
-    params: requiredErrorMsg,
-  })
-  .refine((x) => checkIfNegative(x), { params: negativeNumberError }),
+amount: z.number().nonnegative({
+  message: negativeNumberError.defaultMessage,
+})

Committable suggestion was skipped due to low confidence.


166-166: ⚠️ Potential issue

Rename the asdf property to a meaningful name

The property asdf appears to be a placeholder and should be renamed to reflect its purpose in the schema.

For example, if this field is intended to store uploaded files, it could be renamed to attachments:

-  asdf: z.array(FileSchema),
+  attachments: z.array(FileSchema),

Committable suggestion was skipped due to low confidence.


59-154: ⚠️ Potential issue

Replace placeholder error messages with meaningful content

In the superRefine method, the message field is set to 'Custom error message' in multiple places. This placeholder should be replaced with actual error messages to provide clarity during validation.

Apply this diff to update the error messages:

ctx.addIssue({
  code: z.ZodIssueCode.custom,
- message: 'Custom error message',
+ message: params.defaultMessage,
  params: /* respective error message object */,
  path: [/* respective path */],
})

Ensure that each params object is correctly referenced, and message is set to params.defaultMessage from the corresponding error message in m.securityDeposit.

Committable suggestion was skipped due to low confidence.

libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodSecurityDeposit.ts (2)

88-94: 🛠️ Refactor suggestion

Refactor repeated condition logic into a helper function

The condition functions used in multiple fields are repeating similar logic to check securityDeposit.securityType. Extracting this logic into a utility function can enhance code reusability and readability across the form.

You can define a helper function at the top of your file:

const isSecurityType = (answers: FormValue, type: string) => {
  const securityDeposit = answers.securityDeposit as FormValue
  return securityDeposit?.securityType === type
}

Then, update your condition properties:

-condition: (answers) => {
-  const securityDeposit = answers.securityDeposit as FormValue
-  return (
-    securityDeposit &&
-    Boolean(securityDeposit.securityType) &&
-    securityDeposit.securityType === 'bankGuarantee'
-  )
-},
+condition: (answers) => isSecurityType(answers, 'bankGuarantee'),

This refactoring simplifies the conditions and makes the codebase easier to maintain.

Also applies to: 102-110, 117-124, 131-138, 145-152, 159-166, 207-217


14-14: ⚠️ Potential issue

Remove unused constant 'messages'

The constant messages declared on line 14 is not used anywhere in the file. Removing it will improve code cleanliness and aid in effective tree-shaking during bundling.

Apply this diff to remove the unused constant:

-const messages = m.prerequisites.intro
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.


@addi addi changed the base branch from main to rental-agreement-application October 30, 2024 23:16
Copy link

codecov bot commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.65%. Comparing base (9cd101f) to head (290f96a).
Report is 117 commits behind head on rental-agreement-application.

Additional details and impacted files

Impacted file tree graph

@@                       Coverage Diff                        @@
##           rental-agreement-application   #16661      +/-   ##
================================================================
- Coverage                         36.71%   36.65%   -0.06%     
================================================================
  Files                              6850     6859       +9     
  Lines                            142065   143015     +950     
  Branches                          40558    40892     +334     
================================================================
+ Hits                              52153    52421     +268     
- Misses                            89912    90594     +682     
Flag Coverage Δ
air-discount-scheme-backend 54.10% <ø> (ø)
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
api-domains-air-discount-scheme 36.96% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.48% <ø> (ø)
api-domains-communications 39.92% <ø> (+0.01%) ⬆️
api-domains-criminal-record 48.04% <ø> (ø)
api-domains-driving-license 44.50% <ø> (ø)
api-domains-education 31.61% <ø> (ø)
api-domains-health-insurance 34.82% <ø> (ø)
api-domains-mortgage-certificate 35.01% <ø> (+0.02%) ⬆️
api-domains-payment-schedule 41.19% <ø> (ø)
application-api-files 56.91% <ø> (-0.08%) ⬇️
application-core 71.58% <ø> (-0.48%) ⬇️
application-system-api 41.33% <ø> (-0.02%) ⬇️
application-template-api-modules 27.80% <ø> (-0.02%) ⬇️
application-templates-accident-notification 29.24% <ø> (-0.03%) ⬇️
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.30% <ø> (-0.04%) ⬇️
application-templates-driving-license 18.40% <ø> (+0.07%) ⬆️
application-templates-estate 12.25% <ø> (-0.08%) ⬇️
application-templates-example-payment 25.20% <ø> (+0.05%) ⬆️
application-templates-financial-aid 15.47% <ø> (-0.04%) ⬇️
application-templates-general-petition 23.42% <ø> (-0.02%) ⬇️
application-templates-inheritance-report 6.51% <ø> (+0.02%) ⬆️
application-templates-marriage-conditions 15.18% <ø> (+<0.01%) ⬆️
application-templates-mortgage-certificate 43.67% <ø> (-0.27%) ⬇️
application-templates-parental-leave 29.94% <ø> (-0.02%) ⬇️
application-types 6.56% <ø> (-0.02%) ⬇️
application-ui-components 1.27% <ø> (-0.01%) ⬇️
application-ui-shell 21.22% <ø> (-0.14%) ⬇️
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.71% <ø> (ø)
clients-driving-license-book 43.83% <ø> (ø)
clients-financial-statements-inao 49.36% <ø> (ø)
clients-license-client 1.83% <ø> (ø)
clients-regulations 42.84% <ø> (ø)
clients-rsk-company-registry 29.76% <ø> (ø)
clients-rsk-personal-tax-return 38.00% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.51% <ø> (+0.04%) ⬆️
cms 0.42% <ø> (-0.01%) ⬇️
cms-translations 39.05% <ø> (+0.01%) ⬆️
dokobit-signing 63.46% <ø> (ø)
download-service 44.24% <ø> (ø)
email-service 61.21% <ø> (ø)
feature-flags 91.17% <ø> (ø)
file-storage 53.82% <ø> (ø)
financial-aid-backend 51.24% <ø> (-5.15%) ⬇️
judicial-system-api 19.52% <ø> (+1.11%) ⬆️
judicial-system-audit-trail 69.50% <ø> (ø)
judicial-system-backend 55.32% <ø> (+0.28%) ⬆️
judicial-system-message 67.43% <ø> (+0.06%) ⬆️
judicial-system-message-handler 48.62% <ø> (+0.08%) ⬆️
judicial-system-scheduler 70.65% <ø> (+1.04%) ⬆️
license-api 42.46% <ø> (-0.21%) ⬇️
nest-config 78.51% <ø> (ø)
nest-feature-flags 51.58% <ø> (-0.51%) ⬇️
nova-sms 62.83% <ø> (ø)
portals-admin-regulations-admin 1.84% <ø> (-0.02%) ⬇️
portals-core 16.01% <ø> (-0.14%) ⬇️
services-auth-admin-api 51.89% <ø> (-0.04%) ⬇️
services-auth-delegation-api 57.52% <ø> (+0.15%) ⬆️
services-auth-ids-api 51.45% <ø> (+0.01%) ⬆️
services-auth-personal-representative 45.05% <ø> (-0.10%) ⬇️
services-auth-personal-representative-public 41.25% <ø> (-0.03%) ⬇️
services-auth-public-api 48.96% <ø> (+0.05%) ⬆️
services-endorsements-api 53.60% <ø> (-0.07%) ⬇️
services-sessions 65.31% <ø> (-0.08%) ⬇️
services-university-gateway 49.35% <ø> (+0.91%) ⬆️
services-user-notification 46.94% <ø> (+<0.01%) ⬆️
services-user-profile 61.85% <ø> (ø)
web 1.80% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 191 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9cd101f...290f96a. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs 81520fb 🔗

70 Total Test Services: 0 Failed, 67 Passed
🔻 Test Sessions change in coverage: 3 decreased, 22 increased, 174 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 81 0 29.6s N/A Link
air-discount-scheme-web 0 0 0 2 0 7.17s N/A Link
api 0 0 0 4 0 2.5s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 16.12s N/A Link
api-domains-assets 0 0 0 3 0 9.77s N/A Link
api-domains-auth-admin 0 0 0 18 0 10.39s N/A Link
api-domains-communications 0 0 0 5 0 27.54s N/A Link
api-domains-criminal-record 0 0 0 5 0 8.22s 1 increased (+0.05%) Link
api-domains-driving-license 0 0 0 23 0 26.63s N/A Link
api-domains-education 0 0 0 8 0 16.91s N/A Link

🔻 Code Coverage Decreases vs Default Branch (3)

  • application-types - jest 5.42% (-0.05%) - Details
  • services-sessions - jest 68.84% (-0.04%) - Details
  • services-university-gateway - jest 45.17% (-0.02%) - Details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant