@plumile/backoffice-react 0.1.107 → 0.1.109
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.
- package/lib/esm/auth/TotpQrCode.js +1 -1
- package/lib/esm/auth/TotpQrCode.js.map +1 -1
- package/lib/esm/auth/login/EmailCapturePanel.js +27 -23
- package/lib/esm/auth/login/EmailCapturePanel.js.map +1 -1
- package/lib/esm/auth/login/MfaChallengeForm.js +38 -36
- package/lib/esm/auth/login/MfaChallengeForm.js.map +1 -1
- package/lib/esm/auth/login/PasskeyLoginForm.js +40 -37
- package/lib/esm/auth/login/PasskeyLoginForm.js.map +1 -1
- package/lib/esm/auth/pages/AcceptInvitationScreen.js +63 -62
- package/lib/esm/auth/pages/AcceptInvitationScreen.js.map +1 -1
- package/lib/esm/auth/pages/PasswordResetCompleteScreen.js +56 -55
- package/lib/esm/auth/pages/PasswordResetCompleteScreen.js.map +1 -1
- package/lib/esm/auth/pages/PasswordResetRequestScreen.js +45 -45
- package/lib/esm/auth/pages/PasswordResetRequestScreen.js.map +1 -1
- package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js +1 -0
- package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js.map +1 -1
- package/lib/esm/components/backoffice/columns/buildDataTableColumns.js +44 -39
- package/lib/esm/components/backoffice/columns/buildDataTableColumns.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeCopyButton.js +15 -0
- package/lib/esm/components/backoffice/detail/BackofficeCopyButton.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailActionBar.js +11 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailActionBar.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailBlock.js +7 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailBlock.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailHeader.js +15 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailHeader.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailPage.js +19 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailPage.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationLink.js +47 -40
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationLink.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationListBlock.js +83 -90
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationListBlock.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailTable.js +8 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailTable.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeEmptyValue.js +7 -0
- package/lib/esm/components/backoffice/detail/BackofficeEmptyValue.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeStatusGroup.js +8 -0
- package/lib/esm/components/backoffice/detail/BackofficeStatusGroup.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeTechnicalFacts.js +2 -0
- package/lib/esm/components/backoffice/filters/EntityFilterValue.js +16 -8
- package/lib/esm/components/backoffice/filters/EntityFilterValue.js.map +1 -1
- package/lib/esm/components/backoffice/filters/EntityIdFilterField.js +85 -53
- package/lib/esm/components/backoffice/filters/EntityIdFilterField.js.map +1 -1
- package/lib/esm/components/backoffice/filters/entityIdFilterField.css.js +2 -2
- package/lib/esm/components/backoffice/filters/entityIdFilterField.css.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.js +53 -48
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.js +2 -2
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.js +15 -11
- package/lib/esm/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/buildBreadcrumbs.js +50 -23
- package/lib/esm/components/backoffice/layout/breadcrumb/buildBreadcrumbs.js.map +1 -1
- package/lib/esm/components/backoffice/layout/buildSidebarSections.js +69 -69
- package/lib/esm/components/backoffice/layout/sidebarUtils.js +16 -16
- package/lib/esm/components/backoffice/layout/sidebarUtils.js.map +1 -1
- package/lib/esm/components/backoffice/links/BackofficeInlineLink.js +29 -0
- package/lib/esm/components/backoffice/links/BackofficeInlineLink.js.map +1 -0
- package/lib/esm/components/backoffice/links/BackofficeLink.js +21 -0
- package/lib/esm/components/backoffice/links/BackofficeLink.js.map +1 -0
- package/lib/esm/components/backoffice/links/BackofficeLinkContent.js +26 -0
- package/lib/esm/components/backoffice/links/BackofficeLinkContent.js.map +1 -0
- package/lib/esm/components/backoffice/links/BackofficeLinkLabel.js +19 -0
- package/lib/esm/components/backoffice/links/BackofficeLinkLabel.js.map +1 -0
- package/lib/esm/components/backoffice/links/backofficeLink.css.js +7 -0
- package/lib/esm/components/backoffice/links/backofficeLink.css.js.map +1 -0
- package/lib/esm/components/backoffice/links/resolveBackofficeLink.js +81 -0
- package/lib/esm/components/backoffice/links/resolveBackofficeLink.js.map +1 -0
- package/lib/esm/components/backoffice/links/resolveBackofficeTargetIcon.js +50 -0
- package/lib/esm/components/backoffice/links/resolveBackofficeTargetIcon.js.map +1 -0
- package/lib/esm/components/backoffice/links/types.js +0 -0
- package/lib/esm/components/backoffice/links/useBackofficeLink.js +21 -0
- package/lib/esm/components/backoffice/links/useBackofficeLink.js.map +1 -0
- package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js +1 -0
- package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js.map +1 -1
- package/lib/esm/components/backoffice/pickers/entityIdPickerDialog.css.js +2 -2
- package/lib/esm/components/backoffice/pickers/entityIdPickerDialog.css.js.map +1 -1
- package/lib/esm/components/backoffice/pickers/shared/EntityPickerList.js +27 -21
- package/lib/esm/components/backoffice/pickers/shared/EntityPickerList.js.map +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeEntityIdRef.js +27 -27
- package/lib/esm/components/backoffice/refs/BackofficeEntityIdRef.js.map +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeEntityLink.js +24 -21
- package/lib/esm/components/backoffice/refs/BackofficeEntityLink.js.map +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeRelatedCountLink.js +45 -44
- package/lib/esm/components/backoffice/refs/BackofficeRelatedCountLink.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js +277 -227
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js.map +1 -1
- package/lib/esm/components/backoffice/shared/BackofficeFilterableCell.js +25 -30
- package/lib/esm/components/backoffice/shared/BackofficeFilterableCell.js.map +1 -1
- package/lib/esm/i18n/locales/en/backofficeReact.js +8 -0
- package/lib/esm/i18n/locales/en/backofficeReact.js.map +1 -1
- package/lib/esm/i18n/locales/fr/backofficeReact.js +8 -0
- package/lib/esm/i18n/locales/fr/backofficeReact.js.map +1 -1
- package/lib/esm/index.js +88 -73
- package/lib/esm/pages/BackofficeDashboardPage.js +1 -5
- package/lib/esm/pages/BackofficeDashboardPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js +231 -222
- package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.view-helpers.js +170 -54
- package/lib/esm/pages/BackofficeEntityDetailPage.view-helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.js +196 -207
- package/lib/esm/pages/BackofficeEntityListPage.js.map +1 -1
- package/lib/esm/pages/BackofficeHubPage.js +21 -21
- package/lib/esm/pages/BackofficeLayoutPage.js +7 -7
- package/lib/esm/pages/BackofficeLayoutPage.js.map +1 -1
- package/lib/esm/router/createBackofficeRoutes.js +132 -126
- package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
- package/lib/esm/style.css +1 -1
- package/lib/types/auth/login/EmailCapturePanel.d.ts.map +1 -1
- package/lib/types/auth/login/MfaChallengeForm.d.ts.map +1 -1
- package/lib/types/auth/login/PasskeyLoginForm.d.ts.map +1 -1
- package/lib/types/auth/pages/AcceptInvitationScreen.d.ts.map +1 -1
- package/lib/types/auth/pages/PasswordResetCompleteScreen.d.ts.map +1 -1
- package/lib/types/auth/pages/PasswordResetRequestScreen.d.ts.map +1 -1
- package/lib/types/components/backoffice/actions/BackofficeEntityActionFormDialog.d.ts.map +1 -1
- package/lib/types/components/backoffice/columns/buildDataTableColumns.d.ts +0 -1
- package/lib/types/components/backoffice/columns/buildDataTableColumns.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeCopyButton.d.ts +8 -0
- package/lib/types/components/backoffice/detail/BackofficeCopyButton.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailActionBar.d.ts +9 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailActionBar.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailBlock.d.ts +7 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailBlock.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailHeader.d.ts +12 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailHeader.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailPage.d.ts +16 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailPage.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailPage.stories.d.ts +11 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailPage.stories.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailRelationLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailRelationListBlock.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailTable.d.ts +6 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailTable.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeEmptyValue.d.ts +7 -0
- package/lib/types/components/backoffice/detail/BackofficeEmptyValue.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeStatusGroup.d.ts +8 -0
- package/lib/types/components/backoffice/detail/BackofficeStatusGroup.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeTechnicalFacts.d.ts +2 -0
- package/lib/types/components/backoffice/detail/BackofficeTechnicalFacts.d.ts.map +1 -0
- package/lib/types/components/backoffice/filters/EntityFilterValue.d.ts +5 -1
- package/lib/types/components/backoffice/filters/EntityFilterValue.d.ts.map +1 -1
- package/lib/types/components/backoffice/filters/EntityIdFilterField.d.ts +1 -0
- package/lib/types/components/backoffice/filters/EntityIdFilterField.d.ts.map +1 -1
- package/lib/types/components/backoffice/filters/entityIdFilterField.css.d.ts +5 -2
- package/lib/types/components/backoffice/filters/entityIdFilterField.css.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.d.ts +1 -0
- package/lib/types/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/buildBreadcrumbs.d.ts +10 -8
- package/lib/types/components/backoffice/layout/breadcrumb/buildBreadcrumbs.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/types.d.ts +10 -5
- package/lib/types/components/backoffice/layout/breadcrumb/types.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/sidebarUtils.d.ts +6 -2
- package/lib/types/components/backoffice/layout/sidebarUtils.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/BackofficeInlineLink.d.ts +18 -0
- package/lib/types/components/backoffice/links/BackofficeInlineLink.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/BackofficeLink.d.ts +13 -0
- package/lib/types/components/backoffice/links/BackofficeLink.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/BackofficeLinkContent.d.ts +10 -0
- package/lib/types/components/backoffice/links/BackofficeLinkContent.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/BackofficeLinkLabel.d.ts +12 -0
- package/lib/types/components/backoffice/links/BackofficeLinkLabel.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/backofficeLink.css.d.ts +4 -0
- package/lib/types/components/backoffice/links/backofficeLink.css.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/resolveBackofficeLink.d.ts +15 -0
- package/lib/types/components/backoffice/links/resolveBackofficeLink.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/resolveBackofficeTargetIcon.d.ts +8 -0
- package/lib/types/components/backoffice/links/resolveBackofficeTargetIcon.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/types.d.ts +45 -0
- package/lib/types/components/backoffice/links/types.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/useBackofficeLink.d.ts +7 -0
- package/lib/types/components/backoffice/links/useBackofficeLink.d.ts.map +1 -0
- package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.d.ts.map +1 -1
- package/lib/types/components/backoffice/pickers/entityIdPickerDialog.css.d.ts +2 -0
- package/lib/types/components/backoffice/pickers/entityIdPickerDialog.css.d.ts.map +1 -1
- package/lib/types/components/backoffice/pickers/shared/EntityPickerList.d.ts.map +1 -1
- package/lib/types/components/backoffice/refs/BackofficeEntityLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/refs/BackofficeRelatedCountLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts.map +1 -1
- package/lib/types/components/backoffice/shared/BackofficeFilterableCell.d.ts +6 -3
- package/lib/types/components/backoffice/shared/BackofficeFilterableCell.d.ts.map +1 -1
- package/lib/types/i18n/resources.d.ts +16 -0
- package/lib/types/i18n/resources.d.ts.map +1 -1
- package/lib/types/index.d.ts +24 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts +49 -22
- package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListPage.d.ts.map +1 -1
- package/lib/types/provider/types.d.ts +26 -22
- package/lib/types/provider/types.d.ts.map +1 -1
- package/lib/types/router/createBackofficeRoutes.d.ts +36 -1
- package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import t from "react-qr-code";
|
|
2
|
+
import { QRCode as t } from "react-qr-code";
|
|
3
3
|
//#region src/auth/TotpQrCode.tsx
|
|
4
4
|
function n({ secret: e, issuer: t, accountName: n, algorithm: r = "SHA1", digits: i = 6, period: a = 30 }) {
|
|
5
5
|
let o = n ?? t, s = new URLSearchParams({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TotpQrCode.js","names":[],"sources":["../../../src/auth/TotpQrCode.tsx"],"sourcesContent":["import type { JSX } from 'react';\nimport QRCode from 'react-qr-code';\n\nexport type BuildTotpOtpAuthUriOptions = {\n secret: string;\n issuer: string;\n accountName?: string;\n algorithm?: string;\n digits?: number;\n period?: number;\n};\n\nexport type TotpQrCodeProps = BuildTotpOtpAuthUriOptions & {\n otpauthUrl?: string;\n size?: number;\n};\n\n/**\n *\n */\nexport function buildTotpOtpAuthUri({\n secret,\n issuer,\n accountName,\n algorithm = 'SHA1',\n digits = 6,\n period = 30,\n}: BuildTotpOtpAuthUriOptions): string {\n const label = accountName ?? issuer;\n const params = new URLSearchParams({\n secret,\n issuer,\n algorithm,\n digits: String(digits),\n period: String(period),\n });\n\n return `otpauth://totp/${encodeURIComponent(label)}?${params.toString()}`;\n}\n\nexport const TotpQrCode = ({\n secret,\n issuer,\n accountName,\n otpauthUrl,\n size = 220,\n algorithm,\n digits,\n period,\n}: TotpQrCodeProps): JSX.Element => {\n const otpAuthUri =\n otpauthUrl ??\n buildTotpOtpAuthUri({\n secret,\n issuer,\n accountName,\n algorithm,\n digits,\n period,\n });\n\n return <QRCode value={otpAuthUri} size={size} />;\n};\n\nexport default TotpQrCode;\n"],"mappings":";;;AAoBA,SAAgB,EAAoB,EAClC,WACA,WACA,gBACA,eAAY,QACZ,YAAS,GACT,YAAS,MAC4B;CACrC,IAAM,IAAQ,KAAe,GACvB,IAAS,IAAI,gBAAgB;EACjC;EACA;EACA;EACA,QAAQ,OAAO,EAAO;EACtB,QAAQ,OAAO,EAAO;EACvB,CAAC;CAEF,OAAO,kBAAkB,mBAAmB,EAAM,CAAC,GAAG,EAAO,UAAU;;AAGzE,IAAa,KAAc,EACzB,WACA,WACA,gBACA,eACA,UAAO,KACP,cACA,WACA,gBAaO,kBAAC,GAAD;CAAQ,OAVb,KACA,EAAoB;EAClB;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAEoC;CAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"TotpQrCode.js","names":[],"sources":["../../../src/auth/TotpQrCode.tsx"],"sourcesContent":["import type { JSX } from 'react';\nimport { QRCode } from 'react-qr-code';\n\nexport type BuildTotpOtpAuthUriOptions = {\n secret: string;\n issuer: string;\n accountName?: string;\n algorithm?: string;\n digits?: number;\n period?: number;\n};\n\nexport type TotpQrCodeProps = BuildTotpOtpAuthUriOptions & {\n otpauthUrl?: string;\n size?: number;\n};\n\n/**\n *\n */\nexport function buildTotpOtpAuthUri({\n secret,\n issuer,\n accountName,\n algorithm = 'SHA1',\n digits = 6,\n period = 30,\n}: BuildTotpOtpAuthUriOptions): string {\n const label = accountName ?? issuer;\n const params = new URLSearchParams({\n secret,\n issuer,\n algorithm,\n digits: String(digits),\n period: String(period),\n });\n\n return `otpauth://totp/${encodeURIComponent(label)}?${params.toString()}`;\n}\n\nexport const TotpQrCode = ({\n secret,\n issuer,\n accountName,\n otpauthUrl,\n size = 220,\n algorithm,\n digits,\n period,\n}: TotpQrCodeProps): JSX.Element => {\n const otpAuthUri =\n otpauthUrl ??\n buildTotpOtpAuthUri({\n secret,\n issuer,\n accountName,\n algorithm,\n digits,\n period,\n });\n\n return <QRCode value={otpAuthUri} size={size} />;\n};\n\nexport default TotpQrCode;\n"],"mappings":";;;AAoBA,SAAgB,EAAoB,EAClC,WACA,WACA,gBACA,eAAY,QACZ,YAAS,GACT,YAAS,MAC4B;CACrC,IAAM,IAAQ,KAAe,GACvB,IAAS,IAAI,gBAAgB;EACjC;EACA;EACA;EACA,QAAQ,OAAO,EAAO;EACtB,QAAQ,OAAO,EAAO;EACvB,CAAC;CAEF,OAAO,kBAAkB,mBAAmB,EAAM,CAAC,GAAG,EAAO,UAAU;;AAGzE,IAAa,KAAc,EACzB,WACA,WACA,gBACA,eACA,UAAO,KACP,cACA,WACA,gBAaO,kBAAC,GAAD;CAAQ,OAVb,KACA,EAAoB;EAClB;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAEoC;CAAQ,CAAA"}
|
|
@@ -1,50 +1,54 @@
|
|
|
1
1
|
import { actionsRow as e, formSurface as t, helper as n, inlineLink as r } from "./loginPage.css.js";
|
|
2
2
|
import { AuthPanel as i } from "./AuthPanel.js";
|
|
3
3
|
import { useBackofficeReactTranslation as a } from "../../i18n/useBackofficeReactTranslation.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useCallback as o } from "react";
|
|
5
|
+
import { Button as s, Form as c, FormError as l, FormField as u } from "@plumile/ui";
|
|
6
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
6
7
|
//#region src/auth/login/EmailCapturePanel.tsx
|
|
7
|
-
var
|
|
8
|
-
let { t:
|
|
9
|
-
return /* @__PURE__ */
|
|
8
|
+
var p = ({ email: p, errorMessage: m, isLoading: h, onEmailChange: g, onContinue: _, onForgotPassword: v }) => {
|
|
9
|
+
let { t: y } = a();
|
|
10
|
+
return /* @__PURE__ */ d(i, { children: /* @__PURE__ */ f(c, {
|
|
10
11
|
className: t,
|
|
12
|
+
onSubmit: o((e) => {
|
|
13
|
+
e.preventDefault(), _();
|
|
14
|
+
}, [_]),
|
|
15
|
+
initialFocus: "first-form-control",
|
|
11
16
|
children: [
|
|
12
|
-
/* @__PURE__ */
|
|
17
|
+
/* @__PURE__ */ d("p", {
|
|
13
18
|
className: n,
|
|
14
|
-
children:
|
|
19
|
+
children: y("auth.emailCapture.description")
|
|
15
20
|
}),
|
|
16
|
-
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
label:
|
|
21
|
+
m != null && /* @__PURE__ */ d(l, { children: m }),
|
|
22
|
+
/* @__PURE__ */ d(u, {
|
|
23
|
+
label: y("auth.emailCapture.emailLabel"),
|
|
19
24
|
name: "email",
|
|
20
25
|
type: "email",
|
|
21
|
-
value:
|
|
26
|
+
value: p,
|
|
22
27
|
onChange: (e) => {
|
|
23
|
-
|
|
28
|
+
g(e.target.value);
|
|
24
29
|
},
|
|
25
|
-
placeholder:
|
|
30
|
+
placeholder: y("auth.emailCapture.emailPlaceholder"),
|
|
26
31
|
autoComplete: "email",
|
|
27
32
|
required: !0
|
|
28
33
|
}),
|
|
29
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ f("div", {
|
|
30
35
|
className: e,
|
|
31
|
-
children: [/* @__PURE__ */
|
|
32
|
-
type: "
|
|
36
|
+
children: [/* @__PURE__ */ d(s, {
|
|
37
|
+
type: "submit",
|
|
33
38
|
variant: "primary",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}), /* @__PURE__ */ l("button", {
|
|
39
|
+
isLoading: h,
|
|
40
|
+
children: y("auth.emailCapture.continue")
|
|
41
|
+
}), /* @__PURE__ */ d("button", {
|
|
38
42
|
type: "button",
|
|
39
43
|
className: r,
|
|
40
|
-
onClick:
|
|
41
|
-
children:
|
|
44
|
+
onClick: v,
|
|
45
|
+
children: y("auth.emailCapture.forgotPassword")
|
|
42
46
|
})]
|
|
43
47
|
})
|
|
44
48
|
]
|
|
45
49
|
}) });
|
|
46
50
|
};
|
|
47
51
|
//#endregion
|
|
48
|
-
export {
|
|
52
|
+
export { p as EmailCapturePanel };
|
|
49
53
|
|
|
50
54
|
//# sourceMappingURL=EmailCapturePanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailCapturePanel.js","names":[],"sources":["../../../../src/auth/login/EmailCapturePanel.tsx"],"sourcesContent":["import { type JSX } from 'react';\nimport { useBackofficeReactTranslation } from '../../i18n/useBackofficeReactTranslation.js';\n\nimport { Button, FormError, FormField } from '@plumile/ui';\n\nimport { AuthPanel } from './AuthPanel.js';\nimport * as styles from './loginPage.css.js';\n\ntype Props = {\n email: string;\n errorMessage: string | null;\n isLoading: boolean;\n onEmailChange: (value: string) => void;\n onContinue: () => void;\n onForgotPassword: () => void;\n};\n\nexport const EmailCapturePanel = ({\n email,\n errorMessage,\n isLoading,\n onEmailChange,\n onContinue,\n onForgotPassword,\n}: Props): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n return (\n <AuthPanel>\n <
|
|
1
|
+
{"version":3,"file":"EmailCapturePanel.js","names":[],"sources":["../../../../src/auth/login/EmailCapturePanel.tsx"],"sourcesContent":["import { useCallback, type FormEvent, type JSX } from 'react';\nimport { useBackofficeReactTranslation } from '../../i18n/useBackofficeReactTranslation.js';\n\nimport { Button, Form, FormError, FormField } from '@plumile/ui';\n\nimport { AuthPanel } from './AuthPanel.js';\nimport * as styles from './loginPage.css.js';\n\ntype Props = {\n email: string;\n errorMessage: string | null;\n isLoading: boolean;\n onEmailChange: (value: string) => void;\n onContinue: () => void;\n onForgotPassword: () => void;\n};\n\nexport const EmailCapturePanel = ({\n email,\n errorMessage,\n isLoading,\n onEmailChange,\n onContinue,\n onForgotPassword,\n}: Props): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n const handleSubmit = useCallback(\n (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n onContinue();\n },\n [onContinue],\n );\n\n return (\n <AuthPanel>\n <Form\n className={styles.formSurface}\n onSubmit={handleSubmit}\n initialFocus=\"first-form-control\"\n >\n <p className={styles.helper}>{t('auth.emailCapture.description')}</p>\n {errorMessage != null && <FormError>{errorMessage}</FormError>}\n <FormField\n label={t('auth.emailCapture.emailLabel')}\n name=\"email\"\n type=\"email\"\n value={email}\n onChange={(event) => {\n onEmailChange(event.target.value);\n }}\n placeholder={t('auth.emailCapture.emailPlaceholder')}\n autoComplete=\"email\"\n required\n />\n <div className={styles.actionsRow}>\n <Button type=\"submit\" variant=\"primary\" isLoading={isLoading}>\n {t('auth.emailCapture.continue')}\n </Button>\n <button\n type=\"button\"\n className={styles.inlineLink}\n onClick={onForgotPassword}\n >\n {t('auth.emailCapture.forgotPassword')}\n </button>\n </div>\n </Form>\n </AuthPanel>\n );\n};\n"],"mappings":";;;;;;;AAiBA,IAAa,KAAqB,EAChC,UACA,iBACA,cACA,kBACA,eACA,0BACwB;CACxB,IAAM,EAAE,SAAM,GAA+B;CAS7C,OACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EACE,WAAW;EACX,UAZe,GAClB,MAAsC;GAErC,AADA,EAAM,gBAAgB,EACtB,GAAY;KAEd,CAAC,EAAW,CAOE;EACV,cAAa;YAHf;GAKE,kBAAC,KAAD;IAAG,WAAW;cAAgB,EAAE,gCAAgC;IAAK,CAAA;GACpE,KAAgB,QAAQ,kBAAC,GAAD,EAAA,UAAY,GAAyB,CAAA;GAC9D,kBAAC,GAAD;IACE,OAAO,EAAE,+BAA+B;IACxC,MAAK;IACL,MAAK;IACL,OAAO;IACP,WAAW,MAAU;KACnB,EAAc,EAAM,OAAO,MAAM;;IAEnC,aAAa,EAAE,qCAAqC;IACpD,cAAa;IACb,UAAA;IACA,CAAA;GACF,kBAAC,OAAD;IAAK,WAAW;cAAhB,CACE,kBAAC,GAAD;KAAQ,MAAK;KAAS,SAAQ;KAAqB;eAChD,EAAE,6BAA6B;KACzB,CAAA,EACT,kBAAC,UAAD;KACE,MAAK;KACL,WAAW;KACX,SAAS;eAER,EAAE,mCAAmC;KAC/B,CAAA,CACL;;GACD;KACG,CAAA"}
|
|
@@ -1,80 +1,82 @@
|
|
|
1
1
|
import { actionsRow as e, formSurface as t, helper as n, inlineLink as r, stack as i } from "./loginPage.css.js";
|
|
2
2
|
import { useBackofficeReactTranslation as a } from "../../i18n/useBackofficeReactTranslation.js";
|
|
3
3
|
import { useCallback as o, useEffect as s, useState as c } from "react";
|
|
4
|
-
import { Button as l,
|
|
5
|
-
import { jsx as
|
|
4
|
+
import { Button as l, Form as u, FormError as d, FormField as f } from "@plumile/ui";
|
|
5
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
6
6
|
//#region src/auth/login/MfaChallengeForm.tsx
|
|
7
|
-
var
|
|
8
|
-
let { t:
|
|
7
|
+
var h = ({ auth: h, onSuccess: g, onBack: _ }) => {
|
|
8
|
+
let { t: v } = a(), [y, b] = c(""), [x, S] = c(null);
|
|
9
9
|
s(() => {
|
|
10
|
-
|
|
11
|
-
}, [
|
|
12
|
-
let
|
|
13
|
-
e.preventDefault(),
|
|
14
|
-
let t =
|
|
10
|
+
h.clearError(), S(null);
|
|
11
|
+
}, [h]);
|
|
12
|
+
let C = o(async (e) => {
|
|
13
|
+
e.preventDefault(), S(null);
|
|
14
|
+
let t = y.trim();
|
|
15
15
|
if (t.length < 4) {
|
|
16
|
-
|
|
16
|
+
S(v("auth.mfa.errors.shortCode"));
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
try {
|
|
20
20
|
let e = { code: t };
|
|
21
|
-
await
|
|
21
|
+
await h.completeMfa(e), g();
|
|
22
22
|
} catch {
|
|
23
|
-
|
|
23
|
+
S(v("auth.mfa.errors.verificationFailed"));
|
|
24
24
|
}
|
|
25
25
|
}, [
|
|
26
|
-
m,
|
|
27
|
-
v,
|
|
28
26
|
h,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
y,
|
|
28
|
+
g,
|
|
29
|
+
v
|
|
30
|
+
]), w = h.emailHint == null ? v("auth.mfa.helper.default") : v("auth.mfa.helper.withEmail", { email: h.emailHint }), T = x;
|
|
31
|
+
return /* @__PURE__ */ m(u, {
|
|
32
32
|
className: t,
|
|
33
|
-
onSubmit:
|
|
33
|
+
onSubmit: o((e) => {
|
|
34
|
+
C(e).catch(() => {});
|
|
35
|
+
}, [C]),
|
|
34
36
|
noValidate: !0,
|
|
35
|
-
|
|
37
|
+
initialFocus: "first-form-control",
|
|
38
|
+
children: [/* @__PURE__ */ m("div", {
|
|
36
39
|
className: i,
|
|
37
40
|
children: [
|
|
38
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ p("p", {
|
|
39
42
|
className: n,
|
|
40
|
-
children:
|
|
43
|
+
children: w
|
|
41
44
|
}),
|
|
42
|
-
|
|
43
|
-
/* @__PURE__ */ f
|
|
44
|
-
label:
|
|
45
|
+
T == null ? null : /* @__PURE__ */ p(d, { children: T }),
|
|
46
|
+
/* @__PURE__ */ p(f, {
|
|
47
|
+
label: v("auth.mfa.form.label"),
|
|
45
48
|
name: "code",
|
|
46
49
|
type: "text",
|
|
47
|
-
value:
|
|
50
|
+
value: y,
|
|
48
51
|
onChange: (e) => {
|
|
49
|
-
|
|
52
|
+
b(e.target.value), S(null);
|
|
50
53
|
},
|
|
51
|
-
placeholder:
|
|
54
|
+
placeholder: v("auth.mfa.form.placeholder"),
|
|
52
55
|
autoComplete: "one-time-code",
|
|
53
|
-
autoFocus: !0,
|
|
54
56
|
required: !0
|
|
55
57
|
})
|
|
56
58
|
]
|
|
57
|
-
}), /* @__PURE__ */
|
|
59
|
+
}), /* @__PURE__ */ m("div", {
|
|
58
60
|
className: e,
|
|
59
|
-
children: [/* @__PURE__ */
|
|
61
|
+
children: [/* @__PURE__ */ p(l, {
|
|
60
62
|
type: "button",
|
|
61
63
|
variant: "text",
|
|
62
64
|
size: "small",
|
|
63
65
|
className: r,
|
|
64
66
|
onClick: () => {
|
|
65
|
-
|
|
67
|
+
h.reset(), _();
|
|
66
68
|
},
|
|
67
|
-
children:
|
|
68
|
-
}), /* @__PURE__ */
|
|
69
|
+
children: v("auth.mfa.actions.back")
|
|
70
|
+
}), /* @__PURE__ */ p(l, {
|
|
69
71
|
type: "submit",
|
|
70
72
|
size: "large",
|
|
71
|
-
isLoading:
|
|
72
|
-
children:
|
|
73
|
+
isLoading: h.isLoading,
|
|
74
|
+
children: v("auth.mfa.actions.submit")
|
|
73
75
|
})]
|
|
74
76
|
})]
|
|
75
77
|
});
|
|
76
78
|
};
|
|
77
79
|
//#endregion
|
|
78
|
-
export {
|
|
80
|
+
export { h as MfaChallengeForm };
|
|
79
81
|
|
|
80
82
|
//# sourceMappingURL=MfaChallengeForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MfaChallengeForm.js","names":[],"sources":["../../../../src/auth/login/MfaChallengeForm.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport {\n useCallback,\n useEffect,\n useState,\n type FormEvent,\n type JSX,\n} from 'react';\nimport { useBackofficeReactTranslation } from '../../i18n/useBackofficeReactTranslation.js';\n\nimport { Button, FormError, FormField } from '@plumile/ui';\n\nimport type { TotpCredentials, UseAuthReturn } from '../../hooks/useAuth.js';\n\nimport * as styles from './loginPage.css.js';\n\ntype Props = {\n auth: Pick<\n UseAuthReturn,\n 'completeMfa' | 'isLoading' | 'error' | 'emailHint' | 'reset' | 'clearError'\n >;\n onSuccess: () => void;\n onBack: () => void;\n};\n\nexport const MfaChallengeForm = ({\n auth,\n onSuccess,\n onBack,\n}: Props): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n const [code, setCode] = useState('');\n const [localError, setLocalError] = useState<string | null>(null);\n\n // Clear any stale errors when the MFA form is shown\n useEffect(() => {\n auth.clearError();\n setLocalError(null);\n }, [auth]);\n\n const handleSubmit = useCallback(\n async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n setLocalError(null);\n\n const trimmed = code.trim();\n if (trimmed.length < 4) {\n setLocalError(t('auth.mfa.errors.shortCode'));\n return;\n }\n\n try {\n const credentials: TotpCredentials = {\n code: trimmed,\n };\n await auth.completeMfa(credentials);\n onSuccess();\n } catch {\n setLocalError(t('auth.mfa.errors.verificationFailed'));\n }\n },\n [auth, code, onSuccess, t],\n );\n\n const helper =\n auth.emailHint != null\n ? t('auth.mfa.helper.withEmail', { email: auth.emailHint })\n : t('auth.mfa.helper.default');\n\n const formError = localError;\n\n
|
|
1
|
+
{"version":3,"file":"MfaChallengeForm.js","names":[],"sources":["../../../../src/auth/login/MfaChallengeForm.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport {\n useCallback,\n useEffect,\n useState,\n type FormEvent,\n type JSX,\n} from 'react';\nimport { useBackofficeReactTranslation } from '../../i18n/useBackofficeReactTranslation.js';\n\nimport { Button, Form, FormError, FormField } from '@plumile/ui';\n\nimport type { TotpCredentials, UseAuthReturn } from '../../hooks/useAuth.js';\n\nimport * as styles from './loginPage.css.js';\n\ntype Props = {\n auth: Pick<\n UseAuthReturn,\n 'completeMfa' | 'isLoading' | 'error' | 'emailHint' | 'reset' | 'clearError'\n >;\n onSuccess: () => void;\n onBack: () => void;\n};\n\nexport const MfaChallengeForm = ({\n auth,\n onSuccess,\n onBack,\n}: Props): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n const [code, setCode] = useState('');\n const [localError, setLocalError] = useState<string | null>(null);\n\n // Clear any stale errors when the MFA form is shown\n useEffect(() => {\n auth.clearError();\n setLocalError(null);\n }, [auth]);\n\n const handleSubmit = useCallback(\n async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n setLocalError(null);\n\n const trimmed = code.trim();\n if (trimmed.length < 4) {\n setLocalError(t('auth.mfa.errors.shortCode'));\n return;\n }\n\n try {\n const credentials: TotpCredentials = {\n code: trimmed,\n };\n await auth.completeMfa(credentials);\n onSuccess();\n } catch {\n setLocalError(t('auth.mfa.errors.verificationFailed'));\n }\n },\n [auth, code, onSuccess, t],\n );\n\n const helper =\n auth.emailHint != null\n ? t('auth.mfa.helper.withEmail', { email: auth.emailHint })\n : t('auth.mfa.helper.default');\n\n const formError = localError;\n\n const handleSubmitEvent = useCallback(\n (event: FormEvent<HTMLFormElement>) => {\n handleSubmit(event).catch(() => {\n return undefined;\n });\n },\n [handleSubmit],\n );\n\n return (\n <Form\n className={styles.formSurface}\n onSubmit={handleSubmitEvent}\n noValidate\n initialFocus=\"first-form-control\"\n >\n <div className={styles.stack}>\n <p className={styles.helper}>{helper}</p>\n {formError != null ? <FormError>{formError}</FormError> : null}\n <FormField\n label={t('auth.mfa.form.label')}\n name=\"code\"\n type=\"text\"\n value={code}\n onChange={(event) => {\n setCode(event.target.value);\n setLocalError(null);\n }}\n placeholder={t('auth.mfa.form.placeholder')}\n autoComplete=\"one-time-code\"\n required\n />\n </div>\n <div className={styles.actionsRow}>\n <Button\n type=\"button\"\n variant=\"text\"\n size=\"small\"\n className={styles.inlineLink}\n onClick={() => {\n auth.reset();\n onBack();\n }}\n >\n {t('auth.mfa.actions.back')}\n </Button>\n <Button type=\"submit\" size=\"large\" isLoading={auth.isLoading}>\n {t('auth.mfa.actions.submit')}\n </Button>\n </div>\n </Form>\n );\n};\n"],"mappings":";;;;;;AAyBA,IAAa,KAAoB,EAC/B,SACA,cACA,gBACwB;CACxB,IAAM,EAAE,SAAM,GAA+B,EACvC,CAAC,GAAM,KAAW,EAAS,GAAG,EAC9B,CAAC,GAAY,KAAiB,EAAwB,KAAK;CAGjE,QAAgB;EAEd,AADA,EAAK,YAAY,EACjB,EAAc,KAAK;IAClB,CAAC,EAAK,CAAC;CAEV,IAAM,IAAe,EACnB,OAAO,MAAsC;EAE3C,AADA,EAAM,gBAAgB,EACtB,EAAc,KAAK;EAEnB,IAAM,IAAU,EAAK,MAAM;EAC3B,IAAI,EAAQ,SAAS,GAAG;GACtB,EAAc,EAAE,4BAA4B,CAAC;GAC7C;;EAGF,IAAI;GACF,IAAM,IAA+B,EACnC,MAAM,GACP;GAED,AADA,MAAM,EAAK,YAAY,EAAY,EACnC,GAAW;UACL;GACN,EAAc,EAAE,qCAAqC,CAAC;;IAG1D;EAAC;EAAM;EAAM;EAAW;EAAE,CAC3B,EAEK,IACJ,EAAK,aAAa,OAEd,EAAE,0BAA0B,GAD5B,EAAE,6BAA6B,EAAE,OAAO,EAAK,WAAW,CAAC,EAGzD,IAAY;CAWlB,OACE,kBAAC,GAAD;EACE,WAAW;EACX,UAZsB,GACvB,MAAsC;GACrC,EAAa,EAAM,CAAC,YAAY,GAE9B;KAEJ,CAAC,EAAa,CAMF;EACV,YAAA;EACA,cAAa;YAJf,CAME,kBAAC,OAAD;GAAK,WAAW;aAAhB;IACE,kBAAC,KAAD;KAAG,WAAW;eAAgB;KAAW,CAAA;IACxC,KAAa,OAA4C,OAArC,kBAAC,GAAD,EAAA,UAAY,GAAsB,CAAA;IACvD,kBAAC,GAAD;KACE,OAAO,EAAE,sBAAsB;KAC/B,MAAK;KACL,MAAK;KACL,OAAO;KACP,WAAW,MAAU;MAEnB,AADA,EAAQ,EAAM,OAAO,MAAM,EAC3B,EAAc,KAAK;;KAErB,aAAa,EAAE,4BAA4B;KAC3C,cAAa;KACb,UAAA;KACA,CAAA;IACE;MACN,kBAAC,OAAD;GAAK,WAAW;aAAhB,CACE,kBAAC,GAAD;IACE,MAAK;IACL,SAAQ;IACR,MAAK;IACL,WAAW;IACX,eAAe;KAEb,AADA,EAAK,OAAO,EACZ,GAAQ;;cAGT,EAAE,wBAAwB;IACpB,CAAA,EACT,kBAAC,GAAD;IAAQ,MAAK;IAAS,MAAK;IAAQ,WAAW,EAAK;cAChD,EAAE,0BAA0B;IACtB,CAAA,CACL;KACD"}
|
|
@@ -1,81 +1,84 @@
|
|
|
1
1
|
import { actionsRow as e, formSurface as t, helper as n, inlineLink as r, stack as i } from "./loginPage.css.js";
|
|
2
2
|
import { useBackofficeReactTranslation as a } from "../../i18n/useBackofficeReactTranslation.js";
|
|
3
3
|
import { useCallback as o, useEffect as s, useState as c } from "react";
|
|
4
|
-
import { Button as l,
|
|
5
|
-
import { jsx as
|
|
4
|
+
import { Button as l, Form as u, FormError as d, FormField as f } from "@plumile/ui";
|
|
5
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
6
6
|
//#region src/auth/login/PasskeyLoginForm.tsx
|
|
7
|
-
var
|
|
8
|
-
let { t:
|
|
7
|
+
var h = ({ auth: h, onSuccess: g, defaultEmail: _, isAttemptingPasskey: v = !1, onShowMethods: y }) => {
|
|
8
|
+
let { t: b } = a(), [x, S] = c(h.emailHint ?? ""), [C, w] = c(null);
|
|
9
9
|
s(() => {
|
|
10
|
-
|
|
11
|
-
}, [
|
|
12
|
-
let
|
|
13
|
-
if (e.preventDefault(),
|
|
14
|
-
|
|
10
|
+
h.emailHint != null && h.emailHint !== "" ? S(h.emailHint) : _ != null && _ !== "" && S(_);
|
|
11
|
+
}, [h.emailHint, _]);
|
|
12
|
+
let T = o(async (e) => {
|
|
13
|
+
if (e.preventDefault(), w(null), x.trim() === "") {
|
|
14
|
+
w(b("auth.passkey.errors.emailRequired"));
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
try {
|
|
18
|
-
let e = await
|
|
18
|
+
let e = await h.beginAuthentication(x.trim());
|
|
19
19
|
if (Array.isArray(e.methods) && e.methods.length === 0) {
|
|
20
|
-
|
|
20
|
+
w(e.lockedUntil == null ? b("auth.passkey.errors.locked") : b("auth.passkey.errors.lockedWithTime", { time: new Date(e.lockedUntil).toLocaleString() }));
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
if (Array.isArray(e.methods) && !e.methods.includes("PASSKEY")) {
|
|
24
|
-
|
|
24
|
+
w(b("auth.passkey.errors.notAvailable"));
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
await
|
|
27
|
+
await h.loginWithPasskey({ email: x.trim() }) === "success" && g();
|
|
28
28
|
} catch {
|
|
29
|
-
|
|
29
|
+
w(b("auth.passkey.errors.failed"));
|
|
30
30
|
}
|
|
31
31
|
}, [
|
|
32
|
-
m,
|
|
33
|
-
b,
|
|
34
32
|
h,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
x,
|
|
34
|
+
g,
|
|
35
|
+
b
|
|
36
|
+
]), E = C;
|
|
37
|
+
return /* @__PURE__ */ m(u, {
|
|
38
38
|
className: t,
|
|
39
|
-
onSubmit:
|
|
39
|
+
onSubmit: o((e) => {
|
|
40
|
+
T(e).catch(() => {});
|
|
41
|
+
}, [T]),
|
|
40
42
|
noValidate: !0,
|
|
41
|
-
|
|
43
|
+
initialFocus: "first-form-control",
|
|
44
|
+
children: [/* @__PURE__ */ m("div", {
|
|
42
45
|
className: i,
|
|
43
46
|
children: [
|
|
44
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ p("p", {
|
|
45
48
|
className: n,
|
|
46
|
-
children:
|
|
49
|
+
children: b("auth.passkey.helper")
|
|
47
50
|
}),
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */ f
|
|
50
|
-
label:
|
|
51
|
+
E == null ? null : /* @__PURE__ */ p(d, { children: E }),
|
|
52
|
+
/* @__PURE__ */ p(f, {
|
|
53
|
+
label: b("auth.passkey.form.emailLabel"),
|
|
51
54
|
name: "passkey-email",
|
|
52
55
|
type: "email",
|
|
53
|
-
value:
|
|
56
|
+
value: x,
|
|
54
57
|
onChange: (e) => {
|
|
55
|
-
|
|
58
|
+
S(e.target.value), w(null);
|
|
56
59
|
},
|
|
57
|
-
placeholder:
|
|
60
|
+
placeholder: b("auth.passkey.form.emailPlaceholder"),
|
|
58
61
|
autoComplete: "email",
|
|
59
62
|
required: !0
|
|
60
63
|
})
|
|
61
64
|
]
|
|
62
|
-
}), /* @__PURE__ */
|
|
65
|
+
}), /* @__PURE__ */ m("div", {
|
|
63
66
|
className: e,
|
|
64
|
-
children: [/* @__PURE__ */
|
|
67
|
+
children: [/* @__PURE__ */ p(l, {
|
|
65
68
|
type: "submit",
|
|
66
69
|
variant: "primary",
|
|
67
|
-
isLoading:
|
|
68
|
-
children:
|
|
69
|
-
}),
|
|
70
|
+
isLoading: h.isLoading,
|
|
71
|
+
children: b(v ? "auth.passkey.actions.submitting" : "auth.passkey.actions.submit")
|
|
72
|
+
}), y == null ? null : /* @__PURE__ */ p("button", {
|
|
70
73
|
type: "button",
|
|
71
74
|
className: r,
|
|
72
|
-
onClick:
|
|
73
|
-
children:
|
|
75
|
+
onClick: y,
|
|
76
|
+
children: b("auth.passkey.actions.showMethods")
|
|
74
77
|
})]
|
|
75
78
|
})]
|
|
76
79
|
});
|
|
77
80
|
};
|
|
78
81
|
//#endregion
|
|
79
|
-
export {
|
|
82
|
+
export { h as PasskeyLoginForm };
|
|
80
83
|
|
|
81
84
|
//# sourceMappingURL=PasskeyLoginForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasskeyLoginForm.js","names":[],"sources":["../../../../src/auth/login/PasskeyLoginForm.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport {\n useCallback,\n useEffect,\n useState,\n type FormEvent,\n type JSX,\n} from 'react';\nimport { useBackofficeReactTranslation } from '../../i18n/useBackofficeReactTranslation.js';\n\nimport { Button, FormError, FormField } from '@plumile/ui';\n\nimport type { UseAuthReturn } from '../../hooks/useAuth.js';\n\nimport * as styles from './loginPage.css.js';\n\ntype Props = {\n auth: Pick<\n UseAuthReturn,\n | 'loginWithPasskey'\n | 'isLoading'\n | 'error'\n | 'emailHint'\n | 'nextStep'\n | 'beginAuthentication'\n | 'lockedUntil'\n | 'availableMethods'\n >;\n onSuccess: () => void;\n defaultEmail?: string;\n isAttemptingPasskey?: boolean;\n onShowMethods?: () => void;\n};\n\nexport const PasskeyLoginForm = ({\n auth,\n onSuccess,\n defaultEmail,\n isAttemptingPasskey = false,\n onShowMethods,\n}: Props): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n const [email, setEmail] = useState(auth.emailHint ?? '');\n const [localError, setLocalError] = useState<string | null>(null);\n\n useEffect(() => {\n if (auth.emailHint != null && auth.emailHint !== '') {\n setEmail(auth.emailHint);\n } else if (defaultEmail != null && defaultEmail !== '') {\n setEmail(defaultEmail);\n }\n }, [auth.emailHint, defaultEmail]);\n\n const handleSubmit = useCallback(\n async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n setLocalError(null);\n\n if (email.trim() === '') {\n setLocalError(t('auth.passkey.errors.emailRequired'));\n return;\n }\n\n try {\n const result = await auth.beginAuthentication(email.trim());\n if (Array.isArray(result.methods) && result.methods.length === 0) {\n const lockedUntilMessage =\n result.lockedUntil != null\n ? t('auth.passkey.errors.lockedWithTime', {\n time: new Date(result.lockedUntil).toLocaleString(),\n })\n : t('auth.passkey.errors.locked');\n setLocalError(lockedUntilMessage);\n return;\n }\n if (\n Array.isArray(result.methods) &&\n !result.methods.includes('PASSKEY')\n ) {\n setLocalError(t('auth.passkey.errors.notAvailable'));\n return;\n }\n\n const status = await auth.loginWithPasskey({ email: email.trim() });\n if (status === 'success') {\n onSuccess();\n }\n } catch {\n setLocalError(t('auth.passkey.errors.failed'));\n }\n },\n [auth, email, onSuccess, t],\n );\n\n const formError = localError;\n\n
|
|
1
|
+
{"version":3,"file":"PasskeyLoginForm.js","names":[],"sources":["../../../../src/auth/login/PasskeyLoginForm.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport {\n useCallback,\n useEffect,\n useState,\n type FormEvent,\n type JSX,\n} from 'react';\nimport { useBackofficeReactTranslation } from '../../i18n/useBackofficeReactTranslation.js';\n\nimport { Button, Form, FormError, FormField } from '@plumile/ui';\n\nimport type { UseAuthReturn } from '../../hooks/useAuth.js';\n\nimport * as styles from './loginPage.css.js';\n\ntype Props = {\n auth: Pick<\n UseAuthReturn,\n | 'loginWithPasskey'\n | 'isLoading'\n | 'error'\n | 'emailHint'\n | 'nextStep'\n | 'beginAuthentication'\n | 'lockedUntil'\n | 'availableMethods'\n >;\n onSuccess: () => void;\n defaultEmail?: string;\n isAttemptingPasskey?: boolean;\n onShowMethods?: () => void;\n};\n\nexport const PasskeyLoginForm = ({\n auth,\n onSuccess,\n defaultEmail,\n isAttemptingPasskey = false,\n onShowMethods,\n}: Props): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n const [email, setEmail] = useState(auth.emailHint ?? '');\n const [localError, setLocalError] = useState<string | null>(null);\n\n useEffect(() => {\n if (auth.emailHint != null && auth.emailHint !== '') {\n setEmail(auth.emailHint);\n } else if (defaultEmail != null && defaultEmail !== '') {\n setEmail(defaultEmail);\n }\n }, [auth.emailHint, defaultEmail]);\n\n const handleSubmit = useCallback(\n async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n setLocalError(null);\n\n if (email.trim() === '') {\n setLocalError(t('auth.passkey.errors.emailRequired'));\n return;\n }\n\n try {\n const result = await auth.beginAuthentication(email.trim());\n if (Array.isArray(result.methods) && result.methods.length === 0) {\n const lockedUntilMessage =\n result.lockedUntil != null\n ? t('auth.passkey.errors.lockedWithTime', {\n time: new Date(result.lockedUntil).toLocaleString(),\n })\n : t('auth.passkey.errors.locked');\n setLocalError(lockedUntilMessage);\n return;\n }\n if (\n Array.isArray(result.methods) &&\n !result.methods.includes('PASSKEY')\n ) {\n setLocalError(t('auth.passkey.errors.notAvailable'));\n return;\n }\n\n const status = await auth.loginWithPasskey({ email: email.trim() });\n if (status === 'success') {\n onSuccess();\n }\n } catch {\n setLocalError(t('auth.passkey.errors.failed'));\n }\n },\n [auth, email, onSuccess, t],\n );\n\n const formError = localError;\n\n const handleSubmitEvent = useCallback(\n (event: FormEvent<HTMLFormElement>) => {\n handleSubmit(event).catch(() => {\n return undefined;\n });\n },\n [handleSubmit],\n );\n\n return (\n <Form\n className={styles.formSurface}\n onSubmit={handleSubmitEvent}\n noValidate\n initialFocus=\"first-form-control\"\n >\n <div className={styles.stack}>\n <p className={styles.helper}>{t('auth.passkey.helper')}</p>\n {formError != null ? <FormError>{formError}</FormError> : null}\n <FormField\n label={t('auth.passkey.form.emailLabel')}\n name=\"passkey-email\"\n type=\"email\"\n value={email}\n onChange={(event) => {\n setEmail(event.target.value);\n setLocalError(null);\n }}\n placeholder={t('auth.passkey.form.emailPlaceholder')}\n autoComplete=\"email\"\n required\n />\n </div>\n <div className={styles.actionsRow}>\n <Button type=\"submit\" variant=\"primary\" isLoading={auth.isLoading}>\n {isAttemptingPasskey\n ? t('auth.passkey.actions.submitting')\n : t('auth.passkey.actions.submit')}\n </Button>\n {onShowMethods != null ? (\n <button\n type=\"button\"\n className={styles.inlineLink}\n onClick={onShowMethods}\n >\n {t('auth.passkey.actions.showMethods')}\n </button>\n ) : null}\n </div>\n </Form>\n );\n};\n"],"mappings":";;;;;;AAkCA,IAAa,KAAoB,EAC/B,SACA,cACA,iBACA,yBAAsB,IACtB,uBACwB;CACxB,IAAM,EAAE,SAAM,GAA+B,EACvC,CAAC,GAAO,KAAY,EAAS,EAAK,aAAa,GAAG,EAClD,CAAC,GAAY,KAAiB,EAAwB,KAAK;CAEjE,QAAgB;EACd,AAAI,EAAK,aAAa,QAAQ,EAAK,cAAc,KAC/C,EAAS,EAAK,UAAU,GACf,KAAgB,QAAQ,MAAiB,MAClD,EAAS,EAAa;IAEvB,CAAC,EAAK,WAAW,EAAa,CAAC;CAElC,IAAM,IAAe,EACnB,OAAO,MAAsC;EAI3C,IAHA,EAAM,gBAAgB,EACtB,EAAc,KAAK,EAEf,EAAM,MAAM,KAAK,IAAI;GACvB,EAAc,EAAE,oCAAoC,CAAC;GACrD;;EAGF,IAAI;GACF,IAAM,IAAS,MAAM,EAAK,oBAAoB,EAAM,MAAM,CAAC;GAC3D,IAAI,MAAM,QAAQ,EAAO,QAAQ,IAAI,EAAO,QAAQ,WAAW,GAAG;IAOhE,EALE,EAAO,eAAe,OAIlB,EAAE,6BAA6B,GAH/B,EAAE,sCAAsC,EACtC,MAAM,IAAI,KAAK,EAAO,YAAY,CAAC,gBAAgB,EACpD,CAAC,CAEyB;IACjC;;GAEF,IACE,MAAM,QAAQ,EAAO,QAAQ,IAC7B,CAAC,EAAO,QAAQ,SAAS,UAAU,EACnC;IACA,EAAc,EAAE,mCAAmC,CAAC;IACpD;;GAIF,AAAI,MADiB,EAAK,iBAAiB,EAAE,OAAO,EAAM,MAAM,EAAE,CAAC,KACpD,aACb,GAAW;UAEP;GACN,EAAc,EAAE,6BAA6B,CAAC;;IAGlD;EAAC;EAAM;EAAO;EAAW;EAAE,CAC5B,EAEK,IAAY;CAWlB,OACE,kBAAC,GAAD;EACE,WAAW;EACX,UAZsB,GACvB,MAAsC;GACrC,EAAa,EAAM,CAAC,YAAY,GAE9B;KAEJ,CAAC,EAAa,CAMF;EACV,YAAA;EACA,cAAa;YAJf,CAME,kBAAC,OAAD;GAAK,WAAW;aAAhB;IACE,kBAAC,KAAD;KAAG,WAAW;eAAgB,EAAE,sBAAsB;KAAK,CAAA;IAC1D,KAAa,OAA4C,OAArC,kBAAC,GAAD,EAAA,UAAY,GAAsB,CAAA;IACvD,kBAAC,GAAD;KACE,OAAO,EAAE,+BAA+B;KACxC,MAAK;KACL,MAAK;KACL,OAAO;KACP,WAAW,MAAU;MAEnB,AADA,EAAS,EAAM,OAAO,MAAM,EAC5B,EAAc,KAAK;;KAErB,aAAa,EAAE,qCAAqC;KACpD,cAAa;KACb,UAAA;KACA,CAAA;IACE;MACN,kBAAC,OAAD;GAAK,WAAW;aAAhB,CACE,kBAAC,GAAD;IAAQ,MAAK;IAAS,SAAQ;IAAU,WAAW,EAAK;cAElD,EADH,IACK,oCACA,8BAA8B;IAC7B,CAAA,EACR,KAAiB,OAQd,OAPF,kBAAC,UAAD;IACE,MAAK;IACL,WAAW;IACX,SAAS;cAER,EAAE,mCAAmC;IAC/B,CAAA,CAEP;KACD"}
|
|
@@ -3,115 +3,116 @@ import { AuthPanel as r } from "../login/AuthPanel.js";
|
|
|
3
3
|
import { useBackofficeReactTranslation as i } from "../../i18n/useBackofficeReactTranslation.js";
|
|
4
4
|
import { MfaChallengeForm as a } from "../login/MfaChallengeForm.js";
|
|
5
5
|
import { useCallback as o, useMemo as s, useState as c } from "react";
|
|
6
|
-
import { AuthLayout as l, Button as u,
|
|
7
|
-
import { jsx as
|
|
6
|
+
import { AuthLayout as l, Button as u, Form as d, FormError as f, FormField as p } from "@plumile/ui";
|
|
7
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
8
8
|
//#region src/auth/pages/AcceptInvitationScreen.tsx
|
|
9
|
-
var
|
|
10
|
-
let { t:
|
|
11
|
-
if (e.preventDefault(),
|
|
12
|
-
|
|
9
|
+
var g = ({ auth: g, onSuccessRedirect: _, onBackToLogin: v, token: y }) => {
|
|
10
|
+
let { t: b } = i(), { acceptInvitation: x } = g, [S, C] = c("idle"), [w, T] = c(""), [E, D] = c(""), [O, k] = c(!1), [A, j] = c(null), M = s(() => y ?? (typeof window > "u" ? "" : new URLSearchParams(window.location.search).get("token") ?? ""), [y]), N = o((e) => {
|
|
11
|
+
if (e.preventDefault(), M === "") {
|
|
12
|
+
j(b("auth.acceptInvitation.errors.missingToken")), C("error");
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
if (
|
|
16
|
-
|
|
15
|
+
if (w !== E) {
|
|
16
|
+
j(b("auth.acceptInvitation.errors.passwordMismatch")), C("error");
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
token:
|
|
21
|
-
password:
|
|
22
|
-
passwordConfirmation:
|
|
19
|
+
C("pending"), j(null), k(!0), x({
|
|
20
|
+
token: M,
|
|
21
|
+
password: w,
|
|
22
|
+
passwordConfirmation: E
|
|
23
23
|
}).then((e) => {
|
|
24
24
|
if (e === "mfa-required") {
|
|
25
|
-
|
|
25
|
+
C("mfa");
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
C("completed"), _();
|
|
29
29
|
}).catch(() => {
|
|
30
|
-
|
|
30
|
+
C("error"), j(b("auth.acceptInvitation.errors.default"));
|
|
31
31
|
}).finally(() => {
|
|
32
|
-
|
|
32
|
+
k(!1);
|
|
33
33
|
});
|
|
34
34
|
}, [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
]),
|
|
42
|
-
|
|
43
|
-
}, [
|
|
44
|
-
|
|
35
|
+
x,
|
|
36
|
+
_,
|
|
37
|
+
w,
|
|
38
|
+
E,
|
|
39
|
+
M,
|
|
40
|
+
b
|
|
41
|
+
]), P = o(() => {
|
|
42
|
+
C("completed"), _();
|
|
43
|
+
}, [_]), F = o(() => {
|
|
44
|
+
C("idle"), j(null), k(!1);
|
|
45
45
|
}, []);
|
|
46
|
-
if (
|
|
47
|
-
title:
|
|
48
|
-
subtitle:
|
|
49
|
-
children: /* @__PURE__ */
|
|
50
|
-
auth:
|
|
51
|
-
onSuccess:
|
|
46
|
+
if (S === "mfa") return /* @__PURE__ */ m(l, {
|
|
47
|
+
title: b("auth.acceptInvitation.mfaTitle"),
|
|
48
|
+
subtitle: b("auth.acceptInvitation.mfaSubtitle"),
|
|
49
|
+
children: /* @__PURE__ */ m(a, {
|
|
50
|
+
auth: g,
|
|
51
|
+
onSuccess: P,
|
|
52
52
|
onBack: () => {
|
|
53
|
-
|
|
53
|
+
g.reset(), F();
|
|
54
54
|
}
|
|
55
55
|
})
|
|
56
56
|
});
|
|
57
|
-
let
|
|
58
|
-
return
|
|
57
|
+
let I;
|
|
58
|
+
return I = S === "completed" ? /* @__PURE__ */ m("div", {
|
|
59
59
|
className: n,
|
|
60
|
-
children: /* @__PURE__ */
|
|
60
|
+
children: /* @__PURE__ */ m("p", {
|
|
61
61
|
className: t,
|
|
62
|
-
children:
|
|
62
|
+
children: b("auth.acceptInvitation.status.success")
|
|
63
63
|
})
|
|
64
|
-
}) : /* @__PURE__ */
|
|
65
|
-
description:
|
|
66
|
-
children: /* @__PURE__ */
|
|
64
|
+
}) : /* @__PURE__ */ m(r, {
|
|
65
|
+
description: b("auth.acceptInvitation.subtitle"),
|
|
66
|
+
children: /* @__PURE__ */ h(d, {
|
|
67
67
|
className: e,
|
|
68
|
-
onSubmit:
|
|
68
|
+
onSubmit: N,
|
|
69
69
|
noValidate: !0,
|
|
70
|
+
initialFocus: "first-form-control",
|
|
70
71
|
children: [
|
|
71
|
-
|
|
72
|
-
/* @__PURE__ */ p
|
|
73
|
-
label:
|
|
72
|
+
A == null ? null : /* @__PURE__ */ m(f, { children: A }),
|
|
73
|
+
/* @__PURE__ */ m(p, {
|
|
74
|
+
label: b("auth.acceptInvitation.form.passwordLabel"),
|
|
74
75
|
name: "password",
|
|
75
76
|
type: "password",
|
|
76
|
-
value:
|
|
77
|
+
value: w,
|
|
77
78
|
onChange: (e) => {
|
|
78
|
-
|
|
79
|
+
T(e.target.value), j(null), S === "error" && C("idle");
|
|
79
80
|
},
|
|
80
|
-
placeholder:
|
|
81
|
+
placeholder: b("auth.acceptInvitation.form.passwordPlaceholder"),
|
|
81
82
|
autoComplete: "new-password",
|
|
82
83
|
required: !0
|
|
83
84
|
}),
|
|
84
|
-
/* @__PURE__ */ p
|
|
85
|
-
label:
|
|
85
|
+
/* @__PURE__ */ m(p, {
|
|
86
|
+
label: b("auth.acceptInvitation.form.confirmLabel"),
|
|
86
87
|
name: "password-confirmation",
|
|
87
88
|
type: "password",
|
|
88
|
-
value:
|
|
89
|
+
value: E,
|
|
89
90
|
onChange: (e) => {
|
|
90
|
-
|
|
91
|
+
D(e.target.value), j(null), S === "error" && C("idle");
|
|
91
92
|
},
|
|
92
|
-
placeholder:
|
|
93
|
+
placeholder: b("auth.acceptInvitation.form.confirmPlaceholder"),
|
|
93
94
|
autoComplete: "new-password",
|
|
94
95
|
required: !0
|
|
95
96
|
}),
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
+
/* @__PURE__ */ m(u, {
|
|
97
98
|
type: "submit",
|
|
98
|
-
isLoading:
|
|
99
|
-
children:
|
|
99
|
+
isLoading: O,
|
|
100
|
+
children: b(S === "pending" ? "auth.acceptInvitation.status.workingButton" : "auth.acceptInvitation.form.submit")
|
|
100
101
|
}),
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ m(u, {
|
|
102
103
|
type: "button",
|
|
103
104
|
variant: "secondary",
|
|
104
|
-
onClick:
|
|
105
|
-
children:
|
|
105
|
+
onClick: v,
|
|
106
|
+
children: b("auth.acceptInvitation.actions.backToLogin")
|
|
106
107
|
})
|
|
107
108
|
]
|
|
108
109
|
})
|
|
109
|
-
}), /* @__PURE__ */
|
|
110
|
-
title:
|
|
111
|
-
children:
|
|
110
|
+
}), /* @__PURE__ */ m(l, {
|
|
111
|
+
title: b("auth.acceptInvitation.title"),
|
|
112
|
+
children: I
|
|
112
113
|
});
|
|
113
114
|
};
|
|
114
115
|
//#endregion
|
|
115
|
-
export {
|
|
116
|
+
export { g as AcceptInvitationScreen };
|
|
116
117
|
|
|
117
118
|
//# sourceMappingURL=AcceptInvitationScreen.js.map
|