@adonis-agora/payments 0.16.1 → 0.16.2

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.
@@ -17,7 +17,7 @@
17
17
  rel="stylesheet"
18
18
  />
19
19
  <title>payments · billing console</title>
20
- <script type="module" crossorigin src="/__PAYMENTS_DASHBOARD__/assets/index-DYQO0uZL.js"></script>
20
+ <script type="module" crossorigin src="/__PAYMENTS_DASHBOARD__/assets/index-1Gb8l6g0.js"></script>
21
21
  <link rel="stylesheet" crossorigin href="/__PAYMENTS_DASHBOARD__/assets/index-D6oPV1WS.css">
22
22
  </head>
23
23
  <body>
@@ -28,6 +28,15 @@ export interface BillingOverview {
28
28
  * de assinatura comum do Woovi, e uma linha gravada com elas é receita de verdade.
29
29
  */
30
30
  export declare function monthlyRecurringRevenue(lines: SubscriptionCycleTotal[]): number;
31
+ /**
32
+ * Compute a billing overview from the store — the data foundation a billing dashboard
33
+ * (Agora dashboard pattern) renders. Scoped to the `from`/`to` window: revenue — BOTH gross
34
+ * (`revenue`, the sum of paid payments) and net of refunds (`net_revenue`,
35
+ * `amount - refunded_amount` over the same rows) — and usage per meter. Point-in-time, and
36
+ * so unaffected by the window: `active_subscriptions`, and `mrr`, the monthly recurring
37
+ * revenue implied by the cycle totals of the subscriptions active right now.
38
+ * Pure store queries (no gateway calls), so it works headless and is trivially testable.
39
+ */
31
40
  export declare function billingOverview(store: BillingStore, options: {
32
41
  from: Date;
33
42
  to: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"billing_overview.d.ts","sourceRoot":"","sources":["../../../src/billing/billing_overview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,kDAAkD;AAClD,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,EAAE,EAAE,IAAI,CAAA;KAAE,CAAC;IACjC,OAAO,EAAE,qBAAqB,EAAE,CAAC;CAClC;AAwBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,EAAE,GAAG,MAAM,CAQ/E;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GAChC,OAAO,CAAC,eAAe,CAAC,CA8C1B"}
1
+ {"version":3,"file":"billing_overview.d.ts","sourceRoot":"","sources":["../../../src/billing/billing_overview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,kDAAkD;AAClD,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,EAAE,EAAE,IAAI,CAAA;KAAE,CAAC;IACjC,OAAO,EAAE,qBAAqB,EAAE,CAAC;CAClC;AAiBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,EAAE,GAAG,MAAM,CAQ/E;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GAChC,OAAO,CAAC,eAAe,CAAC,CA8C1B"}
@@ -1,10 +1,3 @@
1
- /**
2
- * Compute a billing overview from the store — the data foundation a billing dashboard
3
- * (Agora dashboard pattern) renders. Aggregates KPIs over a `from`/`to` window: revenue —
4
- * BOTH gross (`revenue`, the sum of paid payments) and net of refunds (`net_revenue`,
5
- * `amount - refunded_amount` over the same rows) — active subscriptions, and usage per meter.
6
- * Pure store queries (no gateway calls), so it works headless and is trivially testable.
7
- */
8
1
  /** Quantos meses cada ciclo cobre. O que não estiver aqui é ignorado, não chutado. */
9
2
  const MONTHS_PER_CYCLE = {
10
3
  WEEKLY: 7 / 30.44,
@@ -43,6 +36,15 @@ export function monthlyRecurringRevenue(lines) {
43
36
  }
44
37
  return Math.round(monthly);
45
38
  }
39
+ /**
40
+ * Compute a billing overview from the store — the data foundation a billing dashboard
41
+ * (Agora dashboard pattern) renders. Scoped to the `from`/`to` window: revenue — BOTH gross
42
+ * (`revenue`, the sum of paid payments) and net of refunds (`net_revenue`,
43
+ * `amount - refunded_amount` over the same rows) — and usage per meter. Point-in-time, and
44
+ * so unaffected by the window: `active_subscriptions`, and `mrr`, the monthly recurring
45
+ * revenue implied by the cycle totals of the subscriptions active right now.
46
+ * Pure store queries (no gateway calls), so it works headless and is trivially testable.
47
+ */
46
48
  export async function billingOverview(store, options) {
47
49
  const { from, to } = options;
48
50
  const [revenue, netRevenue, activeSubscriptions, usage, cycleTotals] = await Promise.all([
@@ -1 +1 @@
1
- {"version":3,"file":"billing_overview.js","sourceRoot":"","sources":["../../../src/billing/billing_overview.ts"],"names":[],"mappings":"AAeA;;;;;;GAMG;AACH,sFAAsF;AACtF,MAAM,gBAAgB,GAA2B;IAC/C,MAAM,EAAE,CAAC,GAAG,KAAK;IACjB,QAAQ,EAAE,EAAE,GAAG,KAAK;IACpB,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,CAAC;IACf,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ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,EAAE,OAAO,EAAE;QACnE,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,iCAAiC,EAAE,KAAK,EAAE,UAAU,EAAE;QACnF,EAAE,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,mBAAmB,EAAE;QAC1F,yFAAyF;QACzF,0FAA0F;QAC1F,uFAAuF;QACvF,2DAA2D;QAC3D;YACE,GAAG,EAAE,KAAK;YACV,KAAK,EAAE,oCAAoC;YAC3C,KAAK,EAAE,uBAAuB,CAAC,WAAW,CAAC;SAC5C;KACF,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC;YACX,GAAG,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE;YAC1B,KAAK,EAAE,WAAW,IAAI,CAAC,KAAK,EAAE;YAC9B,KAAK,EAAE,IAAI,CAAC,QAAQ;SACrB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AAC3C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/payments",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "Billing library for AdonisJS — 18 payment gateways behind one driver contract, with a Cashier-style subscription billing layer: Billable mixin, Lucid stores, idempotent webhook processing and an optional Durable-backed dispatcher. Part of the Agora ecosystem.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -133,19 +133,19 @@
133
133
  },
134
134
  "devDependencies": {
135
135
  "@adonis-agora/payments-dashboard": "0.4.0",
136
- "@adonisjs/assembler": "^8.5.1",
136
+ "@adonisjs/assembler": "8.5.1",
137
137
  "@adonisjs/core": "7.5.0",
138
- "@adonisjs/lucid": "^22.4.2",
139
- "@mdx-js/mdx": "^3.1.1",
140
- "@testcontainers/postgresql": "^12.1.0",
141
- "@types/luxon": "^3.7.5",
142
- "@types/node": "^26.4.1",
143
- "@types/pg": "^8.23.1",
144
- "@woovi/node-sdk": "^1.3.3",
145
- "luxon": "^3.7.2",
146
- "pg": "^8.23.0",
147
- "stripe": "^22.6.1",
148
- "typescript": "^7.0.2",
138
+ "@adonisjs/lucid": "22.4.2",
139
+ "@mdx-js/mdx": "3.1.1",
140
+ "@testcontainers/postgresql": "12.1.0",
141
+ "@types/luxon": "3.7.5",
142
+ "@types/node": "26.5.0",
143
+ "@types/pg": "8.23.1",
144
+ "@woovi/node-sdk": "1.3.3",
145
+ "luxon": "3.7.2",
146
+ "pg": "8.23.0",
147
+ "stripe": "22.6.2",
148
+ "typescript": "7.0.2",
149
149
  "vitest": "5.0.0"
150
150
  },
151
151
  "engines": {