Skip to content

feat: snapshot endpoint share URL#339

Merged
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
vicky4196:feature/snapshot-url
Jun 29, 2026
Merged

feat: snapshot endpoint share URL#339
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
vicky4196:feature/snapshot-url

Conversation

@vicky4196

Copy link
Copy Markdown
Contributor

Add 'Snapshot endpoint' export to share UI state

Summary

This PR implements a shareable URL feature that captures the current endpoint selection and parameters. Users can generate a URL snapshot of their configured endpoint with parameters and share it with others, who will see the same endpoint and parameters pre-loaded.

Changes

src/utils/snapshotUrl.ts (new)

  • generateSnapshotUrl(basePath, snapshot) - Creates a URL with endpoint ID and base64-encoded params
  • parseSnapshotUrl(search) - Parses URL to extract endpoint and params, returns null if invalid
  • copySnapshotUrl(basePath, snapshot) - Copies snapshot URL to clipboard for sharing

src/ApiUsage.tsx

  • Added snapshotted state to track copy feedback
  • Added handleShareSnapshot() function to generate and copy snapshot URL
  • Added useEffect to restore endpoint params from snapshot URL on mount
  • Added "Share Snapshot" button next to "Make Test Call" button
  • Imported LinkIcon for the share button

src/components/icons/LinkIcon.tsx (new)

  • New link/chain icon component for sharing functionality
  • Follows existing icon patterns (size variants, accessibility)

src/components/icons/index.tsx

  • Added export for LinkIcon

src/index.css

  • Added .share-snapshot-button styles with proper spacing

src/utils/snapshotUrl.test.ts (new)

  • 11 tests covering URL generation, parsing, and clipboard copying
  • Tests edge cases like special characters, malformed params, empty values

API/Visible Changes

URL Parameters

  • endpoint - The selected endpoint ID (e.g., "endpoint-1", "endpoint-2")
  • params - Base64-encoded JSON of request parameters

Example URL

/usage?endpoint=endpoint-2&params=eyJhYm91dCI6MTAwLCJjdXJrenVjdXIiOiJVU0QifQ%3D%3D

Accessibility (WCAG 2.1 AA)

  • Share button has aria-label for screen readers
  • Icon is marked aria-hidden when button has accessible label
  • Focus styles follow existing design tokens

Test Output

✓ src/utils/snapshotUrl.test.ts (11 tests) 36ms

All tests pass including:

  • URL generation with/without params
  • Base64 encoding/decoding with Unicode support
  • Graceful handling of malformed URLs
  • Clipboard copy success/failure

closes #252

- Add collapsible filter sections (Categories, Price, Popularity)
- Persist collapsed state to localStorage via usePersistedState hook
- Add ChevronIcon component for expand/collapse indicator
- Implement WCAG 2.1 AA accessibility with aria-expanded/aria-controls
- Add reduced motion support and responsive styling
- Add comprehensive tests for collapse functionality

closes CalloraOrg#254
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@vicky4196 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

- Add snapshotUrl.ts utility for URL-based endpoint sharing
- Add Share Snapshot button to generate/copy shareable URLs
- Restore endpoint params from URL on page load
- Add LinkIcon component for share functionality
- Handle Unicode chars in params via base64 encoding

closes CalloraOrg#252
@vicky4196 vicky4196 force-pushed the feature/snapshot-url branch from ca05f9e to 9ae0d95 Compare June 29, 2026 16:45
@greatest0fallt1me greatest0fallt1me merged commit 6458603 into CalloraOrg:main Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add 'Snapshot endpoint' export to share UI state

2 participants