Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/providers/amp.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion plugins/amp/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
]
}
14 changes: 14 additions & 0 deletions plugins/amp/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down