Skip to content

[LWM] feat(notifications): split prompt rules into domain packages#18739

Draft
tonykhaov wants to merge 2 commits into
developfrom
support/notifications-prompt-ddd
Draft

[LWM] feat(notifications): split prompt rules into domain packages#18739
tonykhaov wants to merge 2 commits into
developfrom
support/notifications-prompt-ddd

Conversation

@tonykhaov

Copy link
Copy Markdown
Contributor

✅ Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • ...

📝 Description

Replace this text by a clear and concise description of what this pull request is about and why it is needed. Be sure to explain the problem you're addressing and the solution you're proposing.
For libraries, you can add a code sample of how to use it.
For bug fixes, you can explain the previous behaviour and how it was fixed.
In case of visual features, please attach screenshots or video recordings to demonstrate the changes.

❓ Context

  • JIRA or GitHub link:
  • ADR link (if any):

🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

Copilot AI review requested due to automatic review settings June 18, 2026 13:49
@tonykhaov tonykhaov requested review from a team as code owners June 18, 2026 13:49
@live-github-bot live-github-bot Bot added the mobile Has changes in LLM label Jun 18, 2026
@live-github-bot live-github-bot Bot changed the title feat(notifications): split prompt rules into domain packages [LWM] feat(notifications): split prompt rules into domain packages Jun 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR modularizes the Notifications Prompt logic by extracting the eligibility/history “domain” contract into domain/entity/notification-prompt, and moving platform-specific adapters and flow/UI primitives into dedicated features/* packages, then wiring Ledger Live Mobile MVVM code to consume these new packages.

Changes:

  • Added a new domain entity package (@domain/entity-notification-prompt) containing schemas, persisted history slice/selectors, and the decision engine (with unit tests).
  • Added new feature packages for platform adapters (@features/platform-notification-prompt) and flow primitives (@features/flow-notification-prompt), both with tests.
  • Updated Ledger Live Mobile Notifications Prompt MVVM code to use the new domain + feature packages and added workspace dependencies.

Reviewed changes

Copilot reviewed 43 out of 45 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pnpm-lock.yaml Adds workspace links and dependency graph entries for the new domain/feature packages.
features/platform/notification-prompt/tsconfig.json TypeScript configuration for the new platform adapter package.
features/platform/notification-prompt/src/policy/mapFeatureFlagsToNotificationPromptPolicy.ts Maps feature-flag payloads into the normalized domain NotificationPromptPolicy.
features/platform/notification-prompt/src/policy/mapFeatureFlagsToNotificationPromptPolicy.test.ts Unit tests validating feature-flag → domain policy normalization.
features/platform/notification-prompt/src/permissions/mapFirebaseAuthorizationStatusToNotificationPermissionStatus.ts Platform adapter mapping Firebase authorization statuses into the domain permission status contract.
features/platform/notification-prompt/src/permissions/mapFirebaseAuthorizationStatusToNotificationPermissionStatus.test.ts Unit tests for Firebase status → domain permission status mapping.
features/platform/notification-prompt/src/index.ts Public exports for the platform notification-prompt adapter package.
features/platform/notification-prompt/project.json Nx project target definition for the new package.
features/platform/notification-prompt/package.json Declares the new platform adapter package and its workspace dependencies.
features/platform/notification-prompt/jest.config.js Jest configuration for the platform adapter package.
features/flow/notification-prompt/tsconfig.json TypeScript configuration for the new flow package (React JSX enabled).
features/flow/notification-prompt/src/state/slice.ts Adds the flow slice for drawer open/close and pending intent emission.
features/flow/notification-prompt/src/state/slice.test.ts Unit tests for the flow slice reducers/selectors.
features/flow/notification-prompt/src/index.ts Public exports for flow primitives (provider + slice).
features/flow/notification-prompt/src/components/NotificationsPromptProvider/index.tsx Adds a reusable context provider + hook for flow orchestration.
features/flow/notification-prompt/project.json Nx project target definition for the new flow package.
features/flow/notification-prompt/package.json Declares the new flow package and its dependencies (React + RTK).
features/flow/notification-prompt/jest.config.js Jest configuration for the flow package.
domain/entity/notification-prompt/tsconfig.json TypeScript configuration for the new domain entity package.
domain/entity/notification-prompt/src/logic/engine.ts Implements the domain decision engine (after-action + inactivity) and helper utilities.
domain/entity/notification-prompt/src/logic/engine.test.ts Unit tests covering key decision branches and helper behavior.
domain/entity/notification-prompt/src/index.ts Public exports for the domain entity package (schema, slice, engine, default reducer).
domain/entity/notification-prompt/src/data/slice.ts Adds persisted history slice + selectors for notification prompt state.
domain/entity/notification-prompt/src/data/slice.test.ts Unit tests for the history slice reducers.
domain/entity/notification-prompt/src/data/selectors.test.ts Unit tests for history selectors (including legacy fallback behavior).
domain/entity/notification-prompt/src/data/schema.ts Defines the domain schemas/types for policy, history, targets, sources, and variants.
domain/entity/notification-prompt/src/data/schema.test.ts Unit tests validating schema acceptance/rejection rules.
domain/entity/notification-prompt/src/data/schema.mock.ts Mock factories for policy/history/permission status used in tests.
domain/entity/notification-prompt/project.json Nx project target definition for the new domain package.
domain/entity/notification-prompt/package.json Declares the new domain entity package and its dependencies (RTK + Zod).
domain/entity/notification-prompt/jest.config.js Jest configuration for the domain entity package.
apps/ledger-live-mobile/src/mvvm/features/NotificationsPrompt/new/NotificationsPromptProvider.tsx Switches the mobile provider to reuse the flow package provider/context contract.
apps/ledger-live-mobile/src/mvvm/features/NotificationsPrompt/new/notificationsPromptAnalytics.ts Aligns analytics helpers with the new domain decision types while keeping mobile target typing where needed.
apps/ledger-live-mobile/src/mvvm/features/NotificationsPrompt/new/hooks/useNotificationsPromptTriggers.ts Uses the new platform adapters + domain engine, including normalized policy + permission status mapping.
apps/ledger-live-mobile/src/mvvm/features/NotificationsPrompt/new/hooks/useNotificationsPromptDrawerScheduler.ts Updates types to the new domain NotificationPromptSource.
apps/ledger-live-mobile/package.json Adds workspace dependencies on the new domain + feature notification-prompt packages.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

@tonykhaov tonykhaov marked this pull request as draft June 18, 2026 14:39
@tonykhaov tonykhaov force-pushed the support/notifications-prompt-ddd branch from 8ea9c71 to 2c8550e Compare June 18, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mobile Has changes in LLM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants