@xylabs/sdk-react 2.8.2 → 2.9.1

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 (48) hide show
  1. package/dist/components/BasePage/BasePage.js +2 -2
  2. package/dist/components/BasePage/BasePage.js.map +1 -1
  3. package/dist/components/BasePage/BasePage.stories.js +4 -0
  4. package/dist/components/BasePage/BasePage.stories.js.map +1 -1
  5. package/dist/components/BasePage/BasePageProps.d.ts +2 -0
  6. package/dist/components/dialogs/ErrorDialog.d.ts +1 -1
  7. package/dist/components/dialogs/ErrorDialog.js.map +1 -1
  8. package/dist/esm2017/components/BasePage/BasePageProps.d.ts +2 -0
  9. package/dist/esm2017/components/dialogs/ErrorDialog.d.ts +1 -1
  10. package/dist/esm2017/index.js +34 -18
  11. package/dist/esm2017/index.js.map +1 -1
  12. package/dist/esm2017/lib/Tracking/Snapchat/Snaptr.d.ts +1 -3
  13. package/dist/esm5/components/BasePage/BasePageProps.d.ts +2 -0
  14. package/dist/esm5/components/dialogs/ErrorDialog.d.ts +1 -1
  15. package/dist/esm5/index.js +34 -18
  16. package/dist/esm5/index.js.map +1 -1
  17. package/dist/esm5/lib/Tracking/Snapchat/Snaptr.d.ts +1 -3
  18. package/dist/lib/Tracking/Google/Gtag.js +8 -7
  19. package/dist/lib/Tracking/Google/Gtag.js.map +1 -1
  20. package/dist/lib/Tracking/Reddit/Rdt.js +4 -1
  21. package/dist/lib/Tracking/Reddit/Rdt.js.map +1 -1
  22. package/dist/lib/Tracking/Snapchat/Snaptr.d.ts +1 -3
  23. package/dist/lib/Tracking/Snapchat/Snaptr.js +18 -7
  24. package/dist/lib/Tracking/Snapchat/Snaptr.js.map +1 -1
  25. package/dist/lib/Tracking/Tiktok/Ttq.js +4 -1
  26. package/dist/lib/Tracking/Tiktok/Ttq.js.map +1 -1
  27. package/dist/node/components/BasePage/BasePageProps.d.ts +2 -0
  28. package/dist/node/components/dialogs/ErrorDialog.d.ts +1 -1
  29. package/dist/node/index.js +34 -18
  30. package/dist/node/index.js.map +1 -1
  31. package/dist/node/lib/Tracking/Snapchat/Snaptr.d.ts +1 -3
  32. package/dist/node-esm/components/BasePage/BasePageProps.d.ts +2 -0
  33. package/dist/node-esm/components/dialogs/ErrorDialog.d.ts +1 -1
  34. package/dist/node-esm/index.js +34 -18
  35. package/dist/node-esm/index.js.map +1 -1
  36. package/dist/node-esm/lib/Tracking/Snapchat/Snaptr.d.ts +1 -3
  37. package/package.json +28 -29
  38. package/rollup.config.js +1 -1
  39. package/src/components/BasePage/BasePage.stories.tsx +5 -0
  40. package/src/components/BasePage/BasePage.tsx +3 -0
  41. package/src/components/BasePage/BasePageProps.ts +2 -0
  42. package/src/components/dialogs/ErrorDialog.tsx +0 -1
  43. package/src/lib/Tracking/Google/Gtag.ts +7 -5
  44. package/src/lib/Tracking/Reddit/Rdt.ts +4 -1
  45. package/src/lib/Tracking/Snapchat/Snaptr.ts +8 -9
  46. package/src/lib/Tracking/Tiktok/Ttq.ts +4 -1
  47. package/xylabs-sdk-react-v2.8.2.tgz +0 -0
  48. package/xylabs-sdk-react-v2.7.25.tgz +0 -0
package/package.json CHANGED
@@ -9,16 +9,16 @@
9
9
  "url": "https://github.com/xylabs/sdk-react/issues"
10
10
  },
11
11
  "dependencies": {
12
- "@types/numeral": "^2.0.2",
13
- "@types/react-helmet": "^6.1.5",
14
- "@xylabs/sdk-js": "^2.3.25",
15
- "axios": "^0.24.0",
16
- "lodash": "^4.17.21",
17
- "md5": "^2.3.0",
18
- "numeral": "^2.0.6",
19
- "query-string": "^7.1.0",
20
- "react-helmet": "^6.1.0",
21
- "react-icons": "^4.3.1"
12
+ "@types/react-helmet": "^6",
13
+ "@xylabs/sdk-js": "^2",
14
+ "axios": "^0",
15
+ "bn.js": "^5",
16
+ "lodash": "^4",
17
+ "md5": "^2",
18
+ "numeral": "^2",
19
+ "query-string": "^7",
20
+ "react-helmet": "^6",
21
+ "react-icons": "^4"
22
22
  },
23
23
  "description": "Common React library for all XY Labs projects that use React",
24
24
  "devDependencies": {
@@ -26,34 +26,34 @@
26
26
  "@emotion/react": "^11.7.1",
27
27
  "@emotion/styled": "^11.6.0",
28
28
  "@ethersproject/abstract-signer": "^5.5.0",
29
- "@ethersproject/providers": "^5.5.1",
30
- "@mui/icons-material": "^5.2.5",
31
- "@mui/material": "^5.2.7",
32
- "@mui/styles": "^5.2.3",
29
+ "@ethersproject/providers": "^5.5.2",
30
+ "@mui/icons-material": "^5.3.0",
31
+ "@mui/material": "^5.3.0",
32
+ "@mui/styles": "^5.3.0",
33
33
  "@rollup/plugin-image": "^2.1.1",
34
34
  "@rollup/plugin-json": "^4.1.0",
35
35
  "@rollup/plugin-replace": "^3.0.1",
36
36
  "@rollup/plugin-strip": "^2.1.0",
37
37
  "@rollup/plugin-typescript": "^8.3.0",
38
- "@storybook/addon-actions": "^6.4.9",
39
- "@storybook/addon-docs": "^6.4.9",
40
- "@storybook/addon-essentials": "^6.4.9",
41
- "@storybook/addon-links": "^6.4.9",
42
- "@storybook/components": "^6.4.9",
43
- "@storybook/core-events": "^6.4.9",
44
- "@storybook/react": "^6.4.9",
38
+ "@storybook/addon-actions": "^6.4.13",
39
+ "@storybook/addon-docs": "^6.4.13",
40
+ "@storybook/addon-essentials": "^6.4.13",
41
+ "@storybook/addon-links": "^6.4.13",
42
+ "@storybook/components": "^6.4.13",
43
+ "@storybook/core-events": "^6.4.13",
44
+ "@storybook/react": "^6.4.13",
45
45
  "@types/bn.js": "^5.1.0",
46
46
  "@types/lodash": "^4.14.178",
47
47
  "@types/md5": "^2.3.1",
48
- "@types/node": "^17.0.8",
48
+ "@types/node": "^17.0.10",
49
+ "@types/numeral": "^2",
49
50
  "@types/react": "^17",
50
51
  "@xylabs/eslint-config-react": "^2",
51
- "@xylabs/pixel": "^1.2.5",
52
- "@xylabs/rollup-config": "^1.0.5",
52
+ "@xylabs/pixel": "^1.2.6",
53
+ "@xylabs/rollup-config": "^1.1.1",
53
54
  "@xylabs/ts-scripts": "^1.0.24",
54
- "@xylabs/tsconfig": "^1.0.8",
55
+ "@xylabs/tsconfig": "^1.0.9",
55
56
  "babel-loader": "^8.2.3",
56
- "bn.js": "^5.2.0",
57
57
  "copyfiles": "^2.4.1",
58
58
  "eslint": "^8",
59
59
  "eslint-plugin-prettier": "^4.0.0",
@@ -64,7 +64,7 @@
64
64
  "react-dom": "^17.0.2",
65
65
  "react-router-dom": "^6",
66
66
  "rollbar": "^2",
67
- "rollup": "^2.63.0",
67
+ "rollup": "^2.64.0",
68
68
  "rollup-plugin-svg": "^2.0.0",
69
69
  "ts-node": "^10.4.0",
70
70
  "tslib": "^2.3.1",
@@ -103,7 +103,6 @@
103
103
  "@mui/styles": "^5",
104
104
  "@xylabs/pixel": "^1",
105
105
  "@xylabs/sdk-js": "^2",
106
- "bn.js": "^5",
107
106
  "react": "^17",
108
107
  "react-dom": "^17",
109
108
  "react-router-dom": "^6"
@@ -131,5 +130,5 @@
131
130
  },
132
131
  "sideEffects": false,
133
132
  "types": "dist/index.d.ts",
134
- "version": "2.8.2"
133
+ "version": "2.9.1"
135
134
  }
package/rollup.config.js CHANGED
@@ -2,4 +2,4 @@ import { getRollupConfig } from '@xylabs/rollup-config'
2
2
 
3
3
  import pkg from './package.json'
4
4
 
5
- export default getRollupConfig(pkg)
5
+ export default getRollupConfig({pkg})
@@ -15,8 +15,13 @@ const StorybookEntry = {
15
15
 
16
16
  const Template: ComponentStory<typeof BasePage> = (args) => <BasePage {...args}></BasePage>
17
17
 
18
+ const AppBar = () => <div>AppBar</div>
19
+ const FilterBar = () => <div>FilterBar</div>
20
+
18
21
  const Default = Template.bind({})
19
22
  Default.args = {
23
+ appBar: <AppBar />,
24
+ filterBar: <FilterBar />,
20
25
  title: 'Default',
21
26
  }
22
27
 
@@ -18,7 +18,9 @@ const BasePage: React.FC<BasePageProps> = ({
18
18
  appFooter,
19
19
  appBar,
20
20
  cookieConsent,
21
+ filterBar,
21
22
  hideAppBar,
23
+ hideFilterBar,
22
24
  noindex = false,
23
25
  scrollToTopButton = false,
24
26
  title,
@@ -40,6 +42,7 @@ const BasePage: React.FC<BasePageProps> = ({
40
42
  <Helmet title={title}>{noindex ? <meta content="noindex" name="robots" /> : null}</Helmet>
41
43
  {scrollToTopButton ? <div id={scrollToTopAnchorId} /> : null}
42
44
  {hideAppBar ? null : appBar}
45
+ {hideFilterBar ? null : filterBar}
43
46
  {beta ? (
44
47
  <FlexRow
45
48
  margin={1}
@@ -9,7 +9,9 @@ interface BasePageProps extends BoxProps {
9
9
  beta?: boolean
10
10
  container?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
11
11
  disableGutters?: boolean
12
+ filterBar?: ReactElement
12
13
  hideAppBar?: boolean
14
+ hideFilterBar?: boolean
13
15
  hideFooter?: boolean
14
16
  noindex?: boolean
15
17
  cookieConsent?: ReactNode
@@ -1,6 +1,5 @@
1
1
  import { Dialog, DialogActions, DialogContent, DialogProps, DialogTitle, Typography } from '@mui/material'
2
2
  import { AxiosError } from 'axios'
3
- import React from 'react'
4
3
 
5
4
  import { ButtonEx } from '../ButtonEx'
6
5
  import { FlexRow } from '../FlexBox'
@@ -21,11 +21,13 @@ class Gtag {
21
21
  this.ga4id = ga4id
22
22
  this.awid = awid
23
23
  this.domains = domains
24
- global.dataLayer = global.dataLayer || []
25
- this.gtag = function () {
26
- // eslint-disable-next-line prefer-rest-params
27
- global.dataLayer.push(arguments)
28
- }
24
+ global.dataLayer = global.dataLayer ?? []
25
+ this.gtag =
26
+ global.gtag ??
27
+ function () {
28
+ // eslint-disable-next-line prefer-rest-params
29
+ global.dataLayer.push(arguments)
30
+ }
29
31
  global.gtag = this.gtag
30
32
  this.gtag('js', new Date())
31
33
  this.gtag('config', ga4id)
@@ -13,7 +13,10 @@ class Rdt {
13
13
  }
14
14
 
15
15
  private static getRdt() {
16
- return global.rdt
16
+ if (global.rdt) {
17
+ return global.rdt
18
+ }
19
+ console.warn('Missing rdt')
17
20
  }
18
21
 
19
22
  public load(id: string) {
@@ -1,21 +1,20 @@
1
+ import { delay } from '@xylabs/sdk-js'
2
+
1
3
  import { global } from '../../global'
2
4
 
3
5
  class SnapTr {
4
- static pixelId?: string
5
-
6
6
  public static getSnapTr() {
7
- return global.snaptr
7
+ if (global.snaptr) {
8
+ return global.snaptr
9
+ }
10
+ console.warn('Missing snaptr')
8
11
  }
9
12
 
10
13
  public static instance: SnapTr
11
- public static init(pixelId: string) {
12
- this.pixelId = pixelId
13
- this.track('PAGE_VIEW')
14
- }
15
14
 
16
- public static track<T>(event: string, data?: T) {
17
- this.getSnapTr()('init', this.pixelId)
15
+ public static async track<T>(event: string, data?: T) {
18
16
  this.getSnapTr()('track', event, data)
17
+ await delay(0)
19
18
  }
20
19
  }
21
20
 
@@ -13,7 +13,10 @@ class Ttq {
13
13
  }
14
14
 
15
15
  public static getTtq() {
16
- return global.ttq
16
+ if (global.ttq) {
17
+ return global.ttq
18
+ }
19
+ console.warn('Missing ttq')
17
20
  }
18
21
 
19
22
  public static page() {
Binary file
Binary file