Skip to content

Commit

Permalink
Merge pull request #4 from 0xsequence/1713-kit-analytics
Browse files Browse the repository at this point in the history
analytics, project access key
  • Loading branch information
SamueleA authored Jan 29, 2024
2 parents 85d4053 + a35de0f commit 3508b89
Show file tree
Hide file tree
Showing 22 changed files with 344 additions and 256 deletions.
2 changes: 1 addition & 1 deletion examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"homepage": "kit",
"dependencies": {
"0xsequence": "^1.4.9",
"0xsequence": "^1.8.2",
"@0xsequence/design-system": "^1.1.0",
"@0xsequence/kit": "workspace:*",
"@0xsequence/kit-checkout": "workspace:*",
Expand Down
10 changes: 5 additions & 5 deletions packages/checkout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"0xsequence": "^1.4.9",
"@0xsequence/api": "^1.4.9",
"@0xsequence/indexer": "^1.4.9",
"@0xsequence/metadata": "^1.4.9",
"@0xsequence/network": "^1.4.9",
"0xsequence": "^1.8.2",
"@0xsequence/api": "^1.8.2",
"@0xsequence/indexer": "^1.8.2",
"@0xsequence/metadata": "^1.8.2",
"@0xsequence/network": "^1.8.2",
"@tanstack/react-query": "^4.29.5",
"react-copy-to-clipboard": "^5.1.0",
"@paperxyz/react-client-sdk": "^1.1.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@0xsequence/provider": "^1.4.9",
"@0xsequence/provider": "^1.8.2",
"@0xsequence/wagmi-connector": "^2.1.4"
},
"devDependencies": {
"@0xsequence/design-system": "^1.1.0",
"@0xsequence/kit": "workspace:*"
},
"peerDependencies": {
"0xsequence": ">=1.4.9",
"0xsequence": ">=1.8.2",
"ethers": ">=5.7.2",
"@0xsequence/design-system": ">=1.1.0",
"react": ">=17",
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/src/connectors/apple/apple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { getAppleLogo, getAppleMonochromeLogo } from './AppleLogo'

export interface AppleOptions {
chains: Chain[];
options?: BaseSequenceConnectorOptions;
options: BaseSequenceConnectorOptions;
}

export const apple = ({ chains, options = {} }: AppleOptions) => ({
export const apple = ({ chains, options }: AppleOptions) => ({
id: 'apple',
isSequenceBased: true,
logoDark: getAppleLogo({ isDarkMode: true }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const CoinbaseWalletLogo: React.FunctionComponent = ({...props}) => {
<React.Fragment>
<svg viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
<rect width="28" height="28" fill="#2C5FF6"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14 23.8C19.4124 23.8 23.8 19.4124 23.8 14C23.8 8.58761 19.4124 4.2 14 4.2C8.58761 4.2 4.2 8.58761 4.2 14C4.2 19.4124 8.58761 23.8 14 23.8ZM11.55 10.8C11.1358 10.8 10.8 11.1358 10.8 11.55V16.45C10.8 16.8642 11.1358 17.2 11.55 17.2H16.45C16.8642 17.2 17.2 16.8642 17.2 16.45V11.55C17.2 11.1358 16.8642 10.8 16.45 10.8H11.55Z" fill="white"/>
<path fillRule="evenodd" clipRule="evenodd" d="M14 23.8C19.4124 23.8 23.8 19.4124 23.8 14C23.8 8.58761 19.4124 4.2 14 4.2C8.58761 4.2 4.2 8.58761 4.2 14C4.2 19.4124 8.58761 23.8 14 23.8ZM11.55 10.8C11.1358 10.8 10.8 11.1358 10.8 11.55V16.45C10.8 16.8642 11.1358 17.2 11.55 17.2H16.45C16.8642 17.2 17.2 16.8642 17.2 16.45V11.55C17.2 11.1358 16.8642 10.8 16.45 10.8H11.55Z" fill="white"/>
</svg>
</React.Fragment>
)
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/src/connectors/discord/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { getDiscordLogo } from './DiscordLogo'

export interface DiscordOptions {
chains: Chain[];
options?: BaseSequenceConnectorOptions;
options: BaseSequenceConnectorOptions;
}

export const discord = ({ chains, options = {} }: DiscordOptions) => ({
export const discord = ({ chains, options }: DiscordOptions) => ({
id: 'discord',
isSequenceBased: true,
logoDark: getDiscordLogo({ isDarkMode: true }),
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/src/connectors/email/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export const EMAIL_CONNECTOR_LOCAL_STORAGE_KEY = '@sequence.kit.connector.email'

export interface EmailOptions {
chains: Chain[];
options?: BaseSequenceConnectorOptions;
options: BaseSequenceConnectorOptions;
}

export const email = ({ chains, options = {} }: EmailOptions) => ({
export const email = ({ chains, options }: EmailOptions) => ({
id: 'email',
isSequenceBased: true,
logoDark: getEmailLogo({ isDarkMode: true }),
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/src/connectors/facebook/facebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { FacebookLogo, getFacebookMonochromeLogo } from './FacebookLogo'

export interface FacebookOptions {
chains: Chain[];
options?: BaseSequenceConnectorOptions;
options: BaseSequenceConnectorOptions;
}

export const facebook = ({ chains, options = {} }: FacebookOptions) => ({
export const facebook = ({ chains, options }: FacebookOptions) => ({
id: 'facebook',
isSequenceBased: true,
logoDark: FacebookLogo,
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/src/connectors/google/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { GoogleLogo, getMonochromeGoogleLogo } from './GoogleLogo'

export interface GoogleOptions {
chains: Chain[];
options?: BaseSequenceConnectorOptions;
options: BaseSequenceConnectorOptions;
}

export const google = ({ chains, options = {} }: GoogleOptions) => ({
export const google = ({ chains, options }: GoogleOptions) => ({
id: 'google',
isSequenceBased: true,
logoDark: GoogleLogo,
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/src/connectors/sequence/sequence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SequenceLogo } from './SequenceLogo'

export interface SequenceOptions {
chains: Chain[];
options?: BaseSequenceConnectorOptions
options: BaseSequenceConnectorOptions
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from 'wagmi'

export interface BaseSequenceConnectorOptions {
projectAccessKey: string,
defaultNetwork?: sequence.network.ChainIdLike,
connect?: ConnectOptions
}
Expand All @@ -27,9 +28,9 @@ export class BaseSequenceConnector extends Connector<sequence.provider.SequenceP

provider: sequence.provider.SequenceProvider

constructor({ chains, options = {} }: {
constructor({ chains, options }: {
chains?: Chain[],
options?: BaseSequenceConnectorOptions
options: BaseSequenceConnectorOptions
}) {
super({ chains, options })

Expand All @@ -52,13 +53,13 @@ export class BaseSequenceConnector extends Connector<sequence.provider.SequenceP
this.name = name
}

this.provider = sequence.initWallet({
this.provider = sequence.initWallet(options.projectAccessKey, {
defaultNetwork: options?.defaultNetwork,
transports: {
walletAppURL: 'https://sequence.app',
},
defaultEIP6492: true,
projectAccessKey: options?.connect?.projectAccessKey
analytics: false,
})

this.provider.on('chainChanged', (chainIdHex: string) => {
Expand Down
6 changes: 6 additions & 0 deletions packages/connectors/src/defaultConnectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const getDefaultConnectors = ({
chains,
options: {
defaultNetwork: defaultChain,
projectAccessKey,
connect: {
app: appName,
projectAccessKey
Expand All @@ -59,6 +60,7 @@ export const getDefaultConnectors = ({
chains,
options: {
defaultNetwork: defaultChain,
projectAccessKey,
connect: {
app: appName,
projectAccessKey
Expand All @@ -69,6 +71,7 @@ export const getDefaultConnectors = ({
chains,
options: {
defaultNetwork: defaultChain,
projectAccessKey,
connect: {
app: appName,
projectAccessKey
Expand All @@ -79,6 +82,7 @@ export const getDefaultConnectors = ({
chains,
options: {
defaultNetwork: defaultChain,
projectAccessKey,
connect: {
app: appName,
projectAccessKey
Expand All @@ -89,6 +93,7 @@ export const getDefaultConnectors = ({
chains,
options: {
defaultNetwork: defaultChain,
projectAccessKey,
connect: {
app: appName,
projectAccessKey
Expand All @@ -108,6 +113,7 @@ export const getDefaultConnectors = ({
chains,
options: {
defaultNetwork: defaultChain,
projectAccessKey,
connect: {
app: appName,
projectAccessKey
Expand Down
15 changes: 8 additions & 7 deletions packages/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@0xsequence/auth": "^1.4.9",
"@0xsequence/api": "^1.4.9",
"@0xsequence/indexer": "^1.4.9",
"@0xsequence/metadata": "^1.4.9",
"@0xsequence/network": "^1.4.9",
"@0xsequence/auth": "^1.8.2",
"@0xsequence/api": "^1.8.2",
"@0xsequence/indexer": "^1.8.2",
"@0xsequence/metadata": "^1.8.2",
"@0xsequence/network": "^1.8.2",
"@0xsequence/provider": "^1.8.2",
"@0xsequence/design-system": "^1.1.0",
"@0xsequence/ethauth": "^0.8.1",
"@0xsequence/kit-connectors": "workspace:*",
"@0xsequence/utils": "1.4.9",
"@0xsequence/utils": "1.8.2",
"@0xsequence/wagmi-connector": "^2.1.4",
"@vanilla-extract/css": "^1.9.3",
"@vanilla-extract/recipes": "^0.3.0",
Expand All @@ -42,7 +43,7 @@
},
"devDependencies": {
"ethers": "5.7.2",
"0xsequence": "^1.4.9",
"0xsequence": "^1.8.2",
"viem": "1.10.7",
"wagmi": "1.3.9"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface BannerProps {
}

export const Banner = ({
config = {}
config = {} as KitConfig
}: BannerProps) => {
const { signIn = {} } = config
const { logoUrl } = signIn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import{ EMAIL_CONNECTOR_LOCAL_STORAGE_KEY } from '@0xsequence/kit-connectors'
import { ExtendedWalletList } from './ExtendedWalletList'
import { Banner } from './Banner'

import { useAnalyticsContext } from '../../../contexts'
import { KitConfig } from '../../index'
import { defaultSignInOptions } from '../../../constants'
import { isEmailValid } from '../../../utils'
import { KitConnectProviderProps } from '../index'
Expand All @@ -22,7 +24,7 @@ export const ConnectWalletContent = (props: ConnectWalletContentProps) => {
const { isConnected } = useAccount()
const { theme } = useTheme()
const { config = {} } = props
const { signIn = {} } = config
const { signIn = {} } = config as KitConfig
const {
showEmailInput = defaultSignInOptions.showEmailInput,
socialAuthOptions = defaultSignInOptions.socialAuthOptions,
Expand Down Expand Up @@ -113,7 +115,7 @@ export const ConnectWalletContent = (props: ConnectWalletContentProps) => {

return (
<>
<Banner config={config} />
<Banner config={config as KitConfig} />
<Box marginTop="5">
{emailConnector && showEmailInput && (
<>
Expand Down
Loading

0 comments on commit 3508b89

Please sign in to comment.