@thecb/components 7.6.0 → 7.6.1-beta.1

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.esm.js CHANGED
@@ -6310,6 +6310,14 @@ var throttle = function throttle(delay, fn) {
6310
6310
  return fn.apply(void 0, arguments);
6311
6311
  };
6312
6312
  };
6313
+ var titleCaseWord = function titleCaseWord(word) {
6314
+ return word.charAt(0).toUpperCase() + word.slice(1);
6315
+ };
6316
+ var titleCaseString = function titleCaseString(string) {
6317
+ return string.split(" ").map(function (word, index, string) {
6318
+ return index === 0 || index === string.length - 1 || word.length > 3 ? titleCaseWord(word.toLowerCase()) : word;
6319
+ }).join(" ");
6320
+ };
6313
6321
 
6314
6322
  var general = /*#__PURE__*/Object.freeze({
6315
6323
  __proto__: null,
@@ -6327,7 +6335,9 @@ var general = /*#__PURE__*/Object.freeze({
6327
6335
  inputPlaceholderTextStyle: inputPlaceholderTextStyle,
6328
6336
  inputDisabledStyle: inputDisabledStyle,
6329
6337
  MOBILE_WIDTH: MOBILE_WIDTH,
6330
- throttle: throttle
6338
+ throttle: throttle,
6339
+ titleCaseWord: titleCaseWord,
6340
+ titleCaseString: titleCaseString
6331
6341
  });
6332
6342
 
6333
6343
  var _excluded$1 = ["themeValues", "weight", "color", "textWrap", "extraStyles", "hoverStyles", "onClick", "onKeyPress", "as", "dataQa", "children", "variant"];
@@ -17137,12 +17147,14 @@ function _extends$1() {
17137
17147
  _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
17138
17148
  for (var i = 1; i < arguments.length; i++) {
17139
17149
  var source = arguments[i];
17150
+
17140
17151
  for (var key in source) {
17141
17152
  if (Object.prototype.hasOwnProperty.call(source, key)) {
17142
17153
  target[key] = source[key];
17143
17154
  }
17144
17155
  }
17145
17156
  }
17157
+
17146
17158
  return target;
17147
17159
  };
17148
17160
  return _extends$1.apply(this, arguments);
@@ -17152,6 +17164,7 @@ function _assertThisInitialized(self) {
17152
17164
  if (self === void 0) {
17153
17165
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17154
17166
  }
17167
+
17155
17168
  return self;
17156
17169
  }
17157
17170
 
@@ -17184,6 +17197,7 @@ function _isNativeReflectConstruct() {
17184
17197
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
17185
17198
  if (Reflect.construct.sham) return false;
17186
17199
  if (typeof Proxy === "function") return true;
17200
+
17187
17201
  try {
17188
17202
  Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
17189
17203
  return true;
@@ -17205,23 +17219,30 @@ function _construct(Parent, args, Class) {
17205
17219
  return instance;
17206
17220
  };
17207
17221
  }
17222
+
17208
17223
  return _construct.apply(null, arguments);
17209
17224
  }
17210
17225
 
17211
17226
  function _wrapNativeSuper(Class) {
17212
17227
  var _cache = typeof Map === "function" ? new Map() : undefined;
17228
+
17213
17229
  _wrapNativeSuper = function _wrapNativeSuper(Class) {
17214
17230
  if (Class === null || !_isNativeFunction(Class)) return Class;
17231
+
17215
17232
  if (typeof Class !== "function") {
17216
17233
  throw new TypeError("Super expression must either be null or a function");
17217
17234
  }
17235
+
17218
17236
  if (typeof _cache !== "undefined") {
17219
17237
  if (_cache.has(Class)) return _cache.get(Class);
17238
+
17220
17239
  _cache.set(Class, Wrapper);
17221
17240
  }
17241
+
17222
17242
  function Wrapper() {
17223
17243
  return _construct(Class, arguments, _getPrototypeOf(this).constructor);
17224
17244
  }
17245
+
17225
17246
  Wrapper.prototype = Object.create(Class.prototype, {
17226
17247
  constructor: {
17227
17248
  value: Wrapper,
@@ -17232,6 +17253,7 @@ function _wrapNativeSuper(Class) {
17232
17253
  });
17233
17254
  return _setPrototypeOf(Wrapper, Class);
17234
17255
  };
17256
+
17235
17257
  return _wrapNativeSuper(Class);
17236
17258
  }
17237
17259
 
@@ -44616,6 +44638,10 @@ var NavMenuMobile = function NavMenuMobile(_ref) {
44616
44638
 
44617
44639
  var NavMenuMobile$1 = themeComponent(NavMenuMobile, "NavMenu", fallbackValues$E, "profile");
44618
44640
 
44641
+ var ACH_METHOD = "BANK_ACCOUNT";
44642
+ var CC_METHOD = "CREDIT_CARD";
44643
+ var CASH_METHOD = "CASH";
44644
+
44619
44645
  var IconsModule = function IconsModule(_ref) {
44620
44646
  var icon = _ref.icon,
44621
44647
  iconDefault = _ref.iconDefault,
@@ -44695,13 +44721,27 @@ var AutopayModal = function AutopayModal(_ref) {
44695
44721
  isPaymentPlan = _ref.isPaymentPlan,
44696
44722
  nextAutopayDate = _ref.nextAutopayDate,
44697
44723
  dueDate = _ref.dueDate,
44698
- inactive = _ref.inactive;
44699
- var planType = isPaymentPlan ? "Payment Plan" : "Autopay";
44724
+ inactive = _ref.inactive,
44725
+ description = _ref.description,
44726
+ subDescription = _ref.subDescription,
44727
+ allowedPaymentInstruments = _ref.allowedPaymentInstruments;
44728
+
44729
+ var generateMethodNeededText = function generateMethodNeededText(planText, allowedPaymentInstruments) {
44730
+ var allowsCard = allowedPaymentInstruments.includes(CC_METHOD);
44731
+ var allowsACH = allowedPaymentInstruments.includes(ACH_METHOD);
44732
+ var methodRequired = allowsCard && !allowsACH ? "debit or credit card payment method" : !allowsCard && allowsACH ? "checking account payment method" : "payment method";
44733
+ return "To setup ".concat(planText, " you must have a saved ").concat(methodRequired, " and address in your profile. Do you want to save these now?");
44734
+ };
44735
+
44736
+ var plan = isPaymentPlan ? "your payment plan" : "autopay";
44737
+ var shortPlan = isPaymentPlan ? "Payment Plan" : "Autopay";
44738
+ var deactivateText = "deactivate ".concat(shortPlan, " for ").concat(description, ": ").concat(subDescription);
44739
+ var activateText = "Set Up ".concat(shortPlan, " for ").concat(description, ": ").concat(subDescription);
44700
44740
  var nextDate = dueDate || nextAutopayDate;
44701
44741
  var modalExtraProps = {
44702
- modalHeaderText: autoPayActive ? "Deactivate ".concat(planType) : "Set Up ".concat(planType),
44703
- modalBodyText: autoPayActive ? "Are you sure you want to deactivate ".concat(isPaymentPlan ? "your payment plan" : "autopay", "? ").concat(!inactive && nextDate ? "Your next payment will be due on ".concat(nextDate, ".") : "") : "To set up ".concat(isPaymentPlan ? "a payment plan" : "autopay", " you must save a payment method and address in your profile. Do you want to save these now?"),
44704
- continueButtonText: autoPayActive ? "Disable ".concat(planType) : "Add to Profile",
44742
+ modalHeaderText: autoPayActive ? titleCaseString(deactivateText) : titleCaseString(activateText),
44743
+ modalBodyText: autoPayActive ? "Are you sure you want to deactivate ".concat(plan, "? ").concat(!inactive && nextDate ? "Your next payment will be due on ".concat(nextDate, ".") : "") : generateMethodNeededText(plan, allowedPaymentInstruments),
44744
+ continueButtonText: autoPayActive ? "Disable ".concat(shortPlan) : "Add to Profile",
44705
44745
  useDangerButton: autoPayActive,
44706
44746
  continueAction: autoPayActive ? function () {
44707
44747
  deactivatePaymentSchedule(isPaymentPlan ? paymentPlanSchedule : autoPaySchedule, isPaymentPlan);
@@ -44717,7 +44757,7 @@ var AutopayModal = function AutopayModal(_ref) {
44717
44757
  case "secondary":
44718
44758
  {
44719
44759
  return /*#__PURE__*/React.createElement(ButtonWithAction, {
44720
- text: autoPayActive ? "Turn off ".concat(planType) : "Set Up ".concat(planType),
44760
+ text: autoPayActive ? "Turn off ".concat(shortPlan) : "Set Up ".concat(shortPlan),
44721
44761
  variant: "secondary",
44722
44762
  action: function action() {
44723
44763
  toggleModal(true);
@@ -44730,7 +44770,7 @@ var AutopayModal = function AutopayModal(_ref) {
44730
44770
  case "tertiary":
44731
44771
  {
44732
44772
  return /*#__PURE__*/React.createElement(ButtonWithAction, {
44733
- text: autoPayActive ? "Manage ".concat(planType) : "Set Up ".concat(planType),
44773
+ text: autoPayActive ? "Manage ".concat(shortPlan) : "Set Up ".concat(shortPlan),
44734
44774
  variant: "tertiary",
44735
44775
  action: function action() {
44736
44776
  toggleModal(true);
@@ -44762,12 +44802,12 @@ var AutopayModal = function AutopayModal(_ref) {
44762
44802
  e.key === "Enter" && toggleModal(true);
44763
44803
  },
44764
44804
  tabIndex: "0",
44765
- dataQa: "".concat(planType, " On"),
44805
+ dataQa: "".concat(shortPlan, " On"),
44766
44806
  color: SEA_GREEN,
44767
44807
  weight: themeValues.fontWeight,
44768
44808
  hoverStyles: themeValues.modalLinkHoverFocus,
44769
44809
  extraStyles: "padding-left: 0.25rem;"
44770
- }, "".concat(planType, " ").concat(nextAutopayDate))));
44810
+ }, "".concat(shortPlan, " ").concat(nextAutopayDate))));
44771
44811
  }
44772
44812
  }
44773
44813
  };
@@ -44794,7 +44834,10 @@ var AmountModule = function AmountModule(_ref) {
44794
44834
  autoPaySchedule = _ref.autoPaySchedule,
44795
44835
  paymentPlanSchedule = _ref.paymentPlanSchedule,
44796
44836
  isPaymentPlan = _ref.isPaymentPlan,
44797
- nextAutopayDate = _ref.nextAutopayDate;
44837
+ nextAutopayDate = _ref.nextAutopayDate,
44838
+ description = _ref.description,
44839
+ subDescription = _ref.subDescription,
44840
+ allowedPaymentInstruments = _ref.allowedPaymentInstruments;
44798
44841
 
44799
44842
  var _useState = useState(false),
44800
44843
  _useState2 = _slicedToArray(_useState, 2),
@@ -44823,7 +44866,10 @@ var AmountModule = function AmountModule(_ref) {
44823
44866
  paymentPlanSchedule: paymentPlanSchedule,
44824
44867
  isPaymentPlan: isPaymentPlan,
44825
44868
  nextAutopayDate: nextAutopayDate,
44826
- controlType: "link"
44869
+ controlType: "link",
44870
+ description: description,
44871
+ subDescription: subDescription,
44872
+ allowedPaymentInstruments: allowedPaymentInstruments
44827
44873
  })));
44828
44874
  };
44829
44875
 
@@ -44842,7 +44888,10 @@ var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
44842
44888
  isPaymentPlan = _ref.isPaymentPlan,
44843
44889
  nextAutopayDate = _ref.nextAutopayDate,
44844
44890
  obligationAssocID = _ref.obligationAssocID,
44845
- dueDate = _ref.dueDate;
44891
+ dueDate = _ref.dueDate,
44892
+ description = _ref.description,
44893
+ subDescription = _ref.subDescription,
44894
+ allowedPaymentInstruments = _ref.allowedPaymentInstruments;
44846
44895
  var planType = isPaymentPlan ? "Payment Plan" : "Autopay";
44847
44896
 
44848
44897
  var _useState = useState(false),
@@ -44898,7 +44947,10 @@ var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
44898
44947
  autoPaySchedule: autoPaySchedule,
44899
44948
  paymentPlanSchedule: paymentPlanSchedule,
44900
44949
  isPaymentPlan: isPaymentPlan,
44901
- nextAutopayDate: nextAutopayDate
44950
+ nextAutopayDate: nextAutopayDate,
44951
+ description: description,
44952
+ subDescription: subDescription,
44953
+ allowedPaymentInstruments: allowedPaymentInstruments
44902
44954
  }))), /*#__PURE__*/React.createElement(Box, {
44903
44955
  padding: isMobile ? "16px" : "0"
44904
44956
  }, /*#__PURE__*/React.createElement(Cluster, {
@@ -44938,7 +44990,10 @@ var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
44938
44990
  paymentPlanSchedule: paymentPlanSchedule,
44939
44991
  isPaymentPlan: isPaymentPlan,
44940
44992
  nextAutopayDate: nextAutopayDate,
44941
- dueDate: dueDate
44993
+ dueDate: dueDate,
44994
+ description: description,
44995
+ subDescription: subDescription,
44996
+ allowedPaymentInstruments: allowedPaymentInstruments
44942
44997
  })), !isMobile && /*#__PURE__*/React.createElement(Box, {
44943
44998
  padding: "0"
44944
44999
  }, /*#__PURE__*/React.createElement(ButtonWithAction, {
@@ -45028,7 +45083,10 @@ var InactiveControlsModule = function InactiveControlsModule(_ref) {
45028
45083
  dueDate = _ref.dueDate,
45029
45084
  agencyName = _ref.agencyName,
45030
45085
  configType = _ref.configType,
45031
- actions = _ref.actions;
45086
+ actions = _ref.actions,
45087
+ description = _ref.description,
45088
+ subDescription = _ref.subDescription,
45089
+ allowedPaymentInstruments = _ref.allowedPaymentInstruments;
45032
45090
 
45033
45091
  var _useState = useState(false),
45034
45092
  _useState2 = _slicedToArray(_useState, 2),
@@ -45067,7 +45125,10 @@ var InactiveControlsModule = function InactiveControlsModule(_ref) {
45067
45125
  obligationAssocID: obligationAssocID,
45068
45126
  dueDate: dueDate,
45069
45127
  controlType: "secondary",
45070
- inactive: true
45128
+ inactive: true,
45129
+ description: description,
45130
+ subDescription: subDescription,
45131
+ allowedPaymentInstruments: allowedPaymentInstruments
45071
45132
  })), /*#__PURE__*/React.createElement(Box, {
45072
45133
  padding: "0",
45073
45134
  extraStyles: "flex-grow: 1;"
@@ -45109,7 +45170,7 @@ var InactiveTitleModule = function InactiveTitleModule(_ref) {
45109
45170
  };
45110
45171
 
45111
45172
  var Obligation = function Obligation(_ref) {
45112
- var _firstObligation$cust, _firstObligation$desc, _firstObligation$subD;
45173
+ var _obligations$, _firstObligation$cust;
45113
45174
 
45114
45175
  var config = _ref.config,
45115
45176
  obligations = _ref.obligations,
@@ -45144,7 +45205,13 @@ var Obligation = function Obligation(_ref) {
45144
45205
  The top level desc/subdesc for all obligations in a collection is the same
45145
45206
  (Collection accounts look different in the Account Details page)
45146
45207
  */
45147
- var firstObligation = obligations[0];
45208
+ var firstObligation = (_obligations$ = obligations === null || obligations === void 0 ? void 0 : obligations[0]) !== null && _obligations$ !== void 0 ? _obligations$ : {};
45209
+ var _firstObligation$allo = firstObligation.allowedPaymentInstruments,
45210
+ allowedPaymentInstruments = _firstObligation$allo === void 0 ? [CASH_METHOD, CC_METHOD, ACH_METHOD] : _firstObligation$allo,
45211
+ _firstObligation$desc = firstObligation.description,
45212
+ description = _firstObligation$desc === void 0 ? "Account" : _firstObligation$desc,
45213
+ _firstObligation$subD = firstObligation.subDescription,
45214
+ subDescription = _firstObligation$subD === void 0 ? obligationAssocID : _firstObligation$subD;
45148
45215
  var customAttributes = (_firstObligation$cust = firstObligation === null || firstObligation === void 0 ? void 0 : firstObligation.customAttributes) !== null && _firstObligation$cust !== void 0 ? _firstObligation$cust : {};
45149
45216
  var boxShadowValue = "0px 2px 4px rgba(41, 42, 51, 0.1), 0px 1px 1px 2px rgba(41, 42, 51, 0.1);";
45150
45217
  var activeObligation = /*#__PURE__*/React.createElement(Box, {
@@ -45152,7 +45219,7 @@ var Obligation = function Obligation(_ref) {
45152
45219
  borderRadius: "4px",
45153
45220
  boxShadow: boxShadowValue,
45154
45221
  as: "section",
45155
- "aria-label": "".concat((_firstObligation$desc = firstObligation === null || firstObligation === void 0 ? void 0 : firstObligation.description) !== null && _firstObligation$desc !== void 0 ? _firstObligation$desc : "account", " ").concat((_firstObligation$subD = firstObligation === null || firstObligation === void 0 ? void 0 : firstObligation.subDescription) !== null && _firstObligation$subD !== void 0 ? _firstObligation$subD : obligationAssocID),
45222
+ "aria-label": "".concat(description, " - ").concat(subDescription),
45156
45223
  border: "1px solid ".concat(GRECIAN_GREY),
45157
45224
  borderWidthOverride: "1px 0 0 0"
45158
45225
  }, /*#__PURE__*/React.createElement(Box, {
@@ -45181,8 +45248,8 @@ var Obligation = function Obligation(_ref) {
45181
45248
  iconValue: config.iconValue,
45182
45249
  customAttributes: customAttributes
45183
45250
  }), /*#__PURE__*/React.createElement(TitleModule, {
45184
- title: firstObligation === null || firstObligation === void 0 ? void 0 : firstObligation.description,
45185
- subtitle: firstObligation === null || firstObligation === void 0 ? void 0 : firstObligation.subDescription,
45251
+ title: description,
45252
+ subtitle: subDescription,
45186
45253
  titleColor: BRIGHT_GREY,
45187
45254
  isMobile: isMobile
45188
45255
  }))), !isMobile && /*#__PURE__*/React.createElement(AmountModule, {
@@ -45196,7 +45263,10 @@ var Obligation = function Obligation(_ref) {
45196
45263
  autoPaySchedule: autoPaySchedule,
45197
45264
  paymentPlanSchedule: paymentPlanSchedule,
45198
45265
  isPaymentPlan: isPaymentPlan,
45199
- nextAutopayDate: nextAutopayDate
45266
+ nextAutopayDate: nextAutopayDate,
45267
+ description: description,
45268
+ subDescription: subDescription,
45269
+ allowedPaymentInstruments: allowedPaymentInstruments
45200
45270
  }))), !isMobile && /*#__PURE__*/React.createElement(PaymentDetailsActions, {
45201
45271
  obligations: obligations,
45202
45272
  autoPayEnabled: autoPayEnabled,
@@ -45211,7 +45281,10 @@ var Obligation = function Obligation(_ref) {
45211
45281
  isMobile: isMobile,
45212
45282
  isPaymentPlan: isPaymentPlan,
45213
45283
  nextAutopayDate: nextAutopayDate,
45214
- obligationAssocID: obligationAssocID
45284
+ obligationAssocID: obligationAssocID,
45285
+ description: description,
45286
+ subDescription: subDescription,
45287
+ allowedPaymentInstruments: allowedPaymentInstruments
45215
45288
  }))), isMobile && /*#__PURE__*/React.createElement(PaymentDetailsActions, {
45216
45289
  obligations: obligations,
45217
45290
  autoPayEnabled: autoPayEnabled,
@@ -45226,7 +45299,10 @@ var Obligation = function Obligation(_ref) {
45226
45299
  isMobile: isMobile,
45227
45300
  isPaymentPlan: isPaymentPlan,
45228
45301
  nextAutopayDate: nextAutopayDate,
45229
- obligationAssocID: obligationAssocID
45302
+ obligationAssocID: obligationAssocID,
45303
+ description: description,
45304
+ subDescription: subDescription,
45305
+ allowedPaymentInstruments: allowedPaymentInstruments
45230
45306
  }));
45231
45307
  var inactiveObligation = /*#__PURE__*/React.createElement(Box, {
45232
45308
  padding: "0",
@@ -45279,7 +45355,10 @@ var Obligation = function Obligation(_ref) {
45279
45355
  obligationAssocID: obligationAssocID,
45280
45356
  dueDate: dueDate,
45281
45357
  agencyName: agencyName,
45282
- configType: config.type
45358
+ configType: config.type,
45359
+ description: description,
45360
+ subDescription: subDescription,
45361
+ allowedPaymentInstruments: allowedPaymentInstruments
45283
45362
  }))), isMobile && /*#__PURE__*/React.createElement(InactiveControlsModule, {
45284
45363
  obligations: obligations,
45285
45364
  autoPayEnabled: autoPayEnabled,
@@ -45293,7 +45372,10 @@ var Obligation = function Obligation(_ref) {
45293
45372
  obligationAssocID: obligationAssocID,
45294
45373
  dueDate: dueDate,
45295
45374
  agencyName: agencyName,
45296
- configType: config.type
45375
+ configType: config.type,
45376
+ description: description,
45377
+ subDescription: subDescription,
45378
+ allowedPaymentInstruments: allowedPaymentInstruments
45297
45379
  }))));
45298
45380
  return inactive ? inactiveObligation : activeObligation;
45299
45381
  };