Skip to content

full package#1

Merged
Zaiidmo merged 2 commits intomasterfrom
package-content
Jan 27, 2026
Merged

full package#1
Zaiidmo merged 2 commits intomasterfrom
package-content

Conversation

@Zaiidmo
Copy link
Contributor

@Zaiidmo Zaiidmo commented Jan 27, 2026

Summary

  • What does this PR change?

Why

  • Why is this change needed?

Checklist

  • Added/updated tests (if behavior changed)
  • npm run lint passes
  • npm run typecheck passes
  • npm test passes
  • npm run build passes
  • Added a changeset (npx changeset) if this affects consumers

Notes

  • Anything reviewers should pay attention to?

@Zaiidmo Zaiidmo requested review from a team and Copilot January 27, 2026 12:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR transforms a generic React TypeScript developer kit template into a complete authentication library package. It implements a full-featured authentication system with JWT token management, OAuth integration, role-based access control, and various UI components for authentication flows.

Changes:

  • Implemented comprehensive authentication system with JWT token handling, refresh token logic, and session management
  • Added OAuth support for Google and Microsoft authentication providers
  • Integrated role-based access control (RBAC) with permission checking hooks and components

Reviewed changes

Copilot reviewed 33 out of 38 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
package.json Updated package metadata, dependencies, and build configuration for authentication library
vite.config.ts Added Vite build configuration for library bundling
src/index.ts Changed exports to authentication-specific modules
src/providers/AuthProvider.tsx Core authentication provider with token management and route handling
src/utils/jwtHelpers.ts JWT token decoding utilities
src/utils/attachAuthInterceptor.ts Axios interceptor for automatic token refresh
src/utils/colorHelpers.ts Tailwind color class utilities for theming
src/pages/auth/SignInPage.tsx Sign-in page component with OAuth integration
src/pages/auth/SignUpPage.tsx Sign-up page component with OAuth integration
src/pages/auth/GoogleCallbackPage.tsx OAuth callback handler for Google/Microsoft
src/models/* Type definitions for authentication-related data structures
src/context/* React contexts for auth state, config, and RBAC
src/hooks/useAbility.ts Permission and role checking hooks
src/components/* Authentication UI components including profile page, modals, and form elements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,8 @@
//src/modles/ColorTheme.ts
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Corrected spelling of 'modles' to 'models' in file path comment.

Suggested change
//src/modles/ColorTheme.ts
//src/models/ColorTheme.ts

Copilot uses AI. Check for mistakes.
return color; // e.g. "bg-red-500"
}
if (color.startsWith("#")) {
return `${color}`; // e.g. "bg-[#FF9900]"
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The function returns a hex color without the Tailwind bracket notation prefix. For hex colors to work in Tailwind, they need to be wrapped in bracket notation with the prefix, e.g., bg-[#FF9900]. The current implementation returns just #FF9900 which won't be recognized by Tailwind. Change line 20 to: return ${prefix}-[${color}];

Suggested change
return `${color}`; // e.g. "bg-[#FF9900]"
return `${prefix}-[${color}]`; // e.g. "bg-[#FF9900]"

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +10
fallbackpermessions?: string[];
/** at least one of these must be present (optional) */
anyPermessions?: string[];
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Corrected spelling of 'permessions' to 'permissions' in parameter names.

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +21
fallbackpermessions = [],
anyPermessions = [],
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Corrected spelling of 'permessions' to 'permissions' in destructured parameters.

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +34
const hasAll = fallbackpermessions.length === 0 || fallbackpermessions.every(p => useCan(p));

/* 3. must have *any* */
const hasSome = anyPermessions.length === 0 || anyPermessions.some(p => useCan(p));
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Corrected spelling of 'permessions' to 'permissions' in variable usage.

Copilot uses AI. Check for mistakes.
Comment on lines +201 to +204
<Route
path="/oauth/microsoft/callback"
element={<GoogleCallbackPage />}
/>
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The Microsoft OAuth callback route is using the GoogleCallbackPage component. While the component may handle both providers, the naming is misleading. Consider renaming GoogleCallbackPage to a more generic name like OAuthCallbackPage to better reflect its purpose.

Copilot uses AI. Check for mistakes.
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
"@ciscode/ui-translate-core": "^1.0.0",
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The package name '@ciscode/ui-translate-core' is listed in peerDependencies, but in imports throughout the codebase it's referenced as '@ciscode-template-model/translate-core' (e.g., in vite.config.ts line 12). This inconsistency will cause module resolution errors. Ensure the package name matches the actual import statements.

Suggested change
"@ciscode/ui-translate-core": "^1.0.0",
"@ciscode-template-model/translate-core": "^1.0.0",

Copilot uses AI. Check for mistakes.
{/* Dismiss button */}
<button
onClick={() => setShow(false)}
aria-label={t("inlineError.dismiss")}
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The translation key should have a default value like other t() calls in the codebase. Add { defaultValue: \"Dismiss\" } as the second parameter to maintain consistency with translation patterns used elsewhere.

Suggested change
aria-label={t("inlineError.dismiss")}
aria-label={t("inlineError.dismiss", { defaultValue: "Dismiss" })}

Copilot uses AI. Check for mistakes.
const rule = table[feature]?.[action];
if (!rule) return false; // no rule = no access

if (rule.perms?.some(p => useCan(p))) return true;
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The useCan hook expects multiple permissions and checks if every permission is present, but here it's called with a single permission p. This creates inconsistent behavior - the rule's perms array suggests OR logic (any permission grants access), but useCan uses AND logic. Either call useCan(...rule.perms) if all permissions are required, or check permissions individually with a different approach.

Suggested change
if (rule.perms?.some(p => useCan(p))) return true;
const canByPerms = rule.perms ? useCan(...rule.perms) : false;
if (canByPerms) return true;

Copilot uses AI. Check for mistakes.
@Zaiidmo Zaiidmo merged commit e9f9a41 into master Jan 27, 2026
@Zaiidmo Zaiidmo deleted the package-content branch January 27, 2026 12:37
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.

3 participants