@wizishop/img-manager 0.2.99 → 0.2.100

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.
@@ -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;
@@ -2141,13 +2239,8 @@
2141
2239
  }());
2142
2240
 
2143
2241
  var CanvaBtnComponent = /** @class */ (function () {
2144
- function CanvaBtnComponent(canvaService, imgManager, wzImgEventService, translateService, alertService, renderer) {
2242
+ function CanvaBtnComponent(canvaService) {
2145
2243
  this.canvaService = canvaService;
2146
- this.imgManager = imgManager;
2147
- this.wzImgEventService = wzImgEventService;
2148
- this.translateService = translateService;
2149
- this.alertService = alertService;
2150
- this.renderer = renderer;
2151
2244
  this.showImgUploaded = new core.EventEmitter();
2152
2245
  this.imgLoading = false;
2153
2246
  this.availableFormat = {
@@ -2166,10 +2259,6 @@
2166
2259
  };
2167
2260
  this.openDropDownMenu = false;
2168
2261
  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
2262
  }
2174
2263
  CanvaBtnComponent.prototype.ngOnInit = function () {
2175
2264
  this.canvaLogoRouteAssets = this.canvaService.getCanvaLogo();
@@ -2191,76 +2280,13 @@
2191
2280
  this.subs.push(subExpectedImgSizesChange);
2192
2281
  };
2193
2282
  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');
2283
+ this.canvaService.openCanva(width, height);
2253
2284
  };
2254
2285
  CanvaBtnComponent.prototype.ngOnDestroy = function () {
2255
2286
  this.subs.forEach(function (sub) { return sub.unsubscribe(); });
2256
2287
  };
2257
2288
  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 }
2289
+ { type: CanvaService }
2264
2290
  ]; };
2265
2291
  __decorate([
2266
2292
  core.Input(),
@@ -2275,12 +2301,7 @@
2275
2301
  selector: 'canva-btn',
2276
2302
  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"
2277
2303
  }),
2278
- __metadata("design:paramtypes", [CanvaService,
2279
- ImgManagerService,
2280
- ImgEventService,
2281
- core$1.TranslateService,
2282
- AlertService,
2283
- core.Renderer2])
2304
+ __metadata("design:paramtypes", [CanvaService])
2284
2305
  ], CanvaBtnComponent);
2285
2306
  return CanvaBtnComponent;
2286
2307
  }());
@@ -4977,9 +4998,9 @@
4977
4998
  exports.ɵbz = SelectFiltersPipe;
4978
4999
  exports.ɵc = UserSettingsService;
4979
5000
  exports.ɵd = ImgEventService;
4980
- exports.ɵe = DomService;
4981
- exports.ɵf = ImgTabsComponent;
4982
- exports.ɵg = AlertService;
5001
+ exports.ɵe = AlertService;
5002
+ exports.ɵf = DomService;
5003
+ exports.ɵg = ImgTabsComponent;
4983
5004
  exports.ɵh = ImgUploadComponent;
4984
5005
  exports.ɵi = easeInOut;
4985
5006
  exports.ɵj = PexelLibComponent;