From 37fe92be86722e95ff07f0ea2d18145c8b81793e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9E=C3=B3rey=20J=C3=B3na?= Date: Thu, 12 Dec 2024 14:09:20 +0000 Subject: [PATCH 1/3] fix(native-app): Android build fixes (#17211) * fix: import for gradle-plugin * fix: update import for react-native-clipboard as well * fix: update build.gradle imports * fix: update reanimated * fix: add folder references to build.gradle * fix: remove react native clipboard from settings.gradle * fix(app): Use dev firebase in for dev android app * fix: remove added newline --------- Co-authored-by: Eirikur Nilsson Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/native/app/android/app/build.gradle | 6 +- apps/native/app/android/build.gradle | 4 +- apps/native/app/android/settings.gradle | 5 +- apps/native/app/package.json | 2 +- codemagic.yaml | 2 +- yarn.lock | 184 ++++++++++++++++++++++- 6 files changed, 186 insertions(+), 17 deletions(-) diff --git a/apps/native/app/android/app/build.gradle b/apps/native/app/android/app/build.gradle index a32464e07a8f..997472187673 100644 --- a/apps/native/app/android/app/build.gradle +++ b/apps/native/app/android/app/build.gradle @@ -16,11 +16,11 @@ react { // The root of your project, i.e. where "package.json" lives. Default is '..' // root = file("../") // The folder where the react-native NPM package is. Default is ../node_modules/react-native - // reactNativeDir = file("../node_modules/react-native") + reactNativeDir = file("../../../../../node_modules/react-native") // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen - // codegenDir = file("../node_modules/@react-native/codegen") + codegenDir = file("../../../../../node_modules/@react-native/codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js - // cliFile = file("../node_modules/react-native/cli.js") + cliFile = file("../../../../../node_modules/react-native/cli.js") /* Variants */ // The list of variants to that are debuggable. For those we're going to diff --git a/apps/native/app/android/build.gradle b/apps/native/app/android/build.gradle index 46f7b30a85d0..06110e23ae99 100644 --- a/apps/native/app/android/build.gradle +++ b/apps/native/app/android/build.gradle @@ -33,11 +33,11 @@ allprojects { repositories { maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url("$rootDir/../node_modules/react-native/android") + url("$rootDir/../../../../../node_modules/react-native/android") } maven { // Android JSC is installed from npm - url("$rootDir/../node_modules/jsc-android/dist") + url("$rootDir/../../../../../node_modules/jsc-android/dist") } mavenCentral { // We don't want to fetch react-native from Maven Central as there are diff --git a/apps/native/app/android/settings.gradle b/apps/native/app/android/settings.gradle index 12979ce6cda2..d9655025ec45 100644 --- a/apps/native/app/android/settings.gradle +++ b/apps/native/app/android/settings.gradle @@ -6,11 +6,8 @@ applyNativeModulesSettingsGradle(settings) include ':app', ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../../../../node_modules/react-native-code-push/android/app') -include ':react-native-clipboard' -project(':react-native-clipboard').projectDir = new File(rootProject.projectDir, '../../node_modules/@react-native-clipboard/clipboard/android') - include ':app' -includeBuild('../node_modules/@react-native/gradle-plugin') +includeBuild('../../../../node_modules/@react-native/gradle-plugin') apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle") useExpoModules() diff --git a/apps/native/app/package.json b/apps/native/app/package.json index 3ebb950c5cba..f742ee2bb587 100644 --- a/apps/native/app/package.json +++ b/apps/native/app/package.json @@ -90,7 +90,7 @@ "react-native-pdf": "6.7.5", "react-native-quick-actions": "0.3.13", "react-native-quick-base64": "2.1.2", - "react-native-reanimated": "3.12.1", + "react-native-reanimated": "3.16.5", "react-native-share": "10.2.1", "react-native-spotlight-search": "2.0.0", "react-native-svg": "15.2.0", diff --git a/codemagic.yaml b/codemagic.yaml index a0840a6144b2..e6d07bc39ad9 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -219,7 +219,7 @@ workflows: - island-upload-keystore groups: - google_credentials - - firebase_credentials + - firebase_credentials_dev vars: <<: *shared_envs PACKAGE_NAME: 'is.island.app.dev' diff --git a/yarn.lock b/yarn.lock index e0441eb6d923..26095abdf270 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2754,6 +2754,15 @@ __metadata: languageName: node linkType: hard +"@babel/helper-annotate-as-pure@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-annotate-as-pure@npm:7.25.9" + dependencies: + "@babel/types": ^7.25.9 + checksum: 41edda10df1ae106a9b4fe617bf7c6df77db992992afd46192534f5cff29f9e49a303231733782dd65c5f9409714a529f215325569f14282046e9d3b7a1ffb6c + languageName: node + linkType: hard + "@babel/helper-builder-binary-assignment-operator-visitor@npm:^7.18.6": version: 7.18.9 resolution: "@babel/helper-builder-binary-assignment-operator-visitor@npm:7.18.9" @@ -2954,6 +2963,23 @@ __metadata: languageName: node linkType: hard +"@babel/helper-create-class-features-plugin@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-create-class-features-plugin@npm:7.25.9" + dependencies: + "@babel/helper-annotate-as-pure": ^7.25.9 + "@babel/helper-member-expression-to-functions": ^7.25.9 + "@babel/helper-optimise-call-expression": ^7.25.9 + "@babel/helper-replace-supers": ^7.25.9 + "@babel/helper-skip-transparent-expression-wrappers": ^7.25.9 + "@babel/traverse": ^7.25.9 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 91dd5f203ed04568c70b052e2f26dfaac7c146447196c00b8ecbb6d3d2f3b517abadb985d3321a19d143adaed6fe17f7f79f8f50e0c20e9d8ad83e1027b42424 + languageName: node + linkType: hard + "@babel/helper-create-regexp-features-plugin@npm:^7.16.7, @babel/helper-create-regexp-features-plugin@npm:^7.17.12": version: 7.17.12 resolution: "@babel/helper-create-regexp-features-plugin@npm:7.17.12" @@ -3017,6 +3043,19 @@ __metadata: languageName: node linkType: hard +"@babel/helper-create-regexp-features-plugin@npm:^7.25.9": + version: 7.26.3 + resolution: "@babel/helper-create-regexp-features-plugin@npm:7.26.3" + dependencies: + "@babel/helper-annotate-as-pure": ^7.25.9 + regexpu-core: ^6.2.0 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 50a27d8ce6da5c2fa0c62c132c4d27cfeb36e3233ff1e5220d643de3dafe49423b507382f0b72a696fce7486014b134c1e742f55438590f9405d26765b009af0 + languageName: node + linkType: hard + "@babel/helper-define-polyfill-provider@npm:^0.3.3": version: 0.3.3 resolution: "@babel/helper-define-polyfill-provider@npm:0.3.3" @@ -3258,6 +3297,16 @@ __metadata: languageName: node linkType: hard +"@babel/helper-member-expression-to-functions@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-member-expression-to-functions@npm:7.25.9" + dependencies: + "@babel/traverse": ^7.25.9 + "@babel/types": ^7.25.9 + checksum: 8e2f1979b6d596ac2a8cbf17f2cf709180fefc274ac3331408b48203fe19134ed87800774ef18838d0275c3965130bae22980d90caed756b7493631d4b2cf961 + languageName: node + linkType: hard + "@babel/helper-module-imports@npm:^7.0.0, @babel/helper-module-imports@npm:^7.16.0, @babel/helper-module-imports@npm:^7.16.7, @babel/helper-module-imports@npm:^7.18.6": version: 7.18.6 resolution: "@babel/helper-module-imports@npm:7.18.6" @@ -3452,6 +3501,15 @@ __metadata: languageName: node linkType: hard +"@babel/helper-optimise-call-expression@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-optimise-call-expression@npm:7.25.9" + dependencies: + "@babel/types": ^7.25.9 + checksum: f09d0ad60c0715b9a60c31841b3246b47d67650c512ce85bbe24a3124f1a4d66377df793af393273bc6e1015b0a9c799626c48e53747581c1582b99167cc65dc + languageName: node + linkType: hard + "@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.13.0, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.16.7, @babel/helper-plugin-utils@npm:^7.17.12, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.19.0, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": version: 7.19.0 resolution: "@babel/helper-plugin-utils@npm:7.19.0" @@ -3494,6 +3552,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-plugin-utils@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-plugin-utils@npm:7.25.9" + checksum: e19ec8acf0b696756e6d84531f532c5fe508dce57aa68c75572a77798bd04587a844a9a6c8ea7d62d673e21fdc174d091c9097fb29aea1c1b49f9c6eaa80f022 + languageName: node + linkType: hard + "@babel/helper-remap-async-to-generator@npm:^7.18.9": version: 7.18.9 resolution: "@babel/helper-remap-async-to-generator@npm:7.18.9" @@ -3627,6 +3692,19 @@ __metadata: languageName: node linkType: hard +"@babel/helper-replace-supers@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-replace-supers@npm:7.25.9" + dependencies: + "@babel/helper-member-expression-to-functions": ^7.25.9 + "@babel/helper-optimise-call-expression": ^7.25.9 + "@babel/traverse": ^7.25.9 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 84f40e12520b7023e52d289bf9d569a06284879fe23bbbacad86bec5d978b2669769f11b073fcfeb1567d8c547168323005fda88607a4681ecaeb4a5cdd48bb9 + languageName: node + linkType: hard + "@babel/helper-simple-access@npm:^7.18.2, @babel/helper-simple-access@npm:^7.18.6": version: 7.19.4 resolution: "@babel/helper-simple-access@npm:7.19.4" @@ -3710,6 +3788,16 @@ __metadata: languageName: node linkType: hard +"@babel/helper-skip-transparent-expression-wrappers@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.25.9" + dependencies: + "@babel/traverse": ^7.25.9 + "@babel/types": ^7.25.9 + checksum: fdbb5248932198bc26daa6abf0d2ac42cab9c2dbb75b7e9f40d425c8f28f09620b886d40e7f9e4e08ffc7aaa2cefe6fc2c44be7c20e81f7526634702fb615bdc + languageName: node + linkType: hard + "@babel/helper-split-export-declaration@npm:^7.16.7, @babel/helper-split-export-declaration@npm:^7.18.6": version: 7.18.6 resolution: "@babel/helper-split-export-declaration@npm:7.18.6" @@ -5153,6 +5241,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-class-properties@npm:^7.0.0-0": + version: 7.25.9 + resolution: "@babel/plugin-transform-class-properties@npm:7.25.9" + dependencies: + "@babel/helper-create-class-features-plugin": ^7.25.9 + "@babel/helper-plugin-utils": ^7.25.9 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: a8d69e2c285486b63f49193cbcf7a15e1d3a5f632c1c07d7a97f65306df7f554b30270b7378dde143f8b557d1f8f6336c643377943dec8ec405e4cd11e90b9ea + languageName: node + linkType: hard + "@babel/plugin-transform-class-properties@npm:^7.22.3": version: 7.22.3 resolution: "@babel/plugin-transform-class-properties@npm:7.22.3" @@ -5234,6 +5334,22 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-classes@npm:^7.0.0-0": + version: 7.25.9 + resolution: "@babel/plugin-transform-classes@npm:7.25.9" + dependencies: + "@babel/helper-annotate-as-pure": ^7.25.9 + "@babel/helper-compilation-targets": ^7.25.9 + "@babel/helper-plugin-utils": ^7.25.9 + "@babel/helper-replace-supers": ^7.25.9 + "@babel/traverse": ^7.25.9 + globals: ^11.1.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: d12584f72125314cc0fa8c77586ece2888d677788ac75f7393f5da574dfe4e45a556f7e3488fab29c8777ab3e5856d7a2d79f6df02834083aaa9d766440e3c68 + languageName: node + linkType: hard + "@babel/plugin-transform-classes@npm:^7.21.0": version: 7.21.0 resolution: "@babel/plugin-transform-classes@npm:7.21.0" @@ -7372,6 +7488,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-unicode-regex@npm:^7.0.0-0": + version: 7.25.9 + resolution: "@babel/plugin-transform-unicode-regex@npm:7.25.9" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.25.9 + "@babel/helper-plugin-utils": ^7.25.9 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: e8baae867526e179467c6ef5280d70390fa7388f8763a19a27c21302dd59b121032568be080749514b097097ceb9af716bf4b90638f1b3cf689aa837ba20150f + languageName: node + linkType: hard + "@babel/plugin-transform-unicode-regex@npm:^7.22.5": version: 7.22.5 resolution: "@babel/plugin-transform-unicode-regex@npm:7.22.5" @@ -13522,7 +13650,7 @@ __metadata: react-native-pdf: 6.7.5 react-native-quick-actions: 0.3.13 react-native-quick-base64: 2.1.2 - react-native-reanimated: 3.12.1 + react-native-reanimated: 3.16.5 react-native-share: 10.2.1 react-native-spotlight-search: 2.0.0 react-native-svg: 15.2.0 @@ -40842,7 +40970,7 @@ __metadata: languageName: node linkType: hard -"jsesc@npm:^3.0.2": +"jsesc@npm:^3.0.2, jsesc@npm:~3.0.2": version: 3.0.2 resolution: "jsesc@npm:3.0.2" bin: @@ -49993,15 +50121,18 @@ __metadata: languageName: node linkType: hard -"react-native-reanimated@npm:3.12.1": - version: 3.12.1 - resolution: "react-native-reanimated@npm:3.12.1" +"react-native-reanimated@npm:3.16.5": + version: 3.16.5 + resolution: "react-native-reanimated@npm:3.16.5" dependencies: "@babel/plugin-transform-arrow-functions": ^7.0.0-0 + "@babel/plugin-transform-class-properties": ^7.0.0-0 + "@babel/plugin-transform-classes": ^7.0.0-0 "@babel/plugin-transform-nullish-coalescing-operator": ^7.0.0-0 "@babel/plugin-transform-optional-chaining": ^7.0.0-0 "@babel/plugin-transform-shorthand-properties": ^7.0.0-0 "@babel/plugin-transform-template-literals": ^7.0.0-0 + "@babel/plugin-transform-unicode-regex": ^7.0.0-0 "@babel/preset-typescript": ^7.16.7 convert-source-map: ^2.0.0 invariant: ^2.2.4 @@ -50009,7 +50140,7 @@ __metadata: "@babel/core": ^7.0.0-0 react: "*" react-native: "*" - checksum: 91575b3a20a5878f42d0302cf304ed46ff35c12ce717018c0bfb6af047bf675f224ab95de778daae483b139e66c5290a661635c06304065879b02a5926243e1c + checksum: 29d28dcf99acb2e3928963106a2860d15c9929712832d8d8437fb563691d0199884a63e925548fe5e4b6fc7a9008eadec3e0294b521d9466c875caf16de9c303 languageName: node linkType: hard @@ -51053,6 +51184,15 @@ __metadata: languageName: node linkType: hard +"regenerate-unicode-properties@npm:^10.2.0": + version: 10.2.0 + resolution: "regenerate-unicode-properties@npm:10.2.0" + dependencies: + regenerate: ^1.4.2 + checksum: d5c5fc13f8b8d7e16e791637a4bfef741f8d70e267d51845ee7d5404a32fa14c75b181c4efba33e4bff8b0000a2f13e9773593713dfe5b66597df4259275ce63 + languageName: node + linkType: hard + "regenerate@npm:^1.4.2": version: 1.4.2 resolution: "regenerate@npm:1.4.2" @@ -51175,6 +51315,20 @@ __metadata: languageName: node linkType: hard +"regexpu-core@npm:^6.2.0": + version: 6.2.0 + resolution: "regexpu-core@npm:6.2.0" + dependencies: + regenerate: ^1.4.2 + regenerate-unicode-properties: ^10.2.0 + regjsgen: ^0.8.0 + regjsparser: ^0.12.0 + unicode-match-property-ecmascript: ^2.0.0 + unicode-match-property-value-ecmascript: ^2.1.0 + checksum: 67d3c4a3f6c99bc80b5d690074a27e6f675be1c1739f8a9acf028fbc36f1a468472574ea65e331e217995198ba4404d7878f3cb3739a73552dd3c70d3fb7f8e6 + languageName: node + linkType: hard + "regjsgen@npm:^0.6.0": version: 0.6.0 resolution: "regjsgen@npm:0.6.0" @@ -51182,6 +51336,24 @@ __metadata: languageName: node linkType: hard +"regjsgen@npm:^0.8.0": + version: 0.8.0 + resolution: "regjsgen@npm:0.8.0" + checksum: a1d925ff14a4b2be774e45775ee6b33b256f89c42d480e6d85152d2133f18bd3d6af662161b226fa57466f7efec367eaf7ccd2a58c0ec2a1306667ba2ad07b0d + languageName: node + linkType: hard + +"regjsparser@npm:^0.12.0": + version: 0.12.0 + resolution: "regjsparser@npm:0.12.0" + dependencies: + jsesc: ~3.0.2 + bin: + regjsparser: bin/parser + checksum: 094b55b0ab3e1fd58f8ce5132a1d44dab08d91f7b0eea4132b0157b303ebb8ded20a9cbd893d25402d2aeddb23fac1f428ab4947b295d6fa51dd1c334a9e76f0 + languageName: node + linkType: hard + "regjsparser@npm:^0.8.2": version: 0.8.4 resolution: "regjsparser@npm:0.8.4" From 057fb9e7eb9df544c8a82c924a26e5551cb85a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3nas=20G=2E=20Sigur=C3=B0sson?= Date: Thu, 12 Dec 2024 16:11:28 +0000 Subject: [PATCH 2/3] feat(accident-notification): procure for accident notifications (#16337) * feat: start of procure for accident notifications * feat: adjust aplicantInformationMultiField for procure * fix: typo in message * chore: simplify conditions and small clean up * chore: remove unused functions * chore: remove console.log * chore: make mapUserToRole slightly cleaner * chore: more concise if statement * chore: trigger deploy-feature * chore: move constants to utils * fix: typo * feat: remove two custom components with text * chore: remove unused messages * chore: remove unused import * chore: remove comment --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../src/dataProviders/index.ts | 4 + .../src/fields/AgreementDescription/index.tsx | 25 ----- .../src/fields/DateOfAccident/index.tsx | 2 +- .../descriptionWithLink.css.ts | 11 --- .../src/fields/DescriptionWithLink/index.tsx | 43 -------- .../src/fields/FormOverview/index.tsx | 2 +- .../accident-notification/src/fields/index.ts | 2 - .../attachmentsSubSection.ts | 7 +- .../locationSubSection.ts | 2 +- .../workMachineSubSection.ts | 2 +- .../applicantInformationSection.ts | 2 - .../betaTestSection.ts | 24 ----- .../agreementDescriptionMultiField.ts | 30 ------ .../externalDataSection/index.ts | 10 -- .../forms/AccidentNotificationForm/index.ts | 6 -- .../juridicialPersonCompanySubSection.ts | 2 +- .../powerOfAttorneyUploadSubSection.ts | 2 +- .../whoIsTheNotificationForMultiField.ts | 39 ++++---- .../InReviewForm/addAttachmentsSection.ts | 2 +- .../PrerequisitesForm/dataHandlingSection.ts | 30 ++++++ .../externalDataSection.ts} | 25 ++++- .../src/forms/PrerequisitesForm/index.ts | 15 +++ .../externalDataSection.ts | 43 ++++++++ .../forms/PrerequisitesProcureForm/index.ts | 15 +++ .../src/lib/AccidentNotificationTemplate.ts | 98 ++++++++++++++++--- .../src/lib/dataSchema.ts | 2 +- .../src/lib/messages/applicantInformation.ts | 12 +++ .../src/lib/messages/externalData.ts | 58 +++++------ .../lib/messages/whoIsTheNotificationFor.ts | 10 ++ .../accident-notification/src/types/index.ts | 7 +- .../src/{ => utils}/constants/index.ts | 1 + .../getWhoIstheNotificationForOptions.ts | 32 ++++++ .../src/utils/getWorkplaceData.spec.ts | 2 +- .../src/utils/hasMissingDocuments.spec.ts | 2 +- .../src/utils/hasMissingDocuments.ts | 2 +- .../src/utils/index.spec.ts | 2 +- .../accident-notification/src/utils/index.ts | 2 +- .../src/utils/isFatalAccident.spec.ts | 2 +- .../src/utils/isFatalAccident.ts | 2 +- .../utils/isMachineRelatedAccident.spec.ts | 2 +- .../src/utils/isMachineRelatedAccident.ts | 2 +- ...RepresentativeOfCompanyOrInstitute.spec.ts | 2 +- .../isRepresentativeOfCompanyOrInstitute.ts | 2 +- .../announcement-of-death/src/types/index.ts | 4 - .../src/types/index.ts | 6 -- .../src/dataProviders/index.ts | 2 +- .../src/lib/dataSchema.ts | 2 +- .../src/types/index.ts | 6 -- .../src/fields/Overview/Overview.tsx | 14 +-- .../applicantInformationMultiField.ts | 12 +-- .../applicantInformationMultiField/types.ts | 2 +- 51 files changed, 349 insertions(+), 286 deletions(-) create mode 100644 libs/application/templates/accident-notification/src/dataProviders/index.ts delete mode 100644 libs/application/templates/accident-notification/src/fields/AgreementDescription/index.tsx delete mode 100644 libs/application/templates/accident-notification/src/fields/DescriptionWithLink/descriptionWithLink.css.ts delete mode 100644 libs/application/templates/accident-notification/src/fields/DescriptionWithLink/index.tsx delete mode 100644 libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/betaTestSection.ts delete mode 100644 libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/externalDataSection/agreementDescriptionMultiField.ts delete mode 100644 libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/externalDataSection/index.ts create mode 100644 libs/application/templates/accident-notification/src/forms/PrerequisitesForm/dataHandlingSection.ts rename libs/application/templates/accident-notification/src/forms/{AccidentNotificationForm/externalDataSection/accidentNotificationSubSection.ts => PrerequisitesForm/externalDataSection.ts} (74%) create mode 100644 libs/application/templates/accident-notification/src/forms/PrerequisitesForm/index.ts create mode 100644 libs/application/templates/accident-notification/src/forms/PrerequisitesProcureForm/externalDataSection.ts create mode 100644 libs/application/templates/accident-notification/src/forms/PrerequisitesProcureForm/index.ts rename libs/application/templates/accident-notification/src/{ => utils}/constants/index.ts (90%) create mode 100644 libs/application/templates/accident-notification/src/utils/getWhoIstheNotificationForOptions.ts diff --git a/libs/application/templates/accident-notification/src/dataProviders/index.ts b/libs/application/templates/accident-notification/src/dataProviders/index.ts new file mode 100644 index 000000000000..fb1bb027a65c --- /dev/null +++ b/libs/application/templates/accident-notification/src/dataProviders/index.ts @@ -0,0 +1,4 @@ +export { + IdentityApi, + NationalRegistryUserApi, +} from '@island.is/application/types' diff --git a/libs/application/templates/accident-notification/src/fields/AgreementDescription/index.tsx b/libs/application/templates/accident-notification/src/fields/AgreementDescription/index.tsx deleted file mode 100644 index 0470ab316795..000000000000 --- a/libs/application/templates/accident-notification/src/fields/AgreementDescription/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { FieldBaseProps } from '@island.is/application/types' -import { Bullet, Stack } from '@island.is/island-ui/core' -import { useLocale } from '@island.is/localization' -import React, { FC } from 'react' -import { externalData } from '../../lib/messages' - -export const AgreementDescription: FC< - React.PropsWithChildren -> = () => { - const { formatMessage } = useLocale() - - return ( - - - {formatMessage(externalData.agreementDescription.bulletOne)} - - - {formatMessage(externalData.agreementDescription.bulletTwo)} - - - {formatMessage(externalData.agreementDescription.bulletThree)} - - - ) -} diff --git a/libs/application/templates/accident-notification/src/fields/DateOfAccident/index.tsx b/libs/application/templates/accident-notification/src/fields/DateOfAccident/index.tsx index b212e92ae31b..27627c0f8f2b 100644 --- a/libs/application/templates/accident-notification/src/fields/DateOfAccident/index.tsx +++ b/libs/application/templates/accident-notification/src/fields/DateOfAccident/index.tsx @@ -5,7 +5,7 @@ import { useLocale } from '@island.is/localization' import { DatePickerController } from '@island.is/shared/form-fields' import React, { FC, useCallback, useEffect, useState } from 'react' import { Controller, useFormContext } from 'react-hook-form' -import { NO, YES } from '../../constants' +import { NO, YES } from '../../utils/constants' import { useLazyIsHealthInsured } from '../../hooks/useLazyIsHealthInsured' import { AccidentNotification } from '../../lib/dataSchema' import { accidentDetails } from '../../lib/messages' diff --git a/libs/application/templates/accident-notification/src/fields/DescriptionWithLink/descriptionWithLink.css.ts b/libs/application/templates/accident-notification/src/fields/DescriptionWithLink/descriptionWithLink.css.ts deleted file mode 100644 index 8ed6d0294c97..000000000000 --- a/libs/application/templates/accident-notification/src/fields/DescriptionWithLink/descriptionWithLink.css.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { style } from '@vanilla-extract/css' -import { theme } from '@island.is/island-ui/theme' - -export const link = style({ - color: theme.color.blue600, - selectors: { - '&:hover': { - backgroundColor: theme.color.purple100, - }, - }, -}) diff --git a/libs/application/templates/accident-notification/src/fields/DescriptionWithLink/index.tsx b/libs/application/templates/accident-notification/src/fields/DescriptionWithLink/index.tsx deleted file mode 100644 index b83eaff05827..000000000000 --- a/libs/application/templates/accident-notification/src/fields/DescriptionWithLink/index.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { Link, Text } from '@island.is/island-ui/core' -import React, { FC } from 'react' -import { useLocale } from '@island.is/localization' -import { formatText } from '@island.is/application/core' -import { FieldBaseProps } from '@island.is/application/types' -import { Box } from '@island.is/island-ui/core' -import * as styles from './descriptionWithLink.css' - -type DescriptionLinkProps = { - field: { - props: { - descriptionFirstPart: string - descriptionSecondPart: string - linkName: string - url: string - } - } -} - -export const DescriptionWithLink: FC< - React.PropsWithChildren -> = ({ application, field }) => { - const { props } = field - const { formatMessage } = useLocale() - const { descriptionFirstPart, descriptionSecondPart, linkName, url } = props - return ( - - - - {`${formatText(descriptionFirstPart, application, formatMessage)} `} - - {` ${formatText( - linkName, - application, - formatMessage, - )}`} - - {formatText(descriptionSecondPart, application, formatMessage)} - - - - ) -} diff --git a/libs/application/templates/accident-notification/src/fields/FormOverview/index.tsx b/libs/application/templates/accident-notification/src/fields/FormOverview/index.tsx index e3401b90871a..3eb21101ca94 100644 --- a/libs/application/templates/accident-notification/src/fields/FormOverview/index.tsx +++ b/libs/application/templates/accident-notification/src/fields/FormOverview/index.tsx @@ -18,7 +18,7 @@ import is from 'date-fns/locale/is' import parseISO from 'date-fns/parseISO' import kennitala from 'kennitala' import React, { FC } from 'react' -import { States, YES } from '../../constants' +import { States, YES } from '../../utils/constants' import { AccidentNotification } from '../../lib/dataSchema' import { accidentDetails, diff --git a/libs/application/templates/accident-notification/src/fields/index.ts b/libs/application/templates/accident-notification/src/fields/index.ts index d2880db80314..82bbce3df36a 100644 --- a/libs/application/templates/accident-notification/src/fields/index.ts +++ b/libs/application/templates/accident-notification/src/fields/index.ts @@ -1,8 +1,6 @@ -export { AgreementDescription } from './AgreementDescription' export { DateOfAccident } from './DateOfAccident' export { FormOverview } from './FormOverview' export { HiddenInformation } from './HiddenInformation' export { ApplicationStatus } from './ApplicationStatus' export { FormOverviewInReview } from './FormOverviewInReview' export { ProxyDocument } from './ProxyDocument' -export { DescriptionWithLink } from './DescriptionWithLink' diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/attachmentsSubSection.ts b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/attachmentsSubSection.ts index 8d666ce9d97c..e8c71b90e331 100644 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/attachmentsSubSection.ts +++ b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/attachmentsSubSection.ts @@ -21,7 +21,12 @@ import { isRepresentativeOfCompanyOrInstitute, } from '../../../utils' import { AttachmentsEnum } from '../../../types' -import { FILE_SIZE_LIMIT, NO, UPLOAD_ACCEPT, YES } from '../../../constants' +import { + FILE_SIZE_LIMIT, + NO, + UPLOAD_ACCEPT, + YES, +} from '../../../utils/constants' // Injury certificate and fatal accident section export const attachmentsSubSection = buildSubSection({ diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/locationSubSection.ts b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/locationSubSection.ts index 7e97ccbd88ae..be855a49a6f0 100644 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/locationSubSection.ts +++ b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/locationSubSection.ts @@ -22,7 +22,7 @@ import { isRescueWorkAccident, isStudiesAccident, } from '../../../utils' -import { NO, YES } from '../../../constants' +import { NO, YES } from '../../../utils/constants' import { isSportAccidentAndEmployee } from '../../../utils/isSportAccidentAndEmployee' import { AgricultureAccidentLocationEnum, diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/workMachineSubSection.ts b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/workMachineSubSection.ts index 67b73e98e2d6..bdfa59c43e79 100644 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/workMachineSubSection.ts +++ b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection/workMachineSubSection.ts @@ -10,7 +10,7 @@ import { isGeneralWorkplaceAccident, } from '../../../utils' import { isSportAccidentAndEmployee } from '../../../utils/isSportAccidentAndEmployee' -import { NO, YES } from '../../../constants' +import { NO, YES } from '../../../utils/constants' // Workmachine information only applicable to generic workplace accidents export const workMachineSubSection = buildSubSection({ diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/applicantInformationSection.ts b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/applicantInformationSection.ts index dc0cde867058..f91bcfaaee43 100644 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/applicantInformationSection.ts +++ b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/applicantInformationSection.ts @@ -1,8 +1,6 @@ import { buildSection } from '@island.is/application/core' - import { applicantInformation } from '../../lib/messages' import { applicantInformationMultiField } from '@island.is/application/ui-forms' - export const applicantInformationSection = buildSection({ id: 'informationAboutApplicantSection', title: applicantInformation.general.title, diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/betaTestSection.ts b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/betaTestSection.ts deleted file mode 100644 index c37d5bbc3359..000000000000 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/betaTestSection.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { buildCustomField, buildSection } from '@island.is/application/core' -import { betaTest } from '../../lib/messages' - -// Should only be here with the soft release, remove on official release. -export const betaTestSection = buildSection({ - id: 'betaTest.section', - title: betaTest.title, - children: [ - buildCustomField( - { - id: 'betaTest.section.textField', - title: betaTest.title, - component: 'DescriptionWithLink', - doesNotRequireAnswer: true, - }, - { - descriptionFirstPart: betaTest.descriptionFirstPart, - descriptionSecondPart: betaTest.descriptionSecondPart, - linkName: betaTest.emailText, - url: betaTest.email, - }, - ), - ], -}) diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/externalDataSection/agreementDescriptionMultiField.ts b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/externalDataSection/agreementDescriptionMultiField.ts deleted file mode 100644 index ff2088966a1e..000000000000 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/externalDataSection/agreementDescriptionMultiField.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { buildCustomField, buildMultiField } from '@island.is/application/core' -import { externalData } from '../../../lib/messages' - -export const agreementDescriptionMultiField = buildMultiField({ - title: externalData.agreementDescription.sectionTitle, - id: 'agreementDescriptionMultiField', - space: 2, - children: [ - buildCustomField({ - id: 'agreementDescriptionCustomField', - title: '', - component: 'AgreementDescription', - doesNotRequireAnswer: true, - }), - buildCustomField( - { - id: 'extrainformationWithDataprovider', - title: '', - component: 'DescriptionWithLink', - doesNotRequireAnswer: true, - }, - { - descriptionFirstPart: externalData.extraInformation.description, - descriptionSecondPart: '', - linkName: externalData.extraInformation.linkText, - url: externalData.extraInformation.link, - }, - ), - ], -}) diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/externalDataSection/index.ts b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/externalDataSection/index.ts deleted file mode 100644 index d46bf5c0c1b0..000000000000 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/externalDataSection/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { buildSection } from '@island.is/application/core' -import { agreementDescriptionMultiField } from './agreementDescriptionMultiField' -import { accidentNotificationSubSection } from './accidentNotificationSubSection' -import { externalData } from '../../../lib/messages' - -export const externalDataSection = buildSection({ - id: 'ExternalDataSection', - title: externalData.agreementDescription.listTitle, - children: [agreementDescriptionMultiField, accidentNotificationSubSection], -}) diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/index.ts b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/index.ts index 82a2dfd20d95..e3b6e2d8ed99 100644 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/index.ts +++ b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/index.ts @@ -2,14 +2,10 @@ import { buildForm } from '@island.is/application/core' import { Form, FormModes } from '@island.is/application/types' import Logo from '../../assets/Logo' import { application } from '../../lib/messages' - import { conclusionSection } from './conclusionSection' - import { overviewSection } from './overviewSection' -import { betaTestSection } from './betaTestSection' import { applicantInformationSection } from './applicantInformationSection' import { whoIsTheNotificationForSection } from './whoIsTheNotificationForSection' -import { externalDataSection } from './externalDataSection' import { aboutTheAccidentSection } from './aboutTheAccidentSection' export const AccidentNotificationForm: Form = buildForm({ @@ -18,8 +14,6 @@ export const AccidentNotificationForm: Form = buildForm({ logo: Logo, mode: FormModes.DRAFT, children: [ - betaTestSection, - externalDataSection, applicantInformationSection, whoIsTheNotificationForSection, aboutTheAccidentSection, diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/juridicialPersonCompanySubSection.ts b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/juridicialPersonCompanySubSection.ts index 45ec29a5a2a7..5d747453c1d0 100644 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/juridicialPersonCompanySubSection.ts +++ b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/juridicialPersonCompanySubSection.ts @@ -6,7 +6,7 @@ import { } from '@island.is/application/core' import { juridicalPerson } from '../../../lib/messages' import { isReportingOnBehalfOfEmployee } from '../../../utils' -import { YES } from '../../../constants' +import { YES } from '../../../utils/constants' export const juridicalPersonCompanySubSection = buildSubSection({ id: 'juridicalPerson.company', diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/powerOfAttorneyUploadSubSection.ts b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/powerOfAttorneyUploadSubSection.ts index d3defa608ae5..00ec8aff756d 100644 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/powerOfAttorneyUploadSubSection.ts +++ b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/powerOfAttorneyUploadSubSection.ts @@ -5,7 +5,7 @@ import { buildSubSection, } from '@island.is/application/core' import { error, powerOfAttorney } from '../../../lib/messages' -import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../../constants' +import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../../utils/constants' import { isUploadNow } from '../../../utils/isUploadNow' export const powerOfAttorneyUploadSubSection = buildSubSection({ diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/whoIsTheNotificationForMultiField.ts b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/whoIsTheNotificationForMultiField.ts index 766ea3128bc2..d59f1f345a83 100644 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/whoIsTheNotificationForMultiField.ts +++ b/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection/whoIsTheNotificationForMultiField.ts @@ -1,34 +1,33 @@ import { buildMultiField, buildRadioField } from '@island.is/application/core' import { whoIsTheNotificationFor } from '../../../lib/messages' -import { WhoIsTheNotificationForEnum } from '../../../types' +import { + whoIsTheNotificationForOptions, + whoIsTheNotificationForProcureOptions, +} from '../../../utils/getWhoIstheNotificationForOptions' export const whoIsTheNotificationForMultiField = buildMultiField({ id: 'whoIsTheNotificationFor', title: whoIsTheNotificationFor.general.heading, - description: whoIsTheNotificationFor.general.description, + description: (application) => { + if (application.externalData.identity) { + return whoIsTheNotificationFor.general.procureDescription + } + return whoIsTheNotificationFor.general.description + }, children: [ buildRadioField({ id: 'whoIsTheNotificationFor.answer', title: '', width: 'half', - options: [ - { - value: WhoIsTheNotificationForEnum.ME, - label: whoIsTheNotificationFor.labels.me, - }, - { - value: WhoIsTheNotificationForEnum.POWEROFATTORNEY, - label: whoIsTheNotificationFor.labels.powerOfAttorney, - }, - { - value: WhoIsTheNotificationForEnum.JURIDICALPERSON, - label: whoIsTheNotificationFor.labels.juridicalPerson, - }, - { - value: WhoIsTheNotificationForEnum.CHILDINCUSTODY, - label: whoIsTheNotificationFor.labels.childInCustody, - }, - ], + condition: (_answers, externalData) => !externalData.identity, + options: whoIsTheNotificationForOptions, + }), + buildRadioField({ + id: 'whoIsTheNotificationFor.answer', + title: '', + width: 'half', + condition: (_answers, externalData) => !!externalData.identity, + options: whoIsTheNotificationForProcureOptions, }), ], }) diff --git a/libs/application/templates/accident-notification/src/forms/InReviewForm/addAttachmentsSection.ts b/libs/application/templates/accident-notification/src/forms/InReviewForm/addAttachmentsSection.ts index 13d264c39118..f0c88a39c67a 100644 --- a/libs/application/templates/accident-notification/src/forms/InReviewForm/addAttachmentsSection.ts +++ b/libs/application/templates/accident-notification/src/forms/InReviewForm/addAttachmentsSection.ts @@ -7,7 +7,7 @@ import { buildSubmitField, } from '@island.is/application/core' import { DefaultEvents, FormValue } from '@island.is/application/types' -import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../constants' +import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../utils/constants' import { addDocuments, error } from '../../lib/messages' import { hasReceivedInjuryCertificate, diff --git a/libs/application/templates/accident-notification/src/forms/PrerequisitesForm/dataHandlingSection.ts b/libs/application/templates/accident-notification/src/forms/PrerequisitesForm/dataHandlingSection.ts new file mode 100644 index 000000000000..240af507eadb --- /dev/null +++ b/libs/application/templates/accident-notification/src/forms/PrerequisitesForm/dataHandlingSection.ts @@ -0,0 +1,30 @@ +import { + buildDescriptionField, + buildMultiField, + buildSection, +} from '@island.is/application/core' +import { externalData } from '../../lib/messages' + +export const dataHandlingSection = buildSection({ + id: 'ExternalDataSection', + title: externalData.agreementDescription.listTitle, + children: [ + buildMultiField({ + title: externalData.agreementDescription.sectionTitle, + id: 'agreementDescriptionMultiField', + space: 2, + children: [ + buildDescriptionField({ + id: 'agreementDescriptionDescriptionField', + title: '', + description: externalData.agreementDescription.bullets, + }), + buildDescriptionField({ + id: 'moreInformation', + title: '', + description: externalData.agreementDescription.moreInformation, + }), + ], + }), + ], +}) diff --git a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/externalDataSection/accidentNotificationSubSection.ts b/libs/application/templates/accident-notification/src/forms/PrerequisitesForm/externalDataSection.ts similarity index 74% rename from libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/externalDataSection/accidentNotificationSubSection.ts rename to libs/application/templates/accident-notification/src/forms/PrerequisitesForm/externalDataSection.ts index 9551bdb5bad5..9edaba894625 100644 --- a/libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/externalDataSection/accidentNotificationSubSection.ts +++ b/libs/application/templates/accident-notification/src/forms/PrerequisitesForm/externalDataSection.ts @@ -1,13 +1,15 @@ import { buildDataProviderItem, buildExternalDataProvider, - buildSubSection, + buildSection, + buildSubmitField, + coreMessages, } from '@island.is/application/core' -import { externalData } from '../../../lib/messages' -import { NationalRegistryUserApi } from '@island.is/application/types' +import { externalData } from '../../lib/messages' +import { NationalRegistryUserApi } from '../../dataProviders' -export const accidentNotificationSubSection = buildSubSection({ - id: 'AccidentNotificationForm', +export const externalDataSection = buildSection({ + id: 'ExternalDataRegularSection', title: externalData.dataProvider.sectionTitle, children: [ buildExternalDataProvider({ @@ -16,6 +18,19 @@ export const accidentNotificationSubSection = buildSubSection({ subTitle: externalData.dataProvider.subTitle, description: '', checkboxLabel: externalData.dataProvider.checkboxLabel, + submitField: buildSubmitField({ + id: 'submit', + placement: 'footer', + title: '', + refetchApplicationAfterSubmit: true, + actions: [ + { + event: 'SUBMIT', + name: coreMessages.buttonNext, + type: 'primary', + }, + ], + }), dataProviders: [ buildDataProviderItem({ id: 'directoryOfLabor', diff --git a/libs/application/templates/accident-notification/src/forms/PrerequisitesForm/index.ts b/libs/application/templates/accident-notification/src/forms/PrerequisitesForm/index.ts new file mode 100644 index 000000000000..89c7e17800ad --- /dev/null +++ b/libs/application/templates/accident-notification/src/forms/PrerequisitesForm/index.ts @@ -0,0 +1,15 @@ +import { buildForm } from '@island.is/application/core' +import { Form } from '@island.is/application/types' +import { application } from '../../lib/messages' +import Logo from '../../assets/Logo' +import { dataHandlingSection } from './dataHandlingSection' +import { externalDataSection } from './externalDataSection' + +export const PrerequisitesForm: Form = buildForm({ + id: 'PrerequisitesForm', + title: application.general.name, + logo: Logo, + renderLastScreenButton: true, + renderLastScreenBackButton: true, + children: [dataHandlingSection, externalDataSection], +}) diff --git a/libs/application/templates/accident-notification/src/forms/PrerequisitesProcureForm/externalDataSection.ts b/libs/application/templates/accident-notification/src/forms/PrerequisitesProcureForm/externalDataSection.ts new file mode 100644 index 000000000000..8cf32a765fd2 --- /dev/null +++ b/libs/application/templates/accident-notification/src/forms/PrerequisitesProcureForm/externalDataSection.ts @@ -0,0 +1,43 @@ +import { + buildDataProviderItem, + buildExternalDataProvider, + buildSection, + buildSubmitField, + coreMessages, +} from '@island.is/application/core' +import { externalData } from '../../lib/messages' +import { IdentityApi } from '../../dataProviders' + +export const externalDataSection = buildSection({ + id: 'ExternalDataProcureSection', + title: externalData.agreementDescription.listTitle, + children: [ + buildExternalDataProvider({ + title: externalData.dataProvider.pageTitle, + id: 'approveExternalData', + subTitle: externalData.dataProvider.subTitle, + description: '', + checkboxLabel: externalData.dataProvider.checkboxLabel, + submitField: buildSubmitField({ + id: 'submit', + placement: 'footer', + title: '', + refetchApplicationAfterSubmit: true, + actions: [ + { + event: 'SUBMIT', + name: coreMessages.buttonNext, + type: 'primary', + }, + ], + }), + dataProviders: [ + buildDataProviderItem({ + provider: IdentityApi, + title: externalData.nationalRegistry.title, + subTitle: externalData.nationalRegistry.subTitle, + }), + ], + }), + ], +}) diff --git a/libs/application/templates/accident-notification/src/forms/PrerequisitesProcureForm/index.ts b/libs/application/templates/accident-notification/src/forms/PrerequisitesProcureForm/index.ts new file mode 100644 index 000000000000..f792bfe3737a --- /dev/null +++ b/libs/application/templates/accident-notification/src/forms/PrerequisitesProcureForm/index.ts @@ -0,0 +1,15 @@ +import { buildForm } from '@island.is/application/core' +import { Form } from '@island.is/application/types' +import { application } from '../../lib/messages' +import Logo from '../../assets/Logo' +import { dataHandlingSection } from '../PrerequisitesForm/dataHandlingSection' +import { externalDataSection } from './externalDataSection' + +export const PrerequisitesProcureForm: Form = buildForm({ + id: 'PrerequisitesProcureForm', + title: application.general.name, + logo: Logo, + renderLastScreenButton: true, + renderLastScreenBackButton: true, + children: [dataHandlingSection, externalDataSection], +}) diff --git a/libs/application/templates/accident-notification/src/lib/AccidentNotificationTemplate.ts b/libs/application/templates/accident-notification/src/lib/AccidentNotificationTemplate.ts index 064f8b9d2530..e28f58669588 100644 --- a/libs/application/templates/accident-notification/src/lib/AccidentNotificationTemplate.ts +++ b/libs/application/templates/accident-notification/src/lib/AccidentNotificationTemplate.ts @@ -14,30 +14,33 @@ import { ApplicationTypes, DefaultEvents, defineTemplateApi, - NationalRegistryUserApi, PendingAction, + FormModes, } from '@island.is/application/types' import set from 'lodash/set' import { assign } from 'xstate' import { AccidentTypeEnum, ReviewApprovalEnum } from '..' -import { States } from '../constants' +import { States } from '../utils/constants' import { ApiActions } from '../shared' import { WhoIsTheNotificationForEnum } from '../types' import { AccidentNotificationSchema } from './dataSchema' import { anPendingActionMessages, application } from './messages' +import { AuthDelegationType } from '@island.is/shared/types' +import { IdentityApi, NationalRegistryUserApi } from '../dataProviders' // The applicant is the applicant of the application, can be someone in power of attorney or the representative for the company // The assignee is the person who is assigned to review the application can be the injured person or the representative for the company // The assignee should see all data related to the application being submitted to sjukra but not data only relevant to applicant enum Roles { + PROCURER = 'procurer', APPLICANT = 'applicant', ASSIGNEE = 'assignee', } type AccidentNotificationEvent = | { type: DefaultEvents.APPROVE } - | { type: DefaultEvents.SUBMIT } | { type: DefaultEvents.REJECT } + | { type: DefaultEvents.SUBMIT } | { type: DefaultEvents.ASSIGN } const assignStatePendingAction = ( @@ -61,7 +64,7 @@ const assignStatePendingAction = ( } const reviewStatePendingAction = ( - application: Application, + _application: Application, role: string, ): PendingAction => { if (role === Roles.ASSIGNEE) { @@ -91,15 +94,72 @@ const AccidentNotificationTemplate: ApplicationTemplate< ApplicationConfigurations.AccidentNotification.translation, ], dataSchema: AccidentNotificationSchema, + allowedDelegations: [ + { + type: AuthDelegationType.ProcurationHolder, + }, + { + type: AuthDelegationType.Custom, + }, + ], stateMachineConfig: { - initial: States.DRAFT, + initial: States.PREREQUISITES, states: { + [States.PREREQUISITES]: { + meta: { + name: application.general.name.defaultMessage, + progress: 0, + lifecycle: DefaultStateLifeCycle, + status: FormModes.DRAFT, + actionCard: { + historyLogs: [ + { + onEvent: DefaultEvents.SUBMIT, + logMessage: coreHistoryMessages.applicationStarted, + }, + ], + }, + roles: [ + { + id: Roles.APPLICANT, + formLoader: () => + import('../forms/PrerequisitesForm').then((val) => + Promise.resolve(val.PrerequisitesForm), + ), + actions: [ + { event: 'SUBMIT', name: 'Staðfesta', type: 'primary' }, + ], + write: 'all', + api: [NationalRegistryUserApi, IdentityApi], + delete: true, + }, + { + id: Roles.PROCURER, + formLoader: () => + import('../forms/PrerequisitesProcureForm').then((val) => + Promise.resolve(val.PrerequisitesProcureForm), + ), + actions: [ + { event: 'SUBMIT', name: 'Staðfesta', type: 'primary' }, + ], + write: 'all', + api: [NationalRegistryUserApi, IdentityApi], + delete: true, + }, + ], + }, + on: { + [DefaultEvents.SUBMIT]: { + target: States.DRAFT, + }, + }, + }, [States.DRAFT]: { meta: { name: application.general.name.defaultMessage, progress: 0.4, lifecycle: DefaultStateLifeCycle, - status: 'draft', + status: FormModes.DRAFT, actionCard: { historyLogs: [ { @@ -122,6 +182,19 @@ const AccidentNotificationTemplate: ApplicationTemplate< api: [NationalRegistryUserApi], delete: true, }, + { + id: Roles.PROCURER, + formLoader: () => + import('../forms/AccidentNotificationForm/index').then((val) => + Promise.resolve(val.AccidentNotificationForm), + ), + actions: [ + { event: 'SUBMIT', name: 'Staðfesta', type: 'primary' }, + ], + write: 'all', + api: [NationalRegistryUserApi], + delete: true, + }, ], }, on: { @@ -346,17 +419,16 @@ const AccidentNotificationTemplate: ApplicationTemplate< id: string, application: Application, ): ApplicationRole | undefined { - if (id === application.applicant && application.assignees.includes(id)) { - return Roles.ASSIGNEE - } + const { applicant, applicantActors, assignees } = application - if (id === application.applicant) { + if (id === applicant) { + if (applicantActors.length) return Roles.PROCURER + if (assignees.includes(id)) return Roles.ASSIGNEE return Roles.APPLICANT } - if (application.assignees.includes(id)) { - return Roles.ASSIGNEE - } + if (assignees.includes(id)) return Roles.ASSIGNEE + return undefined }, } diff --git a/libs/application/templates/accident-notification/src/lib/dataSchema.ts b/libs/application/templates/accident-notification/src/lib/dataSchema.ts index a9ee0e7b182b..afb53946fe3b 100644 --- a/libs/application/templates/accident-notification/src/lib/dataSchema.ts +++ b/libs/application/templates/accident-notification/src/lib/dataSchema.ts @@ -1,7 +1,7 @@ import { applicantInformationSchema } from '@island.is/application/ui-forms' import * as kennitala from 'kennitala' import { z } from 'zod' -import { YES } from '../constants' +import { YES } from '../utils/constants' import { AccidentTypeEnum, AgricultureAccidentLocationEnum, diff --git a/libs/application/templates/accident-notification/src/lib/messages/applicantInformation.ts b/libs/application/templates/accident-notification/src/lib/messages/applicantInformation.ts index 9c9a7954b983..e02b7d08abc8 100644 --- a/libs/application/templates/accident-notification/src/lib/messages/applicantInformation.ts +++ b/libs/application/templates/accident-notification/src/lib/messages/applicantInformation.ts @@ -55,6 +55,18 @@ export const applicantInformation = { description: 'Telephone number', }, }), + procure: defineMessages({ + titill: { + id: 'an.application:applicantInfo.procure.title', + defaultMessage: 'Upplýsingar um ', + description: 'Name of the procure identity', + }, + name: { + id: 'an.application:applicantInfo.procure.name', + defaultMessage: 'Nafn', + description: 'Name of the procure identity', + }, + }), forThirdParty: defineMessages({ title: { id: 'an.application:applicantInfo.forThirdParty.title', diff --git a/libs/application/templates/accident-notification/src/lib/messages/externalData.ts b/libs/application/templates/accident-notification/src/lib/messages/externalData.ts index 017a2fefda6f..869618dbdc54 100644 --- a/libs/application/templates/accident-notification/src/lib/messages/externalData.ts +++ b/libs/application/templates/accident-notification/src/lib/messages/externalData.ts @@ -12,30 +12,24 @@ export const externalData = { defaultMessage: 'Meðferð á gögnum', description: 'Data handling list item title', }, - bulletOne: { - id: 'an.application:section.agreementDescription.BulletOne', - defaultMessage: - 'Þegar tilkynning um slys er send Sjúkratryggingum Íslands mun stofnunin miðla upplýsingum um afstöðu til bótaskyldu með þeim atvinnurekanda eða íþróttafélagi sem á í hlut. Ástæðan þess er að umræddir aðilar kunna að eiga rétt á endurgreiðslu útlagðs kostnaðar og/eða dagpeningum ef greidd hafa verið laun í veikindaforföllum vegna slyssins. Þessir aðilar fá aldrei afhentar heilsufars- eða sjúkraskrárupplýsingar.', - description: 'List item 1 on data gathering information', - }, - bulletTwo: { - id: 'an.application:section.agreementDescription.BulletTwo', - defaultMessage: - 'Vinnueftirlit ríkisins kann einnig að fá afrit af tilkynningunni undir ákveðnum kringumstæðum á grundvelli 4. mgr. 79. gr. laga nr. 46/1980 sem og Rannsóknarnefnd samgönguslysa á grundvelli 12. og 16. gr. laga nr. 18/2013.', - description: 'List item 2 on data gathering information', - }, - bulletThree: { - id: 'an.application:section.agreementDescription.BulletThree', - defaultMessage: - 'Eitthvað óvænt verður að hafa gerst sem veldur tjóni á líkama hins tryggða og áhorfandi getur áttað sig á að hafi gerst.', - description: 'List item 3 on data gathering information', - }, bulletFour: { id: 'an.application:section.agreementDescription.BulletFour', defaultMessage: 'Ef tilkynningaskylda er vanrækt skal það ekki vera því til fyrirstöðu að sá slasaði eða vandamenn geti gert kröfu til bóta. Heimilt er að veita undanþágu þótt meira en ár sé liðið ef atvik slyss eru alveg ljós og drátturinn torveldar ekki gagnaöflun um atriði sem skipta máli. Þá er það skilyrði að unnt sé að meta orsakasamband slyssins og heilsutjóns slasaða.', description: 'List item 4 on data gathering information', }, + bullets: { + id: 'an.application:section.agreementDescription.bullets#markdown', + defaultMessage: + '* Þegar tilkynning um slys er send Sjúkratryggingum Íslands mun stofnunin miðla upplýsingum um afstöðu til bótaskyldu með þeim atvinnurekanda eða íþróttafélagi sem á í hlut. Ástæða þess er að umræddir aðilar kunna að eiga rétt á endurgreiðslu útlagðs kostnaðar og/eða dagpeningum ef greidd hafa verið laun í veikindaforföllum vegna slyssins. Þessir aðilar fá aldrei afhentar heilsufars- eða sjúkraskrárupplýsingar. \n\n* Vinnueftirlit ríkisins kann einnig að fá afrit af tilkynningunni undir ákveðnum kringumstæðum á grundvelli 4. mgr. 79. gr. laga nr. 46/1980 sem og Rannsóknarnefnd samgönguslysa á grundvelli 12. og 16. gr. laga nr. 18/2013. \n\n* Eitthvað óvænt verður að hafa gerst sem veldur tjóni á líkama hins tryggða og áhorfandi getur áttað sig á að hafi gerst.', + description: 'Information on data handling before prerequisites', + }, + moreInformation: { + id: 'an.application:section.agreementDescription.moreInformation#markdown', + defaultMessage: + 'Nánari upplýsingar um vinnslu persónuupplýsinga hjá Sjúkratryggingum Íslands á [Persónuverndarsíðu Sjúkratrygginga](https://www.sjukra.is/personuvernd)', + description: 'More information about data handling', + }, }), dataProvider: defineMessages({ sectionTitle: { @@ -72,6 +66,16 @@ export const externalData = { 'Upplýsingar um nafn, kennitölu og heimilisfang. Upplýsingar um börn og maka.', description: 'Description: National Registry', }, + procureDescription: { + id: 'an.application:section.externalData.nationalRegistry.procureDescription', + defaultMessage: 'Upplýsingar um nafn, kennitölu og heimilisfang.', + description: 'Description: National Registry for procure holder', + }, + subTitle: { + id: 'an.application:section.externalData.nationalRegistry.subTitle', + defaultMessage: 'Hér sækjum við nafn, kennitölu og heimilisfang', + description: 'We will fetch name, national id and address', + }, }), accidentProvider: defineMessages({ title: { @@ -152,22 +156,4 @@ export const externalData = { 'Approval of gathering information from Approval of Municipal Collection Agency', }, }), - extraInformation: defineMessages({ - description: { - id: 'an.application:section.externalData.extraInformation.descriptionFirstPart', - defaultMessage: - 'Nánari upplýsingar um vinnslu persónuupplýsinga hjá Sjúkratryggingum Íslands ', - description: 'Description for link in extrainformation', - }, - linkText: { - id: 'an.application:section.externalData.extraInformation.linkText', - defaultMessage: 'Persónuverndarsíðu SÍ.', - description: 'Link text for link', - }, - link: { - id: 'an.application:section.externalData.extraInformation.link', - defaultMessage: 'https://www.sjukra.is/personuvernd.', - description: 'The url the link text links to', - }, - }), } diff --git a/libs/application/templates/accident-notification/src/lib/messages/whoIsTheNotificationFor.ts b/libs/application/templates/accident-notification/src/lib/messages/whoIsTheNotificationFor.ts index 0c5a1b8195b3..035a2a62108f 100644 --- a/libs/application/templates/accident-notification/src/lib/messages/whoIsTheNotificationFor.ts +++ b/libs/application/templates/accident-notification/src/lib/messages/whoIsTheNotificationFor.ts @@ -17,6 +17,11 @@ export const whoIsTheNotificationFor = { defaultMessage: `Hægt er að tilkynna slys í eigin nafni , fyrir aðra einstaklinga sem þú ert með skriflegt umboð frá eða fyrir starfsmann lögaðila. Foreldrar og forráðamenn geta líka sent inn tilkynningu fyrir hönd barna sem þeir fara með forsjá yfir. Stofnanir, samtök og félög sem eru virk á sviði persónuverndar geta sent inn tilkynningu án umboðs að uppfylltum skilyrðum 80. gr. reglugerðar (ESB) 2016/679 (almennu persónuverndarreglugerðarinnar).`, description: 'Description for who is the notifaction for', }, + procureDescription: { + id: 'an.application:whoIsTheNotificationFor.procureDescription', + defaultMessage: `Í umboði er hægt að tilkynna slys fyrir einstaklinga sem þú ert með umboð frá eða fyrir starfsmann lögaðila. Foreldrar og forráðamenn geta líka sent inn tilkynningu fyrir hönd barna sem þeir fara með forsjá yfir. Stofnanir, samtök og félög sem eru virk á sviði persónuverndar geta sent inn tilkynningu án umboðs að uppfylltum skilyrðum 80. gr. reglugerðar (ESB) 2016/679 (almennu persónuverndarreglugerðarinnar).`, + description: 'Description for who is the notifaction for', + }, }), labels: defineMessages({ juridicalPerson: { @@ -34,6 +39,11 @@ export const whoIsTheNotificationFor = { defaultMessage: 'Í umboði fyrir annan einstakling', description: 'Label for power of attorney option', }, + powerOfAttorneyProcure: { + id: 'an.application:whoIsTheNotificationFor.labels.powerOfAttorneyProcure', + defaultMessage: 'Einstakling', + description: 'Label for power of attorney option', + }, childInCustody: { id: 'an.application:whoIsTheNotificationFor.labels.childInCustody', defaultMessage: 'Fyrir barn í minni forsjá', diff --git a/libs/application/templates/accident-notification/src/types/index.ts b/libs/application/templates/accident-notification/src/types/index.ts index 1b3694a9b695..da316a4fd5f7 100644 --- a/libs/application/templates/accident-notification/src/types/index.ts +++ b/libs/application/templates/accident-notification/src/types/index.ts @@ -1,4 +1,4 @@ -import { NO, YES } from './../constants' +import { NO, YES } from '../utils/constants' export type CompanyInfo = { nationalRegistrationId: string @@ -58,11 +58,6 @@ export enum ChoiceEnum { NO = 'no', } -export enum DataProviderTypes { - NationalRegistry = 'NationalRegistryProvider', - UserProfile = 'UserProfileProvider', -} - export enum WhoIsTheNotificationForEnum { JURIDICALPERSON = 'juridicalPerson', ME = 'me', diff --git a/libs/application/templates/accident-notification/src/constants/index.ts b/libs/application/templates/accident-notification/src/utils/constants/index.ts similarity index 90% rename from libs/application/templates/accident-notification/src/constants/index.ts rename to libs/application/templates/accident-notification/src/utils/constants/index.ts index f17e43d36595..c13413335ab9 100644 --- a/libs/application/templates/accident-notification/src/constants/index.ts +++ b/libs/application/templates/accident-notification/src/utils/constants/index.ts @@ -7,6 +7,7 @@ export const FILE_SIZE_LIMIT = 10000000 // 10MB export enum States { // Draft flow + PREREQUISITES = 'prerequisites', DRAFT = 'draft', REVIEW = 'review', REVIEW_ADD_ATTACHMENT = 'reviewAddAttachment', diff --git a/libs/application/templates/accident-notification/src/utils/getWhoIstheNotificationForOptions.ts b/libs/application/templates/accident-notification/src/utils/getWhoIstheNotificationForOptions.ts new file mode 100644 index 000000000000..28910229cf83 --- /dev/null +++ b/libs/application/templates/accident-notification/src/utils/getWhoIstheNotificationForOptions.ts @@ -0,0 +1,32 @@ +import { WhoIsTheNotificationForEnum } from '../types' +import { whoIsTheNotificationFor } from '../lib/messages' + +export const whoIsTheNotificationForOptions = [ + { + value: WhoIsTheNotificationForEnum.ME, + label: whoIsTheNotificationFor.labels.me, + }, + { + value: WhoIsTheNotificationForEnum.POWEROFATTORNEY, + label: whoIsTheNotificationFor.labels.powerOfAttorney, + }, + { + value: WhoIsTheNotificationForEnum.JURIDICALPERSON, + label: whoIsTheNotificationFor.labels.juridicalPerson, + }, + { + value: WhoIsTheNotificationForEnum.CHILDINCUSTODY, + label: whoIsTheNotificationFor.labels.childInCustody, + }, +] + +export const whoIsTheNotificationForProcureOptions = [ + { + value: WhoIsTheNotificationForEnum.POWEROFATTORNEY, + label: whoIsTheNotificationFor.labels.powerOfAttorneyProcure, + }, + { + value: WhoIsTheNotificationForEnum.JURIDICALPERSON, + label: whoIsTheNotificationFor.labels.juridicalPerson, + }, +] diff --git a/libs/application/templates/accident-notification/src/utils/getWorkplaceData.spec.ts b/libs/application/templates/accident-notification/src/utils/getWorkplaceData.spec.ts index 83bd9755d9ad..45a3cb6d6a11 100644 --- a/libs/application/templates/accident-notification/src/utils/getWorkplaceData.spec.ts +++ b/libs/application/templates/accident-notification/src/utils/getWorkplaceData.spec.ts @@ -1,5 +1,5 @@ import { FormValue } from '@island.is/application/types' -import { YES } from '../constants' +import { YES } from './constants' import { AccidentTypeEnum, WorkAccidentTypeEnum } from '../types' import { getWorkplaceData } from './getWorkplaceData' diff --git a/libs/application/templates/accident-notification/src/utils/hasMissingDocuments.spec.ts b/libs/application/templates/accident-notification/src/utils/hasMissingDocuments.spec.ts index b36f131d049a..945c4858ce4f 100644 --- a/libs/application/templates/accident-notification/src/utils/hasMissingDocuments.spec.ts +++ b/libs/application/templates/accident-notification/src/utils/hasMissingDocuments.spec.ts @@ -4,7 +4,7 @@ import { hasReceivedAllDocuments, } from './hasMissingDocuments' import { WhoIsTheNotificationForEnum, AttachmentsEnum } from '../types' -import { NO, YES } from '../constants' +import { NO, YES } from './constants' import { FormatMessage } from '@island.is/localization' import { FormValue } from '@island.is/application/types' import { AccidentNotification } from '../lib/dataSchema' diff --git a/libs/application/templates/accident-notification/src/utils/hasMissingDocuments.ts b/libs/application/templates/accident-notification/src/utils/hasMissingDocuments.ts index 3c53fe8daf71..d262c07b6226 100644 --- a/libs/application/templates/accident-notification/src/utils/hasMissingDocuments.ts +++ b/libs/application/templates/accident-notification/src/utils/hasMissingDocuments.ts @@ -2,7 +2,7 @@ import { getValueViaPath } from '@island.is/application/core' import { FormValue } from '@island.is/application/types' import { FormatMessage } from '@island.is/localization' import { AttachmentsEnum, FileType, WhoIsTheNotificationForEnum } from '..' -import { YES } from '../constants' +import { YES } from './constants' import { attachments } from '../lib/messages' import { AccidentNotificationAttachmentStatus, diff --git a/libs/application/templates/accident-notification/src/utils/index.spec.ts b/libs/application/templates/accident-notification/src/utils/index.spec.ts index 33d834780e7d..9bde4080715f 100644 --- a/libs/application/templates/accident-notification/src/utils/index.spec.ts +++ b/libs/application/templates/accident-notification/src/utils/index.spec.ts @@ -1,5 +1,5 @@ import { FormatMessage } from '@island.is/localization' -import { YES } from '../constants' +import { YES } from './constants' import { AccidentNotification } from '../lib/dataSchema' import { AttachmentsEnum, WhoIsTheNotificationForEnum } from '../types' import { diff --git a/libs/application/templates/accident-notification/src/utils/index.ts b/libs/application/templates/accident-notification/src/utils/index.ts index 969019bb45bf..2c1059df92f6 100644 --- a/libs/application/templates/accident-notification/src/utils/index.ts +++ b/libs/application/templates/accident-notification/src/utils/index.ts @@ -1,6 +1,6 @@ import { AttachmentsEnum, FileType, WhoIsTheNotificationForEnum } from '..' import { getValueViaPath } from '@island.is/application/core' -import { YES } from '../constants' +import { YES } from './constants' import { AccidentNotification } from '../lib/dataSchema' import { attachments, overview } from '../lib/messages' import { FormatMessage } from '@island.is/localization' diff --git a/libs/application/templates/accident-notification/src/utils/isFatalAccident.spec.ts b/libs/application/templates/accident-notification/src/utils/isFatalAccident.spec.ts index e1e2118355d3..67b9f7bb25ec 100644 --- a/libs/application/templates/accident-notification/src/utils/isFatalAccident.spec.ts +++ b/libs/application/templates/accident-notification/src/utils/isFatalAccident.spec.ts @@ -1,6 +1,6 @@ import { FormValue } from '@island.is/application/types' import { isFatalAccident } from './isFatalAccident' -import { NO, YES } from '../constants' +import { NO, YES } from './constants' describe('isFatalAccident', () => { const fatal: FormValue = { diff --git a/libs/application/templates/accident-notification/src/utils/isFatalAccident.ts b/libs/application/templates/accident-notification/src/utils/isFatalAccident.ts index 3866ad16930f..4094c3efbc99 100644 --- a/libs/application/templates/accident-notification/src/utils/isFatalAccident.ts +++ b/libs/application/templates/accident-notification/src/utils/isFatalAccident.ts @@ -1,6 +1,6 @@ import { getValueViaPath } from '@island.is/application/core' import { FormValue } from '@island.is/application/types' -import { YES } from '../constants' +import { YES } from './constants' import { YesOrNo } from '../types' export const isFatalAccident = (formValue: FormValue) => { diff --git a/libs/application/templates/accident-notification/src/utils/isMachineRelatedAccident.spec.ts b/libs/application/templates/accident-notification/src/utils/isMachineRelatedAccident.spec.ts index 6a66f77d0ad2..017a1e679a26 100644 --- a/libs/application/templates/accident-notification/src/utils/isMachineRelatedAccident.spec.ts +++ b/libs/application/templates/accident-notification/src/utils/isMachineRelatedAccident.spec.ts @@ -1,5 +1,5 @@ import { FormValue } from '@island.is/application/types' -import { NO, YES } from '../constants' +import { NO, YES } from './constants' import { AccidentTypeEnum, WorkAccidentTypeEnum } from '../types' import { isMachineRelatedAccident } from './isMachineRelatedAccident' describe('isMachineRelatedAccident', () => { diff --git a/libs/application/templates/accident-notification/src/utils/isMachineRelatedAccident.ts b/libs/application/templates/accident-notification/src/utils/isMachineRelatedAccident.ts index 627f2da6c98b..fd3cabc5347b 100644 --- a/libs/application/templates/accident-notification/src/utils/isMachineRelatedAccident.ts +++ b/libs/application/templates/accident-notification/src/utils/isMachineRelatedAccident.ts @@ -1,6 +1,6 @@ import { getValueViaPath } from '@island.is/application/core' import { FormValue } from '@island.is/application/types' -import { YES } from '../constants' +import { YES } from './constants' import { YesOrNo } from '../types' import { isGeneralWorkplaceAccident } from './isGeneralWorkplaceAccident' diff --git a/libs/application/templates/accident-notification/src/utils/isRepresentativeOfCompanyOrInstitute.spec.ts b/libs/application/templates/accident-notification/src/utils/isRepresentativeOfCompanyOrInstitute.spec.ts index f1ce2bcfd63c..aeff9475efef 100644 --- a/libs/application/templates/accident-notification/src/utils/isRepresentativeOfCompanyOrInstitute.spec.ts +++ b/libs/application/templates/accident-notification/src/utils/isRepresentativeOfCompanyOrInstitute.spec.ts @@ -5,7 +5,7 @@ import { isInjuredAndRepresentativeOfCompanyOrInstitute, isRepresentativeOfCompanyOrInstitute, } from './isRepresentativeOfCompanyOrInstitute' -import { NO, YES } from '../constants' +import { NO, YES } from './constants' const emptyObject = {} diff --git a/libs/application/templates/accident-notification/src/utils/isRepresentativeOfCompanyOrInstitute.ts b/libs/application/templates/accident-notification/src/utils/isRepresentativeOfCompanyOrInstitute.ts index 77ba93c9a40a..f8c98b7b61f5 100644 --- a/libs/application/templates/accident-notification/src/utils/isRepresentativeOfCompanyOrInstitute.ts +++ b/libs/application/templates/accident-notification/src/utils/isRepresentativeOfCompanyOrInstitute.ts @@ -1,6 +1,6 @@ import { getValueViaPath } from '@island.is/application/core' import { FormValue } from '@island.is/application/types' -import { YES } from '../constants' +import { YES } from './constants' import { WhoIsTheNotificationForEnum } from '../types' export const isRepresentativeOfCompanyOrInstitute = (formValue: FormValue) => { diff --git a/libs/application/templates/announcement-of-death/src/types/index.ts b/libs/application/templates/announcement-of-death/src/types/index.ts index 191ffbeb2b7c..537b31b4a217 100644 --- a/libs/application/templates/announcement-of-death/src/types/index.ts +++ b/libs/application/templates/announcement-of-death/src/types/index.ts @@ -22,7 +22,3 @@ export interface Child { export interface NationalRegistry extends Person { children: Child[] } - -export enum DataProviderTypes { - NationalRegistry = 'NationalRegistryProvider', -} diff --git a/libs/application/templates/family-matters/children-residence-change-v2/src/types/index.ts b/libs/application/templates/family-matters/children-residence-change-v2/src/types/index.ts index 0a917b6ab728..9c90065864d8 100644 --- a/libs/application/templates/family-matters/children-residence-change-v2/src/types/index.ts +++ b/libs/application/templates/family-matters/children-residence-change-v2/src/types/index.ts @@ -23,9 +23,3 @@ export type CRCFieldBaseProps = Override< FieldBaseProps, { application: CRCApplication; errors: ErrorSchema } > - -export enum DataProviderTypes { - MockNationalRegistry = 'MockNationalRegistryProvider', - NationalRegistry = 'NationalRegistryProvider', - UserProfile = 'UserProfileProvider', -} diff --git a/libs/application/templates/general-fishing-license/src/dataProviders/index.ts b/libs/application/templates/general-fishing-license/src/dataProviders/index.ts index 90bb14e08174..57a090f5ae3d 100644 --- a/libs/application/templates/general-fishing-license/src/dataProviders/index.ts +++ b/libs/application/templates/general-fishing-license/src/dataProviders/index.ts @@ -20,5 +20,5 @@ export const ShipRegistryApi = defineTemplateApi({ }) export const IdentityApi = IdsApi.configure({ - externalDataId: 'identityRegistry', + externalDataId: 'identity', }) diff --git a/libs/application/templates/general-fishing-license/src/lib/dataSchema.ts b/libs/application/templates/general-fishing-license/src/lib/dataSchema.ts index 693e7797bf0b..90cfc3b6e76b 100644 --- a/libs/application/templates/general-fishing-license/src/lib/dataSchema.ts +++ b/libs/application/templates/general-fishing-license/src/lib/dataSchema.ts @@ -16,7 +16,7 @@ const FileSchema = z.object({ export const GeneralFishingLicenseSchema = z.object({ approveExternalData: z.boolean().refine((v) => v), externalData: z.object({ - identityRegistry: z.object({ + identity: z.object({ data: z.object({ date: z.string(), status: z.enum(['success', 'failure']), diff --git a/libs/application/templates/general-fishing-license/src/types/index.ts b/libs/application/templates/general-fishing-license/src/types/index.ts index 5c7c341f29b7..d5b63ee5f9d5 100644 --- a/libs/application/templates/general-fishing-license/src/types/index.ts +++ b/libs/application/templates/general-fishing-license/src/types/index.ts @@ -1,9 +1,3 @@ -export enum DataProviderTypes { - NationalRegistry = 'NationalRegistryProvider', - UserProfile = 'UserProfileProvider', - IdentityRegistry = 'IdentityProvider', -} - export enum FishingLicenseEnum { HOOKCATCHLIMIT = 'hookCatchLimit', FISHWITHDANISHSEINE = 'fishWithDanishSeine', // Dragnótaveiðileyfi diff --git a/libs/application/templates/public-debt-payment-plan/src/fields/Overview/Overview.tsx b/libs/application/templates/public-debt-payment-plan/src/fields/Overview/Overview.tsx index dc2d8f8c5f84..59646a7a88ad 100644 --- a/libs/application/templates/public-debt-payment-plan/src/fields/Overview/Overview.tsx +++ b/libs/application/templates/public-debt-payment-plan/src/fields/Overview/Overview.tsx @@ -53,7 +53,7 @@ export const Overview = ({ application, goToScreen }: FieldBaseProps) => { 'paymentPlans', ) as PaymentPlan[] - const identityRegistry = getValueViaPath( + const identity = getValueViaPath( application.externalData, 'identity', ) as IdentityResult @@ -138,14 +138,14 @@ export const Overview = ({ application, goToScreen }: FieldBaseProps) => { editAction('applicantSection')}> - {identityRegistry?.data?.name && ( + {identity?.data?.name && ( - {identityRegistry.data.name} + {identity.data.name} )} {applicant?.phoneNumber && ( @@ -158,12 +158,12 @@ export const Overview = ({ application, goToScreen }: FieldBaseProps) => { )} - {identityRegistry?.data?.address?.streetAddress && - identityRegistry?.data?.address?.postalCode && - identityRegistry?.data?.address?.city && ( + {identity?.data?.address?.streetAddress && + identity?.data?.address?.postalCode && + identity?.data?.address?.city && ( - {`${identityRegistry?.data?.address?.streetAddress}, ${identityRegistry?.data?.address?.postalCode} ${identityRegistry?.data?.address?.city}`} + {`${identity?.data?.address?.streetAddress}, ${identity?.data?.address?.postalCode} ${identity?.data?.address?.city}`} )} {applicant?.email && ( diff --git a/libs/application/ui-forms/src/lib/applicantInformationMultiField/applicantInformationMultiField.ts b/libs/application/ui-forms/src/lib/applicantInformationMultiField/applicantInformationMultiField.ts index 48052a903ad8..eaa4840bacd7 100644 --- a/libs/application/ui-forms/src/lib/applicantInformationMultiField/applicantInformationMultiField.ts +++ b/libs/application/ui-forms/src/lib/applicantInformationMultiField/applicantInformationMultiField.ts @@ -35,7 +35,7 @@ export const applicantInformationMultiField = ( disabled: true, defaultValue: (application: ApplicantInformationInterface) => application.externalData?.nationalRegistry?.data?.fullName ?? - application.externalData?.identityRegistry?.data?.name ?? + application.externalData?.identity?.data?.name ?? '', }), buildTextField({ @@ -47,7 +47,7 @@ export const applicantInformationMultiField = ( disabled: true, defaultValue: (application: ApplicantInformationInterface) => application.externalData?.nationalRegistry?.data?.nationalId ?? - application.externalData?.identityRegistry?.data?.nationalId ?? + application.externalData?.identity?.data?.nationalId ?? '', }), buildTextField({ @@ -59,8 +59,7 @@ export const applicantInformationMultiField = ( defaultValue: (application: ApplicantInformationInterface) => application.externalData?.nationalRegistry?.data?.address ?.streetAddress ?? - application.externalData?.identityRegistry?.data?.address - ?.streetAddress ?? + application.externalData?.identity?.data?.address?.streetAddress ?? '', }), buildTextField({ @@ -74,8 +73,7 @@ export const applicantInformationMultiField = ( return ( application.externalData?.nationalRegistry?.data?.address ?.postalCode ?? - application.externalData?.identityRegistry?.data?.address - ?.postalCode ?? + application.externalData?.identity?.data?.address?.postalCode ?? '' ) }, @@ -88,7 +86,7 @@ export const applicantInformationMultiField = ( disabled: true, defaultValue: (application: ApplicantInformationInterface) => application.externalData?.nationalRegistry?.data?.address?.city ?? - application.externalData?.identityRegistry?.data?.address?.city ?? + application.externalData?.identity?.data?.address?.city ?? '', }), buildTextField({ diff --git a/libs/application/ui-forms/src/lib/applicantInformationMultiField/types.ts b/libs/application/ui-forms/src/lib/applicantInformationMultiField/types.ts index eccb0b392c5d..e2f87089ef71 100644 --- a/libs/application/ui-forms/src/lib/applicantInformationMultiField/types.ts +++ b/libs/application/ui-forms/src/lib/applicantInformationMultiField/types.ts @@ -2,7 +2,7 @@ import { FormText } from '@island.is/application/types' export interface ApplicantInformationInterface { externalData: { // new dataprovider - identityRegistry: { + identity: { data: { name: 'string' nationalId: 'string' From de0bf4ccecc86a77600fc42e6e065da7cf7c7ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar=20Vestmann?= <43557895+RunarVestmann@users.noreply.github.com> Date: Thu, 12 Dec 2024 21:12:47 +0000 Subject: [PATCH 3/3] =?UTF-8?q?feat(web):=20Global=20search=20alias=20for?= =?UTF-8?q?=20'Vinnum=C3=A1lastofnun'=20(#17204)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- libs/content-search-toolkit/src/queries/search.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/content-search-toolkit/src/queries/search.ts b/libs/content-search-toolkit/src/queries/search.ts index d8bde3c182ea..82cdb3f98f53 100644 --- a/libs/content-search-toolkit/src/queries/search.ts +++ b/libs/content-search-toolkit/src/queries/search.ts @@ -35,6 +35,8 @@ export const searchQuery = ( // Handle aliases since the search engine has not been configured to support organization aliases if (queryString.trim().toLowerCase() === 'tr') { queryString = 'Tryggingastofnun' + } else if (queryString.trim().toLowerCase() === 'vmst') { + queryString = 'Vinnumálastofnun' } // * wildcard support for internal clients - eg. used by island.is app