Improve cancel callback documentation#109
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughUpdated documentation clarifying what triggers the cancel callback: added a dedicated section listing specific exceptions and a note about conditional error-triggered cancellations; restructured the troubleshooting index to consolidate cancellation and error handling and adjusted related troubleshooting pages' metadata notes and examples. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
content/docs/troubleshooting/index.mdx (1)
17-17:⚠️ Potential issue | 🟡 MinorFix grammar issues in this sentence.
This line has two grammar errors:
- "an cancel callback" → "a cancel callback"
- "session cancellations" → "session is cancelled"
📝 Proposed fix
-The easiest way to handle cancellation is to set up an cancel callback. This allows your application to react immediately when a user's verification session cancellations. +The easiest way to handle cancellation is to set up a cancel callback. This allows your application to react immediately when a user's verification session is cancelled.
🤖 Fix all issues with AI agents
In `@content/docs/js-sdk/preparing-request.mdx`:
- Around line 107-116: Fix two minor wording issues in the "What triggers cancel
callback?" section: add the article "the" before "user" in the sentence
"Following are some exceptions that happen when user presses a button..." and
hyphenate "auto submit" to "auto-submit" in the sentence "Other errors (such as
network timeouts or internal exceptions) may also trigger this callback if auto
submit is enabled." Reference the section header and the exception names
ReclaimVerificationAbortedException and
ReclaimVerificationProviderScriptException to locate the paragraph to update.
| #### What triggers cancel callback? | ||
|
|
||
| Following are some exceptions that happen when user presses a button to cancel in UI or provider custom injection script causes a cancellation by calling `Reclaim.reportProviderError` in browser. | ||
|
|
||
| | Exception Name | Description | | ||
| |----------------|-------------| | ||
| | `ReclaimVerificationAbortedException` | User cancelled the verification (e.g., tapped on cancel or verify another way button). | | ||
| | `ReclaimVerificationProviderScriptException` | The provider script encountered an error (e.g., login failed, invalid account used). | | ||
|
|
||
| Other errors (such as network timeouts or internal exceptions) will **not** trigger this callback but can be found by [fetching analytics events](./troubleshooting/analytics-event) for the session. | ||
| Other errors (such as network timeouts or internal exceptions) may also trigger this callback if **auto submit is enabled**. In any case, you can always find the complete list of errors by [fetching analytics events](./troubleshooting/analytics-event) for the session. |
There was a problem hiding this comment.
Minor grammar and formatting fixes needed.
Two small issues:
- Line 109: Missing article "the" before "user"
- Line 116: "auto submit" should be hyphenated as "auto-submit" (compound adjective)
📝 Proposed fixes
#### What triggers cancel callback?
-Following are some exceptions that happen when user presses a button to cancel in UI or provider custom injection script causes a cancellation by calling `Reclaim.reportProviderError` in browser.
+Following are some exceptions that happen when the user presses a button to cancel in the UI or a provider custom injection script causes a cancellation by calling `Reclaim.reportProviderError` in the browser.
| Exception Name | Description |
|----------------|-------------|
| `ReclaimVerificationAbortedException` | User cancelled the verification (e.g., tapped on cancel or verify another way button). |
| `ReclaimVerificationProviderScriptException` | The provider script encountered an error (e.g., login failed, invalid account used). |
-Other errors (such as network timeouts or internal exceptions) may also trigger this callback if **auto submit is enabled**. In any case, you can always find the complete list of errors by [fetching analytics events](./troubleshooting/analytics-event) for the session.
+Other errors (such as network timeouts or internal exceptions) may also trigger this callback if **auto-submit is enabled**. In any case, you can always find the complete list of errors by [fetching analytics events](./troubleshooting/analytics-event) for the session.🧰 Tools
🪛 LanguageTool
[grammar] ~116-~116: Use a hyphen to join words.
Context: ...may also trigger this callback if auto submit is enabled. In any case, you ca...
(QB_NEW_EN_HYPHEN)
🤖 Prompt for AI Agents
In `@content/docs/js-sdk/preparing-request.mdx` around lines 107 - 116, Fix two
minor wording issues in the "What triggers cancel callback?" section: add the
article "the" before "user" in the sentence "Following are some exceptions that
happen when user presses a button..." and hyphenate "auto submit" to
"auto-submit" in the sentence "Other errors (such as network timeouts or
internal exceptions) may also trigger this callback if auto submit is enabled."
Reference the section header and the exception names
ReclaimVerificationAbortedException and
ReclaimVerificationProviderScriptException to locate the paragraph to update.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
content/docs/troubleshooting/anatomy.mdx (1)
113-118:⚠️ Potential issue | 🟡 MinorUse a TypeScript code block for the cancel callback shape.
The code block is labeled as
jsonbut contains[key: any]: any, which is TypeScript syntax invalid in JSON. Since the documentation is showing a type structure with index signatures, use a TypeScript code block instead.Suggested change
-```json +```ts { "type": "string", "message": "string", - [key: any]: any + [key: string]: any }</details> </blockquote></details> </blockquote></details>🤖 Fix all issues with AI agents
In `@content/docs/troubleshooting/analytics-event.mdx`: - Around line 208-210: The docs mention a has_error boolean in Reclaim verification metadata but the MetadataReclaimException type definition is missing it; update the MetadataReclaimException metadata type to include an optional has_error?: boolean (and add a short inline comment or sentence describing that it is true when the user cancelled after an error) so the narrative and type definition match—look for the MetadataReclaimException type definition in the analytics-event content and add the optional has_error field to that type. In `@content/docs/troubleshooting/anatomy.mdx`: - Around line 36-58: The comment for "cancelCallbackUrl" conflicts with the example because it says the URL is used only when auto submit is enabled while the example sets "canAutoSubmit": false; update the example or the comment: either set "canAutoSubmit": true in the JSON sample to match the comment, or reword the comment to state that "cancelCallbackUrl" is used when auto submit is enabled (canAutoSubmit: true) and may be ignored when false; adjust the surrounding text for "cancelCallbackUrl" and "canAutoSubmit" so their behaviors are consistent and unambiguous.
| > [!NOTE] | ||
| > In case of `ReclaimVerificationProviderScriptException`, the metadata may contain an additional `providerError` field with more detailed error information from the provider script. | ||
| > In case of `ReclaimVerificationAbortedException`, the metadata may contain an additional `has_error` boolean field which will be true if the user cancelled the verification after an error occurred during verification. |
There was a problem hiding this comment.
Document has_error in the metadata type definition.
The new note introduces a has_error field, but MetadataReclaimException doesn’t include it. This makes the type definition inconsistent with the narrative.
📝 Suggested doc update
export interface MetadataReclaimException {
exception: {
type: string; // e.g. "ReclaimVerificationCancelledException"
message: string;
providerError?: Record<string, any>;
};
+ has_error?: boolean;
}🤖 Prompt for AI Agents
In `@content/docs/troubleshooting/analytics-event.mdx` around lines 208 - 210, The
docs mention a has_error boolean in Reclaim verification metadata but the
MetadataReclaimException type definition is missing it; update the
MetadataReclaimException metadata type to include an optional has_error?:
boolean (and add a short inline comment or sentence describing that it is true
when the user cancelled after an error) so the narrative and type definition
match—look for the MetadataReclaimException type definition in the
analytics-event content and add the optional has_error field to that type.
| // URL which is called when verification is cancelled by the user or after errors (only auto submit enabled; auto submit is enabled by default). | ||
| "cancelCallbackUrl": "https://api.example.com/cancel?session=def", | ||
| // URL to redirect to after cancelled proof generation | ||
| "cancelRedirectUrl": "https://example.com/cancelled?session=def", | ||
| // Timestamp of the proof request | ||
| "timestamp": "1769867597546", | ||
| // legacy: same as above | ||
| "timeStamp": "1769867597546", | ||
| "options": { | ||
| // enables diagnostic logging for debugging purposes | ||
| "log": true, | ||
| // enables use of AI in verification journey | ||
| "acceptAiProviders": false, | ||
| // users may use Reclaim Verifier app clip or instant app for verification | ||
| "useAppClip": false, | ||
| // URL of the custom share page (optional) | ||
| "customSharePageUrl": "https://portal.reclaimprotocol.org", | ||
| "launchOptions": { | ||
| // enables deferred deep links flow | ||
| "canUseDeferredDeepLinksFlow": true | ||
| }, | ||
| // Enables auto submitting proofs on success or errors | ||
| "canAutoSubmit": false, |
There was a problem hiding this comment.
Align cancel callback description with the example configuration.
The comment says cancelCallbackUrl is only used when auto submit is enabled, but the example sets "canAutoSubmit": false, which can be read as contradictory. Consider clarifying the comment or adjusting the example value to avoid confusion.
✏️ Possible clarification
- // URL which is called when verification is cancelled by the user or after errors (only auto submit enabled; auto submit is enabled by default).
+ // URL called when the user cancels verification; error-triggered cancellations are delivered only when canAutoSubmit is true (default).📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // URL which is called when verification is cancelled by the user or after errors (only auto submit enabled; auto submit is enabled by default). | |
| "cancelCallbackUrl": "https://api.example.com/cancel?session=def", | |
| // URL to redirect to after cancelled proof generation | |
| "cancelRedirectUrl": "https://example.com/cancelled?session=def", | |
| // Timestamp of the proof request | |
| "timestamp": "1769867597546", | |
| // legacy: same as above | |
| "timeStamp": "1769867597546", | |
| "options": { | |
| // enables diagnostic logging for debugging purposes | |
| "log": true, | |
| // enables use of AI in verification journey | |
| "acceptAiProviders": false, | |
| // users may use Reclaim Verifier app clip or instant app for verification | |
| "useAppClip": false, | |
| // URL of the custom share page (optional) | |
| "customSharePageUrl": "https://portal.reclaimprotocol.org", | |
| "launchOptions": { | |
| // enables deferred deep links flow | |
| "canUseDeferredDeepLinksFlow": true | |
| }, | |
| // Enables auto submitting proofs on success or errors | |
| "canAutoSubmit": false, | |
| // URL called when the user cancels verification; error-triggered cancellations are delivered only when canAutoSubmit is true (default). | |
| "cancelCallbackUrl": "https://api.example.com/cancel?session=def", | |
| // URL to redirect to after cancelled proof generation | |
| "cancelRedirectUrl": "https://example.com/cancelled?session=def", | |
| // Timestamp of the proof request | |
| "timestamp": "1769867597546", | |
| // legacy: same as above | |
| "timeStamp": "1769867597546", | |
| "options": { | |
| // enables diagnostic logging for debugging purposes | |
| "log": true, | |
| // enables use of AI in verification journey | |
| "acceptAiProviders": false, | |
| // users may use Reclaim Verifier app clip or instant app for verification | |
| "useAppClip": false, | |
| // URL of the custom share page (optional) | |
| "customSharePageUrl": "https://portal.reclaimprotocol.org", | |
| "launchOptions": { | |
| // enables deferred deep links flow | |
| "canUseDeferredDeepLinksFlow": true | |
| }, | |
| // Enables auto submitting proofs on success or errors | |
| "canAutoSubmit": false, |
🤖 Prompt for AI Agents
In `@content/docs/troubleshooting/anatomy.mdx` around lines 36 - 58, The comment
for "cancelCallbackUrl" conflicts with the example because it says the URL is
used only when auto submit is enabled while the example sets "canAutoSubmit":
false; update the example or the comment: either set "canAutoSubmit": true in
the JSON sample to match the comment, or reword the comment to state that
"cancelCallbackUrl" is used when auto submit is enabled (canAutoSubmit: true)
and may be ignored when false; adjust the surrounding text for
"cancelCallbackUrl" and "canAutoSubmit" so their behaviors are consistent and
unambiguous.
Description
Testing (ignore for documentation update)
Type of change
Checklist:
Additional Notes:
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.