@aifeatures/admin-react 0.4.0 → 0.5.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 +3 -3
- package/dist/index.d.cts +168 -4
- package/dist/index.d.ts +168 -4
- package/dist/index.js +3 -3
- package/dist/styles.css +1 -1
- package/package.json +12 -11
package/dist/index.d.cts
CHANGED
|
@@ -10,7 +10,6 @@ interface Form {
|
|
|
10
10
|
endpoint_url: string;
|
|
11
11
|
email_recipients: string[];
|
|
12
12
|
redirect_url: string | null;
|
|
13
|
-
webhook_url: string | null;
|
|
14
13
|
turnstile_sitekey: string | null;
|
|
15
14
|
created_at: string;
|
|
16
15
|
updated_at: string;
|
|
@@ -70,7 +69,6 @@ interface CreateFormInput {
|
|
|
70
69
|
name: string;
|
|
71
70
|
email_recipients?: string[];
|
|
72
71
|
redirect_url?: string;
|
|
73
|
-
webhook_url?: string;
|
|
74
72
|
}
|
|
75
73
|
/**
|
|
76
74
|
* Input for updating a form
|
|
@@ -79,7 +77,6 @@ interface UpdateFormInput {
|
|
|
79
77
|
name?: string;
|
|
80
78
|
email_recipients?: string[];
|
|
81
79
|
redirect_url?: string | null;
|
|
82
|
-
webhook_url?: string | null;
|
|
83
80
|
}
|
|
84
81
|
/**
|
|
85
82
|
* Options for fetching submissions
|
|
@@ -894,6 +891,77 @@ interface GetSubscriptionsOptions {
|
|
|
894
891
|
limit?: number;
|
|
895
892
|
offset?: number;
|
|
896
893
|
}
|
|
894
|
+
/**
|
|
895
|
+
* An outbound webhook destination.
|
|
896
|
+
*
|
|
897
|
+
* The API calls these "event destinations" (the eventdestinations.org term,
|
|
898
|
+
* which leaves room for a queue or bus destination later); the dashboard says
|
|
899
|
+
* "Webhooks", the word a merchant wiring up Zapier already knows. Today every
|
|
900
|
+
* destination is an HTTPS webhook, so the two describe one object.
|
|
901
|
+
*/
|
|
902
|
+
interface EventDestination {
|
|
903
|
+
id: string;
|
|
904
|
+
site_id: string;
|
|
905
|
+
/** Set when the destination is scoped to a single form. Null = site-wide. */
|
|
906
|
+
form_id: string | null;
|
|
907
|
+
url: string;
|
|
908
|
+
/** Subscribed topics. `["*"]` receives every topic. */
|
|
909
|
+
topics: string[];
|
|
910
|
+
/**
|
|
911
|
+
* Payload version, pinned at creation and never rewritten. A future payload
|
|
912
|
+
* shape ships as a new version and this destination keeps receiving the one
|
|
913
|
+
* it was created with.
|
|
914
|
+
*/
|
|
915
|
+
api_version: string;
|
|
916
|
+
status: 'active' | 'disabled';
|
|
917
|
+
/** Why it was auto-disabled after repeated failures. Null while active. */
|
|
918
|
+
disabled_reason: string | null;
|
|
919
|
+
consecutive_failures: number;
|
|
920
|
+
created_at: string;
|
|
921
|
+
updated_at: string;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* The signing secret has exactly one endpoint. It is re-readable on demand
|
|
925
|
+
* rather than shown once, because verifying deliveries is optional and most
|
|
926
|
+
* merchants never do it — a copy-it-now moment would be a task imposed on
|
|
927
|
+
* everyone for the benefit of a few.
|
|
928
|
+
*/
|
|
929
|
+
interface EventDestinationSecretResponse {
|
|
930
|
+
secret: string;
|
|
931
|
+
}
|
|
932
|
+
interface EventDestinationsListResponse {
|
|
933
|
+
destinations: EventDestination[];
|
|
934
|
+
}
|
|
935
|
+
interface CreateEventDestinationInput {
|
|
936
|
+
url: string;
|
|
937
|
+
topics?: string[];
|
|
938
|
+
/** Required: every destination belongs to exactly one form. */
|
|
939
|
+
form_id: string;
|
|
940
|
+
}
|
|
941
|
+
interface UpdateEventDestinationInput {
|
|
942
|
+
url?: string;
|
|
943
|
+
topics?: string[];
|
|
944
|
+
status?: 'active' | 'disabled';
|
|
945
|
+
}
|
|
946
|
+
/** One attempt record from a destination's delivery log. */
|
|
947
|
+
interface EventDelivery {
|
|
948
|
+
id: string;
|
|
949
|
+
destination_id: string;
|
|
950
|
+
/** Sent as the webhook-id header; stable across retries. */
|
|
951
|
+
event_id: string;
|
|
952
|
+
type: string;
|
|
953
|
+
/** The exact JSON body that was (or will be) POSTed. */
|
|
954
|
+
payload: string;
|
|
955
|
+
attempts: number;
|
|
956
|
+
next_attempt_at: string;
|
|
957
|
+
delivered_at: string | null;
|
|
958
|
+
last_error: string | null;
|
|
959
|
+
last_status: number | null;
|
|
960
|
+
created_at: string;
|
|
961
|
+
}
|
|
962
|
+
interface EventDeliveriesListResponse {
|
|
963
|
+
deliveries: EventDelivery[];
|
|
964
|
+
}
|
|
897
965
|
|
|
898
966
|
declare class AifeaturesApiError extends Error {
|
|
899
967
|
status: number;
|
|
@@ -948,6 +1016,15 @@ interface AifeaturesApiClient {
|
|
|
948
1016
|
getPeople(options?: GetPeopleOptions): Promise<PeopleListResponse>;
|
|
949
1017
|
/** Everything known about one person (customer record, orders, submissions). */
|
|
950
1018
|
getPerson(email: string): Promise<PersonDetail>;
|
|
1019
|
+
getEventDestinations(): Promise<EventDestination[]>;
|
|
1020
|
+
createEventDestination(input: CreateEventDestinationInput): Promise<EventDestination>;
|
|
1021
|
+
updateEventDestination(destinationId: string, input: UpdateEventDestinationInput): Promise<EventDestination>;
|
|
1022
|
+
deleteEventDestination(destinationId: string): Promise<void>;
|
|
1023
|
+
rotateEventDestinationSecret(destinationId: string): Promise<EventDestination>;
|
|
1024
|
+
/** Readable whenever needed; rotating replaces it. */
|
|
1025
|
+
getEventDestinationSecret(destinationId: string): Promise<string>;
|
|
1026
|
+
getEventDeliveries(destinationId: string, limit?: number): Promise<EventDelivery[]>;
|
|
1027
|
+
retryEventDelivery(destinationId: string, deliveryId: string): Promise<EventDelivery>;
|
|
951
1028
|
}
|
|
952
1029
|
declare function createApiClient(siteToken: string, apiUrl?: string): AifeaturesApiClient;
|
|
953
1030
|
|
|
@@ -1383,6 +1460,79 @@ interface SubscriptionsViewProps {
|
|
|
1383
1460
|
*/
|
|
1384
1461
|
declare function SubscriptionsView({ refreshKey, onBackToWebsite, className, }: SubscriptionsViewProps): react_jsx_runtime.JSX.Element;
|
|
1385
1462
|
|
|
1463
|
+
interface WebhookSettingsProps {
|
|
1464
|
+
/**
|
|
1465
|
+
* The form these webhooks are attached to.
|
|
1466
|
+
*
|
|
1467
|
+
* Required today because the API requires `form_id` on create, which is
|
|
1468
|
+
* true only while every topic is a form topic. When payments topics land
|
|
1469
|
+
* (order.paid and friends have no form), that requirement relaxes and this
|
|
1470
|
+
* becomes optional in the same change — see the note on the component.
|
|
1471
|
+
*/
|
|
1472
|
+
formId: string;
|
|
1473
|
+
/**
|
|
1474
|
+
* Topics new webhooks subscribe to. Defaults to `['*']` — everything,
|
|
1475
|
+
* including topics added later.
|
|
1476
|
+
*
|
|
1477
|
+
* This is the knob that makes the component context-scoped rather than
|
|
1478
|
+
* form-specific: a payments surface mounts the same component with payment
|
|
1479
|
+
* topics, and the merchant sees "webhooks for this thing" wherever they
|
|
1480
|
+
* already are.
|
|
1481
|
+
*/
|
|
1482
|
+
topics?: string[];
|
|
1483
|
+
/** Blurb above the list. Defaults to the form wording. */
|
|
1484
|
+
description?: string;
|
|
1485
|
+
className?: string;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Webhook management, scoped to whatever context it is mounted in.
|
|
1489
|
+
*
|
|
1490
|
+
* The API calls these "event destinations"; this surface says "Webhooks",
|
|
1491
|
+
* which is the word a merchant connecting Zapier or Make already has.
|
|
1492
|
+
*
|
|
1493
|
+
* NOT a forms component. Webhooks carry every kind of event we emit; showing
|
|
1494
|
+
* them inside a form's settings is a way of SCOPING them to the context the
|
|
1495
|
+
* merchant is already thinking in, not a statement about what they can carry.
|
|
1496
|
+
* A payments surface mounts this same component with payment topics.
|
|
1497
|
+
*
|
|
1498
|
+
* There is deliberately no "all webhooks" screen. Offering one would ask
|
|
1499
|
+
* every merchant to choose between scopes that are the same thing for them —
|
|
1500
|
+
* the typical site has a single form — so each mounting stays contextual.
|
|
1501
|
+
*
|
|
1502
|
+
* Two things here are load-bearing rather than decorative:
|
|
1503
|
+
*
|
|
1504
|
+
* - Adding a webhook is not an event. The row simply appears; there is no
|
|
1505
|
+
* dialog to dismiss, because there is nothing the merchant must do next.
|
|
1506
|
+
* The signing secret is OPTIONAL and re-readable, fetched only when
|
|
1507
|
+
* someone opens its panel, so it never becomes a copy-it-now task imposed
|
|
1508
|
+
* on people who will never verify a signature.
|
|
1509
|
+
* - A destination that failed repeatedly is auto-disabled by the backend.
|
|
1510
|
+
* That state has to be visible and self-serviceable, or the first a
|
|
1511
|
+
* merchant hears of it is a customer asking why leads stopped arriving.
|
|
1512
|
+
*/
|
|
1513
|
+
declare function WebhookSettings({ formId, topics, description, className, }: WebhookSettingsProps): react_jsx_runtime.JSX.Element;
|
|
1514
|
+
|
|
1515
|
+
interface WebhookDeliveriesProps {
|
|
1516
|
+
destinationId: string;
|
|
1517
|
+
/** How many rows to load. The API caps this at 100. */
|
|
1518
|
+
limit?: number;
|
|
1519
|
+
className?: string;
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* The delivery log for one webhook: what we sent, when, and what came back.
|
|
1523
|
+
*
|
|
1524
|
+
* This is the answer to the only two questions a merchant ever asks about a
|
|
1525
|
+
* webhook — "did it fire?" and "why didn't it work?" — and it is why the
|
|
1526
|
+
* backend materialises one row per destination per event rather than one row
|
|
1527
|
+
* per event. Without it the merchant's only recourse is to ask support, and
|
|
1528
|
+
* support's only recourse is to read Workers logs.
|
|
1529
|
+
*
|
|
1530
|
+
* Retry re-sends the STORED bytes, so the consumer sees the same webhook-id
|
|
1531
|
+
* and can deduplicate. That also means a retry is safe to offer for rows that
|
|
1532
|
+
* already delivered — replaying into a rebuilt consumer is a real use.
|
|
1533
|
+
*/
|
|
1534
|
+
declare function WebhookDeliveries({ destinationId, limit, className, }: WebhookDeliveriesProps): react_jsx_runtime.JSX.Element;
|
|
1535
|
+
|
|
1386
1536
|
interface UseFormsReturn {
|
|
1387
1537
|
forms: Form[];
|
|
1388
1538
|
isLoading: boolean;
|
|
@@ -1622,6 +1772,20 @@ interface UseSubscriptionsOptions {
|
|
|
1622
1772
|
*/
|
|
1623
1773
|
declare function useSubscriptions({ initialPageSize, refreshKey, }?: UseSubscriptionsOptions): UseSubscriptionsReturn;
|
|
1624
1774
|
|
|
1775
|
+
interface UseEventDestinationsReturn {
|
|
1776
|
+
destinations: EventDestination[];
|
|
1777
|
+
isLoading: boolean;
|
|
1778
|
+
error: Error | null;
|
|
1779
|
+
refetch: () => Promise<void>;
|
|
1780
|
+
createDestination: (input: CreateEventDestinationInput) => Promise<EventDestination>;
|
|
1781
|
+
updateDestination: (destinationId: string, input: UpdateEventDestinationInput) => Promise<EventDestination>;
|
|
1782
|
+
deleteDestination: (destinationId: string) => Promise<void>;
|
|
1783
|
+
rotateSecret: (destinationId: string) => Promise<EventDestination>;
|
|
1784
|
+
/** Read on demand; there is no shown-once moment to catch. */
|
|
1785
|
+
getSecret: (destinationId: string) => Promise<string>;
|
|
1786
|
+
}
|
|
1787
|
+
declare function useEventDestinations(): UseEventDestinationsReturn;
|
|
1788
|
+
|
|
1625
1789
|
declare function isZeroDecimalCurrency(currency: string): boolean;
|
|
1626
1790
|
/**
|
|
1627
1791
|
* Format a minor-unit amount for display ("$29.00", "¥1,500").
|
|
@@ -1664,4 +1828,4 @@ declare function toMinorUnits(major: string | number, currency: string): number
|
|
|
1664
1828
|
*/
|
|
1665
1829
|
declare function toMajorUnits(minor: number, currency: string): number;
|
|
1666
1830
|
|
|
1667
|
-
export { type AdjustInventoryInput, type AifeaturesApiClient, AifeaturesApiError, type AifeaturesContextValue, AifeaturesProvider, type AifeaturesProviderProps, type ApiError, type Attachment, type BusinessSummary, type CreateFormInput, type CreateOptionInput, type CreateProductInput, type CreateVariantInput, type Customer, type CustomerAddress, CustomerDetail, type CustomerDetail$1 as CustomerDetailData, type CustomerDetailProps, CustomersList, type CustomersListProps, type CustomersListResponse, type EmailSideStatus, type Form, FormSettings, type FormSettingsProps, FormSubmissions, type FormSubmissionsProps, FormsDashboard, type FormsDashboardProps, FormsList, type FormsListProps, type FormsListResponse, type GetBusinessSummaryOptions, type GetCustomersOptions, type GetOrdersOptions, type GetPeopleOptions, type GetProductsOptions, type GetSubmissionsOptions, type GetSubscriptionsOptions, LeadsView, type LeadsViewProps, type LowStockProduct, type NeedsAttentionItem, type NeedsAttentionType, type Order, OrderDetail, type OrderDetailProps, type OrderStatus, OrderStatusBadge, OrdersList, type OrdersListProps, OrdersView, type OrdersViewProps, type PaginatedOrders, type PaginatedSubmissions, type PaginatedSubscriptions, PaymentsDashboard, type PaymentsDashboardProps, PaymentsSetup, type PaymentsSetupProps, type PaymentsStatus, type PaymentsStatusReason, type PaymentsStatusResponse, type PeopleListResponse, type Person, type PersonDetail, type PersonOrder, type PersonSource, type PersonSubmission, type Product, type ProductDetail, type ProductFulfillment, type ProductFulfillmentType, type ProductOption, ProductSettings, type ProductSettingsProps, type ProductStats, type ProductVariant, ProductsList, type ProductsListProps, type ProductsListResponse, ProductsView, type ProductsViewProps, type RefundRequest, type RevenueCurrencyTotal, type RevenuePeriod, type SetInventoryInput, type SetOrderFulfillmentInput, type SettledRevenue, type Submission, SubmissionDetail, type SubmissionDetailProps, type SubmissionMetadata, type Subscription, SubscriptionsView, type SubscriptionsViewProps, type UpdateFormInput, type UpdateOptionInput, type UpdateProductInput, type UpdateVariantInput, type UseBusinessSummaryOptions, type UseBusinessSummaryReturn, type UseCustomersOptions, type UseCustomersReturn, type UseFormsReturn, type UseOrdersOptions, type UseOrdersReturn, type UsePaymentsStatusReturn, type UsePeopleOptions, type UsePeopleReturn, type UsePersonOptions, type UsePersonReturn, type UseProductsOptions, type UseProductsReturn, type UseSubmissionsOptions, type UseSubmissionsReturn, type UseSubscriptionsOptions, type UseSubscriptionsReturn, type VariantInventory, type VariantOptionValue, VariantsEditor, type VariantsEditorProps, ViewShell, type ViewShellProps, chargedTotal, createApiClient, formatPrice, isZeroDecimalCurrency, toMajorUnits, toMinorUnits, useAifeaturesContext as useAifeatures, useAifeaturesContext, useBusinessSummary, useCustomers, useForms, useOrders, usePaymentsStatus, usePeople, usePerson, useProducts, useSubmissions, useSubscriptions };
|
|
1831
|
+
export { type AdjustInventoryInput, type AifeaturesApiClient, AifeaturesApiError, type AifeaturesContextValue, AifeaturesProvider, type AifeaturesProviderProps, type ApiError, type Attachment, type BusinessSummary, type CreateEventDestinationInput, type CreateFormInput, type CreateOptionInput, type CreateProductInput, type CreateVariantInput, type Customer, type CustomerAddress, CustomerDetail, type CustomerDetail$1 as CustomerDetailData, type CustomerDetailProps, CustomersList, type CustomersListProps, type CustomersListResponse, type EmailSideStatus, type EventDeliveriesListResponse, type EventDelivery, type EventDestination, type EventDestinationSecretResponse, type EventDestinationsListResponse, type Form, FormSettings, type FormSettingsProps, FormSubmissions, type FormSubmissionsProps, FormsDashboard, type FormsDashboardProps, FormsList, type FormsListProps, type FormsListResponse, type GetBusinessSummaryOptions, type GetCustomersOptions, type GetOrdersOptions, type GetPeopleOptions, type GetProductsOptions, type GetSubmissionsOptions, type GetSubscriptionsOptions, LeadsView, type LeadsViewProps, type LowStockProduct, type NeedsAttentionItem, type NeedsAttentionType, type Order, OrderDetail, type OrderDetailProps, type OrderStatus, OrderStatusBadge, OrdersList, type OrdersListProps, OrdersView, type OrdersViewProps, type PaginatedOrders, type PaginatedSubmissions, type PaginatedSubscriptions, PaymentsDashboard, type PaymentsDashboardProps, PaymentsSetup, type PaymentsSetupProps, type PaymentsStatus, type PaymentsStatusReason, type PaymentsStatusResponse, type PeopleListResponse, type Person, type PersonDetail, type PersonOrder, type PersonSource, type PersonSubmission, type Product, type ProductDetail, type ProductFulfillment, type ProductFulfillmentType, type ProductOption, ProductSettings, type ProductSettingsProps, type ProductStats, type ProductVariant, ProductsList, type ProductsListProps, type ProductsListResponse, ProductsView, type ProductsViewProps, type RefundRequest, type RevenueCurrencyTotal, type RevenuePeriod, type SetInventoryInput, type SetOrderFulfillmentInput, type SettledRevenue, type Submission, SubmissionDetail, type SubmissionDetailProps, type SubmissionMetadata, type Subscription, SubscriptionsView, type SubscriptionsViewProps, type UpdateEventDestinationInput, type UpdateFormInput, type UpdateOptionInput, type UpdateProductInput, type UpdateVariantInput, type UseBusinessSummaryOptions, type UseBusinessSummaryReturn, type UseCustomersOptions, type UseCustomersReturn, type UseEventDestinationsReturn, type UseFormsReturn, type UseOrdersOptions, type UseOrdersReturn, type UsePaymentsStatusReturn, type UsePeopleOptions, type UsePeopleReturn, type UsePersonOptions, type UsePersonReturn, type UseProductsOptions, type UseProductsReturn, type UseSubmissionsOptions, type UseSubmissionsReturn, type UseSubscriptionsOptions, type UseSubscriptionsReturn, type VariantInventory, type VariantOptionValue, VariantsEditor, type VariantsEditorProps, ViewShell, type ViewShellProps, WebhookDeliveries, type WebhookDeliveriesProps, WebhookSettings, type WebhookSettingsProps, chargedTotal, createApiClient, formatPrice, isZeroDecimalCurrency, toMajorUnits, toMinorUnits, useAifeaturesContext as useAifeatures, useAifeaturesContext, useBusinessSummary, useCustomers, useEventDestinations, useForms, useOrders, usePaymentsStatus, usePeople, usePerson, useProducts, useSubmissions, useSubscriptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ interface Form {
|
|
|
10
10
|
endpoint_url: string;
|
|
11
11
|
email_recipients: string[];
|
|
12
12
|
redirect_url: string | null;
|
|
13
|
-
webhook_url: string | null;
|
|
14
13
|
turnstile_sitekey: string | null;
|
|
15
14
|
created_at: string;
|
|
16
15
|
updated_at: string;
|
|
@@ -70,7 +69,6 @@ interface CreateFormInput {
|
|
|
70
69
|
name: string;
|
|
71
70
|
email_recipients?: string[];
|
|
72
71
|
redirect_url?: string;
|
|
73
|
-
webhook_url?: string;
|
|
74
72
|
}
|
|
75
73
|
/**
|
|
76
74
|
* Input for updating a form
|
|
@@ -79,7 +77,6 @@ interface UpdateFormInput {
|
|
|
79
77
|
name?: string;
|
|
80
78
|
email_recipients?: string[];
|
|
81
79
|
redirect_url?: string | null;
|
|
82
|
-
webhook_url?: string | null;
|
|
83
80
|
}
|
|
84
81
|
/**
|
|
85
82
|
* Options for fetching submissions
|
|
@@ -894,6 +891,77 @@ interface GetSubscriptionsOptions {
|
|
|
894
891
|
limit?: number;
|
|
895
892
|
offset?: number;
|
|
896
893
|
}
|
|
894
|
+
/**
|
|
895
|
+
* An outbound webhook destination.
|
|
896
|
+
*
|
|
897
|
+
* The API calls these "event destinations" (the eventdestinations.org term,
|
|
898
|
+
* which leaves room for a queue or bus destination later); the dashboard says
|
|
899
|
+
* "Webhooks", the word a merchant wiring up Zapier already knows. Today every
|
|
900
|
+
* destination is an HTTPS webhook, so the two describe one object.
|
|
901
|
+
*/
|
|
902
|
+
interface EventDestination {
|
|
903
|
+
id: string;
|
|
904
|
+
site_id: string;
|
|
905
|
+
/** Set when the destination is scoped to a single form. Null = site-wide. */
|
|
906
|
+
form_id: string | null;
|
|
907
|
+
url: string;
|
|
908
|
+
/** Subscribed topics. `["*"]` receives every topic. */
|
|
909
|
+
topics: string[];
|
|
910
|
+
/**
|
|
911
|
+
* Payload version, pinned at creation and never rewritten. A future payload
|
|
912
|
+
* shape ships as a new version and this destination keeps receiving the one
|
|
913
|
+
* it was created with.
|
|
914
|
+
*/
|
|
915
|
+
api_version: string;
|
|
916
|
+
status: 'active' | 'disabled';
|
|
917
|
+
/** Why it was auto-disabled after repeated failures. Null while active. */
|
|
918
|
+
disabled_reason: string | null;
|
|
919
|
+
consecutive_failures: number;
|
|
920
|
+
created_at: string;
|
|
921
|
+
updated_at: string;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* The signing secret has exactly one endpoint. It is re-readable on demand
|
|
925
|
+
* rather than shown once, because verifying deliveries is optional and most
|
|
926
|
+
* merchants never do it — a copy-it-now moment would be a task imposed on
|
|
927
|
+
* everyone for the benefit of a few.
|
|
928
|
+
*/
|
|
929
|
+
interface EventDestinationSecretResponse {
|
|
930
|
+
secret: string;
|
|
931
|
+
}
|
|
932
|
+
interface EventDestinationsListResponse {
|
|
933
|
+
destinations: EventDestination[];
|
|
934
|
+
}
|
|
935
|
+
interface CreateEventDestinationInput {
|
|
936
|
+
url: string;
|
|
937
|
+
topics?: string[];
|
|
938
|
+
/** Required: every destination belongs to exactly one form. */
|
|
939
|
+
form_id: string;
|
|
940
|
+
}
|
|
941
|
+
interface UpdateEventDestinationInput {
|
|
942
|
+
url?: string;
|
|
943
|
+
topics?: string[];
|
|
944
|
+
status?: 'active' | 'disabled';
|
|
945
|
+
}
|
|
946
|
+
/** One attempt record from a destination's delivery log. */
|
|
947
|
+
interface EventDelivery {
|
|
948
|
+
id: string;
|
|
949
|
+
destination_id: string;
|
|
950
|
+
/** Sent as the webhook-id header; stable across retries. */
|
|
951
|
+
event_id: string;
|
|
952
|
+
type: string;
|
|
953
|
+
/** The exact JSON body that was (or will be) POSTed. */
|
|
954
|
+
payload: string;
|
|
955
|
+
attempts: number;
|
|
956
|
+
next_attempt_at: string;
|
|
957
|
+
delivered_at: string | null;
|
|
958
|
+
last_error: string | null;
|
|
959
|
+
last_status: number | null;
|
|
960
|
+
created_at: string;
|
|
961
|
+
}
|
|
962
|
+
interface EventDeliveriesListResponse {
|
|
963
|
+
deliveries: EventDelivery[];
|
|
964
|
+
}
|
|
897
965
|
|
|
898
966
|
declare class AifeaturesApiError extends Error {
|
|
899
967
|
status: number;
|
|
@@ -948,6 +1016,15 @@ interface AifeaturesApiClient {
|
|
|
948
1016
|
getPeople(options?: GetPeopleOptions): Promise<PeopleListResponse>;
|
|
949
1017
|
/** Everything known about one person (customer record, orders, submissions). */
|
|
950
1018
|
getPerson(email: string): Promise<PersonDetail>;
|
|
1019
|
+
getEventDestinations(): Promise<EventDestination[]>;
|
|
1020
|
+
createEventDestination(input: CreateEventDestinationInput): Promise<EventDestination>;
|
|
1021
|
+
updateEventDestination(destinationId: string, input: UpdateEventDestinationInput): Promise<EventDestination>;
|
|
1022
|
+
deleteEventDestination(destinationId: string): Promise<void>;
|
|
1023
|
+
rotateEventDestinationSecret(destinationId: string): Promise<EventDestination>;
|
|
1024
|
+
/** Readable whenever needed; rotating replaces it. */
|
|
1025
|
+
getEventDestinationSecret(destinationId: string): Promise<string>;
|
|
1026
|
+
getEventDeliveries(destinationId: string, limit?: number): Promise<EventDelivery[]>;
|
|
1027
|
+
retryEventDelivery(destinationId: string, deliveryId: string): Promise<EventDelivery>;
|
|
951
1028
|
}
|
|
952
1029
|
declare function createApiClient(siteToken: string, apiUrl?: string): AifeaturesApiClient;
|
|
953
1030
|
|
|
@@ -1383,6 +1460,79 @@ interface SubscriptionsViewProps {
|
|
|
1383
1460
|
*/
|
|
1384
1461
|
declare function SubscriptionsView({ refreshKey, onBackToWebsite, className, }: SubscriptionsViewProps): react_jsx_runtime.JSX.Element;
|
|
1385
1462
|
|
|
1463
|
+
interface WebhookSettingsProps {
|
|
1464
|
+
/**
|
|
1465
|
+
* The form these webhooks are attached to.
|
|
1466
|
+
*
|
|
1467
|
+
* Required today because the API requires `form_id` on create, which is
|
|
1468
|
+
* true only while every topic is a form topic. When payments topics land
|
|
1469
|
+
* (order.paid and friends have no form), that requirement relaxes and this
|
|
1470
|
+
* becomes optional in the same change — see the note on the component.
|
|
1471
|
+
*/
|
|
1472
|
+
formId: string;
|
|
1473
|
+
/**
|
|
1474
|
+
* Topics new webhooks subscribe to. Defaults to `['*']` — everything,
|
|
1475
|
+
* including topics added later.
|
|
1476
|
+
*
|
|
1477
|
+
* This is the knob that makes the component context-scoped rather than
|
|
1478
|
+
* form-specific: a payments surface mounts the same component with payment
|
|
1479
|
+
* topics, and the merchant sees "webhooks for this thing" wherever they
|
|
1480
|
+
* already are.
|
|
1481
|
+
*/
|
|
1482
|
+
topics?: string[];
|
|
1483
|
+
/** Blurb above the list. Defaults to the form wording. */
|
|
1484
|
+
description?: string;
|
|
1485
|
+
className?: string;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Webhook management, scoped to whatever context it is mounted in.
|
|
1489
|
+
*
|
|
1490
|
+
* The API calls these "event destinations"; this surface says "Webhooks",
|
|
1491
|
+
* which is the word a merchant connecting Zapier or Make already has.
|
|
1492
|
+
*
|
|
1493
|
+
* NOT a forms component. Webhooks carry every kind of event we emit; showing
|
|
1494
|
+
* them inside a form's settings is a way of SCOPING them to the context the
|
|
1495
|
+
* merchant is already thinking in, not a statement about what they can carry.
|
|
1496
|
+
* A payments surface mounts this same component with payment topics.
|
|
1497
|
+
*
|
|
1498
|
+
* There is deliberately no "all webhooks" screen. Offering one would ask
|
|
1499
|
+
* every merchant to choose between scopes that are the same thing for them —
|
|
1500
|
+
* the typical site has a single form — so each mounting stays contextual.
|
|
1501
|
+
*
|
|
1502
|
+
* Two things here are load-bearing rather than decorative:
|
|
1503
|
+
*
|
|
1504
|
+
* - Adding a webhook is not an event. The row simply appears; there is no
|
|
1505
|
+
* dialog to dismiss, because there is nothing the merchant must do next.
|
|
1506
|
+
* The signing secret is OPTIONAL and re-readable, fetched only when
|
|
1507
|
+
* someone opens its panel, so it never becomes a copy-it-now task imposed
|
|
1508
|
+
* on people who will never verify a signature.
|
|
1509
|
+
* - A destination that failed repeatedly is auto-disabled by the backend.
|
|
1510
|
+
* That state has to be visible and self-serviceable, or the first a
|
|
1511
|
+
* merchant hears of it is a customer asking why leads stopped arriving.
|
|
1512
|
+
*/
|
|
1513
|
+
declare function WebhookSettings({ formId, topics, description, className, }: WebhookSettingsProps): react_jsx_runtime.JSX.Element;
|
|
1514
|
+
|
|
1515
|
+
interface WebhookDeliveriesProps {
|
|
1516
|
+
destinationId: string;
|
|
1517
|
+
/** How many rows to load. The API caps this at 100. */
|
|
1518
|
+
limit?: number;
|
|
1519
|
+
className?: string;
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* The delivery log for one webhook: what we sent, when, and what came back.
|
|
1523
|
+
*
|
|
1524
|
+
* This is the answer to the only two questions a merchant ever asks about a
|
|
1525
|
+
* webhook — "did it fire?" and "why didn't it work?" — and it is why the
|
|
1526
|
+
* backend materialises one row per destination per event rather than one row
|
|
1527
|
+
* per event. Without it the merchant's only recourse is to ask support, and
|
|
1528
|
+
* support's only recourse is to read Workers logs.
|
|
1529
|
+
*
|
|
1530
|
+
* Retry re-sends the STORED bytes, so the consumer sees the same webhook-id
|
|
1531
|
+
* and can deduplicate. That also means a retry is safe to offer for rows that
|
|
1532
|
+
* already delivered — replaying into a rebuilt consumer is a real use.
|
|
1533
|
+
*/
|
|
1534
|
+
declare function WebhookDeliveries({ destinationId, limit, className, }: WebhookDeliveriesProps): react_jsx_runtime.JSX.Element;
|
|
1535
|
+
|
|
1386
1536
|
interface UseFormsReturn {
|
|
1387
1537
|
forms: Form[];
|
|
1388
1538
|
isLoading: boolean;
|
|
@@ -1622,6 +1772,20 @@ interface UseSubscriptionsOptions {
|
|
|
1622
1772
|
*/
|
|
1623
1773
|
declare function useSubscriptions({ initialPageSize, refreshKey, }?: UseSubscriptionsOptions): UseSubscriptionsReturn;
|
|
1624
1774
|
|
|
1775
|
+
interface UseEventDestinationsReturn {
|
|
1776
|
+
destinations: EventDestination[];
|
|
1777
|
+
isLoading: boolean;
|
|
1778
|
+
error: Error | null;
|
|
1779
|
+
refetch: () => Promise<void>;
|
|
1780
|
+
createDestination: (input: CreateEventDestinationInput) => Promise<EventDestination>;
|
|
1781
|
+
updateDestination: (destinationId: string, input: UpdateEventDestinationInput) => Promise<EventDestination>;
|
|
1782
|
+
deleteDestination: (destinationId: string) => Promise<void>;
|
|
1783
|
+
rotateSecret: (destinationId: string) => Promise<EventDestination>;
|
|
1784
|
+
/** Read on demand; there is no shown-once moment to catch. */
|
|
1785
|
+
getSecret: (destinationId: string) => Promise<string>;
|
|
1786
|
+
}
|
|
1787
|
+
declare function useEventDestinations(): UseEventDestinationsReturn;
|
|
1788
|
+
|
|
1625
1789
|
declare function isZeroDecimalCurrency(currency: string): boolean;
|
|
1626
1790
|
/**
|
|
1627
1791
|
* Format a minor-unit amount for display ("$29.00", "¥1,500").
|
|
@@ -1664,4 +1828,4 @@ declare function toMinorUnits(major: string | number, currency: string): number
|
|
|
1664
1828
|
*/
|
|
1665
1829
|
declare function toMajorUnits(minor: number, currency: string): number;
|
|
1666
1830
|
|
|
1667
|
-
export { type AdjustInventoryInput, type AifeaturesApiClient, AifeaturesApiError, type AifeaturesContextValue, AifeaturesProvider, type AifeaturesProviderProps, type ApiError, type Attachment, type BusinessSummary, type CreateFormInput, type CreateOptionInput, type CreateProductInput, type CreateVariantInput, type Customer, type CustomerAddress, CustomerDetail, type CustomerDetail$1 as CustomerDetailData, type CustomerDetailProps, CustomersList, type CustomersListProps, type CustomersListResponse, type EmailSideStatus, type Form, FormSettings, type FormSettingsProps, FormSubmissions, type FormSubmissionsProps, FormsDashboard, type FormsDashboardProps, FormsList, type FormsListProps, type FormsListResponse, type GetBusinessSummaryOptions, type GetCustomersOptions, type GetOrdersOptions, type GetPeopleOptions, type GetProductsOptions, type GetSubmissionsOptions, type GetSubscriptionsOptions, LeadsView, type LeadsViewProps, type LowStockProduct, type NeedsAttentionItem, type NeedsAttentionType, type Order, OrderDetail, type OrderDetailProps, type OrderStatus, OrderStatusBadge, OrdersList, type OrdersListProps, OrdersView, type OrdersViewProps, type PaginatedOrders, type PaginatedSubmissions, type PaginatedSubscriptions, PaymentsDashboard, type PaymentsDashboardProps, PaymentsSetup, type PaymentsSetupProps, type PaymentsStatus, type PaymentsStatusReason, type PaymentsStatusResponse, type PeopleListResponse, type Person, type PersonDetail, type PersonOrder, type PersonSource, type PersonSubmission, type Product, type ProductDetail, type ProductFulfillment, type ProductFulfillmentType, type ProductOption, ProductSettings, type ProductSettingsProps, type ProductStats, type ProductVariant, ProductsList, type ProductsListProps, type ProductsListResponse, ProductsView, type ProductsViewProps, type RefundRequest, type RevenueCurrencyTotal, type RevenuePeriod, type SetInventoryInput, type SetOrderFulfillmentInput, type SettledRevenue, type Submission, SubmissionDetail, type SubmissionDetailProps, type SubmissionMetadata, type Subscription, SubscriptionsView, type SubscriptionsViewProps, type UpdateFormInput, type UpdateOptionInput, type UpdateProductInput, type UpdateVariantInput, type UseBusinessSummaryOptions, type UseBusinessSummaryReturn, type UseCustomersOptions, type UseCustomersReturn, type UseFormsReturn, type UseOrdersOptions, type UseOrdersReturn, type UsePaymentsStatusReturn, type UsePeopleOptions, type UsePeopleReturn, type UsePersonOptions, type UsePersonReturn, type UseProductsOptions, type UseProductsReturn, type UseSubmissionsOptions, type UseSubmissionsReturn, type UseSubscriptionsOptions, type UseSubscriptionsReturn, type VariantInventory, type VariantOptionValue, VariantsEditor, type VariantsEditorProps, ViewShell, type ViewShellProps, chargedTotal, createApiClient, formatPrice, isZeroDecimalCurrency, toMajorUnits, toMinorUnits, useAifeaturesContext as useAifeatures, useAifeaturesContext, useBusinessSummary, useCustomers, useForms, useOrders, usePaymentsStatus, usePeople, usePerson, useProducts, useSubmissions, useSubscriptions };
|
|
1831
|
+
export { type AdjustInventoryInput, type AifeaturesApiClient, AifeaturesApiError, type AifeaturesContextValue, AifeaturesProvider, type AifeaturesProviderProps, type ApiError, type Attachment, type BusinessSummary, type CreateEventDestinationInput, type CreateFormInput, type CreateOptionInput, type CreateProductInput, type CreateVariantInput, type Customer, type CustomerAddress, CustomerDetail, type CustomerDetail$1 as CustomerDetailData, type CustomerDetailProps, CustomersList, type CustomersListProps, type CustomersListResponse, type EmailSideStatus, type EventDeliveriesListResponse, type EventDelivery, type EventDestination, type EventDestinationSecretResponse, type EventDestinationsListResponse, type Form, FormSettings, type FormSettingsProps, FormSubmissions, type FormSubmissionsProps, FormsDashboard, type FormsDashboardProps, FormsList, type FormsListProps, type FormsListResponse, type GetBusinessSummaryOptions, type GetCustomersOptions, type GetOrdersOptions, type GetPeopleOptions, type GetProductsOptions, type GetSubmissionsOptions, type GetSubscriptionsOptions, LeadsView, type LeadsViewProps, type LowStockProduct, type NeedsAttentionItem, type NeedsAttentionType, type Order, OrderDetail, type OrderDetailProps, type OrderStatus, OrderStatusBadge, OrdersList, type OrdersListProps, OrdersView, type OrdersViewProps, type PaginatedOrders, type PaginatedSubmissions, type PaginatedSubscriptions, PaymentsDashboard, type PaymentsDashboardProps, PaymentsSetup, type PaymentsSetupProps, type PaymentsStatus, type PaymentsStatusReason, type PaymentsStatusResponse, type PeopleListResponse, type Person, type PersonDetail, type PersonOrder, type PersonSource, type PersonSubmission, type Product, type ProductDetail, type ProductFulfillment, type ProductFulfillmentType, type ProductOption, ProductSettings, type ProductSettingsProps, type ProductStats, type ProductVariant, ProductsList, type ProductsListProps, type ProductsListResponse, ProductsView, type ProductsViewProps, type RefundRequest, type RevenueCurrencyTotal, type RevenuePeriod, type SetInventoryInput, type SetOrderFulfillmentInput, type SettledRevenue, type Submission, SubmissionDetail, type SubmissionDetailProps, type SubmissionMetadata, type Subscription, SubscriptionsView, type SubscriptionsViewProps, type UpdateEventDestinationInput, type UpdateFormInput, type UpdateOptionInput, type UpdateProductInput, type UpdateVariantInput, type UseBusinessSummaryOptions, type UseBusinessSummaryReturn, type UseCustomersOptions, type UseCustomersReturn, type UseEventDestinationsReturn, type UseFormsReturn, type UseOrdersOptions, type UseOrdersReturn, type UsePaymentsStatusReturn, type UsePeopleOptions, type UsePeopleReturn, type UsePersonOptions, type UsePersonReturn, type UseProductsOptions, type UseProductsReturn, type UseSubmissionsOptions, type UseSubmissionsReturn, type UseSubscriptionsOptions, type UseSubscriptionsReturn, type VariantInventory, type VariantOptionValue, VariantsEditor, type VariantsEditorProps, ViewShell, type ViewShellProps, WebhookDeliveries, type WebhookDeliveriesProps, WebhookSettings, type WebhookSettingsProps, chargedTotal, createApiClient, formatPrice, isZeroDecimalCurrency, toMajorUnits, toMinorUnits, useAifeaturesContext as useAifeatures, useAifeaturesContext, useBusinessSummary, useCustomers, useEventDestinations, useForms, useOrders, usePaymentsStatus, usePeople, usePerson, useProducts, useSubmissions, useSubscriptions };
|