UNPKG

@hhgtech/hhg-components

Version:
212 lines (198 loc) • 13.6 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var React = require('react'); var tslib_es6 = require('./tslib.es6-92cccef3.js'); var WhatsApp = require('./WhatsApp-931de57c.js'); var index = require('./index-ad7155cf.js'); var index$2 = require('./index-224bb98e.js'); var index$1 = require('./index-db44e8cb.js'); var Locale = require('./Locale-59ccf941.js'); require('./index-3020fcb3.js'); require('./index-1ee4ebb8.js'); require('date-fns/locale'); require('./constantsSite.js'); require('./constantsDomainLocales.js'); require('./constantsRiskScreener.js'); require('./constantsIsProduction.js'); require('js-cookie'); require('uuid'); function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } var React__default = /*#__PURE__*/_interopDefault(React); const Facebook = (_a) => { var { size } = _a, rest = tslib_es6.__rest(_a, ["size"]); return (React__default["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["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 = tslib_es6.__rest(_a, ["size"]); return (React__default["default"].createElement("svg", Object.assign({ width: size, height: size, viewBox: "0 0 32 32" }, rest), React__default["default"].createElement("g", { id: "surface1" }, React__default["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["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["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 = tslib_es6.__rest(_a, ["size"]); return (React__default["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["default"].createElement("rect", { width: "32", height: "32", rx: "4", fill: "#0077B5" }), React__default["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 = tslib_es6.__rest(_a, ["size"]); return (React__default["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["default"].createElement("path", { fill: "#00AEED", d: "M0 0h32v32H0z" }), React__default["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 = tslib_es6.__rest(_a, ["size"]); return (React__default["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["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 = tslib_es6.__rest(_a, ["size"]); return (React__default["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["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 = tslib_es6.__rest(_a, ["size"]); return (React__default["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["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["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["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["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 : `${index$2.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["default"].createElement(Facebook, { size: size }), name: 'Facebook', type: index.SocialType.Facebook, href: `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(formatShareUrl(shareUrl, locale, index.SocialType.Facebook))}`, }, { icon: (React__default["default"].createElement("img", { src: index$1.CommonGAssets.getAssetPath('zalo-mini.png'), alt: "Zalo", style: { maxWidth: size, maxHeight: size, }, loading: "lazy" })), name: 'Zalo', type: index.SocialType.Zalo, href: `https://sp.zalo.me/share?href=${encodeURIComponent(formatShareUrl(shareUrl, locale, index.SocialType.Zalo))}`, allowedLocales: [Locale.LOCALE.Vietnam], }, { icon: React__default["default"].createElement(Twitter, { size: size }), name: 'Twitter', type: index.SocialType.Twitter, href: `https://twitter.com/intent/tweet?url=${formatShareUrl(shareUrl, locale, index.SocialType.Twitter)}`, }, { icon: React__default["default"].createElement(WhatsApp.WhatsApp, { size: size }), name: 'WhatsApp', type: index.SocialType.WhatsApp, href: `https://wa.me/?text=${formatShareUrl(shareUrl, locale, index.SocialType.WhatsApp)}`, }, { icon: React__default["default"].createElement(Linkedin, { size: size }), name: 'LinkedIn', type: index.SocialType.LinkedIn, href: `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(formatShareUrl(shareUrl, locale, index.SocialType.LinkedIn))}`, }, { icon: React__default["default"].createElement(Line, { size: size }), name: 'Line', type: index.SocialType.Line, href: `http://line.me/R/msg/text/?${formatShareUrl(shareUrl, locale, index.SocialType.Line)}`, allowedLocales: [Locale.LOCALE.Taiwan], }, { icon: React__default["default"].createElement(WhatsApp.Instagram, { size: size }), name: 'Instagram', type: index.SocialType.Instagram, href: locale === Locale.LOCALE.Taiwan ? `https://www.instagram.com/helloyishi/` : locale === Locale.LOCALE.Malaysia ? 'https://www.instagram.com/hellodoktor_official/' : locale === Locale.LOCALE.Thailand ? 'https://www.instagram.com/hellokhunmor/' : locale === Locale.LOCALE.Myanmar ? 'https://www.instagram.com/hellosayarwon/' : locale === Locale.LOCALE.Cambodia ? 'https://www.instagram.com/hellokrupetofficial/' : locale === Locale.LOCALE.Vietnam ? 'https://www.instagram.com/hellobacsi/' : locale === Locale.LOCALE.Indonesia ? 'https://www.instagram.com/hellosehat/' : '', allowedLocales: [ Locale.LOCALE.Taiwan, Locale.LOCALE.Malaysia, Locale.LOCALE.Myanmar, Locale.LOCALE.Cambodia, Locale.LOCALE.Vietnam, Locale.LOCALE.Indonesia, Locale.LOCALE.Thailand, ], }, { icon: React__default["default"].createElement(TikTok, { size: size }), name: 'TikTok', type: index.SocialType.Tiktok, href: locale === Locale.LOCALE.Thailand ? 'https://www.tiktok.com/@hellokhunmor' : locale === Locale.LOCALE.Malaysia ? 'https://www.tiktok.com/@hellodoktor_my' : locale === Locale.LOCALE.Cambodia ? 'https://www.tiktok.com/@hellokrupet' : locale === Locale.LOCALE.Vietnam ? 'https://www.tiktok.com/@hellobacsi' : '', allowedLocales: [ Locale.LOCALE.Malaysia, Locale.LOCALE.Cambodia, Locale.LOCALE.Vietnam, Locale.LOCALE.Thailand, ], }, { icon: React__default["default"].createElement(Telegram, { size: size }), name: 'Telegram', type: index.SocialType.Telegram, href: locale === Locale.LOCALE.Cambodia ? 'http://t.me/hellokrupetofficial' : locale === Locale.LOCALE.Indonesia ? 'https://www.instagram.com/hellosehat/' : '', allowedLocales: [Locale.LOCALE.Cambodia, Locale.LOCALE.Indonesia], }, { icon: React__default["default"].createElement(Viber, { size: size }), name: 'Viber', type: index.SocialType.Viber, href: locale === Locale.LOCALE.Myanmar ? '' : '', allowedLocales: [Locale.LOCALE.Myanmar], }, ]; exports.getSocialList = getSocialList;