@tap-payments/os-micro-frontend-shared 0.1.108 → 0.1.109-test.1

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 (39) hide show
  1. package/build/components/ReceiptViewer/ReceiptViewer.d.ts +2 -0
  2. package/build/components/ReceiptViewer/ReceiptViewer.js +256 -0
  3. package/build/components/ReceiptViewer/ReceiptViewerList.d.ts +9 -0
  4. package/build/components/ReceiptViewer/ReceiptViewerList.js +10 -0
  5. package/build/components/ReceiptViewer/components/FooterButton/FooterButton.d.ts +5 -0
  6. package/build/components/ReceiptViewer/components/FooterButton/FooterButton.js +44 -0
  7. package/build/components/ReceiptViewer/components/FooterButton/index.d.ts +2 -0
  8. package/build/components/ReceiptViewer/components/FooterButton/index.js +2 -0
  9. package/build/components/ReceiptViewer/components/ReceiptTitleBar/ReceiptTitleBar.d.ts +5 -0
  10. package/build/components/ReceiptViewer/components/ReceiptTitleBar/ReceiptTitleBar.js +9 -0
  11. package/build/components/ReceiptViewer/components/ReceiptTitleBar/index.d.ts +3 -0
  12. package/build/components/ReceiptViewer/components/ReceiptTitleBar/index.js +3 -0
  13. package/build/components/ReceiptViewer/components/ReceiptTitleBar/type.d.ts +14 -0
  14. package/build/components/ReceiptViewer/components/ReceiptTitleBar/type.js +1 -0
  15. package/build/components/ReceiptViewer/components/index.d.ts +2 -0
  16. package/build/components/ReceiptViewer/components/index.js +2 -0
  17. package/build/components/ReceiptViewer/context/Provider.d.ts +6 -0
  18. package/build/components/ReceiptViewer/context/Provider.js +42 -0
  19. package/build/components/ReceiptViewer/context/context.d.ts +3 -0
  20. package/build/components/ReceiptViewer/context/context.js +7 -0
  21. package/build/components/ReceiptViewer/context/index.d.ts +2 -0
  22. package/build/components/ReceiptViewer/context/index.js +2 -0
  23. package/build/components/ReceiptViewer/hooks/index.d.ts +1 -0
  24. package/build/components/ReceiptViewer/hooks/index.js +1 -0
  25. package/build/components/ReceiptViewer/hooks/useJsonViewerContext.d.ts +8 -0
  26. package/build/components/ReceiptViewer/hooks/useJsonViewerContext.js +18 -0
  27. package/build/components/ReceiptViewer/index.d.ts +7 -0
  28. package/build/components/ReceiptViewer/index.js +7 -0
  29. package/build/components/ReceiptViewer/style.d.ts +631 -0
  30. package/build/components/ReceiptViewer/style.js +176 -0
  31. package/build/components/ReceiptViewer/type.d.ts +22 -0
  32. package/build/components/ReceiptViewer/type.js +1 -0
  33. package/build/components/TableCells/CustomCells/ActionCell/constant.d.ts +1 -0
  34. package/build/components/TableCells/CustomCells/ActionCell/constant.js +2 -1
  35. package/build/components/TableCells/CustomCells/ActionCell/hooks/useActionCell.d.ts +1 -1
  36. package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +1 -1
  37. package/build/utils/table.d.ts +3 -1
  38. package/build/utils/table.js +7 -1
  39. package/package.json +3 -3
@@ -0,0 +1,176 @@
1
+ import { Box, Input, Popover, Typography, styled } from '@mui/material';
2
+ import { motion } from 'framer-motion';
3
+ export const FOOTER_HEIGHT = 37;
4
+ export const TITLE_BAR_HEIGHT = '32px';
5
+ export const VIEWER_HEIGHT = 545;
6
+ export const StyledPopover = styled(Popover)(({ theme }) => ({
7
+ backgroundColor: theme.palette.background.default,
8
+ boxShadow: theme.shadows[21],
9
+ '& .MuiPaper-root': {
10
+ borderRadius: '12px',
11
+ },
12
+ }));
13
+ export const HEADER_HEIGHT = 44;
14
+ export const jsonTheme = {
15
+ '--w-rjv-color': '#9cdcfe',
16
+ '--w-rjv-key-string': '#357fb9',
17
+ '--w-rjv-background-color': '#ffffff',
18
+ '--w-rjv-line-color': '#ffffff',
19
+ '--w-rjv-arrow-color': '#116e6bed',
20
+ '--w-rjv-edit-color': '#9cdcfe',
21
+ '--w-rjv-info-color': '#9c9c9c7a',
22
+ '--w-rjv-update-color': '#FFE20B',
23
+ '--w-rjv-copied-color': '#9cdcfe',
24
+ '--w-rjv-copied-success-color': '#28a745',
25
+ '--w-rjv-curlybraces-color': '#000000',
26
+ '--w-rjv-colon-color': '#000000',
27
+ '--w-rjv-brackets-color': '#000000',
28
+ '--w-rjv-quotes-color': '#9cdcfe',
29
+ '--w-rjv-quotes-string-color': '#c27c46',
30
+ '--w-rjv-type-string-color': '#c27c46',
31
+ '--w-rjv-type-int-color': '#956ea5',
32
+ '--w-rjv-type-float-color': '#956ea5',
33
+ '--w-rjv-type-bigint-color': '#956ea5',
34
+ '--w-rjv-type-boolean-color': '#956ea5',
35
+ '--w-rjv-type-date-color': '#956ea5',
36
+ '--w-rjv-type-url-color': '#3b89cf',
37
+ '--w-rjv-type-null-color': '#956ea5',
38
+ '--w-rjv-type-nan-color': '#956ea5',
39
+ '--w-rjv-type-undefined-color': '#956ea5',
40
+ padding: '1rem',
41
+ height: `calc(100% - ${HEADER_HEIGHT + FOOTER_HEIGHT}px`,
42
+ overflow: 'auto',
43
+ };
44
+ export const requestJsonTheme = Object.assign(Object.assign({}, jsonTheme), { background: 'transparent', '--w-rjv-line-color': 'transparent' });
45
+ export const StyledAnimatedButton = styled('button')(({ theme }) => ({
46
+ padding: '0rem',
47
+ borderRadius: '0.25rem',
48
+ backgroundColor: theme.palette.background.paper,
49
+ display: 'flex',
50
+ alignItems: 'center',
51
+ justifyContent: 'center',
52
+ gap: '0.25rem',
53
+ color: theme.palette.text.primary,
54
+ fontSize: '0.625rem',
55
+ fontWeight: theme.typography.fontWeightBold,
56
+ outline: 'none',
57
+ cursor: 'pointer',
58
+ border: `1px solid ${theme.palette.grey['100']}`,
59
+ '&:hover': {
60
+ boxShadow: '0px 0px 8px 0px rgba(31, 136, 208, 0.30)',
61
+ border: `1px solid ${theme.palette.info.dark};`,
62
+ },
63
+ position: 'relative',
64
+ overflow: 'hidden',
65
+ transition: 'all 0.2s ease-in-out',
66
+ width: '24px',
67
+ height: '24px',
68
+ flexShrink: 0,
69
+ }));
70
+ export const StyledCopyButton = styled('button')(({ theme }) => ({
71
+ outline: 'none',
72
+ cursor: 'pointer',
73
+ border: `1px solid transparent`,
74
+ '&:hover': {
75
+ boxShadow: theme.shadows[8],
76
+ },
77
+ borderRadius: '0.25rem',
78
+ position: 'relative',
79
+ backgroundColor: theme.palette.background.transparent,
80
+ display: 'inline-flex',
81
+ alignItems: 'center',
82
+ justifyContent: 'center',
83
+ }));
84
+ export const StyledSearchInput = styled(Input)(({ theme }) => ({
85
+ border: `1px solid ${theme.palette.grey[100]}`,
86
+ borderRadius: '0.25rem',
87
+ padding: '0.375rem',
88
+ fontSize: '0.625rem',
89
+ outline: 'none',
90
+ width: '100%',
91
+ maxWidth: '150px',
92
+ height: '1.5rem',
93
+ backgroundColor: theme.palette.background.paper,
94
+ '&:focus': {
95
+ border: `1px solid ${theme.palette.info.dark}`,
96
+ },
97
+ }));
98
+ export const StyledTitle = styled(Typography)(() => ({
99
+ border: '1px solid rgba(242, 242, 242, 0.70);',
100
+ display: 'inline-flex',
101
+ height: '24px',
102
+ padding: '0px 8px',
103
+ justifyContent: 'center',
104
+ alignItems: 'center',
105
+ borderRadius: '37.5px',
106
+ backgroundColor: '#fff',
107
+ }));
108
+ export const SectionWrapper = styled(Box, {
109
+ shouldForwardProp: (prop) => !['isMaximized', 'isScrollingRequest', 'isRequestShown'].includes(prop),
110
+ })(({ isScrollingRequest, isMaximized, isRequestShown, theme }) => (Object.assign(Object.assign({ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: '4px', paddingBlock: '0px', paddingInlineStart: '12px', paddingInlineEnd: '12px', position: 'sticky', left: 0, right: 0, top: 0, background: '#fff', zIndex: 5 }, (isScrollingRequest && {
111
+ boxShadow: theme.shadows[23],
112
+ })), (isMaximized && Object.assign({ paddingTop: TITLE_BAR_HEIGHT, transition: 'padding 0.3s ease-in-out' }, (isRequestShown && {
113
+ width: '50%',
114
+ }))))));
115
+ export const FooterWrapper = styled(Box, {
116
+ shouldForwardProp: (prop) => !['isMaximized', 'isRequestShown'].includes(prop),
117
+ })(({ isMaximized, isRequestShown }) => (Object.assign({ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: '8px', height: FOOTER_HEIGHT, position: 'fixed', bottom: 0, right: 0, left: isMaximized ? '50vw' : 0 }, (!isRequestShown && {
118
+ left: 0,
119
+ }))));
120
+ export const ButtonsWrapper = styled(Box)(() => ({
121
+ display: 'flex',
122
+ justifyContent: 'flex-end',
123
+ alignItems: 'center',
124
+ gap: '4px',
125
+ paddingBlock: '10px',
126
+ paddingInlineStart: '8px',
127
+ paddingInlineEnd: '0px',
128
+ }));
129
+ export const StyledHeaderWrapper = styled(Box)(() => ({
130
+ display: 'flex',
131
+ justifyContent: 'flex-start',
132
+ alignItems: 'center',
133
+ gap: '4px',
134
+ paddingBlock: '10px',
135
+ paddingInlineStart: '0px',
136
+ paddingInlineEnd: '12px',
137
+ }));
138
+ export const JSONViewerWrapper = styled(motion.div, {
139
+ shouldForwardProp: (prop) => !['isRequestShown', 'isMaximized'].includes(prop),
140
+ })(({ isRequestShown, isMaximized }) => (Object.assign({ width: '100%', height: '100%', overflowY: 'auto', background: '#fff', zIndex: 20, position: 'relative', display: 'flex', flexDirection: 'column', borderBottomRightRadius: '12px', borderBottomLeftRadius: isRequestShown ? 0 : '12px' }, (isMaximized && {
141
+ borderBottomLeftRadius: 0,
142
+ borderBottomRightRadius: 0,
143
+ height: '100vh',
144
+ }))));
145
+ export const JSONViewerWrapperRequest = styled(motion.div, {
146
+ shouldForwardProp: (prop) => !['isMaximized', 'currentRequestWidth'].includes(prop),
147
+ })(({ isMaximized, currentRequestWidth }) => ({
148
+ backgroundColor: '#E7E7E7B2',
149
+ backdropFilter: 'blur(12px)',
150
+ height: isMaximized ? '100vh' : '100%',
151
+ overflowY: 'auto',
152
+ position: 'absolute',
153
+ width: isMaximized ? '100vw' : currentRequestWidth,
154
+ zIndex: 19,
155
+ display: 'flex',
156
+ flexDirection: 'column',
157
+ borderBottomLeftRadius: '12px',
158
+ }));
159
+ export const JSONViewerScreenContainer = styled(Box, {
160
+ shouldForwardProp: (prop) => !['isMaximized', 'currentHeight'].includes(prop),
161
+ })(({ isMaximized, currentHeight }) => ({
162
+ display: 'flex',
163
+ flexDirection: 'row',
164
+ justifyContent: 'space-between',
165
+ alignItems: 'flex-start',
166
+ height: isMaximized ? `calc(100vh - ${FOOTER_HEIGHT}px)` : (currentHeight || VIEWER_HEIGHT) - FOOTER_HEIGHT + 5,
167
+ background: 'transparent',
168
+ position: 'fixed',
169
+ width: '100%',
170
+ }));
171
+ export const JSONContainer = styled(Box)(() => ({
172
+ position: 'fixed',
173
+ width: '100%',
174
+ background: 'transparent',
175
+ height: '100%',
176
+ }));
@@ -0,0 +1,22 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ export type ReceiptViewerProps = JsonViewer & {
3
+ index: number;
4
+ onClose: () => void;
5
+ isWindowMinimized?: boolean;
6
+ windowOrder?: number;
7
+ };
8
+ export interface AnimatedButtonProps extends HTMLAttributes<HTMLButtonElement> {
9
+ label?: ReactNode;
10
+ icon?: string;
11
+ disableAnimation?: boolean;
12
+ }
13
+ export type JsonViewer = {
14
+ json: Record<string, any>;
15
+ requestJson?: Record<string, any>;
16
+ };
17
+ export type ReceiptViewerContext = {
18
+ receiptViewerList: JsonViewer[];
19
+ handleReceiptViewerDialogOpen: (jsonViewer: JsonViewer) => void;
20
+ handleWindowMinimize: (value: boolean) => void;
21
+ handleWindowOrder: (value: number) => void;
22
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -28,4 +28,5 @@ export declare const actionIcons: {
28
28
  users: string;
29
29
  brand: string;
30
30
  clipboard: string;
31
+ viewApi: string;
31
32
  };
@@ -1,5 +1,5 @@
1
1
  import { BadgeVariants } from '../../../CountBadge';
2
- import { flagIcon, clockIcon, disputeIcon, redFlagIcon, cancelledIcon, closedFlagIcon, orangeFlagIcon, refundInitiatedIcon, viewInvoiceIcon, reverseActionIcon, voidedIcon, capturedDropdownIcon, destinationReversedTableIcon, brandPlaceholderIcon, usersIcon, clipboardIcon, } from '../../../../constants/index.js';
2
+ import { flagIcon, clockIcon, disputeIcon, redFlagIcon, cancelledIcon, closedFlagIcon, orangeFlagIcon, refundInitiatedIcon, viewInvoiceIcon, reverseActionIcon, voidedIcon, capturedDropdownIcon, destinationReversedTableIcon, brandPlaceholderIcon, usersIcon, clipboardIcon, jsonBlackIcon, } from '../../../../constants/index.js';
3
3
  export const flags = {
4
4
  GRAY: { icon: closedFlagIcon, color: '#CFCFCF' },
5
5
  ORANGE: { icon: orangeFlagIcon, color: '#FFD503' },
@@ -24,4 +24,5 @@ export const actionIcons = {
24
24
  users: usersIcon,
25
25
  brand: brandPlaceholderIcon,
26
26
  clipboard: clipboardIcon,
27
+ viewApi: jsonBlackIcon,
27
28
  };
@@ -13,7 +13,7 @@ export declare function useActionCell({ actions, isDropdownShown, onCloseDropdow
13
13
  label: string;
14
14
  onClick: (e: React.MouseEvent<HTMLLIElement, MouseEvent>) => void;
15
15
  onRightClick?: ((e: React.MouseEvent<HTMLLIElement, MouseEvent>) => void) | undefined;
16
- icon: "brand" | "users" | "cancel" | "reverse" | "refund" | "destination" | "capture" | "flag" | "dispute" | "void" | "clock" | "invoice" | "clipboard";
16
+ icon: "brand" | "users" | "cancel" | "reverse" | "refund" | "destination" | "capture" | "flag" | "dispute" | "void" | "clock" | "invoice" | "clipboard" | "viewApi";
17
17
  isLoading?: boolean | undefined;
18
18
  isError?: boolean | undefined;
19
19
  isSuccess?: boolean | undefined;
@@ -283,5 +283,5 @@ export declare const ActionIcon: import("@emotion/styled").StyledComponent<{
283
283
  fetchPriority?: "auto" | "high" | "low" | undefined;
284
284
  srcSet?: string | undefined;
285
285
  } & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLImageElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
286
- icon?: "brand" | "users" | "cancel" | "reverse" | "refund" | "destination" | "capture" | "flag" | "dispute" | "void" | "clock" | "invoice" | "clipboard" | undefined;
286
+ icon?: "brand" | "users" | "cancel" | "reverse" | "refund" | "destination" | "capture" | "flag" | "dispute" | "void" | "clock" | "invoice" | "clipboard" | "viewApi" | undefined;
287
287
  }, {}, {}>;
@@ -6,4 +6,6 @@ export declare const getColumnWidthPercentage: (widthInPx: number, options?: {
6
6
  export declare const getCellWidth: ({ table, cellID, tableMode }: TableCellWidthProps) => string;
7
7
  export declare const calculateMaxAllowedRows: (isLoaded: boolean, isLoading: boolean) => number;
8
8
  export declare const isHeightNotFullyFilledByRows: (totalRows: number) => boolean;
9
- export declare const isTableDefaultMode: (tableMode?: TableMode) => boolean;
9
+ export declare const isTableDefaultMode: (tableMode: TableMode) => boolean;
10
+ export declare const isTableSheetMode: (tableMode: TableMode) => boolean;
11
+ export declare const isTableTextMode: (tableMode: TableMode) => boolean;
@@ -73,6 +73,12 @@ export const isHeightNotFullyFilledByRows = (totalRows) => {
73
73
  const allowedRows = maxRowsThatFit();
74
74
  return totalRows < allowedRows + 1;
75
75
  };
76
- export const isTableDefaultMode = (tableMode = 'default') => {
76
+ export const isTableDefaultMode = (tableMode) => {
77
77
  return tableMode === 'default';
78
78
  };
79
+ export const isTableSheetMode = (tableMode) => {
80
+ return tableMode === 'sheet';
81
+ };
82
+ export const isTableTextMode = (tableMode) => {
83
+ return tableMode === 'text';
84
+ };
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.108",
5
- "testVersion": 0,
4
+ "version": "0.1.109-test.1",
5
+ "testVersion": 1,
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
+ }