@buyingbuddy/react 0.3.4 → 1.0.0

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.
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  // Required: createContext() runs at module scope below, and in the Next.js App
4
4
  // Router every module is a Server Component by default - without this the build
5
5
  // fails with "createContext is not a function" and next dev 500s on every route.
6
- import { createContext, useContext, useEffect, useState } from "react";
6
+ import { createContext, useContext, useEffect, useRef, useState } from "react";
7
7
  import { PKG_VERSION } from "./version";
8
8
  const BuyingBuddyContext = createContext(null);
9
9
  /**
@@ -60,6 +60,14 @@ const BUNDLE_LOADS = new Map();
60
60
  // same account would otherwise repeat an identical message the developer has
61
61
  // already seen and can do nothing further about.
62
62
  const REPORTED_LOAD_FAILURES = new Set();
63
+ // Activation keys that have already had a page-identity conflict reported
64
+ // (see the check at the top of the provider's effect, below). Same
65
+ // once-per-key reasoning as `REPORTED_LOAD_FAILURES`: a remount or a React
66
+ // StrictMode double-effect must not repeat a message the developer has
67
+ // already seen and can do nothing further about by mounting again - the
68
+ // conflict does not resolve itself, so unlike a load failure this is never
69
+ // evicted for a retry.
70
+ const REPORTED_KEY_CONFLICTS = new Set();
63
71
  /**
64
72
  * The v5 widget runtime, served from the CDN — the exact same bundle every
65
73
  * other official integration (WordPress, Joomla, PHP SDK) loads. Loading it
@@ -84,6 +92,11 @@ const MBB_BUNDLE_URL = "https://d2w6u17ngtanmy.cloudfront.net/scripts/my-buying-
84
92
  export function __resetBundleStateForTests() {
85
93
  BUNDLE_LOADS.clear();
86
94
  REPORTED_LOAD_FAILURES.clear();
95
+ REPORTED_KEY_CONFLICTS.clear();
96
+ // The seo dedupe is keyed on the pathname, which never changes within a test
97
+ // file, so without this the first test that warns silences every later one and
98
+ // the suite becomes order-dependent. Same reason the three above are here.
99
+ REPORTED_SEO_MISMATCH.clear();
87
100
  }
88
101
  /**
89
102
  * Whether the widget runtime is already executing on this page.
@@ -112,7 +125,138 @@ function isRuntimeReady() {
112
125
  * subsequent mount, and the dead `<script>` would still be sitting in `<head>`
113
126
  * to make the tag-presence check lie about it a second time.
114
127
  */
115
- function loadRuntimeBundle(activationKey, apiBaseUrl) {
128
+ /** Pages already warned about, so a remount or StrictMode does not repeat it. */
129
+ const REPORTED_SEO_MISMATCH = new Set();
130
+ /**
131
+ * How long after `isLoaded` to wait before scanning for an seo mismatch.
132
+ *
133
+ * Only long enough for React to commit the client widgets that `isLoaded` has
134
+ * just unblocked. It does not need to outlast the runtime's own startup any
135
+ * more, because the scan reads a declared attribute rather than inspecting
136
+ * what each mount contains.
137
+ */
138
+ const SEO_SCAN_DELAY_MS = 250;
139
+ /**
140
+ * Warn about the two `seo` states that silently misrender.
141
+ *
142
+ * `MBB.seo` is page-level, so the correct setting is a property of the page as a
143
+ * whole and neither the provider nor any one widget can infer it. What CAN be
144
+ * checked is agreement: a `<bb-widget>` with server-rendered children present on
145
+ * a page that did not declare `seo`, or an empty one on a page that did.
146
+ *
147
+ * Both failures are silent otherwise - one shows a blank space, the other
148
+ * re-fetches markup it already had - and neither throws, so without this the
149
+ * first signal is a customer reporting a missing widget.
150
+ *
151
+ * NOT GATED ON NODE_ENV, which the first version got wrong in a way that made the
152
+ * whole feature inert. It read `globalThis.process?.env` so it would type-check
153
+ * without @types/node, and claimed bundlers would substitute it: they do not, the
154
+ * substitution is textual on the literal `process.env.NODE_ENV`. webpack 5 and
155
+ * Vite ship no `process` shim, so in a real browser build `env` was undefined and
156
+ * this returned before scanning anything - while the warning strings still
157
+ * shipped. Review caught it; it passed this package's own jsdom tests precisely
158
+ * because node defines `process` there.
159
+ *
160
+ * Running always is also the better behaviour, not just the simpler one. It is
161
+ * one `querySelectorAll` per page, deduped below, and it reports a
162
+ * misconfiguration the site owner needs to hear about wherever they notice it -
163
+ * which is the same judgement already made for this file's key-conflict and
164
+ * load-failure reports, both of which log in production.
165
+ *
166
+ * WHAT it compares is a declared attribute, `data-bb-ssr` - see `isServerRendered`
167
+ * below for why, and for the three wrong answers a content heuristic gave first.
168
+ *
169
+ * WHEN it runs still matters, for one reason only: `BuyingBuddyWidget` renders
170
+ * null until the runtime is ready, so before `isLoaded` the client widgets DO NOT
171
+ * EXIST and a scan sees only the server-rendered ones and reports nothing. A fixed
172
+ * delay from the provider's own effect was not enough - on a real page the
173
+ * CloudFront bundle landed after the timer. Hence an effect keyed on `isLoaded`,
174
+ * plus a short settle for React to commit those widgets.
175
+ *
176
+ * It no longer waits for the runtime to ADOPT anything, because it no longer looks
177
+ * at what the mounts contain.
178
+ */
179
+ function warnOnSeoMismatch(seo) {
180
+ const timer = setTimeout(() => {
181
+ const mounts = Array.from(document.querySelectorAll("bb-widget"));
182
+ if (mounts.length === 0)
183
+ return;
184
+ // One report per page per direction. A remount, a StrictMode double-invoke
185
+ // or a second provider would otherwise repeat an identical warning, which is
186
+ // how a real signal gets tuned out.
187
+ const dedupeKey = `${seo ? "seo" : "no-seo"}:${location.pathname}`;
188
+ if (REPORTED_SEO_MISMATCH.has(dedupeKey))
189
+ return;
190
+ const describe = (el) => el.getAttribute("data-type") || el.id || "(untyped)";
191
+ // A DECLARED fact, not an inferred one. `data-bb-ssr` is set by
192
+ // widgetMountProps, so a mount either came from the server entry or it did
193
+ // not, and there is nothing to guess.
194
+ //
195
+ // This replaces a content heuristic that was wrong three times in a row, each
196
+ // time for a different reason, and each time because it was reaching into
197
+ // runtime internals this package does not own: an empty shadow root the
198
+ // runtime attaches before it has content; a scan that ran before the client
199
+ // widgets existed at all; and finally - measured in a real browser - a
200
+ // LoginPanel whose shadow root held 2 children and 0 characters of text, so
201
+ // "has children" read as "has content" and the warning stayed silent on the
202
+ // exact page it was written for. The fourth fix is not a better heuristic.
203
+ const isServerRendered = (el) => el.hasAttribute("data-bb-ssr");
204
+ // Types that are NOT EXPECTED to be server-rendered, for two different
205
+ // reasons. Naming either kind would make this warning fire on a correctly
206
+ // built site, which is how a real signal becomes noise people switch off.
207
+ //
208
+ // 1. No server-rendered form at all. The disclaimer is the one that matters:
209
+ // it is recommended for the site footer, so it is on every page.
210
+ // 2. SEARCH-BASED. These always load live from the server even on a page that
211
+ // declares `seo`, because their results depend on the visitor's own
212
+ // search - the runtime short-circuits on `isSearchBasedWidget` BEFORE it
213
+ // reads `MBB.seo`. So a results page on an otherwise server-rendered site
214
+ // is correct, and `renderWidget` refuses these types outright.
215
+ //
216
+ // The second group was missing, and it only shows up on the kind of site that
217
+ // has both content pages and a results page - i.e. a real one.
218
+ const NOT_SERVER_RENDERED = new Set([
219
+ // no server markup
220
+ "disclaimer",
221
+ "slidemask",
222
+ "loadingmask",
223
+ "formmask",
224
+ "areasearch_popout",
225
+ "priceselect_popout",
226
+ // search-based: always live
227
+ "listingresults",
228
+ "searchresults",
229
+ "resultsmap",
230
+ "openmap",
231
+ "interactivemap",
232
+ ]);
233
+ const expectsMarkup = (el) => !NOT_SERVER_RENDERED.has((el.getAttribute("data-type") || "").replace(/^MBBv3_/i, "").toLowerCase());
234
+ if (seo) {
235
+ const clientSide = mounts.filter((el) => expectsMarkup(el) && !isServerRendered(el));
236
+ if (clientSide.length > 0) {
237
+ REPORTED_SEO_MISMATCH.add(dedupeKey);
238
+ console.warn(`[BuyingBuddy] seo is set on <BuyingBuddyProvider>, but ${clientSide.length} ` +
239
+ `widget(s) on this page are not server-rendered: ` +
240
+ `${clientSide.map(describe).join(", ")}. With seo set, the runtime trusts ` +
241
+ `the page's markup and does not fetch, so these will render blank. ` +
242
+ `Render them with <BuyingBuddyServerWidget> from "@buyingbuddy/react/server", ` +
243
+ `or remove seo from the provider - it applies to the whole page.`);
244
+ }
245
+ return;
246
+ }
247
+ const prerendered = mounts.filter(isServerRendered);
248
+ if (prerendered.length > 0) {
249
+ REPORTED_SEO_MISMATCH.add(dedupeKey);
250
+ console.warn(`[BuyingBuddy] ${prerendered.length} widget(s) on this page are ` +
251
+ `server-rendered but seo is not set on <BuyingBuddyProvider>: ` +
252
+ `${prerendered.map(describe).join(", ")}. The runtime will fetch and ` +
253
+ `replace markup that was already there - a wasted request and a visible ` +
254
+ `flash. Add seo to the provider.`);
255
+ }
256
+ }, SEO_SCAN_DELAY_MS);
257
+ return () => clearTimeout(timer);
258
+ }
259
+ function loadRuntimeBundle(activationKey, apiBaseUrl, seo) {
116
260
  const inFlight = BUNDLE_LOADS.get(activationKey);
117
261
  if (inFlight)
118
262
  return inFlight;
@@ -123,7 +267,12 @@ function loadRuntimeBundle(activationKey, apiBaseUrl) {
123
267
  // request uses our acid and base URL.
124
268
  if (!window.MBB) {
125
269
  window.MBB = {
126
- seo: "false",
270
+ // The host page's promise that every Buying Buddy widget on it is
271
+ // already server-rendered into its mount. "true" makes the runtime adopt
272
+ // that markup; "false" makes it fetch its own. It is read once, per page,
273
+ // by every widget - see the `seo` prop's documentation in ./types for why
274
+ // it is page-level and what each wrong combination looks like.
275
+ seo,
127
276
  data: { acid: activationKey },
128
277
  apiBaseUrl,
129
278
  reactPackageVersion: PKG_VERSION,
@@ -189,7 +338,7 @@ function loadRuntimeBundle(activationKey, apiBaseUrl) {
189
338
  * </BuyingBuddyProvider>
190
339
  * ```
191
340
  */
192
- export function BuyingBuddyProvider({ activationKey, domain = "www.mbb2.com", apiBaseUrl, children,
341
+ export function BuyingBuddyProvider({ activationKey, domain = "www.mbb2.com", apiBaseUrl, seo = false, children,
193
342
  // `fallback` is deliberately absent here. It remains on the props type as a
194
343
  // deprecated no-op so existing call sites keep compiling, but the provider no
195
344
  // longer has a loading state to render, so there is nothing for it to stand
@@ -197,8 +346,7 @@ export function BuyingBuddyProvider({ activationKey, domain = "www.mbb2.com", ap
197
346
  }) {
198
347
  // Base URL for widget DATA requests. Defaults to the same environment as
199
348
  // `domain`, but can be set independently to point data at another
200
- // environment (e.g. a quick prod/preview flip for testing) without changing
201
- // which bundle/theme `domain` loads.
349
+ // environment (e.g. a quick prod/preview flip for testing).
202
350
  const resolvedApiBaseUrl = apiBaseUrl ?? `https://${domain}`;
203
351
  // Always false on the first render, with no exception for a runtime that is
204
352
  // already present. Under SSR the first client render is the HYDRATION render
@@ -212,32 +360,72 @@ export function BuyingBuddyProvider({ activationKey, domain = "www.mbb2.com", ap
212
360
  // hydration needs to have already agreed on.
213
361
  const [isLoaded, setIsLoaded] = useState(false);
214
362
  const [error, setError] = useState(null);
363
+ // The activation key THIS instance last ran its effect with - distinct from
364
+ // `window.MBB.data.acid`, which is the page's claim and may belong to a
365
+ // different instance entirely. Needed to tell apart "a different provider
366
+ // already claimed this page" from "I claimed it myself under a previous
367
+ // activationKey prop, and that prop just changed" - the latter is this
368
+ // instance's own existing (pre-existing, unrelated-to-this-fix) behavior of
369
+ // not re-claiming the page, and must not be reported as a conflict with
370
+ // someone else.
371
+ const previousActivationKeyRef = useRef(null);
215
372
  useEffect(() => {
216
373
  if (typeof window === "undefined")
217
374
  return;
218
- // Inject the widget theme stylesheet. The runtime bundle does not load a
219
- // theme itself, so — exactly like the official WP/Joomla plugin embeds — we
220
- // load it separately; without it widgets render unthemed and the map logs
221
- // "Missing acid or theme data". Follows `domain` so the theme matches the
222
- // environment (production vs preview).
223
- const themeId = `mbb-theme-${activationKey}`;
224
- if (!document.getElementById(themeId)) {
225
- const theme = document.createElement("script");
226
- theme.id = themeId;
227
- theme.src = `https://${domain}/version3/css/theme/acid/${activationKey}`;
228
- theme.async = true;
229
- // Stamped on BOTH scripts deliberately. The runtime tag below is skipped
230
- // when the bundle is already present, so the theme tag is the only one
231
- // guaranteed to exist on every provider mount — a diagnostic must be able
232
- // to read the version off either.
233
- theme.dataset.bbReact = PKG_VERSION;
234
- document.head.appendChild(theme);
375
+ // A different activation key already claimed this page's single runtime
376
+ // global. `window.MBB.data.acid` is set once, by whichever provider's
377
+ // effect reaches `loadRuntimeBundle`'s `if (!window.MBB)` guard first, and
378
+ // is never reassigned after - so it IS the page's claimed key regardless
379
+ // of which mount ordering produced it. Checking this before both the
380
+ // `apiBaseUrl` assignment and the `isRuntimeReady()` branch below is what
381
+ // stops a second, different-keyed provider from either redirecting the
382
+ // page's data requests to itself (the "last write wins" half of this
383
+ // failure) or, when the runtime already finished loading before this
384
+ // provider mounted, silently reporting a healthy `isLoaded: true` with no
385
+ // signal at all that its own account was never actually requested.
386
+ //
387
+ // Rendering two different accounts on one page is not something this
388
+ // detects a way to support - the v5 runtime has no per-widget `acid`, so
389
+ // there is no fix for that inside this package (see the issue). This only
390
+ // replaces the previous silence - a parse-time `SyntaxError` invisible to
391
+ // any handler the package can attach, or no signal whatsoever - with an
392
+ // actionable one. README's "One account per page" caveat already
393
+ // documents the single-account configuration as the only supported one.
394
+ const claimedAcid = window.MBB?.data.acid;
395
+ const previousActivationKey = previousActivationKeyRef.current;
396
+ previousActivationKeyRef.current = activationKey;
397
+ const isOwnEarlierClaim = claimedAcid !== undefined && claimedAcid === previousActivationKey;
398
+ if (claimedAcid !== undefined &&
399
+ claimedAcid !== activationKey &&
400
+ !isOwnEarlierClaim) {
401
+ if (!REPORTED_KEY_CONFLICTS.has(activationKey)) {
402
+ REPORTED_KEY_CONFLICTS.add(activationKey);
403
+ console.error(`[@buyingbuddy/react] A <BuyingBuddyProvider activationKey="${activationKey}"> ` +
404
+ `was mounted on a page that already has a BuyingBuddy runtime for a ` +
405
+ `different activation key ("${claimedAcid}"). Rendering two providers with ` +
406
+ `different activation keys on the same page is not supported (see the ` +
407
+ `README's "One account per page" caveat) - this provider's widgets will not ` +
408
+ `render. Use a single <BuyingBuddyProvider>, scoped to one activation key, ` +
409
+ `per page.`);
410
+ }
411
+ setError(new Error(`Activation key "${activationKey}" conflicts with this page's existing ` +
412
+ `BuyingBuddy activation key "${claimedAcid}". Rendering two providers with ` +
413
+ `different activation keys on the same page is not supported.`));
414
+ return;
235
415
  }
236
416
  // If the runtime global already exists (a script tag in the page, or a
237
417
  // prior mount), point data requests at the resolved base now.
238
418
  if (window.MBB) {
239
419
  window.MBB.apiBaseUrl = resolvedApiBaseUrl;
240
420
  window.MBB.reactPackageVersion = PKG_VERSION;
421
+ // `seo` belongs here too, and setting it ONLY inside loadRuntimeBundle's
422
+ // `if (!window.MBB)` was a real hole: a page that already carries the
423
+ // classic <script> embed, or is on its second provider mount or a hot
424
+ // reload, keeps the old "false" while rendering server-rendered markup.
425
+ // The runtime then takes its live-fetch branch and replaces that markup -
426
+ // precisely what this prop exists to prevent. The runtime reads MBB.seo
427
+ // per widget at upgrade time, so writing it here is still in time.
428
+ window.MBB.seo = seo ? "true" : "false";
241
429
  }
242
430
  // The runtime is already executing on this page - a classic `<script>`
243
431
  // embed, or a previous mount that finished. Nothing to load, and nothing to
@@ -253,7 +441,7 @@ export function BuyingBuddyProvider({ activationKey, domain = "www.mbb2.com", ap
253
441
  // what the previous version conflated. A cancelled mount used to take the
254
442
  // whole account's error reporting down with it.
255
443
  let cancelled = false;
256
- loadRuntimeBundle(activationKey, resolvedApiBaseUrl).then(() => {
444
+ loadRuntimeBundle(activationKey, resolvedApiBaseUrl, seo ? "true" : "false").then(() => {
257
445
  if (!cancelled)
258
446
  setIsLoaded(true);
259
447
  }, (failure) => {
@@ -280,7 +468,18 @@ export function BuyingBuddyProvider({ activationKey, domain = "www.mbb2.com", ap
280
468
  // Only stop THIS mount from setting state after unmount.
281
469
  cancelled = true;
282
470
  };
283
- }, [activationKey, domain, resolvedApiBaseUrl]);
471
+ // `seo` is in here because it reaches `window.MBB.seo`, and omitting it meant
472
+ // a provider whose seo prop changed after mount kept the first value.
473
+ }, [activationKey, resolvedApiBaseUrl, seo]);
474
+ // The seo mismatch scan, deliberately in its own effect keyed on `isLoaded`.
475
+ // It cannot run from the effect above: the client widgets render nothing until
476
+ // the runtime is ready, so a scan scheduled before that sees only the
477
+ // server-rendered mounts and finds nothing wrong. See warnOnSeoMismatch.
478
+ useEffect(() => {
479
+ if (!isLoaded)
480
+ return;
481
+ return warnOnSeoMismatch(seo);
482
+ }, [isLoaded, seo]);
284
483
  const value = { isLoaded, error, activationKey };
285
484
  // `children` renders unconditionally, in every state. The provider is a
286
485
  // context boundary, not a gate: it is mounted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AC,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;QACF,8EAA8E;QAC9E,sEAAsE;IACxE,CAAC,EAAE,CAAC,aAAa,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAC,CAAC;IAE7C,6EAA6E;IAC7E,+EAA+E;IAC/E,sEAAsE;IACtE,yEAAyE;IACzE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,QAAQ;YAAE,OAAO;QACtB,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IAEpB,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"}
@@ -0,0 +1,104 @@
1
+ import type { CSSProperties } from "react";
2
+ import type { RenderWidgetOptions, RenderedWidget } from "./types.js";
3
+ /** Props for {@link BuyingBuddyServerWidget}. */
4
+ export interface BuyingBuddyServerWidgetProps extends RenderWidgetOptions {
5
+ /** Inline styles. A `height` here reaches the widget element. */
6
+ style?: CSSProperties;
7
+ /** Additional CSS class name(s). */
8
+ className?: string;
9
+ /** HTML id attribute. Optional - the widget does not need one. */
10
+ id?: string;
11
+ }
12
+ /**
13
+ * The mount a server-rendered widget belongs in, as plain props.
14
+ *
15
+ * Exported for the case this component cannot serve: a framework whose server
16
+ * half is not React, or a Pages Router page that fetched in `getServerSideProps`
17
+ * and renders in a client component. Spread these onto a `<bb-widget>` and put
18
+ * `rendered.html` inside it.
19
+ *
20
+ * The widget runtime finds this element by its tag and reads its attributes, so
21
+ * there is no id to coordinate and nothing to look up. Earlier Buying Buddy
22
+ * embeds used `<div id="MBBv3_...">`; that form exists because the WordPress
23
+ * editors wrap an unknown inline-level tag in `<p>`, splitting the element from
24
+ * its content. Nothing here has that constraint, so the mount is the element.
25
+ *
26
+ * The return type is spelled out rather than left as `Record<string, unknown>`,
27
+ * which satisfied `createElement`'s generic overload and discarded all checking -
28
+ * a typo in `dangerouslySetInnerHTML` or `suppressHydrationWarning` would have
29
+ * compiled and silently become an HTML attribute.
30
+ */
31
+ export interface WidgetMountProps {
32
+ id?: string;
33
+ className?: string;
34
+ style: CSSProperties;
35
+ "data-type": string;
36
+ "data-filter": string;
37
+ /**
38
+ * Marks this mount as server-rendered.
39
+ *
40
+ * The provider reads it to tell a server-rendered widget from a client one and
41
+ * warn about the two `seo` states that misrender. It is a declared fact rather
42
+ * than something inferred from the DOM, which is the point: the first version
43
+ * of that check tried to infer it from whether the mount "looked filled", and
44
+ * got three different wrong answers in a row - an empty shadow root the runtime
45
+ * attaches before it has content, a scan that ran before client widgets existed,
46
+ * and content that is really a loading skeleton. All three were the heuristic
47
+ * being coupled to runtime internals this package does not own.
48
+ */
49
+ "data-bb-ssr": "";
50
+ dangerouslySetInnerHTML: {
51
+ __html: string;
52
+ };
53
+ suppressHydrationWarning: true;
54
+ }
55
+ export declare function widgetMountProps(rendered: RenderedWidget, options: {
56
+ type: string;
57
+ style?: CSSProperties;
58
+ className?: string;
59
+ id?: string;
60
+ }): WidgetMountProps;
61
+ /**
62
+ * Render a Buying Buddy widget on the server, with its HTML in the page.
63
+ *
64
+ * An async Server Component: `await` it from a server page or layout. The
65
+ * listing content ends up in the initial HTML, so crawlers and link previews see
66
+ * it without running JavaScript - which is the whole point, and the thing
67
+ * `<BuyingBuddyWidget>` cannot do.
68
+ *
69
+ * **Three things have to be true for this to work**, and two of them are yours:
70
+ *
71
+ * 1. `<BuyingBuddyProvider>` must have `seo="true"`. It is what tells the widget
72
+ * runtime to adopt this markup rather than fetch its own.
73
+ * 2. Every Buying Buddy widget on the page must come through this component.
74
+ * `seo` is page-level, so a client `<BuyingBuddyWidget>` on the same page
75
+ * renders blank.
76
+ * 3. The provider still has to be on the page. It loads the runtime that makes
77
+ * the widget interactive; this component only supplies the markup.
78
+ *
79
+ * Errors are not swallowed - a failed render throws `BuyingBuddyError` and your
80
+ * framework's error boundary decides. That is deliberate: returning an empty
81
+ * mount would be indistinguishable from a working widget with no results, and
82
+ * under `seo="true"` it would freeze into your page cache as a blank space.
83
+ *
84
+ * @example
85
+ * ```tsx
86
+ * // app/team/page.tsx
87
+ * import { headers } from "next/headers";
88
+ * import { BuyingBuddyServerWidget } from "@buyingbuddy/react/server";
89
+ *
90
+ * export default async function TeamPage() {
91
+ * const ip = (await headers()).get("x-forwarded-for")?.split(",")[0];
92
+ * return (
93
+ * <BuyingBuddyServerWidget
94
+ * type="OfficeRoster"
95
+ * activationKey={process.env.BUYING_BUDDY_KEY!}
96
+ * domain="www.example.com"
97
+ * visitor={{ ip }}
98
+ * />
99
+ * );
100
+ * }
101
+ * ```
102
+ */
103
+ export declare function BuyingBuddyServerWidget({ style, className, id, ...options }: BuyingBuddyServerWidgetProps): Promise<import("react").DOMElement<WidgetMountProps, Element>>;
104
+ //# sourceMappingURL=BuyingBuddyServerWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuyingBuddyServerWidget.d.ts","sourceRoot":"","sources":["../../src/server/BuyingBuddyServerWidget.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEtE,iDAAiD;AACjD,MAAM,WAAW,4BAA6B,SAAQ,mBAAmB;IACvE,iEAAiE;IACjE,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,aAAa,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,EAAE,CAAC;IAClB,uBAAuB,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,wBAAwB,EAAE,IAAI,CAAC;CAChC;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAChF,gBAAgB,CAoBlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,KAAK,EACL,SAAS,EACT,EAAE,EACF,GAAG,OAAO,EACX,EAAE,4BAA4B,kEAO9B"}
@@ -0,0 +1,70 @@
1
+ import { createElement } from "react";
2
+ import { renderWidget } from "./renderWidget.js";
3
+ export function widgetMountProps(rendered, options) {
4
+ return {
5
+ id: options.id,
6
+ className: options.className,
7
+ style: { display: "block", width: "100%", ...options.style },
8
+ "data-type": options.type,
9
+ // The filter the SERVER ran, not the one that was requested. A saved-search
10
+ // reference such as `id:22` is a pointer the client cannot resolve, so a
11
+ // mount carrying the pointer makes the widget re-apply it and lose the
12
+ // resolved criteria - including a map search's coordinates.
13
+ "data-filter": rendered.filterString,
14
+ "data-bb-ssr": "",
15
+ dangerouslySetInnerHTML: { __html: rendered.html },
16
+ // The server produced this markup and the client's first render must agree
17
+ // with it. React cannot diff inside `dangerouslySetInnerHTML` anyway, and the
18
+ // widget runtime moves these children into a shadow root as soon as it
19
+ // upgrades the element, so a warning here would be about markup React has
20
+ // already stopped owning.
21
+ suppressHydrationWarning: true,
22
+ };
23
+ }
24
+ /**
25
+ * Render a Buying Buddy widget on the server, with its HTML in the page.
26
+ *
27
+ * An async Server Component: `await` it from a server page or layout. The
28
+ * listing content ends up in the initial HTML, so crawlers and link previews see
29
+ * it without running JavaScript - which is the whole point, and the thing
30
+ * `<BuyingBuddyWidget>` cannot do.
31
+ *
32
+ * **Three things have to be true for this to work**, and two of them are yours:
33
+ *
34
+ * 1. `<BuyingBuddyProvider>` must have `seo="true"`. It is what tells the widget
35
+ * runtime to adopt this markup rather than fetch its own.
36
+ * 2. Every Buying Buddy widget on the page must come through this component.
37
+ * `seo` is page-level, so a client `<BuyingBuddyWidget>` on the same page
38
+ * renders blank.
39
+ * 3. The provider still has to be on the page. It loads the runtime that makes
40
+ * the widget interactive; this component only supplies the markup.
41
+ *
42
+ * Errors are not swallowed - a failed render throws `BuyingBuddyError` and your
43
+ * framework's error boundary decides. That is deliberate: returning an empty
44
+ * mount would be indistinguishable from a working widget with no results, and
45
+ * under `seo="true"` it would freeze into your page cache as a blank space.
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * // app/team/page.tsx
50
+ * import { headers } from "next/headers";
51
+ * import { BuyingBuddyServerWidget } from "@buyingbuddy/react/server";
52
+ *
53
+ * export default async function TeamPage() {
54
+ * const ip = (await headers()).get("x-forwarded-for")?.split(",")[0];
55
+ * return (
56
+ * <BuyingBuddyServerWidget
57
+ * type="OfficeRoster"
58
+ * activationKey={process.env.BUYING_BUDDY_KEY!}
59
+ * domain="www.example.com"
60
+ * visitor={{ ip }}
61
+ * />
62
+ * );
63
+ * }
64
+ * ```
65
+ */
66
+ export async function BuyingBuddyServerWidget({ style, className, id, ...options }) {
67
+ const rendered = await renderWidget(options);
68
+ return createElement("bb-widget", widgetMountProps(rendered, { type: options.type, style, className, id }));
69
+ }
70
+ //# sourceMappingURL=BuyingBuddyServerWidget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuyingBuddyServerWidget.js","sourceRoot":"","sources":["../../src/server/BuyingBuddyServerWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAuDjD,MAAM,UAAU,gBAAgB,CAC9B,QAAwB,EACxB,OAAiF;IAEjF,OAAO;QACL,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE;QAC5D,WAAW,EAAE,OAAO,CAAC,IAAI;QACzB,4EAA4E;QAC5E,yEAAyE;QACzE,uEAAuE;QACvE,4DAA4D;QAC5D,aAAa,EAAE,QAAQ,CAAC,YAAY;QACpC,aAAa,EAAE,EAAE;QACjB,uBAAuB,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE;QAClD,2EAA2E;QAC3E,8EAA8E;QAC9E,uEAAuE;QACvE,0EAA0E;QAC1E,0BAA0B;QAC1B,wBAAwB,EAAE,IAAI;KAC/B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,EAC5C,KAAK,EACL,SAAS,EACT,EAAE,EACF,GAAG,OAAO,EACmB;IAC7B,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;IAE7C,OAAO,aAAa,CAClB,WAAW,EACX,gBAAgB,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CACzE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * What `@buyingbuddy/react/server` resolves to in a browser bundle.
3
+ *
4
+ * It is wired up by the `"browser"` condition in this package's `exports`, which
5
+ * webpack, Vite, Rollup, esbuild and Next's client compiler all honour - so a
6
+ * client-side import gets this module rather than the real server one, and fails
7
+ * loudly instead of shipping server-shaped code to visitors.
8
+ *
9
+ * IT FAILS AT MODULE EVALUATION, NOT AT BUILD TIME. This file said "fail the
10
+ * build" in three places and review was right to call it: a bundler resolves and
11
+ * bundles modules, it does not execute their bodies, so a top-level `throw` fires
12
+ * when the browser runs the chunk. The practical shape on Next is that the SSR
13
+ * pass resolves the real module (no `browser` condition on the server layer), the
14
+ * page renders, and hydration then crashes with the message below. That is still
15
+ * loud and still points at the mistake - but a green build is not evidence the
16
+ * mistake was avoided, and the wording was going to make someone believe it was.
17
+ *
18
+ * WHY NOT THE `server-only` PACKAGE, which this issue originally specified: its
19
+ * guard is inverted from how it reads. Its whole contract is
20
+ * `{"react-server": "./empty.js", "default": "./index.js"}` where `index.js` is a
21
+ * bare top-level `throw`. Only bundlers that set the `react-server` condition -
22
+ * Next's App Router and other RSC frameworks - resolve to the harmless empty
23
+ * module. Express, Fastify, Remix, SvelteKit and plain `node server.js` take
24
+ * `default`, so the throw fires on the server, which is exactly where this is
25
+ * meant to work. A `"browser"` condition of our own gets the intended behaviour
26
+ * on every host instead of one.
27
+ *
28
+ * There is no credential to leak today - the activation key is public, the same
29
+ * class of value as the one already in every client-side embed. The reason to
30
+ * block a client import is that it is a broken usage: domain authorization and
31
+ * per-visitor rate limiting both assume a server caller, and a browser has no
32
+ * `fetch` to our API that would satisfy either. The guard is also already in
33
+ * place for the day a real credential does land.
34
+ */
35
+ declare const MESSAGE: string;
36
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/server/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,QAAA,MAAM,OAAO,QAKY,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /**
3
+ * What `@buyingbuddy/react/server` resolves to in a browser bundle.
4
+ *
5
+ * It is wired up by the `"browser"` condition in this package's `exports`, which
6
+ * webpack, Vite, Rollup, esbuild and Next's client compiler all honour - so a
7
+ * client-side import gets this module rather than the real server one, and fails
8
+ * loudly instead of shipping server-shaped code to visitors.
9
+ *
10
+ * IT FAILS AT MODULE EVALUATION, NOT AT BUILD TIME. This file said "fail the
11
+ * build" in three places and review was right to call it: a bundler resolves and
12
+ * bundles modules, it does not execute their bodies, so a top-level `throw` fires
13
+ * when the browser runs the chunk. The practical shape on Next is that the SSR
14
+ * pass resolves the real module (no `browser` condition on the server layer), the
15
+ * page renders, and hydration then crashes with the message below. That is still
16
+ * loud and still points at the mistake - but a green build is not evidence the
17
+ * mistake was avoided, and the wording was going to make someone believe it was.
18
+ *
19
+ * WHY NOT THE `server-only` PACKAGE, which this issue originally specified: its
20
+ * guard is inverted from how it reads. Its whole contract is
21
+ * `{"react-server": "./empty.js", "default": "./index.js"}` where `index.js` is a
22
+ * bare top-level `throw`. Only bundlers that set the `react-server` condition -
23
+ * Next's App Router and other RSC frameworks - resolve to the harmless empty
24
+ * module. Express, Fastify, Remix, SvelteKit and plain `node server.js` take
25
+ * `default`, so the throw fires on the server, which is exactly where this is
26
+ * meant to work. A `"browser"` condition of our own gets the intended behaviour
27
+ * on every host instead of one.
28
+ *
29
+ * There is no credential to leak today - the activation key is public, the same
30
+ * class of value as the one already in every client-side embed. The reason to
31
+ * block a client import is that it is a broken usage: domain authorization and
32
+ * per-visitor rate limiting both assume a server caller, and a browser has no
33
+ * `fetch` to our API that would satisfy either. The guard is also already in
34
+ * place for the day a real credential does land.
35
+ */
36
+ const MESSAGE = '"@buyingbuddy/react/server" is server-only and cannot be bundled for the browser. ' +
37
+ "Call renderWidget() or render <BuyingBuddyServerWidget> from a Server Component, " +
38
+ "a route handler, getServerSideProps, or your own server code - then pass the HTML " +
39
+ "down. For widgets that render in the browser, import <BuyingBuddyWidget> from " +
40
+ '"@buyingbuddy/react".';
41
+ throw new Error(MESSAGE);
42
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/server/browser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,MAAM,OAAO,GACX,oFAAoF;IACpF,mFAAmF;IACnF,oFAAoF;IACpF,gFAAgF;IAChF,uBAAuB,CAAC;AAE1B,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC"}