@buyingbuddy/react 0.3.2 → 0.3.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/CHANGELOG.md +54 -0
- package/dist/BuyingBuddyProvider.d.ts +14 -0
- package/dist/BuyingBuddyProvider.d.ts.map +1 -1
- package/dist/BuyingBuddyProvider.js +186 -57
- package/dist/BuyingBuddyProvider.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,60 @@ major version is `0`, a breaking change bumps the **minor** version.
|
|
|
8
8
|
Entries before 0.3.0 were reconstructed from the repository history when this file was
|
|
9
9
|
added, so they summarize each release rather than record it at the time.
|
|
10
10
|
|
|
11
|
+
## [0.3.3] — 2026-08-28
|
|
12
|
+
|
|
13
|
+
One change, described two ways, because it fixes two separate symptoms that turned out to
|
|
14
|
+
have a single cause: the provider was deciding the widget runtime had arrived by looking at
|
|
15
|
+
something that is not evidence of it.
|
|
16
|
+
|
|
17
|
+
### Fixed — widgets no longer mount before the runtime that powers them exists
|
|
18
|
+
|
|
19
|
+
`<BuyingBuddyProvider>` now reports `isLoaded` only once the runtime bundle has actually
|
|
20
|
+
executed. Previously two different shortcuts could report it early:
|
|
21
|
+
|
|
22
|
+
- **The presence of a `<script>` tag** was taken to mean the script behind it had finished
|
|
23
|
+
loading. Under React StrictMode — on by default in the Next.js App Router in development —
|
|
24
|
+
the provider's setup runs twice, and the second run found the first run's tag and declared
|
|
25
|
+
the runtime ready while it was still in flight.
|
|
26
|
+
- **The presence of `window.MBB`** was taken to mean the same thing. The provider creates that
|
|
27
|
+
object itself, before the bundle is even requested, so it is present for the entire download.
|
|
28
|
+
|
|
29
|
+
Widgets consequently rendered into the page before the code that turns them into widgets had
|
|
30
|
+
arrived. They recovered on their own once it did, so the visible symptom was a flash and a
|
|
31
|
+
shift at each widget rather than an error — the kind of thing reported as "the widgets jump
|
|
32
|
+
when the page loads".
|
|
33
|
+
|
|
34
|
+
Readiness is now taken from the runtime itself, and every part of your page that mounts a
|
|
35
|
+
widget waits on the same signal rather than each guessing separately.
|
|
36
|
+
|
|
37
|
+
### Fixed — a failed script load is reported again in development
|
|
38
|
+
|
|
39
|
+
If the runtime bundle fails to load — an ad blocker, a CSP rule, a corporate proxy, an offline
|
|
40
|
+
client — that failure is logged to the console and readable as `error` from `useBuyingBuddy()`.
|
|
41
|
+
|
|
42
|
+
Both of those already existed, and both were silently inert in development under StrictMode:
|
|
43
|
+
the failure arrived at a listener that the framework's own double-run had already retired, so
|
|
44
|
+
nothing was logged and `error` stayed `null`. A blocked bundle looked exactly like a page with
|
|
45
|
+
no widgets on it. Production builds were unaffected and reported correctly throughout.
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
const { error } = useBuyingBuddy();
|
|
49
|
+
if (error) return <p>Property search is temporarily unavailable.</p>;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
A load that fails can now also be retried by a later mount, rather than the first failure
|
|
53
|
+
standing for the lifetime of the page.
|
|
54
|
+
|
|
55
|
+
### Fixed — no more hydration mismatch on pages that already carry the classic embed
|
|
56
|
+
|
|
57
|
+
Server-rendered apps (Next.js App Router included) no longer produce
|
|
58
|
+
*"Hydration failed because the server rendered HTML didn't match the client"* when the page
|
|
59
|
+
already has the v5 runtime `<script>` on it — the state a site is in while migrating from the
|
|
60
|
+
script-tag embed to this package, or running both during a transition.
|
|
61
|
+
|
|
62
|
+
The provider's first render on the client now matches what the server produced, and resolves
|
|
63
|
+
to the real state one tick later. Nothing is required of you on upgrade.
|
|
64
|
+
|
|
11
65
|
## [0.3.2] — 2026-08-22
|
|
12
66
|
|
|
13
67
|
Two changes, released together. Neither has shipped before: 0.3.2 was version-bumped and
|
|
@@ -13,6 +13,20 @@ declare global {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Drop all module-level load bookkeeping. For tests only.
|
|
18
|
+
*
|
|
19
|
+
* `BUNDLE_LOADS` and `REPORTED_LOAD_FAILURES` are module singletons that
|
|
20
|
+
* outlive any single render, which is the whole point of them - but it also
|
|
21
|
+
* means a test that removes the injected `<script>` from the DOM has NOT
|
|
22
|
+
* returned the module to a clean state, and the next test reusing that
|
|
23
|
+
* activation key silently joins the previous test's pending promise instead of
|
|
24
|
+
* starting a load of its own.
|
|
25
|
+
*
|
|
26
|
+
* Not exported from `index.ts`, so it is not part of the package's public API:
|
|
27
|
+
* the `exports` map admits the barrel only.
|
|
28
|
+
*/
|
|
29
|
+
export declare function __resetBundleStateForTests(): void;
|
|
16
30
|
/**
|
|
17
31
|
* Provides the BuyingBuddy runtime context to child components.
|
|
18
32
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuyingBuddyProvider.d.ts","sourceRoot":"","sources":["../src/BuyingBuddyProvider.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAKjF;;;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;
|
|
1
|
+
{"version":3,"file":"BuyingBuddyProvider.d.ts","sourceRoot":"","sources":["../src/BuyingBuddyProvider.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAKjF;;;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;AA0DD;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAGjD;AA8GD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,aAAa,EACb,MAAuB,EACvB,UAAU,EACV,QAAQ,GAKT,EAAE,wBAAwB,+BA6G1B"}
|
|
@@ -17,7 +17,43 @@ export function useBuyingBuddy() {
|
|
|
17
17
|
}
|
|
18
18
|
return ctx;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* The custom element the v5 runtime registers. `customElements.define` for this
|
|
22
|
+
* name is an unconditional top-level statement in the bundle, so the definition
|
|
23
|
+
* exists the moment the bundle finishes executing - which makes it the one
|
|
24
|
+
* signal on the page that means "the runtime is really here".
|
|
25
|
+
*
|
|
26
|
+
* It is deliberately NOT `window.MBB`. The provider creates that object itself,
|
|
27
|
+
* below, BEFORE the bundle has even been requested, so `!!window.MBB` is true
|
|
28
|
+
* during the entire CDN round-trip. Treating it as readiness is what produced
|
|
29
|
+
* both defects this module has carried: a widget mounted before the runtime
|
|
30
|
+
* existed, and a first client render that disagreed with the server's.
|
|
31
|
+
*/
|
|
32
|
+
const RUNTIME_ELEMENT = "bb-widget";
|
|
33
|
+
/**
|
|
34
|
+
* In-flight (or completed) loads of the runtime bundle, keyed by activation key.
|
|
35
|
+
*
|
|
36
|
+
* A promise rather than a boolean, because "a script tag with this id exists"
|
|
37
|
+
* and "the bundle behind it has executed" are different facts and the gap
|
|
38
|
+
* between them is a whole network round-trip. Every mount awaits this same
|
|
39
|
+
* promise instead of inferring readiness from the tag, so:
|
|
40
|
+
*
|
|
41
|
+
* - `isLoaded` cannot flip before `onload` has actually fired, and
|
|
42
|
+
* - a load failure reaches EVERY waiting mount, not just the one that
|
|
43
|
+
* happened to attach the handlers.
|
|
44
|
+
*
|
|
45
|
+
* The second point is the one that bit us. Under React StrictMode the effect
|
|
46
|
+
* runs twice: run 1 appended the tag and attached the handlers, then its
|
|
47
|
+
* cleanup marked itself cancelled; run 2 found the tag already there and had no
|
|
48
|
+
* handlers of its own. A real `onerror` then landed only on run 1's
|
|
49
|
+
* cancelled-out closure and was discarded, so the console.error and the `error`
|
|
50
|
+
* on the context - both added specifically for this failure - were silently
|
|
51
|
+
* dead in dev, which is exactly where a developer would be looking.
|
|
52
|
+
*
|
|
53
|
+
* The entry is evicted on failure (see `loadRuntimeBundle`) so a later mount
|
|
54
|
+
* can retry rather than inheriting a permanently rejected promise.
|
|
55
|
+
*/
|
|
56
|
+
const BUNDLE_LOADS = new Map();
|
|
21
57
|
// Accounts whose runtime bundle has already failed and been reported. The
|
|
22
58
|
// provider logs a load failure once per activation key, not once per attempt:
|
|
23
59
|
// a remount, a React StrictMode double-effect, or a second provider for the
|
|
@@ -32,6 +68,113 @@ const REPORTED_LOAD_FAILURES = new Set();
|
|
|
32
68
|
* through CloudFront, not S3 origin.
|
|
33
69
|
*/
|
|
34
70
|
const MBB_BUNDLE_URL = "https://d2w6u17ngtanmy.cloudfront.net/scripts/my-buying-buddy.5.0.js.gz";
|
|
71
|
+
/**
|
|
72
|
+
* Drop all module-level load bookkeeping. For tests only.
|
|
73
|
+
*
|
|
74
|
+
* `BUNDLE_LOADS` and `REPORTED_LOAD_FAILURES` are module singletons that
|
|
75
|
+
* outlive any single render, which is the whole point of them - but it also
|
|
76
|
+
* means a test that removes the injected `<script>` from the DOM has NOT
|
|
77
|
+
* returned the module to a clean state, and the next test reusing that
|
|
78
|
+
* activation key silently joins the previous test's pending promise instead of
|
|
79
|
+
* starting a load of its own.
|
|
80
|
+
*
|
|
81
|
+
* Not exported from `index.ts`, so it is not part of the package's public API:
|
|
82
|
+
* the `exports` map admits the barrel only.
|
|
83
|
+
*/
|
|
84
|
+
export function __resetBundleStateForTests() {
|
|
85
|
+
BUNDLE_LOADS.clear();
|
|
86
|
+
REPORTED_LOAD_FAILURES.clear();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Whether the widget runtime is already executing on this page.
|
|
90
|
+
*
|
|
91
|
+
* True only once the bundle has run, because registering `<bb-widget>` is
|
|
92
|
+
* something only the bundle itself can do. That covers the case the old
|
|
93
|
+
* `!!window.MBB` check was reaching for and getting wrong - a page that already
|
|
94
|
+
* carries the classic `<script>` embed - without the false positives described
|
|
95
|
+
* on `RUNTIME_ELEMENT`.
|
|
96
|
+
*/
|
|
97
|
+
function isRuntimeReady() {
|
|
98
|
+
return (typeof window !== "undefined" &&
|
|
99
|
+
typeof window.customElements !== "undefined" &&
|
|
100
|
+
!!window.customElements.get(RUNTIME_ELEMENT));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Load the runtime bundle for an account, at most once concurrently.
|
|
104
|
+
*
|
|
105
|
+
* Returns the same promise to every caller for a given activation key, so a
|
|
106
|
+
* remount - or React StrictMode's deliberate double-invoke - joins the load in
|
|
107
|
+
* progress instead of assuming a tag it did not create has already finished.
|
|
108
|
+
*
|
|
109
|
+
* On failure the entry is evicted and the failed tag removed, so a later mount
|
|
110
|
+
* genuinely retries. Without that, one transient CDN blip would be permanent
|
|
111
|
+
* for the life of the page: the rejected promise would be handed to every
|
|
112
|
+
* subsequent mount, and the dead `<script>` would still be sitting in `<head>`
|
|
113
|
+
* to make the tag-presence check lie about it a second time.
|
|
114
|
+
*/
|
|
115
|
+
function loadRuntimeBundle(activationKey, apiBaseUrl) {
|
|
116
|
+
const inFlight = BUNDLE_LOADS.get(activationKey);
|
|
117
|
+
if (inFlight)
|
|
118
|
+
return inFlight;
|
|
119
|
+
const scriptId = `mbb-script-${activationKey}`;
|
|
120
|
+
const load = new Promise((resolve, reject) => {
|
|
121
|
+
// Initialise the MBB global the official-embed way (a single `data.acid`
|
|
122
|
+
// plus the data base URL) BEFORE the bundle executes, so its first data
|
|
123
|
+
// request uses our acid and base URL.
|
|
124
|
+
if (!window.MBB) {
|
|
125
|
+
window.MBB = {
|
|
126
|
+
seo: "false",
|
|
127
|
+
data: { acid: activationKey },
|
|
128
|
+
apiBaseUrl,
|
|
129
|
+
reactPackageVersion: PKG_VERSION,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
// A tag can already exist with no map entry - a hot reload that re-evaluated
|
|
133
|
+
// this module, or a second copy of the package. Prefer adopting it over
|
|
134
|
+
// appending a duplicate: two `<script>` tags for this bundle fail at PARSE
|
|
135
|
+
// time on redeclared top-level classes, which fires `load`, not `error`,
|
|
136
|
+
// and so would be invisible here.
|
|
137
|
+
//
|
|
138
|
+
// But adopt only a tag that can still SPEAK. `load` and `error` are not
|
|
139
|
+
// replayed to a handler attached after they fired, so adopting a tag that
|
|
140
|
+
// has already settled would produce a promise that never settles - and
|
|
141
|
+
// because the map entry is only evicted by the error handler, every later
|
|
142
|
+
// mount for this account would join that same stuck promise. `isLoaded`
|
|
143
|
+
// would stay false, `error` would stay null, and nothing would be logged:
|
|
144
|
+
// the precise silence this whole change exists to remove. The state stamp
|
|
145
|
+
// below is what makes that distinguishable at all, since the DOM exposes no
|
|
146
|
+
// "has this script already finished" flag.
|
|
147
|
+
const existing = document.getElementById(scriptId);
|
|
148
|
+
const spent = existing?.dataset.bbLoad === "failed";
|
|
149
|
+
if (spent)
|
|
150
|
+
existing?.remove();
|
|
151
|
+
const adopted = spent ? null : existing;
|
|
152
|
+
const script = adopted ?? document.createElement("script");
|
|
153
|
+
script.onload = () => {
|
|
154
|
+
script.dataset.bbLoad = "loaded";
|
|
155
|
+
// A later failure is a genuinely new event, so let it be reported again
|
|
156
|
+
// rather than silenced by the once-per-key guard from an earlier one.
|
|
157
|
+
REPORTED_LOAD_FAILURES.delete(activationKey);
|
|
158
|
+
resolve();
|
|
159
|
+
};
|
|
160
|
+
script.onerror = () => {
|
|
161
|
+
script.dataset.bbLoad = "failed";
|
|
162
|
+
BUNDLE_LOADS.delete(activationKey);
|
|
163
|
+
script.remove();
|
|
164
|
+
reject(new Error(`Failed to load BuyingBuddy script for account: ${activationKey}`));
|
|
165
|
+
};
|
|
166
|
+
if (!adopted) {
|
|
167
|
+
script.id = scriptId;
|
|
168
|
+
script.src = MBB_BUNDLE_URL;
|
|
169
|
+
script.async = true;
|
|
170
|
+
script.dataset.bbReact = PKG_VERSION;
|
|
171
|
+
script.dataset.bbLoad = "loading";
|
|
172
|
+
document.head.appendChild(script);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
BUNDLE_LOADS.set(activationKey, load);
|
|
176
|
+
return load;
|
|
177
|
+
}
|
|
35
178
|
/**
|
|
36
179
|
* Provides the BuyingBuddy runtime context to child components.
|
|
37
180
|
*
|
|
@@ -57,10 +200,17 @@ export function BuyingBuddyProvider({ activationKey, domain = "www.mbb2.com", ap
|
|
|
57
200
|
// environment (e.g. a quick prod/preview flip for testing) without changing
|
|
58
201
|
// which bundle/theme `domain` loads.
|
|
59
202
|
const resolvedApiBaseUrl = apiBaseUrl ?? `https://${domain}`;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
203
|
+
// Always false on the first render, with no exception for a runtime that is
|
|
204
|
+
// already present. Under SSR the first client render is the HYDRATION render
|
|
205
|
+
// and has to produce what the server produced; the server has no `window`, so
|
|
206
|
+
// it is always false there. Reading a browser global in this initializer -
|
|
207
|
+
// which is what this used to do - is the first cause React itself lists for a
|
|
208
|
+
// hydration mismatch, and it made every widget mount point diverge.
|
|
209
|
+
//
|
|
210
|
+
// The already-loaded case is not lost, only deferred: the effect below sets it
|
|
211
|
+
// synchronously on the first tick after mount, which is precisely the frame
|
|
212
|
+
// hydration needs to have already agreed on.
|
|
213
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
64
214
|
const [error, setError] = useState(null);
|
|
65
215
|
useEffect(() => {
|
|
66
216
|
if (typeof window === "undefined")
|
|
@@ -89,66 +239,45 @@ export function BuyingBuddyProvider({ activationKey, domain = "www.mbb2.com", ap
|
|
|
89
239
|
window.MBB.apiBaseUrl = resolvedApiBaseUrl;
|
|
90
240
|
window.MBB.reactPackageVersion = PKG_VERSION;
|
|
91
241
|
}
|
|
92
|
-
//
|
|
93
|
-
|
|
242
|
+
// The runtime is already executing on this page - a classic `<script>`
|
|
243
|
+
// embed, or a previous mount that finished. Nothing to load, and nothing to
|
|
244
|
+
// wait for, so resolve it synchronously here rather than a tick later: this
|
|
245
|
+
// runs after hydration has already committed, so it costs nothing to
|
|
246
|
+
// correctness and keeps a remount from flashing its widgets away.
|
|
247
|
+
if (isRuntimeReady()) {
|
|
94
248
|
setIsLoaded(true);
|
|
95
249
|
return;
|
|
96
250
|
}
|
|
251
|
+
// Tracks THIS mount only. It gates this component's own state updates and
|
|
252
|
+
// nothing else - deliberately not the shared load's resolution, which is
|
|
253
|
+
// what the previous version conflated. A cancelled mount used to take the
|
|
254
|
+
// whole account's error reporting down with it.
|
|
97
255
|
let cancelled = false;
|
|
98
|
-
|
|
99
|
-
|
|
256
|
+
loadRuntimeBundle(activationKey, resolvedApiBaseUrl).then(() => {
|
|
257
|
+
if (!cancelled)
|
|
258
|
+
setIsLoaded(true);
|
|
259
|
+
}, (failure) => {
|
|
100
260
|
if (cancelled)
|
|
101
261
|
return;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
//
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// request uses our acid and base URL.
|
|
113
|
-
if (!window.MBB) {
|
|
114
|
-
window.MBB = {
|
|
115
|
-
seo: "false",
|
|
116
|
-
data: { acid: activationKey },
|
|
117
|
-
apiBaseUrl: resolvedApiBaseUrl,
|
|
118
|
-
reactPackageVersion: PKG_VERSION,
|
|
119
|
-
};
|
|
262
|
+
// Report, do not render. The provider wraps the host application's
|
|
263
|
+
// whole tree, so anything it renders in place of `children` takes the
|
|
264
|
+
// customer's site down with it - and a blocked CloudFront request is
|
|
265
|
+
// an ordinary event (ad blocker, CSP rule, corporate proxy, offline),
|
|
266
|
+
// not an exceptional one. The correct degraded state is the site
|
|
267
|
+
// intact with the widgets absent, which is what BuyingBuddyWidget's
|
|
268
|
+
// own `if (!isLoaded) return null` already produces.
|
|
269
|
+
if (!REPORTED_LOAD_FAILURES.has(activationKey)) {
|
|
270
|
+
REPORTED_LOAD_FAILURES.add(activationKey);
|
|
271
|
+
console.error(`[@buyingbuddy/react] ${failure.message}`);
|
|
120
272
|
}
|
|
121
|
-
//
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
script.async = true;
|
|
126
|
-
script.dataset.bbReact = PKG_VERSION;
|
|
127
|
-
script.onload = markLoaded;
|
|
128
|
-
script.onerror = () => {
|
|
129
|
-
if (cancelled)
|
|
130
|
-
return;
|
|
131
|
-
const failure = new Error(`Failed to load BuyingBuddy script for account: ${activationKey}`);
|
|
132
|
-
// Report, do not render. The provider wraps the host application's
|
|
133
|
-
// whole tree, so anything it renders in place of `children` takes the
|
|
134
|
-
// customer's site down with it - and a blocked CloudFront request is
|
|
135
|
-
// an ordinary event (ad blocker, CSP rule, corporate proxy, offline),
|
|
136
|
-
// not an exceptional one. The correct degraded state is the site
|
|
137
|
-
// intact with the widgets absent, which is what BuyingBuddyWidget's
|
|
138
|
-
// own `if (!isLoaded) return null` already produces.
|
|
139
|
-
if (!REPORTED_LOAD_FAILURES.has(activationKey)) {
|
|
140
|
-
REPORTED_LOAD_FAILURES.add(activationKey);
|
|
141
|
-
console.error(`[@buyingbuddy/react] ${failure.message}`);
|
|
142
|
-
}
|
|
143
|
-
// Still surfaced on the context, so a host app that wants to say
|
|
144
|
-
// something about it can read `error` from useBuyingBuddy().
|
|
145
|
-
setError(failure);
|
|
146
|
-
};
|
|
147
|
-
document.head.appendChild(script);
|
|
148
|
-
}
|
|
273
|
+
// Still surfaced on the context, so a host app that wants to say
|
|
274
|
+
// something about it can read `error` from useBuyingBuddy().
|
|
275
|
+
setError(failure);
|
|
276
|
+
});
|
|
149
277
|
return () => {
|
|
150
|
-
// Don't remove the script (MBB global state is persistent)
|
|
151
|
-
// load
|
|
278
|
+
// Don't remove the script (MBB global state is persistent) and don't
|
|
279
|
+
// cancel the shared load - another mount may still be waiting on it.
|
|
280
|
+
// Only stop THIS mount from setting state after unmount.
|
|
152
281
|
cancelled = true;
|
|
153
282
|
};
|
|
154
283
|
}, [activationKey, domain, resolvedApiBaseUrl]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuyingBuddyProvider.js","sourceRoot":"","sources":["../src/BuyingBuddyProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+EAA+E;AAC/E,gFAAgF;AAChF,iFAAiF;AAEjF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,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,
|
|
1
|
+
{"version":3,"file":"BuyingBuddyProvider.js","sourceRoot":"","sources":["../src/BuyingBuddyProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+EAA+E;AAC/E,gFAAgF;AAChF,iFAAiF;AAEjF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE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kB,CAAC,CAAC,IAAI,CACvD,GAAG,EAAE;YACH,IAAI,CAAC,SAAS;gBAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC,EACD,CAAC,OAAc,EAAE,EAAE;YACjB,IAAI,SAAS;gBAAE,OAAO;YACtB,mEAAmE;YACnE,sEAAsE;YACtE,qEAAqE;YACrE,sEAAsE;YACtE,iEAAiE;YACjE,oEAAoE;YACpE,qDAAqD;YACrD,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;gBAC/C,sBAAsB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;gBAC1C,OAAO,CAAC,KAAK,CAAC,wBAAwB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;YAC3D,CAAC;YACD,iEAAiE;YACjE,6DAA6D;YAC7D,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpB,CAAC,CACF,CAAC;QAEF,OAAO,GAAG,EAAE;YACV,qEAAqE;YACrE,qEAAqE;YACrE,yDAAyD;YACzD,SAAS,GAAG,IAAI,CAAC;QACnB,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,wEAAwE;IACxE,yEAAyE;IACzE,4EAA4E;IAC5E,2EAA2E;IAC3E,6EAA6E;IAC7E,oEAAoE;IACpE,iEAAiE;IACjE,OAAO,CACL,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACtC,QAAQ,GACmB,CAC/B,CAAC;AACJ,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* there is no bundler `define` to inject it from package.json. `version.test.ts`
|
|
15
15
|
* asserts the two stay in step, so a bump that misses this file fails the suite.
|
|
16
16
|
*/
|
|
17
|
-
export declare const PKG_VERSION = "0.3.
|
|
17
|
+
export declare const PKG_VERSION = "0.3.3";
|
|
18
18
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* there is no bundler `define` to inject it from package.json. `version.test.ts`
|
|
15
15
|
* asserts the two stay in step, so a bump that misses this file fails the suite.
|
|
16
16
|
*/
|
|
17
|
-
export const PKG_VERSION = "0.3.
|
|
17
|
+
export const PKG_VERSION = "0.3.3";
|
|
18
18
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buyingbuddy/react",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "IDX MLS real estate integration for React, Next.js, and Framer — property search, map results, listings, lead capture, and CRM via Buying Buddy.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|