@thecb/components 11.1.9 → 11.1.10

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/dist/index.cjs.js CHANGED
@@ -46850,8 +46850,8 @@ var AutopayModalModule = function AutopayModalModule(_ref) {
46850
46850
  onClick = _ref.onClick,
46851
46851
  onKeyPress = _ref.onKeyPress;
46852
46852
  var generateMethodNeededText = function generateMethodNeededText(planText, allowedPaymentInstruments) {
46853
- var allowsCard = allowedPaymentInstruments.includes(CC_METHOD);
46854
- var allowsACH = allowedPaymentInstruments.includes(ACH_METHOD);
46853
+ var allowsCard = allowedPaymentInstruments === null || allowedPaymentInstruments === void 0 ? void 0 : allowedPaymentInstruments.includes(CC_METHOD);
46854
+ var allowsACH = allowedPaymentInstruments === null || allowedPaymentInstruments === void 0 ? void 0 : allowedPaymentInstruments.includes(ACH_METHOD);
46855
46855
  var methodRequired = allowsCard && !allowsACH ? "debit or credit card payment method" : !allowsCard && allowsACH ? "checking account payment method" : "payment method";
46856
46856
  return "To set up ".concat(planText, " you must have a saved ").concat(methodRequired, " and address. Do you want to save these now?");
46857
46857
  };
@@ -47359,7 +47359,8 @@ var fallbackValues$N = {
47359
47359
  var Obligation = function Obligation(_ref) {
47360
47360
  var _obligations$, _firstObligation$cust;
47361
47361
  var config = _ref.config,
47362
- obligations = _ref.obligations,
47362
+ _ref$obligations = _ref.obligations,
47363
+ obligations = _ref$obligations === void 0 ? [] : _ref$obligations,
47363
47364
  actions = _ref.actions,
47364
47365
  autoPayEnabled = _ref.autoPayEnabled,
47365
47366
  autoPayAvailable = _ref.autoPayAvailable,
@@ -47459,6 +47460,7 @@ var Obligation = function Obligation(_ref) {
47459
47460
  isLoading: true
47460
47461
  }))), !isMobile && /*#__PURE__*/React__default.createElement(PaymentDetailsActions, {
47461
47462
  obligations: obligations,
47463
+ obligationAssocID: obligationAssocID,
47462
47464
  autoPayEnabled: autoPayEnabled,
47463
47465
  autoPayAvailable: autoPayAvailable,
47464
47466
  handleAutopayAction: handleAutopayAction,
@@ -47479,6 +47481,7 @@ var Obligation = function Obligation(_ref) {
47479
47481
  isContentLoading: true
47480
47482
  }))), isMobile && /*#__PURE__*/React__default.createElement(PaymentDetailsActions, {
47481
47483
  obligations: obligations,
47484
+ obligationAssocID: obligationAssocID,
47482
47485
  autoPayEnabled: autoPayEnabled,
47483
47486
  autoPayAvailable: autoPayAvailable,
47484
47487
  handleAutopayAction: handleAutopayAction,
@@ -50740,8 +50743,7 @@ var FilterButton$1 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
50740
50743
  truncateBtnTextWidth = _ref.truncateBtnTextWidth,
50741
50744
  filterLabel = _ref.filterLabel,
50742
50745
  selectedOptions = _ref.selectedOptions,
50743
- extraStyles = _ref.extraStyles,
50744
- dataAppliedOptions = _ref.dataAppliedOptions;
50746
+ extraStyles = _ref.extraStyles;
50745
50747
  var btnTextFilterDescription = selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? "".concat(filterLabel ? "".concat(filterLabel, ": ") : "").concat(selectedOptions[0].name) : "".concat(filterLabel ? filterLabel : "");
50746
50748
  var btnTextItemsDescription = selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length && (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 1 ? ", +".concat((selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) - 1, " More") : "";
50747
50749
  return /*#__PURE__*/React__default.createElement(StyledFilterButton, {
@@ -50759,7 +50761,6 @@ var FilterButton$1 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
50759
50761
  dataQa: "".concat(name, "-filter-button"),
50760
50762
  extraStyles: extraStyles,
50761
50763
  "aria-label": "".concat(filterLabel, " Filter: ").concat(btnTextFilterDescription, " ").concat(btnTextItemsDescription),
50762
- "data-applied-options": dataAppliedOptions,
50763
50764
  contentOverride: true
50764
50765
  }, btnContentOverride ? btnContentOverride : /*#__PURE__*/React__default.createElement(Center, {
50765
50766
  as: "span",
@@ -50944,19 +50945,6 @@ var selectOption = function selectOption(option, selectedOptions, setSelectedOpt
50944
50945
  setSelectedOptions(moreOptions);
50945
50946
  }
50946
50947
  };
50947
- var mergeOptions = function mergeOptions(selectedOptions, activeOptions) {
50948
- if (!activeOptions.length) return selectedOptions;
50949
- if (!selectedOptions.length) return activeOptions;
50950
- var mergedOptions = _toConsumableArray(selectedOptions);
50951
- activeOptions.forEach(function (activeOption) {
50952
- if (!mergedOptions.some(function (option) {
50953
- return option.name === activeOption.name;
50954
- })) {
50955
- mergedOptions.push(activeOption);
50956
- }
50957
- });
50958
- return mergedOptions;
50959
- };
50960
50948
 
50961
50949
  var useKeyboardNavigation = function useKeyboardNavigation(_ref) {
50962
50950
  var options = _ref.options,
@@ -51157,75 +51145,41 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref) {
51157
51145
  searchable = _ref$searchable === void 0 ? true : _ref$searchable,
51158
51146
  themeValues = _ref.themeValues,
51159
51147
  _ref$truncateBtnTextW = _ref.truncateBtnTextWidth,
51160
- truncateBtnTextWidth = _ref$truncateBtnTextW === void 0 ? "15rem" : _ref$truncateBtnTextW,
51161
- activeAppliedOptions = _ref.activeAppliedOptions;
51162
- // State to manage whether the dropdown is open or closed
51148
+ truncateBtnTextWidth = _ref$truncateBtnTextW === void 0 ? "15rem" : _ref$truncateBtnTextW;
51163
51149
  var _useState = React.useState(false),
51164
51150
  _useState2 = _slicedToArray(_useState, 2),
51165
51151
  opened = _useState2[0],
51166
51152
  setOpened = _useState2[1];
51167
-
51168
- // State to manage the currently selected options
51169
51153
  var _useState3 = React.useState([]),
51170
51154
  _useState4 = _slicedToArray(_useState3, 2),
51171
51155
  selectedOptions = _useState4[0],
51172
51156
  setSelectedOptions = _useState4[1];
51173
-
51174
- // State to manage the applied options, initialized with activeAppliedOptions or an empty array
51175
- var _useState5 = React.useState(activeAppliedOptions || []),
51157
+ var _useState5 = React.useState([]),
51176
51158
  _useState6 = _slicedToArray(_useState5, 2),
51177
51159
  appliedOptions = _useState6[0],
51178
51160
  setAppliedOptions = _useState6[1];
51179
-
51180
- // State to track whether the user has interacted with the component
51181
- var _useState7 = React.useState(false),
51182
- _useState8 = _slicedToArray(_useState7, 2),
51183
- hasInteracted = _useState8[0],
51184
- setHasInteracted = _useState8[1];
51185
-
51186
- // Reference to keep track of the opened state across renders without causing re-renders
51187
51161
  var openedRef = React.useRef(opened);
51188
-
51189
- // Hook to detect clicks outside the component and close the dropdown
51162
+ var handleOnClose = function handleOnClose() {
51163
+ if (openedRef.current) {
51164
+ setOpened(false);
51165
+ actions.fields.searchTerm.set("");
51166
+ }
51167
+ };
51190
51168
  var containerRef = useOutsideClickHook(function () {
51191
51169
  return handleOnClose();
51192
51170
  });
51193
-
51194
- // References to various elements within the component
51195
51171
  var dropdownRef = React.useRef(null);
51196
51172
  var filterButtonRef = React.useRef(null);
51197
51173
  var applyFilterButtonRef = React.useRef(null);
51198
-
51199
- // IDs for accessibility and identification purposes
51200
51174
  var filterDropdownID = "".concat(name, "-filter-dropdown");
51201
51175
  var listGroupID = "".concat(name, "-list-group");
51202
- var handleOnClose = function handleOnClose() {
51203
- if (openedRef.current) {
51204
- setOpened(false);
51205
- actions.fields.searchTerm.set("");
51206
- }
51207
- };
51208
51176
  React.useEffect(function () {
51209
51177
  openedRef.current = opened;
51210
51178
  if (!opened) {
51211
- if (hasInteracted) {
51212
- onApply(selectedOptions);
51213
- setAppliedOptions(selectedOptions);
51214
- }
51215
- } else {
51216
- setHasInteracted(true);
51179
+ onApply(selectedOptions);
51180
+ setAppliedOptions(selectedOptions);
51217
51181
  }
51218
51182
  }, [opened]);
51219
- React.useEffect(function () {
51220
- // Update the applied options state with the current active applied options,
51221
- // or an empty array if activeAppliedOptions is undefined or null.
51222
- // This ensures that the current applied options are in sync with the parent component.
51223
- setAppliedOptions(activeAppliedOptions || []);
51224
-
51225
- // Merge the selected options with the active applied options.
51226
- var mergedSelections = mergeOptions(selectedOptions, activeAppliedOptions);
51227
- setSelectedOptions(mergedSelections);
51228
- }, [activeAppliedOptions]);
51229
51183
  React.useEffect(function () {
51230
51184
  var handleKeyDown = function handleKeyDown(event) {
51231
51185
  if (event.key === "Escape") {
@@ -51267,8 +51221,7 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref) {
51267
51221
  truncateBtnTextWidth: truncateBtnTextWidth,
51268
51222
  filterLabel: filterLabel,
51269
51223
  selectedOptions: selectedOptions,
51270
- extraStyles: btnExtraStyles,
51271
- dataAppliedOptions: appliedOptions === null || appliedOptions === void 0 ? void 0 : appliedOptions.length
51224
+ extraStyles: btnExtraStyles
51272
51225
  }), /*#__PURE__*/React__default.createElement(FilterDropdown, {
51273
51226
  id: filterDropdownID,
51274
51227
  ref: dropdownRef,