Skip to content

Commit b10575a

Browse files
authored
chore(predict): Removes mandatory terms of services modal (#22454)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** - Removes the mandatory terms of service modal <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: [PRED-297](https://consensyssoftware.atlassian.net/browse/PRED-297) ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. [PRED-297]: https://consensyssoftware.atlassian.net/browse/PRED-297?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Removes the Predict ToS consent modal and agreement tracking, simplifying buy/sell flows and pruning related controller APIs, types, selectors, and tests. > > - **UI (Predict)**: > - Remove `PredictConsentSheet` component and all references from `PredictBuyPreview` and `PredictSellPreview`; orders now proceed directly. > - Keep inline disclaimer with "Learn more" link; no modal gating. > - **Controller**: > - Delete `acceptAgreement` API from `PredictController` and all usages. > - **Hooks**: > - Remove `usePredictAgreement` hook and its tests. > - **Types/Selectors**: > - Simplify `PredictAccountMeta` to `{ isOnboarded: boolean }`; drop `acceptedToS` and `AcceptAgreementParams`. > - Update selectors/tests to reflect removal of `acceptedToS`. > - **Tests**: > - Remove consent-related tests and mocks across buy/sell previews and consent sheet; adjust flows to assert direct order placement. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8c727d0. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 440bb05 commit b10575a

File tree

13 files changed

+11
-1831
lines changed

13 files changed

+11
-1831
lines changed

app/components/UI/Predict/components/PredictConsentSheet/PredictConsentSheet.test.tsx

Lines changed: 0 additions & 631 deletions
This file was deleted.

app/components/UI/Predict/components/PredictConsentSheet/PredictConsentSheet.tsx

Lines changed: 0 additions & 116 deletions
This file was deleted.

app/components/UI/Predict/components/PredictConsentSheet/index.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

app/components/UI/Predict/controllers/PredictController.test.ts

Lines changed: 0 additions & 239 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,6 @@ describe('PredictController', () => {
15681568
polymarket: {
15691569
'0x123': {
15701570
isOnboarded: true,
1571-
acceptedToS: false,
15721571
},
15731572
},
15741573
};
@@ -4632,242 +4631,4 @@ describe('PredictController', () => {
46324631
);
46334632
});
46344633
});
4635-
4636-
describe('acceptAgreement', () => {
4637-
it('accepts agreement successfully for provider and address', () => {
4638-
withController(({ controller }) => {
4639-
const providerId = 'polymarket';
4640-
const address = '0x1234567890123456789012345678901234567890';
4641-
4642-
const result = controller.acceptAgreement({
4643-
providerId,
4644-
address,
4645-
});
4646-
4647-
expect(result).toBe(true);
4648-
expect(controller.state.accountMeta[providerId][address]).toEqual({
4649-
isOnboarded: false,
4650-
acceptedToS: true,
4651-
});
4652-
});
4653-
});
4654-
4655-
it('updates state correctly when accepting agreement', () => {
4656-
withController(({ controller }) => {
4657-
const providerId = 'polymarket';
4658-
const address = '0x1234567890123456789012345678901234567890';
4659-
4660-
expect(controller.state.accountMeta).toEqual({});
4661-
4662-
controller.acceptAgreement({
4663-
providerId,
4664-
address,
4665-
});
4666-
4667-
expect(controller.state.accountMeta).toEqual({
4668-
[providerId]: {
4669-
[address]: {
4670-
isOnboarded: false,
4671-
acceptedToS: true,
4672-
},
4673-
},
4674-
});
4675-
});
4676-
});
4677-
4678-
it('preserves existing addresses when accepting agreement for different address with same provider', () => {
4679-
withController(({ controller }) => {
4680-
const providerId = 'polymarket';
4681-
const address1 = '0x1234567890123456789012345678901234567890';
4682-
const address2 = '0x9876543210987654321098765432109876543210';
4683-
4684-
controller.acceptAgreement({
4685-
providerId,
4686-
address: address1,
4687-
});
4688-
4689-
expect(controller.state.accountMeta[providerId][address1]).toEqual({
4690-
isOnboarded: false,
4691-
acceptedToS: true,
4692-
});
4693-
4694-
controller.acceptAgreement({
4695-
providerId,
4696-
address: address2,
4697-
});
4698-
4699-
// Both addresses should exist
4700-
expect(controller.state.accountMeta[providerId][address1]).toEqual({
4701-
isOnboarded: false,
4702-
acceptedToS: true,
4703-
});
4704-
expect(controller.state.accountMeta[providerId][address2]).toEqual({
4705-
isOnboarded: false,
4706-
acceptedToS: true,
4707-
});
4708-
});
4709-
});
4710-
4711-
it('accepts agreement for same address with different providers', () => {
4712-
withController(({ controller }) => {
4713-
const provider1 = 'polymarket';
4714-
const provider2 = 'other-provider';
4715-
const address = '0x1234567890123456789012345678901234567890';
4716-
4717-
// Add second provider
4718-
const mockSecondProvider = { ...mockPolymarketProvider };
4719-
controller.updateStateForTesting(() => {
4720-
const providers = (controller as any).providers;
4721-
providers.set(provider2, mockSecondProvider);
4722-
});
4723-
4724-
controller.acceptAgreement({
4725-
providerId: provider1,
4726-
address,
4727-
});
4728-
4729-
controller.acceptAgreement({
4730-
providerId: provider2,
4731-
address,
4732-
});
4733-
4734-
expect(controller.state.accountMeta[provider1][address]).toEqual({
4735-
isOnboarded: false,
4736-
acceptedToS: true,
4737-
});
4738-
expect(controller.state.accountMeta[provider2][address]).toEqual({
4739-
isOnboarded: false,
4740-
acceptedToS: true,
4741-
});
4742-
});
4743-
});
4744-
4745-
it('throws error when provider is not available', () => {
4746-
withController(({ controller }) => {
4747-
const providerId = 'nonexistent-provider';
4748-
const address = '0x1234567890123456789012345678901234567890';
4749-
4750-
expect(() =>
4751-
controller.acceptAgreement({
4752-
providerId,
4753-
address,
4754-
}),
4755-
).toThrow('Provider not available');
4756-
4757-
expect(controller.state.accountMeta[providerId]).toBeUndefined();
4758-
});
4759-
});
4760-
4761-
it('overwrites existing agreement when accepting again', () => {
4762-
withController(({ controller }) => {
4763-
const providerId = 'polymarket';
4764-
const address = '0x1234567890123456789012345678901234567890';
4765-
4766-
controller.acceptAgreement({
4767-
providerId,
4768-
address,
4769-
});
4770-
4771-
expect(controller.state.accountMeta[providerId][address]).toEqual({
4772-
isOnboarded: false,
4773-
acceptedToS: true,
4774-
});
4775-
4776-
// Accept again
4777-
const result = controller.acceptAgreement({
4778-
providerId,
4779-
address,
4780-
});
4781-
4782-
expect(result).toBe(true);
4783-
expect(controller.state.accountMeta[providerId][address]).toEqual({
4784-
isOnboarded: false,
4785-
acceptedToS: true,
4786-
});
4787-
});
4788-
});
4789-
4790-
it('returns true on successful agreement acceptance', () => {
4791-
withController(({ controller }) => {
4792-
const result = controller.acceptAgreement({
4793-
providerId: 'polymarket',
4794-
address: '0x1234567890123456789012345678901234567890',
4795-
});
4796-
4797-
expect(result).toBe(true);
4798-
});
4799-
});
4800-
4801-
it('does not affect other state properties when accepting agreement', () => {
4802-
withController(({ controller }) => {
4803-
controller.updateStateForTesting((state) => {
4804-
state.eligibility = {
4805-
polymarket: { eligible: true, country: 'PT' },
4806-
};
4807-
state.lastError = 'Previous error';
4808-
});
4809-
4810-
const originalEligibility = controller.state.eligibility;
4811-
const originalLastError = controller.state.lastError;
4812-
4813-
controller.acceptAgreement({
4814-
providerId: 'polymarket',
4815-
address: '0x1234567890123456789012345678901234567890',
4816-
});
4817-
4818-
expect(controller.state.eligibility).toEqual(originalEligibility);
4819-
expect(controller.state.lastError).toBe(originalLastError);
4820-
});
4821-
});
4822-
4823-
it('preserves first address metadata when accepting agreement for second address', () => {
4824-
withController(({ controller }) => {
4825-
const providerId = 'polymarket';
4826-
const address1 = '0x1111111111111111111111111111111111111111';
4827-
const address2 = '0x2222222222222222222222222222222222222222';
4828-
4829-
controller.acceptAgreement({
4830-
providerId,
4831-
address: address1,
4832-
});
4833-
4834-
expect(controller.state.accountMeta[providerId][address1]).toEqual({
4835-
isOnboarded: false,
4836-
acceptedToS: true,
4837-
});
4838-
expect(
4839-
controller.state.accountMeta[providerId][address2],
4840-
).toBeUndefined();
4841-
4842-
controller.acceptAgreement({
4843-
providerId,
4844-
address: address2,
4845-
});
4846-
4847-
// Both addresses should exist with their metadata
4848-
expect(controller.state.accountMeta[providerId][address1]).toEqual({
4849-
isOnboarded: false,
4850-
acceptedToS: true,
4851-
});
4852-
expect(controller.state.accountMeta[providerId][address2]).toEqual({
4853-
isOnboarded: false,
4854-
acceptedToS: true,
4855-
});
4856-
});
4857-
});
4858-
4859-
it('handles errors during agreement acceptance gracefully', () => {
4860-
withController(({ controller }) => {
4861-
const providerId = 'invalid-provider';
4862-
const address = '0x1234567890123456789012345678901234567890';
4863-
4864-
expect(() =>
4865-
controller.acceptAgreement({
4866-
providerId,
4867-
address,
4868-
}),
4869-
).toThrow();
4870-
});
4871-
});
4872-
});
48734634
});

0 commit comments

Comments
 (0)