@aifeatures/admin-react 0.5.5 → 0.6.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.cjs +4 -3
- package/dist/index.d.cts +419 -3
- package/dist/index.d.ts +419 -3
- package/dist/index.js +4 -3
- package/dist/styles.css +1 -1
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -390,7 +390,15 @@ interface UpdateProductInput {
|
|
|
390
390
|
/**
|
|
391
391
|
* An order's lifecycle state
|
|
392
392
|
*/
|
|
393
|
-
type OrderStatus = "pending" | "paid" | "failed" | "expired" | "refunded" | "partially_refunded" | "disputed"
|
|
393
|
+
type OrderStatus = "pending" | "paid" | "failed" | "expired" | "refunded" | "partially_refunded" | "disputed"
|
|
394
|
+
/** Invoice orders only: cancelled before it was paid. */
|
|
395
|
+
| "voided";
|
|
396
|
+
/**
|
|
397
|
+
* Where an order came from. `invoice` rows (one-off invoices and retainer
|
|
398
|
+
* cycles) are a different surface — the Invoices view — and are excluded
|
|
399
|
+
* from the Orders list unless asked for by `source`.
|
|
400
|
+
*/
|
|
401
|
+
type OrderSource = "checkout" | "subscription" | "invoice";
|
|
394
402
|
/**
|
|
395
403
|
* Delivery state of ONE side of an order's emails — the buyer receipt or the
|
|
396
404
|
* merchant sale notification. The two sides are tracked, retried and reported
|
|
@@ -585,6 +593,11 @@ interface PaginatedOrders {
|
|
|
585
593
|
*/
|
|
586
594
|
interface GetOrdersOptions {
|
|
587
595
|
status?: OrderStatus;
|
|
596
|
+
/**
|
|
597
|
+
* Restrict to one source. Omitted = checkout + subscription orders (the
|
|
598
|
+
* API's default — invoices live in the Invoices view); `all` = everything.
|
|
599
|
+
*/
|
|
600
|
+
source?: OrderSource | "all";
|
|
588
601
|
/**
|
|
589
602
|
* Statuses to omit. Used to keep abandoned checkouts
|
|
590
603
|
* (`pending` → swept to `expired`) out of the default order view — neither
|
|
@@ -628,6 +641,10 @@ interface Customer {
|
|
|
628
641
|
metadata: Record<string, unknown>;
|
|
629
642
|
created_at: string;
|
|
630
643
|
updated_at: string;
|
|
644
|
+
/** Remembered language for this customer's invoices and receipts. */
|
|
645
|
+
locale?: string | null;
|
|
646
|
+
/** Remembered bill-to identity (company, name, address, tax id, PO). */
|
|
647
|
+
bill_to?: InvoiceBillTo | null;
|
|
631
648
|
}
|
|
632
649
|
/** A saved address on a customer. */
|
|
633
650
|
interface CustomerAddress {
|
|
@@ -657,6 +674,8 @@ interface CustomersListResponse {
|
|
|
657
674
|
interface GetCustomersOptions {
|
|
658
675
|
/** Exact-match email filter (case-insensitive) */
|
|
659
676
|
email?: string;
|
|
677
|
+
/** Case-insensitive substring on email or name (ignored when `email` is set). */
|
|
678
|
+
q?: string;
|
|
660
679
|
limit?: number;
|
|
661
680
|
offset?: number;
|
|
662
681
|
}
|
|
@@ -962,6 +981,231 @@ interface EventDelivery {
|
|
|
962
981
|
interface EventDeliveriesListResponse {
|
|
963
982
|
deliveries: EventDelivery[];
|
|
964
983
|
}
|
|
984
|
+
type InvoiceLabel = "creating" | "failed" | "awaiting_payment" | "overdue" | "payment_processing" | "awaiting_authentication" | "paid" | "paid_outside_stripe" | "paid_by_credit" | "partially_refunded" | "refunded" | "disputed" | "voided" | "uncollectible";
|
|
985
|
+
type InvoiceDeliveryState = "queued" | "sending" | "sent" | "delivered" | "bounced" | "complained" | "failed" | "unknown";
|
|
986
|
+
interface InvoiceLineItem {
|
|
987
|
+
description: string;
|
|
988
|
+
quantity: number;
|
|
989
|
+
/** Line total, minor units. */
|
|
990
|
+
amount: number;
|
|
991
|
+
}
|
|
992
|
+
interface InvoiceBillTo {
|
|
993
|
+
company?: string | null;
|
|
994
|
+
name?: string | null;
|
|
995
|
+
address?: {
|
|
996
|
+
line1?: string | null;
|
|
997
|
+
line2?: string | null;
|
|
998
|
+
city?: string | null;
|
|
999
|
+
state?: string | null;
|
|
1000
|
+
postal_code?: string | null;
|
|
1001
|
+
country?: string | null;
|
|
1002
|
+
} | null;
|
|
1003
|
+
tax_id?: {
|
|
1004
|
+
type: string;
|
|
1005
|
+
value: string;
|
|
1006
|
+
} | null;
|
|
1007
|
+
po_number?: string | null;
|
|
1008
|
+
service_period?: string | null;
|
|
1009
|
+
}
|
|
1010
|
+
interface Invoice {
|
|
1011
|
+
id: string;
|
|
1012
|
+
invoice_number: string | null;
|
|
1013
|
+
status: OrderStatus;
|
|
1014
|
+
label: InvoiceLabel;
|
|
1015
|
+
days_overdue: number | null;
|
|
1016
|
+
customer_id: string | null;
|
|
1017
|
+
customer_email: string | null;
|
|
1018
|
+
customer_name: string | null;
|
|
1019
|
+
currency: string;
|
|
1020
|
+
amount_subtotal: number;
|
|
1021
|
+
tax_total: number;
|
|
1022
|
+
/** Whether tax is already inside the subtotal, or charged on top. */
|
|
1023
|
+
tax_behavior?: "inclusive" | "exclusive" | null;
|
|
1024
|
+
/** Discount already reflected in amount_total (minor currency units). */
|
|
1025
|
+
discount_total?: number;
|
|
1026
|
+
/** The charged total — subtotal less discounts, plus tax when added on top. */
|
|
1027
|
+
amount_total: number;
|
|
1028
|
+
credit_applied: number;
|
|
1029
|
+
amount_due: number | null;
|
|
1030
|
+
amount_paid: number | null;
|
|
1031
|
+
amount_paid_off_stripe: number;
|
|
1032
|
+
amount_refunded: number;
|
|
1033
|
+
line_items: InvoiceLineItem[];
|
|
1034
|
+
note: string | null;
|
|
1035
|
+
footer: string | null;
|
|
1036
|
+
bill_to: InvoiceBillTo | null;
|
|
1037
|
+
locale: string | null;
|
|
1038
|
+
due_at: string | null;
|
|
1039
|
+
created_at: string;
|
|
1040
|
+
paid_at: string | null;
|
|
1041
|
+
payment_state: string;
|
|
1042
|
+
payment_method: string | null;
|
|
1043
|
+
paid_out_of_band: boolean;
|
|
1044
|
+
paid_by_credit: boolean;
|
|
1045
|
+
marked_uncollectible_at: string | null;
|
|
1046
|
+
reminders: {
|
|
1047
|
+
schedule: number[];
|
|
1048
|
+
disabled: boolean;
|
|
1049
|
+
count: number;
|
|
1050
|
+
next_at: string | null;
|
|
1051
|
+
paused_until: string | null;
|
|
1052
|
+
final_sent_at: string | null;
|
|
1053
|
+
};
|
|
1054
|
+
delivery: {
|
|
1055
|
+
state: InvoiceDeliveryState;
|
|
1056
|
+
at: string | null;
|
|
1057
|
+
recipient: string;
|
|
1058
|
+
kind: string;
|
|
1059
|
+
} | null;
|
|
1060
|
+
pay_url: string | null;
|
|
1061
|
+
pdf_url: string | null;
|
|
1062
|
+
payment_methods: Array<"card" | "bank" | "link"> | null;
|
|
1063
|
+
replaces_order_id: string | null;
|
|
1064
|
+
replaced_by_order_id: string | null;
|
|
1065
|
+
correction_reason: string | null;
|
|
1066
|
+
retainer_id: string | null;
|
|
1067
|
+
collection_method?: "send_invoice" | "charge_automatically";
|
|
1068
|
+
operation: {
|
|
1069
|
+
step: string;
|
|
1070
|
+
last_error: string | null;
|
|
1071
|
+
attempts: number;
|
|
1072
|
+
} | null;
|
|
1073
|
+
stripe_invoice_id: string | null;
|
|
1074
|
+
/** Every refund on this invoice and the Stripe credit note that mirrors it (null id while the note is still being created). */
|
|
1075
|
+
credit_notes: InvoiceCreditNote[];
|
|
1076
|
+
/** GET /invoices/{id} only: every buyer-facing send, oldest first, with its delivery state. */
|
|
1077
|
+
communications?: InvoiceCommunication[];
|
|
1078
|
+
}
|
|
1079
|
+
interface InvoiceCreditNote {
|
|
1080
|
+
id: string;
|
|
1081
|
+
stripe_credit_note_id: string | null;
|
|
1082
|
+
stripe_refund_id: string;
|
|
1083
|
+
amount: number;
|
|
1084
|
+
currency: string;
|
|
1085
|
+
origin: "api" | "dashboard";
|
|
1086
|
+
created_at: string;
|
|
1087
|
+
}
|
|
1088
|
+
interface InvoiceCommunication {
|
|
1089
|
+
id: string;
|
|
1090
|
+
/** invoice_sent | reminder | void | receipt */
|
|
1091
|
+
kind: string;
|
|
1092
|
+
slot: number | null;
|
|
1093
|
+
recipient: string;
|
|
1094
|
+
state: InvoiceDeliveryState;
|
|
1095
|
+
state_at: string | null;
|
|
1096
|
+
error: string | null;
|
|
1097
|
+
created_at: string;
|
|
1098
|
+
}
|
|
1099
|
+
interface InvoiceAggregates {
|
|
1100
|
+
currency: string;
|
|
1101
|
+
outstanding: {
|
|
1102
|
+
amount: number;
|
|
1103
|
+
count: number;
|
|
1104
|
+
};
|
|
1105
|
+
overdue: {
|
|
1106
|
+
amount: number;
|
|
1107
|
+
count: number;
|
|
1108
|
+
};
|
|
1109
|
+
paid_this_month: {
|
|
1110
|
+
amount: number;
|
|
1111
|
+
count: number;
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
interface PaginatedInvoices {
|
|
1115
|
+
invoices: Invoice[];
|
|
1116
|
+
total: number;
|
|
1117
|
+
limit: number;
|
|
1118
|
+
offset: number;
|
|
1119
|
+
aggregates?: InvoiceAggregates;
|
|
1120
|
+
}
|
|
1121
|
+
interface GetInvoicesOptions {
|
|
1122
|
+
/** Derived labels to keep (sent comma-separated). */
|
|
1123
|
+
labels?: InvoiceLabel[];
|
|
1124
|
+
customerEmail?: string;
|
|
1125
|
+
customerId?: string;
|
|
1126
|
+
/** Case-insensitive substring on the invoice number, the recipient's name or email. */
|
|
1127
|
+
q?: string;
|
|
1128
|
+
from?: string;
|
|
1129
|
+
to?: string;
|
|
1130
|
+
includeAggregates?: boolean;
|
|
1131
|
+
/** Only the cycles of one retainer. */
|
|
1132
|
+
retainerId?: string;
|
|
1133
|
+
limit?: number;
|
|
1134
|
+
offset?: number;
|
|
1135
|
+
}
|
|
1136
|
+
interface InvoiceSettings {
|
|
1137
|
+
due_days: number;
|
|
1138
|
+
reminder_schedule: number[];
|
|
1139
|
+
footer: string | null;
|
|
1140
|
+
locale: string | null;
|
|
1141
|
+
timezone: string | null;
|
|
1142
|
+
blocked: {
|
|
1143
|
+
at: string;
|
|
1144
|
+
reason: string | null;
|
|
1145
|
+
} | null;
|
|
1146
|
+
budget: {
|
|
1147
|
+
per_hour: number;
|
|
1148
|
+
per_day: number;
|
|
1149
|
+
};
|
|
1150
|
+
payments_active: boolean;
|
|
1151
|
+
}
|
|
1152
|
+
interface InvoicePreview {
|
|
1153
|
+
subject: string;
|
|
1154
|
+
html: string;
|
|
1155
|
+
text: string;
|
|
1156
|
+
from: string;
|
|
1157
|
+
reply_to: string | null;
|
|
1158
|
+
}
|
|
1159
|
+
type RetainerStatus = "creating" | "active" | "paused" | "canceling" | "canceled" | "failed";
|
|
1160
|
+
type RetainerPauseReason = "merchant" | "plan" | "suspension";
|
|
1161
|
+
/** A recurring invoice: one Stripe subscription, one unpaid invoice order per cycle. */
|
|
1162
|
+
interface Retainer {
|
|
1163
|
+
id: string;
|
|
1164
|
+
customer_id: string | null;
|
|
1165
|
+
customer_email: string | null;
|
|
1166
|
+
customer_name: string | null;
|
|
1167
|
+
description: string;
|
|
1168
|
+
/** Per cycle, minor units. */
|
|
1169
|
+
amount: number;
|
|
1170
|
+
currency: string;
|
|
1171
|
+
interval: "month" | "year";
|
|
1172
|
+
/** Day of the month each cycle bills on; null = the creation day. */
|
|
1173
|
+
anchor_day: number | null;
|
|
1174
|
+
days_until_due: number;
|
|
1175
|
+
locale: string | null;
|
|
1176
|
+
bill_to: InvoiceBillTo | null;
|
|
1177
|
+
status: RetainerStatus;
|
|
1178
|
+
/** Every reason it is paused; it resumes only when this is empty. */
|
|
1179
|
+
paused_by: RetainerPauseReason[];
|
|
1180
|
+
skip_next_cycle: boolean;
|
|
1181
|
+
next_cycle_at: string | null;
|
|
1182
|
+
cycles: {
|
|
1183
|
+
count: number;
|
|
1184
|
+
open: number;
|
|
1185
|
+
paid: number;
|
|
1186
|
+
};
|
|
1187
|
+
stripe_subscription_id: string | null;
|
|
1188
|
+
collection_method?: "send_invoice" | "charge_automatically";
|
|
1189
|
+
created_at: string;
|
|
1190
|
+
canceled_at: string | null;
|
|
1191
|
+
operation: {
|
|
1192
|
+
step: string;
|
|
1193
|
+
last_error: string | null;
|
|
1194
|
+
attempts: number;
|
|
1195
|
+
} | null;
|
|
1196
|
+
}
|
|
1197
|
+
interface PaginatedRetainers {
|
|
1198
|
+
retainers: Retainer[];
|
|
1199
|
+
total: number;
|
|
1200
|
+
limit: number;
|
|
1201
|
+
offset: number;
|
|
1202
|
+
}
|
|
1203
|
+
interface GetRetainersOptions {
|
|
1204
|
+
statuses?: RetainerStatus[];
|
|
1205
|
+
customerEmail?: string;
|
|
1206
|
+
limit?: number;
|
|
1207
|
+
offset?: number;
|
|
1208
|
+
}
|
|
965
1209
|
|
|
966
1210
|
declare class AifeaturesApiError extends Error {
|
|
967
1211
|
status: number;
|
|
@@ -1002,6 +1246,14 @@ interface AifeaturesApiClient {
|
|
|
1002
1246
|
getOrder(orderId: string): Promise<Order>;
|
|
1003
1247
|
resendOrderReceipt(orderId: string): Promise<void>;
|
|
1004
1248
|
resetOrderDownloads(orderId: string): Promise<Order>;
|
|
1249
|
+
getInvoices(options?: GetInvoicesOptions): Promise<PaginatedInvoices>;
|
|
1250
|
+
getInvoice(invoiceId: string): Promise<Invoice>;
|
|
1251
|
+
/** The invoice email as it was (or would be) sent — from the recorded payload. */
|
|
1252
|
+
getInvoicePreview(invoiceId: string): Promise<InvoicePreview>;
|
|
1253
|
+
getInvoiceSettings(): Promise<InvoiceSettings>;
|
|
1254
|
+
/** Retainers — recurring invoices (read-only here, like invoices). */
|
|
1255
|
+
getRetainers(options?: GetRetainersOptions): Promise<PaginatedRetainers>;
|
|
1256
|
+
getRetainer(retainerId: string): Promise<Retainer>;
|
|
1005
1257
|
/**
|
|
1006
1258
|
* Mark the WHOLE order done (or un-mark it), optionally recording a
|
|
1007
1259
|
* tracking number. Merchant bookkeeping only — never moves money. The API
|
|
@@ -1196,7 +1448,7 @@ interface PaymentsDashboardProps {
|
|
|
1196
1448
|
/** Optional className */
|
|
1197
1449
|
className?: string;
|
|
1198
1450
|
/** Which tab to open initially */
|
|
1199
|
-
defaultTab?: "products" | "orders" | "customers" | "setup";
|
|
1451
|
+
defaultTab?: "products" | "orders" | "invoices" | "customers" | "setup";
|
|
1200
1452
|
/**
|
|
1201
1453
|
* Host-app callback that starts (or resumes) Stripe Connect onboarding —
|
|
1202
1454
|
* shown on the Setup tab when the site still needs Stripe.
|
|
@@ -1533,6 +1785,88 @@ interface WebhookDeliveriesProps {
|
|
|
1533
1785
|
*/
|
|
1534
1786
|
declare function WebhookDeliveries({ destinationId, limit, className, }: WebhookDeliveriesProps): react_jsx_runtime.JSX.Element;
|
|
1535
1787
|
|
|
1788
|
+
declare function InvoiceLabelBadge({ invoice, className }: {
|
|
1789
|
+
invoice: Pick<Invoice, "label" | "days_overdue" | "collection_method">;
|
|
1790
|
+
className?: string;
|
|
1791
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1792
|
+
interface InvoicesListProps {
|
|
1793
|
+
className?: string;
|
|
1794
|
+
/** Bump to refetch (view data freshness). */
|
|
1795
|
+
refreshKey?: number;
|
|
1796
|
+
/** Deep-open this invoice's detail on mount. */
|
|
1797
|
+
initialInvoiceId?: string;
|
|
1798
|
+
/** Tells the host when the detail is open (so its own back button steps aside). */
|
|
1799
|
+
onDetailOpenChange?: (open: boolean) => void;
|
|
1800
|
+
/** Host callback for the "Connect Stripe" empty state. */
|
|
1801
|
+
onConnectStripe?: () => void;
|
|
1802
|
+
/** Host callback for the "Upgrade" empty state. */
|
|
1803
|
+
onUpgradePlan?: () => void;
|
|
1804
|
+
/** The plan gate the host knows about; the view only renders the copy. */
|
|
1805
|
+
needsPaidPlan?: boolean;
|
|
1806
|
+
/** Show only one retainer's cycles (Unit 8b); the label names it in the chip. */
|
|
1807
|
+
retainerFilter?: {
|
|
1808
|
+
id: string;
|
|
1809
|
+
label: string;
|
|
1810
|
+
} | null;
|
|
1811
|
+
onClearRetainerFilter?: () => void;
|
|
1812
|
+
}
|
|
1813
|
+
declare function InvoicesList({ className, refreshKey, initialInvoiceId, onDetailOpenChange, onConnectStripe, onUpgradePlan, needsPaidPlan, retainerFilter, onClearRetainerFilter }: InvoicesListProps): react_jsx_runtime.JSX.Element;
|
|
1814
|
+
interface InvoiceDetailProps {
|
|
1815
|
+
invoice: Invoice;
|
|
1816
|
+
onBack: () => void;
|
|
1817
|
+
/** Bump to re-read the invoice (a chat mutation landed while the detail is open). */
|
|
1818
|
+
refreshKey?: number;
|
|
1819
|
+
className?: string;
|
|
1820
|
+
}
|
|
1821
|
+
declare function InvoiceDetail({ invoice: given, onBack, refreshKey, className }: InvoiceDetailProps): react_jsx_runtime.JSX.Element;
|
|
1822
|
+
|
|
1823
|
+
interface InvoicesViewProps {
|
|
1824
|
+
/** Bump to refetch everything on screen (view data freshness). */
|
|
1825
|
+
refreshKey?: number;
|
|
1826
|
+
/** Deep-open this invoice's detail on mount (`show_view` params.invoiceId). */
|
|
1827
|
+
initialInvoiceId?: string;
|
|
1828
|
+
/** Host-app callback that swaps the panel back to the website preview. */
|
|
1829
|
+
onBackToWebsite?: () => void;
|
|
1830
|
+
onConnectStripe?: InvoicesListProps["onConnectStripe"];
|
|
1831
|
+
onUpgradePlan?: InvoicesListProps["onUpgradePlan"];
|
|
1832
|
+
needsPaidPlan?: boolean;
|
|
1833
|
+
className?: string;
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* InvoicesView — the merchant view the AI swaps in for "show me my invoices"
|
|
1837
|
+
* (agent-invoicing plan, Unit 8a). Three tiles (outstanding, overdue, paid
|
|
1838
|
+
* this month — in the site currency, recorded rows only), then the read-only
|
|
1839
|
+
* list and detail. Ephemeral like OrdersView: top-level list state on every
|
|
1840
|
+
* swap, except the deep-open.
|
|
1841
|
+
*/
|
|
1842
|
+
declare function InvoicesView({ refreshKey, initialInvoiceId, onBackToWebsite, onConnectStripe, onUpgradePlan, needsPaidPlan, className }: InvoicesViewProps): react_jsx_runtime.JSX.Element;
|
|
1843
|
+
|
|
1844
|
+
declare function RetainerStatusBadge({ retainer, className }: {
|
|
1845
|
+
retainer: Pick<Retainer, "status" | "paused_by" | "skip_next_cycle">;
|
|
1846
|
+
className?: string;
|
|
1847
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1848
|
+
interface RetainersPanelProps {
|
|
1849
|
+
retainers: Retainer[];
|
|
1850
|
+
isLoading: boolean;
|
|
1851
|
+
error: Error | null;
|
|
1852
|
+
onRetry: () => void;
|
|
1853
|
+
/** Filter the invoice list below to this retainer's cycles. */
|
|
1854
|
+
onShowCycles: (retainer: Retainer) => void;
|
|
1855
|
+
/** The retainer whose cycles are on screen, if any. */
|
|
1856
|
+
activeRetainerId?: string | null;
|
|
1857
|
+
/** Rows matching the series on screen (the API's total); more than `retainers.length` means another page exists. */
|
|
1858
|
+
total?: number;
|
|
1859
|
+
/** Ended rows known to exist while the live series is empty (the hook's probe). */
|
|
1860
|
+
endedTotal?: number;
|
|
1861
|
+
isLoadingMore?: boolean;
|
|
1862
|
+
onLoadMore?: () => void;
|
|
1863
|
+
/** The series on screen: live only, or the ended ones too. Omit to hide the toggle. */
|
|
1864
|
+
includeEnded?: boolean;
|
|
1865
|
+
onIncludeEndedChange?: (includeEnded: boolean) => void;
|
|
1866
|
+
className?: string;
|
|
1867
|
+
}
|
|
1868
|
+
declare function RetainersPanel({ retainers, isLoading, error, onRetry, onShowCycles, activeRetainerId, total, endedTotal, isLoadingMore, onLoadMore, includeEnded, onIncludeEndedChange, className }: RetainersPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
1869
|
+
|
|
1536
1870
|
interface UseFormsReturn {
|
|
1537
1871
|
forms: Form[];
|
|
1538
1872
|
isLoading: boolean;
|
|
@@ -1786,6 +2120,88 @@ interface UseEventDestinationsReturn {
|
|
|
1786
2120
|
}
|
|
1787
2121
|
declare function useEventDestinations(): UseEventDestinationsReturn;
|
|
1788
2122
|
|
|
2123
|
+
/**
|
|
2124
|
+
* The Invoices view's data (agent-invoicing plan, Unit 8a). Recorded rows
|
|
2125
|
+
* only — the API never calls Stripe for a list — with the derived labels the
|
|
2126
|
+
* API computes per row and the three tiles' aggregates.
|
|
2127
|
+
*/
|
|
2128
|
+
interface UseInvoicesReturn {
|
|
2129
|
+
invoices: Invoice[];
|
|
2130
|
+
total: number;
|
|
2131
|
+
aggregates: InvoiceAggregates | null;
|
|
2132
|
+
isLoading: boolean;
|
|
2133
|
+
error: Error | null;
|
|
2134
|
+
page: number;
|
|
2135
|
+
pageSize: number;
|
|
2136
|
+
hasNextPage: boolean;
|
|
2137
|
+
hasPreviousPage: boolean;
|
|
2138
|
+
setPage: (page: number) => void;
|
|
2139
|
+
setPageSize: (size: number) => void;
|
|
2140
|
+
/** Derived labels to keep (a saved view). Undefined = every invoice. Resets to the first page. */
|
|
2141
|
+
labels: InvoiceLabel[] | undefined;
|
|
2142
|
+
setLabels: (labels: InvoiceLabel[] | undefined) => void;
|
|
2143
|
+
/** Exact-match recipient email filter. Resets to the first page. */
|
|
2144
|
+
customerEmail: string;
|
|
2145
|
+
setCustomerEmail: (email: string) => void;
|
|
2146
|
+
/** Server-side substring search (invoice number, recipient name or email). Resets to the first page. */
|
|
2147
|
+
q: string;
|
|
2148
|
+
setQ: (q: string) => void;
|
|
2149
|
+
from: string;
|
|
2150
|
+
setFrom: (from: string) => void;
|
|
2151
|
+
to: string;
|
|
2152
|
+
setTo: (to: string) => void;
|
|
2153
|
+
/** Only the cycles of one retainer (Unit 8b). Empty = every invoice. Resets to the first page. */
|
|
2154
|
+
retainerId: string;
|
|
2155
|
+
setRetainerId: (retainerId: string) => void;
|
|
2156
|
+
clearFilters: () => void;
|
|
2157
|
+
refetch: () => Promise<void>;
|
|
2158
|
+
}
|
|
2159
|
+
interface UseInvoicesOptions {
|
|
2160
|
+
initialPageSize?: number;
|
|
2161
|
+
/** Bump to refetch with the current filters (view data freshness). */
|
|
2162
|
+
refreshKey?: number;
|
|
2163
|
+
/**
|
|
2164
|
+
* Ask the API for the three tiles' aggregates on every fetch. Off by
|
|
2165
|
+
* default: the list's own requests don't need them, and the view mounts a
|
|
2166
|
+
* separate one-row hook for the tiles (so a filter change never re-sums
|
|
2167
|
+
* the whole site).
|
|
2168
|
+
*/
|
|
2169
|
+
includeAggregates?: boolean;
|
|
2170
|
+
}
|
|
2171
|
+
declare function useInvoices({ initialPageSize, refreshKey, includeAggregates }?: UseInvoicesOptions): UseInvoicesReturn;
|
|
2172
|
+
|
|
2173
|
+
/**
|
|
2174
|
+
* The Invoices view's retainer series (agent-invoicing plan, Unit 8b).
|
|
2175
|
+
* Live retainers by default (creating / active / paused / canceling), paged
|
|
2176
|
+
* from the API and accumulated; `includeEnded` widens the series to the
|
|
2177
|
+
* canceled and failed ones. When the live series is empty the hook probes
|
|
2178
|
+
* once for ended rows so the panel can still offer them.
|
|
2179
|
+
*/
|
|
2180
|
+
interface UseRetainersReturn {
|
|
2181
|
+
retainers: Retainer[];
|
|
2182
|
+
/** Rows matching the current series (live, or every status). */
|
|
2183
|
+
total: number;
|
|
2184
|
+
/** Ended (canceled / failed) rows known to exist while the live series is empty. */
|
|
2185
|
+
endedTotal: number;
|
|
2186
|
+
hasMore: boolean;
|
|
2187
|
+
isLoading: boolean;
|
|
2188
|
+
isLoadingMore: boolean;
|
|
2189
|
+
error: Error | null;
|
|
2190
|
+
includeEnded: boolean;
|
|
2191
|
+
setIncludeEnded: (includeEnded: boolean) => void;
|
|
2192
|
+
loadMore: () => Promise<void>;
|
|
2193
|
+
refetch: () => Promise<void>;
|
|
2194
|
+
}
|
|
2195
|
+
interface UseRetainersOptions {
|
|
2196
|
+
/** Bump to refetch (view data freshness). */
|
|
2197
|
+
refreshKey?: number;
|
|
2198
|
+
/** Initial series: the ended ones too. */
|
|
2199
|
+
includeEnded?: boolean;
|
|
2200
|
+
/** Page size (the API caps at 100). */
|
|
2201
|
+
limit?: number;
|
|
2202
|
+
}
|
|
2203
|
+
declare function useRetainers({ refreshKey, includeEnded: initialIncludeEnded, limit }?: UseRetainersOptions): UseRetainersReturn;
|
|
2204
|
+
|
|
1789
2205
|
declare function isZeroDecimalCurrency(currency: string): boolean;
|
|
1790
2206
|
/**
|
|
1791
2207
|
* Format a minor-unit amount for display ("$29.00", "¥1,500").
|
|
@@ -1828,4 +2244,4 @@ declare function toMinorUnits(major: string | number, currency: string): number
|
|
|
1828
2244
|
*/
|
|
1829
2245
|
declare function toMajorUnits(minor: number, currency: string): number;
|
|
1830
2246
|
|
|
1831
|
-
export { type AdjustInventoryInput, type AifeaturesApiClient, AifeaturesApiError, type AifeaturesContextValue, AifeaturesProvider, type AifeaturesProviderProps, type ApiError, type Attachment, type BusinessSummary, type CreateEventDestinationInput, type CreateFormInput, type CreateOptionInput, type CreateProductInput, type CreateVariantInput, type Customer, type CustomerAddress, CustomerDetail, type CustomerDetail$1 as CustomerDetailData, type CustomerDetailProps, CustomersList, type CustomersListProps, type CustomersListResponse, type EmailSideStatus, type EventDeliveriesListResponse, type EventDelivery, type EventDestination, type EventDestinationSecretResponse, type EventDestinationsListResponse, type Form, FormSettings, type FormSettingsProps, FormSubmissions, type FormSubmissionsProps, FormsDashboard, type FormsDashboardProps, FormsList, type FormsListProps, type FormsListResponse, type GetBusinessSummaryOptions, type GetCustomersOptions, type GetOrdersOptions, type GetPeopleOptions, type GetProductsOptions, type GetSubmissionsOptions, type GetSubscriptionsOptions, LeadsView, type LeadsViewProps, type LowStockProduct, type NeedsAttentionItem, type NeedsAttentionType, type Order, OrderDetail, type OrderDetailProps, type OrderStatus, OrderStatusBadge, OrdersList, type OrdersListProps, OrdersView, type OrdersViewProps, type PaginatedOrders, type PaginatedSubmissions, type PaginatedSubscriptions, PaymentsDashboard, type PaymentsDashboardProps, PaymentsSetup, type PaymentsSetupProps, type PaymentsStatus, type PaymentsStatusReason, type PaymentsStatusResponse, type PeopleListResponse, type Person, type PersonDetail, type PersonOrder, type PersonSource, type PersonSubmission, type Product, type ProductDetail, type ProductFulfillment, type ProductFulfillmentType, type ProductOption, ProductSettings, type ProductSettingsProps, type ProductStats, type ProductVariant, ProductsList, type ProductsListProps, type ProductsListResponse, ProductsView, type ProductsViewProps, type RefundRequest, type RevenueCurrencyTotal, type RevenuePeriod, type SetInventoryInput, type SetOrderFulfillmentInput, type SettledRevenue, type Submission, SubmissionDetail, type SubmissionDetailProps, type SubmissionMetadata, type Subscription, SubscriptionsView, type SubscriptionsViewProps, type UpdateEventDestinationInput, type UpdateFormInput, type UpdateOptionInput, type UpdateProductInput, type UpdateVariantInput, type UseBusinessSummaryOptions, type UseBusinessSummaryReturn, type UseCustomersOptions, type UseCustomersReturn, type UseEventDestinationsReturn, type UseFormsReturn, type UseOrdersOptions, type UseOrdersReturn, type UsePaymentsStatusReturn, type UsePeopleOptions, type UsePeopleReturn, type UsePersonOptions, type UsePersonReturn, type UseProductsOptions, type UseProductsReturn, type UseSubmissionsOptions, type UseSubmissionsReturn, type UseSubscriptionsOptions, type UseSubscriptionsReturn, type VariantInventory, type VariantOptionValue, VariantsEditor, type VariantsEditorProps, ViewShell, type ViewShellProps, WebhookDeliveries, type WebhookDeliveriesProps, WebhookSettings, type WebhookSettingsProps, chargedTotal, createApiClient, formatPrice, isZeroDecimalCurrency, toMajorUnits, toMinorUnits, useAifeaturesContext as useAifeatures, useAifeaturesContext, useBusinessSummary, useCustomers, useEventDestinations, useForms, useOrders, usePaymentsStatus, usePeople, usePerson, useProducts, useSubmissions, useSubscriptions };
|
|
2247
|
+
export { type AdjustInventoryInput, type AifeaturesApiClient, AifeaturesApiError, type AifeaturesContextValue, AifeaturesProvider, type AifeaturesProviderProps, type ApiError, type Attachment, type BusinessSummary, type CreateEventDestinationInput, type CreateFormInput, type CreateOptionInput, type CreateProductInput, type CreateVariantInput, type Customer, type CustomerAddress, CustomerDetail, type CustomerDetail$1 as CustomerDetailData, type CustomerDetailProps, CustomersList, type CustomersListProps, type CustomersListResponse, type EmailSideStatus, type EventDeliveriesListResponse, type EventDelivery, type EventDestination, type EventDestinationSecretResponse, type EventDestinationsListResponse, type Form, FormSettings, type FormSettingsProps, FormSubmissions, type FormSubmissionsProps, FormsDashboard, type FormsDashboardProps, FormsList, type FormsListProps, type FormsListResponse, type GetBusinessSummaryOptions, type GetCustomersOptions, type GetInvoicesOptions, type GetOrdersOptions, type GetPeopleOptions, type GetProductsOptions, type GetSubmissionsOptions, type GetSubscriptionsOptions, type Invoice, type InvoiceAggregates, type InvoiceBillTo, type InvoiceDeliveryState, InvoiceDetail, type InvoiceDetailProps, type InvoiceLabel, InvoiceLabelBadge, type InvoiceLineItem, type InvoicePreview, type InvoiceSettings, InvoicesList, type InvoicesListProps, InvoicesView, type InvoicesViewProps, LeadsView, type LeadsViewProps, type LowStockProduct, type NeedsAttentionItem, type NeedsAttentionType, type Order, OrderDetail, type OrderDetailProps, type OrderStatus, OrderStatusBadge, OrdersList, type OrdersListProps, OrdersView, type OrdersViewProps, type PaginatedInvoices, type PaginatedOrders, type PaginatedSubmissions, type PaginatedSubscriptions, PaymentsDashboard, type PaymentsDashboardProps, PaymentsSetup, type PaymentsSetupProps, type PaymentsStatus, type PaymentsStatusReason, type PaymentsStatusResponse, type PeopleListResponse, type Person, type PersonDetail, type PersonOrder, type PersonSource, type PersonSubmission, type Product, type ProductDetail, type ProductFulfillment, type ProductFulfillmentType, type ProductOption, ProductSettings, type ProductSettingsProps, type ProductStats, type ProductVariant, ProductsList, type ProductsListProps, type ProductsListResponse, ProductsView, type ProductsViewProps, type RefundRequest, RetainerStatusBadge, RetainersPanel, type RetainersPanelProps, type RevenueCurrencyTotal, type RevenuePeriod, type SetInventoryInput, type SetOrderFulfillmentInput, type SettledRevenue, type Submission, SubmissionDetail, type SubmissionDetailProps, type SubmissionMetadata, type Subscription, SubscriptionsView, type SubscriptionsViewProps, type UpdateEventDestinationInput, type UpdateFormInput, type UpdateOptionInput, type UpdateProductInput, type UpdateVariantInput, type UseBusinessSummaryOptions, type UseBusinessSummaryReturn, type UseCustomersOptions, type UseCustomersReturn, type UseEventDestinationsReturn, type UseFormsReturn, type UseInvoicesOptions, type UseInvoicesReturn, type UseOrdersOptions, type UseOrdersReturn, type UsePaymentsStatusReturn, type UsePeopleOptions, type UsePeopleReturn, type UsePersonOptions, type UsePersonReturn, type UseProductsOptions, type UseProductsReturn, type UseSubmissionsOptions, type UseSubmissionsReturn, type UseSubscriptionsOptions, type UseSubscriptionsReturn, type VariantInventory, type VariantOptionValue, VariantsEditor, type VariantsEditorProps, ViewShell, type ViewShellProps, WebhookDeliveries, type WebhookDeliveriesProps, WebhookSettings, type WebhookSettingsProps, chargedTotal, createApiClient, formatPrice, isZeroDecimalCurrency, toMajorUnits, toMinorUnits, useAifeaturesContext as useAifeatures, useAifeaturesContext, useBusinessSummary, useCustomers, useEventDestinations, useForms, useInvoices, useOrders, usePaymentsStatus, usePeople, usePerson, useProducts, useRetainers, useSubmissions, useSubscriptions };
|