@salesforce/ui-bundle-template-feature-vue-authentication 0.0.0-stage → 13.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/LICENSE.txt +82 -0
  2. package/README.md +106 -2
  3. package/dist/.forceignore +15 -0
  4. package/dist/.husky/pre-commit +4 -0
  5. package/dist/.prettierignore +11 -0
  6. package/dist/.prettierrc +17 -0
  7. package/dist/CHANGELOG.md +5423 -0
  8. package/dist/README.md +83 -0
  9. package/dist/config/project-scratch-def.json +13 -0
  10. package/dist/eslint.config.js +7 -0
  11. package/dist/force-app/main/default/classes/UIBundleAuthUtils.cls +68 -0
  12. package/dist/force-app/main/default/classes/UIBundleAuthUtils.cls-meta.xml +5 -0
  13. package/dist/force-app/main/default/classes/UIBundleAuthUtils_Test.cls +141 -0
  14. package/dist/force-app/main/default/classes/UIBundleAuthUtils_Test.cls-meta.xml +5 -0
  15. package/dist/force-app/main/default/classes/UIBundleChangePassword.cls +77 -0
  16. package/dist/force-app/main/default/classes/UIBundleChangePassword.cls-meta.xml +5 -0
  17. package/dist/force-app/main/default/classes/UIBundleForgotPassword.cls +71 -0
  18. package/dist/force-app/main/default/classes/UIBundleForgotPassword.cls-meta.xml +5 -0
  19. package/dist/force-app/main/default/classes/UIBundleLogin.cls +105 -0
  20. package/dist/force-app/main/default/classes/UIBundleLogin.cls-meta.xml +5 -0
  21. package/dist/force-app/main/default/classes/UIBundleRegistration.cls +162 -0
  22. package/dist/force-app/main/default/classes/UIBundleRegistration.cls-meta.xml +5 -0
  23. package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig.cls +145 -0
  24. package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig.cls-meta.xml +5 -0
  25. package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig_Test.cls +181 -0
  26. package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig_Test.cls-meta.xml +5 -0
  27. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.forceignore +15 -0
  28. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.graphqlrc.yml +2 -0
  29. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.prettierignore +9 -0
  30. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.prettierrc +11 -0
  31. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/README.md +43 -0
  32. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/codegen.yml +95 -0
  33. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/components.json +19 -0
  34. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/e2e/app.spec.ts +17 -0
  35. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/eslint.config.js +124 -0
  36. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/feature-vue-authentication.uibundle-meta.xml +7 -0
  37. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/index.html +12 -0
  38. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/package.json +74 -0
  39. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/playwright.config.ts +24 -0
  40. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/scripts/get-graphql-schema.mjs +71 -0
  41. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/scripts/rewrite-e2e-assets.mjs +23 -0
  42. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/App.vue +5 -0
  43. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/api/graphqlClient.ts +44 -0
  44. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/appLayout.vue +80 -0
  45. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/alerts/status-alert.vue +59 -0
  46. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/layouts/card-layout.vue +30 -0
  47. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/Alert.vue +21 -0
  48. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/AlertAction.vue +17 -0
  49. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/AlertDescription.vue +22 -0
  50. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/AlertTitle.vue +22 -0
  51. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/index.ts +25 -0
  52. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/Avatar.vue +23 -0
  53. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/AvatarFallback.vue +31 -0
  54. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/AvatarImage.vue +16 -0
  55. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/index.ts +3 -0
  56. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/button/Button.vue +33 -0
  57. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/button/index.ts +43 -0
  58. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/Card.vue +29 -0
  59. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardAction.vue +22 -0
  60. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardContent.vue +17 -0
  61. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardDescription.vue +17 -0
  62. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardFooter.vue +22 -0
  63. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardHeader.vue +22 -0
  64. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardTitle.vue +22 -0
  65. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/index.ts +7 -0
  66. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/checkbox/Checkbox.vue +43 -0
  67. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/checkbox/index.ts +1 -0
  68. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/Collapsible.vue +19 -0
  69. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/CollapsibleContent.vue +12 -0
  70. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/CollapsibleTrigger.vue +12 -0
  71. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/index.ts +3 -0
  72. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/Dialog.vue +15 -0
  73. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogClose.vue +12 -0
  74. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogContent.vue +59 -0
  75. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogDescription.vue +31 -0
  76. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogFooter.vue +33 -0
  77. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogHeader.vue +17 -0
  78. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogOverlay.vue +31 -0
  79. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogPortal.vue +12 -0
  80. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogTitle.vue +26 -0
  81. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogTrigger.vue +12 -0
  82. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/index.ts +10 -0
  83. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenu.vue +19 -0
  84. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +51 -0
  85. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuContent.vue +47 -0
  86. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuGroup.vue +12 -0
  87. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuItem.vue +44 -0
  88. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuLabel.vue +30 -0
  89. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuPortal.vue +12 -0
  90. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +21 -0
  91. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +52 -0
  92. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue +26 -0
  93. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue +19 -0
  94. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSub.vue +19 -0
  95. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue +37 -0
  96. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +38 -0
  97. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue +17 -0
  98. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/index.ts +15 -0
  99. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/Field.vue +27 -0
  100. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldContent.vue +22 -0
  101. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldDescription.vue +24 -0
  102. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldError.vue +48 -0
  103. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldGroup.vue +22 -0
  104. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldLabel.vue +24 -0
  105. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldLegend.vue +29 -0
  106. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldSeparator.vue +31 -0
  107. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldSet.vue +22 -0
  108. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldTitle.vue +22 -0
  109. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/index.ts +33 -0
  110. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/index.ts +115 -0
  111. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/input/Input.vue +30 -0
  112. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/input/index.ts +1 -0
  113. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/label/Label.vue +29 -0
  114. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/label/index.ts +1 -0
  115. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/Pagination.vue +17 -0
  116. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationContent.vue +15 -0
  117. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationEllipsis.vue +23 -0
  118. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationItem.vue +7 -0
  119. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationLink.vue +31 -0
  120. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationNext.vue +29 -0
  121. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationPrevious.vue +29 -0
  122. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/index.ts +7 -0
  123. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/Popover.vue +15 -0
  124. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverAnchor.vue +12 -0
  125. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverContent.vue +44 -0
  126. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverDescription.vue +17 -0
  127. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverHeader.vue +17 -0
  128. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverTitle.vue +14 -0
  129. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverTrigger.vue +12 -0
  130. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/index.ts +7 -0
  131. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/Select.vue +15 -0
  132. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectContent.vue +65 -0
  133. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectGroup.vue +26 -0
  134. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectItem.vue +41 -0
  135. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectLabel.vue +26 -0
  136. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectScrollDownButton.vue +32 -0
  137. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectScrollUpButton.vue +32 -0
  138. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectSeparator.vue +24 -0
  139. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectTrigger.vue +45 -0
  140. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectValue.vue +12 -0
  141. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/index.ts +10 -0
  142. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/separator/Separator.vue +33 -0
  143. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/separator/index.ts +1 -0
  144. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/skeleton/Skeleton.vue +15 -0
  145. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/skeleton/index.ts +1 -0
  146. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/sonner/Sonner.vue +29 -0
  147. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/sonner/index.ts +3 -0
  148. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/spinner/Spinner.vue +17 -0
  149. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/spinner/index.ts +1 -0
  150. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/composables/useAsyncData.ts +69 -0
  151. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/api/userProfileApi.ts +107 -0
  152. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/authHelpers.ts +78 -0
  153. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/authenticationConfig.ts +66 -0
  154. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/components/SocialLogin.vue +150 -0
  155. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/composables/useCountdownTimer.ts +246 -0
  156. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/composables/useRetryWithBackoff.ts +112 -0
  157. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/composables/useSessionTimeout.ts +244 -0
  158. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/context/authContext.ts +115 -0
  159. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/footers/FooterLink.vue +47 -0
  160. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/forms/AuthForm.vue +141 -0
  161. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/forms/SubmitButton.vue +57 -0
  162. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/EmailField.vue +46 -0
  163. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/PasswordField.vue +48 -0
  164. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/TextField.vue +106 -0
  165. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/form.ts +90 -0
  166. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/formContexts.ts +61 -0
  167. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/layout/CenteredPageLayout.vue +76 -0
  168. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/layouts/AuthAppLayout.vue +24 -0
  169. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/layouts/PrivateRouteLayout.vue +50 -0
  170. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/menu/AuthMenu.vue +143 -0
  171. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/ChangePassword.vue +122 -0
  172. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/ForgotPassword.vue +90 -0
  173. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/Login.vue +106 -0
  174. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/Profile.vue +180 -0
  175. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/Register.vue +135 -0
  176. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/ResetPassword.vue +114 -0
  177. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/SessionExpiredAlert.vue +50 -0
  178. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/SessionTimeoutValidator.vue +136 -0
  179. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/SessionWarningModal.vue +151 -0
  180. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/sessionTimeService.ts +142 -0
  181. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/sessionTimeoutConfig.ts +82 -0
  182. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/utils/helpers.ts +90 -0
  183. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/utils/queryToSearchParams.ts +33 -0
  184. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/lib/utils.ts +6 -0
  185. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/main.ts +6 -0
  186. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/pages/Home.vue +10 -0
  187. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/pages/NotFound.vue +18 -0
  188. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/router-utils.ts +32 -0
  189. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/router.ts +90 -0
  190. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/styles/global.css +134 -0
  191. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/test/setup.ts +1 -0
  192. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/tsconfig.json +45 -0
  193. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/tsconfig.node.json +13 -0
  194. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/tsconfig.tsbuildinfo +1 -0
  195. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/ui-bundle.json +7 -0
  196. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/vite-env.d.ts +14 -0
  197. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/vite.config.ts +106 -0
  198. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/vitest-env.d.ts +2 -0
  199. package/dist/jest.config.js +6 -0
  200. package/dist/package-lock.json +12554 -0
  201. package/dist/package.json +46 -0
  202. package/dist/scripts/apex/hello.apex +10 -0
  203. package/dist/scripts/gitignore-templates.json +4 -0
  204. package/dist/scripts/graphql-search.sh +191 -0
  205. package/dist/scripts/network-senders.mjs +84 -0
  206. package/dist/scripts/org-setup-config-schema.mjs +132 -0
  207. package/dist/scripts/org-setup-dev.mjs +114 -0
  208. package/dist/scripts/org-setup-url.mjs +108 -0
  209. package/dist/scripts/org-setup-utils.mjs +569 -0
  210. package/dist/scripts/org-setup-xml.mjs +283 -0
  211. package/dist/scripts/org-setup.config.json +5 -0
  212. package/dist/scripts/org-setup.mjs +2545 -0
  213. package/dist/scripts/sf-project-setup.mjs +103 -0
  214. package/dist/scripts/soql/account.soql +6 -0
  215. package/dist/scripts/validate-org-setup-config.mjs +38 -0
  216. package/dist/sfdx-project.json +12 -0
  217. package/package.json +44 -4
@@ -0,0 +1,180 @@
1
+ <!--
2
+ Copyright (c) 2026, Salesforce, Inc.,
3
+ All rights reserved.
4
+ For full license text, see the LICENSE.txt file
5
+ -->
6
+ <script setup lang="ts">
7
+ import { computed, onMounted, ref, watch } from "vue";
8
+ import { z } from "zod";
9
+ import CenteredPageLayout from "../layout/CenteredPageLayout.vue";
10
+ import AuthForm from "../forms/AuthForm.vue";
11
+ import { fields, useAppForm } from "../hooks/form";
12
+ import { ROUTES } from "../authenticationConfig";
13
+ import { emailSchema } from "../authHelpers";
14
+ import { useUser } from "../context/authContext";
15
+ import { fetchUserProfile, updateUserProfile } from "../api/userProfileApi";
16
+ import { Field, FieldLabel } from "@/components/ui/field";
17
+ import { Skeleton } from "@/components/ui/skeleton";
18
+
19
+ const optionalString = z
20
+ .string()
21
+ .trim()
22
+ .transform((val) => (val === "" ? null : val))
23
+ .nullable()
24
+ .optional();
25
+
26
+ const profileSchema = z.object({
27
+ FirstName: z.string().trim().min(1, "First name is required"),
28
+ LastName: z.string().trim().min(1, "Last name is required"),
29
+ Email: emailSchema,
30
+ Phone: optionalString,
31
+ Street: optionalString,
32
+ City: optionalString,
33
+ State: optionalString,
34
+ PostalCode: optionalString,
35
+ Country: optionalString,
36
+ });
37
+
38
+ type ProfileFormValues = z.infer<typeof profileSchema>;
39
+
40
+ const user = useUser();
41
+ const profile = ref<ProfileFormValues | null>(null);
42
+ const loadError = ref<string | null>(null);
43
+ const success = ref(false);
44
+ const submitError = ref<string | null>(null);
45
+
46
+ const form = useAppForm({
47
+ defaultValues: {} as ProfileFormValues,
48
+ validators: { onChange: profileSchema, onSubmit: profileSchema },
49
+ onSubmit: async ({ value }: { value: ProfileFormValues }) => {
50
+ submitError.value = null;
51
+ success.value = false;
52
+ try {
53
+ const updated = await updateUserProfile<Partial<ProfileFormValues>>(user.value.id, value);
54
+ // Merge with submitted values so missing fields (e.g. due to FLS) don't
55
+ // break the form.
56
+ profile.value = {
57
+ FirstName: updated.FirstName ?? value.FirstName ?? "",
58
+ LastName: updated.LastName ?? value.LastName ?? "",
59
+ Email: updated.Email ?? value.Email ?? "",
60
+ Phone: updated.Phone ?? value.Phone ?? null,
61
+ Street: updated.Street ?? value.Street ?? null,
62
+ City: updated.City ?? value.City ?? null,
63
+ State: updated.State ?? value.State ?? null,
64
+ PostalCode: updated.PostalCode ?? value.PostalCode ?? null,
65
+ Country: updated.Country ?? value.Country ?? null,
66
+ };
67
+ success.value = true;
68
+ window.scrollTo({ top: 0, behavior: "smooth" });
69
+ } catch (err) {
70
+ console.error("Failed to update profile", err);
71
+ submitError.value = "Failed to update profile";
72
+ }
73
+ },
74
+ });
75
+
76
+ const isSubmitting = form.useStore((state: { isSubmitting: boolean }) => state.isSubmitting);
77
+ const loading = computed(() => !profile.value && !loadError.value);
78
+
79
+ onMounted(async () => {
80
+ try {
81
+ const data = await fetchUserProfile<Partial<ProfileFormValues>>(user.value.id);
82
+ // Merge with defaults so missing fields (e.g. due to FLS) don't break the form.
83
+ profile.value = {
84
+ FirstName: data.FirstName ?? "",
85
+ LastName: data.LastName ?? "",
86
+ Email: data.Email ?? "",
87
+ Phone: data.Phone ?? null,
88
+ Street: data.Street ?? null,
89
+ City: data.City ?? null,
90
+ State: data.State ?? null,
91
+ PostalCode: data.PostalCode ?? null,
92
+ Country: data.Country ?? null,
93
+ };
94
+ } catch (err) {
95
+ console.error("Failed to load profile", err);
96
+ loadError.value = "Failed to load profile";
97
+ }
98
+ });
99
+
100
+ watch(profile, (value) => {
101
+ if (value) {
102
+ form.reset(profileSchema.parse(value));
103
+ }
104
+ });
105
+
106
+ const fieldSkeletons = [
107
+ "Email",
108
+ "First name",
109
+ "Last name",
110
+ "Phone",
111
+ "Street",
112
+ "City",
113
+ "State",
114
+ "Postal Code",
115
+ "Country",
116
+ ];
117
+ </script>
118
+
119
+ <template>
120
+ <CenteredPageLayout content-max-width="md" :title="ROUTES.PROFILE.TITLE">
121
+ <form.AppForm>
122
+ <AuthForm
123
+ title="Profile"
124
+ description="Update your account information"
125
+ :show-already-logged-in="false"
126
+ :error="loadError ?? submitError"
127
+ :success="success ? 'Profile updated!' : null"
128
+ submit-text="Save Changes"
129
+ submit-loading-text="Saving…"
130
+ :submit-disabled="loading"
131
+ :is-submitting="isSubmitting"
132
+ :footer-link="ROUTES.CHANGE_PASSWORD.PATH"
133
+ footer-link-text="Change password"
134
+ >
135
+ <div v-if="loading" role="status" aria-live="polite">
136
+ <span class="sr-only">Loading profile…</span>
137
+ <Field v-for="label in fieldSkeletons" :key="label">
138
+ <FieldLabel>{{ label }}</FieldLabel>
139
+ <Skeleton class="h-9 w-full rounded-md" />
140
+ </Field>
141
+ </div>
142
+ <template v-else>
143
+ <form.AppField name="Email">
144
+ <fields.EmailField label="Email" disabled />
145
+ </form.AppField>
146
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 items-start">
147
+ <form.AppField name="FirstName">
148
+ <fields.TextField label="First name" autocomplete="given-name" />
149
+ </form.AppField>
150
+ <form.AppField name="LastName">
151
+ <fields.TextField label="Last name" autocomplete="family-name" />
152
+ </form.AppField>
153
+ </div>
154
+ <form.AppField name="Phone">
155
+ <fields.TextField label="Phone" type="tel" autocomplete="tel" />
156
+ </form.AppField>
157
+ <form.AppField name="Street">
158
+ <fields.TextField label="Street" autocomplete="street-address" />
159
+ </form.AppField>
160
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 items-start">
161
+ <form.AppField name="City">
162
+ <fields.TextField label="City" autocomplete="address-level2" />
163
+ </form.AppField>
164
+ <form.AppField name="State">
165
+ <fields.TextField label="State" autocomplete="address-level1" />
166
+ </form.AppField>
167
+ </div>
168
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 items-start">
169
+ <form.AppField name="PostalCode">
170
+ <fields.TextField label="Postal Code" autocomplete="postal-code" />
171
+ </form.AppField>
172
+ <form.AppField name="Country">
173
+ <fields.TextField label="Country" autocomplete="country-name" />
174
+ </form.AppField>
175
+ </div>
176
+ </template>
177
+ </AuthForm>
178
+ </form.AppForm>
179
+ </CenteredPageLayout>
180
+ </template>
@@ -0,0 +1,135 @@
1
+ <!--
2
+ Copyright (c) 2026, Salesforce, Inc.,
3
+ All rights reserved.
4
+ For full license text, see the LICENSE.txt file
5
+ -->
6
+ <script setup lang="ts">
7
+ import { ref } from "vue";
8
+ import { useRoute, useRouter } from "vue-router";
9
+ import { z } from "zod";
10
+ import { createDataSDK } from "@salesforce/platform-sdk";
11
+ import CenteredPageLayout from "../layout/CenteredPageLayout.vue";
12
+ import AuthForm from "../forms/AuthForm.vue";
13
+ import { fields, useAppForm } from "../hooks/form";
14
+ import { AUTH_PLACEHOLDERS, ROUTES } from "../authenticationConfig";
15
+ import { emailSchema, getStartUrl, passwordSchema, type AuthResponse } from "../authHelpers";
16
+ import { ApiError, handleApiResponse } from "../utils/helpers";
17
+ import { queryToSearchParams } from "../utils/queryToSearchParams";
18
+
19
+ const registerSchema = z
20
+ .object({
21
+ firstName: z.string().trim().min(1, "First name is required"),
22
+ lastName: z.string().trim().min(1, "Last name is required"),
23
+ email: emailSchema,
24
+ password: passwordSchema,
25
+ confirmPassword: z.string().min(1, "Please confirm your password"),
26
+ startUrl: z.string(),
27
+ })
28
+ .refine((data) => data.password === data.confirmPassword, {
29
+ message: "Passwords do not match",
30
+ path: ["confirmPassword"],
31
+ });
32
+
33
+ const router = useRouter();
34
+ const route = useRoute();
35
+ const submitError = ref<string | string[] | null>(null);
36
+
37
+ const form = useAppForm({
38
+ defaultValues: {
39
+ firstName: "",
40
+ lastName: "",
41
+ email: "",
42
+ password: "",
43
+ confirmPassword: "",
44
+ startUrl: getStartUrl(queryToSearchParams(route.query)) || "",
45
+ },
46
+ validators: { onChange: registerSchema, onSubmit: registerSchema },
47
+ onSubmit: async ({ value: formFieldValues }: { value: Record<string, string> }) => {
48
+ submitError.value = null;
49
+ try {
50
+ // Salesforce integration: the Data SDK fetch calls a custom Apex REST
51
+ // resource. Ensure "/services/apexrest/auth/register" exists in your org
52
+ // and handles registration (duplicate checks, Site.createExternalUser).
53
+ const { confirmPassword: _confirmPassword, ...request } = formFieldValues;
54
+ const sdk = await createDataSDK();
55
+ const response = await sdk.fetch!("/services/apexrest/auth/register", {
56
+ method: "POST",
57
+ body: JSON.stringify({ request }),
58
+ headers: {
59
+ "Content-Type": "application/json",
60
+ Accept: "application/json",
61
+ },
62
+ });
63
+ const result = await handleApiResponse<AuthResponse>(response);
64
+ if (result?.redirectUrl) {
65
+ // Hard navigate with assign (not replace) so this page stays in history
66
+ // and Back returns here after an MFA/verification screen.
67
+ window.location.assign(result.redirectUrl);
68
+ } else {
69
+ void router.replace(ROUTES.LOGIN.PATH);
70
+ }
71
+ } catch (err) {
72
+ console.error("Registration failed", err);
73
+ if (err instanceof ApiError) {
74
+ submitError.value = err.errors;
75
+ } else {
76
+ submitError.value = "Registration failed";
77
+ }
78
+ }
79
+ },
80
+ });
81
+
82
+ const isSubmitting = form.useStore((state: { isSubmitting: boolean }) => state.isSubmitting);
83
+ </script>
84
+
85
+ <template>
86
+ <CenteredPageLayout :title="ROUTES.REGISTER.TITLE">
87
+ <form.AppForm>
88
+ <AuthForm
89
+ title="Sign Up"
90
+ description="Enter your information to create an account"
91
+ :error="submitError"
92
+ submit-text="Create an account"
93
+ submit-loading-text="Creating account…"
94
+ :is-submitting="isSubmitting"
95
+ footer-text="Already have an account?"
96
+ :footer-link="ROUTES.LOGIN.PATH"
97
+ footer-link-text="Sign in"
98
+ >
99
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 items-start">
100
+ <form.AppField name="firstName">
101
+ <fields.TextField
102
+ label="First name"
103
+ :placeholder="AUTH_PLACEHOLDERS.FIRST_NAME"
104
+ autocomplete="given-name"
105
+ />
106
+ </form.AppField>
107
+ <form.AppField name="lastName">
108
+ <fields.TextField
109
+ label="Last name"
110
+ :placeholder="AUTH_PLACEHOLDERS.LAST_NAME"
111
+ autocomplete="family-name"
112
+ />
113
+ </form.AppField>
114
+ </div>
115
+ <form.AppField name="email">
116
+ <fields.EmailField label="Email" />
117
+ </form.AppField>
118
+ <form.AppField name="password">
119
+ <fields.PasswordField
120
+ label="Password"
121
+ :placeholder="AUTH_PLACEHOLDERS.PASSWORD_CREATE"
122
+ autocomplete="new-password"
123
+ />
124
+ </form.AppField>
125
+ <form.AppField name="confirmPassword">
126
+ <fields.PasswordField
127
+ label="Confirm Password"
128
+ :placeholder="AUTH_PLACEHOLDERS.PASSWORD_CONFIRM"
129
+ autocomplete="new-password"
130
+ />
131
+ </form.AppField>
132
+ </AuthForm>
133
+ </form.AppForm>
134
+ </CenteredPageLayout>
135
+ </template>
@@ -0,0 +1,114 @@
1
+ <!--
2
+ Copyright (c) 2026, Salesforce, Inc.,
3
+ All rights reserved.
4
+ For full license text, see the LICENSE.txt file
5
+ -->
6
+ <script setup lang="ts">
7
+ import { computed, ref } from "vue";
8
+ import { RouterLink, useRoute } from "vue-router";
9
+ import { createDataSDK } from "@salesforce/platform-sdk";
10
+ import CenteredPageLayout from "../layout/CenteredPageLayout.vue";
11
+ import AuthForm from "../forms/AuthForm.vue";
12
+ import CardLayout from "@/components/layouts/card-layout.vue";
13
+ import StatusAlert from "@/components/alerts/status-alert.vue";
14
+ import { fields, useAppForm } from "../hooks/form";
15
+ import { AUTH_PLACEHOLDERS, ROUTES } from "../authenticationConfig";
16
+ import { newPasswordSchema } from "../authHelpers";
17
+ import { ApiError, handleApiResponse } from "../utils/helpers";
18
+
19
+ const route = useRoute();
20
+ const token = computed(() => {
21
+ const raw = route.query.token;
22
+ return typeof raw === "string" ? raw : null;
23
+ });
24
+
25
+ const success = ref(false);
26
+ const submitError = ref<string | string[] | null>(null);
27
+
28
+ const form = useAppForm({
29
+ defaultValues: { newPassword: "", confirmPassword: "" },
30
+ validators: { onChange: newPasswordSchema, onSubmit: newPasswordSchema },
31
+ onSubmit: async ({ value }: { value: { newPassword: string; confirmPassword: string } }) => {
32
+ submitError.value = null;
33
+ success.value = false;
34
+ try {
35
+ // Custom Apex endpoint: /auth/reset-password. Ensure this Apex class
36
+ // exists in your org.
37
+ const sdk = await createDataSDK();
38
+ const response = await sdk.fetch!("/services/apexrest/auth/reset-password", {
39
+ method: "POST",
40
+ body: JSON.stringify({
41
+ token: token.value,
42
+ newPassword: value.newPassword,
43
+ }),
44
+ headers: {
45
+ "Content-Type": "application/json",
46
+ Accept: "application/json",
47
+ },
48
+ });
49
+ await handleApiResponse(response);
50
+ success.value = true;
51
+ // Scroll to top so the user sees the success alert.
52
+ window.scrollTo({ top: 0, behavior: "smooth" });
53
+ } catch (err) {
54
+ console.error("Password reset failed", err);
55
+ if (err instanceof ApiError) {
56
+ submitError.value = err.errors.length === 1 ? err.errors[0] : err.errors;
57
+ } else {
58
+ submitError.value = "Password reset failed";
59
+ }
60
+ }
61
+ },
62
+ });
63
+
64
+ const isSubmitting = form.useStore((state: { isSubmitting: boolean }) => state.isSubmitting);
65
+ </script>
66
+
67
+ <template>
68
+ <CenteredPageLayout :title="ROUTES.RESET_PASSWORD.TITLE">
69
+ <CardLayout v-if="!token" title="Reset Password">
70
+ <h1 class="sr-only">Reset Password</h1>
71
+ <StatusAlert>
72
+ Reset token is invalid or expired.
73
+ <RouterLink :to="ROUTES.FORGOT_PASSWORD.PATH" class="underline underline-offset-4">
74
+ Request a new password reset link.
75
+ </RouterLink>
76
+ </StatusAlert>
77
+ </CardLayout>
78
+
79
+ <form.AppForm v-else>
80
+ <AuthForm
81
+ title="Reset Password"
82
+ description="Enter your new password below"
83
+ :error="submitError"
84
+ submit-text="Reset Password"
85
+ submit-loading-text="Resetting…"
86
+ :is-submitting="isSubmitting"
87
+ footer-text="Remember your password?"
88
+ :footer-link="ROUTES.LOGIN.PATH"
89
+ footer-link-text="Sign in"
90
+ >
91
+ <template v-if="success" #success>
92
+ Password reset successfully!
93
+ <RouterLink :to="ROUTES.LOGIN.PATH" class="underline">Sign in</RouterLink>
94
+ </template>
95
+ <form.AppField name="newPassword">
96
+ <fields.PasswordField
97
+ label="New Password"
98
+ :placeholder="AUTH_PLACEHOLDERS.PASSWORD_NEW"
99
+ autocomplete="new-password"
100
+ :disabled="success"
101
+ />
102
+ </form.AppField>
103
+ <form.AppField name="confirmPassword">
104
+ <fields.PasswordField
105
+ label="Confirm Password"
106
+ :placeholder="AUTH_PLACEHOLDERS.PASSWORD_NEW_CONFIRM"
107
+ autocomplete="new-password"
108
+ :disabled="success"
109
+ />
110
+ </form.AppField>
111
+ </AuthForm>
112
+ </form.AppForm>
113
+ </CenteredPageLayout>
114
+ </template>
@@ -0,0 +1,50 @@
1
+ <!--
2
+ Copyright (c) 2026, Salesforce, Inc.,
3
+ All rights reserved.
4
+ For full license text, see the LICENSE.txt file
5
+ -->
6
+ <script setup lang="ts">
7
+ import { XIcon } from "@lucide/vue";
8
+ import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
9
+ import { Button } from "@/components/ui/button";
10
+ import { LABELS } from "./sessionTimeoutConfig";
11
+
12
+ /**
13
+ * Toast-like alert shown on the login page after the user is redirected due to
14
+ * session expiration. The Vue analogue of the React `SessionExpiredAlert`.
15
+ */
16
+ withDefaults(
17
+ defineProps<{
18
+ /** Custom message to display. */
19
+ message?: string;
20
+ }>(),
21
+ {
22
+ message: LABELS.invalidSessionMessage,
23
+ },
24
+ );
25
+
26
+ const emit = defineEmits<{
27
+ /** User dismissed the alert. */
28
+ (e: "dismiss"): void;
29
+ }>();
30
+ </script>
31
+
32
+ <template>
33
+ <div class="fixed top-4 left-1/2 -translate-x-1/2 z-50 w-full max-w-md px-4">
34
+ <Alert variant="destructive" role="alert">
35
+ <AlertTitle class="flex items-center justify-between">
36
+ <span>{{ LABELS.sessionWarningTitle }}</span>
37
+ <Button
38
+ variant="ghost"
39
+ size="sm"
40
+ :aria-label="LABELS.closeLabel"
41
+ class="h-auto p-1 hover:bg-destructive/10"
42
+ @click="emit('dismiss')"
43
+ >
44
+ <XIcon class="h-4 w-4" />
45
+ </Button>
46
+ </AlertTitle>
47
+ <AlertDescription>{{ message }}</AlertDescription>
48
+ </Alert>
49
+ </div>
50
+ </template>
@@ -0,0 +1,136 @@
1
+ <!--
2
+ Copyright (c) 2026, Salesforce, Inc.,
3
+ All rights reserved.
4
+ For full license text, see the LICENSE.txt file
5
+ -->
6
+ <script setup lang="ts">
7
+ import { onMounted, ref, watch } from "vue";
8
+ import { useRoute } from "vue-router";
9
+ import { useAuth } from "../context/authContext";
10
+ import { useSessionTimeout } from "../composables/useSessionTimeout";
11
+ import { ROUTES } from "../authenticationConfig";
12
+ import { STORAGE_KEYS } from "./sessionTimeoutConfig";
13
+ import SessionWarningModal from "./SessionWarningModal.vue";
14
+ import SessionExpiredAlert from "./SessionExpiredAlert.vue";
15
+
16
+ /**
17
+ * Main component that monitors the user session and displays warnings before
18
+ * expiration. The Vue analogue of the React `SessionTimeoutValidator`.
19
+ *
20
+ * Features:
21
+ * - Polls SessionTimeServlet to monitor session status.
22
+ * - Shows a warning modal when the session nears expiration.
23
+ * - Extends the session when the user clicks "Continue Working".
24
+ * - Uses the auth context's logout() for centralized logout handling.
25
+ * - Shows an expired message on the login page after a timeout redirect.
26
+ * - Implements exponential-backoff retry for failed API calls.
27
+ * - Skips monitoring for guest users.
28
+ */
29
+ const props = defineProps<{
30
+ /** Community base path. */
31
+ basePath: string;
32
+ }>();
33
+
34
+ const emit = defineEmits<{
35
+ /** Session expired and the user is being logged out. */
36
+ (e: "sessionExpired"): void;
37
+ /** Session extended, with the new time remaining. */
38
+ (e: "sessionExtended", newTimeRemaining: number): void;
39
+ }>();
40
+
41
+ const { isAuthenticated, loading, logout } = useAuth();
42
+ const route = useRoute();
43
+
44
+ const sessionTimeout = useSessionTimeout({
45
+ basePath: props.basePath,
46
+ isGuest: () => !isAuthenticated.value,
47
+ });
48
+
49
+ // Session expired alert — checked once at mount. The timeout handler triggers a
50
+ // hard navigation (window.location.replace), so the component always mounts
51
+ // fresh on the login page after expiry.
52
+ const showExpiredAlert = ref(false);
53
+
54
+ function handleExtendSession(): void {
55
+ void sessionTimeout.extendSession().then(() => {
56
+ if (sessionTimeout.timeLeftInSession.value !== null) {
57
+ emit("sessionExtended", sessionTimeout.timeLeftInSession.value);
58
+ }
59
+ });
60
+ }
61
+
62
+ function handleCountdownExpired(): void {
63
+ void sessionTimeout.checkSession();
64
+ }
65
+
66
+ function handleLogout(): void {
67
+ // Set a flag so the login page shows the expired message.
68
+ sessionStorage.setItem(STORAGE_KEYS.SHOW_SESSION_MESSAGE, "true");
69
+
70
+ // Stop session monitoring (clears timeouts, resets state).
71
+ sessionTimeout.logout();
72
+
73
+ emit("sessionExpired");
74
+
75
+ // Centralized logout: clears auth state and redirects to the logout URL,
76
+ // passing the current path so the user returns here after logging back in.
77
+ logout(window.location.pathname);
78
+ }
79
+
80
+ function handleDismissAlert(): void {
81
+ showExpiredAlert.value = false;
82
+ const main = document.querySelector<HTMLElement>("main, #main-content");
83
+ if (main) {
84
+ if (!main.hasAttribute("tabindex")) main.setAttribute("tabindex", "-1");
85
+ main.focus();
86
+ }
87
+ }
88
+
89
+ // Automatic logout when the countdown reaches 0. Only trigger once a response
90
+ // has been received (not null) and the session is genuinely expired.
91
+ watch(
92
+ () => sessionTimeout.timeLeftInSession.value,
93
+ (timeLeft) => {
94
+ if (timeLeft !== null && timeLeft <= 0 && isAuthenticated.value) {
95
+ handleLogout();
96
+ }
97
+ },
98
+ );
99
+
100
+ onMounted(() => {
101
+ const isLoginPage = route.path === ROUTES.LOGIN.PATH;
102
+ const shouldShow =
103
+ isLoginPage && sessionStorage.getItem(STORAGE_KEYS.SHOW_SESSION_MESSAGE) === "true";
104
+ if (shouldShow) {
105
+ sessionStorage.removeItem(STORAGE_KEYS.SHOW_SESSION_MESSAGE);
106
+ }
107
+ showExpiredAlert.value = shouldShow;
108
+ });
109
+
110
+ // Begin monitoring once the auth check has resolved. `start()` is a no-op for
111
+ // guests, so authenticated users start polling and guests are skipped.
112
+ watch(
113
+ loading,
114
+ (isLoading) => {
115
+ if (!isLoading) {
116
+ sessionTimeout.start();
117
+ }
118
+ },
119
+ { immediate: true },
120
+ );
121
+ </script>
122
+
123
+ <template>
124
+ <!-- Session warning modal — only render when open -->
125
+ <SessionWarningModal
126
+ v-if="sessionTimeout.showWarningModal.value"
127
+ :is-open="sessionTimeout.showWarningModal.value"
128
+ :time-remaining="sessionTimeout.timeLeftInSession.value ?? 0"
129
+ @extend-session="handleExtendSession"
130
+ @logout="handleLogout"
131
+ @countdown-expire="handleCountdownExpired"
132
+ />
133
+
134
+ <!-- Session expired alert (shown on the login page) -->
135
+ <SessionExpiredAlert v-if="showExpiredAlert" @dismiss="handleDismissAlert" />
136
+ </template>