@evenicanpm/storefront-core 1.0.0 → 1.0.1

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.
Files changed (133) hide show
  1. package/package.json +3 -2
  2. package/src/api-manager/datasources/d365/d365-address.datasource.ts +1 -1
  3. package/src/api-manager/datasources/d365/d365-user.datasource.ts +0 -19
  4. package/src/api-manager/datasources/e4/e4-cart.datasource.ts +2 -2
  5. package/src/api-manager/datasources/e4/e4-product.datasource.ts +19 -4
  6. package/src/api-manager/datasources/e4/e4.datasource.ts +1 -2
  7. package/src/api-manager/datasources/e4/e4.remaps.ts +24 -0
  8. package/src/api-manager/datasources/e4/e4.translator.ts +17 -0
  9. package/src/api-manager/datasources/e4/{e4-user.datasource.ts → user/e4-user.datasource.ts} +5 -7
  10. package/src/api-manager/datasources/e4/user/e4-user.remaps.ts +4 -0
  11. package/src/api-manager/datasources/e4/user/e4-user.translator.ts +10 -0
  12. package/src/api-manager/index.ts +21 -6
  13. package/src/api-manager/schemas/product.schema.ts +1 -1
  14. package/src/api-manager/services/address/queries/get-states.ts +1 -1
  15. package/src/api-manager/services/create-query.ts +10 -3
  16. package/src/api-manager/types/Datasource.ts +9 -9
  17. package/src/components/Blocks/Components/ProductCarousel/index.tsx +6 -6
  18. package/src/components/_components/navbar/category-based-menu/components/categories.tsx +1 -1
  19. package/src/components/_components/navbar/mega-menu/mega-menu.tsx +1 -1
  20. package/src/components/_components/navbar/nav-list/nav-item-child.tsx +2 -2
  21. package/src/components/_components/product-dimensions/product-dimensions.tsx +114 -0
  22. package/src/components/_components/product-quantity-buttons/product-quantity-buttons.tsx +88 -0
  23. package/src/components/_components/section-header/section-header.tsx +1 -1
  24. package/src/components/_components/settings/setting.tsx +1 -1
  25. package/src/components/_components/wishlist-modal/TODO.md +10 -0
  26. package/src/components/_components/wishlist-modal/add-to-wishlist-button.tsx +68 -0
  27. package/src/components/_components/wishlist-modal/add-to-wishlist-dialog.tsx +161 -0
  28. package/src/components/_components/wishlist-modal/remove-from-wishlist-dialog.tsx +174 -0
  29. package/src/components/_components/wishlist-modal/wishlist-modal-item.tsx +65 -0
  30. package/src/components/countries-input.tsx +1 -0
  31. package/src/hooks/use-cart.tsx +82 -0
  32. package/src/hooks/use-variants.tsx +85 -0
  33. package/src/pages/account/addresses/address-form.tsx +289 -0
  34. package/src/pages/account/addresses/address-item.tsx +104 -0
  35. package/src/pages/account/dashboard-header.tsx +123 -0
  36. package/src/pages/account/navigation.tsx +84 -0
  37. package/src/pages/account/no-records.tsx +20 -0
  38. package/src/pages/account/orders/icons/delivery.tsx +14 -0
  39. package/src/pages/account/orders/icons/package-box.tsx +13 -0
  40. package/src/pages/account/orders/icons/truck-filled.tsx +14 -0
  41. package/src/pages/account/orders/order-progress.tsx +111 -0
  42. package/src/pages/account/orders/order-row.tsx +61 -0
  43. package/src/pages/account/orders/order-summary.tsx +83 -0
  44. package/src/pages/account/orders/ordered-products.tsx +114 -0
  45. package/src/pages/account/profile/profile-button.test.tsx +59 -0
  46. package/src/pages/account/profile/profile-button.tsx +50 -0
  47. package/src/pages/account/profile/user-info.tsx +59 -0
  48. package/src/pages/account/styles.ts +32 -0
  49. package/src/pages/account/table-row.tsx +19 -0
  50. package/src/pages/account/wishlist/create-new-list.tsx +167 -0
  51. package/src/pages/account/wishlist/create-wishlist-button.tsx +40 -0
  52. package/src/pages/account/wishlist/wishlist-item.tsx +82 -0
  53. package/src/pages/blog/pagination.tsx +38 -0
  54. package/src/pages/cart/cart-item.tsx +312 -0
  55. package/src/pages/cart/checkout-form.tsx +122 -0
  56. package/src/pages/cart/coupon-entry.tsx +90 -0
  57. package/src/pages/cart/estimate-shipping.tsx +183 -0
  58. package/src/pages/cart/wrapper.tsx +30 -0
  59. package/src/pages/checkout/checkout-alt-form/address-card.tsx +73 -0
  60. package/src/pages/checkout/checkout-alt-form/checkout-form.tsx +133 -0
  61. package/src/pages/checkout/checkout-alt-form/checkout-step.tsx +120 -0
  62. package/src/pages/checkout/checkout-alt-form/customer-information.tsx +94 -0
  63. package/src/pages/checkout/checkout-alt-form/delivery-address.tsx +170 -0
  64. package/src/pages/checkout/checkout-alt-form/delivery-date.tsx +114 -0
  65. package/src/pages/checkout/checkout-alt-form/delivery-options.tsx +186 -0
  66. package/src/pages/checkout/checkout-alt-form/edit-address-form.tsx +130 -0
  67. package/src/pages/checkout/checkout-alt-form/heading.tsx +50 -0
  68. package/src/pages/checkout/checkout-alt-form/index.ts +1 -0
  69. package/src/pages/checkout/checkout-alt-form/new-address-form.tsx +294 -0
  70. package/src/pages/checkout/checkout-alt-form/node.tsx +9 -0
  71. package/src/pages/checkout/checkout-alt-form/payment-details.tsx +344 -0
  72. package/src/pages/checkout/checkout-alt-form/safe-card-preview-data.tsx +36 -0
  73. package/src/pages/checkout/checkout-alt-form/types.ts +20 -0
  74. package/src/pages/checkout/checkout-alt-summary/cart-item.tsx +39 -0
  75. package/src/pages/checkout/checkout-alt-summary/checkout-alt-summary.tsx +40 -0
  76. package/src/pages/checkout/checkout-alt-summary/index.ts +1 -0
  77. package/src/pages/checkout/checkout-alt-summary/list-item.tsx +31 -0
  78. package/src/pages/confirmation/address.tsx +22 -0
  79. package/src/pages/confirmation/confirmation-summary.tsx +52 -0
  80. package/src/pages/confirmation/ordered-products.tsx +108 -0
  81. package/src/pages/product-details/available-shops.tsx +48 -0
  82. package/src/pages/product-details/bopis/find-in-store-button.tsx +63 -0
  83. package/src/pages/product-details/bopis/find-in-store-modal.tsx +257 -0
  84. package/src/pages/product-details/bopis/pickup-option-select.tsx +127 -0
  85. package/src/pages/product-details/bopis/search-header.tsx +69 -0
  86. package/src/pages/product-details/checkbox-label.tsx +20 -0
  87. package/src/pages/product-details/currency.ts +64 -0
  88. package/src/pages/product-details/frequently-bought.tsx +90 -0
  89. package/src/pages/product-details/frequently-product-card.tsx +60 -0
  90. package/src/pages/product-details/product-comment.tsx +44 -0
  91. package/src/pages/product-details/product-description.tsx +22 -0
  92. package/src/pages/product-details/product-filter-card.tsx +257 -0
  93. package/src/pages/product-details/product-intro/product-intro-images.tsx +87 -0
  94. package/src/pages/product-details/product-intro/product-intro.tsx +250 -0
  95. package/src/pages/product-details/product-review.tsx +131 -0
  96. package/src/pages/product-details/product-tabs.tsx +51 -0
  97. package/src/pages/product-details/related-products.tsx +42 -0
  98. package/src/pages/product-details/types.ts +11 -0
  99. package/src/pages/product-list/breadcrumbs.tsx +39 -0
  100. package/src/pages/product-list/checkbox-label.tsx +20 -0
  101. package/src/pages/product-list/facet-group.tsx +125 -0
  102. package/src/pages/product-list/facet.tsx +36 -0
  103. package/src/pages/product-list/list-filter.tsx +40 -0
  104. package/src/pages/product-list/pagination.tsx +80 -0
  105. package/src/pages/product-list/product-list-context.tsx +302 -0
  106. package/src/pages/product-list/product-list-state.ts +187 -0
  107. package/src/pages/product-list/product-rating.tsx +16 -0
  108. package/src/pages/product-list/quick-view-dialog-content.tsx +205 -0
  109. package/src/pages/product-list/quick-view-dialog.tsx +54 -0
  110. package/src/pages/product-list/range-filter.tsx +125 -0
  111. package/src/pages/product-list/scrollbar.tsx +38 -0
  112. package/src/pages/product-list/search-bar.tsx +162 -0
  113. package/src/pages/product-list/selected-facets.tsx +80 -0
  114. package/src/pages/product-list/side-nav.tsx +49 -0
  115. package/src/pages/product-list/swatch.tsx +80 -0
  116. package/src/pages/product-list/types.ts +18 -0
  117. package/src/pages/product-list/use-product-list.ts +12 -0
  118. package/src/pages/product-list/useCategoryFilter.tsx +26 -0
  119. package/src/pages/product-list/utils/facet-helpers.ts +5 -0
  120. package/src/pages/product-list/utils/generate-breadcrumbs.ts +30 -0
  121. package/src/pages/product-list/utils/getCategoryFilterFromSlug.ts +153 -0
  122. package/src/pages/product-list/utils/product-list-helper.ts +111 -0
  123. package/src/pages/product-list/utils/product-list-types.ts +41 -0
  124. package/src/pages/product-list/utils/search-for-category.ts +76 -0
  125. package/src/pages/product-list/utils/sort-options.ts +44 -0
  126. package/src/pages/product-list/utils/use-previous-refiners.ts +14 -0
  127. package/src/pages/quickorder/order-upload.tsx +150 -0
  128. package/src/pages/quickorder/quick-order-form.tsx +343 -0
  129. package/src/pages/quickorder/quick-order-row.tsx +144 -0
  130. package/tsconfig.json +1 -0
  131. package/src/api-manager/datasources/e4/graphqlRequestSdk.ts +0 -10464
  132. /package/src/{components/_components/hooks/useOverflowDetect.ts → hooks/use-overflow-detect.ts} +0 -0
  133. /package/src/{components/_components/hooks/useSettings.ts → hooks/use-settings.ts} +0 -0
@@ -0,0 +1,130 @@
1
+ import { useState } from "react";
2
+ import Grid from "@mui/material/Grid2";
3
+ import Dialog from "@mui/material/Dialog";
4
+ import Button from "@mui/material/Button";
5
+ import TextField from "@mui/material/TextField";
6
+ import DialogContent from "@mui/material/DialogContent";
7
+ import { useFormik } from "formik";
8
+ import * as yup from "yup";
9
+ // GLOBAL CUSTOM COMPONENT
10
+ import { H5 } from "@/components/_components/Typography";
11
+
12
+ import { Address } from "./types";
13
+
14
+ const validationSchema = yup.object({
15
+ address2: yup.string(),
16
+ name: yup.string().required("Name is required!"),
17
+ address1: yup.string().required("Address is required!"),
18
+ phone: yup.number().required("Phone is required!"),
19
+ });
20
+
21
+ // ================================================================
22
+ interface Props {
23
+ active: boolean;
24
+ address: Address;
25
+ changeEditAddressId: () => void;
26
+ handleEditAddress: (id: number, data: Address) => void;
27
+ }
28
+ // ================================================================
29
+
30
+ export default function EditAddressForm(props: Props) {
31
+ const { active, address, changeEditAddressId, handleEditAddress } = props;
32
+
33
+ const [openModal, setOpenModal] = useState(active);
34
+
35
+ const handleCloseModal = () => {
36
+ setOpenModal(false);
37
+ changeEditAddressId();
38
+ };
39
+
40
+ const initialValues = {
41
+ name: address.name,
42
+ phone: address.phone,
43
+ street1: address.street1,
44
+ street2: address.street2,
45
+ };
46
+
47
+ const { values, touched, errors, handleBlur, handleChange, handleSubmit } =
48
+ useFormik({
49
+ initialValues,
50
+ validationSchema,
51
+ onSubmit: (values) => {
52
+ handleEditAddress(address.id, { ...values, id: address.id });
53
+ handleCloseModal();
54
+ },
55
+ });
56
+
57
+ return (
58
+ <Dialog open={openModal} onClose={handleCloseModal} sx={{ zIndex: 99999 }}>
59
+ <DialogContent>
60
+ <H5 mb={4}>Edit Address Information</H5>
61
+
62
+ <form onSubmit={handleSubmit}>
63
+ <Grid container spacing={3}>
64
+ <Grid size={{ sm: 6, xs: 12 }}>
65
+ <TextField
66
+ fullWidth
67
+ name="name"
68
+ type="text"
69
+ label="Enter Your Name"
70
+ value={values.name}
71
+ onBlur={handleBlur}
72
+ onChange={handleChange}
73
+ helperText={touched.name && errors.name}
74
+ error={touched.name && Boolean(errors.name)}
75
+ />
76
+ </Grid>
77
+
78
+ <Grid size={{ sm: 6, xs: 12 }}>
79
+ <TextField
80
+ fullWidth
81
+ type="text"
82
+ name="street1"
83
+ label="Address line 1"
84
+ onBlur={handleBlur}
85
+ value={values.street1}
86
+ onChange={handleChange}
87
+ helperText={touched.street1 && errors.street1}
88
+ error={touched.street1 && Boolean(errors.street1)}
89
+ />
90
+ </Grid>
91
+
92
+ <Grid size={{ sm: 6, xs: 12 }}>
93
+ <TextField
94
+ fullWidth
95
+ type="text"
96
+ name="street2"
97
+ label="Address line 2"
98
+ onBlur={handleBlur}
99
+ value={values.street2}
100
+ onChange={handleChange}
101
+ helperText={touched.street2 && errors.street2}
102
+ error={touched.street2 && Boolean(errors.street2)}
103
+ />
104
+ </Grid>
105
+
106
+ <Grid size={{ sm: 6, xs: 12 }}>
107
+ <TextField
108
+ fullWidth
109
+ type="text"
110
+ name="phone"
111
+ label="Enter Your Phone"
112
+ onBlur={handleBlur}
113
+ value={values.phone}
114
+ onChange={handleChange}
115
+ helperText={touched.phone && errors.phone}
116
+ error={touched.phone && Boolean(errors.phone)}
117
+ />
118
+ </Grid>
119
+
120
+ <Grid size={{ sm: 6, xs: 12 }}>
121
+ <Button color="primary" variant="contained" type="submit">
122
+ Save
123
+ </Button>
124
+ </Grid>
125
+ </Grid>
126
+ </form>
127
+ </DialogContent>
128
+ </Dialog>
129
+ );
130
+ }
@@ -0,0 +1,50 @@
1
+ import { BoxProps } from "@mui/material/Box";
2
+ import Avatar from "@mui/material/Avatar";
3
+ import { FlexBox } from "@/components/_components/flex-box";
4
+ import { Paragraph } from "@/components/_components/Typography";
5
+ import { StepViewState } from "./checkout-step";
6
+
7
+ // ==============================================================
8
+ interface Props extends BoxProps {
9
+ title: string;
10
+ number: number;
11
+ stepViewState: StepViewState;
12
+ }
13
+ // ==============================================================
14
+
15
+ export default function Heading({
16
+ number,
17
+ title,
18
+ stepViewState,
19
+ ...props
20
+ }: Props) {
21
+ let viewStateColor;
22
+
23
+ switch (stepViewState) {
24
+ case "active":
25
+ viewStateColor = "primary.main";
26
+ break;
27
+ case "preview":
28
+ viewStateColor = "success.main";
29
+ break;
30
+ case "pending":
31
+ viewStateColor = "secondary.main";
32
+ break;
33
+ }
34
+ // AVATAR STYLES
35
+ const STYLES = {
36
+ width: 32,
37
+ height: 32,
38
+ color: "primary.text",
39
+ backgroundColor: viewStateColor,
40
+ };
41
+
42
+ return (
43
+ <FlexBox gap={1.5} alignItems="center" mb={3.5} {...props}>
44
+ <Avatar alt={title} sx={STYLES}>
45
+ {number}
46
+ </Avatar>
47
+ <Paragraph fontSize={20}>{title}</Paragraph>
48
+ </FlexBox>
49
+ );
50
+ }
@@ -0,0 +1 @@
1
+ export { default as CheckoutForm } from "./checkout-form";
@@ -0,0 +1,294 @@
1
+ import React from "react";
2
+ import Grid from "@mui/material/Grid2";
3
+ import Button from "@mui/material/Button";
4
+ import Dialog from "@mui/material/Dialog";
5
+ import TextField from "@mui/material/TextField";
6
+ import DialogContent from "@mui/material/DialogContent";
7
+ // React hook form
8
+ import { Controller, useForm } from "react-hook-form";
9
+ import { zodResolver } from "@hookform/resolvers/zod";
10
+ import z from "zod";
11
+ // LOCAL CUSTOM COMPONENT
12
+ import { H5 } from "@/components/_components/Typography";
13
+ import { Address } from "@/api-manager/schemas/address.schema";
14
+ import { useTranslations } from "use-intl";
15
+ import { Box, FormControl, InputLabel, MenuItem, Select } from "@mui/material";
16
+ import { CountryRegionInfo } from "@msdyn365-commerce/retail-proxy";
17
+ import getStates from "@/api-manager/services/address/queries/get-states";
18
+ import { Paragraph } from "@/components/_components/Typography";
19
+ import { FlexBox } from "@/components/_components/flex-box";
20
+ import { merge } from "lodash";
21
+
22
+ interface Props {
23
+ address?: Address;
24
+ countries: CountryRegionInfo[];
25
+ cartId: string;
26
+ open: boolean;
27
+ handleClose: () => void;
28
+ handleCreateOrUpdateAddress: (address: Address) => void;
29
+ isGuest: boolean;
30
+ }
31
+
32
+ type AddressFormInput = {
33
+ name: string;
34
+ street: string;
35
+ city: string;
36
+ state: string;
37
+ zipCode: string;
38
+ country: string;
39
+ phone: string | null;
40
+ };
41
+
42
+ export default function NewAddressForm({
43
+ address,
44
+ countries,
45
+ isGuest,
46
+ open,
47
+ handleClose,
48
+ handleCreateOrUpdateAddress,
49
+ }: Props) {
50
+ const t = useTranslations("Address");
51
+ const defaultCountry = React.useMemo(
52
+ () =>
53
+ countries.find(
54
+ (c) => c.CountryRegionId === (address?.ThreeLetterISORegionName ?? ""),
55
+ ),
56
+ [countries, address],
57
+ );
58
+
59
+ const [selectedCountry, setSelectedCountry] =
60
+ React.useState<CountryRegionInfo | null>(defaultCountry ?? null);
61
+
62
+ const { data: states } = getStates.useData({
63
+ countryId: selectedCountry?.CountryRegionId,
64
+ });
65
+
66
+ React.useEffect(() => {
67
+ if (address && defaultCountry) {
68
+ setSelectedCountry(defaultCountry);
69
+ }
70
+ }, [address, defaultCountry]);
71
+
72
+ const validationSchema = z.object({
73
+ name: z
74
+ .string()
75
+ .min(1, { message: t("Validation.required", { field: t("name") }) }),
76
+ street: z
77
+ .string()
78
+ .min(1, { message: t("Validation.required", { field: t("street") }) }),
79
+ city: z
80
+ .string()
81
+ .min(1, { message: t("Validation.required", { field: t("city") }) }),
82
+ state: z
83
+ .string()
84
+ .min(1, { message: t("Validation.required", { field: t("state") }) }),
85
+ zipCode: z
86
+ .string()
87
+ .min(1, { message: t("Validation.required", { field: t("zipCode") }) }),
88
+ country: z
89
+ .string()
90
+ .min(1, { message: t("Validation.required", { field: t("country") }) }),
91
+ phone: z.string().optional().default(""),
92
+ });
93
+
94
+ const {
95
+ register,
96
+ handleSubmit,
97
+ formState: { errors },
98
+ control,
99
+ setValue,
100
+ reset,
101
+ } = useForm<AddressFormInput>({
102
+ defaultValues: {
103
+ name: "",
104
+ street: "",
105
+ city: "",
106
+ state: "0",
107
+ zipCode: "",
108
+ phone: "",
109
+ country: selectedCountry?.CountryRegionId || "",
110
+ },
111
+ resolver: zodResolver(validationSchema),
112
+ });
113
+
114
+ React.useEffect(() => {
115
+ setValue("country", selectedCountry?.CountryRegionId || "");
116
+ if (!address) {
117
+ setValue("state", "0");
118
+ }
119
+ }, [selectedCountry, setValue, address]);
120
+
121
+ React.useEffect(() => {
122
+ if (!open) {
123
+ reset();
124
+ setSelectedCountry(defaultCountry ?? null);
125
+ }
126
+ }, [defaultCountry, open, reset]);
127
+
128
+ React.useEffect(() => {
129
+ if (address) {
130
+ setValue("name", address.Name || "");
131
+ setValue("street", address.Street || "");
132
+ setValue("city", address.City || "");
133
+ setValue("state", address.State || "0");
134
+ setValue("zipCode", address.ZipCode || "");
135
+ setValue("phone", address.Phone || "");
136
+ setValue("country", address.ThreeLetterISORegionName || "");
137
+ } else {
138
+ reset();
139
+ }
140
+ }, [address, setValue, reset]);
141
+
142
+ const onFormSubmit = (data: AddressFormInput) => {
143
+ const tempAddress: Address = {
144
+ Name: data.name,
145
+ Street: data.street,
146
+ City: data.city,
147
+ State: data.state,
148
+ ZipCode: data.zipCode,
149
+ TwoLetterISORegionName: selectedCountry?.ISOCode,
150
+ ThreeLetterISORegionName: selectedCountry?.CountryRegionId,
151
+ Phone: data.phone || undefined,
152
+ };
153
+ const newAddress = merge({}, address || {}, tempAddress);
154
+ handleCreateOrUpdateAddress(newAddress);
155
+ handleClose();
156
+ };
157
+
158
+ return (
159
+ <Dialog open={open} onClose={handleClose}>
160
+ <DialogContent>
161
+ <H5 mb={4}>{t("title")}</H5>
162
+ {isGuest && !address && (
163
+ <FlexBox justifyContent="center" mb={2}>
164
+ <Paragraph color={(theme) => theme.palette.error.main}>
165
+ {t("guestCartAddressWarning")}
166
+ </Paragraph>
167
+ </FlexBox>
168
+ )}
169
+ <Box component="form" onSubmit={handleSubmit(onFormSubmit)}>
170
+ <Grid container spacing={3}>
171
+ <Grid size={{ sm: 6, xs: 12 }}>
172
+ <TextField
173
+ {...register("name")}
174
+ label={t("name")}
175
+ fullWidth
176
+ error={!!errors.name}
177
+ helperText={errors.name?.message}
178
+ />
179
+ </Grid>
180
+
181
+ <Grid size={{ sm: 6, xs: 12 }}>
182
+ <TextField
183
+ {...register("street")}
184
+ label={t("street")}
185
+ fullWidth
186
+ error={!!errors.street}
187
+ helperText={errors.street?.message}
188
+ />
189
+ </Grid>
190
+
191
+ <Grid size={{ sm: 6, xs: 12 }}>
192
+ <TextField
193
+ {...register("city")}
194
+ label={t("city")}
195
+ fullWidth
196
+ error={!!errors.city}
197
+ helperText={errors.city?.message}
198
+ />
199
+ </Grid>
200
+ <Grid size={{ sm: 6, xs: 12 }}>
201
+ <FormControl fullWidth size={"small"} error={!!errors.country}>
202
+ <InputLabel id="country-label">{t("country")}</InputLabel>
203
+ <Controller
204
+ name="country"
205
+ control={control}
206
+ render={({ field: { value } }) => (
207
+ <Select
208
+ labelId="country-label"
209
+ value={value}
210
+ onChange={(e) => {
211
+ const cid = e.target.value as string;
212
+ const sel =
213
+ countries.find((c) => c.CountryRegionId === cid) ||
214
+ null;
215
+ setSelectedCountry(sel);
216
+ }}
217
+ >
218
+ <MenuItem value="">Select country</MenuItem>
219
+ {countries.map((c) => (
220
+ <MenuItem
221
+ key={c.CountryRegionId}
222
+ value={c.CountryRegionId}
223
+ >
224
+ {c.ShortName}
225
+ </MenuItem>
226
+ ))}
227
+ </Select>
228
+ )}
229
+ />
230
+ </FormControl>
231
+ </Grid>
232
+ <Grid size={{ sm: 6, xs: 12 }}>
233
+ <FormControl fullWidth size={"small"} error={!!errors.state}>
234
+ <InputLabel id="state-label">{t("state")}</InputLabel>
235
+ <Controller
236
+ name="state"
237
+ control={control}
238
+ render={({ field: { value, onChange } }) => (
239
+ <Select
240
+ labelId="state-label"
241
+ value={value}
242
+ onChange={onChange}
243
+ >
244
+ <MenuItem value="0">Select a state</MenuItem>
245
+ {states &&
246
+ states.length > 0 &&
247
+ states.map(({ StateName, StateId }) => (
248
+ <MenuItem key={StateId} value={StateId}>
249
+ {StateName}
250
+ </MenuItem>
251
+ ))}
252
+ </Select>
253
+ )}
254
+ />
255
+ </FormControl>
256
+ </Grid>
257
+
258
+ <Grid size={{ sm: 6, xs: 12 }}>
259
+ <TextField
260
+ {...register("zipCode")}
261
+ label={t("zipCode")}
262
+ fullWidth
263
+ error={!!errors.zipCode}
264
+ helperText={errors.zipCode?.message}
265
+ />
266
+ </Grid>
267
+
268
+ <Grid size={{ sm: 6, xs: 12 }}>
269
+ <TextField
270
+ {...register("phone")}
271
+ label={t("phone")}
272
+ fullWidth
273
+ error={!!errors.phone}
274
+ helperText={errors.phone?.message}
275
+ />
276
+ </Grid>
277
+ <Grid
278
+ size={{ sm: 6, xs: 12 }}
279
+ display="flex"
280
+ justifyContent="space-around"
281
+ >
282
+ <Button type="submit" color="primary" variant="contained" onClick={onFormSubmit} data-testid="new-address-btn">
283
+ {t("save")}
284
+ </Button>
285
+ <Button onClick={handleClose} color="primary" variant="outlined">
286
+ {t("cancel")}
287
+ </Button>
288
+ </Grid>
289
+ </Grid>
290
+ </Box>
291
+ </DialogContent>
292
+ </Dialog>
293
+ );
294
+ }
@@ -0,0 +1,9 @@
1
+ interface NodeProps {
2
+ className: string;
3
+ children?: React.ReactNode;
4
+ tag: keyof React.JSX.IntrinsicElements;
5
+ [x: string]: React.ReactNode | undefined;
6
+ }
7
+
8
+ export declare const Node: React.FC<NodeProps>;
9
+ export default Node;