@hhgtech/hhg-components
Version:
Hello Health Group common components
204 lines (194 loc) • 12.6 kB
JavaScript
import React__default from 'react';
import { _ as __rest } from './tslib.es6-ea4dfe68.js';
import { W as WhatsApp, I as Instagram } from './WhatsApp-f7a93c46.js';
import { S as SocialType } from './index-90813715.js';
import { g as getHelloSitesUrl } from './index-8b24c2ec.js';
import { C as CommonGAssets } from './index-ebe66e27.js';
import { L as LOCALE } from './Locale-f270bd9d.js';
import './index-963a1701.js';
import './index-5e947517.js';
import 'date-fns/locale';
import './constantsSite.js';
import './constantsDomainLocales.js';
import './constantsRiskScreener.js';
import './constantsIsProduction.js';
import 'js-cookie';
import 'uuid';
const Facebook = (_a) => {
var { size } = _a, rest = __rest(_a, ["size"]);
return (React__default.createElement("svg", Object.assign({ width: size, height: size, viewBox: "0 0 28 28", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, rest),
React__default.createElement("path", { d: "M26.454 0H1.534A1.546 1.546 0 0 0 0 1.546v24.92A1.545 1.545 0 0 0 1.546 28h13.412V17.172h-3.64v-4.239h3.64V9.814c0-3.615 2.209-5.586 5.434-5.586a29 29 0 0 1 3.26.168v3.78h-2.224c-1.755 0-2.097.84-2.097 2.058v2.7h4.189l-.56 4.238h-3.64V28h7.134c.854 0 1.546-.692 1.546-1.546V1.534A1.546 1.546 0 0 0 26.454 0", fill: "#1778F2" })));
};
Facebook.defaultProps = {
size: 24,
};
const Line = (_a) => {
var { size } = _a, rest = __rest(_a, ["size"]);
return (React__default.createElement("svg", Object.assign({ width: size, height: size, viewBox: "0 0 32 32" }, rest),
React__default.createElement("g", { id: "surface1" },
React__default.createElement("path", { fill: "#00cf2e", d: "M26.4 32H5.6A5.6 5.6 0 0 1 0 26.4V5.6A5.6 5.6 0 0 1 5.6 0h20.8A5.6 5.6 0 0 1 32 5.6v20.8a5.6 5.6 0 0 1-5.6 5.6m0 0" }),
React__default.createElement("path", { fill: "#fff", d: "M28.2 14.2c0-4.4-5.2-9.2-12-9.2-6.6 0-12 3.9-12 9.2 0 4.9 4.2 9 10 9.5.4 0 .8.2 1 .6l.2.7a9.3 9.3 0 0 1-.2 1.6.4.4 0 0 0 .2.4.4.4 0 0 0 .4 0c2.8-1.2 12.4-6.3 12.4-12.8m0 0" }),
React__default.createElement("path", { fill: "#00cf2e", d: "M11.8 16.4H10v-4.2a.6.6 0 0 0-.6-.6.6.6 0 0 0-.6.6V17c0 .3.3.6.6.6h2.4c.3 0 .6-.3.6-.6a.6.6 0 0 0-.6-.6m1.6-4.8a.6.6 0 0 0-.6.6V17c0 .3.3.6.6.6s.6-.3.6-.6v-4.8a.6.6 0 0 0-.6-.6m5.6 0a.6.6 0 0 0-.6.6v3l-2.5-3.4a.6.6 0 0 0-.7-.2.6.6 0 0 0-.4.6V17a.6.6 0 0 0 1.2 0v-3l2.5 3.4a.6.6 0 0 0 .5.2.6.6 0 0 0 .6-.6v-4.8a.6.6 0 0 0-.6-.6m4.4 3.6c.3 0 .6-.3.6-.6a.6.6 0 0 0-.6-.6h-1.8v-1.2h1.8a.6.6 0 1 0 0-1.2H21a.6.6 0 0 0-.6.6V17c0 .3.3.6.6.6h2.4a.6.6 0 0 0 0-1.2h-1.8v-1.2Zm0 0" }))));
};
Line.defaultProps = {
size: 24,
};
const Linkedin = (_a) => {
var { size } = _a, rest = __rest(_a, ["size"]);
return (React__default.createElement("svg", Object.assign({ width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, rest),
React__default.createElement("rect", { width: "32", height: "32", rx: "4", fill: "#0077B5" }),
React__default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10.8571 9.07047C10.8349 7.97612 10.1126 7.14258 8.93969 7.14258C7.76679 7.14258 7 7.97612 7 9.07047C7 10.1422 7.74415 10.9997 8.89516 10.9997H8.9171C10.1126 10.9997 10.8571 10.1422 10.8571 9.07047ZM10.8571 12.2861H7V23.8576H10.8571V12.2861ZM20.1512 12.2861C22.9226 12.2861 25.0002 13.9023 25.0002 17.3749L25.0001 23.8572H20.7887V17.8087C20.7887 16.2895 20.1793 15.2527 18.6547 15.2527C17.4912 15.2527 16.7981 15.9516 16.4937 16.6266C16.3824 16.8686 16.355 17.2057 16.355 17.5436V23.8576H12.1431C12.1431 23.8576 12.1986 13.6128 12.1431 12.5519H16.355V14.1532C16.914 13.3835 17.9152 12.2861 20.1512 12.2861Z", fill: "white" })));
};
Linkedin.defaultProps = {
size: 24,
};
const Telegram = (_a) => {
var { size = 24 } = _a, rest = __rest(_a, ["size"]);
return (React__default.createElement("svg", Object.assign({ width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, rest),
React__default.createElement("path", { fill: "#00AEED", d: "M0 0h32v32H0z" }),
React__default.createElement("path", { d: "m7.322 15.653 15.426-5.948c.716-.258 1.342.175 1.11 1.258l.001-.002-2.627 12.375c-.194.877-.716 1.09-1.445.677l-4-2.948-1.93 1.859c-.213.213-.393.393-.806.393l.284-4.07 7.413-6.698c.323-.284-.072-.444-.497-.161l-9.161 5.768-3.95-1.232c-.857-.272-.876-.857.182-1.27", fill: "#fff" })));
};
const TikTok = (_a) => {
var { size = 24 } = _a, rest = __rest(_a, ["size"]);
return (React__default.createElement("svg", Object.assign({ width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, rest),
React__default.createElement("path", { d: "M28.19 0H3.81A3.814 3.814 0 0 0 0 3.81v24.38A3.813 3.813 0 0 0 3.81 32h24.38A3.814 3.814 0 0 0 32 28.19V3.81A3.814 3.814 0 0 0 28.19 0m-3.043 13.96a5.71 5.71 0 0 1-5.302-2.555v8.79A6.497 6.497 0 1 1 13.35 13.7c.135 0 .268.012.401.02v3.202c-.133-.016-.264-.04-.401-.04a3.315 3.315 0 1 0 0 6.631c1.831 0 3.449-1.443 3.449-3.274l.032-14.93h3.06a5.705 5.705 0 0 0 5.257 5.094z", fill: "#000" })));
};
const Twitter = (_a) => {
var { size } = _a, rest = __rest(_a, ["size"]);
return (React__default.createElement("svg", Object.assign({ width: size, height: size, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, rest),
React__default.createElement("path", { d: "M21.407 0H2.593A2.593 2.593 0 0 0 0 2.593v18.814A2.593 2.593 0 0 0 2.593 24h18.814A2.593 2.593 0 0 0 24 21.407V2.593A2.593 2.593 0 0 0 21.407 0m-6.099 20.353-4.46-6.491-5.584 6.49H3.821l6.386-7.422-6.386-9.295h4.871l4.223 6.147 5.288-6.147h1.443l-6.09 7.079 6.623 9.638z", fill: "#000" })));
};
Twitter.defaultProps = {
size: 24,
};
const Viber = (_a) => {
var { size = 24 } = _a, rest = __rest(_a, ["size"]);
return (React__default.createElement("svg", Object.assign({ width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, rest),
React__default.createElement("path", { d: "M24 32H8a8 8 0 0 1-8-8V8a8 8 0 0 1 8-8h16a8 8 0 0 1 8 8v16a8 8 0 0 1-8 8", fill: "#785AFA" }),
React__default.createElement("path", { d: "M25 17.684c-.575 4.638-3.97 4.93-4.595 5.13a19 19 0 0 1-5.85.498s-2.32 2.372-3.04 3.1a.4.4 0 0 1-.335.137c-.125-.031-.16-.178-.16-.395.005-.308.02-3.395.02-3.395-4.53-1.257-4.265-5.986-4.215-8.462s.515-4.505 1.9-5.869c2.48-2.248 7.595-1.912 7.595-1.912 4.32.018 6.39 1.319 6.87 1.755 1.59 1.364 2.405 4.628 1.81 9.412m-.62-10.57c-.565-.523-2.86-2.187-7.965-2.21 0 0-6.02-.363-8.955 2.33-1.635 1.633-2.21 4.024-2.27 6.989S4.645 22.743 10 24.25v2.299c0 .587.175 1.451 1.02 1.451.345 0 .835-.132 1.52-.828l2.275-2.193c2.077.109 4.16-.077 6.185-.553.74-.24 4.925-.776 5.605-6.331.7-5.726-.34-9.349-2.225-10.981", fill: "#fff" }),
React__default.createElement("path", { d: "M15.998 9a5.5 5.5 0 0 1 5.5 5.5.501.501 0 0 1-1 0 4.503 4.503 0 0 0-4.5-4.5h-.045a.5.5 0 0 1 0-1z", fill: "#fff" }),
React__default.createElement("path", { d: "M15.998 11a3.5 3.5 0 0 1 3.5 3.5.5.5 0 0 1-1 0 2.5 2.5 0 0 0-2.5-2.5h-.045a.5.5 0 1 1 0-1zm5.288 8.44a.77.77 0 0 0-.105-.951 12.6 12.6 0 0 0-1.98-1.43.88.88 0 0 0-1.115.155l-.405.505c-.51.63-2.07-.315-2.81-1.088-.775-.745-1.72-2.302-1.09-2.813l.505-.401a.88.88 0 0 0 .155-1.117 12 12 0 0 0-1.43-1.98.766.766 0 0 0-.95-.107 4.5 4.5 0 0 0-1.04.845 1.32 1.32 0 0 0-.355 1.357 14.8 14.8 0 0 0 3.21 5.212 14.9 14.9 0 0 0 5.21 3.207 1.32 1.32 0 0 0 1.36-.352q.476-.475.84-1.041", fill: "#fff" })));
};
function formatShareUrl(url, locale, channel) {
const fullUrl = url.startsWith('http')
? url
: `${getHelloSitesUrl(locale)}${url}`;
return encodeURIComponent(channel
? (() => {
const newUrl = new URL(fullUrl);
newUrl.searchParams.append('cn', channel);
return newUrl.toString();
})()
: fullUrl);
}
const getSocialList = ({ shareUrl, size = 32, locale, }) => [
{
icon: React__default.createElement(Facebook, { size: size }),
name: 'Facebook',
type: SocialType.Facebook,
href: `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(formatShareUrl(shareUrl, locale, SocialType.Facebook))}`,
},
{
icon: (React__default.createElement("img", { src: CommonGAssets.getAssetPath('zalo-mini.png'), alt: "Zalo", style: {
maxWidth: size,
maxHeight: size,
}, loading: "lazy" })),
name: 'Zalo',
type: SocialType.Zalo,
href: `https://sp.zalo.me/share?href=${encodeURIComponent(formatShareUrl(shareUrl, locale, SocialType.Zalo))}`,
allowedLocales: [LOCALE.Vietnam],
},
{
icon: React__default.createElement(Twitter, { size: size }),
name: 'Twitter',
type: SocialType.Twitter,
href: `https://twitter.com/intent/tweet?url=${formatShareUrl(shareUrl, locale, SocialType.Twitter)}`,
},
{
icon: React__default.createElement(WhatsApp, { size: size }),
name: 'WhatsApp',
type: SocialType.WhatsApp,
href: `https://wa.me/?text=${formatShareUrl(shareUrl, locale, SocialType.WhatsApp)}`,
},
{
icon: React__default.createElement(Linkedin, { size: size }),
name: 'LinkedIn',
type: SocialType.LinkedIn,
href: `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(formatShareUrl(shareUrl, locale, SocialType.LinkedIn))}`,
},
{
icon: React__default.createElement(Line, { size: size }),
name: 'Line',
type: SocialType.Line,
href: `http://line.me/R/msg/text/?${formatShareUrl(shareUrl, locale, SocialType.Line)}`,
allowedLocales: [LOCALE.Taiwan],
},
{
icon: React__default.createElement(Instagram, { size: size }),
name: 'Instagram',
type: SocialType.Instagram,
href: locale === LOCALE.Taiwan
? `https://www.instagram.com/helloyishi/`
: locale === LOCALE.Malaysia
? 'https://www.instagram.com/hellodoktor_official/'
: locale === LOCALE.Thailand
? 'https://www.instagram.com/hellokhunmor/'
: locale === LOCALE.Myanmar
? 'https://www.instagram.com/hellosayarwon/'
: locale === LOCALE.Cambodia
? 'https://www.instagram.com/hellokrupetofficial/'
: locale === LOCALE.Vietnam
? 'https://www.instagram.com/hellobacsi/'
: locale === LOCALE.Indonesia
? 'https://www.instagram.com/hellosehat/'
: '',
allowedLocales: [
LOCALE.Taiwan,
LOCALE.Malaysia,
LOCALE.Myanmar,
LOCALE.Cambodia,
LOCALE.Vietnam,
LOCALE.Indonesia,
LOCALE.Thailand,
],
},
{
icon: React__default.createElement(TikTok, { size: size }),
name: 'TikTok',
type: SocialType.Tiktok,
href: locale === LOCALE.Thailand
? 'https://www.tiktok.com/@hellokhunmor'
: locale === LOCALE.Malaysia
? 'https://www.tiktok.com/@hellodoktor_my'
: locale === LOCALE.Cambodia
? 'https://www.tiktok.com/@hellokrupet'
: locale === LOCALE.Vietnam
? 'https://www.tiktok.com/@hellobacsi'
: '',
allowedLocales: [
LOCALE.Malaysia,
LOCALE.Cambodia,
LOCALE.Vietnam,
LOCALE.Thailand,
],
},
{
icon: React__default.createElement(Telegram, { size: size }),
name: 'Telegram',
type: SocialType.Telegram,
href: locale === LOCALE.Cambodia
? 'http://t.me/hellokrupetofficial'
: locale === LOCALE.Indonesia
? 'https://www.instagram.com/hellosehat/'
: '',
allowedLocales: [LOCALE.Cambodia, LOCALE.Indonesia],
},
{
icon: React__default.createElement(Viber, { size: size }),
name: 'Viber',
type: SocialType.Viber,
href: locale === LOCALE.Myanmar ? '' : '',
allowedLocales: [LOCALE.Myanmar],
},
];
export { getSocialList };