fix: improve onboarding address parsing and error handling#165
Closed
Benbenzhouz wants to merge 12 commits intomainfrom
Closed
fix: improve onboarding address parsing and error handling#165Benbenzhouz wants to merge 12 commits intomainfrom
Benbenzhouz wants to merge 12 commits intomainfrom
Conversation
…ogle OAuth error handling
4 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the onboarding module with improved address parsing, better error handling for Google OAuth, and development mode support for third-party services (Stripe/Twilio). The changes allow developers to run the application without full credentials while providing more robust parsing for Australian addresses.
- Enhanced address parsing with multiple regex patterns and manual fallback logic for various Australian address formats
- Added development mode mock implementations for Stripe and Twilio to allow application startup without credentials
- Improved Google OAuth error handling with validation checks and user-friendly error redirects
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/modules/stripe/stripe.service.ts | Adds constructor with development mode support, allowing dummy Stripe key when credentials are missing |
| src/modules/onboarding/onboarding.service.ts | Extends address parsing with multiple regex patterns and manual parsing fallback; adds handling for empty field demo/skip steps |
| src/modules/auth/strategies/google.strategy.ts | Adds development mode credential handling and profile data validation for Google OAuth |
| src/modules/auth/auth.controller.ts | Enhances OAuth callback with authentication checks and default value fallbacks |
| src/lib/twilio/twilio.module.ts | Implements mock Twilio client for development mode when credentials are unavailable |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix unsafe return type in twilio.module.ts - Remove unnecessary condition checks in auth.controller.ts - Fix type definitions in google.strategy.ts - Add eslint-disable comments for console statements - Fix type assertions in auth.controller.ts
- Use 'as unknown as Twilio.Twilio' for mock client type assertion - Add eslint-disable comment for unsafe return type - Fixes TS2740 error for missing properties in mock object
- Add return types to mock Twilio client functions - Replace || with ?? operators in auth.controller.ts - Fix unnecessary optional chain in google.strategy.ts - Add eslint-disable for console.warn in google.strategy.ts - Use non-null assertion for validated profile fields
- Fix unnecessary optional chain error - Add non-null assertion since emails[0] is validated in the check above
- Replace profile?.emails?.[0] with explicit checks - profile parameter is not optional, so optional chain is unnecessary - Fixes @typescript-eslint/no-unnecessary-condition error
…eter - profile is a required parameter, so !profile check is unnecessary - Use profile.emails.length === 0 instead of !profile.emails[0] - Destructure name and emails directly from profile after validation - Fixes @typescript-eslint/no-unnecessary-condition error
- Add apiVersion to Stripe initialization for consistency - Fix street address parsing for 3-part and 4-part address formats - Add explicit demo step ID check (step 6) for skip action - Improve address parsing error message to show missing fields
- Create unified app-config.ts utility for frontend URL and CORS origin - Support multiple environment variable names for flexibility: - APP_URL, FRONTEND_URL, NEXT_PUBLIC_APP_URL (for frontend URL) - CORS_ORIGIN, FRONTEND_URL, APP_URL (for CORS origin) - Update all files to use centralized config functions - Improve compatibility with different environment variable naming conventions Files updated: - src/utils/app-config.ts (new) - src/main.ts - src/modules/auth/auth.controller.ts - src/modules/stripe/stripe.service.ts - src/modules/google-calendar/calendar-oauth.controller.ts
- Use only APP_URL for frontend URL (remove FRONTEND_URL, NEXT_PUBLIC_APP_URL) - Use only CORS_ORIGIN for CORS (remove FRONTEND_URL, APP_URL fallbacks) - Simplify code by using single environment variable names
- Add import statement for getAppUrl from @/utils/app-config - Fixes TypeScript error: Cannot find name 'getAppUrl'
Contributor
Author
|
Closing to recreate after environment variable updates |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Onboarding Module Fixes
问题
解决方案
改动文件
测试
关联 PR