@alma/widgets 3.0.4 → 3.1.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.
@@ -2178,7 +2178,7 @@ var filterELigibility = function filterELigibility(eligibilities, configPlans) {
2178
2178
  });
2179
2179
  };
2180
2180
 
2181
- var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, plans) {
2181
+ var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, plans, customerBillingCountry, customerShippingCountry) {
2182
2182
  var domain = _ref.domain,
2183
2183
  merchantId = _ref.merchantId;
2184
2184
 
@@ -2199,9 +2199,27 @@ var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, pla
2199
2199
  });
2200
2200
  useEffect(function () {
2201
2201
  if (status === apiStatus.PENDING) {
2202
+ var billing_address = null;
2203
+
2204
+ if (customerBillingCountry) {
2205
+ billing_address = {
2206
+ country: customerBillingCountry
2207
+ };
2208
+ }
2209
+
2210
+ var shipping_address = null;
2211
+
2212
+ if (customerShippingCountry) {
2213
+ shipping_address = {
2214
+ country: customerShippingCountry
2215
+ };
2216
+ }
2217
+
2202
2218
  fetchFromApi(domain + '/v2/payments/eligibility', {
2203
2219
  purchase_amount: purchaseAmount,
2204
- queries: configInstallments
2220
+ queries: configInstallments,
2221
+ billing_address: billing_address,
2222
+ shipping_address: shipping_address
2205
2223
  }, {
2206
2224
  Authorization: "Alma-Merchant-Auth " + merchantId
2207
2225
  }).then(function (res) {
@@ -2945,10 +2963,12 @@ var ModalContainer = function ModalContainer(_ref) {
2945
2963
  var purchaseAmount = _ref.purchaseAmount,
2946
2964
  apiData = _ref.apiData,
2947
2965
  configPlans = _ref.configPlans,
2966
+ customerBillingCountry = _ref.customerBillingCountry,
2967
+ customerShippingCountry = _ref.customerShippingCountry,
2948
2968
  onClose = _ref.onClose,
2949
2969
  cards = _ref.cards;
2950
2970
 
2951
- var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans),
2971
+ var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans, customerBillingCountry, customerShippingCountry),
2952
2972
  eligibilityPlans = _useFetchEligibility[0],
2953
2973
  status = _useFetchEligibility[1];
2954
2974
 
@@ -3081,11 +3101,13 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
3081
3101
  purchaseAmount = _ref.purchaseAmount,
3082
3102
  suggestedPaymentPlan = _ref.suggestedPaymentPlan,
3083
3103
  cards = _ref.cards,
3104
+ customerBillingCountry = _ref.customerBillingCountry,
3105
+ customerShippingCountry = _ref.customerShippingCountry,
3084
3106
  transitionDelay = _ref.transitionDelay,
3085
3107
  _ref$hideBorder = _ref.hideBorder,
3086
3108
  hideBorder = _ref$hideBorder === void 0 ? false : _ref$hideBorder;
3087
3109
 
3088
- var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans),
3110
+ var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans, customerBillingCountry, customerShippingCountry),
3089
3111
  eligibilityPlans = _useFetchEligibility[0],
3090
3112
  status = _useFetchEligibility[1];
3091
3113
 
@@ -3244,6 +3266,8 @@ var WidgetsController = /*#__PURE__*/function () {
3244
3266
  _options$monochrome = options.monochrome,
3245
3267
  monochrome = _options$monochrome === void 0 ? true : _options$monochrome,
3246
3268
  suggestedPaymentPlan = options.suggestedPaymentPlan,
3269
+ customerBillingCountry = options.customerBillingCountry,
3270
+ customerShippingCountry = options.customerShippingCountry,
3247
3271
  _options$locale = options.locale,
3248
3272
  locale = _options$locale === void 0 ? Locale.en : _options$locale,
3249
3273
  cards = options.cards;
@@ -3259,6 +3283,8 @@ var WidgetsController = /*#__PURE__*/function () {
3259
3283
  purchaseAmount: purchaseAmount,
3260
3284
  suggestedPaymentPlan: suggestedPaymentPlan,
3261
3285
  cards: cards,
3286
+ customerBillingCountry: customerBillingCountry,
3287
+ customerShippingCountry: customerShippingCountry,
3262
3288
  transitionDelay: transitionDelay,
3263
3289
  hideBorder: hideBorder
3264
3290
  })), document.querySelector(container));
@@ -3272,6 +3298,8 @@ var WidgetsController = /*#__PURE__*/function () {
3272
3298
  _plans = options.plans,
3273
3299
  _options$locale2 = options.locale,
3274
3300
  _locale = _options$locale2 === void 0 ? Locale.en : _options$locale2,
3301
+ _customerBillingCountry = options.customerBillingCountry,
3302
+ _customerShippingCountry = options.customerShippingCountry,
3275
3303
  _cards = options.cards;
3276
3304
 
3277
3305
  var close = function close() {
@@ -3285,6 +3313,8 @@ var WidgetsController = /*#__PURE__*/function () {
3285
3313
  purchaseAmount: _purchaseAmount,
3286
3314
  apiData: _this.apiData,
3287
3315
  configPlans: _plans,
3316
+ customerBillingCountry: _customerBillingCountry,
3317
+ customerShippingCountry: _customerShippingCountry,
3288
3318
  onClose: close,
3289
3319
  cards: _cards
3290
3320
  })), document.querySelector(_container));