@bloom-housing/ui-components 3.0.0 → 3.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,59 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.0.1-alpha.0](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.0...@bloom-housing/ui-components@3.0.1-alpha.0) (2021-11-05)
7
+
8
+
9
+ * 1837/preferences cleanup 3 (#2144) ([3ce6d5e](https://github.com/bloom-housing/bloom/commit/3ce6d5eb5aac49431ec5bf4912dbfcbe9077d84e)), closes [#2144](https://github.com/bloom-housing/bloom/issues/2144)
10
+
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * Preferences are now M-N relation with a listing and have an intermediate table with ordinal number
15
+
16
+ * refactor(backend): preferences deduplication
17
+
18
+ So far each listing referenced it's own unique Preferences. This change introduces Many to Many
19
+ relationship between Preference and Listing entity and forces sharing Preferences between listings.
20
+
21
+ * feat(backend): extend preferences migration with moving existing relations to a new intermediate tab
22
+
23
+ * feat(backend): add Preference - Jurisdiction ManyToMany relation
24
+
25
+ * feat: adapt frontend to backend changes
26
+
27
+ * fix(backend): typeORM preferences select statement
28
+
29
+ * fix(backend): connect preferences with jurisdictions in seeds, fix pref filter validator
30
+
31
+ * fix(backend): fix missing import in preferences-filter-params.ts
32
+
33
+ * refactor: rebase issue
34
+
35
+ * feat: uptake jurisdictional preferences
36
+
37
+ * fix: fixup tests
38
+
39
+ * fix: application preferences ignore page, always separate
40
+
41
+ * Remove page from src/migration/1633359409242-add-listing-preferences-intermediate-relation.ts
42
+
43
+ * fix: preference fetching and ordering/pages
44
+
45
+ * Fix code style issues with Prettier
46
+
47
+ * fix(backend): query User__leasingAgentInListings__jurisdiction_User__leasingAgentIn specified more
48
+
49
+ * fix: perferences cypress tests
50
+
51
+ Co-authored-by: Michal Plebanski <michalp@airnauts.com>
52
+ Co-authored-by: Emily Jablonski <emily.jablonski@exygy.com>
53
+ Co-authored-by: Lint Action <lint-action@samuelmeuli.com>
54
+
55
+
56
+
57
+
58
+
6
59
  # [3.0.0](https://github.com/seanmalbert/bloom/compare/@bloom-housing/ui-components@2.0.1-alpha.8...@bloom-housing/ui-components@3.0.0) (2021-11-05)
7
60
 
8
61
  **Note:** Version bump only for package @bloom-housing/ui-components
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "3.0.0",
3
+ "version": "3.0.1-alpha.0",
4
4
  "author": "Sean Albert <sean.albert@exygy.com>",
5
5
  "description": "Shared user interface components for Bloom affordable housing system",
6
6
  "homepage": "https://github.com/bloom-housing/bloom/tree/master/shared/ui-components",
@@ -69,7 +69,7 @@
69
69
  "webpack": "^4.44.2"
70
70
  },
71
71
  "dependencies": {
72
- "@bloom-housing/backend-core": "^3.0.0",
72
+ "@bloom-housing/backend-core": "^3.0.1-alpha.0",
73
73
  "@mapbox/mapbox-sdk": "^0.13.0",
74
74
  "@types/body-scroll-lock": "^2.6.1",
75
75
  "@types/jwt-decode": "^2.2.1",
@@ -100,5 +100,5 @@
100
100
  "tailwindcss": "2.2.10",
101
101
  "typesafe-actions": "^5.1.0"
102
102
  },
103
- "gitHead": "05ed5c42d83134d0401081b2e67f739ad5bf69ac"
103
+ "gitHead": "a1bb74640840fb852b7819413e3c3d5b1ce0dd72"
104
104
  }
@@ -4,6 +4,7 @@ import {
4
4
  ApplicationPreference,
5
5
  FormMetadataOptions,
6
6
  Preference,
7
+ ListingPreference,
7
8
  } from "@bloom-housing/backend-core/types"
8
9
  import { UseFormMethods } from "react-hook-form"
9
10
  import {
@@ -373,20 +374,25 @@ export type ExclusiveKey = {
373
374
  /*
374
375
  Create an array of all exclusive keys from a preference set
375
376
  */
376
- export const getExclusiveKeys = (preferences: Preference[]) => {
377
+ export const getExclusiveKeys = (preferences: ListingPreference[]) => {
377
378
  const exclusive: ExclusiveKey[] = []
378
- preferences?.forEach((preference) => {
379
- preference?.formMetadata?.options.forEach((option: FormMetadataOptions) => {
379
+ preferences?.forEach((listingPreference) => {
380
+ listingPreference.preference?.formMetadata?.options.forEach((option: FormMetadataOptions) => {
380
381
  if (option.exclusive)
381
382
  exclusive.push({
382
- optionKey: getPreferenceOptionName(option.key, preference?.formMetadata?.key ?? ""),
383
- preferenceKey: preference?.formMetadata?.key,
383
+ optionKey: getPreferenceOptionName(
384
+ option.key,
385
+ listingPreference.preference?.formMetadata?.key ?? ""
386
+ ),
387
+ preferenceKey: listingPreference.preference?.formMetadata?.key,
384
388
  })
385
389
  })
386
- if (!preference?.formMetadata?.hideGenericDecline)
390
+ if (!listingPreference.preference?.formMetadata?.hideGenericDecline)
387
391
  exclusive.push({
388
- optionKey: getExclusivePreferenceOptionName(preference?.formMetadata?.key),
389
- preferenceKey: preference?.formMetadata?.key,
392
+ optionKey: getExclusivePreferenceOptionName(
393
+ listingPreference.preference?.formMetadata?.key
394
+ ),
395
+ preferenceKey: listingPreference.preference?.formMetadata?.key,
390
396
  })
391
397
  })
392
398
  return exclusive
@@ -1,10 +1,22 @@
1
1
  import * as React from "react"
2
- import { Preference, PreferenceLink } from "@bloom-housing/backend-core/types"
3
2
  import "./PreferencesList.scss"
4
3
  import { locale } from "../helpers/translator"
5
4
 
5
+ export interface ListPreferenceLink {
6
+ title: string
7
+ url: string
8
+ }
9
+
10
+ export interface ListPreference {
11
+ ordinal?: number
12
+ links?: ListPreferenceLink[]
13
+ title?: string
14
+ subtitle?: string
15
+ description?: string
16
+ }
17
+
6
18
  export interface PreferencesListProps {
7
- preferences: Preference[]
19
+ listingPreferences: ListPreference[]
8
20
  }
9
21
 
10
22
  const getOrdinal = (n: number) => {
@@ -18,10 +30,7 @@ const getOrdinal = (n: number) => {
18
30
  }
19
31
 
20
32
  const PreferencesList = (props: PreferencesListProps) => {
21
- const filteredPreferences = props.preferences.filter(
22
- (pref) => !pref.formMetadata?.hideFromListing
23
- )
24
- const preferences = filteredPreferences.map((preference: Preference, index: number) => {
33
+ const preferences = props.listingPreferences?.map((preference: ListPreference, index: number) => {
25
34
  const itemClasses = ["preferences-list__item", "info-card"]
26
35
 
27
36
  if (!preference.subtitle && !preference.description && !preference.links) {
@@ -43,7 +52,7 @@ const PreferencesList = (props: PreferencesListProps) => {
43
52
  )}
44
53
  {preference.links && (
45
54
  <div className="preferences-list__links">
46
- {preference.links.map((link: PreferenceLink, linkIndex: number) => (
55
+ {preference.links.map((link: ListPreferenceLink, linkIndex: number) => (
47
56
  <span key={linkIndex}>
48
57
  <a href={link.url}>{link.title}</a>
49
58
  </span>
@@ -891,6 +891,7 @@
891
891
  "isDigitalApplication": "Is there a digital application?",
892
892
  "isPaperApplication": "Is there a paper application?",
893
893
  "isReferralOpportunity": "Is there a referral opportunity?",
894
+ "selectJurisdiction": "You must first select a jurisdiction",
894
895
  "latitude": "Latitude",
895
896
  "leasingAgentAddress": "Leasing Agent Address",
896
897
  "listingPreviewOnly": "This is a listing preview only.",