Skip to content

fix(rewards): add support for new /earn dashboard and Explore on Bing activities (fixes #603) - #612

Open
phanex wants to merge 1 commit into
TheNetsky:v4from
phanex:fix/earn-tab-and-explore-on-bing
Open

phanex wants to merge 1 commit into
TheNetsky:v4from
phanex:fix/earn-tab-and-explore-on-bing

Conversation

@phanex

@phanex phanex commented Sep 17, 2026

Copy link
Copy Markdown

Summary of Changes

Microsoft Rewards has been transitioning cards and activities to the new /earn tab rendered via Next.js React Server Components (RSC). This PR introduces native, language-agnostic parsing for the new format and ensures "Explore on Bing" cards are properly discovered and completed.

  1. Dynamic RSC Component Parsing (ReactFunc.ts):

    • Added findTextByClass() — a recursive tree-walker that extracts title, description, and points from RSC flight chunks using Fluent UI design tokens (text-globalBody2Strong, text-fgCtrlNeutralSecondaryRest, text-statusInformativeTintFg).
    • Works 100% dynamically across all locales/languages without any hardcoded activity IDs, queries, or localized words.
    • Cleans up invisible zero-width Unicode characters (\u200B-\u200D, \uFEFF) embedded by Microsoft's server-rendered text.
    • Preserves standard 10-point default for exploreonbing cards when shared badge elements are deduplicated into external flight chunk references ($Lxx).
  2. Universal Quest Completion Regex (ReactFunc.ts):

    • Simplified the task progress regex to (\d+)\s*\/\s*(\d+), relying solely on the universal fractional slash format (1/1, 1/5) present across all localized interfaces (instead of matching English "tasks").
    • Improved region boundary detection between parent quests.
  3. Centralized Promotion Adapter (offerAdapter.ts):

    • Extracted ParsedOffer to BasePromotion conversion into a single reusable adapter with safe defaults (exclusiveLockedFeatureStatus, priority, activityType) to maintain DRY and prevent downstream type issues.
  4. RSC Fallbacks in Activity Runners:

    • In DailySet.ts and MorePromotions.ts, added fallback to reactSnapshot.offers / reactSnapshot.reportable when the legacy dashboard API returns an empty list.
    • In PromotionActivityRunner.ts, check both name and offerId for exploreonbing.
  5. Aligned Server Action Context (UrlReward.ts):

    • Updated url, referer, and routerStateTree from legacy dashboard to earn to match the bootstrap context and default BrowserFunc behavior.

Testing

  • Tested against live accounts in multiple locales (including German de-DE).
  • Verified all active "Explore on Bing" cards are detected, searched on Bing, and credited successfully.
  • Verified tomorrow/locked cards are properly skipped.
  • TypeScript build (npm run build) passes with 0 errors.

#603

… activities (fixes TheNetsky#603)

- Parse Explore on Bing activities dynamically from React Server Component (RSC) flight chunks via Fluent UI design tokens (findTextByClass), completely language-agnostic across all locales
- Strip zero-width Unicode characters (\u200B-\u200D, \uFEFF) from titles and descriptions
- Introduce offerAdapter to unify ParsedOffer to BasePromotion transformation with safe defaults
- Add fallback in DailySet and MorePromotions for RSC-only offers not returned by the legacy dashboard API
- Align UrlReward context with /earn (matching bootstrap and router state tree)
- Simplify quest completion regex to use universal slash-based task counts without language-specific keywords
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.

1 participant