mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
<!--
Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md
-->
<!-- RECURSEML_SUMMARY:START -->
## High-level PR Summary
This PR fixes a bug where ungrouped offers with `include-by-default`
pricing were not being automatically included in subscription lists. The
fix ensures that ungrouped default offers are now properly added to the
subscriptions array when no explicit database subscription exists for
them, matching the existing behavior for grouped offers. Additionally,
it adds validation to prevent multiple `include-by-default` offers from
being configured within the same group.
⏱️ Estimated Review Time: 15-30 minutes
<details>
<summary>💡 Review Order Suggestion</summary>
| Order | File Path |
|-------|-----------|
| 1 | `apps/backend/src/lib/payments.tsx` |
| 2 | `apps/backend/src/lib/payments.test.tsx` |
</details>
[](https://discord.gg/n3SsVDAW6U)
<!-- RECURSEML_SUMMARY:END -->
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> Fixes bug to include ungrouped `include-by-default` offers in
subscriptions and adds validation for multiple offers in the same group.
>
> - **Behavior**:
> - Fixes bug in `getSubscriptions()` in `payments.tsx` to include
ungrouped `include-by-default` offers in subscriptions when no explicit
subscription exists.
> - Adds validation in `getSubscriptions()` to prevent multiple
`include-by-default` offers in the same group.
> - **Tests**:
> - Adds test cases in `payments.test.tsx` to verify inclusion of
ungrouped `include-by-default` offers and validation of multiple offers
in the same group.
> - **Misc**:
> - Updates import in `payments.test.tsx` to include `getSubscriptions`.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup>
for
|
||
|---|---|---|
| .. | ||
| backend | ||
| dashboard | ||
| dev-launchpad | ||
| e2e | ||
| mock-oauth-server | ||
| oauth-mock-server | ||