@aifeatures/react 0.9.0 → 0.11.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.
package/README.md CHANGED
@@ -38,6 +38,36 @@ Pass base URLs without a trailing slash. `apiUrl=""` explicitly selects root API
38
38
 
39
39
  `ConsentProvider` has independent configuration: its existing default remains `/_ls`, even without `AifeaturesProvider`, and its own explicit `apiUrl` still wins.
40
40
 
41
+ ## Product reviews
42
+
43
+ The review components are part of the pending minor release after `0.9.0` (expected `0.10.0`). They are available in this workspace build; verify the published package exports before upgrading a customer site or adding imports to it.
44
+
45
+ Mount one composer on the product page, using the actual product ID:
46
+
47
+ ```tsx
48
+ import { ProductRating, ProductReviews, ProductReviewForm } from '@aifeatures/react';
49
+
50
+ function Reviews({ productId }: { productId: string }) {
51
+ return <>
52
+ <ProductRating productId={productId} />
53
+ <ProductReviews productId={productId} />
54
+ <ProductReviewForm productId={productId} />
55
+ </>;
56
+ }
57
+ ```
58
+
59
+ These components use the same optional `apiUrl` and `AifeaturesProvider` resolution as the other features. `ProductRating` is useful beside a product title; `ProductReviews` includes its own summary, distribution, filters, pagination, and merchant replies. Confirmed customer mutations refresh subscribed widgets for the same product. Public text is rendered as escaped text. No customer email or order identifiers are displayed.
60
+
61
+ Keep `AccountPage` mounted at the published `/account` route. The composer starts email sign-in; `AccountPage` exchanges the code, saves the existing same-origin customer session, and returns to the validated product route at `#product-review-form`. Account review history provides product links and withdrawal, without a second editor. Sign-in must finish on the store's canonical serving origin: apex, `www`, and secondary domains do not share browser sessions or drafts.
62
+
63
+ The server checks store readiness, site collection settings, production Turnstile keys, and the global collection switch. Pass `preview` to `ProductReviews` and `ProductReviewForm` in previews; the server also refuses preview writes. A disabled store setting pauses new reviews and resubmissions while preserving public reviews, withdrawal, and protected editing on active product pages. A global collection pause stops all content writes. A verified-purchase badge is derived from historical purchases of that exact product at that store; it is never supplied by the browser.
64
+
65
+ The composer owns its fields, JSON requests, validation, and draft recovery. Drafts are scoped to the authenticated identity and product and expire after 24 hours in the current browser. Expired or failed CAPTCHA challenges preserve the draft. An uncertain write triggers a saved-review read before another attempt; a stale revision requires the customer to review the latest state.
66
+
67
+ Only the package-internal Turnstile widget lifecycle and server verification adapter are shared with contact forms. `AifeaturesCaptcha` retains its `formId` configuration, hidden response field, consent behavior, and `/f/:formId` contracts. Reviews use `/v1/p/...` and `/v1/account/...` JSON endpoints. Future booking features can reuse the small CAPTCHA adapter while owning their own availability, capacity, reservation, calendar, and notification behavior.
68
+
69
+ See [product-review operations and release gates](../../docs/OPERATIONS.md#product-reviews--release-and-operations) before enabling collection.
70
+
41
71
  ## Consent runtime
42
72
 
43
73
  `ConsentProvider` requests `/_ls/v1/geo` and `/_ls/v1/prefs/{configId}` on the current site's origin by default. Published sites, shared/editor previews, and local development must serve those two paths through site-services. No hostname is needed in generated site code: