@scalar/api-client 3.17.0 → 3.19.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.
Files changed (189) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
  3. package/dist/components/SectionFilter.vue.d.ts +2 -1
  4. package/dist/components/SectionFilter.vue.d.ts.map +1 -1
  5. package/dist/components/SectionFilter.vue.js +1 -1
  6. package/dist/components/SectionFilter.vue.js.map +1 -1
  7. package/dist/components/SectionFilter.vue.script.js.map +1 -1
  8. package/dist/hooks/use-file-dialog.d.ts.map +1 -1
  9. package/dist/hooks/use-file-dialog.js +1 -0
  10. package/dist/hooks/use-file-dialog.js.map +1 -1
  11. package/dist/style.css +101 -85
  12. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +2 -2
  13. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  14. package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
  15. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +17 -10
  16. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
  17. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +1 -1
  18. package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
  19. package/dist/v2/blocks/operation-block/components/Header.vue.js.map +1 -1
  20. package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
  21. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +3 -1
  22. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
  23. package/dist/v2/blocks/operation-block/helpers/send-request.js +9 -5
  24. package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
  25. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.d.ts +1 -1
  26. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js +1 -1
  27. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js.map +1 -1
  28. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +5 -1
  29. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  30. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  31. package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
  32. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +61 -3
  33. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  34. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts +17 -3
  35. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  36. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
  37. package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
  38. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +42 -21
  39. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
  40. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.d.ts +5 -3
  41. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.d.ts.map +1 -1
  42. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.js.map +1 -1
  43. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.script.js +6 -3
  44. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.script.js.map +1 -1
  45. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.d.ts +1 -1
  46. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.d.ts.map +1 -1
  47. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.js.map +1 -1
  48. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js +1 -0
  49. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js.map +1 -1
  50. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
  51. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js.map +1 -1
  52. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +4 -3
  53. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
  54. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -0
  55. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  56. package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
  57. package/dist/v2/blocks/request-block/components/RequestTable.vue.js.map +1 -1
  58. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js +7 -3
  59. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js.map +1 -1
  60. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +7 -1
  61. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  62. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
  63. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +17 -5
  64. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
  65. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts +1 -1
  66. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js.map +1 -1
  67. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js.map +1 -1
  68. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.d.ts +1 -1
  69. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.d.ts.map +1 -1
  70. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js +17 -8
  71. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js.map +1 -1
  72. package/dist/v2/blocks/request-block/helpers/fold-structured-body-rows.d.ts +1 -1
  73. package/dist/v2/blocks/request-block/helpers/fold-structured-body-rows.js.map +1 -1
  74. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts +3 -1
  75. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts.map +1 -1
  76. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +36 -18
  77. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js.map +1 -1
  78. package/dist/v2/blocks/request-block/helpers/get-parameter-content.d.ts +1 -1
  79. package/dist/v2/blocks/request-block/helpers/get-parameter-content.js.map +1 -1
  80. package/dist/v2/blocks/request-block/helpers/get-parameter-schema.d.ts +1 -1
  81. package/dist/v2/blocks/request-block/helpers/get-parameter-schema.js.map +1 -1
  82. package/dist/v2/blocks/request-block/helpers/get-structured-body-rows.d.ts +1 -1
  83. package/dist/v2/blocks/request-block/helpers/get-structured-body-rows.js +1 -1
  84. package/dist/v2/blocks/request-block/helpers/get-structured-body-rows.js.map +1 -1
  85. package/dist/v2/blocks/request-block/helpers/group-by.d.ts +3 -4
  86. package/dist/v2/blocks/request-block/helpers/group-by.d.ts.map +1 -1
  87. package/dist/v2/blocks/request-block/helpers/group-by.js +12 -10
  88. package/dist/v2/blocks/request-block/helpers/group-by.js.map +1 -1
  89. package/dist/v2/blocks/request-block/helpers/validate-parameter.d.ts +1 -1
  90. package/dist/v2/blocks/request-block/helpers/validate-parameter.js.map +1 -1
  91. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
  92. package/dist/v2/blocks/response-block/ResponseBlock.vue.js.map +1 -1
  93. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +6 -1
  94. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
  95. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +2 -2
  96. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  97. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  98. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
  99. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +2 -2
  100. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
  101. package/dist/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.js.map +1 -1
  102. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +1 -1
  103. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js.map +1 -1
  104. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
  105. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +5 -5
  106. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  107. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
  108. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +10 -7
  109. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
  110. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +1 -1
  111. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js.map +1 -1
  112. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js.map +1 -1
  113. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts +1 -1
  114. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js.map +1 -1
  115. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js.map +1 -1
  116. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +1 -1
  117. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js.map +1 -1
  118. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js.map +1 -1
  119. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +5 -5
  120. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  121. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js.map +1 -1
  122. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js +20 -154
  123. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
  124. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts +1 -1
  125. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js.map +1 -1
  126. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts +1 -1
  127. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  128. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +1 -1
  129. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
  130. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js.map +1 -1
  131. package/dist/v2/blocks/scalar-auth-selector-block/helpers/run-oauth2-authorize.d.ts +1 -1
  132. package/dist/v2/blocks/scalar-auth-selector-block/helpers/run-oauth2-authorize.js.map +1 -1
  133. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +1 -1
  134. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
  135. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js.map +1 -1
  136. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  137. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  138. package/dist/v2/components/code-input/CodeInput.vue.js.map +1 -1
  139. package/dist/v2/components/code-input/CodeInput.vue.script.js +1 -1
  140. package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
  141. package/dist/v2/components/code-input/CodeInputLite.vue.d.ts.map +1 -1
  142. package/dist/v2/components/code-input/CodeInputLite.vue.js +1 -1
  143. package/dist/v2/components/code-input/CodeInputLite.vue.js.map +1 -1
  144. package/dist/v2/components/code-input/CodeInputLite.vue.script.js +7 -6
  145. package/dist/v2/components/code-input/CodeInputLite.vue.script.js.map +1 -1
  146. package/dist/v2/components/code-input/helpers/build-pill-context.d.ts.map +1 -1
  147. package/dist/v2/components/code-input/helpers/build-pill-context.js.map +1 -1
  148. package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts +1 -1
  149. package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts.map +1 -1
  150. package/dist/v2/components/layout/CollapsibleSection.vue.js.map +1 -1
  151. package/dist/v2/components/layout/CollapsibleSection.vue.script.js.map +1 -1
  152. package/dist/v2/components/server/ServerDropdown.vue.d.ts +1 -1
  153. package/dist/v2/components/server/ServerDropdown.vue.js.map +1 -1
  154. package/dist/v2/components/server/ServerDropdown.vue.script.js.map +1 -1
  155. package/dist/v2/components/server/ServerDropdownItem.vue.d.ts +1 -1
  156. package/dist/v2/components/server/ServerDropdownItem.vue.js +1 -1
  157. package/dist/v2/components/server/ServerDropdownItem.vue.js.map +1 -1
  158. package/dist/v2/components/server/ServerDropdownItem.vue.script.js.map +1 -1
  159. package/dist/v2/constants.js +1 -1
  160. package/dist/v2/features/command-palette/components/CommandActionInput.vue.js.map +1 -1
  161. package/dist/v2/features/command-palette/components/CommandActionInput.vue.script.js +1 -1
  162. package/dist/v2/features/command-palette/components/CommandActionInput.vue.script.js.map +1 -1
  163. package/dist/v2/features/environments/components/EnvironmentColors.vue.js.map +1 -1
  164. package/dist/v2/features/environments/components/EnvironmentColors.vue.script.js +1 -1
  165. package/dist/v2/features/environments/components/EnvironmentColors.vue.script.js.map +1 -1
  166. package/dist/v2/features/modal/Modal.vue.d.ts +1 -1
  167. package/dist/v2/features/modal/Modal.vue.js.map +1 -1
  168. package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
  169. package/dist/v2/features/modal/helpers/create-api-client-modal.js.map +1 -1
  170. package/dist/v2/features/modal/helpers/resolve-route-parameters.js +1 -1
  171. package/dist/v2/features/modal/hooks/use-modal-sidebar.js +1 -1
  172. package/dist/v2/features/modal/modal-events.d.ts.map +1 -1
  173. package/dist/v2/features/modal/modal-events.js +10 -1
  174. package/dist/v2/features/modal/modal-events.js.map +1 -1
  175. package/dist/v2/features/operation/Operation.vue.d.ts +1 -1
  176. package/dist/v2/features/operation/Operation.vue.js.map +1 -1
  177. package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
  178. package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts +1 -1
  179. package/dist/v2/features/search/components/DocumentSearchModal.vue.js +1 -1
  180. package/dist/v2/features/search/components/DocumentSearchModal.vue.js.map +1 -1
  181. package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js.map +1 -1
  182. package/dist/v2/features/search/helpers/create-search-index.d.ts +1 -1
  183. package/dist/v2/features/search/helpers/create-search-index.js.map +1 -1
  184. package/dist/v2/features/search/hooks/use-document-search.d.ts +1 -1
  185. package/dist/v2/features/search/hooks/use-document-search.js.map +1 -1
  186. package/dist/v2/features/search/hooks/use-search-index.d.ts +1 -1
  187. package/dist/v2/features/search/hooks/use-search-index.js.map +1 -1
  188. package/dist/vue-styles.css +84 -84
  189. package/package.json +12 -12
@@ -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.1/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 eventBus.emit('auth:update:security-scheme-secrets', {\n payload: {\n type: scheme.type,\n [type]: payload,\n },\n name,\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,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,YACS;GAET,IAAI,QAAA,OAAO,SAAS,iBAClB,OAAO,0BAA0B,OAAO;GAK1C,IAAI,QAAA,OAAO,SAAS,UAClB;GAGF,QAAA,SAA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G,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, 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,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,YACS;GAET,IAAI,QAAA,OAAO,SAAS,iBAClB,OAAO,0BAA0B,OAAO;GAK1C,IAAI,QAAA,OAAO,SAAS,UAClB;G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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,4 +1,4 @@
1
- import type { OAuthFlow, OAuthFlowsObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
1
+ import type { OAuthFlow, OAuthFlowsObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
2
2
  type __VLS_Props = {
3
3
  flowType: keyof OAuthFlowsObject;
4
4
  flow: OAuthFlow;
@@ -1 +1 @@
1
- {"version":3,"file":"OAuthScopesInput.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarIconPencilSimple, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport type {\n OAuthFlow,\n OAuthFlowsObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/v2/components/data-table'\n\nimport OAuthScopesAddModal from './OAuthScopesAddModal.vue'\n\nconst { selectedScopes, flow, flowType } = defineProps<{\n flowType: keyof OAuthFlowsObject\n flow: OAuthFlow\n selectedScopes: string[]\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 searchQuery = ref('')\n\n/**\n * The scope currently being edited, used to switch the shared modal into edit mode.\n * Null means the modal is in \"add\" mode.\n */\nconst editingScope = ref<{ name: string; description: string } | null>(null)\n\n/** List of all available scopes */\nconst scopes = computed(() =>\n Object.entries(flow?.scopes ?? {}).map(([key, val]) => ({\n id: key,\n label: key,\n description: val,\n })),\n)\n\nconst scopeCount = computed(() => Object.keys(flow?.scopes ?? {}).length)\n\n/** Search is only useful once the list is long enough to scan */\nconst showScopeSearch = computed(() => scopeCount.value >= 10)\n\nconst filteredScopes = computed(() => {\n const query = showScopeSearch.value ? searchQuery.value : ''\n if (!query) {\n return scopes.value\n }\n\n const regex = new RegExp(\n query\n .split('')\n .map((c) => c.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('.*'),\n 'i',\n )\n\n return scopes.value.filter(({ label, description }) =>\n regex.test(`${label} ${description}`),\n )\n})\n\nconst hasScopes = computed(() => Object.keys(flow?.scopes ?? {}).length > 0)\n\nconst allScopesSelected = computed(\n () => selectedScopes.length === Object.keys(flow?.scopes ?? {}).length,\n)\n\nconst setScope = (scopeKey: string, checked: boolean) => {\n // Emit a single-scope toggle rather than a freshly computed list. The store applies it\n // against the currently selected scopes, so two quick clicks cannot overwrite each other\n // with a list computed from a prop that has not updated yet.\n emits('update:selectedScopes', { scope: scopeKey, selected: checked })\n}\n\n/** Select all scopes */\nconst selectAllScopes = () =>\n emits('update:selectedScopes', { scopes: Object.keys(flow?.scopes ?? {}) })\n\n/** Deselect all scopes */\nconst deselectAllScopes = () => emits('update:selectedScopes', { scopes: [] })\n\nconst scopeFormModal = useModal()\n\n/**\n * Forces the Disclosure to remount with `defaultOpen` set so the panel auto-expands\n * the moment a brand-new scope is added. Bumping this counter is paired with toggling\n * `expandOnNextMount` so the remount opens the panel, then reverts to the default\n * closed-on-mount behavior for any future unrelated remounts (e.g. collapse on empty).\n *\n * The Disclosure `:key` is only this counter — not a separate `hasScopes` segment — so\n * adding the first scope does not remount twice (empty prefix → with-scopes prefix),\n * which would reopen with `defaultOpen=false` and collapse the panel right when rows appear.\n */\nconst remountKey = ref(0)\nconst expandOnNextMount = ref(false)\n\nwatch(hasScopes, (has, had) => {\n if (had && !has) {\n expandOnNextMount.value = false\n remountKey.value += 1\n }\n})\n\n/** Open the modal in \"add new scope\" mode */\nconst openAddScopeModal = () => {\n editingScope.value = null\n scopeFormModal.show()\n}\n\n/** Open the modal in \"edit scope\" mode prefilled with the chosen row */\nconst openEditScopeModal = (scope: { id: string; description: string }) => {\n editingScope.value = {\n name: scope.id,\n description: scope.description ?? '',\n }\n scopeFormModal.show()\n}\n\n/**\n * Submit handler shared by Add Scope and Edit Scope. For renames, the `upsertScope` mutator on\n * the workspace store rewrites the selection state in place, so the component does not need to\n * emit a follow-up `update:selectedScopes`.\n *\n * When adding a brand-new scope (no `oldName`), the payload sets `enable: true` so the\n * `upsertScope` mutator also adds the new scope to any selection requirement that references\n * this scheme. The Disclosure is then remounted with `defaultOpen=true` so the user\n * immediately sees (and sees selected) the scope they just added.\n */\nconst handleScopeFormSubmit = async (payload: {\n name: string\n description: string\n oldName?: string\n}) => {\n const isAdd = !payload.oldName\n\n emits('upsert:scope', {\n scope: payload.name,\n description: payload.description,\n flowType,\n ...(payload.oldName ? { oldScope: payload.oldName } : {}),\n ...(isAdd ? { enable: true } : {}),\n })\n\n if (!isAdd) {\n return\n }\n\n expandOnNextMount.value = true\n remountKey.value += 1\n // Reset after the remount so subsequent unrelated remounts (e.g. when the last\n // scope is deleted) still default to a closed panel.\n await nextTick()\n expandOnNextMount.value = false\n}\n\n/**\n * Remove the scope from the flow. Selection cleanup (dropping the deleted key from any\n * currently-selected scopes) is handled by the `deleteScope` mutator on the workspace store,\n * so the component does not need to emit a follow-up `update:selectedScopes` here.\n */\nconst handleDeleteScope = (scopeKey: string) => {\n emits('delete:scope', { scope: scopeKey, flowType })\n}\n</script>\n\n<template>\n <DataTableCell class=\"h-auto !max-h-[initial] min-h-8 items-center\">\n <div class=\"flex h-fit w-full\">\n <div class=\"text-c-1 h-full items-center\"></div>\n <Disclosure\n :key=\"remountKey\"\n as=\"div\"\n class=\"bl flex w-full flex-col\"\n :defaultOpen=\"expandOnNextMount\">\n <!--\n Keep Add Scope (and other actions) outside the summary DisclosureButton.\n When there are no scopes the summary control is disabled; a native disabled\n button blocks pointer events for all descendants, which would make Add Scope unusable.\n -->\n <div\n class=\"group/scopes-accordion flex h-auto min-h-8 items-center gap-1.5 pr-2.25 pl-3 text-left\">\n <DisclosureButton\n :class=\"[\n 'min-w-0 flex-1 text-left',\n hasScopes ? 'hover:text-c-1 cursor-pointer' : 'cursor-default',\n (selectedScopes.length || 0) > 0 ? 'text-c-1' : 'text-c-3',\n ]\"\n :disabled=\"!hasScopes\">\n <template v-if=\"hasScopes\">\n Scopes Selected\n {{ selectedScopes.length || 0 }} /\n {{ Object.keys(flow?.scopes ?? {}).length || 0 }}\n </template>\n <template v-else> No Scopes Defined </template>\n </DisclosureButton>\n\n <div class=\"flex shrink-0 items-center gap-1.75\">\n <!-- Add new scope -->\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"openAddScopeModal\">\n Add Scope\n </ScalarButton>\n\n <!-- Deselect All -->\n <ScalarButton\n v-if=\"hasScopes && allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deselectAllScopes\">\n Deselect All\n </ScalarButton>\n\n <!-- Select All -->\n <ScalarButton\n v-if=\"hasScopes && !allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"selectAllScopes\">\n Select All\n </ScalarButton>\n\n <DisclosureButton\n v-if=\"hasScopes\"\n v-slot=\"{ open }\"\n class=\"text-c-3 hover:text-c-2 -m-0.5 flex shrink-0 items-center justify-center rounded p-0.5 focus-visible:outline-offset-2\">\n <ScalarIcon\n class=\"group-hover/scopes-accordion:text-c-2\"\n :icon=\"open ? 'ChevronDown' : 'ChevronRight'\"\n size=\"md\" />\n </DisclosureButton>\n </div>\n </div>\n <!-- Scopes List -->\n <DisclosurePanel as=\"template\">\n <div>\n <ScalarSearchInput\n v-if=\"showScopeSearch\"\n v-model=\"searchQuery\"\n class=\"flex items-center text-xs\" />\n <table\n class=\"grid max-h-40 auto-rows-auto overflow-x-hidden overflow-y-auto\"\n :style=\"{ gridTemplateColumns: '1fr auto' }\">\n <DataTableRow\n v-for=\"{ id, label, description } in filteredScopes\"\n :key=\"id\"\n class=\"text-c-2 group/scope-row\"\n @click=\"setScope(id, !selectedScopes.includes(id))\">\n <DataTableCell\n class=\"box-border flex !max-h-[initial] w-full min-w-0 cursor-pointer items-stretch overflow-hidden px-0 py-0\">\n <!-- Text scrolls horizontally; action rail stays fixed -->\n <div\n class=\"no-scrollbar text-c-2 group-hover/scope-row:text-c-1 flex min-h-8 min-w-0 flex-1 items-center gap-1 overflow-x-auto px-3 py-1.5 pr-20 text-xs text-nowrap\">\n <span class=\"font-code shrink-0 text-xs\">{{ label }}</span>\n <template v-if=\"String(description ?? '').trim()\">\n <span class=\"shrink-0\">&ndash;</span>\n <span class=\"whitespace-nowrap\">{{ description }}</span>\n </template>\n </div>\n <div\n class=\"oauth-scope-row-action-rail absolute top-0 right-0 z-[1] flex h-full min-w-[4.5rem] items-center justify-end gap-0.5 py-1 pr-2 pl-4 opacity-0 transition-opacity group-focus-within/scope-row:opacity-100 group-hover/scope-row:opacity-100\"\n @click.stop>\n <ScalarIconButton\n :icon=\"ScalarIconPencilSimple\"\n :label=\"`Edit ${label}`\"\n size=\"sm\"\n @click.stop=\"\n openEditScopeModal({\n id,\n description: description ?? '',\n })\n \" />\n <ScalarIconButton\n :icon=\"ScalarIconTrash\"\n :label=\"`Delete ${label}`\"\n size=\"sm\"\n @click.stop=\"handleDeleteScope(id)\" />\n </div>\n </DataTableCell>\n <!--\n Stop the click here so it does not also bubble to the row's `@click`\n toggle. The checkbox already drives the change via `@update:modelValue`;\n letting the row fire too would toggle the scope a second time.\n -->\n <DataTableCheckbox\n :ariaLabel=\"`Select ${label} scope`\"\n :modelValue=\"selectedScopes.includes(id)\"\n @click.stop\n @update:modelValue=\"setScope(id, $event)\" />\n </DataTableRow>\n </table>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n\n <!-- Shared add/edit scope modal -->\n <OAuthScopesAddModal\n :scope=\"editingScope\"\n :scopes=\"Object.keys(flow.scopes ?? {})\"\n :state=\"scopeFormModal\"\n @submit=\"handleScopeFormSubmit\" />\n </DataTableCell>\n</template>\n\n<style>\n/* Matches AddressBar.vue `.address-bar-bg-states` / `.fade-right` (header URL input). */\n.oauth-scope-row-action-rail {\n --oauth-scope-row-rail-bg: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n background: linear-gradient(\n 90deg,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 100%) 0%,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 20%) 30%,\n var(--oauth-scope-row-rail-bg) 100%\n );\n}\n\n.no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n\n.no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"OAuthScopesInput.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarIconPencilSimple, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport type {\n OAuthFlow,\n OAuthFlowsObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/v2/components/data-table'\n\nimport OAuthScopesAddModal from './OAuthScopesAddModal.vue'\n\nconst { selectedScopes, flow, flowType } = defineProps<{\n flowType: keyof OAuthFlowsObject\n flow: OAuthFlow\n selectedScopes: string[]\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 searchQuery = ref('')\n\n/**\n * The scope currently being edited, used to switch the shared modal into edit mode.\n * Null means the modal is in \"add\" mode.\n */\nconst editingScope = ref<{ name: string; description: string } | null>(null)\n\n/** List of all available scopes */\nconst scopes = computed(() =>\n Object.entries(flow?.scopes ?? {}).map(([key, val]) => ({\n id: key,\n label: key,\n description: val,\n })),\n)\n\nconst scopeCount = computed(() => Object.keys(flow?.scopes ?? {}).length)\n\n/** Search is only useful once the list is long enough to scan */\nconst showScopeSearch = computed(() => scopeCount.value >= 10)\n\nconst filteredScopes = computed(() => {\n const query = showScopeSearch.value ? searchQuery.value : ''\n if (!query) {\n return scopes.value\n }\n\n const regex = new RegExp(\n query\n .split('')\n .map((c) => c.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('.*'),\n 'i',\n )\n\n return scopes.value.filter(({ label, description }) =>\n regex.test(`${label} ${description}`),\n )\n})\n\nconst hasScopes = computed(() => Object.keys(flow?.scopes ?? {}).length > 0)\n\nconst allScopesSelected = computed(\n () => selectedScopes.length === Object.keys(flow?.scopes ?? {}).length,\n)\n\nconst setScope = (scopeKey: string, checked: boolean) => {\n // Emit a single-scope toggle rather than a freshly computed list. The store applies it\n // against the currently selected scopes, so two quick clicks cannot overwrite each other\n // with a list computed from a prop that has not updated yet.\n emits('update:selectedScopes', { scope: scopeKey, selected: checked })\n}\n\n/** Select all scopes */\nconst selectAllScopes = () =>\n emits('update:selectedScopes', { scopes: Object.keys(flow?.scopes ?? {}) })\n\n/** Deselect all scopes */\nconst deselectAllScopes = () => emits('update:selectedScopes', { scopes: [] })\n\nconst scopeFormModal = useModal()\n\n/**\n * Forces the Disclosure to remount with `defaultOpen` set so the panel auto-expands\n * the moment a brand-new scope is added. Bumping this counter is paired with toggling\n * `expandOnNextMount` so the remount opens the panel, then reverts to the default\n * closed-on-mount behavior for any future unrelated remounts (e.g. collapse on empty).\n *\n * The Disclosure `:key` is only this counter — not a separate `hasScopes` segment — so\n * adding the first scope does not remount twice (empty prefix → with-scopes prefix),\n * which would reopen with `defaultOpen=false` and collapse the panel right when rows appear.\n */\nconst remountKey = ref(0)\nconst expandOnNextMount = ref(false)\n\nwatch(hasScopes, (has, had) => {\n if (had && !has) {\n expandOnNextMount.value = false\n remountKey.value += 1\n }\n})\n\n/** Open the modal in \"add new scope\" mode */\nconst openAddScopeModal = () => {\n editingScope.value = null\n scopeFormModal.show()\n}\n\n/** Open the modal in \"edit scope\" mode prefilled with the chosen row */\nconst openEditScopeModal = (scope: { id: string; description: string }) => {\n editingScope.value = {\n name: scope.id,\n description: scope.description ?? '',\n }\n scopeFormModal.show()\n}\n\n/**\n * Submit handler shared by Add Scope and Edit Scope. For renames, the `upsertScope` mutator on\n * the workspace store rewrites the selection state in place, so the component does not need to\n * emit a follow-up `update:selectedScopes`.\n *\n * When adding a brand-new scope (no `oldName`), the payload sets `enable: true` so the\n * `upsertScope` mutator also adds the new scope to any selection requirement that references\n * this scheme. The Disclosure is then remounted with `defaultOpen=true` so the user\n * immediately sees (and sees selected) the scope they just added.\n */\nconst handleScopeFormSubmit = async (payload: {\n name: string\n description: string\n oldName?: string\n}) => {\n const isAdd = !payload.oldName\n\n emits('upsert:scope', {\n scope: payload.name,\n description: payload.description,\n flowType,\n ...(payload.oldName ? { oldScope: payload.oldName } : {}),\n ...(isAdd ? { enable: true } : {}),\n })\n\n if (!isAdd) {\n return\n }\n\n expandOnNextMount.value = true\n remountKey.value += 1\n // Reset after the remount so subsequent unrelated remounts (e.g. when the last\n // scope is deleted) still default to a closed panel.\n await nextTick()\n expandOnNextMount.value = false\n}\n\n/**\n * Remove the scope from the flow. Selection cleanup (dropping the deleted key from any\n * currently-selected scopes) is handled by the `deleteScope` mutator on the workspace store,\n * so the component does not need to emit a follow-up `update:selectedScopes` here.\n */\nconst handleDeleteScope = (scopeKey: string) => {\n emits('delete:scope', { scope: scopeKey, flowType })\n}\n</script>\n\n<template>\n <DataTableCell class=\"h-auto !max-h-[initial] min-h-8 items-center\">\n <div class=\"flex h-fit w-full\">\n <div class=\"text-c-1 h-full items-center\"></div>\n <Disclosure\n :key=\"remountKey\"\n as=\"div\"\n class=\"bl flex w-full flex-col\"\n :defaultOpen=\"expandOnNextMount\">\n <!--\n Keep Add Scope (and other actions) outside the summary DisclosureButton.\n When there are no scopes the summary control is disabled; a native disabled\n button blocks pointer events for all descendants, which would make Add Scope unusable.\n -->\n <div\n class=\"group/scopes-accordion flex h-auto min-h-8 items-center gap-1.5 pr-2.25 pl-3 text-left\">\n <DisclosureButton\n :class=\"[\n 'min-w-0 flex-1 text-left',\n hasScopes ? 'hover:text-c-1 cursor-pointer' : 'cursor-default',\n (selectedScopes.length || 0) > 0 ? 'text-c-1' : 'text-c-3',\n ]\"\n :disabled=\"!hasScopes\">\n <template v-if=\"hasScopes\">\n Scopes Selected\n {{ selectedScopes.length || 0 }} /\n {{ Object.keys(flow?.scopes ?? {}).length || 0 }}\n </template>\n <template v-else> No Scopes Defined </template>\n </DisclosureButton>\n\n <div class=\"flex shrink-0 items-center gap-1.75\">\n <!-- Add new scope -->\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"openAddScopeModal\">\n Add Scope\n </ScalarButton>\n\n <!-- Deselect All -->\n <ScalarButton\n v-if=\"hasScopes && allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deselectAllScopes\">\n Deselect All\n </ScalarButton>\n\n <!-- Select All -->\n <ScalarButton\n v-if=\"hasScopes && !allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"selectAllScopes\">\n Select All\n </ScalarButton>\n\n <DisclosureButton\n v-if=\"hasScopes\"\n v-slot=\"{ open }\"\n class=\"text-c-3 hover:text-c-2 -m-0.5 flex shrink-0 items-center justify-center rounded p-0.5 focus-visible:outline-offset-2\">\n <ScalarIcon\n class=\"group-hover/scopes-accordion:text-c-2\"\n :icon=\"open ? 'ChevronDown' : 'ChevronRight'\"\n size=\"md\" />\n </DisclosureButton>\n </div>\n </div>\n <!-- Scopes List -->\n <DisclosurePanel as=\"template\">\n <div>\n <ScalarSearchInput\n v-if=\"showScopeSearch\"\n v-model=\"searchQuery\"\n class=\"flex items-center text-xs\" />\n <table\n class=\"grid max-h-40 auto-rows-auto overflow-x-hidden overflow-y-auto\"\n :style=\"{ gridTemplateColumns: '1fr auto' }\">\n <DataTableRow\n v-for=\"{ id, label, description } in filteredScopes\"\n :key=\"id\"\n class=\"text-c-2 group/scope-row\"\n @click=\"setScope(id, !selectedScopes.includes(id))\">\n <DataTableCell\n class=\"box-border flex !max-h-[initial] w-full min-w-0 cursor-pointer items-stretch overflow-hidden px-0 py-0\">\n <!-- Text scrolls horizontally; action rail stays fixed -->\n <div\n class=\"no-scrollbar text-c-2 group-hover/scope-row:text-c-1 flex min-h-8 min-w-0 flex-1 items-center gap-1 overflow-x-auto px-3 py-1.5 pr-20 text-xs text-nowrap\">\n <span class=\"font-code shrink-0 text-xs\">{{ label }}</span>\n <template v-if=\"String(description ?? '').trim()\">\n <span class=\"shrink-0\">&ndash;</span>\n <span class=\"whitespace-nowrap\">{{ description }}</span>\n </template>\n </div>\n <div\n class=\"oauth-scope-row-action-rail absolute top-0 right-0 z-[1] flex h-full min-w-[4.5rem] items-center justify-end gap-0.5 py-1 pr-2 pl-4 opacity-0 transition-opacity group-focus-within/scope-row:opacity-100 group-hover/scope-row:opacity-100\"\n @click.stop>\n <ScalarIconButton\n :icon=\"ScalarIconPencilSimple\"\n :label=\"`Edit ${label}`\"\n size=\"sm\"\n @click.stop=\"\n openEditScopeModal({\n id,\n description: description ?? '',\n })\n \" />\n <ScalarIconButton\n :icon=\"ScalarIconTrash\"\n :label=\"`Delete ${label}`\"\n size=\"sm\"\n @click.stop=\"handleDeleteScope(id)\" />\n </div>\n </DataTableCell>\n <!--\n Stop the click here so it does not also bubble to the row's `@click`\n toggle. The checkbox already drives the change via `@update:modelValue`;\n letting the row fire too would toggle the scope a second time.\n -->\n <DataTableCheckbox\n :ariaLabel=\"`Select ${label} scope`\"\n :modelValue=\"selectedScopes.includes(id)\"\n @click.stop\n @update:modelValue=\"setScope(id, $event)\" />\n </DataTableRow>\n </table>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n\n <!-- Shared add/edit scope modal -->\n <OAuthScopesAddModal\n :scope=\"editingScope\"\n :scopes=\"Object.keys(flow.scopes ?? {})\"\n :state=\"scopeFormModal\"\n @submit=\"handleScopeFormSubmit\" />\n </DataTableCell>\n</template>\n\n<style>\n/* Matches AddressBar.vue `.address-bar-bg-states` / `.fade-right` (header URL input). */\n.oauth-scope-row-action-rail {\n --oauth-scope-row-rail-bg: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n background: linear-gradient(\n 90deg,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 100%) 0%,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 20%) 30%,\n var(--oauth-scope-row-rail-bg) 100%\n );\n}\n\n.no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n\n.no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n</style>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"OAuthScopesInput.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarIconPencilSimple, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport type {\n OAuthFlow,\n OAuthFlowsObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/v2/components/data-table'\n\nimport OAuthScopesAddModal from './OAuthScopesAddModal.vue'\n\nconst { selectedScopes, flow, flowType } = defineProps<{\n flowType: keyof OAuthFlowsObject\n flow: OAuthFlow\n selectedScopes: string[]\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 searchQuery = ref('')\n\n/**\n * The scope currently being edited, used to switch the shared modal into edit mode.\n * Null means the modal is in \"add\" mode.\n */\nconst editingScope = ref<{ name: string; description: string } | null>(null)\n\n/** List of all available scopes */\nconst scopes = computed(() =>\n Object.entries(flow?.scopes ?? {}).map(([key, val]) => ({\n id: key,\n label: key,\n description: val,\n })),\n)\n\nconst scopeCount = computed(() => Object.keys(flow?.scopes ?? {}).length)\n\n/** Search is only useful once the list is long enough to scan */\nconst showScopeSearch = computed(() => scopeCount.value >= 10)\n\nconst filteredScopes = computed(() => {\n const query = showScopeSearch.value ? searchQuery.value : ''\n if (!query) {\n return scopes.value\n }\n\n const regex = new RegExp(\n query\n .split('')\n .map((c) => c.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('.*'),\n 'i',\n )\n\n return scopes.value.filter(({ label, description }) =>\n regex.test(`${label} ${description}`),\n )\n})\n\nconst hasScopes = computed(() => Object.keys(flow?.scopes ?? {}).length > 0)\n\nconst allScopesSelected = computed(\n () => selectedScopes.length === Object.keys(flow?.scopes ?? {}).length,\n)\n\nconst setScope = (scopeKey: string, checked: boolean) => {\n // Emit a single-scope toggle rather than a freshly computed list. The store applies it\n // against the currently selected scopes, so two quick clicks cannot overwrite each other\n // with a list computed from a prop that has not updated yet.\n emits('update:selectedScopes', { scope: scopeKey, selected: checked })\n}\n\n/** Select all scopes */\nconst selectAllScopes = () =>\n emits('update:selectedScopes', { scopes: Object.keys(flow?.scopes ?? {}) })\n\n/** Deselect all scopes */\nconst deselectAllScopes = () => emits('update:selectedScopes', { scopes: [] })\n\nconst scopeFormModal = useModal()\n\n/**\n * Forces the Disclosure to remount with `defaultOpen` set so the panel auto-expands\n * the moment a brand-new scope is added. Bumping this counter is paired with toggling\n * `expandOnNextMount` so the remount opens the panel, then reverts to the default\n * closed-on-mount behavior for any future unrelated remounts (e.g. collapse on empty).\n *\n * The Disclosure `:key` is only this counter — not a separate `hasScopes` segment — so\n * adding the first scope does not remount twice (empty prefix → with-scopes prefix),\n * which would reopen with `defaultOpen=false` and collapse the panel right when rows appear.\n */\nconst remountKey = ref(0)\nconst expandOnNextMount = ref(false)\n\nwatch(hasScopes, (has, had) => {\n if (had && !has) {\n expandOnNextMount.value = false\n remountKey.value += 1\n }\n})\n\n/** Open the modal in \"add new scope\" mode */\nconst openAddScopeModal = () => {\n editingScope.value = null\n scopeFormModal.show()\n}\n\n/** Open the modal in \"edit scope\" mode prefilled with the chosen row */\nconst openEditScopeModal = (scope: { id: string; description: string }) => {\n editingScope.value = {\n name: scope.id,\n description: scope.description ?? '',\n }\n scopeFormModal.show()\n}\n\n/**\n * Submit handler shared by Add Scope and Edit Scope. For renames, the `upsertScope` mutator on\n * the workspace store rewrites the selection state in place, so the component does not need to\n * emit a follow-up `update:selectedScopes`.\n *\n * When adding a brand-new scope (no `oldName`), the payload sets `enable: true` so the\n * `upsertScope` mutator also adds the new scope to any selection requirement that references\n * this scheme. The Disclosure is then remounted with `defaultOpen=true` so the user\n * immediately sees (and sees selected) the scope they just added.\n */\nconst handleScopeFormSubmit = async (payload: {\n name: string\n description: string\n oldName?: string\n}) => {\n const isAdd = !payload.oldName\n\n emits('upsert:scope', {\n scope: payload.name,\n description: payload.description,\n flowType,\n ...(payload.oldName ? { oldScope: payload.oldName } : {}),\n ...(isAdd ? { enable: true } : {}),\n })\n\n if (!isAdd) {\n return\n }\n\n expandOnNextMount.value = true\n remountKey.value += 1\n // Reset after the remount so subsequent unrelated remounts (e.g. when the last\n // scope is deleted) still default to a closed panel.\n await nextTick()\n expandOnNextMount.value = false\n}\n\n/**\n * Remove the scope from the flow. Selection cleanup (dropping the deleted key from any\n * currently-selected scopes) is handled by the `deleteScope` mutator on the workspace store,\n * so the component does not need to emit a follow-up `update:selectedScopes` here.\n */\nconst handleDeleteScope = (scopeKey: string) => {\n emits('delete:scope', { scope: scopeKey, flowType })\n}\n</script>\n\n<template>\n <DataTableCell class=\"h-auto !max-h-[initial] min-h-8 items-center\">\n <div class=\"flex h-fit w-full\">\n <div class=\"text-c-1 h-full items-center\"></div>\n <Disclosure\n :key=\"remountKey\"\n as=\"div\"\n class=\"bl flex w-full flex-col\"\n :defaultOpen=\"expandOnNextMount\">\n <!--\n Keep Add Scope (and other actions) outside the summary DisclosureButton.\n When there are no scopes the summary control is disabled; a native disabled\n button blocks pointer events for all descendants, which would make Add Scope unusable.\n -->\n <div\n class=\"group/scopes-accordion flex h-auto min-h-8 items-center gap-1.5 pr-2.25 pl-3 text-left\">\n <DisclosureButton\n :class=\"[\n 'min-w-0 flex-1 text-left',\n hasScopes ? 'hover:text-c-1 cursor-pointer' : 'cursor-default',\n (selectedScopes.length || 0) > 0 ? 'text-c-1' : 'text-c-3',\n ]\"\n :disabled=\"!hasScopes\">\n <template v-if=\"hasScopes\">\n Scopes Selected\n {{ selectedScopes.length || 0 }} /\n {{ Object.keys(flow?.scopes ?? {}).length || 0 }}\n </template>\n <template v-else> No Scopes Defined </template>\n </DisclosureButton>\n\n <div class=\"flex shrink-0 items-center gap-1.75\">\n <!-- Add new scope -->\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"openAddScopeModal\">\n Add Scope\n </ScalarButton>\n\n <!-- Deselect All -->\n <ScalarButton\n v-if=\"hasScopes && allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deselectAllScopes\">\n Deselect All\n </ScalarButton>\n\n <!-- Select All -->\n <ScalarButton\n v-if=\"hasScopes && !allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"selectAllScopes\">\n Select All\n </ScalarButton>\n\n <DisclosureButton\n v-if=\"hasScopes\"\n v-slot=\"{ open }\"\n class=\"text-c-3 hover:text-c-2 -m-0.5 flex shrink-0 items-center justify-center rounded p-0.5 focus-visible:outline-offset-2\">\n <ScalarIcon\n class=\"group-hover/scopes-accordion:text-c-2\"\n :icon=\"open ? 'ChevronDown' : 'ChevronRight'\"\n size=\"md\" />\n </DisclosureButton>\n </div>\n </div>\n <!-- Scopes List -->\n <DisclosurePanel as=\"template\">\n <div>\n <ScalarSearchInput\n v-if=\"showScopeSearch\"\n v-model=\"searchQuery\"\n class=\"flex items-center text-xs\" />\n <table\n class=\"grid max-h-40 auto-rows-auto overflow-x-hidden overflow-y-auto\"\n :style=\"{ gridTemplateColumns: '1fr auto' }\">\n <DataTableRow\n v-for=\"{ id, label, description } in filteredScopes\"\n :key=\"id\"\n class=\"text-c-2 group/scope-row\"\n @click=\"setScope(id, !selectedScopes.includes(id))\">\n <DataTableCell\n class=\"box-border flex !max-h-[initial] w-full min-w-0 cursor-pointer items-stretch overflow-hidden px-0 py-0\">\n <!-- Text scrolls horizontally; action rail stays fixed -->\n <div\n class=\"no-scrollbar text-c-2 group-hover/scope-row:text-c-1 flex min-h-8 min-w-0 flex-1 items-center gap-1 overflow-x-auto px-3 py-1.5 pr-20 text-xs text-nowrap\">\n <span class=\"font-code shrink-0 text-xs\">{{ label }}</span>\n <template v-if=\"String(description ?? '').trim()\">\n <span class=\"shrink-0\">&ndash;</span>\n <span class=\"whitespace-nowrap\">{{ description }}</span>\n </template>\n </div>\n <div\n class=\"oauth-scope-row-action-rail absolute top-0 right-0 z-[1] flex h-full min-w-[4.5rem] items-center justify-end gap-0.5 py-1 pr-2 pl-4 opacity-0 transition-opacity group-focus-within/scope-row:opacity-100 group-hover/scope-row:opacity-100\"\n @click.stop>\n <ScalarIconButton\n :icon=\"ScalarIconPencilSimple\"\n :label=\"`Edit ${label}`\"\n size=\"sm\"\n @click.stop=\"\n openEditScopeModal({\n id,\n description: description ?? '',\n })\n \" />\n <ScalarIconButton\n :icon=\"ScalarIconTrash\"\n :label=\"`Delete ${label}`\"\n size=\"sm\"\n @click.stop=\"handleDeleteScope(id)\" />\n </div>\n </DataTableCell>\n <!--\n Stop the click here so it does not also bubble to the row's `@click`\n toggle. The checkbox already drives the change via `@update:modelValue`;\n letting the row fire too would toggle the scope a second time.\n -->\n <DataTableCheckbox\n :ariaLabel=\"`Select ${label} scope`\"\n :modelValue=\"selectedScopes.includes(id)\"\n @click.stop\n @update:modelValue=\"setScope(id, $event)\" />\n </DataTableRow>\n </table>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n\n <!-- Shared add/edit scope modal -->\n <OAuthScopesAddModal\n :scope=\"editingScope\"\n :scopes=\"Object.keys(flow.scopes ?? {})\"\n :state=\"scopeFormModal\"\n @submit=\"handleScopeFormSubmit\" />\n </DataTableCell>\n</template>\n\n<style>\n/* Matches AddressBar.vue `.address-bar-bg-states` / `.fade-right` (header URL input). */\n.oauth-scope-row-action-rail {\n --oauth-scope-row-rail-bg: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n background: linear-gradient(\n 90deg,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 100%) 0%,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 20%) 30%,\n var(--oauth-scope-row-rail-bg) 100%\n );\n}\n\n.no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n\n.no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA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eAAA,WAAgC,mBAAkB;WAA6B;wBAA2C,eAAW;;;;;;aAM7I,YAIwC,MAAA,gBAAA,GAAA;UAHrC,MAAM,MAAA,eAAA;UACN,OAAK,UAAY;UAClB,MAAK;UACJ,SAAK,eAAA,WAAO,kBAAkB,EAAE,GAAA,CAAA,MAAA,CAAA;;;;;;;kBAQvC,YAI8C,MAAA,yBAAA,GAAA;SAH3C,WAAS,UAAY,MAAK;SAC1B,YAAY,QAAA,eAAe,SAAS,EAAE;SACtC,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA;SACV,wBAAiB,WAAE,SAAS,IAAI,MAAM;;;;;;;;;;;;+BASrD,YAIoC,6BAAA;KAHjC,OAAO,aAAA;KACP,QAAQ,OAAO,KAAK,QAAA,KAAK,UAAM,CAAA,CAAA;KAC/B,OAAO,MAAA,cAAA;KACP,UAAQ"}
1
+ {"version":3,"file":"OAuthScopesInput.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarIconPencilSimple, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport type {\n OAuthFlow,\n OAuthFlowsObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/v2/components/data-table'\n\nimport OAuthScopesAddModal from './OAuthScopesAddModal.vue'\n\nconst { selectedScopes, flow, flowType } = defineProps<{\n flowType: keyof OAuthFlowsObject\n flow: OAuthFlow\n selectedScopes: string[]\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 searchQuery = ref('')\n\n/**\n * The scope currently being edited, used to switch the shared modal into edit mode.\n * Null means the modal is in \"add\" mode.\n */\nconst editingScope = ref<{ name: string; description: string } | null>(null)\n\n/** List of all available scopes */\nconst scopes = computed(() =>\n Object.entries(flow?.scopes ?? {}).map(([key, val]) => ({\n id: key,\n label: key,\n description: val,\n })),\n)\n\nconst scopeCount = computed(() => Object.keys(flow?.scopes ?? {}).length)\n\n/** Search is only useful once the list is long enough to scan */\nconst showScopeSearch = computed(() => scopeCount.value >= 10)\n\nconst filteredScopes = computed(() => {\n const query = showScopeSearch.value ? searchQuery.value : ''\n if (!query) {\n return scopes.value\n }\n\n const regex = new RegExp(\n query\n .split('')\n .map((c) => c.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('.*'),\n 'i',\n )\n\n return scopes.value.filter(({ label, description }) =>\n regex.test(`${label} ${description}`),\n )\n})\n\nconst hasScopes = computed(() => Object.keys(flow?.scopes ?? {}).length > 0)\n\nconst allScopesSelected = computed(\n () => selectedScopes.length === Object.keys(flow?.scopes ?? {}).length,\n)\n\nconst setScope = (scopeKey: string, checked: boolean) => {\n // Emit a single-scope toggle rather than a freshly computed list. The store applies it\n // against the currently selected scopes, so two quick clicks cannot overwrite each other\n // with a list computed from a prop that has not updated yet.\n emits('update:selectedScopes', { scope: scopeKey, selected: checked })\n}\n\n/** Select all scopes */\nconst selectAllScopes = () =>\n emits('update:selectedScopes', { scopes: Object.keys(flow?.scopes ?? {}) })\n\n/** Deselect all scopes */\nconst deselectAllScopes = () => emits('update:selectedScopes', { scopes: [] })\n\nconst scopeFormModal = useModal()\n\n/**\n * Forces the Disclosure to remount with `defaultOpen` set so the panel auto-expands\n * the moment a brand-new scope is added. Bumping this counter is paired with toggling\n * `expandOnNextMount` so the remount opens the panel, then reverts to the default\n * closed-on-mount behavior for any future unrelated remounts (e.g. collapse on empty).\n *\n * The Disclosure `:key` is only this counter — not a separate `hasScopes` segment — so\n * adding the first scope does not remount twice (empty prefix → with-scopes prefix),\n * which would reopen with `defaultOpen=false` and collapse the panel right when rows appear.\n */\nconst remountKey = ref(0)\nconst expandOnNextMount = ref(false)\n\nwatch(hasScopes, (has, had) => {\n if (had && !has) {\n expandOnNextMount.value = false\n remountKey.value += 1\n }\n})\n\n/** Open the modal in \"add new scope\" mode */\nconst openAddScopeModal = () => {\n editingScope.value = null\n scopeFormModal.show()\n}\n\n/** Open the modal in \"edit scope\" mode prefilled with the chosen row */\nconst openEditScopeModal = (scope: { id: string; description: string }) => {\n editingScope.value = {\n name: scope.id,\n description: scope.description ?? '',\n }\n scopeFormModal.show()\n}\n\n/**\n * Submit handler shared by Add Scope and Edit Scope. For renames, the `upsertScope` mutator on\n * the workspace store rewrites the selection state in place, so the component does not need to\n * emit a follow-up `update:selectedScopes`.\n *\n * When adding a brand-new scope (no `oldName`), the payload sets `enable: true` so the\n * `upsertScope` mutator also adds the new scope to any selection requirement that references\n * this scheme. The Disclosure is then remounted with `defaultOpen=true` so the user\n * immediately sees (and sees selected) the scope they just added.\n */\nconst handleScopeFormSubmit = async (payload: {\n name: string\n description: string\n oldName?: string\n}) => {\n const isAdd = !payload.oldName\n\n emits('upsert:scope', {\n scope: payload.name,\n description: payload.description,\n flowType,\n ...(payload.oldName ? { oldScope: payload.oldName } : {}),\n ...(isAdd ? { enable: true } : {}),\n })\n\n if (!isAdd) {\n return\n }\n\n expandOnNextMount.value = true\n remountKey.value += 1\n // Reset after the remount so subsequent unrelated remounts (e.g. when the last\n // scope is deleted) still default to a closed panel.\n await nextTick()\n expandOnNextMount.value = false\n}\n\n/**\n * Remove the scope from the flow. Selection cleanup (dropping the deleted key from any\n * currently-selected scopes) is handled by the `deleteScope` mutator on the workspace store,\n * so the component does not need to emit a follow-up `update:selectedScopes` here.\n */\nconst handleDeleteScope = (scopeKey: string) => {\n emits('delete:scope', { scope: scopeKey, flowType })\n}\n</script>\n\n<template>\n <DataTableCell class=\"h-auto !max-h-[initial] min-h-8 items-center\">\n <div class=\"flex h-fit w-full\">\n <div class=\"text-c-1 h-full items-center\"></div>\n <Disclosure\n :key=\"remountKey\"\n as=\"div\"\n class=\"bl flex w-full flex-col\"\n :defaultOpen=\"expandOnNextMount\">\n <!--\n Keep Add Scope (and other actions) outside the summary DisclosureButton.\n When there are no scopes the summary control is disabled; a native disabled\n button blocks pointer events for all descendants, which would make Add Scope unusable.\n -->\n <div\n class=\"group/scopes-accordion flex h-auto min-h-8 items-center gap-1.5 pr-2.25 pl-3 text-left\">\n <DisclosureButton\n :class=\"[\n 'min-w-0 flex-1 text-left',\n hasScopes ? 'hover:text-c-1 cursor-pointer' : 'cursor-default',\n (selectedScopes.length || 0) > 0 ? 'text-c-1' : 'text-c-3',\n ]\"\n :disabled=\"!hasScopes\">\n <template v-if=\"hasScopes\">\n Scopes Selected\n {{ selectedScopes.length || 0 }} /\n {{ Object.keys(flow?.scopes ?? {}).length || 0 }}\n </template>\n <template v-else> No Scopes Defined </template>\n </DisclosureButton>\n\n <div class=\"flex shrink-0 items-center gap-1.75\">\n <!-- Add new scope -->\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"openAddScopeModal\">\n Add Scope\n </ScalarButton>\n\n <!-- Deselect All -->\n <ScalarButton\n v-if=\"hasScopes && allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deselectAllScopes\">\n Deselect All\n </ScalarButton>\n\n <!-- Select All -->\n <ScalarButton\n v-if=\"hasScopes && !allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"selectAllScopes\">\n Select All\n </ScalarButton>\n\n <DisclosureButton\n v-if=\"hasScopes\"\n v-slot=\"{ open }\"\n class=\"text-c-3 hover:text-c-2 -m-0.5 flex shrink-0 items-center justify-center rounded p-0.5 focus-visible:outline-offset-2\">\n <ScalarIcon\n class=\"group-hover/scopes-accordion:text-c-2\"\n :icon=\"open ? 'ChevronDown' : 'ChevronRight'\"\n size=\"md\" />\n </DisclosureButton>\n </div>\n </div>\n <!-- Scopes List -->\n <DisclosurePanel as=\"template\">\n <div>\n <ScalarSearchInput\n v-if=\"showScopeSearch\"\n v-model=\"searchQuery\"\n class=\"flex items-center text-xs\" />\n <table\n class=\"grid max-h-40 auto-rows-auto overflow-x-hidden overflow-y-auto\"\n :style=\"{ gridTemplateColumns: '1fr auto' }\">\n <DataTableRow\n v-for=\"{ id, label, description } in filteredScopes\"\n :key=\"id\"\n class=\"text-c-2 group/scope-row\"\n @click=\"setScope(id, !selectedScopes.includes(id))\">\n <DataTableCell\n class=\"box-border flex !max-h-[initial] w-full min-w-0 cursor-pointer items-stretch overflow-hidden px-0 py-0\">\n <!-- Text scrolls horizontally; action rail stays fixed -->\n <div\n class=\"no-scrollbar text-c-2 group-hover/scope-row:text-c-1 flex min-h-8 min-w-0 flex-1 items-center gap-1 overflow-x-auto px-3 py-1.5 pr-20 text-xs text-nowrap\">\n <span class=\"font-code shrink-0 text-xs\">{{ label }}</span>\n <template v-if=\"String(description ?? '').trim()\">\n <span class=\"shrink-0\">&ndash;</span>\n <span class=\"whitespace-nowrap\">{{ description }}</span>\n </template>\n </div>\n <div\n class=\"oauth-scope-row-action-rail absolute top-0 right-0 z-[1] flex h-full min-w-[4.5rem] items-center justify-end gap-0.5 py-1 pr-2 pl-4 opacity-0 transition-opacity group-focus-within/scope-row:opacity-100 group-hover/scope-row:opacity-100\"\n @click.stop>\n <ScalarIconButton\n :icon=\"ScalarIconPencilSimple\"\n :label=\"`Edit ${label}`\"\n size=\"sm\"\n @click.stop=\"\n openEditScopeModal({\n id,\n description: description ?? '',\n })\n \" />\n <ScalarIconButton\n :icon=\"ScalarIconTrash\"\n :label=\"`Delete ${label}`\"\n size=\"sm\"\n @click.stop=\"handleDeleteScope(id)\" />\n </div>\n </DataTableCell>\n <!--\n Stop the click here so it does not also bubble to the row's `@click`\n toggle. The checkbox already drives the change via `@update:modelValue`;\n letting the row fire too would toggle the scope a second time.\n -->\n <DataTableCheckbox\n :ariaLabel=\"`Select ${label} scope`\"\n :modelValue=\"selectedScopes.includes(id)\"\n @click.stop\n @update:modelValue=\"setScope(id, $event)\" />\n </DataTableRow>\n </table>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n\n <!-- Shared add/edit scope modal -->\n <OAuthScopesAddModal\n :scope=\"editingScope\"\n :scopes=\"Object.keys(flow.scopes ?? {})\"\n :state=\"scopeFormModal\"\n @submit=\"handleScopeFormSubmit\" />\n </DataTableCell>\n</template>\n\n<style>\n/* Matches AddressBar.vue `.address-bar-bg-states` / `.fade-right` (header URL input). */\n.oauth-scope-row-action-rail {\n --oauth-scope-row-rail-bg: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n background: linear-gradient(\n 90deg,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 100%) 0%,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 20%) 30%,\n var(--oauth-scope-row-rail-bg) 100%\n );\n}\n\n.no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n\n.no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA,MAAM,QAAQ;EAed,MAAM,cAAc,IAAI,EAAE;;;;;EAM1B,MAAM,eAAe,IAAkD,IAAI;;EAG3E,MAAM,SAAS,eACb,OAAO,QAAQ,QA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AY;UAClB,MAAK;UACJ,SAAK,eAAA,WAAO,kBAAkB,EAAE,GAAA,CAAA,MAAA,CAAA;;;;;;;kBAQvC,YAI8C,MAAA,yBAAA,GAAA;SAH3C,WAAS,UAAY,MAAK;SAC1B,YAAY,QAAA,eAAe,SAAS,EAAE;SACtC,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA;SACV,wBAAiB,WAAE,SAAS,IAAI,MAAM;;;;;;;;;;;;+BASrD,YAIoC,6BAAA;KAHjC,OAAO,aAAA;KACP,QAAQ,OAAO,KAAK,QAAA,KAAK,UAAM,CAAA,CAAA;KAC/B,OAAO,MAAA,cAAA;KACP,UAAQ"}
@@ -1,6 +1,6 @@
1
1
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
2
2
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
3
- import { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
+ import { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
4
4
  import type { CustomFetch } from '../../../../v2/blocks/operation-block/helpers/send-request.js';
5
5
  type __VLS_Props = {
6
6
  /** Current environment configuration */
@@ -1 +1 @@
1
- {"version":3,"file":"OpenIDConnect.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\nimport { DataTableRow } from '@/v2/components/data-table'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n eventBus,\n getStaticBorderClass,\n name,\n scheme,\n proxyUrl,\n customFetch,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObject\n /** Optional fetch override (IPC-backed on desktop) used for discovery requests */\n customFetch?: CustomFetch\n}>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n customFetch,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message ?? 'Failed to fetch OpenID Connect configuration',\n 'error',\n )\n return\n }\n\n /** Set the newly discovered params in the secret store */\n const openIdConnect = openIDDiscoveryToFlows(_discovery)\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: openIdConnect,\n name,\n overwrite: true,\n })\n}\n\nconst handleUpdateOpenIdConnectUrl = (value: string): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: 'openIdConnect',\n openIdConnectUrl: value,\n },\n name,\n })\n</script>\n\n<template>\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.openIdConnectUrl\"\n placeholder=\"https://example.com/.well-known/openid-configuration\"\n required\n @update:modelValue=\"handleUpdateOpenIdConnectUrl\">\n Discovery URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :disabled=\"!scheme.openIdConnectUrl\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleOpenIdConnect\">\n Fetch Configuration\n </ScalarButton>\n </div>\n </DataTableRow>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"OpenIDConnect.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\nimport { DataTableRow } from '@/v2/components/data-table'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n eventBus,\n getStaticBorderClass,\n name,\n scheme,\n proxyUrl,\n customFetch,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObject\n /** Optional fetch override (IPC-backed on desktop) used for discovery requests */\n customFetch?: CustomFetch\n}>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n customFetch,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message ?? 'Failed to fetch OpenID Connect configuration',\n 'error',\n )\n return\n }\n\n /** Set the newly discovered params in the secret store */\n const openIdConnect = openIDDiscoveryToFlows(_discovery)\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: openIdConnect,\n name,\n overwrite: true,\n })\n}\n\nconst handleUpdateOpenIdConnectUrl = (value: string): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: 'openIdConnect',\n openIdConnectUrl: value,\n },\n name,\n })\n</script>\n\n<template>\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.openIdConnectUrl\"\n placeholder=\"https://example.com/.well-known/openid-configuration\"\n required\n @update:modelValue=\"handleUpdateOpenIdConnectUrl\">\n Discovery URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :disabled=\"!scheme.openIdConnectUrl\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleOpenIdConnect\">\n Fetch Configuration\n </ScalarButton>\n </div>\n </DataTableRow>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"OpenIDConnect.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\nimport { DataTableRow } from '@/v2/components/data-table'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n eventBus,\n getStaticBorderClass,\n name,\n scheme,\n proxyUrl,\n customFetch,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObject\n /** Optional fetch override (IPC-backed on desktop) used for discovery requests */\n customFetch?: CustomFetch\n}>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n customFetch,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message ?? 'Failed to fetch OpenID Connect configuration',\n 'error',\n )\n return\n }\n\n /** Set the newly discovered params in the secret store */\n const openIdConnect = openIDDiscoveryToFlows(_discovery)\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: openIdConnect,\n name,\n overwrite: true,\n })\n}\n\nconst handleUpdateOpenIdConnectUrl = (value: string): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: 'openIdConnect',\n openIdConnectUrl: value,\n },\n name,\n })\n</script>\n\n<template>\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.openIdConnectUrl\"\n placeholder=\"https://example.com/.well-known/openid-configuration\"\n required\n @update:modelValue=\"handleUpdateOpenIdConnectUrl\">\n Discovery URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :disabled=\"!scheme.openIdConnectUrl\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleOpenIdConnect\">\n Fetch Configuration\n </ScalarButton>\n </div>\n </DataTableRow>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAwCA,MAAM,SAAS,gBAAgB;EAC/B,MAAM,EAAE,UAAU,UAAU;;;;EAK5B,MAAM,sBAAsB,YAA2B;GACrD,IAAI,OAAO,aAAa,CAAC,QAAA,OAAO,kBAC9B;GAGF,OAAO,MAAM;GACb,MAAM,CAAC,OAAO,cAAc,MAAM,4BAChC,QAAA,OAAO,kBACP,QAAA,UACA,QAAA,WACF;GACA,MAAM,OAAO,MAAM;GAGnB,IAAI,OAAO;IACT,QAAQ,MAAM,KAAK;IACnB,MACE,OAAO,WAAW,gDAClB,OACF;IACA;GACF;;GAGA,MAAM,gBAAgB,uBAAuB,UAAU;GACvD,QAAA,SAAS,KAAK,uCAAuC;IACnD,SAAS;IACT,MAAG,QAAA;IACH,WAAW;GACb,CAAC;EACH;EAEA,MAAM,gCAAgC,UACpC,QAAA,SAAS,KAAK,+BAA+B;GAC3C,SAAS;IACP,MAAM;IACN,kBAAkB;GACpB;GACA,MAAG,QAAA;EACL,CAAC;;2DAID,YAUe,MAAA,oBAAA,GAAA,MAAA;2BADe,CAR5B,YAQ4B,mCAAA;KAPzB,gBAAgB,QAAA,qBAAoB;KACpC,aAAA,QAAA;KACA,YAAY,QAAA,OAAO;KACpB,aAAY;KACZ,UAAA;KACC,uBAAmB;;4BAEtB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAFoD,mBAEpD,EAAA,CAAA,EAAA,CAAA;;;;;;;;OAGF,YAYe,MAAA,oBAAA,GAAA,EAZD,OAAM,aAAY,GAAA;2BAWxB,CAVN,mBAUM,OAVN,YAUM,CATJ,YAQe,MAAA,YAAA,GAAA;KAPb,OAAM;KACL,UAAQ,CAAG,QAAA,OAAO;KAClB,QAAA,MAAA,MAAA;KACD,MAAK;KACL,SAAQ;KACP,SAAO;;4BAEV,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAF+B,yBAE/B,EAAA,CAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"OpenIDConnect.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\nimport { DataTableRow } from '@/v2/components/data-table'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n eventBus,\n getStaticBorderClass,\n name,\n scheme,\n proxyUrl,\n customFetch,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObject\n /** Optional fetch override (IPC-backed on desktop) used for discovery requests */\n customFetch?: CustomFetch\n}>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n customFetch,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message ?? 'Failed to fetch OpenID Connect configuration',\n 'error',\n )\n return\n }\n\n /** Set the newly discovered params in the secret store */\n const openIdConnect = openIDDiscoveryToFlows(_discovery)\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: openIdConnect,\n name,\n overwrite: true,\n })\n}\n\nconst handleUpdateOpenIdConnectUrl = (value: string): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: 'openIdConnect',\n openIdConnectUrl: value,\n },\n name,\n })\n</script>\n\n<template>\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.openIdConnectUrl\"\n placeholder=\"https://example.com/.well-known/openid-configuration\"\n required\n @update:modelValue=\"handleUpdateOpenIdConnectUrl\">\n Discovery URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :disabled=\"!scheme.openIdConnectUrl\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleOpenIdConnect\">\n Fetch Configuration\n </ScalarButton>\n </div>\n </DataTableRow>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAwCA,MAAM,SAAS,gBAAgB;EAC/B,MAAM,EAAE,UAAU,UAAU;;;;EAK5B,MAAM,sBAAsB,YAA2B;GACrD,IAAI,OAAO,aAAa,CAAC,QAAA,OAAO,kBAC9B;GAGF,OAAO,MAAM;GACb,MAAM,CAAC,OAAO,cAAc,MAAM,4BAChC,QAAA,OAAO,kBACP,QAAA,UACA,QAAA,WACF;GACA,MAAM,OAAO,MAAM;GAGnB,IAAI,OAAO;IACT,QAAQ,MAAM,KAAK;IACnB,MACE,OAAO,WAAW,gDAClB,OACF;IACA;GACF;;GAGA,MAAM,gBAAgB,uBAAuB,UAAU;GACvD,QAAA,SAAS,KAAK,uCAAuC;IACnD,SAAS;IACT,MAAG,QAAA;IACH,WAAW;GACb,CAAC;EACH;EAEA,MAAM,gCAAgC,UACpC,QAAA,SAAS,KAAK,+BAA+B;GAC3C,SAAS;IACP,MAAM;IACN,kBAAkB;GACpB;GACA,MAAG,QAAA;EACL,CAAC;;2DAID,YAUe,MAAA,oBAAA,GAAA,MAAA;2BADe,CAR5B,YAQ4B,mCAAA;KAPzB,gBAAgB,QAAA,qBAAoB;KACpC,aAAA,QAAA;KACA,YAAY,QAAA,OAAO;KACpB,aAAY;KACZ,UAAA;KACC,uBAAmB;;4BAEtB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAFoD,mBAEpD,EAAA,CAAA,EAAA,CAAA;;;;;;;;OAGF,YAYe,MAAA,oBAAA,GAAA,EAZD,OAAM,aAAY,GAAA;2BAWxB,CAVN,mBAUM,OAVN,YAUM,CATJ,YAQe,MAAA,YAAA,GAAA;KAPb,OAAM;KACL,UAAQ,CAAG,QAAA,OAAO;KAClB,QAAA,MAAA,MAAA;KACD,MAAK;KACL,SAAQ;KACP,SAAO;;4BAEV,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAF+B,yBAE/B,EAAA,CAAA,EAAA,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import type { AuthMeta, WorkspaceEventBus } from '@scalar/workspace-store/events';
2
2
  import type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example';
3
3
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
4
- import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
+ import type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
5
5
  import type { OAuth2Options } from '../../../../v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js';
6
6
  import type { SecuritySchemeOption } from '../../../../v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js';
7
7
  type __VLS_Props = {
@@ -1 +1 @@
1
- {"version":3,"file":"RequestAuthDataTable.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n No authentication selected\n </div>\n </form>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RequestAuthDataTable.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n No authentication selected\n </div>\n </form>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"RequestAuthDataTable.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n No authentication selected\n </div>\n </form>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDA,MAAM,eAAe,eACb,QAAA,sBAAsB,QAAA,gBAC9B;;;;;EAMA,MAAM,iBAAiB,eAAwB,QAAA,sBAAsB,SAAS,CAAC;;EAG/E,MAAM,mBAAmB,UACvB,QAAA,SAAS,KAAK,4BAA4B;GACxC;GACA,MAAG,QAAA;EACL,CAAC;;EAGH,MAAM,sBACJ,WAEA,QAAA,SAAS,KAAK,+BAA+B;GAC3C,GAAG;GACH,MAAG,QAAA;EACL,CAAC;;EAGH,MAAM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ACvB,kBAAc;;;;;;;;;;;;;qCAInB,mBAKM,OAAA;;IAHJ,OAAK,eAAA,CAAC,mFAAiF,EAAA,gDAC7B,QAAA,SAAQ,CAAA,CAAA;MAAI,gCAExE,CAAA,EAAA,GAAA,EAAA"}
1
+ {"version":3,"file":"RequestAuthDataTable.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n No authentication selected\n </div>\n </form>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDA,MAAM,eAAe,eACb,QAAA,sBAAsB,QAAA,gBAC9B;;;;;EAMA,MAAM,iBAAiB,eAAwB,QAAA,sBAAsB,SAAS,CAAC;;EAG/E,MAAM,mBAAmB,UACvB,QAAA,SAAS,KAAK,4BAA4B;GACxC;GACA,MAAG,QAAA;EACL,CAAC;;EAGH,MAAM,sBACJ,WAEA,QAAA,SAAS,KAAK,+BAA+B;GAC3C,GAAG;GACH,MAAG,QAAA;EACL,CAAC;;EAGH,MAAM,qBACJ,WACS,QAAA,SAAS,KAAK,sBAAsB,MAAM;;EAGrD,MAAM,qBACJ,WACS,QAAA,SAAS,KAAK,sBAAsB,MAAM;;EAGrD,MAAM,eAAe,UAA2B,QAAA,oBAAoB;;EAGpE,SAAa,EACX,aACF,CAAC;;uBAIC,mBAyDO,QAAA,EAzDA,UAAM,OAAA,OAAA,OAAA,KAAA,oBAAP,C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} from '@scalar/workspace-store/request-example';
3
3
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
4
- import type { SecurityRequirementObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
+ import type { SecurityRequirementObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
5
5
  import { type OAuth2Options } from './OAuth2.vue.js';
6
6
  type __VLS_Props = {
7
7
  /** Current environment configuration */
@@ -34,7 +34,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
34
34
  }, "meta">) => any;
35
35
  "upsert:scope": (payload: {
36
36
  name: string;
37
- flowType: keyof import("@scalar/workspace-store/schemas/v3.1/strict/oauthflows").OAuthFlowsObject;
37
+ flowType: keyof import("@scalar/workspace-store/schemas/v3.2/strict/oauthflows").OAuthFlowsObject;
38
38
  scope: string;
39
39
  description: string;
40
40
  oldScope?: string;
@@ -42,7 +42,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
42
42
  }) => any;
43
43
  "delete:scope": (payload: {
44
44
  name: string;
45
- flowType: keyof import("@scalar/workspace-store/schemas/v3.1/strict/oauthflows").OAuthFlowsObject;
45
+ flowType: keyof import("@scalar/workspace-store/schemas/v3.2/strict/oauthflows").OAuthFlowsObject;
46
46
  scope: string;
47
47
  }) => any;
48
48
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
@@ -56,7 +56,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
56
56
  }, "meta">) => any) | undefined;
57
57
  "onUpsert:scope"?: ((payload: {
58
58
  name: string;
59
- flowType: keyof import("@scalar/workspace-store/schemas/v3.1/strict/oauthflows").OAuthFlowsObject;
59
+ flowType: keyof import("@scalar/workspace-store/schemas/v3.2/strict/oauthflows").OAuthFlowsObject;
60
60
  scope: string;
61
61
  description: string;
62
62
  oldScope?: string;
@@ -64,7 +64,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
64
64
  }) => any) | undefined;
65
65
  "onDelete:scope"?: ((payload: {
66
66
  name: string;
67
- flowType: keyof import("@scalar/workspace-store/schemas/v3.1/strict/oauthflows").OAuthFlowsObject;
67
+ flowType: keyof import("@scalar/workspace-store/schemas/v3.2/strict/oauthflows").OAuthFlowsObject;
68
68
  scope: string;
69
69
  }) => any) | undefined;
70
70
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"RequestAuthTab.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue"],"names":[],"mappings":"AAuzBA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAML,KAAK,qBAAqB,EAK3B,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAEnH,OAAO,KAAK,EAEV,yBAAyB,EACzB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAgBrE,OAAe,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAA;AAYzD,KAAK,WAAW,GAAG;IACjB,wCAAwC;IACxC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,yFAAyF;IACzF,QAAQ,EAAE,OAAO,CAAA;IACjB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,+BAA+B;IAC/B,uBAAuB,EAAE,yBAAyB,CAAA;IAClD,oGAAoG;IACpG,eAAe,EAAE,qBAAqB,CAAA;IACtC,mCAAmC;IACnC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,uDAAuD;IACvD,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,yFAAyF;IACzF,YAAY,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;CACtC,CAAC;AAi+CF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"RequestAuthTab.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue"],"names":[],"mappings":"AA8qBA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAEL,KAAK,qBAAqB,EAG3B,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAEnH,OAAO,KAAK,EAEV,yBAAyB,EACzB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAgBrE,OAAe,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAA;AAYzD,KAAK,WAAW,GAAG;IACjB,wCAAwC;IACxC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,yFAAyF;IACzF,QAAQ,EAAE,OAAO,CAAA;IACjB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,+BAA+B;IAC/B,uBAAuB,EAAE,yBAAyB,CAAA;IAClD,oGAAoG;IACpG,eAAe,EAAE,qBAAqB,CAAA;IACtC,mCAAmC;IACnC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,uDAAuD;IACvD,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,yFAAyF;IACzF,YAAY,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;CACtC,CAAC;AAksCF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}