@buyingbuddy/react 0.0.3 → 0.1.1
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/LICENSE +21 -0
- package/README.md +38 -69
- package/dist/BuyingBuddyProvider.d.ts +3 -3
- package/dist/BuyingBuddyProvider.d.ts.map +1 -1
- package/dist/BuyingBuddyProvider.js +61 -50
- package/dist/BuyingBuddyProvider.js.map +1 -1
- package/dist/BuyingBuddyWidget.d.ts +1 -1
- package/dist/BuyingBuddyWidget.d.ts.map +1 -1
- package/dist/BuyingBuddyWidget.js +51 -12
- package/dist/BuyingBuddyWidget.js.map +1 -1
- package/dist/types.d.ts +5 -13
- package/dist/types.d.ts.map +1 -1
- package/framer/BuyingBuddyWidget.tsx +274 -0
- package/package.json +16 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Blue Fire Group
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @buyingbuddy/react
|
|
2
2
|
|
|
3
|
-
React components
|
|
3
|
+
Add IDX/MLS integration to your site with React components that embed [Buying Buddy IDX CRM](https://www.buyingbuddy.com) widgets - MLS property search, map-based results, detailed listing pages, featured-listing showcases, lead-capture forms, and market reports.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Buying Buddy widgets ship as a `<bb-widget>` custom element loaded from the Buying Buddy 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
6
|
|
|
7
7
|
Works with **React**, **Next.js**, and **Framer**.
|
|
8
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
|
|
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 Buying Buddy account dashboard (**Widgets → Plugin Installation and Setup**) instead.
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
@@ -40,8 +40,10 @@ Then paste one of the examples below into `src/App.jsx` and save — the page re
|
|
|
40
40
|
|
|
41
41
|
Before anything will render, you need both of these:
|
|
42
42
|
|
|
43
|
-
1. **A
|
|
44
|
-
2. **Your domain authorized on that account.** An
|
|
43
|
+
1. **A Buying Buddy account activation key.** 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 activation key.
|
|
44
|
+
2. **Your domain authorized on that account.** An activation key only works on domains registered to its account. Running on an unauthorized domain produces an "invalid account / unauthorized domain" error.
|
|
45
|
+
|
|
46
|
+
**Don't have an account yet?** [Start a free trial](https://buyingbuddy.com/free-trial-idx-plugin.php) or [buy a license](https://buyingbuddy.com/order) to get your activation key.
|
|
45
47
|
|
|
46
48
|
## Quick start
|
|
47
49
|
|
|
@@ -50,40 +52,34 @@ import { BuyingBuddyProvider, BuyingBuddyWidget } from "@buyingbuddy/react";
|
|
|
50
52
|
|
|
51
53
|
export default function App() {
|
|
52
54
|
return (
|
|
53
|
-
<BuyingBuddyProvider
|
|
54
|
-
<BuyingBuddyWidget type="FeaturedGallery" limit
|
|
55
|
+
<BuyingBuddyProvider activationKey="account-activation-key">
|
|
56
|
+
<BuyingBuddyWidget type="FeaturedGallery" filter="limit:12" />
|
|
55
57
|
</BuyingBuddyProvider>
|
|
56
58
|
);
|
|
57
59
|
}
|
|
58
60
|
```
|
|
59
61
|
|
|
60
|
-
Replace `
|
|
62
|
+
Replace `account-activation-key` with your `activationKey`. The provider loads the Buying Buddy 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
63
|
|
|
62
64
|
## Examples
|
|
63
65
|
|
|
64
|
-
**A
|
|
66
|
+
**A standalone search form:**
|
|
65
67
|
|
|
66
68
|
```jsx
|
|
67
|
-
<BuyingBuddyProvider
|
|
68
|
-
<BuyingBuddyWidget type="
|
|
69
|
+
<BuyingBuddyProvider activationKey="account-activation-key">
|
|
70
|
+
<BuyingBuddyWidget type="SearchForm" />
|
|
69
71
|
</BuyingBuddyProvider>
|
|
70
72
|
```
|
|
71
73
|
|
|
72
|
-
**
|
|
73
|
-
|
|
74
|
-
```jsx
|
|
75
|
-
<BuyingBuddyWidget type="SearchForm" />
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
**FeaturedGallery / FeaturedList show the account's own (featured) listings**, with `limit` capping how many:
|
|
74
|
+
**FeaturedGallery / FeaturedList show the account's own (featured) listings**, with a `limit:` token in the filter capping how many:
|
|
79
75
|
|
|
80
76
|
```jsx
|
|
81
|
-
<BuyingBuddyWidget type="FeaturedGallery" limit
|
|
77
|
+
<BuyingBuddyWidget type="FeaturedGallery" filter="limit:12" />
|
|
82
78
|
```
|
|
83
79
|
|
|
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,
|
|
80
|
+
> 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, add search criteria to the `filter` (below).
|
|
85
81
|
|
|
86
|
-
**Driving a gallery by search criteria.**
|
|
82
|
+
**Driving a gallery by search criteria.** All options are expressed as `+`-joined tokens inside a single `filter` string — criteria, sort, and count alike. Use `FIELD()` for a field that accepts several values:
|
|
87
83
|
|
|
88
84
|
```jsx
|
|
89
85
|
{/* 6 listings over $300k, priced high-to-low */}
|
|
@@ -99,20 +95,19 @@ Replace `your-account-id` with your `acid`. The provider loads the BuyingBuddy s
|
|
|
99
95
|
/>
|
|
100
96
|
```
|
|
101
97
|
|
|
102
|
-
**
|
|
98
|
+
**A map-bound results list** (results widgets are driven by the search/cookie state, and `SearchResults` is bound to the map viewport):
|
|
103
99
|
|
|
104
100
|
```jsx
|
|
105
|
-
<BuyingBuddyWidget
|
|
101
|
+
<BuyingBuddyWidget
|
|
102
|
+
type="SearchResults"
|
|
103
|
+
filter="city:Denver+price_min:300000+orderby:price desc"
|
|
104
|
+
/>
|
|
106
105
|
```
|
|
107
106
|
|
|
108
|
-
**
|
|
107
|
+
**An interactive map with a fixed height:**
|
|
109
108
|
|
|
110
109
|
```jsx
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const handleLoaded = useCallback(() => console.log("gallery ready"), []);
|
|
114
|
-
|
|
115
|
-
<BuyingBuddyWidget type="FeaturedGallery" onWidgetLoaded={handleLoaded} />
|
|
110
|
+
<BuyingBuddyWidget type="InteractiveMap" style={{ height: "600px" }} />
|
|
116
111
|
```
|
|
117
112
|
|
|
118
113
|
### Next.js
|
|
@@ -128,7 +123,7 @@ import { BuyingBuddyProvider, BuyingBuddyWidget } from "@buyingbuddy/react";
|
|
|
128
123
|
|
|
129
124
|
export default function Page() {
|
|
130
125
|
return (
|
|
131
|
-
<BuyingBuddyProvider
|
|
126
|
+
<BuyingBuddyProvider activationKey="account-activation-key" fallback={<p>Loading…</p>}>
|
|
132
127
|
<BuyingBuddyWidget type="SearchResults" />
|
|
133
128
|
</BuyingBuddyProvider>
|
|
134
129
|
);
|
|
@@ -139,25 +134,22 @@ Because the widgets are client-only, their listing content is **not server-rende
|
|
|
139
134
|
|
|
140
135
|
### Framer
|
|
141
136
|
|
|
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 (
|
|
137
|
+
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 (activation key, widget type, filter), so you configure everything from Framer's design panel — no React code required.
|
|
143
138
|
|
|
144
|
-
1. Open
|
|
139
|
+
1. Open [`framer/BuyingBuddyWidget.tsx`](framer/BuyingBuddyWidget.tsx) and copy its entire contents. (It also ships inside the npm package at `node_modules/@buyingbuddy/react/framer/BuyingBuddyWidget.tsx`.)
|
|
145
140
|
2. In Framer, go to **Assets → Code → +** and paste it in.
|
|
146
|
-
3. Drag the component onto your canvas and set your **
|
|
141
|
+
3. Drag the component onto your canvas and set your **activation key** in the property panel.
|
|
147
142
|
|
|
148
143
|
## API
|
|
149
144
|
|
|
150
145
|
### `<BuyingBuddyProvider>`
|
|
151
146
|
|
|
152
|
-
Loads the
|
|
147
|
+
Loads the Buying Buddy runtime for an account and makes it available to the widgets inside it. Use **one** provider, near the top of your tree.
|
|
153
148
|
|
|
154
149
|
| Prop | Type | Default | Description |
|
|
155
150
|
|------|------|---------|-------------|
|
|
156
|
-
| `
|
|
157
|
-
| `
|
|
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). |
|
|
151
|
+
| `activationKey` | `string` | — | **Required.** Your Buying Buddy account activation key. |
|
|
152
|
+
| `fallback` | `ReactNode` | `null` | Rendered while the script is loading. Not shown on error — see Caveats. |
|
|
161
153
|
|
|
162
154
|
### `<BuyingBuddyWidget>`
|
|
163
155
|
|
|
@@ -166,34 +158,11 @@ Renders a single widget. Must be a descendant of `<BuyingBuddyProvider>`.
|
|
|
166
158
|
| Prop | Type | Description |
|
|
167
159
|
|------|------|-------------|
|
|
168
160
|
| `type` | `BuyingBuddyWidgetType` | **Required.** Widget to render — e.g. `"FeaturedGallery"`, `"SearchForm"`, `"SearchResults"`, `"InteractiveMap"`, `"SearchDetails"`. |
|
|
169
|
-
| `filter` | `string` | Property filter
|
|
170
|
-
| `
|
|
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). |
|
|
161
|
+
| `filter` | `string` | Property filter as `+`-joined tokens, e.g. `"city:Denver+FIELD(property_beds:3,4,5)+orderby:price desc+limit:9"`. |
|
|
162
|
+
| `style` | `React.CSSProperties` | Inline styles applied to the wrapper `<div>` (not forwarded to the widget element). Useful for sizing widgets such as `InteractiveMap`. |
|
|
178
163
|
|
|
179
164
|
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
165
|
|
|
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
166
|
### TypeScript
|
|
198
167
|
|
|
199
168
|
The package is written in TypeScript and ships its own types. These are exported for your own typing needs:
|
|
@@ -209,13 +178,13 @@ import type {
|
|
|
209
178
|
|
|
210
179
|
## Caveats & limitations
|
|
211
180
|
|
|
212
|
-
- **One account per page.** The
|
|
181
|
+
- **One account per page.** The Buying Buddy script installs a single global, so a page is expected to use one `activationKey`. Rendering two providers with different activation keys on the same page is not supported.
|
|
213
182
|
- **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
|
|
183
|
+
- **Changing a prop rebuilds the widget.** Changing `type` or `filter` tears down and recreates the underlying `<bb-widget>`, losing in-widget state (map position, scroll, form input).
|
|
215
184
|
- **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
|
|
185
|
+
- **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't currently replace the default error UI.
|
|
217
186
|
- **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.
|
|
187
|
+
- **Pre-release.** This package is `0.x` — the API may change.
|
|
219
188
|
|
|
220
189
|
## Development
|
|
221
190
|
|
|
@@ -228,4 +197,4 @@ npm test # run the unit tests (vitest)
|
|
|
228
197
|
|
|
229
198
|
## License
|
|
230
199
|
|
|
231
|
-
|
|
200
|
+
[MIT](LICENSE) © Blue Fire Group / Buying Buddy
|
|
@@ -16,16 +16,16 @@ declare global {
|
|
|
16
16
|
/**
|
|
17
17
|
* Provides the BuyingBuddy runtime context to child components.
|
|
18
18
|
*
|
|
19
|
-
* Loads the MBB script tag for the given
|
|
19
|
+
* Loads the MBB script tag for the given activation key and exposes
|
|
20
20
|
* loading state via context. Widgets rendered as children will
|
|
21
21
|
* wait for the script to load before mounting.
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```tsx
|
|
25
|
-
* <BuyingBuddyProvider
|
|
25
|
+
* <BuyingBuddyProvider activationKey="your-activation-key">
|
|
26
26
|
* <BuyingBuddyWidget type="FeaturedGallery" limit={12} />
|
|
27
27
|
* </BuyingBuddyProvider>
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export declare function BuyingBuddyProvider({
|
|
30
|
+
export declare function BuyingBuddyProvider({ activationKey, 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,
|
|
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,aAAa,EACb,MAAuB,EACvB,UAAU,EACV,QAAQ,EACR,QAAe,GAChB,EAAE,wBAAwB,2CAkH1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, useEffect, useState
|
|
2
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
3
3
|
const BuyingBuddyContext = createContext(null);
|
|
4
4
|
/**
|
|
5
5
|
* Hook to access the BuyingBuddy context.
|
|
@@ -16,18 +16,18 @@ const LOADED_ACCOUNTS = new Set();
|
|
|
16
16
|
/**
|
|
17
17
|
* Provides the BuyingBuddy runtime context to child components.
|
|
18
18
|
*
|
|
19
|
-
* Loads the MBB script tag for the given
|
|
19
|
+
* Loads the MBB script tag for the given activation key and exposes
|
|
20
20
|
* loading state via context. Widgets rendered as children will
|
|
21
21
|
* wait for the script to load before mounting.
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```tsx
|
|
25
|
-
* <BuyingBuddyProvider
|
|
25
|
+
* <BuyingBuddyProvider activationKey="your-activation-key">
|
|
26
26
|
* <BuyingBuddyWidget type="FeaturedGallery" limit={12} />
|
|
27
27
|
* </BuyingBuddyProvider>
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export function BuyingBuddyProvider({
|
|
30
|
+
export function BuyingBuddyProvider({ activationKey, domain = "www.mbb2.com", apiBaseUrl, children, fallback = null, }) {
|
|
31
31
|
// Base URL for widget DATA requests. Defaults to the same environment as
|
|
32
32
|
// `domain`, but can be set independently to point data at another
|
|
33
33
|
// environment (e.g. a quick prod/preview flip for testing) without changing
|
|
@@ -38,32 +38,6 @@ export function BuyingBuddyProvider({ accountId, domain = "www.mbb2.com", apiBas
|
|
|
38
38
|
return typeof window !== "undefined" && !!window.MBB;
|
|
39
39
|
});
|
|
40
40
|
const [error, setError] = useState(null);
|
|
41
|
-
const handleLoad = useCallback(() => {
|
|
42
|
-
// Poll for MBB global — the JSONP script sets it after execution.
|
|
43
|
-
// Also detect the server's invalid-account response which defines
|
|
44
|
-
// displayInvalidAcidMsg instead of setting window.MBB.
|
|
45
|
-
let attempts = 0;
|
|
46
|
-
const check = () => {
|
|
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;
|
|
51
|
-
LOADED_ACCOUNTS.add(accountId);
|
|
52
|
-
setIsLoaded(true);
|
|
53
|
-
}
|
|
54
|
-
else if ("displayInvalidAcidMsg" in window ||
|
|
55
|
-
attempts >= 50) {
|
|
56
|
-
setError(new Error("displayInvalidAcidMsg" in window
|
|
57
|
-
? "BuyingBuddy: Invalid Account ID or unauthorized domain. Check your accountId and ensure this domain is registered in your BuyingBuddy dashboard."
|
|
58
|
-
: "BuyingBuddy script loaded but MBB global was not initialized."));
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
attempts++;
|
|
62
|
-
setTimeout(check, 100);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
check();
|
|
66
|
-
}, [accountId, resolvedApiBaseUrl]);
|
|
67
41
|
useEffect(() => {
|
|
68
42
|
if (typeof window === "undefined")
|
|
69
43
|
return;
|
|
@@ -73,11 +47,11 @@ export function BuyingBuddyProvider({ accountId, domain = "www.mbb2.com", apiBas
|
|
|
73
47
|
// `domain` as the API so the theme follows the environment (production vs
|
|
74
48
|
// preview) — if a given environment serves bad CSS, that's the
|
|
75
49
|
// environment's problem, not this package's.
|
|
76
|
-
const themeId = `mbb-theme-${
|
|
50
|
+
const themeId = `mbb-theme-${activationKey}`;
|
|
77
51
|
if (!document.getElementById(themeId)) {
|
|
78
52
|
const theme = document.createElement("script");
|
|
79
53
|
theme.id = themeId;
|
|
80
|
-
theme.src = `https://${domain}/version3/css/theme/acid/${
|
|
54
|
+
theme.src = `https://${domain}/version3/css/theme/acid/${activationKey}`;
|
|
81
55
|
theme.async = true;
|
|
82
56
|
document.head.appendChild(theme);
|
|
83
57
|
}
|
|
@@ -86,31 +60,68 @@ export function BuyingBuddyProvider({ accountId, domain = "www.mbb2.com", apiBas
|
|
|
86
60
|
if (window.MBB) {
|
|
87
61
|
window.MBB.apiBaseUrl = resolvedApiBaseUrl;
|
|
88
62
|
}
|
|
89
|
-
// Already loaded for this account
|
|
90
|
-
if (window.MBB && LOADED_ACCOUNTS.has(
|
|
63
|
+
// Already loaded for this account — nothing more to do.
|
|
64
|
+
if (window.MBB && LOADED_ACCOUNTS.has(activationKey)) {
|
|
91
65
|
setIsLoaded(true);
|
|
92
66
|
return;
|
|
93
67
|
}
|
|
94
|
-
|
|
95
|
-
//
|
|
68
|
+
// Poll for the MBB global — the JSONP script sets it after execution.
|
|
69
|
+
// Also detect the server's invalid-account response, which defines
|
|
70
|
+
// displayInvalidAcidMsg instead of setting window.MBB. The poll is
|
|
71
|
+
// cancellable so it can't setState after unmount or run twice (Strict Mode).
|
|
72
|
+
let cancelled = false;
|
|
73
|
+
let timer;
|
|
74
|
+
let attempts = 0;
|
|
75
|
+
const check = () => {
|
|
76
|
+
if (cancelled)
|
|
77
|
+
return;
|
|
78
|
+
if (window.MBB) {
|
|
79
|
+
// Set before the widget bundle (appended by the bootstrap, loaded
|
|
80
|
+
// async) makes its first data request, so DATA follows this base URL.
|
|
81
|
+
window.MBB.apiBaseUrl = resolvedApiBaseUrl;
|
|
82
|
+
LOADED_ACCOUNTS.add(activationKey);
|
|
83
|
+
setIsLoaded(true);
|
|
84
|
+
}
|
|
85
|
+
else if ("displayInvalidAcidMsg" in window || attempts >= 50) {
|
|
86
|
+
setError(new Error("displayInvalidAcidMsg" in window
|
|
87
|
+
? "BuyingBuddy: Invalid activation key or unauthorized domain. Check your activationKey and ensure this domain is registered in your BuyingBuddy dashboard."
|
|
88
|
+
: "BuyingBuddy script loaded but MBB global was not initialized."));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
attempts++;
|
|
92
|
+
timer = setTimeout(check, 100);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const scriptId = `mbb-script-${activationKey}`;
|
|
96
|
+
// Script tag already exists in the DOM — just start polling.
|
|
96
97
|
if (document.getElementById(scriptId)) {
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
check();
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const script = document.createElement("script");
|
|
102
|
+
script.id = scriptId;
|
|
103
|
+
script.src = `https://${domain}/mbbv3/index/acid/${activationKey}`;
|
|
104
|
+
script.async = true;
|
|
105
|
+
script.onload = () => {
|
|
106
|
+
if (!cancelled)
|
|
107
|
+
check();
|
|
108
|
+
};
|
|
109
|
+
script.onerror = () => {
|
|
110
|
+
if (cancelled)
|
|
111
|
+
return;
|
|
112
|
+
setError(new Error(`Failed to load BuyingBuddy script for account: ${activationKey}`));
|
|
113
|
+
};
|
|
114
|
+
document.head.appendChild(script);
|
|
99
115
|
}
|
|
100
|
-
const script = document.createElement("script");
|
|
101
|
-
script.id = scriptId;
|
|
102
|
-
script.src = `https://${domain}/mbbv3/index/acid/${accountId}`;
|
|
103
|
-
script.async = true;
|
|
104
|
-
script.onload = handleLoad;
|
|
105
|
-
script.onerror = () => {
|
|
106
|
-
setError(new Error(`Failed to load BuyingBuddy script for account: ${accountId}`));
|
|
107
|
-
};
|
|
108
|
-
document.head.appendChild(script);
|
|
109
116
|
return () => {
|
|
110
|
-
// Don't remove the script
|
|
117
|
+
// Don't remove the script (MBB global state is persistent); just stop the
|
|
118
|
+
// poll so it can't setState after unmount.
|
|
119
|
+
cancelled = true;
|
|
120
|
+
if (timer)
|
|
121
|
+
clearTimeout(timer);
|
|
111
122
|
};
|
|
112
|
-
}, [
|
|
113
|
-
const value = { isLoaded, error,
|
|
123
|
+
}, [activationKey, domain, resolvedApiBaseUrl]);
|
|
124
|
+
const value = { isLoaded, error, activationKey };
|
|
114
125
|
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 }));
|
|
115
126
|
}
|
|
116
127
|
//# sourceMappingURL=BuyingBuddyProvider.js.map
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"BuyingBuddyProvider.js","sourceRoot":"","sources":["../src/BuyingBuddyProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGvE,MAAM,kBAAkB,GAAG,aAAa,CAAiC,IAAI,CAAC,CAAC;AAE/E;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAC3C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,4DAA4D,CAC7D,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAYD,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,aAAa,EACb,MAAM,GAAG,cAAc,EACvB,UAAU,EACV,QAAQ,EACR,QAAQ,GAAG,IAAI,GACU;IACzB,yEAAyE;IACzE,kEAAkE;IAClE,4EAA4E;IAC5E,qCAAqC;IACrC,MAAM,kBAAkB,GAAG,UAAU,IAAI,WAAW,MAAM,EAAE,CAAC;IAC7D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC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AO;gBACtB,QAAQ,CACN,IAAI,KAAK,CACP,kDAAkD,aAAa,EAAE,CAClE,CACF,CAAC;YACJ,CAAC,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,GAAG,EAAE;YACV,0EAA0E;YAC1E,2CAA2C;YAC3C,SAAS,GAAG,IAAI,CAAC;YACjB,IAAI,KAAK;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEhD,MAAM,KAAK,GAA4B,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;IAE1E,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"}
|
|
@@ -16,5 +16,5 @@ import type { BuyingBuddyWidgetProps } from "./types";
|
|
|
16
16
|
* <BuyingBuddyWidget type="InteractiveMap" style={{ height: "600px" }} />
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export declare function BuyingBuddyWidget({ type, filter, limit, order,
|
|
19
|
+
export declare function BuyingBuddyWidget({ type, filter, limit, order, style, className, id, onWidgetLoaded, }: BuyingBuddyWidgetProps): import("react/jsx-runtime").JSX.Element | null;
|
|
20
20
|
//# sourceMappingURL=BuyingBuddyWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuyingBuddyWidget.d.ts","sourceRoot":"","sources":["../src/BuyingBuddyWidget.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACL,
|
|
1
|
+
{"version":3,"file":"BuyingBuddyWidget.d.ts","sourceRoot":"","sources":["../src/BuyingBuddyWidget.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,EAAE,EACF,cAAc,GACf,EAAE,sBAAsB,kDAyFxB"}
|
|
@@ -18,9 +18,17 @@ import { useBuyingBuddy } from "./BuyingBuddyProvider";
|
|
|
18
18
|
* <BuyingBuddyWidget type="InteractiveMap" style={{ height: "600px" }} />
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
|
-
export function BuyingBuddyWidget({ type, filter, limit, order,
|
|
21
|
+
export function BuyingBuddyWidget({ type, filter, limit, order, style, className, id, onWidgetLoaded, }) {
|
|
22
22
|
const containerRef = useRef(null);
|
|
23
23
|
const { isLoaded } = useBuyingBuddy();
|
|
24
|
+
// Keep the latest onWidgetLoaded in a ref so changing its identity (e.g. an
|
|
25
|
+
// inline arrow created on every render) does NOT re-run the widget effect and
|
|
26
|
+
// rebuild the <bb-widget> — which would drop map position / scroll / form
|
|
27
|
+
// state and re-fire data requests.
|
|
28
|
+
const onWidgetLoadedRef = useRef(onWidgetLoaded);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
onWidgetLoadedRef.current = onWidgetLoaded;
|
|
31
|
+
}, [onWidgetLoaded]);
|
|
24
32
|
useEffect(() => {
|
|
25
33
|
const container = containerRef.current;
|
|
26
34
|
if (!container || !isLoaded)
|
|
@@ -39,23 +47,54 @@ export function BuyingBuddyWidget({ type, filter, limit, order, demo, featured,
|
|
|
39
47
|
widget.setAttribute("limit", String(limit));
|
|
40
48
|
if (order !== undefined)
|
|
41
49
|
widget.setAttribute("order", order);
|
|
42
|
-
if (demo !== undefined)
|
|
43
|
-
widget.setAttribute("demo", String(demo));
|
|
44
|
-
if (featured !== undefined)
|
|
45
|
-
widget.setAttribute("featured", String(featured));
|
|
46
50
|
if (id !== undefined)
|
|
47
51
|
widget.setAttribute("id", id);
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
// Make the custom element fill the wrapper so a size applied via `style`
|
|
53
|
+
// (e.g. a fixed height for InteractiveMap / SearchResults) actually reaches
|
|
54
|
+
// the widget and its internal sticky-map/scroll layout — mirroring native
|
|
55
|
+
// usage where height is set on <bb-widget> directly. Without this the
|
|
56
|
+
// element sizes to its content and overflows a height-constrained wrapper
|
|
57
|
+
// (which then gets clipped → the widget looks broken).
|
|
58
|
+
widget.style.display = "block";
|
|
59
|
+
widget.style.width = "100%";
|
|
60
|
+
widget.style.height = "100%";
|
|
61
|
+
// Fires when the widget finishes loading. The runtime's `componentLoaded`
|
|
62
|
+
// event is NOT composed, so depending on the widget it's dispatched either
|
|
63
|
+
// on the host element (search widgets) or inside the shadow root (most
|
|
64
|
+
// widgets), where it bubbles to the shadow root but not across to the host.
|
|
65
|
+
// Listen on both, firing once, and read the callback from a ref so it isn't
|
|
66
|
+
// an effect dependency (avoids needless rebuilds).
|
|
67
|
+
let firedLoaded = false;
|
|
68
|
+
const fireLoaded = () => {
|
|
69
|
+
if (firedLoaded)
|
|
70
|
+
return;
|
|
71
|
+
firedLoaded = true;
|
|
72
|
+
onWidgetLoadedRef.current?.();
|
|
73
|
+
};
|
|
74
|
+
widget.addEventListener("componentLoaded", fireLoaded, { once: true });
|
|
54
75
|
container.appendChild(widget);
|
|
76
|
+
// The shadow root is created during connectedCallback; poll briefly for it,
|
|
77
|
+
// then listen there for the in-shadow dispatch.
|
|
78
|
+
let shadowTimer;
|
|
79
|
+
let attempts = 0;
|
|
80
|
+
const attachShadowListener = () => {
|
|
81
|
+
if (firedLoaded)
|
|
82
|
+
return;
|
|
83
|
+
const root = widget.shadowRoot;
|
|
84
|
+
if (root) {
|
|
85
|
+
root.addEventListener("componentLoaded", fireLoaded, { once: true });
|
|
86
|
+
}
|
|
87
|
+
else if (attempts++ < 50) {
|
|
88
|
+
shadowTimer = setTimeout(attachShadowListener, 50);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
attachShadowListener();
|
|
55
92
|
return () => {
|
|
93
|
+
if (shadowTimer)
|
|
94
|
+
clearTimeout(shadowTimer);
|
|
56
95
|
container.innerHTML = "";
|
|
57
96
|
};
|
|
58
|
-
}, [type, filter, limit, order,
|
|
97
|
+
}, [type, filter, limit, order, id, isLoaded]);
|
|
59
98
|
if (!isLoaded)
|
|
60
99
|
return null;
|
|
61
100
|
return (_jsx("div", { ref: containerRef, style: { width: "100%", ...style }, className: className, suppressHydrationWarning: true }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuyingBuddyWidget.js","sourceRoot":"","sources":["../src/BuyingBuddyWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACL,
|
|
1
|
+
{"version":3,"file":"BuyingBuddyW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AE,CAAC,CAAC;YACvE,CAAC;iBAAM,IAAI,QAAQ,EAAE,GAAG,EAAE,EAAE,CAAC;gBAC3B,WAAW,GAAG,UAAU,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;YACrD,CAAC;QACH,CAAC,CAAC;QACF,oBAAoB,EAAE,CAAC;QAEvB,OAAO,GAAG,EAAE;YACV,IAAI,WAAW;gBAAE,YAAY,CAAC,WAAW,CAAC,CAAC;YAC3C,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE/C,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,OAAO,CACL,cACE,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAClC,SAAS,EAAE,SAAS,EACpB,wBAAwB,SACxB,CACH,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -26,14 +26,7 @@ export interface BuyingBuddyWidgetProps {
|
|
|
26
26
|
* Example: "price_asc", "price_desc", "date_listed_desc"
|
|
27
27
|
*/
|
|
28
28
|
order?: string;
|
|
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
|
-
*/
|
|
33
|
-
demo?: boolean | string;
|
|
34
|
-
/** Show only featured listings. */
|
|
35
|
-
featured?: boolean | string;
|
|
36
|
-
/** Inline style object or string for the widget container. */
|
|
29
|
+
/** Inline styles for the widget. A `height` here reaches the widget element. */
|
|
37
30
|
style?: React.CSSProperties;
|
|
38
31
|
/** Additional CSS class name(s). */
|
|
39
32
|
className?: string;
|
|
@@ -47,10 +40,9 @@ export interface BuyingBuddyWidgetProps {
|
|
|
47
40
|
*/
|
|
48
41
|
export interface BuyingBuddyProviderProps {
|
|
49
42
|
/**
|
|
50
|
-
* Your BuyingBuddy account
|
|
51
|
-
* This is the `acid` value from your BuyingBuddy account.
|
|
43
|
+
* Your BuyingBuddy activation key — the `acid` value from your account.
|
|
52
44
|
*/
|
|
53
|
-
|
|
45
|
+
activationKey: string;
|
|
54
46
|
/**
|
|
55
47
|
* Domain the runtime script, theme, and config are loaded from.
|
|
56
48
|
* Defaults to "www.mbb2.com". This selects which environment's widget
|
|
@@ -82,7 +74,7 @@ export interface BuyingBuddyContextValue {
|
|
|
82
74
|
isLoaded: boolean;
|
|
83
75
|
/** Error if the script failed to load. */
|
|
84
76
|
error: Error | null;
|
|
85
|
-
/** The
|
|
86
|
-
|
|
77
|
+
/** The activation key passed to the provider. */
|
|
78
|
+
activationKey: string;
|
|
87
79
|
}
|
|
88
80
|
//# sourceMappingURL=types.d.ts.map
|
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;IAC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,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,mDAAmD;IACnD,QAAQ,EAAE,OAAO,CAAC;IAElB,0CAA0C;IAC1C,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAEpB,iDAAiD;IACjD,aAAa,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
// BuyingBuddyWidget.tsx — Framer Code Component
|
|
2
|
+
//
|
|
3
|
+
// Standalone single-file component for Framer website builder.
|
|
4
|
+
// Paste this entire file into Framer's code editor (Assets > Code > +).
|
|
5
|
+
//
|
|
6
|
+
// This is a self-contained version of @buyingbuddy/react that works
|
|
7
|
+
// within Framer's single-file constraint and provides property controls
|
|
8
|
+
// for the Framer design UI.
|
|
9
|
+
|
|
10
|
+
import { useState, useEffect, useRef } from "react"
|
|
11
|
+
import { addPropertyControls, ControlType } from "framer"
|
|
12
|
+
|
|
13
|
+
interface BuyingBuddyWidgetProps {
|
|
14
|
+
accountId: string
|
|
15
|
+
widgetType: string
|
|
16
|
+
filter: string
|
|
17
|
+
limit: number
|
|
18
|
+
order: string
|
|
19
|
+
featured: boolean
|
|
20
|
+
style?: React.CSSProperties
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* BuyingBuddy Widget
|
|
25
|
+
*
|
|
26
|
+
* Embeds any BuyingBuddy real estate widget in your Framer site.
|
|
27
|
+
* Configure your activation key and widget type in the property panel.
|
|
28
|
+
*
|
|
29
|
+
* @framerSupportedLayoutWidth any
|
|
30
|
+
* @framerSupportedLayoutHeight any
|
|
31
|
+
*/
|
|
32
|
+
export default function BuyingBuddyWidget(props: BuyingBuddyWidgetProps) {
|
|
33
|
+
const {
|
|
34
|
+
accountId,
|
|
35
|
+
widgetType,
|
|
36
|
+
filter,
|
|
37
|
+
limit,
|
|
38
|
+
order,
|
|
39
|
+
featured,
|
|
40
|
+
style: externalStyle,
|
|
41
|
+
} = props
|
|
42
|
+
|
|
43
|
+
const containerRef = useRef<HTMLDivElement>(null)
|
|
44
|
+
const [status, setStatus] = useState<"loading" | "ready" | "error">(
|
|
45
|
+
"loading"
|
|
46
|
+
)
|
|
47
|
+
const [errorMsg, setErrorMsg] = useState("")
|
|
48
|
+
|
|
49
|
+
// Load the MBB plugin script
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!accountId) {
|
|
52
|
+
setStatus("error")
|
|
53
|
+
setErrorMsg(
|
|
54
|
+
"Activation key is required. Set it in the property panel."
|
|
55
|
+
)
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Already loaded
|
|
60
|
+
if ((window as any).MBB) {
|
|
61
|
+
setStatus("ready")
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Inject the widget theme stylesheet. The plugin embed loads this
|
|
66
|
+
// separately from the runtime script; without it widgets render
|
|
67
|
+
// unthemed and the map logs "Missing acid or theme data".
|
|
68
|
+
const themeId = `mbb-theme-${accountId}`
|
|
69
|
+
if (!document.getElementById(themeId)) {
|
|
70
|
+
const theme = document.createElement("script")
|
|
71
|
+
theme.id = themeId
|
|
72
|
+
theme.src = `https://www.mbb2.com/version3/css/theme/acid/${accountId}`
|
|
73
|
+
theme.async = true
|
|
74
|
+
document.head.appendChild(theme)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const scriptId = `mbb-script-${accountId}`
|
|
78
|
+
if (document.getElementById(scriptId)) {
|
|
79
|
+
pollForMBB()
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const script = document.createElement("script")
|
|
84
|
+
script.id = scriptId
|
|
85
|
+
script.src = `https://www.mbb2.com/mbbv3/index/acid/${accountId}`
|
|
86
|
+
script.async = true
|
|
87
|
+
script.onload = () => pollForMBB()
|
|
88
|
+
script.onerror = () => {
|
|
89
|
+
setStatus("error")
|
|
90
|
+
setErrorMsg("Failed to load BuyingBuddy script.")
|
|
91
|
+
}
|
|
92
|
+
document.head.appendChild(script)
|
|
93
|
+
|
|
94
|
+
function pollForMBB() {
|
|
95
|
+
let attempts = 0
|
|
96
|
+
const check = () => {
|
|
97
|
+
if ((window as any).MBB) {
|
|
98
|
+
setStatus("ready")
|
|
99
|
+
} else if (
|
|
100
|
+
"displayInvalidAcidMsg" in (window as any) ||
|
|
101
|
+
attempts >= 50
|
|
102
|
+
) {
|
|
103
|
+
setStatus("error")
|
|
104
|
+
setErrorMsg(
|
|
105
|
+
"displayInvalidAcidMsg" in (window as any)
|
|
106
|
+
? "Invalid activation key or unauthorized domain. Check your activation key and ensure this domain is registered in your Buying Buddy dashboard (Widgets > Plugin Installation and Setup)."
|
|
107
|
+
: "BuyingBuddy script loaded but failed to initialize."
|
|
108
|
+
)
|
|
109
|
+
} else {
|
|
110
|
+
attempts++
|
|
111
|
+
setTimeout(check, 100)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
check()
|
|
115
|
+
}
|
|
116
|
+
}, [accountId])
|
|
117
|
+
|
|
118
|
+
// Create the <bb-widget> custom element imperatively
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
const container = containerRef.current
|
|
121
|
+
if (!container || status !== "ready") return
|
|
122
|
+
|
|
123
|
+
container.innerHTML = ""
|
|
124
|
+
|
|
125
|
+
const widget = document.createElement("bb-widget")
|
|
126
|
+
widget.setAttribute("data-type", widgetType)
|
|
127
|
+
if (filter) widget.setAttribute("data-filter", filter)
|
|
128
|
+
if (limit) widget.setAttribute("limit", String(limit))
|
|
129
|
+
if (order) widget.setAttribute("order", order)
|
|
130
|
+
if (featured) widget.setAttribute("featured", "true")
|
|
131
|
+
|
|
132
|
+
container.appendChild(widget)
|
|
133
|
+
|
|
134
|
+
return () => {
|
|
135
|
+
container.innerHTML = ""
|
|
136
|
+
}
|
|
137
|
+
}, [status, widgetType, filter, limit, order, featured])
|
|
138
|
+
|
|
139
|
+
if (status === "error") {
|
|
140
|
+
return (
|
|
141
|
+
<div
|
|
142
|
+
style={{
|
|
143
|
+
color: "#b91c1c",
|
|
144
|
+
padding: 12,
|
|
145
|
+
border: "1px solid #fca5a5",
|
|
146
|
+
borderRadius: 6,
|
|
147
|
+
background: "#fef2f2",
|
|
148
|
+
fontFamily: "sans-serif",
|
|
149
|
+
fontSize: 14,
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
<strong>BuyingBuddy Error:</strong> {errorMsg}
|
|
153
|
+
</div>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (status === "loading") {
|
|
158
|
+
return (
|
|
159
|
+
<div
|
|
160
|
+
style={{
|
|
161
|
+
padding: 20,
|
|
162
|
+
textAlign: "center",
|
|
163
|
+
color: "#888",
|
|
164
|
+
fontFamily: "sans-serif",
|
|
165
|
+
}}
|
|
166
|
+
>
|
|
167
|
+
Loading BuyingBuddy...
|
|
168
|
+
</div>
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<div
|
|
174
|
+
ref={containerRef}
|
|
175
|
+
style={{ width: "100%", minHeight: 200, ...externalStyle }}
|
|
176
|
+
/>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
BuyingBuddyWidget.defaultProps = {
|
|
181
|
+
accountId: "",
|
|
182
|
+
widgetType: "FeaturedGallery",
|
|
183
|
+
filter: "",
|
|
184
|
+
limit: 12,
|
|
185
|
+
order: "",
|
|
186
|
+
featured: false,
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
addPropertyControls(BuyingBuddyWidget, {
|
|
190
|
+
accountId: {
|
|
191
|
+
type: ControlType.String,
|
|
192
|
+
title: "Activation Key",
|
|
193
|
+
description: "Your Buying Buddy activation key (acid value).",
|
|
194
|
+
},
|
|
195
|
+
widgetType: {
|
|
196
|
+
type: ControlType.Enum,
|
|
197
|
+
title: "Widget Type",
|
|
198
|
+
options: [
|
|
199
|
+
"FeaturedGallery",
|
|
200
|
+
"FeaturedList",
|
|
201
|
+
"SearchForm",
|
|
202
|
+
"ListingResults",
|
|
203
|
+
"SearchDetails",
|
|
204
|
+
"QuickSearch",
|
|
205
|
+
"InteractiveMap",
|
|
206
|
+
"Communities",
|
|
207
|
+
"LcForm",
|
|
208
|
+
"LoginPanel",
|
|
209
|
+
"Calculator",
|
|
210
|
+
"MarketReport",
|
|
211
|
+
"MarketStats",
|
|
212
|
+
"Brokers",
|
|
213
|
+
"OfficeRoster",
|
|
214
|
+
"Disclaimer",
|
|
215
|
+
],
|
|
216
|
+
optionTitles: [
|
|
217
|
+
"Featured Gallery",
|
|
218
|
+
"Featured List",
|
|
219
|
+
"Search Form",
|
|
220
|
+
"Search Results",
|
|
221
|
+
"Property Details",
|
|
222
|
+
"Quick Search",
|
|
223
|
+
"Interactive Map",
|
|
224
|
+
"Communities",
|
|
225
|
+
"Lead Capture Form",
|
|
226
|
+
"Login Panel",
|
|
227
|
+
"Mortgage Calculator",
|
|
228
|
+
"Market Report",
|
|
229
|
+
"Market Stats",
|
|
230
|
+
"Brokers",
|
|
231
|
+
"Office Roster",
|
|
232
|
+
"MLS Disclaimer",
|
|
233
|
+
],
|
|
234
|
+
},
|
|
235
|
+
filter: {
|
|
236
|
+
type: ControlType.String,
|
|
237
|
+
title: "Filter",
|
|
238
|
+
description:
|
|
239
|
+
'Property filter, e.g. "city:denver+price_min:300000" or "formType:simple1"',
|
|
240
|
+
placeholder: "city:denver+price_min:300000",
|
|
241
|
+
},
|
|
242
|
+
limit: {
|
|
243
|
+
type: ControlType.Number,
|
|
244
|
+
title: "Limit",
|
|
245
|
+
description: "Maximum number of results to display.",
|
|
246
|
+
min: 1,
|
|
247
|
+
max: 100,
|
|
248
|
+
step: 1,
|
|
249
|
+
},
|
|
250
|
+
order: {
|
|
251
|
+
type: ControlType.Enum,
|
|
252
|
+
title: "Sort Order",
|
|
253
|
+
options: [
|
|
254
|
+
"",
|
|
255
|
+
"price_asc",
|
|
256
|
+
"price_desc",
|
|
257
|
+
"date_listed_desc",
|
|
258
|
+
"date_listed_asc",
|
|
259
|
+
],
|
|
260
|
+
optionTitles: [
|
|
261
|
+
"Default",
|
|
262
|
+
"Price: Low to High",
|
|
263
|
+
"Price: High to Low",
|
|
264
|
+
"Newest First",
|
|
265
|
+
"Oldest First",
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
featured: {
|
|
269
|
+
type: ControlType.Boolean,
|
|
270
|
+
title: "Featured Only",
|
|
271
|
+
enabledTitle: "Yes",
|
|
272
|
+
disabledTitle: "No",
|
|
273
|
+
},
|
|
274
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buyingbuddy/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "React wrapper for BuyingBuddy Web Component widgets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"framer"
|
|
17
18
|
],
|
|
18
19
|
"scripts": {
|
|
19
20
|
"build": "tsc",
|
|
@@ -37,13 +38,23 @@
|
|
|
37
38
|
},
|
|
38
39
|
"keywords": [
|
|
39
40
|
"buyingbuddy",
|
|
40
|
-
"react",
|
|
41
41
|
"web-components",
|
|
42
|
+
"nextjs",
|
|
43
|
+
"framer",
|
|
42
44
|
"real-estate",
|
|
43
45
|
"idx",
|
|
44
|
-
"
|
|
46
|
+
"idx-search",
|
|
47
|
+
"mls",
|
|
48
|
+
"mls-integration",
|
|
49
|
+
"property-listings",
|
|
50
|
+
"property-search",
|
|
51
|
+
"real-estate-crm",
|
|
52
|
+
"real-estate-marketing"
|
|
45
53
|
],
|
|
46
|
-
"license": "
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
},
|
|
47
58
|
"repository": {
|
|
48
59
|
"type": "git",
|
|
49
60
|
"url": "https://github.com/Blue-Fire-Group/buyingbuddy.git",
|