@embarkai/ui-kit 0.1.4 → 0.1.6

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/README.md CHANGED
@@ -39,9 +39,11 @@ export const queryClient = new QueryClient({
39
39
 
40
40
  ### 2. I18n config (Required) & typing (Optional)
41
41
 
42
- i18next lib must be initiated for both passport & your app (namespace concept used to manage translations), so your app's language can be switched by Passport's lang selector.
42
+ i18next lib must be initiated for both UIKIT & your app (namespace concept used to manage translations), so your app's language can be switched by UIKIT's lang selector.
43
43
 
44
- There is no need to provide any translations for Passport ( has built-in default lang-set ), unless it's not required to expand supported languages by custom langs, but it is required to init i18next inside DApp.
44
+ There is no need to provide any translations for UIKIT ( has built-in default lang-set ), unless it's not required to expand supported languages by custom langs, but it is required to init i18next inside DApp.
45
+
46
+ > **NOTE** If you don't need multi-language support inside your Dapp go to step 3 from here providing combineI18NResources() call with no params
45
47
 
46
48
  First, create the following folder structure for your dapp's translations (or update existant, if needed):
47
49
 
@@ -95,7 +97,7 @@ export const YOUR_APP_TRANSLATION_RESOURSES = {
95
97
  } as const
96
98
  ```
97
99
 
98
- > **Note:** If you don't need to translate your app then leave YOUR_APP_TRANSLATION_RESOURSES empty with no locales folder.
100
+ > **Note:** If you don't need multi-language support inside your Dapp leave YOUR_APP_TRANSLATION_RESOURSES empty for now
99
101
 
100
102
  Decalre types (usualy at `src/i18next.d.ts`) so t-method provides intellisence typings for your translations. Default locale is recomended to be used for typing as shown
101
103
 
@@ -120,66 +122,64 @@ declare module 'i18next' {
120
122
  import { useTranslation } from 'react-i18next'
121
123
 
122
124
  export function useT() {
123
- return useTranslation('app') // this will make t-method typed accordingly
125
+ return useTranslation('app') // this will make t-method accordingly typed by locale
124
126
  }
125
127
  ```
126
128
 
127
129
  ```tsx
128
- import {
129
- combineI18NResources,
130
- LOCAL_STORAGE_I18N_KEY,
131
- //
132
- Provider,
133
- RainbowKitProvider,
134
- SessionProvider
135
- } from '@embarkai/ui-kit'
130
+ import { combineI18NResources, LOCAL_STORAGE_I18N_KEY, Provider } from '@embarkai/ui-kit'
136
131
  //
137
132
  import i18n from 'i18next'
138
- import { initReactI18next, useTranslation } from 'react-i18next'
133
+ import { initReactI18next } from 'react-i18next'
139
134
 
140
135
  import { YOUR_APP_TRANSLATION_RESOURSES } from './i18n'
141
136
  import { queryClient } from './queryClient'
137
+ import { useT } from './useTranslation'
142
138
 
143
139
  i18n.use(initReactI18next).init({
144
- resources: combineI18NResources(YOUR_APP_TRANSLATION_RESOURSES),
145
- lng: localStorage.getItem(LOCAL_STORAGE_I18N_KEY) || 'en', // passport saves language setup on change
140
+ resources: combineI18NResources(YOUR_APP_TRANSLATION_RESOURSES), // combineI18NResources() call with no params to skip milti-lang inside dapp
141
+ lng: localStorage.getItem(LOCAL_STORAGE_I18N_KEY) || 'en', // persisted locale
146
142
  fallbackLng: 'en', // default
147
143
  defaultNS: 'app', // your app i18n-namespace, example: app
148
144
  namespace: 'app', // your app i18n-namespace, example: app
149
145
  debug: false
150
146
  })
151
147
 
152
- function Root() {
148
+ function YourDapp() {
153
149
  const { t } = useT()
154
150
 
151
+ return (
152
+ <>
153
+ <header>
154
+ <h1>{t('common.appname')}</h1>
155
+ </header>
156
+
157
+ <main>
158
+ <span>{t('page1.title')}</span>
159
+ </main>
160
+ </>
161
+ )
162
+ }
163
+
164
+ function Root() {
155
165
  return (
156
166
  <QueryClientProvider client={queryClient}>
157
167
  <Provider
158
168
  projectId="your-project-id" // Get from EmbarkAI Dashboard
159
169
  >
160
- <RainbowKitProvider>
161
- <SessionProvider>
162
- <header>
163
- <h1>{t('common.appname')}</h1>
164
- </header>
165
-
166
- <main>
167
- <span>{t('page1.title')}</span>
168
- </main>
169
- </SessionProvider>
170
- </RainbowKitProvider>
170
+ <YourDapp />
171
171
  </Provider>
172
172
  </QueryClientProvider>
173
173
  )
174
174
  }
175
175
  ```
176
176
 
177
- ### 4. Add the Connect Button
177
+ ### 4. Add the ConnectWalletButton
178
178
 
179
179
  ```tsx
180
180
  import { ConnectWalletButton } from '@embarkai/ui-kit'
181
181
 
182
- function YourApp() {
182
+ function YourDappComponent() {
183
183
  const { t } = useT()
184
184
 
185
185
  return (
@@ -228,11 +228,11 @@ That's it! The `ConnectWalletButton` provides a complete authentication UI with
228
228
  projectId="your-project-id" // Required
229
229
  initialConfig={{
230
230
  network: {
231
- name: 'Lumia Beam',
232
- symbol: 'LUMIA',
233
- chainId: 2030232745, // Default chain for your dApp
234
- rpcUrl: 'https://beam-rpc.lumia.org',
235
- explorerUrl: 'https://beam-explorer.lumia.org',
231
+ name: 'BSC Testnet',
232
+ symbol: 'BNB',
233
+ chainId: 97, // Default chain for your dApp
234
+ rpcUrl: "https://bnb-testnet.g.alchemy.com/v2/8WLaZS09KaoheJmGa4sXA",
235
+ explorerUrl: "https://testnet.bscscan.com",
236
236
  testnet: true,
237
237
  forceChain: false
238
238
  },
@@ -244,11 +244,10 @@ That's it! The `ConnectWalletButton` provides a complete authentication UI with
244
244
 
245
245
  The SDK uses the following priority for determining the active chain:
246
246
 
247
- 1. **User's explicit selection** - If user manually switched chains in the UI, their choice is preserved (stored in localStorage)
248
- 2. **dApp config `network.chainId`** - Your configured default chain for first-time users
249
- 3. **SDK default** - BSC
250
-
251
- This ensures returning users keep their preferred chain while new users start on your configured network.
247
+ 1. **dApp config `network.forceChain` = true && `network.chainId` provided** - Your configured default chain will be forced inside your Dapp with no chain selector available
248
+ 2. **User's explicit selection** - If user manually switched chains in the UI, their choice is preserved (stored in localStorage)
249
+ 3. **dApp config `network.chainId`** - Preferred chainId. If no forceChain flag provided SwitchChainChange ux pops whenever user is not on preferred chainID
250
+ 4. **SDK default** - BSC
252
251
 
253
252
  ### Advanced Configuration
254
253
 
@@ -263,14 +262,11 @@ This ensures returning users keep their preferred chain while new users start on
263
262
  title: 'Welcome to MyApp',
264
263
  subtitle: 'Sign in to continue',
265
264
 
266
- dialogClassName: 'string', // beta
265
+ dialogClassName: 'string',
267
266
 
268
- authOrder: ['email', 'passkey', 'social'],
267
+ useExternalIcons: false, // each social configured auth provider can be supllied by custom icons, flag forces to use provided icons via config, otherwise default icons is used
269
268
 
270
- branding: {
271
- tagline: 'Powered by MPC',
272
- link: { text: 'Learn More', url: \'https\:\/\/example.com/docs\' },
273
- },
269
+ authOrder: ['email', 'passkey', 'social'],
274
270
  },
275
271
 
276
272
  // Authentication providers
@@ -288,8 +284,8 @@ This ensures returning users keep their preferred chain while new users start on
288
284
  social: {
289
285
  enabled: true,
290
286
  providers: [
291
- { id: 'Discord', name: 'Discord', enabled: true, comingSoon: false },
292
- { id: 'telegram', name: 'Telegram', enabled: true, comingSoon: false },
287
+ { id: 'Discord', name: 'Discord', enabled: true, comingSoon: false, icon: 'ReactIconComponent' },
288
+ { id: 'telegram', name: 'Telegram', enabled: true, comingSoon: false, icon: 'ReactIconComponent' },
293
289
  ],
294
290
  },
295
291
  wallet: {
@@ -324,39 +320,39 @@ This ensures returning users keep their preferred chain while new users start on
324
320
  // Network configuration
325
321
  // chainId sets default chain for new users (see "Network Chain Priority" above)
326
322
  network: {
327
- name: 'Lumia Beam',
328
- symbol: 'LUMIA',
329
- chainId: 2030232745, // Your dApp's default chain
330
- rpcUrl: 'https\:\/\/beam-rpc.lumia.org',
331
- explorerUrl: 'https\:\/\/beam-explorer.lumia.org',
332
- testnet: true,
333
- forceChain: false, // if true, passport is immediatly forced to switch itto provided chainId, chain selector via SeetingsMenu becomes anavailable
334
- },
323
+ "name": "BSC Testnet",
324
+ "symbol": "BNB",
325
+ "chainId": 97, // Your dApp's default chain
326
+ "rpcUrl": "https\:\/\/bnb-testnet.g.alchemy.com/v2/8WLaZS09KaoheJmGa4sXA",
327
+ "explorerUrl": "https\:\/\/testnet.bscscan.com",
328
+ "testnet": true,
329
+ "forceChain": false // if true, UIKIT is immediatly forced to switch into provided chainId, chain selector via SeetingsMenu becomes anavailable
330
+ }
335
331
  }}
336
332
  callbacks={{
337
333
  onConnecting: ({ method, provider }) => {
338
- console.log('Connecting with:', method, provider);
334
+ console.info('Connecting with:', method, provider);
339
335
  },
340
336
  onConnect: ({ address, session }) => {
341
- console.log('Connected:', address);
337
+ console.info('Connected:', address, session);
342
338
  },
343
339
  onAccount: ({ userId, address, session, hasKeyshare }) => {
344
- console.log('Account ready:', userId);
340
+ console.info('Account ready:', userId);
345
341
  },
346
342
  onAccountUpdate: ({ providers }) => {
347
- console.log('Profile updated:', providers);
343
+ console.info('Profile updated:', providers);
348
344
  },
349
345
  onDisconnect: ({ address, userId }) => {
350
- console.log('Disconnected:', address);
346
+ console.info('Disconnected:', address);
351
347
  },
352
348
  onError: ({ error, message }) => {
353
349
  console.error('Error:', message);
354
350
  },
355
351
  onWalletReady: (status) => {
356
- console.log('Wallet ready:', status.ready);
352
+ console.info('Wallet ready:', status.ready);
357
353
  },
358
354
  onChainChange: ({ chainId, previousChainId }) => {
359
- console.log('Chain Changed:', { previousChainId, chainId })
355
+ console.info('Chain Changed:', { previousChainId, chainId })
360
356
  },
361
357
  }}
362
358
  >
@@ -453,14 +449,12 @@ function DirectTransactionExample() {
453
449
 
454
450
  try {
455
451
  // Send transaction directly with full control
456
- const userOpHash = await sendUserOperation(
457
- session, // Required: session from useAccountSession
458
- '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', // to address
459
- '1000000000000000000', // value in wei (1 ETH)
460
- '0x', // data (optional contract call)
461
- 'standard', // fee type: 'economy' | 'standard' | 'fast'
462
- 'v0.7' // EntryPoint version
463
- )
452
+ const userOpHash = await sendUserOperation(session, {
453
+ to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
454
+ value: '1000000000000000000', // 1 ETH in wei
455
+ data: '0x', // optional contract call
456
+ feeType: 'standard', // (Optional) 'economy' | 'standard' | 'fast'
457
+ })
464
458
 
465
459
  console.log('Transaction submitted:', userOpHash)
466
460
  } catch (error) {
@@ -556,7 +550,7 @@ function SignatureExample() {
556
550
  domain: {
557
551
  name: 'MyDApp', // Your dApp name (must match contract)
558
552
  version: '1', // Contract version
559
- chainId: 994, // Lumia Prism Testnet
553
+ chainId: 994,
560
554
  verifyingContract: '0x...' // Your contract address (REQUIRED in production!)
561
555
  },
562
556
  types: {
@@ -652,14 +646,12 @@ function BackendSubmissionExample() {
652
646
  if (!session) return
653
647
 
654
648
  // Prepare and sign UserOp without sending to bundler
655
- const { userOp, userOpHash } = await prepareUserOperation(
656
- session,
657
- '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', // to
658
- '1000000000000000000', // 1 ETH in wei
659
- '0x', // data
660
- 'standard', // fee type: 'economy' | 'standard' | 'fast'
661
- 'v0.7' // EntryPoint version
662
- )
649
+ const { userOp, userOpHash } = await prepareUserOperation(session, {
650
+ to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
651
+ value: '1000000000000000000', // 1 ETH in wei
652
+ data: '0x',
653
+ feeType: 'standard', // (Optional) 'economy' | 'standard' | 'fast'
654
+ })
663
655
 
664
656
  // Send to backend for validation and submission
665
657
  await fetch('/api/submit-transaction', {
@@ -684,7 +676,7 @@ import { getUserOperationReceipt, sendUserOperationRaw } from '@embarkai/core'
684
676
  import { getChainConfig } from '@embarkai/core/read'
685
677
  import { recoverAddress } from 'viem'
686
678
 
687
- const CHAIN_ID = 2030232745 // Lumia Testnet
679
+ const CHAIN_ID = 2030232745
688
680
 
689
681
  // Get chain config for bundler URL
690
682
  const chainConfig = getChainConfig(CHAIN_ID)
@@ -731,13 +723,6 @@ return {
731
723
  }
732
724
  ```
733
725
 
734
- **Network Configuration:**
735
-
736
- | Network | Chain ID | Bundler URL |
737
- | --------------------- | ---------- | ------------------------------------------- |
738
- | Lumia Testnet (Beam) | 2030232745 | https://api.lumiapassport.com/rundler |
739
- | Lumia Mainnet (Prism) | 994873017 | https://api.lumiapassport.com/rundler-prism |
740
-
741
726
  ### useOpenPage - Programmatic EmbarkAI Dialog Control
742
727
 
743
728
  Control the EmbarkAI dialog programmatically.
@@ -751,7 +736,7 @@ function CustomAuthButton() {
751
736
  return (
752
737
  <div>
753
738
  <button onClick={() => openEmbarkAI(PageKey.AUTH)}>Sign In</button>
754
- <button onClick={() => openEmbarkAI(PageKey.RECEIVE)}>Receive LUMIA</button>
739
+ <button onClick={() => openEmbarkAI(PageKey.RECEIVE)}>Receive CRYPTO</button>
755
740
 
756
741
  <button onClick={close}>Close Dialog</button>
757
742
  </div>
@@ -780,11 +765,7 @@ function AppHeader() {
780
765
 
781
766
  ### Email OTP
782
767
 
783
- Users receive a one-time code via email.
784
-
785
- ```tsx
786
- // Configured by default, no additional setup needed
787
- ```
768
+ Configured by default, no additional setup needed
788
769
 
789
770
  ### Passkey (WebAuthn)
790
771
 
@@ -813,29 +794,24 @@ initialConfig={{
813
794
 
814
795
  ### External Wallet
815
796
 
816
- Connect existing wallets (MetaMask, WalletConnect, etc.).
817
-
818
- ```tsx
819
- // Configured by default
820
- // Uses RainbowKit for wallet connections
821
- ```
797
+ ...to be updated
822
798
 
823
799
  ## Styling
824
800
 
825
- ### Passport Dialog Window
801
+ ### UIKIT Dialog Window
826
802
 
827
- Global Passport window view can be redefined via config prop by providing specific dialogClassName.
803
+ Global UIKIT window view can be redefined via config prop - dialogClassName.
828
804
 
829
805
  > **Note** Providing "dialogClassName" will disable default dialog window styles
830
806
 
831
807
  ```css
832
- .passport-dialog-classname {
808
+ .uikit-dialog-classname {
833
809
  background-color: rgba(14, 14, 14, 0.7);
834
810
  backdrop-filter: blur(10px);
835
811
 
836
812
  box-shadow:
837
813
  0 0 8px rgba(14, 14, 14, 0.1),
838
- inset 0 0 0 1px var(--account-abstraction-bd);
814
+ inset 0 0 0 1px var(--embark-ui-bd);
839
815
  }
840
816
  ```
841
817
 
@@ -848,16 +824,16 @@ import 'index.css'
848
824
  ...
849
825
  ui: {
850
826
  ...
851
- dialogClassName: 'passport-dialog-classname',
827
+ dialogClassName: 'uikit-dialog-classname',
852
828
  ...
853
829
  },
854
830
  ...
855
831
  }}/>
856
832
  ```
857
833
 
858
- ### Passport styles
834
+ ### CSSV styles & Dark/Light modes
859
835
 
860
- Passport provides global hook for Light/Dark modes - useColorMode - use it within yor application instead of any local mode declaration.
836
+ UIKIT provides global hook for Light/Dark modes - useColorMode - use it within yor application instead of any local mode declaration.
861
837
 
862
838
  ```tsx
863
839
  import { useColorMode } from '@embarkai/ui-kit'
@@ -875,62 +851,62 @@ function YourAnyComponent() {
875
851
  }
876
852
  ```
877
853
 
878
- Passport styles are possible to match with your project via css-variables set (use separate for dark & light).
854
+ UIKIT styles are possible to match with your project via css-variables set (use separate for dark & light).
879
855
  Values will be automatically applied according to selected colorMode.
880
856
  The simpliest way to customize cssv is via app index.css file:
881
857
 
882
858
  ```css
883
- .account-abstraction-ui-scope[data-current-theme-mode='light'],
884
- .account-abstraction-ui-scope[data-current-theme-mode='dark'] {
859
+ .embarkai-ui-scope[data-current-theme-mode='light'],
860
+ .embarkai-ui-scope[data-current-theme-mode='dark'] {
885
861
  /* fixed cssv */
886
- --account-abstraction-maw: 384px;
887
- --account-abstraction-pd: 12px;
888
- --account-abstraction-gap: 10px;
889
- --account-abstraction-bdrs: 20px;
890
- --account-abstraction-element-bdrs: 10px;
862
+ --embark-ui-maw: 384px;
863
+ --embark-ui-pd: 12px;
864
+ --embark-ui-gap: 10px;
865
+ --embark-ui-bdrs: 20px;
866
+ --embark-ui-element-bdrs: 10px;
891
867
 
892
868
  /** overlay */
893
- --account-abstraction-overlay: rgba(255, 255, 255, 0.8);
894
- --account-abstraction-backdrop-blur: 10px;
869
+ --embark-ui-overlay: rgba(255, 255, 255, 0.8);
870
+ --embark-ui-backdrop-blur: 10px;
895
871
 
896
872
  /** surface backgrounds */
897
- --account-abstraction-bg: #ffffff;
873
+ --embark-ui-bg: #ffffff;
898
874
 
899
875
  /** text */
900
- --account-abstraction-fg: #000000;
901
- --account-abstraction-fg-h: rgba(0, 0, 0, 0.6);
902
- --account-abstraction-fg-a: rgba(0, 0, 0, 0.4);
903
- --account-abstraction-fg-inverted: #ffffff;
904
- --account-abstraction-fg-muted: rgba(0, 0, 0, 0.6);
876
+ --embark-ui-fg: #000000;
877
+ --embark-ui-fg-h: rgba(0, 0, 0, 0.6);
878
+ --embark-ui-fg-a: rgba(0, 0, 0, 0.4);
879
+ --embark-ui-fg-inverted: #ffffff;
880
+ --embark-ui-fg-muted: rgba(0, 0, 0, 0.6);
905
881
 
906
882
  /** backgrounds i.e. buttons bg etc */
907
- --account-abstraction-primary: #000000;
908
- --account-abstraction-primary-h: rgba(0, 0, 0, 0.8);
909
- --account-abstraction-primary-a: rgba(0, 0, 0, 0.6);
883
+ --embark-ui-primary: #000000;
884
+ --embark-ui-primary-h: rgba(0, 0, 0, 0.8);
885
+ --embark-ui-primary-a: rgba(0, 0, 0, 0.6);
910
886
 
911
- --account-abstraction-secondary: #e4e4e4;
912
- --account-abstraction-secondary-h: rgba(228, 228, 228, 0.8);
913
- --account-abstraction-secondary-a: rgba(228, 228, 228, 0.6);
887
+ --embark-ui-secondary: #e4e4e4;
888
+ --embark-ui-secondary-h: rgba(228, 228, 228, 0.8);
889
+ --embark-ui-secondary-a: rgba(228, 228, 228, 0.6);
914
890
 
915
891
  /** borders */
916
- --account-abstraction-bd: #ebebeb;
917
- --account-abstraction-bd-intense: rgb(169, 169, 169);
892
+ --embark-ui-bd: #ebebeb;
893
+ --embark-ui-bd-intense: rgb(169, 169, 169);
918
894
 
919
895
  /** shadows */
920
- --account-abstraction-shadow-c: rgba(0, 0, 0, 0.1);
896
+ --embark-ui-shadow-c: rgba(0, 0, 0, 0.1);
921
897
 
922
898
  /** highlight colors */
923
- --account-abstraction-info: #000000;
924
- --account-abstraction-bg-info: #e4e4e4;
899
+ --embark-ui-info: #000000;
900
+ --embark-ui-bg-info: #e4e4e4;
925
901
 
926
- --account-abstraction-success: #000000;
927
- --account-abstraction-bg-success: #21ff51;
902
+ --embark-ui-success: #000000;
903
+ --embark-ui-bg-success: #21ff51;
928
904
 
929
- --account-abstraction-warning: #000000;
930
- --account-abstraction-bg-warning: #e9fa00;
905
+ --embark-ui-warning: #000000;
906
+ --embark-ui-bg-warning: #e9fa00;
931
907
 
932
- --account-abstraction-error: #ffffff;
933
- --account-abstraction-bg-error: #d6204e;
908
+ --embark-ui-error: #ffffff;
909
+ --embark-ui-bg-error: #d6204e;
934
910
  }
935
911
  ```
936
912
 
@@ -947,8 +923,6 @@ import type { AuthProvider, ProviderConfig, User, WalletInfo } from '@embarkai/u
947
923
  Check out the `/examples` directory for complete working examples:
948
924
 
949
925
  - **React + Vite** - Modern React setup with Vite
950
- - **Next.js** - Next.js App Router integration
951
- - **React + TypeScript** - Full TypeScript example
952
926
 
953
927
  ## Security
954
928
 
@@ -957,19 +931,10 @@ Check out the `/examples` directory for complete working examples:
957
931
  - 🔐 **No Private Key Exposure** - Private keys never exist in complete form on client
958
932
  - ✅ **Non-custodial** - Users maintain full control of their accounts
959
933
 
960
- ## Need Help?
961
-
962
- - 📖 [Documentation](https://docs.lumiapassport.com)
963
- - 💬 [Discord Community](https://discord.gg/lumia)
964
- - 🐛 [Report Issues](https://github.com/lumiachain/lumia-passport-sdk/issues)
965
- - 📧 [Email Support](mailto:support@lumia.org)
966
-
967
934
  ## License
968
935
 
969
936
  MIT License - see LICENSE file for details.
970
937
 
971
938
  ## Links
972
939
 
973
- - [Website](https://lumiapassport.com)
974
- - [GitHub](https://github.com/lumiachain/lumia-passport-sdk)
975
940
  - [NPM Package](https://www.npmjs.com/package/@embarkai/ui-kit)
@@ -15,7 +15,7 @@
15
15
  <meta http-equiv="X-Content-Type-Options" content="nosniff" />
16
16
  <meta http-equiv="Referrer-Policy" content="strict-origin-when-cross-origin" />
17
17
 
18
- <title>EmbarkAI Secure Wallet - iframe version 0.1.4</title>
18
+ <title>EmbarkAI Secure Wallet - iframe version 0.1.6</title>
19
19
 
20
20
  <!-- Styles will be injected by build process -->
21
21
  <style>