@lukso/up-connector 0.8.5 → 0.9.0-dev.d3f910d

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 (80) hide show
  1. package/dist/account-modal.cjs +3 -3
  2. package/dist/account-modal.js +2 -2
  3. package/dist/auto-setup.cjs +4 -3
  4. package/dist/auto-setup.cjs.map +1 -1
  5. package/dist/auto-setup.d.cts +1 -123
  6. package/dist/auto-setup.d.ts +1 -123
  7. package/dist/auto-setup.js +3 -2
  8. package/dist/backup-modal.cjs +3 -3
  9. package/dist/backup-modal.js +2 -2
  10. package/dist/{chunk-DR5ABNGN.cjs → chunk-3AIZSSEE.cjs} +2 -2
  11. package/dist/{chunk-DR5ABNGN.cjs.map → chunk-3AIZSSEE.cjs.map} +1 -1
  12. package/dist/{chunk-XFMPPOEM.js → chunk-43E6AVSP.js} +5 -4
  13. package/dist/chunk-43E6AVSP.js.map +1 -0
  14. package/dist/{chunk-HROZAHML.js → chunk-D7RI2CWB.js} +5 -4
  15. package/dist/chunk-D7RI2CWB.js.map +1 -0
  16. package/dist/chunk-J3WDC6ON.js +19 -0
  17. package/dist/chunk-J3WDC6ON.js.map +1 -0
  18. package/dist/{chunk-OIB4M2BJ.cjs → chunk-PHRCQCEN.cjs} +5 -4
  19. package/dist/chunk-PHRCQCEN.cjs.map +1 -0
  20. package/dist/{chunk-D4X5RQWB.cjs → chunk-UJDGQG6P.cjs} +5 -4
  21. package/dist/chunk-UJDGQG6P.cjs.map +1 -0
  22. package/dist/chunk-WZFVXKMX.cjs +19 -0
  23. package/dist/chunk-WZFVXKMX.cjs.map +1 -0
  24. package/dist/{chunk-EWIDQS53.cjs → chunk-XCX7QWLC.cjs} +5 -4
  25. package/dist/chunk-XCX7QWLC.cjs.map +1 -0
  26. package/dist/{chunk-A47V7DY2.js → chunk-XEZEZ62E.js} +2 -2
  27. package/dist/{chunk-A47V7DY2.js.map → chunk-XEZEZ62E.js.map} +1 -1
  28. package/dist/{chunk-PUIFBRHQ.js → chunk-XKSB6TPG.js} +5 -4
  29. package/dist/chunk-XKSB6TPG.js.map +1 -0
  30. package/dist/index.cjs +23 -11
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +4 -6
  33. package/dist/index.d.ts +4 -6
  34. package/dist/index.js +31 -19
  35. package/dist/index.js.map +1 -1
  36. package/dist/restore-modal.cjs +3 -3
  37. package/dist/restore-modal.js +2 -2
  38. package/package.json +7 -12
  39. package/src/account-modal.ts +3 -2
  40. package/src/auto-setup.ts +14 -359
  41. package/src/backup-modal.ts +3 -2
  42. package/src/connector.ts +7 -4
  43. package/src/index.ts +20 -19
  44. package/src/restore-modal.ts +3 -2
  45. package/dist/chunk-2BZE2DLW.js +0 -1186
  46. package/dist/chunk-2BZE2DLW.js.map +0 -1
  47. package/dist/chunk-455JZ6IZ.cjs +0 -1186
  48. package/dist/chunk-455JZ6IZ.cjs.map +0 -1
  49. package/dist/chunk-D4X5RQWB.cjs.map +0 -1
  50. package/dist/chunk-EWIDQS53.cjs.map +0 -1
  51. package/dist/chunk-HROZAHML.js.map +0 -1
  52. package/dist/chunk-OIB4M2BJ.cjs.map +0 -1
  53. package/dist/chunk-PUIFBRHQ.js.map +0 -1
  54. package/dist/chunk-R7V3Q7Z6.cjs +0 -181
  55. package/dist/chunk-R7V3Q7Z6.cjs.map +0 -1
  56. package/dist/chunk-XFMPPOEM.js.map +0 -1
  57. package/dist/chunk-XR4C6P3Z.js +0 -181
  58. package/dist/chunk-XR4C6P3Z.js.map +0 -1
  59. package/dist/connect-modal/index.cjs +0 -22
  60. package/dist/connect-modal/index.cjs.map +0 -1
  61. package/dist/connect-modal/index.d.cts +0 -3
  62. package/dist/connect-modal/index.d.ts +0 -3
  63. package/dist/connect-modal/index.js +0 -22
  64. package/dist/connect-modal/index.js.map +0 -1
  65. package/dist/index-2LsIVyuU.d.cts +0 -413
  66. package/dist/index-2LsIVyuU.d.ts +0 -413
  67. package/src/connect-modal/components/connection-view.ts +0 -418
  68. package/src/connect-modal/components/eoa-connection-view.ts +0 -418
  69. package/src/connect-modal/components/qr-code-view.ts +0 -86
  70. package/src/connect-modal/connect-modal.base.ts +0 -18
  71. package/src/connect-modal/connect-modal.config.ts +0 -27
  72. package/src/connect-modal/connect-modal.templates.ts +0 -22
  73. package/src/connect-modal/connect-modal.ts +0 -227
  74. package/src/connect-modal/connect-modal.types.ts +0 -108
  75. package/src/connect-modal/images/up-cube-glass.png +0 -0
  76. package/src/connect-modal/index.ts +0 -25
  77. package/src/connect-modal/services/wagmi.ts +0 -377
  78. package/src/connect-modal/styles/styles.css +0 -1
  79. package/src/connect-modal/utils/chainParams.ts +0 -32
  80. package/src/connect-modal/utils/walletConnectDeepLinkUrl.ts +0 -43
@@ -1,227 +0,0 @@
1
- /**
2
- * Connect Modal - Lit Component
3
- *
4
- * Framework-agnostic connection modal for wallet/profile connections.
5
- */
6
-
7
- import { withDeviceService, withTheme } from '@lukso/core/mixins'
8
- import debug from 'debug'
9
- import { html, type TemplateResult } from 'lit'
10
- import { property, state } from 'lit/decorators.js'
11
-
12
- import { ConnectModalBase } from './connect-modal.base.js'
13
- import type {
14
- ConnectionModalView,
15
- WalletConnector,
16
- } from './connect-modal.types'
17
- import { fromWagmiConnectors, getWagmiSetup } from './services/wagmi'
18
-
19
- import '@lukso/web-components/dist/components/lukso-modal'
20
- import './components/eoa-connection-view'
21
- import './components/connection-view'
22
- import './components/qr-code-view'
23
-
24
- const logInfo = debug('connect-modal:info')
25
-
26
- export class ConnectModal extends withTheme(
27
- withDeviceService(ConnectModalBase)
28
- ) {
29
- // Public properties
30
- @property({ type: Boolean, reflect: true }) open = false
31
-
32
- // Private state
33
- @state() private connectors: WalletConnector[] = []
34
- // isDark state is provided by withTheme mixin
35
- @state() private modalView: ConnectionModalView = 'up_connection'
36
- @state() private qrCodeData: string | undefined = undefined
37
-
38
- updated(changedProperties: Map<string, any>): void {
39
- super.updated(changedProperties)
40
-
41
- // Reset view and load connectors when modal opens
42
- if (changedProperties.has('open') && this.open) {
43
- this.modalView = 'up_connection' // Reset to main view when modal opens
44
- this.loadConnectors()
45
- }
46
- }
47
-
48
- /**
49
- * Close modal
50
- */
51
- handleClose(): void {
52
- this.open = false
53
-
54
- this.dispatchEvent(
55
- new CustomEvent('on-close', { bubbles: true, composed: true })
56
- )
57
- }
58
-
59
- private async loadConnectors(): Promise<void> {
60
- const globalWagmiSetup = getWagmiSetup()
61
- logInfo('Global wagmi setup:', globalWagmiSetup)
62
-
63
- if (!globalWagmiSetup) {
64
- console.warn(
65
- 'No global wagmi setup found! Call setupConnectModal() first.'
66
- )
67
- this.connectors = []
68
- return
69
- }
70
-
71
- try {
72
- const { wagmiConfig, chainId, embeddedWalletId } = globalWagmiSetup
73
-
74
- // Get connectors from wagmi config
75
- const wagmiConnectors = wagmiConfig?.connectors || []
76
- logInfo('Initial connectors:', wagmiConnectors)
77
-
78
- // Dynamically import wagmi's connect function to avoid bundling if not used
79
- // Use dynamic import to keep @wagmi/core as an optional peer dependency
80
- const wagmiCore = await import('@wagmi/core').catch((error) => {
81
- throw new Error('@wagmi/core is required when using wagmi connectors', {
82
- cause: error,
83
- })
84
- })
85
-
86
- // Convert to WalletConnector format using the adapter
87
- this.connectors = fromWagmiConnectors(
88
- wagmiConnectors,
89
- async (options: any) => {
90
- await wagmiCore.connect(wagmiConfig, {
91
- connector: options.connector,
92
- chainId: options.chainId || chainId,
93
- })
94
- },
95
- chainId,
96
- embeddedWalletId
97
- )
98
- logInfo('Converted connectors:', this.connectors)
99
- } catch (error) {
100
- console.warn('Failed to load connectors', error)
101
- this.connectors = []
102
- }
103
- }
104
-
105
- /**
106
- * Successful connection handler
107
- *
108
- * @param connector
109
- */
110
- private handleOnConnectSuccess(event: CustomEvent): void {
111
- event.stopPropagation() // Prevent event bubbling
112
- const connector = event.detail.connector as WalletConnector
113
- logInfo('Connection success:', connector)
114
- this.open = false
115
-
116
- // Dispatch connect event
117
- this.dispatchEvent(
118
- new CustomEvent('on-connect', {
119
- detail: { connector },
120
- bubbles: true,
121
- composed: true,
122
- })
123
- )
124
- }
125
-
126
- /**
127
- * Error connection handler
128
- *
129
- * @param error
130
- */
131
- private handleOnConnectError(event: CustomEvent): void {
132
- event.stopPropagation() // Prevent event bubbling
133
- const error = event.detail.error as Error
134
- logInfo('Connection error:', error)
135
-
136
- // Dispatch error event
137
- this.dispatchEvent(
138
- new CustomEvent('on-error', {
139
- detail: { error },
140
- bubbles: true,
141
- composed: true,
142
- })
143
- )
144
- }
145
-
146
- private handleBackToConnectionView(event: CustomEvent): void {
147
- event.stopPropagation() // Prevent event bubbling
148
- this.modalView = 'up_connection'
149
- }
150
-
151
- private handleShowEoaConnectionsView = (event: CustomEvent): void => {
152
- event.stopPropagation() // Prevent event bubbling
153
- this.modalView = 'eoa_connection'
154
- }
155
-
156
- private handleShowQrCodeView = (event: CustomEvent): void => {
157
- event.stopPropagation() // Prevent event bubbling
158
- this.qrCodeData = event.detail.data
159
- this.modalView = 'qr_code'
160
- }
161
-
162
- // ===== Template Methods =====
163
-
164
- /**
165
- * Render modal content based on current view flag
166
- */
167
- private renderModalContent(): TemplateResult<1> {
168
- switch (this.modalView) {
169
- case 'qr_code':
170
- return html`<qr-code-view
171
- .data=${this.qrCodeData}
172
- .theme=${this.theme}
173
- @on-back=${this.handleBackToConnectionView}
174
- @on-close=${this.handleClose}
175
- ></qr-code-view>`
176
- case 'eoa_connection':
177
- return html`
178
- <eoa-connection-view
179
- .connectors=${this.connectors}
180
- .theme=${this.theme}
181
- @on-back=${this.handleBackToConnectionView}
182
- @on-close=${this.handleClose}
183
- @on-connect=${this.handleOnConnectSuccess}
184
- @on-error=${this.handleOnConnectError}
185
- ></eoa-connection-view>
186
- `
187
- default: // up_connection
188
- return html`
189
- <connection-view
190
- .connectors=${this.connectors}
191
- .theme=${this.theme}
192
- @on-back=${this.handleBackToConnectionView}
193
- @on-close=${this.handleClose}
194
- @on-connect=${this.handleOnConnectSuccess}
195
- @on-error=${this.handleOnConnectError}
196
- @on-show-eoa-connections-view=${this.handleShowEoaConnectionsView}
197
- @on-show-qr-code=${this.handleShowQrCodeView}
198
- ></connection-view>
199
- `
200
- }
201
- }
202
-
203
- render(): TemplateResult<1> {
204
- return html`
205
- <lukso-modal
206
- ?is-open=${this.open}
207
- ?has-bottom-padding=${!!(this.device?.isIOS && this.device?.isSafari)}
208
- size="auto"
209
- .theme=${this.theme}
210
- @on-backdrop-click=${this.handleClose}
211
- >
212
- <div class="p-6 w-full sm:w-[372px]">
213
- ${this.renderModalContent()}
214
- </div>
215
- </lukso-modal>
216
- `
217
- }
218
- }
219
-
220
- // Register custom element
221
- customElements.define('connect-modal', ConnectModal as any)
222
-
223
- declare global {
224
- interface HTMLElementTagNameMap {
225
- 'connect-modal': ConnectModal
226
- }
227
- }
@@ -1,108 +0,0 @@
1
- export interface WalletConnector {
2
- id: string
3
- name?: string
4
- rdns?: string // Reverse DNS identifier (e.g., 'io.metamask')
5
- slug?: string
6
- type: 'embedded' | 'extension' | 'mobile' | 'injected' | 'walletconnect'
7
- connect: () => Promise<void>
8
- getProvider?: () => Promise<any>
9
- switchChain?: (params: {
10
- chainId?: number
11
- addEthereumChainParameter?: any
12
- }) => Promise<void>
13
- }
14
-
15
- export interface ConnectModalSetup {
16
- /**
17
- * Wagmi config instance
18
- */
19
- wagmiConfig: any
20
-
21
- /**
22
- * Optional chain ID to use for connections (defaults to first chain in config)
23
- */
24
- chainId?: number
25
-
26
- /**
27
- * Optional embedded wallet ID (to identify it in wagmi connectors)
28
- * If provided, this connector will be shown first as "Create Passkey Wallet"
29
- * Example: 'dev.lukso.auth'
30
- */
31
- embeddedWalletId?: string
32
- }
33
-
34
- // Minimal wagmi Connector interface (to avoid importing @wagmi/core)
35
- export interface WagmiConnector {
36
- uid: string
37
- name: string
38
- id: string
39
- type: string
40
- icon?: string
41
- // Other wagmi connector properties...
42
- [key: string]: any
43
- }
44
-
45
- export type ConnectModalTheme = 'light' | 'dark' | 'auto'
46
-
47
- export type ConnectionModalView = 'up_connection' | 'qr_code' | 'eoa_connection'
48
-
49
- export type WalletResponse = {
50
- listings: {
51
- [key in string]: Wallet
52
- }
53
- count: number
54
- total: number
55
- }
56
-
57
- export type Wallet = {
58
- id: string
59
- name: string
60
- slug: string
61
- description: string
62
- homepage: string
63
- chains: string[]
64
- versions: string[]
65
- sdks: string[]
66
- app_type: string
67
- category: string
68
- image_id: string
69
- image_url: WalletImageUrl
70
- app: WalletApp
71
- rdns: string
72
- mobile: WalletMobile
73
- desktop: WalletDesktop
74
- isInstalled: boolean
75
- connector: WalletConnector | undefined
76
- }
77
-
78
- export type WalletImageUrl = {
79
- sm: string
80
- md: string
81
- lg: string
82
- }
83
- export type WalletAppType =
84
- | 'browser'
85
- | 'ios'
86
- | 'android'
87
- | 'mac'
88
- | 'windows'
89
- | 'linux'
90
- | 'chrome'
91
- | 'firefox'
92
- | 'safari'
93
- | 'edge'
94
- | 'opera'
95
-
96
- export type WalletApp = {
97
- [key in WalletAppType]?: string
98
- }
99
-
100
- export interface WalletMobile {
101
- native?: string
102
- universal?: string
103
- }
104
-
105
- export interface WalletDesktop {
106
- native?: string
107
- universal?: string
108
- }
@@ -1,25 +0,0 @@
1
- /**
2
- * Connect Modal - Barrel Export
3
- *
4
- * Exports the connect modal component and all related types and utilities
5
- */
6
-
7
- export { ConnectModalBase } from './connect-modal.base.js'
8
- export { ConnectModal } from './connect-modal.js'
9
- export type {
10
- ConnectionModalView,
11
- ConnectModalSetup,
12
- ConnectModalTheme,
13
- WagmiConnector,
14
- Wallet,
15
- WalletConnector,
16
- } from './connect-modal.types'
17
- export type { WagmiConnection } from './services/wagmi'
18
- export {
19
- disconnect,
20
- getConnection,
21
- getWagmiSetup,
22
- setupWagmi as setupConnectModal,
23
- wagmi,
24
- watchConnection,
25
- } from './services/wagmi'