@usethrottle/auth 0.8.0 → 0.9.0

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/dist/index.d.cts CHANGED
@@ -164,6 +164,18 @@ interface Invoice {
164
164
  sourceType: string | null;
165
165
  /** Frozen at issue — the lines actually billed, not the order's lines today. */
166
166
  lineItems: InvoiceLineItem[];
167
+ /**
168
+ * Set when the invoice bills less than the order: the order total its lines
169
+ * add up to. `total` is then the amount due (Net-N invoice) or the amount
170
+ * paid (a deposit receipt). Null when the invoice bills the whole order.
171
+ */
172
+ orderTotal: number | null;
173
+ /** Net-N invoices: paid on the order before this invoice (e.g. a deposit). */
174
+ amountPaid: number | null;
175
+ /** Net-N invoices: waived by a comp. */
176
+ compWaived: number | null;
177
+ /** Deposit receipts: the balance still due, billed on the Net-N invoice. */
178
+ balanceDue: number | null;
167
179
  /** Resolved on the detail read only; null on list rows and when the hop fails. */
168
180
  orderId: string | null;
169
181
  orderNumber: string | null;
package/dist/index.d.ts CHANGED
@@ -164,6 +164,18 @@ interface Invoice {
164
164
  sourceType: string | null;
165
165
  /** Frozen at issue — the lines actually billed, not the order's lines today. */
166
166
  lineItems: InvoiceLineItem[];
167
+ /**
168
+ * Set when the invoice bills less than the order: the order total its lines
169
+ * add up to. `total` is then the amount due (Net-N invoice) or the amount
170
+ * paid (a deposit receipt). Null when the invoice bills the whole order.
171
+ */
172
+ orderTotal: number | null;
173
+ /** Net-N invoices: paid on the order before this invoice (e.g. a deposit). */
174
+ amountPaid: number | null;
175
+ /** Net-N invoices: waived by a comp. */
176
+ compWaived: number | null;
177
+ /** Deposit receipts: the balance still due, billed on the Net-N invoice. */
178
+ balanceDue: number | null;
167
179
  /** Resolved on the detail read only; null on list rows and when the hop fails. */
168
180
  orderId: string | null;
169
181
  orderNumber: string | null;
@@ -1209,6 +1209,12 @@ var enUS = {
1209
1209
  viewSubscription: "View subscription",
1210
1210
  payButton: "Pay this invoice",
1211
1211
  billedTo: "Billed to",
1212
+ /** Shown when an invoice bills less than the order, matching the PDF. */
1213
+ orderTotal: "Order total",
1214
+ amountPaid: "Amount paid",
1215
+ waived: "Waived",
1216
+ amountDue: "Amount due",
1217
+ balanceDue: "Balance due",
1212
1218
  /** Display copy for `invoice.status` — the wire values are paid|open|void. */
1213
1219
  statusLabels: { paid: "Paid", open: "Open", void: "Void" },
1214
1220
  downloadUnavailable: "This invoice is not available to download right now."
@@ -4224,6 +4230,9 @@ function InvoiceDetail(props) {
4224
4230
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelState, { resource, isEmpty: (i) => i === null, emptyTitle: t.invoices.empty, skeletonRows: 4, children: (invoice) => {
4225
4231
  const money = (v) => formatMoney(v, invoice.currency, locale);
4226
4232
  const lines = invoice.lineItems ?? [];
4233
+ const partOfOrder = invoice.orderTotal != null;
4234
+ const isDepositReceipt = partOfOrder && invoice.balanceDue != null;
4235
+ const headlineLabel = !partOfOrder ? t.invoices.total : isDepositReceipt ? t.invoices.amountPaid : t.invoices.amountDue;
4227
4236
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ...a.el("invoiceDetail.layout", "throttle-detail"), children: [
4228
4237
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ...a.el("invoiceDetail.main", "throttle-detail__main"), children: [
4229
4238
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "throttle-detail__section", children: [
@@ -4257,10 +4266,14 @@ function InvoiceDetail(props) {
4257
4266
  ] }),
4258
4267
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("aside", { ...a.el("invoiceDetail.rail", "throttle-detail__rail"), children: [
4259
4268
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "throttle-detail__section", children: [
4260
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "throttle-detail__label", children: t.invoices.total }),
4269
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "throttle-detail__label", children: headlineLabel }),
4261
4270
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "throttle-detail__headline", children: money(invoice.total) })
4262
4271
  ] }),
4263
4272
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ...a.el("invoiceDetail.totals", "throttle-totals"), children: [
4273
+ partOfOrder ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Line2, { label: t.invoices.orderTotal, value: money(invoice.orderTotal) }) : null,
4274
+ partOfOrder && invoice.amountPaid ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Line2, { label: t.invoices.amountPaid, value: `-${money(invoice.amountPaid)}` }) : null,
4275
+ partOfOrder && invoice.compWaived ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Line2, { label: t.invoices.waived, value: `-${money(invoice.compWaived)}` }) : null,
4276
+ isDepositReceipt && invoice.balanceDue ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Line2, { label: t.invoices.balanceDue, value: money(invoice.balanceDue) }) : null,
4264
4277
  invoice.dueAt ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Line2, { label: t.invoices.due, value: formatDate(invoice.dueAt, locale) }) : null,
4265
4278
  invoice.periodStart && invoice.periodEnd ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4266
4279
  Line2,