@tap-payments/os-micro-frontend-shared 0.1.365 → 0.1.367

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.
@@ -11,12 +11,11 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import Tooltip from '../../../Tooltip';
14
- import IconWithBadge from '../../../IconWithBadge';
15
14
  import TableCell from '../../TableCell';
16
- import { BrandsWrapper, BrandsWrapperContent, Label } from './style';
15
+ import { BrandsWrapper, BrandsWrapperContent, Label, VerificationContainer, VerificationIcon } from './style';
17
16
  import { verificationIcon } from './constants';
18
17
  export default function BrandsCell(_a) {
19
18
  var { brand, verificationStatus, hideStatus, brandLogo } = _a, props = __rest(_a, ["brand", "verificationStatus", "hideStatus", "brandLogo"]);
20
19
  const icon = verificationIcon[verificationStatus !== null && verificationStatus !== void 0 ? verificationStatus : 'incomplete'];
21
- return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(Tooltip, Object.assign({ title: brand.name }, { children: _jsx(BrandsWrapper, Object.assign({ hasClick: !!props.onClick }, { children: _jsxs(BrandsWrapperContent, { children: [brandLogo, _jsx(Label, Object.assign({ brandName: brand.name }, { children: brand.name || 'Not Available' })), !hideStatus && (_jsx(IconWithBadge, { mainIcon: icon, mainIconSize: 10, containerSize: 10, borderColor: "transparent", containerSx: { marginLeft: 'auto' } }))] }) })) })) })));
20
+ return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(Tooltip, Object.assign({ title: brand.name }, { children: _jsx(BrandsWrapper, Object.assign({ hasClick: !!props.onClick }, { children: _jsxs(BrandsWrapperContent, { children: [brandLogo, _jsx(Label, Object.assign({ brandName: brand.name }, { children: brand.name || 'Not Available' })), !hideStatus && (_jsx(VerificationContainer, { children: _jsx(VerificationIcon, { src: icon }) }))] }) })) })) })));
22
21
  }
@@ -5,8 +5,8 @@ export declare const BrandsWrapper: import("@emotion/styled").StyledComponent<im
5
5
  export declare const BrandsWrapperContent: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
6
6
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
7
7
  }, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
8
- export declare const BrandName: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
9
- export declare const VerificationIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
10
8
  export declare const Label: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
11
9
  brandName?: string | undefined;
12
10
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
11
+ export declare const VerificationIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
12
+ export declare const VerificationContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -17,16 +17,15 @@ export const BrandsWrapperContent = styled(Box)(() => ({
17
17
  overflow: 'hidden',
18
18
  width: '100%',
19
19
  }));
20
- export const BrandName = styled('div')(({ theme }) => ({
21
- fontSize: '14px',
22
- fontWeight: 400,
23
- color: theme.palette.text.primary,
24
- }));
25
- export const VerificationIcon = styled('img')(() => ({
26
- width: '8px',
27
- height: '8px',
28
- }));
29
20
  export const Label = styled('p', { shouldForwardProp: (props) => !['brandName'].includes(props) })(({ theme, brandName }) => (Object.assign({ fontSize: '14px', fontWeight: 400, color: theme.palette.text.primary, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', width: '74px', margin: '0' }, (!brandName && {
30
21
  color: '#B1B1B1',
31
22
  width: '84px',
32
23
  }))));
24
+ export const VerificationIcon = styled('img')(() => ({
25
+ width: '10.5px',
26
+ height: '10.5px',
27
+ }));
28
+ export const VerificationContainer = styled('div')({
29
+ marginLeft: 'auto',
30
+ width: 'auto',
31
+ });
@@ -1,6 +1,23 @@
1
- export declare const filtersTypeMap: {
1
+ /**
2
+ * Maps report **source codes** (app or service)
3
+ * to the corresponding **backend report filter types**.
4
+ *
5
+ * Used as a translation layer between UI report grouping
6
+ * and backend report filtering.
7
+ *
8
+ * - Key: App code or service code
9
+ * - Value: One or more backend filter types
10
+ */
11
+ export declare const reportFilterTypesMap: {
2
12
  [x: string]: string[];
3
13
  };
14
+ /**
15
+ * Reports apps
16
+ *
17
+ * Defines apps shown in the reports app, with each service linked
18
+ * to its backend filter type (REPORT_FILTER_TYPES).
19
+ *
20
+ */
4
21
  export declare const REPORTS_APPS: {
5
22
  code: string;
6
23
  name: string;
@@ -1,39 +1,89 @@
1
1
  import { APP_CODES } from './apps';
2
2
  import { acceptanceAppIcon, billingAppIcon, payoutsAppIcon, walletAppIcon } from './assets';
3
- export const filtersTypeMap = {
4
- [APP_CODES.acceptance.services.charges.code]: ['CHARGE'],
5
- [APP_CODES.acceptance.services.authorization.code]: ['AUTHORIZE'],
6
- [APP_CODES.acceptance.services.refunds.code]: ['REFUND'],
7
- [APP_CODES.acceptance.services.chargeback.code]: ['CHARGEBACKS'],
8
- [APP_CODES.acceptance.services.destinations.code]: ['DESTINATIONS'],
9
- [APP_CODES.acceptance.code]: ['CHARGE', 'AUTHORIZE', 'REFUND', 'CHARGEBACKS', 'DESTINATIONS'],
10
- [APP_CODES.payouts.code]: ['PAYOUT', 'RETAILER_PAYOUT', 'MERCHANT_PAYOUT'],
11
- [APP_CODES.wallet.code]: ['STATEMENT', 'STATEMENT_SUMMARY'],
12
- [APP_CODES.billing.code]: ['INVOICE'],
13
- [APP_CODES.payouts.services.payouts.code]: ['PAYOUT'],
14
- [APP_CODES.wallet.services.merchants.functions.statement.code]: ['STATEMENT'],
15
- [APP_CODES.wallet.services.merchants.functions.summary.code]: ['STATEMENT_SUMMARY'],
16
- [APP_CODES.billing.services.invoices.code]: ['INVOICE'],
17
- [APP_CODES.payouts.services.merchantPayout.code]: ['MERCHANT_PAYOUT'],
18
- [APP_CODES.payouts.services.retailerPayout.code]: ['RETAILER_PAYOUT'],
3
+ /**
4
+ * Backend report filter types (used by reports APIs)
5
+ *
6
+ * Maps frontend report identifiers to the backend API filter types.
7
+ * Acts as the source of truth for all report types across apps/services
8
+ */
9
+ const REPORT_FILTER_TYPES = {
10
+ // Acceptance
11
+ CHARGE: 'CHARGE',
12
+ AUTHORIZE: 'AUTHORIZE',
13
+ REFUND: 'REFUND',
14
+ CHARGEBACKS: 'CHARGEBACKS',
15
+ DESTINATIONS: 'DESTINATIONS',
16
+ // Wallet
17
+ STATEMENT: 'STATEMENT',
18
+ STATEMENT_SUMMARY: 'STATEMENT_SUMMARY',
19
+ // Billing
20
+ INVOICE: 'INVOICE',
21
+ // Payouts
22
+ PAYOUT: 'PAYOUT',
23
+ MERCHANT_PAYOUT: 'MERCHANT_PAYOUT',
24
+ RETAILER_PAYOUT: 'RETAILER_PAYOUT',
19
25
  };
26
+ /**
27
+ * Maps report **source codes** (app or service)
28
+ * to the corresponding **backend report filter types**.
29
+ *
30
+ * Used as a translation layer between UI report grouping
31
+ * and backend report filtering.
32
+ *
33
+ * - Key: App code or service code
34
+ * - Value: One or more backend filter types
35
+ */
36
+ export const reportFilterTypesMap = {
37
+ // Acceptance
38
+ [APP_CODES.acceptance.services.charges.code]: [REPORT_FILTER_TYPES.CHARGE],
39
+ [APP_CODES.acceptance.services.authorization.code]: [REPORT_FILTER_TYPES.AUTHORIZE],
40
+ [APP_CODES.acceptance.services.refunds.code]: [REPORT_FILTER_TYPES.REFUND],
41
+ [APP_CODES.acceptance.services.chargeback.code]: [REPORT_FILTER_TYPES.CHARGEBACKS],
42
+ [APP_CODES.acceptance.services.destinations.code]: [REPORT_FILTER_TYPES.DESTINATIONS],
43
+ [APP_CODES.acceptance.code]: [
44
+ REPORT_FILTER_TYPES.CHARGE,
45
+ REPORT_FILTER_TYPES.AUTHORIZE,
46
+ REPORT_FILTER_TYPES.REFUND,
47
+ REPORT_FILTER_TYPES.CHARGEBACKS,
48
+ REPORT_FILTER_TYPES.DESTINATIONS,
49
+ ],
50
+ // Wallet
51
+ [APP_CODES.wallet.services.merchants.functions.statement.code]: [REPORT_FILTER_TYPES.STATEMENT],
52
+ [APP_CODES.wallet.services.merchants.functions.summary.code]: [REPORT_FILTER_TYPES.STATEMENT_SUMMARY],
53
+ [APP_CODES.wallet.code]: [REPORT_FILTER_TYPES.STATEMENT, REPORT_FILTER_TYPES.STATEMENT_SUMMARY],
54
+ // Billing
55
+ [APP_CODES.billing.services.invoices.code]: [REPORT_FILTER_TYPES.INVOICE],
56
+ [APP_CODES.billing.code]: [REPORT_FILTER_TYPES.INVOICE],
57
+ // Payouts
58
+ [APP_CODES.payouts.services.payouts.code]: [REPORT_FILTER_TYPES.PAYOUT],
59
+ [APP_CODES.payouts.services.merchantPayout.code]: [REPORT_FILTER_TYPES.MERCHANT_PAYOUT],
60
+ [APP_CODES.payouts.services.retailerPayout.code]: [REPORT_FILTER_TYPES.RETAILER_PAYOUT],
61
+ [APP_CODES.payouts.code]: [REPORT_FILTER_TYPES.PAYOUT, REPORT_FILTER_TYPES.MERCHANT_PAYOUT, REPORT_FILTER_TYPES.RETAILER_PAYOUT],
62
+ };
63
+ /**
64
+ * Reports apps
65
+ *
66
+ * Defines apps shown in the reports app, with each service linked
67
+ * to its backend filter type (REPORT_FILTER_TYPES).
68
+ *
69
+ */
20
70
  export const REPORTS_APPS = [
21
71
  {
22
72
  code: APP_CODES.billing.code,
23
73
  name: 'Billing',
24
74
  icon: billingAppIcon,
25
- services: [{ name: 'Invoices', code: 'INVOICE' }],
75
+ services: [{ name: 'Invoices', code: REPORT_FILTER_TYPES.INVOICE }],
26
76
  },
27
77
  {
28
78
  code: APP_CODES.acceptance.code,
29
79
  name: 'Acceptance',
30
80
  icon: acceptanceAppIcon,
31
81
  services: [
32
- { name: 'Authorisations', code: 'AUTHORIZE' },
33
- { name: 'Charges', code: 'CHARGE' },
34
- { name: 'Refunds', code: 'REFUND' },
35
- { name: 'Chargebacks', code: 'CHARGEBACKS' },
36
- { name: 'Destinations', code: 'DESTINATIONS' },
82
+ { name: 'Authorisations', code: REPORT_FILTER_TYPES.AUTHORIZE },
83
+ { name: 'Charges', code: REPORT_FILTER_TYPES.CHARGE },
84
+ { name: 'Refunds', code: REPORT_FILTER_TYPES.REFUND },
85
+ { name: 'Chargebacks', code: REPORT_FILTER_TYPES.CHARGEBACKS },
86
+ { name: 'Destinations', code: REPORT_FILTER_TYPES.DESTINATIONS },
37
87
  ],
38
88
  },
39
89
  {
@@ -41,8 +91,8 @@ export const REPORTS_APPS = [
41
91
  name: 'Wallet',
42
92
  icon: walletAppIcon,
43
93
  services: [
44
- { name: 'Aggregated Statement', code: 'STATEMENT_SUMMARY' },
45
- { name: 'Detailed Statement', code: 'STATEMENT' },
94
+ { name: 'Aggregated Statement', code: REPORT_FILTER_TYPES.STATEMENT_SUMMARY },
95
+ { name: 'Detailed Statement', code: REPORT_FILTER_TYPES.STATEMENT },
46
96
  ],
47
97
  },
48
98
  {
@@ -50,9 +100,9 @@ export const REPORTS_APPS = [
50
100
  name: 'Payouts',
51
101
  icon: payoutsAppIcon,
52
102
  services: [
53
- { name: 'Payouts', code: 'PAYOUT' },
54
- { name: 'Merchant Payouts', code: 'MERCHANT_PAYOUT' },
55
- { name: 'Retailer Payouts', code: 'RETAILER_PAYOUT' },
103
+ { name: 'Payouts', code: REPORT_FILTER_TYPES.PAYOUT },
104
+ { name: 'Merchant Payouts', code: REPORT_FILTER_TYPES.MERCHANT_PAYOUT },
105
+ { name: 'Retailer Payouts', code: REPORT_FILTER_TYPES.RETAILER_PAYOUT },
56
106
  ],
57
107
  },
58
108
  ];
@@ -1,18 +1,17 @@
1
1
  import { ColumnsView } from './column';
2
2
  import { Segment, SegmentCountry, SegmentUser, SelectedBrand, SelectedCountry, User } from './user';
3
- import { BusinessMerchant } from './merchant';
4
3
  import type { i18n } from 'i18next';
5
4
  import { Theme } from '@mui/material';
6
5
  import { CalenderMode } from './theme';
7
6
  import { Timezone } from './appConfig';
8
7
  import { Brand, Entity, TableMode } from './index.js';
9
8
  import { TextAndLang } from './common';
10
- export interface AccountAppPayload {
11
- disabledAccountDataFetching?: boolean;
12
- isAccountDetailsOpen: boolean;
13
- selectedMerchant?: BusinessMerchant;
14
- }
15
- export interface AppPayload extends Partial<AccountAppPayload> {
9
+ export type AppPayload<TServiceCodes extends string = string> = {
10
+ services: {
11
+ [key in TServiceCodes]?: ServicePayload;
12
+ };
13
+ };
14
+ export interface ServicePayload {
16
15
  columnFilters?: Record<string, any>;
17
16
  filteredIds?: string[];
18
17
  dateRange?: [Date, Date];
@@ -21,6 +20,7 @@ export interface AppPayload extends Partial<AccountAppPayload> {
21
20
  isTextShown?: boolean;
22
21
  tableViews?: ColumnsView[];
23
22
  calendarTimezone?: number;
23
+ reportTypes?: string[];
24
24
  }
25
25
  export interface AppDetails {
26
26
  id: string;
@@ -43,7 +43,7 @@ export interface AppDetails {
43
43
  minWidth: number | string;
44
44
  minHeight: number | string;
45
45
  };
46
- payload?: Record<string, any> & AppPayload;
46
+ payload?: Record<string, any> & ServicePayload;
47
47
  toolbarIconUrl?: string;
48
48
  hideMaximizedApp?: boolean;
49
49
  hideMinimizeApp?: boolean;
@@ -99,7 +99,7 @@ export type MFWidgetBaseProps = {
99
99
  hasHeader: boolean;
100
100
  sandboxMode: boolean;
101
101
  initialServiceCode?: string;
102
- initialPayload?: Record<string, any> & AppPayload;
102
+ initialAppPayload?: AppPayload;
103
103
  };
104
104
  user: User;
105
105
  segment: {
@@ -6,7 +6,7 @@ export declare const openNewAppAttrs: ({ appCode, serviceCode, sandboxMode, payl
6
6
  numberOfOpenedApps: number;
7
7
  segmentId: string;
8
8
  }) => {
9
- payload?: (Record<string, any> & import("../types/index.js").AppPayload) | undefined;
9
+ payload?: (Record<string, any> & import("../types/index.js").ServicePayload) | undefined;
10
10
  segmentId: string;
11
11
  appCode: string;
12
12
  serviceCode: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.365",
4
+ "version": "0.1.367",
5
5
  "testVersion": 0,
6
6
  "type": "module",
7
7
  "main": "build/index.js",