@xylabs/sdk-react 2.9.34 → 2.10.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.
- package/dist/cjs5/components/BasePage/BasePageProps.d.ts +0 -2
- package/dist/cjs5/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/cjs5/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/cjs5/contexts/UserEvents/{Loader.d.ts → Provider.d.ts} +1 -1
- package/dist/cjs5/contexts/UserEvents/index.d.ts +1 -1
- package/dist/cjs5/index.js +111 -76
- package/dist/cjs5/index.js.map +1 -1
- package/dist/cjs5/lib/Tracking/Facebook/index.d.ts +1 -0
- package/dist/cjs5/lib/Tracking/XyoUserEventHandler.d.ts +3 -1
- package/dist/components/Background.js +1 -0
- package/dist/components/Background.js.map +1 -1
- package/dist/components/BasePage/BasePage.js +2 -2
- package/dist/components/BasePage/BasePage.js.map +1 -1
- package/dist/components/BasePage/BasePage.stories.js +2 -3
- package/dist/components/BasePage/BasePage.stories.js.map +1 -1
- package/dist/components/BasePage/BasePageProps.d.ts +0 -2
- package/dist/components/EthAccount/EthAccount.js +2 -2
- package/dist/components/EthAccount/EthAccount.js.map +1 -1
- package/dist/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/components/EthAccount/EthAccount.stories.js +18 -1
- package/dist/components/EthAccount/EthAccount.stories.js.map +1 -1
- package/dist/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/components/InvertableThemeProvider/InvertableThemeProvider.js +3 -1
- package/dist/components/InvertableThemeProvider/InvertableThemeProvider.js.map +1 -1
- package/dist/components/LinkEx/LinkToEx.js +1 -0
- package/dist/components/LinkEx/LinkToEx.js.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/contexts/UserEvents/{Loader.d.ts → Provider.d.ts} +1 -1
- package/dist/contexts/UserEvents/Provider.js +7 -0
- package/dist/contexts/UserEvents/Provider.js.map +1 -0
- package/dist/contexts/UserEvents/index.d.ts +1 -1
- package/dist/contexts/UserEvents/index.js +1 -1
- package/dist/contexts/UserEvents/index.js.map +1 -1
- package/dist/esm2015/components/BasePage/BasePageProps.d.ts +0 -2
- package/dist/esm2015/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/esm2015/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/esm2015/contexts/UserEvents/{Loader.d.ts → Provider.d.ts} +1 -1
- package/dist/esm2015/contexts/UserEvents/index.d.ts +1 -1
- package/dist/esm2015/index.js +111 -77
- package/dist/esm2015/index.js.map +1 -1
- package/dist/esm2015/lib/Tracking/Facebook/index.d.ts +1 -0
- package/dist/esm2015/lib/Tracking/XyoUserEventHandler.d.ts +3 -1
- package/dist/esm2017/components/BasePage/BasePageProps.d.ts +0 -2
- package/dist/esm2017/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/esm2017/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/esm2017/contexts/UserEvents/{Loader.d.ts → Provider.d.ts} +1 -1
- package/dist/esm2017/contexts/UserEvents/index.d.ts +1 -1
- package/dist/esm2017/index.js +111 -77
- package/dist/esm2017/index.js.map +1 -1
- package/dist/esm2017/lib/Tracking/Facebook/index.d.ts +1 -0
- package/dist/esm2017/lib/Tracking/XyoUserEventHandler.d.ts +3 -1
- package/dist/esm5/components/BasePage/BasePageProps.d.ts +0 -2
- package/dist/esm5/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/esm5/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/esm5/contexts/UserEvents/Provider.d.ts +7 -0
- package/dist/esm5/contexts/UserEvents/index.d.ts +1 -1
- package/dist/esm5/index.js +111 -77
- package/dist/esm5/index.js.map +1 -1
- package/dist/esm5/lib/Tracking/Facebook/index.d.ts +1 -0
- package/dist/esm5/lib/Tracking/XyoUserEventHandler.d.ts +3 -1
- package/dist/lib/Tracking/Facebook/index.d.ts +1 -0
- package/dist/lib/Tracking/Facebook/index.js +1 -0
- package/dist/lib/Tracking/Facebook/index.js.map +1 -1
- package/dist/lib/Tracking/XyoUserEventHandler.d.ts +3 -1
- package/dist/lib/Tracking/XyoUserEventHandler.js +8 -1
- package/dist/lib/Tracking/XyoUserEventHandler.js.map +1 -1
- package/dist/node/components/BasePage/BasePageProps.d.ts +0 -2
- package/dist/node/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/node/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/node/contexts/UserEvents/Provider.d.ts +7 -0
- package/dist/node/contexts/UserEvents/index.d.ts +1 -1
- package/dist/node/index.js +111 -76
- package/dist/node/index.js.map +1 -1
- package/dist/node/lib/Tracking/Facebook/index.d.ts +1 -0
- package/dist/node/lib/Tracking/XyoUserEventHandler.d.ts +3 -1
- package/dist/node-esm/components/BasePage/BasePageProps.d.ts +0 -2
- package/dist/node-esm/components/EthAccount/EthAccount.stories.d.ts +3 -1
- package/dist/node-esm/components/EthAccount/EthAccountProps.d.ts +1 -0
- package/dist/node-esm/contexts/UserEvents/Provider.d.ts +7 -0
- package/dist/node-esm/contexts/UserEvents/index.d.ts +1 -1
- package/dist/node-esm/index.js +111 -77
- package/dist/node-esm/index.js.map +1 -1
- package/dist/node-esm/lib/Tracking/Facebook/index.d.ts +1 -0
- package/dist/node-esm/lib/Tracking/XyoUserEventHandler.d.ts +3 -1
- package/package.json +10 -7
- package/src/components/Background.tsx +1 -0
- package/src/components/BasePage/BasePage.stories.tsx +6 -3
- package/src/components/BasePage/BasePage.tsx +0 -3
- package/src/components/BasePage/BasePageProps.ts +0 -2
- package/src/components/EthAccount/EthAccount.stories.tsx +20 -1
- package/src/components/EthAccount/EthAccount.tsx +2 -1
- package/src/components/EthAccount/EthAccountProps.tsx +1 -0
- package/src/components/InvertableThemeProvider/InvertableThemeProvider.tsx +1 -0
- package/src/components/LinkEx/LinkToEx.tsx +1 -0
- package/src/components/index.ts +1 -0
- package/src/contexts/UserEvents/Provider.tsx +17 -0
- package/src/contexts/UserEvents/index.ts +1 -1
- package/src/lib/Tracking/Facebook/index.ts +1 -0
- package/src/lib/Tracking/XyoUserEventHandler.ts +11 -2
- package/dist/contexts/UserEvents/Loader.js +0 -6
- package/dist/contexts/UserEvents/Loader.js.map +0 -1
- package/dist/esm5/contexts/UserEvents/Loader.d.ts +0 -7
- package/dist/node/contexts/UserEvents/Loader.d.ts +0 -7
- package/dist/node-esm/contexts/UserEvents/Loader.d.ts +0 -7
- package/src/contexts/UserEvents/Loader.tsx +0 -12
|
@@ -9,9 +9,7 @@ interface BasePageProps extends BoxProps {
|
|
|
9
9
|
beta?: boolean
|
|
10
10
|
container?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
11
11
|
disableGutters?: boolean
|
|
12
|
-
filterBar?: ReactElement
|
|
13
12
|
hideAppBar?: boolean
|
|
14
|
-
hideFilterBar?: boolean
|
|
15
13
|
hideFooter?: boolean
|
|
16
14
|
noindex?: boolean
|
|
17
15
|
cookieConsent?: ReactNode
|
|
@@ -38,6 +38,25 @@ LongEmpty.args = {
|
|
|
38
38
|
toEtherScan: true,
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
const Medium = Template.bind({})
|
|
42
|
+
Medium.args = {
|
|
43
|
+
address: EthAddress.fromString('0x6792b02f88b32c4fe8e31cfa41ae5af44865f930'),
|
|
44
|
+
addressLength: 'short',
|
|
45
|
+
icon: true,
|
|
46
|
+
shortenedLength: 8,
|
|
47
|
+
title: 'Sample EthAccount',
|
|
48
|
+
toEtherScan: true,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const MediumEmpty = Template.bind({})
|
|
52
|
+
MediumEmpty.args = {
|
|
53
|
+
addressLength: 'short',
|
|
54
|
+
icon: true,
|
|
55
|
+
shortenedLength: 8,
|
|
56
|
+
title: 'Sample EthAccount',
|
|
57
|
+
toEtherScan: true,
|
|
58
|
+
}
|
|
59
|
+
|
|
41
60
|
const Short = Template.bind({})
|
|
42
61
|
Short.args = {
|
|
43
62
|
address: EthAddress.fromString('0x6792b02f88b32c4fe8e31cfa41ae5af44865f930'),
|
|
@@ -72,7 +91,7 @@ AutoEmpty.args = {
|
|
|
72
91
|
toEtherScan: true,
|
|
73
92
|
}
|
|
74
93
|
|
|
75
|
-
export { Auto, AutoEmpty, Long, LongEmpty, Short, ShortEmpty }
|
|
94
|
+
export { Auto, AutoEmpty, Long, LongEmpty, Medium, MediumEmpty, Short, ShortEmpty }
|
|
76
95
|
|
|
77
96
|
// eslint-disable-next-line import/no-default-export
|
|
78
97
|
export default StorybookEntry
|
|
@@ -14,6 +14,7 @@ const EthAccount: React.FC<EthAccountProps> = ({
|
|
|
14
14
|
icon = false,
|
|
15
15
|
iconSize = 16,
|
|
16
16
|
iconOnly = false,
|
|
17
|
+
shortenedLength,
|
|
17
18
|
addressLength = 'auto',
|
|
18
19
|
fontFamily = '"Source Code Pro",monospace',
|
|
19
20
|
toEtherScan,
|
|
@@ -40,7 +41,7 @@ const EthAccount: React.FC<EthAccountProps> = ({
|
|
|
40
41
|
addressLength === 'long'
|
|
41
42
|
? addressToDisplay.toString()
|
|
42
43
|
: addressLength === 'short'
|
|
43
|
-
? addressToDisplay.toShortString()
|
|
44
|
+
? addressToDisplay.toShortString(shortenedLength)
|
|
44
45
|
: large
|
|
45
46
|
? addressToDisplay.toString()
|
|
46
47
|
: addressToDisplay.toShortString()
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UserEventHandler } from '@xylabs/pixel'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { XyoUserEventHandler } from '../../lib'
|
|
5
|
+
import { UserEventsContext } from './Context'
|
|
6
|
+
|
|
7
|
+
interface Props<T> {
|
|
8
|
+
userEvents: UserEventHandler<T>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const UserEventsProvider: React.FC<Props<unknown>> = ({ userEvents, children }) => {
|
|
12
|
+
return (
|
|
13
|
+
<UserEventsContext.Provider value={{ userEvents: userEvents ?? XyoUserEventHandler.get() }}>
|
|
14
|
+
{children}
|
|
15
|
+
</UserEventsContext.Provider>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './Context'
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './Provider'
|
|
@@ -6,11 +6,14 @@ import {
|
|
|
6
6
|
ViewContentFields,
|
|
7
7
|
} from '@xylabs/pixel'
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
import { FacebookUserEventHandler } from './Facebook'
|
|
10
|
+
import { GoogleUserEventHandler } from './Google'
|
|
11
|
+
|
|
12
|
+
class XyoUserEventHandler<T extends Record<string, unknown>> extends UserEventHandler<T> {
|
|
10
13
|
protected handlers: UserEventHandler<T>[]
|
|
11
14
|
private constructor(handlers: UserEventHandler<T>[] = []) {
|
|
12
15
|
super()
|
|
13
|
-
this.handlers = handlers
|
|
16
|
+
this.handlers = handlers ?? [new FacebookUserEventHandler<T>(), new GoogleUserEventHandler<T>()]
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
async testStarted(data: T | TestStartedFields) {
|
|
@@ -28,6 +31,12 @@ class XyoUserEventHandler<T> extends UserEventHandler<T> {
|
|
|
28
31
|
async userClick(data: T | UserClickFields) {
|
|
29
32
|
await Promise.allSettled(this.handlers.map((handler) => handler.userClick(data)))
|
|
30
33
|
}
|
|
34
|
+
|
|
35
|
+
static instance: XyoUserEventHandler<Record<string, unknown>>
|
|
36
|
+
static get() {
|
|
37
|
+
this.instance = this.instance ?? new XyoUserEventHandler()
|
|
38
|
+
return this.instance
|
|
39
|
+
}
|
|
31
40
|
}
|
|
32
41
|
|
|
33
42
|
export { XyoUserEventHandler }
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { UserEventsContext } from './Context';
|
|
3
|
-
export const UserEventsLoader = ({ userEvents, children }) => {
|
|
4
|
-
return _jsx(UserEventsContext.Provider, Object.assign({ value: { userEvents } }, { children: children }), void 0);
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=Loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Loader.js","sourceRoot":"","sources":["../../../src/contexts/UserEvents/Loader.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAM7C,MAAM,CAAC,MAAM,gBAAgB,GAA6B,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE;IACrF,OAAO,KAAC,iBAAiB,CAAC,QAAQ,kBAAC,KAAK,EAAE,EAAE,UAAU,EAAE,gBAAG,QAAQ,YAA8B,CAAA;AACnG,CAAC,CAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { UserEventHandler } from '@xylabs/pixel'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import { UserEventsContext } from './Context'
|
|
5
|
-
|
|
6
|
-
interface Props<T> {
|
|
7
|
-
userEvents: UserEventHandler<T>
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const UserEventsLoader: React.FC<Props<unknown>> = ({ userEvents, children }) => {
|
|
11
|
-
return <UserEventsContext.Provider value={{ userEvents }}>{children}</UserEventsContext.Provider>
|
|
12
|
-
}
|