ng-easycommerce 0.0.380 → 0.0.381

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/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Ultimas Modificaciones
2
2
 
3
+ ### version: 0.0.381
4
+
5
+ - Se realizaron mejoras sobre componente de newsletters para enviar otros atributos al backoffice.
6
+
7
+ - Se unifican versiones 0.0.377 - 0.0.380
8
+
3
9
  ### version: 0.0.380 - (Para pruebas)
4
10
 
5
11
  - Mejoras solicitadas en GTM, aplica a otras matricas.
@@ -5274,6 +5274,7 @@
5274
5274
  _this.sendValue('body') && formData.append('body', _this.contact_form.get('body').value);
5275
5275
  _this.sendValue('attachments') && formData.append('attachment', _this.contact_form.get('attachment').value);
5276
5276
  _this.blocksService.sendResponse(formData).toPromise().then(function (res) {
5277
+ _this.contact_form.reset();
5277
5278
  _this.toastrService.show(_this.success_message || success_message);
5278
5279
  _this.redirect && _this.router.navigateByUrl('/home');
5279
5280
  }, function (err) {
@@ -5308,17 +5309,6 @@
5308
5309
  return false;
5309
5310
  }
5310
5311
  };
5311
- _this.sendValues = function () {
5312
- return [
5313
- { name: 'name', type: 'text' },
5314
- { name: 'email', type: 'text' },
5315
- { name: 'telephone', type: 'text' },
5316
- { name: 'subject', type: 'text' },
5317
- { name: 'body', type: 'textarea' },
5318
- { name: 'attachments', type: 'file' },
5319
- { name: 'captcha', type: 'text' },
5320
- ];
5321
- };
5322
5312
  _this.contact_form = _this.formBuilder.group({
5323
5313
  name: ['', []],
5324
5314
  email: ['', forms.Validators.required],
@@ -5460,11 +5450,12 @@
5460
5450
  };
5461
5451
  var ContactFormNewsEcComponent = /** @class */ (function (_super) {
5462
5452
  __extends$c(ContactFormNewsEcComponent, _super);
5463
- function ContactFormNewsEcComponent(toastrService, router, consts, formBuilder, blocksService, env) {
5453
+ function ContactFormNewsEcComponent(toastrService, router, consts, paramsService, formBuilder, blocksService, env) {
5464
5454
  var _this = _super.call(this) || this;
5465
5455
  _this.toastrService = toastrService;
5466
5456
  _this.router = router;
5467
5457
  _this.consts = consts;
5458
+ _this.paramsService = paramsService;
5468
5459
  _this.formBuilder = formBuilder;
5469
5460
  _this.blocksService = blocksService;
5470
5461
  _this.env = env;
@@ -5475,12 +5466,17 @@
5475
5466
  _this.form_data = {};
5476
5467
  _this.sendForm = function (form, success_message) {
5477
5468
  if (form.valid && (form.value.email.includes('@'))) {
5478
- _this.form_data = __assign$f({}, form.value);
5479
- _this.form_data.mailText = form.value.body;
5480
- _this.form_data.form_code = _this.block.code;
5481
- _this.blocksService.sendResponse(_this.form_data).toPromise().then(function (res) {
5469
+ var formData = new FormData();
5470
+ formData.append('form_code', _this.block.code);
5471
+ _this.sendValue('name') && formData.append('name', form.get('name').value);
5472
+ _this.sendValue('email') && formData.append('email', form.get('email').value);
5473
+ _this.sendValue('telephone') && formData.append('telephone', form.get('telephone').value);
5474
+ _this.sendValue('subject') && formData.append('subject', form.get('subject').value);
5475
+ _this.sendValue('body') && formData.append('body', form.get('body').value);
5476
+ _this.sendValue('attachments') && formData.append('attachment', form.get('attachment').value);
5477
+ _this.blocksService.sendResponse(formData).toPromise().then(function (res) {
5478
+ _this.newsletter_form.reset();
5482
5479
  _this.toastrService.show(_this.success_message || success_message);
5483
- _this.router.navigateByUrl('/home');
5484
5480
  }, function (err) {
5485
5481
  _this.toastrService.show('inquiry-error');
5486
5482
  });
@@ -5489,6 +5485,8 @@
5489
5485
  _this.toastrService.show('invalid-form');
5490
5486
  }
5491
5487
  };
5488
+ _this.subscribeBlockNews = function (block) {
5489
+ };
5492
5490
  _this.setSubject = function () {
5493
5491
  _this.contact_form.setValue(__assign$f(__assign$f({}, _this.contact_form.value), { subject: _this.subject }));
5494
5492
  };
@@ -5499,20 +5497,24 @@
5499
5497
  e.preventDefault();
5500
5498
  _this.sendForm(_this.newsletter_form, 'newsletter-thanks');
5501
5499
  };
5502
- _this.toastCompleteForm = function (e) {
5503
- e.preventDefault();
5504
- _this.sendForm(_this.contact_form, 'inquiry-sent');
5500
+ _this.sendValue = function (key) {
5501
+ try {
5502
+ var keysearch = key[0].toUpperCase() + key.slice(1).toLowerCase();
5503
+ return _this.block['send' + keysearch];
5504
+ }
5505
+ catch (error) {
5506
+ console.error(error);
5507
+ return false;
5508
+ }
5505
5509
  };
5506
- _this.contact_form = _this.formBuilder.group({
5510
+ _this.newsletter_form = _this.formBuilder.group({
5507
5511
  name: ['', []],
5508
5512
  email: ['', forms.Validators.required],
5509
5513
  telephone: ['', []],
5510
5514
  subject: ['', []],
5511
5515
  body: ['', []],
5512
- captcha: ['', (_this.env.production ? forms.Validators.required : [])],
5513
- });
5514
- _this.newsletter_form = _this.formBuilder.group({
5515
- email: ['', forms.Validators.required],
5516
+ captcha: ['', []],
5517
+ terms: ['', forms.Validators.required],
5516
5518
  });
5517
5519
  _this.ecOnConstruct();
5518
5520
  return _this;
@@ -5529,6 +5531,7 @@
5529
5531
  _this.block = _this.block.contactForm;
5530
5532
  }
5531
5533
  _this.block = __assign$f(__assign$f({}, _this.block), _this.block.translations[_this.consts.getLocale()]);
5534
+ _this.subscribeBlockNews(_this.block);
5532
5535
  });
5533
5536
  }
5534
5537
  else {
@@ -5544,6 +5547,7 @@
5544
5547
  { type: ToastService },
5545
5548
  { type: router.Router },
5546
5549
  { type: Constants },
5550
+ { type: ParametersService },
5547
5551
  { type: forms.FormBuilder },
5548
5552
  { type: BlocksService },
5549
5553
  { type: undefined, decorators: [{ type: core.Inject, args: ['env',] }] }
@@ -5570,7 +5574,7 @@
5570
5574
  providers: [BlocksService],
5571
5575
  styles: [""]
5572
5576
  }),
5573
- __param$5(5, core.Inject('env'))
5577
+ __param$5(6, core.Inject('env'))
5574
5578
  ], ContactFormNewsEcComponent);
5575
5579
  return ContactFormNewsEcComponent;
5576
5580
  }(ComponentHelper));