Skip to content

EdgeSpend: Phaze gift card improvements and error resilience#5937

Open
Jon-edge wants to merge 6 commits intodevelopfrom
jon/fix/phaze-3
Open

EdgeSpend: Phaze gift card improvements and error resilience#5937
Jon-edge wants to merge 6 commits intodevelopfrom
jon/fix/phaze-3

Conversation

@Jon-edge
Copy link
Collaborator

@Jon-edge Jon-edge commented Feb 12, 2026

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes

Dependencies

none

Description

Context

Asana: "EdgeSpend - Various Improvements/Fixes". Addresses several Phaze gift card UX and robustness issues: identity debugging, cleaner fault tolerance, error resilience across scenes, and card status refinements.

Changes

  • Show saved Phaze identities: Adds a secondary "Show Identities" button on the gift card list scene that opens a text modal with all current (dataStore) and legacy (disklet) identity data for debugging/support.
  • Fault-tolerant cleaners: Adds asTolerantArray helper so a single malformed brand or voucher entry doesn't break the entire list. Makes deliveryAddress optional and adds 'failed' to recognized order statuses.
  • Error resilience across scenes: Exposes isError/error from useGiftCardProvider. On GiftCardListScene, stops clearing orders on API errors (keeps last-known-good data), pauses polling when offline, and auto-resumes on reconnect with informational warning banners. On GiftCardMarketScene, gates brand query on connectivity and shows a warning instead of an infinite loader. On GiftCardPurchaseScene, guards against empty delivery addresses and shows a warning when the provider fails.
  • Double-tap prevention: Adds isCreatingOrder guard in handleNextPress to prevent duplicate order creation.
  • Card status states: Distinguishes "Awaiting Payment Confirmations" (tx sent, no voucher yet) from "Pending Delivery" and "Failed" on the gift card display card.
  • QuoteID in menu: Shows the Phaze quoteId at the top of the kebab menu modal for support reference.

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Note

Medium Risk
Touches the gift card purchase and order-status UX flows and relaxes API parsing to tolerate malformed entries, which could affect how orders/brands render and how users proceed through checkout if edge cases are missed.

Overview
Improves EdgeSpend (Phaze) gift card UX and robustness by adding better order state handling, offline/error resilience, and support/debug affordances.

Gift card cards now distinguish confirming vs pending, support a new failed state (including dimming/shimmer behavior), and the menu modal shows the order quoteId for support reference. The list/market/purchase scenes now avoid clearing last-known-good data on refresh failures, pause/auto-resume network polling based on connectivity, surface warning banners on load/refresh errors, and prevent dead-ends in purchase by refetching token lists, blocking double-taps, and validating a non-empty payment address.

Phaze API parsing is hardened with a tolerant array cleaner that skips malformed brand/voucher/status items, expands recognized order statuses to include failed, and makes deliveryAddress optional (with explicit handling in the purchase flow).

Written by Cursor Bugbot for commit bc6baf7. This will update automatically on new commits. Configure here.

Add a secondary "Show Identities" button that opens a text modal
displaying all saved Phaze identities (current dataStore and legacy
disklet formats) with a copy button for debugging.
Add asTolerantArray helper that skips malformed items instead of
throwing on the entire array. Apply it to brand lists and voucher
arrays so a single bad entry doesn't break the whole UI. Also add
'failed' to recognized order statuses and make deliveryAddress
optional with an empty-string default.
Expose isError/error from useGiftCardProvider so scenes can detect
provider initialization failures. On GiftCardListScene, stop clearing
orders on API errors (keep last-known-good data visible), pause
polling when offline and auto-resume on reconnect, and show an
informational warning banner that auto-clears on success. On
GiftCardMarketScene, gate the brand query on network connectivity so
it auto-retries when online, and show a warning instead of an infinite
loader when the initial fetch fails. On GiftCardPurchaseScene, guard
against empty delivery addresses and show a warning when the provider
fails to initialize.
Add isCreatingOrder to the early-return guard in handleNextPress so a
second tap during the brief window before React disables the button
cannot trigger duplicate order creation.
Distinguish between awaiting blockchain confirmations (txid exists but
no voucher yet), pending voucher delivery, and failed/expired orders.
Failed cards are dimmed like redeemed cards.
Display the Phaze quoteId at the top of the kebab menu modal for
easier debugging and support reference.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: baaedaa456

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +186 to +187
// Keep existing cached orders visible — don't clear state on error
setLoadError(true)

Choose a reason for hiding this comment

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

P1 Badge Clear displayed orders when account refresh fails

Keeping existing state on fetch failure can expose the previous account’s cards after an account switch. clearOrderCache() only resets module-level caches, but the activeOrders / redeemedOrders React state is not reset when account.id changes, and this catch block now only sets loadError. If the first refresh for the new account fails (for example, network/API failure), the scene can continue rendering stale orders from the prior user session.

Useful? React with 👍 / 👎.

}

// Don't attempt API calls while offline
if (!isConnected) return

Choose a reason for hiding this comment

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

P1 Badge Exit initial loading state when offline on focus

This early return bypasses loadOrdersFromApi, so its finally (which clears isLoading) never runs. On first entry to the scene (or after cache reset, where loading starts true), visiting while offline leaves an indefinite spinner with no actionable state until connectivity changes, effectively blocking the gift card list offline.

Useful? React with 👍 / 👎.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

}

// Don't attempt API calls while offline
if (!isConnected) return
Copy link

Choose a reason for hiding this comment

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

Infinite loader on first offline visit to list scene

Medium Severity

When the scene is opened for the first time while offline, the early return on !isConnected prevents loadOrdersFromApi from ever being called. Since isLoading is only set to false inside that function's finally block, it remains true and the UI shows FillLoader indefinitely with no offline indication. Before this change, the API call would be attempted, fail, and the finally block would clear isLoading, letting the scene fall through to the "No Gift Cards" or error state.

Additional Locations (2)

Fix in Cursor Fix in Web

(id, i) => `Identity ${i + 1}:\n${JSON.stringify(id, null, 2)}`
)
.join('\n\n')
)
Copy link

Choose a reason for hiding this comment

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

Debug modal exposes userApiKey authentication credential in plain text

Low Severity

The handleShowIdentities function uses JSON.stringify on full identity objects (both current StoredIdentity and legacy PhazeUser), which include the userApiKey field — an authentication credential sent as the user-api-key header in Phaze API requests. Since this modal is designed for sharing with support, the credential could leak inadvertently. The userApiKey should be redacted or omitted before display.

Additional Locations (1)

Fix in Cursor Fix in Web

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