@aifeatures/admin-react 0.17.0 → 0.19.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
@@ -1544,6 +1544,69 @@ type AnalyticsConversions = {
1544
1544
  } | {
1545
1545
  status: 'unreachable';
1546
1546
  };
1547
+ /**
1548
+ * One value behind a goal's conversions — a link, a file, a number, a form.
1549
+ *
1550
+ * `label` is what to show and `target` is what to store: for a form they
1551
+ * differ, because the label is the form's CURRENT name (resolved as the report
1552
+ * runs, so renaming rewrites its history rather than splitting it) while the
1553
+ * target is the endpoint it posts to.
1554
+ */
1555
+ interface AnalyticsGoalTargetRow {
1556
+ /** The value exactly as the page authored it, or the path for a `page` row. */
1557
+ target: string;
1558
+ /** What to show. Identical to `target` except for a form, which is named. */
1559
+ label: string;
1560
+ visitors: number;
1561
+ events: number;
1562
+ conversion_rate: number | null;
1563
+ }
1564
+ /**
1565
+ * One goal's values, ranked.
1566
+ *
1567
+ * NOT EVERY GOAL HAS ANY. The value is the link the page authored, so it
1568
+ * exists for outbound clicks, downloads, contact taps and the two form goals —
1569
+ * and does not exist for `Purchase` (nothing in a payment names a page-level
1570
+ * thing) or for a goal matching a path or a scroll depth. Asking about one of
1571
+ * those is a 400 naming the goal, deliberately, because an empty list reads as
1572
+ * "no conversions" when the truth is "this goal has no values".
1573
+ */
1574
+ type AnalyticsGoalTargets = {
1575
+ status: 'ok';
1576
+ data: AnalyticsGoalTargetRow[];
1577
+ window: {
1578
+ from: string;
1579
+ to: string;
1580
+ };
1581
+ timezone: string;
1582
+ /** Echoed back, so a client can label the table without trusting its own request. */
1583
+ goal: string;
1584
+ dimension: 'target' | 'page';
1585
+ denominator: number;
1586
+ /** True when more distinct values exist than were returned. */
1587
+ truncated: boolean;
1588
+ /**
1589
+ * What share of the goal these rows explain — and it must be rendered
1590
+ * whenever the two numbers differ.
1591
+ *
1592
+ * A value is recorded only from the deploy that began sending one, so a
1593
+ * goal with a long history can show a breakdown covering a sliver of
1594
+ * it: measured on one site the day before forms began carrying theirs,
1595
+ * 8,430 submissions and none with a value. An EMPTY list is therefore
1596
+ * not evidence of no conversions — `goal_events > 0` with
1597
+ * `with_a_value === 0` means they happened and their values were never
1598
+ * recorded, which is a different sentence entirely.
1599
+ *
1600
+ * Null means coverage could not be established, which is NOT zero
1601
+ * coverage.
1602
+ */
1603
+ coverage: {
1604
+ goal_events: number;
1605
+ with_a_value: number;
1606
+ } | null;
1607
+ } | {
1608
+ status: 'unreachable';
1609
+ };
1547
1610
  type AnalyticsChannels = AnalyticsSourced<AnalyticsChannelRow[]>;
1548
1611
  type AnalyticsBreakdown = AnalyticsSourced<AnalyticsBreakdownRow[]>;
1549
1612
  /** Realtime sits outside the historical window, so it carries an as-of instant. */
@@ -1731,6 +1794,19 @@ interface AifeaturesApiClient {
1731
1794
  * cards on one page divide by different wholes while both said "rate".
1732
1795
  */
1733
1796
  getAnalyticsConversions(period: AnalyticsPeriod): Promise<AnalyticsConversions>;
1797
+ /**
1798
+ * The values behind one goal's conversions, ranked.
1799
+ *
1800
+ * REJECTS SOME GOALS BY DESIGN: `Purchase` and any goal matching a path
1801
+ * or a scroll depth have no value to point at, and the server answers a
1802
+ * 400 naming the goal rather than an empty list — an empty list would
1803
+ * read as "no conversions" when the truth is "this goal has no values".
1804
+ * A caller offering target narrowing must treat that as "not narrowable",
1805
+ * not as a failure.
1806
+ */
1807
+ getAnalyticsGoalTargets(goal: string, period: AnalyticsPeriod,
1808
+ /** 1-100, server default 20. Read `truncated` to learn more exist. */
1809
+ limit?: number): Promise<AnalyticsGoalTargets>;
1734
1810
  /** One ranked breakdown, named by its path segment. */
1735
1811
  getAnalyticsBreakdown(name: AnalyticsBreakdownName, period: AnalyticsPeriod, filters?: AnalyticsFilter[]): Promise<AnalyticsBreakdown>;
1736
1812
  getEventDestinations(): Promise<EventDestination[]>;
@@ -1764,13 +1840,32 @@ interface AifeaturesProviderProps {
1764
1840
  declare function AifeaturesProvider({ siteToken, apiUrl, dark, className, children, }: AifeaturesProviderProps): react_jsx_runtime.JSX.Element;
1765
1841
  declare function useAifeaturesContext(): AifeaturesContextValue;
1766
1842
 
1843
+ type FormsTab = 'submissions' | 'settings';
1844
+ /**
1845
+ * Where the dashboard is. Every field is optional: none is the forms list, a
1846
+ * formId opens that form, and a submissionId opens that submission (its form
1847
+ * is looked up when formId is absent, so a bare submission id is a full link).
1848
+ */
1849
+ interface FormsLocation {
1850
+ formId?: string;
1851
+ tab?: FormsTab;
1852
+ submissionId?: string;
1853
+ }
1767
1854
  interface FormsDashboardProps {
1768
1855
  /** Optional className */
1769
1856
  className?: string;
1770
- /** Submission ID to deep link to (opens form and shows submission detail) */
1857
+ /**
1858
+ * Controlled location — pass with `onNavigate` to keep the dashboard in the
1859
+ * host's URL, so a form, tab or submission can be linked to and the browser
1860
+ * back button works. Without `onNavigate` the dashboard keeps its own.
1861
+ */
1862
+ location?: FormsLocation;
1863
+ /** Called with the next location on every navigation inside the dashboard */
1864
+ onNavigate?: (location: FormsLocation) => void;
1865
+ /** Submission ID to open on mount (uncontrolled mode) */
1771
1866
  submissionId?: string;
1772
1867
  }
1773
- declare function FormsDashboard({ className, submissionId }: FormsDashboardProps): react_jsx_runtime.JSX.Element;
1868
+ declare function FormsDashboard({ className, location: controlledLocation, onNavigate, submissionId, }: FormsDashboardProps): react_jsx_runtime.JSX.Element;
1774
1869
 
1775
1870
  interface FormsListProps {
1776
1871
  /** Called when a form is selected */
@@ -1785,10 +1880,14 @@ interface FormSubmissionsProps {
1785
1880
  formId: string;
1786
1881
  /** Optional className */
1787
1882
  className?: string;
1788
- /** Submission ID to auto-open in detail view */
1883
+ /** Submission ID to auto-open in detail view (uncontrolled) */
1789
1884
  defaultSubmissionId?: string;
1885
+ /** Open submission (controlled) — pass with `onSelectSubmission` */
1886
+ submissionId?: string;
1887
+ /** Called with a submission id when one is opened, null on back */
1888
+ onSelectSubmission?: (submissionId: string | null) => void;
1790
1889
  }
1791
- declare function FormSubmissions({ formId, className, defaultSubmissionId }: FormSubmissionsProps): react_jsx_runtime.JSX.Element;
1890
+ declare function FormSubmissions({ formId, className, defaultSubmissionId, submissionId, onSelectSubmission, }: FormSubmissionsProps): react_jsx_runtime.JSX.Element;
1792
1891
 
1793
1892
  interface FormSettingsProps {
1794
1893
  /** The form to edit */
@@ -3038,6 +3137,20 @@ interface PrimaryConversion {
3038
3137
  * guessed: a host that forgets this gets the generic line, which is less
3039
3138
  * specific but never wrong. The opposite default would be wrong exactly
3040
3139
  * where it is hardest to notice.
3140
+ *
3141
+ * WHEN IT ARRIVES FROM THE PICKER IT IS AS-OF THE MOMENT THE LIST LOADED,
3142
+ * and a host PERSISTING a marker must re-derive it from the live report
3143
+ * rather than storing this value. Goals are resolved by display NAME, so a
3144
+ * name can change hands between the list loading and the choice being made:
3145
+ * delete a pre-reservation custom `Contact` and the built-in `Contact`
3146
+ * takes its place, with the opposite `implicit`. Storing the stale flag
3147
+ * would produce a marker that matches no current conversion.
3148
+ *
3149
+ * The reference host does this — its mutation accepts only the goal and an
3150
+ * optional target, and reads `implicit` off the matching conversions row as
3151
+ * it writes. A host that cannot re-derive should expect the picker to flag
3152
+ * the marker as stale the next time it opens, which is the recovery path
3153
+ * rather than a prevention.
3041
3154
  */
3042
3155
  implicit?: boolean;
3043
3156
  /** One target under that goal, or null/undefined for "any target". */
@@ -3120,6 +3233,16 @@ interface DashboardViewProps {
3120
3233
  * site nobody has marked yet.
3121
3234
  */
3122
3235
  primaryConversion?: PrimaryConversion | null;
3236
+ /**
3237
+ * Hand this in and the headline becomes editable: the merchant picks from
3238
+ * the conversions their own site reports, or clears the marker.
3239
+ *
3240
+ * The host persists it — the package has no idea where a marker lives, and
3241
+ * a control that discarded the change would be worse than no control. Its
3242
+ * absence is a real state: a host that cannot persist one gets 0.17.0's
3243
+ * read-only line, and an unmarked site then renders nothing at all.
3244
+ */
3245
+ onChangePrimaryConversion?: (next: PrimaryConversion | null) => void;
3123
3246
  /**
3124
3247
  * Host callback to change the active surface. Without it the storefront
3125
3248
  * entries render nothing, because a panel that claims to lead somewhere and
@@ -3153,6 +3276,6 @@ interface DashboardViewProps {
3153
3276
  * own call and fails alone. Nothing here claims per-panel isolation it does
3154
3277
  * not have.
3155
3278
  */
3156
- declare function DashboardView({ refreshKey, onBackToWebsite, primaryConversion, onOpenSurface, needsPaidPlan, onUpgradePlan, onConnectStripe, }: DashboardViewProps): react_jsx_runtime.JSX.Element;
3279
+ declare function DashboardView({ refreshKey, onBackToWebsite, primaryConversion, onChangePrimaryConversion, onOpenSurface, needsPaidPlan, onUpgradePlan, onConnectStripe, }: DashboardViewProps): react_jsx_runtime.JSX.Element;
3157
3280
 
3158
- 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 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 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1544,6 +1544,69 @@ type AnalyticsConversions = {
1544
1544
  } | {
1545
1545
  status: 'unreachable';
1546
1546
  };
1547
+ /**
1548
+ * One value behind a goal's conversions — a link, a file, a number, a form.
1549
+ *
1550
+ * `label` is what to show and `target` is what to store: for a form they
1551
+ * differ, because the label is the form's CURRENT name (resolved as the report
1552
+ * runs, so renaming rewrites its history rather than splitting it) while the
1553
+ * target is the endpoint it posts to.
1554
+ */
1555
+ interface AnalyticsGoalTargetRow {
1556
+ /** The value exactly as the page authored it, or the path for a `page` row. */
1557
+ target: string;
1558
+ /** What to show. Identical to `target` except for a form, which is named. */
1559
+ label: string;
1560
+ visitors: number;
1561
+ events: number;
1562
+ conversion_rate: number | null;
1563
+ }
1564
+ /**
1565
+ * One goal's values, ranked.
1566
+ *
1567
+ * NOT EVERY GOAL HAS ANY. The value is the link the page authored, so it
1568
+ * exists for outbound clicks, downloads, contact taps and the two form goals —
1569
+ * and does not exist for `Purchase` (nothing in a payment names a page-level
1570
+ * thing) or for a goal matching a path or a scroll depth. Asking about one of
1571
+ * those is a 400 naming the goal, deliberately, because an empty list reads as
1572
+ * "no conversions" when the truth is "this goal has no values".
1573
+ */
1574
+ type AnalyticsGoalTargets = {
1575
+ status: 'ok';
1576
+ data: AnalyticsGoalTargetRow[];
1577
+ window: {
1578
+ from: string;
1579
+ to: string;
1580
+ };
1581
+ timezone: string;
1582
+ /** Echoed back, so a client can label the table without trusting its own request. */
1583
+ goal: string;
1584
+ dimension: 'target' | 'page';
1585
+ denominator: number;
1586
+ /** True when more distinct values exist than were returned. */
1587
+ truncated: boolean;
1588
+ /**
1589
+ * What share of the goal these rows explain — and it must be rendered
1590
+ * whenever the two numbers differ.
1591
+ *
1592
+ * A value is recorded only from the deploy that began sending one, so a
1593
+ * goal with a long history can show a breakdown covering a sliver of
1594
+ * it: measured on one site the day before forms began carrying theirs,
1595
+ * 8,430 submissions and none with a value. An EMPTY list is therefore
1596
+ * not evidence of no conversions — `goal_events > 0` with
1597
+ * `with_a_value === 0` means they happened and their values were never
1598
+ * recorded, which is a different sentence entirely.
1599
+ *
1600
+ * Null means coverage could not be established, which is NOT zero
1601
+ * coverage.
1602
+ */
1603
+ coverage: {
1604
+ goal_events: number;
1605
+ with_a_value: number;
1606
+ } | null;
1607
+ } | {
1608
+ status: 'unreachable';
1609
+ };
1547
1610
  type AnalyticsChannels = AnalyticsSourced<AnalyticsChannelRow[]>;
1548
1611
  type AnalyticsBreakdown = AnalyticsSourced<AnalyticsBreakdownRow[]>;
1549
1612
  /** Realtime sits outside the historical window, so it carries an as-of instant. */
@@ -1731,6 +1794,19 @@ interface AifeaturesApiClient {
1731
1794
  * cards on one page divide by different wholes while both said "rate".
1732
1795
  */
1733
1796
  getAnalyticsConversions(period: AnalyticsPeriod): Promise<AnalyticsConversions>;
1797
+ /**
1798
+ * The values behind one goal's conversions, ranked.
1799
+ *
1800
+ * REJECTS SOME GOALS BY DESIGN: `Purchase` and any goal matching a path
1801
+ * or a scroll depth have no value to point at, and the server answers a
1802
+ * 400 naming the goal rather than an empty list — an empty list would
1803
+ * read as "no conversions" when the truth is "this goal has no values".
1804
+ * A caller offering target narrowing must treat that as "not narrowable",
1805
+ * not as a failure.
1806
+ */
1807
+ getAnalyticsGoalTargets(goal: string, period: AnalyticsPeriod,
1808
+ /** 1-100, server default 20. Read `truncated` to learn more exist. */
1809
+ limit?: number): Promise<AnalyticsGoalTargets>;
1734
1810
  /** One ranked breakdown, named by its path segment. */
1735
1811
  getAnalyticsBreakdown(name: AnalyticsBreakdownName, period: AnalyticsPeriod, filters?: AnalyticsFilter[]): Promise<AnalyticsBreakdown>;
1736
1812
  getEventDestinations(): Promise<EventDestination[]>;
@@ -1764,13 +1840,32 @@ interface AifeaturesProviderProps {
1764
1840
  declare function AifeaturesProvider({ siteToken, apiUrl, dark, className, children, }: AifeaturesProviderProps): react_jsx_runtime.JSX.Element;
1765
1841
  declare function useAifeaturesContext(): AifeaturesContextValue;
1766
1842
 
1843
+ type FormsTab = 'submissions' | 'settings';
1844
+ /**
1845
+ * Where the dashboard is. Every field is optional: none is the forms list, a
1846
+ * formId opens that form, and a submissionId opens that submission (its form
1847
+ * is looked up when formId is absent, so a bare submission id is a full link).
1848
+ */
1849
+ interface FormsLocation {
1850
+ formId?: string;
1851
+ tab?: FormsTab;
1852
+ submissionId?: string;
1853
+ }
1767
1854
  interface FormsDashboardProps {
1768
1855
  /** Optional className */
1769
1856
  className?: string;
1770
- /** Submission ID to deep link to (opens form and shows submission detail) */
1857
+ /**
1858
+ * Controlled location — pass with `onNavigate` to keep the dashboard in the
1859
+ * host's URL, so a form, tab or submission can be linked to and the browser
1860
+ * back button works. Without `onNavigate` the dashboard keeps its own.
1861
+ */
1862
+ location?: FormsLocation;
1863
+ /** Called with the next location on every navigation inside the dashboard */
1864
+ onNavigate?: (location: FormsLocation) => void;
1865
+ /** Submission ID to open on mount (uncontrolled mode) */
1771
1866
  submissionId?: string;
1772
1867
  }
1773
- declare function FormsDashboard({ className, submissionId }: FormsDashboardProps): react_jsx_runtime.JSX.Element;
1868
+ declare function FormsDashboard({ className, location: controlledLocation, onNavigate, submissionId, }: FormsDashboardProps): react_jsx_runtime.JSX.Element;
1774
1869
 
1775
1870
  interface FormsListProps {
1776
1871
  /** Called when a form is selected */
@@ -1785,10 +1880,14 @@ interface FormSubmissionsProps {
1785
1880
  formId: string;
1786
1881
  /** Optional className */
1787
1882
  className?: string;
1788
- /** Submission ID to auto-open in detail view */
1883
+ /** Submission ID to auto-open in detail view (uncontrolled) */
1789
1884
  defaultSubmissionId?: string;
1885
+ /** Open submission (controlled) — pass with `onSelectSubmission` */
1886
+ submissionId?: string;
1887
+ /** Called with a submission id when one is opened, null on back */
1888
+ onSelectSubmission?: (submissionId: string | null) => void;
1790
1889
  }
1791
- declare function FormSubmissions({ formId, className, defaultSubmissionId }: FormSubmissionsProps): react_jsx_runtime.JSX.Element;
1890
+ declare function FormSubmissions({ formId, className, defaultSubmissionId, submissionId, onSelectSubmission, }: FormSubmissionsProps): react_jsx_runtime.JSX.Element;
1792
1891
 
1793
1892
  interface FormSettingsProps {
1794
1893
  /** The form to edit */
@@ -3038,6 +3137,20 @@ interface PrimaryConversion {
3038
3137
  * guessed: a host that forgets this gets the generic line, which is less
3039
3138
  * specific but never wrong. The opposite default would be wrong exactly
3040
3139
  * where it is hardest to notice.
3140
+ *
3141
+ * WHEN IT ARRIVES FROM THE PICKER IT IS AS-OF THE MOMENT THE LIST LOADED,
3142
+ * and a host PERSISTING a marker must re-derive it from the live report
3143
+ * rather than storing this value. Goals are resolved by display NAME, so a
3144
+ * name can change hands between the list loading and the choice being made:
3145
+ * delete a pre-reservation custom `Contact` and the built-in `Contact`
3146
+ * takes its place, with the opposite `implicit`. Storing the stale flag
3147
+ * would produce a marker that matches no current conversion.
3148
+ *
3149
+ * The reference host does this — its mutation accepts only the goal and an
3150
+ * optional target, and reads `implicit` off the matching conversions row as
3151
+ * it writes. A host that cannot re-derive should expect the picker to flag
3152
+ * the marker as stale the next time it opens, which is the recovery path
3153
+ * rather than a prevention.
3041
3154
  */
3042
3155
  implicit?: boolean;
3043
3156
  /** One target under that goal, or null/undefined for "any target". */
@@ -3120,6 +3233,16 @@ interface DashboardViewProps {
3120
3233
  * site nobody has marked yet.
3121
3234
  */
3122
3235
  primaryConversion?: PrimaryConversion | null;
3236
+ /**
3237
+ * Hand this in and the headline becomes editable: the merchant picks from
3238
+ * the conversions their own site reports, or clears the marker.
3239
+ *
3240
+ * The host persists it — the package has no idea where a marker lives, and
3241
+ * a control that discarded the change would be worse than no control. Its
3242
+ * absence is a real state: a host that cannot persist one gets 0.17.0's
3243
+ * read-only line, and an unmarked site then renders nothing at all.
3244
+ */
3245
+ onChangePrimaryConversion?: (next: PrimaryConversion | null) => void;
3123
3246
  /**
3124
3247
  * Host callback to change the active surface. Without it the storefront
3125
3248
  * entries render nothing, because a panel that claims to lead somewhere and
@@ -3153,6 +3276,6 @@ interface DashboardViewProps {
3153
3276
  * own call and fails alone. Nothing here claims per-panel isolation it does
3154
3277
  * not have.
3155
3278
  */
3156
- declare function DashboardView({ refreshKey, onBackToWebsite, primaryConversion, onOpenSurface, needsPaidPlan, onUpgradePlan, onConnectStripe, }: DashboardViewProps): react_jsx_runtime.JSX.Element;
3279
+ declare function DashboardView({ refreshKey, onBackToWebsite, primaryConversion, onChangePrimaryConversion, onOpenSurface, needsPaidPlan, onUpgradePlan, onConnectStripe, }: DashboardViewProps): react_jsx_runtime.JSX.Element;
3157
3280
 
3158
- 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 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 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 };
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 };