@buyingbuddy/react 0.0.1 → 0.0.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/README.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# @buyingbuddy/react
|
|
2
|
+
|
|
3
|
+
React components for embedding [BuyingBuddy](https://www.buyingbuddy.com) real-estate (IDX) widgets — featured galleries, search forms, interactive maps, property details, and more.
|
|
4
|
+
|
|
5
|
+
BuyingBuddy widgets ship as a `<bb-widget>` custom element loaded from the BuyingBuddy plugin script. This package wraps that element in idiomatic React components so you can add IDX search and listings to your site without writing script tags or touching the custom element directly.
|
|
6
|
+
|
|
7
|
+
Works with **React**, **Next.js**, and **Framer**.
|
|
8
|
+
|
|
9
|
+
> **Is this the right package for you?** This is a React component library — you use it inside a build-tooled project (Vite, Next.js, Framer) that compiles JSX/TypeScript. If you just want to drop a widget into a plain HTML page with a `<script>` tag, you don't need this package — use the standard widget install from your BuyingBuddy dashboard (**Widgets → Plugin Installation and Setup**) instead.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
Inside an existing React project:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @buyingbuddy/react
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
React 18 or 19 is required as a peer dependency, so make sure your project has them:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install react react-dom
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Starting from scratch
|
|
26
|
+
|
|
27
|
+
No React project yet? This gets you from nothing to a running page:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm create vite@latest my-site -- --template react
|
|
31
|
+
cd my-site
|
|
32
|
+
npm install
|
|
33
|
+
npm install @buyingbuddy/react
|
|
34
|
+
npm run dev # opens a dev server, usually http://localhost:5173
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then paste one of the examples below into `src/App.jsx` and save — the page reloads automatically.
|
|
38
|
+
|
|
39
|
+
## Prerequisites
|
|
40
|
+
|
|
41
|
+
Before anything will render, you need both of these:
|
|
42
|
+
|
|
43
|
+
1. **A BuyingBuddy account ID (`acid`).** Find it in your dashboard under **Widgets → Plugin Installation and Setup**. There is no anonymous or "try it" mode — the widgets will not load without a valid account ID.
|
|
44
|
+
2. **Your domain authorized on that account.** An `acid` only works on domains registered to its account. Running on an unauthorized domain produces an "invalid account / unauthorized domain" error.
|
|
45
|
+
|
|
46
|
+
## Quick start
|
|
47
|
+
|
|
48
|
+
```jsx
|
|
49
|
+
import { BuyingBuddyProvider, BuyingBuddyWidget } from "@buyingbuddy/react";
|
|
50
|
+
|
|
51
|
+
export default function App() {
|
|
52
|
+
return (
|
|
53
|
+
<BuyingBuddyProvider accountId="your-account-id">
|
|
54
|
+
<BuyingBuddyWidget type="FeaturedGallery" limit={12} />
|
|
55
|
+
</BuyingBuddyProvider>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Replace `your-account-id` with your `acid`. The provider loads the BuyingBuddy script for that account once, waits for it to initialize, then renders your widgets. While it loads it renders the `fallback` (nothing, by default).
|
|
61
|
+
|
|
62
|
+
## Examples
|
|
63
|
+
|
|
64
|
+
**A full search experience.** `SearchResults` is self-contained — it renders the map, the listings, *and* its own search/filter controls. You do **not** add a separate `SearchForm` next to it:
|
|
65
|
+
|
|
66
|
+
```jsx
|
|
67
|
+
<BuyingBuddyProvider accountId="your-account-id">
|
|
68
|
+
<BuyingBuddyWidget type="SearchResults" />
|
|
69
|
+
</BuyingBuddyProvider>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**A standalone search form.** Use `SearchForm` on its own — e.g. a search box on a landing or home page that sends visitors into your search results — not as a companion to `SearchResults`:
|
|
73
|
+
|
|
74
|
+
```jsx
|
|
75
|
+
<BuyingBuddyWidget type="SearchForm" />
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**FeaturedGallery / FeaturedList show the account's own (featured) listings**, with `limit` capping how many:
|
|
79
|
+
|
|
80
|
+
```jsx
|
|
81
|
+
<BuyingBuddyWidget type="FeaturedGallery" limit={12} />
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
> If the account has no listings of its own — e.g. a brand-new or demo account — this renders empty ("0 Found"). To show listings from the broader MLS instead, give it a `filter` (below).
|
|
85
|
+
|
|
86
|
+
**Driving a gallery by search criteria.** Pass a `filter` to query the MLS rather than the account's own listings. Criteria, sort, and count are `+`-joined tokens inside the string; use `FIELD()` for a field that accepts several values:
|
|
87
|
+
|
|
88
|
+
```jsx
|
|
89
|
+
{/* 6 listings over $300k, priced high-to-low */}
|
|
90
|
+
<BuyingBuddyWidget
|
|
91
|
+
type="FeaturedGallery"
|
|
92
|
+
filter="price_min:300000+orderby:price desc+limit:6"
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
{/* combine criteria with + ; FIELD() for multi-value fields */}
|
|
96
|
+
<BuyingBuddyWidget
|
|
97
|
+
type="FeaturedGallery"
|
|
98
|
+
filter="city:Denver+FIELD(property_beds:3,4,5)+orderby:price desc+limit:9"
|
|
99
|
+
/>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**An interactive map with a fixed height:**
|
|
103
|
+
|
|
104
|
+
```jsx
|
|
105
|
+
<BuyingBuddyWidget type="InteractiveMap" style={{ height: "600px" }} />
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Run a callback when a widget finishes loading** (memoize the handler — see [Caveats](#caveats--limitations)):
|
|
109
|
+
|
|
110
|
+
```jsx
|
|
111
|
+
import { useCallback } from "react";
|
|
112
|
+
|
|
113
|
+
const handleLoaded = useCallback(() => console.log("gallery ready"), []);
|
|
114
|
+
|
|
115
|
+
<BuyingBuddyWidget type="FeaturedGallery" onWidgetLoaded={handleLoaded} />
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Next.js
|
|
119
|
+
|
|
120
|
+
The provider runs entirely in the browser (it loads a script and reads `window`), so the file that renders it must be a **client component**. In the App Router, add the `"use client"` directive at the top of the file — it tells Next.js to run this component in the browser rather than only on the server.
|
|
121
|
+
|
|
122
|
+
In `app/page.tsx`:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
"use client";
|
|
126
|
+
|
|
127
|
+
import { BuyingBuddyProvider, BuyingBuddyWidget } from "@buyingbuddy/react";
|
|
128
|
+
|
|
129
|
+
export default function Page() {
|
|
130
|
+
return (
|
|
131
|
+
<BuyingBuddyProvider accountId="your-account-id" fallback={<p>Loading…</p>}>
|
|
132
|
+
<BuyingBuddyWidget type="SearchResults" />
|
|
133
|
+
</BuyingBuddyProvider>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Because the widgets are client-only, their listing content is **not server-rendered** — keep that in mind if SEO of the listings themselves matters to you.
|
|
139
|
+
|
|
140
|
+
### Framer
|
|
141
|
+
|
|
142
|
+
A standalone, single-file widget for the [Framer](https://www.framer.com) website builder is included at [`framer/BuyingBuddyWidget.tsx`](framer/BuyingBuddyWidget.tsx). It bundles the script loading and adds Framer property controls (Account ID, widget type, filter, limit, sort order, featured-only), so you configure everything from Framer's design panel — no React code required.
|
|
143
|
+
|
|
144
|
+
1. Open the [`framer/BuyingBuddyWidget.tsx`](framer/BuyingBuddyWidget.tsx) file and copy its entire contents.
|
|
145
|
+
2. In Framer, go to **Assets → Code → +** and paste it in.
|
|
146
|
+
3. Drag the component onto your canvas and set your **Account ID** in the property panel.
|
|
147
|
+
|
|
148
|
+
## API
|
|
149
|
+
|
|
150
|
+
### `<BuyingBuddyProvider>`
|
|
151
|
+
|
|
152
|
+
Loads the BuyingBuddy runtime for an account and makes it available to the widgets inside it. Use **one** provider, near the top of your tree.
|
|
153
|
+
|
|
154
|
+
| Prop | Type | Default | Description |
|
|
155
|
+
|------|------|---------|-------------|
|
|
156
|
+
| `accountId` | `string` | — | **Required.** Your BuyingBuddy account ID (`acid`). |
|
|
157
|
+
| `domain` | `string` | `"www.mbb2.com"` | Domain the runtime script, theme, and config load from — i.e. which environment's widget bundle you get (e.g. `"preview.mbb2.com"`). Only change if directed by BuyingBuddy support or for testing. |
|
|
158
|
+
| `apiBaseUrl` | `string` | `https://{domain}` | Base URL for widget **data** requests (`window.MBB.apiBaseUrl`). Defaults to the same environment as `domain`; set explicitly to point data at a different environment independently of the bundle (e.g. a quick prod/preview flip for testing). |
|
|
159
|
+
| `children` | `ReactNode` | — | Rendered once the script loads. |
|
|
160
|
+
| `fallback` | `ReactNode` | `null` | Shown while the script is loading (not shown on error — see Caveats). |
|
|
161
|
+
|
|
162
|
+
### `<BuyingBuddyWidget>`
|
|
163
|
+
|
|
164
|
+
Renders a single widget. Must be a descendant of `<BuyingBuddyProvider>`.
|
|
165
|
+
|
|
166
|
+
| Prop | Type | Description |
|
|
167
|
+
|------|------|-------------|
|
|
168
|
+
| `type` | `BuyingBuddyWidgetType` | **Required.** Widget to render — e.g. `"FeaturedGallery"`, `"SearchForm"`, `"SearchResults"`, `"InteractiveMap"`, `"SearchDetails"`. |
|
|
169
|
+
| `filter` | `string` | Property filter in `FIELD()` or `key:value` syntax, e.g. `"FIELD(property_beds:3,4,5)"`. |
|
|
170
|
+
| `limit` | `number \| string` | Maximum number of results to display. |
|
|
171
|
+
| `order` | `string` | Sort order, e.g. `"price_asc"`, `"price_desc"`, `"date_listed_desc"`. |
|
|
172
|
+
| `demo` | `boolean \| string` | Sets the `demo` attribute on the widget element. |
|
|
173
|
+
| `featured` | `boolean \| string` | Show only featured listings. |
|
|
174
|
+
| `style` | `React.CSSProperties` | Inline styles for the **wrapper `<div>`** (not forwarded to the widget element). |
|
|
175
|
+
| `className` | `string` | CSS class(es) for the wrapper `<div>`. |
|
|
176
|
+
| `id` | `string` | HTML `id` attribute set on the widget element. |
|
|
177
|
+
| `onWidgetLoaded` | `() => void` | Fires once when the widget finishes loading. Memoize it (see Caveats). |
|
|
178
|
+
|
|
179
|
+
Common `type` values include `FeaturedGallery`, `FeaturedList`, `SearchForm`, `SearchResults`, `SearchDetails`, `QuickSearch`, `InteractiveMap`, `Communities`, `LcForm` (lead capture), `LoginPanel`, `Calculator`, `MarketReport`, `MarketStats`, `Brokers`, `OfficeRoster`, and `Disclaimer`. The `type` prop accepts any string, so newer widget types work even before they're added to the typings.
|
|
180
|
+
|
|
181
|
+
### `useBuyingBuddy()`
|
|
182
|
+
|
|
183
|
+
Hook for reading the provider's load state. Throws if called outside a `<BuyingBuddyProvider>`.
|
|
184
|
+
|
|
185
|
+
```jsx
|
|
186
|
+
import { useBuyingBuddy } from "@buyingbuddy/react";
|
|
187
|
+
|
|
188
|
+
function Status() {
|
|
189
|
+
const { isLoaded, error, accountId } = useBuyingBuddy();
|
|
190
|
+
if (error) return <p>Failed to load: {error.message}</p>;
|
|
191
|
+
return <p>{isLoaded ? `Ready (${accountId})` : "Loading…"}</p>;
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Returns `{ isLoaded: boolean, error: Error | null, accountId: string }`. Note that when `error` is set, the provider also renders its own built-in error message in place of `children`.
|
|
196
|
+
|
|
197
|
+
### TypeScript
|
|
198
|
+
|
|
199
|
+
The package is written in TypeScript and ships its own types. These are exported for your own typing needs:
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
import type {
|
|
203
|
+
BuyingBuddyWidgetType,
|
|
204
|
+
BuyingBuddyWidgetProps,
|
|
205
|
+
BuyingBuddyProviderProps,
|
|
206
|
+
BuyingBuddyContextValue,
|
|
207
|
+
} from "@buyingbuddy/react";
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Caveats & limitations
|
|
211
|
+
|
|
212
|
+
- **One account per page.** The BuyingBuddy script installs a single global, so a page is expected to use one `accountId`. Rendering two providers with different account IDs on the same page is not supported.
|
|
213
|
+
- **Client-side only.** Widgets render in the browser after the script loads — nothing is server-rendered. There's no SSR/streaming output, so the listing content isn't in the initial HTML (relevant for SEO).
|
|
214
|
+
- **Changing a prop rebuilds the widget.** Changing `type`, `filter`, `limit`, `order`, `demo`, `featured`, `id`, or `onWidgetLoaded` tears down and recreates the underlying `<bb-widget>`, losing in-widget state (map position, scroll, form input). In particular, pass a **stable** `onWidgetLoaded` (wrap it in `useCallback`) — an inline arrow function changes identity on every render and forces a rebuild each time.
|
|
215
|
+
- **The script persists after unmount.** Unmounting the provider does not remove the script or reset the global — remounting reuses the already-loaded runtime. This is intentional.
|
|
216
|
+
- **Error UI is built in.** On load failure the provider renders its own inline error message in place of `children` (and `fallback` is not shown). You can read `error` from `useBuyingBuddy()`, but you can't currently replace the default error UI.
|
|
217
|
+
- **ESM-only.** This package ships as ES modules only (no CommonJS build). Use it in a project with ESM/bundler support.
|
|
218
|
+
- **Pre-release.** This package is `0.0.1` — the API may change.
|
|
219
|
+
|
|
220
|
+
## Development
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npm install
|
|
224
|
+
npm run build # compile src/ to dist/ (JS + .d.ts)
|
|
225
|
+
npm run dev # rebuild on change (tsc --watch)
|
|
226
|
+
npm test # run the unit tests (vitest)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
Proprietary — `UNLICENSED`. © Blue Fire Group / BuyingBuddy.
|
|
@@ -27,5 +27,5 @@ declare global {
|
|
|
27
27
|
* </BuyingBuddyProvider>
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export declare function BuyingBuddyProvider({ accountId, domain, children, fallback, }: BuyingBuddyProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function BuyingBuddyProvider({ accountId, domain, apiBaseUrl, children, fallback, }: BuyingBuddyProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
31
31
|
//# sourceMappingURL=BuyingBuddyProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuyingBuddyProvider.d.ts","sourceRoot":"","sources":["../src/BuyingBuddyProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAIjF;;;GAGG;AACH,wBAAgB,cAAc,IAAI,uBAAuB,CAQxD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,GAAG,CAAC,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAC7B,UAAU,EAAE,MAAM,CAAC;YACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;SACxB,CAAC;KACH;CACF;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,MAAuB,EACvB,QAAQ,EACR,QAAe,GAChB,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"BuyingBuddyProvider.d.ts","sourceRoot":"","sources":["../src/BuyingBuddyProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAIjF;;;GAGG;AACH,wBAAgB,cAAc,IAAI,uBAAuB,CAQxD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,GAAG,CAAC,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAC7B,UAAU,EAAE,MAAM,CAAC;YACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;SACxB,CAAC;KACH;CACF;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,MAAuB,EACvB,UAAU,EACV,QAAQ,EACR,QAAe,GAChB,EAAE,wBAAwB,2CA+G1B"}
|
|
@@ -27,7 +27,12 @@ const LOADED_ACCOUNTS = new Set();
|
|
|
27
27
|
* </BuyingBuddyProvider>
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export function BuyingBuddyProvider({ accountId, domain = "www.mbb2.com", children, fallback = null, }) {
|
|
30
|
+
export function BuyingBuddyProvider({ accountId, domain = "www.mbb2.com", apiBaseUrl, children, fallback = null, }) {
|
|
31
|
+
// Base URL for widget DATA requests. Defaults to the same environment as
|
|
32
|
+
// `domain`, but can be set independently to point data at another
|
|
33
|
+
// environment (e.g. a quick prod/preview flip for testing) without changing
|
|
34
|
+
// which bundle/theme `domain` loads.
|
|
35
|
+
const resolvedApiBaseUrl = apiBaseUrl ?? `https://${domain}`;
|
|
31
36
|
const [isLoaded, setIsLoaded] = useState(() => {
|
|
32
37
|
// If already loaded (e.g., script tag in HTML), skip loading
|
|
33
38
|
return typeof window !== "undefined" && !!window.MBB;
|
|
@@ -40,6 +45,9 @@ export function BuyingBuddyProvider({ accountId, domain = "www.mbb2.com", childr
|
|
|
40
45
|
let attempts = 0;
|
|
41
46
|
const check = () => {
|
|
42
47
|
if (window.MBB) {
|
|
48
|
+
// Set before the widget bundle (appended by the bootstrap, loaded
|
|
49
|
+
// async) makes its first data request, so DATA follows this base URL.
|
|
50
|
+
window.MBB.apiBaseUrl = resolvedApiBaseUrl;
|
|
43
51
|
LOADED_ACCOUNTS.add(accountId);
|
|
44
52
|
setIsLoaded(true);
|
|
45
53
|
}
|
|
@@ -55,10 +63,29 @@ export function BuyingBuddyProvider({ accountId, domain = "www.mbb2.com", childr
|
|
|
55
63
|
}
|
|
56
64
|
};
|
|
57
65
|
check();
|
|
58
|
-
}, [accountId]);
|
|
66
|
+
}, [accountId, resolvedApiBaseUrl]);
|
|
59
67
|
useEffect(() => {
|
|
60
68
|
if (typeof window === "undefined")
|
|
61
69
|
return;
|
|
70
|
+
// Inject the widget theme stylesheet. The official plugin embed loads
|
|
71
|
+
// this separately from the runtime script; without it the widgets render
|
|
72
|
+
// unthemed and the map logs "Missing acid or theme data". Uses the same
|
|
73
|
+
// `domain` as the API so the theme follows the environment (production vs
|
|
74
|
+
// preview) — if a given environment serves bad CSS, that's the
|
|
75
|
+
// environment's problem, not this package's.
|
|
76
|
+
const themeId = `mbb-theme-${accountId}`;
|
|
77
|
+
if (!document.getElementById(themeId)) {
|
|
78
|
+
const theme = document.createElement("script");
|
|
79
|
+
theme.id = themeId;
|
|
80
|
+
theme.src = `https://${domain}/version3/css/theme/acid/${accountId}`;
|
|
81
|
+
theme.async = true;
|
|
82
|
+
document.head.appendChild(theme);
|
|
83
|
+
}
|
|
84
|
+
// If the runtime global already exists (this mount, a prior mount, or a
|
|
85
|
+
// script tag in the page), point data requests at the resolved base now.
|
|
86
|
+
if (window.MBB) {
|
|
87
|
+
window.MBB.apiBaseUrl = resolvedApiBaseUrl;
|
|
88
|
+
}
|
|
62
89
|
// Already loaded for this account
|
|
63
90
|
if (window.MBB && LOADED_ACCOUNTS.has(accountId)) {
|
|
64
91
|
setIsLoaded(true);
|
|
@@ -82,7 +109,7 @@ export function BuyingBuddyProvider({ accountId, domain = "www.mbb2.com", childr
|
|
|
82
109
|
return () => {
|
|
83
110
|
// Don't remove the script on unmount — MBB global state is persistent
|
|
84
111
|
};
|
|
85
|
-
}, [accountId, domain, handleLoad]);
|
|
112
|
+
}, [accountId, domain, resolvedApiBaseUrl, handleLoad]);
|
|
86
113
|
const value = { isLoaded, error, accountId };
|
|
87
114
|
return (_jsx(BuyingBuddyContext.Provider, { value: value, children: error ? (_jsxs("div", { role: "alert", style: { color: "#b91c1c", padding: "12px", border: "1px solid #fca5a5", borderRadius: "6px", backgroundColor: "#fef2f2", fontFamily: "sans-serif", fontSize: "14px" }, children: [_jsx("strong", { children: "BuyingBuddy Error:" }), " ", error.message] })) : isLoaded ? children : fallback }));
|
|
88
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuyingBuddyProvider.js","sourceRoot":"","sources":["../src/BuyingBuddyProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,O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AC,SAAS,EAAE,MAAM,EAAE,kBAAkB,EAAE,UAAU,CAAC,CAAC,CAAC;IAExD,MAAM,KAAK,GAA4B,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAEtE,OAAO,CACL,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACtC,KAAK,CAAC,CAAC,CAAC,CACP,eAAK,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,aACtL,kDAAmC,OAAE,KAAK,CAAC,OAAO,IAC9C,CACP,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GACN,CAC/B,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -26,7 +26,10 @@ export interface BuyingBuddyWidgetProps {
|
|
|
26
26
|
* Example: "price_asc", "price_desc", "date_listed_desc"
|
|
27
27
|
*/
|
|
28
28
|
order?: string;
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Sets the `demo` attribute on the widget element. Note: a valid
|
|
31
|
+
* account ID is still required — there is no account-less preview mode.
|
|
32
|
+
*/
|
|
30
33
|
demo?: boolean | string;
|
|
31
34
|
/** Show only featured listings. */
|
|
32
35
|
featured?: boolean | string;
|
|
@@ -49,10 +52,20 @@ export interface BuyingBuddyProviderProps {
|
|
|
49
52
|
*/
|
|
50
53
|
accountId: string;
|
|
51
54
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
55
|
+
* Domain the runtime script, theme, and config are loaded from.
|
|
56
|
+
* Defaults to "www.mbb2.com". This selects which environment's widget
|
|
57
|
+
* bundle and theme you get (e.g. "preview.mbb2.com" for preview).
|
|
58
|
+
* Only change this if directed by BuyingBuddy support or for testing.
|
|
54
59
|
*/
|
|
55
60
|
domain?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Base URL for widget DATA requests (`window.MBB.apiBaseUrl`).
|
|
63
|
+
* Defaults to `https://{domain}`, so data follows the same environment as
|
|
64
|
+
* `domain`. Set it explicitly to point data at a different environment
|
|
65
|
+
* independently of the bundle/theme — e.g. a quick prod/preview flip for
|
|
66
|
+
* testing. Example: "https://preview.mbb2.com".
|
|
67
|
+
*/
|
|
68
|
+
apiBaseUrl?: string;
|
|
56
69
|
/** Children to render once the script is loaded. */
|
|
57
70
|
children: React.ReactNode;
|
|
58
71
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAC7B,aAAa,GACb,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,YAAY,GACZ,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,eAAe,GACf,aAAa,GACb,iBAAiB,GACjB,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,YAAY,GACZ,SAAS,GACT,cAAc,GACd,YAAY,GACZ,cAAc,GACd,aAAa,GACb,YAAY,GACZ,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,uCAAuC;IACvC,IAAI,EAAE,qBAAqB,CAAC;IAE5B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,M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