kwikid-forms 0.6.20 → 0.6.22

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.
@@ -847,6 +847,7 @@
847
847
  others: {
848
848
  isFrontCamera: false,
849
849
  isWatermark: false,
850
+ isWatermarkForImageUpload: false,
850
851
  flipHorizontal: false,
851
852
  mask: {
852
853
  shape: ""
@@ -3442,7 +3443,6 @@
3442
3443
  case 8:
3443
3444
  value = convertFormFieldValueToKwikUIFormat(field, value);
3444
3445
  validators = new FormValidation().getFormFieldValidators(field);
3445
- console.log("FORMKEYYYY", field);
3446
3446
  formGroup.addControl(field.key, new i3.FormControl({ value: value, disabled: field.disabled }, { validators: validators }));
3447
3447
  _b.label = 9;
3448
3448
  case 9:
@@ -4435,7 +4435,7 @@
4435
4435
  };
4436
4436
  KwikIDFormViewComponent.prototype.ngAfterViewInit = function () { };
4437
4437
  KwikIDFormViewComponent.prototype.ngOnChanges = function (changes) {
4438
- var _k;
4438
+ var _k, _l, _m;
4439
4439
  var _this = this;
4440
4440
  var _a, _b, _c, _d;
4441
4441
  var verifyChange = function (key) {
@@ -4494,13 +4494,19 @@
4494
4494
  if (response) {
4495
4495
  this.resetCamera();
4496
4496
  var image = response === null || response === void 0 ? void 0 : response.image_url;
4497
- this.mediaFiles[this.apiCallResponse.key] = kwikidToolkit.getObjectDeepCopy([
4498
- image
4499
- ]);
4500
- this.formGroup.controls[this.apiCallResponse.key].setValue(kwikidToolkit.getObjectDeepCopy([image]), {
4497
+ this.formData[field_1.key] = kwikidToolkit.getObjectDeepCopy([image]);
4498
+ this.mediaFiles[field_1.key] = kwikidToolkit.getObjectDeepCopy([image]);
4499
+ this.formGroup.controls[field_1.key].patchValue(kwikidToolkit.getObjectDeepCopy([image]), {
4500
+ emitEvent: false,
4501
+ onlySelf: false
4502
+ });
4503
+ this.formGroup.patchValue((_l = {},
4504
+ _l[field_1.key] = kwikidToolkit.getObjectDeepCopy([image]),
4505
+ _l), { emitEvent: false });
4506
+ this.formGroup.controls[field_1.key].updateValueAndValidity({
4501
4507
  emitEvent: false
4502
4508
  });
4503
- this.formGroup.controls[this.apiCallResponse.key].updateValueAndValidity({
4509
+ this.formGroup.updateValueAndValidity({
4504
4510
  emitEvent: false
4505
4511
  });
4506
4512
  this.getUnsavedDataState.emit(true);
@@ -4543,13 +4549,19 @@
4543
4549
  if (response) {
4544
4550
  this.resetCamera();
4545
4551
  var video = response === null || response === void 0 ? void 0 : response.video_url;
4546
- this.mediaFiles[this.apiCallResponse.key] = kwikidToolkit.getObjectDeepCopy([
4547
- video
4548
- ]);
4549
- this.formGroup.controls[this.apiCallResponse.key].setValue(kwikidToolkit.getObjectDeepCopy([video]), {
4552
+ this.formData[field_1.key] = kwikidToolkit.getObjectDeepCopy([video]);
4553
+ this.mediaFiles[field_1.key] = kwikidToolkit.getObjectDeepCopy([video]);
4554
+ this.formGroup.controls[field_1.key].patchValue(kwikidToolkit.getObjectDeepCopy([video]), {
4555
+ emitEvent: false,
4556
+ onlySelf: false
4557
+ });
4558
+ this.formGroup.patchValue((_m = {},
4559
+ _m[field_1.key] = kwikidToolkit.getObjectDeepCopy([video]),
4560
+ _m), { emitEvent: false });
4561
+ this.formGroup.controls[field_1.key].updateValueAndValidity({
4550
4562
  emitEvent: false
4551
4563
  });
4552
- this.formGroup.controls[this.apiCallResponse.key].updateValueAndValidity({
4564
+ this.formGroup.updateValueAndValidity({
4553
4565
  emitEvent: false
4554
4566
  });
4555
4567
  this.getUnsavedDataState.emit(true);
@@ -5232,7 +5244,7 @@
5232
5244
  this.hideApiLoader();
5233
5245
  };
5234
5246
  KwikIDFormViewComponent.prototype.handleOnClickInputCamera = function (e, field) {
5235
- var _a, _b, _c, _d;
5247
+ var _a, _b, _c, _d, _e, _f;
5236
5248
  return __awaiter(this, void 0, void 0, function () {
5237
5249
  var fieldKey, fieldcameraConfig, _k, cameraHelper, _l, _m;
5238
5250
  return __generator(this, function (_o) {
@@ -5253,7 +5265,8 @@
5253
5265
  FIELD_PROPERTIES.capture.cameraConfig,
5254
5266
  fieldcameraConfig
5255
5267
  ]);
5256
- if (!((_d = (_c = this.cameraConfig) === null || _c === void 0 ? void 0 : _c.others) === null || _d === void 0 ? void 0 : _d.isWatermark)) return [3 /*break*/, 3];
5268
+ if (!(((_d = (_c = this.cameraConfig) === null || _c === void 0 ? void 0 : _c.others) === null || _d === void 0 ? void 0 : _d.isWatermark) ||
5269
+ ((_f = (_e = this.cameraConfig) === null || _e === void 0 ? void 0 : _e.others) === null || _f === void 0 ? void 0 : _f.isWatermarkForImageUpload))) return [3 /*break*/, 3];
5257
5270
  cameraHelper = new CameraHelper(field, this.formFields, this.allFormsData, this.formData, this.previousFormData);
5258
5271
  _l = this;
5259
5272
  _m = {};
@@ -5290,9 +5303,10 @@
5290
5303
  KwikIDFormViewComponent.prototype.setCameraMedia = function (media) {
5291
5304
  return __awaiter(this, void 0, void 0, function () {
5292
5305
  var field, validations_4;
5306
+ var _k;
5293
5307
  var _this = this;
5294
- return __generator(this, function (_k) {
5295
- switch (_k.label) {
5308
+ return __generator(this, function (_l) {
5309
+ switch (_l.label) {
5296
5310
  case 0:
5297
5311
  field = getFormFieldByKey(this.formFields, this.cameraFieldKey);
5298
5312
  if (!(kwikidToolkit.checkObjectKeyExists(field, "properties") &&
@@ -5300,17 +5314,25 @@
5300
5314
  field.properties.uploadFileToServer)) return [3 /*break*/, 2];
5301
5315
  return [4 /*yield*/, this.uploadFile(field, media)];
5302
5316
  case 1:
5303
- _k.sent();
5317
+ _l.sent();
5304
5318
  return [3 /*break*/, 3];
5305
5319
  case 2:
5306
5320
  this.resetCamera();
5321
+ this.formData[field.key] = kwikidToolkit.getObjectDeepCopy([media]);
5307
5322
  this.mediaFiles[field.key] = kwikidToolkit.getObjectDeepCopy([media]);
5308
- this.formGroup.controls[field.key].setValue(kwikidToolkit.getObjectDeepCopy([media]), {
5309
- emitEvent: false
5323
+ this.formGroup.controls[field.key].patchValue(kwikidToolkit.getObjectDeepCopy([media]), {
5324
+ emitEvent: false,
5325
+ onlySelf: false
5310
5326
  });
5327
+ this.formGroup.patchValue((_k = {},
5328
+ _k[field.key] = kwikidToolkit.getObjectDeepCopy([media]),
5329
+ _k), { emitEvent: false });
5311
5330
  this.formGroup.controls[field.key].updateValueAndValidity({
5312
5331
  emitEvent: false
5313
5332
  });
5333
+ this.formGroup.updateValueAndValidity({
5334
+ emitEvent: false
5335
+ });
5314
5336
  this.getUnsavedDataState.emit(true);
5315
5337
  if (field.isFormElement &&
5316
5338
  kwikidToolkit.checkObjectKeyExists(field, "validation") &&
@@ -5341,7 +5363,7 @@
5341
5363
  value: this.formGroup.controls[field.key].value
5342
5364
  }, "ON_CHANGE");
5343
5365
  }
5344
- _k.label = 3;
5366
+ _l.label = 3;
5345
5367
  case 3: return [2 /*return*/];
5346
5368
  }
5347
5369
  });