-
Couldn't load subscription status.
- Fork 40
Addresses LLM Content Gaps (runtime architecture, project anatomy, terminology, constants rework and usage guides) #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Left a few comments.
|
|
||
| ## Why Use Constants? | ||
|
|
||
| Constants equal their variable name as a string (e.g., `ButtonType.primary` equals `"primary"`), but using constants provides type safety, IDE autocomplete, and future-proofing against API changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constants provide named references to string values (e.g., ButtonType.primary represents the string "primary"). Using constants instead of raw strings gives you type safety, IDE autocomplete, and protection against future API changes.
|
|
||
| <InlineAlert slots="header,text1" variant="warning"/> | ||
|
|
||
| #### Important |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this heading. Warning should be sufficient.
|
|
||
| ### Event Handling | ||
|
|
||
| **Critical:** Event constants must be imported - they're not available in the constants object: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Event constants are named export only — they must be imported and cannot be accessed through the constants object:
| ```javascript | ||
| import addOnUISdk, { AppEvent } from "https://new.express.adobe.com/static/add-on-sdk/sdk.js"; | ||
|
|
||
| // ✅ Correct - must import AppEvent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct - AppEvent is imported
| updateUITheme(event.theme); | ||
| }); | ||
|
|
||
| // ❌ This will NOT work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a line saying why this will not work?
❌ This will NOT work - AppEvent is not in constants object
| } | ||
| ``` | ||
|
|
||
| ## Common Pitfalls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Common Pitfalls & Solutions
| ## Common Pitfalls | ||
|
|
||
| ### Environment Confusion | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the problem here first?
Problem: Trying to use document constants in the wrong environment.
| ## Related Documentation | ||
|
|
||
| - [Document APIs Reference](../../../references/document-sandbox/document-apis/) | ||
| - [Document APIs Constants](../../../references/document-sandbox/document-apis/enumerations/ArrowHeadType.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is ArrowHead the right link or is it to Constants?
|
|
||
| Some constants (like `AppEvent`, `SupportedMimeTypes`) are **only available as named exports** and cannot be accessed through `addOnUISdk.constants.*`. See [Import Patterns](#import-patterns) below. | ||
|
|
||
| ## Most Common Use Cases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment as constants file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comments to the previous.
Description
Reworks addOnUISdk constants reference and adds a new how-to, as a result of general dev confusion and LLM testing. See: https://jira.corp.adobe.com/browse/EXTDEVEX-48
Related Issue
https://jira.corp.adobe.com/browse/EXTDEVEX-48
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: