@thecb/components 5.8.1-beta.2 → 5.8.1-beta.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "5.8.1-beta.2",
3
+ "version": "5.8.1-beta.5",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -30,9 +30,16 @@ const Obligation = ({
30
30
  inactiveLookupInput = "Account",
31
31
  inactiveLookupValue = ""
32
32
  }) => {
33
- const obligation = obligations[0];
34
- console.log("obligation in obligation component", obligation);
35
- const { customAttributes } = obligation;
33
+ /*
34
+ The value of obligations is always an array. It can contain:
35
+ - A single obligation
36
+ - A group of obligations (a "collection")
37
+
38
+ The top level desc/subdesc for all obligations in a collection is the same
39
+ (Collection accounts look different in the Account Details page)
40
+ */
41
+ const firstObligation = obligations[0];
42
+ const customAttributes = firstObligation?.customAttributes ?? {};
36
43
  const boxShadowValue =
37
44
  "0px 4px 4px rgba(41, 42, 51, 0.1), 0px 1px 1px 2px rgba(41, 42, 51, 0.1);";
38
45
  const activeObligation = (
@@ -41,11 +48,16 @@ const Obligation = ({
41
48
  borderRadius="4px"
42
49
  boxShadow={boxShadowValue}
43
50
  as="section"
44
- aria-label={`${obligation.description} ${obligation.subDescription}`}
51
+ aria-label={`${firstObligation?.description ??
52
+ "account"} ${firstObligation?.subDescription ?? obligationAssocID}`}
45
53
  >
46
54
  <Box background={WHITE}>
47
55
  <Stack childGap="14px">
48
- <Box key={`${obligations[0].id}-top`} padding="0 8px" minWidth="100%">
56
+ <Box
57
+ key={`${firstObligation?.id}-top`}
58
+ padding="0 8px"
59
+ minWidth="100%"
60
+ >
49
61
  <Cluster
50
62
  justify="space-between"
51
63
  align="center"
@@ -64,8 +76,8 @@ const Obligation = ({
64
76
  />
65
77
  )}
66
78
  <TitleModule
67
- title={obligation.description}
68
- subtitle={obligation.subDescription}
79
+ title={firstObligation?.description}
80
+ subtitle={firstObligation?.subDescription}
69
81
  titleColor={BRIGHT_GREY}
70
82
  isMobile={isMobile}
71
83
  />
@@ -73,7 +85,7 @@ const Obligation = ({
73
85
  </Box>
74
86
  {!isMobile && (
75
87
  <AmountModule
76
- totalAmountDue={obligations.reduce(
88
+ totalAmountDue={obligations?.reduce(
77
89
  (acc, curr) => acc + curr.amountDue,
78
90
  0
79
91
  )}
@@ -138,7 +150,7 @@ const Obligation = ({
138
150
  >
139
151
  <Box background={ATHENS_GREY}>
140
152
  <Stack childGap="14px">
141
- <Box key={`${obligations[0].id}-top`} padding="0 8px" minWidth="100%">
153
+ <Box key={`${obligationAssocID}-top`} padding="0 8px" minWidth="100%">
142
154
  <Cluster
143
155
  justify="space-between"
144
156
  align="center"