Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds the ability to set name and email as required fields #98

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.13.2] - 2024-05-26

### Added
- adds the ability to set name and email as required fields

## [Unreleased]

## [1.13.1] - 2024-04-30
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "availability-notify",
"vendor": "vtex",
"version": "1.13.1",
"version": "1.13.2",
"title": "Availability Notify",
"description": "Record and send notification when an item is back in stock",
"scripts": {
Expand Down
9 changes: 9 additions & 0 deletions react/AvailabilityNotifier.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ interface Props {
available?: boolean
/* SKU id to notify to */
skuId?: string
nameRequired: boolean
emailRequired: boolean
}

export interface SellerObj {
Expand Down Expand Up @@ -185,6 +187,7 @@ function AvailabilityNotifier(props: Props) {
})}
value={name}
onChange={handleNameChange}
required={props.nameRequired}
/>
</div>
<div className={`${styles.input} ${styles.inputEmail} w-100 mr5 mb4`}>
Expand All @@ -199,6 +202,7 @@ function AvailabilityNotifier(props: Props) {
onBlur={() => setDidBlurEmail(true)}
error={didBlurEmail && emailError}
errorMessage={emailErrorMessage}
required={props.emailRequired}
/>
</div>
<div className={`${styles.submit} flex items-center mb4`}>
Expand Down Expand Up @@ -241,4 +245,9 @@ function AvailabilityNotifier(props: Props) {
)
}

AvailabilityNotifier.defaultProps = {
nameRequired: false,
emailRequired: false,
}

export default AvailabilityNotifier