Skip to content

feat: WIP allow to upgrade manage forms to customized#886

Merged
smarcet merged 2 commits into
masterfrom
feature/sponsor-form-upgrade-customize
May 6, 2026
Merged

feat: WIP allow to upgrade manage forms to customized#886
smarcet merged 2 commits into
masterfrom
feature/sponsor-form-upgrade-customize

Conversation

@tomrndom
Copy link
Copy Markdown

@tomrndom tomrndom commented Apr 21, 2026

ref: https://app.clickup.com/t/86b66n5jn

Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com

Summary by CodeRabbit

  • New Features

    • Added an alternate “managed” sponsor form workflow allowing forms to be upgraded, fetched, and saved via the new managed-flow path.
    • Improved customized form popup flow and state so loading and saving follow the managed or customized path as appropriate.
  • Bug Fixes

    • Removed unintended debug logging from the sponsor page management interface.

Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

📝 Walkthrough

Walkthrough

Adds a managed sponsor-form upgrade flow: new Redux action types and thunks to fetch and upgrade managed forms, conditions the customized-form popup to use those thunks when invoked as an upgrade, and updates the forms tab to manage the upgrade state; also removes a stray debug log.

Changes

Cohort / File(s) Summary
Redux Actions & Thunks
src/actions/sponsor-forms-actions.js
Add REQUEST_SPONSOR_MANAGED_FORM, RECEIVE_SPONSOR_MANAGED_FORM, SPONSOR_MANAGED_FORMS_UPGRADED; add thunks getSponsorManagedForm(formId) and upgradeSponsorManagedForm(entity) (with normalize changes that remove sponsorship_types) and wrap requests with loading actions.
Customized Form Popup
src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form-popup.js
Introduce upgradeManaged prop-driven flow: initial load calls getSponsorManagedForm when true, save uses upgradeSponsorManagedForm when true; update Redux connect to include new action creators.
Forms Tab Orchestration
src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.js
Add local upgradeManaged state, set it in handleCustomizeForm, refactor handleSaveFormFromTemplate, and add handleCloseCustomizedPopup to reset state and refetch managed/customized lists.
Pages Tab Cleanup
src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.js
Remove a debug console.log from handleManagedEdit and adjust import formatting.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Popup as CustomizedFormPopup
  participant Redux
  participant API as Server

  User->>Popup: open customize (upgradeManaged = true)
  Popup->>Redux: dispatch getSponsorManagedForm(formId)
  Redux->>API: GET /sponsors/{sponsorId}/managed-forms/{formId}?expand=...
  API-->>Redux: 200 managed form payload
  Redux-->>Popup: RECEIVE_SPONSOR_CUSTOMIZED_FORM (normalized)
  User->>Popup: save changes
  Popup->>Redux: dispatch upgradeSponsorManagedForm(entity)
  Redux->>API: PUT /sponsors/{sponsorId}/managed-forms/{formId} (normalized payload)
  API-->>Redux: 200 updated managed form
  Redux-->>Popup: SPONSOR_MANAGED_FORMS_UPGRADED
  Popup->>User: close popup (refresh lists)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • smarcet
  • caseylocker

Poem

🐇 I hopped in code, with whiskers twitching bright,
Upgrading forms by moonlit byte,
Thunks and props in tidy rows,
A rabbit’s patch of Redux glows,
Hooray—managed forms take flight tonight! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses 'WIP' (work in progress) indicator, suggesting incomplete work, and accurately describes the main feature being added: allowing managed forms to be upgraded to customized forms.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/sponsor-form-upgrade-customize

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.js (1)

121-123: ⚠️ Potential issue | 🟡 Minor

Remove debug console.log statement.

This appears to be a leftover debug statement that should be removed before merging.

🧹 Proposed fix
   const handleManagedFormManageItems = (item) => {
-    console.log("Managed Form Item Edit : ", item);
+    // TODO: Implement managed form item navigation
   };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.js` around lines
121 - 123, Remove the leftover debug console.log by deleting the console.log
call inside the handleManagedFormManageItems function; leave the function
signature (const handleManagedFormManageItems = (item) => { ... }) and any real
logic or event handling there, or replace the console.log with proper handling
or a TODO comment if further work is required.
🧹 Nitpick comments (3)
src/actions/sponsor-forms-actions.js (2)

54-57: Unused action type constants.

REQUEST_SPONSOR_MANAGED_FORM and RECEIVE_SPONSOR_MANAGED_FORM are exported but never used. getSponsorManagedForm dispatches RECEIVE_SPONSOR_CUSTOMIZED_FORM instead of RECEIVE_SPONSOR_MANAGED_FORM, which creates naming confusion.

Either use the new action types or remove them to avoid dead code.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/actions/sponsor-forms-actions.js` around lines 54 - 57, The file defines
unused constants REQUEST_SPONSOR_MANAGED_FORM and RECEIVE_SPONSOR_MANAGED_FORM
while getSponsorManagedForm currently dispatches
RECEIVE_SPONSOR_CUSTOMIZED_FORM, causing dead code and naming confusion; either
remove REQUEST_SPONSOR_MANAGED_FORM and RECEIVE_SPONSOR_MANAGED_FORM and update
any references to use the existing RECEIVE_SPONSOR_CUSTOMIZED_FORM, or
(preferred) change getSponsorManagedForm to dispatch
REQUEST_SPONSOR_MANAGED_FORM before the async call and
RECEIVE_SPONSOR_MANAGED_FORM on success (and rename/remove
RECEIVE_SPONSOR_CUSTOMIZED_FORM if it was a mistaken name) so the exported
constants are used consistently (update any reducers listening for the action
types accordingly).

666-689: Inconsistent naming and error handler.

The function getSponsorManagedForm fetches from /show-forms/ (not /managed-forms/) and dispatches RECEIVE_SPONSOR_CUSTOMIZED_FORM. This is confusing given the function name.

Also, this uses snackbarErrorHandler while the similar getSponsorCustomizedForm uses authErrorHandler. Verify this is intentional.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/actions/sponsor-forms-actions.js` around lines 666 - 689, The function
getSponsorManagedForm is misnamed or using the wrong endpoint/action: it calls
the /show-forms/ endpoint and dispatches RECEIVE_SPONSOR_CUSTOMIZED_FORM while
its name implies managed-forms; change either the function name to
getSponsorCustomizedForm or update the URL to /managed-forms/ and the dispatched
action to the appropriate RECEIVE_SPONSOR_MANAGED_FORM to match intent. Also
align the error handler with the similar function getSponsorCustomizedForm by
replacing snackbarErrorHandler with authErrorHandler if authentication errors
should be handled the same way, or explicitly document/keep snackbarErrorHandler
if different behavior is intended; update the call sites and tests that
reference getSponsorManagedForm, the endpoint, or the action constant
accordingly.
src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form-popup.js (1)

122-126: Incomplete PropTypes definition.

Several props are used but not defined in PropTypes: upgradeManaged, formId, entity, sponsor, summitId, summitTZ, and the action props. Consider expanding PropTypes for better documentation and runtime validation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form-popup.js`
around lines 122 - 126, The PropTypes for CustomizedFormPopup are incomplete:
add definitions for the missing props used by the component (upgradeManaged,
formId, entity, sponsor, summitId, summitTZ) and for any action props (e.g.,
onSave, fetchSomething, or the actual action prop names used in the component)
by extending CustomizedFormPopup.propTypes to include these keys with
appropriate PropTypes types (bool, string, number, object, func as appropriate)
and mark required where the component assumes presence; reference the existing
CustomizedFormPopup.propTypes block and the prop names used throughout the
component to ensure every referenced prop is declared.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/actions/sponsor-forms-actions.js`:
- Around line 622-651: normalizeSponsorCustomizedForm is being called without
the summitTZ argument in upgradeSponsorManagedForm; update the call to pass the
current summit timezone (e.g., use currentSummit.time_zone) so date
normalization uses the correct TZ: replace
normalizeSponsorCustomizedForm(entity) with
normalizeSponsorCustomizedForm(entity, currentSummit.time_zone) (or
currentSummit.timeZone if that’s the project convention) inside the
upgradeSponsorManagedForm function.

In
`@src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form-popup.js`:
- Around line 75-83: The useEffect in customized-form-popup.js depends on both
formId and upgradeManaged but only lists formId; update the dependency array for
the useEffect that calls getSponsorManagedForm(formId) or
getSponsorCustomizedForm(formId) to include upgradeManaged so the effect re-runs
when upgradeManaged changes (e.g., change useEffect(..., [formId]) to
useEffect(..., [formId, upgradeManaged])); also ensure
getSponsorManagedForm/getSponsorCustomizedForm are stable or added to the
dependency array if they are not memoized.

---

Outside diff comments:
In `@src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.js`:
- Around line 121-123: Remove the leftover debug console.log by deleting the
console.log call inside the handleManagedFormManageItems function; leave the
function signature (const handleManagedFormManageItems = (item) => { ... }) and
any real logic or event handling there, or replace the console.log with proper
handling or a TODO comment if further work is required.

---

Nitpick comments:
In `@src/actions/sponsor-forms-actions.js`:
- Around line 54-57: The file defines unused constants
REQUEST_SPONSOR_MANAGED_FORM and RECEIVE_SPONSOR_MANAGED_FORM while
getSponsorManagedForm currently dispatches RECEIVE_SPONSOR_CUSTOMIZED_FORM,
causing dead code and naming confusion; either remove
REQUEST_SPONSOR_MANAGED_FORM and RECEIVE_SPONSOR_MANAGED_FORM and update any
references to use the existing RECEIVE_SPONSOR_CUSTOMIZED_FORM, or (preferred)
change getSponsorManagedForm to dispatch REQUEST_SPONSOR_MANAGED_FORM before the
async call and RECEIVE_SPONSOR_MANAGED_FORM on success (and rename/remove
RECEIVE_SPONSOR_CUSTOMIZED_FORM if it was a mistaken name) so the exported
constants are used consistently (update any reducers listening for the action
types accordingly).
- Around line 666-689: The function getSponsorManagedForm is misnamed or using
the wrong endpoint/action: it calls the /show-forms/ endpoint and dispatches
RECEIVE_SPONSOR_CUSTOMIZED_FORM while its name implies managed-forms; change
either the function name to getSponsorCustomizedForm or update the URL to
/managed-forms/ and the dispatched action to the appropriate
RECEIVE_SPONSOR_MANAGED_FORM to match intent. Also align the error handler with
the similar function getSponsorCustomizedForm by replacing snackbarErrorHandler
with authErrorHandler if authentication errors should be handled the same way,
or explicitly document/keep snackbarErrorHandler if different behavior is
intended; update the call sites and tests that reference getSponsorManagedForm,
the endpoint, or the action constant accordingly.

In
`@src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form-popup.js`:
- Around line 122-126: The PropTypes for CustomizedFormPopup are incomplete: add
definitions for the missing props used by the component (upgradeManaged, formId,
entity, sponsor, summitId, summitTZ) and for any action props (e.g., onSave,
fetchSomething, or the actual action prop names used in the component) by
extending CustomizedFormPopup.propTypes to include these keys with appropriate
PropTypes types (bool, string, number, object, func as appropriate) and mark
required where the component assumes presence; reference the existing
CustomizedFormPopup.propTypes block and the prop names used throughout the
component to ensure every referenced prop is declared.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c84efb8-758a-463c-9bda-98702d39f905

📥 Commits

Reviewing files that changed from the base of the PR and between b109482 and beabf04.

📒 Files selected for processing (4)
  • src/actions/sponsor-forms-actions.js
  • src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form-popup.js
  • src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.js
  • src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.js

Comment thread src/actions/sponsor-forms-actions.js
Comment on lines 75 to 83
useEffect(() => {
if (formId) {
getSponsorCustomizedForm(formId);
if (upgradeManaged) {
getSponsorManagedForm(formId);
} else {
getSponsorCustomizedForm(formId);
}
}
}, [formId]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Missing upgradeManaged in useEffect dependency array.

The effect uses upgradeManaged to determine which fetch function to call, but it's not included in the dependency array. If upgradeManaged changes while formId remains the same, the effect won't re-run with the correct fetch logic.

🔧 Proposed fix
   useEffect(() => {
     if (formId) {
       if (upgradeManaged) {
         getSponsorManagedForm(formId);
       } else {
         getSponsorCustomizedForm(formId);
       }
     }
-  }, [formId]);
+  }, [formId, upgradeManaged]);
📝 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.

Suggested change
useEffect(() => {
if (formId) {
getSponsorCustomizedForm(formId);
if (upgradeManaged) {
getSponsorManagedForm(formId);
} else {
getSponsorCustomizedForm(formId);
}
}
}, [formId]);
useEffect(() => {
if (formId) {
if (upgradeManaged) {
getSponsorManagedForm(formId);
} else {
getSponsorCustomizedForm(formId);
}
}
}, [formId, upgradeManaged]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form-popup.js`
around lines 75 - 83, The useEffect in customized-form-popup.js depends on both
formId and upgradeManaged but only lists formId; update the dependency array for
the useEffect that calls getSponsorManagedForm(formId) or
getSponsorCustomizedForm(formId) to include upgradeManaged so the effect re-runs
when upgradeManaged changes (e.g., change useEffect(..., [formId]) to
useEffect(..., [formId, upgradeManaged])); also ensure
getSponsorManagedForm/getSponsorCustomizedForm are stable or added to the
dependency array if they are not memoized.

Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
@tomrndom tomrndom requested a review from smarcet April 22, 2026 03:22
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/actions/sponsor-forms-actions.js`:
- Around line 684-692: The GET in getSponsorManagedForm is using
snackbarErrorHandler instead of the standard authErrorHandler; update the
getRequest call that dispatches createAction(RECEIVE_SPONSOR_CUSTOMIZED_FORM)
for the URL
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/show-forms/${formId}`
to pass authErrorHandler (matching other GETs in this file) so authentication
errors are handled consistently (e.g., 401 redirects).
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7609594b-7167-4994-ae57-3a3d1b328b68

📥 Commits

Reviewing files that changed from the base of the PR and between beabf04 and eb9c9be.

📒 Files selected for processing (1)
  • src/actions/sponsor-forms-actions.js

Comment on lines +684 to +692
return getRequest(
null,
createAction(RECEIVE_SPONSOR_CUSTOMIZED_FORM),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/show-forms/${formId}`,
snackbarErrorHandler
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent error handler for GET request.

All other GET requests in this file use authErrorHandler, but getSponsorManagedForm uses snackbarErrorHandler. This inconsistency could mask authentication errors that other GET actions would properly handle (e.g., redirect to login on 401).

🔧 Proposed fix
   return getRequest(
     null,
     createAction(RECEIVE_SPONSOR_CUSTOMIZED_FORM),
     `${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/show-forms/${formId}`,
-    snackbarErrorHandler
+    authErrorHandler
   )(params)(dispatch).then(() => {
📝 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.

Suggested change
return getRequest(
null,
createAction(RECEIVE_SPONSOR_CUSTOMIZED_FORM),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/show-forms/${formId}`,
snackbarErrorHandler
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
};
return getRequest(
null,
createAction(RECEIVE_SPONSOR_CUSTOMIZED_FORM),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/show-forms/${formId}`,
authErrorHandler
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/actions/sponsor-forms-actions.js` around lines 684 - 692, The GET in
getSponsorManagedForm is using snackbarErrorHandler instead of the standard
authErrorHandler; update the getRequest call that dispatches
createAction(RECEIVE_SPONSOR_CUSTOMIZED_FORM) for the URL
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/show-forms/${formId}`
to pass authErrorHandler (matching other GETs in this file) so authentication
errors are handled consistently (e.g., 401 redirects).

Copy link
Copy Markdown

@smarcet smarcet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@smarcet smarcet merged commit 2b83723 into master May 6, 2026
9 checks passed
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.

2 participants