@vtex/faststore-plugin-buyer-portal 1.1.100 → 1.1.101
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.
- package/package.json +1 -1
- package/src/features/addresses/clients/AddressesClient.ts +2 -0
- package/src/features/addresses/components/AddressForm/AddressForm.tsx +20 -0
- package/src/features/addresses/components/CreateAddressDrawer/CreateAddressDrawer.tsx +14 -10
- package/src/features/addresses/components/EditAddressDrawer/EditAddressDrawer.tsx +8 -3
- package/src/features/addresses/types/AddressData.ts +2 -0
- package/src/features/credit-cards/components/CreateCreditCardDrawer/CreateCreditCardDrawer.tsx +14 -10
- package/src/features/credit-cards/services/tokenize-credit-card.service.ts +1 -1
- package/src/features/shared/utils/addresLabelToPropMapping.ts +1 -1
package/package.json
CHANGED
|
@@ -104,6 +104,7 @@ export default class AddressesClient extends Client {
|
|
|
104
104
|
streetAddress: data.streetAddress,
|
|
105
105
|
neighborhood: data?.neighborhood ?? "",
|
|
106
106
|
streetAddress2: data.streetAddress2,
|
|
107
|
+
streetNumber: data.streetNumber ?? "",
|
|
107
108
|
city: data.city,
|
|
108
109
|
state: data.state,
|
|
109
110
|
country: data.countryCode,
|
|
@@ -137,6 +138,7 @@ export default class AddressesClient extends Client {
|
|
|
137
138
|
streetAddress: data.streetAddress,
|
|
138
139
|
neighborhood: data?.neighborhood ?? "",
|
|
139
140
|
streetAddress2: data.streetAddress2,
|
|
141
|
+
number: data.streetNumber ?? "",
|
|
140
142
|
city: data.city,
|
|
141
143
|
state: data.state,
|
|
142
144
|
country: data.countryCode,
|
|
@@ -193,6 +193,26 @@ export const AddressForm = ({
|
|
|
193
193
|
message="Street Address is required"
|
|
194
194
|
/>
|
|
195
195
|
|
|
196
|
+
{address.countryCode === "BRA" && (
|
|
197
|
+
<>
|
|
198
|
+
<InputText
|
|
199
|
+
type="number"
|
|
200
|
+
label="Number"
|
|
201
|
+
value={address.streetNumber || ""}
|
|
202
|
+
className="address-number"
|
|
203
|
+
hasError={isTouched && !address.streetNumber?.trim()}
|
|
204
|
+
onChange={(event) =>
|
|
205
|
+
setAddress({ ...address, streetNumber: event.target.value })
|
|
206
|
+
}
|
|
207
|
+
/>
|
|
208
|
+
|
|
209
|
+
<ErrorMessage
|
|
210
|
+
show={isTouched && !address.streetNumber?.trim()}
|
|
211
|
+
message="Number is required"
|
|
212
|
+
/>
|
|
213
|
+
</>
|
|
214
|
+
)}
|
|
215
|
+
|
|
196
216
|
<InputText
|
|
197
217
|
label="Apt, Suite, Building (optional)"
|
|
198
218
|
className="street-address2"
|
|
@@ -97,16 +97,20 @@ export const CreateAddressDrawer = ({
|
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
const hasMinimumAddressInformation = () => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
100
|
+
const isBrazil = address.countryCode === "BRA";
|
|
101
|
+
const hasRequiredFields =
|
|
102
|
+
address.name &&
|
|
103
|
+
address.streetAddress &&
|
|
104
|
+
address.country &&
|
|
105
|
+
address.zip &&
|
|
106
|
+
address.state &&
|
|
107
|
+
address.city &&
|
|
108
|
+
address.types.length > 0;
|
|
109
|
+
|
|
110
|
+
const hasBrazilianNumber =
|
|
111
|
+
!isBrazil || (isBrazil && address.streetNumber?.trim());
|
|
112
|
+
|
|
113
|
+
return (hasRequiredFields && hasBrazilianNumber) || useExistingAddress;
|
|
110
114
|
};
|
|
111
115
|
|
|
112
116
|
const isConfirmButtonEnabled = hasMinimumAddressInformation();
|
|
@@ -62,15 +62,20 @@ export const EditAddressDrawer = ({
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
const hasMinimumAddressInformation = () => {
|
|
65
|
-
|
|
65
|
+
const isBrazil = address.countryCode === "BRA";
|
|
66
|
+
const hasRequiredFields =
|
|
66
67
|
address.name &&
|
|
67
68
|
address.streetAddress &&
|
|
68
69
|
address.country &&
|
|
69
70
|
address.zip &&
|
|
70
71
|
address.state &&
|
|
71
72
|
address.city &&
|
|
72
|
-
address.types.length > 0
|
|
73
|
-
|
|
73
|
+
address.types.length > 0;
|
|
74
|
+
|
|
75
|
+
const hasBrazilianNumber =
|
|
76
|
+
!isBrazil || (isBrazil && address.streetNumber?.trim());
|
|
77
|
+
|
|
78
|
+
return hasRequiredFields && hasBrazilianNumber;
|
|
74
79
|
};
|
|
75
80
|
|
|
76
81
|
const isConfirmButtonEnabled = hasMinimumAddressInformation();
|
|
@@ -10,6 +10,7 @@ export type AddressOption = {
|
|
|
10
10
|
streetAddress: string;
|
|
11
11
|
streetAddress2: string;
|
|
12
12
|
streetNumber: string;
|
|
13
|
+
number?: string;
|
|
13
14
|
unit: string;
|
|
14
15
|
neighborhood?: string;
|
|
15
16
|
city: string;
|
|
@@ -89,6 +90,7 @@ export type AddressInput = {
|
|
|
89
90
|
name: string;
|
|
90
91
|
streetAddress: string;
|
|
91
92
|
streetAddress2: string;
|
|
93
|
+
streetNumber?: string;
|
|
92
94
|
country: string;
|
|
93
95
|
countryCode: string;
|
|
94
96
|
zip: string;
|
package/src/features/credit-cards/components/CreateCreditCardDrawer/CreateCreditCardDrawer.tsx
CHANGED
|
@@ -174,16 +174,20 @@ export const CreateCreditCardDrawer = ({
|
|
|
174
174
|
};
|
|
175
175
|
|
|
176
176
|
const hasMinimumAddressInformation = () => {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
177
|
+
const isBrazil = address.countryCode === "BRA";
|
|
178
|
+
const hasRequiredFields =
|
|
179
|
+
address.name &&
|
|
180
|
+
address.streetAddress &&
|
|
181
|
+
address.country &&
|
|
182
|
+
address.zip &&
|
|
183
|
+
address.state &&
|
|
184
|
+
address.city &&
|
|
185
|
+
address.types.length > 0;
|
|
186
|
+
|
|
187
|
+
const hasBrazilianNumber =
|
|
188
|
+
!isBrazil || (isBrazil && address.streetNumber?.trim());
|
|
189
|
+
|
|
190
|
+
return (hasRequiredFields && hasBrazilianNumber) || useExistingAddress;
|
|
187
191
|
};
|
|
188
192
|
|
|
189
193
|
const hasCardInformation = () => {
|
|
@@ -29,7 +29,7 @@ export const tokenizeCreditCardService = async ({
|
|
|
29
29
|
neighborhood: creditCard.address.neighborhood ?? "",
|
|
30
30
|
geoCoordinates: creditCard.address.geoCoordinates.split(",") ?? [],
|
|
31
31
|
postalCode: creditCard.address.zip,
|
|
32
|
-
number: "",
|
|
32
|
+
number: creditCard.address.streetNumber ?? "",
|
|
33
33
|
receiverName: "NOT EMPTY",
|
|
34
34
|
reference: "",
|
|
35
35
|
state: creditCard.address.state,
|