@aifeatures/admin-react 0.19.0 → 0.21.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 -4
- package/dist/index.d.cts +297 -6
- package/dist/index.d.ts +297 -6
- package/dist/index.js +4 -4
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ interface Form {
|
|
|
18
18
|
name: string;
|
|
19
19
|
endpoint_url: string;
|
|
20
20
|
email_recipients: string[];
|
|
21
|
+
/** When false, submissions do not email `email_recipients` (they stay saved). */
|
|
22
|
+
email_notifications: boolean;
|
|
21
23
|
redirect_url: string | null;
|
|
22
24
|
turnstile_sitekey: string | null;
|
|
23
25
|
created_at: string;
|
|
@@ -78,6 +80,7 @@ interface FormsListResponse {
|
|
|
78
80
|
interface CreateFormInput {
|
|
79
81
|
name: string;
|
|
80
82
|
email_recipients?: string[];
|
|
83
|
+
email_notifications?: boolean;
|
|
81
84
|
redirect_url?: string;
|
|
82
85
|
}
|
|
83
86
|
/**
|
|
@@ -86,6 +89,7 @@ interface CreateFormInput {
|
|
|
86
89
|
interface UpdateFormInput {
|
|
87
90
|
name?: string;
|
|
88
91
|
email_recipients?: string[];
|
|
92
|
+
email_notifications?: boolean;
|
|
89
93
|
redirect_url?: string | null;
|
|
90
94
|
}
|
|
91
95
|
/**
|
|
@@ -160,7 +164,7 @@ interface ApiError {
|
|
|
160
164
|
* `funnel_window_precedes_coverage` among them. They belong here, but adding
|
|
161
165
|
* them is a change to the goals and funnels surfaces rather than this one.
|
|
162
166
|
*/
|
|
163
|
-
code?: 'filter_unsupported' | 'filters_unsupported' | 'range_invalid' | 'dimension_unsupported' | 'goals_exceed_report_budget' | 'goal_not_found' | 'goal_has_no_targets' | 'invalid_limit';
|
|
167
|
+
code?: 'filter_unsupported' | 'filters_unsupported' | 'range_invalid' | 'dimension_unsupported' | 'goals_exceed_report_budget' | 'goal_not_found' | 'goal_has_no_targets' | 'invalid_limit' | 'currency_changed';
|
|
164
168
|
}
|
|
165
169
|
/**
|
|
166
170
|
* A site's payment readiness (sites.paymentsStatus)
|
|
@@ -939,6 +943,11 @@ interface GetPeopleOptions {
|
|
|
939
943
|
since?: string;
|
|
940
944
|
/** Free-text filter (email/name). */
|
|
941
945
|
q?: string;
|
|
946
|
+
/**
|
|
947
|
+
* Only people with this source — what the Leads view's Customers / Leads
|
|
948
|
+
* tabs show. Applied server-side before paging.
|
|
949
|
+
*/
|
|
950
|
+
source?: 'customer' | 'lead';
|
|
942
951
|
limit?: number;
|
|
943
952
|
offset?: number;
|
|
944
953
|
}
|
|
@@ -1695,6 +1704,92 @@ interface PromosListResponse {
|
|
|
1695
1704
|
next_cursor: string | null;
|
|
1696
1705
|
checkout_enabled: boolean;
|
|
1697
1706
|
}
|
|
1707
|
+
interface ShippingRate {
|
|
1708
|
+
label: string;
|
|
1709
|
+
/** Minor units of the site's currency. */
|
|
1710
|
+
amount: number;
|
|
1711
|
+
}
|
|
1712
|
+
/** The site read: every store-wide setting the Store section shows. */
|
|
1713
|
+
interface SiteSettings {
|
|
1714
|
+
id: string;
|
|
1715
|
+
name: string;
|
|
1716
|
+
external_id: string | null;
|
|
1717
|
+
/** Order notification recipients (also the default for forms without their own). */
|
|
1718
|
+
default_email_recipients: string[];
|
|
1719
|
+
/** Null = ships anywhere Stripe serves. */
|
|
1720
|
+
shipping_countries: string[] | null;
|
|
1721
|
+
/** Null = no shipping charge. */
|
|
1722
|
+
shipping_rates: ShippingRate[] | null;
|
|
1723
|
+
free_shipping_over: number | null;
|
|
1724
|
+
tax_behavior: 'inclusive' | 'exclusive' | null;
|
|
1725
|
+
tax_rate_bps: number | null;
|
|
1726
|
+
tax_id: string | null;
|
|
1727
|
+
tax_label: string | null;
|
|
1728
|
+
stripe_tax_enabled: boolean;
|
|
1729
|
+
collect_phone_at_checkout: boolean;
|
|
1730
|
+
/** Payments active, a Stripe account set, and checkout not paused. */
|
|
1731
|
+
payments_active: boolean;
|
|
1732
|
+
/** Owner-only: read here, written through the host's callback. */
|
|
1733
|
+
invoice_due_days: number;
|
|
1734
|
+
/** Owner-only. [] = reminders off. */
|
|
1735
|
+
invoice_reminder_schedule: number[];
|
|
1736
|
+
/** Owner-only. */
|
|
1737
|
+
invoice_footer: string | null;
|
|
1738
|
+
currency: string;
|
|
1739
|
+
deleted_at: string | null;
|
|
1740
|
+
purged_at: string | null;
|
|
1741
|
+
created_at: string;
|
|
1742
|
+
updated_at: string;
|
|
1743
|
+
}
|
|
1744
|
+
/** What the site token may write through PATCH /sites/:id. */
|
|
1745
|
+
interface UpdateSiteSettingsInput {
|
|
1746
|
+
default_email_recipients?: string[];
|
|
1747
|
+
shipping_countries?: string[] | null;
|
|
1748
|
+
shipping_rates?: ShippingRate[] | null;
|
|
1749
|
+
free_shipping_over?: number | null;
|
|
1750
|
+
tax_behavior?: 'inclusive' | 'exclusive' | null;
|
|
1751
|
+
tax_rate_bps?: number | null;
|
|
1752
|
+
tax_id?: string | null;
|
|
1753
|
+
tax_label?: string | null;
|
|
1754
|
+
stripe_tax_enabled?: boolean;
|
|
1755
|
+
collect_phone_at_checkout?: boolean;
|
|
1756
|
+
/** Restates every stored amount in the new currency (no FX conversion). */
|
|
1757
|
+
currency?: string;
|
|
1758
|
+
/**
|
|
1759
|
+
* Precondition for amount writes: the currency they were entered in. If
|
|
1760
|
+
* the store's currency is no longer this, the API refuses the whole
|
|
1761
|
+
* request (409 `currency_changed`) and writes nothing.
|
|
1762
|
+
*/
|
|
1763
|
+
expected_currency?: string;
|
|
1764
|
+
}
|
|
1765
|
+
interface CurrencyRestatement {
|
|
1766
|
+
applied: boolean;
|
|
1767
|
+
from: string;
|
|
1768
|
+
to: string;
|
|
1769
|
+
reason?: string;
|
|
1770
|
+
reasons?: string[];
|
|
1771
|
+
blockedBy?: 'orders' | 'amounts' | 'concurrent';
|
|
1772
|
+
retryable?: boolean;
|
|
1773
|
+
pinned?: boolean;
|
|
1774
|
+
}
|
|
1775
|
+
interface UpdateSiteSettingsResult extends SiteSettings {
|
|
1776
|
+
/** Present when the request carried `currency`. */
|
|
1777
|
+
currency_restatement?: CurrencyRestatement;
|
|
1778
|
+
}
|
|
1779
|
+
/**
|
|
1780
|
+
* Owner-only invoice defaults, saved by the HOST (an owner-checked mutation),
|
|
1781
|
+
* never with the site token. Only changed fields are sent.
|
|
1782
|
+
*/
|
|
1783
|
+
interface StoreInvoiceSettingsInput {
|
|
1784
|
+
due_days?: number;
|
|
1785
|
+
/** [] turns reminders off. */
|
|
1786
|
+
reminder_schedule?: number[];
|
|
1787
|
+
footer?: string | null;
|
|
1788
|
+
}
|
|
1789
|
+
type ExportOrdersOptions = Omit<GetOrdersOptions, 'limit' | 'offset'>;
|
|
1790
|
+
type ExportRetainersOptions = Omit<GetRetainersOptions, 'limit' | 'offset'>;
|
|
1791
|
+
type ExportSubscriptionsOptions = Omit<GetSubscriptionsOptions, 'limit' | 'offset'>;
|
|
1792
|
+
type ExportPeopleOptions = Omit<GetPeopleOptions, 'limit' | 'offset'>;
|
|
1698
1793
|
|
|
1699
1794
|
declare class AifeaturesApiError extends Error {
|
|
1700
1795
|
status: number;
|
|
@@ -1710,7 +1805,13 @@ interface AifeaturesApiClient {
|
|
|
1710
1805
|
getSubmissions(formId: string, options?: GetSubmissionsOptions): Promise<PaginatedSubmissions>;
|
|
1711
1806
|
getSubmission(submissionId: string): Promise<Submission>;
|
|
1712
1807
|
deleteSubmission(submissionId: string): Promise<void>;
|
|
1808
|
+
/** Every submission of the form as CSV — one column per field key (spam excluded unless asked). */
|
|
1809
|
+
exportSubmissionsCsv(formId: string, options?: {
|
|
1810
|
+
includeSpam?: boolean;
|
|
1811
|
+
}): Promise<Blob>;
|
|
1713
1812
|
downloadAttachment(submissionId: string, attachment: string | Pick<Attachment, 'id' | 'name'>): Promise<void>;
|
|
1813
|
+
getSite(siteId: string): Promise<SiteSettings>;
|
|
1814
|
+
updateSite(siteId: string, input: UpdateSiteSettingsInput): Promise<UpdateSiteSettingsResult>;
|
|
1714
1815
|
getPaymentsStatus(): Promise<PaymentsStatusResponse>;
|
|
1715
1816
|
getPromos(cursor?: string): Promise<PromosListResponse>;
|
|
1716
1817
|
getPromo(id: string): Promise<Promo>;
|
|
@@ -1721,6 +1822,8 @@ interface AifeaturesApiClient {
|
|
|
1721
1822
|
getProducts(options?: GetProductsOptions): Promise<Product[]>;
|
|
1722
1823
|
/** Returns the product detail (flat fields + options + variants). */
|
|
1723
1824
|
getProduct(productId: string): Promise<ProductDetail>;
|
|
1825
|
+
/** The whole catalog as CSV (the list takes no filters, so neither does this). */
|
|
1826
|
+
exportProductsCsv(): Promise<Blob>;
|
|
1724
1827
|
createProduct(input: CreateProductInput): Promise<ProductDetail>;
|
|
1725
1828
|
updateProduct(productId: string, input: UpdateProductInput): Promise<Product>;
|
|
1726
1829
|
deleteProduct(productId: string): Promise<void>;
|
|
@@ -1736,7 +1839,11 @@ interface AifeaturesApiClient {
|
|
|
1736
1839
|
adjustVariantInventory(variantId: string, input: AdjustInventoryInput): Promise<VariantInventory>;
|
|
1737
1840
|
getCustomers(options?: GetCustomersOptions): Promise<CustomersListResponse>;
|
|
1738
1841
|
getCustomer(customerId: string): Promise<CustomerDetail$1>;
|
|
1842
|
+
/** Every customer of the site as CSV (email, name, phone, customer_since, order_count). */
|
|
1843
|
+
exportCustomersCsv(): Promise<Blob>;
|
|
1739
1844
|
getOrders(options?: GetOrdersOptions): Promise<PaginatedOrders>;
|
|
1845
|
+
/** Every order matching the same filters as `getOrders`, all pages, as CSV. */
|
|
1846
|
+
exportOrdersCsv(options?: ExportOrdersOptions): Promise<Blob>;
|
|
1740
1847
|
getOrder(orderId: string): Promise<Order>;
|
|
1741
1848
|
resendOrderReceipt(orderId: string): Promise<void>;
|
|
1742
1849
|
resetOrderDownloads(orderId: string): Promise<Order>;
|
|
@@ -1747,6 +1854,8 @@ interface AifeaturesApiClient {
|
|
|
1747
1854
|
getInvoiceSettings(): Promise<InvoiceSettings>;
|
|
1748
1855
|
/** Retainers — recurring invoices (read-only here, like invoices). */
|
|
1749
1856
|
getRetainers(options?: GetRetainersOptions): Promise<PaginatedRetainers>;
|
|
1857
|
+
/** Every retainer matching the same filters as `getRetainers`, as CSV. */
|
|
1858
|
+
exportRetainersCsv(options?: ExportRetainersOptions): Promise<Blob>;
|
|
1750
1859
|
getRetainer(retainerId: string): Promise<Retainer>;
|
|
1751
1860
|
/**
|
|
1752
1861
|
* Mark the WHOLE order done (or un-mark it), optionally recording a
|
|
@@ -1756,10 +1865,14 @@ interface AifeaturesApiClient {
|
|
|
1756
1865
|
*/
|
|
1757
1866
|
setOrderFulfillment(orderId: string, input: SetOrderFulfillmentInput): Promise<Order>;
|
|
1758
1867
|
getSubscriptions(options?: GetSubscriptionsOptions): Promise<PaginatedSubscriptions>;
|
|
1868
|
+
/** Every subscription matching the same status filter, as CSV. */
|
|
1869
|
+
exportSubscriptionsCsv(options?: ExportSubscriptionsOptions): Promise<Blob>;
|
|
1759
1870
|
/** One-look business summary: revenue windows, needs-attention list, product counts. */
|
|
1760
1871
|
getBusinessSummary(options: GetBusinessSummaryOptions): Promise<BusinessSummary>;
|
|
1761
1872
|
/** Merged people list (customers ∪ form leads, grouped by email). */
|
|
1762
1873
|
getPeople(options?: GetPeopleOptions): Promise<PeopleListResponse>;
|
|
1874
|
+
/** The whole merged people list for the same search, as CSV; `source` narrows like the Leads tabs. */
|
|
1875
|
+
exportPeopleCsv(options?: ExportPeopleOptions): Promise<Blob>;
|
|
1763
1876
|
/** Everything known about one person (customer record, orders, submissions). */
|
|
1764
1877
|
getPerson(email: string): Promise<PersonDetail>;
|
|
1765
1878
|
/** Whether this site collects at all, its reporting zone, and first_seen. */
|
|
@@ -1902,8 +2015,10 @@ declare function FormSettings({ form, onSaved, className }: FormSettingsProps):
|
|
|
1902
2015
|
interface SubmissionDetailProps {
|
|
1903
2016
|
submission: Submission;
|
|
1904
2017
|
onBack: () => void;
|
|
2018
|
+
/** Shows a delete action when provided; the host navigates away once it resolves */
|
|
2019
|
+
onDelete?: () => Promise<void>;
|
|
1905
2020
|
}
|
|
1906
|
-
declare function SubmissionDetail({ submission, onBack, }: SubmissionDetailProps): react_jsx_runtime.JSX.Element;
|
|
2021
|
+
declare function SubmissionDetail({ submission, onBack, onDelete, }: SubmissionDetailProps): react_jsx_runtime.JSX.Element;
|
|
1907
2022
|
|
|
1908
2023
|
/**
|
|
1909
2024
|
* What the merchant chose to refund — the body of POST /orders/:id/refund,
|
|
@@ -2150,6 +2265,18 @@ interface CustomersListProps {
|
|
|
2150
2265
|
*/
|
|
2151
2266
|
declare function CustomersList({ className }: CustomersListProps): react_jsx_runtime.JSX.Element;
|
|
2152
2267
|
|
|
2268
|
+
interface ExportCsvButtonProps {
|
|
2269
|
+
/** Fetches the whole CSV (e.g. `() => api.exportCustomersCsv()`). */
|
|
2270
|
+
fetchCsv: () => Promise<Blob>;
|
|
2271
|
+
/** File name base; saved as `<base>-YYYY-MM-DD.csv`. */
|
|
2272
|
+
filename: string;
|
|
2273
|
+
label?: string;
|
|
2274
|
+
disabled?: boolean;
|
|
2275
|
+
className?: string;
|
|
2276
|
+
}
|
|
2277
|
+
/** "Export CSV" for any admin view whose API serves a CSV export. */
|
|
2278
|
+
declare function ExportCsvButton({ fetchCsv, filename, label, disabled, className, }: ExportCsvButtonProps): react_jsx_runtime.JSX.Element;
|
|
2279
|
+
|
|
2153
2280
|
interface CustomerDetailProps {
|
|
2154
2281
|
/** The customer to show (from the list row). */
|
|
2155
2282
|
customer: Customer;
|
|
@@ -2173,10 +2300,17 @@ interface PaymentsSetupProps {
|
|
|
2173
2300
|
onConnectStripe?: () => void;
|
|
2174
2301
|
/** Host-app callback for the needs_paid_plan upgrade CTA */
|
|
2175
2302
|
onUpgradePlan?: () => void;
|
|
2303
|
+
/**
|
|
2304
|
+
* Rendered in place of the "Payments are active" card when the status is
|
|
2305
|
+
* active. For a caller that only mounts this because something else says
|
|
2306
|
+
* the store can't sell (Store settings, where a paused checkout reads as
|
|
2307
|
+
* active here but not ready there).
|
|
2308
|
+
*/
|
|
2309
|
+
whenActive?: React.ReactNode;
|
|
2176
2310
|
/** Optional className */
|
|
2177
2311
|
className?: string;
|
|
2178
2312
|
}
|
|
2179
|
-
declare function PaymentsSetup({ onConnectStripe, onUpgradePlan, className, }: PaymentsSetupProps): react_jsx_runtime.JSX.Element;
|
|
2313
|
+
declare function PaymentsSetup({ onConnectStripe, onUpgradePlan, whenActive, className, }: PaymentsSetupProps): react_jsx_runtime.JSX.Element;
|
|
2180
2314
|
|
|
2181
2315
|
interface ViewShellProps {
|
|
2182
2316
|
/** The view's title ("Orders", "Products", "Leads"). */
|
|
@@ -2334,6 +2468,79 @@ interface SubscriptionsViewProps {
|
|
|
2334
2468
|
*/
|
|
2335
2469
|
declare function SubscriptionsView({ refreshKey, onBackToWebsite, className, }: SubscriptionsViewProps): react_jsx_runtime.JSX.Element;
|
|
2336
2470
|
|
|
2471
|
+
declare const STORE_SECTIONS: readonly ["checkout", "shipping", "tax", "currency"];
|
|
2472
|
+
type StoreSettingsSection = (typeof STORE_SECTIONS)[number];
|
|
2473
|
+
|
|
2474
|
+
interface StoreSettingsProps {
|
|
2475
|
+
/** The aifeatures site id. Must match the provider's site token. */
|
|
2476
|
+
siteId: string;
|
|
2477
|
+
/**
|
|
2478
|
+
* Change it to refetch the store settings in place (the editor's turn-end
|
|
2479
|
+
* refresh signal). Nothing remounts; groups with unsaved edits keep them.
|
|
2480
|
+
*/
|
|
2481
|
+
refreshKey?: unknown;
|
|
2482
|
+
/** Scrolls to and focuses this subsection once settings load, and whenever it changes. */
|
|
2483
|
+
section?: StoreSettingsSection;
|
|
2484
|
+
/** Mounted inside Shipping, for the shipping-provider connection when it exists. */
|
|
2485
|
+
shippingProviderSlot?: React.ReactNode;
|
|
2486
|
+
/**
|
|
2487
|
+
* When payments aren't active the section shows the payments setup step
|
|
2488
|
+
* for the store's reason (connect Stripe, or upgrade to a plan that can
|
|
2489
|
+
* sell) instead of settings. These start each fix in the host, as on
|
|
2490
|
+
* PaymentsDashboard; omit them and the step explains without a button.
|
|
2491
|
+
*/
|
|
2492
|
+
onConnectStripe?: () => void;
|
|
2493
|
+
onUpgradePlan?: () => void;
|
|
2494
|
+
className?: string;
|
|
2495
|
+
}
|
|
2496
|
+
/**
|
|
2497
|
+
* Settings → Store: the settings checkout reads when it builds each Stripe
|
|
2498
|
+
* session (phone collection, shipping, tax behaviour and Stripe automatic
|
|
2499
|
+
* tax, currency) — what a merchant can't set in their own Stripe Dashboard,
|
|
2500
|
+
* because products and sessions are created on the fly. Anything else lives
|
|
2501
|
+
* where it's used: invoice defaults and declared tax in `InvoiceSettingsPanel`,
|
|
2502
|
+
* notification recipients in `NotificationRecipientsSettings`, promo codes
|
|
2503
|
+
* in Products. Toggles save immediately; multi-field groups save with their
|
|
2504
|
+
* own Save.
|
|
2505
|
+
*/
|
|
2506
|
+
declare function StoreSettings({ siteId, refreshKey, section, shippingProviderSlot, onConnectStripe, onUpgradePlan, className, }: StoreSettingsProps): react_jsx_runtime.JSX.Element;
|
|
2507
|
+
|
|
2508
|
+
interface InvoiceSettingsPanelProps {
|
|
2509
|
+
/** The aifeatures site id. Must match the provider's site token. */
|
|
2510
|
+
siteId: string;
|
|
2511
|
+
/** Change it to refetch in place; groups with unsaved edits keep them. */
|
|
2512
|
+
refreshKey?: unknown;
|
|
2513
|
+
/**
|
|
2514
|
+
* Owner-only invoice defaults, saved by the host through an owner-checked
|
|
2515
|
+
* mutation (never the site token). Only changed fields are passed. Resolve
|
|
2516
|
+
* on success; reject with an Error whose message is shown beside Save.
|
|
2517
|
+
* Omit and the defaults render read-only.
|
|
2518
|
+
*/
|
|
2519
|
+
onSaveInvoiceSettings?: (input: StoreInvoiceSettingsInput) => Promise<void>;
|
|
2520
|
+
className?: string;
|
|
2521
|
+
}
|
|
2522
|
+
/**
|
|
2523
|
+
* Invoice defaults and the declared tax printed on receipts and invoices.
|
|
2524
|
+
* Neither reaches checkout, so they live with Invoices rather than in Store
|
|
2525
|
+
* settings. Unlike Store, they don't wait for payments to be active: invoice
|
|
2526
|
+
* terms can be set up before the first invoice is sent.
|
|
2527
|
+
*/
|
|
2528
|
+
declare function InvoiceSettingsPanel({ siteId, refreshKey, onSaveInvoiceSettings, className, }: InvoiceSettingsPanelProps): react_jsx_runtime.JSX.Element;
|
|
2529
|
+
|
|
2530
|
+
interface NotificationRecipientsSettingsProps {
|
|
2531
|
+
/** The aifeatures site id. Must match the provider's site token. */
|
|
2532
|
+
siteId: string;
|
|
2533
|
+
/** Change it to refetch in place; unsaved edits are kept. */
|
|
2534
|
+
refreshKey?: unknown;
|
|
2535
|
+
className?: string;
|
|
2536
|
+
}
|
|
2537
|
+
/**
|
|
2538
|
+
* Who gets the site's notification emails: new orders, and form submissions
|
|
2539
|
+
* for forms without their own recipients. Not a checkout setting, and a
|
|
2540
|
+
* forms-only site needs it too, so it doesn't wait for payments to be active.
|
|
2541
|
+
*/
|
|
2542
|
+
declare function NotificationRecipientsSettings({ siteId, refreshKey, className, }: NotificationRecipientsSettingsProps): react_jsx_runtime.JSX.Element;
|
|
2543
|
+
|
|
2337
2544
|
interface WebhookSettingsProps {
|
|
2338
2545
|
/**
|
|
2339
2546
|
* The form these webhooks are attached to.
|
|
@@ -2479,6 +2686,14 @@ interface InvoicesViewProps {
|
|
|
2479
2686
|
onConnectStripe?: InvoicesListProps["onConnectStripe"];
|
|
2480
2687
|
onUpgradePlan?: InvoicesListProps["onUpgradePlan"];
|
|
2481
2688
|
needsPaidPlan?: boolean;
|
|
2689
|
+
/**
|
|
2690
|
+
* The aifeatures site id (must match the provider's site token). Given, the
|
|
2691
|
+
* view offers "Invoice settings": invoice defaults and the tax printed on
|
|
2692
|
+
* receipts and invoices. Pass it only to viewers who may change them.
|
|
2693
|
+
*/
|
|
2694
|
+
siteId?: string;
|
|
2695
|
+
/** Owner-only save for the invoice defaults; omit and they render read-only. */
|
|
2696
|
+
onSaveInvoiceSettings?: (input: StoreInvoiceSettingsInput) => Promise<void>;
|
|
2482
2697
|
className?: string;
|
|
2483
2698
|
}
|
|
2484
2699
|
/**
|
|
@@ -2488,7 +2703,7 @@ interface InvoicesViewProps {
|
|
|
2488
2703
|
* list and detail. Ephemeral like OrdersView: top-level list state on every
|
|
2489
2704
|
* swap, except the deep-open.
|
|
2490
2705
|
*/
|
|
2491
|
-
declare function InvoicesView({ refreshKey, initialInvoiceId, onBackToWebsite, onConnectStripe, onUpgradePlan, needsPaidPlan, className }: InvoicesViewProps): react_jsx_runtime.JSX.Element;
|
|
2706
|
+
declare function InvoicesView({ refreshKey, initialInvoiceId, onBackToWebsite, onConnectStripe, onUpgradePlan, needsPaidPlan, siteId, onSaveInvoiceSettings, className }: InvoicesViewProps): react_jsx_runtime.JSX.Element;
|
|
2492
2707
|
|
|
2493
2708
|
declare function RetainerStatusBadge({ retainer, className }: {
|
|
2494
2709
|
retainer: Pick<Retainer, "status" | "paused_by" | "skip_next_cycle">;
|
|
@@ -2512,9 +2727,11 @@ interface RetainersPanelProps {
|
|
|
2512
2727
|
/** The series on screen: live only, or the ended ones too. Omit to hide the toggle. */
|
|
2513
2728
|
includeEnded?: boolean;
|
|
2514
2729
|
onIncludeEndedChange?: (includeEnded: boolean) => void;
|
|
2730
|
+
/** Fetches the series on screen as CSV (every page). Omit to hide the Export CSV button. */
|
|
2731
|
+
exportCsv?: () => Promise<Blob>;
|
|
2515
2732
|
className?: string;
|
|
2516
2733
|
}
|
|
2517
|
-
declare function RetainersPanel({ retainers, isLoading, error, onRetry, onShowCycles, activeRetainerId, total, endedTotal, isLoadingMore, onLoadMore, includeEnded, onIncludeEndedChange, className }: RetainersPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
2734
|
+
declare function RetainersPanel({ retainers, isLoading, error, onRetry, onShowCycles, activeRetainerId, total, endedTotal, isLoadingMore, onLoadMore, includeEnded, onIncludeEndedChange, exportCsv, className }: RetainersPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
2518
2735
|
|
|
2519
2736
|
/** Shared merchant dashboard surface; all writes use the same API as agent tools. */
|
|
2520
2737
|
declare function PromosPanel(): react_jsx_runtime.JSX.Element;
|
|
@@ -2603,6 +2820,8 @@ interface UseOrdersReturn {
|
|
|
2603
2820
|
*/
|
|
2604
2821
|
unfulfilledOnly: boolean;
|
|
2605
2822
|
setUnfulfilledOnly: (only: boolean) => void;
|
|
2823
|
+
/** The server filters in effect (no paging) — what a CSV export of this list should send. */
|
|
2824
|
+
filters: ExportOrdersOptions;
|
|
2606
2825
|
/** Clears every filter (status, email, dates) and returns to the first page. */
|
|
2607
2826
|
clearFilters: () => void;
|
|
2608
2827
|
refetch: () => Promise<void>;
|
|
@@ -2647,6 +2866,25 @@ interface UseCustomersOptions {
|
|
|
2647
2866
|
}
|
|
2648
2867
|
declare function useCustomers({ initialPageSize, }?: UseCustomersOptions): UseCustomersReturn;
|
|
2649
2868
|
|
|
2869
|
+
interface UseCsvExportOptions {
|
|
2870
|
+
/** Fetches the whole CSV (e.g. `() => api.exportCustomersCsv()`). */
|
|
2871
|
+
fetchCsv: () => Promise<Blob>;
|
|
2872
|
+
/** File name base; saved as `<base>-YYYY-MM-DD.csv`. */
|
|
2873
|
+
filename: string;
|
|
2874
|
+
}
|
|
2875
|
+
interface UseCsvExportReturn {
|
|
2876
|
+
exportCsv: () => Promise<void>;
|
|
2877
|
+
exporting: boolean;
|
|
2878
|
+
/** Set when the last export failed; cleared when the next one starts. */
|
|
2879
|
+
error: Error | null;
|
|
2880
|
+
}
|
|
2881
|
+
/**
|
|
2882
|
+
* Download a server-assembled CSV. Guards double-clicks while one is in
|
|
2883
|
+
* flight; a failed fetch (including a stream that errors mid-file) surfaces
|
|
2884
|
+
* as `error` and saves nothing, never a truncated file.
|
|
2885
|
+
*/
|
|
2886
|
+
declare function useCsvExport({ fetchCsv, filename }: UseCsvExportOptions): UseCsvExportReturn;
|
|
2887
|
+
|
|
2650
2888
|
interface UseBusinessSummaryOptions {
|
|
2651
2889
|
/**
|
|
2652
2890
|
* Bump to force a refetch (view data freshness, plan D11) — the host
|
|
@@ -2668,6 +2906,7 @@ interface UseBusinessSummaryReturn {
|
|
|
2668
2906
|
*/
|
|
2669
2907
|
declare function useBusinessSummary({ refreshKey, }?: UseBusinessSummaryOptions): UseBusinessSummaryReturn;
|
|
2670
2908
|
|
|
2909
|
+
type PeopleSource = NonNullable<GetPeopleOptions['source']>;
|
|
2671
2910
|
interface UsePeopleOptions {
|
|
2672
2911
|
initialPageSize?: number;
|
|
2673
2912
|
/**
|
|
@@ -2694,7 +2933,20 @@ interface UsePeopleReturn {
|
|
|
2694
2933
|
/** Free-text filter (email/name). Resets to the first page. */
|
|
2695
2934
|
q: string;
|
|
2696
2935
|
setQ: (q: string) => void;
|
|
2936
|
+
/**
|
|
2937
|
+
* Only people with this source (the Leads view's Customers / Leads tabs);
|
|
2938
|
+
* undefined is everyone. Filtered server-side before paging, so every page
|
|
2939
|
+
* is a full page of that tab. Resets to the first page.
|
|
2940
|
+
*/
|
|
2941
|
+
source: PeopleSource | undefined;
|
|
2942
|
+
setSource: (source: PeopleSource | undefined) => void;
|
|
2697
2943
|
refetch: () => Promise<void>;
|
|
2944
|
+
/**
|
|
2945
|
+
* Refetch after a person may have been removed (e.g. a deleted submission).
|
|
2946
|
+
* If that emptied a later page, step back one page instead of showing it.
|
|
2947
|
+
* Plain paging keeps the accepted empty page after an exactly-full one.
|
|
2948
|
+
*/
|
|
2949
|
+
refetchAfterRemoval: () => Promise<void>;
|
|
2698
2950
|
}
|
|
2699
2951
|
/**
|
|
2700
2952
|
* The merged people list (customers ∪ form leads, grouped by email — display
|
|
@@ -2843,6 +3095,8 @@ interface UseRetainersReturn {
|
|
|
2843
3095
|
setIncludeEnded: (includeEnded: boolean) => void;
|
|
2844
3096
|
loadMore: () => Promise<void>;
|
|
2845
3097
|
refetch: () => Promise<void>;
|
|
3098
|
+
/** The series' server filters (no paging) — what a CSV export of it should send. */
|
|
3099
|
+
filters: ExportRetainersOptions;
|
|
2846
3100
|
}
|
|
2847
3101
|
interface UseRetainersOptions {
|
|
2848
3102
|
/** Bump to refetch (view data freshness). */
|
|
@@ -3017,6 +3271,43 @@ declare function useRealtimeVisitors(options?: {
|
|
|
3017
3271
|
identity?: string | null;
|
|
3018
3272
|
}): UseRealtimeVisitorsReturn;
|
|
3019
3273
|
|
|
3274
|
+
interface UseSiteSettingsOptions {
|
|
3275
|
+
/** The aifeatures site id. Must be the site the provider's token belongs to. */
|
|
3276
|
+
siteId: string;
|
|
3277
|
+
/**
|
|
3278
|
+
* Change it to refetch (e.g. the editor's turn-end refresh signal). The
|
|
3279
|
+
* refetch is silent: `isLoading` stays false and the current values stay on
|
|
3280
|
+
* screen until the fresh ones land, so nothing remounts.
|
|
3281
|
+
*/
|
|
3282
|
+
refreshKey?: unknown;
|
|
3283
|
+
/**
|
|
3284
|
+
* Owner-only. Saves invoice defaults through the host (an owner-checked
|
|
3285
|
+
* mutation). Resolve on success; reject with an Error whose message is shown
|
|
3286
|
+
* to the merchant. Omit and invoice defaults are read-only.
|
|
3287
|
+
*/
|
|
3288
|
+
onSaveInvoiceSettings?: (input: StoreInvoiceSettingsInput) => Promise<void>;
|
|
3289
|
+
}
|
|
3290
|
+
interface UseSiteSettingsReturn {
|
|
3291
|
+
site: SiteSettings | null;
|
|
3292
|
+
/** True until the first load settles, and again after `siteId` or the api client changes. */
|
|
3293
|
+
isLoading: boolean;
|
|
3294
|
+
/**
|
|
3295
|
+
* The last load error. A failed refetch keeps the previous `site`; a host
|
|
3296
|
+
* save whose re-read failed keeps the saved values and sets this too.
|
|
3297
|
+
*/
|
|
3298
|
+
error: Error | null;
|
|
3299
|
+
refetch: () => Promise<void>;
|
|
3300
|
+
/** PATCH /sites/:id with the site token. Rejects on failure; `site` is left unchanged. */
|
|
3301
|
+
updateSite: (input: UpdateSiteSettingsInput) => Promise<UpdateSiteSettingsResult>;
|
|
3302
|
+
/**
|
|
3303
|
+
* Calls the host's `onSaveInvoiceSettings`, then re-reads the site and
|
|
3304
|
+
* resolves with it (with the saved values merged in if only the re-read
|
|
3305
|
+
* failed). Null when the host gave no callback (read-only).
|
|
3306
|
+
*/
|
|
3307
|
+
saveInvoiceSettings: ((input: StoreInvoiceSettingsInput) => Promise<SiteSettings | null>) | null;
|
|
3308
|
+
}
|
|
3309
|
+
declare function useSiteSettings({ siteId, refreshKey, onSaveInvoiceSettings, }: UseSiteSettingsOptions): UseSiteSettingsReturn;
|
|
3310
|
+
|
|
3020
3311
|
declare function isZeroDecimalCurrency(currency: string): boolean;
|
|
3021
3312
|
/**
|
|
3022
3313
|
* Format a minor-unit amount for display ("$29.00", "¥1,500").
|
|
@@ -3278,4 +3569,4 @@ interface DashboardViewProps {
|
|
|
3278
3569
|
*/
|
|
3279
3570
|
declare function DashboardView({ refreshKey, onBackToWebsite, primaryConversion, onChangePrimaryConversion, onOpenSurface, needsPaidPlan, onUpgradePlan, onConnectStripe, }: DashboardViewProps): react_jsx_runtime.JSX.Element;
|
|
3280
3571
|
|
|
3281
|
-
export { type AdjustInventoryInput, type AifeaturesApiClient, AifeaturesApiError, type AifeaturesContextValue, AifeaturesProvider, type AifeaturesProviderProps, type AnalyticsBreakdown, type AnalyticsBreakdownName, type AnalyticsBreakdownRow, type AnalyticsChannelRow, type AnalyticsChannels, type AnalyticsConversionRow, type AnalyticsConversions, type AnalyticsFilter, type AnalyticsFilterDimension, type AnalyticsGoalTargetRow, type AnalyticsGoalTargets, type AnalyticsPeriod, type AnalyticsRealtime, type AnalyticsSourced, type AnalyticsStatus, type AnalyticsSummary, type AnalyticsSummaryData, type AnalyticsSummaryMetrics, type AnalyticsTimeseries, type AnalyticsTimeseriesRow, AnalyticsView, type AnalyticsViewProps, type ApiError, type Attachment, type BusinessSummary, type BusinessVisitors, type CreateEventDestinationInput, type CreateFormInput, type CreateOptionInput, type CreateProductInput, type CreatePromoInput, type CreateVariantInput, type Customer, type CustomerAddress, CustomerDetail, type CustomerDetail$1 as CustomerDetailData, type CustomerDetailProps, CustomersList, type CustomersListProps, type CustomersListResponse, DashboardView, type DashboardViewProps, type EmailDelivery, 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 FormsLocation, type FormsTab, 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, MAX_ANALYTICS_FILTERS, MAX_ANALYTICS_FILTER_VALUES, 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 PrimaryConversion, 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 Promo, type PromosListResponse, PromosPanel, REALTIME_FAILURES_BEFORE_ERROR, REALTIME_POLL_MS, type RefundRequest, type ReportSlot, 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 UseAnalyticsOptions, type UseAnalyticsReturn, 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 UseRealtimeVisitorsReturn, 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, useAnalytics, useBusinessSummary, useCustomers, useEventDestinations, useForms, useInvoices, useOrders, usePaymentsStatus, usePeople, usePerson, useProducts, useRealtimeVisitors, useRetainers, useSubmissions, useSubscriptions };
|
|
3572
|
+
export { type AdjustInventoryInput, type AifeaturesApiClient, AifeaturesApiError, type AifeaturesContextValue, AifeaturesProvider, type AifeaturesProviderProps, type AnalyticsBreakdown, type AnalyticsBreakdownName, type AnalyticsBreakdownRow, type AnalyticsChannelRow, type AnalyticsChannels, type AnalyticsConversionRow, type AnalyticsConversions, type AnalyticsFilter, type AnalyticsFilterDimension, type AnalyticsGoalTargetRow, type AnalyticsGoalTargets, type AnalyticsPeriod, type AnalyticsRealtime, type AnalyticsSourced, type AnalyticsStatus, type AnalyticsSummary, type AnalyticsSummaryData, type AnalyticsSummaryMetrics, type AnalyticsTimeseries, type AnalyticsTimeseriesRow, AnalyticsView, type AnalyticsViewProps, type ApiError, type Attachment, type BusinessSummary, type BusinessVisitors, type CreateEventDestinationInput, type CreateFormInput, type CreateOptionInput, type CreateProductInput, type CreatePromoInput, type CreateVariantInput, type CurrencyRestatement, type Customer, type CustomerAddress, CustomerDetail, type CustomerDetail$1 as CustomerDetailData, type CustomerDetailProps, CustomersList, type CustomersListProps, type CustomersListResponse, DashboardView, type DashboardViewProps, type EmailDelivery, type EmailSideStatus, type EventDeliveriesListResponse, type EventDelivery, type EventDestination, type EventDestinationSecretResponse, type EventDestinationsListResponse, ExportCsvButton, type ExportCsvButtonProps, type ExportOrdersOptions, type ExportPeopleOptions, type ExportRetainersOptions, type ExportSubscriptionsOptions, type Form, FormSettings, type FormSettingsProps, FormSubmissions, type FormSubmissionsProps, FormsDashboard, type FormsDashboardProps, FormsList, type FormsListProps, type FormsListResponse, type FormsLocation, type FormsTab, 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, InvoiceSettingsPanel, type InvoiceSettingsPanelProps, InvoicesList, type InvoicesListProps, InvoicesView, type InvoicesViewProps, LeadsView, type LeadsViewProps, type LowStockProduct, MAX_ANALYTICS_FILTERS, MAX_ANALYTICS_FILTER_VALUES, type NeedsAttentionItem, type NeedsAttentionType, NotificationRecipientsSettings, type NotificationRecipientsSettingsProps, 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 PrimaryConversion, 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 Promo, type PromosListResponse, PromosPanel, REALTIME_FAILURES_BEFORE_ERROR, REALTIME_POLL_MS, type RefundRequest, type ReportSlot, RetainerStatusBadge, RetainersPanel, type RetainersPanelProps, type RevenueCurrencyTotal, type RevenuePeriod, type SetInventoryInput, type SetOrderFulfillmentInput, type SettledRevenue, type ShippingRate, type SiteSettings, type StoreInvoiceSettingsInput, StoreSettings, type StoreSettingsProps, type StoreSettingsSection, type Submission, SubmissionDetail, type SubmissionDetailProps, type SubmissionMetadata, type Subscription, SubscriptionsView, type SubscriptionsViewProps, type UpdateEventDestinationInput, type UpdateFormInput, type UpdateOptionInput, type UpdateProductInput, type UpdateSiteSettingsInput, type UpdateSiteSettingsResult, type UpdateVariantInput, type UseAnalyticsOptions, type UseAnalyticsReturn, type UseBusinessSummaryOptions, type UseBusinessSummaryReturn, type UseCsvExportOptions, type UseCsvExportReturn, 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 UseRealtimeVisitorsReturn, type UseSiteSettingsOptions, type UseSiteSettingsReturn, 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, useAnalytics, useBusinessSummary, useCsvExport, useCustomers, useEventDestinations, useForms, useInvoices, useOrders, usePaymentsStatus, usePeople, usePerson, useProducts, useRealtimeVisitors, useRetainers, useSiteSettings, useSubmissions, useSubscriptions };
|