diff --git a/docs/providers/amp.md b/docs/providers/amp.md index 9ce3ff56..416ce5b5 100644 --- a/docs/providers/amp.md +++ b/docs/providers/amp.md @@ -75,7 +75,7 @@ The plugin parses the display text with regex to extract: |------------|----------|-----------------------------|----------------------------------------| | Free | overview | Amp Free enabled | Dollar amount consumed as progress bar | | Bonus | detail | Amp Free + active promotion | Bonus percentage and duration | -| Credits | detail | Credits > $0 | Individual credits balance | +| Credits | overview | Credits > $0, or credits-only accounts | Individual credits balance | Progress line includes: - `resetsAt` — ISO timestamp of estimated full replenishment (null if nothing used or rate is zero) diff --git a/plugins/amp/plugin.json b/plugins/amp/plugin.json index 308a3c96..9f45f4de 100644 --- a/plugins/amp/plugin.json +++ b/plugins/amp/plugin.json @@ -9,6 +9,6 @@ "lines": [ { "type": "progress", "label": "Free", "scope": "overview", "primaryOrder": 1 }, { "type": "text", "label": "Bonus", "scope": "detail" }, - { "type": "text", "label": "Credits", "scope": "detail" } + { "type": "text", "label": "Credits", "scope": "overview" } ] } diff --git a/plugins/amp/plugin.test.js b/plugins/amp/plugin.test.js index 577b24ee..c0480fe6 100644 --- a/plugins/amp/plugin.test.js +++ b/plugins/amp/plugin.test.js @@ -305,6 +305,20 @@ describe("amp plugin", () => { expect(result.lines[0].value).toBe("$25.50") }) + it("parses credits-only text with top-up hint", async () => { + var ctx = makeCtx() + writeSecrets(ctx) + var text = "Signed in as person@example.com (exampleuser)\n" + + "Individual credits: $5 remaining (set up automatic top-up to avoid running out) - https://ampcode.com/settings" + ctx.host.http.request.mockReturnValue(balanceResponse(text)) + var plugin = await loadPlugin() + var result = plugin.probe(ctx) + expect(result.plan).toBe("Credits") + expect(result.lines.length).toBe(1) + expect(result.lines[0].label).toBe("Credits") + expect(result.lines[0].value).toBe("$5.00") + }) + it("shows both free tier and credits when both present", async () => { var ctx = makeCtx() writeSecrets(ctx)