Rasterex APINPM Package/docs/solutions/embed-drawing-comparison-erp

Embed Drawing Comparison in an ERP or Asset-Management Page

NPM SDK solution for embedding a revision comparison workspace in an ERP or asset-management frontend.

NPM SDK scope

Use the NPM SDK when the ERP frontend can install and run @rasterex/viewer. Keep the ERP record state in the host application and use the SDK only for the documented viewer lifecycle and comparison operations.

Start with the NPM Revision Workflow, Compare API, and Align API.

Host page layout

Give the operator both record context and a usable drawing workspace.

  • Keep record and revision metadata in a host panel beside the viewer.
  • Give the viewer container an explicit, non-zero height.
  • Keep Compare and Align near the selected source fields and show their current state.
  • Show result metadata only after the compare promise or documented event confirms completion.
  • Keep retry and cancellation available without navigating away from the record.

NPM implementation order

Bind the viewer request to the active ERP record and revision pair.

  • 1Create and mount the viewer when the record page owns the viewer region.
  • 2Await viewer.ready() before enabling comparison actions.
  • 3Register comparisonComplete and comparisonError listeners before sending compare or align.
  • 4Validate that both selected revision sources belong to the active record context.
  • 5Call viewer.compare.compare({ backgroundUrl, overlayUrl }) or viewer.compare.align({ backgroundUrl, overlayUrl }).
  • 6Keep record navigation disabled or coordinated while the request is pending so late results cannot update another record.
  • 7Persist host metadata only after the confirmed result is associated with the active record and revision IDs.
  • 8Unsubscribe and destroy the viewer when the record route changes.

Recovery and host persistence

A comparison result is viewer output. It does not automatically create an ERP attachment, update a work order, save markups, or persist revision metadata. Perform those host operations after confirmation and report their own success or failure separately.

On viewer failure, keep the active record and selected revisions, clear stale result metadata, and offer retry. On host-save failure, retain the confirmed viewer result and show the record-save action as incomplete.