|
1 | 1 | import React, { type JSX } from 'react'; |
2 | 2 |
|
3 | 3 | import { Col, descriptors, Heading, Text } from '@/customizables'; |
| 4 | +import { ClipboardInput } from '@/elements/ClipboardInput'; |
4 | 5 | import { useCardState } from '@/elements/contexts'; |
| 6 | +import { Form } from '@/elements/Form'; |
| 7 | +import { Checkmark, Clipboard } from '@/icons'; |
5 | 8 | import { localizationKeys } from '@/localization'; |
6 | 9 | import { useFormControl } from '@/ui/utils/useFormControl'; |
7 | 10 |
|
@@ -44,6 +47,16 @@ export const SamlGoogleConfigureSteps = (): JSX.Element => { |
44 | 47 | </Step.Header> |
45 | 48 | <SamlGoogleIdentityProviderMetadataStep /> |
46 | 49 | </Wizard.Step> |
| 50 | + |
| 51 | + <Wizard.Step id='service-provider'> |
| 52 | + <Step.Header |
| 53 | + title={localizationKeys('configureSSO.configureStep.samlGoogle.mainHeaderTitle')} |
| 54 | + description={localizationKeys('configureSSO.configureStep.samlGoogle.serviceProviderStep.headerSubtitle')} |
| 55 | + > |
| 56 | + <InnerStepCounter /> |
| 57 | + </Step.Header> |
| 58 | + <SamlGoogleServiceProviderStep /> |
| 59 | + </Wizard.Step> |
47 | 60 | </> |
48 | 61 | ); |
49 | 62 | }; |
@@ -333,3 +346,109 @@ const SamlGoogleIdentityProviderMetadataStep = (): JSX.Element => { |
333 | 346 | </> |
334 | 347 | ); |
335 | 348 | }; |
| 349 | + |
| 350 | +const SamlGoogleServiceProviderStep = (): JSX.Element => { |
| 351 | + const { goNext, goPrev, isFirstStep, isLastStep } = useWizard(); |
| 352 | + const { enterpriseConnection } = useConfigureSSO(); |
| 353 | + |
| 354 | + const acsUrl = enterpriseConnection?.samlConnection?.acsUrl ?? ''; |
| 355 | + const spEntityId = enterpriseConnection?.samlConnection?.spEntityId ?? ''; |
| 356 | + |
| 357 | + const acsUrlField = useFormControl('acsUrl', acsUrl, { |
| 358 | + type: 'text', |
| 359 | + label: localizationKeys( |
| 360 | + 'configureSSO.configureStep.samlGoogle.serviceProviderStep.serviceProviderFields.acsUrl.label', |
| 361 | + ), |
| 362 | + isRequired: false, |
| 363 | + }); |
| 364 | + const spEntityIdField = useFormControl('spEntityId', spEntityId, { |
| 365 | + type: 'text', |
| 366 | + label: localizationKeys( |
| 367 | + 'configureSSO.configureStep.samlGoogle.serviceProviderStep.serviceProviderFields.spEntityId.label', |
| 368 | + ), |
| 369 | + isRequired: false, |
| 370 | + }); |
| 371 | + |
| 372 | + return ( |
| 373 | + <> |
| 374 | + <Step.Body> |
| 375 | + <Step.Section sx={theme => ({ gap: theme.space.$5 })}> |
| 376 | + <Col sx={theme => ({ gap: theme.space.$1x5 })}> |
| 377 | + <Heading |
| 378 | + elementDescriptor={descriptors.configureSSOInstructionsHeading} |
| 379 | + as='h3' |
| 380 | + textVariant='subtitle' |
| 381 | + localizationKey={localizationKeys('configureSSO.configureStep.samlGoogle.serviceProviderStep.title')} |
| 382 | + /> |
| 383 | + <Text |
| 384 | + as='p' |
| 385 | + colorScheme='secondary' |
| 386 | + localizationKey={localizationKeys('configureSSO.configureStep.samlGoogle.serviceProviderStep.paragraph')} |
| 387 | + /> |
| 388 | + </Col> |
| 389 | + |
| 390 | + <Form.ControlRow elementId={acsUrlField.id}> |
| 391 | + <Form.CommonInputWrapper {...acsUrlField.props}> |
| 392 | + <ClipboardInput |
| 393 | + value={acsUrl} |
| 394 | + readOnly |
| 395 | + copyIcon={Clipboard} |
| 396 | + copiedIcon={Checkmark} |
| 397 | + /> |
| 398 | + </Form.CommonInputWrapper> |
| 399 | + </Form.ControlRow> |
| 400 | + |
| 401 | + <Form.ControlRow elementId={spEntityIdField.id}> |
| 402 | + <Form.CommonInputWrapper {...spEntityIdField.props}> |
| 403 | + <ClipboardInput |
| 404 | + value={spEntityId} |
| 405 | + readOnly |
| 406 | + copyIcon={Clipboard} |
| 407 | + copiedIcon={Checkmark} |
| 408 | + /> |
| 409 | + </Form.CommonInputWrapper> |
| 410 | + </Form.ControlRow> |
| 411 | + |
| 412 | + <Col |
| 413 | + elementDescriptor={descriptors.configureSSOInstructionsList} |
| 414 | + as='ul' |
| 415 | + sx={theme => ({ |
| 416 | + gap: theme.space.$1x5, |
| 417 | + margin: 0, |
| 418 | + paddingInlineStart: theme.space.$5, |
| 419 | + listStyleType: 'disc', |
| 420 | + })} |
| 421 | + > |
| 422 | + <Text |
| 423 | + elementDescriptor={descriptors.configureSSOInstructionsListItem} |
| 424 | + as='li' |
| 425 | + colorScheme='secondary' |
| 426 | + localizationKey={localizationKeys( |
| 427 | + 'configureSSO.configureStep.samlGoogle.serviceProviderStep.nameIdInstructions.step1', |
| 428 | + )} |
| 429 | + /> |
| 430 | + <Text |
| 431 | + elementDescriptor={descriptors.configureSSOInstructionsListItem} |
| 432 | + as='li' |
| 433 | + colorScheme='secondary' |
| 434 | + localizationKey={localizationKeys( |
| 435 | + 'configureSSO.configureStep.samlGoogle.serviceProviderStep.nameIdInstructions.step2', |
| 436 | + )} |
| 437 | + /> |
| 438 | + </Col> |
| 439 | + </Step.Section> |
| 440 | + </Step.Body> |
| 441 | + |
| 442 | + <Step.Footer> |
| 443 | + <Step.Footer.Previous |
| 444 | + onClick={() => goPrev()} |
| 445 | + isDisabled={isFirstStep} |
| 446 | + /> |
| 447 | + <Step.Footer.Continue |
| 448 | + onClick={() => goNext()} |
| 449 | + isDisabled={isLastStep} |
| 450 | + /> |
| 451 | + </Step.Footer> |
| 452 | + </> |
| 453 | + ); |
| 454 | +}; |
0 commit comments