@tap-payments/os-micro-frontend-shared 0.1.92 → 0.1.93
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.
|
@@ -13,6 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import Tooltip from '../../../Tooltip';
|
|
14
14
|
import { ImageWrapper } from '../../../index.js';
|
|
15
15
|
import { TableCell } from '../../../TableCells';
|
|
16
|
+
import { openUrl } from '../../../../utils/index.js';
|
|
16
17
|
import { ChannelTextLabel, ChannelTextWrapper, salesChannelAnimation, SalesChannelsContainer, StyledSourceCell, StyledSourceImage } from './style';
|
|
17
18
|
function SalesChannelCell(_a) {
|
|
18
19
|
var _b;
|
|
@@ -21,11 +22,12 @@ function SalesChannelCell(_a) {
|
|
|
21
22
|
var _a;
|
|
22
23
|
const sourceTooltip = channel.address;
|
|
23
24
|
const channelCode = (_a = channel.code) === null || _a === void 0 ? void 0 : _a.replace(/_/g, '');
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, onClick: () => {
|
|
28
|
-
|
|
25
|
+
const isLastChannel = index === (channels === null || channels === void 0 ? void 0 : channels.length) - 1;
|
|
26
|
+
return (_jsx(Tooltip, Object.assign({ title: sourceTooltip }, { children: _jsx(ImageWrapper, Object.assign({ order: index, variants: salesChannelAnimation(index, isTextShown ? 74 : 0), sx: Object.assign({ width: isTextShown ? '70px' : '36px', cursor: 'pointer' }, (isLastChannel && {
|
|
27
|
+
boxShadow: '7px 0px 8px 0px #F2F2F2',
|
|
28
|
+
})), onClick: () => {
|
|
29
|
+
if (channel === null || channel === void 0 ? void 0 : channel.address)
|
|
30
|
+
openUrl(channel.address);
|
|
29
31
|
} }, { children: isTextShown ? (_jsx(ChannelTextWrapper, { children: _jsx(ChannelTextLabel, { children: channelCode }) })) : (_jsx(StyledSourceImage, { src: channel.logo, alt: channelCode })) })) }), `${channel}-${index}`));
|
|
30
32
|
});
|
|
31
33
|
const salesChannelsCount = (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.length) || 0;
|
package/build/utils/url.d.ts
CHANGED
package/build/utils/url.js
CHANGED
|
@@ -6,3 +6,13 @@ export const openNewTab = (url, target = '_blank') => {
|
|
|
6
6
|
link.click();
|
|
7
7
|
link.remove();
|
|
8
8
|
};
|
|
9
|
+
export const openUrl = (url) => {
|
|
10
|
+
const isUrl = /^https?:\/\//i.test(url);
|
|
11
|
+
if (isUrl) {
|
|
12
|
+
window.open(url, '_blank', 'noopener,noreferrer');
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
const newUrl = 'about:blank?' + encodeURIComponent(url);
|
|
16
|
+
window.open(newUrl, '_blank', 'noopener,noreferrer');
|
|
17
|
+
}
|
|
18
|
+
};
|
package/package.json
CHANGED