|
1 | 1 | import { type JSX } from 'react'; |
2 | 2 |
|
3 | 3 | import { Box, Col, descriptors, Heading, localizationKeys, Text } from '@/customizables'; |
| 4 | +import { ClipboardInput } from '@/elements/ClipboardInput'; |
| 5 | +import { Form } from '@/elements/Form'; |
| 6 | +import { Checkmark, Clipboard } from '@/icons'; |
| 7 | +import { useFormControl } from '@/ui/utils/useFormControl'; |
4 | 8 |
|
| 9 | +import { useConfigureSSO } from '../../../ConfigureSSOContext'; |
5 | 10 | import { Step } from '../../../elements/Step'; |
6 | 11 | import { useWizard, Wizard } from '../../../elements/Wizard'; |
7 | 12 | import { InnerStepCounter } from '../../../elements/Wizard/InnerStepCounter'; |
8 | 13 |
|
9 | 14 | export const SamlMicrosoftConfigureSteps = (): JSX.Element => { |
10 | 15 | return ( |
11 | | - <Wizard.Step id='create-app'> |
12 | | - <Step.Header |
13 | | - title={localizationKeys('configureSSO.configureStep.samlMicrosoft.mainHeaderTitle')} |
14 | | - description={localizationKeys('configureSSO.configureStep.samlMicrosoft.createAppStep.headerSubtitle')} |
15 | | - > |
16 | | - <InnerStepCounter /> |
17 | | - </Step.Header> |
18 | | - <SamlMicrosoftCreateAppStep /> |
19 | | - </Wizard.Step> |
| 16 | + <> |
| 17 | + <Wizard.Step id='create-app'> |
| 18 | + <Step.Header |
| 19 | + title={localizationKeys('configureSSO.configureStep.samlMicrosoft.mainHeaderTitle')} |
| 20 | + description={localizationKeys('configureSSO.configureStep.samlMicrosoft.createAppStep.headerSubtitle')} |
| 21 | + > |
| 22 | + <InnerStepCounter /> |
| 23 | + </Step.Header> |
| 24 | + <SamlMicrosoftCreateAppStep /> |
| 25 | + </Wizard.Step> |
| 26 | + |
| 27 | + <Wizard.Step id='service-provider'> |
| 28 | + <Step.Header |
| 29 | + title={localizationKeys('configureSSO.configureStep.samlMicrosoft.mainHeaderTitle')} |
| 30 | + description={localizationKeys('configureSSO.configureStep.samlMicrosoft.serviceProviderStep.headerSubtitle')} |
| 31 | + > |
| 32 | + <InnerStepCounter /> |
| 33 | + </Step.Header> |
| 34 | + <SamlMicrosoftServiceProviderStep /> |
| 35 | + </Wizard.Step> |
| 36 | + </> |
20 | 37 | ); |
21 | 38 | }; |
22 | 39 |
|
@@ -220,3 +237,136 @@ const SamlMicrosoftCreateAppStep = (): JSX.Element => { |
220 | 237 | </> |
221 | 238 | ); |
222 | 239 | }; |
| 240 | + |
| 241 | +const SamlMicrosoftServiceProviderStep = (): JSX.Element => { |
| 242 | + const { goNext, goPrev, isFirstStep, isLastStep } = useWizard(); |
| 243 | + const { enterpriseConnection } = useConfigureSSO(); |
| 244 | + |
| 245 | + const acsUrl = enterpriseConnection?.samlConnection?.acsUrl ?? ''; |
| 246 | + const spEntityId = enterpriseConnection?.samlConnection?.spEntityId ?? ''; |
| 247 | + |
| 248 | + const spEntityIdField = useFormControl('spEntityId', spEntityId, { |
| 249 | + type: 'text', |
| 250 | + label: localizationKeys( |
| 251 | + 'configureSSO.configureStep.samlMicrosoft.serviceProviderStep.serviceProviderFields.spEntityId.label', |
| 252 | + ), |
| 253 | + isRequired: false, |
| 254 | + }); |
| 255 | + const acsUrlField = useFormControl('acsUrl', acsUrl, { |
| 256 | + type: 'text', |
| 257 | + label: localizationKeys( |
| 258 | + 'configureSSO.configureStep.samlMicrosoft.serviceProviderStep.serviceProviderFields.acsUrl.label', |
| 259 | + ), |
| 260 | + isRequired: false, |
| 261 | + }); |
| 262 | + |
| 263 | + return ( |
| 264 | + <> |
| 265 | + <Step.Body> |
| 266 | + <Step.Section sx={theme => ({ gap: theme.space.$5 })}> |
| 267 | + <Col sx={theme => ({ gap: theme.space.$1x5 })}> |
| 268 | + <Heading |
| 269 | + elementDescriptor={descriptors.configureSSOInstructionsHeading} |
| 270 | + as='h3' |
| 271 | + textVariant='subtitle' |
| 272 | + localizationKey={localizationKeys('configureSSO.configureStep.samlMicrosoft.serviceProviderStep.title')} |
| 273 | + /> |
| 274 | + |
| 275 | + <Col |
| 276 | + elementDescriptor={descriptors.configureSSOInstructionsList} |
| 277 | + as='ul' |
| 278 | + sx={theme => ({ |
| 279 | + gap: theme.space.$1x5, |
| 280 | + margin: 0, |
| 281 | + paddingInlineStart: theme.space.$5, |
| 282 | + listStyleType: 'disc', |
| 283 | + })} |
| 284 | + > |
| 285 | + <Text |
| 286 | + elementDescriptor={descriptors.configureSSOInstructionsListItem} |
| 287 | + as='li' |
| 288 | + colorScheme='secondary' |
| 289 | + localizationKey={localizationKeys('configureSSO.configureStep.samlMicrosoft.serviceProviderStep.step1')} |
| 290 | + /> |
| 291 | + <Text |
| 292 | + elementDescriptor={descriptors.configureSSOInstructionsListItem} |
| 293 | + as='li' |
| 294 | + colorScheme='secondary' |
| 295 | + localizationKey={localizationKeys('configureSSO.configureStep.samlMicrosoft.serviceProviderStep.step2')} |
| 296 | + /> |
| 297 | + <Text |
| 298 | + elementDescriptor={descriptors.configureSSOInstructionsListItem} |
| 299 | + as='li' |
| 300 | + colorScheme='secondary' |
| 301 | + localizationKey={localizationKeys('configureSSO.configureStep.samlMicrosoft.serviceProviderStep.step3')} |
| 302 | + /> |
| 303 | + <Text |
| 304 | + elementDescriptor={descriptors.configureSSOInstructionsListItem} |
| 305 | + as='li' |
| 306 | + colorScheme='secondary' |
| 307 | + localizationKey={localizationKeys('configureSSO.configureStep.samlMicrosoft.serviceProviderStep.step4')} |
| 308 | + /> |
| 309 | + <Text |
| 310 | + elementDescriptor={descriptors.configureSSOInstructionsListItem} |
| 311 | + as='li' |
| 312 | + colorScheme='secondary' |
| 313 | + localizationKey={localizationKeys('configureSSO.configureStep.samlMicrosoft.serviceProviderStep.step5')} |
| 314 | + /> |
| 315 | + </Col> |
| 316 | + </Col> |
| 317 | + |
| 318 | + <Form.ControlRow elementId={spEntityIdField.id}> |
| 319 | + <Form.CommonInputWrapper {...spEntityIdField.props}> |
| 320 | + <ClipboardInput |
| 321 | + value={spEntityId} |
| 322 | + readOnly |
| 323 | + copyIcon={Clipboard} |
| 324 | + copiedIcon={Checkmark} |
| 325 | + /> |
| 326 | + </Form.CommonInputWrapper> |
| 327 | + </Form.ControlRow> |
| 328 | + |
| 329 | + <Form.ControlRow elementId={acsUrlField.id}> |
| 330 | + <Form.CommonInputWrapper {...acsUrlField.props}> |
| 331 | + <ClipboardInput |
| 332 | + value={acsUrl} |
| 333 | + readOnly |
| 334 | + copyIcon={Clipboard} |
| 335 | + copiedIcon={Checkmark} |
| 336 | + /> |
| 337 | + </Form.CommonInputWrapper> |
| 338 | + </Form.ControlRow> |
| 339 | + |
| 340 | + <Col |
| 341 | + elementDescriptor={descriptors.configureSSOInstructionsList} |
| 342 | + as='ul' |
| 343 | + sx={theme => ({ |
| 344 | + gap: theme.space.$1x5, |
| 345 | + margin: 0, |
| 346 | + paddingInlineStart: theme.space.$5, |
| 347 | + listStyleType: 'disc', |
| 348 | + })} |
| 349 | + > |
| 350 | + <Text |
| 351 | + elementDescriptor={descriptors.configureSSOInstructionsListItem} |
| 352 | + as='li' |
| 353 | + colorScheme='secondary' |
| 354 | + localizationKey={localizationKeys('configureSSO.configureStep.samlMicrosoft.serviceProviderStep.step6')} |
| 355 | + /> |
| 356 | + </Col> |
| 357 | + </Step.Section> |
| 358 | + </Step.Body> |
| 359 | + |
| 360 | + <Step.Footer> |
| 361 | + <Step.Footer.Previous |
| 362 | + onClick={() => goPrev()} |
| 363 | + isDisabled={isFirstStep} |
| 364 | + /> |
| 365 | + <Step.Footer.Continue |
| 366 | + onClick={() => goNext()} |
| 367 | + isDisabled={isLastStep} |
| 368 | + /> |
| 369 | + </Step.Footer> |
| 370 | + </> |
| 371 | + ); |
| 372 | +}; |
0 commit comments