@reltio/components 1.4.2178 → 1.4.2180

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 (83) hide show
  1. package/cjs/constants/segmantation.d.ts +14 -0
  2. package/cjs/constants/segmantation.js +17 -1
  3. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +8 -0
  4. package/cjs/features/activity-log/ActivitiesFactory/components/SegmentActivity/SegmentActivity.d.ts +8 -0
  5. package/cjs/features/activity-log/ActivitiesFactory/components/SegmentActivity/SegmentActivity.js +20 -0
  6. package/cjs/features/activity-log/ActivitiesFactory/components/SegmentActivity/index.d.ts +1 -0
  7. package/cjs/features/activity-log/ActivitiesFactory/components/SegmentActivity/index.js +5 -0
  8. package/cjs/features/activity-log/ActivityFilterEditor/helpers.test.js +3 -2
  9. package/cjs/features/activity-log/ActivityLog/ActivityLog.test.js +240 -5
  10. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.d.ts +2 -1
  11. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.js +2 -2
  12. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.d.ts +2 -1
  13. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.js +5 -2
  14. package/cjs/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentDeltaField.d.ts +7 -0
  15. package/cjs/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentDeltaField.js +46 -0
  16. package/cjs/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentDeltaField.module.css.js +9 -0
  17. package/cjs/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentQueryDeltaValue.d.ts +4 -0
  18. package/cjs/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentQueryDeltaValue.js +19 -0
  19. package/cjs/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentRefreshScheduleDeltaValue.d.ts +5 -0
  20. package/cjs/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentRefreshScheduleDeltaValue.js +57 -0
  21. package/cjs/features/activity-log/RecordUpdates/components/SegmentDeltaField/index.d.ts +1 -0
  22. package/cjs/features/activity-log/RecordUpdates/components/SegmentDeltaField/index.js +5 -0
  23. package/cjs/features/activity-log/SegmentObject/SegmentObject.d.ts +7 -0
  24. package/cjs/features/activity-log/SegmentObject/SegmentObject.js +21 -0
  25. package/cjs/features/activity-log/SegmentObject/SegmentObject.module.css.js +9 -0
  26. package/cjs/features/activity-log/SegmentObject/index.d.ts +1 -0
  27. package/cjs/features/activity-log/SegmentObject/index.js +5 -0
  28. package/cjs/features/activity-log/SegmentRecord/SegmentRecord.d.ts +7 -0
  29. package/cjs/features/activity-log/SegmentRecord/SegmentRecord.js +22 -0
  30. package/cjs/features/activity-log/SegmentRecord/index.d.ts +1 -0
  31. package/cjs/features/activity-log/SegmentRecord/index.js +5 -0
  32. package/cjs/features/activity-log/hooks/useSegmentReadableQuery.d.ts +2 -0
  33. package/cjs/features/activity-log/hooks/useSegmentReadableQuery.js +13 -0
  34. package/cjs/features/activity-log/index.d.ts +1 -0
  35. package/cjs/features/activity-log/index.js +3 -1
  36. package/cjs/features/activity-log/types.d.ts +5 -1
  37. package/cjs/features/activity-log/types.js +3 -0
  38. package/cjs/features/activity-log/utils/activities.js +3 -0
  39. package/cjs/features/activity-log/utils/filters.js +4 -0
  40. package/cjs/features/history/types.d.ts +3 -0
  41. package/cjs/hooks/useRelationsLoader/useRelationsLoader.js +1 -1
  42. package/constants/segmantation.d.ts +14 -0
  43. package/constants/segmantation.js +16 -0
  44. package/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +8 -0
  45. package/features/activity-log/ActivitiesFactory/components/SegmentActivity/SegmentActivity.d.ts +8 -0
  46. package/features/activity-log/ActivitiesFactory/components/SegmentActivity/SegmentActivity.js +13 -0
  47. package/features/activity-log/ActivitiesFactory/components/SegmentActivity/index.d.ts +1 -0
  48. package/features/activity-log/ActivitiesFactory/components/SegmentActivity/index.js +1 -0
  49. package/features/activity-log/ActivityFilterEditor/helpers.test.js +3 -2
  50. package/features/activity-log/ActivityLog/ActivityLog.test.js +240 -5
  51. package/features/activity-log/ActivityLogFilter/ActivityLogFilter.d.ts +2 -1
  52. package/features/activity-log/ActivityLogFilter/ActivityLogFilter.js +2 -2
  53. package/features/activity-log/RecordUpdates/RecordUpdates.d.ts +2 -1
  54. package/features/activity-log/RecordUpdates/RecordUpdates.js +5 -2
  55. package/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentDeltaField.d.ts +7 -0
  56. package/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentDeltaField.js +39 -0
  57. package/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentDeltaField.module.css.js +9 -0
  58. package/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentQueryDeltaValue.d.ts +4 -0
  59. package/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentQueryDeltaValue.js +12 -0
  60. package/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentRefreshScheduleDeltaValue.d.ts +5 -0
  61. package/features/activity-log/RecordUpdates/components/SegmentDeltaField/SegmentRefreshScheduleDeltaValue.js +27 -0
  62. package/features/activity-log/RecordUpdates/components/SegmentDeltaField/index.d.ts +1 -0
  63. package/features/activity-log/RecordUpdates/components/SegmentDeltaField/index.js +1 -0
  64. package/features/activity-log/SegmentObject/SegmentObject.d.ts +7 -0
  65. package/features/activity-log/SegmentObject/SegmentObject.js +14 -0
  66. package/features/activity-log/SegmentObject/SegmentObject.module.css.js +9 -0
  67. package/features/activity-log/SegmentObject/index.d.ts +1 -0
  68. package/features/activity-log/SegmentObject/index.js +1 -0
  69. package/features/activity-log/SegmentRecord/SegmentRecord.d.ts +7 -0
  70. package/features/activity-log/SegmentRecord/SegmentRecord.js +15 -0
  71. package/features/activity-log/SegmentRecord/index.d.ts +1 -0
  72. package/features/activity-log/SegmentRecord/index.js +1 -0
  73. package/features/activity-log/hooks/useSegmentReadableQuery.d.ts +2 -0
  74. package/features/activity-log/hooks/useSegmentReadableQuery.js +9 -0
  75. package/features/activity-log/index.d.ts +1 -0
  76. package/features/activity-log/index.js +1 -0
  77. package/features/activity-log/types.d.ts +5 -1
  78. package/features/activity-log/types.js +3 -0
  79. package/features/activity-log/utils/activities.js +3 -0
  80. package/features/activity-log/utils/filters.js +4 -0
  81. package/features/history/types.d.ts +3 -0
  82. package/hooks/useRelationsLoader/useRelationsLoader.js +2 -2
  83. package/package.json +2 -2
@@ -177,6 +177,172 @@ describe('Activity log tests', function () {
177
177
  }
178
178
  ],
179
179
  itemsTotal: 1
180
+ },
181
+ {
182
+ uri: 'activities/545aadab-31e2-4d74-9e70-9154c55e6b62',
183
+ user: 'test@reltio.com',
184
+ timestamp: 1750062462522,
185
+ items: [
186
+ {
187
+ id: '00000-00011DH',
188
+ user: 'test@reltio.com',
189
+ method: 'POST',
190
+ url: '/reltio/api/LocalTest/segments',
191
+ clientType: 'UNKNOWN',
192
+ timestamp: 1750062462522,
193
+ objectUri: 'segments/07byrT0',
194
+ objectLabel: 'Boolean test',
195
+ data: {
196
+ type: 'SEGMENT_UPDATE'
197
+ },
198
+ deltaCollection: {
199
+ delta: [
200
+ {
201
+ type: 'ATTRIBUTE_CHANGED',
202
+ attributeType: 'configuration/segments/attributes/rule',
203
+ newValue: {
204
+ value: "(equals(entity.type,'configuration/entityTypes/Company') and equals(entity.attributes.Name,'New company name')) or (equals(entity.type,'configuration/entityTypes/Location') and (equals(interaction.type,'configuration/interactionTypes/Prescriptions') and equals(interaction.attributes.Medication,'New medication')))"
205
+ },
206
+ oldValue: {
207
+ value: "(equals(entity.type,'configuration/entityTypes/Company') and equals(entity.attributes.Name,'Old company name')) or (equals(entity.type,'configuration/entityTypes/Location') and (equals(interaction.type,'configuration/interactionTypes/Prescriptions') and equals(interaction.attributes.Medication,'Old medication')))"
208
+ }
209
+ },
210
+ {
211
+ type: 'ATTRIBUTE_CHANGED',
212
+ attributeType: 'configuration/segments/attributes/status',
213
+ newValue: {
214
+ value: 'submitted'
215
+ },
216
+ oldValue: {
217
+ value: 'live'
218
+ }
219
+ },
220
+ {
221
+ type: 'ATTRIBUTE_CHANGED',
222
+ attributeType: 'configuration/segments/attributes/sharing',
223
+ newValue: {
224
+ value: 'public'
225
+ },
226
+ oldValue: {
227
+ value: 'private'
228
+ }
229
+ },
230
+ {
231
+ type: 'ATTRIBUTE_CHANGED',
232
+ attributeType: 'configuration/segments/attributes/schedule',
233
+ newValue: {
234
+ value: {
235
+ startTime: '2025-08-05T18:30:00Z',
236
+ repeat: 'RRULE:INTERVAL=1;FREQ=DAILY;BYHOUR=8;BYMINUTE=35'
237
+ }
238
+ },
239
+ oldValue: {
240
+ value: {
241
+ startTime: '2025-10-05T18:30:00Z',
242
+ repeat: 'RRULE:INTERVAL=1;FREQ=DAILY;BYHOUR=8;BYMINUTE=35'
243
+ }
244
+ }
245
+ },
246
+ {
247
+ type: 'ATTRIBUTE_CHANGED',
248
+ attributeType: 'configuration/segments/attributes/label',
249
+ newValue: {
250
+ value: 'New name'
251
+ },
252
+ oldValue: {
253
+ value: 'Old name'
254
+ }
255
+ },
256
+ {
257
+ type: 'ATTRIBUTE_ADDED',
258
+ attributeType: 'configuration/segments/attributes/description',
259
+ newValue: {
260
+ value: 'Added description'
261
+ }
262
+ }
263
+ ]
264
+ },
265
+ eventId: '1750062462522_02DTzOy'
266
+ }
267
+ ],
268
+ itemsTotal: 1
269
+ },
270
+ {
271
+ uri: 'activities/545aadab-31e2-4d74-9e70-9154c55e6b63',
272
+ user: 'test@reltio.com',
273
+ timestamp: 1750062462522,
274
+ items: [
275
+ {
276
+ id: '00000-00011DH',
277
+ user: 'test@reltio.com',
278
+ method: 'POST',
279
+ url: '/reltio/api/LocalTest/segments',
280
+ clientType: 'UNKNOWN',
281
+ timestamp: 1750062462522,
282
+ objectUri: 'segments/07byrT0',
283
+ objectLabel: 'Boolean test',
284
+ data: {
285
+ type: 'SEGMENT_UPDATE'
286
+ },
287
+ deltaCollection: {
288
+ delta: [
289
+ {
290
+ type: 'ATTRIBUTE_REMOVED',
291
+ attributeType: 'configuration/segments/attributes/description',
292
+ oldValue: {
293
+ value: 'Old removed description'
294
+ }
295
+ }
296
+ ]
297
+ },
298
+ eventId: '1750062462522_02DTzOy'
299
+ }
300
+ ],
301
+ itemsTotal: 1
302
+ },
303
+ {
304
+ uri: 'activities/545aadab-31e2-4d74-9e70-9154c55e6b61',
305
+ user: 'test@reltio.com',
306
+ timestamp: 1750062462522,
307
+ items: [
308
+ {
309
+ id: '00000-00011DH',
310
+ user: 'test@reltio.com',
311
+ method: 'POST',
312
+ url: '/reltio/api/LocalTest/segments',
313
+ clientType: 'UNKNOWN',
314
+ timestamp: 1750062462522,
315
+ objectUri: 'segments/07byrT0',
316
+ objectLabel: 'Boolean test',
317
+ data: {
318
+ type: 'SEGMENT_CREATE'
319
+ },
320
+ eventId: '1750062462522_02DTzOy'
321
+ }
322
+ ],
323
+ itemsTotal: 1
324
+ },
325
+ {
326
+ uri: 'activities/545aadab-31e2-4d74-9e70-9154c55e6b60',
327
+ user: 'test@reltio.com',
328
+ timestamp: 1750062462522,
329
+ items: [
330
+ {
331
+ id: '00000-00011DH',
332
+ user: 'test@reltio.com',
333
+ method: 'POST',
334
+ url: '/reltio/api/LocalTest/segments',
335
+ clientType: 'UNKNOWN',
336
+ timestamp: 1750062462522,
337
+ objectUri: 'segments/07byrT0',
338
+ objectLabel: 'Boolean test',
339
+ data: {
340
+ type: 'SEGMENT_DELETE'
341
+ },
342
+ eventId: '1750062462522_02DTzOy'
343
+ }
344
+ ],
345
+ itemsTotal: 1
180
346
  }
181
347
  ];
182
348
  var defaultProps = {
@@ -211,8 +377,8 @@ describe('Activity log tests', function () {
211
377
  setUp();
212
378
  var activityItems = screen.getAllByTestId('activity-log-item');
213
379
  var activityGroupItems = screen.getAllByTestId('activity-log-group-item');
214
- expect(activityItems).toHaveLength(4);
215
- expect(activityGroupItems).toHaveLength(3);
380
+ expect(activityItems).toHaveLength(8);
381
+ expect(activityGroupItems).toHaveLength(4);
216
382
  within(activityGroupItems[0]).getByText('Today');
217
383
  within(activityItems[0]).getByText(activities[0].user);
218
384
  within(activityItems[0]).getByText(i18n.date(activities[0].timestamp, 'LT'));
@@ -233,6 +399,29 @@ describe('Activity log tests', function () {
233
399
  within(activityItems[3]).getByText(i18n.date(activities[4].timestamp, 'LT'));
234
400
  within(activityItems[3]).getByText('Profile merged manually');
235
401
  within(activityItems[3]).getByText('entity 3');
402
+ within(activityItems[4]).getByText(activities[5].user);
403
+ within(activityItems[4]).getByText(i18n.date(activities[5].timestamp, 'LT'));
404
+ within(activityItems[4]).getByText('Segment updated');
405
+ within(activityItems[4]).getByText('Boolean test');
406
+ within(activityItems[4]).getByText('Query:');
407
+ within(activityItems[4]).getByText('Shared with:');
408
+ within(activityItems[4]).getByText('private');
409
+ within(activityItems[4]).getByText('public');
410
+ within(activityItems[4]).getByText('3 more updates');
411
+ within(activityItems[5]).getByText(activities[6].user);
412
+ within(activityItems[5]).getByText(i18n.date(activities[6].timestamp, 'LT'));
413
+ within(activityItems[5]).getByText('Segment updated');
414
+ within(activityItems[5]).getByText('Boolean test');
415
+ within(activityItems[5]).getByText('Description:');
416
+ within(activityItems[5]).getByText('Old removed description');
417
+ within(activityItems[6]).getByText(activities[7].user);
418
+ within(activityItems[6]).getByText(i18n.date(activities[7].timestamp, 'LT'));
419
+ within(activityItems[6]).getByText('Segment created');
420
+ within(activityItems[6]).getByText('Boolean test');
421
+ within(activityItems[7]).getByText(activities[8].user);
422
+ within(activityItems[7]).getByText(i18n.date(activities[8].timestamp, 'LT'));
423
+ within(activityItems[7]).getByText('Segment deleted');
424
+ within(activityItems[7]).getByText('Boolean test');
236
425
  expect(console.warn).toHaveBeenCalledWith('Activities not implemented:', activities[2].items);
237
426
  expect(console.warn).toHaveBeenCalledWith('Activities not implemented:', [activities[3].items[1]]);
238
427
  });
@@ -243,15 +432,15 @@ describe('Activity log tests', function () {
243
432
  case 0:
244
433
  user = setUp().user;
245
434
  screen.getAllByTestId('collapse-button');
246
- expect(screen.getAllByTestId('activity-log-item')).toHaveLength(4);
435
+ expect(screen.getAllByTestId('activity-log-item')).toHaveLength(8);
247
436
  return [4 /*yield*/, user.click(screen.getAllByTestId('collapse-button')[0])];
248
437
  case 1:
249
438
  _a.sent();
250
- expect(screen.getAllByTestId('activity-log-item')).toHaveLength(3);
439
+ expect(screen.getAllByTestId('activity-log-item')).toHaveLength(7);
251
440
  return [4 /*yield*/, user.click(screen.getAllByTestId('collapse-button')[0])];
252
441
  case 2:
253
442
  _a.sent();
254
- expect(screen.getAllByTestId('activity-log-item')).toHaveLength(4);
443
+ expect(screen.getAllByTestId('activity-log-item')).toHaveLength(8);
255
444
  return [2 /*return*/];
256
445
  }
257
446
  });
@@ -270,4 +459,50 @@ describe('Activity log tests', function () {
270
459
  setUp({ activities: activitiesWithoutItems });
271
460
  expect(screen.queryByTestId('activity-log-item')).not.toBeInTheDocument();
272
461
  });
462
+ it('should not render value for schedule attribute when value is null', function () {
463
+ var activitiesWithNullSchedule = [
464
+ {
465
+ uri: 'activities/1234-5678-91011',
466
+ user: 'test@reltio.com',
467
+ label: 'SEGMENT_UPDATE',
468
+ description: 'Segment schedule updated',
469
+ timestamp: 1750062462522,
470
+ items: [
471
+ {
472
+ id: '00000-00011DH',
473
+ user: 'test@reltio.com',
474
+ method: 'POST',
475
+ url: '/reltio/api/LocalTest/segments',
476
+ clientType: 'UNKNOWN',
477
+ timestamp: 1750062462522,
478
+ objectUri: 'segments/07byrT0',
479
+ objectLabel: 'Boolean test',
480
+ data: {
481
+ type: 'SEGMENT_UPDATE'
482
+ },
483
+ deltaCollection: {
484
+ delta: [
485
+ {
486
+ type: 'ATTRIBUTE_CHANGED',
487
+ attributeType: 'configuration/segments/attributes/schedule',
488
+ newValue: {
489
+ value: null
490
+ },
491
+ oldValue: {
492
+ value: null
493
+ }
494
+ }
495
+ ]
496
+ },
497
+ eventId: '1750062462522_02DTzOy'
498
+ }
499
+ ],
500
+ itemsTotal: 1
501
+ }
502
+ ];
503
+ setUp({ activities: activitiesWithNullSchedule });
504
+ var activityItems = screen.getAllByTestId('activity-log-item');
505
+ expect(activityItems).toHaveLength(1);
506
+ expect(activityItems[0].querySelector('.firstLetterCapitalized')).not.toBeInTheDocument();
507
+ });
273
508
  });
@@ -7,6 +7,7 @@ type Props = {
7
7
  entityType?: TEntityType;
8
8
  entityUri?: string;
9
9
  exportTypes?: string[];
10
+ segmentId?: string;
10
11
  };
11
- export declare const ActivityLogFilter: ({ value, entityType, entityUri, onChange, exportTypes }: Props) => React.JSX.Element;
12
+ export declare const ActivityLogFilter: ({ value, entityType, entityUri, onChange, exportTypes, segmentId }: Props) => React.JSX.Element;
12
13
  export {};
@@ -20,7 +20,7 @@ import { useMdmTenant, useMdmUser } from '../../../contexts/MdmModuleContext';
20
20
  import { getFilterLabel } from './helpers';
21
21
  import { useStyles } from './styles';
22
22
  export var ActivityLogFilter = function (_a) {
23
- var value = _a.value, entityType = _a.entityType, entityUri = _a.entityUri, onChange = _a.onChange, exportTypes = _a.exportTypes;
23
+ var value = _a.value, entityType = _a.entityType, entityUri = _a.entityUri, onChange = _a.onChange, exportTypes = _a.exportTypes, segmentId = _a.segmentId;
24
24
  var styles = useStyles();
25
25
  var user = useMdmUser();
26
26
  var tenant = useMdmTenant();
@@ -31,6 +31,6 @@ export var ActivityLogFilter = function (_a) {
31
31
  React.createElement(Tooltip, { title: filterLabel },
32
32
  React.createElement(Typography, { variant: "body2", className: styles.label, color: "textSecondary", display: "block", noWrap: true }, filterLabel)),
33
33
  React.createElement("div", { className: styles.buttonsWrapper },
34
- canExport && React.createElement(ActivityExportButton, { filters: __assign(__assign({}, value), { entityUri: entityUri }), exportTypes: exportTypes }),
34
+ canExport && (React.createElement(ActivityExportButton, { filters: __assign(__assign({}, value), { entityUri: entityUri, segmentId: segmentId }), exportTypes: exportTypes })),
35
35
  React.createElement(ActivityFilterButton, { filter: value, entityType: entityType, onChange: onChange }))));
36
36
  };
@@ -3,6 +3,7 @@ import { ActivityDelta } from '../types';
3
3
  type Props = {
4
4
  updates: ActivityDelta[];
5
5
  recordId: string;
6
+ isSegment?: boolean;
6
7
  };
7
- export declare const RecordUpdates: ({ updates, recordId }: Props) => React.JSX.Element;
8
+ export declare const RecordUpdates: ({ updates, recordId, isSegment }: Props) => React.JSX.Element;
8
9
  export {};
@@ -1,17 +1,20 @@
1
1
  import React from 'react';
2
2
  import i18n from 'ui-i18n';
3
3
  import { DeltaField } from './components/DeltaField';
4
+ import { SegmentDeltaField } from './components/SegmentDeltaField';
4
5
  import { useCollapsibleItems } from '../contexts/CollapsibleItemsContext';
5
6
  import { MoreItemsLink } from '../MoreItemsLink';
6
7
  import { useStyles } from './styles';
7
8
  export var RecordUpdates = function (_a) {
8
- var updates = _a.updates, recordId = _a.recordId;
9
+ var updates = _a.updates, recordId = _a.recordId, isSegment = _a.isSegment;
9
10
  var styles = useStyles();
10
11
  var _b = useCollapsibleItems({
11
12
  itemsId: recordId,
12
13
  items: updates
13
14
  }), onExpand = _b.onExpand, collapsedItemsCount = _b.collapsedItemsCount, itemsToShow = _b.itemsToShow;
14
15
  return (React.createElement(React.Fragment, null,
15
- itemsToShow.map(function (update, index) { return (React.createElement(DeltaField, { key: index, delta: update })); }),
16
+ itemsToShow.map(function (update, index) {
17
+ return isSegment ? React.createElement(SegmentDeltaField, { key: index, delta: update }) : React.createElement(DeltaField, { key: index, delta: update });
18
+ }),
16
19
  collapsedItemsCount ? (React.createElement(MoreItemsLink, { itemsCount: collapsedItemsCount, itemsLabel: collapsedItemsCount === 1 ? i18n.text('update') : i18n.text('updates'), onClick: onExpand, className: styles.moreLabel })) : null));
17
20
  };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { ActivityDelta } from '../../../types';
3
+ type Props = {
4
+ delta: ActivityDelta;
5
+ };
6
+ export declare const SegmentDeltaField: ({ delta }: Props) => React.JSX.Element;
7
+ export {};
@@ -0,0 +1,39 @@
1
+ import classnames from 'classnames';
2
+ import React from 'react';
3
+ import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
4
+ import Chip from '@mui/material/Chip';
5
+ import { DeltaTypes } from '../../../types';
6
+ import { SEGMENT_ACTIVITY_LOG_ATTRIBUTES, SegmentActivityLogAttributes } from '../../../../../constants/segmantation';
7
+ import { Field } from '../../../Field';
8
+ import { SegmentQueryDeltaValue } from './SegmentQueryDeltaValue';
9
+ import { SegmentRefreshScheduleDeltaValue } from './SegmentRefreshScheduleDeltaValue';
10
+ import styles from './SegmentDeltaField.module.css';
11
+ export var SegmentDeltaField = function (_a) {
12
+ var _b, _c;
13
+ var delta = _a.delta;
14
+ var newValue = (_b = delta.newValue) === null || _b === void 0 ? void 0 : _b.value;
15
+ var oldValue = (_c = delta.oldValue) === null || _c === void 0 ? void 0 : _c.value;
16
+ var value = oldValue || newValue;
17
+ var deltaLabel = DeltaTypes[delta.type];
18
+ var attribute = SEGMENT_ACTIVITY_LOG_ATTRIBUTES[delta.attributeType];
19
+ var renderValue = function (value) {
20
+ if (!value)
21
+ return null;
22
+ if (delta.attributeType === SegmentActivityLogAttributes.rule) {
23
+ return typeof value === 'string' ? React.createElement(SegmentQueryDeltaValue, { value: value }) : null;
24
+ }
25
+ if (delta.attributeType === SegmentActivityLogAttributes.schedule) {
26
+ return React.createElement(SegmentRefreshScheduleDeltaValue, { value: value });
27
+ }
28
+ if (delta.attributeType === SegmentActivityLogAttributes.sharing) {
29
+ return React.createElement("p", { className: styles.firstLetterCapitalized }, String(value));
30
+ }
31
+ return React.createElement(React.Fragment, null, String(value));
32
+ };
33
+ return attribute ? (React.createElement(Field, { fieldName: attribute, "data-reltio-id": "segment-delta-field" },
34
+ value && renderValue(value),
35
+ newValue && oldValue && (React.createElement(React.Fragment, null,
36
+ React.createElement(ArrowForwardIcon, { className: styles.arrow }),
37
+ renderValue(newValue))),
38
+ deltaLabel && (React.createElement(Chip, { variant: "outlined", label: deltaLabel, className: classnames(styles.chip, styles[deltaLabel]) })))) : null;
39
+ };
@@ -0,0 +1,9 @@
1
+ const styles = {"arrow":"SegmentDeltaField-arrow--hgMCT","chip":"SegmentDeltaField-chip--2msw7","edited":"SegmentDeltaField-edited--7vNXD","added":"SegmentDeltaField-added--wVdZT","deleted":"SegmentDeltaField-deleted--gtV3H","firstLetterCapitalized":"SegmentDeltaField-firstLetterCapitalized--x-YYp"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.SegmentDeltaField-arrow--hgMCT{color:var(--mui-palette-text-primary);font-size:12px;margin:0 8px -1px}.SegmentDeltaField-chip--2msw7{flex-shrink:0;font-size:10px;font-weight:500;height:20px;line-height:16px;margin-left:9px;text-transform:capitalize;width:53px}.SegmentDeltaField-chip--2msw7 span{padding:0}.SegmentDeltaField-chip--2msw7.SegmentDeltaField-edited--7vNXD{border-color:#6973c2;color:#6973c2}.SegmentDeltaField-chip--2msw7.SegmentDeltaField-added--wVdZT{border-color:#75c378;color:#75c378}.SegmentDeltaField-chip--2msw7.SegmentDeltaField-deleted--gtV3H{border-color:#f97061;color:#f97061}.SegmentDeltaField-firstLetterCapitalized--x-YYp{display:inline-block;margin:0}.SegmentDeltaField-firstLetterCapitalized--x-YYp:first-letter{text-transform:capitalize}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const SegmentQueryDeltaValue: ({ value }: {
3
+ value: string;
4
+ }) => React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { convertRuleToBuilderState, readableQueryToString } from '@reltio/mdm-sdk';
3
+ import { useMdmMetadata } from '../../../../../contexts/MdmModuleContext';
4
+ import { useSegmentReadableQuery } from '../../../hooks/useSegmentReadableQuery';
5
+ export var SegmentQueryDeltaValue = function (_a) {
6
+ var value = _a.value;
7
+ var metadata = useMdmMetadata();
8
+ var builderState = convertRuleToBuilderState(value, metadata);
9
+ var readableQuery = useSegmentReadableQuery(builderState);
10
+ var readableQueryString = readableQueryToString(readableQuery);
11
+ return React.createElement(React.Fragment, null, readableQueryString);
12
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { NewSegmentSchedule } from '@reltio/mdm-sdk';
3
+ export declare const SegmentRefreshScheduleDeltaValue: ({ value }: {
4
+ value: NewSegmentSchedule;
5
+ }) => React.JSX.Element;
@@ -0,0 +1,27 @@
1
+ import React, { useMemo } from 'react';
2
+ import { convertScheduleApiFormatToTextChunks } from '@reltio/mdm-sdk';
3
+ import styles from './SegmentDeltaField.module.css';
4
+ var addSpace = function (s, withSpace) {
5
+ if (withSpace === void 0) { withSpace = true; }
6
+ return (withSpace ? s + ' ' : s);
7
+ };
8
+ export var SegmentRefreshScheduleDeltaValue = function (_a) {
9
+ var value = _a.value;
10
+ var scheduleTextChunks = convertScheduleApiFormatToTextChunks(value);
11
+ var scheduleString = useMemo(function () {
12
+ var chunkStrings = scheduleTextChunks
13
+ .filter(function (chunk) { return chunk.activeLabel; })
14
+ .map(function (_a) {
15
+ var activeLabel = _a.activeLabel, inactiveLabel = _a.inactiveLabel, _b = _a.hasEndingSpace, hasEndingSpace = _b === void 0 ? true : _b;
16
+ var out = [];
17
+ if (inactiveLabel)
18
+ out.push(addSpace(inactiveLabel));
19
+ var active = activeLabel.trim();
20
+ if (active)
21
+ out.push(addSpace(active, hasEndingSpace));
22
+ return out.join('');
23
+ });
24
+ return chunkStrings.join('').trimEnd();
25
+ }, [scheduleTextChunks]);
26
+ return React.createElement("p", { className: styles.firstLetterCapitalized }, scheduleString);
27
+ };
@@ -0,0 +1 @@
1
+ export { SegmentDeltaField } from './SegmentDeltaField';
@@ -0,0 +1 @@
1
+ export { SegmentDeltaField } from './SegmentDeltaField';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { ActivityItem } from '../types';
3
+ type Props = {
4
+ item: ActivityItem;
5
+ };
6
+ export declare const SegmentObject: ({ item }: Props) => React.JSX.Element;
7
+ export {};
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import { getLabel } from '@reltio/mdm-sdk';
4
+ import { ActivityTypes } from '../types';
5
+ import { SegmentIdLink } from '../../../SegmentIdLink';
6
+ import styles from './SegmentObject.module.css';
7
+ export var SegmentObject = function (_a) {
8
+ var _b;
9
+ var item = _a.item;
10
+ var objectLabel = item.objectLabel, objectUri = item.objectUri, data = item.data;
11
+ var isRemoved = (data === null || data === void 0 ? void 0 : data.type) === ActivityTypes.SEGMENT_DELETE;
12
+ var segmentId = objectUri === null || objectUri === void 0 ? void 0 : objectUri.split('/').pop();
13
+ return (React.createElement(SegmentIdLink, { className: classnames(styles.link, (_b = {}, _b[styles.removed] = isRemoved, _b)), segmentId: segmentId }, getLabel(objectLabel)));
14
+ };
@@ -0,0 +1,9 @@
1
+ const styles = {"link":"SegmentObject-link--8NAXv","removed":"SegmentObject-removed--Ws93n"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.SegmentObject-link--8NAXv{color:var(--mui-palette-primary-main);font-size:13px;font-weight:400;line-height:15px;text-decoration:none;white-space:break-spaces}.SegmentObject-link--8NAXv.SegmentObject-removed--Ws93n{color:var(--mui-palette-text-secondary);pointer-events:none}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1 @@
1
+ export { SegmentObject } from './SegmentObject';
@@ -0,0 +1 @@
1
+ export { SegmentObject } from './SegmentObject';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { ActivityItem } from '../types';
3
+ type Props = {
4
+ item: ActivityItem;
5
+ };
6
+ export declare const SegmentRecord: ({ item }: Props) => React.JSX.Element;
7
+ export {};
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import i18n from 'ui-i18n';
3
+ import { Record } from '../Record';
4
+ import { RecordLabel } from '../RecordLabel';
5
+ import { RecordUpdates } from '../RecordUpdates';
6
+ import { SegmentObject } from '../SegmentObject';
7
+ export var SegmentRecord = function (_a) {
8
+ var _b;
9
+ var item = _a.item;
10
+ var deltaArray = (_b = item === null || item === void 0 ? void 0 : item.deltaCollection) === null || _b === void 0 ? void 0 : _b.delta;
11
+ return (React.createElement(Record, null,
12
+ React.createElement(RecordLabel, { description: deltaArray ? '' : i18n.text('Segment changed') },
13
+ React.createElement(SegmentObject, { item: item })),
14
+ React.createElement(RecordUpdates, { updates: deltaArray, recordId: item.id, isSegment: true })));
15
+ };
@@ -0,0 +1 @@
1
+ export { SegmentRecord } from './SegmentRecord';
@@ -0,0 +1 @@
1
+ export { SegmentRecord } from './SegmentRecord';
@@ -0,0 +1,2 @@
1
+ import { ReadableQueryPrimitive, SegmentationQueryGroup } from '@reltio/mdm-sdk';
2
+ export declare const useSegmentReadableQuery: (groups: SegmentationQueryGroup[]) => ReadableQueryPrimitive[];
@@ -0,0 +1,9 @@
1
+ import { useMemo } from 'react';
2
+ import { buildSegmentationGroupsReadableQuery } from '@reltio/mdm-sdk';
3
+ import { useMdmAttributesPresentation, useMdmLookups, useMdmMetadata } from '../../../contexts/MdmModuleContext';
4
+ export var useSegmentReadableQuery = function (groups) {
5
+ var metadata = useMdmMetadata();
6
+ var attributesPresentation = useMdmAttributesPresentation();
7
+ var lookups = useMdmLookups();
8
+ return useMemo(function () { return buildSegmentationGroupsReadableQuery(metadata, attributesPresentation, lookups, groups); }, [metadata, lookups, attributesPresentation, groups]);
9
+ };
@@ -3,5 +3,6 @@ export { ActivityLogFilter } from './ActivityLogFilter';
3
3
  export { useActivitiesLoader } from './hooks/useActivitiesLoader';
4
4
  export { useProfileActivitiesLoader } from './hooks/useProfileActivitiesLoader';
5
5
  export { getActivityLabel } from './utils/activities';
6
+ export { buildActivitiesFilterString } from './utils/filters';
6
7
  export { ActivityTypes } from './types';
7
8
  export type { ActivitiesFilter, ActivityData } from './types';
@@ -6,5 +6,6 @@ export { useActivitiesLoader } from './hooks/useActivitiesLoader';
6
6
  export { useProfileActivitiesLoader } from './hooks/useProfileActivitiesLoader';
7
7
  // helpers
8
8
  export { getActivityLabel } from './utils/activities';
9
+ export { buildActivitiesFilterString } from './utils/filters';
9
10
  // types
10
11
  export { ActivityTypes } from './types';
@@ -30,7 +30,10 @@ export declare enum ActivityTypes {
30
30
  SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE = "SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE",
31
31
  GROUP_CREATED = "GROUP_CREATED",
32
32
  GROUP_REMOVED = "GROUP_REMOVED",
33
- GROUP_CHANGED = "GROUP_CHANGED"
33
+ GROUP_CHANGED = "GROUP_CHANGED",
34
+ SEGMENT_CREATE = "SEGMENT_CREATE",
35
+ SEGMENT_DELETE = "SEGMENT_DELETE",
36
+ SEGMENT_UPDATE = "SEGMENT_UPDATE"
34
37
  }
35
38
  export type ActivitiesFilter = {
36
39
  users: string[];
@@ -40,6 +43,7 @@ export type ActivitiesFilter = {
40
43
  sources?: Source[];
41
44
  entityTypes?: TEntityType[];
42
45
  entityUri?: string;
46
+ segmentId?: string;
43
47
  };
44
48
  type DeltaObject = {
45
49
  [key: string]: DeltaValue[];
@@ -30,6 +30,9 @@ export var ActivityTypes;
30
30
  ActivityTypes["GROUP_CREATED"] = "GROUP_CREATED";
31
31
  ActivityTypes["GROUP_REMOVED"] = "GROUP_REMOVED";
32
32
  ActivityTypes["GROUP_CHANGED"] = "GROUP_CHANGED";
33
+ ActivityTypes["SEGMENT_CREATE"] = "SEGMENT_CREATE";
34
+ ActivityTypes["SEGMENT_DELETE"] = "SEGMENT_DELETE";
35
+ ActivityTypes["SEGMENT_UPDATE"] = "SEGMENT_UPDATE";
33
36
  })(ActivityTypes || (ActivityTypes = {}));
34
37
  export var DeltaTypes;
35
38
  (function (DeltaTypes) {
@@ -87,6 +87,9 @@ export var getActivityLabel = function (type) {
87
87
  _a[ActivityTypes.USER_SEARCH] = i18n.text('Searched'),
88
88
  _a[ActivityTypes.ANALYTICS_ATTRIBUTES_CHANGED] = i18n.text('Analytics attribute changed'),
89
89
  _a[ActivityTypes.SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE] = i18n.text('SFDC connector synchronization issue'),
90
+ _a[ActivityTypes.SEGMENT_CREATE] = i18n.text('Segment created'),
91
+ _a[ActivityTypes.SEGMENT_UPDATE] = i18n.text('Segment updated'),
92
+ _a[ActivityTypes.SEGMENT_DELETE] = i18n.text('Segment deleted'),
90
93
  _a);
91
94
  return labels[type] || '';
92
95
  };
@@ -15,6 +15,9 @@ var buildActivityFilterClause = function (activityType) {
15
15
  var buildAttributeFilterClause = function (attribute) {
16
16
  return "equals(items.delta.attributeType, '".concat(attribute.value, "')");
17
17
  };
18
+ var buildSegmentFilterClause = function (segmentId) {
19
+ return "equals(items.objectUri, 'segments/".concat(segmentId, "')");
20
+ };
18
21
  var getFilterClauseBuilder = cond([
19
22
  [equals('users'), function () { return multiValueFilter(buildUserFilterClause); }],
20
23
  [equals('activities'), function () { return multiValueFilter(buildActivityFilterClause); }],
@@ -23,6 +26,7 @@ var getFilterClauseBuilder = cond([
23
26
  [equals('entityTypes'), function () { return multiValueFilter(buildEntityTypeFilterClause); }],
24
27
  [equals('dateRange'), function () { return buildDateRangeFilterClause; }],
25
28
  [equals('entityUri'), function () { return buildEntityUriFilterClause; }],
29
+ [equals('segmentId'), function () { return buildSegmentFilterClause; }],
26
30
  [equals('rawFilter'), function () { return identity; }]
27
31
  ]);
28
32
  export var buildActivitiesFilterString = pipe(defaultTo({}), rejectEmptyValues, toPairs, append(['rawFilter', "not equals(user, 'collaboration-service')"]), map(function (_a) {