Results and errors
The SDK splits problems in two: results the shopper can act on, and errors that aren't theirs to fix.
Results (result.status)
| Status | Meaning | What to show |
| --------------------- | ----------------------------------------- | --------------------------------------- |
| accepted | Entry saved | Your success screen |
| invalid | Some fields failed validation | Inline errors from result.errors |
| invalid_code | Code not found for this campaign | "Check the code and try again" |
| code_used | Code already redeemed | "This code has already been used" |
| entry_limit_reached | This person has entered the maximum times | The campaign's limit message |
| closed | After the end date | The closed message |
| not_started | Before the start date | The start date |
| bot_check_failed | Turnstile token rejected | Reset the widget, ask them to try again |
| rate_limited | Too many attempts | Wait result.retryAfter seconds |
Errors (LoranjError)
Thrown for problems the shopper can't fix. Check with isLoranjError(err) and read err.code.
| Code | Meaning |
| -------------------------- | ---------------------------------------------------------- |
| not_found | Unknown campaign key, or the campaign isn't public |
| origin_not_allowed | This site's domain isn't in the campaign's allowed domains |
| network_error, timeout | Loranj couldn't be reached, even after retries |
| internal_error | Loranj failed, even after retries |