@shopify/shop-minis-react
Version:
React component library for Shopify Shop Minis with Tailwind CSS v4 support (source-only, requires TypeScript)
20 lines (17 loc) • 531 B
text/typescript
/**
* Builds a deeplink URL for a Shop Mini.
*
* @param path - The path within the mini (should start with '/').
* @returns The full deeplink URL. Structure: https://shop.app/mini/{handle}{path}
*
* @example
* buildDeeplinkUrl('/products/123')
* // Returns: 'https://shop.app/mini/my-mini/products/123'
*/
export function buildDeeplinkUrl(path: string): string {
const {handle} = window.minisParams
if (!handle) {
throw new Error('Mini handle is not set')
}
return `https://shop.app/mini/${handle}${path}`
}