@vtex/faststore-plugin-buyer-portal 1.1.87 → 1.1.89

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 (52) hide show
  1. package/CHANGELOG.md +39 -28
  2. package/README.md +2 -2
  3. package/cypress/constants.ts +1 -1
  4. package/cypress/integration/collections.test.ts +9 -5
  5. package/cypress/integration/credit-cards.test.ts +24 -20
  6. package/cypress/integration/roles.test.ts +3 -1
  7. package/cypress/support/commands.ts +1 -1
  8. package/package.json +1 -1
  9. package/plugin.config.js +20 -20
  10. package/src/features/addresses/components/AddressForm/AddressForm.tsx +72 -41
  11. package/src/features/addresses/data/USA.ts +69 -64
  12. package/src/features/addresses/data/countries.ts +6 -1
  13. package/src/features/addresses/data/states.ts +4 -2
  14. package/src/features/addresses/layouts/AddressDetailsLayout/AddressDetailsLayout.tsx +10 -1
  15. package/src/features/addresses/utils/index.ts +1 -0
  16. package/src/features/addresses/utils/stateUtils.ts +63 -0
  17. package/src/features/budgets/components/BudgetAddForm/budget-add-form.scss +9 -3
  18. package/src/features/budgets/components/BudgetAllocationsSelection/budget-allocations-selection.scss +2 -2
  19. package/src/features/budgets/components/BudgetAllocationsTable/budget-allocations-table.scss +29 -0
  20. package/src/features/budgets/components/BudgetDeleteDrawer/budget-delete-drawer.scss +13 -0
  21. package/src/features/budgets/components/BudgetRemainingBalance/BudgetRemainingBalance.tsx +5 -1
  22. package/src/features/budgets/components/BudgetRemainingBalance/budget-remaining-balance.scss +18 -1
  23. package/src/features/budgets/components/BudgetSettingsInfo/budget-settings-info.scss +19 -0
  24. package/src/features/budgets/components/BudgetsTable/BudgetsTable.tsx +12 -2
  25. package/src/features/budgets/components/BudgetsTable/budgets-table.scss +30 -1
  26. package/src/features/budgets/components/CreateBudgetAllocationDrawer/create-budget-allocation-drawer.scss +22 -6
  27. package/src/features/budgets/components/CreateBudgetDrawer/create-budget-drawer.scss +15 -6
  28. package/src/features/budgets/components/DeleteBudgetAllocationDrawer/delete-budget-allocations.scss +15 -1
  29. package/src/features/budgets/components/EditBudgetDrawer/edit-budget-drawer.scss +11 -1
  30. package/src/features/budgets/layouts/BudgetsDetailsLayout/BudgetsDetailsLayout.tsx +76 -75
  31. package/src/features/budgets/layouts/BudgetsDetailsLayout/budget-details-layout.scss +22 -19
  32. package/src/features/budgets/layouts/BudgetsLayout/budgets-layout.scss +6 -0
  33. package/src/features/buying-policies/components/BasicBuyingPolicyDrawer/basic-buying-policy-drawer.scss +4 -0
  34. package/src/features/buying-policies/layouts/BuyingPoliciesLayout/buying-policies-layout.scss +41 -6
  35. package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/BuyingPolicyDetailsLayout.tsx +1 -1
  36. package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/buying-policy-details-layout.scss +17 -1
  37. package/src/features/payment-methods/components/AddPaymentMethodsDrawer/AddPaymentMethodsDrawer.tsx +93 -68
  38. package/src/features/payment-methods/components/AddPaymentMethodsDrawer/add-payment-methods-drawer.scss +66 -30
  39. package/src/features/payment-methods/components/SearchPaymentMethods/SearchPaymentMethods.tsx +6 -4
  40. package/src/features/payment-methods/components/SearchPaymentMethods/search-payment-methods.scss +3 -0
  41. package/src/features/payment-methods/layouts/PaymentMethodsLayout/PaymentMethodsLayout.tsx +65 -54
  42. package/src/features/payment-methods/layouts/PaymentMethodsLayout/payment-methods-layout.scss +121 -103
  43. package/src/features/shared/components/CustomDropdown/custom-dropdown.scss +5 -0
  44. package/src/features/shared/components/InternalTopbar/InternalTopbar.tsx +1 -1
  45. package/src/features/shared/components/MainLinksDropdownMenu/MainLinksDropdownMenu.tsx +1 -1
  46. package/src/features/shared/components/Pagination/Pagination.tsx +18 -8
  47. package/src/features/shared/components/Pagination/pagination.scss +14 -0
  48. package/src/features/shared/layouts/BaseTabsLayout/sidebar-drawer/sidebar-drawer.scss +5 -3
  49. package/src/features/shared/utils/buyerPortalRoutes.ts +1 -1
  50. package/src/features/shared/utils/routeLayoutMapping.ts +22 -21
  51. package/src/pages/org-units.tsx +1 -1
  52. package/src/pages/user-details.tsx +1 -1
package/CHANGELOG.md CHANGED
@@ -7,62 +7,73 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - Added responsiveness to the Payment Methods list.
13
+ - Implemented responsiveness across all drawers in the Payment Methods flow.
14
+ - Ensured responsive behavior for toasts and empty states.
15
+
10
16
  ### Fixed
11
- - Allow creation of user with no roles
17
+
18
+ - Allow creation of user with no roles
19
+
20
+ ### Added
21
+
22
+ - Responsiviness to Buying policies page
12
23
 
13
24
  ### Added
14
25
 
15
- - Credit card page responsiveness
16
- - Change for the store title based on the SEO
26
+ - Credit card page responsiveness
27
+ - Change for the store title based on the SEO
17
28
 
18
29
  ### Added
19
30
 
20
- - Standardization the sidebar menu throughout the navigation of the Organizational Account, regardless of the context.
31
+ - Standardization the sidebar menu throughout the navigation of the Organizational Account, regardless of the context.
21
32
 
22
33
  ### Fixed
23
34
 
24
- - Fix geoCordinate to be geoCoordinates
25
- - Adjusts in Credit Card's experience
26
- - Create a custom dropdown for Buying Policy criteria
35
+ - Fix geoCordinate to be geoCoordinates
36
+ - Adjusts in Credit Card's experience
37
+ - Create a custom dropdown for Buying Policy criteria
27
38
 
28
39
  ### Added
29
40
 
30
- - Send credentials
41
+ - Send credentials
31
42
 
32
43
  ### Added
33
44
 
34
- - Roles and Role Details Screen
35
- - Role Integration on Users
36
- - Setup lint
37
- - Add default values for Credit Cards
45
+ - Roles and Role Details Screen
46
+ - Role Integration on Users
47
+ - Setup lint
48
+ - Add default values for Credit Cards
38
49
 
39
50
  ### changed
40
51
 
41
- - BFF API URLs
52
+ - BFF API URLs
42
53
 
43
54
  ### added
44
55
 
45
- - Address Recipients Add & Delete Feature
46
- - Address Recipients Edit Feature
47
- - Add Buying Policy integration with BFF
48
- - Add default values for Address
56
+ - Address Recipients Add & Delete Feature
57
+ - Address Recipients Edit Feature
58
+ - Add Buying Policy integration with BFF
59
+ - Add default values for Address
49
60
 
50
61
  ### Fixed
51
62
 
52
- - UserData accepts undefined e-mail
53
- - Fix styles
54
- - Fix Address Recipients bff path
63
+ - UserData accepts undefined e-mail
64
+ - Fix styles
65
+ - Fix Address Recipients bff path
55
66
 
56
67
  ### Added
57
68
 
58
- - Add Buying Policies Page
59
- - Add Buying Policy Details Page
60
- - Add Buying Policy Drawers
61
- - Add Buying Policy Integrations
62
- - Add Pagination Tools
63
- - Add Address Pagination
69
+ - Add Buying Policies Page
70
+ - Add Buying Policy Details Page
71
+ - Add Buying Policy Drawers
72
+ - Add Buying Policy Integrations
73
+ - Add Pagination Tools
74
+ - Add Address Pagination
64
75
 
65
76
  ### Added
66
77
 
67
- - Add CHANGELOG file
68
- - Add README file
78
+ - Add CHANGELOG file
79
+ - Add README file
package/README.md CHANGED
@@ -14,14 +14,14 @@
14
14
  - Run `yarn link @vtex/faststore-plugin-buyer-portal`
15
15
  - Run `yarn`
16
16
  - Run `yarn dev` to start your local server
17
- - You will acess the buyer-portal via: localhost:3000/buyer-portal
17
+ - You will acess the Organization Account via: localhost:3000/pvt/organization-account
18
18
 
19
19
  ### Generating a Cookie
20
20
 
21
21
  - Go to `b2bdev.vtexfaststore.com/login` and log-in as a user that has already been added to an Unit. If you don't have one, contact someone on the B2B - Enabler
22
22
  - Go to copy your `VtexIdclientAutCookie_b2bfaststoredev` cookie
23
23
  - Create a cookie in your `localhost:3000` with the `VtexIdclientAutCookie_b2bfaststoredev` key and the value you just copied
24
- - Go to `localhost:3000/buyer-portal`
24
+ - Go to `localhost:3000/pvt/organization-account`
25
25
 
26
26
  ## Developing
27
27
 
@@ -2,7 +2,7 @@
2
2
  export const TEST_CONFIG = {
3
3
  LOCAL_URL: "http://localhost:3000",
4
4
  ROUTES: {
5
- BUYER_PORTAL: "/buyer-portal",
5
+ BUYER_PORTAL: "/pvt/organization-account",
6
6
  },
7
7
  PAYMENT_METHODS: {
8
8
  MASTERCARD: "Mastercard",
@@ -27,11 +27,15 @@ describe("Collections", () => {
27
27
  });
28
28
 
29
29
  it("Should show empty state when unit has no collection", () => {
30
- cy.intercept("GET", "/_next/data/**/buyer-portal/collections/**", (req) => {
31
- req.reply((res) => {
32
- res.body.pageProps.data.isContractEmpty = true;
33
- });
34
- });
30
+ cy.intercept(
31
+ "GET",
32
+ "/_next/data/**/pvt/organization-account/collections/**",
33
+ (req) => {
34
+ req.reply((res) => {
35
+ res.body.pageProps.data.isContractEmpty = true;
36
+ });
37
+ }
38
+ );
35
39
 
36
40
  visitCollectionsPage();
37
41
 
@@ -23,26 +23,30 @@ function interceptCreateCreditCard() {
23
23
  }
24
24
 
25
25
  function interceptGetCreditCards() {
26
- cy.intercept("GET", "/_next/data/**/buyer-portal/credit-cards/**", (req) => {
27
- req.reply((res) => {
28
- res.body.pageProps.data.data.push({
29
- accountId: "FAKE_ACCOUNT_ID",
30
- paymentSystem: "1",
31
- paymentSystemName: "Visa",
32
- cardNumber: "************1234",
33
- bin: "411111",
34
- availableAddresses: [],
35
- expirationDate: "12/2030",
36
- isExpired: false,
37
- accountStatus: null,
38
- cardLabel: "Personal Card",
39
- useCvvForAuthorization: true,
40
- isCardToken: false,
41
- isDefault: false,
42
- isActive: true,
26
+ cy.intercept(
27
+ "GET",
28
+ "/_next/data/**/pvt/pvt/organization-account/credit-cards/**",
29
+ (req) => {
30
+ req.reply((res) => {
31
+ res.body.pageProps.data.data.push({
32
+ accountId: "FAKE_ACCOUNT_ID",
33
+ paymentSystem: "1",
34
+ paymentSystemName: "Visa",
35
+ cardNumber: "************1234",
36
+ bin: "411111",
37
+ availableAddresses: [],
38
+ expirationDate: "12/2030",
39
+ isExpired: false,
40
+ accountStatus: null,
41
+ cardLabel: "Personal Card",
42
+ useCvvForAuthorization: true,
43
+ isCardToken: false,
44
+ isDefault: false,
45
+ isActive: true,
46
+ });
43
47
  });
44
- });
45
- }).as("getCreditCards");
48
+ }
49
+ ).as("getCreditCards");
46
50
  }
47
51
 
48
52
  function fillInitialCreditCardData() {
@@ -175,7 +179,7 @@ describe("Credit Cards Page", () => {
175
179
  // Intercept the server-side request and modify only the data field to simulate an empty state
176
180
  cy.intercept(
177
181
  "GET",
178
- "/_next/data/**/buyer-portal/credit-cards/**",
182
+ "/_next/data/**/pvt/pvt/organization-account/credit-cards/**",
179
183
  (req) => {
180
184
  req.reply((res) => {
181
185
  res.body.pageProps.data.data = []; // Set the data field to an empty array
@@ -3,7 +3,9 @@ import { TEST_CONFIG } from "../constants";
3
3
  // Utility function to navigate to Roles page
4
4
  function goToRolesPage() {
5
5
  cy.visit(TEST_CONFIG.ROUTES.BUYER_PORTAL);
6
- cy.get('a[data-fs-vertical-nav-menu-link][href^="/buyer-portal/roles/"]')
6
+ cy.get(
7
+ 'a[data-fs-vertical-nav-menu-link][href^="/pvt/organization-account/roles/"]'
8
+ )
7
9
  .contains("Roles")
8
10
  .click();
9
11
  }
@@ -1,7 +1,7 @@
1
1
  import { TEST_CONFIG } from "../constants";
2
2
 
3
3
  Cypress.Commands.add("login", () => {
4
- cy.session("buyer-portal-login", () => {
4
+ cy.session("organization-account-login", () => {
5
5
  const loginOrigin = new URL(TEST_CONFIG.AUTH.LOGIN_URL).origin;
6
6
  const login = Cypress.env("VTEX_ACCOUNT_LOGIN");
7
7
  const password = Cypress.env("VTEX_ACCOUNT_PASSWORD");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.1.87",
3
+ "version": "1.1.89",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin.config.js CHANGED
@@ -3,89 +3,89 @@ module.exports = {
3
3
  name: "poc-plugin",
4
4
  pages: {
5
5
  home: {
6
- path: "/buyer-portal/[[...contractMode]]",
6
+ path: "/pvt/organization-account/[[...contractMode]]",
7
7
  appLayout: false,
8
8
  },
9
9
  "address-details": {
10
- path: "/buyer-portal/address/[orgUnitId]/[contractId]/[addressId]",
10
+ path: "/pvt/organization-account/address/[orgUnitId]/[contractId]/[addressId]",
11
11
  appLayout: false,
12
12
  },
13
13
 
14
14
  // ----
15
15
  profile: {
16
- path: "/buyer-portal/profile/[orgUnitId]/[contractId]",
16
+ path: "/pvt/organization-account/profile/[orgUnitId]/[contractId]",
17
17
  appLayout: false,
18
18
  },
19
19
  addresses: {
20
- path: "/buyer-portal/addresses/[orgUnitId]/[contractId]",
20
+ path: "/pvt/organization-account/addresses/[orgUnitId]/[contractId]",
21
21
  appLayout: false,
22
22
  },
23
23
  budgets: {
24
- path: "/buyer-portal/budgets/[orgUnitId]/[contractId]",
24
+ path: "/pvt/organization-account/budgets/[orgUnitId]/[contractId]",
25
25
  appLayout: false,
26
26
  },
27
27
  "budgets-details": {
28
- path: "/buyer-portal/budgets/[orgUnitId]/[contractId]/[budgetId]",
28
+ path: "/pvt/organization-account/budgets/[orgUnitId]/[contractId]/[budgetId]",
29
29
  appLayout: false,
30
30
  },
31
31
  "payment-methods": {
32
- path: "/buyer-portal/payment-methods/[orgUnitId]/[contractId]",
32
+ path: "/pvt/organization-account/payment-methods/[orgUnitId]/[contractId]",
33
33
  appLayout: false,
34
34
  },
35
35
  "credit-cards": {
36
- path: "/buyer-portal/credit-cards/[orgUnitId]/[contractId]",
36
+ path: "/pvt/organization-account/credit-cards/[orgUnitId]/[contractId]",
37
37
  appLayout: false,
38
38
  },
39
39
  collections: {
40
- path: "/buyer-portal/collections/[orgUnitId]/[contractId]",
40
+ path: "/pvt/organization-account/collections/[orgUnitId]/[contractId]",
41
41
  appLayout: false,
42
42
  },
43
43
  "po-numbers": {
44
- path: "/buyer-portal/po-numbers/[orgUnitId]/[contractId]",
44
+ path: "/pvt/organization-account/po-numbers/[orgUnitId]/[contractId]",
45
45
  appLayout: false,
46
46
  },
47
47
  "cost-centers": {
48
- path: "/buyer-portal/cost-centers/[orgUnitId]/[contractId]",
48
+ path: "/pvt/organization-account/cost-centers/[orgUnitId]/[contractId]",
49
49
  appLayout: false,
50
50
  },
51
51
  releases: {
52
- path: "/buyer-portal/releases/[orgUnitId]/[contractId]",
52
+ path: "/pvt/organization-account/releases/[orgUnitId]/[contractId]",
53
53
  appLayout: false,
54
54
  },
55
55
  roles: {
56
- path: "/buyer-portal/roles/[orgUnitId]",
56
+ path: "/pvt/organization-account/roles/[orgUnitId]",
57
57
  appLayout: false,
58
58
  },
59
59
  "role-details": {
60
- path: "/buyer-portal/roles/[orgUnitId]/[roleName]",
60
+ path: "/pvt/organization-account/roles/[orgUnitId]/[roleName]",
61
61
  appLayout: false,
62
62
  },
63
63
  "buying-policies": {
64
- path: "/buyer-portal/buying-policies/[orgUnitId]/[contractId]",
64
+ path: "/pvt/organization-account/buying-policies/[orgUnitId]/[contractId]",
65
65
  appLayout: false,
66
66
  },
67
67
 
68
68
  "buying-policy-details": {
69
- path: "/buyer-portal/buying-policy/[orgUnitId]/[contractId]/[buyingPolicyId]",
69
+ path: "/pvt/organization-account/buying-policy/[orgUnitId]/[contractId]/[buyingPolicyId]",
70
70
  appLayout: false,
71
71
  },
72
72
 
73
73
  users: {
74
- path: "/buyer-portal/users/[orgUnitId]",
74
+ path: "/pvt/organization-account/users/[orgUnitId]",
75
75
  appLayout: false,
76
76
  },
77
77
 
78
78
  "org-units": {
79
- path: "/buyer-portal/org-units/[orgUnitId]",
79
+ path: "/pvt/organization-account/org-units/[orgUnitId]",
80
80
  appLayout: false,
81
81
  },
82
82
 
83
83
  "user-details": {
84
- path: "/buyer-portal/user/[orgUnitId]/[userId]",
84
+ path: "/pvt/organization-account/user/[orgUnitId]/[userId]",
85
85
  appLayout: false,
86
86
  },
87
87
  "org-unit-details": {
88
- path: "/buyer-portal/org-unit/[orgUnitId]",
88
+ path: "/pvt/organization-account/org-unit/[orgUnitId]",
89
89
  appLayout: false,
90
90
  },
91
91
  },
@@ -9,10 +9,17 @@ import {
9
9
  } from "../../../shared/components";
10
10
  import { useBuyerPortal } from "../../../shared/hooks";
11
11
  import { maskPostalCode } from "../../../shared/utils/postalCode";
12
- import { CountryOptions } from "../../data/countries";
13
- import { states as StateOptions } from "../../data/states";
12
+ import { CountryOptions, type CountryOption } from "../../data/countries";
14
13
  import { useDebouncedSearchAddress } from "../../hooks/useDebouncedSearchAddress";
15
14
  import { AddressData, AddressInput } from "../../types";
15
+ import {
16
+ getStateDisplayValue,
17
+ getStateSaveValue,
18
+ isStateSelected,
19
+ getStateDisplayOptions,
20
+ findStateByDisplayValue,
21
+ getStateDisplayFromCode,
22
+ } from "../../utils";
16
23
 
17
24
  export type AddressFormProps = {
18
25
  address: AddressInput;
@@ -42,7 +49,11 @@ export const AddressForm = ({
42
49
  }: AddressFormProps) => {
43
50
  const addressTypeOptions = ["Shipping", "Billing"];
44
51
  const { currentOrgUnit } = useBuyerPortal();
45
-
52
+ const [selectedState, setSelectedState] = useState(
53
+ address.state
54
+ ? getStateDisplayFromCode(address.countryCode || "", address.state)
55
+ : ""
56
+ );
46
57
  const [autoCompleteAddressName, setAutoCompleteAddressName] = useState("");
47
58
 
48
59
  const { searchedAddresses } = useDebouncedSearchAddress(
@@ -66,6 +77,16 @@ export const AddressForm = ({
66
77
 
67
78
  const hideLabel = isEdit || fixedType;
68
79
 
80
+ const handleCountrySelect = (option: CountryOption) => {
81
+ setAddress({
82
+ ...address,
83
+ country: option.name,
84
+ countryCode: option.id,
85
+ state: "",
86
+ });
87
+ setSelectedState("");
88
+ };
89
+
69
90
  return (
70
91
  <>
71
92
  {!useExistingAddress ? (
@@ -79,26 +100,18 @@ export const AddressForm = ({
79
100
  value={address.country}
80
101
  options={CountryOptions}
81
102
  shouldCloseOnSelect
82
- onConfirmKeyPress={(option) =>
83
- setAddress({
84
- ...address,
85
- country: option.name,
86
- countryCode: option.id,
87
- })
88
- }
103
+ onConfirmKeyPress={(option) => {
104
+ handleCountrySelect(option);
105
+ }}
89
106
  renderOption={(option, index) => (
90
107
  <AutocompleteDropdown.Item
91
108
  key={option.id}
92
109
  closeOnClick
93
110
  index={index}
94
111
  isSelected={address.country === option.name}
95
- onClick={() =>
96
- setAddress({
97
- ...address,
98
- country: option.name,
99
- countryCode: option.id,
100
- })
101
- }
112
+ onClick={() => {
113
+ handleCountrySelect(option);
114
+ }}
102
115
  >
103
116
  {option?.name}
104
117
  {address.country === option?.name && (
@@ -218,32 +231,50 @@ export const AddressForm = ({
218
231
  data-fs-bp-create-address-state-selector
219
232
  label="State"
220
233
  className="address-state"
221
- value={address.state}
222
- options={
223
- address.countryCode ? StateOptions[address.countryCode] : []
224
- }
234
+ value={selectedState}
235
+ options={getStateDisplayOptions(address.countryCode || "")}
225
236
  shouldCloseOnSelect
226
- onConfirmKeyPress={(option) =>
227
- setAddress({ ...address, state: option })
228
- }
237
+ onConfirmKeyPress={(option) => {
238
+ const stateData = findStateByDisplayValue(
239
+ address.countryCode || "",
240
+ option
241
+ );
242
+ if (stateData) {
243
+ setSelectedState(option);
244
+ setAddress({ ...address, state: getStateSaveValue(stateData) });
245
+ }
246
+ }}
229
247
  disabled={!address.countryCode}
230
- renderOption={(option, index) => (
231
- <AutocompleteDropdown.Item
232
- key={`${option}-${index}`}
233
- closeOnClick
234
- index={index}
235
- isSelected={
236
- address.state.toLocaleLowerCase() ===
237
- option.toLocaleLowerCase()
238
- }
239
- onClick={() => setAddress({ ...address, state: option })}
240
- >
241
- {option}
242
- {address.state.toLowerCase() === option.toLocaleLowerCase() && (
243
- <Icon name="Check" width={12} height={12} />
244
- )}
245
- </AutocompleteDropdown.Item>
246
- )}
248
+ renderOption={(option, index) => {
249
+ const stateData = findStateByDisplayValue(
250
+ address.countryCode || "",
251
+ option
252
+ );
253
+ const isSelected = stateData
254
+ ? isStateSelected(address.state, stateData)
255
+ : false;
256
+
257
+ return (
258
+ <AutocompleteDropdown.Item
259
+ key={`${option}-${index}`}
260
+ closeOnClick
261
+ index={index}
262
+ isSelected={isSelected}
263
+ onClick={() => {
264
+ if (stateData) {
265
+ setSelectedState(getStateDisplayValue(stateData));
266
+ setAddress({
267
+ ...address,
268
+ state: getStateSaveValue(stateData),
269
+ });
270
+ }
271
+ }}
272
+ >
273
+ {option}
274
+ {isSelected && <Icon name="Check" width={12} height={12} />}
275
+ </AutocompleteDropdown.Item>
276
+ );
277
+ }}
247
278
  />
248
279
 
249
280
  <InputText
@@ -1,65 +1,70 @@
1
- export const states = [
2
- "Alabama",
3
- "Alaska",
4
- "American Samoa",
5
- "Arizona",
6
- "Arkansas",
7
- "Armed Forces Americas",
8
- "Armed Forces Europe, the Middle East, and Canada",
9
- "Armed Forces Pacific",
10
- "California",
11
- "Colorado",
12
- "Connecticut",
13
- "Delaware",
14
- "District Of Columbia (Washington, D.C.)",
15
- "Federated States of Micronesia",
16
- "Florida",
17
- "Georgia",
18
- "Guam",
19
- "Hawaii",
20
- "Idaho",
21
- "Illinois",
22
- "Indiana",
23
- "Iowa",
24
- "Kansas",
25
- "Kentucky",
26
- "Louisiana",
27
- "Maine",
28
- "Marshall Islands",
29
- "Maryland",
30
- "Massachusetts",
31
- "Michigan",
32
- "Minnesota",
33
- "Mississippi",
34
- "Missouri",
35
- "Montana",
36
- "Nebraska",
37
- "Nevada",
38
- "New Hampshire",
39
- "New Jersey",
40
- "New Mexico",
41
- "New York",
42
- "North Carolina",
43
- "North Dakota",
44
- "Northern Mariana Islands",
45
- "Ohio",
46
- "Oklahoma",
47
- "Oregon",
48
- "Palau",
49
- "Pennsylvania",
50
- "Puerto Rico",
51
- "Rhode Island",
52
- "South Carolina",
53
- "South Dakota",
54
- "Tennessee",
55
- "Texas",
56
- "U.S. Minor Outlying Islands",
57
- "U.S. Virgin Islands",
58
- "Utah",
59
- "Vermont",
60
- "Virginia",
61
- "Washington",
62
- "West Virginia",
63
- "Wisconsin",
64
- "Wyoming",
1
+ export type StateOption = {
2
+ code: string;
3
+ name: string;
4
+ };
5
+
6
+ export const states: StateOption[] = [
7
+ { code: "AL", name: "Alabama" },
8
+ { code: "AK", name: "Alaska" },
9
+ { code: "AS", name: "American Samoa" },
10
+ { code: "AZ", name: "Arizona" },
11
+ { code: "AR", name: "Arkansas" },
12
+ { code: "AA", name: "Armed Forces Americas" },
13
+ { code: "AE", name: "Armed Forces Europe, the Middle East, and Canada" },
14
+ { code: "AP", name: "Armed Forces Pacific" },
15
+ { code: "CA", name: "California" },
16
+ { code: "CO", name: "Colorado" },
17
+ { code: "CT", name: "Connecticut" },
18
+ { code: "DE", name: "Delaware" },
19
+ { code: "DC", name: "District Of Columbia (Washington, D.C.)" },
20
+ { code: "FM", name: "Federated States of Micronesia" },
21
+ { code: "FL", name: "Florida" },
22
+ { code: "GA", name: "Georgia" },
23
+ { code: "GU", name: "Guam" },
24
+ { code: "HI", name: "Hawaii" },
25
+ { code: "ID", name: "Idaho" },
26
+ { code: "IL", name: "Illinois" },
27
+ { code: "IN", name: "Indiana" },
28
+ { code: "IA", name: "Iowa" },
29
+ { code: "KS", name: "Kansas" },
30
+ { code: "KY", name: "Kentucky" },
31
+ { code: "LA", name: "Louisiana" },
32
+ { code: "ME", name: "Maine" },
33
+ { code: "MH", name: "Marshall Islands" },
34
+ { code: "MD", name: "Maryland" },
35
+ { code: "MA", name: "Massachusetts" },
36
+ { code: "MI", name: "Michigan" },
37
+ { code: "MN", name: "Minnesota" },
38
+ { code: "MS", name: "Mississippi" },
39
+ { code: "MO", name: "Missouri" },
40
+ { code: "MT", name: "Montana" },
41
+ { code: "NE", name: "Nebraska" },
42
+ { code: "NV", name: "Nevada" },
43
+ { code: "NH", name: "New Hampshire" },
44
+ { code: "NJ", name: "New Jersey" },
45
+ { code: "NM", name: "New Mexico" },
46
+ { code: "NY", name: "New York" },
47
+ { code: "NC", name: "North Carolina" },
48
+ { code: "ND", name: "North Dakota" },
49
+ { code: "MP", name: "Northern Mariana Islands" },
50
+ { code: "OH", name: "Ohio" },
51
+ { code: "OK", name: "Oklahoma" },
52
+ { code: "OR", name: "Oregon" },
53
+ { code: "PW", name: "Palau" },
54
+ { code: "PA", name: "Pennsylvania" },
55
+ { code: "PR", name: "Puerto Rico" },
56
+ { code: "RI", name: "Rhode Island" },
57
+ { code: "SC", name: "South Carolina" },
58
+ { code: "SD", name: "South Dakota" },
59
+ { code: "TN", name: "Tennessee" },
60
+ { code: "TX", name: "Texas" },
61
+ { code: "UM", name: "U.S. Minor Outlying Islands" },
62
+ { code: "VI", name: "U.S. Virgin Islands" },
63
+ { code: "UT", name: "Utah" },
64
+ { code: "VT", name: "Vermont" },
65
+ { code: "VA", name: "Virginia" },
66
+ { code: "WA", name: "Washington" },
67
+ { code: "WV", name: "West Virginia" },
68
+ { code: "WI", name: "Wisconsin" },
69
+ { code: "WY", name: "Wyoming" },
65
70
  ];