@solidstarters/solid-core-ui 1.1.211 → 1.1.212

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 (373) hide show
  1. package/dist/components/Svg/DevDocs.tsx +9 -0
  2. package/dist/components/Svg/DocsSvg.tsx +9 -0
  3. package/dist/components/Svg/ExcelSvg.tsx +15 -0
  4. package/dist/components/Svg/FieldSvg.tsx +9 -0
  5. package/dist/components/Svg/FileSvg.tsx +18 -0
  6. package/dist/components/Svg/HomePageModuleSvg.tsx +179 -0
  7. package/dist/components/Svg/ModelSvg.tsx +9 -0
  8. package/dist/components/Svg/ModuleSvg.tsx +9 -0
  9. package/dist/components/Svg/PDFSvg.tsx +15 -0
  10. package/dist/components/Svg/RightArrowSvg.tsx +9 -0
  11. package/dist/components/Svg/SettingsSvg.tsx +9 -0
  12. package/dist/components/auth/AuthLayout.tsx +223 -0
  13. package/dist/components/auth/ForgotPasswordThankYou.tsx +33 -0
  14. package/dist/components/auth/GoogleAuthChecking.tsx +63 -0
  15. package/dist/components/auth/SolidChangeForcePassword.tsx +222 -0
  16. package/dist/components/auth/SolidForgotPassword.tsx +127 -0
  17. package/dist/components/auth/SolidInitialLoginOtp.tsx +271 -0
  18. package/dist/components/auth/SolidInitiateRegisterOtp.tsx +218 -0
  19. package/dist/components/auth/SolidLogin.d.ts.map +1 -1
  20. package/dist/components/auth/SolidLogin.js +14 -8
  21. package/dist/components/auth/SolidLogin.js.map +1 -1
  22. package/dist/components/auth/SolidLogin.tsx +428 -0
  23. package/dist/components/auth/SolidOTPVerify.tsx +133 -0
  24. package/dist/components/auth/SolidRegister.tsx +454 -0
  25. package/dist/components/auth/SolidResetPassword.tsx +194 -0
  26. package/dist/components/common/AuthBanner.tsx +41 -0
  27. package/dist/components/common/AutoCompleteField.tsx +79 -0
  28. package/dist/components/common/BackButton.tsx +72 -0
  29. package/dist/components/common/CancelButton.tsx +61 -0
  30. package/dist/components/common/CodeEditor.tsx +38 -0
  31. package/dist/components/common/CreateButton.tsx +17 -0
  32. package/dist/components/common/DownloadProgressToast.tsx +55 -0
  33. package/dist/components/common/DropzonePlaceholder.tsx +31 -0
  34. package/dist/components/common/DropzoneUpload.tsx +11 -0
  35. package/dist/components/common/FileReaderExt.tsx +20 -0
  36. package/dist/components/common/GeneralSettings.tsx +1225 -0
  37. package/dist/components/common/HeaderDynamicTitles.tsx +13 -0
  38. package/dist/components/common/MarkdownViewer.tsx +84 -0
  39. package/dist/components/common/MultipleSelectAutoCompleteField.tsx +64 -0
  40. package/dist/components/common/NotFound.tsx +22 -0
  41. package/dist/components/common/SingleSelectAutoCompleteField.tsx +73 -0
  42. package/dist/components/common/SocialMediaLogin.tsx +53 -0
  43. package/dist/components/common/SolidAdmin.tsx +6 -0
  44. package/dist/components/common/SolidBreadcrumb.tsx +129 -0
  45. package/dist/components/common/SolidExport.tsx +563 -0
  46. package/dist/components/common/SolidExportStepper.tsx +135 -0
  47. package/dist/components/common/SolidFieldTooltip.tsx +23 -0
  48. package/dist/components/common/SolidFormHeader.tsx +25 -0
  49. package/dist/components/common/SolidFormStepper.tsx +350 -0
  50. package/dist/components/common/SolidModuleHome.tsx +128 -0
  51. package/dist/components/common/SolidPopupContainer.tsx +37 -0
  52. package/dist/components/common/SolidSettings/LlmSettings/AnthropicProviderComponent.tsx +45 -0
  53. package/dist/components/common/SolidSettings/LlmSettings/OpenAiProviderComponent.tsx +45 -0
  54. package/dist/components/common/SolidSettings/SettingDropzoneActivePlaceholder.tsx +20 -0
  55. package/dist/components/common/SolidSettings/SettingsImageRemoveButton.tsx +15 -0
  56. package/dist/components/common/SolidSettings/SolidUploadedImage.tsx +16 -0
  57. package/dist/components/common/SolidThemeLink.tsx +6 -0
  58. package/dist/components/common/SolidThemeProvider.tsx +44 -0
  59. package/dist/components/common/StepperArrows/ActiveArrowStep.tsx +18 -0
  60. package/dist/components/common/StepperArrows/ActiveBeforeStepArrow.tsx +18 -0
  61. package/dist/components/common/StepperArrows/InactiveStepArrow.tsx +19 -0
  62. package/dist/components/common/error.tsx +30 -0
  63. package/dist/components/common/useHandleFormCustomButtonClick.ts +40 -0
  64. package/dist/components/common/useHandleListCustomButtonClick.ts +42 -0
  65. package/dist/components/core/chatter/SolidChatter.tsx +248 -0
  66. package/dist/components/core/chatter/SolidChatterAuditMessage.tsx +35 -0
  67. package/dist/components/core/chatter/SolidChatterCustomMessage.tsx +46 -0
  68. package/dist/components/core/chatter/SolidChatterDateDivider.tsx +16 -0
  69. package/dist/components/core/chatter/SolidChatterHeader.tsx +218 -0
  70. package/dist/components/core/chatter/SolidChatterMessageBox.tsx +163 -0
  71. package/dist/components/core/chatter/SolidMessageComposer.tsx +146 -0
  72. package/dist/components/core/common/AvatarWidget.tsx +55 -0
  73. package/dist/components/core/common/DateFieldViewComponent.tsx +36 -0
  74. package/dist/components/core/common/FilterComponent.tsx +458 -0
  75. package/dist/components/core/common/LoadDynamicJsxComponent.tsx +70 -0
  76. package/dist/components/core/common/PDFViewer.tsx +117 -0
  77. package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.tsx +89 -0
  78. package/dist/components/core/common/SolidAccountSettings/SolidChangePassword.tsx +188 -0
  79. package/dist/components/core/common/SolidAccountSettings/SolidNotifications.tsx +139 -0
  80. package/dist/components/core/common/SolidAccountSettings/SolidPersonalInfo.tsx +311 -0
  81. package/dist/components/core/common/SolidCreateButton.tsx +48 -0
  82. package/dist/components/core/common/SolidGenericImport/DocumentSvg.tsx +15 -0
  83. package/dist/components/core/common/SolidGenericImport/SolidGenericImport.tsx +64 -0
  84. package/dist/components/core/common/SolidGenericImport/SolidImportDropzone.tsx +125 -0
  85. package/dist/components/core/common/SolidGenericImport/SolidImportInstructions.tsx +122 -0
  86. package/dist/components/core/common/SolidGenericImport/SolidImportStepper.tsx +217 -0
  87. package/dist/components/core/common/SolidGenericImport/SolidImportTransaction.tsx +205 -0
  88. package/dist/components/core/common/SolidGenericImport/SolidImportTransactionStatus.tsx +158 -0
  89. package/dist/components/core/common/SolidGenericImport/SolidImportWrapper.tsx +29 -0
  90. package/dist/components/core/common/SolidGlobalSearchElement.tsx +1470 -0
  91. package/dist/components/core/common/SolidLayoutViews.tsx +87 -0
  92. package/dist/components/core/common/SolidListViewOptions.tsx +31 -0
  93. package/dist/components/core/common/SolidLoaders/SolidCircularLoader.tsx +7 -0
  94. package/dist/components/core/common/SolidPasswordHelperText.tsx +34 -0
  95. package/dist/components/core/common/SolidSaveCustomFilterForm.tsx +75 -0
  96. package/dist/components/core/common/SolidSearchBox.tsx +17 -0
  97. package/dist/components/core/common/SolidViewLayoutManager.ts +421 -0
  98. package/dist/components/core/common/SolidXAiIframe.tsx +77 -0
  99. package/dist/components/core/dashboard/SolidDashboard.tsx +332 -0
  100. package/dist/components/core/dashboard/SolidDashboardBody.tsx +117 -0
  101. package/dist/components/core/dashboard/SolidDashboardFilterRequired.tsx +28 -0
  102. package/dist/components/core/dashboard/SolidDashboardHeader.tsx +10 -0
  103. package/dist/components/core/dashboard/SolidDashboardLoading.tsx +55 -0
  104. package/dist/components/core/dashboard/SolidDashboardNotAvailable.tsx +32 -0
  105. package/dist/components/core/dashboard/SolidDashboardRenderError.tsx +29 -0
  106. package/dist/components/core/dashboard/SolidDashboardVariable.tsx +256 -0
  107. package/dist/components/core/dashboard/SolidQuestionRenderer.tsx +78 -0
  108. package/dist/components/core/dashboard/chart-renderers/ChartJsRenderer.tsx +18 -0
  109. package/dist/components/core/dashboard/chart-renderers/PrimeReactDatatableRenderer.tsx +54 -0
  110. package/dist/components/core/dashboard/chart-renderers/init-chartjs.ts +25 -0
  111. package/dist/components/core/dashboard/dashboard-utils.ts +39 -0
  112. package/dist/components/core/extension/solid-core/CustomIcon/StatusIcon.tsx +17 -0
  113. package/dist/components/core/extension/solid-core/dashboardQuestion/ChartFormPreviewWidget.tsx +36 -0
  114. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.ts +18 -0
  115. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.ts +18 -0
  116. package/dist/components/core/extension/solid-core/modelMetadata/list/DeleteModelRowAction.tsx +114 -0
  117. package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.tsx +213 -0
  118. package/dist/components/core/extension/solid-core/moduleMetadata/list/DeleteModuleRowAction.tsx +138 -0
  119. package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.tsx +209 -0
  120. package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx +131 -0
  121. package/dist/components/core/field/FieldListViewData.tsx +313 -0
  122. package/dist/components/core/filter/SolidBooleanFilterElement.tsx +30 -0
  123. package/dist/components/core/filter/SolidFilterFields.tsx +131 -0
  124. package/dist/components/core/filter/SolidManyToManyFilterElement.tsx +64 -0
  125. package/dist/components/core/filter/SolidManyToOneFilterElement.tsx +61 -0
  126. package/dist/components/core/filter/SolidSelectionDynamicFilterElement.tsx +50 -0
  127. package/dist/components/core/filter/SolidSelectionStaticFilterElement.tsx +32 -0
  128. package/dist/components/core/filter/SolidVarInputsFilterElement.tsx +209 -0
  129. package/dist/components/core/filter/fields/SolidBigintField.tsx +9 -0
  130. package/dist/components/core/filter/fields/SolidBooleanField.tsx +68 -0
  131. package/dist/components/core/filter/fields/SolidComputedField.tsx +23 -0
  132. package/dist/components/core/filter/fields/SolidDateField.tsx +63 -0
  133. package/dist/components/core/filter/fields/SolidDatetimeField.tsx +54 -0
  134. package/dist/components/core/filter/fields/SolidDecimalField.tsx +9 -0
  135. package/dist/components/core/filter/fields/SolidExternalIdField.tsx +52 -0
  136. package/dist/components/core/filter/fields/SolidFloatField.tsx +9 -0
  137. package/dist/components/core/filter/fields/SolidIdField.tsx +46 -0
  138. package/dist/components/core/filter/fields/SolidIntField.tsx +61 -0
  139. package/dist/components/core/filter/fields/SolidLongTextField.tsx +9 -0
  140. package/dist/components/core/filter/fields/SolidMediaMultipleField.tsx +60 -0
  141. package/dist/components/core/filter/fields/SolidMediaSingleField.tsx +62 -0
  142. package/dist/components/core/filter/fields/SolidRelationField.tsx +17 -0
  143. package/dist/components/core/filter/fields/SolidRichTextField.tsx +9 -0
  144. package/dist/components/core/filter/fields/SolidSelectionDynamicField.tsx +52 -0
  145. package/dist/components/core/filter/fields/SolidSelectionStaticField.tsx +54 -0
  146. package/dist/components/core/filter/fields/SolidShortTextField.tsx +60 -0
  147. package/dist/components/core/filter/fields/SolidTimeField.tsx +48 -0
  148. package/dist/components/core/filter/fields/SolidUuidField.tsx +51 -0
  149. package/dist/components/core/filter/fields/relations/SolidRelationManyToManyField.tsx +62 -0
  150. package/dist/components/core/filter/fields/relations/SolidRelationManyToOneField.tsx +84 -0
  151. package/dist/components/core/form/SolidFormActionHeader.tsx +497 -0
  152. package/dist/components/core/form/SolidFormFieldRender.tsx +53 -0
  153. package/dist/components/core/form/SolidFormFieldRenderExtension.tsx +26 -0
  154. package/dist/components/core/form/SolidFormFooter.tsx +162 -0
  155. package/dist/components/core/form/SolidFormLayouts.tsx +104 -0
  156. package/dist/components/core/form/SolidFormUserViewLayout.tsx +84 -0
  157. package/dist/components/core/form/SolidFormView.tsx +1856 -0
  158. package/dist/components/core/form/SolidFormViewContextMenuHeaderButton.tsx +52 -0
  159. package/dist/components/core/form/SolidFormViewNormalHeaderButton.tsx +52 -0
  160. package/dist/components/core/form/SolidFormViewShimmerLoading.tsx +109 -0
  161. package/dist/components/core/form/fields/ISolidField.tsx +71 -0
  162. package/dist/components/core/form/fields/SolidBooleanField.tsx +434 -0
  163. package/dist/components/core/form/fields/SolidDateField.tsx +247 -0
  164. package/dist/components/core/form/fields/SolidDateTimeField.tsx +229 -0
  165. package/dist/components/core/form/fields/SolidDecimalField.tsx +171 -0
  166. package/dist/components/core/form/fields/SolidEmailField.tsx +176 -0
  167. package/dist/components/core/form/fields/SolidIntegerField.tsx +282 -0
  168. package/dist/components/core/form/fields/SolidJsonField.tsx +185 -0
  169. package/dist/components/core/form/fields/SolidLongTextField.tsx +618 -0
  170. package/dist/components/core/form/fields/SolidMediaMultipleField.tsx +663 -0
  171. package/dist/components/core/form/fields/SolidMediaSingleField.tsx +547 -0
  172. package/dist/components/core/form/fields/SolidPasswordField.tsx +390 -0
  173. package/dist/components/core/form/fields/SolidRelationField.tsx +56 -0
  174. package/dist/components/core/form/fields/SolidRichTextField.tsx +188 -0
  175. package/dist/components/core/form/fields/SolidSelectionDynamicField.tsx +340 -0
  176. package/dist/components/core/form/fields/SolidSelectionStaticField.tsx +462 -0
  177. package/dist/components/core/form/fields/SolidShortTextField.tsx +399 -0
  178. package/dist/components/core/form/fields/SolidTimeField.tsx +245 -0
  179. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +453 -0
  180. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +1036 -0
  181. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +627 -0
  182. package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.tsx +38 -0
  183. package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.ts +64 -0
  184. package/dist/components/core/form/fields/widgets/SolidAiInteractionMessageFieldFormWidget.tsx +135 -0
  185. package/dist/components/core/form/fields/widgets/SolidAiInteractionMetadataFieldFormWidget.tsx +144 -0
  186. package/dist/components/core/form/fields/widgets/SolidIconEditWidget.tsx +265 -0
  187. package/dist/components/core/form/fields/widgets/SolidIconViewWidget.tsx +32 -0
  188. package/dist/components/core/form/fields/widgets/SolidRelationFieldAvatarFormWidget.tsx +50 -0
  189. package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.tsx +222 -0
  190. package/dist/components/core/form/fields/widgets/SolidShortTextFieldAvatarWidget.tsx +70 -0
  191. package/dist/components/core/form/widgets/CustomHtml.tsx +20 -0
  192. package/dist/components/core/kanban/KanbanBoard.tsx +150 -0
  193. package/dist/components/core/kanban/KanbanCard.tsx +279 -0
  194. package/dist/components/core/kanban/KanbanColumn.tsx +139 -0
  195. package/dist/components/core/kanban/KanbanUserViewLayout.tsx +84 -0
  196. package/dist/components/core/kanban/SolidKanbanView.tsx +894 -0
  197. package/dist/components/core/kanban/SolidKanbanViewConfigure.tsx +154 -0
  198. package/dist/components/core/kanban/SolidKanbanViewFields.tsx +164 -0
  199. package/dist/components/core/kanban/SolidManyToOneFilterElement.tsx +59 -0
  200. package/dist/components/core/kanban/SolidSelectionDynamicFilterElement.tsx +50 -0
  201. package/dist/components/core/kanban/SolidSelectionStaticFilterElement.tsx +32 -0
  202. package/dist/components/core/kanban/SolidVarInputsFilterElement.tsx +184 -0
  203. package/dist/components/core/kanban/kanban-fields/SolidBigintKanbanField.tsx +9 -0
  204. package/dist/components/core/kanban/kanban-fields/SolidBooleanKanbanField.tsx +16 -0
  205. package/dist/components/core/kanban/kanban-fields/SolidComputedKanbanField.tsx +23 -0
  206. package/dist/components/core/kanban/kanban-fields/SolidDateKanbanField.tsx +14 -0
  207. package/dist/components/core/kanban/kanban-fields/SolidDatetimeKanbanField.tsx +13 -0
  208. package/dist/components/core/kanban/kanban-fields/SolidDecimalKanbanField.tsx +9 -0
  209. package/dist/components/core/kanban/kanban-fields/SolidExternalIdKanbanField.tsx +12 -0
  210. package/dist/components/core/kanban/kanban-fields/SolidFloatKanbanField.tsx +9 -0
  211. package/dist/components/core/kanban/kanban-fields/SolidIdKanbanField.tsx +14 -0
  212. package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.tsx +20 -0
  213. package/dist/components/core/kanban/kanban-fields/SolidLongTextKanbanField.tsx +9 -0
  214. package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.tsx +140 -0
  215. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +164 -0
  216. package/dist/components/core/kanban/kanban-fields/SolidRelationKanbanField.tsx +13 -0
  217. package/dist/components/core/kanban/kanban-fields/SolidRichTextKanbanField.tsx +9 -0
  218. package/dist/components/core/kanban/kanban-fields/SolidSelectionDynamicKanbanField.tsx +14 -0
  219. package/dist/components/core/kanban/kanban-fields/SolidSelectionStaticKanbanField.tsx +14 -0
  220. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.tsx +121 -0
  221. package/dist/components/core/kanban/kanban-fields/SolidTimeKanbanField.tsx +12 -0
  222. package/dist/components/core/kanban/kanban-fields/SolidUuidKanbanField.tsx +13 -0
  223. package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.tsx +16 -0
  224. package/dist/components/core/list/ListViewRowActionPopup.tsx +41 -0
  225. package/dist/components/core/list/SolidColumnSelector/SolidListColumnSelector.tsx +242 -0
  226. package/dist/components/core/list/SolidEmptyListViewPlaceholder.tsx +111 -0
  227. package/dist/components/core/list/SolidListView.tsx +2007 -0
  228. package/dist/components/core/list/SolidListViewColumn.tsx +165 -0
  229. package/dist/components/core/list/SolidListViewConfigure.tsx +339 -0
  230. package/dist/components/core/list/SolidListViewHeaderButton.tsx +31 -0
  231. package/dist/components/core/list/SolidListViewHeaderContextMenuButton.tsx +30 -0
  232. package/dist/components/core/list/SolidListViewRowButtonContextMenu.tsx +41 -0
  233. package/dist/components/core/list/SolidListViewShimmerLoading.tsx +78 -0
  234. package/dist/components/core/list/SolidListingHeader.tsx +42 -0
  235. package/dist/components/core/list/SolidManyToOneFilterElement.tsx +60 -0
  236. package/dist/components/core/list/SolidSelectionDynamicFilterElement.tsx +50 -0
  237. package/dist/components/core/list/SolidSelectionStaticFilterElement.tsx +32 -0
  238. package/dist/components/core/list/SolidTableRowCell.tsx +35 -0
  239. package/dist/components/core/list/SolidVarInputsFilterElement.tsx +184 -0
  240. package/dist/components/core/list/columns/SolidBigintColumn.tsx +9 -0
  241. package/dist/components/core/list/columns/SolidBooleanColumn.tsx +90 -0
  242. package/dist/components/core/list/columns/SolidComputedColumn.tsx +27 -0
  243. package/dist/components/core/list/columns/SolidDateColumn.tsx +90 -0
  244. package/dist/components/core/list/columns/SolidDatetimeColumn.tsx +79 -0
  245. package/dist/components/core/list/columns/SolidDecimalColumn.tsx +9 -0
  246. package/dist/components/core/list/columns/SolidExternalIdColumn.tsx +80 -0
  247. package/dist/components/core/list/columns/SolidFloatColumn.tsx +9 -0
  248. package/dist/components/core/list/columns/SolidIdColumn.tsx +79 -0
  249. package/dist/components/core/list/columns/SolidIntColumn.tsx +87 -0
  250. package/dist/components/core/list/columns/SolidLongTextColumn.tsx +9 -0
  251. package/dist/components/core/list/columns/SolidMediaMultipleColumn.tsx +301 -0
  252. package/dist/components/core/list/columns/SolidMediaSingleColumn.tsx +170 -0
  253. package/dist/components/core/list/columns/SolidRelationColumn.tsx +21 -0
  254. package/dist/components/core/list/columns/SolidRichTextColumn.tsx +9 -0
  255. package/dist/components/core/list/columns/SolidSelectionDynamicColumn.tsx +80 -0
  256. package/dist/components/core/list/columns/SolidSelectionStaticColumn.tsx +81 -0
  257. package/dist/components/core/list/columns/SolidShortTextColumn.tsx +160 -0
  258. package/dist/components/core/list/columns/SolidTimeColumn.tsx +78 -0
  259. package/dist/components/core/list/columns/SolidUuidColumn.tsx +79 -0
  260. package/dist/components/core/list/columns/relations/SolidRelationManyToManyColumn.tsx +106 -0
  261. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.tsx +117 -0
  262. package/dist/components/core/list/columns/relations/SolidRelationOneToManyColumn.tsx +110 -0
  263. package/dist/components/core/list/widgets/SolidManyToManyRelationAvatarListWidget.tsx +30 -0
  264. package/dist/components/core/list/widgets/SolidManyToOneRelationAvatarListWidget.tsx +30 -0
  265. package/dist/components/core/list/widgets/SolidShortTextAvatarWidget.tsx +70 -0
  266. package/dist/components/core/list/widgets/SolidShortTextFieldImageRenderModeWidget.tsx +21 -0
  267. package/dist/components/core/locales/SolidChatterLocaleTabView.tsx +91 -0
  268. package/dist/components/core/locales/SolidLocale.tsx +127 -0
  269. package/dist/components/core/model/CreateModel.tsx +495 -0
  270. package/dist/components/core/model/FieldMetaData.tsx +263 -0
  271. package/dist/components/core/model/FieldMetaDataForm.tsx +3509 -0
  272. package/dist/components/core/model/FieldSelector.tsx +62 -0
  273. package/dist/components/core/model/ModelListViewData.tsx +384 -0
  274. package/dist/components/core/model/ModelMetaData.tsx +921 -0
  275. package/dist/components/core/module/CreateModule.tsx +617 -0
  276. package/dist/components/core/module/ModuleListViewData.tsx +431 -0
  277. package/dist/components/core/solid-ai/SolidAiMainWrapper.tsx +8 -0
  278. package/dist/components/core/solid-ai/SolidXAIIcon.tsx +37 -0
  279. package/dist/components/core/users/CreateUser.tsx +467 -0
  280. package/dist/components/core/users/CreateUserRole.tsx +212 -0
  281. package/dist/components/core/users/UserListView.tsx +376 -0
  282. package/dist/components/layout/AdminLayout.tsx +57 -0
  283. package/dist/components/layout/AdminSidebar.tsx +65 -0
  284. package/dist/components/layout/AppConfig.tsx +104 -0
  285. package/dist/components/layout/AppSidebar.tsx +232 -0
  286. package/dist/components/layout/ButtonLoader.tsx +7 -0
  287. package/dist/components/layout/CustomPagination.tsx +55 -0
  288. package/dist/components/layout/DashboardHeader.tsx +89 -0
  289. package/dist/components/layout/FilterMenu.tsx +122 -0
  290. package/dist/components/layout/Footer.tsx +13 -0
  291. package/dist/components/layout/GlobalSearch.tsx +37 -0
  292. package/dist/components/layout/Header.tsx +8 -0
  293. package/dist/components/layout/Layout.tsx +205 -0
  294. package/dist/components/layout/ListingHeader.tsx +204 -0
  295. package/dist/components/layout/Loader.tsx +16 -0
  296. package/dist/components/layout/UserSidebar.tsx +53 -0
  297. package/dist/components/layout/context/layoutcontext.tsx +52 -0
  298. package/dist/components/layout/navbar-one.tsx +258 -0
  299. package/dist/components/layout/navbar-two-menu.tsx +72 -0
  300. package/dist/components/layout/navbar-two.tsx +37 -0
  301. package/dist/components/layout/user-profile-menu.tsx +213 -0
  302. package/dist/components/layout/user-profile.tsx +7 -0
  303. package/dist/components/modelsComponents/filterIcon.tsx +9 -0
  304. package/dist/constants/error-messages.ts +238 -0
  305. package/dist/declarations.d.ts +22 -0
  306. package/dist/helpers/AppTitle.tsx +12 -0
  307. package/dist/helpers/ToastContainer.tsx +94 -0
  308. package/dist/helpers/autoCompleteVirtualScroll.ts +41 -0
  309. package/dist/helpers/countries.tsx +260 -0
  310. package/dist/helpers/downloadFileWithProgress.ts +91 -0
  311. package/dist/helpers/downloadMediaFile.tsx +21 -0
  312. package/dist/helpers/getAcceptedFileTypes.tsx +22 -0
  313. package/dist/helpers/getRandomColors.tsx +68 -0
  314. package/dist/helpers/helpers.ts +61 -0
  315. package/dist/helpers/hydrateRelationRules.ts +120 -0
  316. package/dist/helpers/permissions.ts +7 -0
  317. package/dist/helpers/registry.ts +337 -0
  318. package/dist/helpers/resendOtpHelper.tsx +5 -0
  319. package/dist/helpers/revalidate.ts +7 -0
  320. package/dist/helpers/rolesHelper.ts +17 -0
  321. package/dist/helpers/solidIcons.tsx +1831 -0
  322. package/dist/helpers/updatePasswordField.ts +41 -0
  323. package/dist/index.ts +421 -0
  324. package/dist/nextAuth/authProviders.d.ts.map +1 -1
  325. package/dist/nextAuth/authProviders.js +6 -5
  326. package/dist/nextAuth/authProviders.js.map +1 -1
  327. package/dist/nextAuth/authProviders.tsx +232 -0
  328. package/dist/nextAuth/handleLogout.tsx +39 -0
  329. package/dist/nextAuth/refreshAccessToken.tsx +28 -0
  330. package/dist/redux/api/aiInteractionApi.ts +59 -0
  331. package/dist/redux/api/authApi.ts +131 -0
  332. package/dist/redux/api/dashboardApi.ts +56 -0
  333. package/dist/redux/api/dashboardQuestionApi.ts +17 -0
  334. package/dist/redux/api/exportTemplateApi.tsx +59 -0
  335. package/dist/redux/api/fetchBaseQuery.tsx +118 -0
  336. package/dist/redux/api/fieldApi.ts +86 -0
  337. package/dist/redux/api/importTransactionApi.tsx +69 -0
  338. package/dist/redux/api/mediaApi.ts +55 -0
  339. package/dist/redux/api/mediaStorageProviderApi.ts +55 -0
  340. package/dist/redux/api/modelApi.ts +80 -0
  341. package/dist/redux/api/moduleApi.ts +72 -0
  342. package/dist/redux/api/permissionApi.ts +32 -0
  343. package/dist/redux/api/pincodeApi.tsx +56 -0
  344. package/dist/redux/api/roleApi.ts +58 -0
  345. package/dist/redux/api/solidActionApi.ts +66 -0
  346. package/dist/redux/api/solidChatterMessageApi.ts +25 -0
  347. package/dist/redux/api/solidEntityApi.tsx +164 -0
  348. package/dist/redux/api/solidMenuApi.ts +71 -0
  349. package/dist/redux/api/solidServiceApi.ts +31 -0
  350. package/dist/redux/api/solidSettingsApi.tsx +83 -0
  351. package/dist/redux/api/solidViewApi.ts +73 -0
  352. package/dist/redux/api/stateApi.tsx +56 -0
  353. package/dist/redux/api/testApi.ts +21 -0
  354. package/dist/redux/api/userApi.ts +135 -0
  355. package/dist/redux/features/authSlice.ts +19 -0
  356. package/dist/redux/features/dataViewSlice.ts +26 -0
  357. package/dist/redux/features/navbarSlice.ts +21 -0
  358. package/dist/redux/features/popupSlice.ts +37 -0
  359. package/dist/redux/features/settingsSlice.ts +60 -0
  360. package/dist/redux/features/themeSlice.ts +17 -0
  361. package/dist/redux/features/userSlice.ts +28 -0
  362. package/dist/redux/hooks/useSolidPopup.ts +20 -0
  363. package/dist/redux/store/defaultStoreConfig.ts +62 -0
  364. package/dist/styles.ts +4 -0
  365. package/dist/types/handlebars.d.ts +4 -0
  366. package/dist/types/index.d.ts +76 -0
  367. package/dist/types/layout.d.ts +94 -0
  368. package/dist/types/next-auth.d.ts +0 -0
  369. package/dist/types/next.d.ts +46 -0
  370. package/dist/types/solid-core.d.ts +320 -0
  371. package/package.json +1 -1
  372. package/src/components/auth/SolidLogin.tsx +26 -13
  373. package/src/nextAuth/authProviders.tsx +9 -5
@@ -0,0 +1,127 @@
1
+ "use client";
2
+
3
+ import { useInitiateChangePasswordMutation } from "../../redux/api/authApi";
4
+ import { useFormik } from "formik";
5
+ import { useRouter } from "next/navigation";
6
+ import { Button } from "primereact/button";
7
+ import { InputText } from "primereact/inputtext";
8
+ import { Message } from "primereact/message";
9
+ import { Toast } from "primereact/toast";
10
+ import { useEffect, useRef } from "react";
11
+ import * as Yup from "yup";
12
+ import { useSelector } from "react-redux";
13
+ import Image from "next/image";
14
+ import SolidLogo from '../../resources/images/SolidXLogo.svg'
15
+ import { ERROR_MESSAGES } from "../../constants/error-messages";
16
+ import { useLazyGetAuthSettingsQuery } from "../../redux/api/solidSettingsApi";
17
+
18
+ const SolidForgotPassword = ({ signInValidatorLabel, signInValidatorPlaceholder }: any) => {
19
+ const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery()
20
+
21
+ useEffect(() => {
22
+ trigger("") // Fetch settings on mount
23
+ }, [trigger])
24
+
25
+ const toast = useRef<Toast>(null);
26
+ const router = useRouter();
27
+ const showToast = (severity: "success" | "error", summary: string, detail: string) => {
28
+ toast.current?.show({
29
+ severity,
30
+ summary,
31
+ detail,
32
+ ...(severity === "error"
33
+ ? { sticky: true } // stays until user closes
34
+ : { life: 3000 }),
35
+ });
36
+ };
37
+ const [initiateChangePassword] = useInitiateChangePasswordMutation();
38
+ const validationSchema = Yup.object({
39
+ email: Yup.string()
40
+ .email(ERROR_MESSAGES.FIELD_INAVLID_FORMAT('email'))
41
+ .required(ERROR_MESSAGES.FIELD_REUQIRED('Email')),
42
+ });
43
+ function maskEmail(email: string) {
44
+ const [localPart, domain] = email.split('@');
45
+ const maskedLocal = localPart.slice(0, 3) + '*'.repeat(localPart.length - 3);
46
+ const maskedDomain = domain.slice(-8).padStart(domain.length, '*');
47
+ return `${maskedLocal}@${maskedDomain}`;
48
+ }
49
+
50
+ const formik = useFormik({
51
+ initialValues: {
52
+ email: "",
53
+ },
54
+ validationSchema,
55
+ onSubmit: async (values) => {
56
+ try {
57
+ const payload = {
58
+ email: values.email,
59
+ };
60
+ const response = await initiateChangePassword(payload).unwrap();
61
+ if (response?.statusCode === 200) {
62
+ const email = values?.email;
63
+ const maskedEmail = maskEmail(email);
64
+ router.push(`/auth/initiate-forgot-password-thank-you?email=${maskedEmail}`)
65
+ } else (
66
+ showToast("error", ERROR_MESSAGES.ERROR, response.error)
67
+ )
68
+ } catch (err: any) {
69
+ showToast("error", ERROR_MESSAGES.ERROR, err?.data ? err?.data?.message : ERROR_MESSAGES.SOMETHING_WRONG);
70
+ }
71
+ },
72
+ });
73
+
74
+ const isFormFieldValid = (formik: any, fieldName: string) =>
75
+ formik.touched[fieldName] && formik.errors[fieldName];
76
+
77
+ return (
78
+ <>
79
+ <Toast ref={toast} />
80
+ <div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`}>
81
+ {solidSettingsData?.data?.authPagesLayout === 'center' &&
82
+ <div className="flex justify-content-center">
83
+ <div className={`solid-logo flex align-items-center ${solidSettingsData?.data?.appLogoPosition}`}>
84
+ <Image
85
+ alt="solid logo"
86
+ src={solidSettingsData?.data?.appLogo || SolidLogo}
87
+ className="relative"
88
+ fill
89
+ />
90
+ </div>
91
+ </div>
92
+ }
93
+ <h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>Forgot Password</h2>
94
+ {/* <p className="solid-auth-subtitle text-sm">By continuing, you agree to the <Link href={'#'}>Terms of Service</Link> and acknowledge you’ve read our <Link href={'#'}>Privacy Policy.</Link> </p> */}
95
+ <form onSubmit={formik.handleSubmit}>
96
+ <div className="flex flex-column gap-2">
97
+ <label htmlFor="email" className="solid-auth-input-label">{signInValidatorLabel ? signInValidatorLabel : "Username or Email"}</label>
98
+ <InputText
99
+ id="email"
100
+ name="email"
101
+ placeholder={signInValidatorPlaceholder ? signInValidatorPlaceholder : "Email ID"}
102
+ value={formik.values.email}
103
+ onChange={formik.handleChange}
104
+ onBlur={formik.handleBlur}
105
+ />
106
+ {isFormFieldValid(formik, "email") && <Message
107
+ className="text-red-500 text-sm"
108
+ severity="error"
109
+ text={formik?.errors?.email?.toString()}
110
+ />}
111
+ </div>
112
+ <div className="mt-4">
113
+ <Button className="w-full font-light auth-submit-button" label="Continue" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
114
+ <Button type="button" label="Back" className="w-full auth-back-button text-center mt-1" link onClick={() => (window.location.href = '/auth/login')} />
115
+ </div>
116
+ </form>
117
+ </div>
118
+ {/* <div className="text-center mt-5">
119
+ <div className="text-sm text-400 secondary-dark-color">
120
+ {'<'} Back to <Link className="font-bold" href="/auth/login">Sign In</Link>
121
+ </div>
122
+ </div> */}
123
+ </>
124
+ );
125
+ };
126
+
127
+ export default SolidForgotPassword;
@@ -0,0 +1,271 @@
1
+ "use client";
2
+
3
+ import { useConfirmOtpLoginMutation, useInitateLoginMutation } from "../../redux/api/authApi";
4
+ import { Form, Formik } from "formik";
5
+ import Image from "next/image";
6
+ import { useRouter, useSearchParams } from "next/navigation";
7
+ import { Button } from "primereact/button";
8
+ import { InputOtp } from "primereact/inputotp";
9
+ import { Message } from "primereact/message";
10
+ import { Toast } from "primereact/toast";
11
+ import { useEffect, useRef, useState } from "react";
12
+ import * as Yup from "yup";
13
+ import SolidLogo from '../../resources/images/SolidXLogo.svg'
14
+ import { signIn } from "next-auth/react";
15
+ import { ERROR_MESSAGES } from "../../constants/error-messages";
16
+ import { useLazyGetAuthSettingsQuery } from "../../redux/api/solidSettingsApi";
17
+
18
+
19
+ const SolidInitialLoginOtp = () => {
20
+ const searchParams = useSearchParams();
21
+ const tempIdentifier = searchParams.get('identifier');
22
+ const type = searchParams.get('type') || 'email';
23
+ const identifier = tempIdentifier ? decodeURIComponent(tempIdentifier) : '';
24
+
25
+ const RESEND_OTP_KEY = `resendOtpLogin_${identifier}`;
26
+ const RESEND_OTP_TIMER_MIN = parseFloat(process.env.NEXT_PUBLIC_RESEND_OTP_TIMER || '0.5');
27
+ const RESEND_OTP_TIMER = Math.round(RESEND_OTP_TIMER_MIN * 60);
28
+ const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
29
+ useEffect(() => {
30
+ trigger("") // Fetch settings on mount
31
+ }, [trigger])
32
+
33
+ const [initiateResendOTP] = useInitateLoginMutation();
34
+ const [initiateOtpLogin] = useConfirmOtpLoginMutation();
35
+ const toast = useRef<Toast>(null);
36
+ const router = useRouter();
37
+ const [timeLeft, setTimeLeft] = useState(RESEND_OTP_TIMER);
38
+ const [resendEnabled, setResendEnabled] = useState(false);
39
+
40
+ const getDisplayText = () => {
41
+ switch (type) {
42
+ case "mobile":
43
+ return {
44
+ title: "OTP Verification",
45
+ subtitle: "Please enter the OTP sent to your mobile number to complete verification"
46
+ };
47
+ case "transactional":
48
+ return {
49
+ title: "OTP Verification",
50
+ subtitle: "Please enter the OTP for your transaction to complete verification"
51
+ };
52
+ case "email":
53
+ default:
54
+ return {
55
+ title: "OTP Verification",
56
+ subtitle: "Please enter the OTP sent to your email to complete verification"
57
+ };
58
+ }
59
+ };
60
+
61
+ const displayText = getDisplayText();
62
+
63
+ useEffect(() => {
64
+
65
+ // Set timer if not already set (e.g., after login)
66
+ const storedTime = localStorage.getItem(RESEND_OTP_KEY);
67
+ if (!storedTime) {
68
+ localStorage.setItem(RESEND_OTP_KEY, Date.now().toString());
69
+ }
70
+
71
+ const lastSent = storedTime ? parseInt(storedTime, 10) : Date.now();
72
+ const elapsed = Math.floor((Date.now() - lastSent) / 1000);
73
+ const remaining = RESEND_OTP_TIMER - elapsed;
74
+
75
+ if (remaining > 0) {
76
+ setTimeLeft(remaining);
77
+ setResendEnabled(false);
78
+ } else {
79
+ setTimeLeft(0);
80
+ setResendEnabled(true);
81
+ }
82
+ }, [identifier]);
83
+
84
+ useEffect(() => {
85
+ if (resendEnabled || timeLeft <= 0) return;
86
+
87
+ const interval = setInterval(() => {
88
+ setTimeLeft((prev) => {
89
+ if (prev <= 1) {
90
+ clearInterval(interval);
91
+ setResendEnabled(true);
92
+ return 0;
93
+ }
94
+ return prev - 1;
95
+ });
96
+ }, 1000);
97
+
98
+ return () => clearInterval(interval);
99
+ }, [resendEnabled, timeLeft]);
100
+
101
+ const validationSchema = Yup.object({
102
+ otp: Yup.string()
103
+ .matches(/^\d{6}$/, ERROR_MESSAGES.OTP_CHARACTER(6))
104
+ .required(ERROR_MESSAGES.FIELD_REUQIRED('OTP')),
105
+ });
106
+
107
+ const showToast = (severity: "success" | "error", summary: string, detail: string) => {
108
+ toast.current?.show({
109
+ severity,
110
+ summary,
111
+ detail,
112
+ ...(severity === "error"
113
+ ? { sticky: true } // stays until user closes
114
+ : { life: 3000 }),
115
+ });
116
+ };
117
+
118
+ const isFormFieldValid = (formik: any, fieldName: string) =>
119
+ formik.touched[fieldName] && formik.errors[fieldName];
120
+
121
+
122
+ const handleResendOtp = async () => {
123
+ try {
124
+ const payload = {
125
+ type: type,
126
+ identifier: identifier,
127
+ };
128
+
129
+ const response = await initiateResendOTP(payload).unwrap();
130
+
131
+ if (response?.statusCode === 200) {
132
+ showToast("success", ERROR_MESSAGES.OPT_RESEND, response?.data?.message);
133
+ localStorage.setItem(RESEND_OTP_KEY, Date.now().toString());
134
+ setTimeLeft(RESEND_OTP_TIMER);
135
+ setResendEnabled(false);
136
+ } else {
137
+ showToast("error", ERROR_MESSAGES.LOGIN_ERROR, response.error);
138
+ }
139
+ } catch (err: any) {
140
+ showToast("error", ERROR_MESSAGES.LOGIN_ERROR, err?.data?.message || ERROR_MESSAGES.SOMETHING_WRONG);
141
+ }
142
+ };
143
+
144
+ return (
145
+ <>
146
+ <Toast ref={toast} />
147
+ <div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`} style={{ minWidth: 480 }}>
148
+ {solidSettingsData?.data?.authPagesLayout === 'center' &&
149
+ <div className="flex justify-content-center">
150
+ <div className={`solid-logo flex align-items-center ${solidSettingsData?.data?.appLogoPosition}`}>
151
+ <Image
152
+ alt="solid logo"
153
+ src={solidSettingsData?.data?.appLogo || SolidLogo}
154
+ className="relative"
155
+ fill
156
+ />
157
+ </div>
158
+ </div>
159
+ }
160
+ <h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center mt-2 md:mt-4' : 'text-left'}`}>OTP Verification</h2>
161
+ <p className="solid-auth-subtitle text-sm">
162
+ Please enter the OTP sent to your email to complete verification
163
+ </p>
164
+ <>
165
+ <Formik
166
+ initialValues={{
167
+ otp: "",
168
+ }}
169
+ validationSchema={validationSchema}
170
+ onSubmit={async (values, { setSubmitting, setErrors }) => {
171
+ try {
172
+ const payload = {
173
+ type: type,
174
+ identifier: identifier,
175
+ otp: values.otp
176
+ };
177
+
178
+ const response = await initiateOtpLogin(payload).unwrap(); // Call mutation trigger
179
+
180
+ if (response?.statusCode === 200) {
181
+ const credentials: any = {
182
+ redirect: false,
183
+ accessToken: response?.data?.accessToken,
184
+ };
185
+
186
+ // Pass both email and mobile if available
187
+ if (response?.data?.user?.email) {
188
+ credentials.email = response?.data?.user?.email;
189
+ }
190
+ if (response?.data?.user?.mobile) {
191
+ credentials.mobile = response?.data?.user?.mobile;
192
+ }
193
+
194
+ // Fallback: if neither exists in response, use the identifier based on type
195
+ if (!credentials.email && !credentials.mobile) {
196
+ if (type === "mobile") {
197
+ credentials.mobile = identifier;
198
+ } else if (type === "email") {
199
+ credentials.email = identifier;
200
+ }
201
+ }
202
+
203
+ const otpResponse = await signIn("credentials", credentials);
204
+
205
+ if (otpResponse?.error) {
206
+ showToast("error", ERROR_MESSAGES.LOGIN_ERROR, otpResponse.error);
207
+ } else {
208
+ localStorage.removeItem(`resendOtpLogin_${identifier}`);
209
+ showToast("success", ERROR_MESSAGES.LOGIN_SUCCESS, ERROR_MESSAGES.DASHBOARD_REDIRECTING);
210
+ router.push(`${process.env.NEXT_PUBLIC_LOGIN_REDIRECT_URL}`);
211
+ }
212
+ } else {
213
+ showToast("error", ERROR_MESSAGES.INAVLID_OTP, response.error);
214
+ setErrors({
215
+ otp: ERROR_MESSAGES.INAVLID_OTP,
216
+ });
217
+ }
218
+ } catch (err: any) {
219
+ showToast("error", ERROR_MESSAGES.LOGIN_ERROR, err?.data ? err?.data?.message : ERROR_MESSAGES.SOMETHING_WRONG);
220
+ } finally {
221
+ setSubmitting(false);
222
+ }
223
+ }}
224
+ >
225
+ {(formik) => (
226
+ <Form>
227
+ <div className="flex flex-column gap-2">
228
+ <label htmlFor="otp" className="solid-auth-input-label">Enter OTP</label>
229
+ <InputOtp
230
+ value={formik.values.otp}
231
+ onChange={(e) => formik.setFieldValue("otp", e.value)}
232
+ length={6}
233
+ style={{ width: '100%' }}
234
+ invalid={!!formik.errors.otp}
235
+ />
236
+ {isFormFieldValid(formik, "otp") && (
237
+ <Message className="text-red-500 text-sm" severity="error" text={formik.errors.otp?.toString()} />
238
+ )}
239
+ <div className="flex align-items-center justify-content-between">
240
+ <Button type="button" icon='pi pi-refresh' iconPos="left" link label="Resend Code" className="px-0 text-sm font-normal"
241
+ onClick={handleResendOtp}
242
+ disabled={!resendEnabled}
243
+ />
244
+ <p className="m-0 text-sm text-color">
245
+ {resendEnabled
246
+ ? "You can resend now"
247
+ : `Time left: ${Math.floor(timeLeft / 60)
248
+ .toString()
249
+ .padStart(2, "0")}:${(timeLeft % 60).toString().padStart(2, "0")}`}
250
+ </p>
251
+ </div>
252
+ </div>
253
+ <div className="mt-4">
254
+ <Button type="submit" className="w-full font-light auth-submit-button" label="Verify" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
255
+ <Button type="button" label="Back" className="w-full auth-back-button text-center mt-1" link onClick={() => (window.location.href = '/auth/login')} />
256
+ </div>
257
+ </Form>
258
+ )}
259
+ </Formik>
260
+ </>
261
+ </div>
262
+ {/* <div className="text-center mt-5">
263
+ <div className="text-sm text-400 secondary-dark-color">
264
+ {'<'} Back to <Link className="font-bold" href="/auth/login">Back</Link>
265
+ </div>
266
+ </div> */}
267
+ </>
268
+ );
269
+ };
270
+
271
+ export default SolidInitialLoginOtp;
@@ -0,0 +1,218 @@
1
+ "use client";
2
+
3
+ import { useConfirmOtpRegisterMutation, useInitateRegisterMutation } from "../../redux/api/authApi";
4
+ import { Form, Formik } from "formik";
5
+ import Image from "next/image";
6
+ import { useRouter, useSearchParams } from "next/navigation";
7
+ import { Button } from "primereact/button";
8
+ import { InputOtp } from "primereact/inputotp";
9
+ import { Message } from "primereact/message";
10
+ import { Toast } from "primereact/toast";
11
+ import { useEffect, useRef, useState } from "react";
12
+ import * as Yup from "yup";
13
+ import SolidLogo from '../../resources/images/SolidXLogo.svg'
14
+ import { ERROR_MESSAGES } from "../../constants/error-messages";
15
+ import { useLazyGetAuthSettingsQuery } from "../../redux/api/solidSettingsApi";
16
+
17
+ const SolidInitiateRegisterOtp = () => {
18
+ const searchParams = useSearchParams();
19
+ const tempEmail = searchParams.get('email');
20
+ const email = tempEmail ? decodeURIComponent(tempEmail) : '';
21
+ const RESEND_OTP_KEY = `resendOtpRegister_${email}`;
22
+ const RESEND_OTP_TIMER_MIN = parseFloat(process.env.NEXT_PUBLIC_RESEND_OTP_TIMER || '0.5');
23
+ const RESEND_OTP_TIMER = Math.round(RESEND_OTP_TIMER_MIN * 60);
24
+ const username = searchParams.get('username') || '';
25
+ const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
26
+ useEffect(() => {
27
+ trigger("") // Fetch settings on mount
28
+ }, [trigger])
29
+
30
+
31
+ const [initiateResendOTP] = useInitateRegisterMutation();
32
+ const [initiateOtpRegister] = useConfirmOtpRegisterMutation();
33
+ const toast = useRef<Toast>(null);
34
+ const router = useRouter();
35
+ const [timeLeft, setTimeLeft] = useState(RESEND_OTP_TIMER);
36
+ const [resendEnabled, setResendEnabled] = useState(false);
37
+
38
+ useEffect(() => {
39
+
40
+ // Set timer if not already set (e.g., after login)
41
+ const storedTime = localStorage.getItem(RESEND_OTP_KEY);
42
+ if (!storedTime) {
43
+ localStorage.setItem(RESEND_OTP_KEY, Date.now().toString());
44
+ }
45
+
46
+ const lastSent = storedTime ? parseInt(storedTime, 10) : Date.now();
47
+ const elapsed = Math.floor((Date.now() - lastSent) / 1000);
48
+ const remaining = RESEND_OTP_TIMER - elapsed;
49
+
50
+ if (remaining > 0) {
51
+ setTimeLeft(remaining);
52
+ setResendEnabled(false);
53
+ } else {
54
+ setTimeLeft(0);
55
+ setResendEnabled(true);
56
+ }
57
+ }, [email]);
58
+
59
+ useEffect(() => {
60
+ if (resendEnabled || timeLeft <= 0) return;
61
+
62
+ const interval = setInterval(() => {
63
+ setTimeLeft((prev) => {
64
+ if (prev <= 1) {
65
+ clearInterval(interval);
66
+ setResendEnabled(true);
67
+ return 0;
68
+ }
69
+ return prev - 1;
70
+ });
71
+ }, 1000);
72
+
73
+ return () => clearInterval(interval);
74
+ }, [resendEnabled, timeLeft]);
75
+
76
+ const validationSchema = Yup.object({
77
+ otp: Yup.string()
78
+ .matches(/^\d{6}$/, ERROR_MESSAGES.OTP_CHARACTER(6))
79
+ .required(ERROR_MESSAGES.FIELD_REUQIRED('OTP')),
80
+ });
81
+
82
+ const showToast = (severity: "success" | "error", summary: string, detail: string) => {
83
+ toast.current?.show({
84
+ severity,
85
+ summary,
86
+ detail,
87
+ ...(severity === "error"
88
+ ? { sticky: true } // stays until user closes
89
+ : { life: 3000 }),
90
+ });
91
+ };
92
+
93
+ const isFormFieldValid = (formik: any, fieldName: string) =>
94
+ formik.touched[fieldName] && formik.errors[fieldName];
95
+
96
+ const handleResendOtp = async () => {
97
+ try {
98
+ const payload = {
99
+ username: username,
100
+ email: email,
101
+ validationSources: ["email"]
102
+ };
103
+
104
+ const response = await initiateResendOTP(payload).unwrap();
105
+
106
+ if (response?.statusCode === 200) {
107
+ showToast("success", ERROR_MESSAGES.OPT_RESEND, response?.data?.message);
108
+ localStorage.setItem(RESEND_OTP_KEY, Date.now().toString());
109
+ setTimeLeft(RESEND_OTP_TIMER);
110
+ setResendEnabled(false);
111
+ } else {
112
+ showToast("error", ERROR_MESSAGES.LOGIN_ERROR, response.error);
113
+ }
114
+ } catch (err: any) {
115
+ showToast("error", ERROR_MESSAGES.LOGIN_ERROR, err?.data?.message || ERROR_MESSAGES.SOMETHING_WRONG);
116
+ }
117
+ };
118
+
119
+ return (
120
+ <>
121
+ <Toast ref={toast} />
122
+ <div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`} style={{ minWidth: 480 }}>
123
+ {solidSettingsData?.data?.authPagesLayout === 'center' &&
124
+ <div className="flex justify-content-center">
125
+ <div className={`solid-logo flex align-items-center ${solidSettingsData?.data?.appLogoPosition}`}>
126
+ <Image
127
+ alt="solid logo"
128
+ src={solidSettingsData?.data?.appLogo || SolidLogo}
129
+ className="relative"
130
+ fill
131
+ />
132
+ </div>
133
+ </div>
134
+ }
135
+ <h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>OTP Verification</h2>
136
+ <p className="solid-auth-subtitle text-sm">
137
+ Please enter the OTP sent to your email to complete verification
138
+ </p>
139
+ <>
140
+ <Formik
141
+ initialValues={{
142
+ otp: "",
143
+ }}
144
+ validationSchema={validationSchema}
145
+ onSubmit={async (values, { setSubmitting, setErrors }) => {
146
+ try {
147
+ const payload = {
148
+ type: "email",
149
+ identifier: email,
150
+ otp: values.otp
151
+ };
152
+
153
+ const response = await initiateOtpRegister(payload).unwrap(); // Call mutation trigger
154
+
155
+ if (response?.statusCode === 200) {
156
+ localStorage.removeItem(`resendOtpRegister_${email}`);
157
+ showToast("success", ERROR_MESSAGES.LOGIN_SUCCESSFULLY, "Login");
158
+ router.push(`/auth/login`);
159
+ } else {
160
+ showToast("error", ERROR_MESSAGES.INAVLID_OTP, response.error);
161
+ setErrors({
162
+ otp: ERROR_MESSAGES.INAVLID_OTP,
163
+ });
164
+ }
165
+ } catch (err: any) {
166
+ showToast("error", ERROR_MESSAGES.LOGIN_ERROR, err?.data ? err?.data?.message : ERROR_MESSAGES.SOMETHING_WRONG);
167
+ } finally {
168
+ setSubmitting(false);
169
+ }
170
+ }}
171
+ >
172
+ {(formik) => (
173
+ <Form>
174
+ <div className="flex flex-column gap-2">
175
+ <label htmlFor="otp" className="solid-auth-input-label">Enter OTP</label>
176
+ <InputOtp
177
+ value={formik.values.otp}
178
+ onChange={(e) => formik.setFieldValue("otp", e.value)}
179
+ length={6}
180
+ style={{ width: '100%' }}
181
+ invalid={!!formik.errors.otp}
182
+ />
183
+ {isFormFieldValid(formik, "otp") && (
184
+ <Message className="text-red-500 text-sm" severity="error" text={formik.errors.otp?.toString()} />
185
+ )}
186
+ <div className="flex align-items-center justify-content-between">
187
+ <Button type="button" icon='pi pi-refresh' iconPos="left" link label="Resend Code" className="px-0 text-sm font-normal"
188
+ onClick={handleResendOtp}
189
+ disabled={!resendEnabled}
190
+ />
191
+ <p className="m-0 text-sm text-color">
192
+ {resendEnabled
193
+ ? "You can resend now"
194
+ : `Time left: ${Math.floor(timeLeft / 60)
195
+ .toString()
196
+ .padStart(2, "0")}:${(timeLeft % 60).toString().padStart(2, "0")}`}
197
+ </p>
198
+ </div>
199
+ </div>
200
+ <div className="mt-4">
201
+ <Button type="submit" className="w-full font-light auth-submit-button" label="Verify" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
202
+ <Button type="button" label="Back" className="w-full auth-back-button text-center mt-1" link onClick={() => (window.location.href = '/auth/login')} />
203
+ </div>
204
+ </Form>
205
+ )}
206
+ </Formik>
207
+ </>
208
+ </div>
209
+ {/* <div className="text-center mt-5">
210
+ <div className="text-sm text-400 secondary-dark-color">
211
+ {'<'} Back to <Link className="font-bold" href="/auth/login">Sign In</Link>
212
+ </div>
213
+ </div> */}
214
+ </>
215
+ );
216
+ };
217
+
218
+ export default SolidInitiateRegisterOtp;
@@ -1 +1 @@
1
- {"version":3,"file":"SolidLogin.d.ts","sourceRoot":"./","sources":["components/auth/SolidLogin.tsx"],"names":[],"mappings":"AA4BA,QAAA,MAAM,UAAU,yDAA0D,GAAG,4CAmY5E,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"SolidLogin.d.ts","sourceRoot":"./","sources":["components/auth/SolidLogin.tsx"],"names":[],"mappings":"AA4BA,QAAA,MAAM,UAAU,yDAA0D,GAAG,4CAgZ5E,CAAC;AAEF,eAAe,UAAU,CAAC"}