@tap-payments/os-micro-frontend-shared 0.1.327-test.1 → 0.1.327-test.5

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,7 +11,6 @@ export declare const StyledAnimatedSpinner: import("@emotion/styled").StyledComp
11
11
  content?: string | undefined;
12
12
  translate?: "yes" | "no" | undefined;
13
13
  id?: string | undefined;
14
- loading?: "eager" | "lazy" | undefined;
15
14
  defaultChecked?: boolean | undefined;
16
15
  defaultValue?: string | number | readonly string[] | undefined;
17
16
  suppressContentEditableWarning?: boolean | undefined;
@@ -274,6 +273,7 @@ export declare const StyledAnimatedSpinner: import("@emotion/styled").StyledComp
274
273
  src?: string | undefined;
275
274
  alt?: string | undefined;
276
275
  decoding?: "auto" | "async" | "sync" | undefined;
276
+ loading?: "eager" | "lazy" | undefined;
277
277
  fetchPriority?: "auto" | "high" | "low" | undefined;
278
278
  srcSet?: string | undefined;
279
279
  } & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLImageElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & AnimatedSpinnerIconProps, {}, {}>;
@@ -0,0 +1,5 @@
1
+ interface PaymentIconProps {
2
+ type: string;
3
+ }
4
+ export declare function PaymentIcon({ type }: PaymentIconProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Box from '@mui/material/Box';
3
+ import { getPaymentMethodsIcon } from '../../constants/index.js';
4
+ import { PaymentChip } from './style';
5
+ export function PaymentIcon({ type }) {
6
+ return (_jsx(PaymentChip, { children: _jsx(Box, { component: "img", src: getPaymentMethodsIcon(type), sx: { width: 18, height: 12, objectFit: 'contain' }, onError: (e) => {
7
+ e.currentTarget.src = getPaymentMethodsIcon('card');
8
+ } }) }));
9
+ }
@@ -14,6 +14,7 @@ import { useState, useCallback, useMemo } from 'react';
14
14
  import { Menu } from '../index.js';
15
15
  import { rightArrow } from '../../constants/index.js';
16
16
  import { MenuItemStyled } from './style';
17
+ import { PaymentIcon } from './PaymentIcon';
17
18
  export default function PaymentMethod({ icon, name, options = [], filters, setFilters }) {
18
19
  var _a;
19
20
  const [anchorEl, setAnchorEl] = useState(null);
@@ -50,5 +51,5 @@ export default function PaymentMethod({ icon, name, options = [], filters, setFi
50
51
  setFilters(Object.assign(Object.assign({}, filters), { payment_methods: [...(paymentMethods !== null && paymentMethods !== void 0 ? paymentMethods : []), selectedPaymentMethod] }));
51
52
  }
52
53
  };
53
- return (_jsxs(MenuItemStyled, Object.assign({ isSelected: isSelected, isIndeterminate: isIndeterminate, onMouseEnter: onOpen, onMouseLeave: onClose, onClick: onClick }, { children: [_jsx("img", { src: icon, alt: name }), _jsx("span", Object.assign({ className: "label" }, { children: name })), _jsx("img", { src: rightArrow, alt: "arrow", style: { height: 12 } }), _jsx(Menu, Object.assign({ open: Boolean(anchorEl), anchorEl: anchorEl, placement: "right-end" }, { children: options === null || options === void 0 ? void 0 : options.map((option) => (_jsx(MenuItemStyled, Object.assign({ isSelected: isSelectedPaymentMethod(option.type), onClick: (e) => onClickPaymentMethod(e, option.type) }, { children: _jsx("img", { src: option.icon, alt: option === null || option === void 0 ? void 0 : option.name, style: { height: 24, width: 36, objectFit: 'contain' } }) }), option.type))) }))] })));
54
+ return (_jsxs(MenuItemStyled, Object.assign({ isSelected: isSelected, isIndeterminate: isIndeterminate, onMouseEnter: onOpen, onMouseLeave: onClose, onClick: onClick }, { children: [_jsx("img", { src: icon, alt: name }), _jsx("span", Object.assign({ className: "label" }, { children: name })), _jsx("img", { src: rightArrow, alt: "arrow", style: { height: 12 } }), _jsx(Menu, Object.assign({ open: Boolean(anchorEl), anchorEl: anchorEl, placement: "right-end" }, { children: options === null || options === void 0 ? void 0 : options.map((option) => (_jsx(MenuItemStyled, Object.assign({ isSelected: isSelectedPaymentMethod(option.type), onClick: (e) => onClickPaymentMethod(e, option.type) }, { children: _jsx(PaymentIcon, { type: option.type }) }), option.type))) }))] })));
54
55
  }
@@ -14,6 +14,7 @@ import { useCallback, useMemo, useState } from 'react';
14
14
  import { Menu } from '../index.js';
15
15
  import { rightArrow } from '../../constants/index.js';
16
16
  import { MenuItemStyled } from './style';
17
+ import { PaymentIcon } from './PaymentIcon';
17
18
  export default function PaymentSchemes({ paymentSchemesSource, filters, setFilters }) {
18
19
  var _a, _b, _c, _d;
19
20
  const [anchorEl, setAnchorEl] = useState(null);
@@ -49,5 +50,5 @@ export default function PaymentSchemes({ paymentSchemesSource, filters, setFilte
49
50
  setFilters(Object.assign(Object.assign({}, filters), { payment_scheme: [...((_b = filters === null || filters === void 0 ? void 0 : filters.payment_scheme) !== null && _b !== void 0 ? _b : []), selectedPaymentScheme] }));
50
51
  }
51
52
  };
52
- return (_jsxs(MenuItemStyled, Object.assign({ isSelected: isSelected, isIndeterminate: isIndeterminate, onMouseEnter: onOpen, onMouseLeave: onClose, onClick: onClick, sx: Object.assign({}, (isDisabled && { opacity: 0.5, pointerEvents: 'none' })) }, { children: [_jsx("span", Object.assign({ className: "label" }, { children: paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.name })), _jsx("img", { src: rightArrow, alt: "arrow", style: { height: 12 } }), _jsx(Menu, Object.assign({ open: Boolean(anchorEl), anchorEl: anchorEl, placement: "right-start" }, { children: (_d = paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.options) === null || _d === void 0 ? void 0 : _d.map((scheme) => (_jsx(MenuItemStyled, Object.assign({ isSelected: isSelectedPaymentScheme(scheme.type), onClick: (e) => onClickPaymentScheme(e, scheme.type) }, { children: _jsx("img", { src: scheme.icon, alt: scheme === null || scheme === void 0 ? void 0 : scheme.name, style: { height: 24 } }) }), scheme.type))) }))] })));
53
+ return (_jsxs(MenuItemStyled, Object.assign({ isSelected: isSelected, isIndeterminate: isIndeterminate, onMouseEnter: onOpen, onMouseLeave: onClose, onClick: onClick, sx: Object.assign({}, (isDisabled && { opacity: 0.5, pointerEvents: 'none' })) }, { children: [_jsx("span", Object.assign({ className: "label" }, { children: paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.name })), _jsx("img", { src: rightArrow, alt: "arrow", style: { height: 12 } }), _jsx(Menu, Object.assign({ open: Boolean(anchorEl), anchorEl: anchorEl, placement: "right-start" }, { children: (_d = paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.options) === null || _d === void 0 ? void 0 : _d.map((scheme) => (_jsx(MenuItemStyled, Object.assign({ isSelected: isSelectedPaymentScheme(scheme.type), onClick: (e) => onClickPaymentScheme(e, scheme.type) }, { children: _jsx(PaymentIcon, { type: scheme.type }) }), scheme.type))) }))] })));
53
54
  }
@@ -1 +1,5 @@
1
+ /// <reference types="react" />
1
2
  export declare const MenuItemStyled: import("@emotion/styled").StyledComponent<import("../MenuItem/MenuItem").MenuItemProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
3
+ export declare const PaymentChip: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
4
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
5
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -1,4 +1,5 @@
1
1
  import { styled } from '@mui/material/styles';
2
+ import Box from '@mui/material/Box';
2
3
  import { MenuItem } from '../index.js';
3
4
  export const MenuItemStyled = styled(MenuItem)(({ theme }) => ({
4
5
  height: 40,
@@ -10,3 +11,12 @@ export const MenuItemStyled = styled(MenuItem)(({ theme }) => ({
10
11
  flexGrow: 1,
11
12
  },
12
13
  }));
14
+ export const PaymentChip = styled(Box)(({ theme }) => ({
15
+ width: 36,
16
+ height: 24,
17
+ border: `1px solid ${theme.palette.divider}`,
18
+ display: 'flex',
19
+ alignItems: 'center',
20
+ justifyContent: 'center',
21
+ borderRadius: '12px',
22
+ }));
@@ -299,7 +299,6 @@ export declare const Icon: import("@emotion/styled").StyledComponent<{
299
299
  content?: string | undefined;
300
300
  translate?: "yes" | "no" | undefined;
301
301
  id?: string | undefined;
302
- loading?: "eager" | "lazy" | undefined;
303
302
  defaultChecked?: boolean | undefined;
304
303
  defaultValue?: string | number | readonly string[] | undefined;
305
304
  suppressContentEditableWarning?: boolean | undefined;
@@ -562,6 +561,7 @@ export declare const Icon: import("@emotion/styled").StyledComponent<{
562
561
  src?: string | undefined;
563
562
  alt?: string | undefined;
564
563
  decoding?: "auto" | "async" | "sync" | undefined;
564
+ loading?: "eager" | "lazy" | undefined;
565
565
  fetchPriority?: "auto" | "high" | "low" | undefined;
566
566
  srcSet?: string | undefined;
567
567
  } & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLImageElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -17,7 +17,6 @@ export declare const ActionIcon: import("@emotion/styled").StyledComponent<{
17
17
  content?: string | undefined;
18
18
  translate?: "yes" | "no" | undefined;
19
19
  id?: string | undefined;
20
- loading?: "eager" | "lazy" | undefined;
21
20
  defaultChecked?: boolean | undefined;
22
21
  defaultValue?: string | number | readonly string[] | undefined;
23
22
  suppressContentEditableWarning?: boolean | undefined;
@@ -280,6 +279,7 @@ export declare const ActionIcon: import("@emotion/styled").StyledComponent<{
280
279
  src?: string | undefined;
281
280
  alt?: string | undefined;
282
281
  decoding?: "auto" | "async" | "sync" | undefined;
282
+ loading?: "eager" | "lazy" | undefined;
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> & {
@@ -10,7 +10,6 @@ export declare const StyledDownloadFileImage: import("@emotion/styled").StyledCo
10
10
  content?: string | undefined;
11
11
  translate?: "yes" | "no" | undefined;
12
12
  id?: string | undefined;
13
- loading?: "eager" | "lazy" | undefined;
14
13
  defaultChecked?: boolean | undefined;
15
14
  defaultValue?: string | number | readonly string[] | undefined;
16
15
  suppressContentEditableWarning?: boolean | undefined;
@@ -273,6 +272,7 @@ export declare const StyledDownloadFileImage: import("@emotion/styled").StyledCo
273
272
  src?: string | undefined;
274
273
  alt?: string | undefined;
275
274
  decoding?: "auto" | "async" | "sync" | undefined;
275
+ loading?: "eager" | "lazy" | undefined;
276
276
  fetchPriority?: "auto" | "high" | "low" | undefined;
277
277
  srcSet?: string | undefined;
278
278
  } & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLImageElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -7,7 +7,6 @@ export declare const MultiRefundIcon: import("@emotion/styled").StyledComponent<
7
7
  content?: string | undefined;
8
8
  translate?: "yes" | "no" | undefined;
9
9
  id?: string | undefined;
10
- loading?: "eager" | "lazy" | undefined;
11
10
  defaultChecked?: boolean | undefined;
12
11
  defaultValue?: string | number | readonly string[] | undefined;
13
12
  suppressContentEditableWarning?: boolean | undefined;
@@ -270,6 +269,7 @@ export declare const MultiRefundIcon: import("@emotion/styled").StyledComponent<
270
269
  src?: string | undefined;
271
270
  alt?: string | undefined;
272
271
  decoding?: "auto" | "async" | "sync" | undefined;
272
+ loading?: "eager" | "lazy" | undefined;
273
273
  fetchPriority?: "auto" | "high" | "low" | undefined;
274
274
  srcSet?: string | undefined;
275
275
  } & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLImageElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -54,7 +54,6 @@ export declare const ActionIcon: import("@emotion/styled").StyledComponent<{
54
54
  content?: string | undefined;
55
55
  translate?: "yes" | "no" | undefined;
56
56
  id?: string | undefined;
57
- loading?: "eager" | "lazy" | undefined;
58
57
  defaultChecked?: boolean | undefined;
59
58
  defaultValue?: string | number | readonly string[] | undefined;
60
59
  suppressContentEditableWarning?: boolean | undefined;
@@ -317,6 +316,7 @@ export declare const ActionIcon: import("@emotion/styled").StyledComponent<{
317
316
  src?: string | undefined;
318
317
  alt?: string | undefined;
319
318
  decoding?: "auto" | "async" | "sync" | undefined;
319
+ loading?: "eager" | "lazy" | undefined;
320
320
  fetchPriority?: "auto" | "high" | "low" | undefined;
321
321
  srcSet?: string | undefined;
322
322
  } & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLImageElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -76,11 +76,18 @@ export type NavigateFunction = (params: {
76
76
  sandboxMode?: boolean;
77
77
  state?: any;
78
78
  }) => void;
79
- export interface WindowPreview {
79
+ export interface PreviewStorageData {
80
80
  id: string;
81
81
  img: string;
82
- status: 'idle' | 'completed' | 'error' | 'loading';
82
+ timestamp: number;
83
+ }
84
+ export interface PreviewData {
85
+ id: string;
86
+ img: string;
87
+ isGenerating: boolean;
88
+ serviceCode?: string;
83
89
  appCode: string;
90
+ isMinimized: boolean;
84
91
  }
85
92
  export type MFWidgetBaseProps = {
86
93
  windowId: string;
@@ -8,8 +8,14 @@ export declare enum SEGMENT_CODE {
8
8
  BUSINESS = "BUSINESS",
9
9
  PLATFORM = "PLATFORM",
10
10
  DEVELOPMENT = "DEVELOPMENT",
11
+ PSP = "PSP",
11
12
  PAYMENT_TECHNOLOGY = "PAYMENT_TECHNOLOGY",
12
13
  PAYMENT_FACILITATOR = "PAYMENT_FACILITATOR",
13
14
  PAYMENT_ACQUIRER = "PAYMENT_ACQUIRER",
14
- PAYMENT_GATEWAY = "PAYMENT_GATEWAY"
15
+ PAYMENT_GATEWAY = "PAYMENT_GATEWAY",
16
+ BILLING_PLATFORM = "BILLING_PLATFORM",
17
+ COMMERCE_PLATFORM = "COMMERCE_PLATFORM",
18
+ DEVELOPMENT_HOUSE = "DEVELOPMENT_HOUSE",
19
+ PAYMENT_GATEWAY_PROVIDER = "PAYMENT_GATEWAY_PROVIDER",
20
+ RETAIL_PLATFORM = "RETAIL_PLATFORM"
15
21
  }
@@ -3,8 +3,14 @@ export var SEGMENT_CODE;
3
3
  SEGMENT_CODE["BUSINESS"] = "BUSINESS";
4
4
  SEGMENT_CODE["PLATFORM"] = "PLATFORM";
5
5
  SEGMENT_CODE["DEVELOPMENT"] = "DEVELOPMENT";
6
+ SEGMENT_CODE["PSP"] = "PSP";
6
7
  SEGMENT_CODE["PAYMENT_TECHNOLOGY"] = "PAYMENT_TECHNOLOGY";
7
8
  SEGMENT_CODE["PAYMENT_FACILITATOR"] = "PAYMENT_FACILITATOR";
8
9
  SEGMENT_CODE["PAYMENT_ACQUIRER"] = "PAYMENT_ACQUIRER";
9
10
  SEGMENT_CODE["PAYMENT_GATEWAY"] = "PAYMENT_GATEWAY";
11
+ SEGMENT_CODE["BILLING_PLATFORM"] = "BILLING_PLATFORM";
12
+ SEGMENT_CODE["COMMERCE_PLATFORM"] = "COMMERCE_PLATFORM";
13
+ SEGMENT_CODE["DEVELOPMENT_HOUSE"] = "DEVELOPMENT_HOUSE";
14
+ SEGMENT_CODE["PAYMENT_GATEWAY_PROVIDER"] = "PAYMENT_GATEWAY_PROVIDER";
15
+ SEGMENT_CODE["RETAIL_PLATFORM"] = "RETAIL_PLATFORM";
10
16
  })(SEGMENT_CODE || (SEGMENT_CODE = {}));
@@ -1,4 +1,4 @@
1
- import { AppDetails, WindowPreview, Segment, TableMode, Timezone } from '../types/index.js';
1
+ import { AppDetails, PreviewData, Segment, TableMode, Timezone } from '../types/index.js';
2
2
  import { SheetViewColumnsData } from './columnResizeStorage';
3
3
  export declare function setSecretKey(): void;
4
4
  export declare function getSecretKey(): string | null;
@@ -32,7 +32,7 @@ export declare const getGlobalTableModeStorage: () => TableMode;
32
32
  export declare const removeGlobalTableModeStorage: () => void;
33
33
  export declare const setSheetViewColumnsStorage: (data: SheetViewColumnsData) => void;
34
34
  export declare const getSheetViewColumnsStorage: () => SheetViewColumnsData;
35
- export declare const setPreviewStorage: (previews: WindowPreview[]) => void;
36
- export declare const getPreviewStorage: () => WindowPreview[];
35
+ export declare const setPreviewStorage: (previews: PreviewData[]) => void;
36
+ export declare const getPreviewStorage: () => Map<string, string>;
37
37
  export declare const removePreviewStorage: () => void;
38
38
  export declare const clearTapOsLocalStorage: () => void;
@@ -172,7 +172,14 @@ export const setSheetViewColumnsStorage = (data) => localStorage.setItem(SHEETVI
172
172
  export const getSheetViewColumnsStorage = () => JSON.parse(localStorage.getItem(SHEETVIEW_COLUMNS_KEY) || '{}');
173
173
  export const setPreviewStorage = (previews) => {
174
174
  try {
175
- localStorage.setItem(PREVIEW_STORAGE_KEY, JSON.stringify(previews));
175
+ const data = previews
176
+ .filter((p) => p.img)
177
+ .map((p) => ({
178
+ id: p.id,
179
+ img: p.img,
180
+ timestamp: Date.now(),
181
+ }));
182
+ localStorage.setItem(PREVIEW_STORAGE_KEY, JSON.stringify(data));
176
183
  }
177
184
  catch (error) {
178
185
  console.warn('Failed to save preview cache:', error);
@@ -182,12 +189,16 @@ export const getPreviewStorage = () => {
182
189
  try {
183
190
  const cached = localStorage.getItem(PREVIEW_STORAGE_KEY);
184
191
  if (!cached)
185
- return [];
192
+ return new Map();
186
193
  const data = JSON.parse(cached);
187
- return data;
194
+ const previewMap = new Map();
195
+ data.forEach((item) => {
196
+ previewMap.set(item.id, item.img);
197
+ });
198
+ return previewMap;
188
199
  }
189
200
  catch (error) {
190
- return [];
201
+ return new Map();
191
202
  }
192
203
  };
193
204
  export const removePreviewStorage = () => {
@@ -16,7 +16,6 @@ export declare function transformPaymentMethodsData(data?: PaymentMethod[]): {
16
16
  options: {
17
17
  name: string | undefined;
18
18
  type: string;
19
- icon: string;
20
19
  }[];
21
20
  }[] | undefined;
22
21
  };
@@ -26,7 +25,6 @@ export declare function transformPaymentSchemesData(data?: Source[]): {
26
25
  options: {
27
26
  name: string | undefined;
28
27
  type: string;
29
- icon: string;
30
28
  }[];
31
29
  };
32
30
  export {};
@@ -1,20 +1,19 @@
1
1
  import capitalize from 'lodash/capitalize';
2
- import { lightUrl, PAYMENT_TYPES_ICONS } from '../constants/index.js';
2
+ import { PAYMENT_TYPES_ICONS } from '../constants/index.js';
3
3
  import { getNameText } from './language';
4
4
  export function transformPaymentMethodsData(data) {
5
5
  return {
6
6
  name: 'Payment Methods',
7
7
  type: 'payment_methods',
8
8
  options: data === null || data === void 0 ? void 0 : data.map((category) => {
9
- var _a;
9
+ var _a, _b;
10
10
  return {
11
11
  name: capitalize(getNameText(category === null || category === void 0 ? void 0 : category.name)),
12
12
  type: category === null || category === void 0 ? void 0 : category.code,
13
- icon: PAYMENT_TYPES_ICONS[category.code],
14
- options: (_a = category.payment_methods) === null || _a === void 0 ? void 0 : _a.map((method) => ({
13
+ icon: (_a = PAYMENT_TYPES_ICONS[category.code]) !== null && _a !== void 0 ? _a : PAYMENT_TYPES_ICONS.CARD,
14
+ options: (_b = category.payment_methods) === null || _b === void 0 ? void 0 : _b.map((method) => ({
15
15
  name: getNameText(method.name),
16
16
  type: method.code,
17
- icon: `${lightUrl}/payment-method/${method.code}.svg`,
18
17
  })),
19
18
  };
20
19
  }),
@@ -30,7 +29,6 @@ export function transformPaymentSchemesData(data = []) {
30
29
  return {
31
30
  name: getNameText(scheme === null || scheme === void 0 ? void 0 : scheme.name),
32
31
  type: scheme === null || scheme === void 0 ? void 0 : scheme.code,
33
- icon: `${lightUrl}/payment-method/${scheme.code}.svg`,
34
32
  };
35
33
  }),
36
34
  };
@@ -1,2 +1,66 @@
1
1
  import { Segment, SegmentData } from '../types/index.js';
2
2
  export declare const getSegmentData: (segments: Segment[], activeSegmentId: string, activeSegments: Segment[]) => SegmentData;
3
+ export declare const getBusinessSegmentConfig: (merchantsIds: string[]) => {
4
+ business?: undefined;
5
+ } | {
6
+ business: {
7
+ merchant: string[];
8
+ };
9
+ };
10
+ export declare const getNonBusinessSegmentConfig: ({ segmentCode, segmentId, segmentTypeCode, }: {
11
+ segmentCode: string;
12
+ segmentTypeCode: string;
13
+ segmentId: string;
14
+ }) => {
15
+ payment_provider: {
16
+ technology: {
17
+ orchestrator: string[];
18
+ gateway?: undefined;
19
+ };
20
+ institution?: undefined;
21
+ };
22
+ platform?: undefined;
23
+ development_agency?: undefined;
24
+ } | {
25
+ payment_provider: {
26
+ technology: {
27
+ gateway: string[];
28
+ orchestrator?: undefined;
29
+ };
30
+ institution?: undefined;
31
+ };
32
+ platform?: undefined;
33
+ development_agency?: undefined;
34
+ } | {
35
+ payment_provider: {
36
+ institution: {
37
+ facilitator: string[];
38
+ acquirer?: undefined;
39
+ };
40
+ technology?: undefined;
41
+ };
42
+ platform?: undefined;
43
+ development_agency?: undefined;
44
+ } | {
45
+ payment_provider: {
46
+ institution: {
47
+ acquirer: string[];
48
+ facilitator?: undefined;
49
+ };
50
+ technology?: undefined;
51
+ };
52
+ platform?: undefined;
53
+ development_agency?: undefined;
54
+ } | {
55
+ platform: string[];
56
+ payment_provider?: undefined;
57
+ development_agency?: undefined;
58
+ } | {
59
+ development_agency: string[];
60
+ payment_provider?: undefined;
61
+ platform?: undefined;
62
+ } | {
63
+ payment_provider?: undefined;
64
+ platform?: undefined;
65
+ development_agency?: undefined;
66
+ };
@@ -1,7 +1,7 @@
1
+ import { SEGMENT_CODE } from '../types/index.js';
1
2
  import { getDefaultEntityCountry } from './entity';
2
3
  export const getSegmentData = (segments, activeSegmentId, activeSegments) => {
3
4
  var _a, _b, _c;
4
- // debugger
5
5
  const newSegment = (_a = segments.find((segment) => segment.id === activeSegmentId)) !== null && _a !== void 0 ? _a : {};
6
6
  const activeSegment = (_b = activeSegments.find((segment) => segment.id === activeSegmentId)) !== null && _b !== void 0 ? _b : {};
7
7
  const defaultCountry = activeSegment.countries.length === 1
@@ -11,3 +11,54 @@ export const getSegmentData = (segments, activeSegmentId, activeSegments) => {
11
11
  return Object.assign(Object.assign({}, newSegment), { defaultCountry,
12
12
  defaultEntity });
13
13
  };
14
+ export const getBusinessSegmentConfig = (merchantsIds) => {
15
+ if (!merchantsIds || !(merchantsIds === null || merchantsIds === void 0 ? void 0 : merchantsIds.length))
16
+ return {};
17
+ return { business: { merchant: merchantsIds } };
18
+ };
19
+ export const getNonBusinessSegmentConfig = ({ segmentCode, segmentId, segmentTypeCode, }) => {
20
+ const code = SEGMENT_CODE.PSP === segmentTypeCode ? segmentCode : segmentTypeCode;
21
+ if (code === SEGMENT_CODE.PAYMENT_TECHNOLOGY) {
22
+ return {
23
+ payment_provider: {
24
+ technology: {
25
+ orchestrator: [segmentId],
26
+ },
27
+ },
28
+ };
29
+ }
30
+ if (code === SEGMENT_CODE.PAYMENT_GATEWAY || code === SEGMENT_CODE.PAYMENT_GATEWAY_PROVIDER) {
31
+ return {
32
+ payment_provider: {
33
+ technology: {
34
+ gateway: [segmentId],
35
+ },
36
+ },
37
+ };
38
+ }
39
+ if (code === SEGMENT_CODE.PAYMENT_FACILITATOR) {
40
+ return {
41
+ payment_provider: {
42
+ institution: {
43
+ facilitator: [segmentId],
44
+ },
45
+ },
46
+ };
47
+ }
48
+ if (code === SEGMENT_CODE.PAYMENT_ACQUIRER) {
49
+ return {
50
+ payment_provider: {
51
+ institution: {
52
+ acquirer: [segmentId],
53
+ },
54
+ },
55
+ };
56
+ }
57
+ if (code === SEGMENT_CODE.PLATFORM) {
58
+ return { platform: [segmentId] };
59
+ }
60
+ if (code === SEGMENT_CODE.DEVELOPMENT) {
61
+ return { development_agency: [segmentId] };
62
+ }
63
+ return {};
64
+ };
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.327-test.1",
5
- "testVersion": 1,
4
+ "version": "0.1.327-test.5",
5
+ "testVersion": 5,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",