@zohodesk/dot 1.0.0-temp-200.8 → 1.0.0-temp-213

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 (142) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +4 -0
  3. package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +1 -1
  4. package/assets/Appearance/light/mode/Dot_LightMode.module.css +1 -1
  5. package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +1 -1
  6. package/es/ActionButton/ActionButton.module.css +2 -2
  7. package/es/AlphabeticList/AlphabeticList.module.css +2 -2
  8. package/es/Attachment/Attachment.module.css +4 -8
  9. package/es/AttachmentViewer/Attachment.js +0 -50
  10. package/es/AttachmentViewer/AttachmentViewer.js +26 -112
  11. package/es/AttachmentViewer/AttachmentViewer.module.css +18 -41
  12. package/es/AttachmentViewer/props/defaultProps.js +1 -1
  13. package/es/AttachmentViewer/props/propTypes.js +1 -9
  14. package/es/AttachmentViewer/utils.js +13 -80
  15. package/es/ChannelIcon/ChannelIcon.module.css +2 -2
  16. package/es/DotProvider/hooks/useDotProvider.js +2 -2
  17. package/es/Drawer/Drawer.module.css +1 -1
  18. package/es/FormAction/FormAction.module.css +1 -1
  19. package/es/IconButton/IconButton.module.css +2 -2
  20. package/es/Message/Message.js +1 -1
  21. package/es/Message/Message.module.css +1 -1
  22. package/es/MessageBanner/MessageBanner.module.css +1 -1
  23. package/es/Onboarding/CarouselDots/CarouselDot/css/CarouselDot.module.css +3 -3
  24. package/es/Onboarding/css/Onboarding.module.css +2 -2
  25. package/es/PlusIcon/PlusIcon.module.css +1 -1
  26. package/es/TagWithIcon/TagWithIcon.module.css +2 -2
  27. package/es/ToastMessage/ToastMessage.module.css +8 -8
  28. package/es/Upload/Upload.module.css +1 -1
  29. package/es/avatar/AvatarClose/AvatarClose.module.css +3 -3
  30. package/es/avatar/AvatarCollision/AvatarCollision.module.css +3 -3
  31. package/es/avatar/AvatarIcon/AvatarIcon.module.css +1 -1
  32. package/es/avatar/AvatarStatus/AvatarStatus.module.css +2 -2
  33. package/es/avatar/AvatarThread/AvatarThread.module.css +2 -2
  34. package/es/avatar/AvatarUser/AvatarUser.module.css +3 -3
  35. package/es/avatar/AvatarWithTeam/AvatarWithTeam.module.css +1 -1
  36. package/es/common/dot_common.module.css +4 -0
  37. package/es/deprecated/SelectDropdown/SelectDropdown.module.css +2 -2
  38. package/es/dropdown/ToggleDropDown/ToggleDropDown.module.css +1 -1
  39. package/es/errorstate/EmptyStates.module.css +1 -1
  40. package/es/errorstate/WillBack/WillBack.module.css +1 -1
  41. package/es/form/fields/Fields.module.css +9 -9
  42. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.module.css +2 -2
  43. package/es/form/fields/TextEditorWrapper/TextEditorWrapper.js +1 -1
  44. package/es/form/layout/Section/ModuleFormSection.module.css +1 -1
  45. package/es/layout/SetupDetailLayout/SetupDetailLayout.module.css +4 -4
  46. package/es/layout/SubtabLayout/SubtabLayout.module.css +1 -1
  47. package/es/list/DotNew/DotNew.module.css +1 -1
  48. package/es/list/ListStencils/ListStencils.module.css +3 -3
  49. package/es/list/SecondaryText/SecondaryText.module.css +4 -4
  50. package/es/list/SecondryPanel/SecondryPanel.module.css +1 -1
  51. package/es/list/Subject/Subject.module.css +2 -2
  52. package/es/list/TagNew/TagNew.module.css +1 -1
  53. package/es/list/Thread/Thread.module.css +1 -1
  54. package/es/list/listCommon.module.css +3 -3
  55. package/es/list/status/StatusDropdown/StatusDropdown.js +2 -2
  56. package/es/list/status/StatusDropdown/StatusDropdown.module.css +1 -1
  57. package/es/list/status/StatusListItem/StatusListItem.module.css +2 -2
  58. package/es/lookup/EmptyPage/LookupEmptyPage.module.css +1 -1
  59. package/es/lookup/Section/LookupSection.module.css +1 -1
  60. package/es/lookup/header/Title/LookupTitle.module.css +1 -1
  61. package/es/lookup/header/ViewDropDown/ViewDropDown.module.css +4 -4
  62. package/es/lookup/header/lookupHeaderCommon.module.css +1 -1
  63. package/es/setup/header/Link/HeaderLink.module.css +2 -2
  64. package/es/setup/helptips/Title/HelpTipsTitle.module.css +1 -1
  65. package/es/setup/table/Text/TableText.module.css +4 -4
  66. package/es/utils/General.js +1 -23
  67. package/es/version2/GlobalNotification/GlobalNotification.module.css +2 -2
  68. package/es/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +1 -1
  69. package/es/version2/lookup/AlertLookup/AlertLookupNew.module.css +4 -4
  70. package/es/version2/lookup/alertLookupCommonNew.module.css +1 -1
  71. package/es/version2/notification/DesktopNotification/DesktopNotification.module.css +6 -6
  72. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +2 -2
  73. package/lib/ActionButton/ActionButton.module.css +2 -2
  74. package/lib/AlphabeticList/AlphabeticList.module.css +2 -2
  75. package/lib/Attachment/Attachment.module.css +4 -8
  76. package/lib/AttachmentViewer/Attachment.js +0 -60
  77. package/lib/AttachmentViewer/AttachmentViewer.js +23 -125
  78. package/lib/AttachmentViewer/AttachmentViewer.module.css +18 -41
  79. package/lib/AttachmentViewer/props/defaultProps.js +1 -1
  80. package/lib/AttachmentViewer/props/propTypes.js +1 -9
  81. package/lib/AttachmentViewer/utils.js +8 -85
  82. package/lib/ChannelIcon/ChannelIcon.module.css +2 -2
  83. package/lib/DotProvider/hooks/useDotProvider.js +2 -2
  84. package/lib/Drawer/Drawer.module.css +1 -1
  85. package/lib/FormAction/FormAction.module.css +1 -1
  86. package/lib/IconButton/IconButton.module.css +2 -2
  87. package/lib/Message/Message.js +2 -2
  88. package/lib/Message/Message.module.css +1 -1
  89. package/lib/MessageBanner/MessageBanner.module.css +1 -1
  90. package/lib/Onboarding/CarouselDots/CarouselDot/css/CarouselDot.module.css +3 -3
  91. package/lib/Onboarding/css/Onboarding.module.css +2 -2
  92. package/lib/PlusIcon/PlusIcon.module.css +1 -1
  93. package/lib/TagWithIcon/TagWithIcon.module.css +2 -2
  94. package/lib/ToastMessage/ToastMessage.module.css +8 -8
  95. package/lib/Upload/Upload.module.css +1 -1
  96. package/lib/avatar/AvatarClose/AvatarClose.module.css +3 -3
  97. package/lib/avatar/AvatarCollision/AvatarCollision.module.css +3 -3
  98. package/lib/avatar/AvatarIcon/AvatarIcon.module.css +1 -1
  99. package/lib/avatar/AvatarStatus/AvatarStatus.module.css +2 -2
  100. package/lib/avatar/AvatarThread/AvatarThread.module.css +2 -2
  101. package/lib/avatar/AvatarUser/AvatarUser.module.css +3 -3
  102. package/lib/avatar/AvatarWithTeam/AvatarWithTeam.module.css +1 -1
  103. package/lib/common/dot_common.module.css +4 -0
  104. package/lib/deprecated/SelectDropdown/SelectDropdown.module.css +2 -2
  105. package/lib/dropdown/ToggleDropDown/ToggleDropDown.module.css +1 -1
  106. package/lib/errorstate/EmptyStates.module.css +1 -1
  107. package/lib/errorstate/WillBack/WillBack.module.css +1 -1
  108. package/lib/form/fields/Fields.module.css +9 -9
  109. package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.module.css +2 -2
  110. package/lib/form/fields/TextEditorWrapper/TextEditorWrapper.js +2 -2
  111. package/lib/form/layout/Section/ModuleFormSection.module.css +1 -1
  112. package/lib/layout/SetupDetailLayout/SetupDetailLayout.module.css +4 -4
  113. package/lib/layout/SubtabLayout/SubtabLayout.module.css +1 -1
  114. package/lib/list/DotNew/DotNew.module.css +1 -1
  115. package/lib/list/ListStencils/ListStencils.module.css +3 -3
  116. package/lib/list/SecondaryText/SecondaryText.module.css +4 -4
  117. package/lib/list/SecondryPanel/SecondryPanel.module.css +1 -1
  118. package/lib/list/Subject/Subject.module.css +2 -2
  119. package/lib/list/TagNew/TagNew.module.css +1 -1
  120. package/lib/list/Thread/Thread.module.css +1 -1
  121. package/lib/list/listCommon.module.css +3 -3
  122. package/lib/list/status/StatusDropdown/StatusDropdown.js +3 -3
  123. package/lib/list/status/StatusDropdown/StatusDropdown.module.css +1 -1
  124. package/lib/list/status/StatusListItem/StatusListItem.module.css +2 -2
  125. package/lib/lookup/EmptyPage/LookupEmptyPage.module.css +1 -1
  126. package/lib/lookup/Section/LookupSection.module.css +1 -1
  127. package/lib/lookup/header/Title/LookupTitle.module.css +1 -1
  128. package/lib/lookup/header/ViewDropDown/ViewDropDown.module.css +4 -4
  129. package/lib/lookup/header/lookupHeaderCommon.module.css +1 -1
  130. package/lib/setup/header/Link/HeaderLink.module.css +2 -2
  131. package/lib/setup/helptips/Title/HelpTipsTitle.module.css +1 -1
  132. package/lib/setup/table/Text/TableText.module.css +4 -4
  133. package/lib/utils/General.js +1 -25
  134. package/lib/version2/GlobalNotification/GlobalNotification.module.css +2 -2
  135. package/lib/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +1 -1
  136. package/lib/version2/lookup/AlertLookup/AlertLookupNew.module.css +4 -4
  137. package/lib/version2/lookup/alertLookupCommonNew.module.css +1 -1
  138. package/lib/version2/notification/DesktopNotification/DesktopNotification.module.css +6 -6
  139. package/lib/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +2 -2
  140. package/package.json +19 -15
  141. package/result.json +0 -1
  142. package/unittest/index.html +0 -37
@@ -3,13 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getAttachmentIconDetails = getAttachmentIconDetails;
7
6
  exports.getExtensionFromFileName = getExtensionFromFileName;
8
7
  exports.isAudioFile = isAudioFile;
9
8
  exports.isBrowserSupportedFile = isBrowserSupportedFile;
10
-
11
- var _General = require("../utils/General");
12
-
13
9
  var UNASSIGNED = 'Unassigned';
14
10
  var BROWSER_SUPPORTED_FILES = ['pdf', 'text', 'txt', 'css', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'ico', 'sh', 'mp3', 'wav', 'ogg'];
15
11
 
@@ -29,60 +25,4 @@ function getExtensionFromFileName(fileName) {
29
25
  function isBrowserSupportedFile(fileName) {
30
26
  var extension = getExtensionFromFileName(fileName);
31
27
  return BROWSER_SUPPORTED_FILES.indexOf(extension) !== -1;
32
- }
33
-
34
- function getAttachmentIconDetails(fileName) {
35
- var _getExtensionFromFile;
36
-
37
- var extension = (_getExtensionFromFile = getExtensionFromFileName(fileName)) === null || _getExtensionFromFile === void 0 ? void 0 : _getExtensionFromFile.toLowerCase();
38
- if (!extension) return 'ZD-GN-fileUnknown';
39
- var imageExtensions = ['jpeg', 'jpg', 'png', 'apng', 'gif', 'bmp', 'tiff', 'tif', 'ico', 'svg', 'heic', 'webp'];
40
- var docExtensions = ['txt'];
41
- var pdfExtensions = ['pdf'];
42
- var htmlExtensions = ['html', 'htm', 'xhtml'];
43
- var pptExtensions = ['ppt', 'pps', 'odp', 'sxi', 'pptx', 'ppsx', 'pot', 'potx', 'key'];
44
- var zipExtensions = ['rar', 'jar', 'zip'];
45
- var wordExtensions = ['doc', 'docx', 'sxw', 'odt', 'docm', 'dot', 'dotm', 'dotx', 'rtf', 'pages'];
46
- var xmlExtensions = ['xml'];
47
- var sheetExtensions = ['xls', 'xlsx', 'xlsm', 'xlsb', 'sxc', 'ods', 'csv', 'tsv', 'numbers'];
48
- var audioExtensions = ['mp3', 'wav', 'wma', 'aac', 'm4r', 'ogg', 'opus'];
49
- var videoExtensions = ['mp4', 'mkv', 'mov', 'mpeg', 'flv', 'wmv', 'avi', 'webm', 'ogv'];
50
- var mailExtensions = ['eml', 'msg'];
51
- var linuxExtensions = ['sh', 'bin'];
52
- var cssExtensions = ['css'];
53
- var exeExtensions = ['exe'];
54
- var eventExtensions = ['ics'];
55
- if (imageExtensions.includes(extension)) return 'ZD-EF-fileImage';
56
- if (docExtensions.includes(extension)) return 'ZD-GN-fileDoc';
57
- if (pdfExtensions.includes(extension)) return 'ZD-EF-filePdf';
58
- if (pptExtensions.includes(extension)) return 'ZD-GN-filePpt';
59
- if (zipExtensions.includes(extension)) return 'ZD-EF-fileZip';
60
-
61
- if (wordExtensions.includes(extension)) {
62
- var _navigator$platform;
63
-
64
- var OSName = ((_navigator$platform = navigator.platform) === null || _navigator$platform === void 0 ? void 0 : _navigator$platform.toLowerCase()) || '';
65
- return OSName.includes('mac') || OSName.includes('linux') ? 'ZD-EF-fileOffice' : 'ZD-EF-fileWord';
66
- }
67
-
68
- if (xmlExtensions.includes(extension)) return 'ZD-EF-fileXml';
69
- if (sheetExtensions.includes(extension)) return 'ZD-GN-fileSheet';
70
- if (audioExtensions.includes(extension)) return 'ZD-EF-fileMp3';
71
- if (videoExtensions.includes(extension)) return 'ZD-EF-fileMp4';
72
- if (mailExtensions.includes(extension)) return 'ZD-GN-fileMail';
73
- if (linuxExtensions.includes(extension)) return 'ZD-EF-linux';
74
- if (cssExtensions.includes(extension)) return 'ZD-EF-clrCss';
75
- if (exeExtensions.includes(extension)) return 'ZD-EF-exe';
76
- if (eventExtensions.includes(extension)) return 'ZD-TK-event';
77
-
78
- if (htmlExtensions.includes(extension)) {
79
- var _getBrowserWithVersio;
80
-
81
- var browser = ((_getBrowserWithVersio = (0, _General.getBrowserWithVersion)()) === null || _getBrowserWithVersio === void 0 ? void 0 : _getBrowserWithVersio.toLowerCase()) || '';
82
- if (browser.includes('chrome') || browser.includes('safari')) return 'ZD-EF-fileXml';
83
- if (browser.includes('ie') || browser.includes('edge')) return 'ZD-EF-explorer';
84
- return 'ZD-EF-firebox';
85
- }
86
-
87
- return 'ZD-GN-fileUnknown';
88
28
  }
@@ -21,12 +21,8 @@ var _Avatar = _interopRequireDefault(require("@zohodesk/components/lib/Avatar/Av
21
21
 
22
22
  var _CustomResponsive = require("@zohodesk/components/lib/Responsive/CustomResponsive");
23
23
 
24
- var _Typography = _interopRequireDefault(require("@zohodesk/components/lib/Typography/Typography"));
25
-
26
24
  var _IdProvider = require("@zohodesk/components/lib/Provider/IdProvider");
27
25
 
28
- var _Button = _interopRequireDefault(require("@zohodesk/components/es/Button/Button"));
29
-
30
26
  var _AttachmentImage = _interopRequireDefault(require("./AttachmentImage"));
31
27
 
32
28
  var _Link = _interopRequireDefault(require("../Link/Link"));
@@ -39,9 +35,11 @@ var _Attachment = require("./Attachment");
39
35
 
40
36
  var _General = require("../utils/General");
41
37
 
38
+ var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
39
+
42
40
  var _utils = require("./utils");
43
41
 
44
- var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
42
+ var _audio_thumbnail = _interopRequireDefault(require("../../images/audio_thumbnail.png"));
45
43
 
46
44
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
47
45
 
@@ -119,45 +117,10 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
119
117
  _this.getUpdateDataList = _this.getUpdateDataList.bind(_assertThisInitialized(_this));
120
118
  _this.zoomMaintain = _this.zoomMaintain.bind(_assertThisInitialized(_this));
121
119
  _this.handleMenuValidation = _this.handleMenuValidation.bind(_assertThisInitialized(_this));
122
- _this.getPreviewIconData = _this.getPreviewIconData.bind(_assertThisInitialized(_this));
123
- _this.renderIframe = _this.renderIframe.bind(_assertThisInitialized(_this));
124
120
  return _this;
125
121
  }
126
122
 
127
123
  _createClass(AttachmentViewer, [{
128
- key: "isImageFileType",
129
- value: function isImageFileType(fileName) {
130
- var _getExtensionFromFile;
131
-
132
- var extension = (_getExtensionFromFile = (0, _Attachment.getExtensionFromFileName)(fileName)) === null || _getExtensionFromFile === void 0 ? void 0 : _getExtensionFromFile.toLowerCase();
133
- if (!extension) return false;
134
- return _utils.FILE_EXTENSIONS.image.map(function (ext) {
135
- return ext.toLowerCase();
136
- }).includes(extension);
137
- }
138
- }, {
139
- key: "isVideoFileType",
140
- value: function isVideoFileType(fileName) {
141
- var _getExtensionFromFile2;
142
-
143
- var extension = (_getExtensionFromFile2 = (0, _Attachment.getExtensionFromFileName)(fileName)) === null || _getExtensionFromFile2 === void 0 ? void 0 : _getExtensionFromFile2.toLowerCase();
144
- if (!extension) return false;
145
- return _utils.FILE_EXTENSIONS.video.map(function (ext) {
146
- return ext.toLowerCase();
147
- }).includes(extension);
148
- }
149
- }, {
150
- key: "isAudioFileType",
151
- value: function isAudioFileType(fileName) {
152
- var _getExtensionFromFile3;
153
-
154
- var extension = (_getExtensionFromFile3 = (0, _Attachment.getExtensionFromFileName)(fileName)) === null || _getExtensionFromFile3 === void 0 ? void 0 : _getExtensionFromFile3.toLowerCase();
155
- if (!extension) return false;
156
- return _utils.FILE_EXTENSIONS.audio.map(function (ext) {
157
- return ext.toLowerCase();
158
- }).includes(extension);
159
- }
160
- }, {
161
124
  key: "componentDidMount",
162
125
  value: function componentDidMount() {
163
126
  this.handleMenuValidation();
@@ -200,17 +163,13 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
200
163
  var _this$state = this.state,
201
164
  data = _this$state.data,
202
165
  selectedIndex = _this$state.selectedIndex;
203
- var allowedPreviewExtensionsData = this.props.allowedPreviewExtensionsData;
204
166
  var selectedAttachment = data[selectedIndex] || {};
205
167
  var selectedAttachmentViewUrl = selectedAttachment.viewUrl;
206
168
  var selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
207
169
  var selectedAttachmentName = selectedAttachment.name;
208
- var selectedAttachmentPreviewUrl = selectedAttachment.previewurl;
209
170
  (0, _utils.checkFileSourcesValidation)({
210
171
  fileName: selectedAttachmentName,
211
- viewURL: selectedAttachmentViewUrl,
212
- previewUrl: selectedAttachmentPreviewUrl,
213
- allowedPreviewExtensionsData: allowedPreviewExtensionsData
172
+ viewURL: selectedAttachmentViewUrl
214
173
  }).then(function (fileSourceValidation) {
215
174
  var isViewURLValid = fileSourceValidation.isViewURLValid,
216
175
  canZoom = fileSourceValidation.canZoom;
@@ -373,38 +332,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
373
332
  }])
374
333
  };
375
334
  }
376
- }, {
377
- key: "getPreviewIconData",
378
- value: function getPreviewIconData(name, size, dataId) {
379
- var fileUnknown = {
380
- iconName: 'ZD-GN-fileUnknown',
381
- iconSize: '40'
382
- };
383
- var fileIconName = (0, _Attachment.getAttachmentIconDetails)(name);
384
- var fileDetails = name ? {
385
- iconName: fileIconName,
386
- iconSize: size
387
- } : fileUnknown;
388
- var iconName = fileDetails.iconName,
389
- iconSize = fileDetails.iconSize;
390
- return /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
391
- iconClass: _AttachmentViewerModule["default"].prevFooterIcon,
392
- name: iconName,
393
- size: iconSize,
394
- "data-id": dataId
395
- });
396
- }
397
- }, {
398
- key: "renderIframe",
399
- value: function renderIframe(previewurl) {
400
- return /*#__PURE__*/_react["default"].createElement("iframe", _extends({
401
- src: previewurl,
402
- className: _AttachmentViewerModule["default"].previewFrame
403
- }, this.props.customProps.iframeProps));
404
- }
405
335
  }, {
406
336
  key: "imgPreviewView",
407
- value: function imgPreviewView(downloadUrl) {
337
+ value: function imgPreviewView() {
408
338
  var _this5 = this;
409
339
 
410
340
  var _this$state3 = this.state,
@@ -415,9 +345,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
415
345
  isPreviewAttachmentValid = _this$state3.isPreviewAttachmentValid;
416
346
  var _this$props = this.props,
417
347
  maintainZoom = _this$props.maintainZoom,
418
- dataId = _this$props.dataId,
419
- i18nKeys = _this$props.i18nKeys,
420
- renderUnSupportedElement = _this$props.renderUnSupportedElement;
348
+ dataId = _this$props.dataId;
421
349
 
422
350
  var getImgStyle = function getImgStyle(i) {
423
351
  var position;
@@ -455,25 +383,16 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
455
383
  _data$customClass = data.customClass,
456
384
  customClass = _data$customClass === void 0 ? {} : _data$customClass,
457
385
  _data$customProps = data.customProps,
458
- customProps = _data$customProps === void 0 ? {} : _data$customProps,
459
- previewurl = data.previewurl,
460
- type = data.type;
386
+ customProps = _data$customProps === void 0 ? {} : _data$customProps;
461
387
  var _customProps$audioPro = customProps.audioProps,
462
388
  audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
463
389
  _customProps$imagePro = customProps.imageProps,
464
- imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro,
465
- _customProps$videoPro = customProps.videoProps,
466
- videoProps = _customProps$videoPro === void 0 ? {} : _customProps$videoPro;
390
+ imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro;
467
391
  var _customClass$customIm = customClass.customImageClass,
468
392
  customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
469
393
  _customClass$customCh = customClass.customChildrenClass,
470
394
  customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
471
395
  var retainZoom = canZoom && selectedIndex == i && maintainZoom;
472
- var extension = (0, _Attachment.getExtensionFromFileName)(name);
473
- var _i18nKeys$previewUnsu = i18nKeys.previewUnsupportedText,
474
- previewUnsupportedText = _i18nKeys$previewUnsu === void 0 ? "Preview not available for the selected file type." : _i18nKeys$previewUnsu,
475
- _i18nKeys$downloadTex = i18nKeys.downloadText,
476
- downloadText = _i18nKeys$downloadTex === void 0 ? "Download" : _i18nKeys$downloadTex;
477
396
  return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
478
397
  className: _AttachmentViewerModule["default"].imgBox,
479
398
  id: "imgBox".concat(i),
@@ -484,51 +403,29 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
484
403
  }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
485
404
  className: _AttachmentViewerModule["default"].imgRef,
486
405
  id: "imgPreviewRef".concat(i)
487
- }, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _this5.isAudioFileType(name) ? /*#__PURE__*/_react["default"].createElement("audio", _extends({
488
- controls: true,
489
- className: _AttachmentViewerModule["default"].zoomIn,
490
- "data-id": "".concat(dataId, "_audioPreview"),
491
- "data-test-id": "".concat(dataId, "_audioPreview")
492
- }, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
493
- src: previewurl,
494
- type: "audio/".concat(extension)
495
- })) : _this5.isVideoFileType(name) ? /*#__PURE__*/_react["default"].createElement("video", _extends({
406
+ }, (0, _Attachment.isAudioFile)(name) ? selectedIndex == i ? /*#__PURE__*/_react["default"].createElement("video", _extends({
407
+ autoPlay: true,
496
408
  controls: true,
497
409
  className: _AttachmentViewerModule["default"].zoomIn,
498
410
  "data-id": "".concat(dataId, "_videoPreview"),
499
411
  "data-test-id": "".concat(dataId, "_videoPreview")
500
- }, videoProps), /*#__PURE__*/_react["default"].createElement("source", {
412
+ }, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
501
413
  src: viewUrl,
502
- type: "video/".concat(extension)
503
- })) : _this5.isImageFileType(name) || children ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
414
+ type: "audio/".concat((0, _Attachment.getExtensionFromFileName)(name))
415
+ })) : null : /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
504
416
  customClass: {
505
- customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, " ").concat(canZoom || retainZoom ? isZoomed ? "".concat(_AttachmentViewerModule["default"].zoomedImg, " ").concat(_AttachmentViewerModule["default"].zoomOutCursor) : "".concat(_AttachmentViewerModule["default"].normalImg, " ").concat(_AttachmentViewerModule["default"].zoomInCursor) : '', " ").concat(customImageClass),
417
+ customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, "\n ").concat(canZoom || retainZoom ? isZoomed ? "".concat(_AttachmentViewerModule["default"].zoomedImg, " ").concat(_AttachmentViewerModule["default"].zoomOutCursor) : "".concat(_AttachmentViewerModule["default"].normalImg, " ").concat(_AttachmentViewerModule["default"].zoomInCursor) : '', " ").concat(customImageClass),
506
418
  customChildrenClass: customChildrenClass
507
419
  },
508
420
  src: viewUrl,
509
421
  onClick: isPreviewAttachmentValid ? isZoomed ? _this5.zoomOut.bind(_this5, i) : function (e) {
510
- return _this5.zoomIn(e, i, true);
422
+ _this5.zoomIn(e, i, true);
511
423
  } : undefined,
512
424
  alt: name,
513
425
  dataId: dataId,
514
426
  id: "img".concat(i),
515
427
  isCover: false
516
- }, imageProps), children) : type === "document" && previewurl != null ? _this5.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/_react["default"].createElement("div", {
517
- className: _AttachmentViewerModule["default"].previewNone
518
- }, /*#__PURE__*/_react["default"].createElement("div", {
519
- className: _AttachmentViewerModule["default"].fileTypeImg
520
- }, _this5.getPreviewIconData(name, '70')), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
521
- $ui_size: "20",
522
- $ui_weight: "semibold"
523
- }, previewUnsupportedText), /*#__PURE__*/_react["default"].createElement(_Link["default"], {
524
- href: downloadUrl,
525
- className: _AttachmentViewerModule["default"].downloadLink,
526
- hasReload: true,
527
- download: true
528
- }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
529
- palette: "primaryFilled",
530
- text: downloadText
531
- }))))));
428
+ }, imageProps), children)));
532
429
  });
533
430
  }
534
431
  }, {
@@ -554,7 +451,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
554
451
  avatarProps = _customProps$avatarPr === void 0 ? {} : _customProps$avatarPr;
555
452
  var totalLen = data.length;
556
453
  var selectedAttachment = data[selectedIndex] || {};
557
- var selectedImgUrl = selectedAttachment.previewurl || selectedAttachment.viewUrl;
454
+ var selectedImgUrl = selectedAttachment.viewUrl;
558
455
  var downloadUrl = selectedAttachment.downloadUrl;
559
456
  var authorHref;
560
457
  var authorName;
@@ -709,7 +606,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
709
606
  eleRef: _this6.setImgBoxRef,
710
607
  scroll: "both",
711
608
  flexible: true
712
- }, _this6.imgPreviewView(downloadUrl)), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
609
+ }, _this6.imgPreviewView()), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
713
610
  className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ''),
714
611
  onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex + 1),
715
612
  "data-title": i18nKeys.nextText,
@@ -765,13 +662,14 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
765
662
  _item$customProps = item.customProps,
766
663
  customProps = _item$customProps === void 0 ? {} : _item$customProps;
767
664
  var thumbnail = item.thumbnail;
768
- var isImageFileType = _this6.isImageFileType(name) || thumbnail;
769
665
  var _customClass$customIm2 = customClass.customImageClass,
770
666
  customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
771
667
  _customClass$customCh2 = customClass.customChildrenClass,
772
668
  customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
669
+ thumbnail = (0, _Attachment.isAudioFile)(name) ? thumbnail || _audio_thumbnail["default"] : thumbnail; //fallback thumbnail for audio
670
+
773
671
  return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
774
- className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : '', " ").concat(isImageFileType ? '' : _AttachmentViewerModule["default"].previewIconDiv),
672
+ className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : ''),
775
673
  key: index,
776
674
  onClick: _this6.changeSelectedIndex.bind(_this6, index),
777
675
  eleRef: function eleRef(el) {
@@ -779,7 +677,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
779
677
  },
780
678
  dataId: "attachPreviewList",
781
679
  "data-title": name
782
- }, isImageFileType || children ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
680
+ }, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
783
681
  src: thumbnail || viewUrl,
784
682
  size: "small",
785
683
  alt: name,
@@ -788,7 +686,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
788
686
  customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
789
687
  },
790
688
  dataId: dataId
791
- }, customProps), children) : _this6.getPreviewIconData(name, '40'));
689
+ }, customProps), children));
792
690
  }))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
793
691
  dataId: "attachToggle",
794
692
  onClick: _this6.togglePViewList,
@@ -2,7 +2,7 @@
2
2
  height: var(--zd_size40) ;
3
3
  position: relative;
4
4
  z-index: 1;
5
- composes: alignVertical from '~@zohodesk/components/lib/common/common.module.css';
5
+ composes: alignVertical from '~@zohodesk/components/es/common/common.module.css';
6
6
  background-color: var(--zdt_attachmentviewer_header_bg);
7
7
  padding: 0 var(--zd_size15) ;
8
8
  border-bottom: 1px solid var(--zdt_attachmentviewer_header_border);
@@ -10,7 +10,7 @@
10
10
 
11
11
  .title {
12
12
  max-width: 50% ;
13
- composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
13
+ composes: dotted from '~@zohodesk/components/es/common/common.module.css';
14
14
  }
15
15
 
16
16
  [dir=ltr] .title {
@@ -23,7 +23,7 @@
23
23
 
24
24
  .count {
25
25
  position: absolute;
26
- composes: xMiddle from '~@zohodesk/components/lib/common/common.module.css';
26
+ composes: xMiddle from '~@zohodesk/components/es/common/common.module.css';
27
27
  padding: 0 var(--zd_size10) ;
28
28
  }
29
29
 
@@ -79,13 +79,13 @@
79
79
  font-size: var(--zd_font_size22) ;
80
80
  height: var(--zd_size38) ;
81
81
  width: var(--zd_size38) ;
82
- line-height: 1.6;
82
+ line-height: 1.6364;
83
83
  border-radius: 50%;
84
84
  cursor: pointer;
85
85
  }
86
86
 
87
87
  .preview {
88
- composes: posrel from '~@zohodesk/components/lib/common/common.module.css';
88
+ composes: posrel from '~@zohodesk/components/es/common/common.module.css';
89
89
  text-align: center;
90
90
  margin: var(--zd_size20) 0 ;
91
91
  }
@@ -94,7 +94,7 @@
94
94
  max-height: 100% ;
95
95
  max-width: 90% ;
96
96
  position: absolute;
97
- composes: middleBoth from '~@zohodesk/components/lib/common/common.module.css';
97
+ composes: middleBoth from '~@zohodesk/components/es/common/common.module.css';
98
98
  }
99
99
 
100
100
  .zoomOut {
@@ -230,10 +230,14 @@
230
230
  transform: rotateX(0deg);
231
231
  }
232
232
 
233
- .previewFrame {
234
- height: 100% ;
235
- width: 100% ;
236
- border: 0;
233
+ .isAudio {
234
+ composes: audioImage from '../common/dot_common.module.css';
235
+ width: var(--zd_size100) ;
236
+ background-size: 100% 100%;
237
+ }
238
+
239
+ .isAudio .image {
240
+ opacity: 0;
237
241
  }
238
242
 
239
243
  .video {
@@ -269,7 +273,7 @@
269
273
  height: 100% ;
270
274
  max-width: 100% ;
271
275
  max-height: 100% ;
272
- composes: dflex from '~@zohodesk/components/lib/common/common.module.css';
276
+ composes: dflex from '~@zohodesk/components/es/common/common.module.css';
273
277
  }
274
278
 
275
279
  .img {
@@ -302,7 +306,7 @@
302
306
 
303
307
  .spinLoad {
304
308
  position: absolute;
305
- composes: middleBoth from '~@zohodesk/components/lib/common/common.module.css';
309
+ composes: middleBoth from '~@zohodesk/components/es/common/common.module.css';
306
310
  height: var(--zd_size18) ;
307
311
  width: var(--zd_size18) ;
308
312
  cursor: progress
@@ -312,7 +316,7 @@
312
316
  height: 100% ;
313
317
  width: 100% ;
314
318
  composes: rotate from '../common/dot_animation.module.css';
315
- composes: infinite from '~@zohodesk/components/lib/common/animation.module.css';
319
+ composes: infinite from '~@zohodesk/components/es/common/animation.module.css';
316
320
  border: 2px solid var(--zdt_attachmentviewer_loader_border);
317
321
  border-top-color: var(--zdt_attachmentviewer_loader_border_top);
318
322
  border-radius: 50%;
@@ -348,7 +352,7 @@
348
352
  .authorName {
349
353
  font-size: var(--zd_font_size15) ;
350
354
  color: var(--zdt_attachmentviewer_title_text);
351
- composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
355
+ composes: dotted from '~@zohodesk/components/es/common/common.module.css';
352
356
  margin: 0 var(--zd_size10) ;
353
357
  }
354
358
 
@@ -358,31 +362,4 @@
358
362
  background-color: var(--dot_mirror);
359
363
  border: 0;
360
364
  cursor: pointer;
361
- }
362
-
363
- .fileTypeImg {
364
- margin-bottom: var(--zd_size30) ;
365
- }
366
-
367
- .previewNone {
368
- color: var(--zdt_attachmentviewer_title_text);
369
- max-width: 70% ;
370
- text-align: center;
371
- margin: auto ;
372
- }
373
-
374
- .downloadLink {
375
- display: inline-block;
376
- padding-top: var(--zd_size15) ;
377
- }
378
-
379
- .previewIconDiv {
380
- width: var(--zd_size60) ;
381
- composes: dflex from '~@zohodesk/components/lib/common/common.module.css';
382
- }
383
-
384
- .prevFooterIcon {
385
- color: var(--zdt_attachmentviewer_title_text);
386
- padding: var(--zd_size2) ;
387
- margin: auto ;
388
365
  }
@@ -15,10 +15,10 @@ exports.AttachmentImage_defaultProps = AttachmentImage_defaultProps;
15
15
  var AttachmentViewer_defaultProps = {
16
16
  responsiveId: "Helmet",
17
17
  needDownload: true,
18
+ i18nKeys: {},
18
19
  maintainZoom: false,
19
20
  isActive: false,
20
21
  dataId: 'AttachmentViewer',
21
- i18nKeys: {},
22
22
  customProps: {}
23
23
  };
24
24
  exports.AttachmentViewer_defaultProps = AttachmentViewer_defaultProps;
@@ -38,8 +38,7 @@ var AttachmentViewer_propTypes = {
38
38
  downloadText: _propTypes["default"].string,
39
39
  closeText: _propTypes["default"].string,
40
40
  hideText: _propTypes["default"].string,
41
- showText: _propTypes["default"].string,
42
- previewUnsupportedText: _propTypes["default"].string
41
+ showText: _propTypes["default"].string
43
42
  }),
44
43
  needDownload: _propTypes["default"].string,
45
44
  previewObj: _propTypes["default"].object,
@@ -47,13 +46,6 @@ var AttachmentViewer_propTypes = {
47
46
  maintainZoom: _propTypes["default"].bool,
48
47
  isActive: _propTypes["default"].bool,
49
48
  dataId: _propTypes["default"].string,
50
- allowedPreviewExtensionsData: _propTypes["default"].shape({
51
- audio: _propTypes["default"].arrayOf(_propTypes["default"].string),
52
- video: _propTypes["default"].arrayOf(_propTypes["default"].string),
53
- image: _propTypes["default"].arrayOf(_propTypes["default"].string),
54
- document: _propTypes["default"].arrayOf(_propTypes["default"].string)
55
- }),
56
- renderUnSupportedElement: _propTypes["default"].func,
57
49
  customProps: _propTypes["default"].shape({
58
50
  avatarProps: _propTypes["default"].exact(_propTypes2.propTypes)
59
51
  })
@@ -3,12 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ZoomEvent = exports.Zoom = exports.FILE_EXTENSIONS = void 0;
6
+ exports.ZoomEvent = exports.Zoom = void 0;
7
7
  exports.checkAudioUrlValidity = checkAudioUrlValidity;
8
8
  exports.checkFileSourcesValidation = checkFileSourcesValidation;
9
9
  exports.checkImageValidity = checkImageValidity;
10
- exports.checkVideoUrlValidity = checkVideoUrlValidity;
11
- exports.isValidDocument = isValidDocument;
12
10
 
13
11
  var _Attachment = require("./Attachment");
14
12
 
@@ -155,21 +153,6 @@ function checkImageValidity(src) {
155
153
  });
156
154
  }
157
155
 
158
- function checkVideoUrlValidity(url) {
159
- return new Promise(function (resolve) {
160
- var video = document.createElement('video');
161
- video.src = url;
162
-
163
- video.oncanplaythrough = function () {
164
- return resolve(true);
165
- };
166
-
167
- video.onerror = function () {
168
- return resolve(false);
169
- };
170
- });
171
- }
172
-
173
156
  function checkAudioUrlValidity(url) {
174
157
  return new Promise(function (resolve) {
175
158
  var audio = new Audio(url);
@@ -186,85 +169,25 @@ function checkAudioUrlValidity(url) {
186
169
 
187
170
  ;
188
171
 
189
- function isValidDocument(url) {
190
- if (!url) {
191
- return false;
192
- }
193
-
194
- return true;
195
- }
196
-
197
- var FILE_EXTENSIONS = {
198
- audio: ['mp3', 'wav', 'wma', 'aac', 'm4r', 'm4a', 'flac', 'aiff', 'alac', 'ogg', 'opus', 'amr', 'mid', 'midi'],
199
- video: ['mp4', 'mkv', 'mov', 'mpeg', 'mpg', 'flv', 'wmv', 'avi', 'webm', 'ogv', 'm4v', '3gp', '3g2'],
200
- document: ['doc', 'docx', 'docm', 'dot', 'dotx', 'dotm', 'odt', 'rtf', 'txt', 'md', 'pages', 'xls', 'xlsx', 'xlsm', 'xlsb', 'csv', 'tsv', 'ods', 'sxc', 'numbers', 'ppt', 'pptx', 'pps', 'ppsx', 'pot', 'potx', 'odp', 'sxi', 'key', 'pdf', 'xml', 'json', 'yaml', 'yml', 'log', 'eml', 'msg'],
201
- image: ['jpeg', 'jpg', 'png', 'apng', 'gif', 'bmp', 'dib', 'tiff', 'tif', 'ico', 'svg', 'webp', 'heic', 'heif', 'jfif', 'pjpeg', 'pjp', 'avif']
202
- };
203
- exports.FILE_EXTENSIONS = FILE_EXTENSIONS;
204
-
205
172
  function checkFileSourcesValidation(_ref) {
206
- var _getExtensionFromFile;
207
-
208
173
  var fileName = _ref.fileName,
209
- viewURL = _ref.viewURL,
210
- previewUrl = _ref.previewUrl,
211
- allowedPreviewExtensionsData = _ref.allowedPreviewExtensionsData;
212
- var extension = (_getExtensionFromFile = (0, _Attachment.getExtensionFromFileName)(fileName)) === null || _getExtensionFromFile === void 0 ? void 0 : _getExtensionFromFile.toLowerCase();
213
-
214
- if (!extension) {
215
- return Promise.resolve({
216
- isViewURLValid: false,
217
- canZoom: false
218
- });
219
- }
174
+ viewURL = _ref.viewURL;
220
175
 
221
- var extensionSource = allowedPreviewExtensionsData || FILE_EXTENSIONS;
222
-
223
- var fileExtensionValidation = function fileExtensionValidation(type) {
224
- var list = extensionSource[type];
225
- if (!Array.isArray(list)) return false;
226
- return list.map(function (e) {
227
- return e.toLowerCase();
228
- }).includes(extension);
229
- };
230
-
231
- if (fileExtensionValidation('audio')) {
232
- return checkAudioUrlValidity(viewURL).then(function (isURLValid) {
233
- return {
234
- isViewURLValid: isURLValid,
235
- canZoom: false
236
- };
237
- });
238
- }
239
-
240
- if (fileExtensionValidation('video')) {
241
- return checkVideoUrlValidity(viewURL).then(function (isURLValid) {
176
+ if ((0, _Attachment.isAudioFile)(fileName)) {
177
+ var audioValidityPromise = checkAudioUrlValidity(viewURL);
178
+ return audioValidityPromise.then(function (isURLValid) {
242
179
  return {
243
180
  isViewURLValid: isURLValid,
244
181
  canZoom: false
245
182
  };
246
183
  });
247
- }
248
-
249
- if (fileExtensionValidation('document')) {
250
- var isValid = isValidDocument(previewUrl, fileName);
251
- return Promise.resolve({
252
- isViewURLValid: isValid,
253
- canZoom: false
254
- });
255
- }
256
-
257
- if (fileExtensionValidation('image')) {
258
- return checkImageValidity(viewURL).then(function (isURLValid) {
184
+ } else {
185
+ var imageValidityPromise = checkImageValidity(viewURL);
186
+ return imageValidityPromise.then(function (isURLValid) {
259
187
  return {
260
188
  isViewURLValid: isURLValid,
261
189
  canZoom: isURLValid
262
190
  };
263
191
  });
264
192
  }
265
-
266
- return Promise.resolve({
267
- isViewURLValid: false,
268
- canZoom: false
269
- });
270
193
  }