diff --git a/CHANGELOG.md b/CHANGELOG.md index ba05763d..f09bbcbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added +- Schema to the `checkout button`, this makes it possible to define via admin where the user will be directed after the click + ## [2.63.5] - 2022-07-28 ### Fixed diff --git a/react/CheckoutButton.tsx b/react/CheckoutButton.tsx index 49e581cb..f09b481e 100644 --- a/react/CheckoutButton.tsx +++ b/react/CheckoutButton.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react' +import React from 'react' import { FormattedMessage } from 'react-intl' import { Button } from 'vtex.styleguide' import { CssHandlesTypes, useCssHandles } from 'vtex.css-handles' @@ -13,7 +13,10 @@ interface Props { classes?: CssHandlesTypes.CustomClasses } -const CheckoutButton: FC = ({ finishShoppingButtonLink, classes }) => { +const CheckoutButton: StoreFunctionComponent = ({ + finishShoppingButtonLink, + classes, +}): JSX.Element => { const { url: checkoutUrl } = useCheckoutURL() const { handles } = useCssHandles(CSS_HANDLES, { classes }) const goToCheckout = useCheckout() @@ -32,4 +35,8 @@ const CheckoutButton: FC = ({ finishShoppingButtonLink, classes }) => { ) } +CheckoutButton.schema = { + title: 'store/finish-shopping-button-label', +} + export default CheckoutButton diff --git a/react/typings/global.d.ts b/react/typings/global.d.ts new file mode 100644 index 00000000..78b1bbf1 --- /dev/null +++ b/react/typings/global.d.ts @@ -0,0 +1,28 @@ +import { FC } from 'react' + +declare global { + interface StoreFunctionComponent

extends FC

{ + schema?: object + } + + type QuantityDisplayType = 'always' | 'never' | 'not-empty' + + type MinicartTotalItemsType = + | 'total' + | 'distinct' + | 'totalAvailable' + | 'distinctAvailable' + + type SlideDirectionType = + | 'horizontal' + | 'vertical' + | 'rightToLeft' + | 'leftToRight' + + type MinicartVariationType = + | 'popup' + | 'drawer' + | 'link' + | 'popupWithLink' + | 'block' +} diff --git a/react/typings/global.ts b/react/typings/global.ts deleted file mode 100644 index 31ca3a4f..00000000 --- a/react/typings/global.ts +++ /dev/null @@ -1,20 +0,0 @@ -type QuantityDisplayType = 'always' | 'never' | 'not-empty' - -type MinicartTotalItemsType = - | 'total' - | 'distinct' - | 'totalAvailable' - | 'distinctAvailable' - -type SlideDirectionType = - | 'horizontal' - | 'vertical' - | 'rightToLeft' - | 'leftToRight' - -type MinicartVariationType = - | 'popup' - | 'drawer' - | 'link' - | 'popupWithLink' - | 'block' diff --git a/store/interfaces.json b/store/interfaces.json index 8ee2313c..eb84dfb2 100644 --- a/store/interfaces.json +++ b/store/interfaces.json @@ -22,7 +22,17 @@ "allowed": ["product-list"] }, "minicart-checkout-button": { - "component": "CheckoutButton" + "component": "CheckoutButton", + "content": { + "title": "store/finish-shopping-button-label", + "properties": { + "finishShoppingButtonLink": { + "type": "string", + "title": "admin/editor.minicart.linkButtonFinishShopping.title", + "default": "/checkout/#/cart" + } + } + } }, "minicart-summary": { "component": "Summary",