@xylabs/sdk-react 2.7.22 → 2.7.26
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.
- package/dist/components/Experiments/Experiments.d.ts +0 -1
- package/dist/components/Experiments/Experiments.js +46 -25
- package/dist/components/Experiments/Experiments.js.map +1 -1
- package/dist/components/InvertableThemeProvider/InvertableThemeContext.d.ts +2 -2
- package/dist/components/InvertableThemeProvider/InvertableThemeContext.js +2 -2
- package/dist/components/InvertableThemeProvider/InvertableThemeContext.js.map +1 -1
- package/dist/components/QuickTipButton/QuickTipButton.js +2 -2
- package/dist/components/QuickTipButton/QuickTipButton.js.map +1 -1
- package/dist/contexts/CookieConsent/Loader.js +2 -2
- package/dist/contexts/CookieConsent/Loader.js.map +1 -1
- package/dist/contexts/Ethers/Context.d.ts +2 -2
- package/dist/contexts/Ethers/Context.js +2 -2
- package/dist/contexts/Ethers/Context.js.map +1 -1
- package/dist/contexts/Ethers/MetaMask.js +10 -10
- package/dist/contexts/Ethers/MetaMask.js.map +1 -1
- package/dist/contexts/Ethers/MyEtherWallet.js +9 -9
- package/dist/contexts/Ethers/MyEtherWallet.js.map +1 -1
- package/dist/contexts/Ethers/Opera.d.ts +1 -1
- package/dist/contexts/Ethers/Opera.js +40 -45
- package/dist/contexts/Ethers/Opera.js.map +1 -1
- package/dist/contexts/Ethers/Trust.d.ts +1 -1
- package/dist/contexts/Ethers/Trust.js +31 -36
- package/dist/contexts/Ethers/Trust.js.map +1 -1
- package/dist/contexts/NetworkSettings/Context.d.ts +2 -2
- package/dist/contexts/NetworkSettings/Context.js +2 -2
- package/dist/contexts/NetworkSettings/Context.js.map +1 -1
- package/dist/contexts/UserEvents/Context.d.ts +2 -2
- package/dist/contexts/UserEvents/Context.js +2 -2
- package/dist/contexts/UserEvents/Context.js.map +1 -1
- package/dist/esm2017/components/Experiments/Experiments.d.ts +0 -1
- package/dist/esm2017/components/InvertableThemeProvider/InvertableThemeContext.d.ts +2 -2
- package/dist/esm2017/contexts/Ethers/Context.d.ts +2 -2
- package/dist/esm2017/contexts/Ethers/Opera.d.ts +1 -1
- package/dist/esm2017/contexts/Ethers/Trust.d.ts +1 -1
- package/dist/esm2017/contexts/NetworkSettings/Context.d.ts +2 -2
- package/dist/esm2017/contexts/UserEvents/Context.d.ts +2 -2
- package/dist/esm2017/index.js +193 -225
- package/dist/esm2017/index.js.map +1 -1
- package/dist/esm2017/lib/Tracking/Facebook/Fbq.d.ts +2 -2
- package/dist/esm2017/lib/Tracking/Reddit/Rdt.d.ts +1 -1
- package/dist/esm2017/lib/Tracking/Snapchat/Snaptr.d.ts +1 -1
- package/dist/esm2017/lib/Tracking/Tiktok/Ttq.d.ts +2 -2
- package/dist/esm5/components/Experiments/Experiments.d.ts +0 -1
- package/dist/esm5/components/InvertableThemeProvider/InvertableThemeContext.d.ts +2 -2
- package/dist/esm5/contexts/Ethers/Context.d.ts +2 -2
- package/dist/esm5/contexts/Ethers/Opera.d.ts +1 -1
- package/dist/esm5/contexts/Ethers/Trust.d.ts +1 -1
- package/dist/esm5/contexts/NetworkSettings/Context.d.ts +2 -2
- package/dist/esm5/contexts/UserEvents/Context.d.ts +2 -2
- package/dist/esm5/index.js +193 -225
- package/dist/esm5/index.js.map +1 -1
- package/dist/esm5/lib/Tracking/Facebook/Fbq.d.ts +2 -2
- package/dist/esm5/lib/Tracking/Reddit/Rdt.d.ts +1 -1
- package/dist/esm5/lib/Tracking/Snapchat/Snaptr.d.ts +1 -1
- package/dist/esm5/lib/Tracking/Tiktok/Ttq.d.ts +2 -2
- package/dist/hooks/useMounted.js +2 -1
- package/dist/hooks/useMounted.js.map +1 -1
- package/dist/hooks/useWebP.js +2 -2
- package/dist/hooks/useWebP.js.map +1 -1
- package/dist/hooks/useWindowSize.js +3 -2
- package/dist/hooks/useWindowSize.js.map +1 -1
- package/dist/lib/Tracking/Facebook/Fbq.d.ts +2 -2
- package/dist/lib/Tracking/Facebook/Fbq.js +3 -26
- package/dist/lib/Tracking/Facebook/Fbq.js.map +1 -1
- package/dist/lib/Tracking/Reddit/Rdt.d.ts +1 -1
- package/dist/lib/Tracking/Reddit/Rdt.js +7 -21
- package/dist/lib/Tracking/Reddit/Rdt.js.map +1 -1
- package/dist/lib/Tracking/Snapchat/Snaptr.d.ts +1 -1
- package/dist/lib/Tracking/Snapchat/Snaptr.js +2 -15
- package/dist/lib/Tracking/Snapchat/Snaptr.js.map +1 -1
- package/dist/lib/Tracking/Tiktok/Ttq.d.ts +2 -2
- package/dist/lib/Tracking/Tiktok/Ttq.js +13 -40
- package/dist/lib/Tracking/Tiktok/Ttq.js.map +1 -1
- package/dist/lib/useAsyncEffect.js +5 -1
- package/dist/lib/useAsyncEffect.js.map +1 -1
- package/dist/node/components/Experiments/Experiments.d.ts +0 -1
- package/dist/node/components/InvertableThemeProvider/InvertableThemeContext.d.ts +2 -2
- package/dist/node/contexts/Ethers/Context.d.ts +2 -2
- package/dist/node/contexts/Ethers/Opera.d.ts +1 -1
- package/dist/node/contexts/Ethers/Trust.d.ts +1 -1
- package/dist/node/contexts/NetworkSettings/Context.d.ts +2 -2
- package/dist/node/contexts/UserEvents/Context.d.ts +2 -2
- package/dist/node/index.js +207 -240
- package/dist/node/index.js.map +1 -1
- package/dist/node/lib/Tracking/Facebook/Fbq.d.ts +2 -2
- package/dist/node/lib/Tracking/Reddit/Rdt.d.ts +1 -1
- package/dist/node/lib/Tracking/Snapchat/Snaptr.d.ts +1 -1
- package/dist/node/lib/Tracking/Tiktok/Ttq.d.ts +2 -2
- package/dist/node-esm/components/Experiments/Experiments.d.ts +0 -1
- package/dist/node-esm/components/InvertableThemeProvider/InvertableThemeContext.d.ts +2 -2
- package/dist/node-esm/contexts/Ethers/Context.d.ts +2 -2
- package/dist/node-esm/contexts/Ethers/Opera.d.ts +1 -1
- package/dist/node-esm/contexts/Ethers/Trust.d.ts +1 -1
- package/dist/node-esm/contexts/NetworkSettings/Context.d.ts +2 -2
- package/dist/node-esm/contexts/UserEvents/Context.d.ts +2 -2
- package/dist/node-esm/index.js +193 -225
- package/dist/node-esm/index.js.map +1 -1
- package/dist/node-esm/lib/Tracking/Facebook/Fbq.d.ts +2 -2
- package/dist/node-esm/lib/Tracking/Reddit/Rdt.d.ts +1 -1
- package/dist/node-esm/lib/Tracking/Snapchat/Snaptr.d.ts +1 -1
- package/dist/node-esm/lib/Tracking/Tiktok/Ttq.d.ts +2 -2
- package/package.json +10 -10
- package/rollup.config.js +2 -116
- package/src/components/Experiments/Experiments.tsx +7 -9
- package/src/components/InvertableThemeProvider/InvertableThemeContext.tsx +2 -2
- package/src/contexts/Ethers/Context.ts +2 -2
- package/src/contexts/Ethers/Opera.tsx +14 -20
- package/src/contexts/Ethers/Trust.tsx +10 -16
- package/src/contexts/NetworkSettings/Context.ts +2 -2
- package/src/contexts/UserEvents/Context.ts +2 -2
- package/src/lib/Tracking/Facebook/Fbq.ts +2 -6
- package/src/lib/Tracking/Reddit/Rdt.ts +1 -4
- package/src/lib/Tracking/Snapchat/Snaptr.ts +1 -4
- package/src/lib/Tracking/Tiktok/Ttq.ts +2 -6
- package/src/lib/useAsyncEffect.tsx +9 -5
- package/xylabs-sdk-react-v2.7.25.tgz +0 -0
- package/index.node.ts +0 -1
- package/index.ts +0 -1
package/rollup.config.js
CHANGED
|
@@ -1,119 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import json from '@rollup/plugin-json'
|
|
3
|
-
import replace from '@rollup/plugin-replace'
|
|
4
|
-
import strip from '@rollup/plugin-strip'
|
|
5
|
-
import typescriptPlugin from '@rollup/plugin-typescript'
|
|
6
|
-
import typescript from 'typescript'
|
|
1
|
+
import { getRollupConfig } from '@xylabs/rollup-config'
|
|
7
2
|
|
|
8
3
|
import pkg from './package.json'
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const BUILD_TARGET_MAGIC_STRING = '__BUILD_TARGET__'
|
|
13
|
-
|
|
14
|
-
function generateBuildTargetReplaceConfig(moduleFormat, languageTarget) {
|
|
15
|
-
let buildTarget = ''
|
|
16
|
-
|
|
17
|
-
switch (moduleFormat.toLowerCase()) {
|
|
18
|
-
case 'esm':
|
|
19
|
-
buildTarget += 'esm'
|
|
20
|
-
break
|
|
21
|
-
case 'cjs':
|
|
22
|
-
buildTarget += 'cjs'
|
|
23
|
-
break
|
|
24
|
-
default:
|
|
25
|
-
throw Error(`unsupported module format ${moduleFormat}. Valid values are esm and cjs.`)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (typeof languageTarget !== 'number') {
|
|
29
|
-
throw Error('languageTarget accepts only number')
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// simplified input validation
|
|
33
|
-
if (languageTarget != 5 && languageTarget < 2015) {
|
|
34
|
-
throw Error(`invalid languageTarget ${languageTarget}. Valid values are 5, 2015, 2016, etc.`)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
buildTarget += languageTarget
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
[BUILD_TARGET_MAGIC_STRING]: buildTarget,
|
|
41
|
-
preventAssignment: true,
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function emitModulePackageFile() {
|
|
46
|
-
return {
|
|
47
|
-
generateBundle() {
|
|
48
|
-
this.emitFile({
|
|
49
|
-
fileName: 'package.json',
|
|
50
|
-
source: '{"type":"module"}',
|
|
51
|
-
type: 'asset',
|
|
52
|
-
})
|
|
53
|
-
},
|
|
54
|
-
name: 'emit-module-package-file',
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const getPlugIns = (outDir) => {
|
|
59
|
-
return [
|
|
60
|
-
image(),
|
|
61
|
-
json(),
|
|
62
|
-
strip({
|
|
63
|
-
functions: ['debugAssert.*'],
|
|
64
|
-
}),
|
|
65
|
-
typescriptPlugin({
|
|
66
|
-
outDir,
|
|
67
|
-
typescript,
|
|
68
|
-
}),
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const browserBuilds = [
|
|
73
|
-
{
|
|
74
|
-
external: (id) => deps.some((dep) => id === dep || id.startsWith(`${dep}/`)),
|
|
75
|
-
input: {
|
|
76
|
-
index: './src/index.ts',
|
|
77
|
-
},
|
|
78
|
-
output: [{ dir: './dist/esm5', format: 'es', sourcemap: true }],
|
|
79
|
-
plugins: [...getPlugIns('./dist/esm5'), replace(generateBuildTargetReplaceConfig('esm', 5))],
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
external: (id) => deps.some((dep) => id === dep || id.startsWith(`${dep}/`)),
|
|
83
|
-
input: {
|
|
84
|
-
index: './src/index.ts',
|
|
85
|
-
},
|
|
86
|
-
output: {
|
|
87
|
-
dir: './dist/esm2017',
|
|
88
|
-
format: 'es',
|
|
89
|
-
sourcemap: true,
|
|
90
|
-
},
|
|
91
|
-
plugins: [...getPlugIns('./dist/esm2017'), replace(generateBuildTargetReplaceConfig('esm', 2017))],
|
|
92
|
-
},
|
|
93
|
-
]
|
|
94
|
-
|
|
95
|
-
const nodeBuilds = [
|
|
96
|
-
{
|
|
97
|
-
external: (id) => deps.some((dep) => id === dep || id.startsWith(`${dep}/`)),
|
|
98
|
-
input: {
|
|
99
|
-
index: './src/index.ts',
|
|
100
|
-
},
|
|
101
|
-
output: [{ dir: './dist/node', format: 'cjs', sourcemap: true }],
|
|
102
|
-
plugins: [...getPlugIns('./dist/node'), replace(generateBuildTargetReplaceConfig('cjs', 5))],
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
external: (id) => deps.some((dep) => id === dep || id.startsWith(`${dep}/`)),
|
|
106
|
-
input: {
|
|
107
|
-
index: './src/index.ts',
|
|
108
|
-
},
|
|
109
|
-
output: [{ dir: './dist/node-esm', format: 'es', sourcemap: true }],
|
|
110
|
-
plugins: [
|
|
111
|
-
...getPlugIns('./dist/node-esm'),
|
|
112
|
-
replace(generateBuildTargetReplaceConfig('esm', 2017)),
|
|
113
|
-
emitModulePackageFile(),
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
]
|
|
117
|
-
|
|
118
|
-
// eslint-disable-next-line import/no-default-export
|
|
119
|
-
export default [...browserBuilds, ...nodeBuilds]
|
|
5
|
+
export default getRollupConfig(pkg)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Log } from '@xylabs/sdk-js'
|
|
1
|
+
import { forget, Log } from '@xylabs/sdk-js'
|
|
2
2
|
import React, { ReactElement, useContext } from 'react'
|
|
3
3
|
|
|
4
4
|
import { UserEventsContext } from '../../contexts'
|
|
5
|
-
import { getLocalStorageObject,
|
|
5
|
+
import { getLocalStorageObject, setLocalStorageObject } from '../../lib'
|
|
6
6
|
import { ExperimentProps } from './Experiment'
|
|
7
7
|
|
|
8
8
|
const defaultLocalStorageKey = 'testData'
|
|
@@ -31,7 +31,6 @@ type Props = {
|
|
|
31
31
|
children: ReactElement<ExperimentProps>[] | ReactElement<ExperimentProps>
|
|
32
32
|
localStorageProp?: string | boolean
|
|
33
33
|
name: string
|
|
34
|
-
testStarted?: () => Promise<void>
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
const missingKeyError = new Error('Experiment Elements must have Keys')
|
|
@@ -61,9 +60,9 @@ const calcTotalWeight = (childList: ReactElement<ExperimentProps>[]) => {
|
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
const Experiments: React.FC<Props> = (props) => {
|
|
64
|
-
const { name, children,
|
|
65
|
-
const
|
|
66
|
-
const { userEvents } =
|
|
63
|
+
const { name, children, localStorageProp = true } = props
|
|
64
|
+
const userEventsContext = useContext(UserEventsContext)
|
|
65
|
+
const { userEvents } = userEventsContext
|
|
67
66
|
loadOutcomes()
|
|
68
67
|
|
|
69
68
|
const localStorageKey = buildLocalStorageKey(localStorageProp)
|
|
@@ -87,9 +86,8 @@ const Experiments: React.FC<Props> = (props) => {
|
|
|
87
86
|
if (localStorageProp !== false) {
|
|
88
87
|
localStorage.setItem(localStorageKey, mergeData(experimentsTestData))
|
|
89
88
|
}
|
|
90
|
-
if (
|
|
91
|
-
userEvents
|
|
92
|
-
testStarted?.()
|
|
89
|
+
if (userEvents) {
|
|
90
|
+
forget(userEvents.testStarted({ name, variation: child.key }))
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
93
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createContext } from 'react'
|
|
2
2
|
|
|
3
3
|
import { InvertableTheme } from './InvertableTheme'
|
|
4
4
|
|
|
5
|
-
const InvertableThemeContext =
|
|
5
|
+
const InvertableThemeContext = createContext<InvertableTheme>({
|
|
6
6
|
options: {},
|
|
7
7
|
})
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
2
2
|
import { Provider } from '@ethersproject/providers'
|
|
3
3
|
import { EthAddress } from '@xylabs/sdk-js'
|
|
4
|
-
import
|
|
4
|
+
import { createContext } from 'react'
|
|
5
5
|
|
|
6
6
|
export interface EthersData {
|
|
7
7
|
busy?: boolean
|
|
@@ -18,4 +18,4 @@ export interface EthersData {
|
|
|
18
18
|
walletProvider?: Provider | null
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export const EthersContext =
|
|
21
|
+
export const EthersContext = createContext<EthersData>({})
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { JsonRpcProvider, JsonRpcSigner, Web3Provider } from '@ethersproject/providers'
|
|
2
2
|
import { EthAddress } from '@xylabs/sdk-js'
|
|
3
|
-
import
|
|
3
|
+
import { PropsWithChildren, useState } from 'react'
|
|
4
4
|
|
|
5
|
+
import { useAsyncEffect } from '../../lib'
|
|
5
6
|
import { EthersContext } from './Context'
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
@@ -23,37 +24,30 @@ export const OperaEthersLoader: React.FC<PropsWithChildren<Props>> = (props) =>
|
|
|
23
24
|
const chainId = ethereum?.chainId ? parseInt(ethereum?.chainId) : 1
|
|
24
25
|
const isConnected = ethereum?.isConnected() ?? false
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const signer = operaProvider.getSigner()
|
|
34
|
-
const load = async () => {
|
|
27
|
+
useAsyncEffect(
|
|
28
|
+
async (mounted) => {
|
|
29
|
+
if (ethereum) {
|
|
30
|
+
ethereum.enable()
|
|
31
|
+
const operaProvider = new Web3Provider(ethereum)
|
|
32
|
+
const provider = operaProvider
|
|
33
|
+
const signer = operaProvider.getSigner()
|
|
35
34
|
try {
|
|
36
35
|
const localAddress = EthAddress.fromString(await signer.getAddress())
|
|
37
36
|
ethereum.autoRefreshOnNetworkChange = false
|
|
38
|
-
if (
|
|
37
|
+
if (mounted()) {
|
|
39
38
|
setSigner(signer)
|
|
40
39
|
setProvider(provider)
|
|
41
40
|
setLocalAddress(localAddress)
|
|
42
41
|
}
|
|
43
42
|
} catch (ex) {
|
|
44
|
-
if (
|
|
43
|
+
if (mounted()) {
|
|
45
44
|
setError(Error(`localAddress: ${ex}`))
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return () => {
|
|
54
|
-
cancelled = true
|
|
55
|
-
}
|
|
56
|
-
}, [ethereum])
|
|
48
|
+
},
|
|
49
|
+
[ethereum]
|
|
50
|
+
)
|
|
57
51
|
|
|
58
52
|
return (
|
|
59
53
|
<EthersContext.Provider
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Web3Provider } from '@ethersproject/providers'
|
|
2
2
|
import { EthAddress } from '@xylabs/sdk-js'
|
|
3
|
-
import
|
|
3
|
+
import { PropsWithChildren, useState } from 'react'
|
|
4
4
|
|
|
5
|
+
import { useAsyncEffect } from '../../lib'
|
|
5
6
|
import { EthersContext } from './Context'
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
@@ -22,30 +23,23 @@ export const TrustEthersLoader: React.FC<PropsWithChildren<Props>> = (props) =>
|
|
|
22
23
|
|
|
23
24
|
const provider = trustProvider
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (signer) {
|
|
29
|
-
const load = async () => {
|
|
26
|
+
useAsyncEffect(
|
|
27
|
+
async (mounted) => {
|
|
28
|
+
if (signer) {
|
|
30
29
|
try {
|
|
31
30
|
const localAddress = EthAddress.fromString(await signer.getAddress())
|
|
32
|
-
if (
|
|
31
|
+
if (mounted()) {
|
|
33
32
|
setLocalAddress(localAddress)
|
|
34
33
|
}
|
|
35
34
|
} catch (ex) {
|
|
36
|
-
if (
|
|
35
|
+
if (mounted()) {
|
|
37
36
|
setError(Error(`localAddress: ${ex}`))
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return () => {
|
|
46
|
-
cancelled = true
|
|
47
|
-
}
|
|
48
|
-
}, [signer])
|
|
40
|
+
},
|
|
41
|
+
[signer]
|
|
42
|
+
)
|
|
49
43
|
|
|
50
44
|
return (
|
|
51
45
|
<EthersContext.Provider
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EthAddress } from '@xylabs/sdk-js'
|
|
2
|
-
import
|
|
2
|
+
import { createContext } from 'react'
|
|
3
3
|
|
|
4
|
-
const NetworkSettingsContext =
|
|
4
|
+
const NetworkSettingsContext = createContext<{
|
|
5
5
|
xyStakingConsensusAddress?: EthAddress
|
|
6
6
|
xyBondAddress?: EthAddress
|
|
7
7
|
xyGovernanceAddress?: EthAddress
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { UserEventHandler } from '@xylabs/pixel'
|
|
2
|
-
import
|
|
2
|
+
import { createContext } from 'react'
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
userEvents?: UserEventHandler<unknown>
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
const UserEventsContext =
|
|
8
|
+
const UserEventsContext = createContext<Props>({})
|
|
9
9
|
export { UserEventsContext }
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { delay } from '@xylabs/sdk-js'
|
|
2
|
-
|
|
3
1
|
import { global } from '../../global'
|
|
4
2
|
|
|
5
3
|
class Fbq {
|
|
@@ -36,18 +34,16 @@ class Fbq {
|
|
|
36
34
|
return this.instance
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
public
|
|
37
|
+
public track(event: string, data: Record<string, unknown>) {
|
|
40
38
|
this.fbq('track', event, {
|
|
41
39
|
...data,
|
|
42
40
|
})
|
|
43
|
-
await delay(0)
|
|
44
41
|
}
|
|
45
42
|
|
|
46
|
-
public
|
|
43
|
+
public trackCustom(event: string, data: Record<string, unknown>) {
|
|
47
44
|
this.fbq('trackCustom', event, {
|
|
48
45
|
...data,
|
|
49
46
|
})
|
|
50
|
-
await delay(0)
|
|
51
47
|
}
|
|
52
48
|
}
|
|
53
49
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { delay } from '@xylabs/sdk-js'
|
|
2
|
-
|
|
3
1
|
import { global } from '../../global'
|
|
4
2
|
|
|
5
3
|
class Rdt {
|
|
@@ -26,12 +24,11 @@ class Rdt {
|
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
public
|
|
27
|
+
public track(event: string, data?: Record<string, unknown>) {
|
|
30
28
|
try {
|
|
31
29
|
Rdt.getRdt()('track', event, {
|
|
32
30
|
...data,
|
|
33
31
|
})
|
|
34
|
-
await delay(0)
|
|
35
32
|
} catch (ex) {
|
|
36
33
|
console.error(ex)
|
|
37
34
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { delay } from '@xylabs/sdk-js'
|
|
2
|
-
|
|
3
1
|
import { global } from '../../global'
|
|
4
2
|
|
|
5
3
|
class SnapTr {
|
|
@@ -15,10 +13,9 @@ class SnapTr {
|
|
|
15
13
|
this.track('PAGE_VIEW')
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
public static
|
|
16
|
+
public static track<T>(event: string, data?: T) {
|
|
19
17
|
this.getSnapTr()('init', this.pixelId)
|
|
20
18
|
this.getSnapTr()('track', event, data)
|
|
21
|
-
await delay(0)
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
21
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { delay } from '@xylabs/sdk-js'
|
|
2
|
-
|
|
3
1
|
import { global } from '../../global'
|
|
4
2
|
|
|
5
3
|
class Ttq {
|
|
@@ -18,21 +16,19 @@ class Ttq {
|
|
|
18
16
|
return global.ttq
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
public static
|
|
19
|
+
public static page() {
|
|
22
20
|
try {
|
|
23
21
|
Ttq.getTtq().page()
|
|
24
|
-
await delay(0)
|
|
25
22
|
} catch (ex) {
|
|
26
23
|
console.error(`Ttq.page: ${ex}`)
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
public
|
|
27
|
+
public track(event: string, data?: Record<string, unknown>) {
|
|
31
28
|
try {
|
|
32
29
|
Ttq.getTtq().track(event, {
|
|
33
30
|
...data,
|
|
34
31
|
})
|
|
35
|
-
await delay(0)
|
|
36
32
|
} catch (ex) {
|
|
37
33
|
console.error(`Ttq.track: ${ex}`)
|
|
38
34
|
}
|
|
@@ -12,11 +12,15 @@ function useAsyncEffect(effect: EffectFunc, inputs?: unknown[]) {
|
|
|
12
12
|
return mounted
|
|
13
13
|
})
|
|
14
14
|
|
|
15
|
-
Promise.resolve(promise)
|
|
16
|
-
|
|
17
|
-
callback
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
Promise.resolve(promise)
|
|
16
|
+
.then((callback) => {
|
|
17
|
+
if (callback) {
|
|
18
|
+
callback?.()
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
.catch((reason) => {
|
|
22
|
+
console.log(`useAsyncEffect Excepted: ${reason}`)
|
|
23
|
+
})
|
|
20
24
|
|
|
21
25
|
return function () {
|
|
22
26
|
mounted = false
|
|
Binary file
|
package/index.node.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src'
|
package/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src'
|