Skip to content

feat: New UI Implementation (experimental)#502

Closed
Xevalous wants to merge 36 commits intoTheNetsky:v3from
Xevalous:v4-exp-stable-2
Closed

feat: New UI Implementation (experimental)#502
Xevalous wants to merge 36 commits intoTheNetsky:v3from
Xevalous:v4-exp-stable-2

Conversation

@Xevalous
Copy link
Copy Markdown

@Xevalous Xevalous commented Mar 26, 2026

DISCLAIMER

This code is produced through vibecode, incorporating manual review and testing stages. This pull request is provided as reference material and is recommended for evaluation purposes. However, the code is suitable for merging as it has been adapted and aligned with the repository codebase structure.


Overview

This pull request introduces Quest activity support for the Microsoft Rewards Script New UI implementation. The implementation focuses on DOM-based detection and task processing for Bing search activities, maintaining full backward compatibility with the existing codebase.


What's Included

Quest Activity Handler

File: src/functions/activities/browser/Quest.ts

  • Implementation: 473 lines of optimized, DOM-only code
  • Status: Production-ready with 0 TypeScript errors
  • Core Methods:
    • doQuests() - Entry point for quest discovery and processing
    • findQuestLinks() - DOM queries with regex fallback for quest card detection
    • processQuest() - Individual quest handler and task link discovery
    • clickTask() - Task execution with multi-strategy link finding

Type Definitions

File: src/interface/PanelFlyoutData.ts

  • PanelFlyoutData interface for type-safe quest panel data structure
  • Enables structured handling of Next.js JSON serialized quest metadata

Utility Functions

File: src/util/NextParser.ts

  • parseNextJSData() function for extracting quest data from Next.js serialized JSON
  • Eliminates need for API calls during quest discovery

Registry Update

File: src/functions/Activities.ts

  • Quest import and method registration
  • doQuests() method integration into activity workflow

Related Work

This implementation builds upon the activity completion patterns established in PR #496, which introduced the foundation for New UI activity handling. The Quest implementation extends this architecture to support quest-specific task discovery and completion workflows while maintaining consistency with existing activity patterns.


Limitations

Unsupported: ms-search:// Protocol URLs

The following technical constraints prevent ms-search:// URL support:

  • Custom protocol does not load in standard browsers
  • Task metadata (title, description, status) not accessible in DOM
  • Content embedded in Next.js JSON, not exposed via DOM queries
  • No reliable method for completion status detection without API calls
  • Click handlers obfuscated, non-standard HTML link patterns

Consequence

Quests with exclusively ms-search:// tasks will be skipped during execution.


Review Recommendations

  1. Verify quest discovery across different dashboard states
  2. Test task execution with various quest configurations
  3. Validate error handling in edge cases
  4. Monitor performance during high activity periods
  5. Consider future refactoring opportunities noted in technical debt

Xevalous added 30 commits March 16, 2026 21:51
- Add NextParser for parsing Next.js streaming data (self.__next_f.push)
- Add getDashboardDataFromPage() to extract data from page HTML
- Update counters parsing for V4 format (pcSearch, no mobileSearch)
- Add V4 detection and legacy fallback
- Update Daily Set and More Promotions for V4 format
- Add debug logging for API counters
- Add completeActivityV4 method to report activity completion via API
- Add hash and type fields to activity mapping
- Update activity solving to try API completion for V4
- Still getting 400 error - needs further investigation
- Visit activity destination page before calling completion API
- Added form/type/__RequestVerificationToken params to API call
- Still getting 400 error - needs further investigation
- Add PanelFlyoutData interface for panel flyout API
- Add getPanelFlyoutData() method to fetch from Bing panel flyout API
- Update UrlReward to use new V4 API endpoint (bing.com/msrewards/api/v1/reportactivity)
- Update DoubleSearchPoints and FindClippy to use mobile API with Bearer token
- Skip requestToken check for V4
- Add panelData property to bot and fetch in Main flow
…dling, and logging

- Add session validation: skip expired sessions by checking _C_Auth cookie
- Add UserAgent fallback: use default versions when API fails (prevents crash)
- Add reportActivity API call in completeActivityV4 for Daily Set URL activities
- Reduce wait times: 15-30s -> 5-8s to prevent timeout
- Add start:log npm script for file logging with timestamps

Tested successfully: +586 points earned
- Daily Check-In: 541 pts
- Read to Earn: 30 pts
- Desktop Searches: 15 pts
…letion

- Fetch /earn page data in doMorePromotions for Keep Earning activities
- Add hash, activityType, isLocked to activity mapping
- Always call completeActivityV4 for modern rewards (not just when hash exists)
- Skip locked activities (Silver/Gold membership required)
- Add debug logging for moreActivities count

Tested: +586 points earned, all Daily Set activities completed
…PI, and dashboard data

- Enhanced Workers.ts with improved V4 activity handling
- Updated UrlReward.ts with V4-specific API endpoints
- Added v4_dashboard_dump.json with current UI analysis
- Updated getuserinfo.json for V4 compatibility

This completes initial V4 UI research and optimization
for transition to v4-exp-2 branch.
…ctivities

- Fixed 'Do you know the answer?' activity detection by combining
  both flyoutResult.morePromotions and userInfo.promotions sources
- Added debug logging for userInfo promotions
- Extracted getuserinfo.htm to JSON for V4 research
…tructure

- Transform userInfo.promotions correctly (attributes field)
- Add filter for ENstar_Rewards activities (Do you know the answer?)
- Add debug logging for flyoutResult destination field
- Fix points check to include ENstar activities with default 5 points
- v4_dashboard_dump.json: updated with current points (591)
- refrensi/getuserinfo.htm: raw panel flyout data for V4 research
- Remove per-item debug logs that were too verbose
- Keep essential summary logs for debugging
- Simplified comments for better readability
- Filter activities based on offerId existence instead of hardcoded ENstar
- Remove default 5 points fallback - use actual points or 0
- Rename completeActivityV4 to completeActivity for consistency
- Lookup panelPromotion from userInfo.promotions (not morePromotions)
- Add fallback to flyoutResult.morePromotions
- Simplify duplicate complete/isCompleted logic with shared variable
…rePromotions

- Add flyoutResult.morePromotions lookup
- Use userInfo.promotions with fallback to name field
- Align with upstream V4 changes
…esult.morePromotions"

This reverts commit dc486f0.
…cking

- Add 3-tier link detection strategy: direct DOM query, fallback HTML search, regex extraction
- Implement JavaScript-based click simulation for better headless mode compatibility
- Add 2000ms post-hydration wait to allow React/Vue components to render
- Improve ms-search dialog detection and dismissal logging
- Optimize re-navigation cycle for faster processing
- Supports both headless: true and headless: false modes
- Switch to desktop viewport (1920x1080) before quest processing
- Set desktop user agent to ensure task links render properly
- This fixes headless: true mode where task links were not rendering with mobile viewport
- Improve HTML diagnostics logging for debugging
- Documented critical fix: desktop viewport/UA switch BEFORE quest processing
- Added test results showing HTML loads but task links still not rendering
- Identified root cause: viewport/UA is necessary but not sufficient
- Added next debugging steps for further investigation
Microsoft does not render quest task links (ms-search:// and bing.com/search URLs)
in headless browser environments, even with proper viewport and user-agent settings.
This appears to be a client-side rendering limitation on Microsoft's side.

Added check to gracefully skip quest processing in headless mode with warning
message instructing users to set 'headless: false' if they want quest support.
Documented full investigation of headless mode quest link rendering issue:
- Option A (Shadow DOM): Task links not in DOM, rendering limitation confirmed
- Option B (API): Feasible but overly complex for current scope
- Option C (Hidden window): Not supported by Patchright without compromises

Root cause: Microsoft conditionally disables rendering of quest task links
in headless browser environments. This appears intentional or a side effect
of client-side rendering conditions.

Solution: Graceful degradation with clear user message to switch headless: false
for quest support.
- Add doQuestsViaAPI() method to fetch quest tasks from getuserinfo API
- Add processQuestTaskViaAPI() method to handle ms-search and bing.com/search URLs
- For ms-search URLs: extract query and convert to Bing search equivalent
- For bing.com/search URLs: navigate directly
- Skip completed tasks automatically via API data
- Keep existing DOM-based approach for non-headless mode
- Enables quest support when headless: true in config
…rch support

Revert to commit 4b68b2c which contains the quest detection implementation that discovers:
- Quest cards via DOM parsing (querySelectorAll for href=/earn/quest/...)
- Task links for bing.com/search URLs (direct navigation)
- Task links for ms-search:// URLs (unknown task content, regex extraction)

This removes the headless-mode API-based approach and goes back to the robust
DOM-based detection that handles both Bing search and ms-search URL types.
- Removed all API-based quest processing methods (doQuestsViaAPI, processQuestTaskViaAPI)
- Removed diagnostic instrumentation (HTML snapshots, network logging, console capture)
- Removed headless mode detection and routing logic
- Removed fs/path imports and unused diagnostic code
- Removed ms-search:// URL handling (known limitation - cannot detect DOM content)
- Simplified to DOM-only approach for bing.com/search task discovery
- Reduced Quest.ts from 622 to 473 lines
- Added JSDoc documenting ms-search limitation
- Verified TypeScript compilation (0 errors)

This implementation focuses on stability using direct DOM queries and regex fallbacks
for finding quest cards and task links. Only bing.com/search URLs are processed.
@Xevalous Xevalous changed the title [FEAT] V4 Implementation (experimental) Feat: V4 Implementation (experimental) Mar 26, 2026
@Xevalous Xevalous changed the title Feat: V4 Implementation (experimental) feat: V4 Implementation (experimental) Mar 26, 2026
@Xevalous Xevalous changed the title feat: V4 Implementation (experimental) feat: New UI Implementation (experimental) Mar 26, 2026
@TheNetsky
Copy link
Copy Markdown
Owner

I appriciate the effort however v3 will remain compatible for the old dash. And v4 will be for the new dash. However I am not a fan of a massive AI vibecoded PR. So this will not be merged.

@TheNetsky TheNetsky closed this Mar 26, 2026
@Xevalous
Copy link
Copy Markdown
Author

fair enough, even reviewed manually it seems kinda bloated and should never been merge, but you can take it as references since it worked very well except some activity don't work.

if you guys searching for new ui wokaround, you can use this for now..

@Xevalous Xevalous deleted the v4-exp-stable-2 branch April 2, 2026 13:51
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