import { adminPortalAssets } from '../../../../../internal/assets/dist/index.mjs';
import React__default from 'react';
import { CopyableText } from '../components/CopyableText.mjs';
import { IdpField } from '../components/IdpField.mjs';
import { Instruction } from '../components/Instruction.mjs';
import { InstructionSet } from '../components/InstructionSet.mjs';
import { PaddedContainer } from '../components/PaddedContainer.mjs';
import { SettingsList } from '../components/SettingsList.mjs';
import { Screenshot } from '../shared/components/Screenshot.mjs';
import { useOrgInfo } from '../utils/useOrgInfo.mjs';
import { getIdpAndConnectionInfo } from './IdpInfo.mjs';

const OktaSamlInstructions$3 = ({ connection: connectionProp })=>{
    const { connection, idp } = getIdpAndConnectionInfo(connectionProp);
    return /*#__PURE__*/ React__default.createElement(InstructionSet, null, /*#__PURE__*/ React__default.createElement(Instruction, null, "Under ", /*#__PURE__*/ React__default.createElement("b", null, "SAML Settings → General"), " within the app setup flow, input the following values:"), /*#__PURE__*/ React__default.createElement(PaddedContainer, null, /*#__PURE__*/ React__default.createElement(SettingsList, null, /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.acsUrlLabel,
        value: connection.acs_url,
        isCopyable: true
    }), /*#__PURE__*/ React__default.createElement(IdpField, {
        title: "Single sign-on URL (as both Recipient and Destination URL)",
        value: "selected"
    }), /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.audienceUriLabel,
        value: connection.audience_uri,
        isCopyable: true
    }), /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.nameIdFormatLabel,
        value: "EmailAddress"
    }), /*#__PURE__*/ React__default.createElement(IdpField, {
        title: "Application username",
        value: "Email"
    }), /*#__PURE__*/ React__default.createElement(IdpField, {
        title: "Update application username on",
        value: "Create and update"
    }))));
};
const EntraSamlInstructions$3 = ({ connection: connectionProp })=>{
    const { connection, idp } = getIdpAndConnectionInfo(connectionProp);
    return /*#__PURE__*/ React__default.createElement(InstructionSet, null, /*#__PURE__*/ React__default.createElement(Instruction, null, "Within your new application navigate to the ", /*#__PURE__*/ React__default.createElement("b", null, "Single Sign-On"), " page in the left-hand navigation of the application view, and select ", /*#__PURE__*/ React__default.createElement("b", null, "SAML"), "."), /*#__PURE__*/ React__default.createElement(Instruction, null, "Within the ", /*#__PURE__*/ React__default.createElement("b", null, "Set up Single Sign-On with SAML page"), ", select the ", /*#__PURE__*/ React__default.createElement("b", null, "Edit"), " button on Step 1:", ' ', /*#__PURE__*/ React__default.createElement("b", null, "Basic SAML Configuration"), " and add the following values:"), /*#__PURE__*/ React__default.createElement(PaddedContainer, null, /*#__PURE__*/ React__default.createElement(SettingsList, null, /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.audienceUriLabel,
        value: connection.audience_uri,
        isCopyable: true
    }), /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.acsUrlLabel,
        value: connection.acs_url,
        isCopyable: true
    }))), /*#__PURE__*/ React__default.createElement(Screenshot, {
        src: adminPortalAssets.entraSetupSso,
        alt: "Entra Setup SSO"
    }), /*#__PURE__*/ React__default.createElement(Screenshot, {
        src: adminPortalAssets.entraBasicSamlConfig,
        alt: "Entra Basic SAML Config"
    }), /*#__PURE__*/ React__default.createElement(Instruction, null, "Leave the ", /*#__PURE__*/ React__default.createElement("b", null, "Optional"), " fields empty (Sign on URL, Relay State, and Logout URL) and click ", /*#__PURE__*/ React__default.createElement("b", null, "Save"), "."));
};
const GoogleSamlInstructions$2 = ({ connection: connectionProp })=>{
    const { connection, idp } = getIdpAndConnectionInfo(connectionProp);
    return /*#__PURE__*/ React__default.createElement(InstructionSet, null, /*#__PURE__*/ React__default.createElement("div", null, /*#__PURE__*/ React__default.createElement(Instruction, null, "Under ", /*#__PURE__*/ React__default.createElement("b", null, "Service provider details"), " input the following:"), /*#__PURE__*/ React__default.createElement(PaddedContainer, null, /*#__PURE__*/ React__default.createElement(SettingsList, null, /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.acsUrlLabel,
        value: connection.acs_url,
        isCopyable: true
    }), /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.audienceUriLabel,
        value: connection.audience_uri,
        isCopyable: true
    })))), /*#__PURE__*/ React__default.createElement(Instruction, null, "Under ", /*#__PURE__*/ React__default.createElement("b", null, "Name ID → Name ID format"), " select ", /*#__PURE__*/ React__default.createElement("b", null, "EMAIL"), " from the dropdown."), /*#__PURE__*/ React__default.createElement(Instruction, null, "Under ", /*#__PURE__*/ React__default.createElement("b", null, "Name ID"), " select ", /*#__PURE__*/ React__default.createElement("b", null, "Basic information → Primary email"), " from the dropdown."), /*#__PURE__*/ React__default.createElement(Screenshot, {
        src: adminPortalAssets.googleSamlSpDetails,
        alt: "Google SAML SP Details"
    }), /*#__PURE__*/ React__default.createElement(Instruction, null, "Click ", /*#__PURE__*/ React__default.createElement("b", null, "Continue"), "."));
};
const OktaOidcInstructions$2 = ({ connection: connectionProp })=>{
    const { connection, idp } = getIdpAndConnectionInfo(connectionProp);
    const { data } = useOrgInfo();
    const organizationName = data?.organization_name ?? '';
    return /*#__PURE__*/ React__default.createElement(InstructionSet, null, /*#__PURE__*/ React__default.createElement(Instruction, null, "Under ", /*#__PURE__*/ React__default.createElement("b", null, "General Settings"), " name your application ", organizationName, "."), /*#__PURE__*/ React__default.createElement(Instruction, null, "Select ", /*#__PURE__*/ React__default.createElement("b", null, "Authorization code"), " as the ", /*#__PURE__*/ React__default.createElement("b", null, "Grant Type"), "."), /*#__PURE__*/ React__default.createElement(Screenshot, {
        src: adminPortalAssets.oktaGrantType,
        alt: "Okta grant type"
    }), /*#__PURE__*/ React__default.createElement("div", null, /*#__PURE__*/ React__default.createElement(Instruction, null, "Add the following value as a ", /*#__PURE__*/ React__default.createElement("b", null, idp.redirectUrlLabel), ":"), /*#__PURE__*/ React__default.createElement(PaddedContainer, null, /*#__PURE__*/ React__default.createElement(CopyableText, null, connection.redirect_url))), /*#__PURE__*/ React__default.createElement("div", null, /*#__PURE__*/ React__default.createElement(Instruction, null, "Under ", /*#__PURE__*/ React__default.createElement("b", null, "Assignments"), " specify whether you want to allow everyone in application to access, or only a subset of your users. You can change this value later."), /*#__PURE__*/ React__default.createElement(PaddedContainer, null, /*#__PURE__*/ React__default.createElement(Instruction, null, "If you want all users to be able to access ", organizationName, " make sure to also enable Just-in-Time Provisioning via this SSO Connection."))), /*#__PURE__*/ React__default.createElement(Screenshot, {
        src: adminPortalAssets.oktaAccessType,
        alt: "Okta access type"
    }), /*#__PURE__*/ React__default.createElement(Instruction, null, "Click save."));
};
const EntraOidcInstructions$2 = ({ connection: connectionProp })=>{
    const { connection, idp } = getIdpAndConnectionInfo(connectionProp);
    return /*#__PURE__*/ React__default.createElement(InstructionSet, null, /*#__PURE__*/ React__default.createElement(Instruction, null, "Within the App Registration page, navigate to the ", /*#__PURE__*/ React__default.createElement("b", null, "Authentication"), " page from the left-hand navigation and under ", /*#__PURE__*/ React__default.createElement("b", null, "Platform configurations"), " select ", /*#__PURE__*/ React__default.createElement("b", null, "Add a platform"), " and choose ", /*#__PURE__*/ React__default.createElement("b", null, "Web"), " as the platform type."), /*#__PURE__*/ React__default.createElement(Screenshot, {
        src: adminPortalAssets.entraOidcAuthSetup,
        alt: "Entra OIDC Auth Setup"
    }), /*#__PURE__*/ React__default.createElement("div", null, /*#__PURE__*/ React__default.createElement(Instruction, null, "In the ", /*#__PURE__*/ React__default.createElement("b", null, "Configure web"), " page, enter the following value as the ", /*#__PURE__*/ React__default.createElement("b", null, "Redirect URI"), ":"), /*#__PURE__*/ React__default.createElement(PaddedContainer, null, /*#__PURE__*/ React__default.createElement(SettingsList, null, /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.redirectUrlLabel,
        value: connection.redirect_url,
        isCopyable: true
    }))), /*#__PURE__*/ React__default.createElement(Screenshot, {
        src: adminPortalAssets.entraOidcConfigureRedirectUri,
        alt: "Entra OIDC Configure Redirect URI"
    })), /*#__PURE__*/ React__default.createElement(Instruction, null, "Leave all other fields blank and click ", /*#__PURE__*/ React__default.createElement("b", null, "Configure"), " to save."));
};
const DefaultAppDetails = ({ connection: connectionProp })=>{
    const { connection, idp, type } = getIdpAndConnectionInfo(connectionProp);
    return /*#__PURE__*/ React__default.createElement(SettingsList, null, type === 'saml' && /*#__PURE__*/ React__default.createElement(React__default.Fragment, null, /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.acsUrlLabel,
        value: connection.acs_url,
        isCopyable: true
    }), /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.audienceUriLabel,
        value: connection.audience_uri,
        isCopyable: true
    }), /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.nameIdFormatLabel,
        value: idp.nameIdFormatValue
    })), type === 'oidc' && /*#__PURE__*/ React__default.createElement(IdpField, {
        title: idp.redirectUrlLabel,
        value: connection.redirect_url,
        isCopyable: true
    }));
};
const AppDetails = ({ connection: connectionProp })=>{
    const { connection, type } = getIdpAndConnectionInfo(connectionProp);
    if (type === 'saml') {
        switch(connection.identity_provider){
            case 'okta':
                return /*#__PURE__*/ React__default.createElement(OktaSamlInstructions$3, {
                    connection: connection
                });
            case 'microsoft-entra':
                return /*#__PURE__*/ React__default.createElement(EntraSamlInstructions$3, {
                    connection: connection
                });
            case 'google-workspace':
                return /*#__PURE__*/ React__default.createElement(GoogleSamlInstructions$2, {
                    connection: connection
                });
        }
    }
    if (type === 'oidc') {
        switch(connection.identity_provider){
            case 'okta':
                return /*#__PURE__*/ React__default.createElement(OktaOidcInstructions$2, {
                    connection: connection
                });
            case 'microsoft-entra':
                return /*#__PURE__*/ React__default.createElement(EntraOidcInstructions$2, {
                    connection: connection
                });
        }
    }
    return /*#__PURE__*/ React__default.createElement(DefaultAppDetails, {
        connection: connection
    });
};

export { AppDetails, DefaultAppDetails };
//# sourceMappingURL=AppDetails.mjs.map
