Skip to content

@W-20161521: fix new guest registration flow#3468

Merged
dannyphan2000 merged 2 commits intofeature/1cc_paymentsfrom
dannyphan2000.W-20161521.guest-register-fix
Nov 13, 2025
Merged

@W-20161521: fix new guest registration flow#3468
dannyphan2000 merged 2 commits intofeature/1cc_paymentsfrom
dannyphan2000.W-20161521.guest-register-fix

Conversation

@dannyphan2000
Copy link
Contributor

@dannyphan2000 dannyphan2000 commented Nov 13, 2025

Fix New Guest Registration flow for One-Click Checkout layout.

Description

This PR fixes the issue of logging in a newly registered user from the Checkout page. The root cause was the unnecessary mergeBasket call for newly registered user and basket causing intermittent failures in mismatched customer/basket. The basket's owner is updated in-place via the registration call.

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • Remove the use-basket-recovery hook as well as its implementation in User Registration component to re-create basket.
  • Remove the call to mergeBasket in User Registration component
  • Add more unit tests for one-click-user-registration for 100% coverage.
  • Fix linting + add missing translations

How to Test-Drive This PR

Follow 1CC guest-to-registered flow with OTP authentication via User Registration component

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

Signed-off-by: d.phan <d.phan@salesforce.com>
@dannyphan2000 dannyphan2000 requested a review from a team as a code owner November 13, 2025 00:37
@dannyphan2000 dannyphan2000 added the skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated label Nov 13, 2025
@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Nov 13, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Licenses 0 0 0 0 0 issues
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

}
} catch {
} catch (_e) {
// Fail silently
Copy link
Contributor Author

Choose a reason for hiding this comment

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

linting fix

await user.click(cb) // off
expect(props.onSavePreferenceChange).toHaveBeenCalledWith(false)
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just adding the remaining tests for ~100% coverage of the component

pwdlessLoginToken: otpCode,
register_customer: true
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to call mergeBasket for a completely new user - the newly registered user would not have any existing basket before the registration

Signed-off-by: d.phan <d.phan@salesforce.com>
productItems: [{productId: 'sku-1', quantity: 1}]
}
const {authorizePasswordlessLogin} = setup({basket: basketWithoutCustomerInfo})
await user.click(screen.getByRole('checkbox', {name: /Create an account/i}))

Choose a reason for hiding this comment

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

Should we instead disable the checkbox? Would the user get a false sense that they will be registered?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm that makes sense - rare case again as well but we can log a bug for that fix as needed

expect(screen.getByRole('checkbox', {name: /Create an account/i})).toBeInTheDocument()
})

test('prevents duplicate OTP sends', async () => {

Choose a reason for hiding this comment

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

Nice test!

"value": "Add a new payment method to check out faster."
}
],
"account.title.my_account": [

Choose a reason for hiding this comment

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

These translations seem unrelated to the change itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup just adding it because the build was complaining!

@dannyphan2000 dannyphan2000 merged commit 5e853ec into feature/1cc_payments Nov 13, 2025
12 of 42 checks passed
@dannyphan2000 dannyphan2000 deleted the dannyphan2000.W-20161521.guest-register-fix branch November 13, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants