@solidxai/core-ui 0.1.7-beta.9 → 0.1.8-beta.0

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 (44) hide show
  1. package/LICENSE +89 -0
  2. package/README.md +217 -0
  3. package/dist/components/auth/SolidLogin.js +1 -1
  4. package/dist/components/auth/SolidLogin.js.map +1 -1
  5. package/dist/components/auth/SolidLogin.tsx +2 -2
  6. package/dist/components/common/GeneralSettings.js +31 -29
  7. package/dist/components/common/GeneralSettings.js.map +1 -1
  8. package/dist/components/common/GeneralSettings.tsx +51 -41
  9. package/dist/components/common/SolidSettings/LlmSettings/AiModelConfigTab.d.ts +18 -14
  10. package/dist/components/common/SolidSettings/LlmSettings/AiModelConfigTab.d.ts.map +1 -1
  11. package/dist/components/common/SolidSettings/LlmSettings/AiModelConfigTab.js +130 -26
  12. package/dist/components/common/SolidSettings/LlmSettings/AiModelConfigTab.js.map +1 -1
  13. package/dist/components/common/SolidSettings/LlmSettings/AiModelConfigTab.tsx +319 -80
  14. package/dist/components/shad-cn-ui/SolidTabs.d.ts +2 -1
  15. package/dist/components/shad-cn-ui/SolidTabs.d.ts.map +1 -1
  16. package/dist/components/shad-cn-ui/SolidTabs.js +5 -5
  17. package/dist/components/shad-cn-ui/SolidTabs.js.map +1 -1
  18. package/dist/components/shad-cn-ui/SolidTabs.tsx +6 -0
  19. package/dist/helpers/registry.js +87 -87
  20. package/dist/helpers/registry.js.map +1 -1
  21. package/dist/helpers/registry.ts +87 -87
  22. package/dist/index.d.ts +1 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.ts +11 -0
  27. package/dist/modules/solidUiModule.d.ts +40 -0
  28. package/dist/modules/solidUiModule.d.ts.map +1 -0
  29. package/dist/modules/solidUiModule.js +83 -0
  30. package/dist/modules/solidUiModule.js.map +1 -0
  31. package/dist/modules/solidUiModule.ts +148 -0
  32. package/dist/routes/SolidLayoutRegistry.d.ts.map +1 -1
  33. package/dist/routes/SolidLayoutRegistry.js +45 -13
  34. package/dist/routes/SolidLayoutRegistry.js.map +1 -1
  35. package/dist/routes/SolidLayoutRegistry.tsx +55 -16
  36. package/dist/routes/guards/GuestGuard.d.ts.map +1 -1
  37. package/dist/routes/guards/GuestGuard.js +2 -7
  38. package/dist/routes/guards/GuestGuard.js.map +1 -1
  39. package/dist/routes/guards/GuestGuard.tsx +2 -6
  40. package/dist/types/extension-registry.d.ts +9 -9
  41. package/dist/types/extension-registry.js +9 -9
  42. package/dist/types/extension-registry.js.map +1 -1
  43. package/dist/types/extension-registry.ts +9 -9
  44. package/package.json +2 -2
package/LICENSE ADDED
@@ -0,0 +1,89 @@
1
+ Business Source License 1.1
2
+
3
+ License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB plc.
5
+
6
+ Parameters:
7
+
8
+ Licensor: Logicloop Ventures Limited
9
+ Licensed Work: SolidX Core UI (@solidxai/core-ui)
10
+ Additional Use Grant: Individuals and organizations with total annual revenue
11
+ (including funding) of less than $1,000,000 USD may use
12
+ the Licensed Work for any purpose, including commercial
13
+ production use. Organizations with total annual revenue
14
+ (including funding) of $1,000,000 USD or more must obtain
15
+ a commercial Enterprise License before using the Licensed
16
+ Work in production. Contact https://solidxai.com/contact
17
+ for licensing.
18
+
19
+ "Production use" means any use of the Licensed Work other
20
+ than development, debugging, evaluation, or testing.
21
+
22
+ Change Date: None
23
+ Change License: Apache 2.0
24
+
25
+ Notice:
26
+
27
+ In consideration of the right to use this License's text and the
28
+ "Business Source License" name and trademark, Licensor covenants to MariaDB,
29
+ and to all other recipients of the Licensed Work, that Licensor will:
30
+
31
+ 1. Specify as the Change License the Apache License, Version 2.0 or any
32
+ later version, or a license that is compatible with GPL Version 2.0 or
33
+ a later version, where "compatible" means that software provided under
34
+ the Change License can be included in a program with software provided
35
+ under GPL Version 2.0 or a later version. Licensor may specify
36
+ additional Change Licenses without limitation.
37
+
38
+ 2. Specify an additional grant of rights to use that does not impose any
39
+ additional restriction on the rights granted in this License, as the
40
+ Additional Use Grant.
41
+
42
+ 3. Not modify this License in any other way.
43
+
44
+ Terms
45
+
46
+ The Licensor hereby grants you the right to copy, modify, create derivative
47
+ works, redistribute, and make non-production use of the Licensed Work. The
48
+ Licensor may make an Additional Use Grant, above, permitting limited
49
+ production use.
50
+
51
+ Effective on the Change Date, or the fourth anniversary of the first
52
+ publicly available distribution of a specific version of the Licensed Work
53
+ under this License, whichever comes first, the Licensor hereby grants you
54
+ rights under the terms of the Change License, and the rights granted in the
55
+ paragraph above terminate.
56
+
57
+ If your use of the Licensed Work does not comply with the requirements
58
+ currently in effect as described in this License, you must purchase a
59
+ commercial license from the Licensor, its affiliated entities, or authorized
60
+ resellers, or you must refrain from using the Licensed Work.
61
+
62
+ All copies of the original and modified Licensed Work, and derivative works
63
+ of the Licensed Work, are subject to this License. This License applies
64
+ separately for each version of the Licensed Work and the Change Date may
65
+ vary for each version of the Licensed Work released by Licensor.
66
+
67
+ You must conspicuously display this License on each original or modified copy
68
+ of the Licensed Work. If you receive the Licensed Work in original or
69
+ modified form from a third party, the terms and conditions set forth in this
70
+ License apply to your use of that work.
71
+
72
+ Any use of the Licensed Work in violation of this License will automatically
73
+ terminate your rights under this License for the current and all other
74
+ versions of the Licensed Work.
75
+
76
+ This License does not grant you any right in any trademark or logo of
77
+ Licensor or its affiliates (provided that you may use a trademark or logo of
78
+ Licensor as expressly required by this License).
79
+
80
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
81
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
82
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
83
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
84
+ TITLE.
85
+
86
+ For complete terms and conditions, see https://solidxai.com/terms.
87
+
88
+ For questions about licensing, contact support@solidxai.com or visit
89
+ https://solidxai.com/contact.
package/README.md ADDED
@@ -0,0 +1,217 @@
1
+ # @solidxai/core-ui
2
+
3
+ > The React UI framework behind every SolidX application — auth flows, metadata-driven forms and tables, dashboards, and full state management — wired up and ready to use.
4
+
5
+ `@solidxai/core-ui` is the frontend counterpart to [`@solidxai/core`](https://www.npmjs.com/package/@solidxai/core). It ships a complete set of React components, Redux slices, RTK Query API integrations, route guards, and utility hooks designed to work with the SolidX backend platform — so you can build production-grade admin and data-management interfaces without rebuilding the same infrastructure on every project.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@solidxai/core-ui)](https://www.npmjs.com/package/@solidxai/core-ui)
8
+ [![License: BSL-1.1](https://img.shields.io/badge/License-BSL--1.1-blue.svg)](https://mariadb.com/bsl11/)
9
+ [![Documentation](https://img.shields.io/badge/docs-solidxai.com-blue)](https://docs.solidxai.com/docs)
10
+ [![Discord](https://img.shields.io/badge/discord-online-brightgreen.svg)](https://discord.gg/yh4KZf8c)
11
+
12
+
13
+ ## Why @solidxai/core-ui?
14
+
15
+ Building admin dashboards and data-management UIs involves the same heavy lifting every time: authentication screens, data tables with filtering and pagination, form builders for every field type, role-aware UI elements, file upload flows, and a global state layer that ties it all together.
16
+
17
+ `@solidxai/core-ui` bundles all of that into a single, cohesive package that is:
18
+
19
+ - **Metadata-driven** — point `SolidListView` or `SolidFormView` at a model name and get a fully functional table or form without writing column definitions or field components by hand.
20
+ - **Fully typed** — complete TypeScript definitions for every component, hook, slice, and utility.
21
+ - **Extensible** — register custom components and functions into the extension registry; the core engine picks them up automatically.
22
+ - **Backend-agnostic escape hatches** — pre-configured Axios instance and RTK Query base query, but nothing prevents you from calling your own endpoints alongside them.
23
+
24
+
25
+ ## Core Capabilities
26
+
27
+ ### Metadata-driven Views
28
+
29
+ The centrepiece of the library. Describe your data model once and get complete UI for free.
30
+
31
+ - **`SolidListView`** — data table with multi-column sorting, rich filter expressions, group-by, column visibility, row actions, import/export, and pagination; supports 15+ column types including relations, media, rich text, and computed fields.
32
+ - **`SolidFormView`** — full create/edit form rendered from model metadata; supports 15+ field types — boolean, date/time, decimal, integer, short/long text, rich text, JSON, media (single & multiple), static/dynamic selection, relation, email, password, and more.
33
+ - **`SolidFormStepper`** — multi-step wizard wrapper for any form.
34
+ - **`SolidTreeView` / `SolidTreeTable`** — hierarchical tree display, with optional table columns.
35
+ - **`SolidKanbanView`** — kanban board view backed by the same model metadata.
36
+
37
+ ### Authentication
38
+
39
+ Complete auth UI with no extra wiring needed.
40
+
41
+ - Login, registration, forgot/reset password, and force-change-password screens
42
+ - OTP / passwordless flows (SMS and email)
43
+ - Google OAuth2 integration
44
+ - JWT access/refresh token management via `authSlice` and the `baseQueryWithAuth` RTK Query adapter
45
+ - `AuthGuard` and `GuestGuard` route protection components
46
+
47
+ ### Layouts & Navigation
48
+
49
+ - `AdminLayout` / `Layout` — shell layouts with sidebar, header, and footer regions
50
+ - `SolidAiStudioLayout` / `SolidStudio` — studio/configuration mode for admin users
51
+ - `NavbarOne`, `NavbarTwo` — responsive top navigation bars
52
+ - `AdminSidebar`, `UserSidebar` — collapsible sidebars
53
+ - `GlobalSearch` — application-wide search component
54
+ - `FilterMenu` — slide-in advanced filter panel
55
+
56
+ ### Dashboards
57
+
58
+ - `SolidDashboard` — drag-and-drop dashboard grid backed by Gridstack
59
+ - `SolidViewLayoutManager` — layout composer for arranging views
60
+ - Chart.js integration: bar, line, pie, doughnut, data table, and meter-group chart types
61
+ - Security-aware aggregates that respect the active user's role
62
+
63
+ ### Redux Store & API Layer
64
+
65
+ A pre-wired Redux Toolkit store with slices and RTK Query API definitions ready to drop in.
66
+
67
+ | Slices | Purpose |
68
+ |---|---|
69
+ | `authSlice` | Token storage and logout |
70
+ | `userSlice` | Current user and authentication state |
71
+ | `themeSlice` | Light / dark theme |
72
+ | `toastSlice` | Toast notification queue |
73
+ | `popupSlice` | Modal open/close state |
74
+ | `navbarSlice` | Navbar visibility |
75
+ | `dataViewSlice` | Grid vs list view toggle |
76
+
77
+ API slices (RTK Query) cover: auth, users, roles, modules, models, fields, views, menus, media, import/export, dashboards, settings, chatter, API keys, and AI interactions.
78
+
79
+ ### UI Component Library
80
+
81
+ A complete set of primitives built on Radix UI, PrimeReact, and Bootstrap, including:
82
+
83
+ - Buttons, inputs, textareas, password fields, date pickers, autocomplete
84
+ - Dialogs, popovers, tooltips, accordions, tabs, dropdowns
85
+ - Checkboxes, radio groups, switches, sliders, progress bars
86
+ - Rich text editor (Quill), code editor (Monaco / CodeMirror)
87
+ - Media lightbox, image viewer, PDF viewer
88
+ - `SolidIcon` — custom icon registry backed by Lucide React
89
+
90
+ ### State, Routing & Providers
91
+
92
+ - `StoreProvider` — wraps the app with the Redux store
93
+ - `SolidThemeProvider` — theme context
94
+ - `SolidToastProvider` — toast notification context
95
+ - `SolidLayoutRegistryProvider` — layout registry context
96
+ - `getSolidRoutes` — generates the full route tree from module metadata
97
+ - `useSession`, `useRouter`, `usePathname`, `useSearchParams` — familiar routing hooks
98
+
99
+ ### Utilities & Helpers
100
+
101
+ - `solidAxios` — pre-configured Axios instance with auth headers
102
+ - `solidGet`, `solidPost`, `solidPut`, `solidPatch`, `solidDelete` — typed HTTP helpers
103
+ - `signIn`, `signOut`, `getSession`, `refreshAccessToken` — auth session helpers
104
+ - `permissionExpression`, `hasAnyRole` — permission evaluation helpers
105
+ - `downloadFileWithProgress`, `downloadMediaFile`, `fetchS3Url` — file utilities
106
+ - `eventBus` / `AppEvents` — application-wide event system
107
+ - `registerExtensionComponent`, `registerExtensionFunction` — extension registry
108
+
109
+ ### Chatter
110
+
111
+ - `SolidChatter` — per-record messaging thread and activity feed component, mirroring the backend Chatter feature
112
+
113
+
114
+ ## Installation
115
+
116
+ ```bash
117
+ npm install @solidxai/core-ui
118
+ ```
119
+
120
+ ### Peer dependencies
121
+
122
+ ```bash
123
+ npm install react react-dom react-router-dom \
124
+ @reduxjs/toolkit react-redux \
125
+ bootstrap primereact primeicons primeflex
126
+ ```
127
+
128
+
129
+ ## Quick Setup
130
+
131
+ ### 1. Create the store
132
+
133
+ ```typescript
134
+ import { createSolidStore } from '@solidxai/core-ui';
135
+
136
+ export const store = createSolidStore({
137
+ entities: ['User', 'Post'], // your entity names
138
+ reducers: { mySlice: myReducer },
139
+ middlewares: [myMiddleware],
140
+ });
141
+ ```
142
+
143
+ ### 2. Wrap your app
144
+
145
+ ```typescript
146
+ import {
147
+ StoreProvider,
148
+ SolidThemeProvider,
149
+ SolidToastProvider,
150
+ } from '@solidxai/core-ui';
151
+
152
+ export default function App() {
153
+ return (
154
+ <StoreProvider store={store}>
155
+ <SolidThemeProvider>
156
+ <SolidToastProvider>
157
+ <Router />
158
+ </SolidToastProvider>
159
+ </SolidThemeProvider>
160
+ </StoreProvider>
161
+ );
162
+ }
163
+ ```
164
+
165
+ ### 3. Use metadata-driven views
166
+
167
+ ```typescript
168
+ import { SolidListView, SolidFormView } from '@solidxai/core-ui';
169
+
170
+ // Renders a full data table for the "users" model
171
+ <SolidListView moduleName="users" viewName="list" />
172
+
173
+ // Renders a create/edit form for the "users" model
174
+ <SolidFormView moduleName="users" viewName="create" />
175
+ ```
176
+
177
+ For full configuration options — environment variables, theming, extension points, and advanced layout setup — see the [Developer Documentation](https://docs.solidxai.com/docs).
178
+
179
+
180
+ ## Technology Stack
181
+
182
+ | Concern | Technology |
183
+ |---|---|
184
+ | Framework | React 18 + TypeScript |
185
+ | Routing | React Router DOM 7 |
186
+ | State management | Redux Toolkit + RTK Query |
187
+ | HTTP | Axios |
188
+ | UI primitives | Radix UI · PrimeReact · Bootstrap 5 |
189
+ | Data tables | TanStack Table 8 |
190
+ | Charts | Chart.js |
191
+ | Dashboard grid | Gridstack · React Grid Layout |
192
+ | Rich text | Quill |
193
+ | Code editor | Monaco Editor · CodeMirror |
194
+ | Forms | Formik + Yup |
195
+ | Drag and drop | @hello-pangea/dnd |
196
+ | Date/time | Day.js |
197
+ | Icons | Lucide React |
198
+
199
+ ---
200
+
201
+ ## Part of the SolidX Platform
202
+
203
+ `@solidxai/core-ui` is the frontend foundation of the [SolidX](https://solidxai.com) low-code development platform. It pairs with [`@solidxai/core`](https://www.npmjs.com/package/@solidxai/core) (the NestJS backend module) to form a complete full-stack framework. SolidX generates fully open-source, standards-based NestJS + React code that your team owns outright — no proprietary runtime, no lock-in.
204
+
205
+ | | |
206
+ |---|---|
207
+ | Website | [solidxai.com](https://solidxai.com) |
208
+ | Documentation | [docs.solidxai.com](https://docs.solidxai.com/docs) |
209
+ | Backend package | [@solidxai/core](https://www.npmjs.com/package/@solidxai/core) |
210
+ | Discord | [discord.gg/yh4KZf8c](https://discord.gg/yh4KZf8c) |
211
+ | Support | support@solidxai.com |
212
+
213
+ ---
214
+
215
+ ## License
216
+
217
+ BSL-1.1 © [Logicloop](https://logicloop.io)
@@ -197,7 +197,7 @@ var SolidLogin = function (_a) {
197
197
  // identifier: Yup.string().required("required"),
198
198
  // })
199
199
  // }
200
- validationSchema: Yup.object({ identifier: Yup.string().required("Rxequired") }), enableReinitialize: false, onSubmit: function (values, _a) {
200
+ validationSchema: Yup.object({ identifier: Yup.string().required("Required") }), enableReinitialize: false, onSubmit: function (values, _a) {
201
201
  var setSubmitting = _a.setSubmitting, setErrors = _a.setErrors;
202
202
  return __awaiter(void 0, void 0, void 0, function () {
203
203
  var RESEND_OTP_KEY, RESEND_OTP_TIMER_MIN, RESEND_OTP_TIMER, authType, payload, storedTimeStr, now, lastSent, elapsed, remaining, formatted, response, identifier, err_1;
@@ -1 +1 @@
1
- {"version":3,"file":"SolidLogin.js","sourceRoot":"","sources":["../../../src/components/auth/SolidLogin.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,IAAI,MAAM,gBAA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BAAiB,CAAE,IAAI,0CAAE,eAAe,MAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAE,aACzG,aAAI,SAAS,EAAC,kBAAkB,sCAA2B,EAC3D,YAAG,SAAS,EAAC,mBAAmB,sEAA0D,EAE1F,KAAC,eAAe,IAAC,iBAAiB,EAAE,MAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,IAAI,0CAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,IAAI,0CAAE,gBAAgB,GAAI,EAC9I,CAAA,MAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,IAAI,0CAAE,qBAAqB,KAAI,CAC/C,8BACI,eAAK,SAAS,EAAC,uDAAuD,aAClE,KAAC,YAAY,IAAC,SAAS,EAAC,QAAQ,GAAG,EACnC,eAAM,SAAS,EAAC,kBAAkB,iCAAwB,EAC1D,KAAC,YAAY,IAAC,SAAS,EAAC,QAAQ,GAAG,IACjC,EACN,KAAC,gBAAgB,KAAG,IACrB,CACN,IACC,EACL,CAAA,MAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,IAAI,0CAAE,uBAAuB,KAAI,cAAK,SAAS,EAAC,cAAc,YAC9E,eAAK,SAAS,EAAC,mDAAmD,8CACtC,KAAC,IAAI,IAAC,SAAS,EAAC,WAAW,EAAC,IAAI,EAAC,gBAAgB,wBAAe,IACtF,GACJ,IACJ,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { Form, Formik } from \"formik\";\nimport { signIn } from \"../../adapters/auth/index\";\nimport Link from \"../common/Link\";\nimport { useRouter } from \"../../hooks/useRouter\";\nimport { useEffect, useState } from \"react\";\nimport * as Yup from \"yup\";\nimport { SocialMediaLogin } from \"../common/SocialMediaLogin\";\nimport { useInitateLoginMutation } from \"../../redux/api/authApi\";\nimport { formatTimeLeft } from \"../../helpers/resendOtpHelper\";\nimport { ERROR_MESSAGES } from \"../../constants/error-messages\";\nimport { useLazyGetAuthSettingsQuery } from \"../../redux/api/solidSettingsApi\";\nimport { env } from \"../../adapters/env\";\nimport { showToast } from \"../../redux/features/toastSlice\";\nimport { AuthTabs } from \"./AuthTabs\";\nimport { loadSession } from \"../../adapters/auth/storage\";\nimport { hasAnyRole } from \"../../helpers/rolesHelper\";\nimport { useDispatch } from \"react-redux\";\nimport { SolidButton, SolidDivider, SolidInput, SolidMessage, SolidPasswordInput, SolidRadioGroup } from \"../shad-cn-ui\";\n\ninterface AuthModesProps {\n passwordBasedAuth: boolean;\n passwordLessAuth: boolean;\n}\nconst SolidLogin = ({ signInValidatorLabel, signInValidatorPlaceholder }: any) => {\n\n const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();\n useEffect(() => {\n trigger(\"\") // Fetch settings on mount\n }, [trigger])\n\n const [initiateLogin] = useInitateLoginMutation();\n const [activeIndex, setActiveIndex] = useState(0);\n useEffect(() => {\n sessionStorage.removeItem(\"app-mounted\");\n }, [])\n const dispatch = useDispatch();\n const router = useRouter();\n\n const isFormFieldValid = (formik: any, fieldName: string) =>\n formik.touched[fieldName] && formik.errors[fieldName];\n const emailOrUsernameRegex = /^[a-zA-Z0-9._]{2,30}$/;\n\n const PasswordLogin = () => {\n return (\n <Formik\n initialValues={{\n identifier: \"\",\n // email: initialEmail,\n password: \"\",\n // rememberMe: rememberMe,\n }}\n enableReinitialize={false}\n validationSchema={Yup.object({\n identifier: Yup.string()\n .required(ERROR_MESSAGES.FIELD_REUQIRED(\"Email or Username\"))\n .test(\n \"email-or-username\",\n ERROR_MESSAGES.FIELD_INVALID(\"email or username\"),\n (value) => {\n // if (!value) return false;\n\n const isEmail = Yup.string().email().isValidSync(value);\n const isUsername = emailOrUsernameRegex.test(value);\n\n return isEmail || isUsername;\n }\n ),\n password: Yup.string().required(ERROR_MESSAGES.FIELD_REUQIRED(\"Password\")),\n })}\n onSubmit={async (values, { setSubmitting, setErrors }) => {\n try {\n // Handle Remember Me\n // if (values.rememberMe) {\n // localStorage.setItem(\"rememberedEmail\", values.email);\n // } else {\n // localStorage.removeItem(\"rememberedEmail\");\n // }\n const response = await signIn(\"credentials\", {\n redirect: false,\n identifier: values.identifier,\n password: values.password,\n });\n\n if (response?.error) {\n dispatch(showToast({ severity: \"error\", summary: ERROR_MESSAGES.LOGIN_ERROR, detail: response.error }));\n setErrors({\n identifier: ERROR_MESSAGES.INVALID_CREDENTIALS,\n password: ERROR_MESSAGES.INVALID_CREDENTIALS,\n });\n } else {\n dispatch(showToast({ severity: \"success\", summary: ERROR_MESSAGES.LOGIN_SUCCESS, detail: ERROR_MESSAGES.DASHBOARD_REDIRECTING }));\n const session = loadSession();\n const isAdmin = hasAnyRole(session?.user?.roles, [\"Admin\"]);\n const isDev = env(\"VITE_SOLIDX_ENV\") === \"dev\";\n const redirectUrl = isAdmin && isDev ? \"/studio\" : (env(\"NEXT_PUBLIC_LOGIN_REDIRECT_URL\") || \"/admin\");\n router.push(redirectUrl);\n }\n } catch (error: any) {\n dispatch(showToast({ severity: \"error\", summary: ERROR_MESSAGES.LOGIN_ERROR, detail: error?.data ? error?.data?.message : ERROR_MESSAGES.SOMETHING_WRONG }));\n } finally {\n setSubmitting(false); // Re-enable the button after submission\n }\n }}\n >\n {(formik) => (\n <Form>\n <div className=\"flex flex-column gap-2 mt-3\">\n <label htmlFor=\"email\" className=\"solid-auth-input-label\">{signInValidatorLabel ? signInValidatorLabel : \"Username or Email\"}</label>\n <SolidInput\n id=\"identifier\"\n name=\"identifier\"\n placeholder={signInValidatorPlaceholder ? signInValidatorPlaceholder : \"Email or Username\"}\n onChange={formik.handleChange}\n value={formik.values.identifier}\n onBlur={formik.handleBlur}\n aria-invalid={!!isFormFieldValid(formik, \"identifier\")}\n className=\"w-full\"\n />\n {isFormFieldValid(formik, \"identifier\") && (\n <SolidMessage\n className=\"text-red-500 text-sm\"\n severity=\"error\"\n text={formik?.errors?.identifier?.toString()}\n />\n )}\n </div>\n <div className=\"flex flex-column gap-1 mt-4\" style={{}}>\n <div className=\"flex align-items-center justify-content-between\">\n <label htmlFor=\"password\" className=\"solid-auth-input-label\">Password</label>\n <Link href={\"/auth/initiate-forgot-password\"} className=\"solid-auth-inline-link\">Forgot your password?</Link>\n </div>\n <SolidPasswordInput\n id=\"password\"\n name=\"password\"\n value={formik.values.password}\n onChange={formik.handleChange}\n toggle\n className=\"w-full\"\n aria-invalid={!!isFormFieldValid(formik, \"password\")}\n />\n {isFormFieldValid(formik, \"password\") && (\n <SolidMessage\n className=\"text-red-500 text-sm\"\n severity=\"error\"\n text={formik?.errors?.password?.toString()}\n />\n )}\n </div>\n {/* <div className=\"flex align-items-center mt-4\">\n <Checkbox inputId=\"remember\" onChange={(e: any) => setChecked(e.checked)} checked={checked} />\n <label htmlFor=\"remember\" className=\"ml-2\">Remember me</label>\n </div> */}\n <div className=\"mt-4\">\n <SolidButton\n type=\"submit\"\n className=\"w-full font-light auth-submit-button\"\n label=\"Sign In\"\n disabled={formik.isSubmitting}\n loading={formik.isSubmitting}\n />\n </div>\n </Form>\n )}\n </Formik>\n )\n }\n\n const PasswordLessLogin = () => {\n const validationType = solidSettingsData?.data?.passwordlessLoginValidateWhat || \"email\";\n const [selectedAuthMethod, setSelectedAuthMethod] = useState<\"email\" | \"mobile\">(\"email\");\n\n const getFieldConfig = () => {\n if (validationType === \"selectable\") {\n if (selectedAuthMethod === \"mobile\") {\n return {\n label: \"Mobile Number / Username\",\n placeholder: \"Enter your mobile number or username\",\n type: \"mobile\",\n // validationSchema: Yup.string()\n // .matches(/^[0-9]{10}$/, ERROR_MESSAGES.FIELD_INVALID('mobile number'))\n // .required(ERROR_MESSAGES.FIELD_REUQIRED('Mobile number'))\n };\n } else {\n return {\n label: \"Email Address / Username\",\n placeholder: \"Enter your email or username\",\n type: \"email\",\n // validationSchema: Yup.string()\n // .email(ERROR_MESSAGES.FIELD_INVALID('email address'))\n // .required(ERROR_MESSAGES.FIELD_REUQIRED('Email'))\n };\n }\n }\n switch (validationType) {\n case \"mobile\":\n return {\n label: signInValidatorLabel || \"Mobile Number / Username\",\n placeholder: signInValidatorPlaceholder || \"Enter your mobile number / username\",\n type: \"mobile\",\n // validationSchema: Yup.string()\n // .matches(/^[0-9]{10}$/, ERROR_MESSAGES.FIELD_INVALID('mobile number'))\n // .required(ERROR_MESSAGES.FIELD_REUQIRED('Mobile number'))\n };\n case \"email\":\n default:\n return {\n label: signInValidatorLabel || \"Email / Username\",\n placeholder: signInValidatorPlaceholder || \"Email ID / username\",\n type: \"email\",\n // validationSchema: Yup.string()\n // .email(ERROR_MESSAGES.FIELD_INVALID('email address'))\n // .required(ERROR_MESSAGES.FIELD_REUQIRED('Email'))\n };\n }\n };\n\n const fieldConfig = getFieldConfig();\n return (\n <Formik\n initialValues={{\n identifier: \"\",\n }}\n // validationSchema={\n // fieldConfig.validationSchema \n // ? Yup.object({\n // identifier: fieldConfig.validationSchema\n // })\n // : Yup.object({\n // identifier: Yup.string().required(\"required\"),\n // })\n // }\n validationSchema={\n Yup.object({ identifier: Yup.string().required(\"Rxequired\") })\n }\n enableReinitialize={false}\n onSubmit={async (values, { setSubmitting, setErrors }) => {\n try {\n const RESEND_OTP_KEY = `resendOtpLogin_${values.identifier}`;\n const RESEND_OTP_TIMER_MIN = parseFloat(env(\"NEXT_PUBLIC_RESEND_OTP_TIMER\") || '0.5');\n const RESEND_OTP_TIMER = Math.round(RESEND_OTP_TIMER_MIN * 60);\n\n // Use selectedAuthMethod for selectable, otherwise use fieldConfig.type\n const authType = validationType === \"selectable\" ? selectedAuthMethod : fieldConfig.type;\n\n const payload: { identifier: string; type?: string } = {\n identifier: values.identifier,\n };\n if (validationType === \"selectable\") {\n payload.type = selectedAuthMethod;\n }\n\n const storedTimeStr = localStorage.getItem(RESEND_OTP_KEY);\n const now = Date.now();\n if (storedTimeStr) {\n const lastSent = parseInt(storedTimeStr, 10);\n const elapsed = Math.floor((now - lastSent) / 1000);\n const remaining = RESEND_OTP_TIMER - elapsed;\n\n if (remaining > 0) {\n const formatted = formatTimeLeft(remaining);\n dispatch(showToast({ severity: \"error\", summary: ERROR_MESSAGES.PLEASE_WAIT, detail: ERROR_MESSAGES.OPT_FORMAT(formatted) }));\n setSubmitting(false);\n return; // Prevent request\n }\n }\n const response = await initiateLogin(payload).unwrap(); // Call mutation trigger\n\n if (response?.statusCode === 200) {\n dispatch(showToast({ severity: \"success\", summary: ERROR_MESSAGES.OPT_RESEND, detail: response?.data?.message }));\n const identifier = values.identifier;\n localStorage.setItem(`resendOtpLogin_${identifier}`, Date.now().toString());\n router.push(`/auth/initiate-login?identifier=${encodeURIComponent(identifier)}&type=${authType}`);\n } else {\n dispatch(showToast({ severity: \"error\", summary: ERROR_MESSAGES.LOGIN_ERROR, detail: response.error }));\n }\n } catch (err: any) {\n dispatch(showToast({ severity: \"error\", summary: ERROR_MESSAGES.LOGIN_ERROR, detail: err?.data ? err?.data?.message : ERROR_MESSAGES.SOMETHING_WRONG }));\n setErrors({\n identifier: \"Invalid Credentials\",\n });\n } finally {\n setSubmitting(false);\n }\n }}\n >\n {(formik) => (\n <Form>\n {/* Radio buttons for selectable type */}\n {validationType === \"selectable\" && (\n <div className=\"flex flex-column gap-3 mt-3\">\n <label className=\"solid-auth-input-label\">Select Authentication Method</label>\n <SolidRadioGroup\n name=\"authMethod\"\n value={selectedAuthMethod}\n options={[\n { label: \"Email / Username\", value: \"email\" },\n { label: \"Mobile / Username\", value: \"mobile\" },\n ]}\n onChange={(value) => {\n setSelectedAuthMethod(value);\n formik.setFieldValue(\"identifier\", \"\");\n }}\n className=\"solid-auth-radio-options flex gap-4 flex-wrap\"\n />\n </div>\n )}\n <div className=\"flex flex-column gap-2 mt-3\">\n <label htmlFor=\"identifier\" className=\"solid-auth-input-label\">{fieldConfig.label}</label>\n <SolidInput\n id=\"identifier\"\n name=\"identifier\"\n placeholder={fieldConfig.placeholder}\n onChange={formik.handleChange}\n value={formik.values.identifier}\n onBlur={formik.handleBlur}\n aria-invalid={!!isFormFieldValid(formik, \"identifier\")}\n className=\"w-full\"\n />\n {isFormFieldValid(formik, \"identifier\") && (\n <SolidMessage\n className=\"text-red-500 text-sm\"\n severity=\"error\"\n text={ signInValidatorLabel ? `${signInValidatorLabel} is ${formik?.errors?.identifier?.toString()}` : formik?.errors?.identifier?.toString()}\n />\n )}\n </div>\n <div className=\"mt-4\">\n <SolidButton\n type=\"submit\"\n className=\"w-full font-light auth-submit-button\"\n label=\"Sign In\"\n disabled={formik.isSubmitting}\n loading={formik.isSubmitting}\n />\n </div>\n </Form>\n )}\n </Formik>\n )\n }\n\n const RenderAuthModes: React.FC<AuthModesProps> = ({ passwordBasedAuth, passwordLessAuth }) => {\n if (passwordBasedAuth && passwordLessAuth) {\n return (\n <AuthTabs\n activeIndex={activeIndex}\n onChange={setActiveIndex}\n tabs={[\n { key: \"with-password\", label: \"With Password\", content: <PasswordLogin /> },\n { key: \"without-password\", label: \"Without Password\", content: <PasswordLessLogin /> },\n ]}\n />\n );\n } else if (passwordBasedAuth) {\n return <PasswordLogin />;\n } else if (passwordLessAuth) {\n return <PasswordLessLogin />;\n } else {\n return <p>No authentication method available</p>;\n }\n };\n\n return (\n <div className=\"\">\n <div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`}>\n <h2 className=\"solid-auth-title\">Login to your account</h2>\n <p className=\"solid-auth-helper\">Enter your credentials below to login to your account</p>\n\n <RenderAuthModes passwordBasedAuth={solidSettingsData?.data?.passwordBasedAuth} passwordLessAuth={solidSettingsData?.data?.passwordLessAuth} />\n {solidSettingsData?.data?.iamGoogleOAuthEnabled && (\n <>\n <div className=\"solid-auth-divider flex align-items-center gap-2 my-4\">\n <SolidDivider className=\"flex-1\" />\n <span className=\"text-sm text-500\">Or continue with</span>\n <SolidDivider className=\"flex-1\" />\n </div>\n <SocialMediaLogin />\n </>\n )}\n </div>\n {solidSettingsData?.data?.allowPublicRegistration && <div className=\"mt-3 md:mt-5\">\n <div className=\"text-sm text-center text-400 secondary-dark-color\">\n Don’t have an account ? <Link className=\"font-bold\" href=\"/auth/register\">Sign Up</Link>\n </div>\n </div>}\n </div>\n );\n};\n\nexport default SolidLogin;\n"]}
1
+ {"version":3,"file":"SolidLogin.js","sourceRoot":"","sources":["../../../src/components/auth/SolidLogin.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,U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iB,CAAE,IAAI,0CAAE,uBAAuB,KAAI,cAAK,SAAS,EAAC,cAAc,YAC9E,eAAK,SAAS,EAAC,mDAAmD,8CACtC,KAAC,IAAI,IAAC,SAAS,EAAC,WAAW,EAAC,IAAI,EAAC,gBAAgB,wBAAe,IACtF,GACJ,IACJ,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { Form, Formik } from \"formik\";\nimport { signIn } from \"../../adapters/auth/index\";\nimport Link from \"../common/Link\";\nimport { useRouter } from \"../../hooks/useRouter\";\nimport { useEffect, useState } from \"react\";\nimport * as Yup from \"yup\";\nimport { SocialMediaLogin } from \"../common/SocialMediaLogin\";\nimport { useInitateLoginMutation } from \"../../redux/api/authApi\";\nimport { formatTimeLeft } from \"../../helpers/resendOtpHelper\";\nimport { ERROR_MESSAGES } from \"../../constants/error-messages\";\nimport { useLazyGetAuthSettingsQuery } from \"../../redux/api/solidSettingsApi\";\nimport { env } from \"../../adapters/env\";\nimport { showToast } from \"../../redux/features/toastSlice\";\nimport { AuthTabs } from \"./AuthTabs\";\nimport { loadSession } from \"../../adapters/auth/storage\";\nimport { hasAnyRole } from \"../../helpers/rolesHelper\";\nimport { useDispatch } from \"react-redux\";\nimport { SolidButton, SolidDivider, SolidInput, SolidMessage, SolidPasswordInput, SolidRadioGroup } from \"../shad-cn-ui\";\n\ninterface AuthModesProps {\n passwordBasedAuth: boolean;\n passwordLessAuth: boolean;\n}\nconst SolidLogin = ({ signInValidatorLabel, signInValidatorPlaceholder }: any) => {\n\n const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();\n useEffect(() => {\n trigger(\"\") // Fetch settings on mount\n }, [trigger])\n\n const [initiateLogin] = useInitateLoginMutation();\n const [activeIndex, setActiveIndex] = useState(0);\n useEffect(() => {\n sessionStorage.removeItem(\"app-mounted\");\n }, [])\n const dispatch = useDispatch();\n const router = useRouter();\n\n const isFormFieldValid = (formik: any, fieldName: string) =>\n formik.touched[fieldName] && formik.errors[fieldName];\n const emailOrUsernameRegex = /^[a-zA-Z0-9._]{2,30}$/;\n\n const PasswordLogin = () => {\n return (\n <Formik\n initialValues={{\n identifier: \"\",\n // email: initialEmail,\n password: \"\",\n // rememberMe: rememberMe,\n }}\n enableReinitialize={false}\n validationSchema={Yup.object({\n identifier: Yup.string()\n .required(ERROR_MESSAGES.FIELD_REUQIRED(\"Email or Username\"))\n .test(\n \"email-or-username\",\n ERROR_MESSAGES.FIELD_INVALID(\"email or username\"),\n (value) => {\n // if (!value) return false;\n\n const isEmail = Yup.string().email().isValidSync(value);\n const isUsername = emailOrUsernameRegex.test(value);\n\n return isEmail || isUsername;\n }\n ),\n password: Yup.string().required(ERROR_MESSAGES.FIELD_REUQIRED(\"Password\")),\n })}\n onSubmit={async (values, { setSubmitting, setErrors }) => {\n try {\n // Handle Remember Me\n // if (values.rememberMe) {\n // localStorage.setItem(\"rememberedEmail\", values.email);\n // } else {\n // localStorage.removeItem(\"rememberedEmail\");\n // }\n const response = await signIn(\"credentials\", {\n redirect: false,\n identifier: values.identifier,\n password: values.password,\n });\n\n if (response?.error) {\n dispatch(showToast({ severity: \"error\", summary: ERROR_MESSAGES.LOGIN_ERROR, detail: response.error }));\n setErrors({\n identifier: ERROR_MESSAGES.INVALID_CREDENTIALS,\n password: ERROR_MESSAGES.INVALID_CREDENTIALS,\n });\n } else {\n dispatch(showToast({ severity: \"success\", summary: ERROR_MESSAGES.LOGIN_SUCCESS, detail: ERROR_MESSAGES.DASHBOARD_REDIRECTING }));\n const session = loadSession();\n const isAdmin = hasAnyRole(session?.user?.roles, [\"Admin\"]);\n const isDev = env(\"VITE_SOLIDX_ENV\") === \"dev\";\n const redirectUrl = isAdmin && isDev ? \"/studio\" : (env(\"NEXT_PUBLIC_LOGIN_REDIRECT_URL\") || \"/admin\");\n router.push(redirectUrl);\n }\n } catch (error: any) {\n dispatch(showToast({ severity: \"error\", summary: ERROR_MESSAGES.LOGIN_ERROR, detail: error?.data ? error?.data?.message : ERROR_MESSAGES.SOMETHING_WRONG }));\n } finally {\n setSubmitting(false); // Re-enable the button after submission\n }\n }}\n >\n {(formik) => (\n <Form>\n <div className=\"flex flex-column gap-2 mt-3\">\n <label htmlFor=\"email\" className=\"solid-auth-input-label\">{signInValidatorLabel ? signInValidatorLabel : \"Username or Email\"}</label>\n <SolidInput\n id=\"identifier\"\n name=\"identifier\"\n placeholder={signInValidatorPlaceholder ? signInValidatorPlaceholder : \"Email or Username\"}\n onChange={formik.handleChange}\n value={formik.values.identifier}\n onBlur={formik.handleBlur}\n aria-invalid={!!isFormFieldValid(formik, \"identifier\")}\n className=\"w-full\"\n />\n {isFormFieldValid(formik, \"identifier\") && (\n <SolidMessage\n className=\"text-red-500 text-sm\"\n severity=\"error\"\n text={formik?.errors?.identifier?.toString()}\n />\n )}\n </div>\n <div className=\"flex flex-column gap-1 mt-4\" style={{}}>\n <div className=\"flex align-items-center justify-content-between\">\n <label htmlFor=\"password\" className=\"solid-auth-input-label\">Password</label>\n <Link href={\"/auth/initiate-forgot-password\"} className=\"solid-auth-inline-link\">Forgot your password?</Link>\n </div>\n <SolidPasswordInput\n id=\"password\"\n name=\"password\"\n value={formik.values.password}\n onChange={formik.handleChange}\n toggle\n className=\"w-full\"\n aria-invalid={!!isFormFieldValid(formik, \"password\")}\n />\n {isFormFieldValid(formik, \"password\") && (\n <SolidMessage\n className=\"text-red-500 text-sm\"\n severity=\"error\"\n text={formik?.errors?.password?.toString()}\n />\n )}\n </div>\n {/* <div className=\"flex align-items-center mt-4\">\n <Checkbox inputId=\"remember\" onChange={(e: any) => setChecked(e.checked)} checked={checked} />\n <label htmlFor=\"remember\" className=\"ml-2\">Remember me</label>\n </div> */}\n <div className=\"mt-4\">\n <SolidButton\n type=\"submit\"\n className=\"w-full font-light auth-submit-button\"\n label=\"Sign In\"\n disabled={formik.isSubmitting}\n loading={formik.isSubmitting}\n />\n </div>\n </Form>\n )}\n </Formik>\n )\n }\n\n const PasswordLessLogin = () => {\n const validationType = solidSettingsData?.data?.passwordlessLoginValidateWhat || \"email\";\n const [selectedAuthMethod, setSelectedAuthMethod] = useState<\"email\" | \"mobile\">(\"email\");\n\n const getFieldConfig = () => {\n if (validationType === \"selectable\") {\n if (selectedAuthMethod === \"mobile\") {\n return {\n label: \"Mobile Number / Username\",\n placeholder: \"Enter your mobile number or username\",\n type: \"mobile\",\n // validationSchema: Yup.string()\n // .matches(/^[0-9]{10}$/, ERROR_MESSAGES.FIELD_INVALID('mobile number'))\n // .required(ERROR_MESSAGES.FIELD_REUQIRED('Mobile number'))\n };\n } else {\n return {\n label: \"Email Address / Username\",\n placeholder: \"Enter your email or username\",\n type: \"email\",\n // validationSchema: Yup.string()\n // .email(ERROR_MESSAGES.FIELD_INVALID('email address'))\n // .required(ERROR_MESSAGES.FIELD_REUQIRED('Email'))\n };\n }\n }\n switch (validationType) {\n case \"mobile\":\n return {\n label: signInValidatorLabel || \"Mobile Number / Username\",\n placeholder: signInValidatorPlaceholder || \"Enter your mobile number / username\",\n type: \"mobile\",\n // validationSchema: Yup.string()\n // .matches(/^[0-9]{10}$/, ERROR_MESSAGES.FIELD_INVALID('mobile number'))\n // .required(ERROR_MESSAGES.FIELD_REUQIRED('Mobile number'))\n };\n case \"email\":\n default:\n return {\n label: signInValidatorLabel || \"Email / Username\",\n placeholder: signInValidatorPlaceholder || \"Email ID / username\",\n type: \"email\",\n // validationSchema: Yup.string()\n // .email(ERROR_MESSAGES.FIELD_INVALID('email address'))\n // .required(ERROR_MESSAGES.FIELD_REUQIRED('Email'))\n };\n }\n };\n\n const fieldConfig = getFieldConfig();\n return (\n <Formik\n initialValues={{\n identifier: \"\",\n }}\n // validationSchema={\n // fieldConfig.validationSchema \n // ? Yup.object({\n // identifier: fieldConfig.validationSchema\n // })\n // : Yup.object({\n // identifier: Yup.string().required(\"required\"),\n // })\n // }\n validationSchema={\n Yup.object({ identifier: Yup.string().required(\"Required\") })\n }\n enableReinitialize={false}\n onSubmit={async (values, { setSubmitting, setErrors }) => {\n try {\n const RESEND_OTP_KEY = `resendOtpLogin_${values.identifier}`;\n const RESEND_OTP_TIMER_MIN = parseFloat(env(\"NEXT_PUBLIC_RESEND_OTP_TIMER\") || '0.5');\n const RESEND_OTP_TIMER = Math.round(RESEND_OTP_TIMER_MIN * 60);\n\n // Use selectedAuthMethod for selectable, otherwise use fieldConfig.type\n const authType = validationType === \"selectable\" ? selectedAuthMethod : fieldConfig.type;\n\n const payload: { identifier: string; type?: string } = {\n identifier: values.identifier,\n };\n if (validationType === \"selectable\") {\n payload.type = selectedAuthMethod;\n }\n\n const storedTimeStr = localStorage.getItem(RESEND_OTP_KEY);\n const now = Date.now();\n if (storedTimeStr) {\n const lastSent = parseInt(storedTimeStr, 10);\n const elapsed = Math.floor((now - lastSent) / 1000);\n const remaining = RESEND_OTP_TIMER - elapsed;\n\n if (remaining > 0) {\n const formatted = formatTimeLeft(remaining);\n dispatch(showToast({ severity: \"error\", summary: ERROR_MESSAGES.PLEASE_WAIT, detail: ERROR_MESSAGES.OPT_FORMAT(formatted) }));\n setSubmitting(false);\n return; // Prevent request\n }\n }\n const response = await initiateLogin(payload).unwrap(); // Call mutation trigger\n\n if (response?.statusCode === 200) {\n dispatch(showToast({ severity: \"success\", summary: ERROR_MESSAGES.OPT_RESEND, detail: response?.data?.message }));\n const identifier = values.identifier;\n localStorage.setItem(`resendOtpLogin_${identifier}`, Date.now().toString());\n router.push(`/auth/initiate-login?identifier=${encodeURIComponent(identifier)}&type=${authType}`);\n } else {\n dispatch(showToast({ severity: \"error\", summary: ERROR_MESSAGES.LOGIN_ERROR, detail: response.error }));\n }\n } catch (err: any) {\n dispatch(showToast({ severity: \"error\", summary: ERROR_MESSAGES.LOGIN_ERROR, detail: err?.data ? err?.data?.message : ERROR_MESSAGES.SOMETHING_WRONG }));\n setErrors({\n identifier: \"Invalid Credentials\",\n });\n } finally {\n setSubmitting(false);\n }\n }}\n >\n {(formik) => (\n <Form>\n {/* Radio buttons for selectable type */}\n {validationType === \"selectable\" && (\n <div className=\"flex flex-column gap-3 mt-3\">\n <label className=\"solid-auth-input-label\">Select Authentication Method</label>\n <SolidRadioGroup\n name=\"authMethod\"\n value={selectedAuthMethod}\n options={[\n { label: \"Email / Username\", value: \"email\" },\n { label: \"Mobile / Username\", value: \"mobile\" },\n ]}\n onChange={(value) => {\n setSelectedAuthMethod(value);\n formik.setFieldValue(\"identifier\", \"\");\n }}\n className=\"solid-auth-radio-options flex gap-4 flex-wrap\"\n />\n </div>\n )}\n <div className=\"flex flex-column gap-2 mt-3\">\n <label htmlFor=\"identifier\" className=\"solid-auth-input-label\">{fieldConfig.label}</label>\n <SolidInput\n id=\"identifier\"\n name=\"identifier\"\n placeholder={fieldConfig.placeholder}\n onChange={formik.handleChange}\n value={formik.values.identifier}\n onBlur={formik.handleBlur}\n aria-invalid={!!isFormFieldValid(formik, \"identifier\")}\n className=\"w-full\"\n />\n {isFormFieldValid(formik, \"identifier\") && (\n <SolidMessage\n className=\"text-red-500 text-sm\"\n severity=\"error\"\n text={signInValidatorLabel ? `${signInValidatorLabel} is ${formik?.errors?.identifier?.toString()}` : formik?.errors?.identifier?.toString()}\n />\n )}\n </div>\n <div className=\"mt-4\">\n <SolidButton\n type=\"submit\"\n className=\"w-full font-light auth-submit-button\"\n label=\"Sign In\"\n disabled={formik.isSubmitting}\n loading={formik.isSubmitting}\n />\n </div>\n </Form>\n )}\n </Formik>\n )\n }\n\n const RenderAuthModes: React.FC<AuthModesProps> = ({ passwordBasedAuth, passwordLessAuth }) => {\n if (passwordBasedAuth && passwordLessAuth) {\n return (\n <AuthTabs\n activeIndex={activeIndex}\n onChange={setActiveIndex}\n tabs={[\n { key: \"with-password\", label: \"With Password\", content: <PasswordLogin /> },\n { key: \"without-password\", label: \"Without Password\", content: <PasswordLessLogin /> },\n ]}\n />\n );\n } else if (passwordBasedAuth) {\n return <PasswordLogin />;\n } else if (passwordLessAuth) {\n return <PasswordLessLogin />;\n } else {\n return <p>No authentication method available</p>;\n }\n };\n\n return (\n <div className=\"\">\n <div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`}>\n <h2 className=\"solid-auth-title\">Login to your account</h2>\n <p className=\"solid-auth-helper\">Enter your credentials below to login to your account</p>\n\n <RenderAuthModes passwordBasedAuth={solidSettingsData?.data?.passwordBasedAuth} passwordLessAuth={solidSettingsData?.data?.passwordLessAuth} />\n {solidSettingsData?.data?.iamGoogleOAuthEnabled && (\n <>\n <div className=\"solid-auth-divider flex align-items-center gap-2 my-4\">\n <SolidDivider className=\"flex-1\" />\n <span className=\"text-sm text-500\">Or continue with</span>\n <SolidDivider className=\"flex-1\" />\n </div>\n <SocialMediaLogin />\n </>\n )}\n </div>\n {solidSettingsData?.data?.allowPublicRegistration && <div className=\"mt-3 md:mt-5\">\n <div className=\"text-sm text-center text-400 secondary-dark-color\">\n Don’t have an account ? <Link className=\"font-bold\" href=\"/auth/register\">Sign Up</Link>\n </div>\n </div>}\n </div>\n );\n};\n\nexport default SolidLogin;\n"]}
@@ -230,7 +230,7 @@ const SolidLogin = ({ signInValidatorLabel, signInValidatorPlaceholder }: any) =
230
230
  // })
231
231
  // }
232
232
  validationSchema={
233
- Yup.object({ identifier: Yup.string().required("Rxequired") })
233
+ Yup.object({ identifier: Yup.string().required("Required") })
234
234
  }
235
235
  enableReinitialize={false}
236
236
  onSubmit={async (values, { setSubmitting, setErrors }) => {
@@ -320,7 +320,7 @@ const SolidLogin = ({ signInValidatorLabel, signInValidatorPlaceholder }: any) =
320
320
  <SolidMessage
321
321
  className="text-red-500 text-sm"
322
322
  severity="error"
323
- text={ signInValidatorLabel ? `${signInValidatorLabel} is ${formik?.errors?.identifier?.toString()}` : formik?.errors?.identifier?.toString()}
323
+ text={signInValidatorLabel ? `${signInValidatorLabel} is ${formik?.errors?.identifier?.toString()}` : formik?.errors?.identifier?.toString()}
324
324
  />
325
325
  )}
326
326
  </div>
@@ -60,7 +60,7 @@ import { useDropzone } from 'react-dropzone';
60
60
  import { SettingDropzoneActivePlaceholder } from './SolidSettings/SettingDropzoneActivePlaceholder';
61
61
  import { SolidUploadedImage } from './SolidSettings/SolidUploadedImage';
62
62
  import { SettingsImageRemoveButton } from './SolidSettings/SettingsImageRemoveButton';
63
- import { AiModelConfigTab } from './SolidSettings/LlmSettings/AiModelConfigTab';
63
+ import { ModelConfigTab, ProvidersTab, ensureBuiltInProviders } from './SolidSettings/LlmSettings/AiModelConfigTab';
64
64
  import { useDispatch } from 'react-redux';
65
65
  import { ERROR_MESSAGES } from '../../constants/error-messages';
66
66
  import { useBulkUpdateSolidSettingsMutation, useLazyGetSolidSettingsQuery } from '../../redux/api/solidSettingsApi';
@@ -117,8 +117,8 @@ export var GeneralSettings = function () {
117
117
  var _a;
118
118
  var defaultAiConfig = {
119
119
  models: {
120
- default: { providerKey: "", behavior: { streaming: false, custom: "" } },
121
- fast: { providerKey: "", behavior: { streaming: false, custom: "" } },
120
+ default: { providerId: "", model: "", behavior: { streaming: false, custom: "" } },
121
+ fast: { providerId: "", model: "", behavior: { streaming: false, custom: "" } },
122
122
  },
123
123
  providers: {},
124
124
  };
@@ -456,35 +456,37 @@ export var GeneralSettings = function () {
456
456
  _jsx(AiSettingsSection, { aiConfig: formik.values.solidXGenAiCodeBuilderConfig, onAiConfigChange: handleAiConfigChange }), pathname.includes("api-keys") && ((_43 = session === null || session === void 0 ? void 0 : session.user) === null || _43 === void 0 ? void 0 : _43.id) &&
457
457
  _jsx(ApiKeysTab, { userId: session.user.id, canCreate: (_45 = (_44 = session === null || session === void 0 ? void 0 : session.user) === null || _44 === void 0 ? void 0 : _44.isAllowedToGenerateApiKeys) !== null && _45 !== void 0 ? _45 : false })] })] }) }) }) }));
458
458
  };
459
- var AI_TABS = [
460
- { key: "fast", label: "Fast Model", title: "Fast Model" },
461
- { key: "default", label: "Intelligent Model", title: "Intelligent Model (Reasoning & tool use)" },
462
- ];
463
459
  var DEFAULT_BEHAVIOR = { streaming: false, custom: "" };
460
+ var DEFAULT_MODEL_ENTRY = { providerId: "", model: "", behavior: DEFAULT_BEHAVIOR };
464
461
  var AiSettingsSection = function (_a) {
462
+ var _b, _c, _d, _e, _f;
465
463
  var aiConfig = _a.aiConfig, onAiConfigChange = _a.onAiConfigChange;
466
- var _b = useState("fast"), activeTab = _b[0], setActiveTab = _b[1];
467
- var tabItems = AI_TABS.map(function (tab) {
468
- var _a, _b, _c, _d, _e, _f, _g;
469
- var modelEntry = (_b = (_a = aiConfig.models) === null || _a === void 0 ? void 0 : _a[tab.key]) !== null && _b !== void 0 ? _b : { providerKey: "", behavior: DEFAULT_BEHAVIOR };
470
- var providerKey = (_c = modelEntry.providerKey) !== null && _c !== void 0 ? _c : "";
471
- var providerConfig = (_e = (_d = aiConfig.providers) === null || _d === void 0 ? void 0 : _d[providerKey]) !== null && _e !== void 0 ? _e : { provider: providerKey, apiKey: "", model: "" };
472
- var behavior = (_f = modelEntry.behavior) !== null && _f !== void 0 ? _f : DEFAULT_BEHAVIOR;
473
- return {
474
- value: tab.key,
475
- label: tab.label,
476
- content: (_jsx(AiModelConfigTab, { providerKey: providerKey, providerConfig: providerConfig, behavior: behavior, allProviders: (_g = aiConfig.providers) !== null && _g !== void 0 ? _g : {}, onProviderKeyChange: function (newKey, newConfig) {
477
- var _a, _b;
478
- onAiConfigChange(__assign(__assign({}, aiConfig), { models: __assign(__assign({}, aiConfig.models), (_a = {}, _a[tab.key] = __assign(__assign({}, modelEntry), { providerKey: newKey }), _a)), providers: __assign(__assign({}, aiConfig.providers), (_b = {}, _b[newKey] = newConfig, _b)) }));
479
- }, onProviderConfigChange: function (pk, config) {
480
- var _a;
481
- onAiConfigChange(__assign(__assign({}, aiConfig), { providers: __assign(__assign({}, aiConfig.providers), (_a = {}, _a[pk] = config, _a)) }));
482
- }, onBehaviorChange: function (newBehavior) {
483
- var _a;
484
- onAiConfigChange(__assign(__assign({}, aiConfig), { models: __assign(__assign({}, aiConfig.models), (_a = {}, _a[tab.key] = __assign(__assign({}, modelEntry), { behavior: newBehavior }), _a)) }));
464
+ var _g = useState("providers"), activeTab = _g[0], setActiveTab = _g[1];
465
+ var _h = useState(false), showAddProvider = _h[0], setShowAddProvider = _h[1];
466
+ var providers = ensureBuiltInProviders((_b = aiConfig.providers) !== null && _b !== void 0 ? _b : {});
467
+ var tabItems = [
468
+ {
469
+ value: "providers",
470
+ label: "Providers",
471
+ content: (_jsx(ProvidersTab, { providers: providers, onProvidersChange: function (newProviders) {
472
+ onAiConfigChange(__assign(__assign({}, aiConfig), { providers: newProviders }));
473
+ }, showAddModal: showAddProvider, onAddModalClose: function () { return setShowAddProvider(false); } })),
474
+ },
475
+ {
476
+ value: "default",
477
+ label: "Intelligent Model",
478
+ content: (_jsx(ModelConfigTab, { modelEntry: (_d = (_c = aiConfig.models) === null || _c === void 0 ? void 0 : _c.default) !== null && _d !== void 0 ? _d : DEFAULT_MODEL_ENTRY, providers: providers, onModelEntryChange: function (entry) {
479
+ onAiConfigChange(__assign(__assign({}, aiConfig), { models: __assign(__assign({}, aiConfig.models), { default: entry }) }));
485
480
  } })),
486
- };
487
- });
488
- return (_jsxs("div", { children: [_jsx("p", { className: "solid-settings-heading", style: { marginBottom: "1rem" }, children: "AI Model Configuration" }), _jsx(SolidTabGroup, { tabs: tabItems, value: activeTab, onValueChange: function (value) { return setActiveTab(value); }, tabPosition: "left" })] }));
481
+ },
482
+ {
483
+ value: "fast",
484
+ label: "Fast Model",
485
+ content: (_jsx(ModelConfigTab, { modelEntry: (_f = (_e = aiConfig.models) === null || _e === void 0 ? void 0 : _e.fast) !== null && _f !== void 0 ? _f : DEFAULT_MODEL_ENTRY, providers: providers, onModelEntryChange: function (entry) {
486
+ onAiConfigChange(__assign(__assign({}, aiConfig), { models: __assign(__assign({}, aiConfig.models), { fast: entry }) }));
487
+ } })),
488
+ },
489
+ ];
490
+ return (_jsxs("div", { children: [_jsx("p", { className: "solid-settings-heading", style: { marginBottom: "1rem" }, children: "AI Model Configuration" }), _jsx(SolidTabGroup, { tabs: tabItems, value: activeTab, onValueChange: function (value) { return setActiveTab(value); }, tabPosition: "left", extra: activeTab === "providers" ? (_jsx(SolidButton, { size: "sm", onClick: function () { return setShowAddProvider(true); }, children: "Add" })) : undefined })] }));
489
491
  };
490
492
  //# sourceMappingURL=GeneralSettings.js.map