@kelpie/schemas 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/company.d.ts +8 -0
- package/dist/company.d.ts.map +1 -1
- package/dist/company.js +4 -0
- package/dist/company.js.map +1 -1
- package/dist/consentPurpose.d.ts +49 -0
- package/dist/consentPurpose.d.ts.map +1 -0
- package/dist/consentPurpose.js +40 -0
- package/dist/consentPurpose.js.map +1 -0
- package/dist/customField.d.ts +99 -0
- package/dist/customField.d.ts.map +1 -0
- package/dist/customField.js +133 -0
- package/dist/customField.js.map +1 -0
- package/dist/deal.d.ts +8 -0
- package/dist/deal.d.ts.map +1 -1
- package/dist/deal.js +4 -0
- package/dist/deal.js.map +1 -1
- package/dist/enquiry.d.ts +43 -0
- package/dist/enquiry.d.ts.map +1 -0
- package/dist/enquiry.js +47 -0
- package/dist/enquiry.js.map +1 -0
- package/dist/form.d.ts +117 -2
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +102 -1
- package/dist/form.js.map +1 -1
- package/dist/formSubmission.d.ts +29 -0
- package/dist/formSubmission.d.ts.map +1 -1
- package/dist/formSubmission.js +34 -0
- package/dist/formSubmission.js.map +1 -1
- package/dist/importExport.d.ts +28 -4
- package/dist/importExport.d.ts.map +1 -1
- package/dist/importExport.js +24 -1
- package/dist/importExport.js.map +1 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/list.d.ts +10 -0
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +6 -0
- package/dist/list.js.map +1 -1
- package/dist/names.d.ts +43 -0
- package/dist/names.d.ts.map +1 -0
- package/dist/names.js +35 -0
- package/dist/names.js.map +1 -0
- package/dist/opportunity.d.ts +10 -0
- package/dist/opportunity.d.ts.map +1 -1
- package/dist/opportunity.js +7 -0
- package/dist/opportunity.js.map +1 -1
- package/dist/partnership.d.ts +8 -0
- package/dist/partnership.d.ts.map +1 -1
- package/dist/partnership.js +4 -0
- package/dist/partnership.js.map +1 -1
- package/dist/person.d.ts +42 -1
- package/dist/person.d.ts.map +1 -1
- package/dist/person.js +23 -0
- package/dist/person.js.map +1 -1
- package/dist/personConsent.d.ts +31 -0
- package/dist/personConsent.d.ts.map +1 -0
- package/dist/personConsent.js +27 -0
- package/dist/personConsent.js.map +1 -0
- package/dist/raise.d.ts +8 -0
- package/dist/raise.d.ts.map +1 -1
- package/dist/raise.js +4 -0
- package/dist/raise.js.map +1 -1
- package/dist/sampleData.d.ts +1 -0
- package/dist/sampleData.d.ts.map +1 -1
- package/dist/sampleData.js +2 -0
- package/dist/sampleData.js.map +1 -1
- package/dist/values.d.ts +86 -8
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +140 -3
- package/dist/values.js.map +1 -1
- package/package.json +1 -1
- package/src/company.ts +13 -0
- package/src/consentPurpose.ts +95 -0
- package/src/customField.ts +211 -0
- package/src/deal.ts +13 -0
- package/src/enquiry.ts +94 -0
- package/src/form.ts +230 -2
- package/src/formSubmission.ts +63 -0
- package/src/importExport.ts +44 -5
- package/src/index.ts +70 -2
- package/src/list.ts +16 -0
- package/src/names.ts +49 -0
- package/src/opportunity.ts +18 -0
- package/src/partnership.ts +13 -0
- package/src/person.ts +69 -1
- package/src/personConsent.ts +60 -0
- package/src/raise.ts +13 -0
- package/src/sampleData.ts +3 -0
- package/src/values.ts +169 -3
package/dist/form.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { FormFieldMapTarget, FormFieldType, FormOptionValueType, FormStatus } from './values.ts';
|
|
2
|
+
import type { FormFieldMapTarget, FormFieldType, FormOptionValueType, FormStatus, PipelineKind } from './values.ts';
|
|
3
3
|
import type { RecordTimestamps } from './wire.ts';
|
|
4
4
|
/**
|
|
5
5
|
* Wire and write shapes for `/v1/forms`, the embeddable inbound capture from
|
|
@@ -29,12 +29,44 @@ export interface FormField {
|
|
|
29
29
|
/** Empty for every type but `select`. */
|
|
30
30
|
readonly options: readonly FormFieldOption[];
|
|
31
31
|
readonly placeholder: string | null;
|
|
32
|
+
/**
|
|
33
|
+
* The intro sentence for a `consent` field — sits above the list of purpose
|
|
34
|
+
* checkboxes. `label` is the field heading; `statement` is what the visitor
|
|
35
|
+
* reads before ticking. Null for every other type.
|
|
36
|
+
*/
|
|
37
|
+
readonly statement: string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Workspace consent purposes this `consent` field offers, in display order.
|
|
40
|
+
* Non-empty when `type === 'consent'`; empty otherwise. Each ticked box
|
|
41
|
+
* grants the purpose it belongs to; an unticked one is absence.
|
|
42
|
+
*/
|
|
43
|
+
readonly consentPurposeIds: readonly string[];
|
|
44
|
+
/**
|
|
45
|
+
* Per-purpose override for the checkbox text, keyed by purpose id. Absent
|
|
46
|
+
* keys fall back to the workspace purpose's own label. Only the wording
|
|
47
|
+
* changes — the checkbox stays bound to its purpose.
|
|
48
|
+
*/
|
|
49
|
+
readonly consentPurposeLabels: Readonly<Record<string, string>>;
|
|
32
50
|
/** Position in the form, contiguous from 0. The server renumbers on every write. */
|
|
33
51
|
readonly sortOrder: number;
|
|
34
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* One pre-existing pipeline record every submitter is linked into through
|
|
55
|
+
* `person_links`. `target_type` is fixed at form-write time; the row itself
|
|
56
|
+
* lives in `form_attach_targets` on the server.
|
|
57
|
+
*/
|
|
58
|
+
export interface FormAttachTarget {
|
|
59
|
+
readonly targetType: PipelineKind;
|
|
60
|
+
readonly targetId: string;
|
|
61
|
+
}
|
|
35
62
|
export interface Form extends RecordTimestamps {
|
|
36
63
|
readonly id: string;
|
|
37
64
|
readonly name: string;
|
|
65
|
+
/**
|
|
66
|
+
* Heading on the hosted/embed page. Defaults to `name` when the form is
|
|
67
|
+
* created; edit it from Settings without renaming the form in the CRM.
|
|
68
|
+
*/
|
|
69
|
+
readonly title: string;
|
|
38
70
|
readonly description: string | null;
|
|
39
71
|
readonly status: FormStatus;
|
|
40
72
|
readonly fields: readonly FormField[];
|
|
@@ -44,6 +76,39 @@ export interface Form extends RecordTimestamps {
|
|
|
44
76
|
readonly dealStageId: string | null;
|
|
45
77
|
/** Expands `{{company.name}}` and `{{person.name}}`. Null when `createDeal` is off. */
|
|
46
78
|
readonly dealNameTemplate: string | null;
|
|
79
|
+
readonly createOpportunity: boolean;
|
|
80
|
+
/** Required when `createOpportunity` is on: opportunities carry a `kind`. */
|
|
81
|
+
readonly opportunityKind: string | null;
|
|
82
|
+
readonly opportunityStageId: string | null;
|
|
83
|
+
readonly opportunityNameTemplate: string | null;
|
|
84
|
+
/** Null falls back to the workspace default member at submit time. */
|
|
85
|
+
readonly opportunityOwnerId: string | null;
|
|
86
|
+
readonly createPartnership: boolean;
|
|
87
|
+
/** Required when `createPartnership` is on. */
|
|
88
|
+
readonly partnershipKind: string | null;
|
|
89
|
+
readonly partnershipStageId: string | null;
|
|
90
|
+
readonly partnershipNameTemplate: string | null;
|
|
91
|
+
/** Null falls back to the workspace default member at submit time. */
|
|
92
|
+
readonly partnershipOwnerId: string | null;
|
|
93
|
+
readonly createEnquiry: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Free-text label for the enquiry's `source` column. Optional: an unset value
|
|
96
|
+
* stores an empty string. Enquiry needs no `kind` because it has no `kind`
|
|
97
|
+
* column — a form's source is the source.
|
|
98
|
+
*/
|
|
99
|
+
readonly enquirySource: string | null;
|
|
100
|
+
readonly enquiryStageId: string | null;
|
|
101
|
+
readonly enquiryNameTemplate: string | null;
|
|
102
|
+
/** Null falls back to the workspace default member at submit time. */
|
|
103
|
+
readonly enquiryOwnerId: string | null;
|
|
104
|
+
/** Tags to merge (union) into the resolved Person's `tags` on every submit. */
|
|
105
|
+
readonly personTags: readonly string[];
|
|
106
|
+
/** Tags to merge (union) into the resolved Company's `tags`; skipped when no company resolved. */
|
|
107
|
+
readonly companyTags: readonly string[];
|
|
108
|
+
/** Lists (person or company) every matching record is added to on submit. */
|
|
109
|
+
readonly listIds: readonly string[];
|
|
110
|
+
/** Pre-existing pipeline records the submitter is linked to via `person_links`. */
|
|
111
|
+
readonly attachTargets: readonly FormAttachTarget[];
|
|
47
112
|
/**
|
|
48
113
|
* The handle the public submit and embed endpoints resolve a workspace from.
|
|
49
114
|
* Globally unique, and the only credential those endpoints take.
|
|
@@ -70,9 +135,17 @@ export interface FormFieldInput {
|
|
|
70
135
|
readonly mapTo: FormFieldMapTarget;
|
|
71
136
|
readonly options?: readonly FormFieldOptionInput[];
|
|
72
137
|
readonly placeholder?: string | null;
|
|
138
|
+
/** The intro sentence above the list of consent checkboxes. */
|
|
139
|
+
readonly statement?: string | null;
|
|
140
|
+
/** Non-empty for `consent` fields; each id becomes a checkbox in display order. */
|
|
141
|
+
readonly consentPurposeIds?: readonly string[];
|
|
142
|
+
/** Per-purpose override for the checkbox text. Falls back to the workspace label. */
|
|
143
|
+
readonly consentPurposeLabels?: Readonly<Record<string, string>>;
|
|
73
144
|
}
|
|
74
145
|
export interface CreateFormInput {
|
|
75
146
|
readonly name: string;
|
|
147
|
+
/** Defaults to `name` when omitted. */
|
|
148
|
+
readonly title?: string;
|
|
76
149
|
readonly description?: string | null;
|
|
77
150
|
readonly status?: FormStatus;
|
|
78
151
|
readonly fields: readonly FormFieldInput[];
|
|
@@ -80,10 +153,33 @@ export interface CreateFormInput {
|
|
|
80
153
|
readonly createDeal?: boolean;
|
|
81
154
|
readonly dealStageId?: string | null;
|
|
82
155
|
readonly dealNameTemplate?: string | null;
|
|
156
|
+
readonly createOpportunity?: boolean;
|
|
157
|
+
readonly opportunityKind?: string | null;
|
|
158
|
+
readonly opportunityStageId?: string | null;
|
|
159
|
+
readonly opportunityNameTemplate?: string | null;
|
|
160
|
+
readonly opportunityOwnerId?: string | null;
|
|
161
|
+
readonly createPartnership?: boolean;
|
|
162
|
+
readonly partnershipKind?: string | null;
|
|
163
|
+
readonly partnershipStageId?: string | null;
|
|
164
|
+
readonly partnershipNameTemplate?: string | null;
|
|
165
|
+
readonly partnershipOwnerId?: string | null;
|
|
166
|
+
readonly createEnquiry?: boolean;
|
|
167
|
+
readonly enquirySource?: string | null;
|
|
168
|
+
readonly enquiryStageId?: string | null;
|
|
169
|
+
readonly enquiryNameTemplate?: string | null;
|
|
170
|
+
readonly enquiryOwnerId?: string | null;
|
|
171
|
+
readonly personTags?: readonly string[];
|
|
172
|
+
readonly companyTags?: readonly string[];
|
|
173
|
+
readonly listIds?: readonly string[];
|
|
174
|
+
readonly attachTargets?: readonly FormAttachTarget[];
|
|
83
175
|
}
|
|
84
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* `fields`, `list_ids`, and `attach_targets` are each absent or the whole list;
|
|
178
|
+
* there is no per-entry patch.
|
|
179
|
+
*/
|
|
85
180
|
export interface FormInput {
|
|
86
181
|
readonly name?: string;
|
|
182
|
+
readonly title?: string;
|
|
87
183
|
readonly description?: string | null;
|
|
88
184
|
readonly status?: FormStatus;
|
|
89
185
|
readonly fields?: readonly FormFieldInput[];
|
|
@@ -91,6 +187,25 @@ export interface FormInput {
|
|
|
91
187
|
readonly createDeal?: boolean;
|
|
92
188
|
readonly dealStageId?: string | null;
|
|
93
189
|
readonly dealNameTemplate?: string | null;
|
|
190
|
+
readonly createOpportunity?: boolean;
|
|
191
|
+
readonly opportunityKind?: string | null;
|
|
192
|
+
readonly opportunityStageId?: string | null;
|
|
193
|
+
readonly opportunityNameTemplate?: string | null;
|
|
194
|
+
readonly opportunityOwnerId?: string | null;
|
|
195
|
+
readonly createPartnership?: boolean;
|
|
196
|
+
readonly partnershipKind?: string | null;
|
|
197
|
+
readonly partnershipStageId?: string | null;
|
|
198
|
+
readonly partnershipNameTemplate?: string | null;
|
|
199
|
+
readonly partnershipOwnerId?: string | null;
|
|
200
|
+
readonly createEnquiry?: boolean;
|
|
201
|
+
readonly enquirySource?: string | null;
|
|
202
|
+
readonly enquiryStageId?: string | null;
|
|
203
|
+
readonly enquiryNameTemplate?: string | null;
|
|
204
|
+
readonly enquiryOwnerId?: string | null;
|
|
205
|
+
readonly personTags?: readonly string[];
|
|
206
|
+
readonly companyTags?: readonly string[];
|
|
207
|
+
readonly listIds?: readonly string[];
|
|
208
|
+
readonly attachTargets?: readonly FormAttachTarget[];
|
|
94
209
|
}
|
|
95
210
|
export declare function createFormBody(input: CreateFormInput): Record<string, unknown>;
|
|
96
211
|
export declare function formBody(input: FormInput): Record<string, unknown>;
|
package/dist/form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,YAAY,EACb,MAAM,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD;;;;;;;;GAQG;AAEH;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAA;CACxC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;IAC5B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAA;IAClC,yCAAyC;IACzC,QAAQ,C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AChC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5C,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAA;CACrD;AAsBD,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA+B9E;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA+BlE"}
|
package/dist/form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { FORM_FIELD_MAP_TARGETS, FORM_FIELD_TYPES, FORM_OPTION_VALUE_TYPES, FORM_STATUSES, } from './values.js';
|
|
2
|
+
import { FORM_FIELD_MAP_TARGETS, FORM_FIELD_TYPES, FORM_OPTION_VALUE_TYPES, FORM_STATUSES, PIPELINE_KINDS, } from './values.js';
|
|
3
3
|
import { definedFields, idSchema, recordTimestamps } from './wire.js';
|
|
4
4
|
const formFieldOptionSchema = z
|
|
5
5
|
.object({
|
|
@@ -21,6 +21,9 @@ const formFieldSchema = z
|
|
|
21
21
|
map_to: z.enum(FORM_FIELD_MAP_TARGETS),
|
|
22
22
|
options: z.array(formFieldOptionSchema),
|
|
23
23
|
placeholder: z.string().nullable(),
|
|
24
|
+
statement: z.string().nullable(),
|
|
25
|
+
consent_purpose_ids: z.array(idSchema),
|
|
26
|
+
consent_purpose_labels: z.record(z.string(), z.string()),
|
|
24
27
|
sort_order: z.number().int(),
|
|
25
28
|
})
|
|
26
29
|
.transform((wire) => ({
|
|
@@ -31,12 +34,25 @@ const formFieldSchema = z
|
|
|
31
34
|
mapTo: wire.map_to,
|
|
32
35
|
options: wire.options,
|
|
33
36
|
placeholder: wire.placeholder,
|
|
37
|
+
statement: wire.statement,
|
|
38
|
+
consentPurposeIds: wire.consent_purpose_ids,
|
|
39
|
+
consentPurposeLabels: wire.consent_purpose_labels,
|
|
34
40
|
sortOrder: wire.sort_order,
|
|
35
41
|
}));
|
|
42
|
+
const attachTargetSchema = z
|
|
43
|
+
.object({
|
|
44
|
+
target_type: z.enum(PIPELINE_KINDS),
|
|
45
|
+
target_id: idSchema,
|
|
46
|
+
})
|
|
47
|
+
.transform((wire) => ({
|
|
48
|
+
targetType: wire.target_type,
|
|
49
|
+
targetId: wire.target_id,
|
|
50
|
+
}));
|
|
36
51
|
export const formSchema = z
|
|
37
52
|
.object({
|
|
38
53
|
id: idSchema,
|
|
39
54
|
name: z.string(),
|
|
55
|
+
title: z.string(),
|
|
40
56
|
description: z.string().nullable(),
|
|
41
57
|
status: z.enum(FORM_STATUSES),
|
|
42
58
|
fields: z.array(formFieldSchema),
|
|
@@ -44,12 +60,32 @@ export const formSchema = z
|
|
|
44
60
|
create_deal: z.boolean(),
|
|
45
61
|
deal_stage_id: idSchema.nullable(),
|
|
46
62
|
deal_name_template: z.string().nullable(),
|
|
63
|
+
create_opportunity: z.boolean(),
|
|
64
|
+
opportunity_kind: z.string().nullable(),
|
|
65
|
+
opportunity_stage_id: idSchema.nullable(),
|
|
66
|
+
opportunity_name_template: z.string().nullable(),
|
|
67
|
+
opportunity_owner_id: idSchema.nullable(),
|
|
68
|
+
create_partnership: z.boolean(),
|
|
69
|
+
partnership_kind: z.string().nullable(),
|
|
70
|
+
partnership_stage_id: idSchema.nullable(),
|
|
71
|
+
partnership_name_template: z.string().nullable(),
|
|
72
|
+
partnership_owner_id: idSchema.nullable(),
|
|
73
|
+
create_enquiry: z.boolean(),
|
|
74
|
+
enquiry_source: z.string().nullable(),
|
|
75
|
+
enquiry_stage_id: idSchema.nullable(),
|
|
76
|
+
enquiry_name_template: z.string().nullable(),
|
|
77
|
+
enquiry_owner_id: idSchema.nullable(),
|
|
78
|
+
person_tags: z.array(z.string()),
|
|
79
|
+
company_tags: z.array(z.string()),
|
|
80
|
+
list_ids: z.array(idSchema),
|
|
81
|
+
attach_targets: z.array(attachTargetSchema),
|
|
47
82
|
public_key: z.string(),
|
|
48
83
|
...recordTimestamps,
|
|
49
84
|
})
|
|
50
85
|
.transform((wire) => ({
|
|
51
86
|
id: wire.id,
|
|
52
87
|
name: wire.name,
|
|
88
|
+
title: wire.title,
|
|
53
89
|
description: wire.description,
|
|
54
90
|
status: wire.status,
|
|
55
91
|
fields: wire.fields,
|
|
@@ -57,6 +93,25 @@ export const formSchema = z
|
|
|
57
93
|
createDeal: wire.create_deal,
|
|
58
94
|
dealStageId: wire.deal_stage_id,
|
|
59
95
|
dealNameTemplate: wire.deal_name_template,
|
|
96
|
+
createOpportunity: wire.create_opportunity,
|
|
97
|
+
opportunityKind: wire.opportunity_kind,
|
|
98
|
+
opportunityStageId: wire.opportunity_stage_id,
|
|
99
|
+
opportunityNameTemplate: wire.opportunity_name_template,
|
|
100
|
+
opportunityOwnerId: wire.opportunity_owner_id,
|
|
101
|
+
createPartnership: wire.create_partnership,
|
|
102
|
+
partnershipKind: wire.partnership_kind,
|
|
103
|
+
partnershipStageId: wire.partnership_stage_id,
|
|
104
|
+
partnershipNameTemplate: wire.partnership_name_template,
|
|
105
|
+
partnershipOwnerId: wire.partnership_owner_id,
|
|
106
|
+
createEnquiry: wire.create_enquiry,
|
|
107
|
+
enquirySource: wire.enquiry_source,
|
|
108
|
+
enquiryStageId: wire.enquiry_stage_id,
|
|
109
|
+
enquiryNameTemplate: wire.enquiry_name_template,
|
|
110
|
+
enquiryOwnerId: wire.enquiry_owner_id,
|
|
111
|
+
personTags: wire.person_tags,
|
|
112
|
+
companyTags: wire.company_tags,
|
|
113
|
+
listIds: wire.list_ids,
|
|
114
|
+
attachTargets: wire.attach_targets,
|
|
60
115
|
publicKey: wire.public_key,
|
|
61
116
|
createdAt: wire.created_at,
|
|
62
117
|
updatedAt: wire.updated_at,
|
|
@@ -69,11 +124,18 @@ function fieldBody(field) {
|
|
|
69
124
|
map_to: field.mapTo,
|
|
70
125
|
options: field.options?.map((option) => definedFields({ key: option.key, value: option.value, value_type: option.valueType })),
|
|
71
126
|
placeholder: field.placeholder,
|
|
127
|
+
statement: field.statement,
|
|
128
|
+
consent_purpose_ids: field.consentPurposeIds,
|
|
129
|
+
consent_purpose_labels: field.consentPurposeLabels,
|
|
72
130
|
});
|
|
73
131
|
}
|
|
132
|
+
function attachTargetBody(target) {
|
|
133
|
+
return { target_type: target.targetType, target_id: target.targetId };
|
|
134
|
+
}
|
|
74
135
|
export function createFormBody(input) {
|
|
75
136
|
return definedFields({
|
|
76
137
|
name: input.name,
|
|
138
|
+
title: input.title,
|
|
77
139
|
description: input.description,
|
|
78
140
|
status: input.status,
|
|
79
141
|
fields: input.fields.map(fieldBody),
|
|
@@ -81,11 +143,31 @@ export function createFormBody(input) {
|
|
|
81
143
|
create_deal: input.createDeal,
|
|
82
144
|
deal_stage_id: input.dealStageId,
|
|
83
145
|
deal_name_template: input.dealNameTemplate,
|
|
146
|
+
create_opportunity: input.createOpportunity,
|
|
147
|
+
opportunity_kind: input.opportunityKind,
|
|
148
|
+
opportunity_stage_id: input.opportunityStageId,
|
|
149
|
+
opportunity_name_template: input.opportunityNameTemplate,
|
|
150
|
+
opportunity_owner_id: input.opportunityOwnerId,
|
|
151
|
+
create_partnership: input.createPartnership,
|
|
152
|
+
partnership_kind: input.partnershipKind,
|
|
153
|
+
partnership_stage_id: input.partnershipStageId,
|
|
154
|
+
partnership_name_template: input.partnershipNameTemplate,
|
|
155
|
+
partnership_owner_id: input.partnershipOwnerId,
|
|
156
|
+
create_enquiry: input.createEnquiry,
|
|
157
|
+
enquiry_source: input.enquirySource,
|
|
158
|
+
enquiry_stage_id: input.enquiryStageId,
|
|
159
|
+
enquiry_name_template: input.enquiryNameTemplate,
|
|
160
|
+
enquiry_owner_id: input.enquiryOwnerId,
|
|
161
|
+
person_tags: input.personTags,
|
|
162
|
+
company_tags: input.companyTags,
|
|
163
|
+
list_ids: input.listIds,
|
|
164
|
+
attach_targets: input.attachTargets?.map(attachTargetBody),
|
|
84
165
|
});
|
|
85
166
|
}
|
|
86
167
|
export function formBody(input) {
|
|
87
168
|
return definedFields({
|
|
88
169
|
name: input.name,
|
|
170
|
+
title: input.title,
|
|
89
171
|
description: input.description,
|
|
90
172
|
status: input.status,
|
|
91
173
|
fields: input.fields?.map(fieldBody),
|
|
@@ -93,6 +175,25 @@ export function formBody(input) {
|
|
|
93
175
|
create_deal: input.createDeal,
|
|
94
176
|
deal_stage_id: input.dealStageId,
|
|
95
177
|
deal_name_template: input.dealNameTemplate,
|
|
178
|
+
create_opportunity: input.createOpportunity,
|
|
179
|
+
opportunity_kind: input.opportunityKind,
|
|
180
|
+
opportunity_stage_id: input.opportunityStageId,
|
|
181
|
+
opportunity_name_template: input.opportunityNameTemplate,
|
|
182
|
+
opportunity_owner_id: input.opportunityOwnerId,
|
|
183
|
+
create_partnership: input.createPartnership,
|
|
184
|
+
partnership_kind: input.partnershipKind,
|
|
185
|
+
partnership_stage_id: input.partnershipStageId,
|
|
186
|
+
partnership_name_template: input.partnershipNameTemplate,
|
|
187
|
+
partnership_owner_id: input.partnershipOwnerId,
|
|
188
|
+
create_enquiry: input.createEnquiry,
|
|
189
|
+
enquiry_source: input.enquirySource,
|
|
190
|
+
enquiry_stage_id: input.enquiryStageId,
|
|
191
|
+
enquiry_name_template: input.enquiryNameTemplate,
|
|
192
|
+
enquiry_owner_id: input.enquiryOwnerId,
|
|
193
|
+
person_tags: input.personTags,
|
|
194
|
+
company_tags: input.companyTags,
|
|
195
|
+
list_ids: input.listIds,
|
|
196
|
+
attach_targets: input.attachTargets?.map(attachTargetBody),
|
|
96
197
|
});
|
|
97
198
|
}
|
|
98
199
|
//# sourceMappingURL=form.js.map
|
package/dist/form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","sourceRoot":"","sources":["../src/form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../src/form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,cAAc,GACf,MAAM,aAAa,CAAA;AAQpB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AA0HrE,MAAM,qBAAqB,GAAG,CAAC;KAC5B,MAAM,CAAC;IACN,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC;CAC5C,CAAC;KACD,SAAS,CACR,CAAC,IAAI,EAAmB,EAAE,CAAC,CAAC;IAC1B,GAAG,EAAE,IAAI,CAAC,GAAG;IACb,KAAK,EAAE,IAAI,CAAC,KAAK;IACjB,SAAS,EAAE,IAAI,CAAC,UAAU;CAC3B,CAAC,CACH,CAAA;AAEH,MAAM,eAAe,GAAG,CAAC;KACtB,MAAM,CAAC;IACN,EAAE,EAAE,QAAQ;IACZ,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,IAA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B,QAAQ,EAAE,KAAK,CAAC,OAAO;QACvB,cAAc,EAAE,KAAK,CAAC,aAAa,EAAE,GAAG,CAAC,gBAAgB,CAAC;KAC3D,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/formSubmission.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { FormActionStatus } from './values.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The record types a submission can name through its FK columns. Used by
|
|
5
|
+
* `GET /v1/form-submissions?target_type=…` so the query, the server, and the
|
|
6
|
+
* UI hook agree on the seven values.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FORM_SUBMISSION_LINK_TARGETS: readonly ['person', 'company', 'position', 'deal', 'opportunity', 'partnership', 'enquiry'];
|
|
9
|
+
export type FormSubmissionLinkTarget = (typeof FORM_SUBMISSION_LINK_TARGETS)[number];
|
|
2
10
|
/**
|
|
3
11
|
* Wire shape for `/v1/forms/:id/submissions`, and for what the public submit
|
|
4
12
|
* endpoint answers with.
|
|
@@ -7,6 +15,18 @@ import { z } from 'zod';
|
|
|
7
15
|
* no create body here (the public endpoint takes an answer map, not a
|
|
8
16
|
* submission) and no update at all.
|
|
9
17
|
*/
|
|
18
|
+
/**
|
|
19
|
+
* One post-submit action's outcome. The submission's `actionLog` carries these
|
|
20
|
+
* in the order the runner attempted them, so a reader can see what ran, what
|
|
21
|
+
* was skipped, and what rolled back.
|
|
22
|
+
*/
|
|
23
|
+
export interface FormSubmissionActionEntry {
|
|
24
|
+
/** A machine name for the action ('create_deal', 'tag_person', 'add_list'…). */
|
|
25
|
+
readonly action: string;
|
|
26
|
+
readonly status: FormActionStatus;
|
|
27
|
+
/** Human-readable message. Never a stack trace; safe for the Submissions UI. */
|
|
28
|
+
readonly detail: string;
|
|
29
|
+
}
|
|
10
30
|
export interface FormSubmission {
|
|
11
31
|
readonly id: string;
|
|
12
32
|
readonly formId: string;
|
|
@@ -22,6 +42,15 @@ export interface FormSubmission {
|
|
|
22
42
|
readonly companyId: string | null;
|
|
23
43
|
readonly positionId: string | null;
|
|
24
44
|
readonly dealId: string | null;
|
|
45
|
+
readonly opportunityId: string | null;
|
|
46
|
+
readonly partnershipId: string | null;
|
|
47
|
+
readonly enquiryId: string | null;
|
|
48
|
+
/**
|
|
49
|
+
* Per-action outcome from the post-submit runner, in the order attempted.
|
|
50
|
+
* Only actions the form was configured to run appear; a form with no
|
|
51
|
+
* post-actions has an empty log.
|
|
52
|
+
*/
|
|
53
|
+
readonly actionLog: readonly FormSubmissionActionEntry[];
|
|
25
54
|
readonly createdAt: Date;
|
|
26
55
|
}
|
|
27
56
|
export declare const formSubmissionSchema: z.ZodType<FormSubmission, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formSubmission.d.ts","sourceRoot":"","sources":["../src/formSubmission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"formSubmission.d.ts","sourceRoot":"","sources":["../src/formSubmission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAGnD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,YACvC,QAAQ,EACR,SAAS,EACT,UAAU,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,SAAS,CACD,CAAA;AAEV,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpF;;;;;;;GAOG;AAEH;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IACjC,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,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
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { FORM_ACTION_STATUSES } from './values.js';
|
|
2
3
|
import { idSchema, timestampSchema } from './wire.js';
|
|
4
|
+
/**
|
|
5
|
+
* The record types a submission can name through its FK columns. Used by
|
|
6
|
+
* `GET /v1/form-submissions?target_type=…` so the query, the server, and the
|
|
7
|
+
* UI hook agree on the seven values.
|
|
8
|
+
*/
|
|
9
|
+
export const FORM_SUBMISSION_LINK_TARGETS = [
|
|
10
|
+
'person',
|
|
11
|
+
'company',
|
|
12
|
+
'position',
|
|
13
|
+
'deal',
|
|
14
|
+
'opportunity',
|
|
15
|
+
'partnership',
|
|
16
|
+
'enquiry',
|
|
17
|
+
];
|
|
18
|
+
const actionEntrySchema = z
|
|
19
|
+
.object({
|
|
20
|
+
action: z.string(),
|
|
21
|
+
status: z.enum(FORM_ACTION_STATUSES),
|
|
22
|
+
detail: z.string(),
|
|
23
|
+
})
|
|
24
|
+
.transform((wire) => ({
|
|
25
|
+
action: wire.action,
|
|
26
|
+
status: wire.status,
|
|
27
|
+
detail: wire.detail,
|
|
28
|
+
}));
|
|
3
29
|
export const formSubmissionSchema = z
|
|
4
30
|
.object({
|
|
5
31
|
id: idSchema,
|
|
@@ -10,6 +36,10 @@ export const formSubmissionSchema = z
|
|
|
10
36
|
company_id: idSchema.nullable(),
|
|
11
37
|
position_id: idSchema.nullable(),
|
|
12
38
|
deal_id: idSchema.nullable(),
|
|
39
|
+
opportunity_id: idSchema.nullable(),
|
|
40
|
+
partnership_id: idSchema.nullable(),
|
|
41
|
+
enquiry_id: idSchema.nullable(),
|
|
42
|
+
action_log: z.array(actionEntrySchema),
|
|
13
43
|
created_at: timestampSchema,
|
|
14
44
|
})
|
|
15
45
|
.transform((wire) => ({
|
|
@@ -21,6 +51,10 @@ export const formSubmissionSchema = z
|
|
|
21
51
|
companyId: wire.company_id,
|
|
22
52
|
positionId: wire.position_id,
|
|
23
53
|
dealId: wire.deal_id,
|
|
54
|
+
opportunityId: wire.opportunity_id,
|
|
55
|
+
partnershipId: wire.partnership_id,
|
|
56
|
+
enquiryId: wire.enquiry_id,
|
|
57
|
+
actionLog: wire.action_log,
|
|
24
58
|
createdAt: wire.created_at,
|
|
25
59
|
}));
|
|
26
60
|
export const formSubmitResultSchema = z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formSubmission.js","sourceRoot":"","sources":["../src/formSubmission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"formSubmission.js","sourceRoot":"","sources":["../src/formSubmission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAErD;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,QAAQ;IACR,SAAS;IACT,UAAU;IACV,MAAM;IACN,aAAa;IACb,aAAa;IACb,SAAS;CACD,CAAA;AAqDV,MAAM,iBAAiB,GAAG,CAAC;KACxB,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC;KACD,SAAS,CACR,CAAC,IAAI,EAA6B,EAAE,CAAC,CAAC;IACpC,MAAM,EAAE,IAAI,CAAC,MAAM;IACnB,MAAM,EAAE,IAAI,CAAC,MAAM;IACnB,MAAM,EAAE,IAAI,CAAC,MAAM;CACpB,CAAC,CACH,CAAA;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAuC,CAAC;KAC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EAAE,QAAQ;IACZ,OAAO,EAAE,QAAQ;IACjB,YAAY,EAAE,eAAe;IAC7B,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;CAC9B,CAAC;KACD,SAAS,CACR,CAAC,IAAI,EAAoB,EAAE,CAAC,CAAC;IAC3B,EAAE,EAAE,IAAI,CAAC,EAAE;IACX,MAAM,EAAE,IAAI,CAAC,OAAO;IACpB,WAAW,EAAE,IAAI,CAAC,YAAY;IAC9B,eAAe,EAAE,IAAI,CAAC,iBAAiB;CACxC,CAAC,CACH,CAAA"}
|
package/dist/importExport.d.ts
CHANGED
|
@@ -74,12 +74,22 @@ export interface CsvColumn {
|
|
|
74
74
|
/**
|
|
75
75
|
* A column an import may map but an export never writes.
|
|
76
76
|
*
|
|
77
|
-
* The People affiliation columns are the
|
|
78
|
-
* positions, so a single company and title on the person row would be
|
|
79
|
-
* the way out. They map on the way in to drive a Position, and the
|
|
80
|
-
* template leave them out.
|
|
77
|
+
* The People affiliation columns are the original example: a person can hold
|
|
78
|
+
* many positions, so a single company and title on the person row would be
|
|
79
|
+
* lossy on the way out. They map on the way in to drive a Position, and the
|
|
80
|
+
* export and template leave them out. The consent grant columns follow the
|
|
81
|
+
* same rule — a person's consent state is exported serialised in `consents`,
|
|
82
|
+
* not row-by-row per purpose. See `headersFor`.
|
|
81
83
|
*/
|
|
82
84
|
readonly importOnly?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* A column an export writes but an import never maps. `do_not_contact` and
|
|
87
|
+
* the serialised `consents` list are exported for readability; consent
|
|
88
|
+
* round-trips through `consent_status` / `consent_at` plus the job's
|
|
89
|
+
* `consent_purpose_id`, and `do_not_contact` is a Person patch, not part of
|
|
90
|
+
* an import job.
|
|
91
|
+
*/
|
|
92
|
+
readonly exportOnly?: boolean;
|
|
83
93
|
}
|
|
84
94
|
/**
|
|
85
95
|
* The canonical Kelpie CSV columns per object (`import-export.md`).
|
|
@@ -91,6 +101,14 @@ export interface CsvColumn {
|
|
|
91
101
|
* still carry `company_domain`, `company_name` and `title`, which drive a
|
|
92
102
|
* Position for the person rather than a field on them. Those three are
|
|
93
103
|
* `importOnly`, so an export and a template leave them out.
|
|
104
|
+
*
|
|
105
|
+
* A People row still has to name its person, but `name` is not marked `required`
|
|
106
|
+
* here: the row satisfies it with `name`, or with `first_name` / `last_name` for
|
|
107
|
+
* the name to be composed from. `required` is a per-column flag and that is a
|
|
108
|
+
* statement about a pair of them, so the rule lives in the People row check
|
|
109
|
+
* instead. Every CRM worth migrating from exports first and last name in their
|
|
110
|
+
* own columns and most export no full name at all, which is the case this
|
|
111
|
+
* exists for.
|
|
94
112
|
*/
|
|
95
113
|
export declare const OBJECT_COLUMNS: Readonly<Record<ImportObject, readonly CsvColumn[]>>;
|
|
96
114
|
/** Columns whose value is a pipe-separated list (`a|b|c`), per `import-export.md`. */
|
|
@@ -149,6 +167,12 @@ export interface ImportJob extends RecordTimestamps {
|
|
|
149
167
|
readonly onMissingCompany: OnMissingCompany;
|
|
150
168
|
readonly matchKey: string;
|
|
151
169
|
readonly columnMap: ImportColumnMap;
|
|
170
|
+
/**
|
|
171
|
+
* The consent purpose a People import grants (or withdraws) for each row
|
|
172
|
+
* that carries a `consent_status`. Required whenever the map names
|
|
173
|
+
* `consent_status` or `consent_at`. Null for every other object.
|
|
174
|
+
*/
|
|
175
|
+
readonly consentPurposeId: string | null;
|
|
152
176
|
/** The headers as they appeared in the uploaded file, in file order. */
|
|
153
177
|
readonly sourceHeaders: readonly string[];
|
|
154
178
|
readonly fileName: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importExport.d.ts","sourceRoot":"","sources":["../src/importExport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD;;;;;;;;GAQG;AAEH,eAAO,MAAM,cAAc,YAAI,QAAQ,EAAE,SAAS,EAAE,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AAQ,CAAC,SAAS,EAAE,eAAe,CAAA;IACnC;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC,wEAAwE;IACxE,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAA;IACzC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAA;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAA;IAC5C,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAA;CAC9C;AAsBD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAuCvD,CAAA;AAEH,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAEnE"}
|
package/dist/importExport.js
CHANGED
|
@@ -91,6 +91,14 @@ export const ON_MISSING_COMPANY_LABELS = {
|
|
|
91
91
|
* still carry `company_domain`, `company_name` and `title`, which drive a
|
|
92
92
|
* Position for the person rather than a field on them. Those three are
|
|
93
93
|
* `importOnly`, so an export and a template leave them out.
|
|
94
|
+
*
|
|
95
|
+
* A People row still has to name its person, but `name` is not marked `required`
|
|
96
|
+
* here: the row satisfies it with `name`, or with `first_name` / `last_name` for
|
|
97
|
+
* the name to be composed from. `required` is a per-column flag and that is a
|
|
98
|
+
* statement about a pair of them, so the rule lives in the People row check
|
|
99
|
+
* instead. Every CRM worth migrating from exports first and last name in their
|
|
100
|
+
* own columns and most export no full name at all, which is the case this
|
|
101
|
+
* exists for.
|
|
94
102
|
*/
|
|
95
103
|
export const OBJECT_COLUMNS = {
|
|
96
104
|
companies: [
|
|
@@ -108,7 +116,11 @@ export const OBJECT_COLUMNS = {
|
|
|
108
116
|
{ key: 'hq', label: 'HQ', required: false },
|
|
109
117
|
],
|
|
110
118
|
people: [
|
|
111
|
-
{ key: 'name', label: 'Name', required:
|
|
119
|
+
{ key: 'name', label: 'Name', required: false },
|
|
120
|
+
{ key: 'salutation', label: 'Salutation', required: false },
|
|
121
|
+
{ key: 'first_name', label: 'First name', required: false },
|
|
122
|
+
{ key: 'last_name', label: 'Last name', required: false },
|
|
123
|
+
{ key: 'suffix', label: 'Suffix', required: false },
|
|
112
124
|
{ key: 'email', label: 'Email', required: true },
|
|
113
125
|
{ key: 'timezone', label: 'Timezone', required: false },
|
|
114
126
|
{ key: 'location', label: 'Location', required: false },
|
|
@@ -118,9 +130,18 @@ export const OBJECT_COLUMNS = {
|
|
|
118
130
|
{ key: 'summary', label: 'Summary', required: false },
|
|
119
131
|
{ key: 'tags', label: 'Tags', required: false },
|
|
120
132
|
{ key: 'phones', label: 'Phones', required: false },
|
|
133
|
+
{ key: 'do_not_contact', label: 'Do not contact', required: false, exportOnly: true },
|
|
134
|
+
{ key: 'consents', label: 'Consents', required: false, exportOnly: true },
|
|
121
135
|
{ key: 'company_domain', label: 'Company domain', required: false, importOnly: true },
|
|
122
136
|
{ key: 'company_name', label: 'Company name', required: false, importOnly: true },
|
|
123
137
|
{ key: 'title', label: 'Title', required: false, importOnly: true },
|
|
138
|
+
/**
|
|
139
|
+
* Consent grant to write for the job's purpose. `granted` or `withdrawn`.
|
|
140
|
+
* Mapping either column with no `consent_purpose_id` set on the job is a
|
|
141
|
+
* `422` — the writer would not know which purpose the row is for.
|
|
142
|
+
*/
|
|
143
|
+
{ key: 'consent_status', label: 'Consent status', required: false, importOnly: true },
|
|
144
|
+
{ key: 'consent_at', label: 'Consent at', required: false, importOnly: true },
|
|
124
145
|
],
|
|
125
146
|
positions: [
|
|
126
147
|
{ key: 'person_email', label: 'Person email', required: true },
|
|
@@ -230,6 +251,7 @@ export const importJobSchema = z
|
|
|
230
251
|
on_missing_company: z.enum(ON_MISSING_COMPANY),
|
|
231
252
|
match_key: z.string(),
|
|
232
253
|
column_map: z.record(z.string(), z.string().nullable()),
|
|
254
|
+
consent_purpose_id: idSchema.nullable(),
|
|
233
255
|
source_headers: z.array(z.string()),
|
|
234
256
|
file_name: z.string().nullable(),
|
|
235
257
|
counts: countsSchema,
|
|
@@ -247,6 +269,7 @@ export const importJobSchema = z
|
|
|
247
269
|
onMissingCompany: wire.on_missing_company,
|
|
248
270
|
matchKey: wire.match_key,
|
|
249
271
|
columnMap: wire.column_map,
|
|
272
|
+
consentPurposeId: wire.consent_purpose_id,
|
|
250
273
|
sourceHeaders: wire.source_headers,
|
|
251
274
|
fileName: wire.file_name,
|
|
252
275
|
counts: wire.counts,
|