Skip to content

Events Reference

All events are dispatched as CustomEvent with bubbles: true and composed: true.

EventPayloadStage
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

Fired once when the widget is mounted and initialized.

interface ReadyDetail {
mode: 'register' | 'update' | 'access';
}

Fired when the file upload to S3 begins.

interface UploadStartDetail {
filename: string;
size: number; // bytes
}

Fired repeatedly during file upload.

interface UploadProgressDetail {
progress: number; // 0–100
loaded: number; // bytes uploaded
total: number; // total bytes
}

Fired when the file upload finishes successfully.

interface UploadCompleteDetail {
filename: string;
}

Fired when the backend has confirmed the submission and a blockchain transaction is initiated.

interface ConfirmedDetail {
transactionId: string;
}

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:

StepProgressDescription
validating5%Validating work data
transferring_tokens20%Transferring tokens
preparing_transaction40%Preparing transaction
signing55%Signing transaction
submitting70%Submitting to blockchain
confirming85%Waiting for confirmation
completed100%Done

Update mode — step order and progress:

StepProgressDescription
validating5%Validating work data
preparing_transaction40%Preparing transaction
signing55%Signing transaction
submitting70%Submitting to blockchain
confirming85%Waiting for confirmation
completed100%Done

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.


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
}

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.


Fired for non-fatal, recoverable errors.

interface ErrorDetail {
stage: string;
error: string;
code?: string;
details?: unknown;
}

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);
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',
};