@vendasta/forms_microservice 0.0.17 → 0.0.20

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.
@@ -166,6 +166,26 @@ class CreateFormSubmissionRequest {
166
166
  return toReturn;
167
167
  }
168
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
+ }
169
189
  class DeleteFormRequest {
170
190
  constructor(kwargs) {
171
191
  if (!kwargs) {
@@ -224,6 +244,9 @@ class FormConfigField {
224
244
  if (typeof this.defaultValue !== 'undefined' && this.defaultValue !== null) {
225
245
  toReturn['defaultValue'] = 'toApiJson' in this.defaultValue ? this.defaultValue.toApiJson() : this.defaultValue;
226
246
  }
247
+ if (typeof this.preFillByUrlQueryParameter !== 'undefined') {
248
+ toReturn['preFillByUrlQueryParameter'] = this.preFillByUrlQueryParameter;
249
+ }
227
250
  return toReturn;
228
251
  }
229
252
  }
@@ -393,7 +416,7 @@ class ListFormsResponseFormRow {
393
416
  return toReturn;
394
417
  }
395
418
  }
396
- class ListFormSubmissionResponseFormSubmission {
419
+ class FormSubmission {
397
420
  constructor(kwargs) {
398
421
  if (!kwargs) {
399
422
  return;
@@ -401,28 +424,25 @@ class ListFormSubmissionResponseFormSubmission {
401
424
  Object.assign(this, kwargs);
402
425
  }
403
426
  static fromProto(proto) {
404
- let m = new ListFormSubmissionResponseFormSubmission();
427
+ let m = new FormSubmission();
405
428
  m = Object.assign(m, proto);
406
- if (proto.values) {
407
- m.values = proto.values.map(ListFormSubmissionResponseFormSubmissionSubmittedValue.fromProto);
408
- }
409
429
  return m;
410
430
  }
411
431
  toApiJson() {
412
432
  const toReturn = {};
413
- if (typeof this.formSubmissionId !== 'undefined') {
414
- toReturn['formSubmissionId'] = this.formSubmissionId;
433
+ if (typeof this.formId !== 'undefined') {
434
+ toReturn['formId'] = this.formId;
415
435
  }
416
- if (typeof this.formVersion !== 'undefined') {
417
- toReturn['formVersion'] = this.formVersion;
436
+ if (typeof this.version !== 'undefined') {
437
+ toReturn['version'] = this.version;
418
438
  }
419
- if (typeof this.values !== 'undefined' && this.values !== null) {
420
- toReturn['values'] = 'toApiJson' in this.values ? this.values.toApiJson() : this.values;
439
+ if (typeof this.values !== 'undefined') {
440
+ toReturn['values'] = this.values;
421
441
  }
422
442
  return toReturn;
423
443
  }
424
444
  }
425
- class FormSubmission {
445
+ class ListFormSubmissionResponseFormSubmission {
426
446
  constructor(kwargs) {
427
447
  if (!kwargs) {
428
448
  return;
@@ -430,20 +450,23 @@ class FormSubmission {
430
450
  Object.assign(this, kwargs);
431
451
  }
432
452
  static fromProto(proto) {
433
- let m = new FormSubmission();
453
+ let m = new ListFormSubmissionResponseFormSubmission();
434
454
  m = Object.assign(m, proto);
455
+ if (proto.values) {
456
+ m.values = proto.values.map(ListFormSubmissionResponseFormSubmissionSubmittedValue.fromProto);
457
+ }
435
458
  return m;
436
459
  }
437
460
  toApiJson() {
438
461
  const toReturn = {};
439
- if (typeof this.formId !== 'undefined') {
440
- toReturn['formId'] = this.formId;
462
+ if (typeof this.formSubmissionId !== 'undefined') {
463
+ toReturn['formSubmissionId'] = this.formSubmissionId;
441
464
  }
442
- if (typeof this.version !== 'undefined') {
443
- toReturn['version'] = this.version;
465
+ if (typeof this.formVersion !== 'undefined') {
466
+ toReturn['formVersion'] = this.formVersion;
444
467
  }
445
- if (typeof this.values !== 'undefined') {
446
- toReturn['values'] = this.values;
468
+ if (typeof this.values !== 'undefined' && this.values !== null) {
469
+ toReturn['values'] = 'toApiJson' in this.values ? this.values.toApiJson() : this.values;
447
470
  }
448
471
  return toReturn;
449
472
  }
@@ -1098,7 +1121,8 @@ class FormSubmissionApiService {
1098
1121
  }
1099
1122
  createFormSubmission(r) {
1100
1123
  const request = (r.toApiJson) ? r : new CreateFormSubmissionRequest(r);
1101
- return this.http.post(this._host + "/forms.v1.FormSubmissionService/CreateFormSubmission", request.toApiJson(), Object.assign(Object.assign({}, this.apiOptions()), { observe: 'response' }));
1124
+ return this.http.post(this._host + "/forms.v1.FormSubmissionService/CreateFormSubmission", request.toApiJson(), this.apiOptions())
1125
+ .pipe(map(resp => CreateFormSubmissionResponse.fromProto(resp)));
1102
1126
  }
1103
1127
  listFormSubmission(r) {
1104
1128
  const request = (r.toApiJson) ? r : new ListFormSubmissionRequest(r);
@@ -1187,11 +1211,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
1187
1211
 
1188
1212
  // *********************************
1189
1213
 
1214
+ class FormSubmissionsExportService {
1215
+ constructor(http, hostService) {
1216
+ this.http = http;
1217
+ this.hostService = hostService;
1218
+ this._host = this.hostService.hostWithScheme;
1219
+ }
1220
+ exportCSV(formId) {
1221
+ const url = `${this._host}/form-submissions/export-csv`;
1222
+ return this.http.post(url, {
1223
+ form_id: formId
1224
+ }, {
1225
+ observe: 'response',
1226
+ responseType: 'blob',
1227
+ withCredentials: true
1228
+ }).pipe(map((response) => {
1229
+ const contentDisposition = response.headers.get('content-disposition') || 'form-submissions.csv';
1230
+ const filename = contentDisposition.replace('attachment; filename=', '').replace(/"/g, '');
1231
+ return {
1232
+ filename: filename,
1233
+ blob: response.body || new Blob([], { type: 'text/csv' }),
1234
+ };
1235
+ }));
1236
+ }
1237
+ }
1238
+ 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 });
1239
+ FormSubmissionsExportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: FormSubmissionsExportService, providedIn: 'root' });
1240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: FormSubmissionsExportService, decorators: [{
1241
+ type: Injectable,
1242
+ args: [{ providedIn: 'root' }]
1243
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: HostService }]; } });
1244
+
1190
1245
  // MANUALLY CREATED FILE
1191
1246
 
1192
1247
  /**
1193
1248
  * Generated bundle index. Do not edit.
1194
1249
  */
1195
1250
 
1196
- 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 };
1251
+ 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 };
1197
1252
  //# sourceMappingURL=vendasta-forms_microservice.mjs.map