Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Show subscription status #2162

Merged
merged 2 commits into from
Jan 7, 2025
Merged

Conversation

kgilpin
Copy link
Contributor

@kgilpin kgilpin commented Dec 17, 2024

Adds subscription status tracking and display functionality to the chat interface. The key components are:

  • A new SubscriptionStatus Vue component that displays:
    • Subscription status (subscribed/not subscribed)
    • Weekly chat usage and limits for free tier
    • Link to subscription documentation
  • Registration flow to create conversation threads with subscription data
  • Integration with the existing chat interface

Design

sequenceDiagram
    participant ChatSearchVue as ChatSearch.vue
    participant AppMapRPC as AppMapRPC
    participant RpcClient as RpcClient
    participant SubscriptionStatus as VSubscriptionStatus

    ChatSearchVue->>RpcClient: register()
    activate RpcClient
    RpcClient->>AppMapRPC: v1.navie.register
    activate AppMapRPC
    AppMapRPC->>RpcClient: returns registrationData
    deactivate AppMapRPC
    RpcClient->>ChatSearchVue: registrationData
    deactivate RpcClient

    ChatSearchVue->>ChatSearchVue: Check subscription from registrationData
    alt subscription is undefined
        ChatSearchVue->>SubscriptionStatus: Display "Loading"
    else subscription is defined
        alt enrolled is false
            alt usage7days is defined
                ChatSearchVue->>SubscriptionStatus: Display "The free plan includes {{ limit7days }} chats per week. You've used {{ usage7days }}."
            else usage7days is undefined
                ChatSearchVue->>SubscriptionStatus: Display "You're not subscribed."
            end
            ChatSearchVue->>SubscriptionStatus: Display "Subscribe now »"
        else enrolled is true
            ChatSearchVue->>SubscriptionStatus: Display "You're subscribed"
        end
    end
Loading
  1. Loading State:

    • Condition: subscription prop is undefined.
    • Display: The component shows "Loading subscription status...".
  2. Not Subscribed State:

    • Condition: subscription is defined, but enrolled is false.
    • Display:
      • If usage7days is defined, it shows the message:
        • "The free plan includes {{ limit7days }} chats per week."
        • "You've used {{ usage7days }}."
      • If usage7days is not defined, it shows "You're not subscribed."
      • Includes a link: "Subscribe now »"
  3. Subscribed State:

    • Condition: subscription is defined and enrolled is true.
    • Display: The component shows "You're subscribed."

TODO (recommended)

  • Add error handling for failed registrations
  • Add loading state spinner/indicator

@kgilpin kgilpin changed the base branch from main to feat/require-subscription December 30, 2024 14:58
@kgilpin kgilpin force-pushed the feat/show-subscription-status branch 2 times, most recently from b8444e5 to 07953da Compare December 30, 2024 15:17
@kgilpin kgilpin changed the base branch from feat/require-subscription to main December 30, 2024 15:21
@kgilpin kgilpin requested a review from dustinbyrne December 30, 2024 15:41
@kgilpin kgilpin added the enhancement New feature or request label Dec 30, 2024
@dustinbyrne dustinbyrne force-pushed the feat/show-subscription-status branch from a8a7d16 to a37a212 Compare December 31, 2024 18:09
* Register conversation thread on chat startup
* Display conversation usage vs allowed limits
* Indicate when a user is subscribed
@dustinbyrne dustinbyrne force-pushed the feat/show-subscription-status branch from 9e7b0d5 to 246fe8d Compare January 3, 2025 19:19
@dustinbyrne dustinbyrne marked this pull request as ready for review January 6, 2025 20:10
@dustinbyrne dustinbyrne merged commit 8eb9c0a into main Jan 7, 2025
23 checks passed
@dustinbyrne dustinbyrne deleted the feat/show-subscription-status branch January 7, 2025 15:46
@appland-release
Copy link
Contributor

🎉 This PR is included in version @appland/components-v4.43.0 🎉

The release is available on:

  • @appland/components-v4.43.0
  • GitHub release
  • @appland/components-v4.43.0

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants