@zextras/carbonio-ui-commons 2.2.0 → 2.3.0

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.
@@ -33,6 +33,16 @@ export type FolderState = {
33
33
  updateFolder: (id: string, opt: Partial<Folder>) => void;
34
34
  };
35
35
  export type FolderView = 'search folder' | 'tag' | 'conversation' | 'message' | 'contact' | 'document' | 'appointment' | 'virtual conversation' | 'remote folder' | 'wiki' | 'task' | 'chat';
36
+ /**
37
+ * Type of a DataSource sync account.
38
+ *
39
+ * Matches the server-side `DataSourceType` enum
40
+ * (soap/src/main/java/com/zimbra/soap/admin/type/DataSourceType.java).
41
+ *
42
+ * The `dsType` attribute is present on a `<folder>` element in `GetFolderResponse`
43
+ * only when that folder is the **root** folder of a DataSource.
44
+ */
45
+ export type DataSourceType = 'pop3' | 'imap' | 'caldav' | 'contacts' | 'yab' | 'rss' | 'cal' | 'gal' | 'xsync' | 'tagmap' | 'unknown';
36
46
  export type Grant = {
37
47
  perm: string;
38
48
  gt: 'usr' | 'grp' | 'dom' | 'cos' | 'all' | 'guest' | 'key' | 'pub';
@@ -77,6 +87,8 @@ export type BaseFolder = {
77
87
  };
78
88
  retentionPolicy?: any;
79
89
  checked?: boolean;
90
+ dsId?: string;
91
+ dsType?: DataSourceType;
80
92
  };
81
93
  export type SoapLink = SoapFolder & LinkFolderFields;
82
94
  export type SoapSearchFolder = SoapFolder & SearchFolderFields;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/folder/index.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>\n *\n * SPDX-License-Identifier: AGPL-3.0-only\n */\nimport { ComponentType } from 'react';\n\nimport { WorkerMessage } from '../workers';\n\nexport type FolderFields = {\n\t// Additional Parameters\n\tisLink: boolean;\n\tdepth: number;\n\tparent?: string;\n\tchildren: Array<Folder>;\n};\n\nexport type UserFolder = BaseFolder & FolderFields & { isLink: false };\n\nexport type LinkFolder = BaseFolder & FolderFields & LinkFolderFields & { isLink: true };\n\nexport type SearchFolder = BaseFolder &\n\tPick<FolderFields, 'parent' | 'isLink'> &\n\tSearchFolderFields;\nexport type Folder = UserFolder | LinkFolder;\nexport type RootFolder = Folder & { uuid: undefined };\nexport type Folders = { [id: string]: Folder };\nexport type Searches = { [id: string]: SearchFolder };\nexport type LinksIdMap = { [id: string]: string };\nexport type FolderState = {\n\tfolders: Folders;\n\tlinksIdMap: LinksIdMap;\n\tsearches: Searches;\n\tupdateFolder: (id: string, opt: Partial<Folder>) => void;\n};\n\nexport type FolderView =\n\t| 'search folder'\n\t| 'tag'\n\t| 'conversation'\n\t| 'message'\n\t| 'contact'\n\t| 'document'\n\t| 'appointment'\n\t| 'virtual conversation'\n\t| 'remote folder'\n\t| 'wiki'\n\t| 'task'\n\t| 'chat';\n\n// Grants\nexport type Grant = {\n\t// Rights - Some combination of (r)ead, (w)rite, (i)nsert, (d)elete, (a)dminister, workflow action (x), view (p)rivate, view (f)reebusy, (c)reate subfolder\n\tperm: string;\n\t/* The type of Grantee:\n\t\"usr\",\n\t\"grp\",\n\t\"dom\" (domain),\n\t\"cos\",\n\t\"all\" (all authenticated users),\n\t\"pub\" (public authenticated and unauthenticated access),\n\t\"guest\" (non-Zimbra email address and password),\n\t\"key\" (non-Zimbra email address and access key)\n\t*/\n\tgt: 'usr' | 'grp' | 'dom' | 'cos' | 'all' | 'guest' | 'key' | 'pub';\n\t// Grantee ID\n\tzid?: string;\n\t// Time when this grant expires. For internal/guest grant: If this attribute is not specified, the expiry of the grant is derived from internalGrantExpiry/guestGrantExpiry of the ACL it is part of. If this attribute is specified (overridden), the expiry value can not be greater than the corresponding expiry value in the ACL. For public grant: If this attribute is not specified, defaults to the maximum allowed expiry for a public grant. If not specified in the response, defaults to 0. Value of 0 indicates that this grant never expires.\n\texpiry?: string;\n\t// Name or email address of the principal being granted rights. optional if {grantee-type} is \"all\"/\"guest\"/\"pub\". When specified in a request, this can be just the username portion of the address in the default domain.\n\td?: string;\n\t// Optional argument. password when {grantee-type} is \"guest\"\n\tpw?: string;\n\t// Optional argument. Access key when {grantee-type} is \"key\"\n\tkey?: string;\n};\n\nexport type BaseFolder = {\n\t// Folder ID\n\tid: string;\n\t// Item's UUID - a globally unique identifier\n\tuuid: string;\n\t// Name of folder; max length 128; whitespace is trimmed by server; Cannot contain ':', '\"', '/', or any character below 0x20\n\tname: string;\n\t// Absolute Folder path\n\tabsFolderPath?: string;\n\t// ID of parent folder (absent for root folder)\n\tl?: string;\n\t// UUID of parent folder (absent for root folder)\n\tluuid?: string;\n\t// Flags - checked in UI (#), exclude free/(b)usy info, IMAP subscribed (*), does not (i)nherit rights from parent, is a s(y)nc folder with external data source, sync is turned on(~), folder does n(o)t allow inferiors / children\n\tf?: string;\n\t// color numeric; range 0-127; defaults to 0 if not present; client can display only 0-7\n\tcolor?: number;\n\t// RGB color in format #rrggbb where r,g and b are hex digits\n\trgb?: string;\n\t// Number of unread messages in folder\n\tu?: number;\n\t// Number of unread messages with this tag, including those with the IMAP \\Deleted flag set\n\ti4u?: number;\n\t// (optional) Default type for the folder; used by web client to decide which view to use;\n\tview?: FolderView;\n\t// Revision\n\trev?: number;\n\t// Modified sequence\n\tms?: number;\n\t// Modified date in seconds\n\tmd?: number;\n\t// Number of non-subfolder items in folder\n\tn?: number;\n\t// Number of non-subfolder items in folder, including those with the IMAP \\Deleted flag set\n\ti4n?: number;\n\t// Total size of all of non-subfolder items in folder\n\ts?: number;\n\t// Imap modified sequence\n\ti4ms?: number;\n\t// IMAP UIDNEXT\n\ti4next?: number;\n\t// URL (RSS, iCal, etc.) this folder syncs its contents to\n\turl?: string;\n\t// Last successful sync date from external URL in epoch seconds\n\tlsd?: number;\n\tactivesyncdisabled: boolean;\n\t// Number of days for which web client would sync folder data for offline use\n\twebOfflineSyncDays?: number;\n\t// For remote folders, the access rights the authenticated user has on the folder - will contain the calculated (c)reate folder permission if the user has both (i)nsert and (r)ead access on the folder\n\tperm?: string;\n\t// recursive\n\trecursive: boolean;\n\t// URL to the folder in the REST interface for rest-enabled apps (such as notebook)\n\trest?: string;\n\t// whether this folder can be deleted\n\tdeletable: boolean;\n\t// custom metadata\n\tmeta?: Array<any>;\n\t// ACL for sharing\n\tacl?: { grant: Array<Grant> };\n\tretentionPolicy?: any;\n\t// indicates whether this folder is displayed in Calendars\n\tchecked?: boolean;\n};\n\nexport type SoapLink = SoapFolder & LinkFolderFields;\nexport type SoapSearchFolder = SoapFolder & SearchFolderFields;\n\nexport type SoapFolder = BaseFolder & {\n\tfolder?: Array<SoapFolder>;\n\tlink?: Array<SoapLink>;\n\tsearch?: Array<SoapSearchFolder>;\n};\n\nexport type LinkFolderFields = {\n\t// Primary email address of the owner of the linked-to resource\n\towner?: string;\n\t// Zimbra ID (guid) of the owner of the linked-to resource\n\tzid?: string;\n\t// Item ID of the linked-to resource in the remote mailbox\n\trid?: string;\n\t// UUID of the linked-to resource in the remote mailbox\n\truuid?: string;\n\t// The name presently used for the item by the owner\n\toname?: string;\n\t// If set, client should display reminders for shared appointments/tasks\n\treminder: boolean;\n\t// If \"tr\" is true in the request, broken is set if this is a broken link\n\tbroken: boolean;\n};\nexport type SearchFolderFields = {\n\t// Query\n\tquery?: string;\n\t// Sort by\n\tsortBy?: SortBy;\n\t// Comma-separated list. Legal values in list are:\n\t// appointment|chat|contact|conversation|document|message|tag|task|wiki (default is \"conversation\")\n\ttypes?: string;\n};\n\nexport type SortBy =\n\t| 'dateDesc'\n\t| 'dateAsc'\n\t| 'idDesc'\n\t| 'idAsc'\n\t| 'subjDesc'\n\t| 'subjAsc'\n\t| 'nameDesc'\n\t| 'nameAsc'\n\t| 'durDesc'\n\t| 'durAsc'\n\t| 'none'\n\t| 'taskDueAsc'\n\t| 'taskDueDesc'\n\t| 'taskStatusAsc'\n\t| 'taskStatusDesc'\n\t| 'taskPercCompletedAsc'\n\t| 'taskPercCompletedDesc'\n\t| 'rcptAsc'\n\t| 'rcptDesc'\n\t| 'readAsc'\n\t| 'readDesc';\n\nexport type AccordionFolder = {\n\tid: string;\n\tlabel: string;\n\tfolder: Folder;\n\tCustomComponent: ComponentType<{ folder: Folder }>;\n\titems: Array<AccordionFolder>;\n};\n\nexport type TreeNode<T> = T & {\n\tid: string;\n\tchildren: TreeNode<T>[];\n\tparent?: string;\n};\n\nexport type PopulateFoldersStoreOptions = {\n\tview?: FolderView;\n\tnoSharedAccounts?: boolean;\n\tcustomFolders?: Array<Folder>;\n};\n\n/**\n * Message to notify the worker of a folder change\n */\nexport type FolderMessage = WorkerMessage<Record<string, never>>;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/folder/index.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>\n *\n * SPDX-License-Identifier: AGPL-3.0-only\n */\nimport { ComponentType } from 'react';\n\nimport { WorkerMessage } from '../workers';\n\nexport type FolderFields = {\n\t// Additional Parameters\n\tisLink: boolean;\n\tdepth: number;\n\tparent?: string;\n\tchildren: Array<Folder>;\n};\n\nexport type UserFolder = BaseFolder & FolderFields & { isLink: false };\n\nexport type LinkFolder = BaseFolder & FolderFields & LinkFolderFields & { isLink: true };\n\nexport type SearchFolder = BaseFolder &\n\tPick<FolderFields, 'parent' | 'isLink'> &\n\tSearchFolderFields;\nexport type Folder = UserFolder | LinkFolder;\nexport type RootFolder = Folder & { uuid: undefined };\nexport type Folders = { [id: string]: Folder };\nexport type Searches = { [id: string]: SearchFolder };\nexport type LinksIdMap = { [id: string]: string };\nexport type FolderState = {\n\tfolders: Folders;\n\tlinksIdMap: LinksIdMap;\n\tsearches: Searches;\n\tupdateFolder: (id: string, opt: Partial<Folder>) => void;\n};\n\nexport type FolderView =\n\t| 'search folder'\n\t| 'tag'\n\t| 'conversation'\n\t| 'message'\n\t| 'contact'\n\t| 'document'\n\t| 'appointment'\n\t| 'virtual conversation'\n\t| 'remote folder'\n\t| 'wiki'\n\t| 'task'\n\t| 'chat';\n\n/**\n * Type of a DataSource sync account.\n *\n * Matches the server-side `DataSourceType` enum\n * (soap/src/main/java/com/zimbra/soap/admin/type/DataSourceType.java).\n *\n * The `dsType` attribute is present on a `<folder>` element in `GetFolderResponse`\n * only when that folder is the **root** folder of a DataSource.\n */\nexport type DataSourceType =\n\t| 'pop3' // POP3 email import\n\t| 'imap' // IMAP two-way sync\n\t| 'caldav' // CalDAV calendar sync (e.g. Google Calendar, iCloud, Nextcloud)\n\t| 'contacts' // Contacts sync\n\t| 'yab' // Yahoo Address Book\n\t| 'rss' // RSS/Atom feed\n\t| 'cal' // iCal/ICS subscription (read-only, URL-based)\n\t| 'gal' // Global Address List import\n\t| 'xsync' // Custom/extension sync type\n\t| 'tagmap' // Tag mapping datasource\n\t| 'unknown'; // Fallback for unrecognized types\n\n// Grants\nexport type Grant = {\n\t// Rights - Some combination of (r)ead, (w)rite, (i)nsert, (d)elete, (a)dminister, workflow action (x), view (p)rivate, view (f)reebusy, (c)reate subfolder\n\tperm: string;\n\t/* The type of Grantee:\n\t\"usr\",\n\t\"grp\",\n\t\"dom\" (domain),\n\t\"cos\",\n\t\"all\" (all authenticated users),\n\t\"pub\" (public authenticated and unauthenticated access),\n\t\"guest\" (non-Zimbra email address and password),\n\t\"key\" (non-Zimbra email address and access key)\n\t*/\n\tgt: 'usr' | 'grp' | 'dom' | 'cos' | 'all' | 'guest' | 'key' | 'pub';\n\t// Grantee ID\n\tzid?: string;\n\t// Time when this grant expires. For internal/guest grant: If this attribute is not specified, the expiry of the grant is derived from internalGrantExpiry/guestGrantExpiry of the ACL it is part of. If this attribute is specified (overridden), the expiry value can not be greater than the corresponding expiry value in the ACL. For public grant: If this attribute is not specified, defaults to the maximum allowed expiry for a public grant. If not specified in the response, defaults to 0. Value of 0 indicates that this grant never expires.\n\texpiry?: string;\n\t// Name or email address of the principal being granted rights. optional if {grantee-type} is \"all\"/\"guest\"/\"pub\". When specified in a request, this can be just the username portion of the address in the default domain.\n\td?: string;\n\t// Optional argument. password when {grantee-type} is \"guest\"\n\tpw?: string;\n\t// Optional argument. Access key when {grantee-type} is \"key\"\n\tkey?: string;\n};\n\nexport type BaseFolder = {\n\t// Folder ID\n\tid: string;\n\t// Item's UUID - a globally unique identifier\n\tuuid: string;\n\t// Name of folder; max length 128; whitespace is trimmed by server; Cannot contain ':', '\"', '/', or any character below 0x20\n\tname: string;\n\t// Absolute Folder path\n\tabsFolderPath?: string;\n\t// ID of parent folder (absent for root folder)\n\tl?: string;\n\t// UUID of parent folder (absent for root folder)\n\tluuid?: string;\n\t// Flags - checked in UI (#), exclude free/(b)usy info, IMAP subscribed (*), does not (i)nherit rights from parent, is a s(y)nc folder with external data source, sync is turned on(~), folder does n(o)t allow inferiors / children\n\tf?: string;\n\t// color numeric; range 0-127; defaults to 0 if not present; client can display only 0-7\n\tcolor?: number;\n\t// RGB color in format #rrggbb where r,g and b are hex digits\n\trgb?: string;\n\t// Number of unread messages in folder\n\tu?: number;\n\t// Number of unread messages with this tag, including those with the IMAP \\Deleted flag set\n\ti4u?: number;\n\t// (optional) Default type for the folder; used by web client to decide which view to use;\n\tview?: FolderView;\n\t// Revision\n\trev?: number;\n\t// Modified sequence\n\tms?: number;\n\t// Modified date in seconds\n\tmd?: number;\n\t// Number of non-subfolder items in folder\n\tn?: number;\n\t// Number of non-subfolder items in folder, including those with the IMAP \\Deleted flag set\n\ti4n?: number;\n\t// Total size of all of non-subfolder items in folder\n\ts?: number;\n\t// Imap modified sequence\n\ti4ms?: number;\n\t// IMAP UIDNEXT\n\ti4next?: number;\n\t// URL (RSS, iCal, etc.) this folder syncs its contents to\n\turl?: string;\n\t// Last successful sync date from external URL in epoch seconds\n\tlsd?: number;\n\tactivesyncdisabled: boolean;\n\t// Number of days for which web client would sync folder data for offline use\n\twebOfflineSyncDays?: number;\n\t// For remote folders, the access rights the authenticated user has on the folder - will contain the calculated (c)reate folder permission if the user has both (i)nsert and (r)ead access on the folder\n\tperm?: string;\n\t// recursive\n\trecursive: boolean;\n\t// URL to the folder in the REST interface for rest-enabled apps (such as notebook)\n\trest?: string;\n\t// whether this folder can be deleted\n\tdeletable: boolean;\n\t// custom metadata\n\tmeta?: Array<any>;\n\t// ACL for sharing\n\tacl?: { grant: Array<Grant> };\n\tretentionPolicy?: any;\n\t// indicates whether this folder is displayed in Calendars\n\tchecked?: boolean;\n\t// DataSource ID - present only when this folder is the root folder of a DataSource\n\tdsId?: string;\n\t// DataSource type (e.g., caldav, imap, pop3) - present only when this folder is the root folder of a DataSource\n\tdsType?: DataSourceType;\n};\n\nexport type SoapLink = SoapFolder & LinkFolderFields;\nexport type SoapSearchFolder = SoapFolder & SearchFolderFields;\n\nexport type SoapFolder = BaseFolder & {\n\tfolder?: Array<SoapFolder>;\n\tlink?: Array<SoapLink>;\n\tsearch?: Array<SoapSearchFolder>;\n};\n\nexport type LinkFolderFields = {\n\t// Primary email address of the owner of the linked-to resource\n\towner?: string;\n\t// Zimbra ID (guid) of the owner of the linked-to resource\n\tzid?: string;\n\t// Item ID of the linked-to resource in the remote mailbox\n\trid?: string;\n\t// UUID of the linked-to resource in the remote mailbox\n\truuid?: string;\n\t// The name presently used for the item by the owner\n\toname?: string;\n\t// If set, client should display reminders for shared appointments/tasks\n\treminder: boolean;\n\t// If \"tr\" is true in the request, broken is set if this is a broken link\n\tbroken: boolean;\n};\nexport type SearchFolderFields = {\n\t// Query\n\tquery?: string;\n\t// Sort by\n\tsortBy?: SortBy;\n\t// Comma-separated list. Legal values in list are:\n\t// appointment|chat|contact|conversation|document|message|tag|task|wiki (default is \"conversation\")\n\ttypes?: string;\n};\n\nexport type SortBy =\n\t| 'dateDesc'\n\t| 'dateAsc'\n\t| 'idDesc'\n\t| 'idAsc'\n\t| 'subjDesc'\n\t| 'subjAsc'\n\t| 'nameDesc'\n\t| 'nameAsc'\n\t| 'durDesc'\n\t| 'durAsc'\n\t| 'none'\n\t| 'taskDueAsc'\n\t| 'taskDueDesc'\n\t| 'taskStatusAsc'\n\t| 'taskStatusDesc'\n\t| 'taskPercCompletedAsc'\n\t| 'taskPercCompletedDesc'\n\t| 'rcptAsc'\n\t| 'rcptDesc'\n\t| 'readAsc'\n\t| 'readDesc';\n\nexport type AccordionFolder = {\n\tid: string;\n\tlabel: string;\n\tfolder: Folder;\n\tCustomComponent: ComponentType<{ folder: Folder }>;\n\titems: Array<AccordionFolder>;\n};\n\nexport type TreeNode<T> = T & {\n\tid: string;\n\tchildren: TreeNode<T>[];\n\tparent?: string;\n};\n\nexport type PopulateFoldersStoreOptions = {\n\tview?: FolderView;\n\tnoSharedAccounts?: boolean;\n\tcustomFolders?: Array<Folder>;\n};\n\n/**\n * Message to notify the worker of a folder change\n */\nexport type FolderMessage = WorkerMessage<Record<string, never>>;\n"]}
@@ -84,6 +84,8 @@ export const normalize = (f, p) => ({
84
84
  i4next: f.i4next,
85
85
  url: f.url,
86
86
  lsd: f.lsd,
87
+ dsId: f.dsId,
88
+ dsType: f.dsType,
87
89
  activesyncdisabled: !!f.activesyncdisabled,
88
90
  webOfflineSyncDays: f.webOfflineSyncDays,
89
91
  perm: f.perm,
@@ -275,16 +277,28 @@ modified.forEach((val) => {
275
277
  }
276
278
  }
277
279
  });
280
+ const collectFolderSubtreeIds = (folderId) => {
281
+ const folder = folders[folderId];
282
+ if (!folder) {
283
+ return [];
284
+ }
285
+ return folder.children.reduce((acc, child) => [...acc, child.id, ...collectFolderSubtreeIds(child.id)], []);
286
+ };
278
287
  export const handleFolderDeleted = (deleted) => deleted.forEach((val) => {
279
- const folder = folders[val];
280
- if (folder) {
281
- if (folder.parent) {
282
- const parent = folders[folder.parent];
283
- parent.children = parent.children.filter((obj) => obj.id !== val);
288
+ const folderIdsToDelete = [val, ...collectFolderSubtreeIds(val)];
289
+ folderIdsToDelete.forEach((folderId) => {
290
+ const folder = folders[folderId];
291
+ if (folder) {
292
+ if (folder.parent) {
293
+ const parent = folders[folder.parent];
294
+ if (parent) {
295
+ parent.children = parent.children.filter((obj) => obj.id !== folderId);
296
+ }
297
+ }
298
+ delete folders[folderId];
299
+ delete searches[folderId];
284
300
  }
285
- delete folders[val];
286
- delete searches[val];
287
- }
301
+ });
288
302
  });
289
303
  export const handleFolderNotify = (notify) => {
290
304
  handleFolderCreated(notify.created?.folder ?? []);
@@ -1 +1 @@
1
- {"version":3,"file":"handle-message.js","sourceRoot":"","sources":["../../src/worker/handle-message.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiB1C,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,IAAI,OAAO,GAAY,EAAE,CAAC;AAC1B,MAAM,QAAQ,GAAa,EAAE,CAAC;AAC9B,MAAM,UAAU,GAAe,EAAE,CAAC;AAClC,8EAA8E;AAC9E,IAAI,IAAwB,CAAC;AAE7B,MAAM,CAAC,MAAM,SAAS,GAAG;IACxB,UAAU,EAAE,GAAY,EAAE,CAAC,OAAO;IAClC,YAAY,EAAE,GAAS,EAAE;QACxB,OAAO,GAAG,EAAE,CAAC;IACd,CAAC;IACD,UAAU,EAAE,CAAC,IAAa,EAAQ,EAAE;QACnC,OAAO,GAAG,IAAI,CAAC;IAChB,CAAC;IACD,cAAc,EAAE,CAAC,OAAmB,EAAQ,EAAE;QAC7C,IAAI,GAAG,OAAO,CAAC;IAChB,CAAC;IACD,cAAc,EAAE,GAAuB,EAAE,CAAC,IAAI;CAC9C,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,GAAkB,EAAiB,EAAE,CAC/D,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;IACjB,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IACxC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IACxC,IAAI,UAAU,GAAG,UAAU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,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;IAClD,iBAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;IAC9C,2DAA2D;IAC3D,0DAA0D;IAC1D,6DAA6D;IAC7D,aAAa;IACb,oBAAoB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7F,mBAAmB,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAE,IAAI,EAAiB,EAAQ,EAAE;IACtE,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1C,mBAAmB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;IACD,IAAI,IAAI,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;QAC1B,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,IAAI,EAAiB,EAAQ,EAAE;IAC9D,qBAAqB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,6DAA6D;IAC7D,aAAa;IACb,WAAW,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;AAChD,CAAC,CAAC","sourcesContent":["/*\n * SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>\n *\n * SPDX-License-Identifier: AGPL-3.0-only\n */\n\nimport type { SoapNotify } from '@zextras/carbonio-ui-soap-lib';\n\nimport { getLinkIdMapKey } from './utils';\nimport type {\n\tBaseFolder,\n\tFolder,\n\tFolderMessage,\n\tFolders,\n\tLinkFolder,\n\tLinkFolderFields,\n\tSearches,\n\tSearchFolderFields,\n\tSoapFolder,\n\tSoapLink,\n\tSoapSearchFolder,\n\tUserFolder\n} from '../types';\nimport { FolderView, LinksIdMap } from '../types';\n\nconst IM_LOGS = '14';\nconst USER_ROOT = '1';\n\nlet folders: Folders = {};\nconst searches: Searches = {};\nconst linksIdMap: LinksIdMap = {};\n// used to check if a newly created folder is being added to the correct store\nlet view: string | undefined;\n\nexport const testUtils = {\n\tgetFolders: (): Folders => folders,\n\tresetFolders: (): void => {\n\t\tfolders = {};\n\t},\n\tsetFolders: (data: Folders): void => {\n\t\tfolders = data;\n\t},\n\tsetCurrentView: (current: FolderView): void => {\n\t\tview = current;\n\t},\n\tgetCurrentView: (): string | undefined => view\n};\n\nconst sortFoldersByName = (obj: Array<Folder>): Array<Folder> =>\n\tobj.sort((a, b) => {\n\t\tconst aLowerName = a.name.toLowerCase();\n\t\tconst bLowerName = b.name.toLowerCase();\n\t\tif (aLowerName < bLowerName) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (aLowerName > bLowerName) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn 0;\n\t});\n\nconst updateChildren = (folder: Folder, changes: any): any => {\n\tif (changes.absFolderPath && folder.children.length) {\n\t\tfolder.children.forEach((child) => {\n\t\t\tconst childFolder = folders[child.id];\n\t\t\tif (changes.absFolderPath && childFolder.absFolderPath) {\n\t\t\t\tconst paths = childFolder.absFolderPath.split('/').slice(2);\n\t\t\t\tchildFolder.absFolderPath = `${changes.absFolderPath}/${paths.join('/')}`;\n\t\t\t}\n\t\t\tif (childFolder.children.length) {\n\t\t\t\tupdateChildren(childFolder, changes);\n\t\t\t}\n\t\t});\n\t}\n};\n\nexport const testFolderIsChecked = ({ string }: { string: string | undefined }): boolean =>\n\t/#/.test(string || '');\n\nconst omit = ({\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tlink: _1,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tfolder: _2,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tsearch: _3,\n\t...obj\n}: Partial<SoapFolder>): Partial<SoapFolder> => obj;\n\nexport const hasId = (f: { id: string }, id: string): boolean => f.id.split(':').includes(id);\nexport const normalize = (f: SoapFolder, p?: Folder): BaseFolder => ({\n\tid: f.id,\n\tuuid: f.uuid,\n\tname: f.name,\n\tabsFolderPath: f.absFolderPath,\n\tl: f.l,\n\tluuid: f.luuid,\n\tchecked: testFolderIsChecked({ string: f.f }),\n\tf: f.f,\n\t// the type defined in shell is not correct refs: SHELL-118\n\t// FIXME: remove the cast when the type will be fixed\n\tcolor: (f.color as unknown as number) || p?.color,\n\trgb: f.rgb,\n\tu: f.u,\n\ti4u: f.i4u,\n\tview: f.view,\n\trev: f.rev,\n\tms: f.ms,\n\tmd: f.md,\n\tn: f.n,\n\ti4n: f.i4n,\n\ts: f.s,\n\ti4ms: f.i4ms,\n\ti4next: f.i4next,\n\turl: f.url,\n\tlsd: f.lsd,\n\tactivesyncdisabled: !!f.activesyncdisabled,\n\twebOfflineSyncDays: f.webOfflineSyncDays,\n\tperm: f.perm,\n\trecursive: !!f.recursive,\n\trest: f.rest,\n\tdeletable: !!f.deletable,\n\tmeta: f.meta,\n\tacl: f.acl,\n\tretentionPolicy: f.retentionPolicy\n});\n\nexport const normalizeSearch = (s: SoapSearchFolder): BaseFolder & SearchFolderFields => ({\n\t...normalize(s),\n\tquery: s.query,\n\tsortBy: s.sortBy,\n\ttypes: s.types\n});\n\nexport const normalizeLink = (l: SoapLink, p?: Folder): BaseFolder & LinkFolderFields => ({\n\t...normalize(l, p),\n\towner: l.owner,\n\tzid: l.zid,\n\trid: l.rid,\n\truuid: l.ruuid,\n\toname: l.oname,\n\treminder: !!l.reminder,\n\tbroken: !!l.broken\n});\n\nexport const processSearch = (soapSearch: SoapSearchFolder, parent: Folder): void => {\n\tconst search = {\n\t\t...normalizeSearch(soapSearch),\n\t\tparent: parent?.id,\n\t\tisLink: parent?.isLink\n\t};\n\tsearches[search.id] = search;\n};\n\nexport const processLink = (soapLink: SoapLink, depth: number, parent?: Folder): LinkFolder => {\n\tconst link = {\n\t\t...normalizeLink(soapLink, parent),\n\t\tisLink: true,\n\t\tchildren: [],\n\t\tparent: parent?.id,\n\t\tdepth\n\t} as LinkFolder;\n\t// eslint-disable-next-line no-param-reassign\n\tfolders[soapLink.id] = link;\n\n\t// Get the zid:rid key of the link and add it to the links id map\n\tconst linkIdMapKey = getLinkIdMapKey(soapLink);\n\tlinkIdMapKey && (linksIdMap[linkIdMapKey] = soapLink.id);\n\n\tsoapLink?.folder?.forEach((f) => {\n\t\tif (!hasId(f, IM_LOGS)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\n\t\t\tconst child = processFolder(f, depth + 1, link);\n\t\t\tlink.children.push(child);\n\t\t}\n\t});\n\tsoapLink?.link?.forEach((l) => {\n\t\tif (!hasId(l, IM_LOGS)) {\n\t\t\tconst child = processLink(l, depth + 1, link);\n\t\t\tlink.children.push(child);\n\t\t}\n\t});\n\tsoapLink?.search?.forEach((s) => {\n\t\tprocessSearch(s, link);\n\t});\n\n\treturn link;\n};\n\nexport const processFolder = (\n\tsoapFolder: SoapFolder,\n\tdepth: number,\n\tparent?: Folder\n): UserFolder => {\n\tconst folder: UserFolder = {\n\t\t...normalize(soapFolder, parent),\n\t\tisLink: false,\n\t\tchildren: [],\n\t\tparent: parent?.id,\n\t\tdepth\n\t};\n\tfolders[soapFolder.id] = folder;\n\tsoapFolder?.folder?.forEach((f) => {\n\t\tif (!hasId(f, IM_LOGS)) {\n\t\t\tconst child = processFolder(f, depth + 1, folder);\n\t\t\tif (!hasId(f, USER_ROOT)) {\n\t\t\t\tfolder.children.push(child);\n\t\t\t}\n\t\t}\n\t});\n\tsoapFolder?.link?.forEach((l) => {\n\t\tif (!hasId(l, IM_LOGS)) {\n\t\t\tconst child = processLink(l, depth + 1, folder);\n\t\t\tif (!hasId(l, USER_ROOT)) {\n\t\t\t\tfolder.children.push(child);\n\t\t\t}\n\t\t}\n\t});\n\tsoapFolder?.search?.forEach((s) => {\n\t\tprocessSearch(s, folder);\n\t});\n\treturn folder;\n};\n\nexport const handleFolderRefresh = (\n\tsoapFolders: Array<SoapFolder>,\n\tcurrentView: FolderView\n): UserFolder | Array<UserFolder> => {\n\tview = currentView;\n\tif (soapFolders.length > 1) {\n\t\tconst sharedAccounts = soapFolders.slice(1);\n\t\treturn [\n\t\t\tprocessFolder(soapFolders[0], 0),\n\t\t\t...sharedAccounts.map((folder) => processLink(folder as SoapLink, 0))\n\t\t] as Array<UserFolder>;\n\t}\n\treturn processFolder(soapFolders[0], 0);\n};\n\nexport const handleFolderCreated = (created: Array<SoapFolder>): void =>\n\tcreated.forEach((val: SoapFolder) => {\n\t\tif (val.id && val.l && view && val.view === view) {\n\t\t\tconst parent = folders[val.l];\n\t\t\tconst folder: UserFolder = {\n\t\t\t\t...normalize(val, parent),\n\t\t\t\tisLink: false,\n\t\t\t\tchildren: [],\n\t\t\t\tparent: parent?.id,\n\t\t\t\tdepth: parent && parent.depth !== undefined ? parent.depth + 1 : 0\n\t\t\t};\n\t\t\tfolders[val.id] = folder;\n\t\t\tparent.children.push(folder);\n\t\t\tsortFoldersByName(parent.children);\n\t\t}\n\t});\nexport const handleLinkCreated = (created: Array<SoapLink>): void =>\n\tcreated.forEach((val: SoapLink) => {\n\t\tif (val.id && val.l && view && val.view === view) {\n\t\t\tconst parent = folders[val.l];\n\t\t\tconst folder: LinkFolder = {\n\t\t\t\t...normalizeLink(val, parent),\n\t\t\t\tisLink: true,\n\t\t\t\tchildren: [],\n\t\t\t\tparent: parent?.id,\n\t\t\t\tdepth: parent && parent.depth !== undefined ? parent.depth + 1 : 0\n\t\t\t};\n\t\t\tfolders[val.id] = folder;\n\t\t\tparent.children.push(folder);\n\t\t\tsortFoldersByName(parent.children);\n\t\t}\n\t});\n\nfunction getKeyByValue(map: Folders, searchValue: Partial<UserFolder>): string | undefined {\n\treturn Object.keys(map).find(\n\t\t(key) => searchValue.id === `${(map[key] as LinkFolder).zid}:${(map[key] as LinkFolder).rid}`\n\t);\n}\n\nfunction folderIsSharedWithMe(folderId: string | undefined): boolean {\n\tif (!folderId) return false;\n\tconst folder = folders[folderId];\n\tif (folder?.parent) {\n\t\treturn folderIsSharedWithMe(folder?.parent);\n\t}\n\treturn folder?.name === 'USER_ROOT';\n}\n\nexport const handleFolderModified = (modified: Array<Partial<UserFolder>>): void =>\n\t// the type defined in shell is not correct refs: SHELL-118\n\t// FIXME: remove the ts-ignore when the type will be fixed\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore\n\tmodified.forEach((val: Partial<SoapFolder>): void => {\n\t\tif (!val.id) return;\n\t\tconst mountPointId = val.id.includes(':') ? getKeyByValue(folders, val) : val.id;\n\t\tconst parentMountPointId = getKeyByValue(folders, { id: val.l });\n\t\tconst isSharedWithMe = folderIsSharedWithMe(mountPointId);\n\t\tconst parentIsSharedWithMe = folderIsSharedWithMe(parentMountPointId);\n\t\tconst parentFolderId = parentIsSharedWithMe && parentMountPointId ? parentMountPointId : val.l;\n\t\tconst folderId = isSharedWithMe && mountPointId ? mountPointId : val.id;\n\t\tconst folder = folderId ? folders[folderId] : null;\n\n\t\tif (folder) {\n\t\t\tObject.assign(folder, omit({ ...val, id: folderId }));\n\t\t\tupdateChildren(folder, val);\n\t\t\tif (typeof val.f !== 'undefined') {\n\t\t\t\tfolder.checked = testFolderIsChecked({ string: val.f });\n\t\t\t}\n\n\t\t\tconst oldParentId = folder.parent;\n\n\t\t\tif (oldParentId) {\n\t\t\t\tconst oldParent = folders[oldParentId];\n\t\t\t\tif (oldParent) {\n\t\t\t\t\tif (!val.l) {\n\t\t\t\t\t\toldParent.children = oldParent.children.map((f) => (f.id !== val.id ? f : folder));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst newParent = parentFolderId ? folders[parentFolderId] : null;\n\t\t\t\t\t\tif (newParent) {\n\t\t\t\t\t\t\toldParent.children = oldParent.children.filter((f) => f.id !== folderId);\n\t\t\t\t\t\t\tnewParent.children.push(folder);\n\t\t\t\t\t\t\tsortFoldersByName(newParent.children);\n\t\t\t\t\t\t\tfolder.parent = newParent.id;\n\t\t\t\t\t\t\tfolder.depth = newParent?.depth !== undefined ? newParent.depth + 1 : 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfolders[folderId] = folder;\n\t\t\t}\n\t\t}\n\t});\nexport const handleFolderDeleted = (deleted: string[]): void =>\n\tdeleted.forEach((val) => {\n\t\tconst folder = folders[val];\n\t\tif (folder) {\n\t\t\tif (folder.parent) {\n\t\t\t\tconst parent = folders[folder.parent];\n\t\t\t\tparent.children = parent.children.filter((obj) => obj.id !== val);\n\t\t\t}\n\t\t\tdelete folders[val];\n\t\t\tdelete searches[val];\n\t\t}\n\t});\nexport const handleFolderNotify = (notify: SoapNotify): void => {\n\thandleFolderCreated(notify.created?.folder ?? []);\n\thandleLinkCreated(notify.created?.link ?? []);\n\t// the type defined in shell is not correct refs: SHELL-118\n\t// FIXME: remove the ts-ignore when the type will be fixed\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore\n\thandleFolderModified([...(notify.modified?.folder ?? []), ...(notify.modified?.link ?? [])]);\n\thandleFolderDeleted(notify.deleted ?? []);\n};\n\nexport const handleFoldersMessages = ({ data }: FolderMessage): void => {\n\tif (data.op === 'refresh' && data.folder) {\n\t\thandleFolderRefresh(data.folder, data.currentView);\n\t}\n\tif (data.op === 'notify') {\n\t\thandleFolderNotify(data.notify);\n\t}\n};\n\nexport const handleMessage = ({ data }: FolderMessage): void => {\n\thandleFoldersMessages({ data });\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore\n\tpostMessage({ folders, linksIdMap, searches });\n};\n"]}
1
+ {"version":3,"file":"handle-message.js","sourceRoot":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MAAM,CAAC,CAAC;IACjC,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,IAAI,EAAiB,EAAQ,EAAE;IAC9D,qBAAqB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,6DAA6D;IAC7D,aAAa;IACb,WAAW,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;AAChD,CAAC,CAAC","sourcesContent":["/*\n * SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>\n *\n * SPDX-License-Identifier: AGPL-3.0-only\n */\n\nimport type { SoapNotify } from '@zextras/carbonio-ui-soap-lib';\n\nimport { getLinkIdMapKey } from './utils';\nimport type {\n\tBaseFolder,\n\tFolder,\n\tFolderMessage,\n\tFolders,\n\tLinkFolder,\n\tLinkFolderFields,\n\tSearches,\n\tSearchFolderFields,\n\tSoapFolder,\n\tSoapLink,\n\tSoapSearchFolder,\n\tUserFolder\n} from '../types';\nimport { FolderView, LinksIdMap } from '../types';\n\nconst IM_LOGS = '14';\nconst USER_ROOT = '1';\n\nlet folders: Folders = {};\nconst searches: Searches = {};\nconst linksIdMap: LinksIdMap = {};\n// used to check if a newly created folder is being added to the correct store\nlet view: string | undefined;\n\nexport const testUtils = {\n\tgetFolders: (): Folders => folders,\n\tresetFolders: (): void => {\n\t\tfolders = {};\n\t},\n\tsetFolders: (data: Folders): void => {\n\t\tfolders = data;\n\t},\n\tsetCurrentView: (current: FolderView): void => {\n\t\tview = current;\n\t},\n\tgetCurrentView: (): string | undefined => view\n};\n\nconst sortFoldersByName = (obj: Array<Folder>): Array<Folder> =>\n\tobj.sort((a, b) => {\n\t\tconst aLowerName = a.name.toLowerCase();\n\t\tconst bLowerName = b.name.toLowerCase();\n\t\tif (aLowerName < bLowerName) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (aLowerName > bLowerName) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn 0;\n\t});\n\nconst updateChildren = (folder: Folder, changes: any): any => {\n\tif (changes.absFolderPath && folder.children.length) {\n\t\tfolder.children.forEach((child) => {\n\t\t\tconst childFolder = folders[child.id];\n\t\t\tif (changes.absFolderPath && childFolder.absFolderPath) {\n\t\t\t\tconst paths = childFolder.absFolderPath.split('/').slice(2);\n\t\t\t\tchildFolder.absFolderPath = `${changes.absFolderPath}/${paths.join('/')}`;\n\t\t\t}\n\t\t\tif (childFolder.children.length) {\n\t\t\t\tupdateChildren(childFolder, changes);\n\t\t\t}\n\t\t});\n\t}\n};\n\nexport const testFolderIsChecked = ({ string }: { string: string | undefined }): boolean =>\n\t/#/.test(string || '');\n\nconst omit = ({\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tlink: _1,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tfolder: _2,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tsearch: _3,\n\t...obj\n}: Partial<SoapFolder>): Partial<SoapFolder> => obj;\n\nexport const hasId = (f: { id: string }, id: string): boolean => f.id.split(':').includes(id);\nexport const normalize = (f: SoapFolder, p?: Folder): BaseFolder => ({\n\tid: f.id,\n\tuuid: f.uuid,\n\tname: f.name,\n\tabsFolderPath: f.absFolderPath,\n\tl: f.l,\n\tluuid: f.luuid,\n\tchecked: testFolderIsChecked({ string: f.f }),\n\tf: f.f,\n\t// the type defined in shell is not correct refs: SHELL-118\n\t// FIXME: remove the cast when the type will be fixed\n\tcolor: (f.color as unknown as number) || p?.color,\n\trgb: f.rgb,\n\tu: f.u,\n\ti4u: f.i4u,\n\tview: f.view,\n\trev: f.rev,\n\tms: f.ms,\n\tmd: f.md,\n\tn: f.n,\n\ti4n: f.i4n,\n\ts: f.s,\n\ti4ms: f.i4ms,\n\ti4next: f.i4next,\n\turl: f.url,\n\tlsd: f.lsd,\n\tdsId: f.dsId,\n\tdsType: f.dsType,\n\tactivesyncdisabled: !!f.activesyncdisabled,\n\twebOfflineSyncDays: f.webOfflineSyncDays,\n\tperm: f.perm,\n\trecursive: !!f.recursive,\n\trest: f.rest,\n\tdeletable: !!f.deletable,\n\tmeta: f.meta,\n\tacl: f.acl,\n\tretentionPolicy: f.retentionPolicy\n});\n\nexport const normalizeSearch = (s: SoapSearchFolder): BaseFolder & SearchFolderFields => ({\n\t...normalize(s),\n\tquery: s.query,\n\tsortBy: s.sortBy,\n\ttypes: s.types\n});\n\nexport const normalizeLink = (l: SoapLink, p?: Folder): BaseFolder & LinkFolderFields => ({\n\t...normalize(l, p),\n\towner: l.owner,\n\tzid: l.zid,\n\trid: l.rid,\n\truuid: l.ruuid,\n\toname: l.oname,\n\treminder: !!l.reminder,\n\tbroken: !!l.broken\n});\n\nexport const processSearch = (soapSearch: SoapSearchFolder, parent: Folder): void => {\n\tconst search = {\n\t\t...normalizeSearch(soapSearch),\n\t\tparent: parent?.id,\n\t\tisLink: parent?.isLink\n\t};\n\tsearches[search.id] = search;\n};\n\nexport const processLink = (soapLink: SoapLink, depth: number, parent?: Folder): LinkFolder => {\n\tconst link = {\n\t\t...normalizeLink(soapLink, parent),\n\t\tisLink: true,\n\t\tchildren: [],\n\t\tparent: parent?.id,\n\t\tdepth\n\t} as LinkFolder;\n\t// eslint-disable-next-line no-param-reassign\n\tfolders[soapLink.id] = link;\n\n\t// Get the zid:rid key of the link and add it to the links id map\n\tconst linkIdMapKey = getLinkIdMapKey(soapLink);\n\tlinkIdMapKey && (linksIdMap[linkIdMapKey] = soapLink.id);\n\n\tsoapLink?.folder?.forEach((f) => {\n\t\tif (!hasId(f, IM_LOGS)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\n\t\t\tconst child = processFolder(f, depth + 1, link);\n\t\t\tlink.children.push(child);\n\t\t}\n\t});\n\tsoapLink?.link?.forEach((l) => {\n\t\tif (!hasId(l, IM_LOGS)) {\n\t\t\tconst child = processLink(l, depth + 1, link);\n\t\t\tlink.children.push(child);\n\t\t}\n\t});\n\tsoapLink?.search?.forEach((s) => {\n\t\tprocessSearch(s, link);\n\t});\n\n\treturn link;\n};\n\nexport const processFolder = (\n\tsoapFolder: SoapFolder,\n\tdepth: number,\n\tparent?: Folder\n): UserFolder => {\n\tconst folder: UserFolder = {\n\t\t...normalize(soapFolder, parent),\n\t\tisLink: false,\n\t\tchildren: [],\n\t\tparent: parent?.id,\n\t\tdepth\n\t};\n\tfolders[soapFolder.id] = folder;\n\tsoapFolder?.folder?.forEach((f) => {\n\t\tif (!hasId(f, IM_LOGS)) {\n\t\t\tconst child = processFolder(f, depth + 1, folder);\n\t\t\tif (!hasId(f, USER_ROOT)) {\n\t\t\t\tfolder.children.push(child);\n\t\t\t}\n\t\t}\n\t});\n\tsoapFolder?.link?.forEach((l) => {\n\t\tif (!hasId(l, IM_LOGS)) {\n\t\t\tconst child = processLink(l, depth + 1, folder);\n\t\t\tif (!hasId(l, USER_ROOT)) {\n\t\t\t\tfolder.children.push(child);\n\t\t\t}\n\t\t}\n\t});\n\tsoapFolder?.search?.forEach((s) => {\n\t\tprocessSearch(s, folder);\n\t});\n\treturn folder;\n};\n\nexport const handleFolderRefresh = (\n\tsoapFolders: Array<SoapFolder>,\n\tcurrentView: FolderView\n): UserFolder | Array<UserFolder> => {\n\tview = currentView;\n\tif (soapFolders.length > 1) {\n\t\tconst sharedAccounts = soapFolders.slice(1);\n\t\treturn [\n\t\t\tprocessFolder(soapFolders[0], 0),\n\t\t\t...sharedAccounts.map((folder) => processLink(folder as SoapLink, 0))\n\t\t] as Array<UserFolder>;\n\t}\n\treturn processFolder(soapFolders[0], 0);\n};\n\nexport const handleFolderCreated = (created: Array<SoapFolder>): void =>\n\tcreated.forEach((val: SoapFolder) => {\n\t\tif (val.id && val.l && view && val.view === view) {\n\t\t\tconst parent = folders[val.l];\n\t\t\tconst folder: UserFolder = {\n\t\t\t\t...normalize(val, parent),\n\t\t\t\tisLink: false,\n\t\t\t\tchildren: [],\n\t\t\t\tparent: parent?.id,\n\t\t\t\tdepth: parent && parent.depth !== undefined ? parent.depth + 1 : 0\n\t\t\t};\n\t\t\tfolders[val.id] = folder;\n\t\t\tparent.children.push(folder);\n\t\t\tsortFoldersByName(parent.children);\n\t\t}\n\t});\nexport const handleLinkCreated = (created: Array<SoapLink>): void =>\n\tcreated.forEach((val: SoapLink) => {\n\t\tif (val.id && val.l && view && val.view === view) {\n\t\t\tconst parent = folders[val.l];\n\t\t\tconst folder: LinkFolder = {\n\t\t\t\t...normalizeLink(val, parent),\n\t\t\t\tisLink: true,\n\t\t\t\tchildren: [],\n\t\t\t\tparent: parent?.id,\n\t\t\t\tdepth: parent && parent.depth !== undefined ? parent.depth + 1 : 0\n\t\t\t};\n\t\t\tfolders[val.id] = folder;\n\t\t\tparent.children.push(folder);\n\t\t\tsortFoldersByName(parent.children);\n\t\t}\n\t});\n\nfunction getKeyByValue(map: Folders, searchValue: Partial<UserFolder>): string | undefined {\n\treturn Object.keys(map).find(\n\t\t(key) => searchValue.id === `${(map[key] as LinkFolder).zid}:${(map[key] as LinkFolder).rid}`\n\t);\n}\n\nfunction folderIsSharedWithMe(folderId: string | undefined): boolean {\n\tif (!folderId) return false;\n\tconst folder = folders[folderId];\n\tif (folder?.parent) {\n\t\treturn folderIsSharedWithMe(folder?.parent);\n\t}\n\treturn folder?.name === 'USER_ROOT';\n}\n\nexport const handleFolderModified = (modified: Array<Partial<UserFolder>>): void =>\n\t// the type defined in shell is not correct refs: SHELL-118\n\t// FIXME: remove the ts-ignore when the type will be fixed\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore\n\tmodified.forEach((val: Partial<SoapFolder>): void => {\n\t\tif (!val.id) return;\n\t\tconst mountPointId = val.id.includes(':') ? getKeyByValue(folders, val) : val.id;\n\t\tconst parentMountPointId = getKeyByValue(folders, { id: val.l });\n\t\tconst isSharedWithMe = folderIsSharedWithMe(mountPointId);\n\t\tconst parentIsSharedWithMe = folderIsSharedWithMe(parentMountPointId);\n\t\tconst parentFolderId = parentIsSharedWithMe && parentMountPointId ? parentMountPointId : val.l;\n\t\tconst folderId = isSharedWithMe && mountPointId ? mountPointId : val.id;\n\t\tconst folder = folderId ? folders[folderId] : null;\n\n\t\tif (folder) {\n\t\t\tObject.assign(folder, omit({ ...val, id: folderId }));\n\t\t\tupdateChildren(folder, val);\n\t\t\tif (typeof val.f !== 'undefined') {\n\t\t\t\tfolder.checked = testFolderIsChecked({ string: val.f });\n\t\t\t}\n\n\t\t\tconst oldParentId = folder.parent;\n\n\t\t\tif (oldParentId) {\n\t\t\t\tconst oldParent = folders[oldParentId];\n\t\t\t\tif (oldParent) {\n\t\t\t\t\tif (!val.l) {\n\t\t\t\t\t\toldParent.children = oldParent.children.map((f) => (f.id !== val.id ? f : folder));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst newParent = parentFolderId ? folders[parentFolderId] : null;\n\t\t\t\t\t\tif (newParent) {\n\t\t\t\t\t\t\toldParent.children = oldParent.children.filter((f) => f.id !== folderId);\n\t\t\t\t\t\t\tnewParent.children.push(folder);\n\t\t\t\t\t\t\tsortFoldersByName(newParent.children);\n\t\t\t\t\t\t\tfolder.parent = newParent.id;\n\t\t\t\t\t\t\tfolder.depth = newParent?.depth !== undefined ? newParent.depth + 1 : 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfolders[folderId] = folder;\n\t\t\t}\n\t\t}\n\t});\n\nconst collectFolderSubtreeIds = (folderId: string): string[] => {\n\tconst folder = folders[folderId];\n\tif (!folder) {\n\t\treturn [];\n\t}\n\n\treturn folder.children.reduce<string[]>(\n\t\t(acc, child) => [...acc, child.id, ...collectFolderSubtreeIds(child.id)],\n\t\t[]\n\t);\n};\n\nexport const handleFolderDeleted = (deleted: string[]): void =>\n\tdeleted.forEach((val) => {\n\t\tconst folderIdsToDelete = [val, ...collectFolderSubtreeIds(val)];\n\n\t\tfolderIdsToDelete.forEach((folderId) => {\n\t\t\tconst folder = folders[folderId];\n\t\t\tif (folder) {\n\t\t\t\tif (folder.parent) {\n\t\t\t\t\tconst parent = folders[folder.parent];\n\t\t\t\t\tif (parent) {\n\t\t\t\t\t\tparent.children = parent.children.filter((obj) => obj.id !== folderId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdelete folders[folderId];\n\t\t\t\tdelete searches[folderId];\n\t\t\t}\n\t\t});\n\t});\nexport const handleFolderNotify = (notify: SoapNotify): void => {\n\thandleFolderCreated(notify.created?.folder ?? []);\n\thandleLinkCreated(notify.created?.link ?? []);\n\t// the type defined in shell is not correct refs: SHELL-118\n\t// FIXME: remove the ts-ignore when the type will be fixed\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore\n\thandleFolderModified([...(notify.modified?.folder ?? []), ...(notify.modified?.link ?? [])]);\n\thandleFolderDeleted(notify.deleted ?? []);\n};\n\nexport const handleFoldersMessages = ({ data }: FolderMessage): void => {\n\tif (data.op === 'refresh' && data.folder) {\n\t\thandleFolderRefresh(data.folder, data.currentView);\n\t}\n\tif (data.op === 'notify') {\n\t\thandleFolderNotify(data.notify);\n\t}\n};\n\nexport const handleMessage = ({ data }: FolderMessage): void => {\n\thandleFoldersMessages({ data });\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore\n\tpostMessage({ folders, linksIdMap, searches });\n};\n"]}
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@zextras/carbonio-ui-commons",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Carbonio UI Commons",
5
+ "packageManager": "pnpm@10.32.1",
5
6
  "main": "./lib/index.js",
6
7
  "types": "./lib/index.d.ts",
7
8
  "exports": {
@@ -13,27 +14,29 @@
13
14
  },
14
15
  "engines": {
15
16
  "node": "v22",
16
- "npm": "v10"
17
+ "pnpm": ">=10"
17
18
  },
18
19
  "scripts": {
19
- "build": "npm run build:lib",
20
- "build:dev": "npm run build:lib",
20
+ "build": "pnpm run build:lib",
21
+ "build:dev": "pnpm run build:lib",
21
22
  "prebuild:lib": "rm -rf lib",
22
23
  "build:lib": "tsc -p tsconfig.lib.json",
23
- "test": "TZ=Europe/Rome jest --testTimeout=20000 --maxWorkers=50%",
24
+ "test": "vitest run",
25
+ "test:watch": "vitest",
26
+ "coverage": "vitest run --coverage",
24
27
  "type-check": "tsc --noEmit",
25
- "type-check:watch": "npm run type-check -- --watch",
28
+ "type-check:watch": "pnpm run type-check -- --watch",
26
29
  "lint": "eslint --ext .js,.jsx,.ts,.tsx --resolve-plugins-relative-to node_modules/@zextras/carbonio-ui-configs src",
27
30
  "lint-fix": "eslint --fix --ext .js,.jsx,.ts,.tsx --quiet --resolve-plugins-relative-to node_modules/@zextras/carbonio-ui-configs",
28
31
  "lint-errors": "eslint --ext .js,.jsx,.ts,.tsx --quiet --resolve-plugins-relative-to node_modules/@zextras/carbonio-ui-configs src",
29
32
  "lint-stats": "eslint --ext .js,.jsx,.ts,.tsx --format node_modules/eslint-stats/byErrorAndWarningStacked --resolve-plugins-relative-to node_modules/@zextras/carbonio-ui-configs src",
30
- "lint-check": "npm run lint-errors; npm run type-check",
31
- "prestart": "npm run prebuild:pkg",
33
+ "lint-check": "pnpm run lint-errors; pnpm run type-check",
34
+ "prestart": "pnpm run prebuild:pkg",
32
35
  "prettify:check": "prettier --check .",
33
36
  "start": "sdk watch",
34
- "prepack": "npm run build:lib",
35
- "packTo": "npm pack --pack-destination $PKG_PATH && cd $PKG_PATH && npm i zextras-carbonio-ui-commons-$npm_package_version.tgz",
36
- "deploy-on-module": "npm pack && rm -rf $PKG_PATH/node_modules/@zextras/carbonio-ui-commons/* && tar -xf zextras-carbonio-ui-commons-$npm_package_version.tgz -C $PKG_PATH/node_modules/@zextras/carbonio-ui-commons/ --strip-components 1"
37
+ "prepack": "pnpm run build:lib",
38
+ "packTo": "pnpm pack --pack-destination $PKG_PATH && cd $PKG_PATH && pnpm add ./zextras-carbonio-ui-commons-$npm_package_version.tgz",
39
+ "deploy-on-module": "pnpm pack && rm -rf $PKG_PATH/node_modules/@zextras/carbonio-ui-commons/* && tar -xf zextras-carbonio-ui-commons-$npm_package_version.tgz -C $PKG_PATH/node_modules/@zextras/carbonio-ui-commons/ --strip-components 1"
37
40
  },
38
41
  "keywords": [],
39
42
  "author": "Zextras <https://www.zextras.com/carbonio/>",
@@ -46,71 +49,88 @@
46
49
  ],
47
50
  "license": "AGPL-3.0-only",
48
51
  "devDependencies": {
49
- "@babel/core": "^7.24.0",
50
- "@babel/plugin-proposal-class-properties": "^7.18.6",
51
- "@babel/plugin-transform-runtime": "^7.24.0",
52
- "@babel/preset-env": "^7.20.2",
53
- "@babel/preset-react": "^7.18.6",
54
- "@babel/preset-typescript": "^7.21.0",
55
- "@commitlint/cli": "^19.6.1",
56
- "@commitlint/config-conventional": "^19.6.0",
57
- "@emotion/babel-plugin": "^11.13.5",
58
- "@faker-js/faker": "^8.4.1",
59
- "@testing-library/dom": "^10.4.0",
60
- "@testing-library/jest-dom": "^6.4.5",
61
- "@testing-library/react": "^16.0.1",
62
- "@testing-library/user-event": "^14.5.2",
63
- "@tsconfig/node20": "^20.1.5",
64
- "@types/jest": "^29.5.12",
65
- "@types/lodash": "^4.17.4",
66
- "@types/react": "^18.3.2",
67
- "@types/react-dom": "^18.3.1",
68
- "@types/react-redux": "^7.1.25",
69
- "@types/uuid": "^10.0.0",
52
+ "@babel/core": "7.29.0",
53
+ "@babel/plugin-transform-runtime": "7.29.0",
54
+ "@babel/preset-env": "7.29.2",
55
+ "@babel/preset-react": "7.28.5",
56
+ "@babel/preset-typescript": "7.28.5",
57
+ "@commitlint/cli": "19.8.1",
58
+ "@commitlint/config-conventional": "19.8.1",
59
+ "@emotion/babel-plugin": "11.13.5",
60
+ "@faker-js/faker": "8.4.1",
61
+ "@semantic-release/commit-analyzer": "12.0.0",
62
+ "@semantic-release/github": "10.3.5",
63
+ "@semantic-release/npm": "11.0.3",
64
+ "@semantic-release/release-notes-generator": "14.1.0",
65
+ "@testing-library/dom": "10.4.0",
66
+ "@testing-library/jest-dom": "6.6.3",
67
+ "@testing-library/react": "16.3.0",
68
+ "@testing-library/user-event": "14.6.1",
69
+ "@tsconfig/node20": "20.1.9",
70
+ "@types/jest": "30.0.0",
71
+ "@types/lodash": "4.17.24",
72
+ "@types/react": "18.3.28",
73
+ "@types/react-dom": "18.3.7",
74
+ "@types/react-redux": "7.1.34",
75
+ "@types/uuid": "10.0.0",
76
+ "@vitejs/plugin-react": "5.2.0",
77
+ "@vitest/coverage-v8": "4.1.2",
70
78
  "@zextras/carbonio-search-ui": "github:zextras/carbonio-search-ui#v0.0.7",
71
- "@zextras/carbonio-ui-configs": "^2.1.0",
79
+ "@zextras/carbonio-ui-configs": "2.1.0",
72
80
  "@zextras/carbonio-ui-sdk": "2.2.2",
73
- "babel-plugin-transform-import-meta": "^2.2.0",
74
- "eslint-plugin-jest-dom": "^5.4.0",
75
- "eslint-plugin-notice": "^0.9.10",
76
- "eslint-plugin-testing-library": "^5.10.1",
77
- "eslint-plugin-unused-imports": "^2.0.0",
78
- "jest": "^29.7.0",
79
- "jest-environment-jsdom": "^29.7.0",
80
- "jest-fail-on-console": "^3.1.2",
81
- "jest-fetch-mock": "^3.0.3",
82
- "jest-junit": "^15.0.0",
83
- "msw": "^2.2.3",
84
- "npm": "^10.5.0",
85
- "react-redux": "^8.0.5",
86
- "ts-node": "^10.9.2",
87
- "typescript": "^5.7.2"
81
+ "babel-plugin-transform-import-meta": "2.3.3",
82
+ "conventional-changelog-conventionalcommits": "7.0.2",
83
+ "eslint": "8.57.1",
84
+ "eslint-plugin-jest-dom": "5.5.0",
85
+ "eslint-plugin-notice": "0.9.10",
86
+ "eslint-plugin-testing-library": "5.11.1",
87
+ "eslint-plugin-unused-imports": "2.0.0",
88
+ "jsdom": "25.0.1",
89
+ "moment-timezone": "0.5.48",
90
+ "msw": "2.10.4",
91
+ "prettier": "3.6.2",
92
+ "react-redux": "8.1.3",
93
+ "semantic-release": "24.2.9",
94
+ "ts-node": "10.9.2",
95
+ "typescript": "5.8.3",
96
+ "vitest": "4.1.2"
88
97
  },
89
98
  "dependencies": {
90
- "core-js": "^3.36.0",
91
- "i18next": "^22.4.13",
92
- "immer": "^9.0.19",
93
- "uuid": "^9.0.0",
94
- "zustand": "^4.5.2"
99
+ "core-js": "3.47.0",
100
+ "i18next": "22.5.1",
101
+ "immer": "9.0.21",
102
+ "redux": "4.2.1",
103
+ "uuid": "9.0.1",
104
+ "zustand": "4.5.7"
95
105
  },
96
106
  "peerDependencies": {
97
- "@emotion/react": "^11.14.0",
98
- "@emotion/styled": "^11.14.0",
99
- "@mui/icons-material": "^5.15.12",
100
- "@mui/material": "^5.15.12",
107
+ "@emotion/react": "11.14.0",
108
+ "@emotion/styled": "11.14.1",
109
+ "@mui/icons-material": "5.18.0",
110
+ "@mui/material": "5.18.0",
101
111
  "@zextras/carbonio-design-system": ">=12.0.0",
102
- "@zextras/carbonio-shell-ui": ">=12.0.0",
112
+ "@zextras/carbonio-shell-ui": ">=14.0.0",
103
113
  "@zextras/carbonio-ui-soap-lib": ">=1.0.4",
104
- "lodash": "^4.17.21",
105
- "react": "^18.3.1",
106
- "react-dom": "^18.3.1",
107
- "react-i18next": "^12.2.0",
108
- "react-router-dom": "^6.30.0"
114
+ "lodash": "4.17.21",
115
+ "react": "18.3.1",
116
+ "react-dom": "18.3.1",
117
+ "react-i18next": "12.3.1",
118
+ "react-router-dom": "6.30.1"
109
119
  },
110
120
  "files": [
111
121
  "lib",
112
122
  "README.md"
113
123
  ],
124
+ "pnpm": {
125
+ "onlyBuiltDependencies": [
126
+ "@zextras/carbonio-search-ui",
127
+ "core-js",
128
+ "esbuild",
129
+ "msw",
130
+ "protobufjs",
131
+ "unrs-resolver"
132
+ ]
133
+ },
114
134
  "browserslist": [
115
135
  ">1%",
116
136
  "last 1 version",