@alma/widgets 2.8.3 → 2.10.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.
@@ -2943,11 +2943,12 @@ var useButtonAnimation = function useButtonAnimation(iterateValues, transitionDe
2943
2943
  setUpdate = _useState2[1];
2944
2944
 
2945
2945
  useEffect(function () {
2946
+ var timeout;
2946
2947
  var isMounted = true;
2947
2948
 
2948
2949
  if (iterateValues.length !== 0) {
2949
2950
  if (!iterateValues.includes(current) && update) setCurrent(iterateValues[0]);
2950
- setTimeout(function () {
2951
+ timeout = setTimeout(function () {
2951
2952
  if (update && isMounted) {
2952
2953
  setCurrent(iterateValues[iterateValues.includes(current) ? (iterateValues.indexOf(current) + 1) % iterateValues.length : 0]);
2953
2954
  }
@@ -2956,6 +2957,7 @@ var useButtonAnimation = function useButtonAnimation(iterateValues, transitionDe
2956
2957
 
2957
2958
  return function () {
2958
2959
  isMounted = false;
2960
+ clearTimeout(timeout);
2959
2961
  };
2960
2962
  }, [iterateValues, current]);
2961
2963
  return {
@@ -3022,7 +3024,7 @@ var STATIC_CUSTOMISATION_CLASSES$1 = {
3022
3024
  activeOption: prefix$1 + '-active-option'
3023
3025
  };
3024
3026
 
3025
- var s$c = {"widgetButton":"_TSkFv","logo":"_LJ4nZ","primaryContainer":"_bMClc","paymentPlans":"_17c_S","plan":"_2Kqjn","active":"_3dG_J","polychrome":"_2icEF","notEligible":"_3O1bg","info":"_25GrF","loader":"_30j1O","error":"_R0YlN","errorText":"_2kGhu","errorButton":"_73d_Y","pending":"_1ZDMS","clickable":"_UksZa","unClickable":"_1lr-q"};
3027
+ var s$c = {"widgetButton":"_TSkFv","logo":"_LJ4nZ","primaryContainer":"_bMClc","paymentPlans":"_17c_S","plan":"_2Kqjn","active":"_3dG_J","polychrome":"_2icEF","notEligible":"_3O1bg","hideBorder":"_3_qcn","info":"_25GrF","loader":"_30j1O","error":"_R0YlN","errorText":"_2kGhu","errorButton":"_73d_Y","pending":"_1ZDMS","clickable":"_UksZa","unClickable":"_1lr-q"};
3026
3028
 
3027
3029
  var VERY_LONG_TIME_IN_MS = 1000 * 3600 * 24 * 365;
3028
3030
  var DEFAULT_TRANSITION_TIME = 5500;
@@ -3037,7 +3039,9 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
3037
3039
  purchaseAmount = _ref.purchaseAmount,
3038
3040
  suggestedPaymentPlan = _ref.suggestedPaymentPlan,
3039
3041
  cards = _ref.cards,
3040
- transitionDelay = _ref.transitionDelay;
3042
+ transitionDelay = _ref.transitionDelay,
3043
+ _ref$hideBorder = _ref.hideBorder,
3044
+ hideBorder = _ref$hideBorder === void 0 ? false : _ref$hideBorder;
3041
3045
 
3042
3046
  var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans),
3043
3047
  eligibilityPlans = _useFetchEligibility[0],
@@ -3135,7 +3139,7 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
3135
3139
 
3136
3140
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
3137
3141
  onClick: handleOpenModal,
3138
- className: cx(s$c.widgetButton, (_cx = {}, _cx[s$c.clickable] = eligiblePlans.length > 0, _cx[s$c.unClickable] = eligiblePlans.length === 0, _cx), STATIC_CUSTOMISATION_CLASSES$1.container),
3142
+ className: cx(s$c.widgetButton, (_cx = {}, _cx[s$c.clickable] = eligiblePlans.length > 0, _cx[s$c.unClickable] = eligiblePlans.length === 0, _cx[s$c.hideBorder] = hideBorder, _cx), STATIC_CUSTOMISATION_CLASSES$1.container),
3139
3143
  "data-testid": "widget-button"
3140
3144
  }, /*#__PURE__*/React.createElement("div", {
3141
3145
  className: cx(s$c.primaryContainer, STATIC_CUSTOMISATION_CLASSES$1.eligibilityLine)
@@ -3153,7 +3157,11 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
3153
3157
  onMouseEnter: function onMouseEnter() {
3154
3158
  return onHover(key);
3155
3159
  },
3160
+ onTouchStart: function onTouchStart() {
3161
+ return onHover(key);
3162
+ },
3156
3163
  onMouseOut: onLeave,
3164
+ onTouchEnd: onLeave,
3157
3165
  className: cx(s$c.plan, (_cx2 = {}, _cx2[cx(s$c.active, STATIC_CUSTOMISATION_CLASSES$1.activeOption)] = isCurrent, _cx2[s$c.polychrome] = !monochrome && isCurrent, _cx2[cx(s$c.notEligible, STATIC_CUSTOMISATION_CLASSES$1.notEligibleOption)] = !eligibilityPlan.eligible, _cx2))
3158
3166
  }, paymentPlanShorthandName(eligibilityPlan));
3159
3167
  }))), /*#__PURE__*/React.createElement("div", {
@@ -3189,6 +3197,8 @@ var WidgetsController = /*#__PURE__*/function () {
3189
3197
  plans = options.plans,
3190
3198
  transitionDelay = options.transitionDelay,
3191
3199
  hideIfNotEligible = options.hideIfNotEligible,
3200
+ _options$hideBorder = options.hideBorder,
3201
+ hideBorder = _options$hideBorder === void 0 ? false : _options$hideBorder,
3192
3202
  _options$monochrome = options.monochrome,
3193
3203
  monochrome = _options$monochrome === void 0 ? true : _options$monochrome,
3194
3204
  suggestedPaymentPlan = options.suggestedPaymentPlan,
@@ -3207,7 +3217,8 @@ var WidgetsController = /*#__PURE__*/function () {
3207
3217
  purchaseAmount: purchaseAmount,
3208
3218
  suggestedPaymentPlan: suggestedPaymentPlan,
3209
3219
  cards: cards,
3210
- transitionDelay: transitionDelay
3220
+ transitionDelay: transitionDelay,
3221
+ hideBorder: hideBorder
3211
3222
  })), document.querySelector(container));
3212
3223
  }
3213
3224
  }