@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.
@@ -2855,11 +2855,12 @@ const useButtonAnimation = (iterateValues, transitionDelay) => {
2855
2855
  const [current, setCurrent] = useState(0);
2856
2856
  const [update, setUpdate] = useState(true);
2857
2857
  useEffect(() => {
2858
+ let timeout;
2858
2859
  let isMounted = true;
2859
2860
 
2860
2861
  if (iterateValues.length !== 0) {
2861
2862
  if (!iterateValues.includes(current) && update) setCurrent(iterateValues[0]);
2862
- setTimeout(() => {
2863
+ timeout = setTimeout(() => {
2863
2864
  if (update && isMounted) {
2864
2865
  setCurrent(iterateValues[iterateValues.includes(current) ? (iterateValues.indexOf(current) + 1) % iterateValues.length : 0]);
2865
2866
  }
@@ -2868,6 +2869,7 @@ const useButtonAnimation = (iterateValues, transitionDelay) => {
2868
2869
 
2869
2870
  return () => {
2870
2871
  isMounted = false;
2872
+ clearTimeout(timeout);
2871
2873
  };
2872
2874
  }, [iterateValues, current]);
2873
2875
  return {
@@ -2927,7 +2929,7 @@ const STATIC_CUSTOMISATION_CLASSES$1 = {
2927
2929
  activeOption: prefix$1 + '-active-option'
2928
2930
  };
2929
2931
 
2930
- 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"};
2932
+ 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"};
2931
2933
 
2932
2934
  const VERY_LONG_TIME_IN_MS = 1000 * 3600 * 24 * 365;
2933
2935
  const DEFAULT_TRANSITION_TIME = 5500;
@@ -2940,7 +2942,8 @@ const PaymentPlanWidget = ({
2940
2942
  purchaseAmount,
2941
2943
  suggestedPaymentPlan,
2942
2944
  cards,
2943
- transitionDelay
2945
+ transitionDelay,
2946
+ hideBorder: _hideBorder = false
2944
2947
  }) => {
2945
2948
  const [eligibilityPlans, status] = useFetchEligibility(purchaseAmount, apiData, configPlans);
2946
2949
  const eligiblePlans = eligibilityPlans.filter(plan => plan.eligible);
@@ -3025,7 +3028,8 @@ const PaymentPlanWidget = ({
3025
3028
  onClick: handleOpenModal,
3026
3029
  className: cx(s$c.widgetButton, {
3027
3030
  [s$c.clickable]: eligiblePlans.length > 0,
3028
- [s$c.unClickable]: eligiblePlans.length === 0
3031
+ [s$c.unClickable]: eligiblePlans.length === 0,
3032
+ [s$c.hideBorder]: _hideBorder
3029
3033
  }, STATIC_CUSTOMISATION_CLASSES$1.container),
3030
3034
  "data-testid": "widget-button"
3031
3035
  }, /*#__PURE__*/React.createElement("div", {
@@ -3040,7 +3044,9 @@ const PaymentPlanWidget = ({
3040
3044
  return /*#__PURE__*/React.createElement("div", {
3041
3045
  key: key,
3042
3046
  onMouseEnter: () => onHover(key),
3047
+ onTouchStart: () => onHover(key),
3043
3048
  onMouseOut: onLeave,
3049
+ onTouchEnd: onLeave,
3044
3050
  className: cx(s$c.plan, {
3045
3051
  [cx(s$c.active, STATIC_CUSTOMISATION_CLASSES$1.activeOption)]: isCurrent,
3046
3052
  [s$c.polychrome]: !monochrome && isCurrent,
@@ -3079,6 +3085,7 @@ class WidgetsController {
3079
3085
  plans,
3080
3086
  transitionDelay,
3081
3087
  hideIfNotEligible,
3088
+ hideBorder = false,
3082
3089
  monochrome = true,
3083
3090
  suggestedPaymentPlan,
3084
3091
  locale = Locale.en,
@@ -3096,7 +3103,8 @@ class WidgetsController {
3096
3103
  purchaseAmount: purchaseAmount,
3097
3104
  suggestedPaymentPlan: suggestedPaymentPlan,
3098
3105
  cards: cards,
3099
- transitionDelay: transitionDelay
3106
+ transitionDelay: transitionDelay,
3107
+ hideBorder: hideBorder
3100
3108
  })), document.querySelector(container));
3101
3109
  }
3102
3110
  }