@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.
@@ -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 ListFormSubmissionResponseFormSubmission {
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 ListFormSubmissionResponseFormSubmission();
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.formSubmissionId !== 'undefined') {
413
- toReturn['formSubmissionId'] = this.formSubmissionId;
430
+ if (typeof this.formId !== 'undefined') {
431
+ toReturn['formId'] = this.formId;
414
432
  }
415
- if (typeof this.formVersion !== 'undefined') {
416
- toReturn['formVersion'] = this.formVersion;
433
+ if (typeof this.version !== 'undefined') {
434
+ toReturn['version'] = this.version;
417
435
  }
418
- if (typeof this.values !== 'undefined' && this.values !== null) {
419
- toReturn['values'] = 'toApiJson' in this.values ? this.values.toApiJson() : this.values;
436
+ if (typeof this.values !== 'undefined') {
437
+ toReturn['values'] = this.values;
420
438
  }
421
439
  return toReturn;
422
440
  }
423
441
  }
424
- class FormSubmission {
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 FormSubmission();
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.formId !== 'undefined') {
439
- toReturn['formId'] = this.formId;
459
+ if (typeof this.formSubmissionId !== 'undefined') {
460
+ toReturn['formSubmissionId'] = this.formSubmissionId;
440
461
  }
441
- if (typeof this.version !== 'undefined') {
442
- toReturn['version'] = this.version;
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
  }
@@ -1097,7 +1118,8 @@ class FormSubmissionApiService {
1097
1118
  }
1098
1119
  createFormSubmission(r) {
1099
1120
  const request = (r.toApiJson) ? r : new CreateFormSubmissionRequest(r);
1100
- return this.http.post(this._host + "/forms.v1.FormSubmissionService/CreateFormSubmission", request.toApiJson(), Object.assign(Object.assign({}, this.apiOptions()), { observe: 'response' }));
1121
+ return this.http.post(this._host + "/forms.v1.FormSubmissionService/CreateFormSubmission", request.toApiJson(), this.apiOptions())
1122
+ .pipe(map(resp => CreateFormSubmissionResponse.fromProto(resp)));
1101
1123
  }
1102
1124
  listFormSubmission(r) {
1103
1125
  const request = (r.toApiJson) ? r : new ListFormSubmissionRequest(r);
@@ -1186,11 +1208,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
1186
1208
 
1187
1209
  // *********************************
1188
1210
 
1211
+ class FormSubmissionsExportService {
1212
+ constructor(http, hostService) {
1213
+ this.http = http;
1214
+ this.hostService = hostService;
1215
+ this._host = this.hostService.hostWithScheme;
1216
+ }
1217
+ exportCSV(formId) {
1218
+ const url = `${this._host}/form-submissions/export-csv`;
1219
+ return this.http.post(url, {
1220
+ form_id: formId
1221
+ }, {
1222
+ observe: 'response',
1223
+ responseType: 'blob',
1224
+ withCredentials: true
1225
+ }).pipe(map((response) => {
1226
+ const contentDisposition = response.headers.get('content-disposition') || 'form-submissions.csv';
1227
+ const filename = contentDisposition.replace('attachment; filename=', '').replace(/"/g, '');
1228
+ return {
1229
+ filename: filename,
1230
+ blob: response.body || new Blob([], { type: 'text/csv' }),
1231
+ };
1232
+ }));
1233
+ }
1234
+ }
1235
+ 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 });
1236
+ FormSubmissionsExportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: FormSubmissionsExportService, providedIn: 'root' });
1237
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: FormSubmissionsExportService, decorators: [{
1238
+ type: Injectable,
1239
+ args: [{ providedIn: 'root' }]
1240
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: HostService }]; } });
1241
+
1189
1242
  // MANUALLY CREATED FILE
1190
1243
 
1191
1244
  /**
1192
1245
  * Generated bundle index. Do not edit.
1193
1246
  */
1194
1247
 
1195
- 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 };
1248
+ 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 };
1196
1249
  //# sourceMappingURL=vendasta-forms_microservice.mjs.map