@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.
@@ -14979,7 +14979,7 @@
14979
14979
  });
14980
14980
  };
14981
14981
 
14982
- var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, plans) {
14982
+ var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, plans, customerBillingCountry, customerShippingCountry) {
14983
14983
  var domain = _ref.domain,
14984
14984
  merchantId = _ref.merchantId;
14985
14985
 
@@ -15000,9 +15000,27 @@
15000
15000
  });
15001
15001
  react.useEffect(function () {
15002
15002
  if (status === apiStatus.PENDING) {
15003
+ var billing_address = null;
15004
+
15005
+ if (customerBillingCountry) {
15006
+ billing_address = {
15007
+ country: customerBillingCountry
15008
+ };
15009
+ }
15010
+
15011
+ var shipping_address = null;
15012
+
15013
+ if (customerShippingCountry) {
15014
+ shipping_address = {
15015
+ country: customerShippingCountry
15016
+ };
15017
+ }
15018
+
15003
15019
  fetchFromApi(domain + '/v2/payments/eligibility', {
15004
15020
  purchase_amount: purchaseAmount,
15005
- queries: configInstallments
15021
+ queries: configInstallments,
15022
+ billing_address: billing_address,
15023
+ shipping_address: shipping_address
15006
15024
  }, {
15007
15025
  Authorization: "Alma-Merchant-Auth " + merchantId
15008
15026
  }).then(function (res) {
@@ -20358,10 +20376,12 @@
20358
20376
  var purchaseAmount = _ref.purchaseAmount,
20359
20377
  apiData = _ref.apiData,
20360
20378
  configPlans = _ref.configPlans,
20379
+ customerBillingCountry = _ref.customerBillingCountry,
20380
+ customerShippingCountry = _ref.customerShippingCountry,
20361
20381
  onClose = _ref.onClose,
20362
20382
  cards = _ref.cards;
20363
20383
 
20364
- var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans),
20384
+ var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans, customerBillingCountry, customerShippingCountry),
20365
20385
  eligibilityPlans = _useFetchEligibility[0],
20366
20386
  status = _useFetchEligibility[1];
20367
20387
 
@@ -20494,11 +20514,13 @@
20494
20514
  purchaseAmount = _ref.purchaseAmount,
20495
20515
  suggestedPaymentPlan = _ref.suggestedPaymentPlan,
20496
20516
  cards = _ref.cards,
20517
+ customerBillingCountry = _ref.customerBillingCountry,
20518
+ customerShippingCountry = _ref.customerShippingCountry,
20497
20519
  transitionDelay = _ref.transitionDelay,
20498
20520
  _ref$hideBorder = _ref.hideBorder,
20499
20521
  hideBorder = _ref$hideBorder === void 0 ? false : _ref$hideBorder;
20500
20522
 
20501
- var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans),
20523
+ var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans, customerBillingCountry, customerShippingCountry),
20502
20524
  eligibilityPlans = _useFetchEligibility[0],
20503
20525
  status = _useFetchEligibility[1];
20504
20526
 
@@ -20657,6 +20679,8 @@
20657
20679
  _options$monochrome = options.monochrome,
20658
20680
  monochrome = _options$monochrome === void 0 ? true : _options$monochrome,
20659
20681
  suggestedPaymentPlan = options.suggestedPaymentPlan,
20682
+ customerBillingCountry = options.customerBillingCountry,
20683
+ customerShippingCountry = options.customerShippingCountry,
20660
20684
  _options$locale = options.locale,
20661
20685
  locale = _options$locale === void 0 ? Locale.en : _options$locale,
20662
20686
  cards = options.cards;
@@ -20672,6 +20696,8 @@
20672
20696
  purchaseAmount: purchaseAmount,
20673
20697
  suggestedPaymentPlan: suggestedPaymentPlan,
20674
20698
  cards: cards,
20699
+ customerBillingCountry: customerBillingCountry,
20700
+ customerShippingCountry: customerShippingCountry,
20675
20701
  transitionDelay: transitionDelay,
20676
20702
  hideBorder: hideBorder
20677
20703
  })), document.querySelector(container));
@@ -20685,6 +20711,8 @@
20685
20711
  _plans = options.plans,
20686
20712
  _options$locale2 = options.locale,
20687
20713
  _locale = _options$locale2 === void 0 ? Locale.en : _options$locale2,
20714
+ _customerBillingCountry = options.customerBillingCountry,
20715
+ _customerShippingCountry = options.customerShippingCountry,
20688
20716
  _cards = options.cards;
20689
20717
 
20690
20718
  var close = function close() {
@@ -20698,6 +20726,8 @@
20698
20726
  purchaseAmount: _purchaseAmount,
20699
20727
  apiData: _this.apiData,
20700
20728
  configPlans: _plans,
20729
+ customerBillingCountry: _customerBillingCountry,
20730
+ customerShippingCountry: _customerShippingCountry,
20701
20731
  onClose: close,
20702
20732
  cards: _cards
20703
20733
  })), document.querySelector(_container));