@vendasta/forms_microservice 0.0.16 → 0.0.19
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/esm2020/lib/_internal/enums/api.enum.mjs +2 -1
- package/esm2020/lib/_internal/form-submission.api.service.mjs +4 -3
- package/esm2020/lib/_internal/interfaces/api.interface.mjs +1 -1
- package/esm2020/lib/_internal/interfaces/index.mjs +1 -1
- package/esm2020/lib/_internal/objects/api.mjs +40 -20
- package/esm2020/lib/_internal/objects/index.mjs +2 -2
- package/esm2020/lib/form-submission-export.service.mjs +38 -0
- package/esm2020/lib/index.mjs +2 -1
- package/fesm2015/vendasta-forms_microservice.mjs +74 -21
- package/fesm2015/vendasta-forms_microservice.mjs.map +1 -1
- package/fesm2020/vendasta-forms_microservice.mjs +74 -21
- package/fesm2020/vendasta-forms_microservice.mjs.map +1 -1
- package/lib/_internal/enums/api.enum.d.ts +2 -1
- package/lib/_internal/form-submission.api.service.d.ts +3 -3
- package/lib/_internal/interfaces/api.interface.d.ts +8 -5
- package/lib/_internal/interfaces/index.d.ts +1 -1
- package/lib/_internal/objects/api.d.ts +14 -8
- package/lib/_internal/objects/index.d.ts +1 -1
- package/lib/form-submission-export.service.d.ts +17 -0
- package/lib/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@ var FieldType;
|
|
|
19
19
|
FieldType[FieldType["FIELD_TYPE_DROPDOWN"] = 4] = "FIELD_TYPE_DROPDOWN";
|
|
20
20
|
FieldType[FieldType["FIELD_TYPE_CURRENCY"] = 5] = "FIELD_TYPE_CURRENCY";
|
|
21
21
|
FieldType[FieldType["FIELD_TYPE_BOOLEAN"] = 6] = "FIELD_TYPE_BOOLEAN";
|
|
22
|
+
FieldType[FieldType["FIELD_TYPE_RADIO"] = 7] = "FIELD_TYPE_RADIO";
|
|
22
23
|
})(FieldType || (FieldType = {}));
|
|
23
24
|
var JsonSchemaLibrary;
|
|
24
25
|
(function (JsonSchemaLibrary) {
|
|
@@ -165,6 +166,26 @@ class CreateFormSubmissionRequest {
|
|
|
165
166
|
return toReturn;
|
|
166
167
|
}
|
|
167
168
|
}
|
|
169
|
+
class CreateFormSubmissionResponse {
|
|
170
|
+
constructor(kwargs) {
|
|
171
|
+
if (!kwargs) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
Object.assign(this, kwargs);
|
|
175
|
+
}
|
|
176
|
+
static fromProto(proto) {
|
|
177
|
+
let m = new CreateFormSubmissionResponse();
|
|
178
|
+
m = Object.assign(m, proto);
|
|
179
|
+
return m;
|
|
180
|
+
}
|
|
181
|
+
toApiJson() {
|
|
182
|
+
const toReturn = {};
|
|
183
|
+
if (typeof this.redirectUrl !== 'undefined') {
|
|
184
|
+
toReturn['redirectUrl'] = this.redirectUrl;
|
|
185
|
+
}
|
|
186
|
+
return toReturn;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
168
189
|
class DeleteFormRequest {
|
|
169
190
|
constructor(kwargs) {
|
|
170
191
|
if (!kwargs) {
|
|
@@ -392,7 +413,7 @@ class ListFormsResponseFormRow {
|
|
|
392
413
|
return toReturn;
|
|
393
414
|
}
|
|
394
415
|
}
|
|
395
|
-
class
|
|
416
|
+
class FormSubmission {
|
|
396
417
|
constructor(kwargs) {
|
|
397
418
|
if (!kwargs) {
|
|
398
419
|
return;
|
|
@@ -400,28 +421,25 @@ class ListFormSubmissionResponseFormSubmission {
|
|
|
400
421
|
Object.assign(this, kwargs);
|
|
401
422
|
}
|
|
402
423
|
static fromProto(proto) {
|
|
403
|
-
let m = new
|
|
424
|
+
let m = new FormSubmission();
|
|
404
425
|
m = Object.assign(m, proto);
|
|
405
|
-
if (proto.values) {
|
|
406
|
-
m.values = proto.values.map(ListFormSubmissionResponseFormSubmissionSubmittedValue.fromProto);
|
|
407
|
-
}
|
|
408
426
|
return m;
|
|
409
427
|
}
|
|
410
428
|
toApiJson() {
|
|
411
429
|
const toReturn = {};
|
|
412
|
-
if (typeof this.
|
|
413
|
-
toReturn['
|
|
430
|
+
if (typeof this.formId !== 'undefined') {
|
|
431
|
+
toReturn['formId'] = this.formId;
|
|
414
432
|
}
|
|
415
|
-
if (typeof this.
|
|
416
|
-
toReturn['
|
|
433
|
+
if (typeof this.version !== 'undefined') {
|
|
434
|
+
toReturn['version'] = this.version;
|
|
417
435
|
}
|
|
418
|
-
if (typeof this.values !== 'undefined'
|
|
419
|
-
toReturn['values'] =
|
|
436
|
+
if (typeof this.values !== 'undefined') {
|
|
437
|
+
toReturn['values'] = this.values;
|
|
420
438
|
}
|
|
421
439
|
return toReturn;
|
|
422
440
|
}
|
|
423
441
|
}
|
|
424
|
-
class
|
|
442
|
+
class ListFormSubmissionResponseFormSubmission {
|
|
425
443
|
constructor(kwargs) {
|
|
426
444
|
if (!kwargs) {
|
|
427
445
|
return;
|
|
@@ -429,20 +447,23 @@ class FormSubmission {
|
|
|
429
447
|
Object.assign(this, kwargs);
|
|
430
448
|
}
|
|
431
449
|
static fromProto(proto) {
|
|
432
|
-
let m = new
|
|
450
|
+
let m = new ListFormSubmissionResponseFormSubmission();
|
|
433
451
|
m = Object.assign(m, proto);
|
|
452
|
+
if (proto.values) {
|
|
453
|
+
m.values = proto.values.map(ListFormSubmissionResponseFormSubmissionSubmittedValue.fromProto);
|
|
454
|
+
}
|
|
434
455
|
return m;
|
|
435
456
|
}
|
|
436
457
|
toApiJson() {
|
|
437
458
|
const toReturn = {};
|
|
438
|
-
if (typeof this.
|
|
439
|
-
toReturn['
|
|
459
|
+
if (typeof this.formSubmissionId !== 'undefined') {
|
|
460
|
+
toReturn['formSubmissionId'] = this.formSubmissionId;
|
|
440
461
|
}
|
|
441
|
-
if (typeof this.
|
|
442
|
-
toReturn['
|
|
462
|
+
if (typeof this.formVersion !== 'undefined') {
|
|
463
|
+
toReturn['formVersion'] = this.formVersion;
|
|
443
464
|
}
|
|
444
|
-
if (typeof this.values !== 'undefined') {
|
|
445
|
-
toReturn['values'] = this.values;
|
|
465
|
+
if (typeof this.values !== 'undefined' && this.values !== null) {
|
|
466
|
+
toReturn['values'] = 'toApiJson' in this.values ? this.values.toApiJson() : this.values;
|
|
446
467
|
}
|
|
447
468
|
return toReturn;
|
|
448
469
|
}
|
|
@@ -1096,7 +1117,8 @@ class FormSubmissionApiService {
|
|
|
1096
1117
|
}
|
|
1097
1118
|
createFormSubmission(r) {
|
|
1098
1119
|
const request = (r.toApiJson) ? r : new CreateFormSubmissionRequest(r);
|
|
1099
|
-
return this.http.post(this._host + "/forms.v1.FormSubmissionService/CreateFormSubmission", request.toApiJson(),
|
|
1120
|
+
return this.http.post(this._host + "/forms.v1.FormSubmissionService/CreateFormSubmission", request.toApiJson(), this.apiOptions())
|
|
1121
|
+
.pipe(map(resp => CreateFormSubmissionResponse.fromProto(resp)));
|
|
1100
1122
|
}
|
|
1101
1123
|
listFormSubmission(r) {
|
|
1102
1124
|
const request = (r.toApiJson) ? r : new ListFormSubmissionRequest(r);
|
|
@@ -1185,11 +1207,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
|
|
|
1185
1207
|
|
|
1186
1208
|
// *********************************
|
|
1187
1209
|
|
|
1210
|
+
class FormSubmissionsExportService {
|
|
1211
|
+
constructor(http, hostService) {
|
|
1212
|
+
this.http = http;
|
|
1213
|
+
this.hostService = hostService;
|
|
1214
|
+
this._host = this.hostService.hostWithScheme;
|
|
1215
|
+
}
|
|
1216
|
+
exportCSV(formId) {
|
|
1217
|
+
const url = `${this._host}/form-submissions/export-csv`;
|
|
1218
|
+
return this.http.post(url, {
|
|
1219
|
+
form_id: formId
|
|
1220
|
+
}, {
|
|
1221
|
+
observe: 'response',
|
|
1222
|
+
responseType: 'blob',
|
|
1223
|
+
withCredentials: true
|
|
1224
|
+
}).pipe(map((response) => {
|
|
1225
|
+
const contentDisposition = response.headers.get('content-disposition') || 'form-submissions.csv';
|
|
1226
|
+
const filename = contentDisposition.replace('attachment; filename=', '').replace(/"/g, '');
|
|
1227
|
+
return {
|
|
1228
|
+
filename: filename,
|
|
1229
|
+
blob: response.body || new Blob([], { type: 'text/csv' }),
|
|
1230
|
+
};
|
|
1231
|
+
}));
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
FormSubmissionsExportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: FormSubmissionsExportService, deps: [{ token: i1.HttpClient }, { token: HostService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1235
|
+
FormSubmissionsExportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: FormSubmissionsExportService, providedIn: 'root' });
|
|
1236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: FormSubmissionsExportService, decorators: [{
|
|
1237
|
+
type: Injectable,
|
|
1238
|
+
args: [{ providedIn: 'root' }]
|
|
1239
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: HostService }]; } });
|
|
1240
|
+
|
|
1188
1241
|
// MANUALLY CREATED FILE
|
|
1189
1242
|
|
|
1190
1243
|
/**
|
|
1191
1244
|
* Generated bundle index. Do not edit.
|
|
1192
1245
|
*/
|
|
1193
1246
|
|
|
1194
|
-
export { CreateFormRequest, CreateFormResponse, CreateFormSubmissionRequest, DeleteFormRequest, FieldType, FieldValue, FormConfig, FormConfigField, FormConfigFieldSchema, FormConfigFieldUnmappedField, FormConfigFieldUnmappedFieldOption, FormSubmission, FormSubmissionApiService, FormsApiService, GetEmbedCodeRequest, GetEmbedCodeResponse, GetFormRequest, GetFormResponse, GetMultiFormVersionsListRequest, GetMultiFormVersionsListResponse, GetMultiFormVersionsListResponseVersions, GetMultiRequest, GetMultiRequestFormConfigIdentifier, GetMultiResponse, HostService, JsonSchemaLibrary, ListFormSubmissionRequest, ListFormSubmissionResponse, ListFormSubmissionResponseFormSubmission, ListFormSubmissionResponseFormSubmissionSubmittedValue, ListFormsRequest, ListFormsRequestFilters, ListFormsResponse, ListFormsResponseFormRow, PagedRequestOptions, PagedResponseMetadata, PreviewFormRequest, PreviewFormResponse, RenderFormRequest, RenderFormResponse, Styles, UpdateFormRequest, UpdateFormResponse };
|
|
1247
|
+
export { CreateFormRequest, CreateFormResponse, CreateFormSubmissionRequest, CreateFormSubmissionResponse, DeleteFormRequest, FieldType, FieldValue, FormConfig, FormConfigField, FormConfigFieldSchema, FormConfigFieldUnmappedField, FormConfigFieldUnmappedFieldOption, FormSubmission, FormSubmissionApiService, FormSubmissionsExportService, FormsApiService, GetEmbedCodeRequest, GetEmbedCodeResponse, GetFormRequest, GetFormResponse, GetMultiFormVersionsListRequest, GetMultiFormVersionsListResponse, GetMultiFormVersionsListResponseVersions, GetMultiRequest, GetMultiRequestFormConfigIdentifier, GetMultiResponse, HostService, JsonSchemaLibrary, ListFormSubmissionRequest, ListFormSubmissionResponse, ListFormSubmissionResponseFormSubmission, ListFormSubmissionResponseFormSubmissionSubmittedValue, ListFormsRequest, ListFormsRequestFilters, ListFormsResponse, ListFormsResponseFormRow, PagedRequestOptions, PagedResponseMetadata, PreviewFormRequest, PreviewFormResponse, RenderFormRequest, RenderFormResponse, Styles, UpdateFormRequest, UpdateFormResponse };
|
|
1195
1248
|
//# sourceMappingURL=vendasta-forms_microservice.mjs.map
|