const sdk = new HaspSDK({
// All options are optional — defaults work for most apps.
appId: undefined, // Auto-detected from window.__HASP__ — never set this manually
baseUrl: '/api/hasp/v1', // Data API base path — do not change (exposed for testing environments only)
onUnauthorized: () => {
// Called on 401. Default: redirect to /login.
// Override to save draft state before redirecting.
},
onMaintenanceStart: (status) => {
// Called with { status, message?, estimatedSeconds? } when maintenance begins.
},
onMaintenanceEnd: () => {
// Called when maintenance ends (any request succeeds after a 503).
},
retry: {
maxRetries: 3, // Retries for 429/502 (default: 3)
baseDelayMs: 500, // Base delay before first retry (default: 500ms)
},
});