@jsb188/mday 1.1.11 → 1.1.12

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 (210) hide show
  1. package/package.json +58 -23
  2. package/src/constants/agentMemory.ts +14 -45
  3. package/src/constants/agentNote.ts +212 -0
  4. package/src/constants/aiChat.ts +5 -0
  5. package/src/constants/billing.ts +126 -0
  6. package/src/constants/campaign.ts +156 -47
  7. package/src/constants/contact.ts +72 -0
  8. package/src/constants/csvExport.ts +133 -0
  9. package/src/constants/dataTable.ts +12 -38
  10. package/src/constants/dataTableFieldTypes.generated.ts +3 -7
  11. package/src/constants/docAccess.ts +3 -2
  12. package/src/constants/dt.ts +234 -0
  13. package/src/constants/email.ts +114 -12
  14. package/src/constants/fieldDoc.ts +74 -4
  15. package/src/constants/graphqlReactivity.ts +108 -25
  16. package/src/constants/log.ts +9 -0
  17. package/src/constants/logDisplay/README.md +88 -0
  18. package/src/constants/logDisplay/defaults.ts +39 -0
  19. package/src/constants/logDisplay/index.ts +27 -0
  20. package/src/constants/logDisplay/operations/arable.ts +16 -0
  21. package/src/constants/logDisplay/operations/farmersMarket.ts +10 -0
  22. package/src/constants/logDisplay/operations/foodManufacturing.ts +13 -0
  23. package/src/constants/logDisplay/shared/accounting.ts +13 -0
  24. package/src/constants/logDisplay/shared/interactions.ts +13 -0
  25. package/src/constants/logDisplay/shared/rackTemperatures.ts +42 -0
  26. package/src/constants/logTaxonomy.generated.ts +1834 -730
  27. package/src/constants/organization.ts +13 -14
  28. package/src/constants/qrCode.ts +30 -0
  29. package/src/constants/sheet.ts +65 -101
  30. package/src/constants/sms.ts +18 -0
  31. package/src/constants/storage.ts +33 -9
  32. package/src/constants/usage.ts +3 -0
  33. package/src/constants/workflowSteps.ts +60 -0
  34. package/src/schemas/editLogEntry.ts +106 -283
  35. package/src/schemas/inboundContact.ts +5 -5
  36. package/src/types/agentMemory.d.ts +38 -14
  37. package/src/types/agentNote.d.ts +443 -0
  38. package/src/types/billing.d.ts +537 -0
  39. package/src/types/campaign.d.ts +1043 -193
  40. package/src/types/contact.d.ts +15 -0
  41. package/src/types/csvExport.d.ts +213 -0
  42. package/src/types/dataAnalysis.d.ts +44 -0
  43. package/src/types/dataTable.d.ts +102 -309
  44. package/src/types/definitionElement.d.ts +35 -0
  45. package/src/types/dt.d.ts +257 -0
  46. package/src/types/email.d.ts +144 -55
  47. package/src/types/emailReplyReport.d.ts +76 -0
  48. package/src/types/fieldDoc.d.ts +579 -150
  49. package/src/types/fieldDocContract.d.ts +90 -0
  50. package/src/types/inboundContact.d.ts +8 -0
  51. package/src/types/log.d.ts +94 -3
  52. package/src/types/logDisplay.types.ts +85 -0
  53. package/src/types/organization.d.ts +8 -3
  54. package/src/types/qrCode.d.ts +96 -0
  55. package/src/types/richText.d.ts +81 -0
  56. package/src/types/sheet.d.ts +180 -463
  57. package/src/types/sms.d.ts +38 -0
  58. package/src/types/storage.d.ts +266 -27
  59. package/src/types/workflow.d.ts +196 -66
  60. package/src/utils/agentMemory.ts +15 -0
  61. package/src/utils/agentNote.ts +850 -0
  62. package/src/utils/aiChat.ts +31 -14
  63. package/src/utils/aiChatWork.ts +64 -0
  64. package/src/utils/billing.ts +37 -0
  65. package/src/utils/campaign.ts +642 -209
  66. package/src/utils/campaignAI.ts +72 -0
  67. package/src/utils/campaignAccess.ts +239 -0
  68. package/src/utils/campaignEmail.ts +601 -0
  69. package/src/utils/campaignEmailCompiler.ts +372 -0
  70. package/src/utils/campaignEmailImages.ts +60 -0
  71. package/src/utils/campaignEmailStyles.ts +544 -0
  72. package/src/utils/campaignLifecycle.ts +104 -0
  73. package/src/utils/campaignPreview.ts +285 -0
  74. package/src/utils/contact.ts +50 -0
  75. package/src/utils/csvExport.ts +19 -0
  76. package/src/utils/dataTable.ts +18 -556
  77. package/src/utils/dataTableFieldTypeRegistry.ts +1 -0
  78. package/src/utils/dataTableRelativeDate.ts +447 -0
  79. package/src/utils/definitionElement.ts +84 -0
  80. package/src/utils/email.ts +208 -1
  81. package/src/utils/emailReplyReport.test.ts +187 -0
  82. package/src/utils/emailReplyReport.ts +143 -0
  83. package/src/utils/fieldDoc.ts +81 -37
  84. package/src/utils/fieldDocAnswers.ts +128 -0
  85. package/src/utils/fieldDocDefaults.ts +36 -0
  86. package/src/utils/fieldDocProgram.ts +36 -0
  87. package/src/utils/fieldDocSummary.ts +30 -0
  88. package/src/utils/log.ts +232 -141
  89. package/src/utils/logDisplay.helpers.ts +177 -0
  90. package/src/utils/logDisplay.ts +87 -0
  91. package/src/utils/logStoreRead.ts +9 -13
  92. package/src/utils/logTaxonomy.helpers.ts +17 -0
  93. package/src/utils/logTaxonomyDisplay.ts +80 -124
  94. package/src/utils/noteDoc.ts +66 -284
  95. package/src/utils/organization.ts +117 -283
  96. package/src/utils/qrCode.helpers.ts +189 -0
  97. package/src/utils/qrCode.test.ts +519 -0
  98. package/src/utils/qrCode.ts +273 -0
  99. package/src/utils/richTextHTML.ts +385 -0
  100. package/src/utils/sheet.ts +123 -4834
  101. package/src/utils/sheetAxisMove.ts +77 -291
  102. package/src/utils/sheetBootstrap.ts +771 -1138
  103. package/src/utils/sheetCellLiteral.ts +101 -0
  104. package/src/utils/sheetCommand.ts +23 -88
  105. package/src/utils/sheetDesign.ts +705 -0
  106. package/src/utils/sheetExport.ts +17 -69
  107. package/src/utils/sheetFeatureReference.ts +183 -0
  108. package/src/utils/sheetFormulaArgs.ts +168 -0
  109. package/src/utils/sheetFormulaCompile.ts +475 -0
  110. package/src/utils/sheetFormulaConditionalAggregate.ts +254 -0
  111. package/src/utils/sheetFormulaCriteria.ts +656 -0
  112. package/src/utils/sheetFormulaDate.ts +444 -0
  113. package/src/utils/sheetFormulaEvaluation.ts +388 -403
  114. package/src/utils/sheetFormulaEvaluator.ts +589 -444
  115. package/src/utils/sheetFormulaFunctionHandlers.ts +403 -0
  116. package/src/utils/sheetFormulaLogical.ts +116 -0
  117. package/src/utils/sheetFormulaLookup.ts +488 -0
  118. package/src/utils/sheetFormulaMath.ts +48 -0
  119. package/src/utils/sheetFormulaParser.ts +729 -0
  120. package/src/utils/sheetFormulaRange.ts +330 -0
  121. package/src/utils/sheetFormulaReference.ts +703 -0
  122. package/src/utils/sheetFormulaReferenceAggregates.ts +313 -0
  123. package/src/utils/sheetFormulaReferenceDates.ts +237 -0
  124. package/src/utils/sheetFormulaReferenceLogical.ts +330 -0
  125. package/src/utils/sheetFormulaReferenceLookup.ts +341 -0
  126. package/src/utils/sheetFormulaReferenceMath.ts +95 -0
  127. package/src/utils/sheetFormulaReferenceRewrite.ts +220 -0
  128. package/src/utils/sheetFormulaReferenceText.ts +462 -0
  129. package/src/utils/sheetFormulaSyntax.ts +1027 -0
  130. package/src/utils/sheetFormulaText.ts +430 -0
  131. package/src/utils/sheetJournal.ts +140 -18
  132. package/src/utils/sheetNumberFormat.ts +68 -267
  133. package/src/utils/sheetPreview.ts +68 -0
  134. package/src/utils/sheetSequence.ts +13 -43
  135. package/src/utils/sheetSnapshot.ts +176 -429
  136. package/src/utils/sheetStructureEdit.ts +537 -907
  137. package/src/utils/sheetStructureReferences.ts +389 -0
  138. package/src/utils/storage.ts +49 -3
  139. package/src/utils/time.ts +12 -0
  140. package/src/utils/workflow.ts +199 -73
  141. package/src/utils/workflowLogFingerprint.ts +302 -0
  142. package/src/utils/workflowLogRevisionSnapshot.ts +424 -0
  143. package/src/utils/workflowProgress.ts +280 -0
  144. package/src/utils/workflowTriggers.ts +61 -0
  145. package/tests/agentNote.test.ts +395 -0
  146. package/tests/campaignAI.test.ts +119 -0
  147. package/tests/campaignAccess.test.ts +239 -0
  148. package/tests/campaignEmail.test.ts +441 -0
  149. package/tests/campaignLifecycle.test.ts +134 -0
  150. package/tests/campaignPublication.test.ts +309 -0
  151. package/tests/dataTableFieldTypeRegistry.test.ts +2 -1
  152. package/tests/dataTableRelativeDate.test.ts +412 -0
  153. package/tests/email.test.ts +39 -0
  154. package/tests/fieldDocProgram.test.ts +114 -0
  155. package/tests/logDisplay.fixtures.ts +67 -0
  156. package/tests/logDisplay.test.ts +227 -0
  157. package/tests/noteDoc.test.ts +37 -192
  158. package/tests/richTextHTML.test.ts +185 -0
  159. package/tests/sheetAxisMove.test.ts +49 -40
  160. package/tests/sheetBootstrap.test.ts +1967 -0
  161. package/tests/sheetFeatureReference.test.ts +22 -0
  162. package/tests/sheetFormulaCriteria.test.ts +269 -0
  163. package/tests/sheetFormulaEvaluator.test.ts +93 -200
  164. package/tests/sheetFormulaFunctions.test.ts +538 -0
  165. package/tests/sheetFormulaLanguage.test.ts +361 -0
  166. package/tests/sheetFormulaParity.fixtures.ts +872 -0
  167. package/tests/sheetFormulaParity.test.ts +188 -0
  168. package/tests/sheetFormulaRange.test.ts +167 -0
  169. package/tests/sheetFormulaReference.test.ts +78 -0
  170. package/tests/sheetFormulaReferenceRewrite.test.ts +117 -0
  171. package/tests/sheetFormulaTextDate.test.ts +512 -0
  172. package/tests/sheetSequence.test.ts +4 -23
  173. package/tests/sheetSnapshot.test.ts +134 -0
  174. package/tests/sheetStructureEdit.test.ts +492 -37
  175. package/tests/sheetStructureReferences.test.ts +589 -0
  176. package/tests/workflowLifecycleStatus.test.ts +60 -0
  177. package/tests/workflowLogFingerprint.test.ts +203 -0
  178. package/tests/workflowLogRevisionSnapshot.test.ts +96 -0
  179. package/tests/workflowProgress.test.ts +180 -0
  180. package/tests/workflowTriggers.test.ts +29 -0
  181. package/src/constants/agentDoc.ts +0 -12
  182. package/src/constants/logActivityGroupColors.generated.ts +0 -19
  183. package/src/constants/schedule.ts +0 -220
  184. package/src/constants/scheduleRuleTemplateSeed.ts +0 -138
  185. package/src/constants/scheduleRuleTemplates.generated.ts +0 -145
  186. package/src/constants/sheetRegionSources.generated.ts +0 -578
  187. package/src/schemas/fieldDocsQuery.ts +0 -12
  188. package/src/schemas/organization.ts +0 -68
  189. package/src/types/agentDoc.d.ts +0 -64
  190. package/src/types/noteDoc.d.ts +0 -86
  191. package/src/types/schedule.d.ts +0 -391
  192. package/src/utils/agentDoc.ts +0 -109
  193. package/src/utils/campaignFormEditor.ts +0 -871
  194. package/src/utils/dataTableRealtimeAuthority.ts +0 -209
  195. package/src/utils/dataTableRealtimeSelection.ts +0 -134
  196. package/src/utils/dataTableRowDocument.ts +0 -508
  197. package/src/utils/dataTableSource.ts +0 -230
  198. package/src/utils/schedule.ts +0 -799
  199. package/src/utils/scheduleEvaluation.ts +0 -1994
  200. package/src/utils/scheduleICS.ts +0 -246
  201. package/src/utils/scheduleRuleTemplates.ts +0 -188
  202. package/src/utils/sheetRegion.ts +0 -374
  203. package/src/utils/sheetRegionFilter.ts +0 -1259
  204. package/src/utils/sheetRegionSourceRegistry.ts +0 -594
  205. package/tests/schedule.test.ts +0 -693
  206. package/tests/scheduleEvaluation.test.ts +0 -1970
  207. package/tests/scheduleICS.test.ts +0 -208
  208. package/tests/scheduleRuleTemplates.test.ts +0 -176
  209. package/tests/scheduleSweepInvariants.test.ts +0 -428
  210. package/tests/sheetRegionFilter.test.ts +0 -1135
@@ -1,20 +1,34 @@
1
1
  import {
2
2
  CAMPAIGN_AUDIENCE_ENUMS,
3
+ CAMPAIGN_DRAFT_RESET_SOURCES,
3
4
  CAMPAIGN_ELEMENT_KINDS,
4
5
  CAMPAIGN_ELEMENT_TYPES,
5
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,
6
11
  CAMPAIGN_FORM_BACKGROUND_FILL_STYLES,
12
+ CAMPAIGN_GENERATION_GRAPHQL_STATUS_ENUMS,
13
+ CAMPAIGN_GENERATION_PROGRESS_STAGES,
14
+ CAMPAIGN_GENERATION_STATUS_ENUMS,
7
15
  CAMPAIGN_KIND_ENUMS,
8
- CAMPAIGN_RESPONSE_STATUS_ENUMS,
16
+ CAMPAIGN_MANAGEMENT_OPERATION_ENUMS,
17
+ CAMPAIGN_PUBLISH_STATUS_ENUMS,
9
18
  CAMPAIGN_SORT_ENUMS,
10
19
  CAMPAIGN_STATUS_ENUMS,
20
+ CAMPAIGN_TEMPLATE_GRAPHQL_STATUS_ENUMS,
11
21
  CAMPAIGN_TEMPLATE_STATUS_ENUMS,
12
22
  CAMPAIGN_TEMPLATE_TYPES,
13
23
  } from '../constants/campaign.ts';
14
24
  import type {
15
- OrganizationData,
16
- OrganizationSiteData,
17
- } from './organization.d.ts';
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';
18
32
  import type { StorageData, StorageGQL } from './storage.d.ts';
19
33
 
20
34
  /**
@@ -22,45 +36,344 @@ import type { StorageData, StorageGQL } from './storage.d.ts';
22
36
  */
23
37
 
24
38
  export type CampaignKindEnum = (typeof CAMPAIGN_KIND_ENUMS)[number];
39
+ export type CampaignsSortEnum = (typeof CAMPAIGN_SORT_ENUMS)[number];
25
40
  export type CampaignAudienceEnum = (typeof CAMPAIGN_AUDIENCE_ENUMS)[number];
26
- export type CampaignTemplateStatusEnum =
27
- (typeof CAMPAIGN_TEMPLATE_STATUS_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];
28
47
  export type CampaignStatusEnum = (typeof CAMPAIGN_STATUS_ENUMS)[number];
29
- export type CampaignResponseStatusEnum =
30
- (typeof CAMPAIGN_RESPONSE_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];
31
52
  export type CampaignElementKindEnum = (typeof CAMPAIGN_ELEMENT_KINDS)[number];
32
53
  export type CampaignElementTypeEnum = (typeof CAMPAIGN_ELEMENT_TYPES)[number];
33
- export type CampaignElementVisibleWhenOperatorEnum =
34
- (typeof CAMPAIGN_ELEMENT_VISIBLE_WHEN_OPERATORS)[number];
35
- export type CampaignsSortEnum = (typeof CAMPAIGN_SORT_ENUMS)[number];
54
+ export type CampaignElementVisibleWhenOperatorEnum = (typeof CAMPAIGN_ELEMENT_VISIBLE_WHEN_OPERATORS)[number];
36
55
  export type CampaignTemplateType = (typeof CAMPAIGN_TEMPLATE_TYPES)[number];
37
- export type CampaignFormBackgroundFillStyleEnum =
38
- (typeof CAMPAIGN_FORM_BACKGROUND_FILL_STYLES)[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];
39
61
 
40
62
  /**
41
63
  * Filters
42
64
  */
43
65
 
44
66
  export interface CampaignTemplatesFilterArgs {
67
+ archived?: boolean | null;
45
68
  kind?: CampaignKindEnum | null;
46
- status?: CampaignTemplateStatusEnum | null;
47
- search?: string | null;
69
+ status?: CampaignTemplateDatabaseStatusEnum | null;
48
70
  }
49
71
 
72
+ export type SystemCampaignTemplatesFilterArgs = Pick<CampaignTemplatesFilterArgs, 'kind' | 'status'>;
73
+
50
74
  export interface CampaignsFilterArgs {
75
+ scheduledStartDate?: string | null;
76
+ scheduledEndDate?: string | null;
51
77
  templateId?: string | null;
52
78
  kind?: CampaignKindEnum | null;
53
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;
54
281
  }
55
282
 
56
283
  export interface CampaignResponsesFilterArgs {
57
284
  campaignId: string;
58
- status?: CampaignResponseStatusEnum[] | null;
59
285
  }
60
286
 
61
287
  export interface CampaignRecipientsFilterArgs {
62
288
  campaignId: string;
63
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;
64
377
  }
65
378
 
66
379
  /**
@@ -80,7 +393,6 @@ export interface CampaignElementValidationObj {
80
393
  maxLength?: number;
81
394
  min?: number;
82
395
  max?: number;
83
- pattern?: string;
84
396
  maxFiles?: number;
85
397
  acceptedContentTypes?: string[];
86
398
  }
@@ -102,45 +414,40 @@ export interface CampaignElementVisibleWhenValuesObj {
102
414
  export interface CampaignElementSettingsObj {
103
415
  numbered?: boolean; // Render children of this section as a numbered list
104
416
  fullWidth?: boolean;
417
+ emailRow?: CampaignEmailRowStorageSettingsObj | null;
418
+ emailBlock?: CampaignEmailBlockStorageSettingsObj | null;
105
419
  }
106
420
 
107
421
  export interface CampaignElementSettingsGQL {
108
422
  numbered: boolean;
109
423
  fullWidth: boolean;
424
+ emailRow?: CampaignEmailRowStorageSettingsObj | null;
425
+ emailBlock?: CampaignEmailBlockStorageSettingsObj | null;
110
426
  }
111
427
 
112
- export interface CampaignElementData {
428
+ export interface CampaignElementData
429
+ extends DefinitionElementBaseData<
430
+ CampaignElementKindEnum,
431
+ CampaignElementOptionObj,
432
+ CampaignElementSettingsObj,
433
+ CampaignElementStorageRelData
434
+ > {
113
435
  __table: 'campaign_template_elements';
114
- id: number | bigint;
115
436
  templateId: number | bigint;
116
- parentId?: number | bigint | null; // NULL for SECTION elements
117
- kind: CampaignElementKindEnum;
118
437
  type?: CampaignElementTypeEnum | null; // Set if and only if kind is QUESTION
119
- key: string; // Answers reference this key; unique per template
120
- order: number;
121
- label?: string | null;
122
- description?: string | null;
438
+ /** @deprecated Retained only for historical definition reads. */
439
+ aiPrompt?: string | null;
123
440
  placeholder?: string | null;
124
- options?: CampaignElementOptionObj[] | null;
125
- required?: boolean;
126
441
  validation?: CampaignElementValidationObj | null;
127
442
  visibleWhen?: CampaignElementVisibleWhenObj | null;
128
- settings?: CampaignElementSettingsObj | null;
129
- storageRels?: CampaignElementStorageRelData[]; // Element images
130
443
  }
131
444
 
132
- export interface CampaignElementStorageRelData {
445
+ export interface CampaignElementStorageRelData extends DefinitionElementStorageRelBaseData {
133
446
  __table: 'campaign_element_storage_rels';
134
447
  elementId: number | bigint;
135
- storageId: number | bigint;
136
- order: number;
137
- file: StorageData;
138
448
  }
139
449
 
140
- // One hydrated top-level section with its ordered child elements
141
- export interface CampaignSectionWithElementsObj extends CampaignElementData {
142
- elements: CampaignElementData[];
143
- }
450
+ export type CampaignSectionWithElementsObj = DefinitionSectionWithElementsObj<CampaignElementData>;
144
451
 
145
452
  // The full resolved definition of one template
146
453
  export interface CampaignDefinitionObj {
@@ -166,6 +473,8 @@ export interface CampaignDefinitionSnapshotElementObj {
166
473
  order: number;
167
474
  label?: string | null;
168
475
  description?: string | null;
476
+ /** @deprecated Retained only for historical definition reads. */
477
+ aiPrompt?: string | null;
169
478
  placeholder?: string | null;
170
479
  options?: CampaignElementOptionObj[] | null;
171
480
  required: boolean;
@@ -175,8 +484,7 @@ export interface CampaignDefinitionSnapshotElementObj {
175
484
  storageRels: CampaignDefinitionSnapshotStorageRelObj[];
176
485
  }
177
486
 
178
- export interface CampaignDefinitionSnapshotSectionObj
179
- extends CampaignDefinitionSnapshotElementObj {
487
+ export interface CampaignDefinitionSnapshotSectionObj extends CampaignDefinitionSnapshotElementObj {
180
488
  elements: CampaignDefinitionSnapshotElementObj[];
181
489
  }
182
490
 
@@ -185,60 +493,84 @@ export interface CampaignDefinitionSnapshotSectionObj
185
493
  */
186
494
 
187
495
  export interface FormCampaignSettingsObj {
496
+ // Source-owned preference; omitted by content normalizers and preserved by the database.
497
+ agentNoteDisabled?: boolean;
188
498
  color?: string | null;
189
499
  backgroundFillStyle?: CampaignFormBackgroundFillStyleEnum | null;
190
500
  confirmationMessage?: string | null;
191
501
  }
192
502
 
193
- export interface EmailCampaignSettingsObj {
194
- subject?: string | null;
195
- body?: string | null;
196
- bodyHTML?: string | null;
197
- replyToAgentDomain: string;
198
- secondaryReplyToEmail?: string | null;
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;
199
511
  }
200
512
 
201
- export type CampaignSettingsObj =
202
- | EmailCampaignSettingsObj
203
- | FormCampaignSettingsObj;
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
+ }
204
526
 
205
- export interface EmailCampaignSettingsInputObj {
527
+ export interface EmailCampaignSettingsObj {
528
+ // Source-owned preference; omitted by content normalizers and preserved by the database.
529
+ agentNoteDisabled?: boolean;
206
530
  subject?: string | null;
531
+ preheader?: string | null;
207
532
  body?: string | null;
208
- bodyHTML?: string | null;
209
- replyToAgentDomain?: string | null;
533
+ aiAgentDomain: string;
210
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;
211
551
  }
212
552
 
213
- export interface FormCampaignSettingsInputObj {
553
+ export type CampaignSettingsObj = EmailCampaignSettingsObj | FormCampaignSettingsObj;
554
+
555
+ export interface FormCampaignSettingsPatchInputObj {
214
556
  color?: string | null;
215
557
  backgroundFillStyle?: CampaignFormBackgroundFillStyleEnum | null;
216
558
  confirmationMessage?: string | null;
217
559
  }
218
560
 
219
- export type CampaignSettingsInputObj =
220
- | {
221
- email: EmailCampaignSettingsInputObj;
222
- form?: never;
223
- }
224
- | {
225
- email?: never;
226
- form: FormCampaignSettingsInputObj;
227
- };
228
-
229
561
  export interface CampaignTemplateData {
230
562
  __table: 'campaign_templates';
231
563
  id: number | bigint;
232
- organizationId: number | bigint;
564
+ organizationId: number | bigint | null;
565
+ editVersion: number | bigint;
233
566
  kind: CampaignKindEnum;
234
- status: CampaignTemplateStatusEnum;
567
+ status: CampaignTemplateDatabaseStatusEnum;
235
568
  generationError?: string | null; // Only ever set while status is ERROR
236
569
  title?: string | null;
237
570
  description?: string | null;
238
- responseWorkflowId?: number | bigint | null;
239
- siteId?: number | bigint | null;
240
571
  headerImageStorageId?: number | bigint | null;
241
572
  settings?: CampaignSettingsObj | null;
573
+ archivedAt?: Date | string | null;
242
574
  createdByAccountId?: number | bigint | null;
243
575
  createdAt: Date | string;
244
576
  updatedAt: Date | string;
@@ -246,46 +578,83 @@ export interface CampaignTemplateData {
246
578
  // Attached by fetch helpers
247
579
  elements?: CampaignElementData[];
248
580
  headerImage?: StorageData | null;
249
- site?: OrganizationSiteData | null;
250
581
  }
251
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
+
252
602
  /**
253
603
  * Campaigns (the campaigns table)
254
604
  */
255
605
 
256
- // The published question tree, frozen at publish time so editing the template
257
- // never changes what an in-flight campaign asks
606
+ // A campaign-owned question tree detached from its mutable source template.
258
607
  export interface CampaignDefinitionSnapshotObj {
259
608
  schemaVersion: number;
260
609
  snapshotSource: string;
261
610
  sections: CampaignDefinitionSnapshotSectionObj[];
262
611
  }
263
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
+
264
629
  export interface CampaignData {
265
630
  __table: 'campaigns';
266
631
  id: number | bigint;
267
632
  organizationId: number | bigint;
268
- templateId: number | bigint;
269
- sourceCampaignId?: number | bigint | null;
633
+ editVersion: number | bigint;
634
+ templateId: number | bigint | null;
270
635
  idempotencyKey?: string | null;
636
+ emailRecipientSelectionMode?: CampaignEmailRecipientSelectionModeEnum | null;
637
+ audienceFrozenAt?: Date | string | null;
271
638
  kind: CampaignKindEnum;
272
639
  status: CampaignStatusEnum;
640
+ generationStatus: CampaignGenerationDatabaseStatusEnum;
641
+ generationError?: string | null;
642
+ generationProgress?: string | null;
643
+ generationProgressStage?: CampaignGenerationProgressStageEnum | null;
273
644
  publicId?: string | null;
274
645
  audience: CampaignAudienceEnum;
275
646
  title?: string | null;
276
647
  description?: string | null;
277
- definitionSnapshot: CampaignDefinitionSnapshotObj;
648
+ draftSnapshot: CampaignDefinitionSnapshotObj;
649
+ publishedSnapshot?: CampaignPublishedSnapshotObj | null;
278
650
  settingsSnapshot: CampaignSettingsObj;
279
- responseWorkflowId?: number | bigint | null;
280
- responseWorkflowSnapshot?: Record<string, any> | null;
281
- siteId?: number | bigint | null;
282
651
  headerImageStorageId?: number | bigint | null;
283
- scheduledAt?: Date | string | null;
284
- opensAt?: Date | string | null;
652
+ scheduledAt: Date | string | null;
285
653
  closesAt?: Date | string | null;
286
- publishedAt: Date | string;
654
+ startedAt?: Date | string | null;
287
655
  completedAt?: Date | string | null;
288
656
  errorMessage?: string | null;
657
+ archivedAt?: Date | string | null;
289
658
  createdByAccountId?: number | bigint | null;
290
659
  createdAt: Date | string;
291
660
  updatedAt: Date | string;
@@ -296,6 +665,39 @@ export interface CampaignData {
296
665
  headerImage?: StorageData | null;
297
666
  }
298
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
+
299
701
  /**
300
702
  * Campaign recipients (the campaign_recipients table)
301
703
  */
@@ -305,14 +707,18 @@ export interface CampaignRecipientData {
305
707
  id: number | bigint;
306
708
  organizationId: number | bigint;
307
709
  campaignId: number | bigint;
308
- inboundContactId: number | bigint;
309
- emailAddressSnapshot: string;
310
- personNameSnapshot?: string | null;
311
- accessTokenHash?: string | null;
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
+ };
312
719
  invitedAt?: Date | string | null;
313
720
  firstOpenedAt?: Date | string | null;
314
721
  respondedAt?: Date | string | null;
315
- revokedAt?: Date | string | null;
316
722
  createdAt: Date | string;
317
723
  updatedAt: Date | string;
318
724
  }
@@ -321,14 +727,16 @@ export interface CampaignRecipientData {
321
727
  * Campaign responses (the campaign_responses table)
322
728
  */
323
729
 
324
- // One answer, keyed by its element. Files live in
325
- // campaign_response_storage_rels and are attached as "files".
730
+ // One answer, keyed by its element.
326
731
  export interface CampaignAnswerObj {
327
732
  elementKey: string;
328
733
  // Copied from the published definition by the server when the answer is saved
329
734
  question?: string | null;
330
735
  value?: string | string[] | null;
331
- files?: StorageGQL[];
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;
332
740
  }
333
741
 
334
742
  export interface CampaignAnswersObj {
@@ -337,18 +745,19 @@ export interface CampaignAnswersObj {
337
745
 
338
746
  export interface CampaignResponseData {
339
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;
340
752
  id: number | bigint;
341
753
  organizationId: number | bigint;
342
754
  campaignId: number | bigint;
343
- templateId: number | bigint;
344
- recipientId?: number | bigint | null;
345
755
  respondentAccountId?: number | bigint | null;
346
756
  respondentEmail?: string | null;
347
757
  respondentName?: string | null;
348
758
  childOrgId?: number | bigint | null;
349
759
  answers: CampaignAnswersObj;
350
- status: CampaignResponseStatusEnum;
351
- submittedAt?: Date | string | null;
760
+ submittedAt: Date | string;
352
761
  activityAt: Date | string;
353
762
  createdAt: Date | string;
354
763
  updatedAt: Date | string;
@@ -356,20 +765,24 @@ export interface CampaignResponseData {
356
765
  // Attached by fetch helpers
357
766
  campaign?: CampaignData | null;
358
767
  childOrg?: OrganizationData | null;
359
- storageRels?: CampaignResponseStorageRelData[];
360
768
  }
361
769
 
362
- export interface CampaignResponseStorageRelData {
363
- __table: 'campaign_response_storage_rels';
364
- responseId: number | bigint;
365
- storageId: number | bigint;
366
- elementKey: string;
367
- order: number;
368
- file: StorageData;
369
- }
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
+ >;
370
783
 
371
784
  /**
372
- * Create-template modal draft
785
+ * Create-campaign modal draft
373
786
  */
374
787
 
375
788
  export interface CampaignDraftFile {
@@ -390,17 +803,43 @@ export interface CampaignDraft {
390
803
  }
391
804
 
392
805
  /**
393
- * Editor input shapes
394
- *
395
- * What the template editor submits. Ids are absent by design: a definition
396
- * write replaces the whole tree, so an element is identified by its key rather
397
- * than by a row id the client would have to track.
806
+ * Canonical editor patch inputs
398
807
  */
399
808
 
400
- export interface CampaignElementInputObj {
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;
401
841
  kind: CampaignElementKindEnum;
402
842
  type?: CampaignElementTypeEnum | null;
403
- key?: string | null;
404
843
  label?: string | null;
405
844
  description?: string | null;
406
845
  placeholder?: string | null;
@@ -412,74 +851,273 @@ export interface CampaignElementInputObj {
412
851
  imageStorageIds?: string[] | null;
413
852
  }
414
853
 
415
- export interface CampaignSectionInputObj {
416
- key?: string | null;
854
+ export interface CampaignDefinitionSectionInputObj {
855
+ key: string;
856
+ order: number;
417
857
  label?: string | null;
418
858
  description?: string | null;
419
859
  settings?: CampaignElementSettingsObj | null;
420
- elements: CampaignElementInputObj[];
860
+ imageStorageIds?: string[] | null;
421
861
  }
422
862
 
423
- /**
424
- * GraphQL view shapes
425
- *
426
- * Definition snapshots, element JSONB columns and campaign settings cross the
427
- * wire as typed GraphQL objects.
428
- */
863
+ export interface CampaignDefinitionContentInputObj extends CampaignDefinitionSectionInputObj {
864
+ parentKey: string;
865
+ visibleWhen?: CampaignElementVisibleWhenValuesObj | null;
866
+ }
429
867
 
430
- export interface CampaignElementGQL {
431
- id: string;
432
- parentId?: string | null;
433
- kind: CampaignElementKindEnum;
434
- type?: CampaignElementTypeEnum | null;
435
- key: string;
436
- order: number;
437
- label?: string | null;
438
- description?: string | null;
868
+ export interface CampaignDefinitionQuestionInputObj extends CampaignDefinitionContentInputObj {
869
+ type: CampaignElementTypeEnum;
439
870
  placeholder?: string | null;
440
- required: boolean;
441
- options: CampaignElementOptionObj[];
871
+ options?: CampaignElementOptionObj[] | null;
872
+ required?: boolean | null;
442
873
  validation?: CampaignElementValidationObj | null;
443
- visibleWhen?: CampaignElementVisibleWhenValuesObj | null;
444
- settings: CampaignElementSettingsGQL;
445
- files?: StorageGQL[];
446
874
  }
447
875
 
448
- export interface CampaignTemplateGQL {
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;
449
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[];
450
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;
451
1059
  kind: CampaignKindEnum;
452
1060
  status: CampaignTemplateStatusEnum;
453
1061
  generationError?: string | null;
454
- generationProgress?: CampaignTemplateGenerationProgressGQL | null;
455
1062
  title?: string | null;
456
1063
  description?: string | null;
457
- responseWorkflowId?: string | null;
458
- siteId?: string | null;
459
1064
  settings: CampaignSettingsGQL;
460
1065
  headerImage?: StorageGQL | null;
461
- elements?: CampaignElementGQL[];
1066
+ __deleted?: boolean;
1067
+ archivedAt?: string | null;
462
1068
  createdAt: string;
463
1069
  updatedAt: string;
464
1070
  }
465
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
+
466
1104
  export interface CampaignTemplateSummaryGQL {
467
1105
  id: string;
468
- organizationId: string;
1106
+ organizationId: string | null;
1107
+ editable: boolean;
1108
+ editVersion: number;
469
1109
  kind: CampaignKindEnum;
470
1110
  status: CampaignTemplateStatusEnum;
471
1111
  generationError?: string | null;
472
- generationProgress?: CampaignTemplateGenerationProgressGQL | null;
473
1112
  title?: string | null;
474
1113
  description?: string | null;
475
1114
  headerImage?: StorageGQL | null;
1115
+ preview?: CampaignTemplatePreviewGQL | null;
1116
+ __deleted?: boolean;
1117
+ archivedAt?: string | null;
476
1118
  createdAt: string;
477
1119
  updatedAt: string;
478
- cursor?: string | null;
479
- }
480
-
481
- export interface CampaignTemplateGenerationProgressGQL {
482
- message: string;
1120
+ cursor: string;
483
1121
  }
484
1122
 
485
1123
  export interface CampaignDefinitionFileGQL {
@@ -488,21 +1126,21 @@ export interface CampaignDefinitionFileGQL {
488
1126
  uri?: string | null;
489
1127
  contentType?: string | null;
490
1128
  size?: number | null;
1129
+ name?: string | null;
1130
+ imageData?: { width: number; height: number } | null;
491
1131
  }
492
1132
 
493
- export interface CampaignAnswerFileGQL {
494
- id: string;
495
- order: number;
496
- uri?: string | null;
497
- contentType?: string | null;
498
- size?: number | null;
499
- }
500
-
501
- export interface CampaignAnswerGQL {
502
- elementKey: string;
503
- question?: string | null;
504
- values: string[];
505
- files: CampaignAnswerFileGQL[];
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;
506
1144
  }
507
1145
 
508
1146
  export interface CampaignDefinitionElementGQL {
@@ -512,10 +1150,12 @@ export interface CampaignDefinitionElementGQL {
512
1150
  order: number;
513
1151
  label?: string | null;
514
1152
  description?: string | null;
1153
+ /** @deprecated Retained only for historical definition reads. */
1154
+ aiPrompt?: string | null;
515
1155
  placeholder?: string | null;
516
1156
  options: CampaignElementOptionObj[];
517
1157
  required: boolean;
518
- validation?: CampaignElementValidationObj | null;
1158
+ validation?: CampaignElementValidationGQL | null;
519
1159
  visibleWhen?: CampaignElementVisibleWhenValuesObj | null;
520
1160
  settings: CampaignElementSettingsGQL;
521
1161
  files: CampaignDefinitionFileGQL[];
@@ -527,66 +1167,160 @@ export interface CampaignDefinitionSectionGQL {
527
1167
  label?: string | null;
528
1168
  description?: string | null;
529
1169
  settings: CampaignElementSettingsGQL;
1170
+ files: CampaignDefinitionFileGQL[];
530
1171
  elements: CampaignDefinitionElementGQL[];
531
1172
  }
532
1173
 
533
- export interface CampaignDefinitionSnapshotGQL {
534
- schemaVersion: number;
535
- snapshotSource: string;
1174
+ export interface CampaignDefinitionGQL {
536
1175
  sections: CampaignDefinitionSectionGQL[];
537
1176
  }
538
1177
 
539
- export interface CampaignGQL {
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 {
540
1225
  id: string;
541
1226
  organizationId: string;
542
- templateId: string;
1227
+ editVersion: number;
1228
+ publishedEditVersion?: number | null;
1229
+ templateId?: string | null;
543
1230
  kind: CampaignKindEnum;
544
1231
  status: CampaignStatusEnum;
1232
+ generationStatus: CampaignGenerationStatusEnum;
1233
+ generationError?: string | null;
1234
+ generationProgress?: string | null;
1235
+ generationProgressStage?: CampaignGenerationProgressStageEnum | null;
545
1236
  publicId?: string | null;
546
1237
  audience: CampaignAudienceEnum;
1238
+ emailRecipientSelectionMode?: CampaignEmailRecipientSelectionModeEnum | null;
1239
+ audienceFrozenAt?: string | null;
547
1240
  title?: string | null;
548
1241
  description?: string | null;
549
- definitionSnapshot: CampaignDefinitionSnapshotGQL;
550
1242
  settings: CampaignSettingsGQL;
551
- siteId?: string | null;
552
1243
  headerImage?: StorageGQL | null;
553
- scheduledAt?: string | null;
554
- opensAt?: string | null;
1244
+ scheduledAt: string | null;
555
1245
  closesAt?: string | null;
556
- publishedAt: string;
1246
+ startedAt?: string | null;
557
1247
  completedAt?: string | null;
558
1248
  errorMessage?: string | null;
1249
+ __deleted?: boolean;
1250
+ archivedAt?: string | null;
559
1251
  isOpen: boolean;
560
1252
  createdAt: string;
561
1253
  updatedAt: string;
562
- cursor?: string | null;
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;
563
1282
  }
564
1283
 
565
1284
  export interface CampaignSummaryGQL {
1285
+ preview?: CampaignTemplatePreviewGQL | null;
566
1286
  id: string;
567
1287
  organizationId: string;
568
- templateId: string;
1288
+ templateId?: string | null;
569
1289
  kind: CampaignKindEnum;
570
1290
  status: CampaignStatusEnum;
1291
+ generationStatus: CampaignGenerationStatusEnum;
1292
+ generationError?: string | null;
1293
+ generationProgress?: string | null;
1294
+ generationProgressStage?: CampaignGenerationProgressStageEnum | null;
571
1295
  publicId?: string | null;
572
1296
  audience: CampaignAudienceEnum;
1297
+ emailRecipientSelectionMode?: CampaignEmailRecipientSelectionModeEnum | null;
1298
+ audienceFrozenAt?: string | null;
1299
+ audienceCount: number | null;
1300
+ audiencePreview: string[] | null;
573
1301
  title?: string | null;
574
- opensAt?: string | null;
1302
+ scheduledAt: string | null;
575
1303
  closesAt?: string | null;
576
- publishedAt: string;
1304
+ startedAt?: string | null;
577
1305
  completedAt?: string | null;
1306
+ __deleted?: boolean;
1307
+ archivedAt?: string | null;
1308
+ metrics: CampaignSummaryMetricsGQL | null;
578
1309
  isOpen: boolean;
579
1310
  createdAt: string;
580
- cursor?: string | null;
1311
+ updatedAt: string;
1312
+ cursor: string;
581
1313
  }
582
1314
 
583
1315
  export interface EmailCampaignSettingsGQL {
584
1316
  __typename: 'EmailCampaignSettings';
585
1317
  subject?: string | null;
586
- body?: string | null;
587
- bodyHTML?: string | null;
588
- replyToAgentDomain: string;
1318
+ preheader?: string | null;
1319
+ aiAgentDomain: string | null;
589
1320
  secondaryReplyToEmail?: string | null;
1321
+ sendAt?: string | null;
1322
+ design: CampaignEmailDesignSettingsObj;
1323
+ trackOpens: boolean;
590
1324
  }
591
1325
 
592
1326
  export interface FormCampaignSettingsGQL {
@@ -596,44 +1330,96 @@ export interface FormCampaignSettingsGQL {
596
1330
  confirmationMessage?: string | null;
597
1331
  }
598
1332
 
599
- export type CampaignSettingsGQL =
600
- | EmailCampaignSettingsGQL
601
- | FormCampaignSettingsGQL;
1333
+ export type CampaignSettingsGQL = EmailCampaignSettingsGQL | FormCampaignSettingsGQL;
602
1334
 
603
- export interface CampaignResponseGQL {
1335
+ export interface CampaignResponseSummaryGQL {
1336
+ aiAnswersComplete: boolean;
1337
+ aiFinishedAt: string | null;
604
1338
  id: string;
605
- cursor?: string | null;
1339
+ cursor: string;
606
1340
  campaignId: string;
607
- templateId: string;
608
1341
  respondentName?: string | null;
609
1342
  respondentEmail?: string | null;
610
1343
  childOrgId?: string | null;
611
1344
  childOrgName?: string | null;
612
- // The people-list fragment omits answers until a response detail surface
613
- // needs them.
614
- answers?: CampaignAnswerGQL[];
615
- status: CampaignResponseStatusEnum;
616
- submittedAt?: string | null;
1345
+ submittedAt: string;
617
1346
  activityAt: string;
618
1347
  createdAt: string;
619
1348
  }
620
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
+
621
1368
  export interface CampaignRecipientGQL {
622
1369
  id: string;
623
- cursor?: string | null;
1370
+ cursor: string;
624
1371
  campaignId: string;
625
- inboundContactId: string;
1372
+ inboundContactId: string | null;
1373
+ emailAddressId?: string | null;
1374
+ outboundEmailId?: string | null;
626
1375
  emailAddress: string;
627
1376
  personName?: string | null;
1377
+ deliveryStatus?: OutboundEmailStatusEnum | null;
1378
+ sentAt?: string | null;
1379
+ deliveredAt?: string | null;
1380
+ openedAt?: string | null;
628
1381
  invitedAt?: string | null;
629
1382
  firstOpenedAt?: string | null;
630
1383
  respondedAt?: string | null;
631
- revokedAt?: string | null;
1384
+ bouncedAt?: string | null;
1385
+ bounceType?: string | null;
1386
+ spamComplaintAt?: string | null;
1387
+ errorMessage?: string | null;
1388
+ suppressionReason?: string | null;
632
1389
  createdAt: string;
633
1390
  }
634
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
+
635
1421
  /**
636
- * The public form payload served by /api/campaigns/:publicId
1422
+ * Sanitized campaign definition rendered by the public form and editor preview.
637
1423
  */
638
1424
 
639
1425
  export interface PublicCampaignElementObj {
@@ -655,29 +1441,93 @@ export interface PublicCampaignSectionObj {
655
1441
  title?: string | null;
656
1442
  description?: string | null;
657
1443
  settings?: CampaignElementSettingsObj | null;
1444
+ visibleWhen?: CampaignElementVisibleWhenObj | null;
658
1445
  elements: PublicCampaignElementObj[];
659
1446
  }
660
1447
 
661
1448
  export interface PublicCampaignObj {
662
1449
  publicId: string;
1450
+ publicationVersion: number;
663
1451
  audience: CampaignAudienceEnum;
664
1452
  title?: string | null;
665
1453
  description?: string | null;
666
- headerImage?: { id: string; uri: string; contentType?: string | null } | null;
1454
+ headerImage?: {
1455
+ id: string;
1456
+ uri: string;
1457
+ contentType?: string | null;
1458
+ imageData?: { averageColor?: string | null } | null;
1459
+ } | null;
667
1460
  color?: string | null;
668
1461
  backgroundFillStyle: CampaignFormBackgroundFillStyleEnum;
669
- isOpen: boolean;
670
- // Null when the campaign is closed: a closed form withholds its questions
1462
+ confirmationMessage?: string | null;
1463
+ // Null when the public session is not ready to expose its definition
671
1464
  sections: PublicCampaignSectionObj[] | null;
672
1465
  }
673
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
+
674
1513
  /**
675
1514
  * Durable generation job payload
676
1515
  */
677
1516
 
678
1517
  export interface CampaignGenerationJobPayload {
679
1518
  accountId: string;
680
- templateId: string;
1519
+ campaignId: string;
681
1520
  instructions: string;
682
1521
  sourceStorageIds?: string[] | null;
683
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
+ }