@jsb188/mday 1.1.2

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.
Files changed (202) hide show
  1. package/package.json +142 -0
  2. package/src/constants/agentMemory.ts +166 -0
  3. package/src/constants/agentNote.ts +212 -0
  4. package/src/constants/aiChat.ts +10 -0
  5. package/src/constants/billing.ts +126 -0
  6. package/src/constants/campaign.ts +236 -0
  7. package/src/constants/contact.ts +72 -0
  8. package/src/constants/csvExport.ts +133 -0
  9. package/src/constants/dataTable.ts +22 -0
  10. package/src/constants/dataTableFieldTypes.generated.ts +59 -0
  11. package/src/constants/docAccess.ts +33 -0
  12. package/src/constants/dt.ts +234 -0
  13. package/src/constants/email.ts +146 -0
  14. package/src/constants/fieldDoc.ts +104 -0
  15. package/src/constants/graphqlReactivity.ts +196 -0
  16. package/src/constants/inboundContact.ts +8 -0
  17. package/src/constants/integration.ts +13 -0
  18. package/src/constants/log.ts +21 -0
  19. package/src/constants/logDisplay/README.md +88 -0
  20. package/src/constants/logDisplay/defaults.ts +39 -0
  21. package/src/constants/logDisplay/index.ts +27 -0
  22. package/src/constants/logDisplay/operations/arable.ts +16 -0
  23. package/src/constants/logDisplay/operations/farmersMarket.ts +10 -0
  24. package/src/constants/logDisplay/operations/foodManufacturing.ts +13 -0
  25. package/src/constants/logDisplay/shared/accounting.ts +13 -0
  26. package/src/constants/logDisplay/shared/interactions.ts +13 -0
  27. package/src/constants/logDisplay/shared/rackTemperatures.ts +42 -0
  28. package/src/constants/logTaxonomy.generated.ts +2199 -0
  29. package/src/constants/noteDoc.ts +77 -0
  30. package/src/constants/organization.ts +60 -0
  31. package/src/constants/pageRoute.ts +23 -0
  32. package/src/constants/qrCode.ts +30 -0
  33. package/src/constants/sheet.ts +132 -0
  34. package/src/constants/sms.ts +18 -0
  35. package/src/constants/square.ts +16 -0
  36. package/src/constants/storage.ts +85 -0
  37. package/src/constants/usage.ts +82 -0
  38. package/src/constants/workflowSteps.ts +60 -0
  39. package/src/schemas/editLogEntry.ts +879 -0
  40. package/src/schemas/inboundContact.ts +77 -0
  41. package/src/schemas/logsQuery.ts +93 -0
  42. package/src/types/account.d.ts +81 -0
  43. package/src/types/agentMemory.d.ts +100 -0
  44. package/src/types/agentNote.d.ts +441 -0
  45. package/src/types/billing.d.ts +537 -0
  46. package/src/types/campaign.d.ts +1533 -0
  47. package/src/types/contact.d.ts +15 -0
  48. package/src/types/csvExport.d.ts +213 -0
  49. package/src/types/dataAnalysis.d.ts +44 -0
  50. package/src/types/dataTable.d.ts +159 -0
  51. package/src/types/definitionElement.d.ts +35 -0
  52. package/src/types/docAccess.d.ts +96 -0
  53. package/src/types/dt.d.ts +257 -0
  54. package/src/types/email.d.ts +231 -0
  55. package/src/types/emailReplyReport.d.ts +76 -0
  56. package/src/types/fieldDoc.d.ts +702 -0
  57. package/src/types/fieldDocContract.d.ts +90 -0
  58. package/src/types/inboundContact.d.ts +65 -0
  59. package/src/types/integration.d.ts +42 -0
  60. package/src/types/log.d.ts +338 -0
  61. package/src/types/logDisplay.types.ts +85 -0
  62. package/src/types/organization.d.ts +350 -0
  63. package/src/types/pageRoute.d.ts +48 -0
  64. package/src/types/qrCode.d.ts +96 -0
  65. package/src/types/richText.d.ts +81 -0
  66. package/src/types/sheet.d.ts +847 -0
  67. package/src/types/sms.d.ts +38 -0
  68. package/src/types/storage.d.ts +481 -0
  69. package/src/types/usage.d.ts +106 -0
  70. package/src/types/workflow.d.ts +435 -0
  71. package/src/utils/agentMemory.ts +15 -0
  72. package/src/utils/agentNote.ts +850 -0
  73. package/src/utils/aiChat.ts +43 -0
  74. package/src/utils/aiChatWork.ts +64 -0
  75. package/src/utils/billing.ts +37 -0
  76. package/src/utils/campaign.ts +1173 -0
  77. package/src/utils/campaignAI.ts +72 -0
  78. package/src/utils/campaignAccess.ts +239 -0
  79. package/src/utils/campaignEmail.ts +601 -0
  80. package/src/utils/campaignEmailCompiler.ts +372 -0
  81. package/src/utils/campaignEmailImages.ts +60 -0
  82. package/src/utils/campaignEmailStyles.ts +544 -0
  83. package/src/utils/campaignLifecycle.ts +104 -0
  84. package/src/utils/campaignPreview.ts +285 -0
  85. package/src/utils/contact.ts +50 -0
  86. package/src/utils/csvExport.ts +19 -0
  87. package/src/utils/dataTable.ts +311 -0
  88. package/src/utils/dataTableFieldTypeRegistry.ts +106 -0
  89. package/src/utils/dataTableRelativeDate.ts +447 -0
  90. package/src/utils/definitionElement.ts +84 -0
  91. package/src/utils/docAccess.ts +383 -0
  92. package/src/utils/documentName.ts +53 -0
  93. package/src/utils/email.ts +379 -0
  94. package/src/utils/emailReplyReport.test.ts +187 -0
  95. package/src/utils/emailReplyReport.ts +143 -0
  96. package/src/utils/fieldDoc.ts +157 -0
  97. package/src/utils/fieldDocAnswers.ts +128 -0
  98. package/src/utils/fieldDocDefaults.ts +36 -0
  99. package/src/utils/fieldDocProgram.ts +36 -0
  100. package/src/utils/fieldDocSummary.ts +30 -0
  101. package/src/utils/log.ts +357 -0
  102. package/src/utils/logDisplay.helpers.ts +177 -0
  103. package/src/utils/logDisplay.ts +87 -0
  104. package/src/utils/logRegistryValue.ts +90 -0
  105. package/src/utils/logStoreRead.ts +262 -0
  106. package/src/utils/logTaxonomy.helpers.ts +17 -0
  107. package/src/utils/logTaxonomy.ts +76 -0
  108. package/src/utils/logTaxonomyDisplay.ts +395 -0
  109. package/src/utils/noteDoc.ts +609 -0
  110. package/src/utils/organization.ts +669 -0
  111. package/src/utils/pageRoute.ts +71 -0
  112. package/src/utils/qrCode.helpers.ts +189 -0
  113. package/src/utils/qrCode.test.ts +519 -0
  114. package/src/utils/qrCode.ts +273 -0
  115. package/src/utils/richTextHTML.ts +385 -0
  116. package/src/utils/sheet.ts +262 -0
  117. package/src/utils/sheetAxisMove.ts +616 -0
  118. package/src/utils/sheetBootstrap.ts +1402 -0
  119. package/src/utils/sheetCellLiteral.ts +101 -0
  120. package/src/utils/sheetCommand.ts +358 -0
  121. package/src/utils/sheetDesign.ts +705 -0
  122. package/src/utils/sheetExport.ts +186 -0
  123. package/src/utils/sheetFeatureReference.ts +183 -0
  124. package/src/utils/sheetFormulaArgs.ts +168 -0
  125. package/src/utils/sheetFormulaCompile.ts +475 -0
  126. package/src/utils/sheetFormulaConditionalAggregate.ts +254 -0
  127. package/src/utils/sheetFormulaCriteria.ts +656 -0
  128. package/src/utils/sheetFormulaDate.ts +444 -0
  129. package/src/utils/sheetFormulaEvaluation.ts +899 -0
  130. package/src/utils/sheetFormulaEvaluator.ts +997 -0
  131. package/src/utils/sheetFormulaFunctionHandlers.ts +403 -0
  132. package/src/utils/sheetFormulaLogical.ts +116 -0
  133. package/src/utils/sheetFormulaLookup.ts +488 -0
  134. package/src/utils/sheetFormulaMath.ts +48 -0
  135. package/src/utils/sheetFormulaParser.ts +729 -0
  136. package/src/utils/sheetFormulaRange.ts +330 -0
  137. package/src/utils/sheetFormulaReference.ts +703 -0
  138. package/src/utils/sheetFormulaReferenceAggregates.ts +313 -0
  139. package/src/utils/sheetFormulaReferenceDates.ts +237 -0
  140. package/src/utils/sheetFormulaReferenceLogical.ts +330 -0
  141. package/src/utils/sheetFormulaReferenceLookup.ts +341 -0
  142. package/src/utils/sheetFormulaReferenceMath.ts +95 -0
  143. package/src/utils/sheetFormulaReferenceRewrite.ts +220 -0
  144. package/src/utils/sheetFormulaReferenceText.ts +462 -0
  145. package/src/utils/sheetFormulaSyntax.ts +1027 -0
  146. package/src/utils/sheetFormulaText.ts +430 -0
  147. package/src/utils/sheetJournal.ts +200 -0
  148. package/src/utils/sheetNumberFormat.ts +1012 -0
  149. package/src/utils/sheetPreview.ts +68 -0
  150. package/src/utils/sheetSequence.ts +118 -0
  151. package/src/utils/sheetSnapshot.ts +739 -0
  152. package/src/utils/sheetStructureEdit.ts +914 -0
  153. package/src/utils/sheetStructureReferences.ts +389 -0
  154. package/src/utils/square.ts +32 -0
  155. package/src/utils/storage.ts +198 -0
  156. package/src/utils/table-route.ts +262 -0
  157. package/src/utils/time.ts +12 -0
  158. package/src/utils/workflow.ts +506 -0
  159. package/src/utils/workflowLogFingerprint.ts +302 -0
  160. package/src/utils/workflowLogRevisionSnapshot.ts +424 -0
  161. package/src/utils/workflowProgress.ts +280 -0
  162. package/src/utils/workflowTriggers.ts +61 -0
  163. package/tests/agentNote.test.ts +395 -0
  164. package/tests/campaignAI.test.ts +119 -0
  165. package/tests/campaignAccess.test.ts +239 -0
  166. package/tests/campaignEmail.test.ts +441 -0
  167. package/tests/campaignLifecycle.test.ts +134 -0
  168. package/tests/campaignPublication.test.ts +309 -0
  169. package/tests/dataTableFieldTypeRegistry.test.ts +111 -0
  170. package/tests/dataTableRelativeDate.test.ts +412 -0
  171. package/tests/docAccess.test.ts +525 -0
  172. package/tests/editLogEntry.test.ts +112 -0
  173. package/tests/email.test.ts +39 -0
  174. package/tests/fieldDocProgram.test.ts +114 -0
  175. package/tests/logDisplay.fixtures.ts +67 -0
  176. package/tests/logDisplay.test.ts +227 -0
  177. package/tests/noteDoc.test.ts +514 -0
  178. package/tests/richTextHTML.test.ts +185 -0
  179. package/tests/sheetAxisMove.test.ts +352 -0
  180. package/tests/sheetBootstrap.test.ts +1967 -0
  181. package/tests/sheetFeatureReference.test.ts +22 -0
  182. package/tests/sheetFormulaCriteria.test.ts +269 -0
  183. package/tests/sheetFormulaEvaluator.test.ts +468 -0
  184. package/tests/sheetFormulaFunctions.test.ts +538 -0
  185. package/tests/sheetFormulaLanguage.test.ts +361 -0
  186. package/tests/sheetFormulaParity.fixtures.ts +872 -0
  187. package/tests/sheetFormulaParity.test.ts +188 -0
  188. package/tests/sheetFormulaRange.test.ts +167 -0
  189. package/tests/sheetFormulaReference.test.ts +78 -0
  190. package/tests/sheetFormulaReferenceRewrite.test.ts +117 -0
  191. package/tests/sheetFormulaTextDate.test.ts +512 -0
  192. package/tests/sheetSequence.test.ts +22 -0
  193. package/tests/sheetSnapshot.test.ts +134 -0
  194. package/tests/sheetStructureEdit.test.ts +537 -0
  195. package/tests/sheetStructureReferences.test.ts +589 -0
  196. package/tests/workflowLifecycleStatus.test.ts +60 -0
  197. package/tests/workflowLogFingerprint.test.ts +203 -0
  198. package/tests/workflowLogRevisionSnapshot.test.ts +96 -0
  199. package/tests/workflowProgress.test.ts +180 -0
  200. package/tests/workflowTriggers.test.ts +29 -0
  201. package/tsconfig.json +12 -0
  202. package/vitest.config.ts +8 -0
@@ -0,0 +1,1533 @@
1
+ import {
2
+ CAMPAIGN_AUDIENCE_ENUMS,
3
+ CAMPAIGN_DRAFT_RESET_SOURCES,
4
+ CAMPAIGN_ELEMENT_KINDS,
5
+ CAMPAIGN_ELEMENT_TYPES,
6
+ CAMPAIGN_ELEMENT_VISIBLE_WHEN_OPERATORS,
7
+ CAMPAIGN_EMAIL_ALIGNMENTS,
8
+ CAMPAIGN_EMAIL_BLOCK_TYPES,
9
+ CAMPAIGN_EMAIL_BUTTON_STYLES,
10
+ CAMPAIGN_EMAIL_HEADING_LEVELS,
11
+ CAMPAIGN_FORM_BACKGROUND_FILL_STYLES,
12
+ CAMPAIGN_GENERATION_GRAPHQL_STATUS_ENUMS,
13
+ CAMPAIGN_GENERATION_PROGRESS_STAGES,
14
+ CAMPAIGN_GENERATION_STATUS_ENUMS,
15
+ CAMPAIGN_KIND_ENUMS,
16
+ CAMPAIGN_MANAGEMENT_OPERATION_ENUMS,
17
+ CAMPAIGN_PUBLISH_STATUS_ENUMS,
18
+ CAMPAIGN_SORT_ENUMS,
19
+ CAMPAIGN_STATUS_ENUMS,
20
+ CAMPAIGN_TEMPLATE_GRAPHQL_STATUS_ENUMS,
21
+ CAMPAIGN_TEMPLATE_STATUS_ENUMS,
22
+ CAMPAIGN_TEMPLATE_TYPES,
23
+ } from '../constants/campaign.ts';
24
+ import type {
25
+ DefinitionElementBaseData,
26
+ DefinitionElementStorageRelBaseData,
27
+ DefinitionSectionWithElementsObj,
28
+ } from './definitionElement.d.ts';
29
+ import type { DocAccessGrantObj } from './docAccess.d.ts';
30
+ import type { OutboundEmailStatusEnum } from './email.d.ts';
31
+ import type { OrganizationData, OrganizationOperationEnum } from './organization.d.ts';
32
+ import type { StorageData, StorageGQL } from './storage.d.ts';
33
+
34
+ /**
35
+ * Enums
36
+ */
37
+
38
+ export type CampaignKindEnum = (typeof CAMPAIGN_KIND_ENUMS)[number];
39
+ export type CampaignsSortEnum = (typeof CAMPAIGN_SORT_ENUMS)[number];
40
+ export type CampaignAudienceEnum = (typeof CAMPAIGN_AUDIENCE_ENUMS)[number];
41
+ export type FormCampaignAudienceEnum = Exclude<CampaignAudienceEnum, 'INBOUND_CONTACTS'>;
42
+ export type CampaignTemplateDatabaseStatusEnum = (typeof CAMPAIGN_TEMPLATE_STATUS_ENUMS)[number];
43
+ export type CampaignTemplateStatusEnum = (typeof CAMPAIGN_TEMPLATE_GRAPHQL_STATUS_ENUMS)[number];
44
+ export type CampaignGenerationDatabaseStatusEnum = (typeof CAMPAIGN_GENERATION_STATUS_ENUMS)[number];
45
+ export type CampaignGenerationStatusEnum = (typeof CAMPAIGN_GENERATION_GRAPHQL_STATUS_ENUMS)[number];
46
+ export type CampaignGenerationProgressStageEnum = (typeof CAMPAIGN_GENERATION_PROGRESS_STAGES)[number];
47
+ export type CampaignStatusEnum = (typeof CAMPAIGN_STATUS_ENUMS)[number];
48
+ export type CampaignEmailRecipientSelectionModeEnum = 'AUDIENCE_LISTS' | 'NETWORK_ORGANIZATIONS';
49
+ export type CampaignPublishStatusEnum = (typeof CAMPAIGN_PUBLISH_STATUS_ENUMS)[number];
50
+ export type CampaignDraftResetSourceEnum = (typeof CAMPAIGN_DRAFT_RESET_SOURCES)[number];
51
+ export type CampaignManagementOperationEnum = (typeof CAMPAIGN_MANAGEMENT_OPERATION_ENUMS)[number];
52
+ export type CampaignElementKindEnum = (typeof CAMPAIGN_ELEMENT_KINDS)[number];
53
+ export type CampaignElementTypeEnum = (typeof CAMPAIGN_ELEMENT_TYPES)[number];
54
+ export type CampaignElementVisibleWhenOperatorEnum = (typeof CAMPAIGN_ELEMENT_VISIBLE_WHEN_OPERATORS)[number];
55
+ export type CampaignTemplateType = (typeof CAMPAIGN_TEMPLATE_TYPES)[number];
56
+ export type CampaignFormBackgroundFillStyleEnum = (typeof CAMPAIGN_FORM_BACKGROUND_FILL_STYLES)[number];
57
+ export type CampaignEmailBlockTypeEnum = (typeof CAMPAIGN_EMAIL_BLOCK_TYPES)[number];
58
+ export type CampaignEmailHeadingLevelEnum = (typeof CAMPAIGN_EMAIL_HEADING_LEVELS)[number];
59
+ export type CampaignEmailAlignmentEnum = (typeof CAMPAIGN_EMAIL_ALIGNMENTS)[number];
60
+ export type CampaignEmailButtonStyleEnum = (typeof CAMPAIGN_EMAIL_BUTTON_STYLES)[number];
61
+
62
+ /**
63
+ * Filters
64
+ */
65
+
66
+ export interface CampaignTemplatesFilterArgs {
67
+ archived?: boolean | null;
68
+ kind?: CampaignKindEnum | null;
69
+ status?: CampaignTemplateDatabaseStatusEnum | null;
70
+ }
71
+
72
+ export type SystemCampaignTemplatesFilterArgs = Pick<CampaignTemplatesFilterArgs, 'kind' | 'status'>;
73
+
74
+ export interface CampaignsFilterArgs {
75
+ scheduledStartDate?: string | null;
76
+ scheduledEndDate?: string | null;
77
+ templateId?: string | null;
78
+ kind?: CampaignKindEnum | null;
79
+ status?: CampaignStatusEnum[] | null;
80
+ archived?: boolean | null;
81
+ }
82
+
83
+ export interface CampaignStatusCommandInputObj {
84
+ expectedStatus: CampaignStatusEnum;
85
+ idempotencyKey: string;
86
+ }
87
+
88
+ export interface SendEmailCampaignCommandInputObj extends CampaignStatusCommandInputObj {
89
+ expectedEditVersion: number;
90
+ scheduledAt?: string | null;
91
+ }
92
+
93
+ type CampaignNonEmailLifecycleCommandInputObj =
94
+ | {
95
+ publish: Omit<CampaignStatusCommandInputObj, 'expectedStatus'> & {
96
+ audience?: FormCampaignAudienceEnum;
97
+ expectedEditVersion: number;
98
+ expectedStatus: CampaignPublishStatusEnum;
99
+ scheduledAt?: string | null;
100
+ closesAt?: string | null;
101
+ };
102
+ reschedule?: never;
103
+ openNow?: never;
104
+ setCloseTime?: never;
105
+ clearCloseTime?: never;
106
+ closeNow?: never;
107
+ cancel?: never;
108
+ archive?: never;
109
+ }
110
+ | {
111
+ publish?: never;
112
+ reschedule: CampaignStatusCommandInputObj & { scheduledAt: string };
113
+ openNow?: never;
114
+ setCloseTime?: never;
115
+ clearCloseTime?: never;
116
+ closeNow?: never;
117
+ cancel?: never;
118
+ archive?: never;
119
+ }
120
+ | {
121
+ publish?: never;
122
+ reschedule?: never;
123
+ openNow: CampaignStatusCommandInputObj;
124
+ setCloseTime?: never;
125
+ clearCloseTime?: never;
126
+ closeNow?: never;
127
+ cancel?: never;
128
+ archive?: never;
129
+ }
130
+ | {
131
+ publish?: never;
132
+ reschedule?: never;
133
+ openNow?: never;
134
+ setCloseTime: CampaignStatusCommandInputObj & { closesAt: string };
135
+ clearCloseTime?: never;
136
+ closeNow?: never;
137
+ cancel?: never;
138
+ archive?: never;
139
+ }
140
+ | {
141
+ publish?: never;
142
+ reschedule?: never;
143
+ openNow?: never;
144
+ setCloseTime?: never;
145
+ clearCloseTime: CampaignStatusCommandInputObj;
146
+ closeNow?: never;
147
+ cancel?: never;
148
+ archive?: never;
149
+ }
150
+ | {
151
+ publish?: never;
152
+ reschedule?: never;
153
+ openNow?: never;
154
+ setCloseTime?: never;
155
+ clearCloseTime?: never;
156
+ closeNow: CampaignStatusCommandInputObj;
157
+ cancel?: never;
158
+ archive?: never;
159
+ }
160
+ | {
161
+ publish?: never;
162
+ reschedule?: never;
163
+ openNow?: never;
164
+ setCloseTime?: never;
165
+ clearCloseTime?: never;
166
+ closeNow?: never;
167
+ cancel: CampaignStatusCommandInputObj;
168
+ archive?: never;
169
+ }
170
+ | {
171
+ publish?: never;
172
+ reschedule?: never;
173
+ openNow?: never;
174
+ setCloseTime?: never;
175
+ clearCloseTime?: never;
176
+ closeNow?: never;
177
+ cancel?: never;
178
+ archive: CampaignStatusCommandInputObj;
179
+ };
180
+
181
+ export type CampaignLifecycleCommandInputObj =
182
+ | {
183
+ sendEmail: SendEmailCampaignCommandInputObj;
184
+ retryEmail?: never;
185
+ publish?: never;
186
+ reschedule?: never;
187
+ openNow?: never;
188
+ setCloseTime?: never;
189
+ clearCloseTime?: never;
190
+ closeNow?: never;
191
+ cancel?: never;
192
+ archive?: never;
193
+ }
194
+ | {
195
+ retryEmail: Omit<SendEmailCampaignCommandInputObj, 'scheduledAt'>;
196
+ sendEmail?: never;
197
+ publish?: never;
198
+ reschedule?: never;
199
+ openNow?: never;
200
+ setCloseTime?: never;
201
+ clearCloseTime?: never;
202
+ closeNow?: never;
203
+ cancel?: never;
204
+ archive?: never;
205
+ }
206
+ | (CampaignNonEmailLifecycleCommandInputObj & {
207
+ sendEmail?: never;
208
+ retryEmail?: never;
209
+ });
210
+
211
+ export type CampaignSettingsCommandInputObj =
212
+ | {
213
+ setFormSettings: {
214
+ expectedEditVersion: number;
215
+ settings: FormCampaignSettingsPatchInputObj;
216
+ };
217
+ sendEmail?: never;
218
+ retryEmail?: never;
219
+ publish?: never;
220
+ reschedule?: never;
221
+ openNow?: never;
222
+ setCloseTime?: never;
223
+ clearCloseTime?: never;
224
+ closeNow?: never;
225
+ cancel?: never;
226
+ archive?: never;
227
+ resetDraft?: never;
228
+ }
229
+ | {
230
+ resetDraft: {
231
+ expectedEditVersion: number;
232
+ source: CampaignDraftResetSourceEnum;
233
+ };
234
+ setFormSettings?: never;
235
+ sendEmail?: never;
236
+ retryEmail?: never;
237
+ publish?: never;
238
+ reschedule?: never;
239
+ openNow?: never;
240
+ setCloseTime?: never;
241
+ clearCloseTime?: never;
242
+ closeNow?: never;
243
+ cancel?: never;
244
+ archive?: never;
245
+ }
246
+ | (CampaignLifecycleCommandInputObj & {
247
+ setFormSettings?: never;
248
+ resetDraft?: never;
249
+ });
250
+
251
+ export interface EditCampaignSettingsInputObj {
252
+ organizationId: string;
253
+ campaignId: string;
254
+ command: CampaignSettingsCommandInputObj;
255
+ }
256
+
257
+ export interface CreateCampaignTemplateInputObj {
258
+ organizationId: string;
259
+ kind: CampaignKindEnum;
260
+ title: string;
261
+ description?: string | null;
262
+ }
263
+
264
+ export interface CreateFormCampaignDraftInputObj {
265
+ title: string;
266
+ organizationId: string;
267
+ templateId: string;
268
+ idempotencyKey: string;
269
+ expectedTemplateEditVersion: number;
270
+ }
271
+
272
+ export interface CreateEmailCampaignDraftInputObj extends CreateFormCampaignDraftInputObj {}
273
+
274
+ /** @deprecated Create an email campaign draft, select audience lists, then use command.sendEmail. */
275
+ export interface SendCampaignEmailInputObj {
276
+ organizationId: string;
277
+ templateId: string;
278
+ audienceListIds?: string[] | null;
279
+ idempotencyKey: string;
280
+ scheduledAt?: string | null;
281
+ }
282
+
283
+ export interface CampaignResponsesFilterArgs {
284
+ campaignId: string;
285
+ }
286
+
287
+ export interface CampaignRecipientsFilterArgs {
288
+ campaignId: string;
289
+ query?: string | null;
290
+ deliveryStatus?: OutboundEmailStatusEnum[] | null;
291
+ }
292
+
293
+ /**
294
+ * Email builder document
295
+ */
296
+
297
+ export interface CampaignEmailLinkObj {
298
+ label: string;
299
+ url: string;
300
+ }
301
+
302
+ export interface CampaignEmailBlockContentObj {
303
+ text?: string | null;
304
+ // A JSON-string serialized, sanitized RichTextDocument.
305
+ richText?: string | null;
306
+ url?: string | null;
307
+ altText?: string | null;
308
+ heading?: string | null;
309
+ headingLevel?: CampaignEmailHeadingLevelEnum | null;
310
+ buttonLabel?: string | null;
311
+ buttonUrl?: string | null;
312
+ links: CampaignEmailLinkObj[];
313
+ }
314
+
315
+ export interface CampaignEmailBlockSettingsObj {
316
+ alignment: CampaignEmailAlignmentEnum;
317
+ textColor?: string | null;
318
+ backgroundColor?: string | null;
319
+ fontSize?: number | null;
320
+ padding: string;
321
+ height?: number | null;
322
+ buttonStyle?: CampaignEmailButtonStyleEnum | null;
323
+ }
324
+
325
+ export interface CampaignEmailBlockObj {
326
+ key: string;
327
+ order: number;
328
+ type: CampaignEmailBlockTypeEnum;
329
+ content: CampaignEmailBlockContentObj;
330
+ settings: CampaignEmailBlockSettingsObj;
331
+ files?: CampaignDefinitionFileGQL[];
332
+ imageStorageIds?: string[];
333
+ }
334
+
335
+ export interface CampaignEmailColumnObj {
336
+ key: string;
337
+ order: number;
338
+ // Integer percentage; all columns in one row must total 100.
339
+ width: number;
340
+ blocks: CampaignEmailBlockObj[];
341
+ }
342
+
343
+ export interface CampaignEmailRowSettingsObj {
344
+ backgroundColor?: string | null;
345
+ padding: string;
346
+ }
347
+
348
+ export interface CampaignEmailRowObj {
349
+ key: string;
350
+ order: number;
351
+ settings: CampaignEmailRowSettingsObj;
352
+ columns: CampaignEmailColumnObj[];
353
+ }
354
+
355
+ export interface CampaignEmailDefinitionObj {
356
+ schemaVersion: number;
357
+ rows: CampaignEmailRowObj[];
358
+ }
359
+
360
+ export interface CampaignEmailRowColumnStorageObj {
361
+ key: string;
362
+ order: number;
363
+ width: number;
364
+ }
365
+
366
+ // Stored inside one SECTION element's settings.emailRow JSONB member.
367
+ export interface CampaignEmailRowStorageSettingsObj extends CampaignEmailRowSettingsObj {
368
+ columns: CampaignEmailRowColumnStorageObj[];
369
+ }
370
+
371
+ // Stored inside one CONTENT element's settings.emailBlock JSONB member.
372
+ export interface CampaignEmailBlockStorageSettingsObj {
373
+ columnKey: string;
374
+ type: CampaignEmailBlockTypeEnum;
375
+ content: CampaignEmailBlockContentObj;
376
+ settings: CampaignEmailBlockSettingsObj;
377
+ }
378
+
379
+ /**
380
+ * Campaign template elements (the campaign_template_elements table)
381
+ */
382
+
383
+ // One selectable choice. "value" is a stable slug that answers store; "label"
384
+ // is display text and may be edited without orphaning historical answers.
385
+ export interface CampaignElementOptionObj {
386
+ value: string;
387
+ label: string;
388
+ }
389
+
390
+ // Answer constraints; which keys apply depends on the element's type
391
+ export interface CampaignElementValidationObj {
392
+ minLength?: number;
393
+ maxLength?: number;
394
+ min?: number;
395
+ max?: number;
396
+ maxFiles?: number;
397
+ acceptedContentTypes?: string[];
398
+ }
399
+
400
+ // Show this element only when another element's answer matches
401
+ export interface CampaignElementVisibleWhenObj {
402
+ elementKey: string;
403
+ operator: CampaignElementVisibleWhenOperatorEnum;
404
+ value?: string | string[] | null;
405
+ }
406
+
407
+ export interface CampaignElementVisibleWhenValuesObj {
408
+ elementKey: string;
409
+ operator: CampaignElementVisibleWhenOperatorEnum;
410
+ values: string[];
411
+ }
412
+
413
+ // Sparse presentation flags; absent means false
414
+ export interface CampaignElementSettingsObj {
415
+ numbered?: boolean; // Render children of this section as a numbered list
416
+ fullWidth?: boolean;
417
+ emailRow?: CampaignEmailRowStorageSettingsObj | null;
418
+ emailBlock?: CampaignEmailBlockStorageSettingsObj | null;
419
+ }
420
+
421
+ export interface CampaignElementSettingsGQL {
422
+ numbered: boolean;
423
+ fullWidth: boolean;
424
+ emailRow?: CampaignEmailRowStorageSettingsObj | null;
425
+ emailBlock?: CampaignEmailBlockStorageSettingsObj | null;
426
+ }
427
+
428
+ export interface CampaignElementData
429
+ extends DefinitionElementBaseData<
430
+ CampaignElementKindEnum,
431
+ CampaignElementOptionObj,
432
+ CampaignElementSettingsObj,
433
+ CampaignElementStorageRelData
434
+ > {
435
+ __table: 'campaign_template_elements';
436
+ templateId: number | bigint;
437
+ type?: CampaignElementTypeEnum | null; // Set if and only if kind is QUESTION
438
+ /** @deprecated Retained only for historical definition reads. */
439
+ aiPrompt?: string | null;
440
+ placeholder?: string | null;
441
+ validation?: CampaignElementValidationObj | null;
442
+ visibleWhen?: CampaignElementVisibleWhenObj | null;
443
+ }
444
+
445
+ export interface CampaignElementStorageRelData extends DefinitionElementStorageRelBaseData {
446
+ __table: 'campaign_element_storage_rels';
447
+ elementId: number | bigint;
448
+ }
449
+
450
+ export type CampaignSectionWithElementsObj = DefinitionSectionWithElementsObj<CampaignElementData>;
451
+
452
+ // The full resolved definition of one template
453
+ export interface CampaignDefinitionObj {
454
+ sections: CampaignSectionWithElementsObj[];
455
+ }
456
+
457
+ export interface CampaignDefinitionSnapshotFileObj {
458
+ uri?: string | null;
459
+ contentType?: string | null;
460
+ size?: number | null;
461
+ }
462
+
463
+ export interface CampaignDefinitionSnapshotStorageRelObj {
464
+ storageId: string;
465
+ order: number;
466
+ file: CampaignDefinitionSnapshotFileObj;
467
+ }
468
+
469
+ export interface CampaignDefinitionSnapshotElementObj {
470
+ key: string;
471
+ kind: CampaignElementKindEnum;
472
+ type?: CampaignElementTypeEnum | null;
473
+ order: number;
474
+ label?: string | null;
475
+ description?: string | null;
476
+ /** @deprecated Retained only for historical definition reads. */
477
+ aiPrompt?: string | null;
478
+ placeholder?: string | null;
479
+ options?: CampaignElementOptionObj[] | null;
480
+ required: boolean;
481
+ validation?: CampaignElementValidationObj | null;
482
+ visibleWhen?: CampaignElementVisibleWhenObj | null;
483
+ settings?: CampaignElementSettingsObj | null;
484
+ storageRels: CampaignDefinitionSnapshotStorageRelObj[];
485
+ }
486
+
487
+ export interface CampaignDefinitionSnapshotSectionObj extends CampaignDefinitionSnapshotElementObj {
488
+ elements: CampaignDefinitionSnapshotElementObj[];
489
+ }
490
+
491
+ /**
492
+ * Campaign templates (the campaign_templates table)
493
+ */
494
+
495
+ export interface FormCampaignSettingsObj {
496
+ // Source-owned preference; omitted by content normalizers and preserved by the database.
497
+ agentNoteDisabled?: boolean;
498
+ color?: string | null;
499
+ backgroundFillStyle?: CampaignFormBackgroundFillStyleEnum | null;
500
+ confirmationMessage?: string | null;
501
+ }
502
+
503
+ export interface CampaignEmailDesignSettingsObj {
504
+ canvasColor?: string | null;
505
+ contentColor?: string | null;
506
+ contentWidth: number;
507
+ fontFamily?: string | null;
508
+ textColor?: string | null;
509
+ linkColor?: string | null;
510
+ padding: string;
511
+ }
512
+
513
+ export interface EmailReplyReportField {
514
+ key: string;
515
+ label: string;
516
+ description: string;
517
+ type: 'NUMBER' | 'TEXT' | 'BOOLEAN';
518
+ unit: string | null;
519
+ }
520
+
521
+ export interface EmailReplyReportDefinition {
522
+ version: 1;
523
+ instructions: string | null;
524
+ fields: EmailReplyReportField[];
525
+ }
526
+
527
+ export interface EmailCampaignSettingsObj {
528
+ // Source-owned preference; omitted by content normalizers and preserved by the database.
529
+ agentNoteDisabled?: boolean;
530
+ subject?: string | null;
531
+ preheader?: string | null;
532
+ body?: string | null;
533
+ aiAgentDomain: string;
534
+ secondaryReplyToEmail?: string | null;
535
+ // Preferred draft send time; delivery starts only after a send command.
536
+ sendAt?: string | null;
537
+ design: CampaignEmailDesignSettingsObj;
538
+ trackOpens: boolean;
539
+ // Database ids (as text) of addresses skipped for this campaign only; pruned
540
+ // to the addresses actually present in the selected lists when the send freezes.
541
+ excludedEmailAddressIds?: string[];
542
+ excludedEmails?: string[];
543
+ excludedOrganizationIds?: string[];
544
+ networkPermissionPolicy?: 'RELATIONSHIP';
545
+ // Server-owned summaries retain the original send receipt across retries and editor updates.
546
+ emailListRecipientSummary?: Record<string, unknown>;
547
+ networkRecipientSummary?: Record<string, unknown>;
548
+ emailListSendInfo?: { senderAddress: string; replyAddress: string; timeZone: string };
549
+ // Server-owned answer definitions keep reporting field identities consistent across replies.
550
+ emailReplyReport?: EmailReplyReportDefinition;
551
+ }
552
+
553
+ export type CampaignSettingsObj = EmailCampaignSettingsObj | FormCampaignSettingsObj;
554
+
555
+ export interface FormCampaignSettingsPatchInputObj {
556
+ color?: string | null;
557
+ backgroundFillStyle?: CampaignFormBackgroundFillStyleEnum | null;
558
+ confirmationMessage?: string | null;
559
+ }
560
+
561
+ export interface CampaignTemplateData {
562
+ __table: 'campaign_templates';
563
+ id: number | bigint;
564
+ organizationId: number | bigint | null;
565
+ editVersion: number | bigint;
566
+ kind: CampaignKindEnum;
567
+ status: CampaignTemplateDatabaseStatusEnum;
568
+ generationError?: string | null; // Only ever set while status is ERROR
569
+ title?: string | null;
570
+ description?: string | null;
571
+ headerImageStorageId?: number | bigint | null;
572
+ settings?: CampaignSettingsObj | null;
573
+ archivedAt?: Date | string | null;
574
+ createdByAccountId?: number | bigint | null;
575
+ createdAt: Date | string;
576
+ updatedAt: Date | string;
577
+
578
+ // Attached by fetch helpers
579
+ elements?: CampaignElementData[];
580
+ headerImage?: StorageData | null;
581
+ }
582
+
583
+ export type CampaignTemplateSummaryData = Pick<
584
+ CampaignTemplateData,
585
+ | 'id'
586
+ | 'organizationId'
587
+ | 'editVersion'
588
+ | 'kind'
589
+ | 'status'
590
+ | 'generationError'
591
+ | 'title'
592
+ | 'description'
593
+ | 'headerImageStorageId'
594
+ | 'archivedAt'
595
+ | 'createdAt'
596
+ | 'updatedAt'
597
+ > & {
598
+ headerImage?: StorageData | null;
599
+ preview?: StorageData | null;
600
+ };
601
+
602
+ /**
603
+ * Campaigns (the campaigns table)
604
+ */
605
+
606
+ // A campaign-owned question tree detached from its mutable source template.
607
+ export interface CampaignDefinitionSnapshotObj {
608
+ schemaVersion: number;
609
+ snapshotSource: string;
610
+ sections: CampaignDefinitionSnapshotSectionObj[];
611
+ }
612
+
613
+ /*
614
+ * Complete respondent-facing state copied from one explicitly published draft.
615
+ */
616
+ export interface CampaignPublishedSnapshotObj {
617
+ schemaVersion: number;
618
+ version: number;
619
+ sourceEditVersion: number;
620
+ publishedAt: string;
621
+ publishedByAccountId?: string | null;
622
+ title?: string | null;
623
+ description?: string | null;
624
+ headerImageStorageId?: string | null;
625
+ settings: FormCampaignSettingsObj;
626
+ definition: CampaignDefinitionSnapshotObj;
627
+ }
628
+
629
+ export interface CampaignData {
630
+ __table: 'campaigns';
631
+ id: number | bigint;
632
+ organizationId: number | bigint;
633
+ editVersion: number | bigint;
634
+ templateId: number | bigint | null;
635
+ idempotencyKey?: string | null;
636
+ emailRecipientSelectionMode?: CampaignEmailRecipientSelectionModeEnum | null;
637
+ audienceFrozenAt?: Date | string | null;
638
+ kind: CampaignKindEnum;
639
+ status: CampaignStatusEnum;
640
+ generationStatus: CampaignGenerationDatabaseStatusEnum;
641
+ generationError?: string | null;
642
+ generationProgress?: string | null;
643
+ generationProgressStage?: CampaignGenerationProgressStageEnum | null;
644
+ publicId?: string | null;
645
+ audience: CampaignAudienceEnum;
646
+ title?: string | null;
647
+ description?: string | null;
648
+ draftSnapshot: CampaignDefinitionSnapshotObj;
649
+ publishedSnapshot?: CampaignPublishedSnapshotObj | null;
650
+ settingsSnapshot: CampaignSettingsObj;
651
+ headerImageStorageId?: number | bigint | null;
652
+ scheduledAt: Date | string | null;
653
+ closesAt?: Date | string | null;
654
+ startedAt?: Date | string | null;
655
+ completedAt?: Date | string | null;
656
+ errorMessage?: string | null;
657
+ archivedAt?: Date | string | null;
658
+ createdByAccountId?: number | bigint | null;
659
+ createdAt: Date | string;
660
+ updatedAt: Date | string;
661
+
662
+ // Attached by fetch helpers
663
+ template?: CampaignTemplateData | null;
664
+ organization?: OrganizationData | null;
665
+ headerImage?: StorageData | null;
666
+ }
667
+
668
+ export type CampaignSummaryData = Pick<
669
+ CampaignData,
670
+ | 'id'
671
+ | 'organizationId'
672
+ | 'templateId'
673
+ | 'kind'
674
+ | 'status'
675
+ | 'generationStatus'
676
+ | 'generationError'
677
+ | 'generationProgress'
678
+ | 'generationProgressStage'
679
+ | 'publicId'
680
+ | 'audience'
681
+ | 'emailRecipientSelectionMode'
682
+ | 'audienceFrozenAt'
683
+ | 'title'
684
+ | 'scheduledAt'
685
+ | 'closesAt'
686
+ | 'startedAt'
687
+ | 'completedAt'
688
+ | 'archivedAt'
689
+ | 'createdAt'
690
+ | 'updatedAt'
691
+ > & {
692
+ preview?: StorageData | null;
693
+ audienceCount: number | null;
694
+ audiencePreview: string[] | null;
695
+ responseCount: number;
696
+ recipientCount: number;
697
+ deliveredCount: number;
698
+ openedCount: number;
699
+ };
700
+
701
+ /**
702
+ * Campaign recipients (the campaign_recipients table)
703
+ */
704
+
705
+ export interface CampaignRecipientData {
706
+ __table: 'campaign_recipients';
707
+ id: number | bigint;
708
+ organizationId: number | bigint;
709
+ campaignId: number | bigint;
710
+ inboundContactId: number | bigint | null;
711
+ emailAddressId: number | bigint | null;
712
+ snapshot: {
713
+ emailAddress: string;
714
+ personName: string | null;
715
+ audienceMemberIds: string[];
716
+ networkPermissionPolicy?: 'RELATIONSHIP';
717
+ networkSources?: { organizationId: string; contactId: string; ownerOrganizationId: string | null }[];
718
+ };
719
+ invitedAt?: Date | string | null;
720
+ firstOpenedAt?: Date | string | null;
721
+ respondedAt?: Date | string | null;
722
+ createdAt: Date | string;
723
+ updatedAt: Date | string;
724
+ }
725
+
726
+ /**
727
+ * Campaign responses (the campaign_responses table)
728
+ */
729
+
730
+ // One answer, keyed by its element.
731
+ export interface CampaignAnswerObj {
732
+ elementKey: string;
733
+ // Copied from the published definition by the server when the answer is saved
734
+ question?: string | null;
735
+ value?: string | string[] | null;
736
+ // Copied from the published definition for selected choices when saved
737
+ selectedOptions?: CampaignElementOptionObj[];
738
+ // Internal answer marker used to withhold AI values from respondent transports.
739
+ ai?: boolean;
740
+ }
741
+
742
+ export interface CampaignAnswersObj {
743
+ [elementKey: string]: CampaignAnswerObj;
744
+ }
745
+
746
+ export interface CampaignResponseData {
747
+ __table: 'campaign_responses';
748
+ submissionVersion: number | bigint;
749
+ // True when no AI work is needed or the whole batch has been saved successfully.
750
+ aiAnswersComplete: boolean;
751
+ aiFinishedAt: Date | string | null;
752
+ id: number | bigint;
753
+ organizationId: number | bigint;
754
+ campaignId: number | bigint;
755
+ respondentAccountId?: number | bigint | null;
756
+ respondentEmail?: string | null;
757
+ respondentName?: string | null;
758
+ childOrgId?: number | bigint | null;
759
+ answers: CampaignAnswersObj;
760
+ submittedAt: Date | string;
761
+ activityAt: Date | string;
762
+ createdAt: Date | string;
763
+ updatedAt: Date | string;
764
+
765
+ // Attached by fetch helpers
766
+ campaign?: CampaignData | null;
767
+ childOrg?: OrganizationData | null;
768
+ }
769
+
770
+ export type CampaignResponseSummaryData = Pick<
771
+ CampaignResponseData,
772
+ | 'id'
773
+ | 'campaignId'
774
+ | 'respondentEmail'
775
+ | 'respondentName'
776
+ | 'childOrgId'
777
+ | 'aiAnswersComplete'
778
+ | 'aiFinishedAt'
779
+ | 'submittedAt'
780
+ | 'activityAt'
781
+ | 'createdAt'
782
+ >;
783
+
784
+ /**
785
+ * Create-campaign modal draft
786
+ */
787
+
788
+ export interface CampaignDraftFile {
789
+ contentType: string;
790
+ fileKey: string;
791
+ fileUri: string;
792
+ name: string;
793
+ storageId: string;
794
+ uploadedAt: number;
795
+ }
796
+
797
+ // Persisted locally so closing and reopening the modal resumes where the user
798
+ // left off. Instructions are held per kind because the modal can switch
799
+ // between a public form and an email without losing either draft.
800
+ export interface CampaignDraft {
801
+ files: CampaignDraftFile[];
802
+ instructions: Record<CampaignKindEnum, string>;
803
+ }
804
+
805
+ /**
806
+ * Canonical editor patch inputs
807
+ */
808
+
809
+ export interface CampaignEditorMetadataPatchInputObj {
810
+ title?: string | null;
811
+ description?: string | null;
812
+ headerImageStorageId?: string | null;
813
+ }
814
+
815
+ export interface EmailCampaignSettingsPatchInputObj {
816
+ subject?: string | null;
817
+ preheader?: string | null;
818
+ aiAgentDomain?: string | null;
819
+ secondaryReplyToEmail?: string | null;
820
+ sendAt?: string | null;
821
+ design?: CampaignEmailDesignSettingsInputObj | null;
822
+ trackOpens?: boolean | null;
823
+ }
824
+
825
+ export interface CampaignEmailDesignSettingsInputObj {
826
+ canvasColor?: string | null;
827
+ contentColor?: string | null;
828
+ contentWidth?: number | null;
829
+ fontFamily?: string | null;
830
+ textColor?: string | null;
831
+ linkColor?: string | null;
832
+ padding?: string | null;
833
+ }
834
+
835
+ export type CampaignEmailDesignSettingsPatchInputObj = CampaignEmailDesignSettingsInputObj;
836
+
837
+ export interface CampaignDefinitionFlatNodeInputObj {
838
+ key: string;
839
+ parentKey?: string | null;
840
+ order: number;
841
+ kind: CampaignElementKindEnum;
842
+ type?: CampaignElementTypeEnum | null;
843
+ label?: string | null;
844
+ description?: string | null;
845
+ placeholder?: string | null;
846
+ options?: CampaignElementOptionObj[] | null;
847
+ required?: boolean | null;
848
+ validation?: CampaignElementValidationObj | null;
849
+ visibleWhen?: CampaignElementVisibleWhenValuesObj | null;
850
+ settings?: CampaignElementSettingsObj | null;
851
+ imageStorageIds?: string[] | null;
852
+ }
853
+
854
+ export interface CampaignDefinitionSectionInputObj {
855
+ key: string;
856
+ order: number;
857
+ label?: string | null;
858
+ description?: string | null;
859
+ settings?: CampaignElementSettingsObj | null;
860
+ imageStorageIds?: string[] | null;
861
+ }
862
+
863
+ export interface CampaignDefinitionContentInputObj extends CampaignDefinitionSectionInputObj {
864
+ parentKey: string;
865
+ visibleWhen?: CampaignElementVisibleWhenValuesObj | null;
866
+ }
867
+
868
+ export interface CampaignDefinitionQuestionInputObj extends CampaignDefinitionContentInputObj {
869
+ type: CampaignElementTypeEnum;
870
+ placeholder?: string | null;
871
+ options?: CampaignElementOptionObj[] | null;
872
+ required?: boolean | null;
873
+ validation?: CampaignElementValidationObj | null;
874
+ }
875
+
876
+ export type CampaignDefinitionNodeInputObj =
877
+ | {
878
+ section: CampaignDefinitionSectionInputObj;
879
+ content?: never;
880
+ question?: never;
881
+ }
882
+ | {
883
+ section?: never;
884
+ content: CampaignDefinitionContentInputObj;
885
+ question?: never;
886
+ }
887
+ | {
888
+ section?: never;
889
+ content?: never;
890
+ question: CampaignDefinitionQuestionInputObj;
891
+ };
892
+
893
+ export interface CampaignDefinitionPatchInputObj {
894
+ upsertNodes?: CampaignDefinitionNodeInputObj[] | null;
895
+ deleteNodeKeys?: string[] | null;
896
+ }
897
+
898
+ export interface CampaignEmailRowSettingsInputObj {
899
+ backgroundColor?: string | null;
900
+ padding?: string | null;
901
+ }
902
+
903
+ export interface CampaignEmailColumnInputObj {
904
+ key: string;
905
+ order: number;
906
+ width: number;
907
+ }
908
+
909
+ export interface CampaignEmailRowInputObj {
910
+ key: string;
911
+ order: number;
912
+ settings?: CampaignEmailRowSettingsInputObj | null;
913
+ columns: CampaignEmailColumnInputObj[];
914
+ }
915
+
916
+ export type CampaignEmailLinkInputObj = CampaignEmailLinkObj;
917
+
918
+ export interface CampaignEmailBlockContentInputObj {
919
+ text?: string | null;
920
+ // A JSON-string serialized, sanitized RichTextDocument.
921
+ richText?: string | null;
922
+ url?: string | null;
923
+ altText?: string | null;
924
+ heading?: string | null;
925
+ headingLevel?: CampaignEmailHeadingLevelEnum | null;
926
+ buttonLabel?: string | null;
927
+ buttonUrl?: string | null;
928
+ links?: CampaignEmailLinkInputObj[] | null;
929
+ }
930
+
931
+ export interface CampaignEmailBlockSettingsInputObj {
932
+ alignment?: CampaignEmailAlignmentEnum | null;
933
+ textColor?: string | null;
934
+ backgroundColor?: string | null;
935
+ fontSize?: number | null;
936
+ padding?: string | null;
937
+ height?: number | null;
938
+ buttonStyle?: CampaignEmailButtonStyleEnum | null;
939
+ }
940
+
941
+ export interface CampaignEmailBlockInputObj {
942
+ key: string;
943
+ parentKey: string;
944
+ columnKey: string;
945
+ order: number;
946
+ type: CampaignEmailBlockTypeEnum;
947
+ content?: CampaignEmailBlockContentInputObj | null;
948
+ settings?: CampaignEmailBlockSettingsInputObj | null;
949
+ imageStorageIds?: string[] | null;
950
+ }
951
+
952
+ export type CampaignEmailDefinitionNodeInputObj =
953
+ | {
954
+ row: CampaignEmailRowInputObj;
955
+ block?: never;
956
+ }
957
+ | {
958
+ row?: never;
959
+ block: CampaignEmailBlockInputObj;
960
+ };
961
+
962
+ export interface CampaignEmailDefinitionPatchInputObj {
963
+ upsertNodes?: CampaignEmailDefinitionNodeInputObj[] | null;
964
+ deleteNodeKeys?: string[] | null;
965
+ }
966
+
967
+ export interface CampaignEditorPatchInputObj {
968
+ metadata?: CampaignEditorMetadataPatchInputObj | null;
969
+ definition?: CampaignDefinitionPatchInputObj | null;
970
+ emailDefinition?: CampaignEmailDefinitionPatchInputObj | null;
971
+ settings?:
972
+ | { form: FormCampaignSettingsPatchInputObj; email?: never }
973
+ | { email: EmailCampaignSettingsPatchInputObj; form?: never }
974
+ | null;
975
+ }
976
+
977
+ export interface CampaignContentEditorPatchInputObj {
978
+ metadata?: CampaignEditorMetadataPatchInputObj | null;
979
+ definition?: CampaignDefinitionPatchInputObj | null;
980
+ emailDefinition?: CampaignEmailDefinitionPatchInputObj | null;
981
+ settings?:
982
+ | {
983
+ form: Omit<FormCampaignSettingsPatchInputObj, 'backgroundFillStyle' | 'color'>;
984
+ email?: never;
985
+ }
986
+ | { email: EmailCampaignSettingsPatchInputObj; form?: never }
987
+ | null;
988
+ }
989
+
990
+ export interface EditCampaignTemplateInputObj {
991
+ organizationId: string;
992
+ templateId: string;
993
+ expectedEditVersion: number;
994
+ patch: CampaignEditorPatchInputObj;
995
+ }
996
+
997
+ export interface EditCampaignInputObj {
998
+ organizationId: string;
999
+ campaignId: string;
1000
+ expectedEditVersion: number;
1001
+ patch: CampaignContentEditorPatchInputObj;
1002
+ }
1003
+
1004
+ export interface UpdateCampaignAccessInputObj {
1005
+ audience: FormCampaignAudienceEnum;
1006
+ campaignId: string;
1007
+ expectedEditVersion: number;
1008
+ grants: DocAccessGrantObj[];
1009
+ organizationId: string;
1010
+ }
1011
+
1012
+ /**
1013
+ * Complete editable access policy for one public-form campaign.
1014
+ */
1015
+
1016
+ export interface CampaignFormAccessObj {
1017
+ audience: FormCampaignAudienceEnum;
1018
+ grants: DocAccessGrantObj[];
1019
+ }
1020
+
1021
+ /**
1022
+ * One organization shown in the campaign-form access target picker.
1023
+ */
1024
+
1025
+ export interface CampaignFormAccessOrganizationGQL {
1026
+ available: boolean;
1027
+ id: string;
1028
+ inNetwork: boolean;
1029
+ name: string;
1030
+ operation?: string | null;
1031
+ }
1032
+
1033
+ /**
1034
+ * Authoritative owner-side campaign-form access session loaded by the Share
1035
+ * modal. The policy revision and grants come from one database snapshot.
1036
+ */
1037
+
1038
+ export interface CampaignFormAccessSessionGQL {
1039
+ audience: FormCampaignAudienceEnum;
1040
+ campaignId: string;
1041
+ editVersion: number;
1042
+ editable: boolean;
1043
+ grants: DocAccessGrantObj[];
1044
+ organizationId: string;
1045
+ organizations: CampaignFormAccessOrganizationGQL[];
1046
+ publicId?: string | null;
1047
+ }
1048
+
1049
+ /**
1050
+ * GraphQL view shapes
1051
+ *
1052
+ * Campaign definitions and settings cross the wire as typed GraphQL objects.
1053
+ */
1054
+
1055
+ export interface CampaignTemplateCoreGQL {
1056
+ id: string;
1057
+ organizationId: string | null;
1058
+ editVersion: number;
1059
+ kind: CampaignKindEnum;
1060
+ status: CampaignTemplateStatusEnum;
1061
+ generationError?: string | null;
1062
+ title?: string | null;
1063
+ description?: string | null;
1064
+ settings: CampaignSettingsGQL;
1065
+ headerImage?: StorageGQL | null;
1066
+ __deleted?: boolean;
1067
+ archivedAt?: string | null;
1068
+ createdAt: string;
1069
+ updatedAt: string;
1070
+ }
1071
+
1072
+ export type CampaignTemplateGQL = CampaignTemplateCoreGQL;
1073
+
1074
+ /**
1075
+ * Generated screenshot metadata for one campaign template.
1076
+ */
1077
+ export interface CampaignTemplatePreviewGQL {
1078
+ uri: string;
1079
+ width: number;
1080
+ height: number;
1081
+ updatedAt: string;
1082
+ }
1083
+
1084
+ /**
1085
+ * Internal, token-authorized renderer payload for one reusable template.
1086
+ */
1087
+ export type CampaignTemplatePreviewCaptureObj =
1088
+ | {
1089
+ templateId: string;
1090
+ templateKind: 'PUBLIC_FORM';
1091
+ revision: string;
1092
+ publicForm: PublicCampaignObj;
1093
+ }
1094
+ | {
1095
+ templateId: string;
1096
+ templateKind: 'EMAIL';
1097
+ revision: string;
1098
+ email: {
1099
+ definition: CampaignEmailDefinitionGQL;
1100
+ settings: EmailCampaignSettingsObj;
1101
+ };
1102
+ };
1103
+
1104
+ export interface CampaignTemplateSummaryGQL {
1105
+ id: string;
1106
+ organizationId: string | null;
1107
+ editable: boolean;
1108
+ editVersion: number;
1109
+ kind: CampaignKindEnum;
1110
+ status: CampaignTemplateStatusEnum;
1111
+ generationError?: string | null;
1112
+ title?: string | null;
1113
+ description?: string | null;
1114
+ headerImage?: StorageGQL | null;
1115
+ preview?: CampaignTemplatePreviewGQL | null;
1116
+ __deleted?: boolean;
1117
+ archivedAt?: string | null;
1118
+ createdAt: string;
1119
+ updatedAt: string;
1120
+ cursor: string;
1121
+ }
1122
+
1123
+ export interface CampaignDefinitionFileGQL {
1124
+ id: string;
1125
+ order: number;
1126
+ uri?: string | null;
1127
+ contentType?: string | null;
1128
+ size?: number | null;
1129
+ name?: string | null;
1130
+ imageData?: { width: number; height: number } | null;
1131
+ }
1132
+
1133
+ /*
1134
+ * GraphQL emits nullable validation members as explicit nulls when requested,
1135
+ * unlike the sparse storage/input representation above.
1136
+ */
1137
+ export interface CampaignElementValidationGQL {
1138
+ minLength?: number | null;
1139
+ maxLength?: number | null;
1140
+ min?: number | null;
1141
+ max?: number | null;
1142
+ maxFiles?: number | null;
1143
+ acceptedContentTypes?: string[] | null;
1144
+ }
1145
+
1146
+ export interface CampaignDefinitionElementGQL {
1147
+ key: string;
1148
+ kind: CampaignElementKindEnum;
1149
+ type?: CampaignElementTypeEnum | null;
1150
+ order: number;
1151
+ label?: string | null;
1152
+ description?: string | null;
1153
+ /** @deprecated Retained only for historical definition reads. */
1154
+ aiPrompt?: string | null;
1155
+ placeholder?: string | null;
1156
+ options: CampaignElementOptionObj[];
1157
+ required: boolean;
1158
+ validation?: CampaignElementValidationGQL | null;
1159
+ visibleWhen?: CampaignElementVisibleWhenValuesObj | null;
1160
+ settings: CampaignElementSettingsGQL;
1161
+ files: CampaignDefinitionFileGQL[];
1162
+ }
1163
+
1164
+ export interface CampaignDefinitionSectionGQL {
1165
+ key: string;
1166
+ order: number;
1167
+ label?: string | null;
1168
+ description?: string | null;
1169
+ settings: CampaignElementSettingsGQL;
1170
+ files: CampaignDefinitionFileGQL[];
1171
+ elements: CampaignDefinitionElementGQL[];
1172
+ }
1173
+
1174
+ export interface CampaignDefinitionGQL {
1175
+ sections: CampaignDefinitionSectionGQL[];
1176
+ }
1177
+
1178
+ export type CampaignEmailLinkGQL = CampaignEmailLinkObj;
1179
+
1180
+ export type CampaignEmailDesignSettingsGQL = CampaignEmailDesignSettingsObj;
1181
+
1182
+ export type CampaignEmailBlockContentGQL = CampaignEmailBlockContentObj;
1183
+
1184
+ export type CampaignEmailBlockSettingsGQL = CampaignEmailBlockSettingsObj;
1185
+
1186
+ export interface CampaignEmailBlockGQL extends Omit<CampaignEmailBlockObj, 'imageStorageIds'> {
1187
+ files: CampaignDefinitionFileGQL[];
1188
+ }
1189
+
1190
+ export interface CampaignEmailColumnGQL extends Omit<CampaignEmailColumnObj, 'blocks'> {
1191
+ blocks: CampaignEmailBlockGQL[];
1192
+ }
1193
+
1194
+ export type CampaignEmailRowSettingsGQL = CampaignEmailRowSettingsObj;
1195
+
1196
+ export interface CampaignEmailRowGQL extends Omit<CampaignEmailRowObj, 'columns'> {
1197
+ columns: CampaignEmailColumnGQL[];
1198
+ }
1199
+
1200
+ export interface CampaignEmailDefinitionGQL {
1201
+ schemaVersion: number;
1202
+ rows: CampaignEmailRowGQL[];
1203
+ }
1204
+
1205
+ export interface EmailCampaignEditorDraft {
1206
+ title: string;
1207
+ description: string;
1208
+ settings: EmailCampaignSettingsObj;
1209
+ definition: CampaignEmailDefinitionGQL;
1210
+ }
1211
+
1212
+ export interface EmailCampaignPreviewGQL {
1213
+ text: string;
1214
+ html: string;
1215
+ }
1216
+
1217
+ export interface CampaignEditorGQL {
1218
+ definition: CampaignDefinitionGQL;
1219
+ reservedQuestionKeys?: string[];
1220
+ emailDefinition?: CampaignEmailDefinitionGQL | null;
1221
+ emailPreview?: EmailCampaignPreviewGQL | null;
1222
+ }
1223
+
1224
+ export interface CampaignCoreGQL {
1225
+ id: string;
1226
+ organizationId: string;
1227
+ editVersion: number;
1228
+ publishedEditVersion?: number | null;
1229
+ templateId?: string | null;
1230
+ kind: CampaignKindEnum;
1231
+ status: CampaignStatusEnum;
1232
+ generationStatus: CampaignGenerationStatusEnum;
1233
+ generationError?: string | null;
1234
+ generationProgress?: string | null;
1235
+ generationProgressStage?: CampaignGenerationProgressStageEnum | null;
1236
+ publicId?: string | null;
1237
+ audience: CampaignAudienceEnum;
1238
+ emailRecipientSelectionMode?: CampaignEmailRecipientSelectionModeEnum | null;
1239
+ audienceFrozenAt?: string | null;
1240
+ title?: string | null;
1241
+ description?: string | null;
1242
+ settings: CampaignSettingsGQL;
1243
+ headerImage?: StorageGQL | null;
1244
+ scheduledAt: string | null;
1245
+ closesAt?: string | null;
1246
+ startedAt?: string | null;
1247
+ completedAt?: string | null;
1248
+ errorMessage?: string | null;
1249
+ __deleted?: boolean;
1250
+ archivedAt?: string | null;
1251
+ isOpen: boolean;
1252
+ createdAt: string;
1253
+ updatedAt: string;
1254
+ }
1255
+
1256
+ export type CampaignGQL = CampaignCoreGQL;
1257
+
1258
+ export type CampaignEditorSessionStatusEnum = 'ORGANIZATION_MISMATCH' | 'READY';
1259
+
1260
+ export interface CampaignEditSessionGQL {
1261
+ campaign: CampaignGQL | null;
1262
+ editor: CampaignEditorGQL | null;
1263
+ editable: boolean;
1264
+ manageable: boolean;
1265
+ organizationId: string;
1266
+ status: CampaignEditorSessionStatusEnum;
1267
+ }
1268
+
1269
+ export interface CampaignTemplateEditSessionGQL {
1270
+ template: CampaignTemplateGQL | null;
1271
+ editor: CampaignEditorGQL | null;
1272
+ editable: boolean;
1273
+ organizationId: string | null;
1274
+ status: CampaignEditorSessionStatusEnum;
1275
+ }
1276
+
1277
+ export interface CampaignSummaryMetricsGQL {
1278
+ responseCount: number;
1279
+ recipientCount: number;
1280
+ deliveredCount: number;
1281
+ openedCount: number;
1282
+ }
1283
+
1284
+ export interface CampaignSummaryGQL {
1285
+ preview?: CampaignTemplatePreviewGQL | null;
1286
+ id: string;
1287
+ organizationId: string;
1288
+ templateId?: string | null;
1289
+ kind: CampaignKindEnum;
1290
+ status: CampaignStatusEnum;
1291
+ generationStatus: CampaignGenerationStatusEnum;
1292
+ generationError?: string | null;
1293
+ generationProgress?: string | null;
1294
+ generationProgressStage?: CampaignGenerationProgressStageEnum | null;
1295
+ publicId?: string | null;
1296
+ audience: CampaignAudienceEnum;
1297
+ emailRecipientSelectionMode?: CampaignEmailRecipientSelectionModeEnum | null;
1298
+ audienceFrozenAt?: string | null;
1299
+ audienceCount: number | null;
1300
+ audiencePreview: string[] | null;
1301
+ title?: string | null;
1302
+ scheduledAt: string | null;
1303
+ closesAt?: string | null;
1304
+ startedAt?: string | null;
1305
+ completedAt?: string | null;
1306
+ __deleted?: boolean;
1307
+ archivedAt?: string | null;
1308
+ metrics: CampaignSummaryMetricsGQL | null;
1309
+ isOpen: boolean;
1310
+ createdAt: string;
1311
+ updatedAt: string;
1312
+ cursor: string;
1313
+ }
1314
+
1315
+ export interface EmailCampaignSettingsGQL {
1316
+ __typename: 'EmailCampaignSettings';
1317
+ subject?: string | null;
1318
+ preheader?: string | null;
1319
+ aiAgentDomain: string | null;
1320
+ secondaryReplyToEmail?: string | null;
1321
+ sendAt?: string | null;
1322
+ design: CampaignEmailDesignSettingsObj;
1323
+ trackOpens: boolean;
1324
+ }
1325
+
1326
+ export interface FormCampaignSettingsGQL {
1327
+ __typename: 'FormCampaignSettings';
1328
+ color?: string | null;
1329
+ backgroundFillStyle?: CampaignFormBackgroundFillStyleEnum | null;
1330
+ confirmationMessage?: string | null;
1331
+ }
1332
+
1333
+ export type CampaignSettingsGQL = EmailCampaignSettingsGQL | FormCampaignSettingsGQL;
1334
+
1335
+ export interface CampaignResponseSummaryGQL {
1336
+ aiAnswersComplete: boolean;
1337
+ aiFinishedAt: string | null;
1338
+ id: string;
1339
+ cursor: string;
1340
+ campaignId: string;
1341
+ respondentName?: string | null;
1342
+ respondentEmail?: string | null;
1343
+ childOrgId?: string | null;
1344
+ childOrgName?: string | null;
1345
+ submittedAt: string;
1346
+ activityAt: string;
1347
+ createdAt: string;
1348
+ }
1349
+
1350
+ export interface CampaignResponseAnswerGQL {
1351
+ elementKey: string;
1352
+ question?: string | null;
1353
+ values: string[];
1354
+ }
1355
+
1356
+ export interface CampaignResponseGQL extends Omit<CampaignResponseSummaryGQL, 'cursor'> {
1357
+ answers: CampaignResponseAnswerGQL[];
1358
+ campaignTitle?: string | null;
1359
+ childOrgOperation?: OrganizationOperationEnum | null;
1360
+ }
1361
+
1362
+ export interface CampaignResponseOverviewGQL {
1363
+ id?: string | null;
1364
+ submittedCount?: number | null;
1365
+ responseRate?: number | null;
1366
+ }
1367
+
1368
+ export interface CampaignRecipientGQL {
1369
+ id: string;
1370
+ cursor: string;
1371
+ campaignId: string;
1372
+ inboundContactId: string | null;
1373
+ emailAddressId?: string | null;
1374
+ outboundEmailId?: string | null;
1375
+ emailAddress: string;
1376
+ personName?: string | null;
1377
+ deliveryStatus?: OutboundEmailStatusEnum | null;
1378
+ sentAt?: string | null;
1379
+ deliveredAt?: string | null;
1380
+ openedAt?: string | null;
1381
+ invitedAt?: string | null;
1382
+ firstOpenedAt?: string | null;
1383
+ respondedAt?: string | null;
1384
+ bouncedAt?: string | null;
1385
+ bounceType?: string | null;
1386
+ spamComplaintAt?: string | null;
1387
+ errorMessage?: string | null;
1388
+ suppressionReason?: string | null;
1389
+ createdAt: string;
1390
+ }
1391
+
1392
+ export interface CampaignRecipientOverviewGQL {
1393
+ id: string;
1394
+ totalCount: number;
1395
+ selectedCount: number;
1396
+ queuedCount: number;
1397
+ processingCount: number;
1398
+ sentCount: number;
1399
+ deliveredCount: number;
1400
+ openedCount: number;
1401
+ respondedCount: number;
1402
+ bouncedCount: number;
1403
+ spamComplaintCount: number;
1404
+ failedCount: number;
1405
+ retryableCount: number;
1406
+ unknownCount: number;
1407
+ suppressedCount: number;
1408
+ // Addresses deliberately skipped for this campaign at the time the audience froze.
1409
+ excludedCount: number;
1410
+ audienceLists: CampaignRecipientOverviewListGQL[];
1411
+ }
1412
+
1413
+ /*
1414
+ * One selected list named as it was when the campaign audience froze.
1415
+ */
1416
+ export interface CampaignRecipientOverviewListGQL {
1417
+ id: string;
1418
+ name: string;
1419
+ }
1420
+
1421
+ /**
1422
+ * Sanitized campaign definition rendered by the public form and editor preview.
1423
+ */
1424
+
1425
+ export interface PublicCampaignElementObj {
1426
+ key: string;
1427
+ kind: CampaignElementKindEnum;
1428
+ type?: CampaignElementTypeEnum | null;
1429
+ label?: string | null;
1430
+ description?: string | null;
1431
+ placeholder?: string | null;
1432
+ options?: CampaignElementOptionObj[] | null;
1433
+ required: boolean;
1434
+ validation?: CampaignElementValidationObj | null;
1435
+ visibleWhen?: CampaignElementVisibleWhenObj | null;
1436
+ files?: Array<{ id: string; uri: string; contentType?: string | null }>;
1437
+ }
1438
+
1439
+ export interface PublicCampaignSectionObj {
1440
+ key: string;
1441
+ title?: string | null;
1442
+ description?: string | null;
1443
+ settings?: CampaignElementSettingsObj | null;
1444
+ visibleWhen?: CampaignElementVisibleWhenObj | null;
1445
+ elements: PublicCampaignElementObj[];
1446
+ }
1447
+
1448
+ export interface PublicCampaignObj {
1449
+ publicId: string;
1450
+ publicationVersion: number;
1451
+ audience: CampaignAudienceEnum;
1452
+ title?: string | null;
1453
+ description?: string | null;
1454
+ headerImage?: {
1455
+ id: string;
1456
+ uri: string;
1457
+ contentType?: string | null;
1458
+ imageData?: { averageColor?: string | null } | null;
1459
+ } | null;
1460
+ color?: string | null;
1461
+ backgroundFillStyle: CampaignFormBackgroundFillStyleEnum;
1462
+ confirmationMessage?: string | null;
1463
+ // Null when the public session is not ready to expose its definition
1464
+ sections: PublicCampaignSectionObj[] | null;
1465
+ }
1466
+
1467
+ export interface PublicCampaignOrganizationObj {
1468
+ id: string;
1469
+ name: string;
1470
+ }
1471
+
1472
+ export interface PublicCampaignResponseObj {
1473
+ publicationVersion: number;
1474
+ respondentName?: string | null;
1475
+ childOrgId?: string | null;
1476
+ responseId?: string | null;
1477
+ answers?: CampaignAnswersObj;
1478
+ submittedAt?: string | null;
1479
+ }
1480
+
1481
+ /**
1482
+ * One atomic public-form bootstrap snapshot served by the REST session route.
1483
+ */
1484
+ export type PublicCampaignSessionObj = {
1485
+ campaign: PublicCampaignObj;
1486
+ } & (
1487
+ | {
1488
+ state: 'UNAVAILABLE' | 'SIGN_IN_REQUIRED';
1489
+ organizations: [];
1490
+ organization: null;
1491
+ response: null;
1492
+ }
1493
+ | {
1494
+ state: 'ACCESS_DENIED';
1495
+ organizations: [];
1496
+ organization: PublicCampaignOrganizationObj | null;
1497
+ response: null;
1498
+ }
1499
+ | {
1500
+ state: 'SELECT_ORGANIZATION';
1501
+ organizations: PublicCampaignOrganizationObj[];
1502
+ organization: null;
1503
+ response: null;
1504
+ }
1505
+ | {
1506
+ state: 'READY';
1507
+ organizations: [];
1508
+ organization: PublicCampaignOrganizationObj | null;
1509
+ response: PublicCampaignResponseObj | null;
1510
+ }
1511
+ );
1512
+
1513
+ /**
1514
+ * Durable generation job payload
1515
+ */
1516
+
1517
+ export interface CampaignGenerationJobPayload {
1518
+ accountId: string;
1519
+ campaignId: string;
1520
+ instructions: string;
1521
+ sourceStorageIds?: string[] | null;
1522
+ }
1523
+
1524
+ /**
1525
+ * Durable scheduled-email dispatch job payload
1526
+ */
1527
+
1528
+ export interface CampaignEmailDispatchJobPayload {
1529
+ campaignId: string;
1530
+ sendBatchId: string;
1531
+ emailHandle: string;
1532
+ organizationName: string;
1533
+ }