@wizishop/img-manager 0.2.99 → 0.2.102

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.
Files changed (37) hide show
  1. package/assets/i18n/fr.json +1 -1
  2. package/bundles/wizishop-img-manager.umd.js +238 -195
  3. package/bundles/wizishop-img-manager.umd.js.map +1 -1
  4. package/bundles/wizishop-img-manager.umd.min.js +2 -2
  5. package/bundles/wizishop-img-manager.umd.min.js.map +1 -1
  6. package/esm2015/lib/components/canva-btn/canva-btn.component.js +7 -82
  7. package/esm2015/lib/components/images-view/images-view.component.js +2 -2
  8. package/esm2015/lib/components/img-editor/img-editor.component.js +2 -2
  9. package/esm2015/lib/components/img-upload/img-upload.component.js +23 -4
  10. package/esm2015/lib/components/pexels-lib/pexels-lib.component.js +5 -2
  11. package/esm2015/lib/components/upload-list/upload-list.component.js +2 -2
  12. package/esm2015/lib/services/canva.service.js +88 -5
  13. package/esm2015/lib/wz-img-manager.component.js +15 -1
  14. package/esm2015/wizishop-img-manager.js +4 -4
  15. package/esm5/lib/components/canva-btn/canva-btn.component.js +7 -88
  16. package/esm5/lib/components/images-view/images-view.component.js +2 -2
  17. package/esm5/lib/components/img-editor/img-editor.component.js +2 -2
  18. package/esm5/lib/components/img-upload/img-upload.component.js +23 -4
  19. package/esm5/lib/components/pexels-lib/pexels-lib.component.js +5 -2
  20. package/esm5/lib/components/upload-list/upload-list.component.js +2 -2
  21. package/esm5/lib/services/canva.service.js +94 -5
  22. package/esm5/lib/wz-img-manager.component.js +19 -1
  23. package/esm5/wizishop-img-manager.js +4 -4
  24. package/fesm2015/wizishop-img-manager.js +221 -182
  25. package/fesm2015/wizishop-img-manager.js.map +1 -1
  26. package/fesm5/wizishop-img-manager.js +236 -193
  27. package/fesm5/wizishop-img-manager.js.map +1 -1
  28. package/lib/components/canva-btn/canva-btn.component.d.ts +2 -19
  29. package/lib/components/img-upload/img-upload.component.d.ts +3 -0
  30. package/lib/services/canva.service.d.ts +20 -1
  31. package/lib/wz-img-manager.component.d.ts +2 -0
  32. package/package.json +1 -1
  33. package/wizishop-img-manager-0.2.102.tgz +0 -0
  34. package/wizishop-img-manager.d.ts +3 -3
  35. package/wizishop-img-manager.metadata.json +1 -1
  36. package/wz-img-manager.scss +2563 -2559
  37. package/wizishop-img-manager-0.2.99.tgz +0 -0
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common/http'), require('@angular/animations'), require('@ngx-translate/core'), require('@wizishop/ng-wizi-bulma'), require('rxjs/operators'), require('@angular/router'), require('@angular/common'), require('@angular/forms'), require('ngx-scrollbar'), require('ngx-scrollbar/reached-event'), require('ngx-image-cropper'), require('@angular/cdk/table'), require('@angular/cdk/drag-drop'), require('uuid'), require('ngx-perfect-scrollbar')) :
3
- typeof define === 'function' && define.amd ? define('@wizishop/img-manager', ['exports', '@angular/core', 'rxjs', '@angular/common/http', '@angular/animations', '@ngx-translate/core', '@wizishop/ng-wizi-bulma', 'rxjs/operators', '@angular/router', '@angular/common', '@angular/forms', 'ngx-scrollbar', 'ngx-scrollbar/reached-event', 'ngx-image-cropper', '@angular/cdk/table', '@angular/cdk/drag-drop', 'uuid', 'ngx-perfect-scrollbar'], factory) :
4
- (global = global || self, factory((global.wizishop = global.wizishop || {}, global.wizishop['img-manager'] = {}), global['^9']['0']['3'], global['~6']['5']['4'], global.ng.common.http, global['~9']['0']['3'], global['^13']['0']['0'], global['^9']['1']['4'], global.rxjs.operators, global.ng.router, global['^9']['0']['3'], global['~9']['0']['3'], global['^7']['2']['3'], global.reachedEvent, global['^3']['1']['9'], global.ng.cdk.table, global.ng.cdk['drag-drop'], global.uuid, global['^10']['1']['1']));
5
- }(this, (function (exports, core, rxjs, http, animations, core$1, ngWiziBulma, operators, router, common, forms, ngxScrollbar, reachedEvent, ngxImageCropper, table, dragDrop, uuid, ngxPerfectScrollbar) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common/http'), require('@ngx-translate/core'), require('@wizishop/ng-wizi-bulma'), require('rxjs/operators'), require('@angular/animations'), require('@angular/router'), require('@angular/common'), require('@angular/forms'), require('ngx-scrollbar'), require('ngx-scrollbar/reached-event'), require('ngx-image-cropper'), require('@angular/cdk/table'), require('@angular/cdk/drag-drop'), require('uuid'), require('ngx-perfect-scrollbar')) :
3
+ typeof define === 'function' && define.amd ? define('@wizishop/img-manager', ['exports', '@angular/core', 'rxjs', '@angular/common/http', '@ngx-translate/core', '@wizishop/ng-wizi-bulma', 'rxjs/operators', '@angular/animations', '@angular/router', '@angular/common', '@angular/forms', 'ngx-scrollbar', 'ngx-scrollbar/reached-event', 'ngx-image-cropper', '@angular/cdk/table', '@angular/cdk/drag-drop', 'uuid', 'ngx-perfect-scrollbar'], factory) :
4
+ (global = global || self, factory((global.wizishop = global.wizishop || {}, global.wizishop['img-manager'] = {}), global['^9']['0']['3'], global['~6']['5']['4'], global.ng.common.http, global['^13']['0']['0'], global['^9']['1']['4'], global.rxjs.operators, global['~9']['0']['3'], global.ng.router, global['^9']['0']['3'], global['~9']['0']['3'], global['^7']['2']['3'], global.reachedEvent, global['^3']['1']['9'], global.ng.cdk.table, global.ng.cdk['drag-drop'], global.uuid, global['^10']['1']['1']));
5
+ }(this, (function (exports, core, rxjs, http, core$1, ngWiziBulma, operators, animations, router, common, forms, ngxScrollbar, reachedEvent, ngxImageCropper, table, dragDrop, uuid, ngxPerfectScrollbar) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -603,9 +603,114 @@
603
603
  return UserSettingsService;
604
604
  }());
605
605
 
606
+ var AlertService = /** @class */ (function () {
607
+ function AlertService(nwbAlertService, translateService) {
608
+ this.nwbAlertService = nwbAlertService;
609
+ this.translateService = translateService;
610
+ this.actionMsg = 'ImgManager.alert.action';
611
+ this.alertConfig = {
612
+ message: '',
613
+ duration: 5000
614
+ };
615
+ }
616
+ AlertService.prototype.openAlert = function (msgKey) {
617
+ var _this = this;
618
+ this.closePreviousAlert();
619
+ this.translateService.get(msgKey).subscribe(function (trans) {
620
+ _this.alertConfig.message = trans;
621
+ _this.setAlertColor(msgKey);
622
+ _this.alertRefComponent = _this.nwbAlertService.open(_this.alertConfig);
623
+ _this.alertRefComponent.afterClosed().subscribe();
624
+ });
625
+ };
626
+ AlertService.prototype.openAlertWithBackendRespons = function (msgKey, msgBackend) {
627
+ var _this = this;
628
+ this.translateService.get(msgKey).subscribe(function (trans) {
629
+ _this.alertConfig.message = trans;
630
+ _this.alertConfig.message += '<br/>' + JSON.parse(msgBackend).message;
631
+ _this.closePreviousAlert();
632
+ _this.alertRefComponent = _this.nwbAlertService.open(_this.alertConfig);
633
+ _this.alertRefComponent.afterClosed().subscribe();
634
+ });
635
+ };
636
+ AlertService.prototype.closePreviousAlert = function () {
637
+ if (this.alertRefComponent) {
638
+ this.alertRefComponent.dismiss();
639
+ }
640
+ };
641
+ AlertService.prototype.setAlertColor = function (msgKey) {
642
+ var isErrorMsg = /error/i.test(msgKey);
643
+ this.alertConfig.color = isErrorMsg ? 'is-danger' : 'is-success';
644
+ };
645
+ AlertService.ctorParameters = function () { return [
646
+ { type: ngWiziBulma.NwbAlertService },
647
+ { type: core$1.TranslateService }
648
+ ]; };
649
+ AlertService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function AlertService_Factory() { return new AlertService(core["ɵɵinject"](ngWiziBulma.NwbAlertService), core["ɵɵinject"](core$1.TranslateService)); }, token: AlertService, providedIn: "root" });
650
+ AlertService = __decorate([
651
+ core.Injectable({
652
+ providedIn: 'root'
653
+ }),
654
+ __metadata("design:paramtypes", [ngWiziBulma.NwbAlertService,
655
+ core$1.TranslateService])
656
+ ], AlertService);
657
+ return AlertService;
658
+ }());
659
+
660
+ var ImgEventService = /** @class */ (function () {
661
+ function ImgEventService() {
662
+ this.imgToEditEvent = new rxjs.Subject();
663
+ this.imgRemoved = new rxjs.Subject();
664
+ this.imgAdded = new rxjs.Subject();
665
+ this.listDisplayedChange = new rxjs.Subject();
666
+ }
667
+ ImgEventService.prototype.emitImgRemoved = function (id_file) {
668
+ this.imgRemoved.next(id_file);
669
+ };
670
+ ImgEventService.prototype.getImgRemovedEventListner = function () {
671
+ return this.imgRemoved.asObservable();
672
+ };
673
+ ImgEventService.prototype.emitImgToEdit = function (imgToEdit) {
674
+ this.imgToEditEvent.next(imgToEdit);
675
+ };
676
+ ImgEventService.prototype.getImgToEditEventListner = function () {
677
+ return this.imgToEditEvent.asObservable();
678
+ };
679
+ ImgEventService.prototype.emitImgAdded = function (id_file) {
680
+ this.imgAdded.next(id_file);
681
+ };
682
+ ImgEventService.prototype.getImgAddedEventListner = function () {
683
+ return this.imgAdded.asObservable();
684
+ };
685
+ ImgEventService.prototype.emitlistDisplayedChange = function (value) {
686
+ this.listDisplayedChange.next(value);
687
+ };
688
+ ImgEventService.prototype.getlistDisplayedChange = function () {
689
+ return this.listDisplayedChange.asObservable();
690
+ };
691
+ ImgEventService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function ImgEventService_Factory() { return new ImgEventService(); }, token: ImgEventService, providedIn: "root" });
692
+ ImgEventService = __decorate([
693
+ core.Injectable({
694
+ providedIn: 'root'
695
+ }),
696
+ __metadata("design:paramtypes", [])
697
+ ], ImgEventService);
698
+ return ImgEventService;
699
+ }());
700
+
606
701
  var CanvaService = /** @class */ (function () {
607
- function CanvaService(externalConfigService) {
702
+ function CanvaService(externalConfigService, imgManager, wzImgEventService, alertService, translateService) {
608
703
  this.externalConfigService = externalConfigService;
704
+ this.imgManager = imgManager;
705
+ this.wzImgEventService = wzImgEventService;
706
+ this.alertService = alertService;
707
+ this.translateService = translateService;
708
+ this.imgLoading = false;
709
+ this.uploadingImg = 'ImgManager.CanvaBtn.uploadingImg';
710
+ this.successUploadPhoto = 'ImgManager.CanvaBtn.successImport';
711
+ this.errorUploadCanvaImg = 'ImgManager.CanvaBtn.errorUploadCanvaImg';
712
+ this.errorRenameCanvaImg = 'ImgManager.CanvaBtn.errorRenameCanvaImg';
713
+ this.forceToOpenCanva = false;
609
714
  this.bindExpectedImgSizeEvent = new rxjs.BehaviorSubject(null);
610
715
  this.bindExpectedSizeDone = this.bindExpectedImgSizeEvent.asObservable();
611
716
  }
@@ -621,6 +726,9 @@
621
726
  };
622
727
  CanvaService.prototype.expectedImgSizesChange = function (mediaDTO) {
623
728
  this.bindExpectedImgSizeEvent.next(mediaDTO);
729
+ if (this.forceToOpenCanva) {
730
+ this.openCanva(parseInt(mediaDTO.image_width), parseInt(mediaDTO.image_height));
731
+ }
624
732
  };
625
733
  CanvaService.prototype.getCanvaApi = function () {
626
734
  var _this = this;
@@ -675,58 +783,84 @@
675
783
  };
676
784
  document.getElementsByTagName('head')[0].appendChild(node);
677
785
  };
678
- CanvaService.ctorParameters = function () { return [
679
- { type: ImgManagerConfigService }
680
- ]; };
681
- CanvaService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function CanvaService_Factory() { return new CanvaService(core["ɵɵinject"](ImgManagerConfigService)); }, token: CanvaService, providedIn: "root" });
682
- CanvaService = __decorate([
683
- core.Injectable({
684
- providedIn: 'root'
685
- }),
686
- __metadata("design:paramtypes", [ImgManagerConfigService])
687
- ], CanvaService);
688
- return CanvaService;
689
- }());
690
-
691
- var ImgEventService = /** @class */ (function () {
692
- function ImgEventService() {
693
- this.imgToEditEvent = new rxjs.Subject();
694
- this.imgRemoved = new rxjs.Subject();
695
- this.imgAdded = new rxjs.Subject();
696
- this.listDisplayedChange = new rxjs.Subject();
697
- }
698
- ImgEventService.prototype.emitImgRemoved = function (id_file) {
699
- this.imgRemoved.next(id_file);
700
- };
701
- ImgEventService.prototype.getImgRemovedEventListner = function () {
702
- return this.imgRemoved.asObservable();
703
- };
704
- ImgEventService.prototype.emitImgToEdit = function (imgToEdit) {
705
- this.imgToEditEvent.next(imgToEdit);
706
- };
707
- ImgEventService.prototype.getImgToEditEventListner = function () {
708
- return this.imgToEditEvent.asObservable();
786
+ CanvaService.prototype.openCanva = function (width, height) {
787
+ var _this = this;
788
+ if (this.imgLoading) {
789
+ return;
790
+ }
791
+ this.getCanvaApi().pipe(operators.take(1)).subscribe(function (api) {
792
+ _this.canvaApi = api;
793
+ _this.addOverflowBody();
794
+ _this.createDesign(width, height);
795
+ });
709
796
  };
710
- ImgEventService.prototype.emitImgAdded = function (id_file) {
711
- this.imgAdded.next(id_file);
797
+ CanvaService.prototype.addOverflowBody = function () {
798
+ document.body.classList.add('ovh-canva');
712
799
  };
713
- ImgEventService.prototype.getImgAddedEventListner = function () {
714
- return this.imgAdded.asObservable();
800
+ CanvaService.prototype.removeOverflowBody = function () {
801
+ document.body.classList.remove('ovh-canva');
715
802
  };
716
- ImgEventService.prototype.emitlistDisplayedChange = function (value) {
717
- this.listDisplayedChange.next(value);
803
+ CanvaService.prototype.createDesign = function (width, height) {
804
+ var _this = this;
805
+ var createDesign = {
806
+ type: 'EtsyShopIcon',
807
+ dimensions: {
808
+ units: 'px',
809
+ width: width ? width : undefined,
810
+ height: height ? height : undefined,
811
+ },
812
+ publishLabel: this.translateService.instant('ImgManager.CanvaBtn.publish'),
813
+ };
814
+ this.canvaApi.createDesign({
815
+ design: createDesign,
816
+ onDesignPublish: function (_a) {
817
+ var exportUrl = _a.exportUrl, designTitle = _a.designTitle;
818
+ return _this.designPublished(exportUrl, designTitle);
819
+ },
820
+ onDesignClose: function () {
821
+ _this.removeOverflowBody();
822
+ }
823
+ });
718
824
  };
719
- ImgEventService.prototype.getlistDisplayedChange = function () {
720
- return this.listDisplayedChange.asObservable();
825
+ CanvaService.prototype.designPublished = function (exportUrl, designTitle) {
826
+ var _this = this;
827
+ this.alertService.openAlert(this.uploadingImg);
828
+ this.imgLoading = true;
829
+ this.imgManager.uploadFileByUrl(exportUrl, designTitle).pipe(operators.take(1)).subscribe(function (img) {
830
+ _this.imgLoading = false;
831
+ _this.removeOverflowBody();
832
+ _this.wzImgEventService.emitImgAdded(img.id_file);
833
+ _this.alertService.openAlert(_this.successUploadPhoto);
834
+ }, function (error) {
835
+ _this.imgLoading = false;
836
+ _this.removeOverflowBody();
837
+ if (error.error.code === 406 && error.error.message) {
838
+ _this.alertService.openAlertWithBackendRespons(_this.errorUploadCanvaImg, error.error.message);
839
+ }
840
+ else {
841
+ _this.alertService.openAlert(_this.errorUploadCanvaImg);
842
+ }
843
+ });
721
844
  };
722
- ImgEventService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function ImgEventService_Factory() { return new ImgEventService(); }, token: ImgEventService, providedIn: "root" });
723
- ImgEventService = __decorate([
845
+ CanvaService.ctorParameters = function () { return [
846
+ { type: ImgManagerConfigService },
847
+ { type: ImgManagerService },
848
+ { type: ImgEventService },
849
+ { type: AlertService },
850
+ { type: core$1.TranslateService }
851
+ ]; };
852
+ CanvaService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function CanvaService_Factory() { return new CanvaService(core["ɵɵinject"](ImgManagerConfigService), core["ɵɵinject"](ImgManagerService), core["ɵɵinject"](ImgEventService), core["ɵɵinject"](AlertService), core["ɵɵinject"](core$1.TranslateService)); }, token: CanvaService, providedIn: "root" });
853
+ CanvaService = __decorate([
724
854
  core.Injectable({
725
855
  providedIn: 'root'
726
856
  }),
727
- __metadata("design:paramtypes", [])
728
- ], ImgEventService);
729
- return ImgEventService;
857
+ __metadata("design:paramtypes", [ImgManagerConfigService,
858
+ ImgManagerService,
859
+ ImgEventService,
860
+ AlertService,
861
+ core$1.TranslateService])
862
+ ], CanvaService);
863
+ return CanvaService;
730
864
  }());
731
865
 
732
866
  var DomService = /** @class */ (function () {
@@ -779,6 +913,19 @@
779
913
  this.listDisplayed = false;
780
914
  this.hideTab = false;
781
915
  }
916
+ Object.defineProperty(WzImgManagerComponent.prototype, "forceToOpenCanva", {
917
+ // If forceToOpenCanva is true : Canva will open with the canvaService.expectedImgSizesChange
918
+ // If forceToOpenCanva is a WiziBlockMediaDto, Canva open immediatly
919
+ set: function (forceToOpenCanva) {
920
+ this.canvaService.forceToOpenCanva = !!forceToOpenCanva;
921
+ if (typeof forceToOpenCanva === 'boolean') {
922
+ return;
923
+ }
924
+ this.canvaService.expectedImgSizesChange(forceToOpenCanva);
925
+ },
926
+ enumerable: true,
927
+ configurable: true
928
+ });
782
929
  Object.defineProperty(WzImgManagerComponent.prototype, "multipleImgMode", {
783
930
  get: function () {
784
931
  return this._multipleImgMode;
@@ -927,6 +1074,11 @@
927
1074
  core.Input(),
928
1075
  __metadata("design:type", ImgManagerConfigDto)
929
1076
  ], WzImgManagerComponent.prototype, "externalConfig", void 0);
1077
+ __decorate([
1078
+ core.Input(),
1079
+ __metadata("design:type", Object),
1080
+ __metadata("design:paramtypes", [Object])
1081
+ ], WzImgManagerComponent.prototype, "forceToOpenCanva", null);
930
1082
  __decorate([
931
1083
  core.Output(),
932
1084
  __metadata("design:type", Object)
@@ -973,60 +1125,6 @@
973
1125
  ]),
974
1126
  ]);
975
1127
 
976
- var AlertService = /** @class */ (function () {
977
- function AlertService(nwbAlertService, translateService) {
978
- this.nwbAlertService = nwbAlertService;
979
- this.translateService = translateService;
980
- this.actionMsg = 'ImgManager.alert.action';
981
- this.alertConfig = {
982
- message: '',
983
- duration: 5000
984
- };
985
- }
986
- AlertService.prototype.openAlert = function (msgKey) {
987
- var _this = this;
988
- this.closePreviousAlert();
989
- this.translateService.get(msgKey).subscribe(function (trans) {
990
- _this.alertConfig.message = trans;
991
- _this.setAlertColor(msgKey);
992
- _this.alertRefComponent = _this.nwbAlertService.open(_this.alertConfig);
993
- _this.alertRefComponent.afterClosed().subscribe();
994
- });
995
- };
996
- AlertService.prototype.openAlertWithBackendRespons = function (msgKey, msgBackend) {
997
- var _this = this;
998
- this.translateService.get(msgKey).subscribe(function (trans) {
999
- _this.alertConfig.message = trans;
1000
- _this.alertConfig.message += '<br/>' + JSON.parse(msgBackend).message;
1001
- _this.closePreviousAlert();
1002
- _this.alertRefComponent = _this.nwbAlertService.open(_this.alertConfig);
1003
- _this.alertRefComponent.afterClosed().subscribe();
1004
- });
1005
- };
1006
- AlertService.prototype.closePreviousAlert = function () {
1007
- if (this.alertRefComponent) {
1008
- this.alertRefComponent.dismiss();
1009
- }
1010
- };
1011
- AlertService.prototype.setAlertColor = function (msgKey) {
1012
- var isErrorMsg = /error/i.test(msgKey);
1013
- this.alertConfig.color = isErrorMsg ? 'is-danger' : 'is-success';
1014
- };
1015
- AlertService.ctorParameters = function () { return [
1016
- { type: ngWiziBulma.NwbAlertService },
1017
- { type: core$1.TranslateService }
1018
- ]; };
1019
- AlertService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function AlertService_Factory() { return new AlertService(core["ɵɵinject"](ngWiziBulma.NwbAlertService), core["ɵɵinject"](core$1.TranslateService)); }, token: AlertService, providedIn: "root" });
1020
- AlertService = __decorate([
1021
- core.Injectable({
1022
- providedIn: 'root'
1023
- }),
1024
- __metadata("design:paramtypes", [ngWiziBulma.NwbAlertService,
1025
- core$1.TranslateService])
1026
- ], AlertService);
1027
- return AlertService;
1028
- }());
1029
-
1030
1128
  var ImgUploadComponent = /** @class */ (function () {
1031
1129
  function ImgUploadComponent(imgManager, alertService, externalConfigService) {
1032
1130
  this.imgManager = imgManager;
@@ -1038,6 +1136,7 @@
1038
1136
  this.loadingText = 'ImgManager.ImgUpload.loading';
1039
1137
  this.errorUploadingImg = 'ImgManager.ImgUpload.errorUploadingImg';
1040
1138
  this.errorNotImg = 'ImgManager.ImgUpload.errorNotImg';
1139
+ this.MAX_IMAGE_SIZE = 10000000; // In bytes
1041
1140
  }
1042
1141
  ImgUploadComponent.prototype.ngOnInit = function () {
1043
1142
  this.assetsIcon = this.getAssets();
@@ -1063,13 +1162,19 @@
1063
1162
  try {
1064
1163
  for (var files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
1065
1164
  var file = files_1_1.value;
1066
- var formData = new FormData();
1067
- formData.append('image', file, file.name);
1165
+ console.log('file', file.size);
1068
1166
  if (!this.isFileImage(file.type)) {
1069
1167
  this.alertService.openAlert(this.errorNotImg);
1070
1168
  this.isLoading = false;
1071
1169
  continue;
1072
1170
  }
1171
+ if (!this.isSizeValid(file.size)) {
1172
+ this.alertService.openAlert("L'image : " + file.name + " est trop grande (" + this.getImageSizeInKo(file.size) + "ko). Taille maximum accept\u00E9e: " + this.getImageSizeInKo(this.MAX_IMAGE_SIZE) + "ko");
1173
+ this.isLoading = false;
1174
+ continue;
1175
+ }
1176
+ var formData = new FormData();
1177
+ formData.append('image', file, file.name);
1073
1178
  imgToUploadList.push(this.imgManager.uploadFile(formData));
1074
1179
  }
1075
1180
  }
@@ -1084,7 +1189,13 @@
1084
1189
  _this.onImgUpload(img),
1085
1190
  _this.isLoading = false;
1086
1191
  }, function (error) {
1087
- _this.alertService.openAlert(_this.errorUploadingImg);
1192
+ var _a, _b;
1193
+ if (((_b = (_a = error) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.message) && error.statusText !== 'Bad Request') {
1194
+ _this.alertService.openAlertWithBackendRespons(_this.errorUploadingImg, error.error.message);
1195
+ }
1196
+ else {
1197
+ _this.alertService.openAlert(_this.errorUploadingImg);
1198
+ }
1088
1199
  _this.isLoading = false;
1089
1200
  });
1090
1201
  };
@@ -1099,6 +1210,12 @@
1099
1210
  ImgUploadComponent.prototype.isFileImage = function (fileType) {
1100
1211
  return fileType.split('/')[0] === 'image';
1101
1212
  };
1213
+ ImgUploadComponent.prototype.isSizeValid = function (imageBytesSize) {
1214
+ return imageBytesSize < this.MAX_IMAGE_SIZE;
1215
+ };
1216
+ ImgUploadComponent.prototype.getImageSizeInKo = function (size) {
1217
+ return Math.round(size / 1024);
1218
+ };
1102
1219
  /**
1103
1220
  * Remove the style of the drag and drop box
1104
1221
  * After an img is droped, the box is still grey
@@ -1302,7 +1419,7 @@
1302
1419
  UploadListComponent = __decorate([
1303
1420
  core.Component({
1304
1421
  selector: 'upload-list',
1305
- template: "<div class=\"upload-list\" [ngClass]=\"{'smallDisplay': stateDisplayed === 'small'}\" [@easeInOut]=\"'in'\">\n\n <ng-scrollbar\n #scrollable\n [visibility]=\"'native'\"\n class=\"upload-list__scroll\"\n [ngClass]=\"{\n 'upload-list__scroll--smallDisplay': stateDisplayed === 'small',\n 'upload-list__scroll--window': stateDisplayed === 'window'}\"\n >\n <div class=\"upload-list__box\">\n <div class=\"upload-list__box__container\">\n <div>\n <p class=\"mainColor\">\n {{ picturesList? picturesList.length : '' }}\n <ng-container *ngIf=\"picturesList && picturesList.length > 1\">{{ 'ImgManager.UploadList.imgSuccessImport' | translate }}</ng-container>\n <ng-container *ngIf=\"picturesList && picturesList.length === 1\">{{ 'ImgManager.UploadList.imgSuccessImportOne' | translate }}</ng-container>\n </p>\n <div class=\"dropdown is-hoverable\">\n <div class=\"dropdown-trigger\">\n <i\n aria-haspopup=\"true\" aria-controls=\"dropdown-menuInfoSeo\"\n class=\"fas fa-info-circle\">\n </i>\n </div>\n <div class=\"dropdown-menu dropDownShadow\" id=\"dropdown-menuInfoSeo\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.rezise' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.webp' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.cdn' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.lazyloading' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"upload-list__box__cards\">\n <div class=\"upload-list__box__cards__card\" *ngFor=\"let picture of picturesList; let index = index;\">\n <img-card\n [picture]=\"picture\"\n [stateDisplayed]=\"stateDisplayed\"\n (toggleImgSelected)=\"onToggleSelectImg(index)\"\n (switchDisplayWindow)=\"switchDisplayWindowCard()\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n ></img-card>\n <div class=\"upload-list__box__cards__card__btnBox\">\n <button class=\"button success upload-list__box__cards__card__btnBox__btn\"><i class=\"fal fa-check\"></i></button>\n </div>\n </div>\n </div>\n </div>\n </ng-scrollbar>\n</div>\n",
1422
+ template: "<div class=\"upload-list\" [ngClass]=\"{'smallDisplay': stateDisplayed === 'small'}\" [@easeInOut]=\"'in'\">\n\n <perfect-scrollbar\n #scrollable\n class=\"upload-list__scroll\"\n [ngClass]=\"{\n 'upload-list__scroll--smallDisplay': stateDisplayed === 'small',\n 'upload-list__scroll--window': stateDisplayed === 'window'}\"\n >\n <div class=\"upload-list__box\">\n <div class=\"upload-list__box__container\">\n <div>\n <p class=\"mainColor\">\n {{ picturesList? picturesList.length : '' }}\n <ng-container *ngIf=\"picturesList && picturesList.length > 1\">{{ 'ImgManager.UploadList.imgSuccessImport' | translate }}</ng-container>\n <ng-container *ngIf=\"picturesList && picturesList.length === 1\">{{ 'ImgManager.UploadList.imgSuccessImportOne' | translate }}</ng-container>\n </p>\n <div class=\"dropdown is-hoverable\">\n <div class=\"dropdown-trigger\">\n <i\n aria-haspopup=\"true\" aria-controls=\"dropdown-menuInfoSeo\"\n class=\"fas fa-info-circle\">\n </i>\n </div>\n <div class=\"dropdown-menu dropDownShadow\" id=\"dropdown-menuInfoSeo\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.rezise' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.webp' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.cdn' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.lazyloading' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"upload-list__box__cards\">\n <div class=\"upload-list__box__cards__card\" *ngFor=\"let picture of picturesList; let index = index;\">\n <img-card\n [picture]=\"picture\"\n [stateDisplayed]=\"stateDisplayed\"\n (toggleImgSelected)=\"onToggleSelectImg(index)\"\n (switchDisplayWindow)=\"switchDisplayWindowCard()\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n ></img-card>\n <div class=\"upload-list__box__cards__card__btnBox\">\n <button class=\"button success upload-list__box__cards__card__btnBox__btn\"><i class=\"fal fa-check\"></i></button>\n </div>\n </div>\n </div>\n </div>\n </perfect-scrollbar>\n</div>\n",
1306
1423
  animations: [
1307
1424
  easeInOut
1308
1425
  ]
@@ -1645,6 +1762,7 @@
1645
1762
  };
1646
1763
  PexelLibComponent.prototype.search = function () {
1647
1764
  var _this = this;
1765
+ console.log('search');
1648
1766
  if (this.isLoading) {
1649
1767
  return;
1650
1768
  }
@@ -1657,6 +1775,8 @@
1657
1775
  }
1658
1776
  this.isLoading = true;
1659
1777
  var searchSub = this.wzImgLibService.searchOnPexels(this.searchValue, this.perPage, this.currentPage).subscribe(function (data) {
1778
+ console.log('search ended here');
1779
+ console.log(data);
1660
1780
  _this.wzImgLibDto = data;
1661
1781
  _this.nbResult = _this.wzImgLibDto.total_results;
1662
1782
  if (_this.nbResult) {
@@ -1771,7 +1891,7 @@
1771
1891
  PexelLibComponent = __decorate([
1772
1892
  core.Component({
1773
1893
  selector: 'pexels-lib',
1774
- template: "<div class=\"pexels-lib\" #outerElement [@easeInOut]=\"'in'\">\n <ng-scrollbar\n #scrollable\n reachedOffset=\"50\"\n [visibility]=\"'hover'\"\n class=\"pexels-lib__scroll\"\n [ngClass]=\"{'pexels-lib__scroll--smallDisplay': stateDisplayed === 'small'}\"\n (reachedBottom)=\"onBottomReached()\"\n >\n <div\n *ngIf=\"!disableSearch\"\n class=\"pexels-lib__search\"\n [ngClass]=\"{'pexels-lib__search--smallDisplay': stateDisplayed === 'small'}\"\n >\n <wz-input-search\n [(ngModel)]=\"searchValue\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n (changeDebounced)=\"onSearchNameChanged()\"\n [smallPadding]=\"stateDisplayed === 'small'\">\n </wz-input-search>\n </div>\n\n <div *ngIf=\"!initComponent\" class=\"pexels-lib__wrapper\">\n <p *ngIf=\"nbResult\" class=\"pexels-lib__wrapper__result-nb\">{{ 'ImgManager.PexelLib.nbImgFound' | translate }} : {{ nbResult }}</p>\n\n <div class=\"pexels-lib__wrapper__result\">\n\n <div *ngFor=\"let photosColumn of photosColumns; let indexCol = index;\" class=\"pexels-lib__wrapper__result__column\" [@listAnimation]=\"photosColumn.photos.length\">\n <div *ngFor=\"let photo of photosColumn.photos; let indexPhoto = index;\" class=\"pexels-lib__wrapper__result__column__element\">\n\n <img [alt]=\"photo.src.medium\" [src]=\"photo.src.medium\"\n class=\"pexels-lib__wrapper__result__column__element__img\"/>\n\n <div class=\"pexels-lib__wrapper__result__column__element__wrapper\">\n <span class=\"pexels-lib__wrapper__result__column__element__wrapper__infos\">\n {{ photo.width }} x {{ photo.height}}\n </span>\n\n <div class=\"dropdown is-up\" [ngClass]=\"{'is-hoverable': !photo.uploading}\">\n <div class=\"dropdown-trigger\">\n <button\n class=\"button pexels-lib__wrapper__result__column__element__wrapper__button\"\n aria-haspopup=\"true\"\n aria-controls=\"dropdown-menu\">\n\n <div *ngIf=\"!photo.uploading\" (click)=\"uploadPhoto(photo, photo.src.large2x)\">\n <span>{{ 'ImgManager.PexelLib.import' | translate }}</span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-up\" aria-hidden=\"true\"></i>\n </span>\n <ng-container *ngIf=\"photo.uploaded\">\n &nbsp;<i class=\"fal fa-check\"></i>\n </ng-container>\n </div>\n\n <ng-container *ngIf=\"photo.uploading\">\n {{ 'ImgManager.PexelLib.importation' | translate }}\n <span btnLoadingAnim class=\"btnLoadingAnnimation\"></span>\n </ng-container>\n\n </button>\n </div>\n <div class=\"dropdown-menu pexels-lib__wrapper__result__column__element__wrapper__dropdown\" id=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div class=\"dropdown-content__wrapper\">\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.portrait)\">\n <p>{{ 'ImgManager.PexelLib.portrait' | translate }}</p>\n <i class=\"fal fa-check iPortrait\"></i>\n </div>\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.landscape)\">\n <p>{{ 'ImgManager.PexelLib.landscape' | translate }}</p>\n <i class=\"fal fa-check iLandscape\"></i>\n </div>\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.large2x)\">\n <p>{{ 'ImgManager.PexelLib.original' | translate }}</p>\n <i class=\"fal fa-check iOriginal\"></i>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"isLoading\">\n <wz-loader></wz-loader>\n </ng-container>\n <div\n *ngIf=\"!isLoading && !nbResult\"\n class=\"pexels-lib__alert\"\n [@easeInOut]=\"'in'\">\n <wz-alert [warning]=\"true\">\n {{ 'ImgManager.PexelLib.noResult' | translate }}\n </wz-alert>\n </div>\n\n </ng-scrollbar>\n</div>\n",
1894
+ template: "<div class=\"pexels-lib\" #outerElement [@easeInOut]=\"'in'\">\n <perfect-scrollbar\n scrollYMarginOffset=\"300\"\n class=\"pexels-lib__scroll\"\n [ngClass]=\"{'pexels-lib__scroll--smallDisplay': stateDisplayed === 'small'}\"\n (psYReachEnd)=\"onBottomReached()\"\n >\n <div\n *ngIf=\"!disableSearch\"\n class=\"pexels-lib__search\"\n [ngClass]=\"{'pexels-lib__search--smallDisplay': stateDisplayed === 'small'}\"\n >\n <wz-input-search\n [(ngModel)]=\"searchValue\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n (changeDebounced)=\"onSearchNameChanged()\"\n [smallPadding]=\"stateDisplayed === 'small'\">\n </wz-input-search>\n </div>\n\n <div *ngIf=\"!initComponent\" class=\"pexels-lib__wrapper\">\n <p *ngIf=\"nbResult\" class=\"pexels-lib__wrapper__result-nb\">{{ 'ImgManager.PexelLib.nbImgFound' | translate }} : {{ nbResult }}</p>\n\n <div class=\"pexels-lib__wrapper__result\">\n\n <div *ngFor=\"let photosColumn of photosColumns; let indexCol = index;\" class=\"pexels-lib__wrapper__result__column\" [@listAnimation]=\"photosColumn.photos.length\">\n <div *ngFor=\"let photo of photosColumn.photos; let indexPhoto = index;\" class=\"pexels-lib__wrapper__result__column__element\">\n\n <img [alt]=\"photo.src.medium\" [src]=\"photo.src.medium\"\n class=\"pexels-lib__wrapper__result__column__element__img\"/>\n\n <div class=\"pexels-lib__wrapper__result__column__element__wrapper\">\n <span class=\"pexels-lib__wrapper__result__column__element__wrapper__infos\">\n {{ photo.width }} x {{ photo.height}}\n </span>\n\n <div class=\"dropdown is-up\" [ngClass]=\"{'is-hoverable': !photo.uploading}\">\n <div class=\"dropdown-trigger\">\n <button\n class=\"button pexels-lib__wrapper__result__column__element__wrapper__button\"\n aria-haspopup=\"true\"\n aria-controls=\"dropdown-menu\">\n\n <div *ngIf=\"!photo.uploading\" (click)=\"uploadPhoto(photo, photo.src.large2x)\">\n <span>{{ 'ImgManager.PexelLib.import' | translate }}</span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-up\" aria-hidden=\"true\"></i>\n </span>\n <ng-container *ngIf=\"photo.uploaded\">\n &nbsp;<i class=\"fal fa-check\"></i>\n </ng-container>\n </div>\n\n <ng-container *ngIf=\"photo.uploading\">\n {{ 'ImgManager.PexelLib.importation' | translate }}\n <span btnLoadingAnim class=\"btnLoadingAnnimation\"></span>\n </ng-container>\n\n </button>\n </div>\n <div class=\"dropdown-menu pexels-lib__wrapper__result__column__element__wrapper__dropdown\" id=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div class=\"dropdown-content__wrapper\">\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.portrait)\">\n <p>{{ 'ImgManager.PexelLib.portrait' | translate }}</p>\n <i class=\"fal fa-check iPortrait\"></i>\n </div>\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.landscape)\">\n <p>{{ 'ImgManager.PexelLib.landscape' | translate }}</p>\n <i class=\"fal fa-check iLandscape\"></i>\n </div>\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.large2x)\">\n <p>{{ 'ImgManager.PexelLib.original' | translate }}</p>\n <i class=\"fal fa-check iOriginal\"></i>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"isLoading\">\n <wz-loader></wz-loader>\n </ng-container>\n <div\n *ngIf=\"!isLoading && !nbResult\"\n class=\"pexels-lib__alert\"\n [@easeInOut]=\"'in'\">\n <wz-alert [warning]=\"true\">\n {{ 'ImgManager.PexelLib.noResult' | translate }}\n </wz-alert>\n </div>\n\n </perfect-scrollbar>\n</div>\n",
1775
1895
  animations: [
1776
1896
  easeInOut,
1777
1897
  listAnnimation
@@ -2130,7 +2250,7 @@
2130
2250
  ImgEditorComponent = __decorate([
2131
2251
  core.Component({
2132
2252
  selector: 'img-editor',
2133
- template: "<div class=\"img-editor\" [@easeInOut]=\"'in'\">\n\n <ng-scrollbar\n #scrollable\n [visibility]=\"'native'\"\n class=\"img-editor__scroll\"\n [ngClass]=\"{\n 'img-editor__scroll--full': stateDisplayed === 'full',\n 'img-editor__scroll--smallDisplay': stateDisplayed === 'small',\n 'img-editor__scroll--window': stateDisplayed === 'window'\n }\"\n >\n <div class=\"columns\">\n <!-- Left section -->\n <div class=\"column is-one-third img-editor__infoSection\">\n\n <info-section\n [imgToEdit]=\"imgToEdit\"\n [(isNameModified)]=\"isNameModified\"\n >\n </info-section>\n\n <!-- Button Action Section -->\n\n <div class=\"img-editor__infoSection__actions\">\n <div>\n <button\n class=\"button img-editor__infoSection__actions__cancel\"\n (click)=\"onCancel()\"\n [disabled]=\"isLoading || (!isImgModified && !isNameModified)\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <div\n class=\"button danger button img-editor__infoSection__actions__save\"\n [ngClass]=\"{'img-editor__infoSection__actions__save--disable': isLoading}\"\n (click)=\"onSave()\"\n >\n {{ 'ImgManager.ImgEditor.saveBtn' | translate }}\n <span btnLoadingAnim *ngIf=\"isLoading\" class=\"btnLoadingAnnimation\"></span>\n </div>\n\n </div>\n </div>\n </div>\n\n\n <!-- Right section -->\n <div class=\"column img-editor__container\">\n <cropper\n [imgToEdit]=\"imgToEdit\"\n [(isImgModified)]=\"isImgModified\"\n (currentCroppedImageChange)=\"onImgCropped($event)\"\n (editClosed)=\"onEditClosed($event)\">\n </cropper>\n </div>\n </div>\n </ng-scrollbar>\n</div>\n",
2253
+ template: "<div class=\"img-editor\" [@easeInOut]=\"'in'\">\n\n <perfect-scrollbar\n class=\"img-editor__scroll\"\n [ngClass]=\"{\n 'img-editor__scroll--full': stateDisplayed === 'full',\n 'img-editor__scroll--smallDisplay': stateDisplayed === 'small',\n 'img-editor__scroll--window': stateDisplayed === 'window'\n }\"\n >\n <div class=\"columns\">\n <!-- Left section -->\n <div class=\"column is-one-third img-editor__infoSection\">\n\n <info-section\n [imgToEdit]=\"imgToEdit\"\n [(isNameModified)]=\"isNameModified\"\n >\n </info-section>\n\n <!-- Button Action Section -->\n\n <div class=\"img-editor__infoSection__actions\">\n <div>\n <button\n class=\"button img-editor__infoSection__actions__cancel\"\n (click)=\"onCancel()\"\n [disabled]=\"isLoading || (!isImgModified && !isNameModified)\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <div\n class=\"button danger button img-editor__infoSection__actions__save\"\n [ngClass]=\"{'img-editor__infoSection__actions__save--disable': isLoading}\"\n (click)=\"onSave()\"\n >\n {{ 'ImgManager.ImgEditor.saveBtn' | translate }}\n <span btnLoadingAnim *ngIf=\"isLoading\" class=\"btnLoadingAnnimation\"></span>\n </div>\n\n </div>\n </div>\n </div>\n\n\n <!-- Right section -->\n <div class=\"column img-editor__container\">\n <cropper\n [imgToEdit]=\"imgToEdit\"\n [(isImgModified)]=\"isImgModified\"\n (currentCroppedImageChange)=\"onImgCropped($event)\"\n (editClosed)=\"onEditClosed($event)\">\n </cropper>\n </div>\n </div>\n </perfect-scrollbar>\n</div>\n",
2134
2254
  animations: [
2135
2255
  easeInOut
2136
2256
  ]
@@ -2141,13 +2261,8 @@
2141
2261
  }());
2142
2262
 
2143
2263
  var CanvaBtnComponent = /** @class */ (function () {
2144
- function CanvaBtnComponent(canvaService, imgManager, wzImgEventService, translateService, alertService, renderer) {
2264
+ function CanvaBtnComponent(canvaService) {
2145
2265
  this.canvaService = canvaService;
2146
- this.imgManager = imgManager;
2147
- this.wzImgEventService = wzImgEventService;
2148
- this.translateService = translateService;
2149
- this.alertService = alertService;
2150
- this.renderer = renderer;
2151
2266
  this.showImgUploaded = new core.EventEmitter();
2152
2267
  this.imgLoading = false;
2153
2268
  this.availableFormat = {
@@ -2166,10 +2281,6 @@
2166
2281
  };
2167
2282
  this.openDropDownMenu = false;
2168
2283
  this.subs = [];
2169
- this.uploadingImg = 'ImgManager.CanvaBtn.uploadingImg';
2170
- this.successUploadPhoto = 'ImgManager.CanvaBtn.successImport';
2171
- this.errorUploadCanvaImg = 'ImgManager.CanvaBtn.errorUploadCanvaImg';
2172
- this.errorRenameCanvaImg = 'ImgManager.CanvaBtn.errorRenameCanvaImg';
2173
2284
  }
2174
2285
  CanvaBtnComponent.prototype.ngOnInit = function () {
2175
2286
  this.canvaLogoRouteAssets = this.canvaService.getCanvaLogo();
@@ -2191,76 +2302,13 @@
2191
2302
  this.subs.push(subExpectedImgSizesChange);
2192
2303
  };
2193
2304
  CanvaBtnComponent.prototype.onOpenCanva = function (width, height) {
2194
- var _this = this;
2195
- if (this.imgLoading) {
2196
- return;
2197
- }
2198
- var subCanvaApi = this.canvaService.getCanvaApi().subscribe(function (api) {
2199
- _this.canvaApi = api;
2200
- _this.addOverflowBody();
2201
- _this.createDesign(width, height);
2202
- });
2203
- this.subs.push(subCanvaApi);
2204
- };
2205
- CanvaBtnComponent.prototype.createDesign = function (width, height) {
2206
- var _this = this;
2207
- var createDesign = {
2208
- type: 'EtsyShopIcon',
2209
- dimensions: {
2210
- units: 'px',
2211
- width: width ? width : undefined,
2212
- height: height ? height : undefined,
2213
- },
2214
- publishLabel: this.translateService.instant('ImgManager.CanvaBtn.publish'),
2215
- };
2216
- this.canvaApi.createDesign({
2217
- design: createDesign,
2218
- onDesignPublish: function (_a) {
2219
- var exportUrl = _a.exportUrl, designTitle = _a.designTitle;
2220
- return _this.designPublished(exportUrl, designTitle);
2221
- },
2222
- onDesignClose: function () {
2223
- _this.removeOverflowBody();
2224
- }
2225
- });
2226
- };
2227
- CanvaBtnComponent.prototype.designPublished = function (exportUrl, designTitle) {
2228
- var _this = this;
2229
- this.alertService.openAlert(this.uploadingImg);
2230
- this.imgLoading = true;
2231
- var subUploadImg = this.imgManager.uploadFileByUrl(exportUrl, designTitle).subscribe(function (img) {
2232
- _this.imgLoading = false;
2233
- _this.removeOverflowBody();
2234
- _this.wzImgEventService.emitImgAdded(img.id_file);
2235
- _this.alertService.openAlert(_this.successUploadPhoto);
2236
- }, function (error) {
2237
- _this.imgLoading = false;
2238
- _this.removeOverflowBody();
2239
- if (error.error.code === 406 && error.error.message) {
2240
- _this.alertService.openAlertWithBackendRespons(_this.errorUploadCanvaImg, error.error.message);
2241
- }
2242
- else {
2243
- _this.alertService.openAlert(_this.errorUploadCanvaImg);
2244
- }
2245
- });
2246
- this.subs.push(subUploadImg);
2247
- };
2248
- CanvaBtnComponent.prototype.addOverflowBody = function () {
2249
- this.renderer.addClass(document.body, 'ovh-canva');
2250
- };
2251
- CanvaBtnComponent.prototype.removeOverflowBody = function () {
2252
- this.renderer.removeClass(document.body, 'ovh-canva');
2305
+ this.canvaService.openCanva(width, height);
2253
2306
  };
2254
2307
  CanvaBtnComponent.prototype.ngOnDestroy = function () {
2255
2308
  this.subs.forEach(function (sub) { return sub.unsubscribe(); });
2256
2309
  };
2257
2310
  CanvaBtnComponent.ctorParameters = function () { return [
2258
- { type: CanvaService },
2259
- { type: ImgManagerService },
2260
- { type: ImgEventService },
2261
- { type: core$1.TranslateService },
2262
- { type: AlertService },
2263
- { type: core.Renderer2 }
2311
+ { type: CanvaService }
2264
2312
  ]; };
2265
2313
  __decorate([
2266
2314
  core.Input(),
@@ -2273,14 +2321,9 @@
2273
2321
  CanvaBtnComponent = __decorate([
2274
2322
  core.Component({
2275
2323
  selector: 'canva-btn',
2276
- template: "<div class=\"canva dropdown is-right is-hoverable\"\n wzAutoHide (clickOutside)=\"openDropDownMenu = false;\"\n [ngClass]=\"{'is-up': stateDisplayed === 'small', 'noTooltip': stateDisplayed !== 'small'}\"\n >\n <div class=\"dropdown-trigger\">\n <div\n class=\"button canva-btn\"\n aria-controls=\"dropdown-menuCanva\"\n (click)=\"openDropDownMenu = true;\"\n >\n <span>{{'ImgManager.CanvaBtn.createImg' | translate}}</span>\n <img [src]=\"canvaLogoRouteAssets\" class=\"canva-btn__logo\">\n\n <span btnLoadingAnim class=\"btnLoadingAnnimation\" *ngIf=\"imgLoading\"></span>\n </div>\n </div>\n <div\n class=\"dropdown-menu dropDownShadow\"\n [ngClass]=\"{'displayDropDownMenu': openDropDownMenu }\"\n id=\"dropdown-menuCanva\"\n role=\"menu\">\n <ng-scrollbar\n #scrollable\n [visibility]=\"'hover'\"\n class=\"smallScroll\"\n >\n <div class=\"dropdown-content\">\n <div class=\"dropdownTitle\">\n <p>{{'ImgManager.CanvaBtn.createImg.title' | translate}}</p>\n </div>\n\n <div class=\"infoItem\">\n <p>{{'ImgManager.CanvaBtn.info' | translate}}</p>\n </div>\n\n <ng-container >\n <div\n *ngIf=\"expectedWidth && expectedHeight\"\n class=\"dropdown-item-wrapper\"\n >\n <div class=\"dropdown-item expectedSizes\" (click)=\"onOpenCanva(expectedWidth, expectedHeight)\">\n <p>{{'ImgManager.CanvaBtn.recommanded' | translate}}</p><p>{{expectedWidth}}*{{expectedHeight}}</p>\n </div>\n </div>\n </ng-container>\n\n <div\n *ngFor=\"let format of availableFormat| keyvalue\"\n class=\"dropdown-item-wrapper\">\n <div\n (click)=\"onOpenCanva(format.value.width, format.value.height)\"\n class=\"dropdown-item\">\n <p>{{format.key | translate}}</p><p>{{format.value.width}}*{{format.value.height}}</p>\n </div>\n </div>\n </div>\n </ng-scrollbar>\n </div>\n</div>\n"
2324
+ template: "<div class=\"canva dropdown is-right is-hoverable\"\n wzAutoHide (clickOutside)=\"openDropDownMenu = false;\"\n [ngClass]=\"{'is-up': stateDisplayed === 'small', 'noTooltip': stateDisplayed !== 'small'}\"\n >\n <div class=\"dropdown-trigger\">\n <div\n class=\"button canva-btn\"\n aria-controls=\"dropdown-menuCanva\"\n (click)=\"openDropDownMenu = true;\"\n >\n <span>{{'ImgManager.CanvaBtn.createImg' | translate}}</span>\n <img [src]=\"canvaLogoRouteAssets\" class=\"canva-btn__logo\">\n\n <span btnLoadingAnim class=\"btnLoadingAnnimation\" *ngIf=\"imgLoading\"></span>\n </div>\n </div>\n <div\n class=\"dropdown-menu dropDownShadow\"\n [ngClass]=\"{'displayDropDownMenu': openDropDownMenu }\"\n id=\"dropdown-menuCanva\"\n role=\"menu\">\n <perfect-scrollbar\n class=\"smallScroll\"\n >\n <div class=\"dropdown-content\">\n <div class=\"dropdownTitle\">\n <p>{{'ImgManager.CanvaBtn.createImg.title' | translate}}</p>\n </div>\n\n <div class=\"infoItem\">\n <p>{{'ImgManager.CanvaBtn.info' | translate}}</p>\n </div>\n\n <ng-container >\n <div\n *ngIf=\"expectedWidth && expectedHeight\"\n class=\"dropdown-item-wrapper\"\n >\n <div class=\"dropdown-item expectedSizes\" (click)=\"onOpenCanva(expectedWidth, expectedHeight)\">\n <p>{{'ImgManager.CanvaBtn.recommanded' | translate}}</p><p>{{expectedWidth}}*{{expectedHeight}}</p>\n </div>\n </div>\n </ng-container>\n\n <div\n *ngFor=\"let format of availableFormat| keyvalue\"\n class=\"dropdown-item-wrapper\">\n <div\n (click)=\"onOpenCanva(format.value.width, format.value.height)\"\n class=\"dropdown-item\">\n <p>{{format.key | translate}}</p><p>{{format.value.width}}*{{format.value.height}}</p>\n </div>\n </div>\n </div>\n </perfect-scrollbar>\n </div>\n</div>\n"
2277
2325
  }),
2278
- __metadata("design:paramtypes", [CanvaService,
2279
- ImgManagerService,
2280
- ImgEventService,
2281
- core$1.TranslateService,
2282
- AlertService,
2283
- core.Renderer2])
2326
+ __metadata("design:paramtypes", [CanvaService])
2284
2327
  ], CanvaBtnComponent);
2285
2328
  return CanvaBtnComponent;
2286
2329
  }());
@@ -3356,7 +3399,7 @@
3356
3399
  ImagesViewComponent = __decorate([
3357
3400
  core.Component({
3358
3401
  selector: 'images-view',
3359
- template: "<div class=\"images-view\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small'}\" [@easeInOut]=\"'in'\">\n <!-- Subheader : Img number and actions btn (sup img list, switch forma display) -->\n <div\n *ngIf=\"(stateDisplayed !== 'small' || tabDisplayed === 'img-upload')\"\n class=\"images-view__container\"\n [ngClass]=\"{'images-view__container--uploadTab': tabDisplayed === 'img-upload', 'images-view__container--window': stateDisplayed === 'window'}\"\n >\n\n <div *ngIf=\"tabDisplayed !== 'img-upload'\">\n <p class=\"mainColor\">{{ 'ImgManager.ImgLib.nbImg' | translate }} : {{length}}</p>\n </div>\n <div *ngIf=\"tabDisplayed === 'img-upload'\">\n <p class=\"mainColor\">{{ 'ImgManager.ImgLib.lastImgs' | translate }}</p>\n </div>\n\n <div class=\"field has-addons subHeaderActions\" *ngIf=\"tabDisplayed !== 'img-upload'\">\n\n <!-- For listforma : Display btn del multiple img & Confirm action -->\n <div class=\"images-view__container__boxAction\">\n\n\n <!-- S\u00E9lectionner -->\n <button\n class=\"button success images-view__container__boxAction__import\"\n @insertRemoveAnnim\n *ngIf=\"listDisplayed && nbImgToDelSelected && !confirmImgSup && !delListImgLoader && multipleImgMode\"\n (click)=\"selectImgChosen()\"\n >\n <i class=\"fal fa-check\"></i>\n {{ 'ImgManager.ImgLib.select' | translate }} ({{nbImgToDelSelected}})\n </button>\n\n <!-- Display btn del multiple img -->\n <button\n *ngIf=\"listDisplayed && nbImgToDelSelected && !confirmImgSup\"\n (click)=\"displayConfirmImgSup()\"\n class=\"button images-view__container__boxAction__delBtn danger\"\n @insertRemoveAnnim\n >\n <i class=\"fal fa-times\"></i>{{ 'ImgManager.ImgLib.delMlt' | translate }} ({{nbImgToDelSelected}})\n <span btnLoadingAnim *ngIf=\"delListImgLoader\" class=\"btnLoadingAnnimation\"></span>\n </button>\n\n <!-- Confirm action -->\n <div\n class=\"images-view__container__boxAction__confirmSup\"\n [ngClass]=\"{'images-view__container__boxAction__confirmSup--visible': confirmImgSup}\">\n <p *ngIf=\"nbImgToDelSelected > 1\" class=\"images-view__container__boxAction__confirmSup__text\">{{ 'ImgManager.ImgLib.confirmSupQuestions' | translate:{nbImage: nbImgToDelSelected} }}</p>\n <p *ngIf=\"nbImgToDelSelected === 1\" class=\"images-view__container__boxAction__confirmSup__text\">{{ 'ImgManager.ImgLib.confirmSupQuestion' | translate:{nbImage: nbImgToDelSelected} }}</p>\n <div>\n <button\n class=\"button images-view__container__boxAction__confirmSup__cancel\"\n (click)=\"cancelSup()\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <button\n (click)=\"removeListImg()\"\n class=\"button images-view__container__delBtn danger\"\n >\n {{ 'ImgManager.ImgLib.confirm' | translate }}\n </button>\n </div>\n </div>\n\n </div>\n\n\n <!-- Swith mosaic/list forma -->\n <div class=\"field has-addons images-view__container__buttonBox\">\n <div class=\"control\">\n <div\n class=\"button is-lighted images-view__container__buttonBox__btn\"\n [ngClass]=\"{'actifDisplayed': !listDisplayed}\"\n (click)=\"onSwitchFormatDisplayed(false)\"\n >\n <span class=\"icon is-small\">\n <i class=\"far fa-th\"></i>\n </span>\n </div>\n </div>\n\n <div class=\"control\">\n <div class=\"button is-lighted images-view__container__buttonBox__btn\"\n [ngClass]=\"{'actifDisplayed': listDisplayed}\"\n (click)=\"onSwitchFormatDisplayed(true)\"\n >\n <span class=\"icon is-small\">\n <i class=\"fas fa-bars\"></i>\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n\n <!-- Images section -->\n<ng-scrollbar\n #scrollable\n [visibility]=\"'native'\"\n class=\"images-view__scroll\"\n [ngClass]=\"{\n 'images-view__scroll--hide--mosaic': displayPexelsResults && !listDisplayed,\n 'images-view__scroll--hide--mosaic--small': displayPexelsResults && !listDisplayed && stateDisplayed === 'small',\n 'images-view__scroll--hide--table': displayPexelsResults && listDisplayed,\n 'images-view__scroll--full': stateDisplayed === 'full',\n 'images-view__scroll--smallDisplay' : stateDisplayed === 'small' && tabDisplayed !== 'img-upload',\n 'images-view__scroll--smallUploadDisplay' : stateDisplayed === 'small' && tabDisplayed === 'img-upload',\n 'images-view__scroll--window': stateDisplayed === 'window'\n}\"\n>\n <div #imgLibContainer class=\"images-view__wrapper\">\n <div *ngIf=\"!listDisplayed || stateDisplayed === 'small'\" [@easeInOut]=\"'in'\">\n <mosaic-view\n [picturesList]=\"picturesList\"\n (picturesListChange)=\"onPicturesListChange()\"\n [tableFilters]=\"tableFilters\"\n (filtersChange)=\"onFiltersChange()\"\n [(disable)]=\"disable\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n (switchDisplayWindow)=\"switchDisplayWindowMosaic()\"\n [nbFakeImg]=\"nbFakeImg\"\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabDisplayed\"\n [displayPexelsResults]=\"displayPexelsResults\"\n [isLoading]=\"isLoading\"\n [fullSize]=\"fullSize\"\n >\n </mosaic-view>\n </div>\n\n <div *ngIf=\"listDisplayed && stateDisplayed !== 'small'\" [@easeInOut]=\"'in'\">\n <table-view\n [picturesList]=\"picturesList\"\n (picturesListChange)=\"onPicturesListChange()\"\n [tableFilters]=\"tableFilters\"\n (filtersChange)=\"onFiltersChange()\"\n [(disable)]=\"disable\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n [displayPexelsResults]=\"displayPexelsResults\"\n [stateDisplayed]=\"stateDisplayed\"\n [isLoading]=\"isLoading\"\n >\n </table-view>\n </div>\n\n </div>\n</ng-scrollbar>\n\n<!-- Pexels Section - When no img found -->\n<div\n *ngIf=\"displayPexelsResults\"\n class=\"images-view--pexels\"\n [@easeInOut]=\"'in'\">\n <pexels-lib\n [searchValue]=\"tableFilters.searchValue\"\n (showImgUploaded)=\"onShowImgUploaded()\"\n [disableSearch]=\"true\"\n >\n </pexels-lib>\n</div>\n",
3402
+ template: "<div class=\"images-view\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small'}\" [@easeInOut]=\"'in'\">\n <!-- Subheader : Img number and actions btn (sup img list, switch forma display) -->\n <div\n *ngIf=\"(stateDisplayed !== 'small' || tabDisplayed === 'img-upload')\"\n class=\"images-view__container\"\n [ngClass]=\"{'images-view__container--uploadTab': tabDisplayed === 'img-upload', 'images-view__container--window': stateDisplayed === 'window'}\"\n >\n\n <div *ngIf=\"tabDisplayed !== 'img-upload'\">\n <p class=\"mainColor\">{{ 'ImgManager.ImgLib.nbImg' | translate }} : {{length}}</p>\n </div>\n <div *ngIf=\"tabDisplayed === 'img-upload'\">\n <p class=\"mainColor\">{{ 'ImgManager.ImgLib.lastImgs' | translate }}</p>\n </div>\n\n <div class=\"field has-addons subHeaderActions\" *ngIf=\"tabDisplayed !== 'img-upload'\">\n\n <!-- For listforma : Display btn del multiple img & Confirm action -->\n <div class=\"images-view__container__boxAction\">\n\n\n <!-- S\u00E9lectionner -->\n <button\n class=\"button success images-view__container__boxAction__import\"\n @insertRemoveAnnim\n *ngIf=\"listDisplayed && nbImgToDelSelected && !confirmImgSup && !delListImgLoader && multipleImgMode\"\n (click)=\"selectImgChosen()\"\n >\n <i class=\"fal fa-check\"></i>\n {{ 'ImgManager.ImgLib.select' | translate }} ({{nbImgToDelSelected}})\n </button>\n\n <!-- Display btn del multiple img -->\n <button\n *ngIf=\"listDisplayed && nbImgToDelSelected && !confirmImgSup\"\n (click)=\"displayConfirmImgSup()\"\n class=\"button images-view__container__boxAction__delBtn danger\"\n @insertRemoveAnnim\n >\n <i class=\"fal fa-times\"></i>{{ 'ImgManager.ImgLib.delMlt' | translate }} ({{nbImgToDelSelected}})\n <span btnLoadingAnim *ngIf=\"delListImgLoader\" class=\"btnLoadingAnnimation\"></span>\n </button>\n\n <!-- Confirm action -->\n <div\n class=\"images-view__container__boxAction__confirmSup\"\n [ngClass]=\"{'images-view__container__boxAction__confirmSup--visible': confirmImgSup}\">\n <p *ngIf=\"nbImgToDelSelected > 1\" class=\"images-view__container__boxAction__confirmSup__text\">{{ 'ImgManager.ImgLib.confirmSupQuestions' | translate:{nbImage: nbImgToDelSelected} }}</p>\n <p *ngIf=\"nbImgToDelSelected === 1\" class=\"images-view__container__boxAction__confirmSup__text\">{{ 'ImgManager.ImgLib.confirmSupQuestion' | translate:{nbImage: nbImgToDelSelected} }}</p>\n <div>\n <button\n class=\"button images-view__container__boxAction__confirmSup__cancel\"\n (click)=\"cancelSup()\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <button\n (click)=\"removeListImg()\"\n class=\"button images-view__container__delBtn danger\"\n >\n {{ 'ImgManager.ImgLib.confirm' | translate }}\n </button>\n </div>\n </div>\n\n </div>\n\n\n <!-- Swith mosaic/list forma -->\n <div class=\"field has-addons images-view__container__buttonBox\">\n <div class=\"control\">\n <div\n class=\"button is-lighted images-view__container__buttonBox__btn\"\n [ngClass]=\"{'actifDisplayed': !listDisplayed}\"\n (click)=\"onSwitchFormatDisplayed(false)\"\n >\n <span class=\"icon is-small\">\n <i class=\"far fa-th\"></i>\n </span>\n </div>\n </div>\n\n <div class=\"control\">\n <div class=\"button is-lighted images-view__container__buttonBox__btn\"\n [ngClass]=\"{'actifDisplayed': listDisplayed}\"\n (click)=\"onSwitchFormatDisplayed(true)\"\n >\n <span class=\"icon is-small\">\n <i class=\"fas fa-bars\"></i>\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n\n <!-- Images section -->\n<perfect-scrollbar\n class=\"images-view__scroll\"\n [ngClass]=\"{\n 'images-view__scroll--hide--mosaic': displayPexelsResults && !listDisplayed,\n 'images-view__scroll--hide--mosaic--small': displayPexelsResults && !listDisplayed && stateDisplayed === 'small',\n 'images-view__scroll--hide--table': displayPexelsResults && listDisplayed,\n 'images-view__scroll--full': stateDisplayed === 'full',\n 'images-view__scroll--smallDisplay' : stateDisplayed === 'small' && tabDisplayed !== 'img-upload',\n 'images-view__scroll--smallUploadDisplay' : stateDisplayed === 'small' && tabDisplayed === 'img-upload',\n 'images-view__scroll--window': stateDisplayed === 'window'\n}\"\n>\n <div #imgLibContainer class=\"images-view__wrapper\">\n <div *ngIf=\"!listDisplayed || stateDisplayed === 'small'\" [@easeInOut]=\"'in'\">\n <mosaic-view\n [picturesList]=\"picturesList\"\n (picturesListChange)=\"onPicturesListChange()\"\n [tableFilters]=\"tableFilters\"\n (filtersChange)=\"onFiltersChange()\"\n [(disable)]=\"disable\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n (switchDisplayWindow)=\"switchDisplayWindowMosaic()\"\n [nbFakeImg]=\"nbFakeImg\"\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabDisplayed\"\n [displayPexelsResults]=\"displayPexelsResults\"\n [isLoading]=\"isLoading\"\n [fullSize]=\"fullSize\"\n >\n </mosaic-view>\n </div>\n\n <div *ngIf=\"listDisplayed && stateDisplayed !== 'small'\" [@easeInOut]=\"'in'\">\n <table-view\n [picturesList]=\"picturesList\"\n (picturesListChange)=\"onPicturesListChange()\"\n [tableFilters]=\"tableFilters\"\n (filtersChange)=\"onFiltersChange()\"\n [(disable)]=\"disable\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n [displayPexelsResults]=\"displayPexelsResults\"\n [stateDisplayed]=\"stateDisplayed\"\n [isLoading]=\"isLoading\"\n >\n </table-view>\n </div>\n\n </div>\n</perfect-scrollbar>\n\n<!-- Pexels Section - When no img found -->\n<div\n *ngIf=\"displayPexelsResults\"\n class=\"images-view--pexels\"\n [@easeInOut]=\"'in'\">\n <pexels-lib\n [searchValue]=\"tableFilters.searchValue\"\n (showImgUploaded)=\"onShowImgUploaded()\"\n [disableSearch]=\"true\"\n >\n </pexels-lib>\n</div>\n",
3360
3403
  animations: [
3361
3404
  easeInOut,
3362
3405
  insertRemove
@@ -4977,9 +5020,9 @@
4977
5020
  exports.ɵbz = SelectFiltersPipe;
4978
5021
  exports.ɵc = UserSettingsService;
4979
5022
  exports.ɵd = ImgEventService;
4980
- exports.ɵe = DomService;
4981
- exports.ɵf = ImgTabsComponent;
4982
- exports.ɵg = AlertService;
5023
+ exports.ɵe = AlertService;
5024
+ exports.ɵf = DomService;
5025
+ exports.ɵg = ImgTabsComponent;
4983
5026
  exports.ɵh = ImgUploadComponent;
4984
5027
  exports.ɵi = easeInOut;
4985
5028
  exports.ɵj = PexelLibComponent;