@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.cjs.js CHANGED
@@ -6318,6 +6318,14 @@ var throttle = function throttle(delay, fn) {
6318
6318
  return fn.apply(void 0, arguments);
6319
6319
  };
6320
6320
  };
6321
+ var titleCaseWord = function titleCaseWord(word) {
6322
+ return word.charAt(0).toUpperCase() + word.slice(1);
6323
+ };
6324
+ var titleCaseString = function titleCaseString(string) {
6325
+ return string.split(" ").map(function (word, index, string) {
6326
+ return index === 0 || index === string.length - 1 || word.length > 3 ? titleCaseWord(word.toLowerCase()) : word;
6327
+ }).join(" ");
6328
+ };
6321
6329
 
6322
6330
  var general = /*#__PURE__*/Object.freeze({
6323
6331
  __proto__: null,
@@ -6335,7 +6343,9 @@ var general = /*#__PURE__*/Object.freeze({
6335
6343
  inputPlaceholderTextStyle: inputPlaceholderTextStyle,
6336
6344
  inputDisabledStyle: inputDisabledStyle,
6337
6345
  MOBILE_WIDTH: MOBILE_WIDTH,
6338
- throttle: throttle
6346
+ throttle: throttle,
6347
+ titleCaseWord: titleCaseWord,
6348
+ titleCaseString: titleCaseString
6339
6349
  });
6340
6350
 
6341
6351
  var _excluded$1 = ["themeValues", "weight", "color", "textWrap", "extraStyles", "hoverStyles", "onClick", "onKeyPress", "as", "dataQa", "children", "variant"];
@@ -17145,12 +17155,14 @@ function _extends$1() {
17145
17155
  _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
17146
17156
  for (var i = 1; i < arguments.length; i++) {
17147
17157
  var source = arguments[i];
17158
+
17148
17159
  for (var key in source) {
17149
17160
  if (Object.prototype.hasOwnProperty.call(source, key)) {
17150
17161
  target[key] = source[key];
17151
17162
  }
17152
17163
  }
17153
17164
  }
17165
+
17154
17166
  return target;
17155
17167
  };
17156
17168
  return _extends$1.apply(this, arguments);
@@ -17160,6 +17172,7 @@ function _assertThisInitialized(self) {
17160
17172
  if (self === void 0) {
17161
17173
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17162
17174
  }
17175
+
17163
17176
  return self;
17164
17177
  }
17165
17178
 
@@ -17192,6 +17205,7 @@ function _isNativeReflectConstruct() {
17192
17205
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
17193
17206
  if (Reflect.construct.sham) return false;
17194
17207
  if (typeof Proxy === "function") return true;
17208
+
17195
17209
  try {
17196
17210
  Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
17197
17211
  return true;
@@ -17213,23 +17227,30 @@ function _construct(Parent, args, Class) {
17213
17227
  return instance;
17214
17228
  };
17215
17229
  }
17230
+
17216
17231
  return _construct.apply(null, arguments);
17217
17232
  }
17218
17233
 
17219
17234
  function _wrapNativeSuper(Class) {
17220
17235
  var _cache = typeof Map === "function" ? new Map() : undefined;
17236
+
17221
17237
  _wrapNativeSuper = function _wrapNativeSuper(Class) {
17222
17238
  if (Class === null || !_isNativeFunction(Class)) return Class;
17239
+
17223
17240
  if (typeof Class !== "function") {
17224
17241
  throw new TypeError("Super expression must either be null or a function");
17225
17242
  }
17243
+
17226
17244
  if (typeof _cache !== "undefined") {
17227
17245
  if (_cache.has(Class)) return _cache.get(Class);
17246
+
17228
17247
  _cache.set(Class, Wrapper);
17229
17248
  }
17249
+
17230
17250
  function Wrapper() {
17231
17251
  return _construct(Class, arguments, _getPrototypeOf(this).constructor);
17232
17252
  }
17253
+
17233
17254
  Wrapper.prototype = Object.create(Class.prototype, {
17234
17255
  constructor: {
17235
17256
  value: Wrapper,
@@ -17240,6 +17261,7 @@ function _wrapNativeSuper(Class) {
17240
17261
  });
17241
17262
  return _setPrototypeOf(Wrapper, Class);
17242
17263
  };
17264
+
17243
17265
  return _wrapNativeSuper(Class);
17244
17266
  }
17245
17267
 
@@ -44624,6 +44646,10 @@ var NavMenuMobile = function NavMenuMobile(_ref) {
44624
44646
 
44625
44647
  var NavMenuMobile$1 = themeComponent(NavMenuMobile, "NavMenu", fallbackValues$E, "profile");
44626
44648
 
44649
+ var ACH_METHOD = "BANK_ACCOUNT";
44650
+ var CC_METHOD = "CREDIT_CARD";
44651
+ var CASH_METHOD = "CASH";
44652
+
44627
44653
  var IconsModule = function IconsModule(_ref) {
44628
44654
  var icon = _ref.icon,
44629
44655
  iconDefault = _ref.iconDefault,
@@ -44703,13 +44729,27 @@ var AutopayModal = function AutopayModal(_ref) {
44703
44729
  isPaymentPlan = _ref.isPaymentPlan,
44704
44730
  nextAutopayDate = _ref.nextAutopayDate,
44705
44731
  dueDate = _ref.dueDate,
44706
- inactive = _ref.inactive;
44707
- var planType = isPaymentPlan ? "Payment Plan" : "Autopay";
44732
+ inactive = _ref.inactive,
44733
+ description = _ref.description,
44734
+ subDescription = _ref.subDescription,
44735
+ allowedPaymentInstruments = _ref.allowedPaymentInstruments;
44736
+
44737
+ var generateMethodNeededText = function generateMethodNeededText(planText, allowedPaymentInstruments) {
44738
+ var allowsCard = allowedPaymentInstruments.includes(CC_METHOD);
44739
+ var allowsACH = allowedPaymentInstruments.includes(ACH_METHOD);
44740
+ var methodRequired = allowsCard && !allowsACH ? "debit or credit card payment method" : !allowsCard && allowsACH ? "checking account payment method" : "payment method";
44741
+ return "To setup ".concat(planText, " you must have a saved ").concat(methodRequired, " and address in your profile. Do you want to save these now?");
44742
+ };
44743
+
44744
+ var plan = isPaymentPlan ? "your payment plan" : "autopay";
44745
+ var shortPlan = isPaymentPlan ? "Payment Plan" : "Autopay";
44746
+ var deactivateText = "deactivate ".concat(shortPlan, " for ").concat(description, ": ").concat(subDescription);
44747
+ var activateText = "Set Up ".concat(shortPlan, " for ").concat(description, ": ").concat(subDescription);
44708
44748
  var nextDate = dueDate || nextAutopayDate;
44709
44749
  var modalExtraProps = {
44710
- modalHeaderText: autoPayActive ? "Deactivate ".concat(planType) : "Set Up ".concat(planType),
44711
- 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?"),
44712
- continueButtonText: autoPayActive ? "Disable ".concat(planType) : "Add to Profile",
44750
+ modalHeaderText: autoPayActive ? titleCaseString(deactivateText) : titleCaseString(activateText),
44751
+ 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),
44752
+ continueButtonText: autoPayActive ? "Disable ".concat(shortPlan) : "Add to Profile",
44713
44753
  useDangerButton: autoPayActive,
44714
44754
  continueAction: autoPayActive ? function () {
44715
44755
  deactivatePaymentSchedule(isPaymentPlan ? paymentPlanSchedule : autoPaySchedule, isPaymentPlan);
@@ -44725,7 +44765,7 @@ var AutopayModal = function AutopayModal(_ref) {
44725
44765
  case "secondary":
44726
44766
  {
44727
44767
  return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
44728
- text: autoPayActive ? "Turn off ".concat(planType) : "Set Up ".concat(planType),
44768
+ text: autoPayActive ? "Turn off ".concat(shortPlan) : "Set Up ".concat(shortPlan),
44729
44769
  variant: "secondary",
44730
44770
  action: function action() {
44731
44771
  toggleModal(true);
@@ -44738,7 +44778,7 @@ var AutopayModal = function AutopayModal(_ref) {
44738
44778
  case "tertiary":
44739
44779
  {
44740
44780
  return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
44741
- text: autoPayActive ? "Manage ".concat(planType) : "Set Up ".concat(planType),
44781
+ text: autoPayActive ? "Manage ".concat(shortPlan) : "Set Up ".concat(shortPlan),
44742
44782
  variant: "tertiary",
44743
44783
  action: function action() {
44744
44784
  toggleModal(true);
@@ -44770,12 +44810,12 @@ var AutopayModal = function AutopayModal(_ref) {
44770
44810
  e.key === "Enter" && toggleModal(true);
44771
44811
  },
44772
44812
  tabIndex: "0",
44773
- dataQa: "".concat(planType, " On"),
44813
+ dataQa: "".concat(shortPlan, " On"),
44774
44814
  color: SEA_GREEN,
44775
44815
  weight: themeValues.fontWeight,
44776
44816
  hoverStyles: themeValues.modalLinkHoverFocus,
44777
44817
  extraStyles: "padding-left: 0.25rem;"
44778
- }, "".concat(planType, " ").concat(nextAutopayDate))));
44818
+ }, "".concat(shortPlan, " ").concat(nextAutopayDate))));
44779
44819
  }
44780
44820
  }
44781
44821
  };
@@ -44802,7 +44842,10 @@ var AmountModule = function AmountModule(_ref) {
44802
44842
  autoPaySchedule = _ref.autoPaySchedule,
44803
44843
  paymentPlanSchedule = _ref.paymentPlanSchedule,
44804
44844
  isPaymentPlan = _ref.isPaymentPlan,
44805
- nextAutopayDate = _ref.nextAutopayDate;
44845
+ nextAutopayDate = _ref.nextAutopayDate,
44846
+ description = _ref.description,
44847
+ subDescription = _ref.subDescription,
44848
+ allowedPaymentInstruments = _ref.allowedPaymentInstruments;
44806
44849
 
44807
44850
  var _useState = React.useState(false),
44808
44851
  _useState2 = _slicedToArray(_useState, 2),
@@ -44831,7 +44874,10 @@ var AmountModule = function AmountModule(_ref) {
44831
44874
  paymentPlanSchedule: paymentPlanSchedule,
44832
44875
  isPaymentPlan: isPaymentPlan,
44833
44876
  nextAutopayDate: nextAutopayDate,
44834
- controlType: "link"
44877
+ controlType: "link",
44878
+ description: description,
44879
+ subDescription: subDescription,
44880
+ allowedPaymentInstruments: allowedPaymentInstruments
44835
44881
  })));
44836
44882
  };
44837
44883
 
@@ -44850,7 +44896,10 @@ var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
44850
44896
  isPaymentPlan = _ref.isPaymentPlan,
44851
44897
  nextAutopayDate = _ref.nextAutopayDate,
44852
44898
  obligationAssocID = _ref.obligationAssocID,
44853
- dueDate = _ref.dueDate;
44899
+ dueDate = _ref.dueDate,
44900
+ description = _ref.description,
44901
+ subDescription = _ref.subDescription,
44902
+ allowedPaymentInstruments = _ref.allowedPaymentInstruments;
44854
44903
  var planType = isPaymentPlan ? "Payment Plan" : "Autopay";
44855
44904
 
44856
44905
  var _useState = React.useState(false),
@@ -44906,7 +44955,10 @@ var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
44906
44955
  autoPaySchedule: autoPaySchedule,
44907
44956
  paymentPlanSchedule: paymentPlanSchedule,
44908
44957
  isPaymentPlan: isPaymentPlan,
44909
- nextAutopayDate: nextAutopayDate
44958
+ nextAutopayDate: nextAutopayDate,
44959
+ description: description,
44960
+ subDescription: subDescription,
44961
+ allowedPaymentInstruments: allowedPaymentInstruments
44910
44962
  }))), /*#__PURE__*/React__default.createElement(Box, {
44911
44963
  padding: isMobile ? "16px" : "0"
44912
44964
  }, /*#__PURE__*/React__default.createElement(Cluster, {
@@ -44946,7 +44998,10 @@ var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
44946
44998
  paymentPlanSchedule: paymentPlanSchedule,
44947
44999
  isPaymentPlan: isPaymentPlan,
44948
45000
  nextAutopayDate: nextAutopayDate,
44949
- dueDate: dueDate
45001
+ dueDate: dueDate,
45002
+ description: description,
45003
+ subDescription: subDescription,
45004
+ allowedPaymentInstruments: allowedPaymentInstruments
44950
45005
  })), !isMobile && /*#__PURE__*/React__default.createElement(Box, {
44951
45006
  padding: "0"
44952
45007
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
@@ -45036,7 +45091,10 @@ var InactiveControlsModule = function InactiveControlsModule(_ref) {
45036
45091
  dueDate = _ref.dueDate,
45037
45092
  agencyName = _ref.agencyName,
45038
45093
  configType = _ref.configType,
45039
- actions = _ref.actions;
45094
+ actions = _ref.actions,
45095
+ description = _ref.description,
45096
+ subDescription = _ref.subDescription,
45097
+ allowedPaymentInstruments = _ref.allowedPaymentInstruments;
45040
45098
 
45041
45099
  var _useState = React.useState(false),
45042
45100
  _useState2 = _slicedToArray(_useState, 2),
@@ -45075,7 +45133,10 @@ var InactiveControlsModule = function InactiveControlsModule(_ref) {
45075
45133
  obligationAssocID: obligationAssocID,
45076
45134
  dueDate: dueDate,
45077
45135
  controlType: "secondary",
45078
- inactive: true
45136
+ inactive: true,
45137
+ description: description,
45138
+ subDescription: subDescription,
45139
+ allowedPaymentInstruments: allowedPaymentInstruments
45079
45140
  })), /*#__PURE__*/React__default.createElement(Box, {
45080
45141
  padding: "0",
45081
45142
  extraStyles: "flex-grow: 1;"
@@ -45117,7 +45178,7 @@ var InactiveTitleModule = function InactiveTitleModule(_ref) {
45117
45178
  };
45118
45179
 
45119
45180
  var Obligation = function Obligation(_ref) {
45120
- var _firstObligation$cust, _firstObligation$desc, _firstObligation$subD;
45181
+ var _obligations$, _firstObligation$cust;
45121
45182
 
45122
45183
  var config = _ref.config,
45123
45184
  obligations = _ref.obligations,
@@ -45152,7 +45213,13 @@ var Obligation = function Obligation(_ref) {
45152
45213
  The top level desc/subdesc for all obligations in a collection is the same
45153
45214
  (Collection accounts look different in the Account Details page)
45154
45215
  */
45155
- var firstObligation = obligations[0];
45216
+ var firstObligation = (_obligations$ = obligations === null || obligations === void 0 ? void 0 : obligations[0]) !== null && _obligations$ !== void 0 ? _obligations$ : {};
45217
+ var _firstObligation$allo = firstObligation.allowedPaymentInstruments,
45218
+ allowedPaymentInstruments = _firstObligation$allo === void 0 ? [CASH_METHOD, CC_METHOD, ACH_METHOD] : _firstObligation$allo,
45219
+ _firstObligation$desc = firstObligation.description,
45220
+ description = _firstObligation$desc === void 0 ? "Account" : _firstObligation$desc,
45221
+ _firstObligation$subD = firstObligation.subDescription,
45222
+ subDescription = _firstObligation$subD === void 0 ? obligationAssocID : _firstObligation$subD;
45156
45223
  var customAttributes = (_firstObligation$cust = firstObligation === null || firstObligation === void 0 ? void 0 : firstObligation.customAttributes) !== null && _firstObligation$cust !== void 0 ? _firstObligation$cust : {};
45157
45224
  var boxShadowValue = "0px 2px 4px rgba(41, 42, 51, 0.1), 0px 1px 1px 2px rgba(41, 42, 51, 0.1);";
45158
45225
  var activeObligation = /*#__PURE__*/React__default.createElement(Box, {
@@ -45160,7 +45227,7 @@ var Obligation = function Obligation(_ref) {
45160
45227
  borderRadius: "4px",
45161
45228
  boxShadow: boxShadowValue,
45162
45229
  as: "section",
45163
- "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),
45230
+ "aria-label": "".concat(description, " - ").concat(subDescription),
45164
45231
  border: "1px solid ".concat(GRECIAN_GREY),
45165
45232
  borderWidthOverride: "1px 0 0 0"
45166
45233
  }, /*#__PURE__*/React__default.createElement(Box, {
@@ -45189,8 +45256,8 @@ var Obligation = function Obligation(_ref) {
45189
45256
  iconValue: config.iconValue,
45190
45257
  customAttributes: customAttributes
45191
45258
  }), /*#__PURE__*/React__default.createElement(TitleModule, {
45192
- title: firstObligation === null || firstObligation === void 0 ? void 0 : firstObligation.description,
45193
- subtitle: firstObligation === null || firstObligation === void 0 ? void 0 : firstObligation.subDescription,
45259
+ title: description,
45260
+ subtitle: subDescription,
45194
45261
  titleColor: BRIGHT_GREY,
45195
45262
  isMobile: isMobile
45196
45263
  }))), !isMobile && /*#__PURE__*/React__default.createElement(AmountModule, {
@@ -45204,7 +45271,10 @@ var Obligation = function Obligation(_ref) {
45204
45271
  autoPaySchedule: autoPaySchedule,
45205
45272
  paymentPlanSchedule: paymentPlanSchedule,
45206
45273
  isPaymentPlan: isPaymentPlan,
45207
- nextAutopayDate: nextAutopayDate
45274
+ nextAutopayDate: nextAutopayDate,
45275
+ description: description,
45276
+ subDescription: subDescription,
45277
+ allowedPaymentInstruments: allowedPaymentInstruments
45208
45278
  }))), !isMobile && /*#__PURE__*/React__default.createElement(PaymentDetailsActions, {
45209
45279
  obligations: obligations,
45210
45280
  autoPayEnabled: autoPayEnabled,
@@ -45219,7 +45289,10 @@ var Obligation = function Obligation(_ref) {
45219
45289
  isMobile: isMobile,
45220
45290
  isPaymentPlan: isPaymentPlan,
45221
45291
  nextAutopayDate: nextAutopayDate,
45222
- obligationAssocID: obligationAssocID
45292
+ obligationAssocID: obligationAssocID,
45293
+ description: description,
45294
+ subDescription: subDescription,
45295
+ allowedPaymentInstruments: allowedPaymentInstruments
45223
45296
  }))), isMobile && /*#__PURE__*/React__default.createElement(PaymentDetailsActions, {
45224
45297
  obligations: obligations,
45225
45298
  autoPayEnabled: autoPayEnabled,
@@ -45234,7 +45307,10 @@ var Obligation = function Obligation(_ref) {
45234
45307
  isMobile: isMobile,
45235
45308
  isPaymentPlan: isPaymentPlan,
45236
45309
  nextAutopayDate: nextAutopayDate,
45237
- obligationAssocID: obligationAssocID
45310
+ obligationAssocID: obligationAssocID,
45311
+ description: description,
45312
+ subDescription: subDescription,
45313
+ allowedPaymentInstruments: allowedPaymentInstruments
45238
45314
  }));
45239
45315
  var inactiveObligation = /*#__PURE__*/React__default.createElement(Box, {
45240
45316
  padding: "0",
@@ -45287,7 +45363,10 @@ var Obligation = function Obligation(_ref) {
45287
45363
  obligationAssocID: obligationAssocID,
45288
45364
  dueDate: dueDate,
45289
45365
  agencyName: agencyName,
45290
- configType: config.type
45366
+ configType: config.type,
45367
+ description: description,
45368
+ subDescription: subDescription,
45369
+ allowedPaymentInstruments: allowedPaymentInstruments
45291
45370
  }))), isMobile && /*#__PURE__*/React__default.createElement(InactiveControlsModule, {
45292
45371
  obligations: obligations,
45293
45372
  autoPayEnabled: autoPayEnabled,
@@ -45301,7 +45380,10 @@ var Obligation = function Obligation(_ref) {
45301
45380
  obligationAssocID: obligationAssocID,
45302
45381
  dueDate: dueDate,
45303
45382
  agencyName: agencyName,
45304
- configType: config.type
45383
+ configType: config.type,
45384
+ description: description,
45385
+ subDescription: subDescription,
45386
+ allowedPaymentInstruments: allowedPaymentInstruments
45305
45387
  }))));
45306
45388
  return inactive ? inactiveObligation : activeObligation;
45307
45389
  };