@solidxai/core-ui 0.1.8-beta.22 → 0.1.8-beta.23

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 (87) hide show
  1. package/dist/components/auth/AuthLayout.d.ts +1 -1
  2. package/dist/components/auth/AuthLayout.d.ts.map +1 -1
  3. package/dist/components/auth/AuthLayout.js +3 -4
  4. package/dist/components/auth/AuthLayout.js.map +1 -1
  5. package/dist/components/auth/AuthLayout.tsx +4 -5
  6. package/dist/components/auth/SolidOTPVerify.d.ts +3 -0
  7. package/dist/components/auth/SolidOTPVerify.d.ts.map +1 -0
  8. package/dist/components/auth/SolidOTPVerify.js +67 -0
  9. package/dist/components/auth/SolidOTPVerify.js.map +1 -0
  10. package/dist/components/auth/SolidOTPVerify.tsx +133 -0
  11. package/dist/components/common/AuthBanner.js.map +1 -1
  12. package/dist/components/core/common/LoadDynamicJsxComponent.d.ts +2 -0
  13. package/dist/components/core/common/LoadDynamicJsxComponent.d.ts.map +1 -0
  14. package/dist/components/core/common/LoadDynamicJsxComponent.js +50 -0
  15. package/dist/components/core/common/LoadDynamicJsxComponent.js.map +1 -0
  16. package/dist/components/core/common/LoadDynamicJsxComponent.tsx +70 -0
  17. package/dist/components/core/common/SolidGlobalSearchElement.js +1 -1
  18. package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
  19. package/dist/components/core/common/SolidGlobalSearchElement.tsx +1 -1
  20. package/dist/components/core/kanban/SolidManyToOneFilterElement.d.ts.map +1 -1
  21. package/dist/components/core/kanban/SolidManyToOneFilterElement.js.map +1 -1
  22. package/dist/components/core/kanban/SolidManyToOneFilterElement.tsx +2 -1
  23. package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.d.ts.map +1 -1
  24. package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.js +2 -2
  25. package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.js.map +1 -1
  26. package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.tsx +10 -21
  27. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.d.ts.map +1 -1
  28. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js +2 -2
  29. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js.map +1 -1
  30. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +10 -18
  31. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.d.ts.map +1 -1
  32. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js +6 -3
  33. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js.map +1 -1
  34. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.tsx +24 -30
  35. package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.js.map +1 -1
  36. package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.tsx +2 -2
  37. package/dist/components/core/list/SolidListViewRowButtonContextMenu.d.ts +1 -1
  38. package/dist/components/core/list/SolidListViewRowButtonContextMenu.d.ts.map +1 -1
  39. package/dist/components/core/list/SolidListViewRowButtonContextMenu.js +7 -6
  40. package/dist/components/core/list/SolidListViewRowButtonContextMenu.js.map +1 -1
  41. package/dist/components/core/list/SolidListViewRowButtonContextMenu.tsx +10 -9
  42. package/dist/components/shad-cn-ui/SolidDatePicker.d.ts.map +1 -1
  43. package/dist/components/shad-cn-ui/SolidDatePicker.js +1 -1
  44. package/dist/components/shad-cn-ui/SolidDatePicker.js.map +1 -1
  45. package/dist/components/shad-cn-ui/SolidDatePicker.tsx +2 -0
  46. package/dist/nextAuth/authProviders.d.ts +4 -0
  47. package/dist/nextAuth/authProviders.d.ts.map +1 -0
  48. package/dist/nextAuth/authProviders.js +198 -0
  49. package/dist/nextAuth/authProviders.js.map +1 -0
  50. package/dist/nextAuth/authProviders.tsx +232 -0
  51. package/dist/nextAuth/handleLogout.d.ts +2 -0
  52. package/dist/nextAuth/handleLogout.d.ts.map +1 -0
  53. package/dist/nextAuth/handleLogout.js +36 -0
  54. package/dist/nextAuth/handleLogout.js.map +1 -0
  55. package/dist/nextAuth/handleLogout.tsx +39 -0
  56. package/dist/nextAuth/refreshAccessToken.d.ts +2 -0
  57. package/dist/nextAuth/refreshAccessToken.d.ts.map +1 -0
  58. package/dist/nextAuth/refreshAccessToken.js +24 -0
  59. package/dist/nextAuth/refreshAccessToken.js.map +1 -0
  60. package/dist/nextAuth/refreshAccessToken.tsx +28 -0
  61. package/dist/redux/features/settingsSlice.d.ts +20 -0
  62. package/dist/redux/features/settingsSlice.d.ts.map +1 -0
  63. package/dist/redux/features/settingsSlice.js +39 -0
  64. package/dist/redux/features/settingsSlice.js.map +1 -0
  65. package/dist/redux/features/settingsSlice.ts +60 -0
  66. package/dist/resources/globals.css +10 -0
  67. package/package.json +1 -1
  68. package/dist/components/core/list/SolidDataTablePagination.d.ts +0 -15
  69. package/dist/components/core/list/SolidDataTablePagination.d.ts.map +0 -1
  70. package/dist/components/core/list/SolidDataTablePagination.js +0 -22
  71. package/dist/components/core/list/SolidDataTablePagination.js.map +0 -1
  72. package/dist/components/core/list/SolidDataTablePagination.tsx +0 -71
  73. package/dist/components/solid-ui/SolidButton.d.ts +0 -14
  74. package/dist/components/solid-ui/SolidButton.d.ts.map +0 -1
  75. package/dist/components/solid-ui/SolidButton.js +0 -36
  76. package/dist/components/solid-ui/SolidButton.js.map +0 -1
  77. package/dist/components/solid-ui/SolidButton.tsx +0 -54
  78. package/dist/components/solid-ui/SolidTabs.d.ts +0 -18
  79. package/dist/components/solid-ui/SolidTabs.d.ts.map +0 -1
  80. package/dist/components/solid-ui/SolidTabs.js +0 -22
  81. package/dist/components/solid-ui/SolidTabs.js.map +0 -1
  82. package/dist/components/solid-ui/SolidTabs.tsx +0 -73
  83. package/dist/components/solid-ui/index.d.ts +0 -3
  84. package/dist/components/solid-ui/index.d.ts.map +0 -1
  85. package/dist/components/solid-ui/index.js +0 -3
  86. package/dist/components/solid-ui/index.js.map +0 -1
  87. package/dist/components/solid-ui/index.ts +0 -2
@@ -1,6 +1,7 @@
1
1
 
2
2
  import { useState } from 'react';
3
3
  import { SolidKanbanViewFieldsParams } from '../SolidKanbanViewFields';
4
+ import { Dialog } from 'primereact/dialog';
4
5
  import { Document, Page } from "react-pdf";
5
6
  import { PDFSvg } from '../../../../components/Svg/PDFSvg';
6
7
  import MP3Image from '../../../../resources/images/fileTypes/Mp3.png'
@@ -8,18 +9,29 @@ import MP4Image from '../../../../resources/images/fileTypes/Mp4.png'
8
9
  import FileImage from '../../../../resources/images/fileTypes/File.png'
9
10
  import Image from "../../../common/Image";
10
11
  import { ExcelSvg } from '../../../../components/Svg/ExcelSvg';
11
- import {
12
- SolidDialog,
13
- SolidDialogBody,
14
- SolidDialogClose,
15
- SolidDialogHeader,
16
- SolidDialogTitle,
17
- } from "../../../shad-cn-ui";
18
12
  const SolidShortTextKanbanField = ({ solidKanbanViewMetaData, fieldMetadata, fieldLayout, data, setLightboxUrls, setOpenLightbox, groupedView }: SolidKanbanViewFieldsParams) => {
19
13
  const [visible, setVisible] = useState(false);
20
14
  const widget = fieldLayout?.attrs?.widget ? fieldLayout?.attrs?.widget : "text";
21
15
  const mimeType = data && data?.mimeType
22
16
  const fileName = data?.originalFileName;
17
+ const PDFHeader = () => {
18
+ return (
19
+ <div className='flex justify-content-between align-items-center'>
20
+ <p className='m-0'>
21
+ {fileName}
22
+ </p>
23
+ <a
24
+ href={data[fieldMetadata.name]}
25
+ download={fileName}
26
+ target="_blank"
27
+ rel="noopener noreferrer"
28
+ className='mr-4'
29
+ >
30
+ <i className='pi pi-download' />
31
+ </a>
32
+ </div>
33
+ )
34
+ }
23
35
  return (
24
36
  <div className={`${fieldLayout?.attrs?.className ? ` ${fieldLayout.attrs.className}` : ""}`}>
25
37
  {widget === "text" && groupedView &&
@@ -49,29 +61,11 @@ const SolidShortTextKanbanField = ({ solidKanbanViewMetaData, fieldMetadata, fie
49
61
  <div className='kanban-media-view-card' onClick={() => setVisible(true)} style={{ cursor: 'pointer' }}>
50
62
  <PDFSvg />
51
63
  </div>
52
- <SolidDialog open={visible} onOpenChange={setVisible} className="solid-kanban-preview-dialog">
53
- <SolidDialogHeader className="solid-kanban-preview-dialog-header">
54
- <div className="solid-kanban-preview-dialog-title-row">
55
- <SolidDialogTitle>{fileName}</SolidDialogTitle>
56
- <a
57
- href={data[fieldMetadata.name]}
58
- download={fileName}
59
- target="_blank"
60
- rel="noopener noreferrer"
61
- className="solid-kanban-preview-download"
62
- onClick={(event) => event.stopPropagation()}
63
- >
64
- <i className='pi pi-download' />
65
- </a>
66
- <SolidDialogClose />
67
- </div>
68
- </SolidDialogHeader>
69
- <SolidDialogBody className="solid-kanban-preview-dialog-body">
70
- <Document file={data[fieldMetadata.name]}>
71
- <Page pageNumber={1} />
72
- </Document>
73
- </SolidDialogBody>
74
- </SolidDialog>
64
+ <Dialog header={<PDFHeader />} visible={visible} style={{ width: "" }} onHide={() => setVisible(false)} modal>
65
+ <Document file={data[fieldMetadata.name]}>
66
+ <Page pageNumber={1} />
67
+ </Document>
68
+ </Dialog>
75
69
  </div>
76
70
  )}
77
71
 
@@ -1 +1 @@
1
- {"version":3,"file":"SolidRelationManyToOneKanbanField.js","sourceRoot":"","sources":["../../../../../../src/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.tsx"],"names":[],"mappings":";AAOA,IAAM,iCAAiC,GAAG,UAAC,EAAyF;QAAvF,uBAAuB,6BAAA,EAAE,aAAa,mBAAA,EAAE,WAAW,iBAAA,EAAC,IAAI,UAAA;IAEjG,OAAO,CACJ,mBAAK,CACP,CAAC;AAEN,CAAC,CAAC;AAEF,eAAe,iCAAiC,CAAC","sourcesContent":["\nimport { FilterMatchMode } from 'primereact/api';\nimport { Column, ColumnFilterElementTemplateOptions } from \"primereact/column\";\nimport { FormEvent } from \"primereact/ts-helpers\";\nimport { InputTypes, SolidVarInputsFilterElement } from '../../../../../components/core/filter/SolidVarInputsFilterElement';\nimport { SolidKanbanViewFieldsParams } from '../../../../../components/core/kanban/SolidKanbanViewFields';\n\nconst SolidRelationManyToOneKanbanField = ({ solidKanbanViewMetaData, fieldMetadata, fieldLayout,data }: SolidKanbanViewFieldsParams) => {\n \n return (\n <></>\n );\n\n};\n\nexport default SolidRelationManyToOneKanbanField;\n"]}
1
+ {"version":3,"file":"SolidRelationManyToOneKanbanField.js","sourceRoot":"","sources":["../../../../../../src/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.tsx"],"names":[],"mappings":";AAOA,IAAM,iCAAiC,GAAG,UAAC,EAAyF;QAAvF,uBAAuB,6BAAA,EAAE,aAAa,mBAAA,EAAE,WAAW,iBAAA,EAAC,IAAI,UAAA;IAEjG,OAAO,CACJ,mBAAK,CACP,CAAC;AAEN,CAAC,CAAC;AAEF,eAAe,iCAAiC,CAAC","sourcesContent":["\nimport { FilterMatchMode } from 'primereact/api';\nimport { Column, ColumnFilterElementTemplateOptions } from \"primereact/column\";\nimport { FormEvent } from \"primereact/ts-helpers\";\nimport { InputTypes, SolidVarInputsFilterElement } from '../../../../../components/core/kanban/SolidVarInputsFilterElement';\nimport { SolidKanbanViewFieldsParams } from '../../../../../components/core/kanban/SolidKanbanViewFields';\n\nconst SolidRelationManyToOneKanbanField = ({ solidKanbanViewMetaData, fieldMetadata, fieldLayout,data }: SolidKanbanViewFieldsParams) => {\n \n return (\n <></>\n );\n\n};\n\nexport default SolidRelationManyToOneKanbanField;"]}
@@ -2,7 +2,7 @@
2
2
  import { FilterMatchMode } from 'primereact/api';
3
3
  import { Column, ColumnFilterElementTemplateOptions } from "primereact/column";
4
4
  import { FormEvent } from "primereact/ts-helpers";
5
- import { InputTypes, SolidVarInputsFilterElement } from '../../../../../components/core/filter/SolidVarInputsFilterElement';
5
+ import { InputTypes, SolidVarInputsFilterElement } from '../../../../../components/core/kanban/SolidVarInputsFilterElement';
6
6
  import { SolidKanbanViewFieldsParams } from '../../../../../components/core/kanban/SolidKanbanViewFields';
7
7
 
8
8
  const SolidRelationManyToOneKanbanField = ({ solidKanbanViewMetaData, fieldMetadata, fieldLayout,data }: SolidKanbanViewFieldsParams) => {
@@ -13,4 +13,4 @@ const SolidRelationManyToOneKanbanField = ({ solidKanbanViewMetaData, fieldMetad
13
13
 
14
14
  };
15
15
 
16
- export default SolidRelationManyToOneKanbanField;
16
+ export default SolidRelationManyToOneKanbanField;
@@ -1,2 +1,2 @@
1
- export declare const SolidListViewRowButtonContextMenu: ({ button, params, rowData, solidListViewMetaData, handleCustomButtonClick, onActionComplete }: any) => import("react/jsx-runtime").JSX.Element | null;
1
+ export declare const SolidListViewRowButtonContextMenu: ({ button, params, getSelectedSolidViewData, solidListViewMetaData, handleCustomButtonClick }: any) => import("react/jsx-runtime").JSX.Element | null;
2
2
  //# sourceMappingURL=SolidListViewRowButtonContextMenu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SolidListViewRowButtonContextMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/core/list/SolidListViewRowButtonContextMenu.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,iCAAiC,kGAAmG,GAAG,mDAmCnJ,CAAC"}
1
+ {"version":3,"file":"SolidListViewRowButtonContextMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/core/list/SolidListViewRowButtonContextMenu.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,iCAAiC,iGAAkG,GAAG,mDAmClJ,CAAC"}
@@ -9,21 +9,23 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { useSession } from "../../../hooks/useSession";
14
14
  import { hasAnyRole } from "../../../helpers/rolesHelper";
15
+ import { Button } from "primereact/button";
15
16
  export var SolidListViewRowButtonContextMenu = function (_a) {
16
17
  var _b, _c, _d, _e, _f, _g, _h;
17
- var button = _a.button, params = _a.params, rowData = _a.rowData, solidListViewMetaData = _a.solidListViewMetaData, handleCustomButtonClick = _a.handleCustomButtonClick, onActionComplete = _a.onActionComplete;
18
+ var button = _a.button, params = _a.params, getSelectedSolidViewData = _a.getSelectedSolidViewData, solidListViewMetaData = _a.solidListViewMetaData, handleCustomButtonClick = _a.handleCustomButtonClick;
19
+ var selectedSolidViewData = getSelectedSolidViewData === null || getSelectedSolidViewData === void 0 ? void 0 : getSelectedSolidViewData();
18
20
  var _j = useSession(), session = _j.data, status = _j.status;
19
21
  var user = session === null || session === void 0 ? void 0 : session.user;
20
22
  var hasRole = !((_b = button === null || button === void 0 ? void 0 : button.attrs) === null || _b === void 0 ? void 0 : _b.roles) || ((_c = button === null || button === void 0 ? void 0 : button.attrs) === null || _c === void 0 ? void 0 : _c.roles.length) === 0 ? true : hasAnyRole(user === null || user === void 0 ? void 0 : user.roles, (_d = button === null || button === void 0 ? void 0 : button.attrs) === null || _d === void 0 ? void 0 : _d.roles);
21
23
  if (!hasRole)
22
24
  return null;
23
- return (_jsxs("button", { type: "button", className: "solid-row-action-button ".concat(((_e = button === null || button === void 0 ? void 0 : button.attrs) === null || _e === void 0 ? void 0 : _e.className) ? (_f = button === null || button === void 0 ? void 0 : button.attrs) === null || _f === void 0 ? void 0 : _f.className : ''), onClick: function () {
25
+ return (_jsx(Button, { type: "button", icon: ((_e = button === null || button === void 0 ? void 0 : button.attrs) === null || _e === void 0 ? void 0 : _e.icon) ? (_f = button === null || button === void 0 ? void 0 : button.attrs) === null || _f === void 0 ? void 0 : _f.icon : "pi pi-pencil", className: "w-full text-left gap-2 ".concat(((_g = button === null || button === void 0 ? void 0 : button.attrs) === null || _g === void 0 ? void 0 : _g.className) ? (_h = button === null || button === void 0 ? void 0 : button.attrs) === null || _h === void 0 ? void 0 : _h.className : ''), label: button.attrs.label, size: "small", onClick: function () {
24
26
  var event = {
25
27
  params: params,
26
- rowData: rowData,
28
+ rowData: selectedSolidViewData,
27
29
  solidListViewMetaData: solidListViewMetaData.data,
28
30
  };
29
31
  var modifiedButtonAttrs = __assign({}, button.attrs); // Create a copy
@@ -32,7 +34,6 @@ export var SolidListViewRowButtonContextMenu = function (_a) {
32
34
  modifiedButtonAttrs.popupWidth = '30vw';
33
35
  }
34
36
  handleCustomButtonClick(modifiedButtonAttrs, event);
35
- onActionComplete === null || onActionComplete === void 0 ? void 0 : onActionComplete();
36
- }, children: [_jsx("i", { className: "".concat(((_g = button === null || button === void 0 ? void 0 : button.attrs) === null || _g === void 0 ? void 0 : _g.icon) ? (_h = button === null || button === void 0 ? void 0 : button.attrs) === null || _h === void 0 ? void 0 : _h.icon : "pi pi-pencil", " solid-row-action-button-icon") }), _jsx("span", { className: "solid-row-action-button-label", children: button.attrs.label })] }));
37
+ } }));
37
38
  };
38
39
  //# sourceMappingURL=SolidListViewRowButtonContextMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SolidListViewRowButtonContextMenu.js","sourceRoot":"","sources":["../../../../src/components/core/list/SolidListViewRowButtonContextMenu.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,MAAM,CAAC,IAAM,iCAAiC,GAAG,UAAC,EAAkG;;QAAhG,MAAM,YAAA,EAAE,MAAM,YAAA,EAAE,OAAO,aAAA,EAAE,qBAAqB,2BAAA,EAAE,uBAAuB,6BAAA,EAAE,gBAAgB,sBAAA;IAEnI,IAAA,KAA4B,UAAU,EAAE,EAAhC,OAAO,UAAA,EAAE,MAAM,YAAiB,CAAC;IAC/C,IAAM,IAAI,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC;IAE3B,IAAM,OAAO,GAAG,CAAC,CAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,KAAK,CAAA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KAAK,0CAAE,IAAI,CAAC,CAAC,CAAC,cAAc,kCAA+B,GAAI,EAC9G,eAAM,SAAS,EAAC,+BAA+B,YAAE,MAAM,CAAC,KAAK,CAAC,KAAK,GAAQ,IACtE,CACZ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { useSession } from \"../../../hooks/useSession\";\nimport { hasAnyRole } from \"../../../helpers/rolesHelper\";\n\nexport const SolidListViewRowButtonContextMenu = ({ button, params, rowData, solidListViewMetaData, handleCustomButtonClick, onActionComplete }: any) => {\n\n const { data: session, status } = useSession();\n const user = session?.user;\n\n const hasRole = !button?.attrs?.roles || button?.attrs?.roles.length === 0 ? true : hasAnyRole(user?.roles, button?.attrs?.roles);\n\n if (!hasRole) return null;\n\n return (\n <button\n type=\"button\"\n className={`solid-row-action-button ${button?.attrs?.className ? button?.attrs?.className : ''}`}\n onClick={() => {\n const event = {\n params,\n rowData: rowData,\n solidListViewMetaData: solidListViewMetaData.data,\n };\n\n const modifiedButtonAttrs = { ...button.attrs }; // Create a copy\n\n // Conditionally add popupWidth for specific actions\n if (modifiedButtonAttrs.action === 'GenerateModelCodeRowAction' || modifiedButtonAttrs.action === 'GenerateModuleCodeRowAction') {\n modifiedButtonAttrs.popupWidth = '30vw';\n }\n\n handleCustomButtonClick(modifiedButtonAttrs, event);\n onActionComplete?.();\n }}\n >\n <i className={`${button?.attrs?.icon ? button?.attrs?.icon : \"pi pi-pencil\"} solid-row-action-button-icon`} />\n <span className=\"solid-row-action-button-label\">{button.attrs.label}</span>\n </button>\n );\n};\n"]}
1
+ {"version":3,"file":"SolidListViewRowButtonContextMenu.js","sourceRoot":"","sources":["../../../../src/components/core/list/SolidListViewRowButtonContextMenu.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAA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AE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAE,EAC/F,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EACzB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE;YACL,IAAM,KAAK,GAAG;gBACV,MAAM,QAAA;gBACN,OAAO,EAAE,qBAAqB;gBAC9B,qBAAqB,EAAE,qBAAqB,CAAC,IAAI;aACpD,CAAC;YAEF,IAAM,mBAAmB,gBAAQ,MAAM,CAAC,KAAK,CAAE,CAAC,CAAC,gBAAgB;YAEjE,oDAAoD;YACpD,IAAI,mBAAmB,CAAC,MAAM,KAAK,4BAA4B,IAAI,mBAAmB,CAAC,MAAM,KAAK,6BAA6B,EAAE;gBAC7H,mBAAmB,CAAC,UAAU,GAAG,MAAM,CAAC;aAC3C;YAED,uBAAuB,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QACxD,CAAC,GACH,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { useSession } from \"../../../hooks/useSession\";\nimport { hasAnyRole } from \"../../../helpers/rolesHelper\";\nimport { Button } from \"primereact/button\";\n\nexport const SolidListViewRowButtonContextMenu = ({ button, params, getSelectedSolidViewData, solidListViewMetaData, handleCustomButtonClick }: any) => {\n const selectedSolidViewData = getSelectedSolidViewData?.();\n\n const { data: session, status } = useSession();\n const user = session?.user;\n\n const hasRole = !button?.attrs?.roles || button?.attrs?.roles.length === 0 ? true : hasAnyRole(user?.roles, button?.attrs?.roles);\n\n if (!hasRole) return null;\n\n return (\n <Button\n type=\"button\"\n icon={button?.attrs?.icon ? button?.attrs?.icon : \"pi pi-pencil\"}\n className={`w-full text-left gap-2 ${button?.attrs?.className ? button?.attrs?.className : ''}`}\n label={button.attrs.label}\n size=\"small\"\n onClick={() => {\n const event = {\n params,\n rowData: selectedSolidViewData,\n solidListViewMetaData: solidListViewMetaData.data,\n };\n\n const modifiedButtonAttrs = { ...button.attrs }; // Create a copy\n\n // Conditionally add popupWidth for specific actions\n if (modifiedButtonAttrs.action === 'GenerateModelCodeRowAction' || modifiedButtonAttrs.action === 'GenerateModuleCodeRowAction') {\n modifiedButtonAttrs.popupWidth = '30vw';\n }\n\n handleCustomButtonClick(modifiedButtonAttrs, event);\n }}\n />\n );\n};\n"]}
@@ -1,7 +1,9 @@
1
1
  import { useSession } from "../../../hooks/useSession";
2
2
  import { hasAnyRole } from "../../../helpers/rolesHelper";
3
+ import { Button } from "primereact/button";
3
4
 
4
- export const SolidListViewRowButtonContextMenu = ({ button, params, rowData, solidListViewMetaData, handleCustomButtonClick, onActionComplete }: any) => {
5
+ export const SolidListViewRowButtonContextMenu = ({ button, params, getSelectedSolidViewData, solidListViewMetaData, handleCustomButtonClick }: any) => {
6
+ const selectedSolidViewData = getSelectedSolidViewData?.();
5
7
 
6
8
  const { data: session, status } = useSession();
7
9
  const user = session?.user;
@@ -11,13 +13,16 @@ export const SolidListViewRowButtonContextMenu = ({ button, params, rowData, sol
11
13
  if (!hasRole) return null;
12
14
 
13
15
  return (
14
- <button
16
+ <Button
15
17
  type="button"
16
- className={`solid-row-action-button ${button?.attrs?.className ? button?.attrs?.className : ''}`}
18
+ icon={button?.attrs?.icon ? button?.attrs?.icon : "pi pi-pencil"}
19
+ className={`w-full text-left gap-2 ${button?.attrs?.className ? button?.attrs?.className : ''}`}
20
+ label={button.attrs.label}
21
+ size="small"
17
22
  onClick={() => {
18
23
  const event = {
19
24
  params,
20
- rowData: rowData,
25
+ rowData: selectedSolidViewData,
21
26
  solidListViewMetaData: solidListViewMetaData.data,
22
27
  };
23
28
 
@@ -29,11 +34,7 @@ export const SolidListViewRowButtonContextMenu = ({ button, params, rowData, sol
29
34
  }
30
35
 
31
36
  handleCustomButtonClick(modifiedButtonAttrs, event);
32
- onActionComplete?.();
33
37
  }}
34
- >
35
- <i className={`${button?.attrs?.icon ? button?.attrs?.icon : "pi pi-pencil"} solid-row-action-button-icon`} />
36
- <span className="solid-row-action-button-label">{button.attrs.label}</span>
37
- </button>
38
+ />
38
39
  );
39
40
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SolidDatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidDatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,4CAA4C,CAAC;AAGpD,KAAK,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,GAAG;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAmDF,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,cAAc,EACd,cAAc,EACd,QAAQ,EACR,UAAU,EACV,SAAS,EACT,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAetB"}
1
+ {"version":3,"file":"SolidDatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidDatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,4CAA4C,CAAC;AAGpD,KAAK,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,GAAG;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAmDF,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,cAAc,EACd,cAAc,EACd,QAAQ,EACR,UAAU,EACV,SAAS,EACT,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAiBtB"}
@@ -71,6 +71,6 @@ export function SolidDatePicker(_a) {
71
71
  var resolvedShowTime = timeOnly ? true : showTimeSelect;
72
72
  var resolvedFormat = (_b = (Array.isArray(dateFormat) ? dateFormat[0] : dateFormat)) !== null && _b !== void 0 ? _b : "yyyy-MM-dd";
73
73
  var displayValue = formatDateValue(selected, resolvedFormat);
74
- return (_jsx(ReactDatePicker, __assign({}, props, { selected: selected, showTimeSelect: resolvedShowTime, showTimeSelectOnly: timeOnly, customInput: _jsx(SolidDatePickerInput, { className: inputClassName, displayValue: displayValue }), className: cx("solid-datepicker", className) })));
74
+ return (_jsx(ReactDatePicker, __assign({ popperProps: { strategy: "fixed" }, popperPlacement: "bottom-start" }, props, { selected: selected, showTimeSelect: resolvedShowTime, showTimeSelectOnly: timeOnly, customInput: _jsx(SolidDatePickerInput, { className: inputClassName, displayValue: displayValue }), className: cx("solid-datepicker", className) })));
75
75
  }
76
76
  //# sourceMappingURL=SolidDatePicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SolidDatePicker.js","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidDatePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,4CAA4C,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,SAAS,eAAe,CAAC,KAA8B,EAAE,OAAgB;IACvE,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE;QACvE,OAAO,EAAE,CAAC;KACX;IACD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;KAC5B;IACD,IAAM,GAAG,GAAG,UAAC,GAAW,EAAE,MAAU;QAAV,uBAAA,EAAA,UAAU;QAAK,OAAA,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC;IAAjC,CAAiC,CAAC;IAC3E,IAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC/B,IAAM,OAAO,GAAG,KAA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ker/dist/react-datepicker.css\";\nimport { SolidInput } from \"./SolidInput\";\n\ntype SolidDatePickerProps = React.ComponentProps<typeof ReactDatePicker> & {\n timeOnly?: boolean;\n inputClassName?: string;\n};\n\ntype SolidDatePickerInputProps = React.InputHTMLAttributes<HTMLInputElement> & {\n displayValue?: string;\n};\n\nfunction formatDateValue(value: Date | null | undefined, pattern?: string) {\n if (!value || !(value instanceof Date) || Number.isNaN(value.getTime())) {\n return \"\";\n }\n if (!pattern) {\n return value.toISOString();\n }\n const pad = (num: number, length = 2) => String(num).padStart(length, \"0\");\n const hours = value.getHours();\n const minutes = value.getMinutes();\n const seconds = value.getSeconds();\n const ampm = hours >= 12 ? \"PM\" : \"AM\";\n const h12 = hours % 12 || 12;\n\n return pattern\n .replace(/yyyy/g, String(value.getFullYear()))\n .replace(/MM/g, pad(value.getMonth() + 1))\n .replace(/dd/g, pad(value.getDate()))\n .replace(/HH/g, pad(hours))\n .replace(/hh/g, pad(h12))\n .replace(/h/g, String(h12))\n .replace(/mm/g, pad(minutes))\n .replace(/ss/g, pad(seconds))\n .replace(/aa/g, ampm)\n .replace(/a/g, ampm);\n}\n\nconst SolidDatePickerInput = React.forwardRef<HTMLInputElement, SolidDatePickerInputProps>(\n ({ className, displayValue, ...props }, ref) => (\n <SolidInput\n ref={ref}\n {...props}\n value={displayValue ?? (typeof props.value === \"string\" ? props.value : \"\")}\n readOnly\n className={className}\n />\n )\n);\n\nSolidDatePickerInput.displayName = \"SolidDatePickerInput\";\n\nfunction cx(...parts: Array<string | false | undefined>) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport function SolidDatePicker({\n timeOnly,\n showTimeSelect,\n inputClassName,\n selected,\n dateFormat,\n className,\n ...props\n}: SolidDatePickerProps) {\n const resolvedShowTime = timeOnly ? true : showTimeSelect;\n const resolvedFormat = (Array.isArray(dateFormat) ? dateFormat[0] : dateFormat) ?? \"yyyy-MM-dd\";\n const displayValue = formatDateValue(selected as Date | null | undefined, resolvedFormat);\n\n return (\n <ReactDatePicker\n {...props}\n selected={selected}\n showTimeSelect={resolvedShowTime}\n showTimeSelectOnly={timeOnly}\n customInput={<SolidDatePickerInput className={inputClassName} displayValue={displayValue} />}\n className={cx(\"solid-datepicker\", className)}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"SolidDatePicker.js","sourceRoot":"","sources":["../../../src/components/shad-cn-ui/SolidDatePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,4CAA4C,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,SAAS,eAAe,CAAC,KAA8B,EAAE,OAAgB;IACvE,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE;QACvE,OAAO,EAAE,CAAC;KACX;IACD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;KAC5B;IACD,IAAM,GAAG,GAAG,UAAC,GAAW,EAAE,MAAU;QAAV,uBAAA,EAAA,UAAU;QAAK,OAAA,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC;IAAjC,CAAiC,CAAC;IAC3E,IAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC/B,IAAM,OAAO,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;IACnC,IAAM,OAAO,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;IACnC,IAAM,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACvC,IAAM,GAAG,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC;IAE7B,OAAO,O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,IAA2C;QAA3C,0BAA2C;;IACrD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,EAQT;;IAPrB,IAAA,QAAQ,cAAA,EACR,cAAc,oBAAA,EACd,cAAc,oBAAA,EACd,QAAQ,cAAA,EACR,UAAU,gBAAA,EACV,SAAS,eAAA,EACN,KAAK,cAPsB,uFAQ/B,CADS;IAER,IAAM,gBAAgB,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC;IAC1D,IAAM,cAAc,GAAG,MAAA,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,mCAAI,YAAY,CAAC;IAChG,IAAM,YAAY,GAAG,eAAe,CAAC,QAAmC,EAAE,cAAc,CAAC,CAAC;IAE1F,OAAO,CACL,KAAC,eAAe,aACd,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAClC,eAAe,EAAC,cAAc,IAC1B,KAAK,IACT,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,gBAAgB,EAChC,kBAAkB,EAAE,QAAQ,EAC5B,WAAW,EAAE,KAAC,oBAAoB,IAAC,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,GAAI,EAC5F,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,IAC5C,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React from \"react\";\nimport ReactDatePicker from \"react-datepicker\";\nimport \"react-datepicker/dist/react-datepicker.css\";\nimport { SolidInput } from \"./SolidInput\";\n\ntype SolidDatePickerProps = React.ComponentProps<typeof ReactDatePicker> & {\n timeOnly?: boolean;\n inputClassName?: string;\n};\n\ntype SolidDatePickerInputProps = React.InputHTMLAttributes<HTMLInputElement> & {\n displayValue?: string;\n};\n\nfunction formatDateValue(value: Date | null | undefined, pattern?: string) {\n if (!value || !(value instanceof Date) || Number.isNaN(value.getTime())) {\n return \"\";\n }\n if (!pattern) {\n return value.toISOString();\n }\n const pad = (num: number, length = 2) => String(num).padStart(length, \"0\");\n const hours = value.getHours();\n const minutes = value.getMinutes();\n const seconds = value.getSeconds();\n const ampm = hours >= 12 ? \"PM\" : \"AM\";\n const h12 = hours % 12 || 12;\n\n return pattern\n .replace(/yyyy/g, String(value.getFullYear()))\n .replace(/MM/g, pad(value.getMonth() + 1))\n .replace(/dd/g, pad(value.getDate()))\n .replace(/HH/g, pad(hours))\n .replace(/hh/g, pad(h12))\n .replace(/h/g, String(h12))\n .replace(/mm/g, pad(minutes))\n .replace(/ss/g, pad(seconds))\n .replace(/aa/g, ampm)\n .replace(/a/g, ampm);\n}\n\nconst SolidDatePickerInput = React.forwardRef<HTMLInputElement, SolidDatePickerInputProps>(\n ({ className, displayValue, ...props }, ref) => (\n <SolidInput\n ref={ref}\n {...props}\n value={displayValue ?? (typeof props.value === \"string\" ? props.value : \"\")}\n readOnly\n className={className}\n />\n )\n);\n\nSolidDatePickerInput.displayName = \"SolidDatePickerInput\";\n\nfunction cx(...parts: Array<string | false | undefined>) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport function SolidDatePicker({\n timeOnly,\n showTimeSelect,\n inputClassName,\n selected,\n dateFormat,\n className,\n ...props\n}: SolidDatePickerProps) {\n const resolvedShowTime = timeOnly ? true : showTimeSelect;\n const resolvedFormat = (Array.isArray(dateFormat) ? dateFormat[0] : dateFormat) ?? \"yyyy-MM-dd\";\n const displayValue = formatDateValue(selected as Date | null | undefined, resolvedFormat);\n\n return (\n <ReactDatePicker\n popperProps={{ strategy: \"fixed\" }}\n popperPlacement=\"bottom-start\"\n {...props}\n selected={selected}\n showTimeSelect={resolvedShowTime}\n showTimeSelectOnly={timeOnly}\n customInput={<SolidDatePickerInput className={inputClassName} displayValue={displayValue} />}\n className={cx(\"solid-datepicker\", className)}\n />\n );\n}\n"]}
@@ -72,6 +72,8 @@ export function SolidDatePicker({
72
72
 
73
73
  return (
74
74
  <ReactDatePicker
75
+ popperProps={{ strategy: "fixed" }}
76
+ popperPlacement="bottom-start"
75
77
  {...props}
76
78
  selected={selected}
77
79
  showTimeSelect={resolvedShowTime}
@@ -0,0 +1,4 @@
1
+ import { NextAuthOptions } from "next-auth";
2
+ declare const authProviders: NextAuthOptions;
3
+ export default authProviders;
4
+ //# sourceMappingURL=authProviders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authProviders.d.ts","sourceRoot":"./","sources":["nextAuth/authProviders.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAW5C,QAAA,MAAM,aAAa,EAAE,eAqNpB,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -0,0 +1,198 @@
1
+ import CredentialsProvider from "next-auth/providers/credentials";
2
+ import GoogleProvider from "next-auth/providers/google";
3
+ import { jwtDecode } from "jwt-decode";
4
+ import axios from "axios";
5
+ import { refreshAccessToken } from "./refreshAccessToken";
6
+ const authProviders = {
7
+ session: {
8
+ strategy: "jwt",
9
+ },
10
+ providers: [
11
+ GoogleProvider({
12
+ clientId: process.env.GOOGLE_ID,
13
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET
14
+ }),
15
+ CredentialsProvider({
16
+ // @ts-ignore
17
+ async authorize(credentials, req) {
18
+ const userAgent = req.headers['user-agent'];
19
+ const { username, email, password, identifier, accessToken, accessCode } = credentials;
20
+ console.log(credentials, '=========================');
21
+ try {
22
+ if (accessCode) {
23
+ let config = {
24
+ method: 'get',
25
+ url: `${process.env.API_URL}/api/iam/google/authenticate?accessCode=${accessCode}`,
26
+ headers: {
27
+ 'User-Agent': userAgent,
28
+ }
29
+ };
30
+ const loginResponse = await axios.request(config);
31
+ if (loginResponse.status == 400) {
32
+ throw new Error(loginResponse.data.message);
33
+ }
34
+ if (loginResponse.status == 401) {
35
+ throw new Error(loginResponse.data.message);
36
+ }
37
+ let base64decoded = jwtDecode(loginResponse.data.data.accessToken);
38
+ // let accessTokenExpires = base64decoded.exp;
39
+ let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
40
+ return {
41
+ accessToken: loginResponse.data.data.accessToken,
42
+ refreshToken: loginResponse.data.data.refreshToken,
43
+ accessTokenExpires: accessTokenExpires,
44
+ ...loginResponse.data.data,
45
+ };
46
+ }
47
+ else {
48
+ if (accessToken) {
49
+ let data = JSON.stringify({
50
+ username: identifier,
51
+ email: identifier.includes('@') ? identifier : null,
52
+ password: password
53
+ });
54
+ let config = {
55
+ method: 'get',
56
+ url: `${process.env.API_URL}/api/iam/me`,
57
+ headers: {
58
+ 'accept': '*/*',
59
+ 'Content-Type': 'application/json',
60
+ 'Authorization': `Bearer ${accessToken}`
61
+ }
62
+ };
63
+ const loginResponse = await axios.request(config);
64
+ if (loginResponse.status == 400) {
65
+ throw new Error(loginResponse.data.message);
66
+ }
67
+ if (loginResponse.status == 401) {
68
+ throw new Error(loginResponse.data.message);
69
+ }
70
+ let base64decoded = jwtDecode(accessToken);
71
+ // let accessTokenExpires = base64decoded.exp;
72
+ let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
73
+ return {
74
+ accessToken: accessToken,
75
+ refreshToken: loginResponse.data.data.refreshToken,
76
+ accessTokenExpires: accessTokenExpires,
77
+ ...loginResponse.data.data,
78
+ };
79
+ }
80
+ else {
81
+ let data = JSON.stringify({
82
+ username: identifier,
83
+ email: identifier.includes('@') ? identifier : null,
84
+ password: password
85
+ });
86
+ let config = {
87
+ method: 'post',
88
+ maxBodyLength: Infinity,
89
+ url: `${process.env.API_URL}/api/iam/authenticate`,
90
+ headers: {
91
+ 'accept': '*/*',
92
+ 'Content-Type': 'application/json',
93
+ 'User-Agent': userAgent,
94
+ },
95
+ data: data
96
+ };
97
+ const loginResponse = await axios.request(config);
98
+ // const authenticateResponse = await fetch(
99
+ // `${process.env.API_URL}/api/iam/authenticate`,
100
+ // {
101
+ // method: "Post",
102
+ // headers: {
103
+ // 'accept': '*/*',
104
+ // "Content-Type": "application/json"
105
+ // },
106
+ // body: JSON.stringify({
107
+ // username: email,
108
+ // email: email,
109
+ // password: password
110
+ // })
111
+ // }
112
+ // );
113
+ // const loginResponse = await authenticateResponse.json();
114
+ // const response = await fetch(
115
+ // `${process.env.API_URL}/api/iam/me`,
116
+ // {
117
+ // method: "Get",
118
+ // headers: {
119
+ // "Content-Type": "application/json",
120
+ // "Authorization": `Bearer ${loginResponse.data.accessToken}`,
121
+ // },
122
+ // }
123
+ // );
124
+ // const responseData = await response.json();
125
+ if (loginResponse.status == 400) {
126
+ throw new Error(loginResponse.data.message);
127
+ }
128
+ if (loginResponse.status == 401) {
129
+ throw new Error(loginResponse.data.data.message);
130
+ }
131
+ let base64decoded = jwtDecode(loginResponse.data.data.accessToken);
132
+ // let accessTokenExpires = base64decoded.exp;
133
+ let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
134
+ const returnResponse = {
135
+ accessToken: loginResponse.data.data.accessToken,
136
+ refreshToken: loginResponse.data.data.refreshToken,
137
+ accessTokenExpires: accessTokenExpires,
138
+ ...loginResponse.data.data,
139
+ };
140
+ return returnResponse;
141
+ }
142
+ }
143
+ }
144
+ catch (error) {
145
+ throw new Error(error?.response?.data?.message);
146
+ }
147
+ },
148
+ }),
149
+ ],
150
+ callbacks: {
151
+ // @ts-ignore
152
+ jwt: async ({ token, user }) => {
153
+ // console.log("JWT callback called");
154
+ const bufferTime = 60000;
155
+ if (Date.now() >= (token.accessTokenExpires - bufferTime)) {
156
+ // Call the refresh token function
157
+ return await refreshAccessToken(token);
158
+ }
159
+ // If there is no user (first time login or session), we return the user data
160
+ if (user) {
161
+ // const base64decoded = jwtDecode(user.accessToken);
162
+ // Convert from seconds to milliseconds
163
+ // const accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
164
+ // const accessTokenExpires = user.accessTokenExpires * 1000;
165
+ return {
166
+ ...token,
167
+ accessToken: user.accessToken,
168
+ refreshToken: user.refreshToken,
169
+ accessTokenExpires: user.accessTokenExpires,
170
+ user: user, // Include the user data here
171
+ };
172
+ }
173
+ return token; // If no update needed, just return the existing token
174
+ },
175
+ // @ts-ignore
176
+ session: async ({ session, token }) => {
177
+ // console.log("Session callback called");
178
+ const user = token.user || {}; // Default to an empty object if user is undefined or null
179
+ session.error = token.error ? token.error : null;
180
+ // if (token.error) {
181
+ // return null
182
+ // }
183
+ session.user = {
184
+ ...user,
185
+ accessToken: token?.accessToken,
186
+ refreshToken: token?.refreshToken,
187
+ accessTokenExpires: token?.accessTokenExpires && token?.accessTokenExpires, // Store the expiry time
188
+ };
189
+ return session;
190
+ },
191
+ },
192
+ pages: {
193
+ signIn: "/auth/login",
194
+ },
195
+ secret: process.env.NEXTAUTH_SECRET,
196
+ };
197
+ export default authProviders;
198
+ //# sourceMappingURL=authProviders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authProviders.js","sourceRoot":"./","sources":["nextAuth/authProviders.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,iCAAiC,CAAC;AAClE,OAAO,cAAc,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAY1D,MAAM,aAAa,GAAoB;IACnC,OAAO,EAAE;QACL,QAAQ,EAAE,KAAK;KAClB;IACD,SAAS,EAAE;QACP,cAAc,CAAC;YACX,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAU;YAChC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAqB;SAClD,CAAC;QACF,mBAAmB,CAAC;YAChB,aAAa;YACb,KAAK,CAAC,SAAS,CAAC,WAAwB,EAAE,GAAQ;gBAC9C,MAAM,SAAS,GAAG,GAAG,CAAC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C,sDAAsD;QACxE,CAAC;QACD,aAAa;QACb,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;YAClC,0CAA0C;YAE1C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAE,0DAA0D;YAC1F,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;YACjD,qBAAqB;YACrB,gBAAgB;YAChB,IAAI;YACJ,OAAO,CAAC,IAAI,GAAG;gBACX,GAAG,IAAI;gBACP,WAAW,EAAE,KAAK,EAAE,WAAW;gBAC/B,YAAY,EAAE,KAAK,EAAE,YAAY;gBACjC,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,IAAI,KAAK,EAAE,kBAAkB,EAAG,wBAAwB;aACxG,CAAC;YACF,OAAO,OAAO,CAAC;QAEnB,CAAC;KACJ;IACD,KAAK,EAAE;QACH,MAAM,EAAE,aAAa;KACxB;IACD,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;CACtC,CAAA;AAED,eAAe,aAAa,CAAA","sourcesContent":["import CredentialsProvider from \"next-auth/providers/credentials\";\nimport GoogleProvider from \"next-auth/providers/google\";\nimport { NextRequest } from \"next/server\";\nimport { jwtDecode } from \"jwt-decode\";\nimport { JWT } from \"next-auth/jwt\";\nimport axios from \"axios\";\nimport { signOut } from \"next-auth/react\";\nimport { refreshAccessToken } from \"./refreshAccessToken\";\nimport { NextAuthOptions } from \"next-auth\";\n\ntype Credentials = {\n username: string,\n email: string,\n password: string,\n identifier:string,\n accessToken: string,\n accessCode: string,\n};\n\nconst authProviders: NextAuthOptions = {\n session: {\n strategy: \"jwt\",\n },\n providers: [\n GoogleProvider({\n clientId: process.env.GOOGLE_ID!,\n clientSecret: process.env.GOOGLE_CLIENT_SECRET!\n }),\n CredentialsProvider({\n // @ts-ignore\n async authorize(credentials: Credentials, req: any) {\n const userAgent = req.headers['user-agent'];\n\n const { username, email, password, identifier, accessToken, accessCode } = credentials;\n\n console.log(credentials , '=========================');\n \n try {\n if (accessCode) {\n let config = {\n method: 'get',\n url: `${process.env.API_URL}/api/iam/google/authenticate?accessCode=${accessCode}`,\n headers: {\n 'User-Agent': userAgent,\n }\n };\n const loginResponse = await axios.request(config);\n if (loginResponse.status == 400) {\n throw new Error(loginResponse.data.message);\n }\n if (loginResponse.status == 401) {\n throw new Error(loginResponse.data.message);\n }\n\n let base64decoded = jwtDecode(loginResponse.data.data.accessToken);\n // let accessTokenExpires = base64decoded.exp;\n let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;\n\n return {\n accessToken: loginResponse.data.data.accessToken,\n refreshToken: loginResponse.data.data.refreshToken,\n accessTokenExpires: accessTokenExpires,\n ...loginResponse.data.data,\n };\n\n } else {\n if (accessToken) {\n let data = JSON.stringify({\n username: identifier,\n email: identifier.includes('@')? identifier : null,\n password: password\n });\n\n let config = {\n method: 'get',\n url: `${process.env.API_URL}/api/iam/me`,\n headers: {\n 'accept': '*/*',\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${accessToken}`\n }\n };\n\n\n const loginResponse = await axios.request(config);\n\n if (loginResponse.status == 400) {\n throw new Error(loginResponse.data.message);\n }\n if (loginResponse.status == 401) {\n throw new Error(loginResponse.data.message);\n }\n \n let base64decoded = jwtDecode(accessToken);\n // let accessTokenExpires = base64decoded.exp;\n let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;\n\n return {\n accessToken: accessToken,\n refreshToken: loginResponse.data.data.refreshToken,\n accessTokenExpires: accessTokenExpires,\n ...loginResponse.data.data,\n };\n\n } else {\n\n let data = JSON.stringify({\n username: identifier,\n email: identifier.includes('@')? identifier : null,\n password: password\n });\n\n let config = {\n method: 'post',\n maxBodyLength: Infinity,\n url: `${process.env.API_URL}/api/iam/authenticate`,\n headers: {\n 'accept': '*/*',\n 'Content-Type': 'application/json',\n 'User-Agent': userAgent,\n },\n data: data\n };\n\n\n const loginResponse = await axios.request(config);\n\n // const authenticateResponse = await fetch(\n // `${process.env.API_URL}/api/iam/authenticate`,\n // {\n // method: \"Post\",\n // headers: {\n // 'accept': '*/*', \n // \"Content-Type\": \"application/json\"\n // },\n // body: JSON.stringify({\n // username: email,\n // email: email,\n // password: password\n // })\n // }\n // );\n\n // const loginResponse = await authenticateResponse.json();\n\n // const response = await fetch(\n // `${process.env.API_URL}/api/iam/me`,\n // {\n // method: \"Get\",\n // headers: {\n // \"Content-Type\": \"application/json\",\n // \"Authorization\": `Bearer ${loginResponse.data.accessToken}`,\n // },\n // }\n // );\n\n // const responseData = await response.json();\n\n if (loginResponse.status == 400) {\n throw new Error(loginResponse.data.message);\n }\n if (loginResponse.status == 401) {\n throw new Error(loginResponse.data.data.message);\n }\n let base64decoded = jwtDecode(loginResponse.data.data.accessToken);\n // let accessTokenExpires = base64decoded.exp;\n let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;\n const returnResponse = {\n accessToken: loginResponse.data.data.accessToken,\n refreshToken: loginResponse.data.data.refreshToken,\n accessTokenExpires: accessTokenExpires,\n ...loginResponse.data.data,\n }\n return returnResponse;\n }\n }\n } catch (error: any) {\n throw new Error(error?.response?.data?.message);\n }\n },\n }),\n ],\n callbacks: {\n // @ts-ignore\n jwt: async ({ token, user }) => {\n // console.log(\"JWT callback called\");\n const bufferTime = 60000;\n if (Date.now() >= (token.accessTokenExpires as number - bufferTime)) {\n // Call the refresh token function\n return await refreshAccessToken(token);\n }\n\n // If there is no user (first time login or session), we return the user data\n if (user) {\n // const base64decoded = jwtDecode(user.accessToken);\n // Convert from seconds to milliseconds\n // const accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000; \n // const accessTokenExpires = user.accessTokenExpires * 1000; \n return {\n ...token,\n accessToken: user.accessToken,\n refreshToken: user.refreshToken,\n accessTokenExpires: user.accessTokenExpires,\n user: user, // Include the user data here\n };\n }\n\n return token; // If no update needed, just return the existing token\n },\n // @ts-ignore\n session: async ({ session, token }) => {\n // console.log(\"Session callback called\");\n\n const user = token.user || {}; // Default to an empty object if user is undefined or null\n session.error = token.error ? token.error : null;\n // if (token.error) {\n // return null\n // }\n session.user = {\n ...user, // Include the user info from the token\n accessToken: token?.accessToken, // Add the access token to session for client use\n refreshToken: token?.refreshToken, // Add refresh token to session for future use\n accessTokenExpires: token?.accessTokenExpires && token?.accessTokenExpires, // Store the expiry time\n };\n return session;\n\n },\n },\n pages: {\n signIn: \"/auth/login\",\n },\n secret: process.env.NEXTAUTH_SECRET,\n}\n\nexport default authProviders"]}