mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-21 00:18:41 +00:00
* refactor: decouple @hanzo/ui from hanzogui Make @hanzo/ui shadcn-only — no hanzogui/Tamagui coupling. - remove primitives/bases (gui/admin/svelte/vue) re-exports - drop @hanzogui peerDependencies + peerDependenciesMeta entries - add check-no-hanzogui guard, wired into build - fix latent NodeJS.Timeout types to keep the build green * refactor: remove duplicate @hanzo/brand from the monorepo @hanzo/brand is owned by the standalone hanzoai/brand (the npm-canonical source); this monorepo's copy was unused and had drifted. - delete pkg/brand - add check-no-brand-pkg guard (wired into `check`) so it can't reappear * refactor(ui): stop importing from the app; use own cn util pkg/ui pulled `cn` from @/lib/utils (../../app) — an inverted dependency on the consuming app. Point the animation components at pkg/ui's own cn and drop the @/app, @/registry, @/lib tsconfig path aliases. * fix(ui): type errors; stop tracking the root lockfile - ModelCard: lucide-react dropped the Github icon → use Code - drawer: annotate DrawerTrigger/DrawerClose (radix type portability) - untrack root pnpm-lock.yaml; CI → --no-frozen-lockfile * release: bump @hanzo/ui to 5.7.0 * refactor: rename pkg/ → pkgs/, merge packages/ into it standardize on 'pkgs/': move pkg/* and packages/* into pkgs/. Update workspace globs, CI, scripts, and config references accordingly.
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
// Payment processing - requires API endpoint
|
|
// For static builds, this will call an external payment API
|
|
|
|
// https://developer.squareup.com/blog/online-payments-with-square-and-react/
|
|
declare global {
|
|
interface BigInt {
|
|
toJSON(): string;
|
|
}
|
|
}
|
|
|
|
BigInt.prototype.toJSON = function() { return this.toString(); }
|
|
|
|
const processPayment = async (sourceId: string, amount: number, verificationToken: string) => {
|
|
// For static builds, payments should be processed via an API endpoint
|
|
// Check if we're in a browser environment
|
|
if (typeof window !== 'undefined') {
|
|
// Client-side: call the payment API
|
|
try {
|
|
const response = await fetch('/api/payment', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
sourceId,
|
|
amount,
|
|
verificationToken
|
|
})
|
|
})
|
|
|
|
if (!response.ok) {
|
|
console.error('Payment API error:', response.statusText)
|
|
return null
|
|
}
|
|
|
|
return await response.json()
|
|
} catch (error) {
|
|
console.error('Error processing payment:', error)
|
|
return null
|
|
}
|
|
}
|
|
|
|
// Server-side (for SSR builds only, not static export)
|
|
console.warn('Server-side payment processing not available in static export')
|
|
return null
|
|
}
|
|
|
|
export {
|
|
processPayment as default
|
|
}
|