@nuskin/address-lookup 1.0.1-pa-1033.1 → 1.0.1-pa-1033.3
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 +3 -2
- package/src/AddressLookup.jsx +16 -14
- package/src/components/EgonResults.jsx +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/address-lookup",
|
|
3
|
-
"version": "1.0.1-pa-1033.
|
|
3
|
+
"version": "1.0.1-pa-1033.3",
|
|
4
4
|
"description": "React component for address autocomplete using Egon and Smarty services",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"homepage": "https://code.tls.nuskin.io/nextgen-development/shipping/npm/address-lookup/blob/master/README.md",
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=18.0.0",
|
|
33
|
-
"react-dom": ">=18.0.0"
|
|
33
|
+
"react-dom": ">=18.0.0",
|
|
34
|
+
"axios": ">=1.13.2"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@nuskin/docdash": "1.0.1",
|
package/src/AddressLookup.jsx
CHANGED
|
@@ -3,23 +3,25 @@ import EgonResults from './components/EgonResults.jsx';
|
|
|
3
3
|
import SmartyResults from './components/SmartyResults.jsx';
|
|
4
4
|
import { COUNTRY_MAP } from './countries';
|
|
5
5
|
|
|
6
|
-
const AddressLookup = ({ onAddressSelect }) => {
|
|
7
|
-
const [countryCode, setCountryCode] = useState(
|
|
6
|
+
const AddressLookup = ({ onAddressSelect, country = 'US', showCountrySelection = true }) => {
|
|
7
|
+
const [countryCode, setCountryCode] = useState(country);
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
10
|
<div>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
{showCountrySelection && (
|
|
12
|
+
<select
|
|
13
|
+
value={countryCode}
|
|
14
|
+
onChange={(e) => setCountryCode(e.target.value)}
|
|
15
|
+
style={{ marginBottom: '20px', padding: '8px' }}
|
|
16
|
+
>
|
|
17
|
+
<option value="">Select Country</option>
|
|
18
|
+
{Object.entries(COUNTRY_MAP).map(([code, country]) => (
|
|
19
|
+
<option key={code} value={code}>
|
|
20
|
+
{country.name}
|
|
21
|
+
</option>
|
|
22
|
+
))}
|
|
23
|
+
</select>
|
|
24
|
+
)}
|
|
23
25
|
|
|
24
26
|
<div style={{ display: 'flex', gap: '20px' }}>
|
|
25
27
|
<EgonResults countryCode={countryCode} onSelect={onAddressSelect} />
|
|
@@ -57,6 +57,7 @@ const EgonResults = ({ countryCode, onSelect }) => {
|
|
|
57
57
|
<div><strong>Full Address:</strong> {displayAddress.standard.full_address}</div>
|
|
58
58
|
<div><strong>Street:</strong> {displayAddress.standard.street}</div>
|
|
59
59
|
<div><strong>City:</strong> {displayAddress.standard.city}</div>
|
|
60
|
+
<div><strong>State:</strong> {displayAddress.standard.state}</div>
|
|
60
61
|
<div><strong>Province:</strong> {displayAddress.standard.province}</div>
|
|
61
62
|
<div><strong>Region:</strong> {displayAddress.standard.region}</div>
|
|
62
63
|
<div><strong>Postal Code:</strong> {displayAddress.standard.zipcode}</div>
|
|
@@ -69,6 +70,7 @@ const EgonResults = ({ countryCode, onSelect }) => {
|
|
|
69
70
|
{displayAddress.hn_exp || ''} {displayAddress.street}
|
|
70
71
|
</div>
|
|
71
72
|
<div><strong>City:</strong> {displayAddress.city}</div>
|
|
73
|
+
<div><strong>State:</strong> {displayAddress.standard.state}</div>
|
|
72
74
|
<div><strong>Province:</strong> {displayAddress.province}</div>
|
|
73
75
|
<div><strong>Region:</strong> {displayAddress.region}</div>
|
|
74
76
|
<div><strong>Postal Code:</strong> {displayAddress.zipcode}</div>
|