@shopgate/engage
Version:
Shopgate's ENGAGE library.
46 lines (45 loc) • 1.34 kB
JavaScript
import React, { useMemo } from 'react';
import PropTypes from 'prop-types';
import { i18n } from '@shopgate/engage/core';
import { RippleButton } from '@shopgate/engage/components';
import { useRegistration } from "../../hooks";
import { submitButton, submitButtonContainer } from "./RegistrationContent.style";
/**
* PickupContactForm
* @param {Object} props The component props
* @returns {JSX}
*/
import { jsx as _jsx } from "react/jsx-runtime";
const RegisterFormActions = ({
isGuest
}) => {
const {
handleSubmit,
isLocked,
guestRegistrationEditMode,
orderNeedsPayment
} = useRegistration(isGuest);
const label = useMemo(() => {
if (isGuest) {
if (guestRegistrationEditMode) {
return 'checkout.billing.save';
}
return orderNeedsPayment ? 'checkout.continue_payment' : 'checkout.continue';
}
return 'registration.create_account';
}, [guestRegistrationEditMode, isGuest, orderNeedsPayment]);
return /*#__PURE__*/_jsx("div", {
className: submitButtonContainer,
children: /*#__PURE__*/_jsx(RippleButton, {
type: "secondary",
onClick: handleSubmit,
disabled: isLocked,
className: submitButton,
children: i18n.text(label)
})
});
};
RegisterFormActions.defaultProps = {
isGuest: false
};
export default RegisterFormActions;