20399 components awardco#20488
Conversation
- Added methods for recognizing users and retrieving feed data (social and custom). - Introduced new actions: "Pull Feed Data" and "Submit Recognition" for better interaction with Awardco API. - Updated package version to 0.1.0 and added dependencies. - Created utility functions and constants for improved code organization. This update significantly expands the functionality of the Awardco integration.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughA new Awardco component is introduced with an HTTP request helper, API methods for recognition and feed retrieval, utility functions, and four action modules. The app component provides Changes
Sequence Diagram(s)sequenceDiagram
participant Action as Recognize Action
participant AwardcoApp as Awardco App Service
participant API as Awardco API
Action->>AwardcoApp: recognize({recipients, note, ...})
AwardcoApp->>AwardcoApp: _baseUrl()<br/>_headers()
AwardcoApp->>AwardcoApp: _makeRequest({path: /recognize, ...})
AwardcoApp->>API: POST /recognize<br/>(with apikey header)
API-->>AwardcoApp: response
AwardcoApp-->>Action: response
Action->>Action: $.export($summary)
sequenceDiagram
participant Action as Feed Action
participant AwardcoApp as Awardco App Service
participant API as Awardco API
Action->>AwardcoApp: getCustomFeed({page, limit, metadataFilter})
AwardcoApp->>AwardcoApp: _headers()
AwardcoApp->>AwardcoApp: _makeRequest({path: /v1/custom-feed, ...})
AwardcoApp->>API: GET /v1/custom-feed<br/>(with apikey header)
API-->>AwardcoApp: feed data
AwardcoApp-->>Action: feed data
Action->>Action: $.export($summary)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 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: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@components/awardco/actions/pull-feed-data/pull-feed-data.mjs`:
- Around line 67-82: The API call is passing page, limit, and metadataFilter as
top-level axios config instead of inside the request payload; update the calls
to this.awardco.getCustomFeed and this.awardco.getSocialFeed to pass parameters
under the correct key (use params: { page, limit, metadataFilter } for GET
endpoints or data: { page, limit, metadataFilter } for POST endpoints) so the
query string/body actually contains page, limit and metadataFilter; keep the
feedSource branch logic (this.feedSource === "custom") and only change the
argument object shape when calling those methods.
In `@components/awardco/actions/submit-recognition/submit-recognition.mjs`:
- Around line 132-147: In the recognitionMode === "with_program" branch remove
the early return so the handler sets response and summary then falls through to
the common post-processing (exporting summary); specifically, set response =
await this.awardco.recognize(...) (include the step context by passing $ as a
top-level param: this.awardco.recognize({ $, data: ... })) and set summary =
"Successfully submitted recognition with program" but do not return there—let
the function continue so $.export("$summary", summary) runs later; update the
call to reference this.recognitionProgramId, this.recognitionProgramName,
this.budgetName and this.title as before.
- Around line 149-167: The code block handling this.recognitionMode ===
"no_program" should pass the pipeline context ($) into
this.awardco.recognizeNoProgram to allow proper error handling (i.e., call
recognizeNoProgram({ data: ..., $ })) and ensure response is never left
undefined by adding a fallback branch for unexpected recognitionMode values
(either throw a descriptive error or set response to an error object and set
summary accordingly); update references to response and $.export("$summary",
summary) to occur after all branches so summary/response are always defined.
In `@components/awardco/awardco.app.mjs`:
- Around line 16-26: The _makeRequest function currently spreads ...opts after
setting headers so a caller-supplied headers object can overwrite the internal
apikey header; modify _makeRequest (the axios call building logic) to merge
headers explicitly so internal headers from this._headers() take precedence
(e.g., create mergedHeaders by spreading opts.headers first and then
this._headers()), and pass that mergedHeaders to axios instead of letting
...opts override headers.
In `@components/awardco/package.json`:
- Line 17: The file ends with a closing brace but lacks a trailing newline,
which triggers ESLint's eol-last rule; open the package.json that contains the
final "}" and add a single newline character after the closing brace so the file
ends with a newline (ensure the file is saved with the newline present).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 71d3ff9d-1167-4cb4-a5a1-995e24df1020
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
components/awardco/actions/pull-feed-data/pull-feed-data.mjscomponents/awardco/actions/submit-recognition/submit-recognition.mjscomponents/awardco/awardco.app.mjscomponents/awardco/common/constants.mjscomponents/awardco/common/utils.mjscomponents/awardco/package.json
- Updated the 'Pull Feed Data' action to encapsulate parameters within a 'params' object for better organization. - Modified the 'Submit Recognition' action to include a '$' parameter for consistency in API calls. - Enhanced code readability and maintainability by restructuring data handling in both actions.
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
components/awardco/actions/submit-recognition/submit-recognition.mjs (2)
132-147:⚠️ Potential issue | 🟡 MinorDon't exit before exporting the success summary.
Line 147 returns from the
with_programpath before Line 168 runs, so successful program-based submissions never publish$summary. Setsummaryand fall through to the shared export/return block.Suggested change
if (this.recognitionMode === "with_program") { if (!this.recognitionProgramId && !this.recognitionProgramName) { throw new ConfigurationError("Recognition program ID or Name is required"); } response = await this.awardco.recognize({ $, data: omitEmpty({ ...data, recognitionProgramId: this.recognitionProgramId, recognitionProgramName: this.recognitionProgramName, budgetName: this.budgetName, title: this.title || undefined, }), }); summary = "Successfully submitted recognition with program"; - return response; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@components/awardco/actions/submit-recognition/submit-recognition.mjs` around lines 132 - 147, The with_program branch sets summary and returns early, preventing the shared export of $summary; update the block in submit-recognition.mjs (the branch using this.recognitionMode === "with_program", this.awardco.recognize, and the local summary variable) to remove the immediate return after setting summary so that response is captured but execution falls through to the common export/return section that publishes $summary; ensure you still throw ConfigurationError when both this.recognitionProgramId and this.recognitionProgramName are missing and that response is preserved (e.g., assign response and set summary, then do not return inside the with_program branch).
150-169:⚠️ Potential issue | 🟡 MinorFail fast on unsupported
recognitionMode.If
recognitionModeis ever anything other than the two handled values,summaryandresponsestayundefinedand the action quietly exports an empty summary instead of surfacing a configuration error.Suggested change
if (this.recognitionMode === "no_program") { response = await this.awardco.recognizeNoProgram({ $, data: omitEmpty({ recipients: this.recipients, note: this.note, emailTemplateName: this.emailTemplateName, sendNotifications: this.sendNotifications, budgetName: this.budgetName, tagNames: this.tagNames, giver: this.giver || undefined, amount: this.amount, isPublic: this.isPublic, }), }); summary = "Successfully submitted recognition without program"; + } else if (this.recognitionMode !== "with_program") { + throw new ConfigurationError("Invalid recognition mode"); } $.export("$summary", summary); return response;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@components/awardco/actions/submit-recognition/submit-recognition.mjs` around lines 150 - 169, The code path for this.recognitionMode only covers known branches and leaves summary/response undefined for unsupported values; add a fail-fast branch (e.g., an else or default) after the existing recognitionMode checks to throw a clear error that includes the provided this.recognitionMode value and a short message about supported modes, so the action doesn't export an empty summary; update the block that calls this.awardco.recognizeNoProgram and the final $.export("$summary", summary) usage to assume summary/response are always set or to never reach export when you throw.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@components/awardco/actions/submit-recognition/submit-recognition.mjs`:
- Around line 123-130: The branch that handles the "no_program" request rebuilds
the recognition payload instead of reusing the shared "data" object, risking
drift; modify the no_program branch to use the existing data object (add or
override only the program/programId field as needed) and pass that to the
fetch/request call (the same payload variable "data" created earlier), removing
the duplicated literal payload construction so both branches share the same base
fields (refer to the "data" variable and the fetch/request in the no_program
branch).
- Around line 50-55: The budgetName field is currently required but should be
conditional; update both budgetName field definitions in submit-recognition.mjs
(the budgetName entries used by the "with_program" and the other recognition
mode blocks) to include optional: true so they match the descriptive text
("required when amount is greater than 0 and the program uses allowable access
budgets") and the amount default of 0; locate the budgetName objects and add
optional: true to each one so recognitions without budgets or with zero value
can be submitted.
---
Duplicate comments:
In `@components/awardco/actions/submit-recognition/submit-recognition.mjs`:
- Around line 132-147: The with_program branch sets summary and returns early,
preventing the shared export of $summary; update the block in
submit-recognition.mjs (the branch using this.recognitionMode ===
"with_program", this.awardco.recognize, and the local summary variable) to
remove the immediate return after setting summary so that response is captured
but execution falls through to the common export/return section that publishes
$summary; ensure you still throw ConfigurationError when both
this.recognitionProgramId and this.recognitionProgramName are missing and that
response is preserved (e.g., assign response and set summary, then do not return
inside the with_program branch).
- Around line 150-169: The code path for this.recognitionMode only covers known
branches and leaves summary/response undefined for unsupported values; add a
fail-fast branch (e.g., an else or default) after the existing recognitionMode
checks to throw a clear error that includes the provided this.recognitionMode
value and a short message about supported modes, so the action doesn't export an
empty summary; update the block that calls this.awardco.recognizeNoProgram and
the final $.export("$summary", summary) usage to assume summary/response are
always set or to never reach export when you throw.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9d72d6ed-3b54-44a4-8b14-cde5163a8874
📒 Files selected for processing (2)
components/awardco/actions/pull-feed-data/pull-feed-data.mjscomponents/awardco/actions/submit-recognition/submit-recognition.mjs
- Removed unnecessary fields from the recognition request, enhancing clarity and focus on essential data. - Updated the structure to improve maintainability and readability of the code.
There was a problem hiding this comment.
♻️ Duplicate comments (1)
components/awardco/actions/submit-recognition/submit-recognition.mjs (1)
150-160:⚠️ Potential issue | 🔴 CriticalCritical:
no_programbranch is missing core recognition fields.The payload at lines 153-157 only includes
emailTemplateName,sendNotifications, andbudgetName, but it's missing all the core recognition fields from the shareddataobject:recipients,note,tagNames,giver,amount, andisPublic.This will result in API calls that are missing required fields like
recipientsandnote.Proposed fix
if (this.recognitionMode === "no_program") { response = await this.awardco.recognizeNoProgram({ $, data: omitEmpty({ + ...data, emailTemplateName: this.emailTemplateName, sendNotifications: this.sendNotifications, budgetName: this.budgetName, }), }); summary = "Successfully submitted recognition without program"; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@components/awardco/actions/submit-recognition/submit-recognition.mjs` around lines 150 - 160, The no_program branch (when this.recognitionMode === "no_program") builds a payload for this.awardco.recognizeNoProgram but only sends emailTemplateName, sendNotifications, and budgetName; add the core recognition fields from the shared data object—recipients, note, tagNames, giver, amount, and isPublic—into the payload (use the existing omitEmpty wrapper so falsy/empty values are dropped) so recognizeNoProgram receives the same required fields as the other recognition paths.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@components/awardco/actions/submit-recognition/submit-recognition.mjs`:
- Around line 150-160: The no_program branch (when this.recognitionMode ===
"no_program") builds a payload for this.awardco.recognizeNoProgram but only
sends emailTemplateName, sendNotifications, and budgetName; add the core
recognition fields from the shared data object—recipients, note, tagNames,
giver, amount, and isPublic—into the payload (use the existing omitEmpty wrapper
so falsy/empty values are dropped) so recognizeNoProgram receives the same
required fields as the other recognition paths.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 984fc1a2-5bed-40a6-92a0-b7e39b5c6081
📒 Files selected for processing (1)
components/awardco/actions/submit-recognition/submit-recognition.mjs
michelle0927
left a comment
There was a problem hiding this comment.
Looks great, but I left a couple of comments about avoiding additionalProps.
…recognizing users - Introduced 'Pull Custom Feed Data' and 'Pull Social Feed Data' actions to enhance data retrieval capabilities from the Awardco API. - Added 'Recognize With Recognition Program' and 'Recognize Without Recognition Program' actions for submitting user recognition. - Removed the deprecated 'Submit Recognition' and 'Pull Feed Data' actions to streamline the integration and improve clarity. - Updated documentation links for new actions to ensure users have access to the latest API information.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@components/awardco/actions/pull-social-feed-data/pull-social-feed-data.mjs`:
- Around line 32-41: In the run method, remove the redundant null-coalescing
fallbacks on pagination props and pass this.page and this.limit directly into
awardco.getSocialFeed (i.e., replace uses of this.page ?? 1 and this.limit ?? 10
with this.page and this.limit), and update the $.export("$summary", ...) call to
include the returned items count (for example use response.data.length or
appropriate response property) so the summary reads something like "Successfully
retrieved X items"; target the run function and the call to
this.awardco.getSocialFeed and the $.export("$summary", ...) statement when
applying the change.
In
`@components/awardco/actions/recognize-with-recognition-program/recognize-with-recognition-program.mjs`:
- Around line 67-72: The schema currently marks the budgetName property as
required even though its description says it's conditionally required; update
the action's input schema so budgetName is optional/unrequired by default (or
implement conditional validation in the same schema) rather than always
enforced. Locate the budgetName entry in the recognize-with-recognition-program
action definition and remove or change the unconditional "required" enforcement
(or add a conditional check that only triggers when amount > 0 and program uses
allowable access budgets); apply the same fix to the other similar block
referenced around lines 81–98 to ensure both places reflect the conditional
requirement.
- Around line 82-96: The code allows recognizing by recognitionProgramName alone
but forwards the raw name to awardco.recognize, which may require an ID; update
the flow in recognize-with-recognition-program.mjs to resolve a provided
recognitionProgramName to its ID before calling this.awardco.recognize: if
recognitionProgramId is missing and recognitionProgramName is present, call a
lookup method on the Awardco client (e.g.,
this.awardco.findRecognitionProgramIdByName or similar helper) to retrieve the
ID, throw a ConfigurationError if not found, and then call the recognize(...)
method passing the resolved recognitionProgramId (omit recognitionProgramName)
so recognize(...) always receives a valid ID.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 63284689-2c32-4a4c-aa54-efb1f688b285
📒 Files selected for processing (4)
components/awardco/actions/pull-custom-feed-data/pull-custom-feed-data.mjscomponents/awardco/actions/pull-social-feed-data/pull-social-feed-data.mjscomponents/awardco/actions/recognize-with-recognition-program/recognize-with-recognition-program.mjscomponents/awardco/actions/recognize-without-recognition-program/recognize-without-recognition-program.mjs
michelle0927
left a comment
There was a problem hiding this comment.
For "Recognize With Recognition Program", I'm getting an error: "Values are required.
I have Recognition program name set to "Manager Program" and Budget name set to "Central Budget.
-------------
For "Recognize Without Recognition Program", the description for Email template name says it's "optional if send notifications is true". However, I get an error if I don't enter an email template even if send notifications is true.
…hange default notification setting - Removed the optional attribute from the 'Tag names' field in the 'Recognize With Recognition Program' action. - Changed the default value of the 'Send notifications' field to false in the 'Recognize Without Recognition Program' action for better control over notification settings.
…am/recognize-without-recognition-program.mjs
michelle0927
left a comment
There was a problem hiding this comment.
Tests passed! Ready for Release!
Resolves #20399
Summary by CodeRabbit
New Features
Chores