import { BasePropertyMappingForm } from "@goauthentik/admin/property-mappings/BasePropertyMappingForm"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { docLink } from "@goauthentik/common/global"; import "@goauthentik/elements/CodeMirror"; import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror"; import "@goauthentik/elements/forms/HorizontalFormElement"; import { msg } from "@lit/localize"; import { TemplateResult, html } from "lit"; import { customElement } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; import { OAuthSourcePropertyMapping, PropertymappingsApi } from "@goauthentik/api"; @customElement("ak-property-mapping-oauth-source-form") export class PropertyMappingOAuthSourceForm extends BasePropertyMappingForm { loadInstance(pk: string): Promise { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSourceOauthRetrieve({ pmUuid: pk, }); } async send(data: OAuthSourcePropertyMapping): Promise { if (this.instance) { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSourceOauthUpdate({ pmUuid: this.instance.pk, oAuthSourcePropertyMappingRequest: data, }); } else { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSourceOauthCreate({ oAuthSourcePropertyMappingRequest: data, }); } } renderForm(): TemplateResult { return html`

${msg("Expression using Python.")} ${msg("See documentation for a list of all variables.")}

`; } } declare global { interface HTMLElementTagNameMap { "ak-property-mapping-oauth-source-form": PropertyMappingOAuthSourceForm; } }