@digitaldefiance/express-suite-react-components 2.9.6 → 2.9.9

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 (257) hide show
  1. package/package.json +6 -5
  2. package/src/auth/Private.d.ts +6 -0
  3. package/src/auth/Private.d.ts.map +1 -0
  4. package/src/auth/Private.js +14 -0
  5. package/src/auth/PrivateRoute.d.ts +8 -0
  6. package/src/auth/PrivateRoute.d.ts.map +1 -0
  7. package/src/auth/PrivateRoute.js +23 -0
  8. package/src/auth/UnAuth.d.ts +6 -0
  9. package/src/auth/UnAuth.d.ts.map +1 -0
  10. package/src/auth/UnAuth.js +14 -0
  11. package/src/auth/UnAuthRoute.d.ts +8 -0
  12. package/src/auth/UnAuthRoute.d.ts.map +1 -0
  13. package/src/auth/UnAuthRoute.js +22 -0
  14. package/src/auth/{index.ts → index.d.ts} +2 -1
  15. package/src/auth/index.d.ts.map +1 -0
  16. package/src/auth/index.js +10 -0
  17. package/src/components/ApiAccess.d.ts +16 -0
  18. package/src/components/ApiAccess.d.ts.map +1 -0
  19. package/src/components/ApiAccess.js +70 -0
  20. package/src/components/BackupCodeLoginForm.d.ts +43 -0
  21. package/src/components/BackupCodeLoginForm.d.ts.map +1 -0
  22. package/src/components/BackupCodeLoginForm.js +106 -0
  23. package/src/components/BackupCodesForm.d.ts +26 -0
  24. package/src/components/BackupCodesForm.d.ts.map +1 -0
  25. package/src/components/BackupCodesForm.js +108 -0
  26. package/src/components/ChangePasswordForm.d.ts +26 -0
  27. package/src/components/ChangePasswordForm.d.ts.map +1 -0
  28. package/src/components/ChangePasswordForm.js +66 -0
  29. package/src/components/ConfirmationDialog.d.ts +13 -0
  30. package/src/components/ConfirmationDialog.d.ts.map +1 -0
  31. package/src/components/ConfirmationDialog.js +10 -0
  32. package/src/components/CurrencyCodeSelector.d.ts +9 -0
  33. package/src/components/CurrencyCodeSelector.d.ts.map +1 -0
  34. package/src/components/CurrencyCodeSelector.js +31 -0
  35. package/src/components/CurrencyInput.d.ts +13 -0
  36. package/src/components/CurrencyInput.d.ts.map +1 -0
  37. package/src/components/CurrencyInput.js +22 -0
  38. package/src/components/DashboardPage.d.ts +8 -0
  39. package/src/components/DashboardPage.d.ts.map +1 -0
  40. package/src/components/DashboardPage.js +10 -0
  41. package/src/components/DropdownMenu.d.ts +9 -0
  42. package/src/components/DropdownMenu.d.ts.map +1 -0
  43. package/src/components/DropdownMenu.js +56 -0
  44. package/src/components/ExpirationSecondsSelector.d.ts +13 -0
  45. package/src/components/ExpirationSecondsSelector.d.ts.map +1 -0
  46. package/src/components/ExpirationSecondsSelector.js +32 -0
  47. package/src/components/Flag.d.ts +20 -0
  48. package/src/components/Flag.d.ts.map +1 -0
  49. package/src/components/Flag.js +43 -0
  50. package/src/components/ForgotPasswordForm.d.ts +18 -0
  51. package/src/components/ForgotPasswordForm.d.ts.map +1 -0
  52. package/src/components/ForgotPasswordForm.js +54 -0
  53. package/src/components/LoginForm.d.ts +44 -0
  54. package/src/components/LoginForm.d.ts.map +1 -0
  55. package/src/components/LoginForm.js +99 -0
  56. package/src/components/LogoutPage.d.ts +8 -0
  57. package/src/components/LogoutPage.d.ts.map +1 -0
  58. package/src/components/LogoutPage.js +16 -0
  59. package/src/components/RegisterForm.d.ts +54 -0
  60. package/src/components/RegisterForm.d.ts.map +1 -0
  61. package/src/components/RegisterForm.js +105 -0
  62. package/src/components/ResetPasswordForm.d.ts +23 -0
  63. package/src/components/ResetPasswordForm.d.ts.map +1 -0
  64. package/src/components/ResetPasswordForm.js +68 -0
  65. package/src/components/SideMenu.d.ts +8 -0
  66. package/src/components/SideMenu.d.ts.map +1 -0
  67. package/src/components/SideMenu.js +25 -0
  68. package/src/components/SideMenuListItem.d.ts +13 -0
  69. package/src/components/SideMenuListItem.d.ts.map +1 -0
  70. package/src/components/SideMenuListItem.js +44 -0
  71. package/src/components/TopMenu.d.ts +24 -0
  72. package/src/components/TopMenu.d.ts.map +1 -0
  73. package/src/components/TopMenu.js +42 -0
  74. package/src/components/TranslatedTitle.d.ts +7 -0
  75. package/src/components/TranslatedTitle.d.ts.map +1 -0
  76. package/src/components/TranslatedTitle.js +15 -0
  77. package/src/components/UserLanguageSelector.d.ts +4 -0
  78. package/src/components/UserLanguageSelector.d.ts.map +1 -0
  79. package/src/components/UserLanguageSelector.js +31 -0
  80. package/src/components/UserMenu.d.ts +4 -0
  81. package/src/components/UserMenu.d.ts.map +1 -0
  82. package/src/components/UserMenu.js +12 -0
  83. package/src/components/UserSettingsForm.d.ts +56 -0
  84. package/src/components/UserSettingsForm.d.ts.map +1 -0
  85. package/src/components/UserSettingsForm.js +93 -0
  86. package/src/components/VerifyEmailPage.d.ts +23 -0
  87. package/src/components/VerifyEmailPage.d.ts.map +1 -0
  88. package/src/components/VerifyEmailPage.js +61 -0
  89. package/src/components/{index.ts → index.d.ts} +1 -1
  90. package/src/components/index.d.ts.map +1 -0
  91. package/src/components/index.js +28 -0
  92. package/src/contexts/AuthProvider.d.ts +152 -0
  93. package/src/contexts/AuthProvider.d.ts.map +1 -0
  94. package/src/contexts/AuthProvider.js +446 -0
  95. package/src/contexts/I18nProvider.d.ts +16 -0
  96. package/src/contexts/I18nProvider.d.ts.map +1 -0
  97. package/src/contexts/I18nProvider.js +46 -0
  98. package/src/contexts/MenuContext.d.ts +20 -0
  99. package/src/contexts/MenuContext.d.ts.map +1 -0
  100. package/src/contexts/MenuContext.js +244 -0
  101. package/src/contexts/SuiteConfigProvider.d.ts +44 -0
  102. package/src/contexts/SuiteConfigProvider.d.ts.map +1 -0
  103. package/src/contexts/SuiteConfigProvider.js +43 -0
  104. package/src/contexts/ThemeProvider.d.ts +15 -0
  105. package/src/contexts/ThemeProvider.d.ts.map +1 -0
  106. package/src/contexts/ThemeProvider.js +36 -0
  107. package/src/contexts/{index.ts → index.d.ts} +1 -0
  108. package/src/contexts/index.d.ts.map +1 -0
  109. package/src/contexts/index.js +8 -0
  110. package/src/hooks/{index.ts → index.d.ts} +1 -0
  111. package/src/hooks/index.d.ts.map +1 -0
  112. package/src/hooks/index.js +8 -0
  113. package/src/hooks/useBackupCodes.d.ts +15 -0
  114. package/src/hooks/useBackupCodes.d.ts.map +1 -0
  115. package/src/hooks/useBackupCodes.js +70 -0
  116. package/src/hooks/useEmailVerification.d.ts +10 -0
  117. package/src/hooks/useEmailVerification.d.ts.map +1 -0
  118. package/src/hooks/useEmailVerification.js +36 -0
  119. package/src/hooks/useExpiringValue.d.ts +14 -0
  120. package/src/hooks/useExpiringValue.d.ts.map +1 -0
  121. package/src/hooks/useExpiringValue.js +53 -0
  122. package/src/hooks/useLocalStorage.d.ts +2 -0
  123. package/src/hooks/useLocalStorage.d.ts.map +1 -0
  124. package/src/hooks/useLocalStorage.js +15 -0
  125. package/src/hooks/useUserSettings.d.ts +46 -0
  126. package/src/hooks/useUserSettings.d.ts.map +1 -0
  127. package/src/hooks/useUserSettings.js +152 -0
  128. package/src/{index.ts → index.d.ts} +1 -1
  129. package/src/index.d.ts.map +1 -0
  130. package/src/index.js +12 -0
  131. package/src/interfaces/IAppConfig.d.ts +6 -0
  132. package/src/interfaces/IAppConfig.d.ts.map +1 -0
  133. package/src/interfaces/IAppConfig.js +2 -0
  134. package/src/interfaces/IMenuConfig.d.ts +11 -0
  135. package/src/interfaces/IMenuConfig.d.ts.map +1 -0
  136. package/src/interfaces/IMenuConfig.js +2 -0
  137. package/src/interfaces/IMenuOption.d.ts +58 -0
  138. package/src/interfaces/IMenuOption.d.ts.map +1 -0
  139. package/src/interfaces/IMenuOption.js +2 -0
  140. package/src/interfaces/index.d.ts +4 -0
  141. package/src/interfaces/index.d.ts.map +1 -0
  142. package/src/interfaces/index.js +6 -0
  143. package/src/services/__mocks__/authService.d.ts +21 -0
  144. package/src/services/__mocks__/authService.d.ts.map +1 -0
  145. package/src/services/__mocks__/authService.js +15 -0
  146. package/src/services/api.d.ts +3 -0
  147. package/src/services/api.d.ts.map +1 -0
  148. package/src/services/api.js +14 -0
  149. package/src/services/authService.d.ts +72 -0
  150. package/src/services/authService.d.ts.map +1 -0
  151. package/src/services/authService.js +347 -0
  152. package/src/services/authenticatedApi.d.ts +3 -0
  153. package/src/services/authenticatedApi.d.ts.map +1 -0
  154. package/src/services/authenticatedApi.js +18 -0
  155. package/src/services/index.d.ts +4 -0
  156. package/src/services/index.d.ts.map +1 -0
  157. package/src/services/index.js +6 -0
  158. package/src/types/MenuType.d.ts +11 -0
  159. package/src/types/MenuType.d.ts.map +1 -0
  160. package/src/types/MenuType.js +12 -0
  161. package/src/types/expirationSeconds.d.ts +3 -0
  162. package/src/types/expirationSeconds.d.ts.map +1 -0
  163. package/src/types/expirationSeconds.js +17 -0
  164. package/src/types/index.d.ts +2 -0
  165. package/src/types/index.d.ts.map +1 -0
  166. package/src/types/index.js +4 -0
  167. package/src/types/translation.d.ts +10 -0
  168. package/src/types/translation.d.ts.map +1 -0
  169. package/src/types/translation.js +9 -0
  170. package/src/wrappers/BackupCodeLoginWrapper.d.ts +8 -0
  171. package/src/wrappers/BackupCodeLoginWrapper.d.ts.map +1 -0
  172. package/src/wrappers/BackupCodeLoginWrapper.js +21 -0
  173. package/src/wrappers/BackupCodesWrapper.d.ts +7 -0
  174. package/src/wrappers/BackupCodesWrapper.d.ts.map +1 -0
  175. package/src/wrappers/BackupCodesWrapper.js +17 -0
  176. package/src/wrappers/ChangePasswordFormWrapper.d.ts +8 -0
  177. package/src/wrappers/ChangePasswordFormWrapper.d.ts.map +1 -0
  178. package/src/wrappers/ChangePasswordFormWrapper.js +21 -0
  179. package/src/wrappers/LoginFormWrapper.d.ts +9 -0
  180. package/src/wrappers/LoginFormWrapper.d.ts.map +1 -0
  181. package/src/wrappers/LoginFormWrapper.js +43 -0
  182. package/src/wrappers/LogoutPageWrapper.d.ts +9 -0
  183. package/src/wrappers/LogoutPageWrapper.d.ts.map +1 -0
  184. package/src/wrappers/LogoutPageWrapper.js +21 -0
  185. package/src/wrappers/RegisterFormWrapper.d.ts +9 -0
  186. package/src/wrappers/RegisterFormWrapper.d.ts.map +1 -0
  187. package/src/wrappers/RegisterFormWrapper.js +26 -0
  188. package/src/wrappers/UserSettingsFormWrapper.d.ts +8 -0
  189. package/src/wrappers/UserSettingsFormWrapper.d.ts.map +1 -0
  190. package/src/wrappers/UserSettingsFormWrapper.js +24 -0
  191. package/src/wrappers/VerifyEmailPageWrapper.d.ts +8 -0
  192. package/src/wrappers/VerifyEmailPageWrapper.d.ts.map +1 -0
  193. package/src/wrappers/VerifyEmailPageWrapper.js +20 -0
  194. package/src/wrappers/{index.tsx → index.d.ts} +1 -8
  195. package/src/wrappers/index.d.ts.map +1 -0
  196. package/src/wrappers/index.js +20 -0
  197. package/LICENSE +0 -21
  198. package/src/auth/Private.tsx +0 -17
  199. package/src/auth/PrivateRoute.tsx +0 -28
  200. package/src/auth/UnAuth.tsx +0 -16
  201. package/src/auth/UnAuthRoute.tsx +0 -30
  202. package/src/components/ApiAccess.tsx +0 -134
  203. package/src/components/BackupCodeLoginForm.tsx +0 -314
  204. package/src/components/BackupCodesForm.tsx +0 -198
  205. package/src/components/ChangePasswordForm.tsx +0 -182
  206. package/src/components/ConfirmationDialog.tsx +0 -48
  207. package/src/components/CurrencyCodeSelector.tsx +0 -60
  208. package/src/components/CurrencyInput.tsx +0 -80
  209. package/src/components/DashboardPage.tsx +0 -24
  210. package/src/components/DropdownMenu.tsx +0 -92
  211. package/src/components/ExpirationSecondsSelector.tsx +0 -65
  212. package/src/components/Flag.tsx +0 -53
  213. package/src/components/ForgotPasswordForm.tsx +0 -120
  214. package/src/components/LoginForm.tsx +0 -307
  215. package/src/components/LogoutPage.tsx +0 -21
  216. package/src/components/RegisterForm.tsx +0 -354
  217. package/src/components/ResetPasswordForm.tsx +0 -164
  218. package/src/components/SideMenu.tsx +0 -46
  219. package/src/components/SideMenuListItem.tsx +0 -74
  220. package/src/components/TopMenu.tsx +0 -149
  221. package/src/components/TranslatedTitle.tsx +0 -22
  222. package/src/components/UserLanguageSelector.tsx +0 -45
  223. package/src/components/UserMenu.tsx +0 -15
  224. package/src/components/UserSettingsForm.tsx +0 -328
  225. package/src/components/VerifyEmailPage.tsx +0 -133
  226. package/src/contexts/AuthProvider.spec.tsx +0 -1060
  227. package/src/contexts/AuthProvider.tsx +0 -741
  228. package/src/contexts/I18nProvider.tsx +0 -85
  229. package/src/contexts/MenuContext.tsx +0 -310
  230. package/src/contexts/SuiteConfigProvider.tsx +0 -93
  231. package/src/contexts/ThemeProvider.tsx +0 -67
  232. package/src/hooks/useBackupCodes.ts +0 -85
  233. package/src/hooks/useEmailVerification.ts +0 -39
  234. package/src/hooks/useExpiringValue.ts +0 -78
  235. package/src/hooks/useLocalStorage.ts +0 -18
  236. package/src/hooks/useUserSettings.ts +0 -216
  237. package/src/interfaces/IAppConfig.ts +0 -5
  238. package/src/interfaces/IMenuConfig.ts +0 -11
  239. package/src/interfaces/IMenuOption.ts +0 -55
  240. package/src/interfaces/index.ts +0 -3
  241. package/src/services/__mocks__/authService.ts +0 -14
  242. package/src/services/api.ts +0 -13
  243. package/src/services/authService.ts +0 -422
  244. package/src/services/authenticatedApi.ts +0 -17
  245. package/src/services/index.ts +0 -3
  246. package/src/types/MenuType.ts +0 -15
  247. package/src/types/expirationSeconds.ts +0 -18
  248. package/src/types/index.ts +0 -1
  249. package/src/types/translation.ts +0 -20
  250. package/src/wrappers/BackupCodeLoginWrapper.tsx +0 -35
  251. package/src/wrappers/BackupCodesWrapper.tsx +0 -28
  252. package/src/wrappers/ChangePasswordFormWrapper.tsx +0 -31
  253. package/src/wrappers/LoginFormWrapper.tsx +0 -59
  254. package/src/wrappers/LogoutPageWrapper.tsx +0 -30
  255. package/src/wrappers/RegisterFormWrapper.tsx +0 -48
  256. package/src/wrappers/UserSettingsFormWrapper.tsx +0 -39
  257. package/src/wrappers/VerifyEmailPageWrapper.tsx +0 -27
@@ -0,0 +1,9 @@
1
+ import { FC } from 'react';
2
+ import { LogoutPage } from '../components/LogoutPage';
3
+ export interface LogoutPageWrapperProps {
4
+ onSuccess?: () => void;
5
+ redirectTo?: string;
6
+ componentProps?: Partial<React.ComponentProps<typeof LogoutPage>>;
7
+ }
8
+ export declare const LogoutPageWrapper: FC<LogoutPageWrapperProps>;
9
+ //# sourceMappingURL=LogoutPageWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogoutPageWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/LogoutPageWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAkBxD,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogoutPageWrapper = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_router_dom_1 = require("react-router-dom");
6
+ const LogoutPage_1 = require("../components/LogoutPage");
7
+ const contexts_1 = require("../contexts");
8
+ const LogoutPageWrapper = ({ onSuccess, redirectTo, componentProps = {}, }) => {
9
+ const { logout } = (0, contexts_1.useAuth)();
10
+ const navigate = (0, react_router_dom_1.useNavigate)();
11
+ const { routes } = (0, contexts_1.useSuiteConfig)();
12
+ const handleLogout = async () => {
13
+ await logout();
14
+ if (onSuccess) {
15
+ onSuccess();
16
+ }
17
+ navigate(redirectTo || routes.login || '/login');
18
+ };
19
+ return (0, jsx_runtime_1.jsx)(LogoutPage_1.LogoutPage, { onLogout: handleLogout, onNavigate: navigate, ...componentProps });
20
+ };
21
+ exports.LogoutPageWrapper = LogoutPageWrapper;
@@ -0,0 +1,9 @@
1
+ import { FC } from 'react';
2
+ import { RegisterFormProps } from '../components/RegisterForm';
3
+ export interface RegisterFormWrapperProps {
4
+ onSuccess?: () => void;
5
+ redirectTo?: string;
6
+ componentProps?: Partial<Omit<RegisterFormProps, 'onSubmit' | 'timezones' | 'getInitialTimezone'>>;
7
+ }
8
+ export declare const RegisterFormWrapper: FC<RegisterFormWrapperProps>;
9
+ //# sourceMappingURL=RegisterFormWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegisterFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/RegisterFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAoC,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGjG,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC;CACpG;AAED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAoC5D,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RegisterFormWrapper = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_router_dom_1 = require("react-router-dom");
6
+ const RegisterForm_1 = require("../components/RegisterForm");
7
+ const contexts_1 = require("../contexts");
8
+ const RegisterFormWrapper = ({ onSuccess, redirectTo, componentProps = {}, }) => {
9
+ const { register } = (0, contexts_1.useAuth)();
10
+ const navigate = (0, react_router_dom_1.useNavigate)();
11
+ const { routes, timezones } = (0, contexts_1.useSuiteConfig)();
12
+ const handleSubmit = async (values, usePassword) => {
13
+ const result = await register(values.username, values.email, values.timezone || 'UTC', values.password);
14
+ if ('error' in result) {
15
+ throw new Error(result.error);
16
+ }
17
+ if (onSuccess) {
18
+ onSuccess();
19
+ }
20
+ navigate(redirectTo || routes.verifyEmail || '/verify-email');
21
+ return result;
22
+ };
23
+ const defaultTimezones = timezones || ['UTC', 'America/New_York', 'America/Los_Angeles', 'Europe/London'];
24
+ return ((0, jsx_runtime_1.jsx)(RegisterForm_1.RegisterForm, { onSubmit: handleSubmit, timezones: defaultTimezones, getInitialTimezone: () => Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC', ...componentProps }));
25
+ };
26
+ exports.RegisterFormWrapper = RegisterFormWrapper;
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { UserSettingsFormProps } from '../components/UserSettingsForm';
3
+ export interface UserSettingsFormWrapperProps {
4
+ onSuccess?: () => void;
5
+ componentProps?: Partial<Omit<UserSettingsFormProps, 'initialValues' | 'onSubmit' | 'languages'>>;
6
+ }
7
+ export declare const UserSettingsFormWrapper: FC<UserSettingsFormWrapperProps>;
8
+ //# sourceMappingURL=UserSettingsFormWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserSettingsFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/UserSettingsFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAA4C,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAKjH,MAAM,WAAW,4BAA4B;IAC3C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,eAAe,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC;CACnG;AAED,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CA2BpE,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserSettingsFormWrapper = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const UserSettingsForm_1 = require("../components/UserSettingsForm");
6
+ const contexts_1 = require("../contexts");
7
+ const hooks_1 = require("../hooks");
8
+ const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
9
+ const UserSettingsFormWrapper = ({ onSuccess, componentProps = {}, }) => {
10
+ const { settings, isLoading, updateSettings } = (0, hooks_1.useUserSettingsPublic)();
11
+ const { languages } = (0, contexts_1.useSuiteConfig)();
12
+ const handleSubmit = async (values) => {
13
+ const result = await updateSettings(values);
14
+ if ('success' in result && result.success && onSuccess) {
15
+ onSuccess();
16
+ }
17
+ return result;
18
+ };
19
+ if (isLoading || !settings) {
20
+ return (0, jsx_runtime_1.jsxs)("div", { children: [(0, suite_core_lib_1.getSuiteCoreTranslation)(suite_core_lib_1.SuiteCoreStringKey.Common_Loading), "..."] });
21
+ }
22
+ return ((0, jsx_runtime_1.jsx)(UserSettingsForm_1.UserSettingsForm, { initialValues: settings, onSubmit: handleSubmit, languages: languages, ...componentProps }));
23
+ };
24
+ exports.UserSettingsFormWrapper = UserSettingsFormWrapper;
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { VerifyEmailPage } from '../components/VerifyEmailPage';
3
+ export interface VerifyEmailPageWrapperProps {
4
+ onSuccess?: () => void;
5
+ componentProps?: Partial<React.ComponentProps<typeof VerifyEmailPage>>;
6
+ }
7
+ export declare const VerifyEmailPageWrapper: FC<VerifyEmailPageWrapperProps>;
8
+ //# sourceMappingURL=VerifyEmailPageWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VerifyEmailPageWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/VerifyEmailPageWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAiBlE,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VerifyEmailPageWrapper = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const VerifyEmailPage_1 = require("../components/VerifyEmailPage");
6
+ const hooks_1 = require("../hooks");
7
+ const VerifyEmailPageWrapper = ({ onSuccess, componentProps = {}, }) => {
8
+ const searchParams = new URLSearchParams(window.location.search);
9
+ const token = searchParams.get('token');
10
+ const { verifyEmail } = (0, hooks_1.useEmailVerification)();
11
+ const handleVerify = async (verificationToken) => {
12
+ const result = await verifyEmail(verificationToken);
13
+ if (result.success && onSuccess) {
14
+ onSuccess();
15
+ }
16
+ return result;
17
+ };
18
+ return (0, jsx_runtime_1.jsx)(VerifyEmailPage_1.VerifyEmailPage, { token: token, onVerify: handleVerify, ...componentProps });
19
+ };
20
+ exports.VerifyEmailPageWrapper = VerifyEmailPageWrapper;
@@ -1,24 +1,17 @@
1
- // Re-export all wrapper components from their individual files
2
1
  export { BackupCodeLoginWrapper } from './BackupCodeLoginWrapper';
3
2
  export type { BackupCodeLoginWrapperProps } from './BackupCodeLoginWrapper';
4
-
5
3
  export { BackupCodesWrapper } from './BackupCodesWrapper';
6
4
  export type { BackupCodesWrapperProps } from './BackupCodesWrapper';
7
-
8
5
  export { ChangePasswordFormWrapper } from './ChangePasswordFormWrapper';
9
6
  export type { ChangePasswordFormWrapperProps } from './ChangePasswordFormWrapper';
10
-
11
7
  export { LoginFormWrapper } from './LoginFormWrapper';
12
8
  export type { LoginFormWrapperProps } from './LoginFormWrapper';
13
-
14
9
  export { RegisterFormWrapper } from './RegisterFormWrapper';
15
10
  export type { RegisterFormWrapperProps } from './RegisterFormWrapper';
16
-
17
11
  export { LogoutPageWrapper } from './LogoutPageWrapper';
18
12
  export type { LogoutPageWrapperProps } from './LogoutPageWrapper';
19
-
20
13
  export { VerifyEmailPageWrapper } from './VerifyEmailPageWrapper';
21
14
  export type { VerifyEmailPageWrapperProps } from './VerifyEmailPageWrapper';
22
-
23
15
  export { UserSettingsFormWrapper } from './UserSettingsFormWrapper';
24
16
  export type { UserSettingsFormWrapperProps } from './UserSettingsFormWrapper';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,YAAY,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,YAAY,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserSettingsFormWrapper = exports.VerifyEmailPageWrapper = exports.LogoutPageWrapper = exports.RegisterFormWrapper = exports.LoginFormWrapper = exports.ChangePasswordFormWrapper = exports.BackupCodesWrapper = exports.BackupCodeLoginWrapper = void 0;
4
+ // Re-export all wrapper components from their individual files
5
+ var BackupCodeLoginWrapper_1 = require("./BackupCodeLoginWrapper");
6
+ Object.defineProperty(exports, "BackupCodeLoginWrapper", { enumerable: true, get: function () { return BackupCodeLoginWrapper_1.BackupCodeLoginWrapper; } });
7
+ var BackupCodesWrapper_1 = require("./BackupCodesWrapper");
8
+ Object.defineProperty(exports, "BackupCodesWrapper", { enumerable: true, get: function () { return BackupCodesWrapper_1.BackupCodesWrapper; } });
9
+ var ChangePasswordFormWrapper_1 = require("./ChangePasswordFormWrapper");
10
+ Object.defineProperty(exports, "ChangePasswordFormWrapper", { enumerable: true, get: function () { return ChangePasswordFormWrapper_1.ChangePasswordFormWrapper; } });
11
+ var LoginFormWrapper_1 = require("./LoginFormWrapper");
12
+ Object.defineProperty(exports, "LoginFormWrapper", { enumerable: true, get: function () { return LoginFormWrapper_1.LoginFormWrapper; } });
13
+ var RegisterFormWrapper_1 = require("./RegisterFormWrapper");
14
+ Object.defineProperty(exports, "RegisterFormWrapper", { enumerable: true, get: function () { return RegisterFormWrapper_1.RegisterFormWrapper; } });
15
+ var LogoutPageWrapper_1 = require("./LogoutPageWrapper");
16
+ Object.defineProperty(exports, "LogoutPageWrapper", { enumerable: true, get: function () { return LogoutPageWrapper_1.LogoutPageWrapper; } });
17
+ var VerifyEmailPageWrapper_1 = require("./VerifyEmailPageWrapper");
18
+ Object.defineProperty(exports, "VerifyEmailPageWrapper", { enumerable: true, get: function () { return VerifyEmailPageWrapper_1.VerifyEmailPageWrapper; } });
19
+ var UserSettingsFormWrapper_1 = require("./UserSettingsFormWrapper");
20
+ Object.defineProperty(exports, "UserSettingsFormWrapper", { enumerable: true, get: function () { return UserSettingsFormWrapper_1.UserSettingsFormWrapper; } });
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Digital Defiance, Jessica Mulein
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,17 +0,0 @@
1
- import { FC, ReactNode, useContext } from 'react';
2
- import { AuthContext } from '../contexts/AuthProvider';
3
- export interface PrivateProps {
4
- children: ReactNode;
5
- }
6
-
7
- export const Private: FC<PrivateProps> = ({
8
- children,
9
- }) => {
10
- const { isAuthenticated, isCheckingAuth } = useContext(AuthContext);
11
-
12
- if (isCheckingAuth || !isAuthenticated) {
13
- return <></>;
14
- }
15
-
16
- return <>{children}</>;
17
- };
@@ -1,28 +0,0 @@
1
- import { FC, ReactNode, useContext } from 'react';
2
- import { Navigate, useLocation } from 'react-router-dom';
3
- import { AuthContext } from '../contexts/AuthProvider';
4
- import { useI18n } from '../contexts';
5
- import { SuiteCoreComponentId, SuiteCoreStringKey } from '@digitaldefiance/suite-core-lib';
6
-
7
- interface PrivateRouteProps {
8
- children: ReactNode;
9
- redirectTo?: string;
10
- }
11
-
12
- export const PrivateRoute: FC<PrivateRouteProps> = ({ children, redirectTo }) => {
13
- const { tComponent } = useI18n();
14
- const { isAuthenticated, isCheckingAuth } = useContext(AuthContext);
15
- const location = useLocation();
16
-
17
- if (isCheckingAuth) {
18
- return <div>{tComponent<SuiteCoreStringKey>(SuiteCoreComponentId, SuiteCoreStringKey.Common_CheckingAuthentication)}...</div>;
19
- }
20
-
21
- if (!isAuthenticated) {
22
- return <Navigate to={redirectTo ?? "/login"} state={{ from: location }} replace />;
23
- }
24
-
25
- return <>{children}</>;
26
- };
27
-
28
- export default PrivateRoute;
@@ -1,16 +0,0 @@
1
- import { FC, ReactNode, useContext } from 'react';
2
- import { AuthContext } from '../contexts/AuthProvider';
3
-
4
- export interface UnAuthProps {
5
- children: ReactNode;
6
- }
7
-
8
- export const UnAuth: FC<UnAuthProps> = ({ children }) => {
9
- const { isAuthenticated, isCheckingAuth } = useContext(AuthContext);
10
-
11
- if (isCheckingAuth || isAuthenticated) {
12
- return null;
13
- }
14
-
15
- return <>{children}</>;
16
- };
@@ -1,30 +0,0 @@
1
- import { FC, ReactNode, useContext } from 'react';
2
- import { Navigate, useLocation } from 'react-router-dom';
3
- import { AuthContext, useI18n } from '../contexts';
4
- import { SuiteCoreComponentId, SuiteCoreStringKey } from '@digitaldefiance/suite-core-lib';
5
-
6
- export interface UnAuthRouteProps {
7
- children: ReactNode;
8
- redirectTo?: string;
9
- }
10
-
11
- export const UnAuthRoute: FC<UnAuthRouteProps> = ({
12
- children,
13
- redirectTo = '/dashboard',
14
- }) => {
15
- const { isAuthenticated, isCheckingAuth } = useContext(AuthContext);
16
- const { tComponent } = useI18n();
17
- const location = useLocation();
18
-
19
- if (isCheckingAuth) {
20
- return <div>{tComponent<SuiteCoreStringKey>(SuiteCoreComponentId, SuiteCoreStringKey.Common_CheckingAuthentication)}...</div>;
21
- }
22
-
23
- if (isAuthenticated) {
24
- return <Navigate to={redirectTo ?? "/dashboard"} state={{ from: location }} replace />;
25
- }
26
-
27
- return <>{children}</>;
28
- };
29
-
30
- export default UnAuthRoute;
@@ -1,134 +0,0 @@
1
- import ContentCopyIcon from '@mui/icons-material/ContentCopy';
2
- import {
3
- Box,
4
- Button,
5
- Dialog,
6
- DialogActions,
7
- DialogContent,
8
- DialogTitle,
9
- styled,
10
- TextField,
11
- Typography,
12
- } from '@mui/material';
13
- import { FC, useState } from 'react';
14
- import { SuiteCoreComponentId, SuiteCoreStringKey } from '@digitaldefiance/suite-core-lib';
15
- import { useAuth, useI18n } from '../contexts';
16
-
17
- const ApiAccessContainer = styled(Box)(({ theme }) => ({
18
- display: 'flex',
19
- flexDirection: 'column',
20
- alignItems: 'center',
21
- justifyContent: 'center',
22
- minHeight: '100vh',
23
- backgroundColor: theme.palette.background.default,
24
- padding: theme.spacing(3),
25
- }));
26
-
27
- const ApiAccessContent = styled(Box)(({ theme }) => ({
28
- maxWidth: '600px',
29
- width: '100%',
30
- backgroundColor: theme.palette.background.paper,
31
- borderRadius: theme.shape.borderRadius,
32
- padding: theme.spacing(4),
33
- boxShadow: theme.shadows[3],
34
- }));
35
-
36
- const ApiAccessTitle = styled(Typography)(({ theme }) => ({
37
- marginBottom: theme.spacing(3),
38
- color: theme.palette.primary.main,
39
- }));
40
-
41
- export interface ApiAccessProps {
42
- token?: string | null;
43
- labels?: {
44
- title?: string;
45
- tokenNotAvailable?: string;
46
- copyButton?: string;
47
- notificationTitle?: string;
48
- copied?: string;
49
- copyFailed?: string;
50
- ok?: string;
51
- };
52
- }
53
-
54
- export const ApiAccess: FC<ApiAccessProps> = ({
55
- token: tokenProp,
56
- labels = {},
57
- }) => {
58
- const { token: authToken } = useAuth();
59
- const token = tokenProp !== undefined ? tokenProp : authToken;
60
- const { tComponent } = useI18n();
61
- const [dialogOpen, setDialogOpen] = useState(false);
62
- const [isError, setIsError] = useState(false);
63
-
64
- const translatedLabels = {
65
- title: labels.title || tComponent<SuiteCoreStringKey>(SuiteCoreComponentId, SuiteCoreStringKey.ApiAccess_Title),
66
- tokenNotAvailable: labels.tokenNotAvailable || tComponent<SuiteCoreStringKey>(SuiteCoreComponentId, SuiteCoreStringKey.ApiAccess_TokenNotAvailable),
67
- copyButton: labels.copyButton || tComponent<SuiteCoreStringKey>(SuiteCoreComponentId, SuiteCoreStringKey.Common_CopyToClipboard),
68
- notificationTitle: labels.notificationTitle || tComponent<SuiteCoreStringKey>(SuiteCoreComponentId, SuiteCoreStringKey.Common_Notification),
69
- copied: labels.copied || tComponent<SuiteCoreStringKey>(SuiteCoreComponentId, SuiteCoreStringKey.Common_CopiedToClipboard),
70
- copyFailed: labels.copyFailed || tComponent<SuiteCoreStringKey>(SuiteCoreComponentId, SuiteCoreStringKey.Error_FailedToCopy),
71
- ok: labels.ok || tComponent<SuiteCoreStringKey>(SuiteCoreComponentId, SuiteCoreStringKey.Common_OK),
72
- };
73
-
74
- const copyToClipboard = async () => {
75
- if (token) {
76
- try {
77
- await navigator.clipboard.writeText(token);
78
- setIsError(false);
79
- setDialogOpen(true);
80
- } catch (err) {
81
- setIsError(true);
82
- }
83
- }
84
- };
85
-
86
- const handleClose = () => {
87
- setDialogOpen(false);
88
- setIsError(false);
89
- };
90
-
91
- return (
92
- <ApiAccessContainer>
93
- <ApiAccessContent>
94
- <ApiAccessTitle variant="h4" align="center">
95
- {translatedLabels.title}
96
- </ApiAccessTitle>
97
- <TextField
98
- fullWidth
99
- multiline
100
- rows={4}
101
- value={token || translatedLabels.tokenNotAvailable}
102
- slotProps={{
103
- input: {
104
- readOnly: true,
105
- },
106
- }}
107
- variant="outlined"
108
- margin="normal"
109
- />
110
- <Button
111
- variant="contained"
112
- color="primary"
113
- startIcon={<ContentCopyIcon />}
114
- onClick={copyToClipboard}
115
- fullWidth
116
- style={{ marginTop: '16px' }}
117
- >
118
- {translatedLabels.copyButton}
119
- </Button>
120
- </ApiAccessContent>
121
- <Dialog open={dialogOpen} onClose={handleClose}>
122
- <DialogTitle>{translatedLabels.notificationTitle}</DialogTitle>
123
- <DialogContent>{isError ? translatedLabels.copyFailed : translatedLabels.copied}</DialogContent>
124
- <DialogActions>
125
- <Button onClick={handleClose} color="primary">
126
- {translatedLabels.ok}
127
- </Button>
128
- </DialogActions>
129
- </Dialog>
130
- </ApiAccessContainer>
131
- );
132
- };
133
-
134
- export default ApiAccess;