@scalar/api-client 3.19.2 → 3.20.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/CHANGELOG.md +64 -0
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
- package/dist/components/SectionFilter.vue.d.ts +2 -0
- package/dist/components/SectionFilter.vue.d.ts.map +1 -1
- package/dist/components/SectionFilter.vue.js +1 -1
- package/dist/components/SectionFilter.vue.js.map +1 -1
- package/dist/components/SectionFilter.vue.script.js +11 -8
- package/dist/components/SectionFilter.vue.script.js.map +1 -1
- package/dist/components/Server/ServerVariablesSelect.vue.d.ts.map +1 -1
- package/dist/components/Server/ServerVariablesSelect.vue.js.map +1 -1
- package/dist/components/Server/ServerVariablesSelect.vue.script.js +5 -3
- package/dist/components/Server/ServerVariablesSelect.vue.script.js.map +1 -1
- package/dist/components/Server/ServerVariablesTextbox.vue.d.ts.map +1 -1
- package/dist/components/Server/ServerVariablesTextbox.vue.js.map +1 -1
- package/dist/components/Server/ServerVariablesTextbox.vue.script.js +6 -3
- package/dist/components/Server/ServerVariablesTextbox.vue.script.js.map +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.js.map +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js +4 -2
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js.map +1 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js.map +1 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js +3 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js.map +1 -1
- package/dist/style.css +159 -135
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +10 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +46 -5
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +2 -0
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.script.js +15 -8
- package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js +4 -2
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.js +4 -3
- package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +2 -0
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +51 -26
- package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +28 -8
- package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js +9 -3
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js +6 -4
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +3 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js +7 -5
- package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -2
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js +40 -7
- package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +12 -12
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +24 -20
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js +6 -4
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-rows.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +5 -4
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +2 -0
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +37 -13
- package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/Headers.vue.d.ts +3 -3
- package/dist/v2/blocks/response-block/components/Headers.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/Headers.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/Headers.vue.script.js +5 -3
- package/dist/v2/blocks/response-block/components/Headers.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js +3 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js +11 -3
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js +8 -6
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts +1 -0
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js +109 -56
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js +5 -3
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js +6 -3
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js +7 -5
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +4 -2
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js +22 -14
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js +4 -2
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js +11 -6
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.d.ts +4 -0
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.js +100 -0
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.js.map +1 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.d.ts +13 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.js +97 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.js.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +3 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +42 -29
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +6 -6
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js +7 -4
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js +21 -16
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js +7 -5
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js +7 -5
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +105 -40
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js +10 -8
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js +14 -9
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js +6 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js +3 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js +40 -40
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts +108 -7
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js +12 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.js +8 -5
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.d.ts +3 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.js +8 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.js.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.d.ts +3 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.js +11 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.js.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.d.ts +19 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.js +117 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.js.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +2 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +15 -11
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.js +8 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +6 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +2 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +8 -6
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +4 -4
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.script.js +10 -10
- package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.d.ts +4 -4
- package/dist/v2/components/code-input/CodeInputLite.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.js +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.js.map +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.script.js +8 -5
- package/dist/v2/components/code-input/CodeInputLite.vue.script.js.map +1 -1
- package/dist/v2/components/code-input/PillTooltipHost.vue.d.ts +4 -0
- package/dist/v2/components/code-input/PillTooltipHost.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/PillTooltipHost.vue.js.map +1 -1
- package/dist/v2/components/code-input/PillTooltipHost.vue.script.js +7 -3
- package/dist/v2/components/code-input/PillTooltipHost.vue.script.js.map +1 -1
- package/dist/v2/components/code-input/code-variable-widget.d.ts +3 -0
- package/dist/v2/components/code-input/code-variable-widget.d.ts.map +1 -1
- package/dist/v2/components/code-input/code-variable-widget.js +6 -3
- package/dist/v2/components/code-input/code-variable-widget.js.map +1 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts +0 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.js.map +1 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js +4 -2
- package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.script.js +5 -3
- package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js +12 -9
- package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js.map +1 -1
- package/dist/v2/components/forms/ConfirmationForm.vue.d.ts.map +1 -1
- package/dist/v2/components/forms/ConfirmationForm.vue.js.map +1 -1
- package/dist/v2/components/forms/ConfirmationForm.vue.script.js +5 -3
- package/dist/v2/components/forms/ConfirmationForm.vue.script.js.map +1 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.d.ts.map +1 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.js.map +1 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.script.js +3 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.script.js.map +1 -1
- package/dist/v2/components/modals/DeleteModal.vue.d.ts.map +1 -1
- package/dist/v2/components/modals/DeleteModal.vue.js.map +1 -1
- package/dist/v2/components/modals/DeleteModal.vue.script.js +3 -1
- package/dist/v2/components/modals/DeleteModal.vue.script.js.map +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.d.ts.map +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.js.map +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.script.js +5 -2
- package/dist/v2/components/modals/ModalClientContainer.vue.script.js.map +1 -1
- package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
- package/dist/v2/components/server/ServerDropdown.vue.js.map +1 -1
- package/dist/v2/components/server/ServerDropdown.vue.script.js +9 -5
- package/dist/v2/components/server/ServerDropdown.vue.script.js.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.script.js +4 -2
- package/dist/v2/components/sidebar/Sidebar.vue.script.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.script.js +4 -2
- package/dist/v2/components/sidebar/SidebarMenu.vue.script.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarToggle.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/SidebarToggle.vue.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarToggle.vue.script.js +4 -2
- package/dist/v2/components/sidebar/SidebarToggle.vue.script.js.map +1 -1
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js +4 -2
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts +2 -2
- package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/EnvironmentsList.vue.js.map +1 -1
- package/dist/v2/features/environments/EnvironmentsList.vue.script.js +4 -2
- package/dist/v2/features/environments/EnvironmentsList.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.js.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.script.js +12 -10
- package/dist/v2/features/environments/components/Environment.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js +5 -3
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js +9 -6
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +6 -4
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js +22 -10
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js.map +1 -1
- package/dist/v2/features/localization/index.d.ts +18 -0
- package/dist/v2/features/localization/index.d.ts.map +1 -0
- package/dist/v2/features/localization/index.js +35 -0
- package/dist/v2/features/localization/index.js.map +1 -0
- package/dist/v2/features/localization/locales/ar.d.ts +385 -0
- package/dist/v2/features/localization/locales/ar.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/ar.js +345 -0
- package/dist/v2/features/localization/locales/ar.js.map +1 -0
- package/dist/v2/features/localization/locales/de.d.ts +385 -0
- package/dist/v2/features/localization/locales/de.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/de.js +345 -0
- package/dist/v2/features/localization/locales/de.js.map +1 -0
- package/dist/v2/features/localization/locales/es.d.ts +385 -0
- package/dist/v2/features/localization/locales/es.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/es.js +345 -0
- package/dist/v2/features/localization/locales/es.js.map +1 -0
- package/dist/v2/features/localization/locales/fr.d.ts +385 -0
- package/dist/v2/features/localization/locales/fr.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/fr.js +345 -0
- package/dist/v2/features/localization/locales/fr.js.map +1 -0
- package/dist/v2/features/localization/locales/pt.d.ts +385 -0
- package/dist/v2/features/localization/locales/pt.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/pt.js +345 -0
- package/dist/v2/features/localization/locales/pt.js.map +1 -0
- package/dist/v2/features/localization/locales/ru.d.ts +385 -0
- package/dist/v2/features/localization/locales/ru.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/ru.js +345 -0
- package/dist/v2/features/localization/locales/ru.js.map +1 -0
- package/dist/v2/features/localization/locales/zh-cn.d.ts +385 -0
- package/dist/v2/features/localization/locales/zh-cn.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/zh-cn.js +345 -0
- package/dist/v2/features/localization/locales/zh-cn.js.map +1 -0
- package/dist/v2/features/localization/translations.d.ts +385 -0
- package/dist/v2/features/localization/translations.d.ts.map +1 -0
- package/dist/v2/features/localization/translations.js +345 -0
- package/dist/v2/features/localization/translations.js.map +1 -0
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js.map +1 -1
- package/dist/v2/features/modal/Modal.vue.script.js +17 -4
- package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
- package/dist/v2/features/modal/use-lazy-api-client.d.ts +11 -0
- package/dist/v2/features/modal/use-lazy-api-client.d.ts.map +1 -0
- package/dist/v2/features/modal/use-lazy-api-client.js +48 -0
- package/dist/v2/features/modal/use-lazy-api-client.js.map +1 -0
- package/dist/v2/features/operation/Operation.vue.d.ts +2 -0
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js.map +1 -1
- package/dist/v2/features/operation/Operation.vue.script.js +50 -12
- package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts.map +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.js +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.js.map +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js +12 -8
- package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js.map +1 -1
- package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +1 -1
- package/dist/v2/features/search/components/SearchResult.vue.js.map +1 -1
- package/dist/v2/features/search/components/SearchResult.vue.script.js +14 -10
- package/dist/v2/features/search/components/SearchResult.vue.script.js.map +1 -1
- package/dist/v2/types/options.d.ts +1 -1
- package/dist/v2/types/options.d.ts.map +1 -1
- package/dist/v2/workspace-events.d.ts +2 -2
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +8 -1
- package/dist/v2/workspace-events.js.map +1 -1
- package/dist/vue-styles.css +124 -125
- package/package.json +22 -11
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { useLocalization } from "../../../features/localization/index.js";
|
|
1
2
|
import DataTableRow_default from "../../../components/data-table/DataTableRow.vue.js";
|
|
2
3
|
import { authorizeOauth2, refreshOauth2Token } from "../helpers/oauth.js";
|
|
3
4
|
import { resolveDefaultOAuth2RedirectUri } from "../helpers/resolve-default-oauth2-redirect-url.js";
|
|
4
5
|
import OAuthScopesInput_default from "./OAuthScopesInput.vue.js";
|
|
5
6
|
import RequestAuthDataTableInput_default from "./RequestAuthDataTableInput.vue.js";
|
|
6
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, ref, unref, watch, withCtx } from "vue";
|
|
7
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, onBeforeUnmount, openBlock, ref, toDisplayString, unref, watch, withCtx } from "vue";
|
|
7
8
|
import { ScalarButton } from "@scalar/components/button";
|
|
8
9
|
import { getEnvironmentVariables } from "@scalar/workspace-store/request-example";
|
|
9
10
|
import { useToasts } from "@scalar/use-toasts";
|
|
@@ -11,7 +12,17 @@ import { useLoadingState } from "@scalar/components/loading";
|
|
|
11
12
|
import { pkceOptions } from "@scalar/types/entities";
|
|
12
13
|
//#region src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue?vue&type=script&setup=true&lang.ts
|
|
13
14
|
var _hoisted_1 = { class: "flex h-8 items-center justify-end gap-2 border-t" };
|
|
14
|
-
var _hoisted_2 = { class: "
|
|
15
|
+
var _hoisted_2 = { class: "w-full p-2" };
|
|
16
|
+
var _hoisted_3 = {
|
|
17
|
+
class: "bg-b-2 flex flex-col gap-3 rounded-lg border p-3 text-sm",
|
|
18
|
+
role: "status"
|
|
19
|
+
};
|
|
20
|
+
var _hoisted_4 = { class: "text-c-2 text-xs leading-normal" };
|
|
21
|
+
var _hoisted_5 = { class: "bg-b-1 font-code w-fit max-w-full rounded border px-3 py-2 text-base font-medium tracking-widest break-all select-all" };
|
|
22
|
+
var _hoisted_6 = ["href"];
|
|
23
|
+
var _hoisted_7 = { class: "flex items-center justify-between gap-3" };
|
|
24
|
+
var _hoisted_8 = { class: "text-c-2 text-xs" };
|
|
25
|
+
var _hoisted_9 = { class: "flex h-8 w-full items-center justify-end border-t" };
|
|
15
26
|
var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
16
27
|
__name: "OAuth2",
|
|
17
28
|
props: {
|
|
@@ -34,6 +45,19 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
34
45
|
],
|
|
35
46
|
setup(__props, { emit: __emit }) {
|
|
36
47
|
const emits = __emit;
|
|
48
|
+
const devicePrompt = ref(null);
|
|
49
|
+
let deviceController;
|
|
50
|
+
const cancelDeviceAuthorization = () => {
|
|
51
|
+
deviceController?.abort();
|
|
52
|
+
devicePrompt.value = null;
|
|
53
|
+
};
|
|
54
|
+
onBeforeUnmount(cancelDeviceAuthorization);
|
|
55
|
+
watch(() => [
|
|
56
|
+
__props.type,
|
|
57
|
+
__props.name,
|
|
58
|
+
__props.flows
|
|
59
|
+
], cancelDeviceAuthorization);
|
|
60
|
+
const { translate } = useLocalization();
|
|
37
61
|
const loader = useLoadingState();
|
|
38
62
|
const { toast } = useToasts();
|
|
39
63
|
/** The current OAuth flow based on the selected type */
|
|
@@ -120,15 +144,24 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
120
144
|
const handleAuthorize = async () => {
|
|
121
145
|
if (loader.isLoading) return;
|
|
122
146
|
loader.start();
|
|
123
|
-
const
|
|
147
|
+
const controller = new AbortController();
|
|
148
|
+
deviceController = controller;
|
|
149
|
+
const [error, tokens] = await authorizeOauth2(__props.flows, __props.type, selectedScopes.value, __props.server, __props.proxyUrl, getEnvironmentVariables(__props.environment), __props.options.customFetch, __props.options.captureOAuth2Callback, {
|
|
150
|
+
signal: controller.signal,
|
|
151
|
+
onPrompt: (prompt) => {
|
|
152
|
+
devicePrompt.value = prompt;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
devicePrompt.value = null;
|
|
124
156
|
await loader.clear();
|
|
157
|
+
if (controller.signal.aborted) return;
|
|
125
158
|
if (tokens?.accessToken) handleOauth2SecretsUpdate({
|
|
126
159
|
"x-scalar-secret-token": tokens.accessToken,
|
|
127
160
|
...tokens.refreshToken ? { "x-scalar-secret-refresh-token": tokens.refreshToken } : {}
|
|
128
161
|
});
|
|
129
162
|
else {
|
|
130
163
|
console.error(error);
|
|
131
|
-
toast(error?.message ?? "
|
|
164
|
+
toast(error?.message ?? translate("apiClient.oauth2.failedToauthorize"), "error");
|
|
132
165
|
}
|
|
133
166
|
};
|
|
134
167
|
/** Whether the current flow supports refreshing the access token */
|
|
@@ -156,7 +189,7 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
156
189
|
});
|
|
157
190
|
else {
|
|
158
191
|
console.error(error);
|
|
159
|
-
toast(error?.message ?? "
|
|
192
|
+
toast(error?.message ?? translate("apiClient.oauth2.failedToRefreshToken"), "error");
|
|
160
193
|
}
|
|
161
194
|
};
|
|
162
195
|
/** Updates the secret location */
|
|
@@ -176,7 +209,7 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
176
209
|
type: "password",
|
|
177
210
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = (v) => handleOauth2SecretsUpdate({ "x-scalar-secret-token": v }))
|
|
178
211
|
}, {
|
|
179
|
-
default: withCtx(() => [
|
|
212
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.accessToken")), 1)]),
|
|
180
213
|
_: 1
|
|
181
214
|
}, 8, ["environment", "modelValue"])]),
|
|
182
215
|
_: 1
|
|
@@ -189,7 +222,7 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
189
222
|
placeholder: refreshUrlPlaceholder.value,
|
|
190
223
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = (v) => handleOauth2Update({ refreshUrl: v }))
|
|
191
224
|
}, {
|
|
192
|
-
default: withCtx(() => [
|
|
225
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.refreshUrl")), 1)]),
|
|
193
226
|
_: 1
|
|
194
227
|
}, 8, [
|
|
195
228
|
"environment",
|
|
@@ -210,7 +243,7 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
210
243
|
variant: "outlined",
|
|
211
244
|
onClick: handleRefresh
|
|
212
245
|
}, {
|
|
213
|
-
default: withCtx(() => [
|
|
246
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.refresh")), 1)]),
|
|
214
247
|
_: 1
|
|
215
248
|
}, 8, ["loader"])) : createCommentVNode("", true), createVNode(unref(ScalarButton), {
|
|
216
249
|
class: "mr-1 p-0 px-2 py-0.5",
|
|
@@ -219,12 +252,44 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
219
252
|
variant: "outlined",
|
|
220
253
|
onClick: handleClearAccessTokens
|
|
221
254
|
}, {
|
|
222
|
-
default: withCtx(() => [
|
|
255
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.clear")), 1)]),
|
|
223
256
|
_: 1
|
|
224
257
|
}, 8, ["disabled"])])]),
|
|
225
258
|
_: 1
|
|
226
259
|
})) : createCommentVNode("", true)
|
|
227
260
|
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
261
|
+
"deviceAuthorizationUrl" in flow.value ? (openBlock(), createBlock(unref(DataTableRow_default), { key: 0 }, {
|
|
262
|
+
default: withCtx(() => [createVNode(RequestAuthDataTableInput_default, {
|
|
263
|
+
environment: __props.environment,
|
|
264
|
+
modelValue: flow.value.deviceAuthorizationUrl,
|
|
265
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = (v) => handleOauth2Update({ deviceAuthorizationUrl: v }))
|
|
266
|
+
}, {
|
|
267
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.deviceAuthorizationUrl")), 1)]),
|
|
268
|
+
_: 1
|
|
269
|
+
}, 8, ["environment", "modelValue"])]),
|
|
270
|
+
_: 1
|
|
271
|
+
})) : createCommentVNode("", true),
|
|
272
|
+
devicePrompt.value ? (openBlock(), createBlock(unref(DataTableRow_default), { key: 1 }, {
|
|
273
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [
|
|
274
|
+
createElementVNode("p", _hoisted_4, toDisplayString(unref(translate)("apiClient.oauth2.deviceVerificationPrompt")), 1),
|
|
275
|
+
createElementVNode("strong", _hoisted_5, toDisplayString(devicePrompt.value.userCode), 1),
|
|
276
|
+
createElementVNode("a", {
|
|
277
|
+
class: "text-c-accent w-fit max-w-full text-xs break-all underline underline-offset-2",
|
|
278
|
+
href: devicePrompt.value.verificationUriComplete || devicePrompt.value.verificationUri,
|
|
279
|
+
rel: "noopener noreferrer",
|
|
280
|
+
target: "_blank"
|
|
281
|
+
}, toDisplayString(devicePrompt.value.verificationUri), 9, _hoisted_6),
|
|
282
|
+
createElementVNode("div", _hoisted_7, [createElementVNode("p", _hoisted_8, toDisplayString(unref(translate)("apiClient.oauth2.waitingForAuthorization")), 1), createVNode(unref(ScalarButton), {
|
|
283
|
+
size: "xs",
|
|
284
|
+
variant: "outlined",
|
|
285
|
+
onClick: cancelDeviceAuthorization
|
|
286
|
+
}, {
|
|
287
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.cancelDeviceAuthorization")), 1)]),
|
|
288
|
+
_: 1
|
|
289
|
+
})])
|
|
290
|
+
])])]),
|
|
291
|
+
_: 1
|
|
292
|
+
})) : createCommentVNode("", true),
|
|
228
293
|
createVNode(unref(DataTableRow_default), null, {
|
|
229
294
|
default: withCtx(() => ["authorizationUrl" in flow.value ? (openBlock(), createBlock(RequestAuthDataTableInput_default, {
|
|
230
295
|
key: 0,
|
|
@@ -232,39 +297,39 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
232
297
|
environment: __props.environment,
|
|
233
298
|
modelValue: flow.value["x-scalar-secret-auth-url"] ?? "",
|
|
234
299
|
placeholder: "https://galaxy.scalar.com/authorize",
|
|
235
|
-
"onUpdate:modelValue": _cache[
|
|
300
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = (v) => {
|
|
236
301
|
handleOauth2SecretsUpdate({ "x-scalar-secret-auth-url": v });
|
|
237
302
|
handleOauth2Update({ authorizationUrl: v });
|
|
238
303
|
})
|
|
239
304
|
}, {
|
|
240
|
-
default: withCtx(() => [
|
|
305
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.authUrl")), 1)]),
|
|
241
306
|
_: 1
|
|
242
307
|
}, 8, ["environment", "modelValue"])) : createCommentVNode("", true), "tokenUrl" in flow.value ? (openBlock(), createBlock(RequestAuthDataTableInput_default, {
|
|
243
308
|
key: 1,
|
|
244
309
|
environment: __props.environment,
|
|
245
310
|
modelValue: flow.value["x-scalar-secret-token-url"] ?? "",
|
|
246
311
|
placeholder: "https://galaxy.scalar.com/token",
|
|
247
|
-
"onUpdate:modelValue": _cache[
|
|
312
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = (v) => {
|
|
248
313
|
handleOauth2SecretsUpdate({ "x-scalar-secret-token-url": v });
|
|
249
314
|
handleOauth2Update({ tokenUrl: v });
|
|
250
315
|
})
|
|
251
316
|
}, {
|
|
252
|
-
default: withCtx(() => [
|
|
317
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.tokenUrl")), 1)]),
|
|
253
318
|
_: 1
|
|
254
319
|
}, 8, ["environment", "modelValue"])) : createCommentVNode("", true)]),
|
|
255
320
|
_: 1
|
|
256
321
|
}),
|
|
257
|
-
"x-scalar-secret-redirect-uri" in flow.value ? (openBlock(), createBlock(unref(DataTableRow_default), { key:
|
|
322
|
+
"x-scalar-secret-redirect-uri" in flow.value ? (openBlock(), createBlock(unref(DataTableRow_default), { key: 2 }, {
|
|
258
323
|
default: withCtx(() => [createVNode(RequestAuthDataTableInput_default, {
|
|
259
324
|
environment: __props.environment,
|
|
260
325
|
modelValue: flow.value["x-scalar-secret-redirect-uri"],
|
|
261
|
-
placeholder: __props.options.captureOAuth2Callback ? `${unref(resolveDefaultOAuth2RedirectUri)(__props.options) || "http://127.0.0.1"} (handled automatically)` : "
|
|
262
|
-
"onUpdate:modelValue": _cache[
|
|
326
|
+
placeholder: __props.options.captureOAuth2Callback ? `${unref(resolveDefaultOAuth2RedirectUri)(__props.options) || "http://127.0.0.1"} (handled automatically)` : unref(translate)("apiClient.oauth2.optionalRedirectUrl"),
|
|
327
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = (v) => {
|
|
263
328
|
hasHandledRedirectPrefill.value = true;
|
|
264
329
|
handleOauth2SecretsUpdate({ "x-scalar-secret-redirect-uri": v });
|
|
265
330
|
})
|
|
266
331
|
}, {
|
|
267
|
-
default: withCtx(() => [
|
|
332
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.redirectUrl")), 1)]),
|
|
268
333
|
_: 1
|
|
269
334
|
}, 8, [
|
|
270
335
|
"environment",
|
|
@@ -273,15 +338,15 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
273
338
|
])]),
|
|
274
339
|
_: 1
|
|
275
340
|
})) : createCommentVNode("", true),
|
|
276
|
-
"x-scalar-secret-username" in flow.value && "x-scalar-secret-password" in flow.value ? (openBlock(), createElementBlock(Fragment, { key:
|
|
341
|
+
"x-scalar-secret-username" in flow.value && "x-scalar-secret-password" in flow.value ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [createVNode(unref(DataTableRow_default), null, {
|
|
277
342
|
default: withCtx(() => [createVNode(RequestAuthDataTableInput_default, {
|
|
278
343
|
class: "text-c-2",
|
|
279
344
|
environment: __props.environment,
|
|
280
345
|
modelValue: flow.value["x-scalar-secret-username"],
|
|
281
346
|
placeholder: "janedoe",
|
|
282
|
-
"onUpdate:modelValue": _cache[
|
|
347
|
+
"onUpdate:modelValue": _cache[6] || (_cache[6] = (v) => handleOauth2SecretsUpdate({ "x-scalar-secret-username": v }))
|
|
283
348
|
}, {
|
|
284
|
-
default: withCtx(() => [
|
|
349
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.username")), 1)]),
|
|
285
350
|
_: 1
|
|
286
351
|
}, 8, ["environment", "modelValue"])]),
|
|
287
352
|
_: 1
|
|
@@ -291,9 +356,9 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
291
356
|
modelValue: flow.value["x-scalar-secret-password"],
|
|
292
357
|
placeholder: "********",
|
|
293
358
|
type: "password",
|
|
294
|
-
"onUpdate:modelValue": _cache[
|
|
359
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = (v) => handleOauth2SecretsUpdate({ "x-scalar-secret-password": v }))
|
|
295
360
|
}, {
|
|
296
|
-
default: withCtx(() => [
|
|
361
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.password")), 1)]),
|
|
297
362
|
_: 1
|
|
298
363
|
}, 8, ["environment", "modelValue"])]),
|
|
299
364
|
_: 1
|
|
@@ -303,35 +368,35 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
303
368
|
environment: __props.environment,
|
|
304
369
|
modelValue: flow.value["x-scalar-secret-client-id"],
|
|
305
370
|
placeholder: "12345",
|
|
306
|
-
"onUpdate:modelValue": _cache[
|
|
371
|
+
"onUpdate:modelValue": _cache[8] || (_cache[8] = (v) => handleOauth2SecretsUpdate({ "x-scalar-secret-client-id": v }))
|
|
307
372
|
}, {
|
|
308
|
-
default: withCtx(() => [
|
|
373
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.clientID")), 1)]),
|
|
309
374
|
_: 1
|
|
310
375
|
}, 8, ["environment", "modelValue"])]),
|
|
311
376
|
_: 1
|
|
312
377
|
}),
|
|
313
|
-
showClientSecret.value ? (openBlock(), createBlock(unref(DataTableRow_default), { key:
|
|
378
|
+
showClientSecret.value ? (openBlock(), createBlock(unref(DataTableRow_default), { key: 4 }, {
|
|
314
379
|
default: withCtx(() => [createVNode(RequestAuthDataTableInput_default, {
|
|
315
380
|
environment: __props.environment,
|
|
316
381
|
modelValue: clientSecretValue.value,
|
|
317
382
|
placeholder: "XYZ123",
|
|
318
383
|
type: "password",
|
|
319
|
-
"onUpdate:modelValue": _cache[
|
|
384
|
+
"onUpdate:modelValue": _cache[9] || (_cache[9] = (v) => handleOauth2SecretsUpdate({ "x-scalar-secret-client-secret": v }))
|
|
320
385
|
}, {
|
|
321
|
-
default: withCtx(() => [
|
|
386
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.clientSecret")), 1)]),
|
|
322
387
|
_: 1
|
|
323
388
|
}, 8, ["environment", "modelValue"])]),
|
|
324
389
|
_: 1
|
|
325
390
|
})) : createCommentVNode("", true),
|
|
326
|
-
"x-usePkce" in flow.value ? (openBlock(), createBlock(unref(DataTableRow_default), { key:
|
|
391
|
+
"x-usePkce" in flow.value ? (openBlock(), createBlock(unref(DataTableRow_default), { key: 5 }, {
|
|
327
392
|
default: withCtx(() => [createVNode(RequestAuthDataTableInput_default, {
|
|
328
393
|
enum: unref(pkceOptions),
|
|
329
394
|
environment: __props.environment,
|
|
330
395
|
modelValue: flow.value["x-usePkce"],
|
|
331
396
|
readOnly: "",
|
|
332
|
-
"onUpdate:modelValue": _cache[
|
|
397
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = (v) => handleOauth2Update({ "x-usePkce": v }))
|
|
333
398
|
}, {
|
|
334
|
-
default: withCtx(() => [
|
|
399
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.usePKCE")), 1)]),
|
|
335
400
|
_: 1
|
|
336
401
|
}, 8, [
|
|
337
402
|
"enum",
|
|
@@ -340,16 +405,16 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
340
405
|
])]),
|
|
341
406
|
_: 1
|
|
342
407
|
})) : createCommentVNode("", true),
|
|
343
|
-
__props.type !== "implicit" ? (openBlock(), createBlock(unref(DataTableRow_default), { key:
|
|
408
|
+
__props.type !== "implicit" ? (openBlock(), createBlock(unref(DataTableRow_default), { key: 6 }, {
|
|
344
409
|
default: withCtx(() => [createVNode(RequestAuthDataTableInput_default, {
|
|
345
410
|
enum: ["header", "body"],
|
|
346
411
|
environment: __props.environment,
|
|
347
412
|
modelValue: flow.value["x-scalar-credentials-location"] || "header",
|
|
348
413
|
placeholder: "header",
|
|
349
414
|
readOnly: "",
|
|
350
|
-
"onUpdate:modelValue": _cache[
|
|
415
|
+
"onUpdate:modelValue": _cache[11] || (_cache[11] = (v) => handleSecretLocationUpdate(v))
|
|
351
416
|
}, {
|
|
352
|
-
default: withCtx(() => [
|
|
417
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.credentialsLocation")), 1)]),
|
|
353
418
|
_: 1
|
|
354
419
|
}, 8, ["environment", "modelValue"])]),
|
|
355
420
|
_: 1
|
|
@@ -359,9 +424,9 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
359
424
|
flow: flow.value,
|
|
360
425
|
flowType: __props.type,
|
|
361
426
|
selectedScopes: selectedScopes.value,
|
|
362
|
-
"
|
|
363
|
-
"
|
|
364
|
-
"
|
|
427
|
+
"onDelete:scope": _cache[12] || (_cache[12] = (v) => emits("delete:scope", v)),
|
|
428
|
+
"onUpdate:selectedScopes": _cache[13] || (_cache[13] = (v) => emits("update:selectedScopes", v)),
|
|
429
|
+
"onUpsert:scope": _cache[14] || (_cache[14] = (v) => emits("upsert:scope", v))
|
|
365
430
|
}, null, 8, [
|
|
366
431
|
"flow",
|
|
367
432
|
"flowType",
|
|
@@ -370,10 +435,10 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
370
435
|
_: 1
|
|
371
436
|
}),
|
|
372
437
|
!__props.hideActions ? (openBlock(), createBlock(unref(DataTableRow_default), {
|
|
373
|
-
key:
|
|
438
|
+
key: 7,
|
|
374
439
|
class: "min-w-full"
|
|
375
440
|
}, {
|
|
376
|
-
default: withCtx(() => [createElementVNode("div",
|
|
441
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_9, [__props.scheme.type === "openIdConnect" ? (openBlock(), createBlock(unref(ScalarButton), {
|
|
377
442
|
key: 0,
|
|
378
443
|
class: "mr-1 p-0 px-2 py-0.5",
|
|
379
444
|
disabled: unref(loader).isLoading,
|
|
@@ -381,7 +446,7 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
381
446
|
variant: "outlined",
|
|
382
447
|
onClick: clearOauth2Secrets
|
|
383
448
|
}, {
|
|
384
|
-
default: withCtx(() => [
|
|
449
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.clear")), 1)]),
|
|
385
450
|
_: 1
|
|
386
451
|
}, 8, ["disabled"])) : createCommentVNode("", true), createVNode(unref(ScalarButton), {
|
|
387
452
|
class: "mr-0.75 p-0 px-2 py-0.5",
|
|
@@ -390,7 +455,7 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
390
455
|
variant: "outlined",
|
|
391
456
|
onClick: handleAuthorize
|
|
392
457
|
}, {
|
|
393
|
-
default: withCtx(() => [
|
|
458
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauth2.authorize")), 1)]),
|
|
394
459
|
_: 1
|
|
395
460
|
}, 8, ["loader"])])]),
|
|
396
461
|
_: 1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Any config options required for the OAuth2 flow */\nexport type OAuth2Options = Pick<\n ApiClientConfiguration,\n 'oauth2RedirectUri'\n> & {\n /** Optional fetch override (IPC-backed on desktop) used for token exchange, refresh, and OIDC discovery */\n customFetch?: typeof fetch\n /** Optional redirect capture (loopback-backed on desktop) for interactive OAuth2 flows */\n captureOAuth2Callback?: CaptureOAuth2Callback\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport type { ApiClientConfiguration } from '@scalar/types/api-reference'\nimport { pkceOptions } from '@scalar/types/entities'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { SecretsOAuthFlows } from '@scalar/workspace-store/entities/auth'\nimport type {\n ApiReferenceEvents,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport {\n getEnvironmentVariables,\n type OAuthFlowAuthorizationCodeSecret,\n type OAuthFlowClientCredentialsSecret,\n type OAuthFlowPasswordSecret,\n type OAuthFlowsObjectSecret,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCredentialsLocation } from '@scalar/workspace-store/schemas/extensions/security/x-scalar-credentials-location'\nimport { type XusePkce } from '@scalar/workspace-store/schemas/extensions/security/x-use-pkce'\nimport type {\n OAuthFlow,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, ref, watch } from 'vue'\n\nimport OAuthScopesInput from '@/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue'\nimport {\n authorizeOauth2,\n refreshOauth2Token,\n type CaptureOAuth2Callback,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/oauth'\nimport { resolveDefaultOAuth2RedirectUri } from '@/v2/blocks/scalar-auth-selector-block/helpers/resolve-default-oauth2-redirect-url'\nimport { DataTableRow } from '@/v2/components/data-table'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n flows,\n type,\n scheme,\n selectedScopes: selectedScopesProp,\n server,\n proxyUrl,\n eventBus,\n name,\n options = {},\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** OAuth flows */\n flows: OAuthFlowsObjectSecret\n /** Type of the OAuth flow */\n type: keyof OAuthFlowsObjectSecret\n /** Selected scopes */\n selectedScopes: string[]\n /** Security scheme */\n scheme: SecuritySchemeObjectSecret\n /** Current server configuration */\n server: ServerObject | null\n /** Proxy URL */\n proxyUrl: string\n /** Name of the security scheme */\n name: string\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /**\n * Hides the Authorize / Refresh / Clear actions. Used when the form is embedded as a\n * configuration-only view (e.g. behind a gear icon), so the host component owns the\n * authorize action and the tokens are routed to the scheme it chooses.\n */\n hideActions?: boolean\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: { scopes?: string[]; scope?: string; selected?: boolean },\n ): void\n (\n e: 'upsert:scope',\n payload: Omit<ApiReferenceEvents['auth:upsert:scopes'], 'name'>,\n ): void\n (\n e: 'delete:scope',\n payload: Omit<ApiReferenceEvents['auth:delete:scopes'], 'name'>,\n ): void\n}>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/** The current OAuth flow based on the selected type */\nconst flow = computed(() => flows[type]!)\ntype NonImplicitFlow =\n | OAuthFlowPasswordSecret\n | OAuthFlowClientCredentialsSecret\n | OAuthFlowAuthorizationCodeSecret\n\n/** We filter selected scopes to only include scopes that are defined on this flow (own keys only). */\nconst selectedScopes = computed(() => {\n const definedScopes = flow.value.scopes\n if (!definedScopes) {\n return []\n }\n return selectedScopesProp.filter((scope) =>\n Object.hasOwn(definedScopes, scope),\n )\n})\n\n/**\n * Show the client secret whenever the flow supports one. PKCE and a client\n * secret are independent, so confidential clients can use both together\n * (see RFC 9700 Section 2.1.1).\n */\nconst showClientSecret = computed(\n () => 'x-scalar-secret-client-secret' in flow.value,\n)\n\nconst clientSecretValue = computed((): string => {\n const f = flow.value as { 'x-scalar-secret-client-secret'?: string }\n return f['x-scalar-secret-client-secret'] ?? ''\n})\n\n/** Updates the security scheme base */\nconst handleOauth2Update = (\n payload: Partial<OAuthFlow & XScalarCredentialsLocation>,\n): void => {\n // OpenIdConnect uses the secrets update for all\n if (scheme.type === 'openIdConnect') {\n return handleOauth2SecretsUpdate(payload)\n }\n\n // Only OAuth2 schemes carry flows on the document; this component is never\n // rendered for the other scheme types.\n if (scheme.type !== 'oauth2') {\n return\n }\n\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: scheme.type,\n flows: {\n [type]: payload,\n },\n },\n name,\n })\n}\n\n/** Updates the flow secrets */\nconst handleOauth2SecretsUpdate = (\n payload: Omit<Partial<SecretsOAuthFlows[keyof SecretsOAuthFlows]>, 'type'>,\n): void => {\n // This component only renders for oauth2/openIdConnect. Other scheme types (e.g. mutualTLS)\n // carry no flow secrets, so there is nothing to persist and no matching secrets payload type.\n if (scheme.type !== 'oauth2' && scheme.type !== 'openIdConnect') {\n return\n }\n\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: {\n type: scheme.type,\n [type]: payload,\n },\n name,\n })\n}\n\n/** Clears the flow secrets */\nconst clearOauth2Secrets = (): void => {\n if (loader.isLoading) {\n return\n }\n eventBus.emit('auth:clear:security-scheme-secrets', {\n name,\n })\n}\n\n/** Clears stored access and refresh tokens (authorized state) */\nconst handleClearAccessTokens = (): void => {\n if (loader.isLoading) {\n return\n }\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-token': '',\n 'x-scalar-secret-refresh-token': '',\n })\n}\n\n/** Track redirect URI prefill per flow instance to support document switching */\nconst prefilledFlowIdentity = ref<string | null>(null)\nconst hasHandledRedirectPrefill = ref(false)\n\nconst resolveFlowIdentity = (\n currentFlow: OAuthFlowsObjectSecret[keyof OAuthFlowsObjectSecret] | undefined,\n): string =>\n JSON.stringify({\n type,\n authorizationUrl:\n currentFlow && 'authorizationUrl' in currentFlow\n ? currentFlow.authorizationUrl\n : '',\n tokenUrl:\n currentFlow && 'tokenUrl' in currentFlow ? currentFlow.tokenUrl : '',\n refreshUrl: currentFlow?.refreshUrl ?? '',\n scopes: Object.keys(currentFlow?.scopes ?? {}),\n })\n\n/** Default the redirect-uri to the current origin if we have access to window */\nwatch(\n () => flow.value,\n (currentFlow) => {\n if (!currentFlow || !('x-scalar-secret-redirect-uri' in currentFlow)) {\n return\n }\n\n const flowIdentity = resolveFlowIdentity(currentFlow)\n if (prefilledFlowIdentity.value !== flowIdentity) {\n prefilledFlowIdentity.value = flowIdentity\n hasHandledRedirectPrefill.value = false\n }\n\n if (hasHandledRedirectPrefill.value) {\n return\n }\n\n const newRedirectUri = (currentFlow as OAuthFlowAuthorizationCodeSecret)[\n 'x-scalar-secret-redirect-uri'\n ]\n const defaultRedirectUri = resolveDefaultOAuth2RedirectUri(options)\n\n hasHandledRedirectPrefill.value = true\n\n // The desktop loopback path computes the redirect URI at authorize time (an\n // ephemeral 127.0.0.1 port), so persisting a default into the document would\n // only bake in a stale, unused value. Leave it empty and show a hint instead.\n if (\n newRedirectUri ||\n !defaultRedirectUri ||\n options.captureOAuth2Callback\n ) {\n return\n }\n\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-redirect-uri': defaultRedirectUri,\n })\n },\n { immediate: true },\n)\n\n/**\n * Authorizes the user using the specified OAuth flow.\n * Opens the appropriate OAuth dialog and/or performs the token exchange.\n */\nconst handleAuthorize = async (): Promise<void> => {\n if (loader.isLoading) {\n return\n }\n\n loader.start()\n\n const [error, tokens] = await authorizeOauth2(\n flows,\n type,\n selectedScopes.value,\n server,\n proxyUrl,\n getEnvironmentVariables(environment),\n options.customFetch,\n options.captureOAuth2Callback,\n )\n\n await loader.clear()\n\n if (tokens?.accessToken) {\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-token': tokens.accessToken,\n ...(tokens.refreshToken\n ? { 'x-scalar-secret-refresh-token': tokens.refreshToken }\n : {}),\n })\n } else {\n console.error(error)\n toast(error?.message ?? 'Failed to authorize', 'error')\n }\n}\n\n/** Whether the current flow supports refreshing the access token */\nconst supportsRefreshToken = computed(() => type !== 'implicit')\n\n/**\n * Refresh URL placeholder, shows tokenUrl as hint if refreshUrl is not specified.\n * This helps users understand that tokenUrl will be used as fallback.\n */\nconst refreshUrlPlaceholder = computed(() => {\n if ('tokenUrl' in flow.value && flow.value.tokenUrl) {\n return flow.value.tokenUrl\n }\n return 'https://galaxy.scalar.com/oauth/refresh'\n})\n\n/**\n * Uses the stored refresh token to obtain a new access token\n * via grant_type=refresh_token.\n */\nconst handleRefresh = async (): Promise<void> => {\n if (loader.isLoading || type === 'implicit') {\n return\n }\n\n loader.start()\n\n const [error, tokens] = await refreshOauth2Token(\n flows,\n type,\n proxyUrl,\n server,\n getEnvironmentVariables(environment),\n options.customFetch,\n )\n\n await loader.clear()\n\n if (tokens?.accessToken) {\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-token': tokens.accessToken,\n ...(tokens.refreshToken\n ? { 'x-scalar-secret-refresh-token': tokens.refreshToken }\n : {}),\n })\n } else {\n console.error(error)\n toast(error?.message ?? 'Failed to refresh token', 'error')\n }\n}\n\n/** Updates the secret location */\nconst handleSecretLocationUpdate = (value: string): void => {\n const credentialsLocation = value === 'body' ? 'body' : 'header'\n\n if (scheme.type !== 'openIdConnect') {\n handleOauth2Update({\n 'x-scalar-credentials-location': credentialsLocation,\n })\n }\n\n handleOauth2SecretsUpdate({\n 'x-scalar-credentials-location': credentialsLocation,\n })\n}\n</script>\n\n<template>\n <!-- Access Token Display: Shows when user is already authorized -->\n <template v-if=\"Boolean(flow['x-scalar-secret-token'])\">\n <DataTableRow>\n <RequestAuthDataTableInput\n class=\"border-r-transparent\"\n :environment\n :modelValue=\"flow['x-scalar-secret-token']\"\n placeholder=\"QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT\"\n type=\"password\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-token': v })\n \">\n Access Token\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"supportsRefreshToken\">\n <RequestAuthDataTableInput\n class=\"border-r-transparent\"\n :environment\n :modelValue=\"flow.refreshUrl ?? ''\"\n :placeholder=\"refreshUrlPlaceholder\"\n @update:modelValue=\"(v) => handleOauth2Update({ refreshUrl: v })\">\n Refresh URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow\n v-if=\"!hideActions\"\n class=\"min-w-full\">\n <div class=\"flex h-8 items-center justify-end gap-2 border-t\">\n <ScalarButton\n v-if=\"supportsRefreshToken\"\n class=\"p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleRefresh\">\n Refresh\n </ScalarButton>\n <ScalarButton\n class=\"mr-1 p-0 px-2 py-0.5\"\n :disabled=\"loader.isLoading\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleClearAccessTokens\">\n Clear\n </ScalarButton>\n </div>\n </DataTableRow>\n </template>\n\n <!-- Authorization Form: Shows when user needs to authorize -->\n <template v-else>\n <DataTableRow>\n <RequestAuthDataTableInput\n v-if=\"'authorizationUrl' in flow\"\n containerClass=\"border-r-0\"\n :environment\n :modelValue=\"flow['x-scalar-secret-auth-url'] ?? ''\"\n placeholder=\"https://galaxy.scalar.com/authorize\"\n @update:modelValue=\"\n (v) => {\n handleOauth2SecretsUpdate({ 'x-scalar-secret-auth-url': v })\n handleOauth2Update({ authorizationUrl: v })\n }\n \">\n Auth URL\n </RequestAuthDataTableInput>\n\n <RequestAuthDataTableInput\n v-if=\"'tokenUrl' in flow\"\n :environment\n :modelValue=\"flow['x-scalar-secret-token-url'] ?? ''\"\n placeholder=\"https://galaxy.scalar.com/token\"\n @update:modelValue=\"\n (v) => {\n handleOauth2SecretsUpdate({ 'x-scalar-secret-token-url': v })\n handleOauth2Update({ tokenUrl: v })\n }\n \">\n Token URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-scalar-secret-redirect-uri' in flow\">\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-redirect-uri']\"\n :placeholder=\"\n options.captureOAuth2Callback\n ? `${resolveDefaultOAuth2RedirectUri(options) || 'http://127.0.0.1'} (handled automatically)`\n : 'Optional redirect URL'\n \"\n @update:modelValue=\"\n (v) => {\n hasHandledRedirectPrefill = true\n handleOauth2SecretsUpdate({ 'x-scalar-secret-redirect-uri': v })\n }\n \">\n Redirect URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <template\n v-if=\"\n 'x-scalar-secret-username' in flow && 'x-scalar-secret-password' in flow\n \">\n <DataTableRow>\n <RequestAuthDataTableInput\n class=\"text-c-2\"\n :environment\n :modelValue=\"flow['x-scalar-secret-username']\"\n placeholder=\"janedoe\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-username': v })\n \">\n Username\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-password']\"\n placeholder=\"********\"\n type=\"password\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-password': v })\n \">\n Password\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-client-id']\"\n placeholder=\"12345\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-client-id': v })\n \">\n Client ID\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"showClientSecret\">\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"clientSecretValue\"\n placeholder=\"XYZ123\"\n type=\"password\"\n @update:modelValue=\"\n (v) =>\n handleOauth2SecretsUpdate({ 'x-scalar-secret-client-secret': v })\n \">\n Client Secret\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-usePkce' in flow\">\n <RequestAuthDataTableInput\n :enum=\"pkceOptions\"\n :environment\n :modelValue=\"flow['x-usePkce']\"\n readOnly\n @update:modelValue=\"\n (v) =>\n handleOauth2Update({\n 'x-usePkce': v as XusePkce['x-usePkce'],\n })\n \">\n Use PKCE\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Credentials Location -->\n <DataTableRow v-if=\"type !== 'implicit'\">\n <RequestAuthDataTableInput\n :enum=\"['header', 'body']\"\n :environment\n :modelValue=\"\n (flow as NonImplicitFlow)['x-scalar-credentials-location'] || 'header'\n \"\n placeholder=\"header\"\n readOnly\n @update:modelValue=\"(v) => handleSecretLocationUpdate(v)\">\n Credentials Location\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Scopes -->\n <DataTableRow>\n <OAuthScopesInput\n :flow\n :flowType=\"type\"\n :selectedScopes\n @update:selectedScopes=\"(v) => emits('update:selectedScopes', v)\"\n @upsert:scope=\"(v) => emits('upsert:scope', v)\"\n @delete:scope=\"(v) => emits('delete:scope', v)\" />\n </DataTableRow>\n\n <DataTableRow\n v-if=\"!hideActions\"\n class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <!-- Allow clearing the oauth section and going back to discovery -->\n <ScalarButton\n v-if=\"scheme.type === 'openIdConnect'\"\n class=\"mr-1 p-0 px-2 py-0.5\"\n :disabled=\"loader.isLoading\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"clearOauth2Secrets\">\n Clear\n </ScalarButton>\n\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleAuthorize\">\n Authorize\n </ScalarButton>\n </div>\n </DataTableRow>\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4FA,MAAM,QAAQ;EAed,MAAM,SAAS,gBAAgB;EAC/B,MAAM,EAAE,UAAU,UAAU;;EAG5B,MAAM,OAAO,eAAe,QAAA,M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UAAA,MAAA;MACN,aAAA,QAAA;MACA,YAAwB,KAAA,MAAI,oCAAA;MAG7B,aAAY;MACZ,UAAA;MACC,uBAAiB,OAAA,QAAA,OAAA,OAAG,MAAM,2BAA2B,CAAC;;6BAEzD,CAAA,GAAA,OAAA,QAAA,OAAA,MAAA,CAAA,gBAF4D,0BAE5D,EAAA,CAAA,EAAA,CAAA;;;;;IAIF,YAQe,MAAA,oBAAA,GAAA,MAAA;4BADuC,CANpD,YAMoD,0BAAA;MALjD,MAAA,KAAA;MACA,UAAU,QAAA;MACV,gBAAA,eAAA;MACA,2BAAqB,OAAA,QAAA,OAAA,OAAG,MAAM,MAAK,yBAA0B,CAAC;MAC9D,kBAAY,OAAA,QAAA,OAAA,OAAG,MAAM,MAAK,gBAAiB,CAAC;MAC5C,kBAAY,OAAA,QAAA,OAAA,OAAG,MAAM,MAAK,gBAAiB,CAAC;;;;;;;;KAIxC,QAAA,eAAA,UAAA,GADT,YAwBe,MAAA,oBAAA,GAAA;;KAtBb,OAAM;;4BAqBA,CApBN,mBAoBM,OApBN,YAoBM,CAjBI,QAAA,OAAO,SAAI,mBAAA,UAAA,GADnB,YAQe,MAAA,YAAA,GAAA;;MANb,OAAM;MACL,UAAU,MAAA,MAAA,CAAM,CAAC;MAClB,MAAK;MACL,SAAQ;MACP,SAAO;;6BAEV,CAAA,GAAA,OAAA,QAAA,OAAA,MAAA,CAAA,gBAF8B,WAE9B,EAAA,CAAA,EAAA,CAAA;;0DAEA,YAOe,MAAA,YAAA,GAAA;MANb,OAAM;MACL,QAAA,MAAA,MAAA;MACD,MAAK;MACL,SAAQ;MACP,SAAO;;6BAEV,CAAA,GAAA,OAAA,QAAA,OAAA,MAAA,CAAA,gBAF2B,eAE3B,EAAA,CAAA,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"OAuth2.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Any config options required for the OAuth2 flow */\nexport type OAuth2Options = Pick<\n ApiClientConfiguration,\n 'oauth2RedirectUri'\n> & {\n /** Optional fetch override (IPC-backed on desktop) used for token exchange, refresh, and OIDC discovery */\n customFetch?: typeof fetch\n /** Optional redirect capture (loopback-backed on desktop) for interactive OAuth2 flows */\n captureOAuth2Callback?: CaptureOAuth2Callback\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport type { ApiClientConfiguration } from '@scalar/types/api-reference'\nimport { pkceOptions } from '@scalar/types/entities'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { SecretsOAuthFlows } from '@scalar/workspace-store/entities/auth'\nimport type {\n ApiReferenceEvents,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport {\n getEnvironmentVariables,\n type OAuthFlowAuthorizationCodeSecret,\n type OAuthFlowClientCredentialsSecret,\n type OAuthFlowPasswordSecret,\n type OAuthFlowsObjectSecret,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCredentialsLocation } from '@scalar/workspace-store/schemas/extensions/security/x-scalar-credentials-location'\nimport { type XusePkce } from '@scalar/workspace-store/schemas/extensions/security/x-use-pkce'\nimport type {\n OAuthFlow,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\n\nimport OAuthScopesInput from '@/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue'\nimport {\n authorizeOauth2,\n refreshOauth2Token,\n type CaptureOAuth2Callback,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/oauth'\nimport { resolveDefaultOAuth2RedirectUri } from '@/v2/blocks/scalar-auth-selector-block/helpers/resolve-default-oauth2-redirect-url'\nimport { DataTableRow } from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport type { DeviceAuthorizationPrompt } from '../helpers/oauth-device-authorization'\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n flows,\n type,\n scheme,\n selectedScopes: selectedScopesProp,\n server,\n proxyUrl,\n eventBus,\n name,\n options = {},\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** OAuth flows */\n flows: OAuthFlowsObjectSecret\n /** Type of the OAuth flow */\n type: keyof OAuthFlowsObjectSecret\n /** Selected scopes */\n selectedScopes: string[]\n /** Security scheme */\n scheme: SecuritySchemeObjectSecret\n /** Current server configuration */\n server: ServerObject | null\n /** Proxy URL */\n proxyUrl: string\n /** Name of the security scheme */\n name: string\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /**\n * Hides the Authorize / Refresh / Clear actions. Used when the form is embedded as a\n * configuration-only view (e.g. behind a gear icon), so the host component owns the\n * authorize action and the tokens are routed to the scheme it chooses.\n */\n hideActions?: boolean\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: { scopes?: string[]; scope?: string; selected?: boolean },\n ): void\n (\n e: 'upsert:scope',\n payload: Omit<ApiReferenceEvents['auth:upsert:scopes'], 'name'>,\n ): void\n (\n e: 'delete:scope',\n payload: Omit<ApiReferenceEvents['auth:delete:scopes'], 'name'>,\n ): void\n}>()\n\nconst devicePrompt = ref<DeviceAuthorizationPrompt | null>(null)\nlet deviceController: AbortController | undefined\nconst cancelDeviceAuthorization = (): void => {\n deviceController?.abort()\n devicePrompt.value = null\n}\nonBeforeUnmount(cancelDeviceAuthorization)\nwatch(() => [type, name, flows], cancelDeviceAuthorization)\n\nconst { translate } = useLocalization()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/** The current OAuth flow based on the selected type */\nconst flow = computed(() => flows[type]!)\ntype NonImplicitFlow =\n | OAuthFlowPasswordSecret\n | OAuthFlowClientCredentialsSecret\n | OAuthFlowAuthorizationCodeSecret\n\n/** We filter selected scopes to only include scopes that are defined on this flow (own keys only). */\nconst selectedScopes = computed(() => {\n const definedScopes = flow.value.scopes\n if (!definedScopes) {\n return []\n }\n return selectedScopesProp.filter((scope) =>\n Object.hasOwn(definedScopes, scope),\n )\n})\n\n/**\n * Show the client secret whenever the flow supports one. PKCE and a client\n * secret are independent, so confidential clients can use both together\n * (see RFC 9700 Section 2.1.1).\n */\nconst showClientSecret = computed(\n () => 'x-scalar-secret-client-secret' in flow.value,\n)\n\nconst clientSecretValue = computed((): string => {\n const f = flow.value as { 'x-scalar-secret-client-secret'?: string }\n return f['x-scalar-secret-client-secret'] ?? ''\n})\n\n/** Updates the security scheme base */\nconst handleOauth2Update = (\n payload: Partial<OAuthFlow & XScalarCredentialsLocation> & {\n deviceAuthorizationUrl?: string\n },\n): void => {\n // OpenIdConnect uses the secrets update for all\n if (scheme.type === 'openIdConnect') {\n return handleOauth2SecretsUpdate(payload)\n }\n\n // Only OAuth2 schemes carry flows on the document; this component is never\n // rendered for the other scheme types.\n if (scheme.type !== 'oauth2') {\n return\n }\n\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: scheme.type,\n flows: {\n [type]: payload,\n },\n },\n name,\n })\n}\n\n/** Updates the flow secrets */\nconst handleOauth2SecretsUpdate = (\n payload: Omit<Partial<SecretsOAuthFlows[keyof SecretsOAuthFlows]>, 'type'>,\n): void => {\n // This component only renders for oauth2/openIdConnect. Other scheme types (e.g. mutualTLS)\n // carry no flow secrets, so there is nothing to persist and no matching secrets payload type.\n if (scheme.type !== 'oauth2' && scheme.type !== 'openIdConnect') {\n return\n }\n\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: {\n type: scheme.type,\n [type]: payload,\n },\n name,\n })\n}\n\n/** Clears the flow secrets */\nconst clearOauth2Secrets = (): void => {\n if (loader.isLoading) {\n return\n }\n eventBus.emit('auth:clear:security-scheme-secrets', {\n name,\n })\n}\n\n/** Clears stored access and refresh tokens (authorized state) */\nconst handleClearAccessTokens = (): void => {\n if (loader.isLoading) {\n return\n }\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-token': '',\n 'x-scalar-secret-refresh-token': '',\n })\n}\n\n/** Track redirect URI prefill per flow instance to support document switching */\nconst prefilledFlowIdentity = ref<string | null>(null)\nconst hasHandledRedirectPrefill = ref(false)\n\nconst resolveFlowIdentity = (\n currentFlow: OAuthFlowsObjectSecret[keyof OAuthFlowsObjectSecret] | undefined,\n): string =>\n JSON.stringify({\n type,\n authorizationUrl:\n currentFlow && 'authorizationUrl' in currentFlow\n ? currentFlow.authorizationUrl\n : '',\n tokenUrl:\n currentFlow && 'tokenUrl' in currentFlow ? currentFlow.tokenUrl : '',\n refreshUrl: currentFlow?.refreshUrl ?? '',\n scopes: Object.keys(currentFlow?.scopes ?? {}),\n })\n\n/** Default the redirect-uri to the current origin if we have access to window */\nwatch(\n () => flow.value,\n (currentFlow) => {\n if (!currentFlow || !('x-scalar-secret-redirect-uri' in currentFlow)) {\n return\n }\n\n const flowIdentity = resolveFlowIdentity(currentFlow)\n if (prefilledFlowIdentity.value !== flowIdentity) {\n prefilledFlowIdentity.value = flowIdentity\n hasHandledRedirectPrefill.value = false\n }\n\n if (hasHandledRedirectPrefill.value) {\n return\n }\n\n const newRedirectUri = (currentFlow as OAuthFlowAuthorizationCodeSecret)[\n 'x-scalar-secret-redirect-uri'\n ]\n const defaultRedirectUri = resolveDefaultOAuth2RedirectUri(options)\n\n hasHandledRedirectPrefill.value = true\n\n // The desktop loopback path computes the redirect URI at authorize time (an\n // ephemeral 127.0.0.1 port), so persisting a default into the document would\n // only bake in a stale, unused value. Leave it empty and show a hint instead.\n if (\n newRedirectUri ||\n !defaultRedirectUri ||\n options.captureOAuth2Callback\n ) {\n return\n }\n\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-redirect-uri': defaultRedirectUri,\n })\n },\n { immediate: true },\n)\n\n/**\n * Authorizes the user using the specified OAuth flow.\n * Opens the appropriate OAuth dialog and/or performs the token exchange.\n */\nconst handleAuthorize = async (): Promise<void> => {\n if (loader.isLoading) {\n return\n }\n\n loader.start()\n const controller = new AbortController()\n deviceController = controller\n\n const [error, tokens] = await authorizeOauth2(\n flows,\n type,\n selectedScopes.value,\n server,\n proxyUrl,\n getEnvironmentVariables(environment),\n options.customFetch,\n options.captureOAuth2Callback,\n {\n signal: controller.signal,\n onPrompt: (prompt) => {\n devicePrompt.value = prompt\n },\n },\n )\n devicePrompt.value = null\n\n await loader.clear()\n if (controller.signal.aborted) {\n return\n }\n\n if (tokens?.accessToken) {\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-token': tokens.accessToken,\n ...(tokens.refreshToken\n ? { 'x-scalar-secret-refresh-token': tokens.refreshToken }\n : {}),\n })\n } else {\n console.error(error)\n toast(\n error?.message ?? translate('apiClient.oauth2.failedToauthorize'),\n 'error',\n )\n }\n}\n\n/** Whether the current flow supports refreshing the access token */\nconst supportsRefreshToken = computed(() => type !== 'implicit')\n\n/**\n * Refresh URL placeholder, shows tokenUrl as hint if refreshUrl is not specified.\n * This helps users understand that tokenUrl will be used as fallback.\n */\nconst refreshUrlPlaceholder = computed(() => {\n if ('tokenUrl' in flow.value && flow.value.tokenUrl) {\n return flow.value.tokenUrl\n }\n return 'https://galaxy.scalar.com/oauth/refresh'\n})\n\n/**\n * Uses the stored refresh token to obtain a new access token\n * via grant_type=refresh_token.\n */\nconst handleRefresh = async (): Promise<void> => {\n if (loader.isLoading || type === 'implicit') {\n return\n }\n\n loader.start()\n\n const [error, tokens] = await refreshOauth2Token(\n flows,\n type,\n proxyUrl,\n server,\n getEnvironmentVariables(environment),\n options.customFetch,\n )\n\n await loader.clear()\n\n if (tokens?.accessToken) {\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-token': tokens.accessToken,\n ...(tokens.refreshToken\n ? { 'x-scalar-secret-refresh-token': tokens.refreshToken }\n : {}),\n })\n } else {\n console.error(error)\n toast(\n error?.message ?? translate('apiClient.oauth2.failedToRefreshToken'),\n 'error',\n )\n }\n}\n\n/** Updates the secret location */\nconst handleSecretLocationUpdate = (value: string): void => {\n const credentialsLocation = value === 'body' ? 'body' : 'header'\n\n if (scheme.type !== 'openIdConnect') {\n handleOauth2Update({\n 'x-scalar-credentials-location': credentialsLocation,\n })\n }\n\n handleOauth2SecretsUpdate({\n 'x-scalar-credentials-location': credentialsLocation,\n })\n}\n</script>\n\n<template>\n <!-- Access Token Display: Shows when user is already authorized -->\n <template v-if=\"Boolean(flow['x-scalar-secret-token'])\">\n <DataTableRow>\n <RequestAuthDataTableInput\n class=\"border-r-transparent\"\n :environment\n :modelValue=\"flow['x-scalar-secret-token']\"\n placeholder=\"QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT\"\n type=\"password\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-token': v })\n \">\n {{ translate('apiClient.oauth2.accessToken') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"supportsRefreshToken\">\n <RequestAuthDataTableInput\n class=\"border-r-transparent\"\n :environment\n :modelValue=\"flow.refreshUrl ?? ''\"\n :placeholder=\"refreshUrlPlaceholder\"\n @update:modelValue=\"(v) => handleOauth2Update({ refreshUrl: v })\">\n {{ translate('apiClient.oauth2.refreshUrl') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow\n v-if=\"!hideActions\"\n class=\"min-w-full\">\n <div class=\"flex h-8 items-center justify-end gap-2 border-t\">\n <ScalarButton\n v-if=\"supportsRefreshToken\"\n class=\"p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleRefresh\">\n {{ translate('apiClient.oauth2.refresh') }}\n </ScalarButton>\n <ScalarButton\n class=\"mr-1 p-0 px-2 py-0.5\"\n :disabled=\"loader.isLoading\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleClearAccessTokens\">\n {{ translate('apiClient.oauth2.clear') }}\n </ScalarButton>\n </div>\n </DataTableRow>\n </template>\n\n <!-- Authorization Form: Shows when user needs to authorize -->\n <template v-else>\n <DataTableRow v-if=\"'deviceAuthorizationUrl' in flow\">\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow.deviceAuthorizationUrl\"\n @update:modelValue=\"\n (v) => handleOauth2Update({ deviceAuthorizationUrl: v })\n \">\n {{ translate('apiClient.oauth2.deviceAuthorizationUrl') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow v-if=\"devicePrompt\">\n <div class=\"w-full p-2\">\n <div\n class=\"bg-b-2 flex flex-col gap-3 rounded-lg border p-3 text-sm\"\n role=\"status\">\n <p class=\"text-c-2 text-xs leading-normal\">\n {{ translate('apiClient.oauth2.deviceVerificationPrompt') }}\n </p>\n <strong\n class=\"bg-b-1 font-code w-fit max-w-full rounded border px-3 py-2 text-base font-medium tracking-widest break-all select-all\">\n {{ devicePrompt.userCode }}\n </strong>\n <a\n class=\"text-c-accent w-fit max-w-full text-xs break-all underline underline-offset-2\"\n :href=\"\n devicePrompt.verificationUriComplete ||\n devicePrompt.verificationUri\n \"\n rel=\"noopener noreferrer\"\n target=\"_blank\">\n {{ devicePrompt.verificationUri }}\n </a>\n <div class=\"flex items-center justify-between gap-3\">\n <p class=\"text-c-2 text-xs\">\n {{ translate('apiClient.oauth2.waitingForAuthorization') }}\n </p>\n <ScalarButton\n size=\"xs\"\n variant=\"outlined\"\n @click=\"cancelDeviceAuthorization\">\n {{ translate('apiClient.oauth2.cancelDeviceAuthorization') }}\n </ScalarButton>\n </div>\n </div>\n </div>\n </DataTableRow>\n <DataTableRow>\n <RequestAuthDataTableInput\n v-if=\"'authorizationUrl' in flow\"\n containerClass=\"border-r-0\"\n :environment\n :modelValue=\"flow['x-scalar-secret-auth-url'] ?? ''\"\n placeholder=\"https://galaxy.scalar.com/authorize\"\n @update:modelValue=\"\n (v) => {\n handleOauth2SecretsUpdate({ 'x-scalar-secret-auth-url': v })\n handleOauth2Update({ authorizationUrl: v })\n }\n \">\n {{ translate('apiClient.oauth2.authUrl') }}\n </RequestAuthDataTableInput>\n\n <RequestAuthDataTableInput\n v-if=\"'tokenUrl' in flow\"\n :environment\n :modelValue=\"flow['x-scalar-secret-token-url'] ?? ''\"\n placeholder=\"https://galaxy.scalar.com/token\"\n @update:modelValue=\"\n (v) => {\n handleOauth2SecretsUpdate({ 'x-scalar-secret-token-url': v })\n handleOauth2Update({ tokenUrl: v })\n }\n \">\n {{ translate('apiClient.oauth2.tokenUrl') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-scalar-secret-redirect-uri' in flow\">\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-redirect-uri']\"\n :placeholder=\"\n options.captureOAuth2Callback\n ? `${resolveDefaultOAuth2RedirectUri(options) || 'http://127.0.0.1'} (handled automatically)`\n : translate('apiClient.oauth2.optionalRedirectUrl')\n \"\n @update:modelValue=\"\n (v) => {\n hasHandledRedirectPrefill = true\n handleOauth2SecretsUpdate({ 'x-scalar-secret-redirect-uri': v })\n }\n \">\n {{ translate('apiClient.oauth2.redirectUrl') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <template\n v-if=\"\n 'x-scalar-secret-username' in flow && 'x-scalar-secret-password' in flow\n \">\n <DataTableRow>\n <RequestAuthDataTableInput\n class=\"text-c-2\"\n :environment\n :modelValue=\"flow['x-scalar-secret-username']\"\n placeholder=\"janedoe\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-username': v })\n \">\n {{ translate('apiClient.oauth2.username') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-password']\"\n placeholder=\"********\"\n type=\"password\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-password': v })\n \">\n {{ translate('apiClient.oauth2.password') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-client-id']\"\n placeholder=\"12345\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-client-id': v })\n \">\n {{ translate('apiClient.oauth2.clientID') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"showClientSecret\">\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"clientSecretValue\"\n placeholder=\"XYZ123\"\n type=\"password\"\n @update:modelValue=\"\n (v) =>\n handleOauth2SecretsUpdate({ 'x-scalar-secret-client-secret': v })\n \">\n {{ translate('apiClient.oauth2.clientSecret') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-usePkce' in flow\">\n <RequestAuthDataTableInput\n :enum=\"pkceOptions\"\n :environment\n :modelValue=\"flow['x-usePkce']\"\n readOnly\n @update:modelValue=\"\n (v) =>\n handleOauth2Update({\n 'x-usePkce': v as XusePkce['x-usePkce'],\n })\n \">\n {{ translate('apiClient.oauth2.usePKCE') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Credentials Location -->\n <DataTableRow v-if=\"type !== 'implicit'\">\n <RequestAuthDataTableInput\n :enum=\"['header', 'body']\"\n :environment\n :modelValue=\"\n (flow as NonImplicitFlow)['x-scalar-credentials-location'] || 'header'\n \"\n placeholder=\"header\"\n readOnly\n @update:modelValue=\"(v) => handleSecretLocationUpdate(v)\">\n {{ translate('apiClient.oauth2.credentialsLocation') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Scopes -->\n <DataTableRow>\n <OAuthScopesInput\n :flow\n :flowType=\"type\"\n :selectedScopes\n @delete:scope=\"(v) => emits('delete:scope', v)\"\n @update:selectedScopes=\"(v) => emits('update:selectedScopes', v)\"\n @upsert:scope=\"(v) => emits('upsert:scope', v)\" />\n </DataTableRow>\n\n <DataTableRow\n v-if=\"!hideActions\"\n class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <!-- Allow clearing the oauth section and going back to discovery -->\n <ScalarButton\n v-if=\"scheme.type === 'openIdConnect'\"\n class=\"mr-1 p-0 px-2 py-0.5\"\n :disabled=\"loader.isLoading\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"clearOauth2Secrets\">\n {{ translate('apiClient.oauth2.clear') }}\n </ScalarButton>\n\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleAuthorize\">\n {{ translate('apiClient.oauth2.authorize') }}\n </ScalarButton>\n </div>\n </DataTableRow>\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8FA,MAAM,QAAQ;EAed,MAAM,eAAe,IAAsC,IAAI;EAC/D,IAAI;EACJ,MAAM,kCAAwC;GAC5C,kBAAkB,MAAM;GACxB,aAAa,QAAQ;EACvB;EACA,gBAAgB,yBAAyB;EACzC,YAAY;GAAC,QAAA;GAAM,QAAA;GAAM,QAAA;EAAK,GAAG,yBAAyB;EAE1D,MAAM,EAAE,cAAc,gBAAgB;EAEtC,MAAM,SAAS,gBAAgB;EAC/B,MAAM,EAAE,UAAU,UAAU;;EAG5B,MAAM,OAAO,eAAe,QAAA,MAAM,QAAA,KAAM;EAOxC,MAAM,iBAAiB,eAAe;GACpC,MAAM,gBAAgB,KAAK,MAAM;GACjC,IAAI,CAAC,eACH,OAAO,CAAC;GAEV,OAAO,QAAA,eAAmB,QAAQ,UAChC,OAAO,OAAO,eAAe,KAAK,CACpC;EACF,CAAC;;;;;;EAOD,MAAM,mBAAmB,eACjB,mCAAmC,KAAK,KAChD;EAEA,MAAM,oBAAoB,eAAuB;GAE/C,OADU,KAAK,MACN,oCAAoC;EAC/C,CAAC;;EAGD,MAAM,sBACJ,YAGS;GAET,IAAI,QAAA,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ACA,UAAU,QAAA;MACV,gBAAA,eAAA;MACA,kBAAY,OAAA,QAAA,OAAA,OAAG,MAAM,MAAK,gBAAiB,CAAC;MAC5C,2BAAqB,OAAA,QAAA,OAAA,OAAG,MAAM,MAAK,yBAA0B,CAAC;MAC9D,kBAAY,OAAA,QAAA,OAAA,OAAG,MAAM,MAAK,gBAAiB,CAAC;;;;;;;;KAIxC,QAAA,eAAA,UAAA,GADT,YAwBe,MAAA,oBAAA,GAAA;;KAtBb,OAAM;;4BAqBA,CApBN,mBAoBM,OApBN,YAoBM,CAjBI,QAAA,OAAO,SAAI,mBAAA,UAAA,GADnB,YAQe,MAAA,YAAA,GAAA;;MANb,OAAM;MACL,UAAU,MAAA,MAAA,CAAM,CAAC;MAClB,MAAK;MACL,SAAQ;MACP,SAAO;;6BACiC,CAAA,gBAAA,gBAAtC,MAAA,SAAA,CAAS,CAAA,wBAAA,CAAA,GAAA,CAAA,CAAA,CAAA;;0DAGd,YAOe,MAAA,YAAA,GAAA;MANb,OAAM;MACL,QAAA,MAAA,MAAA;MACD,MAAK;MACL,SAAQ;MACP,SAAO;;6BACqC,CAAA,gBAAA,gBAA1C,MAAA,SAAA,CAAS,CAAA,4BAAA,CAAA,GAAA,CAAA,CAAA,CAAA"}
|
package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthScopesAddModal.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OAuthScopesAddModal.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue"],"names":[],"mappings":"AAwLA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AASvE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,UAAU,CAAA;IACjB,mEAAmE;IACnE,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CACrD,CAAC;AAyRF,QAAA,MAAM,YAAY;;cA5QN,MAAM;qBACC,MAAM;QACnB,6EAA6E;kBACnE,MAAM;;;;;cAHV,MAAM;qBACC,MAAM;QACnB,6EAA6E;kBACnE,MAAM;;;kFA4QpB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthScopesAddModal.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n CommandActionForm,\n CommandActionInput,\n} from '@/v2/features/command-palette'\n\nconst {\n state,\n scopes,\n scope = null,\n} = defineProps<{\n state: ModalState\n /** Existing scope names on the flow, used to prevent duplicates */\n scopes: string[]\n /**\n * When provided, the modal switches to \"edit\" mode and is prefilled with this scope.\n * The original name is retained so the consumer can rename it.\n */\n scope?: { name: string; description: string } | null\n}>()\n\nconst emit = defineEmits<{\n (event: 'cancel'): void\n (\n event: 'submit',\n scopeData: {\n name: string\n description: string\n /** The original name on the flow, only set when editing an existing scope */\n oldName?: string\n },\n ): void\n}>()\n\nconst isEditMode = computed(() => scope !== null)\nconst title = computed(()
|
|
1
|
+
{"version":3,"file":"OAuthScopesAddModal.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n CommandActionForm,\n CommandActionInput,\n} from '@/v2/features/command-palette'\nimport { useLocalization } from '@/v2/features/localization'\n\nconst {\n state,\n scopes,\n scope = null,\n} = defineProps<{\n state: ModalState\n /** Existing scope names on the flow, used to prevent duplicates */\n scopes: string[]\n /**\n * When provided, the modal switches to \"edit\" mode and is prefilled with this scope.\n * The original name is retained so the consumer can rename it.\n */\n scope?: { name: string; description: string } | null\n}>()\n\nconst emit = defineEmits<{\n (event: 'cancel'): void\n (\n event: 'submit',\n scopeData: {\n name: string\n description: string\n /** The original name on the flow, only set when editing an existing scope */\n oldName?: string\n },\n ): void\n}>()\n\nconst { translate } = useLocalization()\n\nconst isEditMode = computed(() => scope !== null)\nconst title = computed(() =>\n isEditMode.value\n ? translate('apiClient.oauthScopesAddModal.edit')\n : translate('apiClient.oauthScopesAddModal.add'),\n)\nconst submitLabel = computed(() =>\n isEditMode.value\n ? translate('apiClient.oauthScopesAddModal.save')\n : translate('apiClient.oauthScopesAddModal.add'),\n)\n\nconst scopeData = ref({\n name: '',\n description: '',\n})\n\n/**\n * Tracks whether the user has interacted with the name field so we can defer the\n * \"name is required\" hint until after the first edit, rather than on initial render.\n */\nconst hasTouchedName = ref(false)\n\nwatch(\n () => scopeData.value.name,\n () => {\n hasTouchedName.value = true\n },\n)\n\nconst trimmedName = computed(() => scopeData.value.name.trim())\n\n/**\n * Whether the chosen name collides with an existing scope on the flow.\n * In edit mode we allow keeping the original name unchanged.\n */\nconst isDuplicateName = computed(() => {\n if (!trimmedName.value) {\n return false\n }\n if (isEditMode.value && trimmedName.value === scope?.name) {\n return false\n }\n return scopes.includes(trimmedName.value)\n})\n\n/** Human readable validation message rendered inline in the modal */\nconst validationError = computed<string | null>(() => {\n if (isDuplicateName.value) {\n return translate('apiClient.oauthScopesAddModal.duplicate', {\n name: trimmedName.value,\n })\n }\n if (hasTouchedName.value && !trimmedName.value) {\n return translate('apiClient.oauthScopesAddModal.required')\n }\n return null\n})\n\nconst isSubmitDisabled = computed(\n () => !trimmedName.value || isDuplicateName.value,\n)\n\nconst handleSubmit = () => {\n if (isSubmitDisabled.value) {\n return\n }\n\n emit('submit', {\n name: trimmedName.value,\n description: scopeData.value.description,\n ...(isEditMode.value && scope ? { oldName: scope.name } : {}),\n })\n state.hide()\n}\n\nwatch(\n () => state.open,\n (isOpen) => {\n if (!isOpen) {\n return\n }\n\n scopeData.value = scope\n ? { name: scope.name, description: scope.description }\n : { name: '', description: '' }\n // Clearing `name` schedules the `scopeData.name` watcher, which sets\n // `hasTouchedName` back to true in the same flush. Defer the reset so it\n // runs after that watcher and reopening add mode does not show a false\n // \"Scope name is required\" error.\n void nextTick(() => {\n hasTouchedName.value = false\n })\n },\n)\n</script>\n\n<template>\n <ScalarModal\n bodyClass=\"overflow-y-auto\"\n size=\"xs\"\n :state=\"state\"\n :title=\"title\">\n <CommandActionForm\n :disabled=\"isSubmitDisabled\"\n @cancel=\"emit('cancel')\"\n @submit=\"handleSubmit\">\n <!-- Name -->\n <div class=\"flex min-h-8 items-start gap-2 text-sm\">\n {{ translate('apiClient.oauthScopesAddModal.name')\n }}<CommandActionInput\n v-model=\"scopeData.name\"\n autofocus\n class=\"field-sizing-content !p-0\"\n placeholder=\"read:user\" />\n </div>\n\n <!-- Description -->\n <div class=\"flex min-h-8 items-start gap-2 text-sm\">\n {{ translate('apiClient.oauthScopesAddModal.description')\n }}<CommandActionInput\n v-model=\"scopeData.description\"\n :autofocus=\"false\"\n class=\"field-sizing-content !p-0\"\n :placeholder=\"\n translate('apiClient.oauthScopesAddModal.readUserData')\n \" />\n </div>\n\n <!-- Inline validation error -->\n <div\n v-if=\"validationError\"\n class=\"text-red text-xs\"\n role=\"alert\">\n {{ validationError }}\n </div>\n\n <template #submit>{{ submitLabel }}</template>\n </CommandActionForm>\n </ScalarModal>\n</template>\n"],"mappings":""}
|
package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLocalization } from "../../../features/localization/index.js";
|
|
1
2
|
import CommandActionForm_default from "../../../features/command-palette/components/CommandActionForm.vue.js";
|
|
2
3
|
import CommandActionInput_default from "../../../features/command-palette/components/CommandActionInput.vue.js";
|
|
3
4
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, nextTick, openBlock, ref, toDisplayString, unref, watch, withCtx } from "vue";
|
|
@@ -20,9 +21,10 @@ var OAuthScopesAddModal_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
|
|
|
20
21
|
emits: ["cancel", "submit"],
|
|
21
22
|
setup(__props, { emit: __emit }) {
|
|
22
23
|
const emit = __emit;
|
|
24
|
+
const { translate } = useLocalization();
|
|
23
25
|
const isEditMode = computed(() => __props.scope !== null);
|
|
24
|
-
const title = computed(() => isEditMode.value ? "
|
|
25
|
-
const submitLabel = computed(() => isEditMode.value ? "
|
|
26
|
+
const title = computed(() => isEditMode.value ? translate("apiClient.oauthScopesAddModal.edit") : translate("apiClient.oauthScopesAddModal.add"));
|
|
27
|
+
const submitLabel = computed(() => isEditMode.value ? translate("apiClient.oauthScopesAddModal.save") : translate("apiClient.oauthScopesAddModal.add"));
|
|
26
28
|
const scopeData = ref({
|
|
27
29
|
name: "",
|
|
28
30
|
description: ""
|
|
@@ -47,8 +49,8 @@ var OAuthScopesAddModal_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
|
|
|
47
49
|
});
|
|
48
50
|
/** Human readable validation message rendered inline in the modal */
|
|
49
51
|
const validationError = computed(() => {
|
|
50
|
-
if (isDuplicateName.value) return
|
|
51
|
-
if (hasTouchedName.value && !trimmedName.value) return "
|
|
52
|
+
if (isDuplicateName.value) return translate("apiClient.oauthScopesAddModal.duplicate", { name: trimmedName.value });
|
|
53
|
+
if (hasTouchedName.value && !trimmedName.value) return translate("apiClient.oauthScopesAddModal.required");
|
|
52
54
|
return null;
|
|
53
55
|
});
|
|
54
56
|
const isSubmitDisabled = computed(() => !trimmedName.value || isDuplicateName.value);
|
|
@@ -88,20 +90,20 @@ var OAuthScopesAddModal_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
|
|
|
88
90
|
}, {
|
|
89
91
|
submit: withCtx(() => [createTextVNode(toDisplayString(submitLabel.value), 1)]),
|
|
90
92
|
default: withCtx(() => [
|
|
91
|
-
createElementVNode("div", _hoisted_1, [
|
|
93
|
+
createElementVNode("div", _hoisted_1, [createTextVNode(toDisplayString(unref(translate)("apiClient.oauthScopesAddModal.name")), 1), createVNode(unref(CommandActionInput_default), {
|
|
92
94
|
modelValue: scopeData.value.name,
|
|
93
95
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => scopeData.value.name = $event),
|
|
94
96
|
autofocus: "",
|
|
95
97
|
class: "field-sizing-content !p-0",
|
|
96
98
|
placeholder: "read:user"
|
|
97
99
|
}, null, 8, ["modelValue"])]),
|
|
98
|
-
createElementVNode("div", _hoisted_2, [
|
|
100
|
+
createElementVNode("div", _hoisted_2, [createTextVNode(toDisplayString(unref(translate)("apiClient.oauthScopesAddModal.description")), 1), createVNode(unref(CommandActionInput_default), {
|
|
99
101
|
modelValue: scopeData.value.description,
|
|
100
102
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => scopeData.value.description = $event),
|
|
101
103
|
autofocus: false,
|
|
102
104
|
class: "field-sizing-content !p-0",
|
|
103
|
-
placeholder: "
|
|
104
|
-
}, null, 8, ["modelValue"])]),
|
|
105
|
+
placeholder: unref(translate)("apiClient.oauthScopesAddModal.readUserData")
|
|
106
|
+
}, null, 8, ["modelValue", "placeholder"])]),
|
|
105
107
|
validationError.value ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(validationError.value), 1)) : createCommentVNode("", true)
|
|
106
108
|
]),
|
|
107
109
|
_: 1
|