@odigos/ui-kit 0.0.47 → 0.0.49

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 (101) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/eslint.config.mjs +16 -2
  3. package/lib/components/data-card/data-card-fields/index.d.ts +2 -1
  4. package/lib/components/error-boundary/error-boundary.stories.d.ts +3 -1
  5. package/lib/components/error-boundary/index.d.ts +1 -2
  6. package/lib/components/field-error/field-error.stories.d.ts +3 -1
  7. package/lib/components/field-error/index.d.ts +1 -2
  8. package/lib/components/key-value-input-list/index.d.ts +2 -0
  9. package/lib/components/key-value-input-list/key-value-input-list.stories.d.ts +2 -0
  10. package/lib/components/segment/index.d.ts +8 -7
  11. package/lib/components/styled.d.ts +5 -1
  12. package/lib/components.js +9 -9
  13. package/lib/constants.js +1 -1
  14. package/lib/containers/await-pipeline/await-pipeline.stories.d.ts +1 -1
  15. package/lib/containers/await-pipeline/index.d.ts +1 -2
  16. package/lib/containers/data-flow-actions-menu/add-entity/index.d.ts +2 -3
  17. package/lib/containers/data-flow-actions-menu/filters/index.d.ts +2 -3
  18. package/lib/containers/data-flow-actions-menu/search/index.d.ts +2 -3
  19. package/lib/containers/data-stream-modal/data-stream-modal.stories.d.ts +2 -2
  20. package/lib/containers/data-stream-modal/index.d.ts +1 -2
  21. package/lib/containers/index.d.ts +1 -0
  22. package/lib/containers/instrumentation-rule-form/custom-fields/custom-instrumentation.d.ts +5 -0
  23. package/lib/containers/notification-manager/index.d.ts +1 -2
  24. package/lib/containers/notification-manager/notification-manager.stories.d.ts +1 -1
  25. package/lib/containers/service-map/helpers/build-edges.d.ts +10 -0
  26. package/lib/containers/service-map/helpers/build-map-nodes.d.ts +11 -0
  27. package/lib/containers/service-map/index.d.ts +8 -0
  28. package/lib/containers/service-map/service-map.stories.d.ts +9 -0
  29. package/lib/containers/slack-invite/index.d.ts +1 -2
  30. package/lib/containers/slack-invite/slack-invite.stories.d.ts +1 -1
  31. package/lib/containers/toast-list/index.d.ts +1 -2
  32. package/lib/containers/toast-list/toast-list.stories.d.ts +1 -1
  33. package/lib/containers/toggle-dark-mode/index.d.ts +1 -2
  34. package/lib/containers/toggle-dark-mode/toggle-dark-mode.stories.d.ts +1 -1
  35. package/lib/containers.js +439 -12485
  36. package/lib/functions/clean-object-empty-strings-values/index.d.ts +2 -1
  37. package/lib/functions/compare-condition/index.d.ts +1 -1
  38. package/lib/functions/flatten-object-keys/index.d.ts +2 -1
  39. package/lib/functions/get-entity-id/index.d.ts +2 -2
  40. package/lib/functions/get-entity-label/index.d.ts +2 -2
  41. package/lib/functions/index.d.ts +1 -0
  42. package/lib/functions/map-destination-fields-for-display/index.d.ts +1 -1
  43. package/lib/functions/remove-empty-values-from-object/index.d.ts +2 -1
  44. package/lib/functions/safe-json-parse/index.d.ts +2 -1
  45. package/lib/functions/safe-json-stringify/index.d.ts +2 -1
  46. package/lib/functions/stringify-non-string-values/index.d.ts +2 -1
  47. package/lib/functions.js +35 -9
  48. package/lib/hooks/useGenericForm.d.ts +2 -1
  49. package/lib/hooks/useInstrumentationRuleFormData.d.ts +3 -6
  50. package/lib/hooks/useSessionStorage.d.ts +2 -2
  51. package/lib/hooks/useSourceFormData.d.ts +1 -4
  52. package/lib/hooks.js +4 -4
  53. package/lib/icons/common/index.d.ts +1 -0
  54. package/lib/icons/common/user-icon/index.d.ts +2 -0
  55. package/lib/icons/common/user-icon/user-icon.stories.d.ts +8 -0
  56. package/lib/icons/instrumentation-rules/custom-instrumentation-icon/custom-instrumentation-icon.stories.d.ts +7 -0
  57. package/lib/icons/instrumentation-rules/custom-instrumentation-icon/index.d.ts +2 -0
  58. package/lib/icons/instrumentation-rules/index.d.ts +1 -0
  59. package/lib/icons.js +6 -6
  60. package/lib/{index-BV85P9UP.js → index-BnvrwbRB.js} +4 -0
  61. package/lib/{index-BRGQ84pJ.js → index-Bw7RE2T2.js} +21 -4
  62. package/lib/{index-B1IScVBT.js → index-C1V7D2ey.js} +12728 -363
  63. package/lib/{index-fEP_guwb.js → index-CeBxw8J4.js} +4 -4
  64. package/lib/{index-C4aVlsHh.js → index-CeDmxXUE.js} +10 -2
  65. package/lib/{index-BUCure0Q.js → index-CkTdd3MS.js} +1 -1
  66. package/lib/{index-C8vqcUbP.js → index-DOU0EdZP.js} +2 -2
  67. package/lib/{index-BJpPcCBm.js → index-DsEoqSQn.js} +3 -3
  68. package/lib/{index-CeHgnkLY.js → index-DxR7e2Cq.js} +1 -1
  69. package/lib/{index-DypjdLnz.js → index-ZTzxu5fz.js} +1 -1
  70. package/lib/{index-CpT8LSxY.js → index-w9lkC6fb.js} +10 -8
  71. package/lib/mock-data/index.d.ts +1 -0
  72. package/lib/mock-data/service-map/index.d.ts +2 -0
  73. package/lib/snippets/index.d.ts +1 -0
  74. package/lib/{containers/data-flow → snippets/react-flow}/edges/labeled-edge.d.ts +4 -4
  75. package/lib/{containers/data-flow → snippets/react-flow}/flow.d.ts +2 -0
  76. package/lib/snippets/react-flow/index.d.ts +13 -0
  77. package/lib/{containers/data-flow → snippets/react-flow}/nodes/add-node.d.ts +4 -4
  78. package/lib/{containers/data-flow → snippets/react-flow}/nodes/base-node.d.ts +4 -4
  79. package/lib/{containers/data-flow → snippets/react-flow}/nodes/edged-node.d.ts +4 -4
  80. package/lib/{containers/data-flow → snippets/react-flow}/nodes/frame-node.d.ts +4 -4
  81. package/lib/{containers/data-flow → snippets/react-flow}/nodes/header-node.d.ts +4 -4
  82. package/lib/snippets/react-flow/nodes/map-item-node.d.ts +12 -0
  83. package/lib/snippets/react-flow/nodes/no-data-node.d.ts +9 -0
  84. package/lib/{containers/data-flow → snippets/react-flow}/nodes/scroll-node.d.ts +4 -4
  85. package/lib/snippets/react-flow/nodes/skeleton-node.d.ts +8 -0
  86. package/lib/snippets.js +8 -8
  87. package/lib/store.js +1 -1
  88. package/lib/theme.js +1 -1
  89. package/lib/types/common/index.d.ts +1 -0
  90. package/lib/types/data-flow/index.d.ts +3 -1
  91. package/lib/types/describe/index.d.ts +1 -1
  92. package/lib/types/index.d.ts +1 -0
  93. package/lib/types/instrumentation-rules/index.d.ts +12 -0
  94. package/lib/types/service-map/index.d.ts +10 -0
  95. package/lib/types.js +10 -2
  96. package/lib/{useSourceSelectionFormData-CMXqoHZs.js → useSourceSelectionFormData-C5VMfWEf.js} +13 -48
  97. package/lib/{useTransition-DsrDiKOV.js → useTransition-mupXsbop.js} +56 -10
  98. package/package.json +3 -2
  99. package/lib/containers/data-flow/nodes/skeleton-node.d.ts +0 -8
  100. /package/lib/{containers/data-flow/helpers/get-main-container-language.d.ts → functions/get-main-container-language/index.d.ts} +0 -0
  101. /package/lib/{containers/data-flow/helpers → snippets/react-flow}/node-config.d.ts +0 -0
@@ -1,6 +1,6 @@
1
+ import { f as useModalStore, b as useDrawerStore } from './index-Bw7RE2T2.js';
2
+ import { AddNodeTypes, EntityTypes, CustomInstrumentationsKeyTypes, CodeAttributesKeyTypes, PayloadCollectionKeyTypes } from './types.js';
1
3
  import React, { useState, useRef, useEffect, useCallback } from 'react';
2
- import { g as useNotificationStore } from './index-BRGQ84pJ.js';
3
- import { CodeAttributesKeyTypes, PayloadCollectionKeyTypes } from './types.js';
4
4
  import styled from 'styled-components';
5
5
 
6
6
  const useGenericForm = (initialFormData) => {
@@ -12,6 +12,7 @@ const useGenericForm = (initialFormData) => {
12
12
  }
13
13
  const [formData, setFormData] = useState(copyInitial());
14
14
  const [formErrors, setFormErrors] = useState({});
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
16
  const handleFormChange = (key, val, obj) => {
16
17
  if (key) {
17
18
  // this is for cases where the form contains objects such as "exportedSignals",
@@ -60,6 +61,39 @@ const useGenericForm = (initialFormData) => {
60
61
  };
61
62
  };
62
63
 
64
+ const useClickNode = () => {
65
+ const { setCurrentModal } = useModalStore();
66
+ const { setDrawerType, setDrawerEntityId } = useDrawerStore();
67
+ const onClickNode = (_, object) => {
68
+ const { data: { id, type }, } = object;
69
+ switch (type) {
70
+ case EntityTypes.Source:
71
+ case EntityTypes.Destination:
72
+ case EntityTypes.Action:
73
+ case EntityTypes.InstrumentationRule:
74
+ setDrawerType(type);
75
+ setDrawerEntityId(id);
76
+ break;
77
+ case AddNodeTypes.AddSource:
78
+ setCurrentModal(EntityTypes.Source);
79
+ break;
80
+ case AddNodeTypes.AddDestination:
81
+ setCurrentModal(EntityTypes.Destination);
82
+ break;
83
+ case AddNodeTypes.AddAction:
84
+ setCurrentModal(EntityTypes.Action);
85
+ break;
86
+ case AddNodeTypes.AddRule:
87
+ setCurrentModal(EntityTypes.InstrumentationRule);
88
+ break;
89
+ default:
90
+ console.warn('Unhandled node click', object);
91
+ break;
92
+ }
93
+ };
94
+ return { onClickNode };
95
+ };
96
+
63
97
  const useContainerSize = () => {
64
98
  const ref = useRef(null);
65
99
  const [width, setWidth] = useState(0);
@@ -142,17 +176,19 @@ const INITIAL = {
142
176
  [CodeAttributesKeyTypes.Namespace]: null,
143
177
  [CodeAttributesKeyTypes.StackTrace]: null,
144
178
  },
179
+ headersCollection: null,
180
+ customInstrumentations: {
181
+ [CustomInstrumentationsKeyTypes.Probes]: null,
182
+ },
145
183
  };
146
184
  const useInstrumentationRuleFormData = () => {
147
- const { addNotification } = useNotificationStore();
148
185
  const { formData, formErrors, handleFormChange, handleErrorChange, resetFormData } = useGenericForm(INITIAL);
149
- const validateForm = (params) => {
150
- const errors = {};
151
- let ok = true;
152
- handleErrorChange(undefined, undefined, errors);
153
- return ok;
186
+ const validateForm = () => {
187
+ // We don't have any specific validations for this form yet
188
+ handleErrorChange(undefined, undefined, {});
189
+ return true;
154
190
  };
155
- const loadFormWithDrawerItem = ({ ruleName, notes, disabled, payloadCollection, codeAttributes }) => {
191
+ const loadFormWithDrawerItem = ({ ruleName, notes, disabled, payloadCollection, codeAttributes, headersCollection, customInstrumentations }) => {
156
192
  const updatedData = {
157
193
  ...INITIAL,
158
194
  ruleName,
@@ -177,6 +213,14 @@ const useInstrumentationRuleFormData = () => {
177
213
  [CodeAttributesKeyTypes.StackTrace]: codeAttributes[CodeAttributesKeyTypes.StackTrace] || null,
178
214
  };
179
215
  }
216
+ if (headersCollection) {
217
+ updatedData['headersCollection'] = headersCollection;
218
+ }
219
+ if (customInstrumentations) {
220
+ updatedData['customInstrumentations'] = {
221
+ [CustomInstrumentationsKeyTypes.Probes]: customInstrumentations[CustomInstrumentationsKeyTypes.Probes] || null,
222
+ };
223
+ }
180
224
  handleFormChange(undefined, undefined, updatedData);
181
225
  };
182
226
  return {
@@ -3475,7 +3519,9 @@ const useTransition = ({ container, animateIn, animateOut, duration = 300 }) =>
3475
3519
  `;
3476
3520
  // !! Do not deprecate this "useCallback" hook, it is necessary for the transition to work properly
3477
3521
  const Transition = useCallback(({ children, enter, ...props }) => {
3522
+ // eslint-disable-next-line react-hooks/rules-of-hooks
3478
3523
  const [mounted, setMounted] = useState(false);
3524
+ // eslint-disable-next-line react-hooks/rules-of-hooks
3479
3525
  useEffect(() => {
3480
3526
  const t = setTimeout(() => setMounted(enter), duration + 50); // +50ms to ensure the animation is finished
3481
3527
  return () => clearTimeout(t);
@@ -3489,4 +3535,4 @@ const useTransition = ({ container, animateIn, animateOut, duration = 300 }) =>
3489
3535
  return Transition;
3490
3536
  };
3491
3537
 
3492
- export { useCopy as a, useGenericForm as b, useInstrumentationRuleFormData as c, useKeyDown as d, useOnClickOutside as e, useTimeAgo as f, useTransition as g, useContainerSize as u };
3538
+ export { useContainerSize as a, useCopy as b, useGenericForm as c, useInstrumentationRuleFormData as d, useKeyDown as e, useOnClickOutside as f, useTimeAgo as g, useTransition as h, useClickNode as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odigos/ui-kit",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "author": "Odigos",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,7 +10,8 @@
10
10
  "dev": "storybook dev -p 6006",
11
11
  "prebuild": "rm -rf lib",
12
12
  "build": "rollup -c --bundleConfigAsCjs",
13
- "watch": "rollup -c --bundleConfigAsCjs -w"
13
+ "watch": "rollup -c --bundleConfigAsCjs -w",
14
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
14
15
  },
15
16
  "release": {
16
17
  "branches": [
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { NodeTypes } from '@/types';
3
- import { type Node, type NodeProps } from '@xyflow/react';
4
- export interface SkeletonNodeProps extends NodeProps<Node<{
5
- nodeWidth: number;
6
- }, NodeTypes.Skeleton>> {
7
- }
8
- export declare const SkeletonNode: React.FC<SkeletonNodeProps>;