@aifeatures/admin-react 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +506 -1
- package/dist/index.d.ts +506 -1
- package/dist/index.js +4 -4
- package/dist/styles.css +1 -1
- package/package.json +14 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,211 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Email marketing wire types (plan U10), mirroring the aifeatures routes:
|
|
6
|
+
* marketing-settings-api, audience-api, marketing-drafts-api, broadcasts-api,
|
|
7
|
+
* welcome-api and recovery-api.
|
|
8
|
+
*/
|
|
9
|
+
interface MarketingSettings {
|
|
10
|
+
business_name: string | null;
|
|
11
|
+
postal_address: string | null;
|
|
12
|
+
reply_to: string | null;
|
|
13
|
+
double_opt_in: boolean;
|
|
14
|
+
checkout_marketing_consent: boolean;
|
|
15
|
+
/** The connected Stripe account's country; null until the app has synced it. */
|
|
16
|
+
stripe_account_country: string | null;
|
|
17
|
+
brand: {
|
|
18
|
+
color: string;
|
|
19
|
+
logo_url: string | null;
|
|
20
|
+
};
|
|
21
|
+
domain: {
|
|
22
|
+
sending_domain: string | null;
|
|
23
|
+
status: string;
|
|
24
|
+
dmarc_status: 'unknown' | 'ok' | 'missing' | 'error';
|
|
25
|
+
};
|
|
26
|
+
paused: {
|
|
27
|
+
paused_at: string | null;
|
|
28
|
+
reason: string | null;
|
|
29
|
+
};
|
|
30
|
+
allowance: {
|
|
31
|
+
month: string;
|
|
32
|
+
monthly: number;
|
|
33
|
+
sent: number;
|
|
34
|
+
reserved: number;
|
|
35
|
+
};
|
|
36
|
+
readiness: {
|
|
37
|
+
can_send: boolean;
|
|
38
|
+
reason: string | null;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
type ContactConsentStatus = 'none' | 'pending' | 'subscribed' | 'unsubscribed';
|
|
42
|
+
interface ContactTagRef {
|
|
43
|
+
id: string;
|
|
44
|
+
label: string;
|
|
45
|
+
system: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface MarketingContact {
|
|
48
|
+
id: string;
|
|
49
|
+
email: string;
|
|
50
|
+
name: string | null;
|
|
51
|
+
status: ContactConsentStatus;
|
|
52
|
+
mailable: boolean;
|
|
53
|
+
consent_at: string | null;
|
|
54
|
+
tags: ContactTagRef[];
|
|
55
|
+
created_at: string;
|
|
56
|
+
}
|
|
57
|
+
interface MarketingContactsPage {
|
|
58
|
+
contacts: MarketingContact[];
|
|
59
|
+
total: number;
|
|
60
|
+
limit: number;
|
|
61
|
+
offset: number;
|
|
62
|
+
}
|
|
63
|
+
interface MarketingContactStats {
|
|
64
|
+
total: number;
|
|
65
|
+
mailable: number;
|
|
66
|
+
by_status: Record<ContactConsentStatus, number>;
|
|
67
|
+
growth: Array<{
|
|
68
|
+
week_start: string;
|
|
69
|
+
new_contacts: number;
|
|
70
|
+
new_subscribers: number;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
interface MarketingTag extends ContactTagRef {
|
|
74
|
+
total: number;
|
|
75
|
+
mailable: number;
|
|
76
|
+
}
|
|
77
|
+
type ImportSkipReason = 'invalid_email' | 'duplicate' | 'inactive_in_source' | 'previously_unsubscribed' | 'suppressed' | 'pending';
|
|
78
|
+
interface ContactImportReport {
|
|
79
|
+
import_id: string;
|
|
80
|
+
rows: number;
|
|
81
|
+
created: number;
|
|
82
|
+
updated: number;
|
|
83
|
+
skipped: number;
|
|
84
|
+
skipped_rows: Array<{
|
|
85
|
+
row: number;
|
|
86
|
+
email: string;
|
|
87
|
+
reason: ImportSkipReason;
|
|
88
|
+
}>;
|
|
89
|
+
}
|
|
90
|
+
type EmailDraftKind = 'broadcast' | 'welcome' | 'recovery';
|
|
91
|
+
type EmailDraftBlock = {
|
|
92
|
+
type: 'heading';
|
|
93
|
+
text: string;
|
|
94
|
+
} | {
|
|
95
|
+
type: 'text';
|
|
96
|
+
text: string;
|
|
97
|
+
} | {
|
|
98
|
+
type: 'image';
|
|
99
|
+
url: string;
|
|
100
|
+
alt?: string;
|
|
101
|
+
} | {
|
|
102
|
+
type: 'button';
|
|
103
|
+
label: string;
|
|
104
|
+
url: string;
|
|
105
|
+
} | {
|
|
106
|
+
type: 'cart';
|
|
107
|
+
label: string;
|
|
108
|
+
};
|
|
109
|
+
interface EmailDraft {
|
|
110
|
+
id: string;
|
|
111
|
+
kind: EmailDraftKind;
|
|
112
|
+
subject: string;
|
|
113
|
+
preheader: string | null;
|
|
114
|
+
blocks: EmailDraftBlock[];
|
|
115
|
+
version: number;
|
|
116
|
+
/** Advisory: the audience the assistant proposed, for the commit panel to pre-fill. A commit sends its own targeting. */
|
|
117
|
+
targeting: BroadcastTargeting | null;
|
|
118
|
+
/** Advisory: the send time (ISO) the assistant proposed, for the commit panel to pre-fill. Never schedules anything. */
|
|
119
|
+
proposed_send_at: string | null;
|
|
120
|
+
created_at: string;
|
|
121
|
+
updated_at: string;
|
|
122
|
+
}
|
|
123
|
+
interface EmailDraftPreview {
|
|
124
|
+
subject: string;
|
|
125
|
+
html: string;
|
|
126
|
+
text: string;
|
|
127
|
+
version: number;
|
|
128
|
+
}
|
|
129
|
+
interface BroadcastTargeting {
|
|
130
|
+
tag_ids: string[];
|
|
131
|
+
match: 'any' | 'all';
|
|
132
|
+
}
|
|
133
|
+
interface BroadcastPlan {
|
|
134
|
+
recipients: number;
|
|
135
|
+
month: string;
|
|
136
|
+
allowance: {
|
|
137
|
+
monthly: number;
|
|
138
|
+
sent: number;
|
|
139
|
+
reserved: number;
|
|
140
|
+
remaining: number;
|
|
141
|
+
};
|
|
142
|
+
fits: boolean;
|
|
143
|
+
sample_size: number | null;
|
|
144
|
+
ramp_days: Array<{
|
|
145
|
+
date: string;
|
|
146
|
+
recipients: number;
|
|
147
|
+
}>;
|
|
148
|
+
}
|
|
149
|
+
type BroadcastStatus = 'scheduled' | 'unscheduled' | 'sending' | 'sent' | 'cancelled' | 'failed';
|
|
150
|
+
interface Broadcast {
|
|
151
|
+
id: string;
|
|
152
|
+
draft_id: string | null;
|
|
153
|
+
status: BroadcastStatus;
|
|
154
|
+
status_reason: string | null;
|
|
155
|
+
subject: string;
|
|
156
|
+
targeting: BroadcastTargeting;
|
|
157
|
+
scheduled_at: string | null;
|
|
158
|
+
committed_at: string | null;
|
|
159
|
+
month: string | null;
|
|
160
|
+
reserved: number;
|
|
161
|
+
recipients: {
|
|
162
|
+
planned: number;
|
|
163
|
+
consumed: number;
|
|
164
|
+
by_state: Record<string, number>;
|
|
165
|
+
};
|
|
166
|
+
stats: {
|
|
167
|
+
delivered: number;
|
|
168
|
+
opened: number;
|
|
169
|
+
clicked: number;
|
|
170
|
+
bounced: number;
|
|
171
|
+
complained: number;
|
|
172
|
+
unsubscribed: number;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
interface WelcomeStep {
|
|
176
|
+
id: string;
|
|
177
|
+
position: number;
|
|
178
|
+
delay_days: number;
|
|
179
|
+
draft_id: string | null;
|
|
180
|
+
published: boolean;
|
|
181
|
+
published_version: number | null;
|
|
182
|
+
published_at: string | null;
|
|
183
|
+
}
|
|
184
|
+
interface WelcomeSequence {
|
|
185
|
+
active: boolean;
|
|
186
|
+
tag_id: string | null;
|
|
187
|
+
steps: WelcomeStep[];
|
|
188
|
+
}
|
|
189
|
+
interface RecoveryStep {
|
|
190
|
+
step: number;
|
|
191
|
+
draft_id: string;
|
|
192
|
+
published: boolean;
|
|
193
|
+
published_version: number | null;
|
|
194
|
+
published_at: string | null;
|
|
195
|
+
}
|
|
196
|
+
interface RecoveryFlow {
|
|
197
|
+
active: boolean;
|
|
198
|
+
offsets_hours: number[];
|
|
199
|
+
steps: RecoveryStep[];
|
|
200
|
+
blocked_by: string[];
|
|
201
|
+
counts: {
|
|
202
|
+
abandoned: number;
|
|
203
|
+
emailed: number;
|
|
204
|
+
recovered: number;
|
|
205
|
+
skipped: number;
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
4
209
|
/** Latest send attempt per kind; delivered means accepted by the recipient's mail server. */
|
|
5
210
|
interface EmailDelivery {
|
|
6
211
|
id: string;
|
|
@@ -22,6 +227,8 @@ interface Form {
|
|
|
22
227
|
email_notifications: boolean;
|
|
23
228
|
redirect_url: string | null;
|
|
24
229
|
turnstile_sitekey: string | null;
|
|
230
|
+
/** Present only while email marketing is enabled for the site (single-form reads). */
|
|
231
|
+
purpose?: 'general' | 'newsletter';
|
|
25
232
|
created_at: string;
|
|
26
233
|
updated_at: string;
|
|
27
234
|
}
|
|
@@ -1704,6 +1911,7 @@ interface PromosListResponse {
|
|
|
1704
1911
|
next_cursor: string | null;
|
|
1705
1912
|
checkout_enabled: boolean;
|
|
1706
1913
|
}
|
|
1914
|
+
|
|
1707
1915
|
interface ShippingRate {
|
|
1708
1916
|
label: string;
|
|
1709
1917
|
/** Minor units of the site's currency. */
|
|
@@ -1727,6 +1935,10 @@ interface SiteSettings {
|
|
|
1727
1935
|
tax_label: string | null;
|
|
1728
1936
|
stripe_tax_enabled: boolean;
|
|
1729
1937
|
collect_phone_at_checkout: boolean;
|
|
1938
|
+
/** Present only while email marketing is on for the site. Takes effect on US Stripe accounts only. */
|
|
1939
|
+
checkout_marketing_consent?: boolean;
|
|
1940
|
+
/** The connected Stripe account's country, present alongside checkout_marketing_consent. */
|
|
1941
|
+
stripe_account_country?: string | null;
|
|
1730
1942
|
/** Payments active, a Stripe account set, and checkout not paused. */
|
|
1731
1943
|
payments_active: boolean;
|
|
1732
1944
|
/** Owner-only: read here, written through the host's callback. */
|
|
@@ -1753,6 +1965,8 @@ interface UpdateSiteSettingsInput {
|
|
|
1753
1965
|
tax_label?: string | null;
|
|
1754
1966
|
stripe_tax_enabled?: boolean;
|
|
1755
1967
|
collect_phone_at_checkout?: boolean;
|
|
1968
|
+
/** Only while email marketing is on for the site (400 `marketing_not_enabled` otherwise). */
|
|
1969
|
+
checkout_marketing_consent?: boolean;
|
|
1756
1970
|
/** Restates every stored amount in the new currency (no FX conversion). */
|
|
1757
1971
|
currency?: string;
|
|
1758
1972
|
/**
|
|
@@ -1931,6 +2145,24 @@ interface AifeaturesApiClient {
|
|
|
1931
2145
|
getEventDestinationSecret(destinationId: string): Promise<string>;
|
|
1932
2146
|
getEventDeliveries(destinationId: string, limit?: number): Promise<EventDelivery[]>;
|
|
1933
2147
|
retryEventDelivery(destinationId: string, deliveryId: string): Promise<EventDelivery>;
|
|
2148
|
+
getMarketingSettings(siteId: string): Promise<MarketingSettings>;
|
|
2149
|
+
getMarketingContacts(siteId: string, options?: {
|
|
2150
|
+
q?: string;
|
|
2151
|
+
limit?: number;
|
|
2152
|
+
offset?: number;
|
|
2153
|
+
}): Promise<MarketingContactsPage>;
|
|
2154
|
+
getMarketingContactStats(siteId: string): Promise<MarketingContactStats>;
|
|
2155
|
+
getMarketingTags(siteId: string): Promise<MarketingTag[]>;
|
|
2156
|
+
getEmailDrafts(siteId: string, kind?: EmailDraftKind): Promise<EmailDraft[]>;
|
|
2157
|
+
getEmailDraft(siteId: string, draftId: string): Promise<EmailDraft>;
|
|
2158
|
+
previewEmailDraft(siteId: string, draftId: string): Promise<EmailDraftPreview>;
|
|
2159
|
+
getBroadcasts(siteId: string): Promise<Broadcast[]>;
|
|
2160
|
+
estimateBroadcast(siteId: string, input: {
|
|
2161
|
+
targeting: BroadcastTargeting;
|
|
2162
|
+
scheduled_at?: string | null;
|
|
2163
|
+
}): Promise<BroadcastPlan>;
|
|
2164
|
+
getWelcomeSequence(siteId: string): Promise<WelcomeSequence>;
|
|
2165
|
+
getRecoveryFlow(siteId: string): Promise<RecoveryFlow>;
|
|
1934
2166
|
}
|
|
1935
2167
|
declare function createApiClient(siteToken: string, apiUrl?: string): AifeaturesApiClient;
|
|
1936
2168
|
|
|
@@ -2736,6 +2968,234 @@ declare function RetainersPanel({ retainers, isLoading, error, onRetry, onShowCy
|
|
|
2736
2968
|
/** Shared merchant dashboard surface; all writes use the same API as agent tools. */
|
|
2737
2969
|
declare function PromosPanel(): react_jsx_runtime.JSX.Element;
|
|
2738
2970
|
|
|
2971
|
+
/**
|
|
2972
|
+
* The email view's org-key writes (email marketing plan U10, KTD10, KTD17).
|
|
2973
|
+
*
|
|
2974
|
+
* The view reads with the site token, but every write below needs the
|
|
2975
|
+
* organization key, which only the host app holds. The view calls
|
|
2976
|
+
* `onOrgAction(action, input)`; the app's relay checks the viewer owns the
|
|
2977
|
+
* site, then calls the aifeatures endpoint this table names. Both sides import
|
|
2978
|
+
* this one table, so the action names and endpoints cannot drift apart.
|
|
2979
|
+
*
|
|
2980
|
+
* No React here: the app's API imports this module.
|
|
2981
|
+
*
|
|
2982
|
+
* Request shape: `path` is relative to the aifeatures `/api/v1` base. Each
|
|
2983
|
+
* `{param}` in `params` is read from `input` and removed from the body; the
|
|
2984
|
+
* rest of `input` is the JSON body (GET and DELETE send none). `{siteId}` is
|
|
2985
|
+
* NEVER taken from `input`: the relay fills it from the site it authorized.
|
|
2986
|
+
*
|
|
2987
|
+
* Relay duties the table cannot express:
|
|
2988
|
+
* - `importContacts`: the relay adds `attested_by` (the app user id). The view
|
|
2989
|
+
* sends `attested: true` only after the merchant ticks the attestation.
|
|
2990
|
+
* - `setFormPurpose`: the aifeatures form route is not site-scoped, so the
|
|
2991
|
+
* relay must confirm the form belongs to the authorized site before calling
|
|
2992
|
+
* it (for example, `GET /forms/{formId}` with that site's token).
|
|
2993
|
+
* - `exportContacts` answers with CSV text, not JSON; resolve with the text.
|
|
2994
|
+
* - On an aifeatures error, reject with an Error whose `code` is the
|
|
2995
|
+
* aifeatures error `code` (`version_conflict`, `over_allowance`, …): the
|
|
2996
|
+
* view keys its recovery on it.
|
|
2997
|
+
*/
|
|
2998
|
+
declare const EMAIL_ORG_ACTIONS: {
|
|
2999
|
+
readonly commitBroadcast: {
|
|
3000
|
+
readonly method: "POST";
|
|
3001
|
+
readonly path: "/sites/{siteId}/marketing/broadcasts";
|
|
3002
|
+
};
|
|
3003
|
+
readonly cancelBroadcast: {
|
|
3004
|
+
readonly method: "POST";
|
|
3005
|
+
readonly path: "/sites/{siteId}/marketing/broadcasts/{sendId}/cancel";
|
|
3006
|
+
readonly params: readonly ["sendId"];
|
|
3007
|
+
};
|
|
3008
|
+
readonly createDraft: {
|
|
3009
|
+
readonly method: "POST";
|
|
3010
|
+
readonly path: "/sites/{siteId}/marketing/drafts";
|
|
3011
|
+
};
|
|
3012
|
+
readonly updateDraft: {
|
|
3013
|
+
readonly method: "PUT";
|
|
3014
|
+
readonly path: "/sites/{siteId}/marketing/drafts/{draftId}";
|
|
3015
|
+
readonly params: readonly ["draftId"];
|
|
3016
|
+
};
|
|
3017
|
+
readonly deleteDraft: {
|
|
3018
|
+
readonly method: "DELETE";
|
|
3019
|
+
readonly path: "/sites/{siteId}/marketing/drafts/{draftId}";
|
|
3020
|
+
readonly params: readonly ["draftId"];
|
|
3021
|
+
};
|
|
3022
|
+
readonly testSendDraft: {
|
|
3023
|
+
readonly method: "POST";
|
|
3024
|
+
readonly path: "/sites/{siteId}/marketing/drafts/{draftId}/test";
|
|
3025
|
+
readonly params: readonly ["draftId"];
|
|
3026
|
+
};
|
|
3027
|
+
readonly importContacts: {
|
|
3028
|
+
readonly method: "POST";
|
|
3029
|
+
readonly path: "/sites/{siteId}/contacts/import";
|
|
3030
|
+
};
|
|
3031
|
+
readonly exportContacts: {
|
|
3032
|
+
readonly method: "GET";
|
|
3033
|
+
readonly path: "/sites/{siteId}/contacts/export";
|
|
3034
|
+
};
|
|
3035
|
+
readonly createTag: {
|
|
3036
|
+
readonly method: "POST";
|
|
3037
|
+
readonly path: "/sites/{siteId}/contact-tags";
|
|
3038
|
+
};
|
|
3039
|
+
readonly updateTag: {
|
|
3040
|
+
readonly method: "PATCH";
|
|
3041
|
+
readonly path: "/sites/{siteId}/contact-tags/{tagId}";
|
|
3042
|
+
readonly params: readonly ["tagId"];
|
|
3043
|
+
};
|
|
3044
|
+
readonly bulkTagContacts: {
|
|
3045
|
+
readonly method: "POST";
|
|
3046
|
+
readonly path: "/sites/{siteId}/contacts/tags";
|
|
3047
|
+
};
|
|
3048
|
+
readonly unsubscribeContact: {
|
|
3049
|
+
readonly method: "POST";
|
|
3050
|
+
readonly path: "/sites/{siteId}/contacts/{contactId}/unsubscribe";
|
|
3051
|
+
readonly params: readonly ["contactId"];
|
|
3052
|
+
};
|
|
3053
|
+
readonly updateSettings: {
|
|
3054
|
+
readonly method: "PUT";
|
|
3055
|
+
readonly path: "/sites/{siteId}/marketing";
|
|
3056
|
+
};
|
|
3057
|
+
readonly setFormPurpose: {
|
|
3058
|
+
readonly method: "PATCH";
|
|
3059
|
+
readonly path: "/forms/{formId}";
|
|
3060
|
+
readonly params: readonly ["formId"];
|
|
3061
|
+
};
|
|
3062
|
+
readonly createWelcomeStep: {
|
|
3063
|
+
readonly method: "POST";
|
|
3064
|
+
readonly path: "/sites/{siteId}/marketing/welcome/steps";
|
|
3065
|
+
};
|
|
3066
|
+
readonly updateWelcomeStep: {
|
|
3067
|
+
readonly method: "PATCH";
|
|
3068
|
+
readonly path: "/sites/{siteId}/marketing/welcome/steps/{stepId}";
|
|
3069
|
+
readonly params: readonly ["stepId"];
|
|
3070
|
+
};
|
|
3071
|
+
readonly deleteWelcomeStep: {
|
|
3072
|
+
readonly method: "DELETE";
|
|
3073
|
+
readonly path: "/sites/{siteId}/marketing/welcome/steps/{stepId}";
|
|
3074
|
+
readonly params: readonly ["stepId"];
|
|
3075
|
+
};
|
|
3076
|
+
readonly publishWelcomeStep: {
|
|
3077
|
+
readonly method: "POST";
|
|
3078
|
+
readonly path: "/sites/{siteId}/marketing/welcome/steps/{stepId}/publish";
|
|
3079
|
+
readonly params: readonly ["stepId"];
|
|
3080
|
+
};
|
|
3081
|
+
readonly activateWelcome: {
|
|
3082
|
+
readonly method: "POST";
|
|
3083
|
+
readonly path: "/sites/{siteId}/marketing/welcome/activate";
|
|
3084
|
+
};
|
|
3085
|
+
readonly pauseWelcome: {
|
|
3086
|
+
readonly method: "POST";
|
|
3087
|
+
readonly path: "/sites/{siteId}/marketing/welcome/pause";
|
|
3088
|
+
};
|
|
3089
|
+
readonly updateWelcome: {
|
|
3090
|
+
readonly method: "PATCH";
|
|
3091
|
+
readonly path: "/sites/{siteId}/marketing/welcome";
|
|
3092
|
+
};
|
|
3093
|
+
readonly setRecoveryStep: {
|
|
3094
|
+
readonly method: "PUT";
|
|
3095
|
+
readonly path: "/sites/{siteId}/marketing/recovery/steps/{step}";
|
|
3096
|
+
readonly params: readonly ["step"];
|
|
3097
|
+
};
|
|
3098
|
+
readonly publishRecoveryStep: {
|
|
3099
|
+
readonly method: "POST";
|
|
3100
|
+
readonly path: "/sites/{siteId}/marketing/recovery/steps/{step}/publish";
|
|
3101
|
+
readonly params: readonly ["step"];
|
|
3102
|
+
};
|
|
3103
|
+
readonly deleteRecoveryStep: {
|
|
3104
|
+
readonly method: "DELETE";
|
|
3105
|
+
readonly path: "/sites/{siteId}/marketing/recovery/steps/{step}";
|
|
3106
|
+
readonly params: readonly ["step"];
|
|
3107
|
+
};
|
|
3108
|
+
readonly activateRecovery: {
|
|
3109
|
+
readonly method: "POST";
|
|
3110
|
+
readonly path: "/sites/{siteId}/marketing/recovery/activate";
|
|
3111
|
+
};
|
|
3112
|
+
readonly pauseRecovery: {
|
|
3113
|
+
readonly method: "POST";
|
|
3114
|
+
readonly path: "/sites/{siteId}/marketing/recovery/pause";
|
|
3115
|
+
};
|
|
3116
|
+
};
|
|
3117
|
+
type EmailOrgAction = keyof typeof EMAIL_ORG_ACTIONS;
|
|
3118
|
+
interface EmailOrgRequest {
|
|
3119
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
3120
|
+
/** Relative to the aifeatures `/api/v1` base. */
|
|
3121
|
+
path: string;
|
|
3122
|
+
/** JSON body; undefined for GET and DELETE. */
|
|
3123
|
+
body: Record<string, unknown> | undefined;
|
|
3124
|
+
}
|
|
3125
|
+
declare function isEmailOrgAction(value: unknown): value is EmailOrgAction;
|
|
3126
|
+
/**
|
|
3127
|
+
* The aifeatures request for one action: path params from `input`, the rest
|
|
3128
|
+
* as the body. `siteId` comes from the relay's authorized site, never from
|
|
3129
|
+
* `input`. Throws when a path param is missing.
|
|
3130
|
+
*/
|
|
3131
|
+
declare function buildEmailOrgRequest(action: EmailOrgAction, siteId: string, input: Record<string, unknown>): EmailOrgRequest;
|
|
3132
|
+
/**
|
|
3133
|
+
* Plain words for the send readiness codes (U4's `siteMaySendMarketing`
|
|
3134
|
+
* reasons). One table for the email view and anything else that explains them.
|
|
3135
|
+
*/
|
|
3136
|
+
declare const EMAIL_READINESS_TEXT: Record<string, string>;
|
|
3137
|
+
declare function emailReadinessText(reason: string | null | undefined): string | null;
|
|
3138
|
+
|
|
3139
|
+
interface EmailDomainSetupResult {
|
|
3140
|
+
status: string;
|
|
3141
|
+
records?: Array<{
|
|
3142
|
+
type: string;
|
|
3143
|
+
name: string;
|
|
3144
|
+
value: string;
|
|
3145
|
+
priority?: number;
|
|
3146
|
+
}>;
|
|
3147
|
+
}
|
|
3148
|
+
/** The plan's help text for the double opt-in toggle, verbatim. */
|
|
3149
|
+
declare const DOUBLE_OPT_IN_HELP = "Subscribers confirm by email before they receive anything. Useful if many subscribers are in the EU (especially Germany), or if your forms attract fake or mistyped signups. Some signups need confirming even with this off: bursts of signups, and people re-subscribing after they unsubscribed.";
|
|
3150
|
+
|
|
3151
|
+
interface EmailViewProps {
|
|
3152
|
+
siteId: string;
|
|
3153
|
+
/** The viewer is the site's owner (or an admin): writes are offered. */
|
|
3154
|
+
isOwnerSide: boolean;
|
|
3155
|
+
needsPaidPlan: boolean;
|
|
3156
|
+
/** Open this draft on mount (`show_view('email', {draft_id})`). Nothing sends until the merchant clicks. */
|
|
3157
|
+
initialDraftId?: string;
|
|
3158
|
+
/** The host's org-key relay for every write (see EMAIL_ORG_ACTIONS). */
|
|
3159
|
+
onOrgAction: (action: EmailOrgAction, input: Record<string, unknown>) => Promise<unknown>;
|
|
3160
|
+
/** A paused site asks an admin to review it (resume stays admin-only). */
|
|
3161
|
+
onRequestReview?: () => Promise<void>;
|
|
3162
|
+
/** Create the sending domain (and its DNS when the site's nameservers are ours). */
|
|
3163
|
+
onStartDomainSetup?: () => Promise<EmailDomainSetupResult>;
|
|
3164
|
+
onBackToWebsite?: () => void;
|
|
3165
|
+
/** Open the host's Settings → Store, where checkout marketing consent lives. */
|
|
3166
|
+
onOpenStoreSettings?: () => void;
|
|
3167
|
+
/**
|
|
3168
|
+
* Bump to refetch everything the view shows in place (an agent turn changed
|
|
3169
|
+
* email data). Keeps the open tab and never overwrites a draft edit the
|
|
3170
|
+
* merchant hasn't saved.
|
|
3171
|
+
*/
|
|
3172
|
+
refreshKey?: number;
|
|
3173
|
+
className?: string;
|
|
3174
|
+
}
|
|
3175
|
+
/**
|
|
3176
|
+
* EmailView — the merchant's email marketing view (plan U10): audience,
|
|
3177
|
+
* broadcasts and settings.
|
|
3178
|
+
* Reads use the site token; every write goes through `onOrgAction`.
|
|
3179
|
+
*/
|
|
3180
|
+
/**
|
|
3181
|
+
* Keyed by site: every panel, open draft, editor and preview starts fresh on
|
|
3182
|
+
* another site, so no state loaded or typed for one site can be rendered, or
|
|
3183
|
+
* saved, against another.
|
|
3184
|
+
*/
|
|
3185
|
+
declare function EmailView(props: EmailViewProps): react_jsx_runtime.JSX.Element;
|
|
3186
|
+
|
|
3187
|
+
interface ContactImportProps {
|
|
3188
|
+
/** Called with the report after a completed import. */
|
|
3189
|
+
onImported?: (report: ContactImportReport) => void;
|
|
3190
|
+
}
|
|
3191
|
+
/** The consent statement the merchant attests to before any import (R5). */
|
|
3192
|
+
declare const IMPORT_ATTESTATION = "I confirm that everyone in this file agreed to receive marketing email from my business.";
|
|
3193
|
+
/**
|
|
3194
|
+
* CSV import with tags. Nothing is sent until the merchant ticks the consent
|
|
3195
|
+
* attestation; the result shows what was added and why rows were skipped.
|
|
3196
|
+
*/
|
|
3197
|
+
declare function ContactImport({ onImported }: ContactImportProps): react_jsx_runtime.JSX.Element;
|
|
3198
|
+
|
|
2739
3199
|
interface UseFormsReturn {
|
|
2740
3200
|
forms: Form[];
|
|
2741
3201
|
isLoading: boolean;
|
|
@@ -3271,6 +3731,51 @@ declare function useRealtimeVisitors(options?: {
|
|
|
3271
3731
|
identity?: string | null;
|
|
3272
3732
|
}): UseRealtimeVisitorsReturn;
|
|
3273
3733
|
|
|
3734
|
+
/**
|
|
3735
|
+
* One read for the email view: loads on mount and whenever `key` changes,
|
|
3736
|
+
* drops stale responses, and exposes a refetch. Internal to the email hooks.
|
|
3737
|
+
*/
|
|
3738
|
+
interface EmailResource<T> {
|
|
3739
|
+
data: T | null;
|
|
3740
|
+
isLoading: boolean;
|
|
3741
|
+
error: Error | null;
|
|
3742
|
+
refetch: () => Promise<void>;
|
|
3743
|
+
}
|
|
3744
|
+
|
|
3745
|
+
/** The site token's page cap for contact reads (KTD17). */
|
|
3746
|
+
declare const AUDIENCE_PAGE_SIZE = 50;
|
|
3747
|
+
interface UseAudienceOptions {
|
|
3748
|
+
siteId: string;
|
|
3749
|
+
/** Search the email address or name. */
|
|
3750
|
+
q?: string;
|
|
3751
|
+
offset?: number;
|
|
3752
|
+
/** Bump to refetch everything. */
|
|
3753
|
+
refreshKey?: number;
|
|
3754
|
+
}
|
|
3755
|
+
interface UseAudienceReturn {
|
|
3756
|
+
contacts: EmailResource<MarketingContactsPage>;
|
|
3757
|
+
stats: EmailResource<MarketingContactStats>;
|
|
3758
|
+
tags: EmailResource<MarketingTag[]>;
|
|
3759
|
+
refetchAll: () => Promise<void>;
|
|
3760
|
+
}
|
|
3761
|
+
/** Contacts (one page, searched), counts with growth, and tags with counts. */
|
|
3762
|
+
declare function useAudience({ siteId, q, offset, refreshKey }: UseAudienceOptions): UseAudienceReturn;
|
|
3763
|
+
|
|
3764
|
+
interface UseEmailDraftsOptions {
|
|
3765
|
+
siteId: string;
|
|
3766
|
+
kind?: EmailDraftKind;
|
|
3767
|
+
refreshKey?: number;
|
|
3768
|
+
}
|
|
3769
|
+
/** The site's email drafts, most recently edited first. */
|
|
3770
|
+
declare function useEmailDrafts({ siteId, kind, refreshKey }: UseEmailDraftsOptions): EmailResource<EmailDraft[]>;
|
|
3771
|
+
|
|
3772
|
+
interface UseBroadcastsOptions {
|
|
3773
|
+
siteId: string;
|
|
3774
|
+
refreshKey?: number;
|
|
3775
|
+
}
|
|
3776
|
+
/** The site's broadcasts with their delivery stats, newest first. */
|
|
3777
|
+
declare function useBroadcasts({ siteId, refreshKey }: UseBroadcastsOptions): EmailResource<Broadcast[]>;
|
|
3778
|
+
|
|
3274
3779
|
interface UseSiteSettingsOptions {
|
|
3275
3780
|
/** The aifeatures site id. Must be the site the provider's token belongs to. */
|
|
3276
3781
|
siteId: string;
|
|
@@ -3569,4 +4074,4 @@ interface DashboardViewProps {
|
|
|
3569
4074
|
*/
|
|
3570
4075
|
declare function DashboardView({ refreshKey, onBackToWebsite, primaryConversion, onChangePrimaryConversion, onOpenSurface, needsPaidPlan, onUpgradePlan, onConnectStripe, }: DashboardViewProps): react_jsx_runtime.JSX.Element;
|
|
3571
4076
|
|
|
3572
|
-
export { type AdjustInventoryInput, type AifeaturesApiClient, AifeaturesApiError, type AifeaturesContextValue, AifeaturesProvider, type AifeaturesProviderProps, type AnalyticsBreakdown, type AnalyticsBreakdownName, type AnalyticsBreakdownRow, type AnalyticsChannelRow, type AnalyticsChannels, type AnalyticsConversionRow, type AnalyticsConversions, type AnalyticsFilter, type AnalyticsFilterDimension, type AnalyticsGoalTargetRow, type AnalyticsGoalTargets, type AnalyticsPeriod, type AnalyticsRealtime, type AnalyticsSourced, type AnalyticsStatus, type AnalyticsSummary, type AnalyticsSummaryData, type AnalyticsSummaryMetrics, type AnalyticsTimeseries, type AnalyticsTimeseriesRow, AnalyticsView, type AnalyticsViewProps, type ApiError, type Attachment, type BusinessSummary, type BusinessVisitors, type CreateEventDestinationInput, type CreateFormInput, type CreateOptionInput, type CreateProductInput, type CreatePromoInput, type CreateVariantInput, type CurrencyRestatement, type Customer, type CustomerAddress, CustomerDetail, type CustomerDetail$1 as CustomerDetailData, type CustomerDetailProps, CustomersList, type CustomersListProps, type CustomersListResponse, DashboardView, type DashboardViewProps, type EmailDelivery, type EmailSideStatus, type EventDeliveriesListResponse, type EventDelivery, type EventDestination, type EventDestinationSecretResponse, type EventDestinationsListResponse, ExportCsvButton, type ExportCsvButtonProps, type ExportOrdersOptions, type ExportPeopleOptions, type ExportRetainersOptions, type ExportSubscriptionsOptions, type Form, FormSettings, type FormSettingsProps, FormSubmissions, type FormSubmissionsProps, FormsDashboard, type FormsDashboardProps, FormsList, type FormsListProps, type FormsListResponse, type FormsLocation, type FormsTab, type GetBusinessSummaryOptions, type GetCustomersOptions, type GetInvoicesOptions, type GetOrdersOptions, type GetPeopleOptions, type GetProductsOptions, type GetSubmissionsOptions, type GetSubscriptionsOptions, type Invoice, type InvoiceAggregates, type InvoiceBillTo, type InvoiceDeliveryState, InvoiceDetail, type InvoiceDetailProps, type InvoiceLabel, InvoiceLabelBadge, type InvoiceLineItem, type InvoicePreview, type InvoiceSettings, InvoiceSettingsPanel, type InvoiceSettingsPanelProps, InvoicesList, type InvoicesListProps, InvoicesView, type InvoicesViewProps, LeadsView, type LeadsViewProps, type LowStockProduct, MAX_ANALYTICS_FILTERS, MAX_ANALYTICS_FILTER_VALUES, type NeedsAttentionItem, type NeedsAttentionType, NotificationRecipientsSettings, type NotificationRecipientsSettingsProps, type Order, OrderDetail, type OrderDetailProps, type OrderStatus, OrderStatusBadge, OrdersList, type OrdersListProps, OrdersView, type OrdersViewProps, type PaginatedInvoices, type PaginatedOrders, type PaginatedSubmissions, type PaginatedSubscriptions, PaymentsDashboard, type PaymentsDashboardProps, PaymentsSetup, type PaymentsSetupProps, type PaymentsStatus, type PaymentsStatusReason, type PaymentsStatusResponse, type PeopleListResponse, type Person, type PersonDetail, type PersonOrder, type PersonSource, type PersonSubmission, type PrimaryConversion, type Product, type ProductDetail, type ProductFulfillment, type ProductFulfillmentType, type ProductOption, ProductSettings, type ProductSettingsProps, type ProductStats, type ProductVariant, ProductsList, type ProductsListProps, type ProductsListResponse, ProductsView, type ProductsViewProps, type Promo, type PromosListResponse, PromosPanel, REALTIME_FAILURES_BEFORE_ERROR, REALTIME_POLL_MS, type RefundRequest, type ReportSlot, RetainerStatusBadge, RetainersPanel, type RetainersPanelProps, type RevenueCurrencyTotal, type RevenuePeriod, type SetInventoryInput, type SetOrderFulfillmentInput, type SettledRevenue, type ShippingRate, type SiteSettings, type StoreInvoiceSettingsInput, StoreSettings, type StoreSettingsProps, type StoreSettingsSection, type Submission, SubmissionDetail, type SubmissionDetailProps, type SubmissionMetadata, type Subscription, SubscriptionsView, type SubscriptionsViewProps, type UpdateEventDestinationInput, type UpdateFormInput, type UpdateOptionInput, type UpdateProductInput, type UpdateSiteSettingsInput, type UpdateSiteSettingsResult, type UpdateVariantInput, type UseAnalyticsOptions, type UseAnalyticsReturn, type UseBusinessSummaryOptions, type UseBusinessSummaryReturn, type UseCsvExportOptions, type UseCsvExportReturn, type UseCustomersOptions, type UseCustomersReturn, type UseEventDestinationsReturn, type UseFormsReturn, type UseInvoicesOptions, type UseInvoicesReturn, type UseOrdersOptions, type UseOrdersReturn, type UsePaymentsStatusReturn, type UsePeopleOptions, type UsePeopleReturn, type UsePersonOptions, type UsePersonReturn, type UseProductsOptions, type UseProductsReturn, type UseRealtimeVisitorsReturn, type UseSiteSettingsOptions, type UseSiteSettingsReturn, type UseSubmissionsOptions, type UseSubmissionsReturn, type UseSubscriptionsOptions, type UseSubscriptionsReturn, type VariantInventory, type VariantOptionValue, VariantsEditor, type VariantsEditorProps, ViewShell, type ViewShellProps, WebhookDeliveries, type WebhookDeliveriesProps, WebhookSettings, type WebhookSettingsProps, chargedTotal, createApiClient, formatPrice, isZeroDecimalCurrency, toMajorUnits, toMinorUnits, useAifeaturesContext as useAifeatures, useAifeaturesContext, useAnalytics, useBusinessSummary, useCsvExport, useCustomers, useEventDestinations, useForms, useInvoices, useOrders, usePaymentsStatus, usePeople, usePerson, useProducts, useRealtimeVisitors, useRetainers, useSiteSettings, useSubmissions, useSubscriptions };
|
|
4077
|
+
export { AUDIENCE_PAGE_SIZE, 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 Broadcast, type BroadcastPlan, type BroadcastStatus, type BroadcastTargeting, type BusinessSummary, type BusinessVisitors, type ContactConsentStatus, ContactImport, type ContactImportProps, type ContactImportReport, type ContactTagRef, 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, DOUBLE_OPT_IN_HELP, DashboardView, type DashboardViewProps, EMAIL_ORG_ACTIONS, EMAIL_READINESS_TEXT, type EmailDelivery, type EmailDomainSetupResult, type EmailDraft, type EmailDraftBlock, type EmailDraftKind, type EmailDraftPreview, type EmailOrgAction, type EmailOrgRequest, type EmailResource, type EmailSideStatus, EmailView, type EmailViewProps, 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, IMPORT_ATTESTATION, type ImportSkipReason, 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 MarketingContact, type MarketingContactStats, type MarketingContactsPage, type MarketingSettings, type MarketingTag, 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 RecoveryFlow, type RecoveryStep, 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 UseAudienceOptions, type UseAudienceReturn, type UseBroadcastsOptions, type UseBusinessSummaryOptions, type UseBusinessSummaryReturn, type UseCsvExportOptions, type UseCsvExportReturn, type UseCustomersOptions, type UseCustomersReturn, type UseEmailDraftsOptions, 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, type WelcomeSequence, type WelcomeStep, buildEmailOrgRequest, chargedTotal, createApiClient, emailReadinessText, formatPrice, isEmailOrgAction, isZeroDecimalCurrency, toMajorUnits, toMinorUnits, useAifeaturesContext as useAifeatures, useAifeaturesContext, useAnalytics, useAudience, useBroadcasts, useBusinessSummary, useCsvExport, useCustomers, useEmailDrafts, useEventDestinations, useForms, useInvoices, useOrders, usePaymentsStatus, usePeople, usePerson, useProducts, useRealtimeVisitors, useRetainers, useSiteSettings, useSubmissions, useSubscriptions };
|