@23blocks/block-forms 4.0.0 → 5.0.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/CHANGELOG.md +352 -0
- package/README.md +107 -138
- package/dist/index.esm.js +494 -165
- package/dist/src/lib/mappers/appointment.mapper.d.ts.map +1 -1
- package/dist/src/lib/mappers/form-instance.mapper.d.ts.map +1 -1
- package/dist/src/lib/mappers/form-schema.mapper.d.ts.map +1 -1
- package/dist/src/lib/mappers/form-set.mapper.d.ts.map +1 -1
- package/dist/src/lib/mappers/form.mapper.d.ts.map +1 -1
- package/dist/src/lib/mappers/landing.mapper.d.ts.map +1 -1
- package/dist/src/lib/mappers/mail-template.mapper.d.ts.map +1 -1
- package/dist/src/lib/mappers/referral.mapper.d.ts.map +1 -1
- package/dist/src/lib/mappers/subscription.mapper.d.ts.map +1 -1
- package/dist/src/lib/mappers/survey.mapper.d.ts.map +1 -1
- package/dist/src/lib/services/application-forms.service.d.ts +0 -39
- package/dist/src/lib/services/application-forms.service.d.ts.map +1 -1
- package/dist/src/lib/services/appointments.service.d.ts +0 -53
- package/dist/src/lib/services/appointments.service.d.ts.map +1 -1
- package/dist/src/lib/services/crm-sync.service.d.ts +2 -34
- package/dist/src/lib/services/crm-sync.service.d.ts.map +1 -1
- package/dist/src/lib/services/form-instances.service.d.ts +0 -55
- package/dist/src/lib/services/form-instances.service.d.ts.map +1 -1
- package/dist/src/lib/services/form-schema-versions.service.d.ts +0 -44
- package/dist/src/lib/services/form-schema-versions.service.d.ts.map +1 -1
- package/dist/src/lib/services/form-schemas.service.d.ts +0 -31
- package/dist/src/lib/services/form-schemas.service.d.ts.map +1 -1
- package/dist/src/lib/services/form-sets.service.d.ts +0 -36
- package/dist/src/lib/services/form-sets.service.d.ts.map +1 -1
- package/dist/src/lib/services/forms.service.d.ts +0 -26
- package/dist/src/lib/services/forms.service.d.ts.map +1 -1
- package/dist/src/lib/services/landings.service.d.ts +0 -31
- package/dist/src/lib/services/landings.service.d.ts.map +1 -1
- package/dist/src/lib/services/mail-templates.service.d.ts +0 -31
- package/dist/src/lib/services/mail-templates.service.d.ts.map +1 -1
- package/dist/src/lib/services/referrals.service.d.ts +0 -31
- package/dist/src/lib/services/referrals.service.d.ts.map +1 -1
- package/dist/src/lib/services/subscriptions.service.d.ts +0 -31
- package/dist/src/lib/services/subscriptions.service.d.ts.map +1 -1
- package/dist/src/lib/services/surveys.service.d.ts +0 -58
- package/dist/src/lib/services/surveys.service.d.ts.map +1 -1
- package/dist/src/lib/types/application-form.d.ts +0 -21
- package/dist/src/lib/types/application-form.d.ts.map +1 -1
- package/dist/src/lib/types/appointment.d.ts +68 -18
- package/dist/src/lib/types/appointment.d.ts.map +1 -1
- package/dist/src/lib/types/crm-sync.d.ts +5 -4
- package/dist/src/lib/types/crm-sync.d.ts.map +1 -1
- package/dist/src/lib/types/form-instance.d.ts +22 -20
- package/dist/src/lib/types/form-instance.d.ts.map +1 -1
- package/dist/src/lib/types/form-schema-version.d.ts +6 -6
- package/dist/src/lib/types/form-schema-version.d.ts.map +1 -1
- package/dist/src/lib/types/form-schema.d.ts +6 -11
- package/dist/src/lib/types/form-schema.d.ts.map +1 -1
- package/dist/src/lib/types/form-set.d.ts +45 -19
- package/dist/src/lib/types/form-set.d.ts.map +1 -1
- package/dist/src/lib/types/form.d.ts +60 -2
- package/dist/src/lib/types/form.d.ts.map +1 -1
- package/dist/src/lib/types/landing.d.ts +45 -11
- package/dist/src/lib/types/landing.d.ts.map +1 -1
- package/dist/src/lib/types/mail-template.d.ts +45 -21
- package/dist/src/lib/types/mail-template.d.ts.map +1 -1
- package/dist/src/lib/types/referral.d.ts +61 -21
- package/dist/src/lib/types/referral.d.ts.map +1 -1
- package/dist/src/lib/types/subscription.d.ts +39 -8
- package/dist/src/lib/types/subscription.d.ts.map +1 -1
- package/dist/src/lib/types/survey.d.ts +42 -6
- package/dist/src/lib/types/survey.d.ts.map +1 -1
- package/package.json +3 -1
package/dist/index.esm.js
CHANGED
|
@@ -76,7 +76,26 @@ const formMapper = {
|
|
|
76
76
|
description: parseString(resource.attributes['description']),
|
|
77
77
|
formType: parseString(resource.attributes['form_type']),
|
|
78
78
|
status: parseStatus(resource.attributes['status']),
|
|
79
|
-
|
|
79
|
+
formUrl: parseString(resource.attributes['form_url']),
|
|
80
|
+
formDomain: parseString(resource.attributes['form_domain']),
|
|
81
|
+
formFields: resource.attributes['form_fields'],
|
|
82
|
+
onlyOnce: resource.attributes['only_once'] !== undefined ? parseBoolean(resource.attributes['only_once']) : undefined,
|
|
83
|
+
backgroundUrl: parseString(resource.attributes['background_url']),
|
|
84
|
+
contentUrl: parseString(resource.attributes['content_url']),
|
|
85
|
+
successUrl: parseString(resource.attributes['success_url']),
|
|
86
|
+
errorUrl: parseString(resource.attributes['error_url']),
|
|
87
|
+
notifySlack: resource.attributes['notify_slack'] !== undefined ? parseBoolean(resource.attributes['notify_slack']) : undefined,
|
|
88
|
+
successNotificationMessage: parseString(resource.attributes['success_notification_message']),
|
|
89
|
+
errorNotificationMessage: parseString(resource.attributes['error_notification_message']),
|
|
90
|
+
sendConfirmationMail: resource.attributes['send_confirmation_mail'] !== undefined ? parseBoolean(resource.attributes['send_confirmation_mail']) : undefined,
|
|
91
|
+
mailTemplate: parseString(resource.attributes['mail_template']),
|
|
92
|
+
sendConfirmationSms: resource.attributes['send_confirmation_sms'] !== undefined ? parseBoolean(resource.attributes['send_confirmation_sms']) : undefined,
|
|
93
|
+
smsTemplate: parseString(resource.attributes['sms_template']),
|
|
94
|
+
sendAdminNotification: resource.attributes['send_admin_notification'] !== undefined ? parseBoolean(resource.attributes['send_admin_notification']) : undefined,
|
|
95
|
+
adminNotificationEmail: parseString(resource.attributes['admin_notification_email']),
|
|
96
|
+
adminNotificationTemplate: parseString(resource.attributes['admin_notification_template']),
|
|
97
|
+
formSchemaUniqueId: parseString(resource.attributes['form_schema_unique_id']),
|
|
98
|
+
requireOtpVerification: resource.attributes['require_otp_verification'] !== undefined ? parseBoolean(resource.attributes['require_otp_verification']) : undefined,
|
|
80
99
|
payload: resource.attributes['payload']
|
|
81
100
|
})
|
|
82
101
|
};
|
|
@@ -107,6 +126,26 @@ function createFormsService(transport, _config) {
|
|
|
107
126
|
name: data.name,
|
|
108
127
|
description: data.description,
|
|
109
128
|
form_type: data.formType,
|
|
129
|
+
form_url: data.formUrl,
|
|
130
|
+
form_domain: data.formDomain,
|
|
131
|
+
form_fields: data.formFields,
|
|
132
|
+
only_once: data.onlyOnce,
|
|
133
|
+
background_url: data.backgroundUrl,
|
|
134
|
+
content_url: data.contentUrl,
|
|
135
|
+
success_url: data.successUrl,
|
|
136
|
+
error_url: data.errorUrl,
|
|
137
|
+
notify_slack: data.notifySlack,
|
|
138
|
+
success_notification_message: data.successNotificationMessage,
|
|
139
|
+
error_notification_message: data.errorNotificationMessage,
|
|
140
|
+
send_confirmation_mail: data.sendConfirmationMail,
|
|
141
|
+
mail_template: data.mailTemplate,
|
|
142
|
+
send_confirmation_sms: data.sendConfirmationSms,
|
|
143
|
+
sms_template: data.smsTemplate,
|
|
144
|
+
send_admin_notification: data.sendAdminNotification,
|
|
145
|
+
admin_notification_email: data.adminNotificationEmail,
|
|
146
|
+
admin_notification_template: data.adminNotificationTemplate,
|
|
147
|
+
form_schema_unique_id: data.formSchemaUniqueId,
|
|
148
|
+
require_otp_verification: data.requireOtpVerification,
|
|
110
149
|
payload: data.payload
|
|
111
150
|
}
|
|
112
151
|
});
|
|
@@ -118,8 +157,27 @@ function createFormsService(transport, _config) {
|
|
|
118
157
|
name: data.name,
|
|
119
158
|
description: data.description,
|
|
120
159
|
form_type: data.formType,
|
|
121
|
-
enabled: data.enabled,
|
|
122
160
|
status: data.status,
|
|
161
|
+
form_url: data.formUrl,
|
|
162
|
+
form_domain: data.formDomain,
|
|
163
|
+
form_fields: data.formFields,
|
|
164
|
+
only_once: data.onlyOnce,
|
|
165
|
+
background_url: data.backgroundUrl,
|
|
166
|
+
content_url: data.contentUrl,
|
|
167
|
+
success_url: data.successUrl,
|
|
168
|
+
error_url: data.errorUrl,
|
|
169
|
+
notify_slack: data.notifySlack,
|
|
170
|
+
success_notification_message: data.successNotificationMessage,
|
|
171
|
+
error_notification_message: data.errorNotificationMessage,
|
|
172
|
+
send_confirmation_mail: data.sendConfirmationMail,
|
|
173
|
+
mail_template: data.mailTemplate,
|
|
174
|
+
send_confirmation_sms: data.sendConfirmationSms,
|
|
175
|
+
sms_template: data.smsTemplate,
|
|
176
|
+
send_admin_notification: data.sendAdminNotification,
|
|
177
|
+
admin_notification_email: data.adminNotificationEmail,
|
|
178
|
+
admin_notification_template: data.adminNotificationTemplate,
|
|
179
|
+
form_schema_unique_id: data.formSchemaUniqueId,
|
|
180
|
+
require_otp_verification: data.requireOtpVerification,
|
|
123
181
|
payload: data.payload
|
|
124
182
|
}
|
|
125
183
|
});
|
|
@@ -139,12 +197,10 @@ const formSchemaMapper = {
|
|
|
139
197
|
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
140
198
|
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
141
199
|
formUniqueId: parseString(resource.attributes['form_unique_id']) || '',
|
|
142
|
-
code: parseString(resource.attributes['code']) || '',
|
|
143
200
|
name: parseString(resource.attributes['name']) || '',
|
|
144
201
|
description: parseString(resource.attributes['description']),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
uiSchema: resource.attributes['ui_schema'],
|
|
202
|
+
formFields: resource.attributes['form_fields'],
|
|
203
|
+
datasource: resource.attributes['datasource'],
|
|
148
204
|
status: parseStatus(resource.attributes['status']),
|
|
149
205
|
enabled: parseBoolean(resource.attributes['enabled']),
|
|
150
206
|
payload: resource.attributes['payload']
|
|
@@ -159,7 +215,6 @@ function createFormSchemasService(transport, _config) {
|
|
|
159
215
|
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
160
216
|
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
161
217
|
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
162
|
-
if (params == null ? void 0 : params.version) queryParams['version'] = String(params.version);
|
|
163
218
|
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
164
219
|
const response = await transport.get(`${basePath(formUniqueId)}/`, {
|
|
165
220
|
params: queryParams
|
|
@@ -173,12 +228,10 @@ function createFormSchemasService(transport, _config) {
|
|
|
173
228
|
async create (formUniqueId, data) {
|
|
174
229
|
const response = await transport.post(`${basePath(formUniqueId)}/`, {
|
|
175
230
|
form_schema: {
|
|
176
|
-
code: data.code,
|
|
177
231
|
name: data.name,
|
|
178
232
|
description: data.description,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
ui_schema: data.uiSchema,
|
|
233
|
+
form_fields: data.formFields,
|
|
234
|
+
datasource: data.datasource,
|
|
182
235
|
payload: data.payload
|
|
183
236
|
}
|
|
184
237
|
});
|
|
@@ -189,8 +242,8 @@ function createFormSchemasService(transport, _config) {
|
|
|
189
242
|
form_schema: {
|
|
190
243
|
name: data.name,
|
|
191
244
|
description: data.description,
|
|
192
|
-
|
|
193
|
-
|
|
245
|
+
form_fields: data.formFields,
|
|
246
|
+
datasource: data.datasource,
|
|
194
247
|
enabled: data.enabled,
|
|
195
248
|
status: data.status,
|
|
196
249
|
payload: data.payload
|
|
@@ -214,8 +267,8 @@ const formSchemaVersionMapper = {
|
|
|
214
267
|
formUniqueId: parseString(resource.attributes['form_unique_id']) || '',
|
|
215
268
|
schemaUniqueId: parseString(resource.attributes['schema_unique_id']) || '',
|
|
216
269
|
version: parseNumber(resource.attributes['version']),
|
|
217
|
-
|
|
218
|
-
|
|
270
|
+
formFields: resource.attributes['form_fields'],
|
|
271
|
+
datasource: resource.attributes['datasource'],
|
|
219
272
|
status: parseStatus(resource.attributes['status']),
|
|
220
273
|
isPublished: parseBoolean(resource.attributes['is_published']),
|
|
221
274
|
publishedAt: parseString(resource.attributes['published_at']),
|
|
@@ -244,8 +297,8 @@ function createFormSchemaVersionsService(transport, _config) {
|
|
|
244
297
|
async create (formUniqueId, schemaUniqueId, data) {
|
|
245
298
|
const response = await transport.post(`${basePath(formUniqueId, schemaUniqueId)}/`, {
|
|
246
299
|
form_schema_version: {
|
|
247
|
-
|
|
248
|
-
|
|
300
|
+
form_fields: data.formFields,
|
|
301
|
+
datasource: data.datasource,
|
|
249
302
|
payload: data.payload
|
|
250
303
|
}
|
|
251
304
|
});
|
|
@@ -254,8 +307,8 @@ function createFormSchemaVersionsService(transport, _config) {
|
|
|
254
307
|
async update (formUniqueId, schemaUniqueId, versionUniqueId, data) {
|
|
255
308
|
const response = await transport.put(`${basePath(formUniqueId, schemaUniqueId)}/${versionUniqueId}`, {
|
|
256
309
|
form_schema_version: {
|
|
257
|
-
|
|
258
|
-
|
|
310
|
+
form_fields: data.formFields,
|
|
311
|
+
datasource: data.datasource,
|
|
259
312
|
status: data.status,
|
|
260
313
|
payload: data.payload
|
|
261
314
|
}
|
|
@@ -279,13 +332,16 @@ const formInstanceMapper = {
|
|
|
279
332
|
uniqueId: parseString(resource.attributes['unique_id']),
|
|
280
333
|
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
281
334
|
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
282
|
-
|
|
283
|
-
formSchemaVersion: parseNumber(resource.attributes['form_schema_version']),
|
|
335
|
+
formUniqueId: parseString(resource.attributes['form_unique_id']),
|
|
284
336
|
userUniqueId: parseString(resource.attributes['user_unique_id']),
|
|
285
|
-
|
|
337
|
+
assignedToUniqueId: parseString(resource.attributes['assigned_to_unique_id']),
|
|
338
|
+
assignedToEmail: parseString(resource.attributes['assigned_to_email']),
|
|
339
|
+
assignedToName: parseString(resource.attributes['assigned_to_name']),
|
|
340
|
+
assignedByName: parseString(resource.attributes['assigned_by_name']),
|
|
341
|
+
expiresAt: parseDate(resource.attributes['expires_at']),
|
|
342
|
+
responses: resource.attributes['responses'],
|
|
343
|
+
metadata: resource.attributes['metadata'],
|
|
286
344
|
status: parseStatus(resource.attributes['status']),
|
|
287
|
-
enabled: parseBoolean(resource.attributes['enabled']),
|
|
288
|
-
submittedAt: parseDate(resource.attributes['submitted_at']),
|
|
289
345
|
payload: resource.attributes['payload']
|
|
290
346
|
})
|
|
291
347
|
};
|
|
@@ -297,7 +353,6 @@ function createFormInstancesService(transport, _config) {
|
|
|
297
353
|
const queryParams = {};
|
|
298
354
|
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
299
355
|
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
300
|
-
if (params == null ? void 0 : params.formSchemaUniqueId) queryParams['form_schema_unique_id'] = params.formSchemaUniqueId;
|
|
301
356
|
if (params == null ? void 0 : params.userUniqueId) queryParams['user_unique_id'] = params.userUniqueId;
|
|
302
357
|
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
303
358
|
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
@@ -313,11 +368,13 @@ function createFormInstancesService(transport, _config) {
|
|
|
313
368
|
async create (formUniqueId, data) {
|
|
314
369
|
const response = await transport.post(`${basePath(formUniqueId)}/`, {
|
|
315
370
|
app_form_instance: {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
371
|
+
assigned_to_unique_id: data.assignedToUniqueId,
|
|
372
|
+
assigned_to_email: data.assignedToEmail,
|
|
373
|
+
assigned_to_name: data.assignedToName,
|
|
374
|
+
assigned_by_name: data.assignedByName,
|
|
375
|
+
expires_at: data.expiresAt instanceof Date ? data.expiresAt.toISOString() : data.expiresAt,
|
|
376
|
+
responses: data.responses,
|
|
377
|
+
metadata: data.metadata
|
|
321
378
|
}
|
|
322
379
|
});
|
|
323
380
|
return decodeOne(response, formInstanceMapper);
|
|
@@ -325,10 +382,14 @@ function createFormInstancesService(transport, _config) {
|
|
|
325
382
|
async update (formUniqueId, uniqueId, data) {
|
|
326
383
|
const response = await transport.put(`${basePath(formUniqueId)}/${uniqueId}`, {
|
|
327
384
|
app_form_instance: {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
385
|
+
assigned_to_unique_id: data.assignedToUniqueId,
|
|
386
|
+
assigned_to_email: data.assignedToEmail,
|
|
387
|
+
assigned_to_name: data.assignedToName,
|
|
388
|
+
assigned_by_name: data.assignedByName,
|
|
389
|
+
expires_at: data.expiresAt instanceof Date ? data.expiresAt.toISOString() : data.expiresAt,
|
|
390
|
+
responses: data.responses,
|
|
391
|
+
metadata: data.metadata,
|
|
392
|
+
status: data.status
|
|
332
393
|
}
|
|
333
394
|
});
|
|
334
395
|
return decodeOne(response, formInstanceMapper);
|
|
@@ -364,9 +425,18 @@ const formSetMapper = {
|
|
|
364
425
|
code: parseString(resource.attributes['code']) || '',
|
|
365
426
|
name: parseString(resource.attributes['name']) || '',
|
|
366
427
|
description: parseString(resource.attributes['description']),
|
|
367
|
-
|
|
428
|
+
category: parseString(resource.attributes['category']),
|
|
429
|
+
appliesTo: parseString(resource.attributes['applies_to']),
|
|
430
|
+
isActive: resource.attributes['is_active'] !== undefined ? parseBoolean(resource.attributes['is_active']) : undefined,
|
|
431
|
+
isDefault: resource.attributes['is_default'] !== undefined ? parseBoolean(resource.attributes['is_default']) : undefined,
|
|
432
|
+
sendAllAtOnce: resource.attributes['send_all_at_once'] !== undefined ? parseBoolean(resource.attributes['send_all_at_once']) : undefined,
|
|
433
|
+
allowPartialCompletion: resource.attributes['allow_partial_completion'] !== undefined ? parseBoolean(resource.attributes['allow_partial_completion']) : undefined,
|
|
434
|
+
enforceSequential: resource.attributes['enforce_sequential'] !== undefined ? parseBoolean(resource.attributes['enforce_sequential']) : undefined,
|
|
435
|
+
expirationDays: parseOptionalNumber(resource.attributes['expiration_days']),
|
|
436
|
+
autoAssignRules: resource.attributes['auto_assign_rules'],
|
|
437
|
+
metadata: resource.attributes['metadata'],
|
|
438
|
+
formSetItemsAttributes: resource.attributes['form_set_items_attributes'] || undefined,
|
|
368
439
|
status: parseStatus(resource.attributes['status']),
|
|
369
|
-
enabled: parseBoolean(resource.attributes['enabled']),
|
|
370
440
|
payload: resource.attributes['payload']
|
|
371
441
|
})
|
|
372
442
|
};
|
|
@@ -390,24 +460,53 @@ function createFormSetsService(transport, _config) {
|
|
|
390
460
|
return decodeOne(response, formSetMapper);
|
|
391
461
|
},
|
|
392
462
|
async create (data) {
|
|
463
|
+
var _data_formSetItemsAttributes;
|
|
393
464
|
const response = await transport.post('/form_sets', {
|
|
394
465
|
form_set: {
|
|
395
466
|
code: data.code,
|
|
396
467
|
name: data.name,
|
|
397
468
|
description: data.description,
|
|
398
|
-
|
|
469
|
+
category: data.category,
|
|
470
|
+
applies_to: data.appliesTo,
|
|
471
|
+
is_active: data.isActive,
|
|
472
|
+
is_default: data.isDefault,
|
|
473
|
+
send_all_at_once: data.sendAllAtOnce,
|
|
474
|
+
allow_partial_completion: data.allowPartialCompletion,
|
|
475
|
+
enforce_sequential: data.enforceSequential,
|
|
476
|
+
expiration_days: data.expirationDays,
|
|
477
|
+
auto_assign_rules: data.autoAssignRules,
|
|
478
|
+
metadata: data.metadata,
|
|
479
|
+
form_set_items_attributes: (_data_formSetItemsAttributes = data.formSetItemsAttributes) == null ? void 0 : _data_formSetItemsAttributes.map((item)=>({
|
|
480
|
+
form_schema_unique_id: item.formSchemaUniqueId,
|
|
481
|
+
display_order: item.displayOrder,
|
|
482
|
+
required: item.required
|
|
483
|
+
})),
|
|
399
484
|
payload: data.payload
|
|
400
485
|
}
|
|
401
486
|
});
|
|
402
487
|
return decodeOne(response, formSetMapper);
|
|
403
488
|
},
|
|
404
489
|
async update (uniqueId, data) {
|
|
490
|
+
var _data_formSetItemsAttributes;
|
|
405
491
|
const response = await transport.put(`/form_sets/${uniqueId}`, {
|
|
406
492
|
form_set: {
|
|
407
493
|
name: data.name,
|
|
408
494
|
description: data.description,
|
|
409
|
-
|
|
410
|
-
|
|
495
|
+
category: data.category,
|
|
496
|
+
applies_to: data.appliesTo,
|
|
497
|
+
is_active: data.isActive,
|
|
498
|
+
is_default: data.isDefault,
|
|
499
|
+
send_all_at_once: data.sendAllAtOnce,
|
|
500
|
+
allow_partial_completion: data.allowPartialCompletion,
|
|
501
|
+
enforce_sequential: data.enforceSequential,
|
|
502
|
+
expiration_days: data.expirationDays,
|
|
503
|
+
auto_assign_rules: data.autoAssignRules,
|
|
504
|
+
metadata: data.metadata,
|
|
505
|
+
form_set_items_attributes: (_data_formSetItemsAttributes = data.formSetItemsAttributes) == null ? void 0 : _data_formSetItemsAttributes.map((item)=>({
|
|
506
|
+
form_schema_unique_id: item.formSchemaUniqueId,
|
|
507
|
+
display_order: item.displayOrder,
|
|
508
|
+
required: item.required
|
|
509
|
+
})),
|
|
411
510
|
status: data.status,
|
|
412
511
|
payload: data.payload
|
|
413
512
|
}
|
|
@@ -419,10 +518,14 @@ function createFormSetsService(transport, _config) {
|
|
|
419
518
|
},
|
|
420
519
|
async match (data) {
|
|
421
520
|
const response = await transport.post('/form_sets/match', {
|
|
422
|
-
|
|
423
|
-
|
|
521
|
+
context: {
|
|
522
|
+
user_unique_id: data.userUniqueId,
|
|
523
|
+
form_set_unique_id: data.formSetUniqueId,
|
|
524
|
+
category: data.category,
|
|
525
|
+
applies_to: data.appliesTo,
|
|
526
|
+
metadata: data.metadata
|
|
527
|
+
}
|
|
424
528
|
});
|
|
425
|
-
// Response is an array of match results
|
|
426
529
|
const results = response;
|
|
427
530
|
return (results.data || []).map((item)=>({
|
|
428
531
|
formSet: formSetMapper.map(item.form_set, new Map()),
|
|
@@ -432,9 +535,13 @@ function createFormSetsService(transport, _config) {
|
|
|
432
535
|
},
|
|
433
536
|
async autoAssign (data) {
|
|
434
537
|
const response = await transport.post('/form_sets/auto_assign', {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
538
|
+
assignment: {
|
|
539
|
+
user_unique_id: data.userUniqueId,
|
|
540
|
+
form_set_unique_id: data.formSetUniqueId,
|
|
541
|
+
assigned_by_name: data.assignedByName,
|
|
542
|
+
expires_at: data.expiresAt instanceof Date ? data.expiresAt.toISOString() : data.expiresAt,
|
|
543
|
+
metadata: data.metadata
|
|
544
|
+
}
|
|
438
545
|
});
|
|
439
546
|
const result = decodePageResult(response, formInstanceMapper);
|
|
440
547
|
return result.data;
|
|
@@ -445,7 +552,7 @@ function createFormSetsService(transport, _config) {
|
|
|
445
552
|
const landingMapper = {
|
|
446
553
|
type: 'landing_instance',
|
|
447
554
|
map: (resource)=>{
|
|
448
|
-
var _parseString
|
|
555
|
+
var _parseString;
|
|
449
556
|
return {
|
|
450
557
|
id: resource.id,
|
|
451
558
|
uniqueId: resource.id,
|
|
@@ -453,10 +560,22 @@ const landingMapper = {
|
|
|
453
560
|
userUniqueId: parseString(resource.attributes['user_unique_id']),
|
|
454
561
|
email: parseString(resource.attributes['email']),
|
|
455
562
|
firstName: parseString(resource.attributes['first_name']),
|
|
563
|
+
middleName: parseString(resource.attributes['middle_name']),
|
|
456
564
|
lastName: parseString(resource.attributes['last_name']),
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
565
|
+
phoneNumber: parseString(resource.attributes['phone_number']),
|
|
566
|
+
message: parseString(resource.attributes['message']),
|
|
567
|
+
notes: parseString(resource.attributes['notes']),
|
|
568
|
+
selectedOption: parseString(resource.attributes['selected_option']),
|
|
569
|
+
formFields: resource.attributes['form_fields'],
|
|
570
|
+
source: parseString(resource.attributes['source']),
|
|
571
|
+
sourceAlias: parseString(resource.attributes['source_alias']),
|
|
572
|
+
sourceId: parseString(resource.attributes['source_id']),
|
|
573
|
+
sourceType: parseString(resource.attributes['source_type']),
|
|
574
|
+
visitorUniqueId: parseString(resource.attributes['visitor_unique_id']),
|
|
575
|
+
visitorType: parseString(resource.attributes['visitor_type']),
|
|
576
|
+
touchId: parseString(resource.attributes['touch_id']),
|
|
577
|
+
touchReferenceId: parseString(resource.attributes['touch_reference_id']),
|
|
578
|
+
preferredLanguage: parseString(resource.attributes['preferred_language']),
|
|
460
579
|
status: parseStatus(resource.attributes['status']),
|
|
461
580
|
token: parseString(resource.attributes['token']),
|
|
462
581
|
submittedAt: parseDate(resource.attributes['submitted_at']),
|
|
@@ -486,29 +605,51 @@ function createLandingsService(transport, _config) {
|
|
|
486
605
|
},
|
|
487
606
|
async submit (formUniqueId, data) {
|
|
488
607
|
const response = await transport.post(`/landings/${formUniqueId}/instances`, {
|
|
489
|
-
|
|
608
|
+
landing: {
|
|
490
609
|
email: data.email,
|
|
491
610
|
first_name: data.firstName,
|
|
611
|
+
middle_name: data.middleName,
|
|
492
612
|
last_name: data.lastName,
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
613
|
+
phone_number: data.phoneNumber,
|
|
614
|
+
message: data.message,
|
|
615
|
+
notes: data.notes,
|
|
616
|
+
selected_option: data.selectedOption,
|
|
617
|
+
form_fields: data.formFields,
|
|
618
|
+
source: data.source,
|
|
619
|
+
source_alias: data.sourceAlias,
|
|
620
|
+
source_id: data.sourceId,
|
|
621
|
+
source_type: data.sourceType,
|
|
622
|
+
visitor_unique_id: data.visitorUniqueId,
|
|
623
|
+
visitor_type: data.visitorType,
|
|
624
|
+
touch_id: data.touchId,
|
|
625
|
+
touch_reference_id: data.touchReferenceId,
|
|
626
|
+
preferred_language: data.preferredLanguage
|
|
497
627
|
}
|
|
498
628
|
});
|
|
499
629
|
return decodeOne(response, landingMapper);
|
|
500
630
|
},
|
|
501
631
|
async update (formUniqueId, uniqueId, data) {
|
|
502
632
|
const response = await transport.put(`/landings/${formUniqueId}/instances/${uniqueId}`, {
|
|
503
|
-
|
|
633
|
+
landing: {
|
|
504
634
|
email: data.email,
|
|
505
635
|
first_name: data.firstName,
|
|
636
|
+
middle_name: data.middleName,
|
|
506
637
|
last_name: data.lastName,
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
638
|
+
phone_number: data.phoneNumber,
|
|
639
|
+
message: data.message,
|
|
640
|
+
notes: data.notes,
|
|
641
|
+
selected_option: data.selectedOption,
|
|
642
|
+
form_fields: data.formFields,
|
|
643
|
+
source: data.source,
|
|
644
|
+
source_alias: data.sourceAlias,
|
|
645
|
+
source_id: data.sourceId,
|
|
646
|
+
source_type: data.sourceType,
|
|
647
|
+
visitor_unique_id: data.visitorUniqueId,
|
|
648
|
+
visitor_type: data.visitorType,
|
|
649
|
+
touch_id: data.touchId,
|
|
650
|
+
touch_reference_id: data.touchReferenceId,
|
|
651
|
+
preferred_language: data.preferredLanguage,
|
|
652
|
+
status: data.status
|
|
512
653
|
}
|
|
513
654
|
});
|
|
514
655
|
return decodeOne(response, landingMapper);
|
|
@@ -522,7 +663,7 @@ function createLandingsService(transport, _config) {
|
|
|
522
663
|
const subscriptionMapper = {
|
|
523
664
|
type: 'subscription',
|
|
524
665
|
map: (resource)=>{
|
|
525
|
-
var _parseString, _parseString1
|
|
666
|
+
var _parseString, _parseString1;
|
|
526
667
|
return {
|
|
527
668
|
id: resource.id,
|
|
528
669
|
uniqueId: resource.id,
|
|
@@ -530,9 +671,20 @@ const subscriptionMapper = {
|
|
|
530
671
|
userUniqueId: parseString(resource.attributes['user_unique_id']),
|
|
531
672
|
email: (_parseString1 = parseString(resource.attributes['email'])) != null ? _parseString1 : '',
|
|
532
673
|
firstName: parseString(resource.attributes['first_name']),
|
|
674
|
+
middleName: parseString(resource.attributes['middle_name']),
|
|
533
675
|
lastName: parseString(resource.attributes['last_name']),
|
|
534
|
-
|
|
535
|
-
|
|
676
|
+
phoneNumber: parseString(resource.attributes['phone_number']),
|
|
677
|
+
notes: parseString(resource.attributes['notes']),
|
|
678
|
+
selectedOption: parseString(resource.attributes['selected_option']),
|
|
679
|
+
formFields: resource.attributes['form_fields'],
|
|
680
|
+
source: parseString(resource.attributes['source']),
|
|
681
|
+
sourceAlias: parseString(resource.attributes['source_alias']),
|
|
682
|
+
sourceId: parseString(resource.attributes['source_id']),
|
|
683
|
+
sourceType: parseString(resource.attributes['source_type']),
|
|
684
|
+
visitorUniqueId: parseString(resource.attributes['visitor_unique_id']),
|
|
685
|
+
visitorType: parseString(resource.attributes['visitor_type']),
|
|
686
|
+
touchId: parseString(resource.attributes['touch_id']),
|
|
687
|
+
touchReferenceId: parseString(resource.attributes['touch_reference_id']),
|
|
536
688
|
status: parseStatus(resource.attributes['status']),
|
|
537
689
|
subscribedAt: parseDate(resource.attributes['subscribed_at']),
|
|
538
690
|
unsubscribedAt: parseDate(resource.attributes['unsubscribed_at']),
|
|
@@ -565,10 +717,20 @@ function createSubscriptionsService(transport, _config) {
|
|
|
565
717
|
subscription: {
|
|
566
718
|
email: data.email,
|
|
567
719
|
first_name: data.firstName,
|
|
720
|
+
middle_name: data.middleName,
|
|
568
721
|
last_name: data.lastName,
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
722
|
+
phone_number: data.phoneNumber,
|
|
723
|
+
notes: data.notes,
|
|
724
|
+
selected_option: data.selectedOption,
|
|
725
|
+
form_fields: data.formFields,
|
|
726
|
+
source: data.source,
|
|
727
|
+
source_alias: data.sourceAlias,
|
|
728
|
+
source_id: data.sourceId,
|
|
729
|
+
source_type: data.sourceType,
|
|
730
|
+
visitor_unique_id: data.visitorUniqueId,
|
|
731
|
+
visitor_type: data.visitorType,
|
|
732
|
+
touch_id: data.touchId,
|
|
733
|
+
touch_reference_id: data.touchReferenceId
|
|
572
734
|
}
|
|
573
735
|
});
|
|
574
736
|
return decodeOne(response, subscriptionMapper);
|
|
@@ -578,11 +740,21 @@ function createSubscriptionsService(transport, _config) {
|
|
|
578
740
|
subscription: {
|
|
579
741
|
email: data.email,
|
|
580
742
|
first_name: data.firstName,
|
|
743
|
+
middle_name: data.middleName,
|
|
581
744
|
last_name: data.lastName,
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
745
|
+
phone_number: data.phoneNumber,
|
|
746
|
+
notes: data.notes,
|
|
747
|
+
selected_option: data.selectedOption,
|
|
748
|
+
form_fields: data.formFields,
|
|
749
|
+
source: data.source,
|
|
750
|
+
source_alias: data.sourceAlias,
|
|
751
|
+
source_id: data.sourceId,
|
|
752
|
+
source_type: data.sourceType,
|
|
753
|
+
visitor_unique_id: data.visitorUniqueId,
|
|
754
|
+
visitor_type: data.visitorType,
|
|
755
|
+
touch_id: data.touchId,
|
|
756
|
+
touch_reference_id: data.touchReferenceId,
|
|
757
|
+
status: data.status
|
|
586
758
|
}
|
|
587
759
|
});
|
|
588
760
|
return decodeOne(response, subscriptionMapper);
|
|
@@ -596,7 +768,7 @@ function createSubscriptionsService(transport, _config) {
|
|
|
596
768
|
const appointmentMapper = {
|
|
597
769
|
type: 'appointment',
|
|
598
770
|
map: (resource)=>{
|
|
599
|
-
var _parseString, _parseDate
|
|
771
|
+
var _parseString, _parseDate;
|
|
600
772
|
return {
|
|
601
773
|
id: resource.id,
|
|
602
774
|
uniqueId: resource.id,
|
|
@@ -604,14 +776,30 @@ const appointmentMapper = {
|
|
|
604
776
|
userUniqueId: parseString(resource.attributes['user_unique_id']),
|
|
605
777
|
email: parseString(resource.attributes['email']),
|
|
606
778
|
firstName: parseString(resource.attributes['first_name']),
|
|
779
|
+
middleName: parseString(resource.attributes['middle_name']),
|
|
607
780
|
lastName: parseString(resource.attributes['last_name']),
|
|
608
|
-
|
|
609
|
-
|
|
781
|
+
phoneNumber: parseString(resource.attributes['phone_number']),
|
|
782
|
+
selectedOption: parseString(resource.attributes['selected_option']),
|
|
783
|
+
formFields: resource.attributes['form_fields'],
|
|
784
|
+
startAt: (_parseDate = parseDate(resource.attributes['start_at'])) != null ? _parseDate : new Date(),
|
|
785
|
+
endAt: parseDate(resource.attributes['end_at']),
|
|
610
786
|
duration: parseOptionalNumber(resource.attributes['duration']),
|
|
611
|
-
|
|
612
|
-
|
|
787
|
+
locationUniqueId: parseString(resource.attributes['location_unique_id']),
|
|
788
|
+
locationName: parseString(resource.attributes['location_name']),
|
|
789
|
+
locationAddress: parseString(resource.attributes['location_address']),
|
|
790
|
+
assignedToUniqueId: parseString(resource.attributes['assigned_to_unique_id']),
|
|
791
|
+
assignedToName: parseString(resource.attributes['assigned_to_name']),
|
|
792
|
+
assignedToEmail: parseString(resource.attributes['assigned_to_email']),
|
|
793
|
+
assignedToPhone: parseString(resource.attributes['assigned_to_phone']),
|
|
613
794
|
notes: parseString(resource.attributes['notes']),
|
|
614
|
-
|
|
795
|
+
source: parseString(resource.attributes['source']),
|
|
796
|
+
sourceAlias: parseString(resource.attributes['source_alias']),
|
|
797
|
+
sourceId: parseString(resource.attributes['source_id']),
|
|
798
|
+
sourceType: parseString(resource.attributes['source_type']),
|
|
799
|
+
visitorUniqueId: parseString(resource.attributes['visitor_unique_id']),
|
|
800
|
+
visitorType: parseString(resource.attributes['visitor_type']),
|
|
801
|
+
touchId: parseString(resource.attributes['touch_id']),
|
|
802
|
+
touchReferenceId: parseString(resource.attributes['touch_reference_id']),
|
|
615
803
|
status: parseStatus(resource.attributes['status']),
|
|
616
804
|
confirmedAt: parseDate(resource.attributes['confirmed_at']),
|
|
617
805
|
cancelledAt: parseDate(resource.attributes['cancelled_at']),
|
|
@@ -646,15 +834,30 @@ function createAppointmentsService(transport, _config) {
|
|
|
646
834
|
appointment: {
|
|
647
835
|
email: data.email,
|
|
648
836
|
first_name: data.firstName,
|
|
837
|
+
middle_name: data.middleName,
|
|
649
838
|
last_name: data.lastName,
|
|
650
|
-
|
|
651
|
-
|
|
839
|
+
phone_number: data.phoneNumber,
|
|
840
|
+
selected_option: data.selectedOption,
|
|
841
|
+
form_fields: data.formFields,
|
|
842
|
+
start_at: data.startAt instanceof Date ? data.startAt.toISOString() : data.startAt,
|
|
843
|
+
end_at: data.endAt instanceof Date ? data.endAt.toISOString() : data.endAt,
|
|
652
844
|
duration: data.duration,
|
|
653
|
-
|
|
654
|
-
|
|
845
|
+
location_unique_id: data.locationUniqueId,
|
|
846
|
+
location_name: data.locationName,
|
|
847
|
+
location_address: data.locationAddress,
|
|
848
|
+
assigned_to_unique_id: data.assignedToUniqueId,
|
|
849
|
+
assigned_to_name: data.assignedToName,
|
|
850
|
+
assigned_to_email: data.assignedToEmail,
|
|
851
|
+
assigned_to_phone: data.assignedToPhone,
|
|
655
852
|
notes: data.notes,
|
|
656
|
-
|
|
657
|
-
|
|
853
|
+
source: data.source,
|
|
854
|
+
source_alias: data.sourceAlias,
|
|
855
|
+
source_id: data.sourceId,
|
|
856
|
+
source_type: data.sourceType,
|
|
857
|
+
visitor_unique_id: data.visitorUniqueId,
|
|
858
|
+
visitor_type: data.visitorType,
|
|
859
|
+
touch_id: data.touchId,
|
|
860
|
+
touch_reference_id: data.touchReferenceId
|
|
658
861
|
}
|
|
659
862
|
});
|
|
660
863
|
return decodeOne(response, appointmentMapper);
|
|
@@ -664,16 +867,31 @@ function createAppointmentsService(transport, _config) {
|
|
|
664
867
|
appointment: {
|
|
665
868
|
email: data.email,
|
|
666
869
|
first_name: data.firstName,
|
|
870
|
+
middle_name: data.middleName,
|
|
667
871
|
last_name: data.lastName,
|
|
668
|
-
|
|
669
|
-
|
|
872
|
+
phone_number: data.phoneNumber,
|
|
873
|
+
selected_option: data.selectedOption,
|
|
874
|
+
form_fields: data.formFields,
|
|
875
|
+
start_at: data.startAt instanceof Date ? data.startAt.toISOString() : data.startAt,
|
|
876
|
+
end_at: data.endAt instanceof Date ? data.endAt.toISOString() : data.endAt,
|
|
670
877
|
duration: data.duration,
|
|
671
|
-
|
|
672
|
-
|
|
878
|
+
location_unique_id: data.locationUniqueId,
|
|
879
|
+
location_name: data.locationName,
|
|
880
|
+
location_address: data.locationAddress,
|
|
881
|
+
assigned_to_unique_id: data.assignedToUniqueId,
|
|
882
|
+
assigned_to_name: data.assignedToName,
|
|
883
|
+
assigned_to_email: data.assignedToEmail,
|
|
884
|
+
assigned_to_phone: data.assignedToPhone,
|
|
673
885
|
notes: data.notes,
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
886
|
+
source: data.source,
|
|
887
|
+
source_alias: data.sourceAlias,
|
|
888
|
+
source_id: data.sourceId,
|
|
889
|
+
source_type: data.sourceType,
|
|
890
|
+
visitor_unique_id: data.visitorUniqueId,
|
|
891
|
+
visitor_type: data.visitorType,
|
|
892
|
+
touch_id: data.touchId,
|
|
893
|
+
touch_reference_id: data.touchReferenceId,
|
|
894
|
+
status: data.status
|
|
677
895
|
}
|
|
678
896
|
});
|
|
679
897
|
return decodeOne(response, appointmentMapper);
|
|
@@ -691,12 +909,16 @@ function createAppointmentsService(transport, _config) {
|
|
|
691
909
|
},
|
|
692
910
|
async reportList (data) {
|
|
693
911
|
const response = await transport.post('/reports/appointments/list', {
|
|
694
|
-
|
|
912
|
+
query_params: {
|
|
695
913
|
form_unique_id: data.formUniqueId,
|
|
914
|
+
user_unique_id: data.userUniqueId,
|
|
915
|
+
source: data.source,
|
|
916
|
+
date_part: data.datePart,
|
|
696
917
|
from_date: data.fromDate instanceof Date ? data.fromDate.toISOString() : data.fromDate,
|
|
697
918
|
to_date: data.toDate instanceof Date ? data.toDate.toISOString() : data.toDate,
|
|
698
919
|
status: data.status,
|
|
699
|
-
|
|
920
|
+
page: data.page,
|
|
921
|
+
records: data.records
|
|
700
922
|
}
|
|
701
923
|
});
|
|
702
924
|
const result = decodePageResult(response, appointmentMapper);
|
|
@@ -704,12 +926,16 @@ function createAppointmentsService(transport, _config) {
|
|
|
704
926
|
},
|
|
705
927
|
async reportSummary (data) {
|
|
706
928
|
const response = await transport.post('/reports/appointments/summary', {
|
|
707
|
-
|
|
929
|
+
query_params: {
|
|
708
930
|
form_unique_id: data.formUniqueId,
|
|
931
|
+
user_unique_id: data.userUniqueId,
|
|
932
|
+
source: data.source,
|
|
933
|
+
date_part: data.datePart,
|
|
709
934
|
from_date: data.fromDate instanceof Date ? data.fromDate.toISOString() : data.fromDate,
|
|
710
935
|
to_date: data.toDate instanceof Date ? data.toDate.toISOString() : data.toDate,
|
|
711
936
|
status: data.status,
|
|
712
|
-
|
|
937
|
+
page: data.page,
|
|
938
|
+
records: data.records
|
|
713
939
|
}
|
|
714
940
|
});
|
|
715
941
|
return response;
|
|
@@ -720,7 +946,7 @@ function createAppointmentsService(transport, _config) {
|
|
|
720
946
|
const surveyMapper = {
|
|
721
947
|
type: 'survey_instance',
|
|
722
948
|
map: (resource)=>{
|
|
723
|
-
var _parseString
|
|
949
|
+
var _parseString;
|
|
724
950
|
return {
|
|
725
951
|
id: resource.id,
|
|
726
952
|
uniqueId: resource.id,
|
|
@@ -728,8 +954,21 @@ const surveyMapper = {
|
|
|
728
954
|
userUniqueId: parseString(resource.attributes['user_unique_id']),
|
|
729
955
|
email: parseString(resource.attributes['email']),
|
|
730
956
|
firstName: parseString(resource.attributes['first_name']),
|
|
957
|
+
middleName: parseString(resource.attributes['middle_name']),
|
|
731
958
|
lastName: parseString(resource.attributes['last_name']),
|
|
732
|
-
|
|
959
|
+
phoneNumber: parseString(resource.attributes['phone_number']),
|
|
960
|
+
message: parseString(resource.attributes['message']),
|
|
961
|
+
notes: parseString(resource.attributes['notes']),
|
|
962
|
+
selectedOption: parseString(resource.attributes['selected_option']),
|
|
963
|
+
formFields: resource.attributes['form_fields'],
|
|
964
|
+
source: parseString(resource.attributes['source']),
|
|
965
|
+
sourceAlias: parseString(resource.attributes['source_alias']),
|
|
966
|
+
sourceId: parseString(resource.attributes['source_id']),
|
|
967
|
+
sourceType: parseString(resource.attributes['source_type']),
|
|
968
|
+
visitorUniqueId: parseString(resource.attributes['visitor_unique_id']),
|
|
969
|
+
visitorType: parseString(resource.attributes['visitor_type']),
|
|
970
|
+
touchId: parseString(resource.attributes['touch_id']),
|
|
971
|
+
touchReferenceId: parseString(resource.attributes['touch_reference_id']),
|
|
733
972
|
status: parseStatus(resource.attributes['status']),
|
|
734
973
|
token: parseString(resource.attributes['token']),
|
|
735
974
|
startedAt: parseDate(resource.attributes['started_at']),
|
|
@@ -772,26 +1011,49 @@ function createSurveysService(transport, _config) {
|
|
|
772
1011
|
},
|
|
773
1012
|
async create (formUniqueId, data) {
|
|
774
1013
|
const response = await transport.post(`/surveys/${formUniqueId}/instances`, {
|
|
775
|
-
|
|
776
|
-
user_unique_id: data.userUniqueId,
|
|
1014
|
+
survey: {
|
|
777
1015
|
email: data.email,
|
|
778
1016
|
first_name: data.firstName,
|
|
1017
|
+
middle_name: data.middleName,
|
|
779
1018
|
last_name: data.lastName,
|
|
780
|
-
|
|
781
|
-
|
|
1019
|
+
phone_number: data.phoneNumber,
|
|
1020
|
+
message: data.message,
|
|
1021
|
+
notes: data.notes,
|
|
1022
|
+
selected_option: data.selectedOption,
|
|
1023
|
+
form_fields: data.formFields,
|
|
1024
|
+
source: data.source,
|
|
1025
|
+
source_alias: data.sourceAlias,
|
|
1026
|
+
source_id: data.sourceId,
|
|
1027
|
+
source_type: data.sourceType,
|
|
1028
|
+
visitor_unique_id: data.visitorUniqueId,
|
|
1029
|
+
visitor_type: data.visitorType,
|
|
1030
|
+
touch_id: data.touchId,
|
|
1031
|
+
touch_reference_id: data.touchReferenceId
|
|
782
1032
|
}
|
|
783
1033
|
});
|
|
784
1034
|
return decodeOne(response, surveyMapper);
|
|
785
1035
|
},
|
|
786
1036
|
async update (formUniqueId, uniqueId, data) {
|
|
787
1037
|
const response = await transport.put(`/surveys/${formUniqueId}/instances/${uniqueId}`, {
|
|
788
|
-
|
|
1038
|
+
survey: {
|
|
789
1039
|
email: data.email,
|
|
790
1040
|
first_name: data.firstName,
|
|
1041
|
+
middle_name: data.middleName,
|
|
791
1042
|
last_name: data.lastName,
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
1043
|
+
phone_number: data.phoneNumber,
|
|
1044
|
+
message: data.message,
|
|
1045
|
+
notes: data.notes,
|
|
1046
|
+
selected_option: data.selectedOption,
|
|
1047
|
+
form_fields: data.formFields,
|
|
1048
|
+
source: data.source,
|
|
1049
|
+
source_alias: data.sourceAlias,
|
|
1050
|
+
source_id: data.sourceId,
|
|
1051
|
+
source_type: data.sourceType,
|
|
1052
|
+
visitor_unique_id: data.visitorUniqueId,
|
|
1053
|
+
visitor_type: data.visitorType,
|
|
1054
|
+
touch_id: data.touchId,
|
|
1055
|
+
touch_reference_id: data.touchReferenceId,
|
|
1056
|
+
status: data.status
|
|
795
1057
|
}
|
|
796
1058
|
});
|
|
797
1059
|
return decodeOne(response, surveyMapper);
|
|
@@ -801,7 +1063,7 @@ function createSurveysService(transport, _config) {
|
|
|
801
1063
|
},
|
|
802
1064
|
async updateStatus (formUniqueId, uniqueId, data) {
|
|
803
1065
|
const response = await transport.put(`/surveys/${formUniqueId}/instances/${uniqueId}/status`, {
|
|
804
|
-
|
|
1066
|
+
survey: {
|
|
805
1067
|
status: data.status
|
|
806
1068
|
}
|
|
807
1069
|
});
|
|
@@ -827,18 +1089,32 @@ function createSurveysService(transport, _config) {
|
|
|
827
1089
|
const referralMapper = {
|
|
828
1090
|
type: 'referral',
|
|
829
1091
|
map: (resource)=>{
|
|
830
|
-
var _parseString
|
|
1092
|
+
var _parseString;
|
|
831
1093
|
return {
|
|
832
1094
|
id: resource.id,
|
|
833
1095
|
uniqueId: resource.id,
|
|
834
1096
|
formUniqueId: (_parseString = parseString(resource.attributes['form_unique_id'])) != null ? _parseString : '',
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
1097
|
+
userUniqueId: parseString(resource.attributes['user_unique_id']),
|
|
1098
|
+
firstName: parseString(resource.attributes['first_name']),
|
|
1099
|
+
middleName: parseString(resource.attributes['middle_name']),
|
|
1100
|
+
lastName: parseString(resource.attributes['last_name']),
|
|
1101
|
+
email: parseString(resource.attributes['email']),
|
|
1102
|
+
phoneNumber: parseString(resource.attributes['phone_number']),
|
|
1103
|
+
message: parseString(resource.attributes['message']),
|
|
1104
|
+
notes: parseString(resource.attributes['notes']),
|
|
1105
|
+
selectedOption: parseString(resource.attributes['selected_option']),
|
|
1106
|
+
formFields: resource.attributes['form_fields'],
|
|
1107
|
+
referredByType: parseString(resource.attributes['referred_by_type']),
|
|
1108
|
+
referredByName: parseString(resource.attributes['referred_by_name']),
|
|
1109
|
+
referredByUniqueId: parseString(resource.attributes['referred_by_unique_id']),
|
|
1110
|
+
source: parseString(resource.attributes['source']),
|
|
1111
|
+
sourceAlias: parseString(resource.attributes['source_alias']),
|
|
1112
|
+
sourceId: parseString(resource.attributes['source_id']),
|
|
1113
|
+
sourceType: parseString(resource.attributes['source_type']),
|
|
1114
|
+
visitorUniqueId: parseString(resource.attributes['visitor_unique_id']),
|
|
1115
|
+
visitorType: parseString(resource.attributes['visitor_type']),
|
|
1116
|
+
touchId: parseString(resource.attributes['touch_id']),
|
|
1117
|
+
touchReferenceId: parseString(resource.attributes['touch_reference_id']),
|
|
842
1118
|
status: parseStatus(resource.attributes['status']),
|
|
843
1119
|
convertedAt: parseDate(resource.attributes['converted_at']),
|
|
844
1120
|
payload: resource.attributes['payload'],
|
|
@@ -855,7 +1131,6 @@ function createReferralsService(transport, _config) {
|
|
|
855
1131
|
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
856
1132
|
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
857
1133
|
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
858
|
-
if (params == null ? void 0 : params.referrerUniqueId) queryParams['referrer_unique_id'] = params.referrerUniqueId;
|
|
859
1134
|
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
860
1135
|
const response = await transport.get(`/referrals/${formUniqueId}/instances`, {
|
|
861
1136
|
params: queryParams
|
|
@@ -869,14 +1144,26 @@ function createReferralsService(transport, _config) {
|
|
|
869
1144
|
async create (formUniqueId, data) {
|
|
870
1145
|
const response = await transport.post(`/referrals/${formUniqueId}/instances`, {
|
|
871
1146
|
referral: {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1147
|
+
first_name: data.firstName,
|
|
1148
|
+
middle_name: data.middleName,
|
|
1149
|
+
last_name: data.lastName,
|
|
1150
|
+
email: data.email,
|
|
1151
|
+
phone_number: data.phoneNumber,
|
|
1152
|
+
message: data.message,
|
|
1153
|
+
notes: data.notes,
|
|
1154
|
+
selected_option: data.selectedOption,
|
|
1155
|
+
form_fields: data.formFields,
|
|
1156
|
+
referred_by_type: data.referredByType,
|
|
1157
|
+
referred_by_name: data.referredByName,
|
|
1158
|
+
referred_by_unique_id: data.referredByUniqueId,
|
|
1159
|
+
source: data.source,
|
|
1160
|
+
source_alias: data.sourceAlias,
|
|
1161
|
+
source_id: data.sourceId,
|
|
1162
|
+
source_type: data.sourceType,
|
|
1163
|
+
visitor_unique_id: data.visitorUniqueId,
|
|
1164
|
+
visitor_type: data.visitorType,
|
|
1165
|
+
touch_id: data.touchId,
|
|
1166
|
+
touch_reference_id: data.touchReferenceId
|
|
880
1167
|
}
|
|
881
1168
|
});
|
|
882
1169
|
return decodeOne(response, referralMapper);
|
|
@@ -884,12 +1171,27 @@ function createReferralsService(transport, _config) {
|
|
|
884
1171
|
async update (formUniqueId, uniqueId, data) {
|
|
885
1172
|
const response = await transport.put(`/referrals/${formUniqueId}/instances/${uniqueId}`, {
|
|
886
1173
|
referral: {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
1174
|
+
first_name: data.firstName,
|
|
1175
|
+
middle_name: data.middleName,
|
|
1176
|
+
last_name: data.lastName,
|
|
1177
|
+
email: data.email,
|
|
1178
|
+
phone_number: data.phoneNumber,
|
|
1179
|
+
message: data.message,
|
|
1180
|
+
notes: data.notes,
|
|
1181
|
+
selected_option: data.selectedOption,
|
|
1182
|
+
form_fields: data.formFields,
|
|
1183
|
+
referred_by_type: data.referredByType,
|
|
1184
|
+
referred_by_name: data.referredByName,
|
|
1185
|
+
referred_by_unique_id: data.referredByUniqueId,
|
|
1186
|
+
source: data.source,
|
|
1187
|
+
source_alias: data.sourceAlias,
|
|
1188
|
+
source_id: data.sourceId,
|
|
1189
|
+
source_type: data.sourceType,
|
|
1190
|
+
visitor_unique_id: data.visitorUniqueId,
|
|
1191
|
+
visitor_type: data.visitorType,
|
|
1192
|
+
touch_id: data.touchId,
|
|
1193
|
+
touch_reference_id: data.touchReferenceId,
|
|
1194
|
+
status: data.status
|
|
893
1195
|
}
|
|
894
1196
|
});
|
|
895
1197
|
return decodeOne(response, referralMapper);
|
|
@@ -903,19 +1205,27 @@ function createReferralsService(transport, _config) {
|
|
|
903
1205
|
const mailTemplateMapper = {
|
|
904
1206
|
type: 'mail_template',
|
|
905
1207
|
map: (resource)=>{
|
|
906
|
-
var _parseString
|
|
1208
|
+
var _parseString;
|
|
907
1209
|
return {
|
|
908
1210
|
id: resource.id,
|
|
909
1211
|
uniqueId: resource.id,
|
|
910
1212
|
name: (_parseString = parseString(resource.attributes['name'])) != null ? _parseString : '',
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1213
|
+
eventName: parseString(resource.attributes['event_name']),
|
|
1214
|
+
fromSubject: parseString(resource.attributes['from_subject']),
|
|
1215
|
+
templateHtml: parseString(resource.attributes['template_html']),
|
|
1216
|
+
templateText: parseString(resource.attributes['template_text']),
|
|
1217
|
+
templateName: parseString(resource.attributes['template_name']),
|
|
1218
|
+
fromAddress: parseString(resource.attributes['from_address']),
|
|
1219
|
+
fromDomain: parseString(resource.attributes['from_domain']),
|
|
917
1220
|
fromName: parseString(resource.attributes['from_name']),
|
|
918
|
-
|
|
1221
|
+
provider: parseString(resource.attributes['provider']),
|
|
1222
|
+
source: parseString(resource.attributes['source']),
|
|
1223
|
+
sourceAlias: parseString(resource.attributes['source_alias']),
|
|
1224
|
+
sourceId: parseString(resource.attributes['source_id']),
|
|
1225
|
+
sourceType: parseString(resource.attributes['source_type']),
|
|
1226
|
+
preferredLanguage: parseString(resource.attributes['preferred_language']),
|
|
1227
|
+
key: parseString(resource.attributes['key']),
|
|
1228
|
+
secret: parseString(resource.attributes['secret']),
|
|
919
1229
|
status: parseStatus(resource.attributes['status']),
|
|
920
1230
|
payload: resource.attributes['payload'],
|
|
921
1231
|
createdAt: parseDate(resource.attributes['created_at']),
|
|
@@ -944,16 +1254,24 @@ function createMailTemplatesService(transport, _config) {
|
|
|
944
1254
|
},
|
|
945
1255
|
async create (data) {
|
|
946
1256
|
const response = await transport.post('/mailtemplates', {
|
|
947
|
-
|
|
1257
|
+
template: {
|
|
948
1258
|
name: data.name,
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1259
|
+
event_name: data.eventName,
|
|
1260
|
+
from_subject: data.fromSubject,
|
|
1261
|
+
template_html: data.templateHtml,
|
|
1262
|
+
template_text: data.templateText,
|
|
1263
|
+
template_name: data.templateName,
|
|
1264
|
+
from_address: data.fromAddress,
|
|
1265
|
+
from_domain: data.fromDomain,
|
|
955
1266
|
from_name: data.fromName,
|
|
956
|
-
|
|
1267
|
+
provider: data.provider,
|
|
1268
|
+
source: data.source,
|
|
1269
|
+
source_alias: data.sourceAlias,
|
|
1270
|
+
source_id: data.sourceId,
|
|
1271
|
+
source_type: data.sourceType,
|
|
1272
|
+
preferred_language: data.preferredLanguage,
|
|
1273
|
+
key: data.key,
|
|
1274
|
+
secret: data.secret,
|
|
957
1275
|
payload: data.payload
|
|
958
1276
|
}
|
|
959
1277
|
});
|
|
@@ -961,16 +1279,24 @@ function createMailTemplatesService(transport, _config) {
|
|
|
961
1279
|
},
|
|
962
1280
|
async update (uniqueId, data) {
|
|
963
1281
|
const response = await transport.put(`/mailtemplates/${uniqueId}`, {
|
|
964
|
-
|
|
1282
|
+
template: {
|
|
965
1283
|
name: data.name,
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1284
|
+
event_name: data.eventName,
|
|
1285
|
+
from_subject: data.fromSubject,
|
|
1286
|
+
template_html: data.templateHtml,
|
|
1287
|
+
template_text: data.templateText,
|
|
1288
|
+
template_name: data.templateName,
|
|
1289
|
+
from_address: data.fromAddress,
|
|
1290
|
+
from_domain: data.fromDomain,
|
|
972
1291
|
from_name: data.fromName,
|
|
973
|
-
|
|
1292
|
+
provider: data.provider,
|
|
1293
|
+
source: data.source,
|
|
1294
|
+
source_alias: data.sourceAlias,
|
|
1295
|
+
source_id: data.sourceId,
|
|
1296
|
+
source_type: data.sourceType,
|
|
1297
|
+
preferred_language: data.preferredLanguage,
|
|
1298
|
+
key: data.key,
|
|
1299
|
+
secret: data.secret,
|
|
974
1300
|
status: data.status,
|
|
975
1301
|
payload: data.payload
|
|
976
1302
|
}
|
|
@@ -1059,19 +1385,13 @@ function createApplicationFormsService(transport, _config) {
|
|
|
1059
1385
|
},
|
|
1060
1386
|
async submit (urlId, data) {
|
|
1061
1387
|
const response = await transport.post(`/${urlId}/forms/public`, {
|
|
1062
|
-
|
|
1063
|
-
data: data.data,
|
|
1064
|
-
payload: data.payload
|
|
1065
|
-
}
|
|
1388
|
+
responses: data.data
|
|
1066
1389
|
});
|
|
1067
1390
|
return decodeOne(response, applicationFormResponseMapper);
|
|
1068
1391
|
},
|
|
1069
1392
|
async draft (urlId, data) {
|
|
1070
1393
|
const response = await transport.put(`/${urlId}/forms/public`, {
|
|
1071
|
-
|
|
1072
|
-
data: data.data,
|
|
1073
|
-
payload: data.payload
|
|
1074
|
-
}
|
|
1394
|
+
responses: data.data
|
|
1075
1395
|
});
|
|
1076
1396
|
return decodeOne(response, applicationFormResponseMapper);
|
|
1077
1397
|
},
|
|
@@ -1098,19 +1418,28 @@ function createCrmSyncService(transport, _config) {
|
|
|
1098
1418
|
const response = await transport.post(`/crm/sync/subscription/${uniqueId}`, {});
|
|
1099
1419
|
return mapSyncResult(response);
|
|
1100
1420
|
},
|
|
1101
|
-
async syncAppointment (uniqueId) {
|
|
1102
|
-
const
|
|
1421
|
+
async syncAppointment (uniqueId, asType) {
|
|
1422
|
+
const body = {};
|
|
1423
|
+
if (asType) body['as_type'] = asType;
|
|
1424
|
+
const response = await transport.post(`/crm/sync/appointment/${uniqueId}`, body);
|
|
1103
1425
|
return mapSyncResult(response);
|
|
1104
1426
|
},
|
|
1105
1427
|
async batchSync (data) {
|
|
1106
1428
|
const response = await transport.post('/crm/sync/batch', {
|
|
1107
|
-
|
|
1108
|
-
|
|
1429
|
+
batch: {
|
|
1430
|
+
limit: data.limit,
|
|
1431
|
+
sync_landings: data.syncLandings,
|
|
1432
|
+
sync_subscriptions: data.syncSubscriptions,
|
|
1433
|
+
sync_appointments: data.syncAppointments,
|
|
1434
|
+
appointments_as_type: data.appointmentsAsType
|
|
1435
|
+
}
|
|
1109
1436
|
});
|
|
1110
1437
|
return mapBatchResult(response);
|
|
1111
1438
|
},
|
|
1112
|
-
async retryFailed () {
|
|
1113
|
-
const
|
|
1439
|
+
async retryFailed (limit) {
|
|
1440
|
+
const body = {};
|
|
1441
|
+
if (limit !== undefined) body['limit'] = limit;
|
|
1442
|
+
const response = await transport.post('/crm/sync/retry_failed', body);
|
|
1114
1443
|
return mapBatchResult(response);
|
|
1115
1444
|
},
|
|
1116
1445
|
async testConnection () {
|