@sanity/access-ui 6.20.0-next.58 → 6.20.0-next.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -207,6 +207,7 @@ interface RequestAccessLabels {
207
207
  ssoEnforcedTitle: ReactNode;
208
208
  ssoEnforcedMessage: (context: {
209
209
  providerTitle?: string;
210
+ signedInWithSso?: boolean;
210
211
  }) => ReactNode;
211
212
  ssoSignInCta: ReactNode;
212
213
  resourceNotAvailableTitle: ReactNode;
package/lib/index.js CHANGED
@@ -167,12 +167,16 @@ const defaultLabels = {
167
167
  deniedMessage: ({ message }) => message ?? "Your request to access this content has been declined.",
168
168
  overLimitMessage: ({ message }) => message ?? "You’ve reached the limit for access requests across all projects. Please wait before submitting more requests, or contact an admin.",
169
169
  expiredMessage: "Your previous request has expired. You may request access again below.",
170
- ssoEnforcedTitle: "Sign in with SSO required",
171
- ssoEnforcedMessage: ({ providerTitle }) => providerTitle ? /* @__PURE__ */ jsxs(Fragment, { children: [
172
- "You’re signed in with ",
173
- /* @__PURE__ */ jsx("strong", { children: providerTitle }),
174
- ", but this organization requires signing in with SSO. Access can’t be requested with this account."
175
- ] }) : /* @__PURE__ */ jsx(Fragment, { children: "This organization requires signing in with SSO. Access can’t be requested with this account." }),
170
+ ssoEnforcedTitle: "Organization SSO required",
171
+ ssoEnforcedMessage: ({ providerTitle, signedInWithSso }) => {
172
+ let requirement = "This organization requires you to sign in with its own SSO. If you can’t continue, contact your organization’s administrator.";
173
+ return signedInWithSso ? /* @__PURE__ */ jsxs(Fragment, { children: ["You’re signed in with a different SSO provider. ", requirement] }) : providerTitle ? /* @__PURE__ */ jsxs(Fragment, { children: [
174
+ "You’re signed in with ",
175
+ /* @__PURE__ */ jsx("strong", { children: providerTitle }),
176
+ ". ",
177
+ requirement
178
+ ] }) : requirement;
179
+ },
176
180
  ssoSignInCta: "Sign in with SSO",
177
181
  resourceNotAvailableTitle: "Access can’t be requested",
178
182
  resourceNotAvailableMessage: "The resource currently being requested is no longer available.",
@@ -236,11 +240,12 @@ function _temp() {
236
240
  * The server's verdict. `null` hands the decision back to the caller's own
237
241
  * request history, which resolves the states this endpoint does not.
238
242
  */
239
- function deriveServerViewState(status, labels, providerTitle) {
243
+ function deriveServerViewState(status, labels, providerTitle, signedInWithSso) {
240
244
  switch (status.state) {
241
245
  case "saml-required": return ssoEnforcedState({
242
246
  labels,
243
247
  providerTitle,
248
+ signedInWithSso,
244
249
  redirectUrl: status.redirectUrl
245
250
  });
246
251
  case "resource-not-available": return {
@@ -254,17 +259,20 @@ function deriveServerViewState(status, labels, providerTitle) {
254
259
  }
255
260
  }
256
261
  function ssoEnforcedState(options) {
257
- let { labels, providerTitle, redirectUrl } = options;
262
+ let { labels, providerTitle, signedInWithSso, redirectUrl } = options;
258
263
  return {
259
264
  view: "sso-enforced",
260
265
  title: labels.ssoEnforcedTitle,
261
266
  description: null,
262
- message: labels.ssoEnforcedMessage({ providerTitle }),
267
+ message: labels.ssoEnforcedMessage({
268
+ providerTitle,
269
+ signedInWithSso
270
+ }),
263
271
  redirectUrl
264
272
  };
265
273
  }
266
274
  function deriveViewState(options) {
267
- let { accessRequestsHistory, accessRequestEligibilityState, resourceId, submitAccessRequestResult, currentUser, providerTitle, labels } = options, submitFailure = (message) => ({
275
+ let { accessRequestsHistory, accessRequestEligibilityState, resourceId, submitAccessRequestResult, currentUser, providerTitle, signedInWithSso, labels } = options, submitFailure = (message) => ({
268
276
  view: "blocked",
269
277
  title: labels.errorTitle,
270
278
  description: null,
@@ -279,6 +287,7 @@ function deriveViewState(options) {
279
287
  case "sso-enforced": return ssoEnforcedState({
280
288
  labels,
281
289
  providerTitle,
290
+ signedInWithSso,
282
291
  redirectUrl: submitAccessRequestResult.redirectUrl
283
292
  });
284
293
  case "denied": return submitFailure(labels.deniedMessage({ message: submitAccessRequestResult.message }));
@@ -286,7 +295,7 @@ function deriveViewState(options) {
286
295
  case "email-domain-blocked":
287
296
  case "requests-disabled": return submitFailure(submitAccessRequestResult.message);
288
297
  }
289
- let serverState = deriveServerViewState(accessRequestEligibilityState, labels, providerTitle);
298
+ let serverState = deriveServerViewState(accessRequestEligibilityState, labels, providerTitle, signedInWithSso);
290
299
  if (serverState) return serverState;
291
300
  let state = deriveAccessRequestState(accessRequestsHistory, resourceId);
292
301
  return state === "pending" ? {
@@ -306,19 +315,22 @@ function deriveViewState(options) {
306
315
  };
307
316
  }
308
317
  function RequestAccessFormContent(props) {
309
- let $ = c(9), { client, resourceType: t0, resourceId, currentUser, onSignOut, onRequestSubmitted, preview, renderAction, loadPromise } = props, resourceType = t0 === void 0 ? "project" : t0, { accessRequestsHistory, accessRequestEligibilityState } = use(loadPromise), labels = {
318
+ let $ = c(11), { client, resourceType: t0, resourceId, currentUser, onSignOut, onRequestSubmitted, preview, renderAction, loadPromise } = props, resourceType = t0 === void 0 ? "project" : t0, { accessRequestsHistory, accessRequestEligibilityState } = use(loadPromise), labels = {
310
319
  ...defaultLabels,
311
320
  ...props.labels
312
- }, titleId = useId(), [note, setNote] = useState(""), [submitAccessRequestResult, setSubmitAccessRequestResult] = useState(null), [isSubmitting, startSubmit] = useTransition(), providerTitle = getProviderTitle(currentUser?.provider), state = deriveViewState({
321
+ }, titleId = useId(), [note, setNote] = useState(""), [submitAccessRequestResult, setSubmitAccessRequestResult] = useState(null), [isSubmitting, startSubmit] = useTransition(), providerTitle = getProviderTitle(currentUser?.provider), t1;
322
+ $[0] === currentUser?.provider ? t1 = $[1] : (t1 = currentUser?.provider?.startsWith("saml-"), $[0] = currentUser?.provider, $[1] = t1);
323
+ let signedInWithSso = t1 === !0, state = deriveViewState({
313
324
  accessRequestsHistory,
314
325
  accessRequestEligibilityState,
315
326
  resourceId,
316
327
  submitAccessRequestResult,
317
328
  currentUser,
318
- providerTitle,
329
+ providerTitle: signedInWithSso ? void 0 : providerTitle,
330
+ signedInWithSso,
319
331
  labels
320
- }), submitFailed = submitAccessRequestResult?.type === "error", t1;
321
- $[0] !== client || $[1] !== isSubmitting || $[2] !== note || $[3] !== onRequestSubmitted || $[4] !== resourceId || $[5] !== resourceType ? (t1 = (event) => {
332
+ }), submitFailed = submitAccessRequestResult?.type === "error", t2;
333
+ $[2] !== client || $[3] !== isSubmitting || $[4] !== note || $[5] !== onRequestSubmitted || $[6] !== resourceId || $[7] !== resourceType ? (t2 = (event) => {
322
334
  event.preventDefault(), !isSubmitting && startSubmit(async () => {
323
335
  let trimmedNote = note.trim() || void 0, result = await submitAccessRequest({
324
336
  client,
@@ -329,13 +341,13 @@ function RequestAccessFormContent(props) {
329
341
  });
330
342
  setSubmitAccessRequestResult(result), result.type === "submitted" && onRequestSubmitted?.({ note: trimmedNote });
331
343
  });
332
- }, $[0] = client, $[1] = isSubmitting, $[2] = note, $[3] = onRequestSubmitted, $[4] = resourceId, $[5] = resourceType, $[6] = t1) : t1 = $[6];
333
- let handleSubmit = t1, t2;
334
- return $[7] === preview ? t2 = $[8] : (t2 = preview ? /* @__PURE__ */ jsx(Flex, {
344
+ }, $[2] = client, $[3] = isSubmitting, $[4] = note, $[5] = onRequestSubmitted, $[6] = resourceId, $[7] = resourceType, $[8] = t2) : t2 = $[8];
345
+ let handleSubmit = t2, t3;
346
+ return $[9] === preview ? t3 = $[10] : (t3 = preview ? /* @__PURE__ */ jsx(Flex, {
335
347
  justifyContent: "center",
336
348
  padding: 2,
337
349
  children: preview
338
- }) : null, $[7] = preview, $[8] = t2), /* @__PURE__ */ jsxs(Flex, {
350
+ }) : null, $[9] = preview, $[10] = t3), /* @__PURE__ */ jsxs(Flex, {
339
351
  flexDirection: "column",
340
352
  height: "100%",
341
353
  children: [/* @__PURE__ */ jsxs(Flex, {
@@ -345,7 +357,7 @@ function RequestAccessFormContent(props) {
345
357
  gap: 4,
346
358
  padding: 4,
347
359
  children: [
348
- t2,
360
+ t3,
349
361
  /* @__PURE__ */ jsx(Text, {
350
362
  as: "h1",
351
363
  id: titleId,
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_Fragment","resourceType = 'project'","() =>\n combineLatest({\n accessRequestsHistory: defer(() => listMyAccessRequests(client)).pipe(\n catchError(() => of(null)),\n ),\n accessRequestEligibilityState: defer(() =>\n fetchAccessRequestStatus({client, resourceType, resourceId, origin: getRequestUrl()}),\n ),\n })","() => of(null)","<Flex alignItems=\"center\" height=\"100%\" justifyContent=\"center\" padding={5}>\n <Spinner muted />\n </Flex>","<Card border height=\"fill\" overflow=\"hidden\" radius={3} tone=\"default\">\n <Suspense\n fallback={\n <Flex alignItems=\"center\" height=\"100%\" justifyContent=\"center\" padding={5}>\n <Spinner muted />\n </Flex>\n }\n >\n <RequestAccessFormContent {...props} loadPromise={loadPromise} />\n </Suspense>\n </Card>","(event: SubmitEvent<HTMLFormElement>) => {\n event.preventDefault()\n if (isSubmitting) return\n startSubmit(async () => {\n const trimmedNote = note.trim() || undefined\n const result = await submitAccessRequest({\n client,\n resourceType,\n resourceId,\n note: trimmedNote,\n requestUrl: getRequestUrl(),\n })\n setSubmitAccessRequestResult(result)\n if (result.type === 'submitted') onRequestSubmitted?.({note: trimmedNote})\n })\n }","preview ? (\n <Flex justifyContent=\"center\" padding={2}>\n {preview}\n </Flex>\n ) : null","event","_c"],"sources":["../src/accessRequests.ts","../src/deriveAccessRequestState.ts","../src/providerTitle.ts","../src/labels.tsx","../src/RequestAccessForm.tsx"],"sourcesContent":["import {type SanityClient} from '@sanity/client'\n\nimport {\n type AccessRequest,\n type AccessRequestEligibilityState,\n type AccessResourceType,\n type SubmitAccessRequestResult,\n} from './types'\n\n/**\n * The Access API only accepts notes up to this length.\n *\n * @public\n */\nexport const MAX_ACCESS_REQUEST_NOTE_LENGTH = 150\n\nconst ACCESS_API_VERSION = '2024-07-01'\n\n/**\n * Structured 403 code thrown by the Access API when the target organization\n * only admits members through its SSO login flow.\n */\nconst SAML_ENFORCEMENT_REQUIRED = 'saml_enforcement_required'\n\nfunction withAccessApiVersion(client: SanityClient): SanityClient {\n return client.withConfig({apiVersion: ACCESS_API_VERSION})\n}\n\n/**\n * Fetches the caller's own access requests across all resources\n * (`GET /access/requests/me`).\n *\n * @public\n */\nexport async function listMyAccessRequests(client: SanityClient): Promise<AccessRequest[]> {\n const requests = await withAccessApiVersion(client).request<AccessRequest[] | null>({\n url: '/access/requests/me',\n tag: 'access-ui.list-requests',\n })\n return requests ?? []\n}\n\n/**\n * Asks what the request-access screen should show\n * (`GET /access/{resourceType}/{resourceId}/requests/state`).\n *\n * Runs before the form is offered, so a user in a SAML-enforced organization is\n * pointed at SSO instead of writing a note no administrator can action.\n *\n * `origin` is carried opaquely to the login page so the user returns where they\n * started. Never throws: an unreachable or older API answers `eligible`,\n * leaving the form in place and the submit-time 403 as the backstop.\n *\n * @public\n */\nexport async function fetchAccessRequestStatus(options: {\n client: SanityClient\n resourceType: AccessResourceType\n resourceId: string\n origin?: string\n}): Promise<AccessRequestEligibilityState> {\n const {client, resourceType, resourceId, origin} = options\n try {\n const status = await withAccessApiVersion(client).request<AccessRequestEligibilityState | null>(\n {\n url: `/access/${resourceType}/${resourceId}/requests/state`,\n tag: 'access-ui.request-state',\n query: origin ? {returnQuery: new URLSearchParams({origin}).toString()} : undefined,\n },\n )\n return status ?? {state: 'eligible'}\n } catch {\n return {state: 'eligible'}\n }\n}\n\ninterface ErrorResponseDetails {\n statusCode?: number\n message?: string\n code?: string\n redirectUrl?: string\n}\n\nfunction getErrorResponseDetails(err: unknown): ErrorResponseDetails {\n if (typeof err !== 'object' || err === null) return {}\n const response = (err as {response?: unknown}).response\n if (typeof response !== 'object' || response === null) return {}\n const {statusCode} = response as {statusCode?: unknown}\n const body = (response as {body?: unknown}).body\n const details: ErrorResponseDetails = {\n statusCode: typeof statusCode === 'number' ? statusCode : undefined,\n }\n if (typeof body === 'object' && body !== null) {\n const {message, code, redirectUrl} = body as {\n message?: unknown\n code?: unknown\n redirectUrl?: unknown\n }\n details.message = typeof message === 'string' ? message : undefined\n details.code = typeof code === 'string' ? code : undefined\n details.redirectUrl = typeof redirectUrl === 'string' ? redirectUrl : undefined\n }\n return details\n}\n\nfunction mapSubmitError(err: unknown): SubmitAccessRequestResult {\n const {statusCode, message, code, redirectUrl} = getErrorResponseDetails(err)\n\n if (statusCode === 403 && code === SAML_ENFORCEMENT_REQUIRED) {\n return {type: 'sso-enforced', redirectUrl, message}\n }\n if (statusCode === 429) {\n return {type: 'over-limit', message}\n }\n if (statusCode === 409) {\n if (message?.includes('email domain')) return {type: 'email-domain-blocked', message}\n if (message?.includes('disabled for organization')) return {type: 'requests-disabled', message}\n return {type: 'denied', message: message?.replace(/^Conflict -\\s*/, '')}\n }\n return {type: 'error', error: err}\n}\n\n/**\n * Submits an access request (`POST /access/{resourceType}/{resourceId}/requests`)\n * and maps the Access API's error contract to a {@link SubmitAccessRequestResult}.\n * Never throws for API rejections; unexpected failures come back as\n * `{type: 'error'}` so callers decide how to surface them.\n *\n * @public\n */\nexport async function submitAccessRequest(options: {\n client: SanityClient\n resourceType: AccessResourceType\n resourceId: string\n note?: string\n requestUrl?: string\n}): Promise<SubmitAccessRequestResult> {\n const {client, resourceType, resourceId, note, requestUrl} = options\n try {\n const request = await withAccessApiVersion(client).request<AccessRequest | null>({\n url: `/access/${resourceType}/${resourceId}/requests`,\n method: 'post',\n tag: 'access-ui.submit-request',\n body: {note, requestUrl, type: 'access'},\n })\n return {type: 'submitted', request}\n } catch (err) {\n return mapSubmitError(err)\n }\n}\n","import {type AccessRequest, type AccessRequestState} from './types'\n\n/**\n * Access requests are considered active for two weeks, matching the Access\n * API's request lifetime.\n */\nconst REQUEST_LIFETIME_MS = 14 * 24 * 60 * 60 * 1000\n\n/**\n * Derives where the caller stands on requesting access to a resource from\n * their existing access requests.\n *\n * A declined request blocks re-requesting for two weeks. A pending request\n * younger than two weeks is in review; older pending requests count as\n * expired, and the caller may request again.\n *\n * @public\n */\nexport function deriveAccessRequestState(\n requests: AccessRequest[] | null | undefined,\n resourceId: string,\n now: number = Date.now(),\n): AccessRequestState {\n if (!requests || requests.length === 0) return 'none'\n\n const isRecent = (request: AccessRequest) =>\n now - new Date(request.createdAt).getTime() < REQUEST_LIFETIME_MS\n\n const forResource = requests.filter((request) => request.resourceId === resourceId)\n\n if (forResource.some((request) => request.status === 'declined' && isRecent(request))) {\n return 'denied'\n }\n if (forResource.some((request) => request.status === 'pending' && isRecent(request))) {\n return 'pending'\n }\n if (forResource.some((request) => request.status === 'pending')) {\n return 'expired'\n }\n return 'none'\n}\n","/**\n * Human-readable title for a login provider id, e.g. `google` → `Google`,\n * `saml-xyz` → `SAML/SSO`.\n *\n * @public\n */\nexport function getProviderTitle(provider?: string): string | undefined {\n if (provider === 'google') return 'Google'\n if (provider === 'github') return 'GitHub'\n if (provider === 'sanity') return 'Sanity'\n if (provider === 'vercel') return 'Vercel'\n if (provider?.startsWith('saml-')) return 'SAML/SSO'\n return undefined\n}\n","import {type ReactNode} from 'react'\n\n/**\n * All user-facing strings in the request-access screen. Every label can be\n * overridden, so hosts with their own i18n stack (studio i18n, react-i18next)\n * inject translated copy while standalone hosts get the English defaults.\n *\n * @public\n */\nexport interface RequestAccessLabels {\n title: ReactNode\n sentTitle: ReactNode\n deniedTitle: ReactNode\n errorTitle: ReactNode\n describeNoAccess: (context: {email?: string}) => ReactNode\n promptProject: ReactNode\n promptOrganization: ReactNode\n notePlaceholder: string\n noteAriaLabel: string\n submit: ReactNode\n sentDescription: ReactNode\n pendingMessage: ReactNode\n deniedMessage: (context: {message?: string}) => ReactNode\n overLimitMessage: (context: {message?: string}) => ReactNode\n expiredMessage: ReactNode\n ssoEnforcedTitle: ReactNode\n ssoEnforcedMessage: (context: {providerTitle?: string}) => ReactNode\n ssoSignInCta: ReactNode\n resourceNotAvailableTitle: ReactNode\n resourceNotAvailableMessage: ReactNode\n submitFailedMessage: ReactNode\n wrongAccount: ReactNode\n signOut: ReactNode\n}\n\n/** @internal */\nexport const defaultLabels: RequestAccessLabels = {\n title: 'Request access',\n sentTitle: 'Access request sent',\n deniedTitle: 'Access request declined',\n errorTitle: 'Access request couldn’t be sent',\n describeNoAccess: ({email}) =>\n email ? (\n <>\n Your account <strong>({email})</strong> doesn’t have access to this content.\n </>\n ) : (\n <>Your account doesn’t have access to this content.</>\n ),\n promptProject: 'Send a request to the project admin(s).',\n promptOrganization: 'Send a request to the organization admin(s).',\n notePlaceholder: 'Message (optional)',\n noteAriaLabel: 'Message',\n submit: 'Request access',\n sentDescription:\n 'Your request has been sent. You will receive a notification if access is approved.',\n pendingMessage: 'Your request to access this content is pending approval.',\n deniedMessage: ({message}) => message ?? 'Your request to access this content has been declined.',\n overLimitMessage: ({message}) =>\n message ??\n 'You’ve reached the limit for access requests across all projects. Please wait before submitting more requests, or contact an admin.',\n expiredMessage: 'Your previous request has expired. You may request access again below.',\n // Reached both before and after a submit, so it must not claim a send failed.\n ssoEnforcedTitle: 'Sign in with SSO required',\n ssoEnforcedMessage: ({providerTitle}) =>\n providerTitle ? (\n <>\n You’re signed in with <strong>{providerTitle}</strong>, but this organization requires\n signing in with SSO. Access can’t be requested with this account.\n </>\n ) : (\n <>\n This organization requires signing in with SSO. Access can’t be requested with this account.\n </>\n ),\n ssoSignInCta: 'Sign in with SSO',\n resourceNotAvailableTitle: 'Access can’t be requested',\n resourceNotAvailableMessage: 'The resource currently being requested is no longer available.',\n submitFailedMessage: 'There was a problem submitting your request. Please try again.',\n wrongAccount: 'Wrong account?',\n signOut: 'Sign out',\n}\n","import {type SanityClient} from '@sanity/client'\nimport {LaunchIcon} from '@sanity/icons/Launch'\nimport {Avatar, Button, Card, Spinner, Text, TextArea} from '@sanity/ui'\nimport {\n type ReactNode,\n type SubmitEvent,\n Suspense,\n use,\n useId,\n useState,\n useTransition,\n} from 'react'\nimport {type ObservablePromise, useObservablePromise} from 'react-rx'\nimport {catchError, combineLatest, defer, of} from 'rxjs'\nimport {Flex, Box, VStack} from 'ui5'\n\nimport {\n fetchAccessRequestStatus,\n listMyAccessRequests,\n MAX_ACCESS_REQUEST_NOTE_LENGTH,\n submitAccessRequest,\n} from './accessRequests'\nimport {deriveAccessRequestState} from './deriveAccessRequestState'\nimport {defaultLabels, type RequestAccessLabels} from './labels'\nimport {getProviderTitle} from './providerTitle'\nimport {\n type AccessRequest,\n type AccessRequestEligibilityState,\n type AccessResourceType,\n type AccessUser,\n type SubmitAccessRequestResult,\n} from './types'\n\n/** @public */\nexport interface RequestAccessFormProps {\n /** Client authenticated as the requesting user. The Access API version is applied internally. */\n client: SanityClient\n resourceType?: AccessResourceType\n /** Project or organization id to request access to. */\n resourceId: string\n /** The signed-in user, rendered in the description and account footer. */\n currentUser?: AccessUser | null\n /**\n * Called when the user chooses \"Sign out\". The account footer's sign-out\n * action is only rendered when provided; hosts own the actual sign-out\n * mechanism (studio: `auth.logout()`, dashboard: logout route navigation).\n */\n onSignOut?: () => void\n /** Called after a request is successfully submitted, e.g. for analytics. */\n onRequestSubmitted?: (details: {note?: string}) => void\n /** Optional slot rendered above the title, e.g. a resource preview. */\n preview?: ReactNode\n /**\n * Renders an optional action area at the bottom of the card's content, e.g.\n * a navigation CTA. Called with the current view so the action can differ\n * per state (or be omitted for some); return null to render nothing.\n */\n renderAction?: (context: {view: RequestAccessView}) => ReactNode\n /** Label overrides for hosts with their own i18n stack. */\n labels?: Partial<RequestAccessLabels>\n}\n\n/**\n * The shared request-access screen: explains that the signed-in account lacks\n * access, lets the user request it with an optional note, and reflects the\n * request lifecycle (pending, denied, expired, over-limit, SSO-enforced).\n *\n * Fetches the caller's existing requests once it is mounted and suspends while\n * loading; an internal `Suspense` boundary renders a spinner, so hosts can\n * mount it directly. The fetch starts when the card commits, not while it\n * renders, so a host whose own `Suspense` boundary retries around it does not\n * refetch, and the result is kept while a hidden `<Activity>` conceals the\n * card. Remount with a `key` when `client` or `resourceId` change.\n *\n * @public\n */\nexport function RequestAccessForm(props: RequestAccessFormProps) {\n const {client, resourceType = 'project', resourceId} = props\n\n // Frozen at first render, so a new client for the same resource neither\n // refetches nor resets the form; hosts remount with `key` to reload. `defer`\n // keeps the requests out of render: react-rx subscribes once this component\n // commits, so a render React discards never fetches, and one subscription is\n // shared across StrictMode's double effects and an `<Activity>` hide/show.\n // Both requests complete, so the hook never resubscribes the source and\n // keeps the settled promise for the life of this instance.\n const [load$] = useState(() =>\n combineLatest({\n accessRequestsHistory: defer(() => listMyAccessRequests(client)).pipe(\n catchError(() => of(null)),\n ),\n accessRequestEligibilityState: defer(() =>\n fetchAccessRequestStatus({client, resourceType, resourceId, origin: getRequestUrl()}),\n ),\n }),\n )\n // Read with `use()` in the child below the boundary, never here: suspending\n // this component would stop the commit that starts the fetch.\n const loadPromise = useObservablePromise(load$)\n\n return (\n <Card border height=\"fill\" overflow=\"hidden\" radius={3} tone=\"default\">\n <Suspense\n fallback={\n <Flex alignItems=\"center\" height=\"100%\" justifyContent=\"center\" padding={5}>\n <Spinner muted />\n </Flex>\n }\n >\n <RequestAccessFormContent {...props} loadPromise={loadPromise} />\n </Suspense>\n </Card>\n )\n}\n\ninterface LoadedAccessRequestData {\n accessRequestsHistory: AccessRequest[] | null\n accessRequestEligibilityState: AccessRequestEligibilityState\n}\n\n/**\n * The view the request-access card is currently showing.\n *\n * @public\n */\nexport type RequestAccessView = 'form' | 'sent' | 'pending' | 'blocked' | 'sso-enforced'\n\n/**\n * Everything the card renders, copy included: the same state that picks a view\n * is the only thing that knows which words that view needs. Keying copy off\n * `view` alone cannot work, because `blocked` covers a prior decline, a gone\n * resource and four submit failures, each with its own copy.\n */\ntype ViewState = {title: ReactNode; description: ReactNode | null} & (\n | {view: 'form'; expired: boolean}\n | {view: 'sent'}\n | {view: 'pending'}\n | {view: 'blocked'; message: ReactNode}\n | {view: 'sso-enforced'; message: ReactNode; redirectUrl?: string}\n)\n\n/**\n * The server's verdict. `null` hands the decision back to the caller's own\n * request history, which resolves the states this endpoint does not.\n */\nfunction deriveServerViewState(\n status: AccessRequestEligibilityState,\n labels: RequestAccessLabels,\n providerTitle?: string,\n): ViewState | null {\n switch (status.state) {\n case 'saml-required':\n return ssoEnforcedState({labels, providerTitle, redirectUrl: status.redirectUrl})\n case 'resource-not-available':\n // Nothing was submitted, so the submit-failure copy would misdescribe it.\n return {\n view: 'blocked',\n title: labels.resourceNotAvailableTitle,\n description: null,\n message: labels.resourceNotAvailableMessage,\n }\n case 'eligible':\n return null\n default:\n return null\n }\n}\n\n// Reached on mount and after a submit 403, so the title claims neither.\nfunction ssoEnforcedState(options: {\n labels: RequestAccessLabels\n providerTitle?: string\n redirectUrl?: string\n}): ViewState {\n const {labels, providerTitle, redirectUrl} = options\n return {\n view: 'sso-enforced',\n title: labels.ssoEnforcedTitle,\n description: null,\n message: labels.ssoEnforcedMessage({providerTitle}),\n redirectUrl,\n }\n}\n\nfunction deriveViewState(options: {\n accessRequestsHistory: AccessRequest[] | null\n accessRequestEligibilityState: AccessRequestEligibilityState\n resourceId: string\n submitAccessRequestResult: SubmitAccessRequestResult | null\n currentUser?: AccessUser | null\n providerTitle?: string\n labels: RequestAccessLabels\n}): ViewState {\n const {\n accessRequestsHistory,\n accessRequestEligibilityState,\n resourceId,\n submitAccessRequestResult,\n currentUser,\n providerTitle,\n labels,\n } = options\n const submitFailure = (message: ReactNode): ViewState => ({\n view: 'blocked',\n title: labels.errorTitle,\n description: null,\n message,\n })\n\n if (submitAccessRequestResult) {\n switch (submitAccessRequestResult.type) {\n case 'submitted':\n return {view: 'sent', title: labels.sentTitle, description: labels.sentDescription}\n case 'sso-enforced':\n return ssoEnforcedState({\n labels,\n providerTitle,\n redirectUrl: submitAccessRequestResult.redirectUrl,\n })\n case 'denied':\n return submitFailure(labels.deniedMessage({message: submitAccessRequestResult.message}))\n case 'over-limit':\n return submitFailure(labels.overLimitMessage({message: submitAccessRequestResult.message}))\n case 'email-domain-blocked':\n case 'requests-disabled':\n return submitFailure(submitAccessRequestResult.message)\n case 'error':\n // Fall through to the fetched state; the form stays up with an inline error.\n break\n default:\n }\n }\n\n // The server's verdict outranks the request history: a pending request in an\n // enforced org is already dead, so \"pending approval\" would be a false\n // promise. It answers `eligible` when it has nothing to say.\n const serverState = deriveServerViewState(accessRequestEligibilityState, labels, providerTitle)\n if (serverState) return serverState\n\n // TODO: `pending` and `denied` will be replaced by future content in `accessRequestEligibilityState`\n const state = deriveAccessRequestState(accessRequestsHistory, resourceId)\n if (state === 'pending') {\n return {view: 'pending', title: labels.sentTitle, description: labels.pendingMessage}\n }\n // Derived from prefetch: the user hasn't submitted anything this session,\n // so the title must describe the prior decline, not a failed send.\n if (state === 'denied') {\n return {\n view: 'blocked',\n title: labels.deniedTitle,\n description: null,\n message: labels.deniedMessage({}),\n }\n }\n return {\n view: 'form',\n title: labels.title,\n description: labels.describeNoAccess({email: currentUser?.email}),\n expired: state === 'expired',\n }\n}\n\nfunction RequestAccessFormContent(\n props: RequestAccessFormProps & {loadPromise: ObservablePromise<LoadedAccessRequestData>},\n) {\n const {\n client,\n resourceType = 'project',\n resourceId,\n currentUser,\n onSignOut,\n onRequestSubmitted,\n preview,\n renderAction,\n loadPromise,\n } = props\n const {accessRequestsHistory, accessRequestEligibilityState} = use(loadPromise)\n\n const labels = {...defaultLabels, ...props.labels}\n const titleId = useId()\n\n const [note, setNote] = useState('')\n const [submitAccessRequestResult, setSubmitAccessRequestResult] =\n useState<SubmitAccessRequestResult | null>(null)\n const [isSubmitting, startSubmit] = useTransition()\n\n const providerTitle = getProviderTitle(currentUser?.provider)\n const state = deriveViewState({\n accessRequestsHistory,\n accessRequestEligibilityState,\n resourceId,\n submitAccessRequestResult,\n currentUser,\n providerTitle,\n labels,\n })\n\n const submitFailed = submitAccessRequestResult?.type === 'error'\n\n const handleSubmit = (event: SubmitEvent<HTMLFormElement>) => {\n event.preventDefault()\n if (isSubmitting) return\n startSubmit(async () => {\n const trimmedNote = note.trim() || undefined\n const result = await submitAccessRequest({\n client,\n resourceType,\n resourceId,\n note: trimmedNote,\n requestUrl: getRequestUrl(),\n })\n setSubmitAccessRequestResult(result)\n if (result.type === 'submitted') onRequestSubmitted?.({note: trimmedNote})\n })\n }\n\n return (\n <Flex flexDirection=\"column\" height=\"100%\">\n <Flex flexDirection=\"column\" flexBasis=\"0%\" flexGrow={1} gap={4} padding={4}>\n {preview ? (\n <Flex justifyContent=\"center\" padding={2}>\n {preview}\n </Flex>\n ) : null}\n\n <Text as=\"h1\" id={titleId} size={2} weight=\"semibold\">\n {state.title}\n </Text>\n\n {state.description !== null ? (\n <Text as=\"p\" muted size={1}>\n {state.description}\n </Text>\n ) : null}\n\n {state.view === 'blocked' || state.view === 'sso-enforced' ? (\n <VStack gap={4}>\n <Card border padding={3} radius={2} role=\"alert\" tone=\"caution\">\n <Text as=\"p\" muted size={1}>\n {state.message}\n </Text>\n </Card>\n {state.view === 'sso-enforced' && state.redirectUrl ? (\n <Button\n as=\"a\"\n href={state.redirectUrl}\n iconRight={LaunchIcon}\n mode=\"ghost\"\n text={labels.ssoSignInCta}\n width=\"fill\"\n />\n ) : null}\n </VStack>\n ) : null}\n\n {state.view === 'form' ? (\n <VStack as=\"form\" aria-labelledby={titleId} onSubmit={handleSubmit} gap={4}>\n <Text as=\"p\" size={1}>\n {state.expired\n ? labels.expiredMessage\n : resourceType === 'organization'\n ? labels.promptOrganization\n : labels.promptProject}\n </Text>\n <VStack gap={2}>\n <TextArea\n aria-label={labels.noteAriaLabel}\n disabled={isSubmitting}\n fontSize={1}\n maxLength={MAX_ACCESS_REQUEST_NOTE_LENGTH}\n onChange={(event) => setNote(event.currentTarget.value)}\n placeholder={labels.notePlaceholder}\n rows={3}\n value={note}\n />\n <Text align=\"right\" muted size={0}>\n {`${note.length}/${MAX_ACCESS_REQUEST_NOTE_LENGTH}`}\n </Text>\n </VStack>\n {submitFailed ? (\n <Card border padding={3} radius={2} role=\"alert\" tone=\"critical\">\n <Text as=\"p\" muted size={1}>\n {labels.submitFailedMessage}\n </Text>\n </Card>\n ) : null}\n <Button\n disabled={isSubmitting}\n loading={isSubmitting}\n text={labels.submit}\n type=\"submit\"\n width=\"fill\"\n />\n </VStack>\n ) : null}\n\n {renderAction?.({view: state.view})}\n </Flex>\n\n {currentUser ? (\n <Card borderTop padding={3}>\n <Flex alignItems=\"center\" flexDirection=\"column\" gap={3}>\n <Flex alignItems=\"center\" gap={2} justifyContent=\"center\">\n <Avatar initials={getInitials(currentUser)} size={0} src={currentUser.profileImage} />\n <Box>\n <Text muted size={1} textOverflow=\"ellipsis\">\n {currentUser.email ?? currentUser.name}\n {providerTitle ? ` · ${providerTitle}` : ''}\n </Text>\n </Box>\n </Flex>\n {onSignOut ? (\n <Button\n fontSize={0}\n mode=\"bleed\"\n onClick={onSignOut}\n padding={2}\n textWeight=\"regular\"\n >\n <Text muted size={1}>\n {labels.wrongAccount} <strong>{labels.signOut}</strong>\n </Text>\n </Button>\n ) : null}\n </Flex>\n </Card>\n ) : null}\n </Flex>\n )\n}\n\n// The URL fragment can carry auth tokens (e.g. the #token= login handoff),\n// so it must never reach the Access API's logs.\nfunction getRequestUrl(): string | undefined {\n if (typeof window === 'undefined') return undefined\n const url = new URL(window.location.href)\n url.hash = ''\n return url.toString()\n}\n\nfunction getInitials(user: AccessUser): string | undefined {\n const source = user.name ?? user.email\n if (!source) return undefined\n const parts = source.trim().split(/\\s+/)\n const initials = parts\n .slice(0, 2)\n .map((part) => part[0])\n .join('')\n return initials ? initials.toUpperCase() : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,iCAAiC;AAU9C,SAAS,qBAAqB,QAAoC;CAChE,OAAO,OAAO,WAAW,EAAC,YAAY,aAAkB,CAAC;AAC3D;;;;;;;AAQA,eAAsB,qBAAqB,QAAgD;CAKzF,OAAO,MAJgB,qBAAqB,MAAM,CAAC,CAAC,QAAgC;EAClF,KAAK;EACL,KAAK;CACP,CAAC,KACkB,CAAC;AACtB;;;;;;;;;;;;;;AAeA,eAAsB,yBAAyB,SAKJ;CACzC,IAAM,EAAC,QAAQ,cAAc,YAAY,WAAU;CACnD,IAAI;EAQF,OAAO,MAPc,qBAAqB,MAAM,CAAC,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;KACH,CAAA,EAAA,CAAA,CACD;IACL,CAAA,GAAA,YACC,oBAAC,QAAD;KACE,UAAU;KACV,MAAK;KACL,SAAS;KACT,SAAS;KACT,YAAW;KAEX,UAAA,qBAAC,MAAD;MAAM,OAAA;MAAM,MAAM;MAAlB,UAAA;OACG,OAAO;OAAa;OAAC,oBAAC,UAAD,EAAA,UAAS,OAAO,QAAgB,CAAA;MAClD;;IACA,CAAA,IACN,IACA;;EACF,CAAA,IACJ,IACA;;AAEV;AAIA,SAAS,gBAAoC;CAC3C,IAAI,OAAO,SAAW,KAAa;CACnC,IAAM,MAAM,IAAI,IAAI,OAAO,SAAS,IAAI;CAExC,OADA,IAAI,OAAO,IACJ,IAAI,SAAS;AACtB;AAEA,SAAS,YAAY,MAAsC;CACzD,IAAM,SAAS,KAAK,QAAQ,KAAK;CACjC,IAAI,CAAC,QAAQ;CAEb,IAAM,WADQ,OAAO,KAAK,CAAC,CAAC,MAAM,KACjB,CAAA,CACd,MAAM,GAAG,CAAC,CAAC,CACX,KAAK,SAAS,KAAK,EAAE,CAAC,CACtB,KAAK,EAAE;CACV,OAAO,WAAW,SAAS,YAAY,IAAI,KAAA;AAC7C"}
1
+ {"version":3,"file":"index.js","names":["_Fragment","resourceType = 'project'","() =>\n combineLatest({\n accessRequestsHistory: defer(() => listMyAccessRequests(client)).pipe(\n catchError(() => of(null)),\n ),\n accessRequestEligibilityState: defer(() =>\n fetchAccessRequestStatus({client, resourceType, resourceId, origin: getRequestUrl()}),\n ),\n })","() => of(null)","<Flex alignItems=\"center\" height=\"100%\" justifyContent=\"center\" padding={5}>\n <Spinner muted />\n </Flex>","<Card border height=\"fill\" overflow=\"hidden\" radius={3} tone=\"default\">\n <Suspense\n fallback={\n <Flex alignItems=\"center\" height=\"100%\" justifyContent=\"center\" padding={5}>\n <Spinner muted />\n </Flex>\n }\n >\n <RequestAccessFormContent {...props} loadPromise={loadPromise} />\n </Suspense>\n </Card>","currentUser?.provider?.startsWith('saml-')","provider","(event: SubmitEvent<HTMLFormElement>) => {\n event.preventDefault()\n if (isSubmitting) return\n startSubmit(async () => {\n const trimmedNote = note.trim() || undefined\n const result = await submitAccessRequest({\n client,\n resourceType,\n resourceId,\n note: trimmedNote,\n requestUrl: getRequestUrl(),\n })\n setSubmitAccessRequestResult(result)\n if (result.type === 'submitted') onRequestSubmitted?.({note: trimmedNote})\n })\n }","preview ? (\n <Flex justifyContent=\"center\" padding={2}>\n {preview}\n </Flex>\n ) : null","event","_c"],"sources":["../src/accessRequests.ts","../src/deriveAccessRequestState.ts","../src/providerTitle.ts","../src/labels.tsx","../src/RequestAccessForm.tsx"],"sourcesContent":["import {type SanityClient} from '@sanity/client'\n\nimport {\n type AccessRequest,\n type AccessRequestEligibilityState,\n type AccessResourceType,\n type SubmitAccessRequestResult,\n} from './types'\n\n/**\n * The Access API only accepts notes up to this length.\n *\n * @public\n */\nexport const MAX_ACCESS_REQUEST_NOTE_LENGTH = 150\n\nconst ACCESS_API_VERSION = '2024-07-01'\n\n/**\n * Structured 403 code thrown by the Access API when the target organization\n * only admits members through its SSO login flow.\n */\nconst SAML_ENFORCEMENT_REQUIRED = 'saml_enforcement_required'\n\nfunction withAccessApiVersion(client: SanityClient): SanityClient {\n return client.withConfig({apiVersion: ACCESS_API_VERSION})\n}\n\n/**\n * Fetches the caller's own access requests across all resources\n * (`GET /access/requests/me`).\n *\n * @public\n */\nexport async function listMyAccessRequests(client: SanityClient): Promise<AccessRequest[]> {\n const requests = await withAccessApiVersion(client).request<AccessRequest[] | null>({\n url: '/access/requests/me',\n tag: 'access-ui.list-requests',\n })\n return requests ?? []\n}\n\n/**\n * Asks what the request-access screen should show\n * (`GET /access/{resourceType}/{resourceId}/requests/state`).\n *\n * Runs before the form is offered, so a user in a SAML-enforced organization is\n * pointed at SSO instead of writing a note no administrator can action.\n *\n * `origin` is carried opaquely to the login page so the user returns where they\n * started. Never throws: an unreachable or older API answers `eligible`,\n * leaving the form in place and the submit-time 403 as the backstop.\n *\n * @public\n */\nexport async function fetchAccessRequestStatus(options: {\n client: SanityClient\n resourceType: AccessResourceType\n resourceId: string\n origin?: string\n}): Promise<AccessRequestEligibilityState> {\n const {client, resourceType, resourceId, origin} = options\n try {\n const status = await withAccessApiVersion(client).request<AccessRequestEligibilityState | null>(\n {\n url: `/access/${resourceType}/${resourceId}/requests/state`,\n tag: 'access-ui.request-state',\n query: origin ? {returnQuery: new URLSearchParams({origin}).toString()} : undefined,\n },\n )\n return status ?? {state: 'eligible'}\n } catch {\n return {state: 'eligible'}\n }\n}\n\ninterface ErrorResponseDetails {\n statusCode?: number\n message?: string\n code?: string\n redirectUrl?: string\n}\n\nfunction getErrorResponseDetails(err: unknown): ErrorResponseDetails {\n if (typeof err !== 'object' || err === null) return {}\n const response = (err as {response?: unknown}).response\n if (typeof response !== 'object' || response === null) return {}\n const {statusCode} = response as {statusCode?: unknown}\n const body = (response as {body?: unknown}).body\n const details: ErrorResponseDetails = {\n statusCode: typeof statusCode === 'number' ? statusCode : undefined,\n }\n if (typeof body === 'object' && body !== null) {\n const {message, code, redirectUrl} = body as {\n message?: unknown\n code?: unknown\n redirectUrl?: unknown\n }\n details.message = typeof message === 'string' ? message : undefined\n details.code = typeof code === 'string' ? code : undefined\n details.redirectUrl = typeof redirectUrl === 'string' ? redirectUrl : undefined\n }\n return details\n}\n\nfunction mapSubmitError(err: unknown): SubmitAccessRequestResult {\n const {statusCode, message, code, redirectUrl} = getErrorResponseDetails(err)\n\n if (statusCode === 403 && code === SAML_ENFORCEMENT_REQUIRED) {\n return {type: 'sso-enforced', redirectUrl, message}\n }\n if (statusCode === 429) {\n return {type: 'over-limit', message}\n }\n if (statusCode === 409) {\n if (message?.includes('email domain')) return {type: 'email-domain-blocked', message}\n if (message?.includes('disabled for organization')) return {type: 'requests-disabled', message}\n return {type: 'denied', message: message?.replace(/^Conflict -\\s*/, '')}\n }\n return {type: 'error', error: err}\n}\n\n/**\n * Submits an access request (`POST /access/{resourceType}/{resourceId}/requests`)\n * and maps the Access API's error contract to a {@link SubmitAccessRequestResult}.\n * Never throws for API rejections; unexpected failures come back as\n * `{type: 'error'}` so callers decide how to surface them.\n *\n * @public\n */\nexport async function submitAccessRequest(options: {\n client: SanityClient\n resourceType: AccessResourceType\n resourceId: string\n note?: string\n requestUrl?: string\n}): Promise<SubmitAccessRequestResult> {\n const {client, resourceType, resourceId, note, requestUrl} = options\n try {\n const request = await withAccessApiVersion(client).request<AccessRequest | null>({\n url: `/access/${resourceType}/${resourceId}/requests`,\n method: 'post',\n tag: 'access-ui.submit-request',\n body: {note, requestUrl, type: 'access'},\n })\n return {type: 'submitted', request}\n } catch (err) {\n return mapSubmitError(err)\n }\n}\n","import {type AccessRequest, type AccessRequestState} from './types'\n\n/**\n * Access requests are considered active for two weeks, matching the Access\n * API's request lifetime.\n */\nconst REQUEST_LIFETIME_MS = 14 * 24 * 60 * 60 * 1000\n\n/**\n * Derives where the caller stands on requesting access to a resource from\n * their existing access requests.\n *\n * A declined request blocks re-requesting for two weeks. A pending request\n * younger than two weeks is in review; older pending requests count as\n * expired, and the caller may request again.\n *\n * @public\n */\nexport function deriveAccessRequestState(\n requests: AccessRequest[] | null | undefined,\n resourceId: string,\n now: number = Date.now(),\n): AccessRequestState {\n if (!requests || requests.length === 0) return 'none'\n\n const isRecent = (request: AccessRequest) =>\n now - new Date(request.createdAt).getTime() < REQUEST_LIFETIME_MS\n\n const forResource = requests.filter((request) => request.resourceId === resourceId)\n\n if (forResource.some((request) => request.status === 'declined' && isRecent(request))) {\n return 'denied'\n }\n if (forResource.some((request) => request.status === 'pending' && isRecent(request))) {\n return 'pending'\n }\n if (forResource.some((request) => request.status === 'pending')) {\n return 'expired'\n }\n return 'none'\n}\n","/**\n * Human-readable title for a login provider id, e.g. `google` → `Google`,\n * `saml-xyz` → `SAML/SSO`.\n *\n * @public\n */\nexport function getProviderTitle(provider?: string): string | undefined {\n if (provider === 'google') return 'Google'\n if (provider === 'github') return 'GitHub'\n if (provider === 'sanity') return 'Sanity'\n if (provider === 'vercel') return 'Vercel'\n if (provider?.startsWith('saml-')) return 'SAML/SSO'\n return undefined\n}\n","import {type ReactNode} from 'react'\n\n/**\n * All user-facing strings in the request-access screen. Every label can be\n * overridden, so hosts with their own i18n stack (studio i18n, react-i18next)\n * inject translated copy while standalone hosts get the English defaults.\n *\n * @public\n */\nexport interface RequestAccessLabels {\n title: ReactNode\n sentTitle: ReactNode\n deniedTitle: ReactNode\n errorTitle: ReactNode\n describeNoAccess: (context: {email?: string}) => ReactNode\n promptProject: ReactNode\n promptOrganization: ReactNode\n notePlaceholder: string\n noteAriaLabel: string\n submit: ReactNode\n sentDescription: ReactNode\n pendingMessage: ReactNode\n deniedMessage: (context: {message?: string}) => ReactNode\n overLimitMessage: (context: {message?: string}) => ReactNode\n expiredMessage: ReactNode\n ssoEnforcedTitle: ReactNode\n ssoEnforcedMessage: (context: {providerTitle?: string; signedInWithSso?: boolean}) => ReactNode\n ssoSignInCta: ReactNode\n resourceNotAvailableTitle: ReactNode\n resourceNotAvailableMessage: ReactNode\n submitFailedMessage: ReactNode\n wrongAccount: ReactNode\n signOut: ReactNode\n}\n\n/** @internal */\nexport const defaultLabels: RequestAccessLabels = {\n title: 'Request access',\n sentTitle: 'Access request sent',\n deniedTitle: 'Access request declined',\n errorTitle: 'Access request couldn’t be sent',\n describeNoAccess: ({email}) =>\n email ? (\n <>\n Your account <strong>({email})</strong> doesn’t have access to this content.\n </>\n ) : (\n <>Your account doesn’t have access to this content.</>\n ),\n promptProject: 'Send a request to the project admin(s).',\n promptOrganization: 'Send a request to the organization admin(s).',\n notePlaceholder: 'Message (optional)',\n noteAriaLabel: 'Message',\n submit: 'Request access',\n sentDescription:\n 'Your request has been sent. You will receive a notification if access is approved.',\n pendingMessage: 'Your request to access this content is pending approval.',\n deniedMessage: ({message}) => message ?? 'Your request to access this content has been declined.',\n overLimitMessage: ({message}) =>\n message ??\n 'You’ve reached the limit for access requests across all projects. Please wait before submitting more requests, or contact an admin.',\n expiredMessage: 'Your previous request has expired. You may request access again below.',\n // Reached both before and after a submit, so it must not claim a send failed.\n ssoEnforcedTitle: 'Organization SSO required',\n ssoEnforcedMessage: ({providerTitle, signedInWithSso}) => {\n const requirement =\n 'This organization requires you to sign in with its own SSO. If you can’t continue, contact your organization’s administrator.'\n if (signedInWithSso) return <>You’re signed in with a different SSO provider. {requirement}</>\n if (providerTitle) {\n return (\n <>\n You’re signed in with <strong>{providerTitle}</strong>. {requirement}\n </>\n )\n }\n return requirement\n },\n ssoSignInCta: 'Sign in with SSO',\n resourceNotAvailableTitle: 'Access can’t be requested',\n resourceNotAvailableMessage: 'The resource currently being requested is no longer available.',\n submitFailedMessage: 'There was a problem submitting your request. Please try again.',\n wrongAccount: 'Wrong account?',\n signOut: 'Sign out',\n}\n","import {type SanityClient} from '@sanity/client'\nimport {LaunchIcon} from '@sanity/icons/Launch'\nimport {Avatar, Button, Card, Spinner, Text, TextArea} from '@sanity/ui'\nimport {\n type ReactNode,\n type SubmitEvent,\n Suspense,\n use,\n useId,\n useState,\n useTransition,\n} from 'react'\nimport {type ObservablePromise, useObservablePromise} from 'react-rx'\nimport {catchError, combineLatest, defer, of} from 'rxjs'\nimport {Flex, Box, VStack} from 'ui5'\n\nimport {\n fetchAccessRequestStatus,\n listMyAccessRequests,\n MAX_ACCESS_REQUEST_NOTE_LENGTH,\n submitAccessRequest,\n} from './accessRequests'\nimport {deriveAccessRequestState} from './deriveAccessRequestState'\nimport {defaultLabels, type RequestAccessLabels} from './labels'\nimport {getProviderTitle} from './providerTitle'\nimport {\n type AccessRequest,\n type AccessRequestEligibilityState,\n type AccessResourceType,\n type AccessUser,\n type SubmitAccessRequestResult,\n} from './types'\n\n/** @public */\nexport interface RequestAccessFormProps {\n /** Client authenticated as the requesting user. The Access API version is applied internally. */\n client: SanityClient\n resourceType?: AccessResourceType\n /** Project or organization id to request access to. */\n resourceId: string\n /** The signed-in user, rendered in the description and account footer. */\n currentUser?: AccessUser | null\n /**\n * Called when the user chooses \"Sign out\". The account footer's sign-out\n * action is only rendered when provided; hosts own the actual sign-out\n * mechanism (studio: `auth.logout()`, dashboard: logout route navigation).\n */\n onSignOut?: () => void\n /** Called after a request is successfully submitted, e.g. for analytics. */\n onRequestSubmitted?: (details: {note?: string}) => void\n /** Optional slot rendered above the title, e.g. a resource preview. */\n preview?: ReactNode\n /**\n * Renders an optional action area at the bottom of the card's content, e.g.\n * a navigation CTA. Called with the current view so the action can differ\n * per state (or be omitted for some); return null to render nothing.\n */\n renderAction?: (context: {view: RequestAccessView}) => ReactNode\n /** Label overrides for hosts with their own i18n stack. */\n labels?: Partial<RequestAccessLabels>\n}\n\n/**\n * The shared request-access screen: explains that the signed-in account lacks\n * access, lets the user request it with an optional note, and reflects the\n * request lifecycle (pending, denied, expired, over-limit, SSO-enforced).\n *\n * Fetches the caller's existing requests once it is mounted and suspends while\n * loading; an internal `Suspense` boundary renders a spinner, so hosts can\n * mount it directly. The fetch starts when the card commits, not while it\n * renders, so a host whose own `Suspense` boundary retries around it does not\n * refetch, and the result is kept while a hidden `<Activity>` conceals the\n * card. Remount with a `key` when `client` or `resourceId` change.\n *\n * @public\n */\nexport function RequestAccessForm(props: RequestAccessFormProps) {\n const {client, resourceType = 'project', resourceId} = props\n\n // Frozen at first render, so a new client for the same resource neither\n // refetches nor resets the form; hosts remount with `key` to reload. `defer`\n // keeps the requests out of render: react-rx subscribes once this component\n // commits, so a render React discards never fetches, and one subscription is\n // shared across StrictMode's double effects and an `<Activity>` hide/show.\n // Both requests complete, so the hook never resubscribes the source and\n // keeps the settled promise for the life of this instance.\n const [load$] = useState(() =>\n combineLatest({\n accessRequestsHistory: defer(() => listMyAccessRequests(client)).pipe(\n catchError(() => of(null)),\n ),\n accessRequestEligibilityState: defer(() =>\n fetchAccessRequestStatus({client, resourceType, resourceId, origin: getRequestUrl()}),\n ),\n }),\n )\n // Read with `use()` in the child below the boundary, never here: suspending\n // this component would stop the commit that starts the fetch.\n const loadPromise = useObservablePromise(load$)\n\n return (\n <Card border height=\"fill\" overflow=\"hidden\" radius={3} tone=\"default\">\n <Suspense\n fallback={\n <Flex alignItems=\"center\" height=\"100%\" justifyContent=\"center\" padding={5}>\n <Spinner muted />\n </Flex>\n }\n >\n <RequestAccessFormContent {...props} loadPromise={loadPromise} />\n </Suspense>\n </Card>\n )\n}\n\ninterface LoadedAccessRequestData {\n accessRequestsHistory: AccessRequest[] | null\n accessRequestEligibilityState: AccessRequestEligibilityState\n}\n\n/**\n * The view the request-access card is currently showing.\n *\n * @public\n */\nexport type RequestAccessView = 'form' | 'sent' | 'pending' | 'blocked' | 'sso-enforced'\n\n/**\n * Everything the card renders, copy included: the same state that picks a view\n * is the only thing that knows which words that view needs. Keying copy off\n * `view` alone cannot work, because `blocked` covers a prior decline, a gone\n * resource and four submit failures, each with its own copy.\n */\ntype ViewState = {title: ReactNode; description: ReactNode | null} & (\n | {view: 'form'; expired: boolean}\n | {view: 'sent'}\n | {view: 'pending'}\n | {view: 'blocked'; message: ReactNode}\n | {view: 'sso-enforced'; message: ReactNode; redirectUrl?: string}\n)\n\n/**\n * The server's verdict. `null` hands the decision back to the caller's own\n * request history, which resolves the states this endpoint does not.\n */\nfunction deriveServerViewState(\n status: AccessRequestEligibilityState,\n labels: RequestAccessLabels,\n providerTitle?: string,\n signedInWithSso?: boolean,\n): ViewState | null {\n switch (status.state) {\n case 'saml-required':\n return ssoEnforcedState({\n labels,\n providerTitle,\n signedInWithSso,\n redirectUrl: status.redirectUrl,\n })\n case 'resource-not-available':\n // Nothing was submitted, so the submit-failure copy would misdescribe it.\n return {\n view: 'blocked',\n title: labels.resourceNotAvailableTitle,\n description: null,\n message: labels.resourceNotAvailableMessage,\n }\n case 'eligible':\n return null\n default:\n return null\n }\n}\n\n// Reached on mount and after a submit 403, so the title claims neither.\nfunction ssoEnforcedState(options: {\n labels: RequestAccessLabels\n providerTitle?: string\n signedInWithSso?: boolean\n redirectUrl?: string\n}): ViewState {\n const {labels, providerTitle, signedInWithSso, redirectUrl} = options\n return {\n view: 'sso-enforced',\n title: labels.ssoEnforcedTitle,\n description: null,\n message: labels.ssoEnforcedMessage({providerTitle, signedInWithSso}),\n redirectUrl,\n }\n}\n\nfunction deriveViewState(options: {\n accessRequestsHistory: AccessRequest[] | null\n accessRequestEligibilityState: AccessRequestEligibilityState\n resourceId: string\n submitAccessRequestResult: SubmitAccessRequestResult | null\n currentUser?: AccessUser | null\n providerTitle?: string\n signedInWithSso?: boolean\n labels: RequestAccessLabels\n}): ViewState {\n const {\n accessRequestsHistory,\n accessRequestEligibilityState,\n resourceId,\n submitAccessRequestResult,\n currentUser,\n providerTitle,\n signedInWithSso,\n labels,\n } = options\n const submitFailure = (message: ReactNode): ViewState => ({\n view: 'blocked',\n title: labels.errorTitle,\n description: null,\n message,\n })\n\n if (submitAccessRequestResult) {\n switch (submitAccessRequestResult.type) {\n case 'submitted':\n return {view: 'sent', title: labels.sentTitle, description: labels.sentDescription}\n case 'sso-enforced':\n return ssoEnforcedState({\n labels,\n providerTitle,\n signedInWithSso,\n redirectUrl: submitAccessRequestResult.redirectUrl,\n })\n case 'denied':\n return submitFailure(labels.deniedMessage({message: submitAccessRequestResult.message}))\n case 'over-limit':\n return submitFailure(labels.overLimitMessage({message: submitAccessRequestResult.message}))\n case 'email-domain-blocked':\n case 'requests-disabled':\n return submitFailure(submitAccessRequestResult.message)\n case 'error':\n // Fall through to the fetched state; the form stays up with an inline error.\n break\n default:\n }\n }\n\n // The server's verdict outranks the request history: a pending request in an\n // enforced org is already dead, so \"pending approval\" would be a false\n // promise. It answers `eligible` when it has nothing to say.\n const serverState = deriveServerViewState(\n accessRequestEligibilityState,\n labels,\n providerTitle,\n signedInWithSso,\n )\n if (serverState) return serverState\n\n // TODO: `pending` and `denied` will be replaced by future content in `accessRequestEligibilityState`\n const state = deriveAccessRequestState(accessRequestsHistory, resourceId)\n if (state === 'pending') {\n return {view: 'pending', title: labels.sentTitle, description: labels.pendingMessage}\n }\n // Derived from prefetch: the user hasn't submitted anything this session,\n // so the title must describe the prior decline, not a failed send.\n if (state === 'denied') {\n return {\n view: 'blocked',\n title: labels.deniedTitle,\n description: null,\n message: labels.deniedMessage({}),\n }\n }\n return {\n view: 'form',\n title: labels.title,\n description: labels.describeNoAccess({email: currentUser?.email}),\n expired: state === 'expired',\n }\n}\n\nfunction RequestAccessFormContent(\n props: RequestAccessFormProps & {loadPromise: ObservablePromise<LoadedAccessRequestData>},\n) {\n const {\n client,\n resourceType = 'project',\n resourceId,\n currentUser,\n onSignOut,\n onRequestSubmitted,\n preview,\n renderAction,\n loadPromise,\n } = props\n const {accessRequestsHistory, accessRequestEligibilityState} = use(loadPromise)\n\n const labels = {...defaultLabels, ...props.labels}\n const titleId = useId()\n\n const [note, setNote] = useState('')\n const [submitAccessRequestResult, setSubmitAccessRequestResult] =\n useState<SubmitAccessRequestResult | null>(null)\n const [isSubmitting, startSubmit] = useTransition()\n\n const providerTitle = getProviderTitle(currentUser?.provider)\n const signedInWithSso = currentUser?.provider?.startsWith('saml-') === true\n const state = deriveViewState({\n accessRequestsHistory,\n accessRequestEligibilityState,\n resourceId,\n submitAccessRequestResult,\n currentUser,\n providerTitle: signedInWithSso ? undefined : providerTitle,\n signedInWithSso,\n labels,\n })\n\n const submitFailed = submitAccessRequestResult?.type === 'error'\n\n const handleSubmit = (event: SubmitEvent<HTMLFormElement>) => {\n event.preventDefault()\n if (isSubmitting) return\n startSubmit(async () => {\n const trimmedNote = note.trim() || undefined\n const result = await submitAccessRequest({\n client,\n resourceType,\n resourceId,\n note: trimmedNote,\n requestUrl: getRequestUrl(),\n })\n setSubmitAccessRequestResult(result)\n if (result.type === 'submitted') onRequestSubmitted?.({note: trimmedNote})\n })\n }\n\n return (\n <Flex flexDirection=\"column\" height=\"100%\">\n <Flex flexDirection=\"column\" flexBasis=\"0%\" flexGrow={1} gap={4} padding={4}>\n {preview ? (\n <Flex justifyContent=\"center\" padding={2}>\n {preview}\n </Flex>\n ) : null}\n\n <Text as=\"h1\" id={titleId} size={2} weight=\"semibold\">\n {state.title}\n </Text>\n\n {state.description !== null ? (\n <Text as=\"p\" muted size={1}>\n {state.description}\n </Text>\n ) : null}\n\n {state.view === 'blocked' || state.view === 'sso-enforced' ? (\n <VStack gap={4}>\n <Card border padding={3} radius={2} role=\"alert\" tone=\"caution\">\n <Text as=\"p\" muted size={1}>\n {state.message}\n </Text>\n </Card>\n {state.view === 'sso-enforced' && state.redirectUrl ? (\n <Button\n as=\"a\"\n href={state.redirectUrl}\n iconRight={LaunchIcon}\n mode=\"ghost\"\n text={labels.ssoSignInCta}\n width=\"fill\"\n />\n ) : null}\n </VStack>\n ) : null}\n\n {state.view === 'form' ? (\n <VStack as=\"form\" aria-labelledby={titleId} onSubmit={handleSubmit} gap={4}>\n <Text as=\"p\" size={1}>\n {state.expired\n ? labels.expiredMessage\n : resourceType === 'organization'\n ? labels.promptOrganization\n : labels.promptProject}\n </Text>\n <VStack gap={2}>\n <TextArea\n aria-label={labels.noteAriaLabel}\n disabled={isSubmitting}\n fontSize={1}\n maxLength={MAX_ACCESS_REQUEST_NOTE_LENGTH}\n onChange={(event) => setNote(event.currentTarget.value)}\n placeholder={labels.notePlaceholder}\n rows={3}\n value={note}\n />\n <Text align=\"right\" muted size={0}>\n {`${note.length}/${MAX_ACCESS_REQUEST_NOTE_LENGTH}`}\n </Text>\n </VStack>\n {submitFailed ? (\n <Card border padding={3} radius={2} role=\"alert\" tone=\"critical\">\n <Text as=\"p\" muted size={1}>\n {labels.submitFailedMessage}\n </Text>\n </Card>\n ) : null}\n <Button\n disabled={isSubmitting}\n loading={isSubmitting}\n text={labels.submit}\n type=\"submit\"\n width=\"fill\"\n />\n </VStack>\n ) : null}\n\n {renderAction?.({view: state.view})}\n </Flex>\n\n {currentUser ? (\n <Card borderTop padding={3}>\n <Flex alignItems=\"center\" flexDirection=\"column\" gap={3}>\n <Flex alignItems=\"center\" gap={2} justifyContent=\"center\">\n <Avatar initials={getInitials(currentUser)} size={0} src={currentUser.profileImage} />\n <Box>\n <Text muted size={1} textOverflow=\"ellipsis\">\n {currentUser.email ?? currentUser.name}\n {providerTitle ? ` · ${providerTitle}` : ''}\n </Text>\n </Box>\n </Flex>\n {onSignOut ? (\n <Button\n fontSize={0}\n mode=\"bleed\"\n onClick={onSignOut}\n padding={2}\n textWeight=\"regular\"\n >\n <Text muted size={1}>\n {labels.wrongAccount} <strong>{labels.signOut}</strong>\n </Text>\n </Button>\n ) : null}\n </Flex>\n </Card>\n ) : null}\n </Flex>\n )\n}\n\n// The URL fragment can carry auth tokens (e.g. the #token= login handoff),\n// so it must never reach the Access API's logs.\nfunction getRequestUrl(): string | undefined {\n if (typeof window === 'undefined') return undefined\n const url = new URL(window.location.href)\n url.hash = ''\n return url.toString()\n}\n\nfunction getInitials(user: AccessUser): string | undefined {\n const source = user.name ?? user.email\n if (!source) return undefined\n const parts = source.trim().split(/\\s+/)\n const initials = parts\n .slice(0, 2)\n .map((part) => part[0])\n .join('')\n return initials ? initials.toUpperCase() : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,iCAAiC;AAU9C,SAAS,qBAAqB,QAAoC;CAChE,OAAO,OAAO,WAAW,EAAC,YAAY,aAAkB,CAAC;AAC3D;;;;;;;AAQA,eAAsB,qBAAqB,QAAgD;CAKzF,OAAO,MAJgB,qBAAqB,MAAM,CAAC,CAAC,QAAgC;EAClF,KAAK;EACL,KAAK;CACP,CAAC,KACkB,CAAC;AACtB;;;;;;;;;;;;;;AAeA,eAAsB,yBAAyB,SAKJ;CACzC,IAAM,EAAC,QAAQ,cAAc,YAAY,WAAU;CACnD,IAAI;EAQF,OAAO,MAPc,qBAAqB,MAAM,CAAC,CAAC,QAChD;GACE,KAAK,WAAW,aAAa,GAAG,WAAW;GAC3C,KAAK;GACL,OAAO,SAAS,EAAC,aAAa,IAAI,gBAAgB,EAAC,OAAM,CAAC,CAAC,CAAC,SAAS,EAAC,IAAI,KAAA;EAC5E,CACF,KACiB,EAAC,OAAO,WAAU;CACrC,QAA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,cAAa;MAAlC,UAAA,CACG,YAAY,SAAS,YAAY,MACjC,gBAAgB,MAAM,kBAAkB,EACrC;KACH,CAAA,EAAA,CAAA,CACD;IACL,CAAA,GAAA,YACC,oBAAC,QAAD;KACE,UAAU;KACV,MAAK;KACL,SAAS;KACT,SAAS;KACT,YAAW;KAEX,UAAA,qBAAC,MAAD;MAAM,OAAA;MAAM,MAAM;MAAlB,UAAA;OACG,OAAO;OAAa;OAAC,oBAAC,UAAD,EAAA,UAAS,OAAO,QAAgB,CAAA;MAClD;;IACA,CAAA,IACN,IACA;;EACF,CAAA,IACJ,IACA;;AAEV;AAIA,SAAS,gBAAoC;CAC3C,IAAI,OAAO,SAAW,KAAa;CACnC,IAAM,MAAM,IAAI,IAAI,OAAO,SAAS,IAAI;CAExC,OADA,IAAI,OAAO,IACJ,IAAI,SAAS;AACtB;AAEA,SAAS,YAAY,MAAsC;CACzD,IAAM,SAAS,KAAK,QAAQ,KAAK;CACjC,IAAI,CAAC,QAAQ;CAEb,IAAM,WADQ,OAAO,KAAK,CAAC,CAAC,MAAM,KACjB,CAAA,CACd,MAAM,GAAG,CAAC,CAAC,CACX,KAAK,SAAS,KAAK,EAAE,CAAC,CACtB,KAAK,EAAE;CACV,OAAO,WAAW,SAAS,YAAY,IAAI,KAAA;AAC7C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/access-ui",
3
- "version": "6.20.0-next.58",
3
+ "version": "6.20.0-next.63",
4
4
  "description": "Shared request-access screen and access-request logic for Sanity applications",
5
5
  "keywords": [
6
6
  "access",