@rs-pk/asset-management 1.0.29 → 1.0.31

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 (24) hide show
  1. package/bundles/rs-pk-asset-management.umd.js +328 -57
  2. package/bundles/rs-pk-asset-management.umd.js.map +1 -1
  3. package/bundles/rs-pk-asset-management.umd.min.js +2 -2
  4. package/bundles/rs-pk-asset-management.umd.min.js.map +1 -1
  5. package/esm2015/lib/components/partial/asset-list/asset-list.component.js +73 -30
  6. package/esm2015/lib/components/partial/file-item/file-item.component.js +9 -3
  7. package/esm2015/lib/components/partial/upload-dialog/upload-dialog.component.js +110 -3
  8. package/esm2015/lib/configs/admin.config.js +71 -13
  9. package/esm2015/lib/services/upload-assets.service.js +17 -12
  10. package/esm5/lib/components/partial/asset-list/asset-list.component.js +95 -31
  11. package/esm5/lib/components/partial/file-item/file-item.component.js +13 -3
  12. package/esm5/lib/components/partial/upload-dialog/upload-dialog.component.js +133 -3
  13. package/esm5/lib/configs/admin.config.js +71 -13
  14. package/esm5/lib/services/upload-assets.service.js +21 -12
  15. package/fesm2015/rs-pk-asset-management.js +275 -56
  16. package/fesm2015/rs-pk-asset-management.js.map +1 -1
  17. package/fesm5/rs-pk-asset-management.js +328 -57
  18. package/fesm5/rs-pk-asset-management.js.map +1 -1
  19. package/lib/components/partial/asset-list/asset-list.component.d.ts +7 -1
  20. package/lib/components/partial/file-item/file-item.component.d.ts +1 -0
  21. package/lib/components/partial/upload-dialog/upload-dialog.component.d.ts +6 -0
  22. package/lib/services/upload-assets.service.d.ts +2 -0
  23. package/package.json +1 -1
  24. package/rs-pk-asset-management.metadata.json +1 -1
@@ -1252,6 +1252,7 @@ class UploadAssetsService {
1252
1252
  this._api = _api;
1253
1253
  this.files = [];
1254
1254
  this.fileNames = [];
1255
+ this.uploadErrors = new Map();
1255
1256
  this.supportedSize = 10 * 1024 * 1024; // 10MB
1256
1257
  // 10MB
1257
1258
  this.documentExtension = ['.pdf', '.csv'];
@@ -1327,9 +1328,21 @@ class UploadAssetsService {
1327
1328
  * @return {?}
1328
1329
  */
1329
1330
  deleteFile(index) {
1331
+ this.uploadErrors.delete(this.files[index]);
1330
1332
  this.files.splice(index, 1);
1331
1333
  this.fileNames.splice(index, 1);
1332
1334
  }
1335
+ /**
1336
+ * @param {?} index
1337
+ * @return {?}
1338
+ */
1339
+ getUploadName(index) {
1340
+ /** @type {?} */
1341
+ const nameSplit = this.files[index].name.split('.');
1342
+ /** @type {?} */
1343
+ const ext = `.${nameSplit.splice(nameSplit.length - 1, 1)[0]}`;
1344
+ return `${this.fileNames[index].name}${ext}`;
1345
+ }
1333
1346
  /**
1334
1347
  * @param {?} parentAssetId
1335
1348
  * @return {?}
@@ -1337,21 +1350,11 @@ class UploadAssetsService {
1337
1350
  uploadMultipleAssets(parentAssetId) {
1338
1351
  const { files } = this;
1339
1352
  /** @type {?} */
1340
- const fileNames = this.fileNames.map((/**
1341
- * @param {?} file
1342
- * @return {?}
1343
- */
1344
- file => file.name));
1345
- /** @type {?} */
1346
1353
  const formData = new FormData();
1347
1354
  formData.append('parentAssetId', parentAssetId);
1348
1355
  formData.append('companyId', '732DA8D2-04EC-4BE0-A168-63EE0DCF50D8');
1349
1356
  for (let i = 0; i < files.length; i++) {
1350
- /** @type {?} */
1351
- const nameSplit = files[i].name.split('.');
1352
- /** @type {?} */
1353
- const ext = `.${nameSplit.splice(nameSplit.length - 1, 1)[0]}`;
1354
- formData.append('files', files[i], `${fileNames[i]}${ext}`);
1357
+ formData.append('files', files[i], this.getUploadName(i));
1355
1358
  }
1356
1359
  return this._api.post(`${this.baseUrl}/File/Upload`, formData);
1357
1360
  }
@@ -1374,6 +1377,8 @@ if (false) {
1374
1377
  /** @type {?} */
1375
1378
  UploadAssetsService.prototype.fileNames;
1376
1379
  /** @type {?} */
1380
+ UploadAssetsService.prototype.uploadErrors;
1381
+ /** @type {?} */
1377
1382
  UploadAssetsService.prototype.supportedSize;
1378
1383
  /** @type {?} */
1379
1384
  UploadAssetsService.prototype.documentExtension;
@@ -2079,6 +2084,12 @@ class FileItemComponent {
2079
2084
  ngOnInit() {
2080
2085
  this.initDataFile();
2081
2086
  }
2087
+ /**
2088
+ * @return {?}
2089
+ */
2090
+ get uploadErrors() {
2091
+ return this.uploadAssetService.uploadErrors.get(this.file);
2092
+ }
2082
2093
  /**
2083
2094
  * @private
2084
2095
  * @return {?}
@@ -2178,8 +2189,8 @@ class FileItemComponent {
2178
2189
  FileItemComponent.decorators = [
2179
2190
  { type: Component, args: [{
2180
2191
  selector: 'lib-file-item',
2181
- template: "<div class=\"file-item__img\">\n <ng-container\n *ngIf=\"\n file.type.indexOf('image') > -1 || documentExts.indexOf(dataFile.ext) > -1;\n else defaultFile\n \"\n >\n <img\n [class.image]=\"file.type.indexOf('image') > -1\"\n *ngIf=\"documentExts.indexOf(dataFile.ext) > -1 || dataFile.data\"\n [src]=\"documentExts.indexOf(dataFile.ext) > -1 ? base64PNG[dataFile.ext] : dataFile.data\"\n />\n </ng-container>\n <ng-template #defaultFile>\n <mat-icon>attach_file</mat-icon>\n </ng-template>\n</div>\n<div class=\"file-item__content\">\n <input\n class=\"file-item__content--name\"\n matInput\n placeholder=\"Enter file name\"\n [value]=\"dataFile.name\"\n required\n (input)=\"onChange($event)\"\n />\n <div class=\"file-item__content--info\">\n <div class=\"file-item__content--info__item\">\n Extension: <span>{{ dataFile.ext }}</span>\n </div>\n <div class=\"file-item__content--info__item\">\n Size: <span>{{ dataFile.size | fileSize }}</span>\n </div>\n </div>\n <div *ngIf=\"dataFile.errors.ext\" class=\"file-item__error\">\n {{ uploadAssetService.messageErrors['ext'] }}\n {{ uploadAssetService.supportedTypes.join(', ') }}\n </div>\n <div *ngIf=\"dataFile.errors.size\" class=\"file-item__error\">\n {{ uploadAssetService.messageErrors['size'] }}\n {{ uploadAssetService.supportedSize | fileSize: 0 }}\n </div>\n <div *ngIf=\"dataFile.errors.maxLength\" class=\"file-item__error\">\n {{ uploadAssetService.messageErrors['maxLength'] }}\n </div>\n</div>\n<div class=\"file-item__action\">\n <mat-icon (click)=\"onRemove()\">delete_outline</mat-icon>\n</div>\n",
2182
- styles: [":host::ng-deep{padding:10px 5%;display:flex;justify-content:space-between;align-items:center;background-color:#f9f9f9;border-radius:10px}:host::ng-deep .file-item__img{display:flex;justify-content:center;align-items:center;width:250px;height:150px;border-radius:10px}:host::ng-deep .file-item__img img{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}:host::ng-deep .file-item__img img.image{background-image:url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAAUABQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+/ivFPFOf+EjvxzjbBgdv+PeDp+OfxzSt4q18AkageASB9ntu3OM+Vn8c5rsdG0fT9d06DVdUgN1f3XmefP5ksO/ypXhj/dwvHGu2ONF+VF3bQSM0AeYUV7IPCWgjgWRA/wCvi4P85SaKAPGm5Vh7H+VeyeERjQLEDoPP/WeQ/wAzRRQB0tFFFAH/2Q==)}:host::ng-deep .file-item__img mat-icon{font-size:100px;width:auto;height:auto}:host::ng-deep .file-item__content{flex:1;padding-left:5%;padding-right:5%}:host::ng-deep .file-item__content--name{width:100%;padding:10px;border:1px solid #d8d8d8;border-radius:5px}:host::ng-deep .file-item__content--info{margin-top:10px;display:flex}:host::ng-deep .file-item__content--info__item:not(:last-child){margin-right:50px}:host::ng-deep .file-item__content--info__item span{color:#000;text-transform:uppercase}:host::ng-deep .file-item__error{margin-top:10px;color:#f44336}:host::ng-deep .file-item__action{color:#f44336;cursor:pointer}"]
2192
+ template: "<div class=\"file-item__img\">\n <ng-container\n *ngIf=\"\n file.type.indexOf('image') > -1 || documentExts.indexOf(dataFile.ext) > -1;\n else defaultFile\n \"\n >\n <img\n [class.image]=\"file.type.indexOf('image') > -1\"\n *ngIf=\"documentExts.indexOf(dataFile.ext) > -1 || dataFile.data\"\n [src]=\"documentExts.indexOf(dataFile.ext) > -1 ? base64PNG[dataFile.ext] : dataFile.data\"\n />\n </ng-container>\n <ng-template #defaultFile>\n <mat-icon>attach_file</mat-icon>\n </ng-template>\n</div>\n<div class=\"file-item__content\">\n <input\n class=\"file-item__content--name\"\n matInput\n placeholder=\"Enter file name\"\n [value]=\"dataFile.name\"\n required\n (input)=\"onChange($event)\"\n />\n <div class=\"file-item__content--info\">\n <div class=\"file-item__content--info__item\">\n Extension: <span>{{ dataFile.ext }}</span>\n </div>\n <div class=\"file-item__content--info__item\">\n Size: <span>{{ dataFile.size | fileSize }}</span>\n </div>\n </div>\n <div *ngIf=\"dataFile.errors.ext\" class=\"file-item__error\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>\n {{ uploadAssetService.messageErrors['ext'] }}\n {{ uploadAssetService.supportedTypes.join(', ') }}\n </span>\n </div>\n <div *ngIf=\"dataFile.errors.size\" class=\"file-item__error\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>\n {{ uploadAssetService.messageErrors['size'] }}\n {{ uploadAssetService.supportedSize | fileSize: 0 }}\n </span>\n </div>\n <div *ngIf=\"dataFile.errors.maxLength\" class=\"file-item__error\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>{{ uploadAssetService.messageErrors['maxLength'] }}</span>\n </div>\n <div *ngFor=\"let message of uploadErrors\" class=\"file-item__error\" role=\"alert\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>{{ message }}</span>\n </div>\n</div>\n<div class=\"file-item__action\">\n <mat-icon (click)=\"onRemove()\">delete_outline</mat-icon>\n</div>\n",
2193
+ styles: [":host::ng-deep{padding:10px 5%;display:flex;justify-content:space-between;align-items:center;background-color:#f9f9f9;border-radius:10px}:host::ng-deep .file-item__img{display:flex;justify-content:center;align-items:center;width:250px;height:150px;border-radius:10px}:host::ng-deep .file-item__img img{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}:host::ng-deep .file-item__img img.image{background-image:url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAAUABQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+/ivFPFOf+EjvxzjbBgdv+PeDp+OfxzSt4q18AkageASB9ntu3OM+Vn8c5rsdG0fT9d06DVdUgN1f3XmefP5ksO/ypXhj/dwvHGu2ONF+VF3bQSM0AeYUV7IPCWgjgWRA/wCvi4P85SaKAPGm5Vh7H+VeyeERjQLEDoPP/WeQ/wAzRRQB0tFFFAH/2Q==)}:host::ng-deep .file-item__img mat-icon{font-size:100px;width:auto;height:auto}:host::ng-deep .file-item__content{flex:1;padding-left:5%;padding-right:5%}:host::ng-deep .file-item__content--name{width:100%;padding:10px;border:1px solid #d8d8d8;border-radius:5px}:host::ng-deep .file-item__content--info{margin-top:10px;display:flex}:host::ng-deep .file-item__content--info__item:not(:last-child){margin-right:50px}:host::ng-deep .file-item__content--info__item span{color:#000;text-transform:uppercase}:host::ng-deep .file-item__error{display:flex;align-items:center;width:-moz-fit-content;width:fit-content;max-width:100%;margin-top:8px;padding:4px 10px;border-radius:6px;background-color:#fdecea;color:#d32f2f;font-size:13px;line-height:18px;word-break:break-word}:host::ng-deep .file-item__error--icon{flex-shrink:0;margin-right:6px;font-size:16px;width:16px;height:16px}:host::ng-deep .file-item__action{color:#f44336;cursor:pointer}"]
2183
2194
  }] }
2184
2195
  ];
2185
2196
  /** @nocollapse */
@@ -2817,6 +2828,8 @@ class UploadDialogComponent {
2817
2828
  this.uploadAssetsService = uploadAssetsService;
2818
2829
  this.isLoading = false;
2819
2830
  this.disabled = true;
2831
+ this.errorMessages = [];
2832
+ this.defaultErrorMessage = 'Something went wrong while uploading. Please try again.';
2820
2833
  this.destroy$ = new Subject();
2821
2834
  if (this.data.fileType) {
2822
2835
  this.uploadAssetsService.supportedTypes =
@@ -2841,6 +2854,7 @@ class UploadDialogComponent {
2841
2854
  */
2842
2855
  error => {
2843
2856
  this.disabled = error;
2857
+ this.clearErrors();
2844
2858
  this.changeDetectorRef.detectChanges();
2845
2859
  }));
2846
2860
  }
@@ -2850,12 +2864,15 @@ class UploadDialogComponent {
2850
2864
  */
2851
2865
  onValidate(hasError) {
2852
2866
  this.disabled = hasError;
2867
+ this.clearErrors();
2853
2868
  }
2854
2869
  /**
2855
2870
  * @return {?}
2856
2871
  */
2857
2872
  uploadFiles() {
2858
2873
  this.isLoading = true;
2874
+ this.clearErrors();
2875
+ this.dialogRef.disableClose = true;
2859
2876
  this.uploadAssetsService
2860
2877
  .uploadMultipleAssets(this.data.currentAssetId)
2861
2878
  .pipe(takeUntil(this.destroy$))
@@ -2867,8 +2884,102 @@ class UploadDialogComponent {
2867
2884
  if (res) {
2868
2885
  this.closeDialog(true);
2869
2886
  }
2887
+ }), (/**
2888
+ * @param {?} err
2889
+ * @return {?}
2890
+ */
2891
+ err => {
2892
+ this.setUploadErrors(this.getErrorMessages(err));
2893
+ this.stopLoading();
2894
+ }), (
2895
+ // the request can complete without a truthy response (or be swallowed by an interceptor)
2896
+ /**
2897
+ * @return {?}
2898
+ */
2899
+ () => this.stopLoading()));
2900
+ }
2901
+ /**
2902
+ * @private
2903
+ * @return {?}
2904
+ */
2905
+ stopLoading() {
2906
+ this.isLoading = false;
2907
+ this.dialogRef.disableClose = false;
2908
+ this.changeDetectorRef.detectChanges();
2909
+ }
2910
+ /**
2911
+ * @private
2912
+ * @return {?}
2913
+ */
2914
+ clearErrors() {
2915
+ this.errorMessages = [];
2916
+ this.uploadAssetsService.uploadErrors.clear();
2917
+ }
2918
+ // show each message on the file it mentions, the rest stay under the list
2919
+ /**
2920
+ * @private
2921
+ * @param {?} messages
2922
+ * @return {?}
2923
+ */
2924
+ setUploadErrors(messages) {
2925
+ const { getFiles: files, uploadErrors } = this.uploadAssetsService;
2926
+ /** @type {?} */
2927
+ const uploadNames = files.map((/**
2928
+ * @param {?} file
2929
+ * @param {?} index
2930
+ * @return {?}
2931
+ */
2932
+ (file, index) => this.uploadAssetsService.getUploadName(index)));
2933
+ this.errorMessages = messages.filter((/**
2934
+ * @param {?} message
2935
+ * @return {?}
2936
+ */
2937
+ message => {
2938
+ /** @type {?} */
2939
+ let index = uploadNames.findIndex((/**
2940
+ * @param {?} name
2941
+ * @return {?}
2942
+ */
2943
+ name => message.indexOf(name) > -1));
2944
+ if (index < 0 && files.length === 1) {
2945
+ index = 0;
2946
+ }
2947
+ if (index < 0) {
2948
+ return true;
2949
+ }
2950
+ uploadErrors.set(files[index], [...(uploadErrors.get(files[index]) || []), message]);
2951
+ return false;
2870
2952
  }));
2871
2953
  }
2954
+ /**
2955
+ * @private
2956
+ * @param {?} err
2957
+ * @return {?}
2958
+ */
2959
+ getErrorMessages(err) {
2960
+ // HttpErrorResponse keeps the API body in `error`, an interceptor may already unwrap it
2961
+ /** @type {?} */
2962
+ const body = err && err.error && typeof err.error === 'object' ? err.error : err || {};
2963
+ /** @type {?} */
2964
+ const messages = (body.Messages || [])
2965
+ .map((/**
2966
+ * @param {?} message
2967
+ * @return {?}
2968
+ */
2969
+ message => (typeof message === 'string' ? message : message && message.Text)))
2970
+ .filter(Boolean);
2971
+ if (!messages.length && body.ResponseMessage) {
2972
+ messages.push(body.ResponseMessage);
2973
+ }
2974
+ return messages.length
2975
+ ? messages.filter((/**
2976
+ * @param {?} message
2977
+ * @param {?} index
2978
+ * @return {?}
2979
+ */
2980
+ (message, index) => messages.indexOf(message) === index))
2981
+ : [this.defaultErrorMessage];
2982
+ }
2872
2983
  /**
2873
2984
  * @param {?=} res
2874
2985
  * @return {?}
@@ -2887,9 +2998,9 @@ class UploadDialogComponent {
2887
2998
  UploadDialogComponent.decorators = [
2888
2999
  { type: Component, args: [{
2889
3000
  selector: 'lib-upload-dialog',
2890
- template: "<lib-modal heading=\"Add new assets\">\n <ng-container content>\n <lib-upload-file\n *ngIf=\"!uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-upload-file>\n <lib-file-list\n *ngIf=\"uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-file-list>\n </ng-container>\n <ng-container actions>\n <button mat-raised-button mat-dialog-close>Cancel</button>\n <button\n class=\"upload__action\"\n [class.loading]=\"isLoading\"\n mat-raised-button\n color=\"primary\"\n (click)=\"uploadFiles()\"\n [disabled]=\"disabled || isLoading\"\n >\n <ng-container *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n </ng-container>\n <span>Upload</span>\n </button>\n </ng-container>\n</lib-modal>\n",
3001
+ template: "<lib-modal heading=\"Add new assets\">\n <ng-container content>\n <lib-upload-file\n *ngIf=\"!uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-upload-file>\n <lib-file-list\n *ngIf=\"uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-file-list>\n <div *ngFor=\"let message of errorMessages\" class=\"upload__error\" role=\"alert\">\n <mat-icon class=\"upload__error--icon\">error_outline</mat-icon>\n <span>{{ message }}</span>\n </div>\n </ng-container>\n <ng-container actions>\n <button mat-raised-button mat-dialog-close [disabled]=\"isLoading\">Cancel</button>\n <button\n class=\"upload__action\"\n [class.loading]=\"isLoading\"\n mat-raised-button\n color=\"primary\"\n (click)=\"uploadFiles()\"\n [disabled]=\"disabled || isLoading\"\n >\n <ng-container *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n </ng-container>\n <span>Upload</span>\n </button>\n </ng-container>\n</lib-modal>\n",
2891
3002
  providers: [UploadAssetsService],
2892
- styles: [":host::ng-deep{display:block;width:1200px;max-width:100%;font-size:14px;line-height:16px;color:#979797;letter-spacing:.15px}:host::ng-deep .mat-dialog-title{position:relative;margin-bottom:0;padding-bottom:24px;color:#000}:host::ng-deep .mat-dialog-actions{justify-content:flex-end;padding:24px 0 0}:host::ng-deep .upload__action{min-width:100px}:host::ng-deep .upload__action.loading{padding:0 5px}:host::ng-deep .upload__action.loading .mat-button-wrapper{display:flex;width:100%;justify-content:center;align-items:center}:host::ng-deep .upload__action.loading .mat-spinner{margin-right:10px}"]
3003
+ styles: [":host::ng-deep{display:block;width:1200px;max-width:100%;font-size:14px;line-height:16px;color:#979797;letter-spacing:.15px}:host::ng-deep .mat-dialog-title{position:relative;margin-bottom:0;padding-bottom:24px;color:#000}:host::ng-deep .mat-dialog-actions{justify-content:flex-end;padding:24px 0 0}:host::ng-deep .upload__error{display:flex;align-items:center;width:-moz-fit-content;width:fit-content;max-width:100%;margin-top:8px;padding:4px 10px;border-radius:6px;background-color:#fdecea;color:#d32f2f;font-size:13px;line-height:18px;word-break:break-word}:host::ng-deep .upload__error--icon{flex-shrink:0;margin-right:6px;font-size:16px;width:16px;height:16px}:host::ng-deep .upload__action{min-width:100px}:host::ng-deep .upload__action.loading{padding:0 5px}:host::ng-deep .upload__action.loading .mat-button-wrapper{display:flex;width:100%;justify-content:center;align-items:center}:host::ng-deep .upload__action.loading .mat-spinner{margin-right:10px}"]
2893
3004
  }] }
2894
3005
  ];
2895
3006
  /** @nocollapse */
@@ -2904,6 +3015,13 @@ if (false) {
2904
3015
  UploadDialogComponent.prototype.isLoading;
2905
3016
  /** @type {?} */
2906
3017
  UploadDialogComponent.prototype.disabled;
3018
+ /** @type {?} */
3019
+ UploadDialogComponent.prototype.errorMessages;
3020
+ /**
3021
+ * @type {?}
3022
+ * @private
3023
+ */
3024
+ UploadDialogComponent.prototype.defaultErrorMessage;
2907
3025
  /**
2908
3026
  * @type {?}
2909
3027
  * @private
@@ -3161,6 +3279,7 @@ class AssetListComponent {
3161
3279
  this.hasAccessPermission = true;
3162
3280
  this.hasArchivePermission = true;
3163
3281
  this.backgroundProcessingNum = BackgroudProcessingStatus;
3282
+ this.processingCheckDelay = 5000;
3164
3283
  this.unsubscribe$ = new Subject$1();
3165
3284
  this.selectedAssets = [];
3166
3285
  }
@@ -3176,15 +3295,7 @@ class AssetListComponent {
3176
3295
  */
3177
3296
  ngOnChanges(changes) {
3178
3297
  if (changes.assets) {
3179
- // Check if asset is uploading
3180
- if (this.assets && this.assets.find((/**
3181
- * @param {?} x
3182
- * @return {?}
3183
- */
3184
- x => x.BackgroudProcessingStatus === this.backgroundProcessingNum.InProcessing))) {
3185
- this._resetUploadingAssets();
3186
- }
3187
- ;
3298
+ this.checkProcessingAssets();
3188
3299
  this.paginator.pageIndex = this.assetService.pageIndex;
3189
3300
  this.paginator.pageSize = this.assetService.pageSize;
3190
3301
  this.paginator.length = this.assetService.fileTotal;
@@ -3319,15 +3430,8 @@ class AssetListComponent {
3319
3430
  * @param {?} res
3320
3431
  * @return {?}
3321
3432
  */
3322
- (res) => {
3323
- /** @type {?} */
3324
- const pagination = res && res.Meta || {};
3325
- /** @type {?} */
3326
- const assets = res && res.Data && res.Data.Children || [];
3327
- /** @type {?} */
3328
- const totalFile = res && res.Data && res.Data.TotalFile || 0;
3329
- this.assetService.setAssetList(assets, pagination, totalFile);
3330
- })).add((/**
3433
+ (res) => this.setAssetList(res)))
3434
+ .add((/**
3331
3435
  * @return {?}
3332
3436
  */
3333
3437
  () => {
@@ -3337,31 +3441,73 @@ class AssetListComponent {
3337
3441
  });
3338
3442
  }));
3339
3443
  }
3444
+ /**
3445
+ * @private
3446
+ * @param {?} res
3447
+ * @return {?}
3448
+ */
3449
+ setAssetList(res) {
3450
+ /** @type {?} */
3451
+ const pagination = res && res.Meta || {};
3452
+ /** @type {?} */
3453
+ const assets = res && res.Data && res.Data.Children || [];
3454
+ /** @type {?} */
3455
+ const totalFile = res && res.Data && res.Data.TotalFile || 0;
3456
+ this.assetService.setAssetList(assets, pagination, totalFile);
3457
+ }
3458
+ // Called on every new asset list: while some files are still processed in the background,
3459
+ // reload the list once after a delay. The reloaded list calls this again, until nothing is processing.
3340
3460
  /**
3341
3461
  * @private
3342
3462
  * @return {?}
3343
3463
  */
3344
- _resetUploadingAssets() {
3464
+ checkProcessingAssets() {
3465
+ this.stopProcessingCheck();
3345
3466
  /** @type {?} */
3346
- const reload = setInterval((/**
3467
+ const hasProcessingAssets = this.assets && this.assets.some((/**
3468
+ * @param {?} asset
3347
3469
  * @return {?}
3348
3470
  */
3349
- () => {
3350
- this.fetchChildrenAssets();
3351
- if (this.assets.find((/**
3352
- * @param {?} x
3471
+ (asset) => asset.BackgroudProcessingStatus === this.backgroundProcessingNum.InProcessing));
3472
+ if (hasProcessingAssets) {
3473
+ this.processingCheckTimer = setTimeout((/**
3353
3474
  * @return {?}
3354
3475
  */
3355
- x => x.BackgroudProcessingStatus === this.backgroundProcessingNum.Processed))) {
3356
- clearInterval(reload);
3357
- }
3358
- console.log('Upload Successfully!'); // interval will be cleared after completing this whole block
3359
- }), 5000);
3476
+ () => this.reloadProcessingAssets()), this.processingCheckDelay);
3477
+ }
3478
+ }
3479
+ // Silent reload, without the global loading bar
3480
+ /**
3481
+ * @private
3482
+ * @return {?}
3483
+ */
3484
+ reloadProcessingAssets() {
3485
+ if (!this.currentFolderId) {
3486
+ return;
3487
+ }
3488
+ this.processingCheckRequest = this.assetService
3489
+ .getChildrenAssets({ assetId: this.currentFolderId })
3490
+ .subscribe((/**
3491
+ * @param {?} res
3492
+ * @return {?}
3493
+ */
3494
+ (res) => this.setAssetList(res)));
3495
+ }
3496
+ /**
3497
+ * @private
3498
+ * @return {?}
3499
+ */
3500
+ stopProcessingCheck() {
3501
+ clearTimeout(this.processingCheckTimer);
3502
+ if (this.processingCheckRequest) {
3503
+ this.processingCheckRequest.unsubscribe();
3504
+ }
3360
3505
  }
3361
3506
  /**
3362
3507
  * @return {?}
3363
3508
  */
3364
3509
  ngOnDestroy() {
3510
+ this.stopProcessingCheck();
3365
3511
  this.unsubscribe$.next();
3366
3512
  this.unsubscribe$.complete();
3367
3513
  }
@@ -3401,6 +3547,21 @@ if (false) {
3401
3547
  AssetListComponent.prototype.assets;
3402
3548
  /** @type {?} */
3403
3549
  AssetListComponent.prototype.backgroundProcessingNum;
3550
+ /**
3551
+ * @type {?}
3552
+ * @private
3553
+ */
3554
+ AssetListComponent.prototype.processingCheckDelay;
3555
+ /**
3556
+ * @type {?}
3557
+ * @private
3558
+ */
3559
+ AssetListComponent.prototype.processingCheckTimer;
3560
+ /**
3561
+ * @type {?}
3562
+ * @private
3563
+ */
3564
+ AssetListComponent.prototype.processingCheckRequest;
3404
3565
  /**
3405
3566
  * @type {?}
3406
3567
  * @private
@@ -5846,20 +6007,78 @@ if (false) {
5846
6007
  */
5847
6008
  /** @type {?} */
5848
6009
  const AdminConfig = {
5849
- locale: 'en-US',
5850
- timeZone: 'local',
6010
+ locale: "en-US",
6011
+ countryName: {
6012
+ US: "United States",
6013
+ CA: "Canada",
6014
+ },
5851
6015
  format: {
5852
- date: 'MM/DD/YYYY',
5853
- dayMonth: 'MMM DD',
5854
- dateTime: 'MM/DD/YYYY HH:mm',
5855
- fullDateTime: 'MM/DD/YYYY HH:mm:ss',
5856
- dateTimeAM: 'MM/DD/YYYY hh:mm A',
5857
- apiDate: 'YYYY/MM/DD',
5858
- apiDateTime: 'YYYY-MM-DD[T]HH:mm:ssZ',
5859
- apiDateTimeNoZ: 'YYYY-MM-DD[T]HH:mm:ss',
5860
- apiDateMonthYear: 'MMM DD YYYY',
5861
- urlParam: 'YYYY-MM-DD',
6016
+ date: "MM/DD/YYYY",
6017
+ dayMonth: "MMM DD",
6018
+ dateTime: "MM/DD/YYYY HH:mm",
6019
+ fullDateTime: "MM/DD/YYYY HH:mm:ss",
6020
+ dateTimeAM: "MM/DD/YYYY hh:mm A",
6021
+ apiDate: "YYYY/MM/DD",
6022
+ apiDateTime: "YYYY-MM-DD[T]HH:mm:ssZ",
6023
+ apiDateTimeNoZ: "YYYY-MM-DD[T]HH:mm:ss",
6024
+ apiDateMonthYear: "MMM DD YYYY",
6025
+ urlParam: "YYYY-MM-DD",
6026
+ },
6027
+ mask: {
6028
+ phone: "(000) 000-0000",
6029
+ date: "M0/d0/0000",
6030
+ zipCode: {
6031
+ US: "00000",
6032
+ CA: "AAA AAA",
6033
+ },
6034
+ money: "0*.00",
6035
+ number: "0*.00",
6036
+ integer: "0*",
6037
+ tax: "00.0000",
6038
+ sku: "0000000000000",
6039
+ upca: "000000000000",
6040
+ pin: "000000",
6041
+ mi9ProductUpc: "00000000000000",
6042
+ },
6043
+ regex: {
6044
+ password: "^(?=.*[a-zA-Z])(?=.*[0-9]).{6,12}",
6045
+ bigyPassword: "^(?=.*[a-zA-Z])(?=.*[0-9]).{8,}$",
6046
+ url: /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\.%_~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/,
6047
+ shortCode: "^[A-Z0-9_]{1,20}$",
6048
+ longCode: "^[A-Z0-9_]{1,100}$",
6049
+ email: /^[\w-\.]+@([\w]+[\.-])+[\w-]{2,}$/,
6050
+ textWithoutSpecialChars: /^[a-zA-Z0-9\. ]+$/,
6051
+ textWithSpecialChars: /^[a-zA-Z0-9_-]+$/,
6052
+ // Allow char '_ -'
6053
+ textWithSpaceAndSpecialChars: /^[a-zA-Z0-9\. /_-]+$/,
6054
+ // Allow space and char '_ - /'
6055
+ address: /^[a-zA-Z0-9][a-zA-Z0-9\_\/\. ]+$/,
6056
+ leadTimeKeyPress: /^[0-9mhdw ]+$/,
6057
+ leadTime: [
6058
+ /^(?:(?<minutes>\d{0,2})m\s*)?(?:(?<hours>\d{0,3})h\s*)?(?:(?<days>\d{0,2})d\s*)?(?:(?<weeks>\d{0,2})w\s*)?$/,
6059
+ /^(?:(?<weeks>\d{0,2})w\s*)?(?:(?<days>\d{0,2})d\s*)?(?:(?<hours>\d{0,3})h\s*)?(?:(?<minutes>\d{0,2})m\s*)?$/,
6060
+ ],
6061
+ userPIN: /^[0-9]{6}$/,
6062
+ storeCode: /^[0-9]{1,10}$/,
6063
+ sku: /^[0-9]{1,14}$/,
6064
+ sku13: /^[0-9]{1,13}$/,
6065
+ keyConfigProvider: /^[a-zA-Z0-9!*()_+\-\[\]{}:\\|,.<>\/]*$/,
6066
+ //not allow character '?#%='
6067
+ textNoSpace: /^[a-zA-Z]+$/,
6068
+ textWithSpace: /^(\s+\S+\s*)*(?!\s).*$/,
6069
+ //not allow a string containing only white spaces
6070
+ slug: /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/,
6071
+ tag: /^[a-zA-Z0-9](-?_?[a-zA-Z0-9])*$/,
6072
+ noSpace: /^[a-zA-Z0-9!*()_+\-\[\]{}:\\|,.<>\/\?\=\&\%\#\@]*$/,
5862
6073
  },
6074
+ pattern: {},
6075
+ pipe: {},
6076
+ pageSizeOptions: [5, 10, 25, 50, 100],
6077
+ maxOrderNumber: 99999,
6078
+ // TinyMCE
6079
+ tinyHeightDefault: "75vh",
6080
+ tinyMCEPluginConfig: "print preview fullpage importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable help charmap quickbars emoticons",
6081
+ tinyMCEToolbarConfig: "undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | fileManagerButton | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist checklist | forecolor backcolor | pagebreak | charmap emoticons | fullscreen preview save print | image media template link anchor codesample | ltr rtl",
5863
6082
  };
5864
6083
 
5865
6084
  /**