@xylabs/sdk-react 2.10.5 → 2.11.2

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.
Files changed (118) hide show
  1. package/dist/WithChildren.d.ts +4 -0
  2. package/dist/WithChildren.js +2 -0
  3. package/dist/WithChildren.js.map +1 -0
  4. package/dist/cjs5/WithChildren.d.ts +4 -0
  5. package/dist/cjs5/components/InvertableThemeProvider/InvertableThemeProviderProps.d.ts +2 -0
  6. package/dist/cjs5/components/Pixel/PixelDebuggerProvider.d.ts +2 -1
  7. package/dist/cjs5/contexts/CookieConsent/Loader.d.ts +2 -1
  8. package/dist/cjs5/contexts/Ethers/Loader.d.ts +4 -4
  9. package/dist/cjs5/contexts/NetworkSettings/Loader.d.ts +4 -4
  10. package/dist/cjs5/contexts/UserEvents/Provider.d.ts +4 -4
  11. package/dist/cjs5/index.d.ts +1 -0
  12. package/dist/cjs5/index.js +19 -4
  13. package/dist/cjs5/index.js.map +1 -1
  14. package/dist/components/InvertableThemeProvider/InvertableThemeProviderProps.d.ts +2 -0
  15. package/dist/components/Pixel/PixelDebuggerProvider.d.ts +2 -1
  16. package/dist/components/Pixel/PixelDebuggerProvider.js.map +1 -1
  17. package/dist/contexts/CookieConsent/Loader.d.ts +2 -1
  18. package/dist/contexts/CookieConsent/Loader.js.map +1 -1
  19. package/dist/contexts/Ethers/Loader.d.ts +4 -4
  20. package/dist/contexts/Ethers/Loader.js.map +1 -1
  21. package/dist/contexts/NetworkSettings/Loader.d.ts +4 -4
  22. package/dist/contexts/NetworkSettings/Loader.js.map +1 -1
  23. package/dist/contexts/UserEvents/Provider.d.ts +4 -4
  24. package/dist/contexts/UserEvents/Provider.js +1 -1
  25. package/dist/contexts/UserEvents/Provider.js.map +1 -1
  26. package/dist/esm2015/WithChildren.d.ts +4 -0
  27. package/dist/esm2015/components/InvertableThemeProvider/InvertableThemeProviderProps.d.ts +2 -0
  28. package/dist/esm2015/components/Pixel/PixelDebuggerProvider.d.ts +2 -1
  29. package/dist/esm2015/contexts/CookieConsent/Loader.d.ts +2 -1
  30. package/dist/esm2015/contexts/Ethers/Loader.d.ts +4 -4
  31. package/dist/esm2015/contexts/NetworkSettings/Loader.d.ts +4 -4
  32. package/dist/esm2015/contexts/UserEvents/Provider.d.ts +4 -4
  33. package/dist/esm2015/index.d.ts +1 -0
  34. package/dist/esm2015/index.js +19 -4
  35. package/dist/esm2015/index.js.map +1 -1
  36. package/dist/esm2017/WithChildren.d.ts +4 -0
  37. package/dist/esm2017/components/InvertableThemeProvider/InvertableThemeProviderProps.d.ts +2 -0
  38. package/dist/esm2017/components/Pixel/PixelDebuggerProvider.d.ts +2 -1
  39. package/dist/esm2017/contexts/CookieConsent/Loader.d.ts +2 -1
  40. package/dist/esm2017/contexts/Ethers/Loader.d.ts +4 -4
  41. package/dist/esm2017/contexts/NetworkSettings/Loader.d.ts +4 -4
  42. package/dist/esm2017/contexts/UserEvents/Provider.d.ts +4 -4
  43. package/dist/esm2017/index.d.ts +1 -0
  44. package/dist/esm2017/index.js +19 -4
  45. package/dist/esm2017/index.js.map +1 -1
  46. package/dist/esm5/WithChildren.d.ts +4 -0
  47. package/dist/esm5/components/InvertableThemeProvider/InvertableThemeProviderProps.d.ts +2 -0
  48. package/dist/esm5/components/Pixel/PixelDebuggerProvider.d.ts +2 -1
  49. package/dist/esm5/contexts/CookieConsent/Loader.d.ts +2 -1
  50. package/dist/esm5/contexts/Ethers/Loader.d.ts +4 -4
  51. package/dist/esm5/contexts/NetworkSettings/Loader.d.ts +4 -4
  52. package/dist/esm5/contexts/UserEvents/Provider.d.ts +4 -4
  53. package/dist/esm5/index.d.ts +1 -0
  54. package/dist/esm5/index.js +19 -4
  55. package/dist/esm5/index.js.map +1 -1
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.js +1 -0
  58. package/dist/index.js.map +1 -1
  59. package/dist/lib/Tracking/Drip/BaseEvent.js +4 -1
  60. package/dist/lib/Tracking/Drip/BaseEvent.js.map +1 -1
  61. package/dist/lib/Tracking/Facebook/Fbq.js +2 -1
  62. package/dist/lib/Tracking/Facebook/Fbq.js.map +1 -1
  63. package/dist/lib/Tracking/Google/Gtag.js +4 -1
  64. package/dist/lib/Tracking/Google/Gtag.js.map +1 -1
  65. package/dist/lib/Tracking/Reddit/Rdt.js +2 -1
  66. package/dist/lib/Tracking/Reddit/Rdt.js.map +1 -1
  67. package/dist/lib/Tracking/Snapchat/Snaptr.js +2 -1
  68. package/dist/lib/Tracking/Snapchat/Snaptr.js.map +1 -1
  69. package/dist/lib/Tracking/Tapjoy/EF.js +2 -1
  70. package/dist/lib/Tracking/Tapjoy/EF.js.map +1 -1
  71. package/dist/lib/Tracking/Tiktok/Ttq.js +2 -1
  72. package/dist/lib/Tracking/Tiktok/Ttq.js.map +1 -1
  73. package/dist/node/WithChildren.d.ts +4 -0
  74. package/dist/node/components/InvertableThemeProvider/InvertableThemeProviderProps.d.ts +2 -0
  75. package/dist/node/components/Pixel/PixelDebuggerProvider.d.ts +2 -1
  76. package/dist/node/contexts/CookieConsent/Loader.d.ts +2 -1
  77. package/dist/node/contexts/Ethers/Loader.d.ts +4 -4
  78. package/dist/node/contexts/NetworkSettings/Loader.d.ts +4 -4
  79. package/dist/node/contexts/UserEvents/Provider.d.ts +4 -4
  80. package/dist/node/index.d.ts +1 -0
  81. package/dist/node/index.js +19 -4
  82. package/dist/node/index.js.map +1 -1
  83. package/dist/node-esm/WithChildren.d.ts +4 -0
  84. package/dist/node-esm/components/InvertableThemeProvider/InvertableThemeProviderProps.d.ts +2 -0
  85. package/dist/node-esm/components/Pixel/PixelDebuggerProvider.d.ts +2 -1
  86. package/dist/node-esm/contexts/CookieConsent/Loader.d.ts +2 -1
  87. package/dist/node-esm/contexts/Ethers/Loader.d.ts +4 -4
  88. package/dist/node-esm/contexts/NetworkSettings/Loader.d.ts +4 -4
  89. package/dist/node-esm/contexts/UserEvents/Provider.d.ts +4 -4
  90. package/dist/node-esm/index.d.ts +1 -0
  91. package/dist/node-esm/index.js +19 -4
  92. package/dist/node-esm/index.js.map +1 -1
  93. package/package.json +18 -11
  94. package/src/WithChildren.ts +3 -0
  95. package/src/components/InvertableThemeProvider/InvertableThemeProviderProps.ts +2 -0
  96. package/src/components/Pixel/PixelDebuggerProvider.tsx +2 -1
  97. package/src/contexts/CookieConsent/Loader.tsx +2 -1
  98. package/src/contexts/Ethers/Loader.tsx +5 -2
  99. package/src/contexts/NetworkSettings/Loader.tsx +3 -3
  100. package/src/contexts/UserEvents/Provider.tsx +6 -3
  101. package/src/index.ts +1 -0
  102. package/src/lib/Tracking/Drip/BaseEvent.ts +4 -2
  103. package/src/lib/Tracking/Facebook/Fbq.ts +2 -2
  104. package/src/lib/Tracking/Google/Gtag.ts +4 -2
  105. package/src/lib/Tracking/Reddit/Rdt.ts +2 -2
  106. package/src/lib/Tracking/Snapchat/Snaptr.ts +2 -2
  107. package/src/lib/Tracking/Tapjoy/EF.ts +2 -1
  108. package/src/lib/Tracking/Tiktok/Ttq.ts +2 -2
  109. package/dist/cjs5/lib/global.d.ts +0 -2
  110. package/dist/esm2015/lib/global.d.ts +0 -2
  111. package/dist/esm2017/lib/global.d.ts +0 -2
  112. package/dist/esm5/lib/global.d.ts +0 -2
  113. package/dist/lib/global.d.ts +0 -2
  114. package/dist/lib/global.js +0 -4
  115. package/dist/lib/global.js.map +0 -1
  116. package/dist/node/lib/global.d.ts +0 -2
  117. package/dist/node-esm/lib/global.d.ts +0 -2
  118. package/src/lib/global.ts +0 -4
package/package.json CHANGED
@@ -9,13 +9,13 @@
9
9
  "url": "https://github.com/xylabs/sdk-react/issues"
10
10
  },
11
11
  "dependencies": {
12
- "@emotion/react": "^11.8.2",
12
+ "@emotion/react": "^11.9.0",
13
13
  "@emotion/styled": "^11.8.1",
14
14
  "@ethersproject/abstract-signer": "^5.6.0",
15
15
  "@ethersproject/providers": "^5.6.2",
16
- "@mui/icons-material": "^5.5.1",
17
- "@mui/material": "^5.5.3",
18
- "@mui/styles": "^5.5.3",
16
+ "@mui/icons-material": "^5.6.0",
17
+ "@mui/material": "^5.6.0",
18
+ "@mui/styles": "^5.6.0",
19
19
  "@xylabs/pixel": "^1.3.7",
20
20
  "@xylabs/sdk-js": "^2.4.3",
21
21
  "axios": "^0.26.1",
@@ -24,15 +24,13 @@
24
24
  "md5": "^2.3.0",
25
25
  "numeral": "^2.0.6",
26
26
  "query-string": "^7.1.1",
27
- "react": "^17.0.2",
28
- "react-dom": "^17.0.2",
29
27
  "react-helmet": "^6.1.0",
30
28
  "react-icons": "^4.3.1",
31
29
  "react-router-dom": "^6.3.0"
32
30
  },
33
31
  "description": "Common React library for all XY Labs projects that use React",
34
32
  "devDependencies": {
35
- "@babel/core": "^7.17.8",
33
+ "@babel/core": "^7.17.9",
36
34
  "@rollup/plugin-image": "^2.1.1",
37
35
  "@rollup/plugin-json": "^4.1.0",
38
36
  "@rollup/plugin-replace": "^4.0.0",
@@ -50,8 +48,7 @@
50
48
  "@types/md5": "^2.3.2",
51
49
  "@types/node": "^17.0.23",
52
50
  "@types/numeral": "^2.0.2",
53
- "@types/react": "^17.0.43",
54
- "@types/react-dom": "^17.0.14",
51
+ "@types/react-dom": "^18.0.0",
55
52
  "@types/react-helmet": "^6.1.5",
56
53
  "@xylabs/eslint-config-react": "^2.1.3",
57
54
  "@xylabs/rollup-config": "^1.1.15",
@@ -64,6 +61,8 @@
64
61
  "eslint-plugin-react": "^7.29.4",
65
62
  "eslint-plugin-react-hooks": "^4.4.0",
66
63
  "prettier": "^2.6.2",
64
+ "react": "^18.0.0",
65
+ "react-dom": "^18.0.0",
67
66
  "rimraf": "^3.0.2",
68
67
  "rollbar": "^2.24.1",
69
68
  "rollup": "^2.70.1",
@@ -71,7 +70,15 @@
71
70
  "ts-node": "^10.7.0",
72
71
  "tslib": "^2.3.1",
73
72
  "typescript": "^4.6.3",
74
- "webpack": "^5.71.0"
73
+ "webpack": "^5.72.0"
74
+ },
75
+ "peerDependencies": {
76
+ "react": "^17",
77
+ "react-dom": "^17"
78
+ },
79
+ "resolutions": {
80
+ "react": "^18",
81
+ "react-dom": "^18"
75
82
  },
76
83
  "esm5": "dist/esm5/index.js",
77
84
  "exports": {
@@ -111,6 +118,6 @@
111
118
  },
112
119
  "sideEffects": false,
113
120
  "types": "dist/index.d.ts",
114
- "version": "2.10.5",
121
+ "version": "2.11.2",
115
122
  "packageManager": "yarn@3.1.1"
116
123
  }
@@ -0,0 +1,3 @@
1
+ import { ReactNode } from 'react'
2
+
3
+ export type WithChildren<T = unknown> = T & { children?: ReactNode }
@@ -1,4 +1,5 @@
1
1
  import { ThemeOptions } from '@mui/material'
2
+ import { ReactNode } from 'react'
2
3
 
3
4
  interface InvertableThemeProviderProps {
4
5
  dark?: boolean
@@ -13,6 +14,7 @@ interface InvertableThemeProviderProps {
13
14
  darkOptions?: ThemeOptions
14
15
  lightOptions?: ThemeOptions
15
16
  resolve?: boolean
17
+ children?: ReactNode
16
18
  }
17
19
 
18
20
  export type { InvertableThemeProviderProps }
@@ -1,7 +1,8 @@
1
1
  import { DebugUserEventsContext } from '../../contexts'
2
2
  import { useLocalStorage } from '../../hooks'
3
+ import { WithChildren } from '../../WithChildren'
3
4
 
4
- export const PixelDebuggerProvider: React.FC = ({ children }) => {
5
+ export const PixelDebuggerProvider: React.FC<WithChildren> = ({ children }) => {
5
6
  const [isDebugging, setIsDebugging] = useLocalStorage<boolean>('isDebuggingPixel', false)
6
7
  return (
7
8
  <DebugUserEventsContext.Provider value={{ isDebugging, setIsDebugging }}>
@@ -1,10 +1,11 @@
1
1
  import { useState } from 'react'
2
2
 
3
+ import { WithChildren } from '../../WithChildren'
3
4
  import { CookieConsentContext } from './Context'
4
5
 
5
6
  const CookiesAcceptedLocalStorageName = 'CookiesAccepted'
6
7
 
7
- const CookieConsentLoader: React.FC = ({ children }) => {
8
+ const CookieConsentLoader: React.FC<WithChildren> = ({ children }) => {
8
9
  const getAcceptedFromLocalStorage = () => {
9
10
  return localStorage.getItem(CookiesAcceptedLocalStorageName) === 'true'
10
11
  }
@@ -1,14 +1,17 @@
1
+ import { ReactNode } from 'react'
2
+
1
3
  import { InfuraEthersLoader } from './Infura'
2
4
  import { MetaMaskEthersLoader } from './MetaMask'
3
5
  import { MyEtherWalletEthersLoader } from './MyEtherWallet'
4
6
  import { OperaEthersLoader } from './Opera'
5
7
  import { TrustEthersLoader } from './Trust'
6
8
 
7
- interface Props {
9
+ export interface EthersLoaderProps {
8
10
  enabled?: boolean
11
+ children?: ReactNode
9
12
  }
10
13
 
11
- export const EthersLoader: React.FC<Props> = (props) => {
14
+ export const EthersLoader: React.FC<EthersLoaderProps> = (props) => {
12
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
16
  const global = window as any
14
17
  const { children } = props
@@ -1,13 +1,13 @@
1
1
  import { EthAddress } from '@xylabs/sdk-js'
2
- import React from 'react'
3
2
 
3
+ import { WithChildren } from '../../WithChildren'
4
4
  import { NetworkSettingsContext } from './Context'
5
5
 
6
- interface Props {
6
+ export interface NetworkSettingsLoaderProps {
7
7
  enabled?: boolean
8
8
  }
9
9
 
10
- export const NetworkSettingsLoader: React.FC<Props> = (props) => {
10
+ export const NetworkSettingsLoader: React.FC<WithChildren<NetworkSettingsLoaderProps>> = (props) => {
11
11
  const { children } = props
12
12
 
13
13
  return (
@@ -1,14 +1,17 @@
1
1
  import { UserEventHandler } from '@xylabs/pixel'
2
- import React from 'react'
3
2
 
4
3
  import { XyoUserEventHandler } from '../../lib'
4
+ import { WithChildren } from '../../WithChildren'
5
5
  import { UserEventsContext } from './Context'
6
6
 
7
- interface Props<T> {
7
+ export interface UserEventsProviderProps<T> {
8
8
  userEvents: UserEventHandler<T>
9
9
  }
10
10
 
11
- export const UserEventsProvider: React.FC<Props<unknown>> = ({ userEvents, children }) => {
11
+ export const UserEventsProvider: React.FC<WithChildren<UserEventsProviderProps<unknown>>> = ({
12
+ userEvents,
13
+ children,
14
+ }) => {
12
15
  return (
13
16
  <UserEventsContext.Provider value={{ userEvents: userEvents ?? XyoUserEventHandler.get() }}>
14
17
  {children}
package/src/index.ts CHANGED
@@ -2,3 +2,4 @@ export * from './components'
2
2
  export * from './contexts'
3
3
  export * from './hooks'
4
4
  export * from './lib'
5
+ export * from './WithChildren'
@@ -1,7 +1,5 @@
1
1
  import { delay } from '@xylabs/sdk-js'
2
2
 
3
- import { global } from '../../global'
4
-
5
3
  type DripEvent<T extends Record<string, unknown>> = (string | T)[]
6
4
 
7
5
  class DripBaseEvent<T extends Record<string, unknown>> {
@@ -27,6 +25,8 @@ class DripBaseEvent<T extends Record<string, unknown>> {
27
25
  }
28
26
 
29
27
  private getDcq() {
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ const global = window as any
30
30
  if (!global._dcq) {
31
31
  throw Error('DCQ not found')
32
32
  }
@@ -34,6 +34,8 @@ class DripBaseEvent<T extends Record<string, unknown>> {
34
34
  }
35
35
 
36
36
  private getDcs() {
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ const global = window as any
37
39
  if (!global._dcs) {
38
40
  throw Error('DCS not found')
39
41
  }
@@ -1,11 +1,11 @@
1
- import { global } from '../../global'
2
-
3
1
  class Fbq {
4
2
  public pixelId?: string
5
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
4
  public fbq?: any
7
5
 
8
6
  private constructor(pixelId: string) {
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ const global = window as any
9
9
  this.pixelId = pixelId
10
10
 
11
11
  this.fbq = function () {
@@ -1,8 +1,6 @@
1
1
  import { assertEx } from '@xylabs/sdk-js'
2
2
  import { parse, stringify } from 'query-string'
3
3
 
4
- import { global } from '../../global'
5
-
6
4
  class Gtag {
7
5
  public updatePagePath(page_path: string) {
8
6
  const ga4id = assertEx(this.ga4id, 'Missing GA4ID')
@@ -21,6 +19,8 @@ class Gtag {
21
19
  this.ga4id = ga4id
22
20
  this.awid = awid
23
21
  this.domains = domains
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
+ const global = window as any
24
24
  global.dataLayer = global.dataLayer ?? []
25
25
  this.gtag =
26
26
  global.gtag ??
@@ -59,6 +59,8 @@ class Gtag {
59
59
  }
60
60
 
61
61
  public static clearDataLayer() {
62
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
+ const global = window as any
62
64
  const dataLayer = global.dataLayer as []
63
65
  dataLayer.length = 0
64
66
  }
@@ -1,5 +1,3 @@
1
- import { global } from '../../global'
2
-
3
1
  class Rdt {
4
2
  public static instance: Rdt
5
3
  public static init(pixelId: string) {
@@ -13,6 +11,8 @@ class Rdt {
13
11
  }
14
12
 
15
13
  private static getRdt() {
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ const global = window as any
16
16
  if (global.rdt) {
17
17
  return global.rdt
18
18
  }
@@ -1,9 +1,9 @@
1
1
  import { delay } from '@xylabs/sdk-js'
2
2
 
3
- import { global } from '../../global'
4
-
5
3
  class SnapTr {
6
4
  public static getSnapTr() {
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const global = window as any
7
7
  if (global.snaptr) {
8
8
  return global.snaptr
9
9
  }
@@ -1,4 +1,3 @@
1
- import { global } from '../../global'
2
1
  class EF {
3
2
  public static instance: EF
4
3
  public static init() {
@@ -9,6 +8,8 @@ class EF {
9
8
  }
10
9
  }
11
10
  public static getEF() {
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ const global = window as any
12
13
  if (global.EF) {
13
14
  return global.EF
14
15
  }
@@ -1,5 +1,3 @@
1
- import { global } from '../../global'
2
-
3
1
  class Ttq {
4
2
  public static instance: Ttq
5
3
  public static init(pixelId: string) {
@@ -13,6 +11,8 @@ class Ttq {
13
11
  }
14
12
 
15
13
  public static getTtq() {
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ const global = window as any
16
16
  if (global.ttq) {
17
17
  return global.ttq
18
18
  }
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,4 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
- const global = window;
3
- export { global };
4
- //# sourceMappingURL=global.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"global.js","sourceRoot":"","sources":["../../src/lib/global.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,MAAM,GAAG,MAAa,CAAA;AAE5B,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
package/src/lib/global.ts DELETED
@@ -1,4 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
- const global = window as any
3
-
4
- export { global }