Skip to content

Add documentation and cleanup for setAdditionalContext#40

Open
robertson-waweru wants to merge 5 commits intosalesforce:devfrom
robertson-waweru:stack/additional-context/05-documentation
Open

Add documentation and cleanup for setAdditionalContext#40
robertson-waweru wants to merge 5 commits intosalesforce:devfrom
robertson-waweru:stack/additional-context/05-documentation

Conversation

@robertson-waweru
Copy link
Contributor

Part 5 of stacked PRs for additional context support (W-21447588, W-21447589).

Changes

  • Add succinct API documentation to root README (~18 lines)
  • Add comprehensive documentation to bridge README with examples
  • Include supported type reference (Text, Number, Boolean, Date, DateTime, etc.)
  • Document common use cases and error handling
  • Add platform notes for iOS/Android differences
  • Remove unused CopilotAdditionalContext import from SettingsScreen (cleanup)

Testing

  • Verify README renders correctly on GitHub
  • Check all code examples are syntactically correct
  • Validate links work properly
  • Ensure documentation is clear and concise

Stack Context

Depends on: #36 (TypeScript types), #37 (iOS bridge), #38 (Android bridge), #39 (JS bridge) - merge in order
Final PR in stack

Completes W-21447588 and W-21447589 with full documentation.
Developers can now integrate additional context in their React Native apps.

70 lines added

- Add CopilotContext.ts with CopilotContextVariable and CopilotAdditionalContext interfaces
- Add CopilotContextVariableType enum with Android SDK type names (Text, Number, Boolean, etc.)
- Export types from types/index.ts and src/index.ts
- Add comprehensive JSDoc with examples and type mappings

Establishes type contract for additional context feature.
- Add setAdditionalContext React method to AgentforceModule
- Convert NSDictionary to AgentforceVariable array with JSEncodableValue enum
- Handle value type conversion (string, number, boolean, array, object)
- Validate conversation exists before applying context
- Add method declaration to AgentforceModule.m

iOS implementation of additional context support.
- Add setAdditionalContext React method to AgentforceModule.kt
- Convert ReadableMap to CopilotAdditionalContext object
- Import SDK classes: CopilotAdditionalContext, CopilotContextVariable
- Handle multiple value types (String, Number, Boolean, Map, Array)
- Validate conversation exists before applying context
- Use coroutine scope for async context setting

Android implementation of additional context support.
- Add setAdditionalContext method to AgentforceService
- Import and re-export CopilotAdditionalContext types
- Add validation for context structure and variables
- Add comprehensive JSDoc documentation with examples
- Handle errors gracefully with clear messages
- Log context application for debugging

Completes JS bridge integration for W-21447588 and W-21447589.
- Add succinct API documentation to root README (18 lines)
- Add comprehensive documentation to bridge README with examples
- Include supported type reference and platform notes
- Remove unused CopilotAdditionalContext import from SettingsScreen
- Document common use cases and error handling

Completes W-21447588 and W-21447589 documentation.
Developers can now integrate additional context in their apps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant