@embarkai/ui-kit 0.1.4 → 0.1.5

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
  >
@@ -556,7 +552,7 @@ function SignatureExample() {
556
552
  domain: {
557
553
  name: 'MyDApp', // Your dApp name (must match contract)
558
554
  version: '1', // Contract version
559
- chainId: 994, // Lumia Prism Testnet
555
+ chainId: 994,
560
556
  verifyingContract: '0x...' // Your contract address (REQUIRED in production!)
561
557
  },
562
558
  types: {
@@ -684,7 +680,7 @@ import { getUserOperationReceipt, sendUserOperationRaw } from '@embarkai/core'
684
680
  import { getChainConfig } from '@embarkai/core/read'
685
681
  import { recoverAddress } from 'viem'
686
682
 
687
- const CHAIN_ID = 2030232745 // Lumia Testnet
683
+ const CHAIN_ID = 2030232745
688
684
 
689
685
  // Get chain config for bundler URL
690
686
  const chainConfig = getChainConfig(CHAIN_ID)
@@ -731,13 +727,6 @@ return {
731
727
  }
732
728
  ```
733
729
 
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
730
  ### useOpenPage - Programmatic EmbarkAI Dialog Control
742
731
 
743
732
  Control the EmbarkAI dialog programmatically.
@@ -751,7 +740,7 @@ function CustomAuthButton() {
751
740
  return (
752
741
  <div>
753
742
  <button onClick={() => openEmbarkAI(PageKey.AUTH)}>Sign In</button>
754
- <button onClick={() => openEmbarkAI(PageKey.RECEIVE)}>Receive LUMIA</button>
743
+ <button onClick={() => openEmbarkAI(PageKey.RECEIVE)}>Receive CRYPTO</button>
755
744
 
756
745
  <button onClick={close}>Close Dialog</button>
757
746
  </div>
@@ -780,11 +769,7 @@ function AppHeader() {
780
769
 
781
770
  ### Email OTP
782
771
 
783
- Users receive a one-time code via email.
784
-
785
- ```tsx
786
- // Configured by default, no additional setup needed
787
- ```
772
+ Configured by default, no additional setup needed
788
773
 
789
774
  ### Passkey (WebAuthn)
790
775
 
@@ -813,29 +798,24 @@ initialConfig={{
813
798
 
814
799
  ### External Wallet
815
800
 
816
- Connect existing wallets (MetaMask, WalletConnect, etc.).
817
-
818
- ```tsx
819
- // Configured by default
820
- // Uses RainbowKit for wallet connections
821
- ```
801
+ ...to be updated
822
802
 
823
803
  ## Styling
824
804
 
825
- ### Passport Dialog Window
805
+ ### UIKIT Dialog Window
826
806
 
827
- Global Passport window view can be redefined via config prop by providing specific dialogClassName.
807
+ Global UIKIT window view can be redefined via config prop - dialogClassName.
828
808
 
829
809
  > **Note** Providing "dialogClassName" will disable default dialog window styles
830
810
 
831
811
  ```css
832
- .passport-dialog-classname {
812
+ .uikit-dialog-classname {
833
813
  background-color: rgba(14, 14, 14, 0.7);
834
814
  backdrop-filter: blur(10px);
835
815
 
836
816
  box-shadow:
837
817
  0 0 8px rgba(14, 14, 14, 0.1),
838
- inset 0 0 0 1px var(--account-abstraction-bd);
818
+ inset 0 0 0 1px var(--embark-ui-bd);
839
819
  }
840
820
  ```
841
821
 
@@ -848,16 +828,16 @@ import 'index.css'
848
828
  ...
849
829
  ui: {
850
830
  ...
851
- dialogClassName: 'passport-dialog-classname',
831
+ dialogClassName: 'uikit-dialog-classname',
852
832
  ...
853
833
  },
854
834
  ...
855
835
  }}/>
856
836
  ```
857
837
 
858
- ### Passport styles
838
+ ### CSSV styles & Dark/Light modes
859
839
 
860
- Passport provides global hook for Light/Dark modes - useColorMode - use it within yor application instead of any local mode declaration.
840
+ UIKIT provides global hook for Light/Dark modes - useColorMode - use it within yor application instead of any local mode declaration.
861
841
 
862
842
  ```tsx
863
843
  import { useColorMode } from '@embarkai/ui-kit'
@@ -875,62 +855,62 @@ function YourAnyComponent() {
875
855
  }
876
856
  ```
877
857
 
878
- Passport styles are possible to match with your project via css-variables set (use separate for dark & light).
858
+ UIKIT styles are possible to match with your project via css-variables set (use separate for dark & light).
879
859
  Values will be automatically applied according to selected colorMode.
880
860
  The simpliest way to customize cssv is via app index.css file:
881
861
 
882
862
  ```css
883
- .account-abstraction-ui-scope[data-current-theme-mode='light'],
884
- .account-abstraction-ui-scope[data-current-theme-mode='dark'] {
863
+ .embarkai-ui-scope[data-current-theme-mode='light'],
864
+ .embarkai-ui-scope[data-current-theme-mode='dark'] {
885
865
  /* 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;
866
+ --embark-ui-maw: 384px;
867
+ --embark-ui-pd: 12px;
868
+ --embark-ui-gap: 10px;
869
+ --embark-ui-bdrs: 20px;
870
+ --embark-ui-element-bdrs: 10px;
891
871
 
892
872
  /** overlay */
893
- --account-abstraction-overlay: rgba(255, 255, 255, 0.8);
894
- --account-abstraction-backdrop-blur: 10px;
873
+ --embark-ui-overlay: rgba(255, 255, 255, 0.8);
874
+ --embark-ui-backdrop-blur: 10px;
895
875
 
896
876
  /** surface backgrounds */
897
- --account-abstraction-bg: #ffffff;
877
+ --embark-ui-bg: #ffffff;
898
878
 
899
879
  /** 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);
880
+ --embark-ui-fg: #000000;
881
+ --embark-ui-fg-h: rgba(0, 0, 0, 0.6);
882
+ --embark-ui-fg-a: rgba(0, 0, 0, 0.4);
883
+ --embark-ui-fg-inverted: #ffffff;
884
+ --embark-ui-fg-muted: rgba(0, 0, 0, 0.6);
905
885
 
906
886
  /** 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);
887
+ --embark-ui-primary: #000000;
888
+ --embark-ui-primary-h: rgba(0, 0, 0, 0.8);
889
+ --embark-ui-primary-a: rgba(0, 0, 0, 0.6);
910
890
 
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);
891
+ --embark-ui-secondary: #e4e4e4;
892
+ --embark-ui-secondary-h: rgba(228, 228, 228, 0.8);
893
+ --embark-ui-secondary-a: rgba(228, 228, 228, 0.6);
914
894
 
915
895
  /** borders */
916
- --account-abstraction-bd: #ebebeb;
917
- --account-abstraction-bd-intense: rgb(169, 169, 169);
896
+ --embark-ui-bd: #ebebeb;
897
+ --embark-ui-bd-intense: rgb(169, 169, 169);
918
898
 
919
899
  /** shadows */
920
- --account-abstraction-shadow-c: rgba(0, 0, 0, 0.1);
900
+ --embark-ui-shadow-c: rgba(0, 0, 0, 0.1);
921
901
 
922
902
  /** highlight colors */
923
- --account-abstraction-info: #000000;
924
- --account-abstraction-bg-info: #e4e4e4;
903
+ --embark-ui-info: #000000;
904
+ --embark-ui-bg-info: #e4e4e4;
925
905
 
926
- --account-abstraction-success: #000000;
927
- --account-abstraction-bg-success: #21ff51;
906
+ --embark-ui-success: #000000;
907
+ --embark-ui-bg-success: #21ff51;
928
908
 
929
- --account-abstraction-warning: #000000;
930
- --account-abstraction-bg-warning: #e9fa00;
909
+ --embark-ui-warning: #000000;
910
+ --embark-ui-bg-warning: #e9fa00;
931
911
 
932
- --account-abstraction-error: #ffffff;
933
- --account-abstraction-bg-error: #d6204e;
912
+ --embark-ui-error: #ffffff;
913
+ --embark-ui-bg-error: #d6204e;
934
914
  }
935
915
  ```
936
916
 
@@ -947,8 +927,6 @@ import type { AuthProvider, ProviderConfig, User, WalletInfo } from '@embarkai/u
947
927
  Check out the `/examples` directory for complete working examples:
948
928
 
949
929
  - **React + Vite** - Modern React setup with Vite
950
- - **Next.js** - Next.js App Router integration
951
- - **React + TypeScript** - Full TypeScript example
952
930
 
953
931
  ## Security
954
932
 
@@ -957,19 +935,10 @@ Check out the `/examples` directory for complete working examples:
957
935
  - 🔐 **No Private Key Exposure** - Private keys never exist in complete form on client
958
936
  - ✅ **Non-custodial** - Users maintain full control of their accounts
959
937
 
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
938
  ## License
968
939
 
969
940
  MIT License - see LICENSE file for details.
970
941
 
971
942
  ## Links
972
943
 
973
- - [Website](https://lumiapassport.com)
974
- - [GitHub](https://github.com/lumiachain/lumia-passport-sdk)
975
944
  - [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.5</title>
19
19
 
20
20
  <!-- Styles will be injected by build process -->
21
21
  <style>