@jsb188/mday 1.1.8 → 1.1.11

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 (123) hide show
  1. package/package.json +105 -35
  2. package/src/constants/agentDoc.ts +12 -0
  3. package/src/constants/agentMemory.ts +154 -0
  4. package/src/constants/aiChat.ts +5 -0
  5. package/src/constants/campaign.ts +127 -0
  6. package/src/constants/dataTable.ts +48 -0
  7. package/src/constants/dataTableFieldTypes.generated.ts +63 -0
  8. package/src/constants/docAccess.ts +32 -0
  9. package/src/constants/email.ts +44 -0
  10. package/src/constants/fieldDoc.ts +34 -0
  11. package/src/constants/graphqlReactivity.ts +113 -0
  12. package/src/constants/inboundContact.ts +8 -0
  13. package/src/constants/integration.ts +13 -0
  14. package/src/constants/log.ts +7 -366
  15. package/src/constants/logActivityGroupColors.generated.ts +19 -0
  16. package/src/constants/logTaxonomy.generated.ts +1103 -0
  17. package/src/constants/noteDoc.ts +77 -0
  18. package/src/constants/organization.ts +18 -11
  19. package/src/constants/pageRoute.ts +23 -0
  20. package/src/constants/schedule.ts +220 -0
  21. package/src/constants/scheduleRuleTemplateSeed.ts +138 -0
  22. package/src/constants/scheduleRuleTemplates.generated.ts +145 -0
  23. package/src/constants/sheet.ts +168 -0
  24. package/src/constants/sheetRegionSources.generated.ts +578 -0
  25. package/src/constants/square.ts +16 -0
  26. package/src/constants/storage.ts +61 -0
  27. package/src/constants/usage.ts +79 -0
  28. package/src/schemas/editLogEntry.ts +1017 -738
  29. package/src/schemas/fieldDocsQuery.ts +12 -0
  30. package/src/schemas/inboundContact.ts +77 -0
  31. package/src/schemas/logsQuery.ts +57 -316
  32. package/src/schemas/organization.ts +53 -213
  33. package/src/types/account.d.ts +81 -0
  34. package/src/types/agentDoc.d.ts +64 -0
  35. package/src/types/agentMemory.d.ts +74 -0
  36. package/src/types/campaign.d.ts +683 -0
  37. package/src/types/dataTable.d.ts +366 -0
  38. package/src/types/docAccess.d.ts +96 -0
  39. package/src/types/email.d.ts +142 -0
  40. package/src/types/fieldDoc.d.ts +273 -0
  41. package/src/types/inboundContact.d.ts +57 -0
  42. package/src/types/integration.d.ts +42 -0
  43. package/src/types/log.d.ts +169 -190
  44. package/src/types/noteDoc.d.ts +86 -0
  45. package/src/types/organization.d.ts +175 -76
  46. package/src/types/pageRoute.d.ts +48 -0
  47. package/src/types/schedule.d.ts +391 -0
  48. package/src/types/sheet.d.ts +1130 -0
  49. package/src/types/storage.d.ts +242 -0
  50. package/src/types/usage.d.ts +106 -0
  51. package/src/types/workflow.d.ts +305 -0
  52. package/src/utils/agentDoc.ts +109 -0
  53. package/src/utils/aiChat.ts +26 -0
  54. package/src/utils/campaign.ts +741 -0
  55. package/src/utils/campaignFormEditor.ts +871 -0
  56. package/src/utils/dataTable.ts +849 -0
  57. package/src/utils/dataTableFieldTypeRegistry.ts +105 -0
  58. package/src/utils/dataTableRealtimeAuthority.ts +209 -0
  59. package/src/utils/dataTableRealtimeSelection.ts +134 -0
  60. package/src/utils/dataTableRowDocument.ts +508 -0
  61. package/src/utils/dataTableSource.ts +230 -0
  62. package/src/utils/docAccess.ts +383 -0
  63. package/src/utils/documentName.ts +53 -0
  64. package/src/utils/email.ts +172 -0
  65. package/src/utils/fieldDoc.ts +113 -0
  66. package/src/utils/log.ts +173 -778
  67. package/src/utils/logRegistryValue.ts +90 -0
  68. package/src/utils/logStoreRead.ts +266 -0
  69. package/src/utils/logTaxonomy.ts +76 -0
  70. package/src/utils/logTaxonomyDisplay.ts +439 -0
  71. package/src/utils/noteDoc.ts +827 -0
  72. package/src/utils/organization.ts +683 -81
  73. package/src/utils/pageRoute.ts +71 -0
  74. package/src/utils/schedule.ts +799 -0
  75. package/src/utils/scheduleEvaluation.ts +1994 -0
  76. package/src/utils/scheduleICS.ts +246 -0
  77. package/src/utils/scheduleRuleTemplates.ts +188 -0
  78. package/src/utils/sheet.ts +4973 -0
  79. package/src/utils/sheetAxisMove.ts +830 -0
  80. package/src/utils/sheetBootstrap.ts +1769 -0
  81. package/src/utils/sheetCommand.ts +423 -0
  82. package/src/utils/sheetExport.ts +238 -0
  83. package/src/utils/sheetFormulaEvaluation.ts +914 -0
  84. package/src/utils/sheetFormulaEvaluator.ts +852 -0
  85. package/src/utils/sheetJournal.ts +78 -0
  86. package/src/utils/sheetNumberFormat.ts +1211 -0
  87. package/src/utils/sheetRegion.ts +374 -0
  88. package/src/utils/sheetRegionFilter.ts +1259 -0
  89. package/src/utils/sheetRegionSourceRegistry.ts +594 -0
  90. package/src/utils/sheetSequence.ts +148 -0
  91. package/src/utils/sheetSnapshot.ts +992 -0
  92. package/src/utils/sheetStructureEdit.ts +1284 -0
  93. package/src/utils/square.ts +32 -0
  94. package/src/utils/storage.ts +152 -0
  95. package/src/utils/table-route.ts +262 -0
  96. package/src/utils/workflow.ts +380 -0
  97. package/tests/dataTableFieldTypeRegistry.test.ts +110 -0
  98. package/tests/docAccess.test.ts +525 -0
  99. package/tests/editLogEntry.test.ts +112 -0
  100. package/tests/noteDoc.test.ts +669 -0
  101. package/tests/schedule.test.ts +693 -0
  102. package/tests/scheduleEvaluation.test.ts +1970 -0
  103. package/tests/scheduleICS.test.ts +208 -0
  104. package/tests/scheduleRuleTemplates.test.ts +176 -0
  105. package/tests/scheduleSweepInvariants.test.ts +428 -0
  106. package/tests/sheetAxisMove.test.ts +343 -0
  107. package/tests/sheetFormulaEvaluator.test.ts +575 -0
  108. package/tests/sheetRegionFilter.test.ts +1135 -0
  109. package/tests/sheetSequence.test.ts +41 -0
  110. package/tests/sheetStructureEdit.test.ts +82 -0
  111. package/tsconfig.json +12 -0
  112. package/vitest.config.ts +8 -0
  113. package/src/constants/log-activityTexts.ts +0 -209
  114. package/src/constants/product.ts +0 -66
  115. package/src/constants/report.ts +0 -25
  116. package/src/schemas/childOrganizationsQuery.ts +0 -44
  117. package/src/schemas/productsQuery.ts +0 -145
  118. package/src/schemas/reportsQuery.ts +0 -107
  119. package/src/types/action.d.ts +0 -42
  120. package/src/types/product.d.ts +0 -173
  121. package/src/types/report.d.ts +0 -203
  122. package/src/utils/product-calEvent.ts +0 -508
  123. package/src/utils/route-helpers.ts +0 -583
@@ -0,0 +1,683 @@
1
+ import {
2
+ CAMPAIGN_AUDIENCE_ENUMS,
3
+ CAMPAIGN_ELEMENT_KINDS,
4
+ CAMPAIGN_ELEMENT_TYPES,
5
+ CAMPAIGN_ELEMENT_VISIBLE_WHEN_OPERATORS,
6
+ CAMPAIGN_FORM_BACKGROUND_FILL_STYLES,
7
+ CAMPAIGN_KIND_ENUMS,
8
+ CAMPAIGN_RESPONSE_STATUS_ENUMS,
9
+ CAMPAIGN_SORT_ENUMS,
10
+ CAMPAIGN_STATUS_ENUMS,
11
+ CAMPAIGN_TEMPLATE_STATUS_ENUMS,
12
+ CAMPAIGN_TEMPLATE_TYPES,
13
+ } from '../constants/campaign.ts';
14
+ import type {
15
+ OrganizationData,
16
+ OrganizationSiteData,
17
+ } from './organization.d.ts';
18
+ import type { StorageData, StorageGQL } from './storage.d.ts';
19
+
20
+ /**
21
+ * Enums
22
+ */
23
+
24
+ export type CampaignKindEnum = (typeof CAMPAIGN_KIND_ENUMS)[number];
25
+ export type CampaignAudienceEnum = (typeof CAMPAIGN_AUDIENCE_ENUMS)[number];
26
+ export type CampaignTemplateStatusEnum =
27
+ (typeof CAMPAIGN_TEMPLATE_STATUS_ENUMS)[number];
28
+ export type CampaignStatusEnum = (typeof CAMPAIGN_STATUS_ENUMS)[number];
29
+ export type CampaignResponseStatusEnum =
30
+ (typeof CAMPAIGN_RESPONSE_STATUS_ENUMS)[number];
31
+ export type CampaignElementKindEnum = (typeof CAMPAIGN_ELEMENT_KINDS)[number];
32
+ 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];
36
+ export type CampaignTemplateType = (typeof CAMPAIGN_TEMPLATE_TYPES)[number];
37
+ export type CampaignFormBackgroundFillStyleEnum =
38
+ (typeof CAMPAIGN_FORM_BACKGROUND_FILL_STYLES)[number];
39
+
40
+ /**
41
+ * Filters
42
+ */
43
+
44
+ export interface CampaignTemplatesFilterArgs {
45
+ kind?: CampaignKindEnum | null;
46
+ status?: CampaignTemplateStatusEnum | null;
47
+ search?: string | null;
48
+ }
49
+
50
+ export interface CampaignsFilterArgs {
51
+ templateId?: string | null;
52
+ kind?: CampaignKindEnum | null;
53
+ status?: CampaignStatusEnum[] | null;
54
+ }
55
+
56
+ export interface CampaignResponsesFilterArgs {
57
+ campaignId: string;
58
+ status?: CampaignResponseStatusEnum[] | null;
59
+ }
60
+
61
+ export interface CampaignRecipientsFilterArgs {
62
+ campaignId: string;
63
+ query?: string | null;
64
+ }
65
+
66
+ /**
67
+ * Campaign template elements (the campaign_template_elements table)
68
+ */
69
+
70
+ // One selectable choice. "value" is a stable slug that answers store; "label"
71
+ // is display text and may be edited without orphaning historical answers.
72
+ export interface CampaignElementOptionObj {
73
+ value: string;
74
+ label: string;
75
+ }
76
+
77
+ // Answer constraints; which keys apply depends on the element's type
78
+ export interface CampaignElementValidationObj {
79
+ minLength?: number;
80
+ maxLength?: number;
81
+ min?: number;
82
+ max?: number;
83
+ pattern?: string;
84
+ maxFiles?: number;
85
+ acceptedContentTypes?: string[];
86
+ }
87
+
88
+ // Show this element only when another element's answer matches
89
+ export interface CampaignElementVisibleWhenObj {
90
+ elementKey: string;
91
+ operator: CampaignElementVisibleWhenOperatorEnum;
92
+ value?: string | string[] | null;
93
+ }
94
+
95
+ export interface CampaignElementVisibleWhenValuesObj {
96
+ elementKey: string;
97
+ operator: CampaignElementVisibleWhenOperatorEnum;
98
+ values: string[];
99
+ }
100
+
101
+ // Sparse presentation flags; absent means false
102
+ export interface CampaignElementSettingsObj {
103
+ numbered?: boolean; // Render children of this section as a numbered list
104
+ fullWidth?: boolean;
105
+ }
106
+
107
+ export interface CampaignElementSettingsGQL {
108
+ numbered: boolean;
109
+ fullWidth: boolean;
110
+ }
111
+
112
+ export interface CampaignElementData {
113
+ __table: 'campaign_template_elements';
114
+ id: number | bigint;
115
+ templateId: number | bigint;
116
+ parentId?: number | bigint | null; // NULL for SECTION elements
117
+ kind: CampaignElementKindEnum;
118
+ 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;
123
+ placeholder?: string | null;
124
+ options?: CampaignElementOptionObj[] | null;
125
+ required?: boolean;
126
+ validation?: CampaignElementValidationObj | null;
127
+ visibleWhen?: CampaignElementVisibleWhenObj | null;
128
+ settings?: CampaignElementSettingsObj | null;
129
+ storageRels?: CampaignElementStorageRelData[]; // Element images
130
+ }
131
+
132
+ export interface CampaignElementStorageRelData {
133
+ __table: 'campaign_element_storage_rels';
134
+ elementId: number | bigint;
135
+ storageId: number | bigint;
136
+ order: number;
137
+ file: StorageData;
138
+ }
139
+
140
+ // One hydrated top-level section with its ordered child elements
141
+ export interface CampaignSectionWithElementsObj extends CampaignElementData {
142
+ elements: CampaignElementData[];
143
+ }
144
+
145
+ // The full resolved definition of one template
146
+ export interface CampaignDefinitionObj {
147
+ sections: CampaignSectionWithElementsObj[];
148
+ }
149
+
150
+ export interface CampaignDefinitionSnapshotFileObj {
151
+ uri?: string | null;
152
+ contentType?: string | null;
153
+ size?: number | null;
154
+ }
155
+
156
+ export interface CampaignDefinitionSnapshotStorageRelObj {
157
+ storageId: string;
158
+ order: number;
159
+ file: CampaignDefinitionSnapshotFileObj;
160
+ }
161
+
162
+ export interface CampaignDefinitionSnapshotElementObj {
163
+ key: string;
164
+ kind: CampaignElementKindEnum;
165
+ type?: CampaignElementTypeEnum | null;
166
+ order: number;
167
+ label?: string | null;
168
+ description?: string | null;
169
+ placeholder?: string | null;
170
+ options?: CampaignElementOptionObj[] | null;
171
+ required: boolean;
172
+ validation?: CampaignElementValidationObj | null;
173
+ visibleWhen?: CampaignElementVisibleWhenObj | null;
174
+ settings?: CampaignElementSettingsObj | null;
175
+ storageRels: CampaignDefinitionSnapshotStorageRelObj[];
176
+ }
177
+
178
+ export interface CampaignDefinitionSnapshotSectionObj
179
+ extends CampaignDefinitionSnapshotElementObj {
180
+ elements: CampaignDefinitionSnapshotElementObj[];
181
+ }
182
+
183
+ /**
184
+ * Campaign templates (the campaign_templates table)
185
+ */
186
+
187
+ export interface FormCampaignSettingsObj {
188
+ color?: string | null;
189
+ backgroundFillStyle?: CampaignFormBackgroundFillStyleEnum | null;
190
+ confirmationMessage?: string | null;
191
+ }
192
+
193
+ export interface EmailCampaignSettingsObj {
194
+ subject?: string | null;
195
+ body?: string | null;
196
+ bodyHTML?: string | null;
197
+ replyToAgentDomain: string;
198
+ secondaryReplyToEmail?: string | null;
199
+ }
200
+
201
+ export type CampaignSettingsObj =
202
+ | EmailCampaignSettingsObj
203
+ | FormCampaignSettingsObj;
204
+
205
+ export interface EmailCampaignSettingsInputObj {
206
+ subject?: string | null;
207
+ body?: string | null;
208
+ bodyHTML?: string | null;
209
+ replyToAgentDomain?: string | null;
210
+ secondaryReplyToEmail?: string | null;
211
+ }
212
+
213
+ export interface FormCampaignSettingsInputObj {
214
+ color?: string | null;
215
+ backgroundFillStyle?: CampaignFormBackgroundFillStyleEnum | null;
216
+ confirmationMessage?: string | null;
217
+ }
218
+
219
+ export type CampaignSettingsInputObj =
220
+ | {
221
+ email: EmailCampaignSettingsInputObj;
222
+ form?: never;
223
+ }
224
+ | {
225
+ email?: never;
226
+ form: FormCampaignSettingsInputObj;
227
+ };
228
+
229
+ export interface CampaignTemplateData {
230
+ __table: 'campaign_templates';
231
+ id: number | bigint;
232
+ organizationId: number | bigint;
233
+ kind: CampaignKindEnum;
234
+ status: CampaignTemplateStatusEnum;
235
+ generationError?: string | null; // Only ever set while status is ERROR
236
+ title?: string | null;
237
+ description?: string | null;
238
+ responseWorkflowId?: number | bigint | null;
239
+ siteId?: number | bigint | null;
240
+ headerImageStorageId?: number | bigint | null;
241
+ settings?: CampaignSettingsObj | null;
242
+ createdByAccountId?: number | bigint | null;
243
+ createdAt: Date | string;
244
+ updatedAt: Date | string;
245
+
246
+ // Attached by fetch helpers
247
+ elements?: CampaignElementData[];
248
+ headerImage?: StorageData | null;
249
+ site?: OrganizationSiteData | null;
250
+ }
251
+
252
+ /**
253
+ * Campaigns (the campaigns table)
254
+ */
255
+
256
+ // The published question tree, frozen at publish time so editing the template
257
+ // never changes what an in-flight campaign asks
258
+ export interface CampaignDefinitionSnapshotObj {
259
+ schemaVersion: number;
260
+ snapshotSource: string;
261
+ sections: CampaignDefinitionSnapshotSectionObj[];
262
+ }
263
+
264
+ export interface CampaignData {
265
+ __table: 'campaigns';
266
+ id: number | bigint;
267
+ organizationId: number | bigint;
268
+ templateId: number | bigint;
269
+ sourceCampaignId?: number | bigint | null;
270
+ idempotencyKey?: string | null;
271
+ kind: CampaignKindEnum;
272
+ status: CampaignStatusEnum;
273
+ publicId?: string | null;
274
+ audience: CampaignAudienceEnum;
275
+ title?: string | null;
276
+ description?: string | null;
277
+ definitionSnapshot: CampaignDefinitionSnapshotObj;
278
+ settingsSnapshot: CampaignSettingsObj;
279
+ responseWorkflowId?: number | bigint | null;
280
+ responseWorkflowSnapshot?: Record<string, any> | null;
281
+ siteId?: number | bigint | null;
282
+ headerImageStorageId?: number | bigint | null;
283
+ scheduledAt?: Date | string | null;
284
+ opensAt?: Date | string | null;
285
+ closesAt?: Date | string | null;
286
+ publishedAt: Date | string;
287
+ completedAt?: Date | string | null;
288
+ errorMessage?: string | null;
289
+ createdByAccountId?: number | bigint | null;
290
+ createdAt: Date | string;
291
+ updatedAt: Date | string;
292
+
293
+ // Attached by fetch helpers
294
+ template?: CampaignTemplateData | null;
295
+ organization?: OrganizationData | null;
296
+ headerImage?: StorageData | null;
297
+ }
298
+
299
+ /**
300
+ * Campaign recipients (the campaign_recipients table)
301
+ */
302
+
303
+ export interface CampaignRecipientData {
304
+ __table: 'campaign_recipients';
305
+ id: number | bigint;
306
+ organizationId: number | bigint;
307
+ campaignId: number | bigint;
308
+ inboundContactId: number | bigint;
309
+ emailAddressSnapshot: string;
310
+ personNameSnapshot?: string | null;
311
+ accessTokenHash?: string | null;
312
+ invitedAt?: Date | string | null;
313
+ firstOpenedAt?: Date | string | null;
314
+ respondedAt?: Date | string | null;
315
+ revokedAt?: Date | string | null;
316
+ createdAt: Date | string;
317
+ updatedAt: Date | string;
318
+ }
319
+
320
+ /**
321
+ * Campaign responses (the campaign_responses table)
322
+ */
323
+
324
+ // One answer, keyed by its element. Files live in
325
+ // campaign_response_storage_rels and are attached as "files".
326
+ export interface CampaignAnswerObj {
327
+ elementKey: string;
328
+ // Copied from the published definition by the server when the answer is saved
329
+ question?: string | null;
330
+ value?: string | string[] | null;
331
+ files?: StorageGQL[];
332
+ }
333
+
334
+ export interface CampaignAnswersObj {
335
+ [elementKey: string]: CampaignAnswerObj;
336
+ }
337
+
338
+ export interface CampaignResponseData {
339
+ __table: 'campaign_responses';
340
+ id: number | bigint;
341
+ organizationId: number | bigint;
342
+ campaignId: number | bigint;
343
+ templateId: number | bigint;
344
+ recipientId?: number | bigint | null;
345
+ respondentAccountId?: number | bigint | null;
346
+ respondentEmail?: string | null;
347
+ respondentName?: string | null;
348
+ childOrgId?: number | bigint | null;
349
+ answers: CampaignAnswersObj;
350
+ status: CampaignResponseStatusEnum;
351
+ submittedAt?: Date | string | null;
352
+ activityAt: Date | string;
353
+ createdAt: Date | string;
354
+ updatedAt: Date | string;
355
+
356
+ // Attached by fetch helpers
357
+ campaign?: CampaignData | null;
358
+ childOrg?: OrganizationData | null;
359
+ storageRels?: CampaignResponseStorageRelData[];
360
+ }
361
+
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
+ }
370
+
371
+ /**
372
+ * Create-template modal draft
373
+ */
374
+
375
+ export interface CampaignDraftFile {
376
+ contentType: string;
377
+ fileKey: string;
378
+ fileUri: string;
379
+ name: string;
380
+ storageId: string;
381
+ uploadedAt: number;
382
+ }
383
+
384
+ // Persisted locally so closing and reopening the modal resumes where the user
385
+ // left off. Instructions are held per kind because the modal can switch
386
+ // between a public form and an email without losing either draft.
387
+ export interface CampaignDraft {
388
+ files: CampaignDraftFile[];
389
+ instructions: Record<CampaignKindEnum, string>;
390
+ }
391
+
392
+ /**
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.
398
+ */
399
+
400
+ export interface CampaignElementInputObj {
401
+ kind: CampaignElementKindEnum;
402
+ type?: CampaignElementTypeEnum | null;
403
+ key?: string | null;
404
+ label?: string | null;
405
+ description?: string | null;
406
+ placeholder?: string | null;
407
+ options?: CampaignElementOptionObj[] | null;
408
+ required?: boolean | null;
409
+ validation?: CampaignElementValidationObj | null;
410
+ visibleWhen?: CampaignElementVisibleWhenValuesObj | null;
411
+ settings?: CampaignElementSettingsObj | null;
412
+ imageStorageIds?: string[] | null;
413
+ }
414
+
415
+ export interface CampaignSectionInputObj {
416
+ key?: string | null;
417
+ label?: string | null;
418
+ description?: string | null;
419
+ settings?: CampaignElementSettingsObj | null;
420
+ elements: CampaignElementInputObj[];
421
+ }
422
+
423
+ /**
424
+ * GraphQL view shapes
425
+ *
426
+ * Definition snapshots, element JSONB columns and campaign settings cross the
427
+ * wire as typed GraphQL objects.
428
+ */
429
+
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;
439
+ placeholder?: string | null;
440
+ required: boolean;
441
+ options: CampaignElementOptionObj[];
442
+ validation?: CampaignElementValidationObj | null;
443
+ visibleWhen?: CampaignElementVisibleWhenValuesObj | null;
444
+ settings: CampaignElementSettingsGQL;
445
+ files?: StorageGQL[];
446
+ }
447
+
448
+ export interface CampaignTemplateGQL {
449
+ id: string;
450
+ organizationId: string;
451
+ kind: CampaignKindEnum;
452
+ status: CampaignTemplateStatusEnum;
453
+ generationError?: string | null;
454
+ generationProgress?: CampaignTemplateGenerationProgressGQL | null;
455
+ title?: string | null;
456
+ description?: string | null;
457
+ responseWorkflowId?: string | null;
458
+ siteId?: string | null;
459
+ settings: CampaignSettingsGQL;
460
+ headerImage?: StorageGQL | null;
461
+ elements?: CampaignElementGQL[];
462
+ createdAt: string;
463
+ updatedAt: string;
464
+ }
465
+
466
+ export interface CampaignTemplateSummaryGQL {
467
+ id: string;
468
+ organizationId: string;
469
+ kind: CampaignKindEnum;
470
+ status: CampaignTemplateStatusEnum;
471
+ generationError?: string | null;
472
+ generationProgress?: CampaignTemplateGenerationProgressGQL | null;
473
+ title?: string | null;
474
+ description?: string | null;
475
+ headerImage?: StorageGQL | null;
476
+ createdAt: string;
477
+ updatedAt: string;
478
+ cursor?: string | null;
479
+ }
480
+
481
+ export interface CampaignTemplateGenerationProgressGQL {
482
+ message: string;
483
+ }
484
+
485
+ export interface CampaignDefinitionFileGQL {
486
+ id: string;
487
+ order: number;
488
+ uri?: string | null;
489
+ contentType?: string | null;
490
+ size?: number | null;
491
+ }
492
+
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[];
506
+ }
507
+
508
+ export interface CampaignDefinitionElementGQL {
509
+ key: string;
510
+ kind: CampaignElementKindEnum;
511
+ type?: CampaignElementTypeEnum | null;
512
+ order: number;
513
+ label?: string | null;
514
+ description?: string | null;
515
+ placeholder?: string | null;
516
+ options: CampaignElementOptionObj[];
517
+ required: boolean;
518
+ validation?: CampaignElementValidationObj | null;
519
+ visibleWhen?: CampaignElementVisibleWhenValuesObj | null;
520
+ settings: CampaignElementSettingsGQL;
521
+ files: CampaignDefinitionFileGQL[];
522
+ }
523
+
524
+ export interface CampaignDefinitionSectionGQL {
525
+ key: string;
526
+ order: number;
527
+ label?: string | null;
528
+ description?: string | null;
529
+ settings: CampaignElementSettingsGQL;
530
+ elements: CampaignDefinitionElementGQL[];
531
+ }
532
+
533
+ export interface CampaignDefinitionSnapshotGQL {
534
+ schemaVersion: number;
535
+ snapshotSource: string;
536
+ sections: CampaignDefinitionSectionGQL[];
537
+ }
538
+
539
+ export interface CampaignGQL {
540
+ id: string;
541
+ organizationId: string;
542
+ templateId: string;
543
+ kind: CampaignKindEnum;
544
+ status: CampaignStatusEnum;
545
+ publicId?: string | null;
546
+ audience: CampaignAudienceEnum;
547
+ title?: string | null;
548
+ description?: string | null;
549
+ definitionSnapshot: CampaignDefinitionSnapshotGQL;
550
+ settings: CampaignSettingsGQL;
551
+ siteId?: string | null;
552
+ headerImage?: StorageGQL | null;
553
+ scheduledAt?: string | null;
554
+ opensAt?: string | null;
555
+ closesAt?: string | null;
556
+ publishedAt: string;
557
+ completedAt?: string | null;
558
+ errorMessage?: string | null;
559
+ isOpen: boolean;
560
+ createdAt: string;
561
+ updatedAt: string;
562
+ cursor?: string | null;
563
+ }
564
+
565
+ export interface CampaignSummaryGQL {
566
+ id: string;
567
+ organizationId: string;
568
+ templateId: string;
569
+ kind: CampaignKindEnum;
570
+ status: CampaignStatusEnum;
571
+ publicId?: string | null;
572
+ audience: CampaignAudienceEnum;
573
+ title?: string | null;
574
+ opensAt?: string | null;
575
+ closesAt?: string | null;
576
+ publishedAt: string;
577
+ completedAt?: string | null;
578
+ isOpen: boolean;
579
+ createdAt: string;
580
+ cursor?: string | null;
581
+ }
582
+
583
+ export interface EmailCampaignSettingsGQL {
584
+ __typename: 'EmailCampaignSettings';
585
+ subject?: string | null;
586
+ body?: string | null;
587
+ bodyHTML?: string | null;
588
+ replyToAgentDomain: string;
589
+ secondaryReplyToEmail?: string | null;
590
+ }
591
+
592
+ export interface FormCampaignSettingsGQL {
593
+ __typename: 'FormCampaignSettings';
594
+ color?: string | null;
595
+ backgroundFillStyle?: CampaignFormBackgroundFillStyleEnum | null;
596
+ confirmationMessage?: string | null;
597
+ }
598
+
599
+ export type CampaignSettingsGQL =
600
+ | EmailCampaignSettingsGQL
601
+ | FormCampaignSettingsGQL;
602
+
603
+ export interface CampaignResponseGQL {
604
+ id: string;
605
+ cursor?: string | null;
606
+ campaignId: string;
607
+ templateId: string;
608
+ respondentName?: string | null;
609
+ respondentEmail?: string | null;
610
+ childOrgId?: string | null;
611
+ 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;
617
+ activityAt: string;
618
+ createdAt: string;
619
+ }
620
+
621
+ export interface CampaignRecipientGQL {
622
+ id: string;
623
+ cursor?: string | null;
624
+ campaignId: string;
625
+ inboundContactId: string;
626
+ emailAddress: string;
627
+ personName?: string | null;
628
+ invitedAt?: string | null;
629
+ firstOpenedAt?: string | null;
630
+ respondedAt?: string | null;
631
+ revokedAt?: string | null;
632
+ createdAt: string;
633
+ }
634
+
635
+ /**
636
+ * The public form payload served by /api/campaigns/:publicId
637
+ */
638
+
639
+ export interface PublicCampaignElementObj {
640
+ key: string;
641
+ kind: CampaignElementKindEnum;
642
+ type?: CampaignElementTypeEnum | null;
643
+ label?: string | null;
644
+ description?: string | null;
645
+ placeholder?: string | null;
646
+ options?: CampaignElementOptionObj[] | null;
647
+ required: boolean;
648
+ validation?: CampaignElementValidationObj | null;
649
+ visibleWhen?: CampaignElementVisibleWhenObj | null;
650
+ files?: Array<{ id: string; uri: string; contentType?: string | null }>;
651
+ }
652
+
653
+ export interface PublicCampaignSectionObj {
654
+ key: string;
655
+ title?: string | null;
656
+ description?: string | null;
657
+ settings?: CampaignElementSettingsObj | null;
658
+ elements: PublicCampaignElementObj[];
659
+ }
660
+
661
+ export interface PublicCampaignObj {
662
+ publicId: string;
663
+ audience: CampaignAudienceEnum;
664
+ title?: string | null;
665
+ description?: string | null;
666
+ headerImage?: { id: string; uri: string; contentType?: string | null } | null;
667
+ color?: string | null;
668
+ backgroundFillStyle: CampaignFormBackgroundFillStyleEnum;
669
+ isOpen: boolean;
670
+ // Null when the campaign is closed: a closed form withholds its questions
671
+ sections: PublicCampaignSectionObj[] | null;
672
+ }
673
+
674
+ /**
675
+ * Durable generation job payload
676
+ */
677
+
678
+ export interface CampaignGenerationJobPayload {
679
+ accountId: string;
680
+ templateId: string;
681
+ instructions: string;
682
+ sourceStorageIds?: string[] | null;
683
+ }