@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.
@@ -8752,12 +8752,15 @@ var AdyenPayment = function AdyenPayment(_ref) {
8752
8752
  }();
8753
8753
 
8754
8754
  useEffect(function () {
8755
+ // @ts-ignore
8756
+ var paymentMethodsResponse = !isEmpty$1(paymentSource == null ? void 0 : paymentSource.paymentMethods) ? // @ts-ignore
8757
+ paymentSource == null ? void 0 : paymentSource.paymentMethods : {};
8758
+ if (isEmpty$1(paymentMethodsResponse)) console.error('Payment methods are not available. Please, check your Adyen configuration.');
8755
8759
  var options = {
8756
8760
  locale: locale,
8757
8761
  environment: environment,
8758
8762
  clientKey: clientKey,
8759
- paymentMethodsResponse: // @ts-ignore
8760
- paymentSource && (paymentSource == null ? void 0 : paymentSource.paymentMethods)
8763
+ paymentMethodsResponse: paymentMethodsResponse
8761
8764
  };
8762
8765
 
8763
8766
  options.onChange = function (s, c) {
@@ -10175,17 +10178,19 @@ var PaymentSource = function PaymentSource(props) {
10175
10178
  setShow(true);
10176
10179
  setShowCard(true);
10177
10180
  } else if ((payment == null ? void 0 : payment.id) === currentPaymentMethodId) {
10178
- var _paymentSource$option, _paymentSource$metada, _paymentSource$paymen, _paymentSource$paymen2, _paymentSource$paymen3, _paymentSource$paymen4;
10181
+ var _paymentSource$option, _paymentSource$metada, _paymentSource$paymen, _paymentSource$paymen2, _paymentSource$paymen3, _paymentSource$paymen4, _paymentSource$paymen5;
10179
10182
 
10180
10183
  setShow(true); // NOTE: Remove metadata in the future
10181
10184
 
10182
10185
  var card = // @ts-ignore
10183
10186
  (paymentSource == null ? void 0 : (_paymentSource$option = paymentSource.options) == null ? void 0 : _paymentSource$option.card) || ( // @ts-ignore
10184
- 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) && {
10187
+ paymentSource == null ? void 0 : (_paymentSource$metada = paymentSource.metadata) == null ? void 0 : _paymentSource$metada.card) || // NOTE: Adyen payment
10188
+ // @ts-ignore
10189
+ (paymentSource == null ? void 0 : (_paymentSource$paymen = paymentSource.paymentRequestData) == null ? void 0 : (_paymentSource$paymen2 = _paymentSource$paymen.paymentMethod) == null ? void 0 : _paymentSource$paymen2.brand) && // @ts-ignore
10190
+ (paymentSource == null ? void 0 : (_paymentSource$paymen3 = paymentSource.paymentResponse) == null ? void 0 : _paymentSource$paymen3.resultCode) === 'Authorised' && {
10185
10191
  // @ts-ignore
10186
- brand: paymentSource == null ? void 0 : (_paymentSource$paymen3 = paymentSource.paymentRequestData) == null ? void 0 : (_paymentSource$paymen4 = _paymentSource$paymen3.paymentMethod) == null ? void 0 : _paymentSource$paymen4.brand
10187
- }; // debugger
10188
-
10192
+ brand: paymentSource == null ? void 0 : (_paymentSource$paymen4 = paymentSource.paymentRequestData) == null ? void 0 : (_paymentSource$paymen5 = _paymentSource$paymen4.paymentMethod) == null ? void 0 : _paymentSource$paymen5.brand
10193
+ };
10189
10194
  if (!isEmpty(card)) setShowCard(true);
10190
10195
  } else setShow(false);
10191
10196