@topconsultnpm/sdkui-react-beta 6.16.72 → 6.16.73

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.
@@ -124,27 +124,10 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
124
124
  useEffect(() => {
125
125
  const checkIsMobile = () => {
126
126
  const userAgent = navigator.userAgent || navigator.vendor || window.opera;
127
- // Only detect actual mobile/tablet devices, NOT desktop browsers
128
- const isMobileDevice =
129
- // Traditional mobile detection (phones and tablets)
130
- /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) ||
131
- // Additional Android tablet detection (covers tablets in landscape)
132
- /android.*tablet|android.*mobile/i.test(userAgent) ||
133
- // Touch-only devices (excludes laptops with touchscreen)
134
- (('ontouchstart' in window || navigator.maxTouchPoints > 0) &&
135
- !/Windows NT|Macintosh|Linux/.test(userAgent)) ||
136
- // Small screen mobile devices only
137
- (window.screen.width <= 768 && /Mobi|Android/i.test(userAgent));
127
+ const isMobileDevice = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent);
138
128
  setIsMobile(isMobileDevice);
139
129
  };
140
130
  checkIsMobile();
141
- // Listen for orientation changes (important for tablets)
142
- window.addEventListener('orientationchange', checkIsMobile);
143
- window.addEventListener('resize', checkIsMobile);
144
- return () => {
145
- window.removeEventListener('orientationchange', checkIsMobile);
146
- window.removeEventListener('resize', checkIsMobile);
147
- };
148
131
  }, []);
149
132
  useEffect(() => {
150
133
  if (fileBlob) {
@@ -187,17 +170,7 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
187
170
  if (fileBlob.type.includes('image')) {
188
171
  return (_jsx(ImageViewer, { fileBlob: fileBlob, alt: '' }));
189
172
  }
190
- // Check if device has limited PDF support (only for mobile/tablet devices)
191
- const hasLimitedPDFSupport = () => {
192
- const userAgent = navigator.userAgent || navigator.vendor || window.opera;
193
- // Only check for actual mobile/tablet devices, NOT desktop browsers
194
- const isAndroidMobile = /android/i.test(userAgent) && (/mobile|tablet/i.test(userAgent) || window.screen.width <= 1024);
195
- const isIOSMobile = /iphone|ipad|ipod/i.test(userAgent);
196
- const isOtherMobile = /webos|blackberry|iemobile|opera mini/i.test(userAgent);
197
- // Return true only for actual mobile devices, not desktop browsers
198
- return isMobile && (isAndroidMobile || isIOSMobile || isOtherMobile);
199
- };
200
- if (fileType === 'application/pdf' && hasLimitedPDFSupport()) {
173
+ if (fileType === 'application/pdf' && isMobile) {
201
174
  return (_jsxs("div", { style: {
202
175
  padding: '40px',
203
176
  textAlign: 'center',
@@ -95,6 +95,8 @@ interface TMBlogsProps {
95
95
  shouldSelectLastBlog?: boolean;
96
96
  /** Updates the flag that determines if the blog component should automatically select the last blog. */
97
97
  updateShouldSelectLastBlog?: (value: boolean) => void;
98
+ /** Refresh Home Page News Callback */
99
+ refreshHomePageNews?: () => Promise<void>;
98
100
  }
99
101
  declare const TMBlogs: (props: TMBlogsProps) => import("react/jsx-runtime").JSX.Element;
100
102
  export default TMBlogs;
@@ -17,6 +17,7 @@ import { useDcmtOperations } from '../../hooks/useDcmtOperations';
17
17
  import { DownloadTypes } from '../../ts';
18
18
  import TMDcmtForm from '../features/documents/TMDcmtForm';
19
19
  import { TMColors } from '../../utils/theme';
20
+ import ShowAlert from '../base/TMAlert';
20
21
  let localAbortController = new AbortController();
21
22
  const TMBlogs = (props) => {
22
23
  const { id, allData, showExtendedAttachments = true, treeFs, draftLatestInfoMap, archivedDocumentMap, updateVisualizedBlogCallback, height, width, scrollToBottom = true, header, showIconHeader = true, color = colors.PRIMARY_BLUE, handleNavigateToWGs, showId, setShowId, contextMenuParams = {
@@ -30,7 +31,7 @@ const TMBlogs = (props) => {
30
31
  isRestoreEnabled: false,
31
32
  isRefreshEnabled: false,
32
33
  isCreateContextualTask: false,
33
- }, refreshCallback, showCommentFormCallback, showTaskFormCallback, handleAttachmentFocus, showFloatingCommentButton = false, context, layoutMode = 'stacked', markBlogAsRead, shouldSelectLastBlog = false, updateShouldSelectLastBlog } = props;
34
+ }, refreshCallback, showCommentFormCallback, showTaskFormCallback, handleAttachmentFocus, showFloatingCommentButton = false, context, layoutMode = 'stacked', markBlogAsRead, shouldSelectLastBlog = false, updateShouldSelectLastBlog, refreshHomePageNews } = props;
34
35
  const [uiId, setUiId] = useState('');
35
36
  // Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
36
37
  const deviceType = useDeviceType();
@@ -207,6 +208,36 @@ const TMBlogs = (props) => {
207
208
  TMResultManager.show(result, SDKUI_Localizator.CopyToClipboard, "ID", undefined);
208
209
  });
209
210
  };
211
+ const unFollowCallback = async (blog, classId) => {
212
+ const title = SDKUI_Localizator.Unfollow;
213
+ const header = blog.header ?? undefined;
214
+ const message = header ? SDKUI_Localizator.UnfollowSelectedItem.replaceParams(header) : SDKUI_Localizator.Unfollow + "?";
215
+ TMMessageBoxManager.show({
216
+ title, message, buttons: [ButtonNames.YES, ButtonNames.NO],
217
+ confirmOnEnter: true,
218
+ onButtonClick: async (e) => {
219
+ if (e !== ButtonNames.YES)
220
+ return;
221
+ let result = [];
222
+ switch (classId) {
223
+ case 'WG':
224
+ const workingGroupEngine = new WorkingGroupEngine(SDK_Globals.tmSession);
225
+ await workingGroupEngine.FollowAddOrRemoveAsync(blog.id, true).then(async () => {
226
+ result.push({ rowIndex: blog.id, id1: blog.id, id2: blog.id, description: SDKUI_Localizator.OperationSuccess, resultType: ResultTypes.SUCCESS });
227
+ refreshHomePageNews?.();
228
+ })
229
+ .catch((err) => {
230
+ result.push({ rowIndex: blog.id, id1: blog.id, id2: blog.id, resultType: ResultTypes.ERROR, description: getExceptionMessage(err) });
231
+ });
232
+ break;
233
+ default:
234
+ ShowAlert({ message: 'TODO', mode: 'warning', title: SDKUI_Localizator.Unfollow, duration: 3000 });
235
+ break;
236
+ }
237
+ TMResultManager.show(result, SDKUI_Localizator.Unfollow, "ID", undefined);
238
+ }
239
+ });
240
+ };
210
241
  // ContexMenuItems array contains a list of context menu items for a blog
211
242
  const contextMenuItems = useMemo(() => {
212
243
  // customData1 === 1 means the group is archived (historical)
@@ -215,6 +246,7 @@ const TMBlogs = (props) => {
215
246
  const isNotOwner = focusedBlog && focusedBlog.ownerID !== userId;
216
247
  const isDeleted = focusedBlog && (focusedBlog.isDel !== undefined && focusedBlog.isDel !== 0);
217
248
  const isInvalid = focusedBlog === undefined;
249
+ const classId = focusedBlog ? focusedBlog.classID : undefined;
218
250
  let menuItemsElements = [
219
251
  {
220
252
  icon: "download",
@@ -269,6 +301,12 @@ const TMBlogs = (props) => {
269
301
  disabled: isGroupArchived ? true : false,
270
302
  beginGroup: true
271
303
  },
304
+ {
305
+ icon: "eyeclose",
306
+ text: SDKUI_Localizator.Unfollow,
307
+ visible: Boolean(classId && classId === 'WG'),
308
+ onClick: () => focusedBlog && classId && unFollowCallback(focusedBlog, classId),
309
+ },
272
310
  {
273
311
  icon: isHeaderHidden ? 'eyeopen' : 'eyeclose',
274
312
  text: isHeaderHidden ? SDKUI_Localizator.ShowFilters : SDKUI_Localizator.HideFilters,
@@ -509,6 +509,8 @@ export declare class SDKUI_Localizator {
509
509
  static get UBLViewFormats_NSO_PDF(): "NSO Style Sheet (PDF)" | "Hoja de estilo NSO (PDF)" | "Feuille de style NSO (PDF)" | "Folha de estilo NSO (PDF)" | "Foglio di stile NSO (PDF)";
510
510
  static get UnableToGetUpdatedDocumentContent(): "Aktualisierter Dokumentinhalt kann nicht abgerufen werden" | "Unable to get updated document content" | "No se puede obtener el contenido actualizado del documento" | "Impossible d'obtenir le contenu mis à jour du document" | "Não é possível obter o conteúdo atualizado do documento" | "Impossibile ottenere il contenuto aggiornato del documento";
511
511
  static get Undo(): "Änderungen rückgängig machen" | "Undo" | "Anular modificaciones" | "Annule les modifications" | "Anular alterações" | "Annulla modifiche";
512
+ static get Unfollow(): "Nicht mehr folgen" | "Unfollow" | "Dejar de seguir" | "Ne plus suivre" | "Deixar de seguir" | "Non seguire più";
513
+ static get UnfollowSelectedItem(): string;
512
514
  static get Update(): "Bearbeiten" | "Update" | "Modificar" | "Modifie" | "Modificação" | "Modifica";
513
515
  static get UpdateCompletedSuccessfully(): "Aktualisierung erfolgreich abgeschlossen" | "Update completed successfully" | "Actualización completada con éxito" | "Mise à jour terminée avec succès" | "Atualização concluída com sucesso" | "Aggiornamento completato con successo";
514
516
  static get UpdateIn(): "interrumpir" | "Aktualisierung in" | "Update in" | "Mettre à jour dans" | "Atualizar em" | "Aggiorna in";
@@ -5055,6 +5055,32 @@ export class SDKUI_Localizator {
5055
5055
  default: return "Annulla modifiche";
5056
5056
  }
5057
5057
  }
5058
+ static get Unfollow() {
5059
+ switch (this._cultureID) {
5060
+ case CultureIDs.De_DE: return "Nicht mehr folgen";
5061
+ case CultureIDs.En_US: return "Unfollow";
5062
+ case CultureIDs.Es_ES: return "Dejar de seguir";
5063
+ case CultureIDs.Fr_FR: return "Ne plus suivre";
5064
+ case CultureIDs.Pt_PT: return "Deixar de seguir";
5065
+ default: return "Non seguire più";
5066
+ }
5067
+ }
5068
+ static get UnfollowSelectedItem() {
5069
+ switch (this._cultureID) {
5070
+ case CultureIDs.De_DE:
5071
+ return "Möchten Sie das ausgewählte Element \"{{0}}\" nicht mehr folgen?";
5072
+ case CultureIDs.En_US:
5073
+ return "Unfollow the selected item \"{{0}}\"?";
5074
+ case CultureIDs.Es_ES:
5075
+ return "¿Dejar de seguir el elemento seleccionado \"{{0}}\"?";
5076
+ case CultureIDs.Fr_FR:
5077
+ return "Ne plus suivre l'élément sélectionné \"{{0}}\" ?";
5078
+ case CultureIDs.Pt_PT:
5079
+ return "Deixar de seguir o item selecionado \"{{0}}\"?";
5080
+ default:
5081
+ return "Non seguire più l'elemento selezionato \"{{0}}\"?";
5082
+ }
5083
+ }
5058
5084
  static get Update() {
5059
5085
  switch (this._cultureID) {
5060
5086
  case CultureIDs.De_DE: return "Bearbeiten";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.16.72",
3
+ "version": "6.16.73",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",