@ciromaciel/contract 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciromaciel/contract",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A single response envelope, a closed catalogue of error codes, and helpers that make answering outside it impossible.",
@@ -38,11 +38,13 @@ export async function getPlanNotice(gate, cfg, ownerId, copy = {}, current = nul
38
38
  * NO PLAN IS NOT A PROBLEM TO REPORT. Since the free floor became one
39
39
  * resource (2026-09-17), an owner with no plan is simply on the free tier,
40
40
  * and telling them "your subscription is not active" reads as a billing
41
- * failure they never had. The notice speaks only when the free tier is
42
- * actually full — and it can only know that from `current`, so without it
43
- * there is no notice: the refusal on creation already says what to do.
41
+ * failure they never had. Using what the free tier gives — even all of it —
42
+ * is not a problem either: the refusal on the next creation already offers
43
+ * the upgrade at the right moment. The notice speaks only when the owner has
44
+ * MORE than the free tier covers (a lapsed plan left resources behind), and
45
+ * it can only know that from `current` — without it there is no notice.
44
46
  */
45
- if (typeof current !== 'number' || limit === null || current < limit) {
47
+ if (typeof current !== 'number' || limit === null || current <= limit) {
46
48
  return { state: 'free', plan: ent.plan, limit, message: null }
47
49
  }
48
50
  const product = copy.product || 'este produto'
@@ -52,7 +54,7 @@ export async function getPlanNotice(gate, cfg, ownerId, copy = {}, current = nul
52
54
  state: 'none',
53
55
  plan: ent.plan,
54
56
  limit,
55
- message: `O plano gratuito do ${product} chegou ao limite. ${keeps} — ${frozen}. Assine para criar mais.`,
57
+ message: `O plano gratuito do ${product} inclui ${limit} e você tem ${current}. ${keeps} — ${frozen}. Assine para voltar a criar.`,
56
58
  }
57
59
  }
58
60