Skip to content

Commit

Permalink
Experimental: ddisable yandex
Browse files Browse the repository at this point in the history
  • Loading branch information
thi-investax committed Jan 6, 2025
1 parent 7d9809f commit fc69f5e
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 116 deletions.
231 changes: 119 additions & 112 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<!-- <link rel="icon" href="%PUBLIC_URL%/images/32x32_App_Icon_rounded.png" sizes="32x32">
<head>
<meta charset="utf-8" />
<!-- <link rel="icon" href="%PUBLIC_URL%/images/32x32_App_Icon_rounded.png" sizes="32x32">
<link rel="icon" href="%PUBLIC_URL%/images/192x192_App_Icon_rounded.png" sizes="192x192"> -->
<link rel="apple-touch-icon" href="%PUBLIC_URL%/images/180x180_App_Icon_rounded.png" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#0d0415" />
<meta name="fortmatic-site-verification" content="j93LgcVZk79qcgyo" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate" />
<!--
<link rel="apple-touch-icon" href="%PUBLIC_URL%/images/180x180_App_Icon_rounded.png" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#0d0415" />
<meta name="fortmatic-site-verification" content="j93LgcVZk79qcgyo" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Expand All @@ -26,102 +25,110 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<!-- Google Tag Manager -->
<script>
; (function (w, d, s, l, i) {
w[l] = w[l] || []
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js',
})
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : ''
j.async = true
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl
f.parentNode.insertBefore(j, f)
})(window, document, 'script', 'dataLayer', 'GTM-NXWCR4X')
</script>
<!-- End Google Tag Manager -->
<!-- <title>IX Swap</title> -->

<script>
var script = document.createElement('script')
// script.src = 'https://tag.safary.club/stag-0.1.5.js'
script.defer = true
script.setAttribute('data-name', 'safary-sdk')
script.setAttribute('data-product-id', 'prd_z2suvagAL5')
script.integrity = 'sha256-sFvG3ANXkfEJBbfj+oozHwPgzQSoq4uDCv3xrLblnmM='
script.crossOrigin = 'anonymous'
var target = document.head || document.body
target.appendChild(script)
</script>

<!-- End Safary Tag Manager -->
</head>

<body style="overflow: auto !important; margin-right: 0 !important;">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NXWCR4X" height="0" width="0"
style="display: none; visibility: hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

<!-- Yandex.Metrika counter -->
<script type="text/javascript">
; (function (m, e, t, r, i, k, a) {
m[i] =
m[i] ||
function () {
; (m[i].a = m[i].a || []).push(arguments)
}
m[i].l = 1 * new Date()
; (k = e.createElement(t)),
(a = e.getElementsByTagName(t)[0]),
(k.async = 1),
(k.src = r),
a.parentNode.insertBefore(k, a)
})(window, document, 'script', 'https://mc.yandex.ru/metrika/tag.js', 'ym')

ym(84960586, 'init', {
clickmap: true,
trackLinks: true,
accurateTrackBounce: true,
webvisor: true,
})
</script>
<!-- Start of ixshelp Zendesk Widget script -->
<script id="ze-snippet"
src="https://static.zdassets.com/ekr/snippet.js?key=4d547246-9c3f-4783-bbfa-13a71f7344e5"></script>
<!-- End of ixshelp Zendesk Widget script -->

<noscript>
<div><img src="https://mc.yandex.ru/watch/84960586" style="position: absolute; left: -9999px" alt="" /></div>
</noscript>
<!-- /Yandex.Metrika counter -->

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-199572024-1"></script>
<script>
window.dataLayer = window.dataLayer || []
function gtag() {
dataLayer.push(arguments)
}
gtag('js', new Date())

gtag('config', 'UA-199572024-1')
</script>
<!-- /Global site tag (gtag.js) - Google Analytics -->

<noscript>You need to enable JavaScript to run this app.</noscript>

<!-- The root is the container of the app -->
<div id="root">
<!-- Triggers the font to load immediately and then is replaced by the app -->
<div style="visibility: hidden">X</div>
</div>
<div id="fake-approval"></div>

<!--
<!-- Google Tag Manager -->
<script>
;(function (w, d, s, l, i) {
w[l] = w[l] || []
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js',
})
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : ''
j.async = true
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl
f.parentNode.insertBefore(j, f)
})(window, document, 'script', 'dataLayer', 'GTM-NXWCR4X')
</script>
<!-- End Google Tag Manager -->
<!-- <title>IX Swap</title> -->

<script>
var script = document.createElement('script')
// script.src = 'https://tag.safary.club/stag-0.1.5.js'
script.defer = true
script.setAttribute('data-name', 'safary-sdk')
script.setAttribute('data-product-id', 'prd_z2suvagAL5')
script.integrity = 'sha256-sFvG3ANXkfEJBbfj+oozHwPgzQSoq4uDCv3xrLblnmM='
script.crossOrigin = 'anonymous'
var target = document.head || document.body
target.appendChild(script)
</script>

<!-- End Safary Tag Manager -->
</head>

<body style="overflow: auto !important; margin-right: 0 !important">
<!-- Google Tag Manager (noscript) -->
<noscript
><iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-NXWCR4X"
height="0"
width="0"
style="display: none; visibility: hidden"
></iframe
></noscript>
<!-- End Google Tag Manager (noscript) -->

<!-- Yandex.Metrika counter -->
<!-- <script type="text/javascript"> -->
<!-- ;(function (m, e, t, r, i, k, a) { -->
<!-- m[i] = -->
<!-- m[i] || -->
<!-- function () { -->
<!-- ;(m[i].a = m[i].a || []).push(arguments) -->
<!-- } -->
<!-- m[i].l = 1 * new Date() -->
<!-- ;(k = e.createElement(t)), -->
<!-- (a = e.getElementsByTagName(t)[0]), -->
<!-- (k.async = 1), -->
<!-- (k.src = r), -->
<!-- a.parentNode.insertBefore(k, a) -->
<!-- })(window, document, 'script', 'https://mc.yandex.ru/metrika/tag.js', 'ym') -->

<!-- ym(84960586, 'init', { -->
<!-- clickmap: true, -->
<!-- trackLinks: true, -->
<!-- accurateTrackBounce: true, -->
<!-- webvisor: true, -->
<!-- }) -->
<!-- </script> -->
<!-- Start of ixshelp Zendesk Widget script -->
<script
id="ze-snippet"
src="https://static.zdassets.com/ekr/snippet.js?key=4d547246-9c3f-4783-bbfa-13a71f7344e5"
></script>
<!-- End of ixshelp Zendesk Widget script -->

<!-- <noscript> -->
<!-- <div><img src="https://mc.yandex.ru/watch/84960586" style="position: absolute; left: -9999px" alt="" /></div> -->
<!-- </noscript> -->
<!-- /Yandex.Metrika counter -->

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-199572024-1"></script>
<script>
window.dataLayer = window.dataLayer || []
function gtag() {
dataLayer.push(arguments)
}
gtag('js', new Date())

gtag('config', 'UA-199572024-1')
</script>
<!-- /Global site tag (gtag.js) - Google Analytics -->

<noscript>You need to enable JavaScript to run this app.</noscript>

<!-- The root is the container of the app -->
<div id="root">
<!-- Triggers the font to load immediately and then is replaced by the app -->
<div style="visibility: hidden">X</div>
</div>
<div id="fake-approval"></div>

<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand All @@ -131,6 +138,6 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</body>
</html>

</html>
4 changes: 1 addition & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
<MuiThemeProvider>
<LocalizationProvider dateAdapter={DayJsUtils}>
<CookiesProvider>
<LiffProvider>
<App />
</LiffProvider>
<App />
<ToastContainer />
</CookiesProvider>
</LocalizationProvider>
Expand Down
56 changes: 56 additions & 0 deletions src/pages/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import SignMessageModal from 'components/SignMessageModal'
import useQuery from 'hooks/useQuery'
import { setJumpTaskState } from 'state/jumpTask'
import { CHAINS } from 'components/Web3Provider/constants'
import liff from '@line/liff'

const chains = CHAINS ? CHAINS.map((chain) => chain.id) : []
const lbpAdminRoutes = [routes.lbpCreate, routes.lbpEdit, routes.lbpDashboard, routes.adminDetails]
Expand All @@ -61,6 +62,13 @@ const initSafary = () => {
document.head.appendChild(script)
}

// Clean URL parameters
const cleanUrlParameters = () => {
const url = new URL(window.location.href)
url.searchParams.delete('mst_challenge')
window.history.replaceState({}, document.title, url.pathname + url.search)
}

export default function App() {
const getMe = useGetMe()
const { isAdmin } = useRole()
Expand All @@ -82,6 +90,8 @@ export default function App() {

const [countryCode, setCountryCode] = useState()

const [isLiffReady, setIsLiffReady] = useState(false)

const transactionId = query.get('transaction_id')
const affUnique1 = query.get('aff_unique1')
const isIxSwap = whiteLabelConfig?.isIxSwap ?? false
Expand Down Expand Up @@ -144,6 +154,47 @@ export default function App() {
return (config?.pages ?? []).length > 0 ? config?.pages[0] : defaultPath
}, [kyc, account, chainId, isWhitelisted, chains])

useEffect(() => {
const initLiff = async () => {
liff
.init({ liffId: '2006746651-DmRwZed0' })
.then(() => {
console.log('LIFF initialization is done')
console.log(liff.getAppLanguage())
console.log(liff.getVersion())
console.log(liff.isInClient())
console.log(liff.isLoggedIn())
console.log(liff.getOS())
console.log(liff.getLineVersion())

setIsLiffReady(true) // Ensure LIFF initialization is complete
})
.catch((error: any) => {
console.error(`LIFF initialization failed: ${error}`)
})
}

initLiff()
}, [])

// useEffect(() => {
// const checkLoginStatus = async () => {
// if (!liff.isLoggedIn()) {
// liff.login() // Redirect to LINE login
// } else {
// const profile = await liff.getProfile()
// console.log('Logged in user profile:', profile)
// }
// }

// checkLoginStatus()
// }, [])

if (!isLiffReady) {
// Optional: Render a loading screen while LIFF initializes
return <LoadingIndicator isLoading />
}

const isAdminKyc = pathname.includes('admin')
const isWhiteBackground =
pathname === routes.launchpad ||
Expand Down Expand Up @@ -229,6 +280,11 @@ export default function App() {
initSafary()
}, [])

useEffect(() => {
// Clean up URL parameters
cleanUrlParameters()
}, [])

useEffect(() => {
if (transactionId) {
dispatch(setJumpTaskState({ transactionId }))
Expand Down
2 changes: 1 addition & 1 deletion src/pages/LiffProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const LiffProvider: React.FC<LiffProviderProps> = ({ children }) => {

useEffect(() => {
liff
.init({ liffId: '2006732958-EAK9vggN' })
.init({ liffId: '2006746651-DmRwZed0' })
.then(() => {
console.log('LIFF initialization is done')
setLiffObject(liff)
Expand Down

0 comments on commit fc69f5e

Please sign in to comment.