Initial commit

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F22Ms5Cxam5UHyxaCrtZzu
This commit is contained in:
Rami Bitar
2026-07-29 11:02:40 -04:00
co-authored by Claude Fable 5
commit f23332e42c
88 changed files with 7947 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
/**
* Adapt a Next.js App Router `searchParams` record (`Record<string, string |
* string[] | undefined>`) into a `URLSearchParams` for Hydrogen helpers that
* expect a `URLSearchParams` (`getSelectedProductOptions`, `parseCollectionParams`).
*
* `searchParams` is a `Promise<Record<...>>` in Next 15+ — `await` it first.
*/
export function toURLSearchParams(
input: Record<string, string | string[] | undefined>,
): URLSearchParams {
const params = new URLSearchParams();
for (const [key, value] of Object.entries(input)) {
if (Array.isArray(value)) {
for (const item of value) params.append(key, item);
} else if (value != null) {
params.set(key, value);
}
}
return params;
}