Package Exports
- wintrust
Readme
wintrust
React components and helpers for Wintrust—load approved testimonials from your deployed Wintrust API and render them as a grid (Wall) or horizontal scroller (Carousel).
Requires React 18 or 19 (peerDependencies allow both). Works best with frameworks that expose env at build time (e.g. Next.js NEXT_PUBLIC_*).
Install
npm install wintrustConfigure API base URL
The client calls:
GET {API_BASE}/testimonials?siteKey=…
Set NEXT_PUBLIC_WINTRUST_API_URL to your deployment’s …/api origin (no trailing slash required—it is normalized internally).
Examples:
# Local Wintrust web app on port 3000
NEXT_PUBLIC_WINTRUST_API_URL=http://localhost:3000/api
# Production
NEXT_PUBLIC_WINTRUST_API_URL=https://your-wintrust-deployment.vercel.app/apiIf unset in the browser, the library falls back to ${window.location.origin}/api (same-origin setups only).
Copy .env.example in this folder for local package development.
Cross‑origin embedding (SPA / Vite / etc.)
Expose the env var however your bundler expects (e.g. Vite define for process.env.NEXT_PUBLIC_WINTRUST_API_URL). Your Wintrust deployment must send CORS Access-Control-Allow-Origin for your site origin (see WINTRUST_EMBED_ORIGINS in the main repo’s apps/web/.env.example).
Easiest embed without npm
Paste an iframe from the Wintrust dashboard (Copy iframe) so your marketing site loads /embed/wall?siteKey=… inside the frame—no install or env on the parent site.
Usage
'use client'
import { Wall, Carousel } from 'wintrust'
export function Praise() {
return (
<section>
<h2>Loved by customers</h2>
<Wall siteKey={process.env.NEXT_PUBLIC_DEMO_SITE_KEY!} />
{/* or: <Carousel siteKey="your_public_site_key" /> */}
</section>
)
}Headless / custom UI
import { fetchTestimonials, type Testimonial } from 'wintrust'
const list: Testimonial[] = await fetchTestimonials('your_public_site_key')Exports
| Export | Purpose |
|---|---|
Wall |
Responsive grid of cards |
Carousel |
Horizontal scroll of cards |
useTestimonials |
Hook: { testimonials, loading, error } |
fetchTestimonials |
One-off fetch + JSON parse |
resolveApiBase |
Resolve API base from env / window |
Testimonial |
TypeScript type for a row |
Publishing (maintainers)
From packages/wintrust:
cd packages/wintrust
npm ci
npm publish --access publicnpm publish triggers prepack, which runs npm run build so dist/ is always included in the tarball.
E403 … Two-factor authentication … is required to publish
npm now requires either:
- Account 2FA with permission to publish — enable on npmjs.com → Account → Security → Two-Factor Authentication (Auth and writes or equivalent for publishing), or
- A granular access token (npm → Access Tokens) with Publish on the right scope/package, using “Bypass 2FA when publishing” if your org/token type allows it.
After enabling 2FA, run npm login again from the terminal, then npm publish --access public from this folder.
Wrong directory: Always run publish from packages/wintrust (from repo root: cd packages/wintrust). If you are already in that folder, cd packages/wintrust will fail—run npm publish directly.
Repo & license
Monorepo: github.com/hungrycheetah-studio/wintrust · MIT