@commercelayer/react-components 2.45.3 → 3.0.0-beta.10

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.
@@ -8760,12 +8760,15 @@ var AdyenPayment = function AdyenPayment(_ref) {
8760
8760
  }();
8761
8761
 
8762
8762
  React.useEffect(function () {
8763
+ // @ts-ignore
8764
+ var paymentMethodsResponse = !isEmpty(paymentSource == null ? void 0 : paymentSource.paymentMethods) ? // @ts-ignore
8765
+ paymentSource == null ? void 0 : paymentSource.paymentMethods : {};
8766
+ if (isEmpty(paymentMethodsResponse)) console.error('Payment methods are not available. Please, check your Adyen configuration.');
8763
8767
  var options = {
8764
8768
  locale: locale,
8765
8769
  environment: environment,
8766
8770
  clientKey: clientKey,
8767
- paymentMethodsResponse: // @ts-ignore
8768
- paymentSource && (paymentSource == null ? void 0 : paymentSource.paymentMethods)
8771
+ paymentMethodsResponse: paymentMethodsResponse
8769
8772
  };
8770
8773
 
8771
8774
  options.onChange = function (s, c) {
@@ -10183,17 +10186,19 @@ var PaymentSource = function PaymentSource(props) {
10183
10186
  setShow(true);
10184
10187
  setShowCard(true);
10185
10188
  } else if ((payment == null ? void 0 : payment.id) === currentPaymentMethodId) {
10186
- var _paymentSource$option, _paymentSource$metada, _paymentSource$paymen, _paymentSource$paymen2, _paymentSource$paymen3, _paymentSource$paymen4;
10189
+ var _paymentSource$option, _paymentSource$metada, _paymentSource$paymen, _paymentSource$paymen2, _paymentSource$paymen3, _paymentSource$paymen4, _paymentSource$paymen5;
10187
10190
 
10188
10191
  setShow(true); // NOTE: Remove metadata in the future
10189
10192
 
10190
10193
  var card = // @ts-ignore
10191
10194
  (paymentSource == null ? void 0 : (_paymentSource$option = paymentSource.options) == null ? void 0 : _paymentSource$option.card) || ( // @ts-ignore
10192
- paymentSource == null ? void 0 : (_paymentSource$metada = paymentSource.metadata) == null ? void 0 : _paymentSource$metada.card) || (paymentSource == null ? void 0 : (_paymentSource$paymen = paymentSource.paymentRequestData) == null ? void 0 : (_paymentSource$paymen2 = _paymentSource$paymen.paymentMethod) == null ? void 0 : _paymentSource$paymen2.brand) && {
10195
+ paymentSource == null ? void 0 : (_paymentSource$metada = paymentSource.metadata) == null ? void 0 : _paymentSource$metada.card) || // NOTE: Adyen payment
10196
+ // @ts-ignore
10197
+ (paymentSource == null ? void 0 : (_paymentSource$paymen = paymentSource.paymentRequestData) == null ? void 0 : (_paymentSource$paymen2 = _paymentSource$paymen.paymentMethod) == null ? void 0 : _paymentSource$paymen2.brand) && // @ts-ignore
10198
+ (paymentSource == null ? void 0 : (_paymentSource$paymen3 = paymentSource.paymentResponse) == null ? void 0 : _paymentSource$paymen3.resultCode) === 'Authorised' && {
10193
10199
  // @ts-ignore
10194
- brand: paymentSource == null ? void 0 : (_paymentSource$paymen3 = paymentSource.paymentRequestData) == null ? void 0 : (_paymentSource$paymen4 = _paymentSource$paymen3.paymentMethod) == null ? void 0 : _paymentSource$paymen4.brand
10195
- }; // debugger
10196
-
10200
+ brand: paymentSource == null ? void 0 : (_paymentSource$paymen4 = paymentSource.paymentRequestData) == null ? void 0 : (_paymentSource$paymen5 = _paymentSource$paymen4.paymentMethod) == null ? void 0 : _paymentSource$paymen5.brand
10201
+ };
10197
10202
  if (!lodash.isEmpty(card)) setShowCard(true);
10198
10203
  } else setShow(false);
10199
10204