Vendor panel order details — first-party React view behind a server-side view marker - #3347
Open
MdAsifHossainNadim wants to merge 2 commits into
Conversation
…ew marker The panel's /orders/:orderId route renders a first-party React view matching the Figma designs, with the #3333 server-rendered fragment kept as the permanent fallback (ADR-0005). The server decides the renderer per store via dokanFrontend.order_details.view — react by default, fragment automatically when third-party callbacks are detected on the details-template hooks or the session is Vendor staff, and always overridable through the dokan_vendor_panel_order_details_view filter. Additive only: a Hookable marker class on the existing localized-args seam, a new OrderDownloadController (list/grant/update/revoke) registered through dokan_rest_api_class_map, the details/ component tree with named section slots for Pro, and the RFQ-measured header controls (breadcrumb, outlined status pill, split status button honoring the legacy cancelled/refunded and admin-setting rules). Shipped permission callbacks, Assets.php and the fragment renderer are untouched. Part of getdokan/plugin-internal-tasks#2159 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The sidebar cards now carry the design's own spec rather than an approximation of it: the customer's name belongs to the title block instead of sitting below a rule, contact lines have their glyphs, addresses read as one sentence that clamps at three lines with the full text on hover, and every block label is the same size and weight. Card rhythm needed the rule to move. The shared card header applies `[.border-b]:pb-6` when it draws its own divider, and that beats a plain padding utility on specificity — even an important one — so the dividered cards sat 4px off the grid from the one without a divider. Blocks draw the rule themselves now, and every card breathes identically. Extensibility comes with it: each section is bracketed by `before-*`/`after-*` slots carrying the whole view context, so an extension can add a card anywhere without replacing a first-party one, and the summary cells, status list and address parts run through JS filters. On the server, sections and the status list get their own filters beside the existing marker ones. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Gives the Vendor panel's
/orders/:orderIdroute a first-party React UI matching the design mockups, while the #3333 server-rendered fragment stays as the permanent compatibility fallback (ADR-0005 intact). Stacked onfeat/vendor-panel-order-details-fragment.Everything is additive — the only shipped files touched are one-line registrations plus this feature's own files from the base branch.
OrderController,Assets.php,Order/functions.php,DetailsFragmentand the fragment component are byte-identical.WeDevs\Dokan\Order\VendorPanelOrderDetails(Hookable) publishesdokanFrontend.order_details.view(react|fragment) through the existingdokan_react_frontend_localized_argsseam, plussections, the status list and theorder_status_changeadmin setting. Defaults toreact, with automatic fallback to the fragment when third-party callbacks are detected on the details-template hooks (reflection, best-effort — thedokan_vendor_panel_order_details_viewfilter is the guaranteed override) or when the session is Vendor staff (whose access only the fragment endpoint currently grants — the shipped staff-refusing permission rule is deliberately untouched, per the WPML - CUSTOMER/SELLER ACCOUNT - ORDERS > Order Details: Date of Delivery > Date > not translated #2133 split).src/dashboard/orders/details/) — summary strip (site-format "date at time", Dokan-formatted earning), items card (Figma column spec44fr/22fr/22fr/22fr,#FDFDFDheader strip, coupon chips, refund rows, strikethrough totals), downloadable-permissions card (search + grant, per-file editable limit/expiry with usage hints, revoke), sidebar Customer/Address/Notes cards built to the Figma spec (20px card grid with block-owned dividers, one label size throughout, lucide mail/phone/IP glyphs, addresses as a single line clamped to three with the full text on hover, legacy keycdn geo IP link,humanTimeDiffnote stamps, trash-icon delete). One order fetch feeds the page;ORDER_DETAILS_LOADED/ORDER_DETAILS_STATUS_CHANGEDkeep the shared header in sync under either renderer.before-*/after-*slots (summary,items,downloads,customer,address,notes) alongsideitems-actionsandsidebar-before/middle/after, each receiving{ order, orderId, sections, isLoading, refetch, navigate }as fillProps; Pro's sections plug in viaregisterPluginscoped to the route id (companion PR). First-party data runs through JS filters too —dokan_order_details_summary_items,dokan_order_details_statuses,dokan_order_details_address_parts— and on the server,dokan_vendor_panel_order_details_sectionsand…_statusesjoin the existing…_args/…_view.dokan_manage_order+ theorder_status_changeadmin setting. No Print control: the legacy page has none.OrderDownloadController:GET/POST dokan/v1/orders/<id>/downloads,PUT/DELETE …/downloads/<permission_id>, registered via thedokan_rest_api_class_mapfilter; staff-aware permission callbacks modeled on the fragment endpoint; grant wrapswc_downloadable_file_permission()with the vendor-ownership guard from the AJAX handler; expiry stored as UTC midnight so the picked day round-trips timezone-stable.Related Pull Request(s)
Closes
How to test the changes in this Pull Request:
npm run build) and open/dashboard/new/#/orders, then any order — the details render as first-party React (no fragment markup), on the product editor's gray canvas.add_filter( 'dokan_vendor_panel_order_details_view', fn() => 'fragment' );— the same route renders the Vendor order details in the Vendor panel — server-rendered fragment over REST #3333 fragment again (ADR-0005 gate). Legacy URL unchanged.dokan_order_detail_after_order_itemsfrom a theme — the view auto-falls back to the fragment.Changelog entry
Vendor order details render as first-party React in the Vendor panel
Previous behaviour: the panel's order-details route displayed the legacy server-rendered template bridged in as an HTML fragment.
New behaviour: stores without third-party template hooks get a first-party React details view matching the new design (summary, items and totals, downloadable permissions, customer/address/notes sidebar), with named section slots for extensions. The fragment remains the automatic fallback for stores with third-party hooked output, for Vendor staff sessions, and via the
dokan_vendor_panel_order_details_viewfilter; the legacy URL keeps working unchanged.🤖 Generated with Claude Code