refactor(chat): remove weekly limit flow

This commit is contained in:
2026-07-01 13:12:14 +08:00
parent d1ccf3631e
commit f6e7adbe96
9 changed files with 33 additions and 89 deletions
@@ -767,7 +767,7 @@ describe("chatMachine transitions", () => {
actor.stop();
});
it("clears the weekly limit prompt after payment succeeds", async () => {
it("clears the insufficient credits prompt after payment succeeds", async () => {
const actor = createActor(createTestChatMachine()).start();
actor.send({ type: "ChatUserLogin", token: "token" });
@@ -789,12 +789,12 @@ describe("chatMachine transitions", () => {
locked: true,
showContent: false,
showUpgrade: true,
reason: "weekly_limit",
hint: "Free message limit reached.",
reason: "insufficient_credits",
hint: "Insufficient credits.",
detail: {
type: "weekly_msg_limit",
usedThisWeek: 3,
limit: 3,
requiredCredits: 2,
currentCredits: 0,
shortfallCredits: 2,
},
},
canSendMessage: false,
@@ -808,7 +808,9 @@ describe("chatMachine transitions", () => {
});
expect(actor.getSnapshot().context.upgradePromptVisible).toBe(true);
expect(actor.getSnapshot().context.upgradeReason).toBe("weekly_limit");
expect(actor.getSnapshot().context.upgradeReason).toBe(
"insufficient_credits",
);
expect(actor.getSnapshot().context.canSendMessage).toBe(false);
actor.send({ type: "ChatPaymentSucceeded" });