Skip to content

React Router authenticate.admin helper + Resource Picker UI mock#36

Open
fazlulkabir34 wants to merge 23 commits into
ctrlaltdylan:mainfrom
bevycommerce:main
Open

React Router authenticate.admin helper + Resource Picker UI mock#36
fazlulkabir34 wants to merge 23 commits into
ctrlaltdylan:mainfrom
bevycommerce:main

Conversation

@fazlulkabir34
Copy link
Copy Markdown

Summary

This branch brings two main upgrades to mock-bridge: first-class support for Shopify App React Router admin authentication in tests, and a fully mocked shopify.resourcePicker flow with an admin-frame modal, catalog API, and stronger bridge integration—so automated browser tests and MCP-style tooling can exercise picker UX without hitting Shopify.

What’s included

React Router admin auth — withMockBridgeAdminAuthForReactRouter (and related exports/build artifacts) so apps using authenticate.admin(request) can run against the mock bridge with clearer wiring and types.
Resource Picker — Replaces the previous stub with a mock modal UI in the admin frame, store/state for open/close/search/selection, variant-aware catalog behavior, and improvements around focus management and error handling.
Server/catalog integration — Mock catalog backed by /api/resource-picker-catalog (documented); customizable via resourcePickerCatalog on the server where applicable.
App Bridge layer — Updates to feature wiring (invokeFeature, resource-picker bridge path, loading tweaks) so the picker behaves consistently with the rest of the mock.
Docs — New guides: docs/SHOPIFY_APP_REACT_ROUTER.md, docs/RESOURCE_PICKER.md; README feature matrix updated (resource picker marked as mock UI); small related edits to backend integration and Remix docs.

fazlulkabir34 and others added 23 commits March 25, 2026 02:52
- Add withMockBridgeAdminAuthForReactRouter under @getverdict/mock-bridge/react-router
- Wire package.json exports for ., ./auth, ./react-router, ./client
- Optional peerDependencies for @shopify/shopify-app-react-router and @shopify/shopify-api
- Document SHOPIFY_APP_REACT_ROUTER, BACKEND_INTEGRATION caveat, README link
- tsconfig paths for Shopify package subpath typings under classic moduleResolution
…kage exports

- Introduced withMockBridgeAdminAuthForReactRouter for enhanced admin authentication in React Router apps.
- Updated package.json to remove deprecated react-router export and streamline exports.
- Enhanced documentation to reflect changes in integration instructions for Shopify App React Router.
- Adjusted type exports for better clarity and consistency.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Removed redundant mention of `@getverdict/mock-bridge/auth` in the Shopify App React Router section.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
chore: update package-lock.json and tsconfig.json
- Added ResourcePicker component for selecting products, variants, and collections.
- Updated App component to include ResourcePicker.
- Enhanced mock bridge to handle resource picker actions.
- Updated package.json and package-lock.json to include new dependencies for React and related types.
- Modified README.md to reflect the new ResourcePicker functionality.
- Updated tsconfig.json to include new type definitions for resource picker.
…d functions

- Enhanced ResourcePickerCatalogResponse to include variants.
- Updated getDefaultResourcePickerCatalog to return variants using flattenVariants.
- Modified mergeResourcePickerCatalog to handle variants in the merge process.
- Adjusted server logic to utilize the new variants structure.
- Removed unnecessary useCallback for toggleId in ResourcePickerModal.
- Simplified onChange handlers for buttons in ResourcePickerModal.
- Introduced fetchCatalog function to centralize catalog fetching logic and improve error handling.
- Updated closedPickerState to include loading state.
- Enhanced getFeatureStore to throw an error if a feature is not found.
- Refactored flattenVariants function for better readability and performance.
… improvements

- Added focus management for the search input in ResourcePickerModal to improve accessibility.
- Implemented keyboard navigation within the dialog to enhance user experience.
- Updated the ResourcePicker state to include selectionRowById for better tracking of selected items.
- Refactored fetchCatalog to handle aborting previous requests and improved error handling.
- Adjusted the mock bridge to support new features and ensure robust communication with the resource picker.
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.

1 participant