@tap-payments/os-micro-frontend-shared 0.1.135 → 0.1.136-test.2

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 (109) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +12 -12
  3. package/build/components/BackgroundAnimation/BackgroundAnimation.js +28 -0
  4. package/build/components/BackgroundAnimation/Blob/Blob.js +2 -0
  5. package/build/components/Chip/style.js +1 -0
  6. package/build/components/ColorPicker/HexaFields.js +4 -0
  7. package/build/components/ColorPicker/style.js +1 -1
  8. package/build/components/Dialog/style.js +1 -0
  9. package/build/components/Dropdown2/style.js +2 -0
  10. package/build/components/HeatMap/constant.js +1 -1
  11. package/build/components/InputBase/AmountInputBase/CurrencyList/style.js +3 -0
  12. package/build/components/InputBase/PhoneInputBase/CountriesList/style.js +3 -0
  13. package/build/components/InputBase/SelectBase/SelectBase.js +1 -0
  14. package/build/components/InputBase/SelectBase/SelectBaseMultiple.js +3 -0
  15. package/build/components/InputBase/SelectBase/style.js +3 -2
  16. package/build/components/InputNumber/InputNumber.js +2 -0
  17. package/build/components/Inputs/Input/style.js +6 -2
  18. package/build/components/Inputs/Select/Select.js +1 -0
  19. package/build/components/Inputs/Select/style.js +3 -2
  20. package/build/components/JSONViewer/JSONViewer.js +10 -2
  21. package/build/components/JSONViewer/context/Provider.js +2 -0
  22. package/build/components/LeftPeekRightExpandingChip/LeftPeekRightExpandingChip.d.ts +10 -0
  23. package/build/components/LeftPeekRightExpandingChip/LeftPeekRightExpandingChip.js +14 -1
  24. package/build/components/LeftPeekRightExpandingChip/style.js +1 -0
  25. package/build/components/LeftPeekRightExpandingChip/useLeftPeekRightExpandingChip.js +30 -2
  26. package/build/components/MultiSelectStatusButton/MultiSelectStatusButton.js +3 -0
  27. package/build/components/NestedDropdown/Dropdown.js +3 -0
  28. package/build/components/RFH/Inputs/FormInput/FormInput.js +1 -0
  29. package/build/components/RFH/Inputs/MultiSelect/MultiSelect.js +1 -0
  30. package/build/components/RangeCalender/RangeCalender.js +1 -0
  31. package/build/components/RangeCalender/components/RangeDatepicker/RangeDatepicker.js +3 -1
  32. package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.d.ts +32 -0
  33. package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.js +36 -2
  34. package/build/components/RightLeftExpandingCenterChip/style.js +25 -4
  35. package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.d.ts +5 -0
  36. package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.js +53 -1
  37. package/build/components/ScrollLoader/ScrollLoader.js +2 -1
  38. package/build/components/StatusButton/StatusButton.js +11 -3
  39. package/build/components/StatusButton/constant.js +3 -1
  40. package/build/components/StatusButton/style.d.ts +2 -1
  41. package/build/components/StatusButton/type.d.ts +13 -1
  42. package/build/components/StatusIcons/AuthIcons/constants.js +5 -0
  43. package/build/components/StatusIcons/AuthorizationAutoIcons/CaptureAutoIcon.js +11 -0
  44. package/build/components/StatusIcons/AuthorizationAutoIcons/VoidAutoIcon.js +11 -0
  45. package/build/components/TableCells/CustomCells/ApplicationStatusCell/ApplicationStatusCell.js +3 -1
  46. package/build/components/TableCells/CustomCells/BrandCell/BrandCell.js +1 -0
  47. package/build/components/TableCells/CustomCells/ReferenceCell/ReferenceCell.js +3 -1
  48. package/build/components/TableCells/CustomCells/RefundStatusCell/components/RefundStateIcon.js +1 -0
  49. package/build/components/TableCells/CustomCells/SegmentsCell/SegmentsCell.js +3 -1
  50. package/build/components/TableCells/CustomCells/SourceMergedCell/SourceMergedCell.js +7 -1
  51. package/build/components/TableCells/CustomCells/StatusCell/StatusCell.js +1 -0
  52. package/build/components/TableView/CustomViews.js +2 -0
  53. package/build/components/TableView/TableView.js +1 -0
  54. package/build/components/Timepicker/Timepicker.js +1 -0
  55. package/build/components/Timepicker/utils.js +9 -5
  56. package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +16 -3
  57. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeaderCell.js +2 -0
  58. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableLoading.js +5 -2
  59. package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.js +6 -2
  60. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/index.d.ts +1 -0
  61. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/index.js +1 -0
  62. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.d.ts +11 -0
  63. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.js +107 -0
  64. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePinnedColumns.js +2 -0
  65. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableData.js +1 -0
  66. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +3 -0
  67. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.d.ts +1 -23
  68. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +25 -21
  69. package/build/components/VirtualTables/SheetViewVirtualTable/style.js +1 -1
  70. package/build/components/VirtualTables/VirtualTable/VirtualTable.js +12 -2
  71. package/build/components/VirtualTables/VirtualTableWithCard/VirtualTableWithCard.js +6 -1
  72. package/build/components/VirtualTables/components/ColumnFilter/Inputs/Inputs.js +1 -0
  73. package/build/components/VirtualTables/components/TableFooter/TableFooter.js +9 -0
  74. package/build/components/VirtualTables/components/TableRow.js +25 -18
  75. package/build/components/VirtualTables/components/virtualScroll/ListItemWrapper.js +3 -1
  76. package/build/components/VirtualTables/components/virtualScroll/ListItemWrapperWithCard.js +2 -0
  77. package/build/components/VirtualTables/components/virtualScroll/VirtualScrollList.js +16 -1
  78. package/build/components/Widget/style.js +1 -0
  79. package/build/components/Window/style.js +1 -0
  80. package/build/components/index.d.ts +8 -2
  81. package/build/components/index.js +11 -2
  82. package/build/constants/assets.js +4 -0
  83. package/build/constants/server.js +1 -0
  84. package/build/constants/table.d.ts +1 -1
  85. package/build/constants/table.js +1 -1
  86. package/build/hooks/useCountdown.js +4 -0
  87. package/build/hooks/useStickyHeaderShadow.js +6 -0
  88. package/build/utils/api.js +3 -0
  89. package/build/utils/array.js +5 -1
  90. package/build/utils/billing.js +1 -0
  91. package/build/utils/country.js +1 -0
  92. package/build/utils/currency.js +6 -0
  93. package/build/utils/date.d.ts +5 -0
  94. package/build/utils/date.js +31 -3
  95. package/build/utils/encrypt.js +3 -1
  96. package/build/utils/error.js +2 -0
  97. package/build/utils/freshdesk.js +2 -0
  98. package/build/utils/geography.js +1 -1
  99. package/build/utils/localStorage.js +7 -0
  100. package/build/utils/merchant.js +3 -0
  101. package/build/utils/number.js +1 -0
  102. package/build/utils/segment.js +1 -0
  103. package/build/utils/string.d.ts +7 -0
  104. package/build/utils/string.js +10 -0
  105. package/build/utils/style.d.ts +13 -2
  106. package/build/utils/style.js +30 -2
  107. package/build/utils/table.js +1 -1
  108. package/build/utils/url.js +2 -0
  109. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  export const getGeographyBoxColor = (palette) => ({
2
2
  Local: palette.success.light,
3
3
  Regional: palette.info.light,
4
- Global: palette.warning.light,
4
+ Global: palette.warning.light, // yellow
5
5
  });
6
6
  export const geographyMap = {
7
7
  G: 'Global',
@@ -23,6 +23,7 @@ export function removeSecretKey() {
23
23
  export function removeConnectMetaData() {
24
24
  localStorage.removeItem(CONNECT_META_DATA);
25
25
  }
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
27
  export function setNavigationData(data) {
27
28
  localStorage.setItem(NAVIGATION_DATA, JSON.stringify(data));
28
29
  }
@@ -39,6 +40,7 @@ export function getNavigationData() {
39
40
  }
40
41
  });
41
42
  });
43
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
44
  }
43
45
  catch (error) {
44
46
  return null;
@@ -59,15 +61,18 @@ export const removeLoggedInUserJwtToken = () => {
59
61
  export const removeLoggedInUserData = () => {
60
62
  localStorage.removeItem(USER_DATA_KEY);
61
63
  };
64
+ // eslint-disable-next-line
62
65
  export const setLoggedInUserData = (data) => {
63
66
  localStorage.setItem(USER_DATA_KEY, JSON.stringify(data));
64
67
  };
68
+ // eslint-disable-next-line
65
69
  export const getLoggedInUserData = () => {
66
70
  const data = localStorage.getItem(USER_DATA_KEY);
67
71
  if (!data)
68
72
  return null;
69
73
  try {
70
74
  return JSON.parse(data);
75
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
71
76
  }
72
77
  catch (error) {
73
78
  return null;
@@ -128,6 +133,7 @@ export const getCalenderTimezone = () => {
128
133
  if (!data)
129
134
  return null;
130
135
  return JSON.parse(data);
136
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
131
137
  }
132
138
  catch (error) {
133
139
  return null;
@@ -139,6 +145,7 @@ export const getCalenderTimezoneHistory = () => {
139
145
  if (!data)
140
146
  return null;
141
147
  return JSON.parse(data);
148
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
142
149
  }
143
150
  catch (error) {
144
151
  return null;
@@ -1,9 +1,12 @@
1
1
  export const getMerchantIds = (activeSegment) => {
2
2
  var _a;
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
4
  return (_a = activeSegment === null || activeSegment === void 0 ? void 0 : activeSegment.countries) === null || _a === void 0 ? void 0 : _a.reduce((acc, country) => {
4
5
  const { entities } = country;
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
7
  const ids = entities.reduce((entitiesAcc, entity) => {
6
8
  const { merchants } = entity;
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
10
  const entitiesAccIds = (merchants || []).map((merchant) => merchant.legacy_id);
8
11
  return [...entitiesAcc, ...entitiesAccIds];
9
12
  }, []);
@@ -12,6 +12,7 @@ export const stringToNumber = (value) => {
12
12
  try {
13
13
  const number = parseFloat(value);
14
14
  return isNaN(number) ? 0 : number;
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
16
  }
16
17
  catch (e) {
17
18
  return 0;
@@ -1,6 +1,7 @@
1
1
  import { getDefaultEntityCountry } from './entity';
2
2
  export const getSegmentData = (segments, activeSegmentId, activeSegments) => {
3
3
  var _a, _b, _c;
4
+ // debugger
4
5
  const newSegment = (_a = segments.find((segment) => segment.id === activeSegmentId)) !== null && _a !== void 0 ? _a : {};
5
6
  const activeSegment = (_b = activeSegments.find((segment) => segment.id === activeSegmentId)) !== null && _b !== void 0 ? _b : {};
6
7
  const defaultCountry = activeSegment.countries.length === 1
@@ -7,4 +7,11 @@ export declare const copyText: (text: string) => void;
7
7
  export declare const capitalizeFirstLetter: (text: string) => string;
8
8
  export declare const percentageToNumber: (percentageStr: string) => number;
9
9
  export declare const maskValue: (value: string) => string;
10
+ /**
11
+ * Transforms a string by replacing a separator with a replacement character and applying proper case formatting
12
+ * @param text - The string to transform
13
+ * @param separator - The separator to replace (defaults to underscore)
14
+ * @param replacement - The replacement character (defaults to space)
15
+ * @returns The transformed string with proper case formatting
16
+ */
10
17
  export declare const transformStringToProperCase: (text: string, separator?: string | RegExp, replacement?: string) => string;
@@ -34,6 +34,7 @@ export const copyText = (text) => {
34
34
  else {
35
35
  const textArea = document.createElement('textarea');
36
36
  textArea.value = text;
37
+ // Avoid scrolling to bottom
37
38
  textArea.style.top = '0';
38
39
  textArea.style.left = '0';
39
40
  textArea.style.position = 'fixed';
@@ -53,7 +54,16 @@ export const percentageToNumber = (percentageStr) => {
53
54
  return parseFloat(number) || 0;
54
55
  };
55
56
  export const maskValue = (value) => `••• ${value.slice(-4)}`;
57
+ /**
58
+ * Transforms a string by replacing a separator with a replacement character and applying proper case formatting
59
+ * @param text - The string to transform
60
+ * @param separator - The separator to replace (defaults to underscore)
61
+ * @param replacement - The replacement character (defaults to space)
62
+ * @returns The transformed string with proper case formatting
63
+ */
56
64
  export const transformStringToProperCase = (text, separator = /_/g, replacement = ' ') => {
65
+ // Replace separator with replacement character
57
66
  const updatedText = text.replace(separator, replacement);
67
+ // Apply proper case formatting
58
68
  return startCase(updatedText);
59
69
  };
@@ -5,18 +5,29 @@ export declare const SELECTION_COLORS: {
5
5
  readonly transparent: "transparent";
6
6
  };
7
7
  interface GetSelectionStylesParams {
8
+ /** Whether the current cell/row is selected */
8
9
  isSelected: boolean;
10
+ /** Whether this is a single cell selection */
9
11
  isCellSelected: boolean;
12
+ /** Whether this is part of a column selection */
10
13
  isColumnSelected: boolean;
14
+ /** Whether this is part of a row selection */
11
15
  isRowSelected?: boolean;
16
+ /** Whether this is the last row in the selection */
12
17
  isLastRow: boolean;
13
18
  }
14
19
  type SelectionStyles = Record<string, string | Record<string, string>>;
20
+ /**
21
+ * Generates CSS styles for table cell selection states
22
+ *
23
+ * @param params - Selection state parameters
24
+ * @returns CSS-in-JS style object for the selected cell/column
25
+ */
15
26
  export declare const getSelectionStyles: ({ isSelected, isCellSelected, isColumnSelected, isRowSelected, isLastRow, }: GetSelectionStylesParams) => SelectionStyles;
16
27
  interface GetRowSelectionBorderStylesParams {
17
- effectiveFirst: boolean;
28
+ isFirstColumn: boolean;
18
29
  isPinnedStart: boolean;
19
30
  isPinnedEnd: boolean;
20
31
  }
21
- export declare const getRowSelectionBorderStyles: ({ effectiveFirst, isPinnedStart, isPinnedEnd }: GetRowSelectionBorderStylesParams) => SelectionStyles;
32
+ export declare const getRowSelectionBorderStyles: ({ isFirstColumn, isPinnedStart, isPinnedEnd }: GetRowSelectionBorderStylesParams) => SelectionStyles;
22
33
  export {};
@@ -1,3 +1,4 @@
1
+ // Selection style constants
1
2
  export const SELECTION_COLORS = {
2
3
  primary: '#1F88D0',
3
4
  background: 'white',
@@ -13,31 +14,52 @@ const CELL_DIMENSIONS = {
13
14
  minHeight: '28px',
14
15
  fullHeight: '100%',
15
16
  };
17
+ /**
18
+ * Generates CSS styles for table cell selection states
19
+ *
20
+ * @param params - Selection state parameters
21
+ * @returns CSS-in-JS style object for the selected cell/column
22
+ */
16
23
  export const getSelectionStyles = ({ isSelected, isCellSelected, isColumnSelected, isRowSelected, isLastRow, }) => {
24
+ // Early return for non-selected cells
17
25
  if (!isSelected) {
18
26
  return {};
19
27
  }
28
+ // Row selection styles
20
29
  if (isRowSelected) {
21
30
  return getRowSelectionStyles();
22
31
  }
32
+ // Single cell selection styles
23
33
  if (isCellSelected && !isColumnSelected) {
24
34
  return getSingleCellSelectionStyles();
25
35
  }
36
+ // Column selection styles
26
37
  if (isColumnSelected) {
27
38
  return getColumnSelectionStyles(isLastRow);
28
39
  }
29
40
  return {};
30
41
  };
42
+ /**
43
+ * Returns styles for row selection
44
+ */
31
45
  const getRowSelectionStyles = () => ({
32
46
  backgroundColor: SELECTION_COLORS.background,
33
47
  color: SELECTION_COLORS.primary,
34
48
  });
49
+ /**
50
+ * Returns styles for a single selected cell
51
+ */
35
52
  const getSingleCellSelectionStyles = () => ({
36
53
  border: `${BORDER_STYLES.thin} solid ${SELECTION_COLORS.primary}`,
37
54
  backgroundColor: SELECTION_COLORS.background,
38
55
  color: SELECTION_COLORS.primary,
39
56
  borderRadius: '2px',
40
57
  });
58
+ /**
59
+ * Returns styles for column selection
60
+ *
61
+ * @param isLastRow - Whether this is the last row in the selection
62
+ */
41
63
  const getColumnSelectionStyles = (isLastRow) => {
42
64
  const borderWidth = getBorderWidthForColumn();
43
65
  const borderBottom = getBorderBottomForColumn(isLastRow);
@@ -52,16 +74,22 @@ const getColumnSelectionStyles = (isLastRow) => {
52
74
  alignItems: 'center',
53
75
  };
54
76
  };
77
+ /**
78
+ * Calculates border width for column selection
79
+ */
55
80
  const getBorderWidthForColumn = () => {
56
81
  const { none, thin } = BORDER_STYLES;
57
82
  return `${none} ${thin} ${thin} ${thin}`;
58
83
  };
84
+ /**
85
+ * Calculates border bottom for column selection
86
+ */
59
87
  const getBorderBottomForColumn = (isLastRow) => {
60
88
  return isLastRow ? `${BORDER_STYLES.thick} solid ${SELECTION_COLORS.primary}` : `${BORDER_STYLES.thin} solid ${SELECTION_COLORS.border}`;
61
89
  };
62
- export const getRowSelectionBorderStyles = ({ effectiveFirst, isPinnedStart, isPinnedEnd }) => ({
90
+ export const getRowSelectionBorderStyles = ({ isFirstColumn, isPinnedStart, isPinnedEnd }) => ({
63
91
  borderTop: `${BORDER_STYLES.thin} solid ${SELECTION_COLORS.primary}`,
64
92
  borderBottom: `${BORDER_STYLES.thin} solid ${SELECTION_COLORS.primary}`,
65
93
  borderRight: `${BORDER_STYLES.thin} solid ${isPinnedEnd ? SELECTION_COLORS.primary : 'none'}`,
66
- borderLeft: `${BORDER_STYLES.thin} solid ${isPinnedStart && effectiveFirst ? SELECTION_COLORS.primary : 'transparent'}`,
94
+ borderLeft: `${BORDER_STYLES.thin} solid ${isPinnedStart && isFirstColumn ? SELECTION_COLORS.primary : 'transparent'}`,
67
95
  });
@@ -2,7 +2,7 @@ import { walletDetailsTableCellWidth, authenticationsTableCellWidth, authorizati
2
2
  export const getColumnWidthPercentage = (widthInPx, options) => {
3
3
  const { isFirst, isLast } = options || {};
4
4
  const paddingInPx = isFirst || isLast ? 0 : 0;
5
- const widthInPercentage = ((widthInPx + paddingInPx) / 898) * 100;
5
+ const widthInPercentage = ((widthInPx + paddingInPx) / 898) * 100; // 1128 is the total width of the table
6
6
  return `${widthInPercentage}%`;
7
7
  };
8
8
  export const getCellWidth = ({ table, cellID, tableMode }) => {
@@ -9,9 +9,11 @@ export const openNewTab = (url, target = '_blank') => {
9
9
  export const openUrl = (url) => {
10
10
  const isUrl = /^https?:\/\//i.test(url);
11
11
  if (isUrl) {
12
+ // Open normal URLs directly
12
13
  window.open(url, '_blank', 'noopener,noreferrer');
13
14
  }
14
15
  else {
16
+ // Show the string in the url bar as a query param
15
17
  const newUrl = 'about:blank?' + encodeURIComponent(url);
16
18
  window.open(newUrl, '_blank', 'noopener,noreferrer');
17
19
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.135",
5
- "testVersion": 1,
4
+ "version": "0.1.136-test.2",
5
+ "testVersion": 2,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -136,4 +136,4 @@
136
136
  "publishConfig": {
137
137
  "registry": "https://registry.npmjs.org/"
138
138
  }
139
- }
139
+ }