From 778214fceb0bd57ca2909136397af8acb1b23e55 Mon Sep 17 00:00:00 2001 From: shobhit-cstk Date: Thu, 7 May 2026 17:21:54 +0530 Subject: [PATCH 1/2] chore: update dependencies and enhance SSO flow - Upgraded @contentstack/marketplace-sdk to version 1.5.2. - Updated axios to version 1.16.0 and follow-redirects to version 1.16.0. - Added react-toastify for improved user notifications during SSO flow. - Implemented toast dismissal logic to enhance user experience during SSO process. --- api/package-lock.json | 12 ++++++------ api/package.json | 4 ++-- ui/package.json | 1 + ui/src/pages/Login/index.tsx | 33 +++++++++++++++++++++++++++++++-- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/api/package-lock.json b/api/package-lock.json index 98a7df42..5dea5b09 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -12,12 +12,12 @@ "@contentstack/cli": "^1.58.0", "@contentstack/cli-utilities": "^1.18.3", "@contentstack/json-rte-serializer": "^3.0.5", - "@contentstack/marketplace-sdk": "^1.5.0", + "@contentstack/marketplace-sdk": "^1.5.2", "@emnapi/core": "1.9.1", "@emnapi/runtime": "1.9.1", "@emnapi/wasi-threads": "1.2.0", "@wordpress/block-serialization-default-parser": "^5.39.0", - "axios": "^1.15.2", + "axios": "^1.16.0", "cheerio": "^1.2.0", "chokidar": "^3.6.0", "cors": "^2.8.5", @@ -5478,12 +5478,12 @@ } }, "node_modules/axios": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.15.2.tgz", - "integrity": "sha512-wLrXxPtcrPTsNlJmKjkPnNPK2Ihe0hn0wGSaTEiHRPxwjvJwT3hKmXF4dpqxmPO9SoNb2FsYXj/xEo0gHN+D5A==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.16.0.tgz", + "integrity": "sha512-6hp5CwvTPlN2A31g5dxnwAX0orzM7pmCRDLnZSX772mv8WDqICwFjowHuPs04Mc8deIld1+ejhtaMn5vp6b+1w==", "license": "MIT", "dependencies": { - "follow-redirects": "^1.15.11", + "follow-redirects": "^1.16.0", "form-data": "^4.0.5", "proxy-from-env": "^2.1.0" } diff --git a/api/package.json b/api/package.json index 5e98ea37..5beb51ae 100644 --- a/api/package.json +++ b/api/package.json @@ -33,12 +33,12 @@ "@contentstack/cli": "^1.58.0", "@contentstack/cli-utilities": "^1.18.3", "@contentstack/json-rte-serializer": "^3.0.5", - "@contentstack/marketplace-sdk": "^1.5.0", + "@contentstack/marketplace-sdk": "^1.5.2", "@emnapi/core": "1.9.1", "@emnapi/runtime": "1.9.1", "@emnapi/wasi-threads": "1.2.0", "@wordpress/block-serialization-default-parser": "^5.39.0", - "axios": "^1.15.2", + "axios": "^1.16.0", "cheerio": "^1.2.0", "chokidar": "^3.6.0", "cors": "^2.8.5", diff --git a/ui/package.json b/ui/package.json index 642ee354..e5187237 100644 --- a/ui/package.json +++ b/ui/package.json @@ -20,6 +20,7 @@ "react-redux": "^9.1.2", "react-router": "^7.0.0", "react-router-dom": "^7.0.0", + "react-toastify": "npm:@contentstack/react-toastify@6.1.5", "redux-persist": "^6.0.0", "sass": "^1.68.0", "socket.io-client": "^4.7.5", diff --git a/ui/src/pages/Login/index.tsx b/ui/src/pages/Login/index.tsx index e1b95c34..46b65c40 100644 --- a/ui/src/pages/Login/index.tsx +++ b/ui/src/pages/Login/index.tsx @@ -15,6 +15,7 @@ import { Icon } from '@contentstack/venus-components'; import { Field as FinalField, Form as FinalForm } from 'react-final-form'; +import { toast as toastify } from 'react-toastify'; // Utilities import { @@ -45,6 +46,24 @@ const SSO_SUCCESS_REDIRECT_MS = 2800; /** Must match oauth-callback-html `OAUTH_CALLBACK_POSTMESSAGE_SOURCE` in the API. */ const SSO_OAUTH_POSTMESSAGE_SOURCE = 'cs-migration-oauth-callback'; +/** + * Stable id for the SSO "select this organization" warning toast so we can + * dismiss it explicitly when the SSO flow ends (success / cancel / error / + * unmount) instead of leaving it stuck on screen. + */ +const SSO_ORG_INSTRUCTION_NOTIFICATION_ID = 'sso-org-instruction'; + +/** Safety auto-close for the SSO org instruction toast (ms). */ +const SSO_ORG_INSTRUCTION_AUTO_CLOSE_MS = 5000; + +const dismissSsoOrgInstruction = () => { + try { + toastify.dismiss(SSO_ORG_INSTRUCTION_NOTIFICATION_ID); + } catch { + /* no-op: dismissing a missing/already-closed toast must not throw */ + } +}; + const isOrgMismatchSsoMessage = (message: string) => message.includes('Organization mismatch'); @@ -64,6 +83,10 @@ const Login: FC = () => { clearTimeout(ssoPollTimerRef.current); ssoPollTimerRef.current = null; } + // The org-instruction toast is only relevant while the SSO flow is in + // progress. Whenever the flow ends (success, cancel, error, timeout) we + // funnel through cancelSsoPoll, so dismiss the toast here too. + dismissSsoOrgInstruction(); }; const fetchData = async () => { @@ -84,6 +107,9 @@ const Login: FC = () => { if (ssoSuccessRedirectTimerRef.current) { clearTimeout(ssoSuccessRedirectTimerRef.current); } + // Don't leave the SSO org-instruction toast stranded if the user + // navigates away mid-flow. + dismissSsoOrgInstruction(); }; }, []); @@ -341,15 +367,17 @@ const Login: FC = () => { } if (appConfig?.organization?.name) { + dismissSsoOrgInstruction(); Notification({ + notificationId: SSO_ORG_INSTRUCTION_NOTIFICATION_ID, notificationContent: { - text: `In Contentstack, select organization "${appConfig.organization.name}" when you install or authorize this app. Choosing a different organization will cause SSO to fail.`, + text: `In Contentstack, select organization "${appConfig?.organization?.name}" when you install or authorize this app. Choosing a different organization will cause SSO to fail.`, }, type: 'warning', notificationProps: { hideProgressBar: true, position: 'bottom-center', - autoClose: false, + autoClose: SSO_ORG_INSTRUCTION_AUTO_CLOSE_MS, }, }); } @@ -361,6 +389,7 @@ const Login: FC = () => { if (appConfig?.user?.uid) { startSSOPolling(appConfig?.user?.uid, ssoWindow); } else { + dismissSsoOrgInstruction(); failureNotification('Missing user information in SSO configuration'); setIsLoading(false); } From 5930935fc03bc5aa8c477b6ef60d44d4594c75e5 Mon Sep 17 00:00:00 2001 From: umeshmore45 Date: Thu, 7 May 2026 17:53:12 +0530 Subject: [PATCH 2/2] feat: add pull request template for improved contribution guidelines - Introduced a comprehensive PR template to standardize submissions. - Included sections for Jira ticket links, PR type, description, affected areas, testing instructions, and author checklist. - Aims to enhance clarity and consistency in the review process. --- .github/PULL_REQUEST_TEMPLATE.md | 104 +++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..e30e2843 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,104 @@ +## ๐Ÿ”— Jira Ticket + +> Replace with your ticket link โ€” required before requesting review. + +[MIGRATION-XXXX](https://contentstack.atlassian.net/browse/MIGRATION-XXXX) + +--- + +## ๐Ÿ“‹ PR Type + + + +- [ ] โœจ Feature +- [ ] ๐Ÿ› Bug Fix +- [ ] ๐Ÿ”ฅ Hotfix +- [ ] โ™ป๏ธ Refactor +- [ ] ๐Ÿงน Chore / Dependency Update +- [ ] ๐Ÿ“ Documentation + +--- + +## ๐Ÿ“ Description + + + +### What changed? + + + +- + +### Why? + + + +--- + +## ๐Ÿงฉ Affected Areas + + + +- [ ] `api` โ€” Node.js backend +- [ ] `ui` โ€” React frontend +- [ ] `upload-api` โ€” Upload API server +- [ ] `docker` / `docker-compose` +- [ ] CI / GitHub Actions workflows +- [ ] Environment variables / config +- [ ] Other: + +--- + +## ๐Ÿงช How to Test + + + +1. +2. +3. + +**Expected result:** + +--- + +## ๐Ÿ“ธ Screenshots / Recordings + + + +| Before | After | +|--------|-------| +| | | + +--- + +## ๐Ÿ”— Related PRs / Dependencies + + + +- + +--- + +## โœ… Author Checklist + +> Complete this before moving the PR out of Draft. + +- [ ] Branch follows naming convention: `feature/`, `bugfix/`, or `hotfix/` + 5โ€“30 lowercase chars +- [ ] Jira ticket linked above +- [ ] Self-reviewed the diff โ€” no debug logs, commented-out code, or TODOs left in +- [ ] `.env` / `example.env` updated if new environment variables were added +- [ ] No sensitive credentials or secrets committed +- [ ] Existing tests pass locally (`npm test`) +- [ ] New tests written (or not applicable โ€” explain why) +- [ ] `README.md` / docs updated if behaviour changed +- [ ] Talisman pre-push scan passes (no secrets flagged) + +--- + +## ๐Ÿ‘€ Reviewer Notes + + + +--- + +> **Migration v2** ยท [Docs](https://github.com/contentstack/migration-v2#readme) ยท [Issues](https://github.com/contentstack/migration-v2/issues)