@alma/widgets 2.7.1 → 2.8.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.
@@ -2691,12 +2691,21 @@ var Info = function Info() {
2691
2691
  }))));
2692
2692
  };
2693
2693
 
2694
+ var COLORS;
2695
+
2696
+ (function (COLORS) {
2697
+ COLORS["ALMA"] = "#FF414D";
2698
+ COLORS["MONOCHROME"] = "#00425D";
2699
+ })(COLORS || (COLORS = {}));
2700
+
2694
2701
  function LogoIcon(_ref) {
2695
- var _ref$color = _ref.color,
2696
- color = _ref$color === void 0 ? '#00425D' : _ref$color,
2697
- _ref$underlineColor = _ref.underlineColor,
2698
- underlineColor = _ref$underlineColor === void 0 ? '#00425D' : _ref$underlineColor,
2699
- className = _ref.className;
2702
+ var className = _ref.className,
2703
+ _ref$color = _ref.color,
2704
+ color = _ref$color === void 0 ? COLORS.MONOCHROME : _ref$color,
2705
+ _ref$monochrome = _ref.monochrome,
2706
+ monochrome = _ref$monochrome === void 0 ? true : _ref$monochrome,
2707
+ underlineColor = _ref.underlineColor;
2708
+ var defaultUnderlineColor = monochrome ? COLORS.MONOCHROME : COLORS.ALMA;
2700
2709
  return /*#__PURE__*/React.createElement("svg", {
2701
2710
  className: className,
2702
2711
  width: "35",
@@ -2720,7 +2729,7 @@ function LogoIcon(_ref) {
2720
2729
  y: "20",
2721
2730
  width: "40",
2722
2731
  height: "3",
2723
- fill: underlineColor
2732
+ fill: underlineColor || defaultUnderlineColor
2724
2733
  }));
2725
2734
  }
2726
2735
 
@@ -2971,7 +2980,7 @@ var STATIC_CUSTOMISATION_CLASSES$1 = {
2971
2980
  activeOption: prefix$1 + '-active-option'
2972
2981
  };
2973
2982
 
2974
- var s$c = {"widgetButton":"_TSkFv","logo":"_LJ4nZ","primaryContainer":"_bMClc","paymentPlans":"_17c_S","plan":"_2Kqjn","active":"_3dG_J","notEligible":"_3O1bg","info":"_25GrF","loader":"_30j1O","error":"_R0YlN","errorText":"_2kGhu","errorButton":"_73d_Y","pending":"_1ZDMS","clickable":"_UksZa","unClickable":"_1lr-q"};
2983
+ 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"};
2975
2984
 
2976
2985
  var VERY_LONG_TIME_IN_MS = 1000 * 3600 * 24 * 365;
2977
2986
  var DEFAULT_TRANSITION_TIME = 5500;
@@ -2979,13 +2988,14 @@ var DEFAULT_TRANSITION_TIME = 5500;
2979
2988
  var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
2980
2989
  var _cx, _cx3;
2981
2990
 
2982
- var purchaseAmount = _ref.purchaseAmount,
2983
- apiData = _ref.apiData,
2991
+ var apiData = _ref.apiData,
2984
2992
  configPlans = _ref.configPlans,
2985
- transitionDelay = _ref.transitionDelay,
2986
2993
  hideIfNotEligible = _ref.hideIfNotEligible,
2994
+ monochrome = _ref.monochrome,
2995
+ purchaseAmount = _ref.purchaseAmount,
2987
2996
  suggestedPaymentPlan = _ref.suggestedPaymentPlan,
2988
- cards = _ref.cards;
2997
+ cards = _ref.cards,
2998
+ transitionDelay = _ref.transitionDelay;
2989
2999
 
2990
3000
  var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans),
2991
3001
  eligibilityPlans = _useFetchEligibility[0],
@@ -3088,19 +3098,21 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
3088
3098
  }, /*#__PURE__*/React.createElement("div", {
3089
3099
  className: cx(s$c.primaryContainer, STATIC_CUSTOMISATION_CLASSES$1.eligibilityLine)
3090
3100
  }, /*#__PURE__*/React.createElement(LogoIcon, {
3091
- className: s$c.logo
3101
+ className: s$c.logo,
3102
+ monochrome: monochrome
3092
3103
  }), /*#__PURE__*/React.createElement("div", {
3093
3104
  className: cx(s$c.paymentPlans, STATIC_CUSTOMISATION_CLASSES$1.eligibilityOptions)
3094
3105
  }, eligibilityPlans.map(function (eligibilityPlan, key) {
3095
3106
  var _cx2;
3096
3107
 
3108
+ var isCurrent = key === current;
3097
3109
  return /*#__PURE__*/React.createElement("div", {
3098
3110
  key: key,
3099
3111
  onMouseEnter: function onMouseEnter() {
3100
3112
  return onHover(key);
3101
3113
  },
3102
3114
  onMouseOut: onLeave,
3103
- className: cx(s$c.plan, (_cx2 = {}, _cx2[cx(s$c.active, STATIC_CUSTOMISATION_CLASSES$1.activeOption)] = current === key, _cx2[cx(s$c.notEligible, STATIC_CUSTOMISATION_CLASSES$1.notEligibleOption)] = !eligibilityPlan.eligible, _cx2))
3115
+ 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))
3104
3116
  }, paymentPlanShorthandName(eligibilityPlan));
3105
3117
  }))), /*#__PURE__*/React.createElement("div", {
3106
3118
  className: cx(s$c.info, (_cx3 = {}, _cx3[cx(s$c.notEligible, STATIC_CUSTOMISATION_CLASSES$1.notEligibleOption)] = eligibilityPlans[current] && !eligibilityPlans[current].eligible, _cx3), STATIC_CUSTOMISATION_CLASSES$1.paymentInfo)
@@ -3135,6 +3147,8 @@ var WidgetsController = /*#__PURE__*/function () {
3135
3147
  plans = options.plans,
3136
3148
  transitionDelay = options.transitionDelay,
3137
3149
  hideIfNotEligible = options.hideIfNotEligible,
3150
+ _options$monochrome = options.monochrome,
3151
+ monochrome = _options$monochrome === void 0 ? true : _options$monochrome,
3138
3152
  suggestedPaymentPlan = options.suggestedPaymentPlan,
3139
3153
  _options$locale = options.locale,
3140
3154
  locale = _options$locale === void 0 ? Locale.en : _options$locale,
@@ -3144,13 +3158,14 @@ var WidgetsController = /*#__PURE__*/function () {
3144
3158
  render( /*#__PURE__*/React.createElement(Provider, {
3145
3159
  locale: locale
3146
3160
  }, /*#__PURE__*/React.createElement(PaymentPlanWidget, {
3147
- purchaseAmount: purchaseAmount,
3148
3161
  apiData: this.apiData,
3149
3162
  configPlans: plans,
3150
- transitionDelay: transitionDelay,
3151
3163
  hideIfNotEligible: hideIfNotEligible,
3164
+ monochrome: monochrome,
3165
+ purchaseAmount: purchaseAmount,
3152
3166
  suggestedPaymentPlan: suggestedPaymentPlan,
3153
- cards: cards
3167
+ cards: cards,
3168
+ transitionDelay: transitionDelay
3154
3169
  })), document.querySelector(container));
3155
3170
  }
3156
3171
  }