Events Reference
All events are dispatched as CustomEvent with bubbles: true and composed: true.
Event Map
Section titled “Event Map”| Event | Payload | Stage |
|---|---|---|
allfeat:ready | { mode } | Initialization |
allfeat:upload-start | { filename, size } | Upload |
allfeat:upload-progress | { progress, loaded, total } | Upload |
allfeat:upload-complete | { filename } | Upload |
allfeat:confirmed | { transactionId } | Confirmation |
allfeat:step | { step, progress, description? } | Tracking |
allfeat:complete | { atsId, txHash, blockNumber, explorerUrl, accessCode? } | Done |
allfeat:failed | { error, stage?, code? } | Error |
allfeat:token-expired | { pendingAction } | Auth |
allfeat:error | { stage, error, code?, details? } | Error |
allfeat:ready
Section titled “allfeat:ready”Fired once when the widget is mounted and initialized.
interface ReadyDetail { mode: 'register' | 'update' | 'access';}allfeat:upload-start
Section titled “allfeat:upload-start”Fired when the file upload to S3 begins.
interface UploadStartDetail { filename: string; size: number; // bytes}allfeat:upload-progress
Section titled “allfeat:upload-progress”Fired repeatedly during file upload.
interface UploadProgressDetail { progress: number; // 0–100 loaded: number; // bytes uploaded total: number; // total bytes}allfeat:upload-complete
Section titled “allfeat:upload-complete”Fired when the file upload finishes successfully.
interface UploadCompleteDetail { filename: string;}allfeat:confirmed
Section titled “allfeat:confirmed”Fired when the backend has confirmed the submission and a blockchain transaction is initiated.
interface ConfirmedDetail { transactionId: string;}allfeat:step
Section titled “allfeat:step”Fired on each tracking step transition during blockchain processing.
interface StepDetail { step: string; progress: number; // 0–100 description?: string; // Human-readable step label}Register mode — step order and progress:
| Step | Progress | Description |
|---|---|---|
validating | 5% | Validating work data |
transferring_tokens | 20% | Transferring tokens |
preparing_transaction | 40% | Preparing transaction |
signing | 55% | Signing transaction |
submitting | 70% | Submitting to blockchain |
confirming | 85% | Waiting for confirmation |
completed | 100% | Done |
Update mode — step order and progress:
| Step | Progress | Description |
|---|---|---|
validating | 5% | Validating work data |
preparing_transaction | 40% | Preparing transaction |
signing | 55% | Signing transaction |
submitting | 70% | Submitting to blockchain |
confirming | 85% | Waiting for confirmation |
completed | 100% | Done |
allfeat:complete
Section titled “allfeat:complete”Fired when the work is successfully registered on the blockchain.
interface CompleteDetail { atsId: number | null; // Unique ATS work identifier txHash: string; // Blockchain transaction hash blockNumber: number; // Block number explorerUrl: string; // Link to blockchain explorer accessCode?: string; // Access code (register mode only)}In access mode, txHash is empty, blockNumber is 0, and explorerUrl is empty — no transaction is performed.
allfeat:failed
Section titled “allfeat:failed”Fired on critical errors that stop the operation.
interface FailedDetail { error: string; // Human-readable error message stage?: string; // Stage where the error occurred code?: string; // Machine-readable error code}allfeat:token-expired
Section titled “allfeat:token-expired”Fired when a 401 response indicates the JWT token has expired.
interface TokenExpiredDetail { pendingAction: string; // The action that was interrupted}After receiving this event, call widget.setToken(newToken) within 60 seconds to resume.
allfeat:error
Section titled “allfeat:error”Fired for non-fatal, recoverable errors.
interface ErrorDetail { stage: string; error: string; code?: string; details?: unknown;}Listening in TypeScript
Section titled “Listening in TypeScript”import { EVENT_NAMES } from 'allfeat-ats-component';import type { CompleteDetail } from 'allfeat-ats-component';
widget.addEventListener(EVENT_NAMES.COMPLETE, ((e: CustomEvent<CompleteDetail>) => { const { atsId, txHash, accessCode } = e.detail;}) as EventListener);EVENT_NAMES Constants
Section titled “EVENT_NAMES Constants”const EVENT_NAMES = { READY: 'allfeat:ready', UPLOAD_START: 'allfeat:upload-start', UPLOAD_PROGRESS: 'allfeat:upload-progress', UPLOAD_COMPLETE: 'allfeat:upload-complete', CONFIRMED: 'allfeat:confirmed', STEP: 'allfeat:step', COMPLETE: 'allfeat:complete', FAILED: 'allfeat:failed', TOKEN_EXPIRED: 'allfeat:token-expired', ERROR: 'allfeat:error',};