@trap_stevo/legendarybuilderproreact-ui
Version:
The legendary UI & utility API that makes your application a legendary application. ~ Created by Steven Compton
424 lines (421 loc) • 21.8 kB
JavaScript
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
/*
Created by Hassan Steven Compton.
March 7, 2024.
*/
import * as React from 'react';
import { useState, useEffect, useRef } from 'react';
import { useNavigate } from "react-router-dom";
import { Elements } from '@stripe/react-stripe-js';
import { loadStripe } from '@stripe/stripe-js';
import HUDPaymentDetailsLaptopOrDesktop from "./PaymentDetailsLaptopOrDesktop.js";
import HUDPaymentDetailsTablet from "./PaymentDetailsTablet.js";
import HUDPaymentDetailsMobile from "./PaymentDetailsMobile.js";
import { useAuth } from "../../HUDComponents/AuthProvider.js";
function HUDPaymentDetails(_ref) {
var checkoutButtonConfigurationSettings = _ref.checkoutButtonConfigurationSettings,
handleShareCertificateUpload = _ref.handleShareCertificateUpload,
handleCardInputInFocusUpdate = _ref.handleCardInputInFocusUpdate,
handleCardInputBlurUpdate = _ref.handleCardInputBlurUpdate,
cardInputFocus = _ref.cardInputFocus,
handleExpirationDateInputInFocusUpdate = _ref.handleExpirationDateInputInFocusUpdate,
handleExpirationDateInputBlurUpdate = _ref.handleExpirationDateInputBlurUpdate,
expirationDateInputFocus = _ref.expirationDateInputFocus,
handleCVVInputInFocusUpdate = _ref.handleCVVInputInFocusUpdate,
handleCVVInputBlurUpdate = _ref.handleCVVInputBlurUpdate,
cvvInputFocus = _ref.cvvInputFocus,
handleNameOnCardInputInFocusUpdate = _ref.handleNameOnCardInputInFocusUpdate,
handleNameOnCardInputBlurUpdate = _ref.handleNameOnCardInputBlurUpdate,
handleNameOnCardInputUpdate = _ref.handleNameOnCardInputUpdate,
nameOnCardInputFocus = _ref.nameOnCardInputFocus,
nameOnCardInputValue = _ref.nameOnCardInputValue,
handleAddressLineOInputInFocusUpdate = _ref.handleAddressLineOInputInFocusUpdate,
handleAddressLineOInputBlurUpdate = _ref.handleAddressLineOInputBlurUpdate,
handleAddressLineOInputUpdate = _ref.handleAddressLineOInputUpdate,
addressLineOInputFocus = _ref.addressLineOInputFocus,
addressLineOInputValue = _ref.addressLineOInputValue,
handleAddressLineTInputInFocusUpdate = _ref.handleAddressLineTInputInFocusUpdate,
handleAddressLineTInputBlurUpdate = _ref.handleAddressLineTInputBlurUpdate,
handleAddressLineTInputUpdate = _ref.handleAddressLineTInputUpdate,
addressLineTInputFocus = _ref.addressLineTInputFocus,
addressLineTInputValue = _ref.addressLineTInputValue,
handlePostalCodeInputInFocusUpdate = _ref.handlePostalCodeInputInFocusUpdate,
handlePostalCodeInputBlurUpdate = _ref.handlePostalCodeInputBlurUpdate,
handlePostalCodeInputUpdate = _ref.handlePostalCodeInputUpdate,
postalCodeInputFocus = _ref.postalCodeInputFocus,
postalCodeInputValue = _ref.postalCodeInputValue,
handleCountryInputInFocusUpdate = _ref.handleCountryInputInFocusUpdate,
handleCountryInputBlurUpdate = _ref.handleCountryInputBlurUpdate,
handleCountryInputUpdate = _ref.handleCountryInputUpdate,
countryInputFocus = _ref.countryInputFocus,
countryInputValue = _ref.countryInputValue,
handleStateInputInFocusUpdate = _ref.handleStateInputInFocusUpdate,
handleStateInputBlurUpdate = _ref.handleStateInputBlurUpdate,
handleStateInputUpdate = _ref.handleStateInputUpdate,
stateInputFocus = _ref.stateInputFocus,
stateInputValue = _ref.stateInputValue,
handleCityInputInFocusUpdate = _ref.handleCityInputInFocusUpdate,
handleCityInputBlurUpdate = _ref.handleCityInputBlurUpdate,
handleCityInputUpdate = _ref.handleCityInputUpdate,
cityInputFocus = _ref.cityInputFocus,
cityInputValue = _ref.cityInputValue,
handlePhoneNumberInputInFocusUpdate = _ref.handlePhoneNumberInputInFocusUpdate,
handlePhoneNumberInputBlurUpdate = _ref.handlePhoneNumberInputBlurUpdate,
handlePhoneNumberInputUpdate = _ref.handlePhoneNumberInputUpdate,
phoneNumberInputFocus = _ref.phoneNumberInputFocus,
setPhoneNumberInputValue = _ref.setPhoneNumberInputValue,
phoneNumberInputValue = _ref.phoneNumberInputValue,
setCheckoutButtonHover = _ref.setCheckoutButtonHover,
checkoutButtonHover = _ref.checkoutButtonHover,
setProcessingPaymentIndicator = _ref.setProcessingPaymentIndicator,
processingPaymentIndicator = _ref.processingPaymentIndicator,
setProcessingPayment = _ref.setProcessingPayment,
processingPayment = _ref.processingPayment,
setPaymentApproval = _ref.setPaymentApproval,
paymentApproval = _ref.paymentApproval,
setCardNumberDisplay = _ref.setCardNumberDisplay,
cardNumberDisplay = _ref.cardNumberDisplay,
hudStripePromise = _ref.hudStripePromise,
paymentCompletion = _ref.paymentCompletion,
paymentAccessURL = _ref.paymentAccessURL,
paymentMessage = _ref.paymentMessage,
paymentType = _ref.paymentType,
certificateData = _ref.certificateData,
setCardBrand = _ref.setCardBrand,
cardBrand = _ref.cardBrand,
product = _ref.product,
HUDInterfaceResponsiveQueries = _ref.HUDInterfaceResponsiveQueries,
updateCurrentScrollPosition = _ref.updateCurrentScrollPosition,
cardNumberInputRef = _ref.cardNumberInputRef,
checkoutDetailsRef = _ref.checkoutDetailsRef;
var _HUDInterfaceResponsi = HUDInterfaceResponsiveQueries(),
desktopOrLaptop = _HUDInterfaceResponsi.desktopOrLaptop,
bigScreen = _HUDInterfaceResponsi.bigScreen,
tablet = _HUDInterfaceResponsi.tablet,
mobile = _HUDInterfaceResponsi.mobile,
portrait = _HUDInterfaceResponsi.portrait,
retina = _HUDInterfaceResponsi.retina;
var _useAuth = useAuth(),
signedUser = _useAuth.signedUser,
setSignedUser = _useAuth.setSignedUser,
signedIn = _useAuth.signedIn,
signIn = _useAuth.signIn,
signOut = _useAuth.signOut;
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
cardNumberComplete = _useState2[0],
setCardNumberComplete = _useState2[1];
var _useState3 = useState(false),
_useState4 = _slicedToArray(_useState3, 2),
cardExpirationDateComplete = _useState4[0],
setCardExpirationDateComplete = _useState4[1];
var _useState5 = useState(false),
_useState6 = _slicedToArray(_useState5, 2),
cardCVCComplete = _useState6[0],
setCVCComplete = _useState6[1];
var hudPaymentComponentStyle = {
style: {
base: {
iconColor: '#699EE8',
color: '#1a1313',
fontWeight: "bold",
fontSize: mobile ? "15px" : "21px",
"::placeholder": {
color: "#737373"
}
},
invalid: {
color: "#fa755a",
iconColor: "#fa755a"
}
}
};
var handleCardNumberOnReady = function handleCardNumberOnReady(component) {
cardNumberInputRef.current = component;
return;
};
var handleCardNumberUpdate = function handleCardNumberUpdate(event) {
setCardNumberComplete(event.complete);
var brand = event.brand;
setCardBrand(brand);
return;
};
var handleCardExpirationDateUpdate = function handleCardExpirationDateUpdate(event) {
setCardExpirationDateComplete(event.complete);
return;
};
var handleCardCVCUpdate = function handleCardCVCUpdate(event) {
setCVCComplete(event.complete);
return;
};
useEffect(function () {
if (signedUser && signedUser.phone && signedUser.phone.trim() !== "") {
setPhoneNumberInputValue(signedUser.phone);
return function () {};
}
return function () {};
}, [signedUser]);
return /*#__PURE__*/React.createElement(React.Fragment, null, desktopOrLaptop === true ? /*#__PURE__*/React.createElement(Elements, {
stripe: hudStripePromise
}, /*#__PURE__*/React.createElement(HUDPaymentDetailsLaptopOrDesktop, {
checkoutButtonConfigurationSettings: checkoutButtonConfigurationSettings,
handleShareCertificateUpload: handleShareCertificateUpload,
handleCardInputInFocusUpdate: handleCardInputInFocusUpdate,
handleCardInputBlurUpdate: handleCardInputBlurUpdate,
cardInputFocus: cardInputFocus,
handleExpirationDateInputInFocusUpdate: handleExpirationDateInputInFocusUpdate,
handleExpirationDateInputBlurUpdate: handleExpirationDateInputBlurUpdate,
expirationDateInputFocus: expirationDateInputFocus,
handleCVVInputInFocusUpdate: handleCVVInputInFocusUpdate,
handleCVVInputBlurUpdate: handleCVVInputBlurUpdate,
cvvInputFocus: cvvInputFocus,
handleNameOnCardInputInFocusUpdate: handleNameOnCardInputInFocusUpdate,
handleNameOnCardInputBlurUpdate: handleNameOnCardInputBlurUpdate,
handleNameOnCardInputUpdate: handleNameOnCardInputUpdate,
nameOnCardInputFocus: nameOnCardInputFocus,
nameOnCardInputValue: nameOnCardInputValue,
handleAddressLineOInputInFocusUpdate: handleAddressLineOInputInFocusUpdate,
handleAddressLineOInputBlurUpdate: handleAddressLineOInputBlurUpdate,
handleAddressLineOInputUpdate: handleAddressLineOInputUpdate,
addressLineOInputFocus: addressLineOInputFocus,
addressLineOInputValue: addressLineOInputValue,
handleAddressLineTInputInFocusUpdate: handleAddressLineTInputInFocusUpdate,
handleAddressLineTInputBlurUpdate: handleAddressLineTInputBlurUpdate,
handleAddressLineTInputUpdate: handleAddressLineTInputUpdate,
addressLineTInputFocus: addressLineTInputFocus,
addressLineTInputValue: addressLineTInputValue,
handlePostalCodeInputInFocusUpdate: handlePostalCodeInputInFocusUpdate,
handlePostalCodeInputBlurUpdate: handlePostalCodeInputBlurUpdate,
handlePostalCodeInputUpdate: handlePostalCodeInputUpdate,
postalCodeInputFocus: postalCodeInputFocus,
postalCodeInputValue: postalCodeInputValue,
handleCountryInputInFocusUpdate: handleCountryInputInFocusUpdate,
handleCountryInputBlurUpdate: handleCountryInputBlurUpdate,
handleCountryInputUpdate: handleCountryInputUpdate,
countryInputFocus: countryInputFocus,
countryInputValue: countryInputValue,
handleStateInputInFocusUpdate: handleStateInputInFocusUpdate,
handleStateInputBlurUpdate: handleStateInputBlurUpdate,
handleStateInputUpdate: handleStateInputUpdate,
stateInputFocus: stateInputFocus,
stateInputValue: stateInputValue,
handleCityInputInFocusUpdate: handleCityInputInFocusUpdate,
handleCityInputBlurUpdate: handleCityInputBlurUpdate,
handleCityInputUpdate: handleCityInputUpdate,
cityInputFocus: cityInputFocus,
cityInputValue: cityInputValue,
handlePhoneNumberInputInFocusUpdate: handlePhoneNumberInputInFocusUpdate,
handlePhoneNumberInputBlurUpdate: handlePhoneNumberInputBlurUpdate,
handlePhoneNumberInputUpdate: handlePhoneNumberInputUpdate,
phoneNumberInputFocus: phoneNumberInputFocus,
setPhoneNumberInputValue: setPhoneNumberInputValue,
phoneNumberInputValue: phoneNumberInputValue,
setCheckoutButtonHover: setCheckoutButtonHover,
checkoutButtonHover: checkoutButtonHover,
setProcessingPaymentIndicator: setProcessingPaymentIndicator,
processingPaymentIndicator: processingPaymentIndicator,
setProcessingPayment: setProcessingPayment,
processingPayment: processingPayment,
setPaymentApproval: setPaymentApproval,
paymentApproval: paymentApproval,
setCardExpirationDateComplete: setCardExpirationDateComplete,
cardExpirationDateComplete: cardExpirationDateComplete,
setCardNumberComplete: setCardNumberComplete,
cardNumberComplete: cardNumberComplete,
setCVCComplete: setCVCComplete,
cardCVCComplete: cardCVCComplete,
setCardNumberDisplay: setCardNumberDisplay,
cardNumberDisplay: cardNumberDisplay,
paymentCompletion: paymentCompletion,
paymentAccessURL: paymentAccessURL,
paymentMessage: paymentMessage,
paymentType: paymentType,
certificateData: certificateData,
setCardBrand: setCardBrand,
cardBrand: cardBrand,
product: product,
cardNumberInputRef: cardNumberInputRef,
checkoutDetailsRef: checkoutDetailsRef,
updateCurrentScrollPosition: updateCurrentScrollPosition,
hudPaymentComponentStyle: hudPaymentComponentStyle,
handleCardNumberOnReady: handleCardNumberOnReady,
handleCardNumberUpdate: handleCardNumberUpdate,
handleCardExpirationDateUpdate: handleCardExpirationDateUpdate,
handleCardCVCUpdate: handleCardCVCUpdate
})) : mobile === true ? /*#__PURE__*/React.createElement(Elements, {
stripe: hudStripePromise
}, /*#__PURE__*/React.createElement(HUDPaymentDetailsMobile, {
checkoutButtonConfigurationSettings: checkoutButtonConfigurationSettings,
handleShareCertificateUpload: handleShareCertificateUpload,
handleCardInputInFocusUpdate: handleCardInputInFocusUpdate,
handleCardInputBlurUpdate: handleCardInputBlurUpdate,
cardInputFocus: cardInputFocus,
handleExpirationDateInputInFocusUpdate: handleExpirationDateInputInFocusUpdate,
handleExpirationDateInputBlurUpdate: handleExpirationDateInputBlurUpdate,
expirationDateInputFocus: expirationDateInputFocus,
handleCVVInputInFocusUpdate: handleCVVInputInFocusUpdate,
handleCVVInputBlurUpdate: handleCVVInputBlurUpdate,
cvvInputFocus: cvvInputFocus,
handleNameOnCardInputInFocusUpdate: handleNameOnCardInputInFocusUpdate,
handleNameOnCardInputBlurUpdate: handleNameOnCardInputBlurUpdate,
handleNameOnCardInputUpdate: handleNameOnCardInputUpdate,
nameOnCardInputFocus: nameOnCardInputFocus,
nameOnCardInputValue: nameOnCardInputValue,
handleAddressLineOInputInFocusUpdate: handleAddressLineOInputInFocusUpdate,
handleAddressLineOInputBlurUpdate: handleAddressLineOInputBlurUpdate,
handleAddressLineOInputUpdate: handleAddressLineOInputUpdate,
addressLineOInputFocus: addressLineOInputFocus,
addressLineOInputValue: addressLineOInputValue,
handleAddressLineTInputInFocusUpdate: handleAddressLineTInputInFocusUpdate,
handleAddressLineTInputBlurUpdate: handleAddressLineTInputBlurUpdate,
handleAddressLineTInputUpdate: handleAddressLineTInputUpdate,
addressLineTInputFocus: addressLineTInputFocus,
addressLineTInputValue: addressLineTInputValue,
handlePostalCodeInputInFocusUpdate: handlePostalCodeInputInFocusUpdate,
handlePostalCodeInputBlurUpdate: handlePostalCodeInputBlurUpdate,
handlePostalCodeInputUpdate: handlePostalCodeInputUpdate,
postalCodeInputFocus: postalCodeInputFocus,
postalCodeInputValue: postalCodeInputValue,
handleCountryInputInFocusUpdate: handleCountryInputInFocusUpdate,
handleCountryInputBlurUpdate: handleCountryInputBlurUpdate,
handleCountryInputUpdate: handleCountryInputUpdate,
countryInputFocus: countryInputFocus,
countryInputValue: countryInputValue,
handleStateInputInFocusUpdate: handleStateInputInFocusUpdate,
handleStateInputBlurUpdate: handleStateInputBlurUpdate,
handleStateInputUpdate: handleStateInputUpdate,
stateInputFocus: stateInputFocus,
stateInputValue: stateInputValue,
handleCityInputInFocusUpdate: handleCityInputInFocusUpdate,
handleCityInputBlurUpdate: handleCityInputBlurUpdate,
handleCityInputUpdate: handleCityInputUpdate,
cityInputFocus: cityInputFocus,
cityInputValue: cityInputValue,
handlePhoneNumberInputInFocusUpdate: handlePhoneNumberInputInFocusUpdate,
handlePhoneNumberInputBlurUpdate: handlePhoneNumberInputBlurUpdate,
handlePhoneNumberInputUpdate: handlePhoneNumberInputUpdate,
phoneNumberInputFocus: phoneNumberInputFocus,
setPhoneNumberInputValue: setPhoneNumberInputValue,
phoneNumberInputValue: phoneNumberInputValue,
setCheckoutButtonHover: setCheckoutButtonHover,
checkoutButtonHover: checkoutButtonHover,
setProcessingPaymentIndicator: setProcessingPaymentIndicator,
processingPaymentIndicator: processingPaymentIndicator,
setProcessingPayment: setProcessingPayment,
processingPayment: processingPayment,
setPaymentApproval: setPaymentApproval,
paymentApproval: paymentApproval,
setCardExpirationDateComplete: setCardExpirationDateComplete,
cardExpirationDateComplete: cardExpirationDateComplete,
setCardNumberComplete: setCardNumberComplete,
cardNumberComplete: cardNumberComplete,
setCVCComplete: setCVCComplete,
cardCVCComplete: cardCVCComplete,
setCardNumberDisplay: setCardNumberDisplay,
cardNumberDisplay: cardNumberDisplay,
paymentCompletion: paymentCompletion,
paymentAccessURL: paymentAccessURL,
paymentMessage: paymentMessage,
paymentType: paymentType,
certificateData: certificateData,
setCardBrand: setCardBrand,
cardBrand: cardBrand,
product: product,
cardNumberInputRef: cardNumberInputRef,
checkoutDetailsRef: checkoutDetailsRef,
updateCurrentScrollPosition: updateCurrentScrollPosition,
hudPaymentComponentStyle: hudPaymentComponentStyle,
handleCardNumberOnReady: handleCardNumberOnReady,
handleCardNumberUpdate: handleCardNumberUpdate,
handleCardExpirationDateUpdate: handleCardExpirationDateUpdate,
handleCardCVCUpdate: handleCardCVCUpdate
})) : tablet === true ? /*#__PURE__*/React.createElement(Elements, {
stripe: hudStripePromise
}, /*#__PURE__*/React.createElement(HUDPaymentDetailsTablet, {
checkoutButtonConfigurationSettings: checkoutButtonConfigurationSettings,
handleShareCertificateUpload: handleShareCertificateUpload,
handleCardInputInFocusUpdate: handleCardInputInFocusUpdate,
handleCardInputBlurUpdate: handleCardInputBlurUpdate,
cardInputFocus: cardInputFocus,
handleExpirationDateInputInFocusUpdate: handleExpirationDateInputInFocusUpdate,
handleExpirationDateInputBlurUpdate: handleExpirationDateInputBlurUpdate,
expirationDateInputFocus: expirationDateInputFocus,
handleCVVInputInFocusUpdate: handleCVVInputInFocusUpdate,
handleCVVInputBlurUpdate: handleCVVInputBlurUpdate,
cvvInputFocus: cvvInputFocus,
handleNameOnCardInputInFocusUpdate: handleNameOnCardInputInFocusUpdate,
handleNameOnCardInputBlurUpdate: handleNameOnCardInputBlurUpdate,
handleNameOnCardInputUpdate: handleNameOnCardInputUpdate,
nameOnCardInputFocus: nameOnCardInputFocus,
nameOnCardInputValue: nameOnCardInputValue,
handleAddressLineOInputInFocusUpdate: handleAddressLineOInputInFocusUpdate,
handleAddressLineOInputBlurUpdate: handleAddressLineOInputBlurUpdate,
handleAddressLineOInputUpdate: handleAddressLineOInputUpdate,
addressLineOInputFocus: addressLineOInputFocus,
addressLineOInputValue: addressLineOInputValue,
handleAddressLineTInputInFocusUpdate: handleAddressLineTInputInFocusUpdate,
handleAddressLineTInputBlurUpdate: handleAddressLineTInputBlurUpdate,
handleAddressLineTInputUpdate: handleAddressLineTInputUpdate,
addressLineTInputFocus: addressLineTInputFocus,
addressLineTInputValue: addressLineTInputValue,
handlePostalCodeInputInFocusUpdate: handlePostalCodeInputInFocusUpdate,
handlePostalCodeInputBlurUpdate: handlePostalCodeInputBlurUpdate,
handlePostalCodeInputUpdate: handlePostalCodeInputUpdate,
postalCodeInputFocus: postalCodeInputFocus,
postalCodeInputValue: postalCodeInputValue,
handleCountryInputInFocusUpdate: handleCountryInputInFocusUpdate,
handleCountryInputBlurUpdate: handleCountryInputBlurUpdate,
handleCountryInputUpdate: handleCountryInputUpdate,
countryInputFocus: countryInputFocus,
countryInputValue: countryInputValue,
handleStateInputInFocusUpdate: handleStateInputInFocusUpdate,
handleStateInputBlurUpdate: handleStateInputBlurUpdate,
handleStateInputUpdate: handleStateInputUpdate,
stateInputFocus: stateInputFocus,
stateInputValue: stateInputValue,
handleCityInputInFocusUpdate: handleCityInputInFocusUpdate,
handleCityInputBlurUpdate: handleCityInputBlurUpdate,
handleCityInputUpdate: handleCityInputUpdate,
cityInputFocus: cityInputFocus,
cityInputValue: cityInputValue,
handlePhoneNumberInputInFocusUpdate: handlePhoneNumberInputInFocusUpdate,
handlePhoneNumberInputBlurUpdate: handlePhoneNumberInputBlurUpdate,
handlePhoneNumberInputUpdate: handlePhoneNumberInputUpdate,
phoneNumberInputFocus: phoneNumberInputFocus,
setPhoneNumberInputValue: setPhoneNumberInputValue,
phoneNumberInputValue: phoneNumberInputValue,
setCheckoutButtonHover: setCheckoutButtonHover,
checkoutButtonHover: checkoutButtonHover,
setProcessingPaymentIndicator: setProcessingPaymentIndicator,
processingPaymentIndicator: processingPaymentIndicator,
setProcessingPayment: setProcessingPayment,
processingPayment: processingPayment,
setPaymentApproval: setPaymentApproval,
paymentApproval: paymentApproval,
setCardExpirationDateComplete: setCardExpirationDateComplete,
cardExpirationDateComplete: cardExpirationDateComplete,
setCardNumberComplete: setCardNumberComplete,
cardNumberComplete: cardNumberComplete,
setCVCComplete: setCVCComplete,
cardCVCComplete: cardCVCComplete,
setCardNumberDisplay: setCardNumberDisplay,
cardNumberDisplay: cardNumberDisplay,
paymentCompletion: paymentCompletion,
paymentAccessURL: paymentAccessURL,
paymentMessage: paymentMessage,
paymentType: paymentType,
certificateData: certificateData,
setCardBrand: setCardBrand,
cardBrand: cardBrand,
product: product,
cardNumberInputRef: cardNumberInputRef,
checkoutDetailsRef: checkoutDetailsRef,
updateCurrentScrollPosition: updateCurrentScrollPosition,
hudPaymentComponentStyle: hudPaymentComponentStyle,
handleCardNumberOnReady: handleCardNumberOnReady,
handleCardNumberUpdate: handleCardNumberUpdate,
handleCardExpirationDateUpdate: handleCardExpirationDateUpdate,
handleCardCVCUpdate: handleCardCVCUpdate
})) : /*#__PURE__*/React.createElement(React.Fragment, null));
}
export default HUDPaymentDetails;