@opendoor/partner-address-entry-sdk
v1.0.0
Published
React component for address autocomplete and entry
Downloads
577
Maintainers
Readme
Partner Address Entry SDK
A minimal, fast React component for address autocomplete and entry, built with Vite for optimal development and build performance.
Features
- 🚀 Fast builds with Vite
- 📦 Minimal bundle size
- 🎯 TypeScript support
- 💼 Lead creation support
- 🏠 Built-in "Do you have a home to sell?" question flow
- 🎨 Customizable styling with CSS modules
- 📱 Responsive design
Installation
npm install @opendoor/partner-address-entry-sdkUsage
Basic Usage
The component includes a built-in "Do you have a home to sell?" question that appears before the address input. Pass your partner ID and test mode configuration as props:
import { OpendoorPartnerAddressEntry } from '@opendoor/partner-address-entry-sdk';
import type { AddressData } from '@opendoor/partner-address-entry-sdk';
function App() {
const handleAddressSelect = (addressData: AddressData) => {
console.log('Selected address:', addressData);
};
return (
<OpendoorPartnerAddressEntry
partnerId="your_partner_id"
testMode={true} // Set to false for production
onAddressSelect={handleAddressSelect}
/>
);
}With Lead Creation
import { OpendoorPartnerAddressEntry, createLead } from '@opendoor/partner-address-entry-sdk';
import type { AddressData } from '@opendoor/partner-address-entry-sdk';
function App() {
const handleAddressSelect = async (addressData: AddressData) => {
const result = await createLead({
addressData,
sellerInfo: {
fullName: 'John Doe',
email: '[email protected]',
phoneNumber: '+1234567890'
}
});
if (result.success) {
console.log('Lead created:', result.leadId);
}
};
return (
<OpendoorPartnerAddressEntry
partnerId="your_partner_id"
testMode={true}
onAddressSelect={handleAddressSelect}
/>
);
}With Offer Creation
import { OpendoorPartnerAddressEntry, createOffer } from '@opendoor/partner-address-entry-sdk';
import type { AddressData } from '@opendoor/partner-address-entry-sdk';
function App() {
const handleAddressSelect = async (addressData: AddressData) => {
const result = await createOffer({
addressData,
sellerInfo: {
fullName: 'Jane Smith',
email: '[email protected]'
},
pollingIntervalMs: 2000,
pollingTimeoutMs: 60000
});
if (result.success && result.offerRequest) {
console.log('Offer status:', result.offerRequest.offerStatus);
console.log('Offer ID:', result.offerRequest.opendoorOfferRequestId);
}
};
return (
<OpendoorPartnerAddressEntry
partnerId="your_partner_id"
testMode={true}
onAddressSelect={handleAddressSelect}
/>
);
}API Reference
OpendoorPartnerAddressEntry
Props:
| Prop | Type | Description |
|------|------|-------------|
| partnerId | string | Your partner ID (required) |
| testMode | boolean | Use staging/demo endpoints when true (optional, default: false) |
| onAddressSelect | (addressData: AddressData) => void | Callback when an address is selected (optional) |
Note: The SDK uses a global configuration shared by all component instances. If you render multiple components with different partnerId or testMode values, the last component to mount will determine the active configuration (last-write-wins).
To override the API base URL, set the VITE_OPENDOOR_PARTNER_API_BASE_URL environment variable.
createLead(options)
Create a lead with the selected address.
Options:
addressData(AddressData, required): The selected address datasellerInfo(SellerInfo, required): Seller informationfullName(string): Full nameemail(string): Email addressphoneNumber(string): Phone number
Returns: Promise<CreateLeadResponse>
createOffer(options)
Create an offer request and poll for status updates.
Options:
addressData(AddressData, required): The selected address datasellerInfo(SellerInfo, optional): Seller informationfullName(string): Full nameemail(string): Email address
pollingIntervalMs(number, optional, default: 2000): Polling intervalpollingTimeoutMs(number, optional, default: 60000): Polling timeout
Returns: Promise<CreateOfferResponse>
Contributing
See CONTRIBUTING.md for development setup, build instructions, and release process.
License
MIT
