@thunderid/react 1.12.0 → 1.14.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.
- package/dist/api/auth/executeEmbeddedSelfFlow.d.ts +36 -0
- package/dist/api/auth/executeEmbeddedSelfFlow.d.ts.map +1 -0
- package/dist/api/auth/executeEmbeddedSelfFlow.js +30 -0
- package/dist/api/auth/executeEmbeddedSelfFlow.js.map +1 -0
- package/dist/cjs/api/auth/executeEmbeddedSelfFlow.cjs +32 -0
- package/dist/cjs/api/auth/executeEmbeddedSelfFlow.cjs.map +1 -0
- package/dist/cjs/components/account/UserProfile/BaseUserProfile.cjs +195 -46
- package/dist/cjs/components/account/UserProfile/BaseUserProfile.cjs.map +1 -1
- package/dist/cjs/components/account/UserProfile/BaseUserProfile.styles.cjs +57 -4
- package/dist/cjs/components/account/UserProfile/BaseUserProfile.styles.cjs.map +1 -1
- package/dist/cjs/components/account/UserProfile/UserProfile.cjs +13 -1
- package/dist/cjs/components/account/UserProfile/UserProfile.cjs.map +1 -1
- package/dist/cjs/components/account/VerifyAttribute/BaseVerifyAttribute.cjs +358 -0
- package/dist/cjs/components/account/VerifyAttribute/BaseVerifyAttribute.cjs.map +1 -0
- package/dist/cjs/components/account/VerifyAttribute/BaseVerifyAttribute.styles.cjs +84 -0
- package/dist/cjs/components/account/VerifyAttribute/BaseVerifyAttribute.styles.cjs.map +1 -0
- package/dist/cjs/components/account/VerifyAttribute/VerifyAttribute.cjs +94 -0
- package/dist/cjs/components/account/VerifyAttribute/VerifyAttribute.cjs.map +1 -0
- package/dist/cjs/components/auth/flow/AuthOptionFactory.cjs +26 -3
- package/dist/cjs/components/auth/flow/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/auth/flow/FieldFactory.cjs +2 -1
- package/dist/cjs/components/auth/flow/FieldFactory.cjs.map +1 -1
- package/dist/cjs/components/primitives/OtpField/OtpField.cjs +10 -5
- package/dist/cjs/components/primitives/OtpField/OtpField.cjs.map +1 -1
- package/dist/cjs/components/primitives/OtpField/OtpField.styles.cjs +16 -8
- package/dist/cjs/components/primitives/OtpField/OtpField.styles.cjs.map +1 -1
- package/dist/cjs/contexts/ComponentRenderer/ComponentRendererContext.cjs.map +1 -1
- package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs +14 -0
- package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
- package/dist/cjs/index.cjs +30 -0
- package/dist/components/account/UserProfile/BaseUserProfile.d.ts +27 -1
- package/dist/components/account/UserProfile/BaseUserProfile.d.ts.map +1 -1
- package/dist/components/account/UserProfile/BaseUserProfile.js +197 -48
- package/dist/components/account/UserProfile/BaseUserProfile.js.map +1 -1
- package/dist/components/account/UserProfile/BaseUserProfile.styles.d.ts.map +1 -1
- package/dist/components/account/UserProfile/BaseUserProfile.styles.js +57 -4
- package/dist/components/account/UserProfile/BaseUserProfile.styles.js.map +1 -1
- package/dist/components/account/UserProfile/UserProfile.d.ts +7 -1
- package/dist/components/account/UserProfile/UserProfile.d.ts.map +1 -1
- package/dist/components/account/UserProfile/UserProfile.js +14 -2
- package/dist/components/account/UserProfile/UserProfile.js.map +1 -1
- package/dist/components/account/VerifyAttribute/BaseVerifyAttribute.d.ts +113 -0
- package/dist/components/account/VerifyAttribute/BaseVerifyAttribute.d.ts.map +1 -0
- package/dist/components/account/VerifyAttribute/BaseVerifyAttribute.js +354 -0
- package/dist/components/account/VerifyAttribute/BaseVerifyAttribute.js.map +1 -0
- package/dist/components/account/VerifyAttribute/BaseVerifyAttribute.styles.d.ts +10 -0
- package/dist/components/account/VerifyAttribute/BaseVerifyAttribute.styles.d.ts.map +1 -0
- package/dist/components/account/VerifyAttribute/BaseVerifyAttribute.styles.js +82 -0
- package/dist/components/account/VerifyAttribute/BaseVerifyAttribute.styles.js.map +1 -0
- package/dist/components/account/VerifyAttribute/VerifyAttribute.d.ts +41 -0
- package/dist/components/account/VerifyAttribute/VerifyAttribute.d.ts.map +1 -0
- package/dist/components/account/VerifyAttribute/VerifyAttribute.js +90 -0
- package/dist/components/account/VerifyAttribute/VerifyAttribute.js.map +1 -0
- package/dist/components/auth/flow/AuthOptionFactory.d.ts +5 -1
- package/dist/components/auth/flow/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/auth/flow/AuthOptionFactory.js +26 -4
- package/dist/components/auth/flow/AuthOptionFactory.js.map +1 -1
- package/dist/components/auth/flow/FieldFactory.d.ts +4 -0
- package/dist/components/auth/flow/FieldFactory.d.ts.map +1 -1
- package/dist/components/auth/flow/FieldFactory.js +2 -1
- package/dist/components/auth/flow/FieldFactory.js.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.d.ts +4 -0
- package/dist/components/primitives/OtpField/OtpField.d.ts.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.js +11 -6
- package/dist/components/primitives/OtpField/OtpField.js.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.styles.d.ts +1 -1
- package/dist/components/primitives/OtpField/OtpField.styles.d.ts.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.styles.js +16 -8
- package/dist/components/primitives/OtpField/OtpField.styles.js.map +1 -1
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts +1 -1
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts.map +1 -1
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.js.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.js +14 -0
- package/dist/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/package.json +2 -2
|
@@ -168,10 +168,37 @@ const useStyles = (theme, colorScheme) => {
|
|
|
168
168
|
const popup = css`
|
|
169
169
|
padding: calc(${theme.vars.spacing.unit} * 2);
|
|
170
170
|
`;
|
|
171
|
-
|
|
172
|
-
alert: css`
|
|
171
|
+
const alert = css`
|
|
173
172
|
margin-bottom: calc(${theme.vars.spacing.unit} * 3);
|
|
174
|
-
|
|
173
|
+
`;
|
|
174
|
+
const verificationStatus = css`
|
|
175
|
+
display: inline-flex;
|
|
176
|
+
flex-shrink: 0;
|
|
177
|
+
gap: calc(${theme.vars.spacing.unit} / 2);
|
|
178
|
+
align-items: center;
|
|
179
|
+
padding: 0 ${theme.vars.spacing.unit};
|
|
180
|
+
border-radius: 999px;
|
|
181
|
+
font-size: 0.75rem;
|
|
182
|
+
font-weight: 500;
|
|
183
|
+
line-height: 22px;
|
|
184
|
+
white-space: nowrap;
|
|
185
|
+
`;
|
|
186
|
+
const verified = css`
|
|
187
|
+
color: ${theme.vars.colors.success.dark ?? theme.vars.colors.success.main};
|
|
188
|
+
background: color-mix(in srgb, ${theme.vars.colors.success.main} 12%, transparent);
|
|
189
|
+
`;
|
|
190
|
+
const unverified = css`
|
|
191
|
+
color: ${theme.vars.colors.warning.contrastText};
|
|
192
|
+
background: color-mix(in srgb, ${theme.vars.colors.warning.main} 14%, transparent);
|
|
193
|
+
`;
|
|
194
|
+
const verification = css`
|
|
195
|
+
padding: ${theme.vars.spacing.unit} 0;
|
|
196
|
+
`;
|
|
197
|
+
const verificationInline = css`
|
|
198
|
+
margin-inline-start: calc(120px + ${theme.vars.spacing.unit});
|
|
199
|
+
`;
|
|
200
|
+
return {
|
|
201
|
+
alert,
|
|
175
202
|
card,
|
|
176
203
|
complexTextarea,
|
|
177
204
|
editButton,
|
|
@@ -193,15 +220,41 @@ const useStyles = (theme, colorScheme) => {
|
|
|
193
220
|
sectionLabel,
|
|
194
221
|
sectionRow,
|
|
195
222
|
sectionValue,
|
|
223
|
+
unverified,
|
|
196
224
|
value,
|
|
197
|
-
valuePlaceholder
|
|
225
|
+
valuePlaceholder,
|
|
226
|
+
verification,
|
|
227
|
+
verificationDialog: css`
|
|
228
|
+
box-sizing: border-box;
|
|
229
|
+
width: min(448px, calc(100vw - calc(${theme.vars.spacing.unit} * 4)));
|
|
230
|
+
padding: calc(${theme.vars.spacing.unit} * 2);
|
|
231
|
+
`,
|
|
232
|
+
verificationInline,
|
|
233
|
+
verificationStatus,
|
|
234
|
+
verified,
|
|
235
|
+
visuallyHidden: css`
|
|
236
|
+
position: absolute;
|
|
237
|
+
width: 1px;
|
|
238
|
+
height: 1px;
|
|
239
|
+
padding: 0;
|
|
240
|
+
margin: -1px;
|
|
241
|
+
overflow: hidden;
|
|
242
|
+
clip: rect(0, 0, 0, 0);
|
|
243
|
+
white-space: nowrap;
|
|
244
|
+
border: 0;
|
|
245
|
+
`
|
|
198
246
|
};
|
|
199
247
|
}, [
|
|
200
248
|
theme.vars.colors.background.surface,
|
|
201
249
|
theme.vars.colors.text.primary,
|
|
202
250
|
theme.vars.colors.text.secondary,
|
|
203
251
|
theme.vars.colors.border,
|
|
252
|
+
theme.vars.colors.success.main,
|
|
253
|
+
theme.vars.colors.success.dark,
|
|
254
|
+
theme.vars.colors.warning.contrastText,
|
|
255
|
+
theme.vars.colors.warning.main,
|
|
204
256
|
theme.vars.borderRadius.large,
|
|
257
|
+
theme.vars.borderRadius.small,
|
|
205
258
|
theme.vars.borderRadius.medium,
|
|
206
259
|
theme.vars.spacing.unit,
|
|
207
260
|
theme.vars.typography.fontFamily,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseUserProfile.styles.js","names":["valuePlaceholder: string","editButton: string","fieldInner: string","fieldActions: string","complexTextarea: string","objectKey: string","objectValue: string","root: string","card: string","header: string","profileInfo: string","name: string","profileSummary: string","sectionRow: string","sectionLabel: string","sectionValue: string","infoContainer: string","info: string","field: string","lastField: string","label: string","value: string","popup: string"],"sources":["../../../../src/components/account/UserProfile/BaseUserProfile.styles.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\n/**\n * Creates styles for the BaseUserProfile component\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> => {\n const valuePlaceholder: string = css`\n font-style: italic;\n opacity: 0.7;\n `;\n\n const editButton: string = css`\n font-style: italic;\n text-decoration: underline;\n opacity: 0.7;\n padding: 0;\n min-height: auto;\n\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n `;\n\n const fieldInner: string = css`\n flex: 1;\n display: flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n min-width: 0;\n `;\n\n const fieldActions: string = css`\n display: flex;\n gap: calc(${theme.vars.spacing.unit} / 2);\n align-items: center;\n margin-inline-start: calc(${theme.vars.spacing.unit} * 4);\n `;\n\n const complexTextarea: string = css`\n min-height: 60px;\n width: 100%;\n padding: 8px;\n border: 1px solid ${theme.vars.colors.border};\n border-radius: ${theme.vars.borderRadius.small};\n resize: vertical;\n `;\n\n const objectKey: string = css`\n padding: ${theme.vars.spacing.unit};\n vertical-align: top;\n `;\n\n const objectValue: string = css`\n padding: ${theme.vars.spacing.unit};\n vertical-align: top;\n `;\n\n return useMemo(() => {\n const root: string = css`\n padding: calc(${theme.vars.spacing.unit} * 4);\n min-width: 600px;\n margin: 0 auto;\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const card: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n `;\n\n const header: string = css`\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 1.5);\n margin-bottom: calc(${theme.vars.spacing.unit} * 1.5);\n `;\n\n const profileInfo: string = css`\n flex: 1;\n `;\n\n const name: string = css`\n font-size: 1.5rem;\n font-weight: 600;\n margin: 0;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const profileSummary: string = css`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n `;\n\n const sectionRow: string = css`\n display: flex;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} * 1) 0;\n `;\n\n const sectionLabel: string = css`\n font-size: 0.875rem;\n font-weight: 600;\n color: ${theme.vars.colors.text.primary};\n width: 160px;\n flex-shrink: 0;\n `;\n\n const sectionValue: string = css`\n flex: 1;\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 1.5);\n font-size: 0.875rem;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const infoContainer: string = css`\n display: flex;\n flex-direction: column;\n `;\n\n const info: string = css`\n padding: calc(${theme.vars.spacing.unit} * 1.5) 0;\n border-bottom: 1px solid ${theme.vars.colors.border};\n `;\n\n const field: string = css`\n display: flex;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} / 2) 0;\n min-height: 28px;\n `;\n\n const lastField: string = css`\n border-bottom: none;\n `;\n\n const label: string = css`\n font-size: 0.875rem;\n font-weight: 500;\n color: ${theme.vars.colors.text.secondary};\n width: 120px;\n flex-shrink: 0;\n line-height: 28px;\n text-align: start;\n `;\n\n const value: string = css`\n color: ${theme.vars.colors.text.primary};\n flex: 1;\n display: inline-block;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n overflow: hidden;\n min-width: 0;\n min-height: 28px;\n line-height: 28px;\n word-break: break-word;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 350px;\n text-align: start;\n\n .${withVendorCSSClassPrefix('form-control')} {\n margin-bottom: 0;\n }\n\n input {\n margin: 0;\n }\n\n table {\n background-color: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.medium};\n white-space: normal;\n }\n\n td {\n border-color: ${theme.vars.colors.border};\n }\n `;\n\n const popup: string = css`\n padding: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const alert: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 3);\n `;\n\n return {\n alert,\n card,\n complexTextarea,\n editButton,\n field,\n fieldActions,\n fieldInner,\n header,\n info,\n infoContainer,\n label,\n lastField,\n name,\n objectKey,\n objectValue,\n popup,\n profileInfo,\n profileSummary,\n root,\n sectionLabel,\n sectionRow,\n sectionValue,\n value,\n valuePlaceholder,\n };\n }, [\n theme.vars.colors.background.surface,\n theme.vars.colors.text.primary,\n theme.vars.colors.text.secondary,\n theme.vars.colors.border,\n theme.vars.borderRadius.large,\n theme.vars.borderRadius.medium,\n theme.vars.spacing.unit,\n theme.vars.typography.fontFamily,\n colorScheme,\n ]);\n};\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,aAAa,OAAc,gBAAgD;CAC/E,MAAMA,mBAA2B,GAAG;;;;CAKpC,MAAMC,aAAqB,GAAG;;;;;;;;;;;CAY9B,MAAMC,aAAqB,GAAG;;;;WAIrB,MAAM,KAAK,QAAQ,KAAK;;;CAIjC,MAAMC,eAAuB,GAAG;;gBAElB,MAAM,KAAK,QAAQ,KAAK;;gCAER,MAAM,KAAK,QAAQ,KAAK;;CAGtD,MAAMC,kBAA0B,GAAG;;;;wBAIb,MAAM,KAAK,OAAO,OAAO;qBAC5B,MAAM,KAAK,aAAa,MAAM;;;CAIjD,MAAMC,YAAoB,GAAG;eAChB,MAAM,KAAK,QAAQ,KAAK;;;CAIrC,MAAMC,cAAsB,GAAG;eAClB,MAAM,KAAK,QAAQ,KAAK;;;AAIrC,QAAO,cAAc;EACnB,MAAMC,OAAe,GAAG;sBACN,MAAM,KAAK,QAAQ,KAAK;;;qBAGzB,MAAM,KAAK,WAAW,WAAW;;EAGlD,MAAMC,OAAe,GAAG;oBACR,MAAM,KAAK,OAAO,WAAW,QAAQ;uBAClC,MAAM,KAAK,aAAa,MAAM;;EAGjD,MAAMC,SAAiB,GAAG;;;kBAGZ,MAAM,KAAK,QAAQ,KAAK;4BACd,MAAM,KAAK,QAAQ,KAAK;;EAGhD,MAAMC,cAAsB,GAAG;;;EAI/B,MAAMC,OAAe,GAAG;;;;eAIb,MAAM,KAAK,OAAO,KAAK,QAAQ;;EAG1C,MAAMC,iBAAyB,GAAG;;;;;EAMlC,MAAMC,aA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ACtB;EACD,CAAC;;AAGJ,qCAAe"}
|
|
1
|
+
{"version":3,"file":"BaseUserProfile.styles.js","names":["valuePlaceholder: string","editButton: string","fieldInner: string","fieldActions: string","complexTextarea: string","objectKey: string","objectValue: string","root: string","card: string","header: string","profileInfo: string","name: string","profileSummary: string","sectionRow: string","sectionLabel: string","sectionValue: string","infoContainer: string","info: string","field: string","lastField: string","label: string","value: string","popup: string","alert: string","verificationStatus: string","verified: string","unverified: string","verification: string","verificationInline: string"],"sources":["../../../../src/components/account/UserProfile/BaseUserProfile.styles.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\n/**\n * Creates styles for the BaseUserProfile component\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> => {\n const valuePlaceholder: string = css`\n font-style: italic;\n opacity: 0.7;\n `;\n\n const editButton: string = css`\n font-style: italic;\n text-decoration: underline;\n opacity: 0.7;\n padding: 0;\n min-height: auto;\n\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n `;\n\n const fieldInner: string = css`\n flex: 1;\n display: flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n min-width: 0;\n `;\n\n const fieldActions: string = css`\n display: flex;\n gap: calc(${theme.vars.spacing.unit} / 2);\n align-items: center;\n margin-inline-start: calc(${theme.vars.spacing.unit} * 4);\n `;\n\n const complexTextarea: string = css`\n min-height: 60px;\n width: 100%;\n padding: 8px;\n border: 1px solid ${theme.vars.colors.border};\n border-radius: ${theme.vars.borderRadius.small};\n resize: vertical;\n `;\n\n const objectKey: string = css`\n padding: ${theme.vars.spacing.unit};\n vertical-align: top;\n `;\n\n const objectValue: string = css`\n padding: ${theme.vars.spacing.unit};\n vertical-align: top;\n `;\n\n return useMemo(() => {\n const root: string = css`\n padding: calc(${theme.vars.spacing.unit} * 4);\n min-width: 600px;\n margin: 0 auto;\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const card: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n `;\n\n const header: string = css`\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 1.5);\n margin-bottom: calc(${theme.vars.spacing.unit} * 1.5);\n `;\n\n const profileInfo: string = css`\n flex: 1;\n `;\n\n const name: string = css`\n font-size: 1.5rem;\n font-weight: 600;\n margin: 0;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const profileSummary: string = css`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n `;\n\n const sectionRow: string = css`\n display: flex;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} * 1) 0;\n `;\n\n const sectionLabel: string = css`\n font-size: 0.875rem;\n font-weight: 600;\n color: ${theme.vars.colors.text.primary};\n width: 160px;\n flex-shrink: 0;\n `;\n\n const sectionValue: string = css`\n flex: 1;\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 1.5);\n font-size: 0.875rem;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const infoContainer: string = css`\n display: flex;\n flex-direction: column;\n `;\n\n const info: string = css`\n padding: calc(${theme.vars.spacing.unit} * 1.5) 0;\n border-bottom: 1px solid ${theme.vars.colors.border};\n `;\n\n const field: string = css`\n display: flex;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} / 2) 0;\n min-height: 28px;\n `;\n\n const lastField: string = css`\n border-bottom: none;\n `;\n\n const label: string = css`\n font-size: 0.875rem;\n font-weight: 500;\n color: ${theme.vars.colors.text.secondary};\n width: 120px;\n flex-shrink: 0;\n line-height: 28px;\n text-align: start;\n `;\n\n const value: string = css`\n color: ${theme.vars.colors.text.primary};\n flex: 1;\n display: inline-block;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n overflow: hidden;\n min-width: 0;\n min-height: 28px;\n line-height: 28px;\n word-break: break-word;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 350px;\n text-align: start;\n\n .${withVendorCSSClassPrefix('form-control')} {\n margin-bottom: 0;\n }\n\n input {\n margin: 0;\n }\n\n table {\n background-color: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.medium};\n white-space: normal;\n }\n\n td {\n border-color: ${theme.vars.colors.border};\n }\n `;\n\n const popup: string = css`\n padding: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const alert: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 3);\n `;\n\n const verificationStatus: string = css`\n display: inline-flex;\n flex-shrink: 0;\n gap: calc(${theme.vars.spacing.unit} / 2);\n align-items: center;\n padding: 0 ${theme.vars.spacing.unit};\n border-radius: 999px;\n font-size: 0.75rem;\n font-weight: 500;\n line-height: 22px;\n white-space: nowrap;\n `;\n\n const verified: string = css`\n color: ${theme.vars.colors.success.dark ?? theme.vars.colors.success.main};\n background: color-mix(in srgb, ${theme.vars.colors.success.main} 12%, transparent);\n `;\n\n // Amber marks an action the user can take.\n const unverified: string = css`\n color: ${theme.vars.colors.warning.contrastText};\n background: color-mix(in srgb, ${theme.vars.colors.warning.main} 14%, transparent);\n `;\n\n const verification: string = css`\n padding: ${theme.vars.spacing.unit} 0;\n `;\n\n // Starts where the value column starts: the label's width plus the row gap.\n const verificationInline: string = css`\n margin-inline-start: calc(120px + ${theme.vars.spacing.unit});\n `;\n\n const verificationDialog: string = css`\n box-sizing: border-box;\n width: min(448px, calc(100vw - calc(${theme.vars.spacing.unit} * 4)));\n padding: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n // Hidden from sight, read by assistive technology.\n const visuallyHidden: string = css`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n `;\n\n return {\n alert,\n card,\n complexTextarea,\n editButton,\n field,\n fieldActions,\n fieldInner,\n header,\n info,\n infoContainer,\n label,\n lastField,\n name,\n objectKey,\n objectValue,\n popup,\n profileInfo,\n profileSummary,\n root,\n sectionLabel,\n sectionRow,\n sectionValue,\n unverified,\n value,\n valuePlaceholder,\n verification,\n verificationDialog,\n verificationInline,\n verificationStatus,\n verified,\n visuallyHidden,\n };\n }, [\n theme.vars.colors.background.surface,\n theme.vars.colors.text.primary,\n theme.vars.colors.text.secondary,\n theme.vars.colors.border,\n theme.vars.colors.success.main,\n theme.vars.colors.success.dark,\n theme.vars.colors.warning.contrastText,\n theme.vars.colors.warning.main,\n theme.vars.borderRadius.large,\n theme.vars.borderRadius.small,\n theme.vars.borderRadius.medium,\n theme.vars.spacing.unit,\n theme.vars.typography.fontFamily,\n colorScheme,\n ]);\n};\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,aAAa,OAAc,gBAAgD;CAC/E,MAAMA,mBAA2B,GAAG;;;;CAKpC,MAAMC,aAAqB,GAAG;;;;;;;;;;;CAY9B,MAAMC,aAAqB,GAAG;;;;WAIrB,MAAM,KAAK,QAAQ,KAAK;;;CAIjC,MAAMC,eAAuB,GAAG;;gBAElB,MAAM,KAAK,QAAQ,KAAK;;gCAER,MAAM,KAAK,QAAQ,KAAK;;CAGtD,MAAMC,kBAA0B,GAAG;;;;wBAIb,MAAM,KAAK,OAAO,OAAO;qBAC5B,MAAM,KAAK,aAAa,MAAM;;;CAIjD,MAAMC,YAAoB,GAAG;eAChB,MAAM,KAAK,QAAQ,KAAK;;;CAIrC,MAAMC,cAAsB,GAAG;eAClB,MAAM,KAAK,QAAQ,KAAK;;;AAIrC,QAAO,cAAc;EACnB,MAAMC,OAAe,GAAG;sBACN,MAAM,KAAK,QAAQ,KAAK;;;qBAGzB,MAAM,KAAK,WAAW,WAAW;;EAGlD,MAAMC,OAAe,GAAG;oBACR,MAAM,KAAK,OAAO,WAAW,QAAQ;uBAClC,MAAM,KAAK,aAAa,MAAM;;E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KAAK;;;;;;;EAQvC,MAAMC,WAAmB,GAAG;eACjB,MAAM,KAAK,OAAO,QAAQ,QAAQ,MAAM,KAAK,OAAO,QAAQ,KAAK;uCACzC,MAAM,KAAK,OAAO,QAAQ,KAAK;;EAIlE,MAAMC,aAAqB,GAAG;eACnB,MAAM,KAAK,OAAO,QAAQ,aAAa;uCACf,MAAM,KAAK,OAAO,QAAQ,KAAK;;EAGlE,MAAMC,eAAuB,GAAG;iBACnB,MAAM,KAAK,QAAQ,KAAK;;EAIrC,MAAMC,qBAA6B,GAAG;0CACA,MAAM,KAAK,QAAQ,KAAK;;AAsB9D,SAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,oBA9CiC,GAAG;;4CAEE,MAAM,KAAK,QAAQ,KAAK;sBAC9C,MAAM,KAAK,QAAQ,KAAK;;GA4CxC;GACA;GACA;GACA,gBA3C6B,GAAG;;;;;;;;;;;GA4CjC;IACA;EACD,MAAM,KAAK,OAAO,WAAW;EAC7B,MAAM,KAAK,OAAO,KAAK;EACvB,MAAM,KAAK,OAAO,KAAK;EACvB,MAAM,KAAK,OAAO;EAClB,MAAM,KAAK,OAAO,QAAQ;EAC1B,MAAM,KAAK,OAAO,QAAQ;EAC1B,MAAM,KAAK,OAAO,QAAQ;EAC1B,MAAM,KAAK,OAAO,QAAQ;EAC1B,MAAM,KAAK,aAAa;EACxB,MAAM,KAAK,aAAa;EACxB,MAAM,KAAK,aAAa;EACxB,MAAM,KAAK,QAAQ;EACnB,MAAM,KAAK,WAAW;EACtB;EACD,CAAC;;AAGJ,qCAAe"}
|
|
@@ -4,7 +4,13 @@ import { BaseUserProfileProps } from './BaseUserProfile';
|
|
|
4
4
|
* Props for the UserProfile component.
|
|
5
5
|
* Extends BaseUserProfileProps but makes the user prop optional since it will be obtained from useThunderID
|
|
6
6
|
*/
|
|
7
|
-
export type UserProfileProps = Omit<BaseUserProfileProps, 'user' | 'profile' | 'flattenedProfile'
|
|
7
|
+
export type UserProfileProps = Omit<BaseUserProfileProps, 'user' | 'profile' | 'flattenedProfile'> & {
|
|
8
|
+
/**
|
|
9
|
+
* Handle of the `SELF` flow that verifies an attribute. Defaults to the server's shipped
|
|
10
|
+
* `default-self-attribute-verification-flow`.
|
|
11
|
+
*/
|
|
12
|
+
verificationFlowHandle?: string;
|
|
13
|
+
};
|
|
8
14
|
/**
|
|
9
15
|
* UserProfile component displays the authenticated user's profile information in a
|
|
10
16
|
* structured and styled format. It shows user details such as display name, email,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../../../../src/components/account/UserProfile/UserProfile.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../../../../src/components/account/UserProfile/UserProfile.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAC,EAAE,EAAoC,MAAM,OAAO,CAAC;AAE5D,OAAwB,EAAC,oBAAoB,EAAyC,MAAM,mBAAmB,CAAC;AAOhH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,GAAG,kBAAkB,CAAC,GAAG;IACnG;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAuFrC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -3,7 +3,8 @@ import useUser_default from "../../../contexts/User/useUser.js";
|
|
|
3
3
|
import useTranslation_default from "../../../hooks/useTranslation.js";
|
|
4
4
|
import BaseUserProfile_default from "./BaseUserProfile.js";
|
|
5
5
|
import updateMeProfile_default from "../../../api/account/updateMeProfile.js";
|
|
6
|
-
import
|
|
6
|
+
import VerifyAttribute_default from "../VerifyAttribute/VerifyAttribute.js";
|
|
7
|
+
import { AttributeVerificationConstants, ThunderIDError, deepMerge, resolveResourceEndpoint } from "@thunderid/browser";
|
|
7
8
|
import { useState } from "react";
|
|
8
9
|
import { jsx } from "react/jsx-runtime";
|
|
9
10
|
|
|
@@ -41,7 +42,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
41
42
|
* />
|
|
42
43
|
* ```
|
|
43
44
|
*/
|
|
44
|
-
const UserProfile = ({ preferences, editable = true,...rest }) => {
|
|
45
|
+
const UserProfile = ({ preferences, editable = true, verificationFlowHandle = AttributeVerificationConstants.DEFAULT_FLOW_HANDLE,...rest }) => {
|
|
45
46
|
const { baseUrl, endpoints, instanceId, preferences: contextPreferences } = useThunderID_default();
|
|
46
47
|
const { profile, flattenedProfile, onUpdateProfile, userSchema } = useUser_default();
|
|
47
48
|
const resolvedPreferences = {
|
|
@@ -74,7 +75,18 @@ const UserProfile = ({ preferences, editable = true,...rest }) => {
|
|
|
74
75
|
setError(message);
|
|
75
76
|
}
|
|
76
77
|
};
|
|
78
|
+
const renderVerification = ({ attribute, attributeDisplayName, onCancel, onComplete }) => /* @__PURE__ */ jsx(VerifyAttribute_default, {
|
|
79
|
+
attribute,
|
|
80
|
+
attributeDisplayName,
|
|
81
|
+
flowHandle: verificationFlowHandle,
|
|
82
|
+
preferences: resolvedPreferences,
|
|
83
|
+
variant: rest.mode === "popup" ? "outlined" : "flat",
|
|
84
|
+
onCancel,
|
|
85
|
+
onComplete,
|
|
86
|
+
onDone: onCancel
|
|
87
|
+
}, attribute);
|
|
77
88
|
return /* @__PURE__ */ jsx(BaseUserProfile_default, {
|
|
89
|
+
renderVerification: isEditableProfile ? renderVerification : void 0,
|
|
78
90
|
profile: profile ?? void 0,
|
|
79
91
|
flattenedProfile: flattenedProfile ?? void 0,
|
|
80
92
|
userSchema: userSchema ?? void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserProfile.js","names":["UserProfile: FC<UserProfileProps>","useThunderID","useUser","useTranslation","isEditableProfile: boolean","updatedAttributes: Record<string, unknown>","updateMeProfile","caughtError: unknown","message: string","BaseUserProfile"],"sources":["../../../../src/components/account/UserProfile/UserProfile.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {ThunderIDError
|
|
1
|
+
{"version":3,"file":"UserProfile.js","names":["UserProfile: FC<UserProfileProps>","useThunderID","useUser","useTranslation","isEditableProfile: boolean","updatedAttributes: Record<string, unknown>","updateMeProfile","caughtError: unknown","message: string","VerifyAttribute","BaseUserProfile"],"sources":["../../../../src/components/account/UserProfile/UserProfile.tsx"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n AttributeVerificationConstants,\n ThunderIDError,\n User,\n deepMerge,\n resolveResourceEndpoint,\n} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useState} from 'react';\n// eslint-disable-next-line import/no-named-as-default\nimport BaseUserProfile, {BaseUserProfileProps, BaseUserProfileVerificationRenderProps} from './BaseUserProfile';\nimport updateMeProfile from '../../../api/account/updateMeProfile';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\nimport useUser from '../../../contexts/User/useUser';\nimport useTranslation from '../../../hooks/useTranslation';\nimport VerifyAttribute from '../VerifyAttribute/VerifyAttribute';\n\n/**\n * Props for the UserProfile component.\n * Extends BaseUserProfileProps but makes the user prop optional since it will be obtained from useThunderID\n */\nexport type UserProfileProps = Omit<BaseUserProfileProps, 'user' | 'profile' | 'flattenedProfile'> & {\n /**\n * Handle of the `SELF` flow that verifies an attribute. Defaults to the server's shipped\n * `default-self-attribute-verification-flow`.\n */\n verificationFlowHandle?: string;\n};\n\n/**\n * UserProfile component displays the authenticated user's profile information in a\n * structured and styled format. It shows user details such as display name, email,\n * username, and other available profile information from ThunderID.\n *\n * This component is the React-specific implementation that uses the BaseUserProfile\n * and automatically retrieves the user data from ThunderID context if not provided.\n *\n * @example\n * ```tsx\n * // Basic usage - will use user from ThunderID context\n * <UserProfile />\n *\n * // With explicit user data\n * <UserProfile user={specificUser} />\n *\n * // With card layout and custom fallback\n * <UserProfile\n * cardLayout={true}\n * fallback={<div>Please sign in to view your profile</div>}\n * />\n *\n * // With field filtering - only show specific fields\n * <UserProfile\n * showFields={['name.givenName', 'name.familyName', 'emails']}\n * />\n *\n * // With field hiding - hide specific fields\n * <UserProfile\n * hideFields={['phoneNumbers', 'addresses']}\n * />\n * ```\n */\nconst UserProfile: FC<UserProfileProps> = ({\n preferences,\n editable = true,\n verificationFlowHandle = AttributeVerificationConstants.DEFAULT_FLOW_HANDLE,\n ...rest\n}: UserProfileProps): ReactElement => {\n const {baseUrl, endpoints, instanceId, preferences: contextPreferences} = useThunderID();\n const {profile, flattenedProfile, onUpdateProfile, userSchema} = useUser();\n const resolvedPreferences = {\n ...contextPreferences,\n ...preferences,\n user: {\n ...contextPreferences?.user,\n ...preferences?.user,\n },\n };\n const {t} = useTranslation(resolvedPreferences?.i18n);\n const isEditableProfile: boolean = resolvedPreferences?.user?.fetchUserProfile === false ? false : editable;\n\n const [error, setError] = useState<string | null>(null);\n\n const handleProfileUpdate = async (payload: Record<string, unknown>): Promise<void> => {\n setError(null);\n\n try {\n const updatedAttributes: Record<string, unknown> = deepMerge(\n (profile?.['attributes'] as Record<string, unknown>) ?? {},\n payload,\n );\n\n Object.keys(updatedAttributes).forEach((key) => {\n if (updatedAttributes[key] === undefined || updatedAttributes[key] === null) {\n delete updatedAttributes[key];\n }\n });\n\n const response: User = await updateMeProfile({\n baseUrl,\n url: resolveResourceEndpoint('usersMe', {endpoints}),\n instanceId,\n payload: updatedAttributes,\n });\n onUpdateProfile(response);\n } catch (caughtError: unknown) {\n let message: string = t('user.profile.update.generic.error');\n\n if (caughtError instanceof ThunderIDError) {\n message = caughtError?.message;\n }\n\n setError(message);\n }\n };\n\n const renderVerification = ({\n attribute,\n attributeDisplayName,\n onCancel,\n onComplete,\n }: BaseUserProfileVerificationRenderProps): ReactNode => (\n <VerifyAttribute\n key={attribute}\n attribute={attribute}\n attributeDisplayName={attributeDisplayName}\n flowHandle={verificationFlowHandle}\n preferences={resolvedPreferences}\n // Popup mode shows the panel under the row as a card; inline mode shows it in a dialog.\n variant={rest.mode === 'popup' ? 'outlined' : 'flat'}\n onCancel={onCancel}\n onComplete={onComplete}\n onDone={onCancel}\n />\n );\n\n return (\n <BaseUserProfile\n renderVerification={isEditableProfile ? renderVerification : undefined}\n profile={profile ?? undefined}\n flattenedProfile={flattenedProfile ?? undefined}\n userSchema={userSchema ?? undefined}\n editable={isEditableProfile}\n onUpdate={isEditableProfile ? handleProfileUpdate : undefined}\n error={error}\n preferences={resolvedPreferences}\n {...rest}\n />\n );\n};\n\nexport default UserProfile;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAMA,eAAqC,EACzC,aACA,WAAW,MACX,yBAAyB,+BAA+B,oBACxD,GAAG,WACiC;CACpC,MAAM,EAAC,SAAS,WAAW,YAAY,aAAa,uBAAsBC,sBAAc;CACxF,MAAM,EAAC,SAAS,kBAAkB,iBAAiB,eAAcC,iBAAS;CAC1E,MAAM,sBAAsB;EAC1B,GAAG;EACH,GAAG;EACH,MAAM;GACJ,GAAG,oBAAoB;GACvB,GAAG,aAAa;GACjB;EACF;CACD,MAAM,EAAC,MAAKC,uBAAe,qBAAqB,KAAK;CACrD,MAAMC,oBAA6B,qBAAqB,MAAM,qBAAqB,QAAQ,QAAQ;CAEnG,MAAM,CAAC,OAAO,YAAY,SAAwB,KAAK;CAEvD,MAAM,sBAAsB,OAAO,YAAoD;AACrF,WAAS,KAAK;AAEd,MAAI;GACF,MAAMC,oBAA6C,UAChD,UAAU,iBAA6C,EAAE,EAC1D,QACD;AAED,UAAO,KAAK,kBAAkB,CAAC,SAAS,QAAQ;AAC9C,QAAI,kBAAkB,SAAS,UAAa,kBAAkB,SAAS,KACrE,QAAO,kBAAkB;KAE3B;AAQF,mBANuB,MAAMC,wBAAgB;IAC3C;IACA,KAAK,wBAAwB,WAAW,EAAC,WAAU,CAAC;IACpD;IACA,SAAS;IACV,CAAC,CACuB;WAClBC,aAAsB;GAC7B,IAAIC,UAAkB,EAAE,oCAAoC;AAE5D,OAAI,uBAAuB,eACzB,WAAU,aAAa;AAGzB,YAAS,QAAQ;;;CAIrB,MAAM,sBAAsB,EAC1B,WACA,sBACA,UACA,iBAEA,oBAACC;EAEY;EACW;EACtB,YAAY;EACZ,aAAa;EAEb,SAAS,KAAK,SAAS,UAAU,aAAa;EACpC;EACE;EACZ,QAAQ;IATH,UAUL;AAGJ,QACE,oBAACC;EACC,oBAAoB,oBAAoB,qBAAqB;EAC7D,SAAS,WAAW;EACpB,kBAAkB,oBAAoB;EACtC,YAAY,cAAc;EAC1B,UAAU;EACV,UAAU,oBAAoB,sBAAsB;EAC7C;EACP,aAAa;EACb,GAAI;GACJ;;AAIN,0BAAe"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { EmbeddedFlowComponent, EmbeddedSelfFlowRequest, EmbeddedSelfFlowResponse, Preferences } from '@thunderid/browser';
|
|
2
|
+
import { FC, ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* What {@link BaseVerifyAttribute} hands its `children` render function, so the steps can be drawn
|
|
5
|
+
* with any UI.
|
|
6
|
+
*/
|
|
7
|
+
export interface BaseVerifyAttributeRenderProps {
|
|
8
|
+
additionalData: Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* The step's components, without its headings.
|
|
11
|
+
*/
|
|
12
|
+
components: EmbeddedFlowComponent[];
|
|
13
|
+
/**
|
|
14
|
+
* Masked destination the code or link was sent to, when the flow reports it.
|
|
15
|
+
*/
|
|
16
|
+
destination: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Translated "Sent to …" line, set when the flow has its own prompt in `subtitle`.
|
|
19
|
+
*/
|
|
20
|
+
destinationText: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Translated error of the last request, or the refusal.
|
|
23
|
+
*/
|
|
24
|
+
error: string | null;
|
|
25
|
+
fieldErrors: Record<string, string>;
|
|
26
|
+
handleInputChange: (name: string, value: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Sends a new code. Set only while the step has a resend action.
|
|
29
|
+
*/
|
|
30
|
+
handleResend?: () => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Submits a step. Pass `skipValidation` for an action, such as a resend, that sends no inputs.
|
|
33
|
+
*/
|
|
34
|
+
handleSubmit: (component: EmbeddedFlowComponent, data?: Record<string, string>, skipValidation?: boolean) => Promise<void>;
|
|
35
|
+
isAwaitingLink: boolean;
|
|
36
|
+
isComplete: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the server refused the verification or the request failed; the flow cannot continue.
|
|
39
|
+
*/
|
|
40
|
+
isFailed: boolean;
|
|
41
|
+
isLoading: boolean;
|
|
42
|
+
isValid: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Closes the panel. Set only when the app passes `onCancel`.
|
|
45
|
+
*/
|
|
46
|
+
onCancel?: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Confirms a link the user opened outside the app. Set only while the step waits for a link and
|
|
49
|
+
* the app passes `onDone`.
|
|
50
|
+
*/
|
|
51
|
+
onDone?: () => void;
|
|
52
|
+
subtitle: string;
|
|
53
|
+
/**
|
|
54
|
+
* Translated message for a recorded verification.
|
|
55
|
+
*/
|
|
56
|
+
successMessage: string;
|
|
57
|
+
title: string;
|
|
58
|
+
touched: Record<string, boolean>;
|
|
59
|
+
values: Record<string, string>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Props for the BaseVerifyAttribute component.
|
|
63
|
+
*/
|
|
64
|
+
export interface BaseVerifyAttributeProps {
|
|
65
|
+
/**
|
|
66
|
+
* Label of the attribute being verified, used in the default heading and success message.
|
|
67
|
+
*/
|
|
68
|
+
attributeDisplayName?: string;
|
|
69
|
+
buttonClassName?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Renders custom UI in place of the default steps. Receives the step, the values and their setters,
|
|
72
|
+
* submit, resend, cancel, the destination, and the loading, error and completed state.
|
|
73
|
+
*/
|
|
74
|
+
children?: (props: BaseVerifyAttributeRenderProps) => ReactNode;
|
|
75
|
+
className?: string;
|
|
76
|
+
inputClassName?: string;
|
|
77
|
+
isInitialized?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Called when the user closes the panel. The close action is shown only when this is set.
|
|
80
|
+
*/
|
|
81
|
+
onCancel?: () => void;
|
|
82
|
+
/**
|
|
83
|
+
* Called once the server has recorded the verification.
|
|
84
|
+
*/
|
|
85
|
+
onComplete?: (response: EmbeddedSelfFlowResponse) => void;
|
|
86
|
+
/**
|
|
87
|
+
* Called when the user selects Done after the flow sent a link, which they confirm outside the app.
|
|
88
|
+
* The Done action is shown only when this is set.
|
|
89
|
+
*/
|
|
90
|
+
onDone?: () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Called when the server refuses the verification or the request fails.
|
|
93
|
+
*/
|
|
94
|
+
onError?: (error: Error) => void;
|
|
95
|
+
onFlowChange?: (response: EmbeddedSelfFlowResponse) => void;
|
|
96
|
+
onInitialize?: () => Promise<EmbeddedSelfFlowResponse>;
|
|
97
|
+
onSubmit?: (payload: EmbeddedSelfFlowRequest) => Promise<EmbeddedSelfFlowResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
100
|
+
*/
|
|
101
|
+
preferences?: Preferences;
|
|
102
|
+
showSubtitle?: boolean;
|
|
103
|
+
showTitle?: boolean;
|
|
104
|
+
size?: 'small' | 'medium' | 'large';
|
|
105
|
+
variant?: 'outlined' | 'flat';
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* BaseVerifyAttribute renders the server-described steps of a self attribute verification flow.
|
|
109
|
+
* Accepts API functions as props to stay framework independent.
|
|
110
|
+
*/
|
|
111
|
+
declare const BaseVerifyAttribute: FC<BaseVerifyAttributeProps>;
|
|
112
|
+
export default BaseVerifyAttribute;
|
|
113
|
+
//# sourceMappingURL=BaseVerifyAttribute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseVerifyAttribute.d.ts","sourceRoot":"","sources":["../../../../src/components/account/VerifyAttribute/BaseVerifyAttribute.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,qBAAqB,EAErB,uBAAuB,EACvB,wBAAwB,EAIxB,WAAW,EAMZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,EAAE,EAGF,SAAS,EASV,MAAM,OAAO,CAAC;AAmEf;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC;;OAEG;IACH,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;OAEG;IACH,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC;;OAEG;IACH,YAAY,EAAE,CACZ,SAAS,EAAE,qBAAqB,EAChC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,cAAc,CAAC,EAAE,OAAO,KACrB,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB;;O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