@aifeatures/admin-react 0.19.0 → 0.20.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
@@ -160,7 +160,7 @@ interface ApiError {
160
160
  * `funnel_window_precedes_coverage` among them. They belong here, but adding
161
161
  * them is a change to the goals and funnels surfaces rather than this one.
162
162
  */
163
- code?: 'filter_unsupported' | 'filters_unsupported' | 'range_invalid' | 'dimension_unsupported' | 'goals_exceed_report_budget' | 'goal_not_found' | 'goal_has_no_targets' | 'invalid_limit';
163
+ 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
164
  }
165
165
  /**
166
166
  * A site's payment readiness (sites.paymentsStatus)
@@ -939,6 +939,11 @@ interface GetPeopleOptions {
939
939
  since?: string;
940
940
  /** Free-text filter (email/name). */
941
941
  q?: string;
942
+ /**
943
+ * Only people with this source — what the Leads view's Customers / Leads
944
+ * tabs show. Applied server-side before paging.
945
+ */
946
+ source?: 'customer' | 'lead';
942
947
  limit?: number;
943
948
  offset?: number;
944
949
  }
@@ -1695,6 +1700,92 @@ interface PromosListResponse {
1695
1700
  next_cursor: string | null;
1696
1701
  checkout_enabled: boolean;
1697
1702
  }
1703
+ interface ShippingRate {
1704
+ label: string;
1705
+ /** Minor units of the site's currency. */
1706
+ amount: number;
1707
+ }
1708
+ /** The site read: every store-wide setting the Store section shows. */
1709
+ interface SiteSettings {
1710
+ id: string;
1711
+ name: string;
1712
+ external_id: string | null;
1713
+ /** Order notification recipients (also the default for forms without their own). */
1714
+ default_email_recipients: string[];
1715
+ /** Null = ships anywhere Stripe serves. */
1716
+ shipping_countries: string[] | null;
1717
+ /** Null = no shipping charge. */
1718
+ shipping_rates: ShippingRate[] | null;
1719
+ free_shipping_over: number | null;
1720
+ tax_behavior: 'inclusive' | 'exclusive' | null;
1721
+ tax_rate_bps: number | null;
1722
+ tax_id: string | null;
1723
+ tax_label: string | null;
1724
+ stripe_tax_enabled: boolean;
1725
+ collect_phone_at_checkout: boolean;
1726
+ /** Payments active, a Stripe account set, and checkout not paused. */
1727
+ payments_active: boolean;
1728
+ /** Owner-only: read here, written through the host's callback. */
1729
+ invoice_due_days: number;
1730
+ /** Owner-only. [] = reminders off. */
1731
+ invoice_reminder_schedule: number[];
1732
+ /** Owner-only. */
1733
+ invoice_footer: string | null;
1734
+ currency: string;
1735
+ deleted_at: string | null;
1736
+ purged_at: string | null;
1737
+ created_at: string;
1738
+ updated_at: string;
1739
+ }
1740
+ /** What the site token may write through PATCH /sites/:id. */
1741
+ interface UpdateSiteSettingsInput {
1742
+ default_email_recipients?: string[];
1743
+ shipping_countries?: string[] | null;
1744
+ shipping_rates?: ShippingRate[] | null;
1745
+ free_shipping_over?: number | null;
1746
+ tax_behavior?: 'inclusive' | 'exclusive' | null;
1747
+ tax_rate_bps?: number | null;
1748
+ tax_id?: string | null;
1749
+ tax_label?: string | null;
1750
+ stripe_tax_enabled?: boolean;
1751
+ collect_phone_at_checkout?: boolean;
1752
+ /** Restates every stored amount in the new currency (no FX conversion). */
1753
+ currency?: string;
1754
+ /**
1755
+ * Precondition for amount writes: the currency they were entered in. If
1756
+ * the store's currency is no longer this, the API refuses the whole
1757
+ * request (409 `currency_changed`) and writes nothing.
1758
+ */
1759
+ expected_currency?: string;
1760
+ }
1761
+ interface CurrencyRestatement {
1762
+ applied: boolean;
1763
+ from: string;
1764
+ to: string;
1765
+ reason?: string;
1766
+ reasons?: string[];
1767
+ blockedBy?: 'orders' | 'amounts' | 'concurrent';
1768
+ retryable?: boolean;
1769
+ pinned?: boolean;
1770
+ }
1771
+ interface UpdateSiteSettingsResult extends SiteSettings {
1772
+ /** Present when the request carried `currency`. */
1773
+ currency_restatement?: CurrencyRestatement;
1774
+ }
1775
+ /**
1776
+ * Owner-only invoice defaults, saved by the HOST (an owner-checked mutation),
1777
+ * never with the site token. Only changed fields are sent.
1778
+ */
1779
+ interface StoreInvoiceSettingsInput {
1780
+ due_days?: number;
1781
+ /** [] turns reminders off. */
1782
+ reminder_schedule?: number[];
1783
+ footer?: string | null;
1784
+ }
1785
+ type ExportOrdersOptions = Omit<GetOrdersOptions, 'limit' | 'offset'>;
1786
+ type ExportRetainersOptions = Omit<GetRetainersOptions, 'limit' | 'offset'>;
1787
+ type ExportSubscriptionsOptions = Omit<GetSubscriptionsOptions, 'limit' | 'offset'>;
1788
+ type ExportPeopleOptions = Omit<GetPeopleOptions, 'limit' | 'offset'>;
1698
1789
 
1699
1790
  declare class AifeaturesApiError extends Error {
1700
1791
  status: number;
@@ -1710,7 +1801,13 @@ interface AifeaturesApiClient {
1710
1801
  getSubmissions(formId: string, options?: GetSubmissionsOptions): Promise<PaginatedSubmissions>;
1711
1802
  getSubmission(submissionId: string): Promise<Submission>;
1712
1803
  deleteSubmission(submissionId: string): Promise<void>;
1804
+ /** Every submission of the form as CSV — one column per field key (spam excluded unless asked). */
1805
+ exportSubmissionsCsv(formId: string, options?: {
1806
+ includeSpam?: boolean;
1807
+ }): Promise<Blob>;
1713
1808
  downloadAttachment(submissionId: string, attachment: string | Pick<Attachment, 'id' | 'name'>): Promise<void>;
1809
+ getSite(siteId: string): Promise<SiteSettings>;
1810
+ updateSite(siteId: string, input: UpdateSiteSettingsInput): Promise<UpdateSiteSettingsResult>;
1714
1811
  getPaymentsStatus(): Promise<PaymentsStatusResponse>;
1715
1812
  getPromos(cursor?: string): Promise<PromosListResponse>;
1716
1813
  getPromo(id: string): Promise<Promo>;
@@ -1721,6 +1818,8 @@ interface AifeaturesApiClient {
1721
1818
  getProducts(options?: GetProductsOptions): Promise<Product[]>;
1722
1819
  /** Returns the product detail (flat fields + options + variants). */
1723
1820
  getProduct(productId: string): Promise<ProductDetail>;
1821
+ /** The whole catalog as CSV (the list takes no filters, so neither does this). */
1822
+ exportProductsCsv(): Promise<Blob>;
1724
1823
  createProduct(input: CreateProductInput): Promise<ProductDetail>;
1725
1824
  updateProduct(productId: string, input: UpdateProductInput): Promise<Product>;
1726
1825
  deleteProduct(productId: string): Promise<void>;
@@ -1736,7 +1835,11 @@ interface AifeaturesApiClient {
1736
1835
  adjustVariantInventory(variantId: string, input: AdjustInventoryInput): Promise<VariantInventory>;
1737
1836
  getCustomers(options?: GetCustomersOptions): Promise<CustomersListResponse>;
1738
1837
  getCustomer(customerId: string): Promise<CustomerDetail$1>;
1838
+ /** Every customer of the site as CSV (email, name, phone, customer_since, order_count). */
1839
+ exportCustomersCsv(): Promise<Blob>;
1739
1840
  getOrders(options?: GetOrdersOptions): Promise<PaginatedOrders>;
1841
+ /** Every order matching the same filters as `getOrders`, all pages, as CSV. */
1842
+ exportOrdersCsv(options?: ExportOrdersOptions): Promise<Blob>;
1740
1843
  getOrder(orderId: string): Promise<Order>;
1741
1844
  resendOrderReceipt(orderId: string): Promise<void>;
1742
1845
  resetOrderDownloads(orderId: string): Promise<Order>;
@@ -1747,6 +1850,8 @@ interface AifeaturesApiClient {
1747
1850
  getInvoiceSettings(): Promise<InvoiceSettings>;
1748
1851
  /** Retainers — recurring invoices (read-only here, like invoices). */
1749
1852
  getRetainers(options?: GetRetainersOptions): Promise<PaginatedRetainers>;
1853
+ /** Every retainer matching the same filters as `getRetainers`, as CSV. */
1854
+ exportRetainersCsv(options?: ExportRetainersOptions): Promise<Blob>;
1750
1855
  getRetainer(retainerId: string): Promise<Retainer>;
1751
1856
  /**
1752
1857
  * Mark the WHOLE order done (or un-mark it), optionally recording a
@@ -1756,10 +1861,14 @@ interface AifeaturesApiClient {
1756
1861
  */
1757
1862
  setOrderFulfillment(orderId: string, input: SetOrderFulfillmentInput): Promise<Order>;
1758
1863
  getSubscriptions(options?: GetSubscriptionsOptions): Promise<PaginatedSubscriptions>;
1864
+ /** Every subscription matching the same status filter, as CSV. */
1865
+ exportSubscriptionsCsv(options?: ExportSubscriptionsOptions): Promise<Blob>;
1759
1866
  /** One-look business summary: revenue windows, needs-attention list, product counts. */
1760
1867
  getBusinessSummary(options: GetBusinessSummaryOptions): Promise<BusinessSummary>;
1761
1868
  /** Merged people list (customers ∪ form leads, grouped by email). */
1762
1869
  getPeople(options?: GetPeopleOptions): Promise<PeopleListResponse>;
1870
+ /** The whole merged people list for the same search, as CSV; `source` narrows like the Leads tabs. */
1871
+ exportPeopleCsv(options?: ExportPeopleOptions): Promise<Blob>;
1763
1872
  /** Everything known about one person (customer record, orders, submissions). */
1764
1873
  getPerson(email: string): Promise<PersonDetail>;
1765
1874
  /** Whether this site collects at all, its reporting zone, and first_seen. */
@@ -2150,6 +2259,18 @@ interface CustomersListProps {
2150
2259
  */
2151
2260
  declare function CustomersList({ className }: CustomersListProps): react_jsx_runtime.JSX.Element;
2152
2261
 
2262
+ interface ExportCsvButtonProps {
2263
+ /** Fetches the whole CSV (e.g. `() => api.exportCustomersCsv()`). */
2264
+ fetchCsv: () => Promise<Blob>;
2265
+ /** File name base; saved as `<base>-YYYY-MM-DD.csv`. */
2266
+ filename: string;
2267
+ label?: string;
2268
+ disabled?: boolean;
2269
+ className?: string;
2270
+ }
2271
+ /** "Export CSV" for any admin view whose API serves a CSV export. */
2272
+ declare function ExportCsvButton({ fetchCsv, filename, label, disabled, className, }: ExportCsvButtonProps): react_jsx_runtime.JSX.Element;
2273
+
2153
2274
  interface CustomerDetailProps {
2154
2275
  /** The customer to show (from the list row). */
2155
2276
  customer: Customer;
@@ -2173,10 +2294,17 @@ interface PaymentsSetupProps {
2173
2294
  onConnectStripe?: () => void;
2174
2295
  /** Host-app callback for the needs_paid_plan upgrade CTA */
2175
2296
  onUpgradePlan?: () => void;
2297
+ /**
2298
+ * Rendered in place of the "Payments are active" card when the status is
2299
+ * active. For a caller that only mounts this because something else says
2300
+ * the store can't sell (Store settings, where a paused checkout reads as
2301
+ * active here but not ready there).
2302
+ */
2303
+ whenActive?: React.ReactNode;
2176
2304
  /** Optional className */
2177
2305
  className?: string;
2178
2306
  }
2179
- declare function PaymentsSetup({ onConnectStripe, onUpgradePlan, className, }: PaymentsSetupProps): react_jsx_runtime.JSX.Element;
2307
+ declare function PaymentsSetup({ onConnectStripe, onUpgradePlan, whenActive, className, }: PaymentsSetupProps): react_jsx_runtime.JSX.Element;
2180
2308
 
2181
2309
  interface ViewShellProps {
2182
2310
  /** The view's title ("Orders", "Products", "Leads"). */
@@ -2334,6 +2462,79 @@ interface SubscriptionsViewProps {
2334
2462
  */
2335
2463
  declare function SubscriptionsView({ refreshKey, onBackToWebsite, className, }: SubscriptionsViewProps): react_jsx_runtime.JSX.Element;
2336
2464
 
2465
+ declare const STORE_SECTIONS: readonly ["checkout", "shipping", "tax", "currency"];
2466
+ type StoreSettingsSection = (typeof STORE_SECTIONS)[number];
2467
+
2468
+ interface StoreSettingsProps {
2469
+ /** The aifeatures site id. Must match the provider's site token. */
2470
+ siteId: string;
2471
+ /**
2472
+ * Change it to refetch the store settings in place (the editor's turn-end
2473
+ * refresh signal). Nothing remounts; groups with unsaved edits keep them.
2474
+ */
2475
+ refreshKey?: unknown;
2476
+ /** Scrolls to and focuses this subsection once settings load, and whenever it changes. */
2477
+ section?: StoreSettingsSection;
2478
+ /** Mounted inside Shipping, for the shipping-provider connection when it exists. */
2479
+ shippingProviderSlot?: React.ReactNode;
2480
+ /**
2481
+ * When payments aren't active the section shows the payments setup step
2482
+ * for the store's reason (connect Stripe, or upgrade to a plan that can
2483
+ * sell) instead of settings. These start each fix in the host, as on
2484
+ * PaymentsDashboard; omit them and the step explains without a button.
2485
+ */
2486
+ onConnectStripe?: () => void;
2487
+ onUpgradePlan?: () => void;
2488
+ className?: string;
2489
+ }
2490
+ /**
2491
+ * Settings → Store: the settings checkout reads when it builds each Stripe
2492
+ * session (phone collection, shipping, tax behaviour and Stripe automatic
2493
+ * tax, currency) — what a merchant can't set in their own Stripe Dashboard,
2494
+ * because products and sessions are created on the fly. Anything else lives
2495
+ * where it's used: invoice defaults and declared tax in `InvoiceSettingsPanel`,
2496
+ * notification recipients in `NotificationRecipientsSettings`, promo codes
2497
+ * in Products. Toggles save immediately; multi-field groups save with their
2498
+ * own Save.
2499
+ */
2500
+ declare function StoreSettings({ siteId, refreshKey, section, shippingProviderSlot, onConnectStripe, onUpgradePlan, className, }: StoreSettingsProps): react_jsx_runtime.JSX.Element;
2501
+
2502
+ interface InvoiceSettingsPanelProps {
2503
+ /** The aifeatures site id. Must match the provider's site token. */
2504
+ siteId: string;
2505
+ /** Change it to refetch in place; groups with unsaved edits keep them. */
2506
+ refreshKey?: unknown;
2507
+ /**
2508
+ * Owner-only invoice defaults, saved by the host through an owner-checked
2509
+ * mutation (never the site token). Only changed fields are passed. Resolve
2510
+ * on success; reject with an Error whose message is shown beside Save.
2511
+ * Omit and the defaults render read-only.
2512
+ */
2513
+ onSaveInvoiceSettings?: (input: StoreInvoiceSettingsInput) => Promise<void>;
2514
+ className?: string;
2515
+ }
2516
+ /**
2517
+ * Invoice defaults and the declared tax printed on receipts and invoices.
2518
+ * Neither reaches checkout, so they live with Invoices rather than in Store
2519
+ * settings. Unlike Store, they don't wait for payments to be active: invoice
2520
+ * terms can be set up before the first invoice is sent.
2521
+ */
2522
+ declare function InvoiceSettingsPanel({ siteId, refreshKey, onSaveInvoiceSettings, className, }: InvoiceSettingsPanelProps): react_jsx_runtime.JSX.Element;
2523
+
2524
+ interface NotificationRecipientsSettingsProps {
2525
+ /** The aifeatures site id. Must match the provider's site token. */
2526
+ siteId: string;
2527
+ /** Change it to refetch in place; unsaved edits are kept. */
2528
+ refreshKey?: unknown;
2529
+ className?: string;
2530
+ }
2531
+ /**
2532
+ * Who gets the site's notification emails: new orders, and form submissions
2533
+ * for forms without their own recipients. Not a checkout setting, and a
2534
+ * forms-only site needs it too, so it doesn't wait for payments to be active.
2535
+ */
2536
+ declare function NotificationRecipientsSettings({ siteId, refreshKey, className, }: NotificationRecipientsSettingsProps): react_jsx_runtime.JSX.Element;
2537
+
2337
2538
  interface WebhookSettingsProps {
2338
2539
  /**
2339
2540
  * The form these webhooks are attached to.
@@ -2479,6 +2680,14 @@ interface InvoicesViewProps {
2479
2680
  onConnectStripe?: InvoicesListProps["onConnectStripe"];
2480
2681
  onUpgradePlan?: InvoicesListProps["onUpgradePlan"];
2481
2682
  needsPaidPlan?: boolean;
2683
+ /**
2684
+ * The aifeatures site id (must match the provider's site token). Given, the
2685
+ * view offers "Invoice settings": invoice defaults and the tax printed on
2686
+ * receipts and invoices. Pass it only to viewers who may change them.
2687
+ */
2688
+ siteId?: string;
2689
+ /** Owner-only save for the invoice defaults; omit and they render read-only. */
2690
+ onSaveInvoiceSettings?: (input: StoreInvoiceSettingsInput) => Promise<void>;
2482
2691
  className?: string;
2483
2692
  }
2484
2693
  /**
@@ -2488,7 +2697,7 @@ interface InvoicesViewProps {
2488
2697
  * list and detail. Ephemeral like OrdersView: top-level list state on every
2489
2698
  * swap, except the deep-open.
2490
2699
  */
2491
- declare function InvoicesView({ refreshKey, initialInvoiceId, onBackToWebsite, onConnectStripe, onUpgradePlan, needsPaidPlan, className }: InvoicesViewProps): react_jsx_runtime.JSX.Element;
2700
+ declare function InvoicesView({ refreshKey, initialInvoiceId, onBackToWebsite, onConnectStripe, onUpgradePlan, needsPaidPlan, siteId, onSaveInvoiceSettings, className }: InvoicesViewProps): react_jsx_runtime.JSX.Element;
2492
2701
 
2493
2702
  declare function RetainerStatusBadge({ retainer, className }: {
2494
2703
  retainer: Pick<Retainer, "status" | "paused_by" | "skip_next_cycle">;
@@ -2512,9 +2721,11 @@ interface RetainersPanelProps {
2512
2721
  /** The series on screen: live only, or the ended ones too. Omit to hide the toggle. */
2513
2722
  includeEnded?: boolean;
2514
2723
  onIncludeEndedChange?: (includeEnded: boolean) => void;
2724
+ /** Fetches the series on screen as CSV (every page). Omit to hide the Export CSV button. */
2725
+ exportCsv?: () => Promise<Blob>;
2515
2726
  className?: string;
2516
2727
  }
2517
- declare function RetainersPanel({ retainers, isLoading, error, onRetry, onShowCycles, activeRetainerId, total, endedTotal, isLoadingMore, onLoadMore, includeEnded, onIncludeEndedChange, className }: RetainersPanelProps): react_jsx_runtime.JSX.Element | null;
2728
+ 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
2729
 
2519
2730
  /** Shared merchant dashboard surface; all writes use the same API as agent tools. */
2520
2731
  declare function PromosPanel(): react_jsx_runtime.JSX.Element;
@@ -2603,6 +2814,8 @@ interface UseOrdersReturn {
2603
2814
  */
2604
2815
  unfulfilledOnly: boolean;
2605
2816
  setUnfulfilledOnly: (only: boolean) => void;
2817
+ /** The server filters in effect (no paging) — what a CSV export of this list should send. */
2818
+ filters: ExportOrdersOptions;
2606
2819
  /** Clears every filter (status, email, dates) and returns to the first page. */
2607
2820
  clearFilters: () => void;
2608
2821
  refetch: () => Promise<void>;
@@ -2647,6 +2860,25 @@ interface UseCustomersOptions {
2647
2860
  }
2648
2861
  declare function useCustomers({ initialPageSize, }?: UseCustomersOptions): UseCustomersReturn;
2649
2862
 
2863
+ interface UseCsvExportOptions {
2864
+ /** Fetches the whole CSV (e.g. `() => api.exportCustomersCsv()`). */
2865
+ fetchCsv: () => Promise<Blob>;
2866
+ /** File name base; saved as `<base>-YYYY-MM-DD.csv`. */
2867
+ filename: string;
2868
+ }
2869
+ interface UseCsvExportReturn {
2870
+ exportCsv: () => Promise<void>;
2871
+ exporting: boolean;
2872
+ /** Set when the last export failed; cleared when the next one starts. */
2873
+ error: Error | null;
2874
+ }
2875
+ /**
2876
+ * Download a server-assembled CSV. Guards double-clicks while one is in
2877
+ * flight; a failed fetch (including a stream that errors mid-file) surfaces
2878
+ * as `error` and saves nothing, never a truncated file.
2879
+ */
2880
+ declare function useCsvExport({ fetchCsv, filename }: UseCsvExportOptions): UseCsvExportReturn;
2881
+
2650
2882
  interface UseBusinessSummaryOptions {
2651
2883
  /**
2652
2884
  * Bump to force a refetch (view data freshness, plan D11) — the host
@@ -2668,6 +2900,7 @@ interface UseBusinessSummaryReturn {
2668
2900
  */
2669
2901
  declare function useBusinessSummary({ refreshKey, }?: UseBusinessSummaryOptions): UseBusinessSummaryReturn;
2670
2902
 
2903
+ type PeopleSource = NonNullable<GetPeopleOptions['source']>;
2671
2904
  interface UsePeopleOptions {
2672
2905
  initialPageSize?: number;
2673
2906
  /**
@@ -2694,6 +2927,13 @@ interface UsePeopleReturn {
2694
2927
  /** Free-text filter (email/name). Resets to the first page. */
2695
2928
  q: string;
2696
2929
  setQ: (q: string) => void;
2930
+ /**
2931
+ * Only people with this source (the Leads view's Customers / Leads tabs);
2932
+ * undefined is everyone. Filtered server-side before paging, so every page
2933
+ * is a full page of that tab. Resets to the first page.
2934
+ */
2935
+ source: PeopleSource | undefined;
2936
+ setSource: (source: PeopleSource | undefined) => void;
2697
2937
  refetch: () => Promise<void>;
2698
2938
  }
2699
2939
  /**
@@ -2843,6 +3083,8 @@ interface UseRetainersReturn {
2843
3083
  setIncludeEnded: (includeEnded: boolean) => void;
2844
3084
  loadMore: () => Promise<void>;
2845
3085
  refetch: () => Promise<void>;
3086
+ /** The series' server filters (no paging) — what a CSV export of it should send. */
3087
+ filters: ExportRetainersOptions;
2846
3088
  }
2847
3089
  interface UseRetainersOptions {
2848
3090
  /** Bump to refetch (view data freshness). */
@@ -3017,6 +3259,43 @@ declare function useRealtimeVisitors(options?: {
3017
3259
  identity?: string | null;
3018
3260
  }): UseRealtimeVisitorsReturn;
3019
3261
 
3262
+ interface UseSiteSettingsOptions {
3263
+ /** The aifeatures site id. Must be the site the provider's token belongs to. */
3264
+ siteId: string;
3265
+ /**
3266
+ * Change it to refetch (e.g. the editor's turn-end refresh signal). The
3267
+ * refetch is silent: `isLoading` stays false and the current values stay on
3268
+ * screen until the fresh ones land, so nothing remounts.
3269
+ */
3270
+ refreshKey?: unknown;
3271
+ /**
3272
+ * Owner-only. Saves invoice defaults through the host (an owner-checked
3273
+ * mutation). Resolve on success; reject with an Error whose message is shown
3274
+ * to the merchant. Omit and invoice defaults are read-only.
3275
+ */
3276
+ onSaveInvoiceSettings?: (input: StoreInvoiceSettingsInput) => Promise<void>;
3277
+ }
3278
+ interface UseSiteSettingsReturn {
3279
+ site: SiteSettings | null;
3280
+ /** True until the first load settles, and again after `siteId` or the api client changes. */
3281
+ isLoading: boolean;
3282
+ /**
3283
+ * The last load error. A failed refetch keeps the previous `site`; a host
3284
+ * save whose re-read failed keeps the saved values and sets this too.
3285
+ */
3286
+ error: Error | null;
3287
+ refetch: () => Promise<void>;
3288
+ /** PATCH /sites/:id with the site token. Rejects on failure; `site` is left unchanged. */
3289
+ updateSite: (input: UpdateSiteSettingsInput) => Promise<UpdateSiteSettingsResult>;
3290
+ /**
3291
+ * Calls the host's `onSaveInvoiceSettings`, then re-reads the site and
3292
+ * resolves with it (with the saved values merged in if only the re-read
3293
+ * failed). Null when the host gave no callback (read-only).
3294
+ */
3295
+ saveInvoiceSettings: ((input: StoreInvoiceSettingsInput) => Promise<SiteSettings | null>) | null;
3296
+ }
3297
+ declare function useSiteSettings({ siteId, refreshKey, onSaveInvoiceSettings, }: UseSiteSettingsOptions): UseSiteSettingsReturn;
3298
+
3020
3299
  declare function isZeroDecimalCurrency(currency: string): boolean;
3021
3300
  /**
3022
3301
  * Format a minor-unit amount for display ("$29.00", "¥1,500").
@@ -3278,4 +3557,4 @@ interface DashboardViewProps {
3278
3557
  */
3279
3558
  declare function DashboardView({ refreshKey, onBackToWebsite, primaryConversion, onChangePrimaryConversion, onOpenSurface, needsPaidPlan, onUpgradePlan, onConnectStripe, }: DashboardViewProps): react_jsx_runtime.JSX.Element;
3280
3559
 
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 };
3560
+ 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 };