@coinlist-co/react 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-CRACFEJ4.js +17 -0
- package/dist/chunk-CRACFEJ4.js.map +1 -0
- package/dist/{chunk-GRVV7NLV.js → chunk-N3WBC2VS.js} +218 -28
- package/dist/chunk-N3WBC2VS.js.map +1 -0
- package/dist/chunk-V6WO67RO.js +311 -0
- package/dist/chunk-V6WO67RO.js.map +1 -0
- package/dist/client/index.cjs +1393 -372
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +526 -10
- package/dist/client/index.d.ts +526 -10
- package/dist/client/index.js +1464 -88
- package/dist/client/index.js.map +1 -1
- package/dist/requirement-BEO42QOr.d.cts +387 -0
- package/dist/requirement-BEO42QOr.d.ts +387 -0
- package/dist/server/index.cjs +459 -36
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +56 -4
- package/dist/server/index.d.ts +56 -4
- package/dist/server/index.js +69 -37
- package/dist/server/index.js.map +1 -1
- package/dist/shared/index.cjs +375 -0
- package/dist/shared/index.cjs.map +1 -0
- package/dist/shared/index.d.cts +35 -0
- package/dist/shared/index.d.ts +35 -0
- package/dist/{client/core → shared}/index.js +38 -19
- package/dist/shared/index.js.map +1 -0
- package/package.json +7 -22
- package/dist/RequirementItem-BpkJQep8.d.ts +0 -37
- package/dist/RequirementItem-BvwsFu9e.d.cts +0 -37
- package/dist/chunk-GRVV7NLV.js.map +0 -1
- package/dist/chunk-IADBIDY6.js +0 -76
- package/dist/chunk-IADBIDY6.js.map +0 -1
- package/dist/chunk-IDCROXPS.js +0 -412
- package/dist/chunk-IDCROXPS.js.map +0 -1
- package/dist/chunk-P4DTIPEX.js +0 -623
- package/dist/chunk-P4DTIPEX.js.map +0 -1
- package/dist/chunk-V5M7SA3C.js +0 -161
- package/dist/chunk-V5M7SA3C.js.map +0 -1
- package/dist/chunk-YJQMJFA7.js +0 -16
- package/dist/chunk-YJQMJFA7.js.map +0 -1
- package/dist/client/components/index.cjs +0 -1107
- package/dist/client/components/index.cjs.map +0 -1
- package/dist/client/components/index.d.cts +0 -121
- package/dist/client/components/index.d.ts +0 -121
- package/dist/client/components/index.js +0 -586
- package/dist/client/components/index.js.map +0 -1
- package/dist/client/core/index.cjs +0 -961
- package/dist/client/core/index.cjs.map +0 -1
- package/dist/client/core/index.d.cts +0 -23
- package/dist/client/core/index.d.ts +0 -23
- package/dist/client/core/index.js.map +0 -1
- package/dist/client/hooks/index.cjs +0 -233
- package/dist/client/hooks/index.cjs.map +0 -1
- package/dist/client/hooks/index.d.cts +0 -33
- package/dist/client/hooks/index.d.ts +0 -33
- package/dist/client/hooks/index.js +0 -19
- package/dist/client/hooks/index.js.map +0 -1
- package/dist/coinlist-client-B_dJkbwB.d.ts +0 -283
- package/dist/coinlist-client-DBKa6j3f.d.cts +0 -283
- package/dist/newtype-yKTvFdg_.d.cts +0 -6
- package/dist/newtype-yKTvFdg_.d.ts +0 -6
- package/dist/oauth-session-DgItaMKN.d.cts +0 -56
- package/dist/oauth-session-DnKDI5ou.d.ts +0 -56
- package/dist/requirement-CxbdY8l4.d.cts +0 -202
- package/dist/requirement-fJsQ3f9_.d.ts +0 -202
- package/dist/useCoinListOffers-C5lBlzcC.d.ts +0 -27
- package/dist/useCoinListOffers-CguwXaCX.d.cts +0 -27
- package/dist/useCoinListRequirements-BECx1cIw.d.ts +0 -31
- package/dist/useCoinListRequirements-CX2gV9gJ.d.cts +0 -31
- package/dist/useCompleteCoinListOAuth-BRhAqD4_.d.cts +0 -55
- package/dist/useCompleteCoinListOAuth-DEZpHjd6.d.ts +0 -55
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { h as RequirementStatusInfo, i as RequirementStatusValue, j as RequirementType, R as Requirement } from './requirement-fJsQ3f9_.js';
|
|
3
|
-
|
|
4
|
-
type RequirementVariant = 'verification' | 'wallet';
|
|
5
|
-
declare const RequirementVariant: {
|
|
6
|
-
fromType(type: RequirementType): RequirementVariant;
|
|
7
|
-
};
|
|
8
|
-
type RequirementStatus = 'required' | 'pending' | 'completed' | 'rejected';
|
|
9
|
-
declare const RequirementStatus: {
|
|
10
|
-
fromStatusValue(status: RequirementStatusValue): RequirementStatus;
|
|
11
|
-
};
|
|
12
|
-
type ChecklistStatus = 'inProgress' | 'eligible' | 'ineligible';
|
|
13
|
-
declare const ChecklistStatus: {
|
|
14
|
-
derive(statuses: RequirementStatusInfo[]): ChecklistStatus;
|
|
15
|
-
};
|
|
16
|
-
type RequirementItemUi = {
|
|
17
|
-
variant: RequirementVariant;
|
|
18
|
-
status: RequirementStatus;
|
|
19
|
-
label: string;
|
|
20
|
-
description: string;
|
|
21
|
-
walletAddress?: string;
|
|
22
|
-
};
|
|
23
|
-
declare const RequirementItemUi: {
|
|
24
|
-
fromDomain(req: Requirement, statusInfo: RequirementStatusInfo | undefined, label: string, description: string, walletAddress?: string): RequirementItemUi;
|
|
25
|
-
};
|
|
26
|
-
interface RequirementItemProps {
|
|
27
|
-
ui: RequirementItemUi;
|
|
28
|
-
expanded?: boolean;
|
|
29
|
-
onToggle?: () => void;
|
|
30
|
-
walletAddress?: string;
|
|
31
|
-
className?: string;
|
|
32
|
-
onAction?: () => void;
|
|
33
|
-
onContactSupport?: () => void;
|
|
34
|
-
}
|
|
35
|
-
declare function RequirementItem({ ui, expanded, onToggle, className, onAction, onContactSupport, }: RequirementItemProps): react_jsx_runtime.JSX.Element;
|
|
36
|
-
|
|
37
|
-
export { ChecklistStatus as C, RequirementStatus as R, RequirementVariant as a, RequirementItem as b, type RequirementItemProps as c, RequirementItemUi as d };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { h as RequirementStatusInfo, i as RequirementStatusValue, j as RequirementType, R as Requirement } from './requirement-CxbdY8l4.cjs';
|
|
3
|
-
|
|
4
|
-
type RequirementVariant = 'verification' | 'wallet';
|
|
5
|
-
declare const RequirementVariant: {
|
|
6
|
-
fromType(type: RequirementType): RequirementVariant;
|
|
7
|
-
};
|
|
8
|
-
type RequirementStatus = 'required' | 'pending' | 'completed' | 'rejected';
|
|
9
|
-
declare const RequirementStatus: {
|
|
10
|
-
fromStatusValue(status: RequirementStatusValue): RequirementStatus;
|
|
11
|
-
};
|
|
12
|
-
type ChecklistStatus = 'inProgress' | 'eligible' | 'ineligible';
|
|
13
|
-
declare const ChecklistStatus: {
|
|
14
|
-
derive(statuses: RequirementStatusInfo[]): ChecklistStatus;
|
|
15
|
-
};
|
|
16
|
-
type RequirementItemUi = {
|
|
17
|
-
variant: RequirementVariant;
|
|
18
|
-
status: RequirementStatus;
|
|
19
|
-
label: string;
|
|
20
|
-
description: string;
|
|
21
|
-
walletAddress?: string;
|
|
22
|
-
};
|
|
23
|
-
declare const RequirementItemUi: {
|
|
24
|
-
fromDomain(req: Requirement, statusInfo: RequirementStatusInfo | undefined, label: string, description: string, walletAddress?: string): RequirementItemUi;
|
|
25
|
-
};
|
|
26
|
-
interface RequirementItemProps {
|
|
27
|
-
ui: RequirementItemUi;
|
|
28
|
-
expanded?: boolean;
|
|
29
|
-
onToggle?: () => void;
|
|
30
|
-
walletAddress?: string;
|
|
31
|
-
className?: string;
|
|
32
|
-
onAction?: () => void;
|
|
33
|
-
onContactSupport?: () => void;
|
|
34
|
-
}
|
|
35
|
-
declare function RequirementItem({ ui, expanded, onToggle, className, onAction, onContactSupport, }: RequirementItemProps): react_jsx_runtime.JSX.Element;
|
|
36
|
-
|
|
37
|
-
export { ChecklistStatus as C, RequirementStatus as R, RequirementVariant as a, RequirementItem as b, type RequirementItemProps as c, RequirementItemUi as d };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shared/types/oauth.ts","../src/shared/api/http-attributes.ts","../src/shared/api/http.ts","../src/shared/api/frontline.ts","../src/shared/api/http-client.ts","../src/shared/api/middleware/request-retry.ts"],"sourcesContent":["import type { Newtype } from '@/shared/types/newtype';\n\nexport type AuthorizationCode = Newtype<string, 'AuthorizationCode'>;\nexport const AuthorizationCode = (value: string): AuthorizationCode =>\n value as AuthorizationCode;\n\nexport type CodeVerifier = Newtype<string, 'CodeVerifier'>;\nexport const CodeVerifier = (value: string): CodeVerifier =>\n value as CodeVerifier;\n\nexport type CodeChallenge = Newtype<string, 'CodeChallenge'>;\nexport const CodeChallenge = (value: string): CodeChallenge =>\n value as CodeChallenge;\n\nexport type RedirectUri = Newtype<string, 'RedirectUri'>;\nexport const RedirectUri = (value: string): RedirectUri => value as RedirectUri;\n\nexport type ClientId = Newtype<string, 'ClientId'>;\nexport const ClientId = (value: string): ClientId => value as ClientId;\n\nexport type ClientSecret = Newtype<string, 'ClientSecret'>;\nexport const ClientSecret = (value: string): ClientSecret =>\n value as ClientSecret;\n","export type HttpRequestAttributes = {\n protected?: boolean;\n userAgent?: boolean;\n idempotencyKey?: boolean;\n /** Zero-based attempt index: 0 = first request, 1 = first retry, etc. */\n retryAttempt?: number;\n renewAttempted?: boolean;\n};\n\nexport type Attributes = Readonly<HttpRequestAttributes>;\n\nconst empty: Attributes = {};\n\nconst concat = (left: Attributes, right: Attributes): Attributes => ({\n ...left,\n ...right,\n});\n\nconst concatAll = (...items: Attributes[]): Attributes => {\n let result = empty;\n for (const item of items) {\n result = concat(result, item);\n }\n return result;\n};\n\nconst protectedRequest = (): Attributes => ({ protected: true });\nconst userAgent = (): Attributes => ({ userAgent: true });\nconst idempotencyKey = (): Attributes => ({\n idempotencyKey: true,\n});\n\n/** Returns attributes with the given retry attempt (zero-based). */\nconst retryAttempt = (attempt: number): Attributes => ({\n retryAttempt: attempt,\n});\nconst renewAttempted = (value: boolean): Attributes => ({\n renewAttempted: value,\n});\n\nconst isProtected = (attrs?: HttpRequestAttributes): boolean =>\n attrs?.protected === true;\nconst needUserAgent = (attrs?: HttpRequestAttributes): boolean =>\n attrs?.userAgent === true;\nconst isIdempotent = (attrs?: HttpRequestAttributes): boolean =>\n attrs?.idempotencyKey === true;\nconst getRetryAttempt = (attrs?: HttpRequestAttributes): number =>\n attrs?.retryAttempt ?? 0;\nconst wasRenewAttempted = (attrs?: HttpRequestAttributes): boolean =>\n attrs?.renewAttempted === true;\n\nexport const Attributes = {\n empty,\n concat,\n concatAll,\n protected: protectedRequest,\n isProtected,\n userAgent,\n needUserAgent,\n idempotencyKey,\n isIdempotent,\n retryAttempt,\n getRetryAttempt,\n renewAttempted,\n wasRenewAttempted,\n} as const;\n","import {\n Attributes,\n type HttpRequestAttributes,\n} from '@/shared/api/http-attributes';\n\nexport type HttpClientConfig = {\n baseUrl: string;\n xApiVersion: string;\n};\n\nexport type QueryParamValue = string | number | boolean | null | undefined;\nexport type QueryParamValues = QueryParamValue | QueryParamValue[];\n\nexport type HttpRequest<TBody = unknown> =\n | {\n method: 'GET';\n url: string;\n queryParams?: Record<string, QueryParamValues>;\n headers?: Record<string, string>;\n attributes?: HttpRequestAttributes;\n redirect?: RequestRedirect;\n }\n | {\n method: 'POST';\n url: string;\n queryParams?: Record<string, QueryParamValues>;\n headers?: Record<string, string>;\n body: TBody;\n attributes?: HttpRequestAttributes;\n redirect?: RequestRedirect;\n };\nexport type HttpResponse<TBody = unknown> = {\n status: number;\n headers?: Record<string, string>;\n body: TBody | null;\n};\n\nexport class HttpError<TBody = unknown> extends Error {\n readonly response: HttpResponse<TBody>;\n\n constructor(response: HttpResponse<TBody>) {\n super(`Request failed with ${response.status} status`);\n this.name = 'HttpError';\n this.response = response;\n }\n}\n\nexport async function makeRequest<TResponse = unknown>(\n request: HttpRequest\n): Promise<HttpResponse<TResponse>> {\n const headers: Record<string, string> = {\n Accept: 'application/json',\n ...(request.method === 'POST' && request.body !== undefined\n ? { 'Content-Type': 'application/json' }\n : {}),\n ...(request.headers ?? {}),\n };\n\n const init: RequestInit = {\n method: request.method,\n headers,\n ...(request.redirect !== undefined ? { redirect: request.redirect } : {}),\n };\n\n if (request.method === 'POST' && request.body !== undefined) {\n init.body = JSON.stringify(request.body);\n }\n\n const response = await fetch(\n buildUrlWithQueryParams(request.url, request.queryParams),\n init\n );\n const responseHeaders = headersToRecord(response.headers);\n\n if (response.status === 204 || response.status === 205) {\n return {\n status: response.status,\n body: null,\n headers: responseHeaders,\n };\n }\n\n if (response.status >= 300 && response.status < 400) {\n await response.text();\n return {\n status: response.status,\n body: null,\n headers: responseHeaders,\n };\n }\n\n const text = await response.text();\n const body = text ? (JSON.parse(text) as TResponse) : null;\n\n return {\n status: response.status,\n body,\n headers: responseHeaders,\n };\n}\n\nfunction buildUrlWithQueryParams(\n url: string,\n queryParams?: Record<string, QueryParamValues>\n): string {\n if (!queryParams) {\n return url;\n }\n\n const searchParams = new URLSearchParams();\n\n for (const [key, value] of Object.entries(queryParams)) {\n if (value === undefined || value === null) {\n continue;\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n if (item === undefined || item === null) {\n continue;\n }\n searchParams.append(key, String(item));\n }\n continue;\n }\n\n searchParams.append(key, String(value));\n }\n\n const queryString = searchParams.toString();\n if (!queryString) {\n return url;\n }\n\n return url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}`;\n}\n\nfunction headersToRecord(headers: Headers): Record<string, string> {\n const record: Record<string, string> = {};\n headers.forEach((value, key) => {\n record[key.toLowerCase()] = value;\n });\n return record;\n}\n\nfunction concatAttributes(\n request: HttpRequest,\n attrs: Attributes\n): HttpRequest {\n const nextAttributes = Attributes.concat(\n request.attributes ?? Attributes.empty,\n attrs\n );\n const nextRequest: typeof request = {\n ...request,\n attributes: nextAttributes,\n };\n return nextRequest;\n}\n\nexport const Request = {\n concatAttributes,\n};\n","export const PUBLIC_API_BASE_URL = 'https://api.coinlist.co';\nexport const HEADER_API_VERSION = 'X-API-Version';\nexport const HEADER_USER_AGENT = 'User-Agent';\nexport const HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';\nexport const API_VERSION = '2025-10-17';\n\nexport const COINLIST_OAUTH_PAGE_URL = 'https://coinlist.co/oauth/authorize';\n","import { HEADER_API_VERSION } from '@/shared/api/frontline';\nimport type {\n HttpClientConfig,\n HttpRequest,\n HttpResponse,\n} from '@/shared/api/http';\nimport { makeRequest } from '@/shared/api/http';\n\nexport type BeforeRequestMiddleware = (\n request: HttpRequest\n) => Promise<HttpRequest>;\n\nexport type AfterRequestMiddleware = (args: {\n request: HttpRequest;\n response: HttpResponse<unknown>;\n retry: (request?: HttpRequest) => Promise<HttpResponse<unknown>>;\n}) => Promise<HttpResponse<unknown>>;\n\nexport type HttpClientMiddleware = {\n beforeRequest?: BeforeRequestMiddleware[];\n afterRequest?: AfterRequestMiddleware[];\n};\n\nexport class HttpClient {\n constructor(\n readonly config: HttpClientConfig,\n readonly middleware: HttpClientMiddleware = {}\n ) {}\n\n async send<TResponse = unknown>(\n request: HttpRequest\n ): Promise<HttpResponse<TResponse>> {\n return this.runRequestWithAfterMiddleware<TResponse>(request);\n }\n\n /**\n * Runs beforeRequest, executeRequest, then the full afterRequest middleware\n * chain. Used by send() and by the retry() callback so that when a\n * middleware calls retry(), the retried response also goes through all\n * afterRequest middleware (e.g. session renewal, retry). Middleware\n * must use request.attributes.retryAttempt (or similar) to avoid infinite\n * recursion when they trigger retries.\n */\n private async runRequestWithAfterMiddleware<TResponse = unknown>(\n request: HttpRequest\n ): Promise<HttpResponse<TResponse>> {\n const preparedRequest = await this.runBeforeRequestMiddleware(\n this.withClientDefaults(request)\n );\n let response = await this.executeRequest<TResponse>(preparedRequest);\n\n for (const middleware of this.middleware.afterRequest ?? []) {\n response = (await middleware({\n request: preparedRequest,\n response,\n retry: (nextRequest = preparedRequest) =>\n this.runRequestWithAfterMiddleware(nextRequest) as Promise<\n HttpResponse<TResponse>\n >,\n })) as HttpResponse<TResponse>;\n }\n\n return response;\n }\n\n private withClientDefaults(request: HttpRequest): HttpRequest {\n const url = this.resolveUrl(request.url);\n const headers = {\n ...(request.headers ?? {}),\n [HEADER_API_VERSION]: this.config.xApiVersion,\n };\n\n return {\n ...request,\n url,\n headers,\n };\n }\n\n /**\n * Resolves a request URL against the client's baseUrl.\n *\n * @internal Public only for testing. Do not use in application code; use\n * {@link HttpClient.send} with a path and the client will resolve the URL.\n */\n resolveUrl(url: string): string {\n // If already absolute, use as-is.\n if (url.startsWith('http://') || url.startsWith('https://')) {\n return url;\n }\n // Otherwise append path to baseUrl so base path (e.g. /api) is preserved.\n const base = this.config.baseUrl.replace(/\\/$/, '');\n const path = url.startsWith('/') ? url : `/${url}`;\n return base + path;\n }\n\n private async runBeforeRequestMiddleware(\n initialRequest: HttpRequest\n ): Promise<HttpRequest> {\n let request = initialRequest;\n for (const middleware of this.middleware.beforeRequest ?? []) {\n request = await middleware(request);\n }\n\n return request;\n }\n\n private executeRequest<TResponse = unknown>(\n request: HttpRequest\n ): Promise<HttpResponse<TResponse>> {\n return makeRequest<TResponse>(request);\n }\n}\n","import { Request } from '@/shared/api/http';\nimport { Attributes } from '@/shared/api/http-attributes';\nimport type { AfterRequestMiddleware } from '@/shared/api/http-client';\n\nconst MAX_ATTEMPTS = 3;\nconst INITIAL_DELAY_MS = 300;\nconst MAX_DELAY_MS = 2000;\n\nconst RETRYABLE_4XX = new Set([408, 409, 429]);\n\nexport function isRetryableStatus(status: number): boolean {\n return (status >= 500 && status < 600) || RETRYABLE_4XX.has(status);\n}\n\nfunction getRetryDelayMs(attempt: number): number {\n return Math.min(INITIAL_DELAY_MS * 2 ** (attempt - 1), MAX_DELAY_MS);\n}\n\nexport type RequestRetryMiddlewareOptions = {\n /**\n * Optional delay function. Defaults to real setTimeout-based delay.\n * Use a no-op (e.g. () => Promise.resolve()) in tests to avoid slow tests.\n */\n delayFn?: (ms: number) => Promise<void>;\n};\n\n/**\n * Creates the request retry after-request middleware. Inject a no-op delayFn\n * in tests to avoid real delays (unit testing best practice).\n */\nexport function createRequestRetryMiddleware(\n options: RequestRetryMiddlewareOptions = {}\n): AfterRequestMiddleware {\n const delayFn = options.delayFn ?? defaultDelay;\n\n return async ({ request, response, retry }) => {\n if (!isRetryableStatus(response.status)) {\n return response;\n }\n\n const currentAttempt = Attributes.getRetryAttempt(request.attributes);\n if (currentAttempt >= MAX_ATTEMPTS - 1) {\n return response;\n }\n\n const nextAttempt = currentAttempt + 1;\n await delayFn(getRetryDelayMs(nextAttempt));\n\n const nextRequest = Request.concatAttributes(\n request,\n Attributes.retryAttempt(nextAttempt)\n );\n return retry(nextRequest);\n };\n}\n\nfunction defaultDelay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Retries the request up to 3 times with exponential backoff when the response\n * has a retryable status (5xx server errors). Uses request.attributes.retryAttempt\n * to decide delay and whether to retry, so the middleware does not loop when\n * retry() runs the full HTTP middleware chain again.\n */\nexport const requestRetryMiddleware: AfterRequestMiddleware =\n createRequestRetryMiddleware();\n"],"mappings":";AAGO,IAAM,oBAAoB,CAAC,UAChC;AAGK,IAAM,eAAe,CAAC,UAC3B;AAGK,IAAM,gBAAgB,CAAC,UAC5B;AAGK,IAAM,cAAc,CAAC,UAA+B;AAGpD,IAAM,WAAW,CAAC,UAA4B;AAG9C,IAAM,eAAe,CAAC,UAC3B;;;ACXF,IAAM,QAAoB,CAAC;AAE3B,IAAM,SAAS,CAAC,MAAkB,WAAmC;AAAA,EACnE,GAAG;AAAA,EACH,GAAG;AACL;AAEA,IAAM,YAAY,IAAI,UAAoC;AACxD,MAAI,SAAS;AACb,aAAW,QAAQ,OAAO;AACxB,aAAS,OAAO,QAAQ,IAAI;AAAA,EAC9B;AACA,SAAO;AACT;AAEA,IAAM,mBAAmB,OAAmB,EAAE,WAAW,KAAK;AAC9D,IAAM,YAAY,OAAmB,EAAE,WAAW,KAAK;AACvD,IAAM,iBAAiB,OAAmB;AAAA,EACxC,gBAAgB;AAClB;AAGA,IAAM,eAAe,CAAC,aAAiC;AAAA,EACrD,cAAc;AAChB;AACA,IAAM,iBAAiB,CAAC,WAAgC;AAAA,EACtD,gBA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F;AAEA,SAAS,aAAa,IAA2B;AAC/C,SAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AACzD;AAQO,IAAM,yBACX,6BAA6B;","names":[]}
|
package/dist/chunk-IADBIDY6.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useCoinList
|
|
3
|
-
} from "./chunk-V5M7SA3C.js";
|
|
4
|
-
import {
|
|
5
|
-
NotAuthenticatedError
|
|
6
|
-
} from "./chunk-P4DTIPEX.js";
|
|
7
|
-
|
|
8
|
-
// src/client/hooks/useCoinListOfferDetails.ts
|
|
9
|
-
import { useEffect, useState } from "react";
|
|
10
|
-
var LOADING_STATE = { type: "LOADING" };
|
|
11
|
-
function useCoinListOfferDetails(offerId) {
|
|
12
|
-
const { coinlist, isReady } = useCoinList();
|
|
13
|
-
const [offerDetailsState, setOfferDetailsState] = useState(LOADING_STATE);
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
let isCancelled = false;
|
|
16
|
-
if (!isReady) {
|
|
17
|
-
setOfferDetailsState(LOADING_STATE);
|
|
18
|
-
return () => {
|
|
19
|
-
isCancelled = true;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
setOfferDetailsState(LOADING_STATE);
|
|
23
|
-
coinlist.fetchOfferDetails(offerId).then((offerDetail) => {
|
|
24
|
-
if (!isCancelled) {
|
|
25
|
-
setOfferDetailsState({ type: "CONTENT", offerDetail });
|
|
26
|
-
}
|
|
27
|
-
}).catch((error) => {
|
|
28
|
-
if (!isCancelled) {
|
|
29
|
-
const reason = error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
|
|
30
|
-
setOfferDetailsState({ type: "ERROR", reason });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return () => {
|
|
34
|
-
isCancelled = true;
|
|
35
|
-
};
|
|
36
|
-
}, [coinlist, isReady, offerId]);
|
|
37
|
-
return { offerDetailsState };
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// src/client/hooks/useCoinListOffers.ts
|
|
41
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
42
|
-
var LOADING_STATE2 = { type: "LOADING" };
|
|
43
|
-
function useCoinListOffers() {
|
|
44
|
-
const { coinlist, isReady } = useCoinList();
|
|
45
|
-
const [offersState, setOffersState] = useState2(LOADING_STATE2);
|
|
46
|
-
useEffect2(() => {
|
|
47
|
-
let isCancelled = false;
|
|
48
|
-
if (!isReady) {
|
|
49
|
-
setOffersState(LOADING_STATE2);
|
|
50
|
-
return () => {
|
|
51
|
-
isCancelled = true;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
setOffersState(LOADING_STATE2);
|
|
55
|
-
coinlist.fetchAllOffers().then((offers) => {
|
|
56
|
-
if (!isCancelled) {
|
|
57
|
-
setOffersState({ type: "CONTENT", offers });
|
|
58
|
-
}
|
|
59
|
-
}).catch((error) => {
|
|
60
|
-
if (!isCancelled) {
|
|
61
|
-
const reason = error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
|
|
62
|
-
setOffersState({ type: "ERROR", reason });
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
return () => {
|
|
66
|
-
isCancelled = true;
|
|
67
|
-
};
|
|
68
|
-
}, [coinlist, isReady]);
|
|
69
|
-
return { offersState };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export {
|
|
73
|
-
useCoinListOfferDetails,
|
|
74
|
-
useCoinListOffers
|
|
75
|
-
};
|
|
76
|
-
//# sourceMappingURL=chunk-IADBIDY6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client/hooks/useCoinListOfferDetails.ts","../src/client/hooks/useCoinListOffers.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useCoinList } from '@/client/hooks/useCoinList';\nimport { NotAuthenticatedError } from '@/shared/types/errors';\nimport type { OfferId } from '@/shared/types/offer';\nimport type { OfferDetail } from '@/shared/types/offer-detail';\n\nexport type LoadOfferDetailsReason = 'not-authenticated' | 'generic-error';\n\nexport type LoadOfferDetailsState =\n | {\n type: 'LOADING';\n }\n | {\n type: 'ERROR';\n reason: LoadOfferDetailsReason;\n }\n | {\n type: 'CONTENT';\n offerDetail: OfferDetail;\n };\n\nexport interface UseCoinListOfferDetailsResult {\n offerDetailsState: LoadOfferDetailsState;\n}\n\nconst LOADING_STATE: LoadOfferDetailsState = { type: 'LOADING' };\n\n/**\n * Loads CoinList offer details for a given offer id and exposes a UI-friendly state.\n *\n * Returns `LOADING` while CoinList is initializing or while details are being fetched.\n * Returns `CONTENT` with the offer when `fetchOfferDetails()` succeeds.\n * Returns `ERROR` with:\n * - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}\n * - `generic-error` for any other failure\n */\nexport function useCoinListOfferDetails(\n offerId: OfferId\n): UseCoinListOfferDetailsResult {\n const { coinlist, isReady } = useCoinList();\n const [offerDetailsState, setOfferDetailsState] =\n useState<LoadOfferDetailsState>(LOADING_STATE);\n\n useEffect(() => {\n let isCancelled = false;\n\n if (!isReady) {\n setOfferDetailsState(LOADING_STATE);\n return () => {\n isCancelled = true;\n };\n }\n\n setOfferDetailsState(LOADING_STATE);\n coinlist\n .fetchOfferDetails(offerId)\n .then((offerDetail) => {\n if (!isCancelled) {\n setOfferDetailsState({ type: 'CONTENT', offerDetail });\n }\n })\n .catch((error: unknown) => {\n if (!isCancelled) {\n const reason: LoadOfferDetailsReason =\n error instanceof NotAuthenticatedError\n ? 'not-authenticated'\n : 'generic-error';\n setOfferDetailsState({ type: 'ERROR', reason });\n }\n });\n\n return () => {\n isCancelled = true;\n };\n }, [coinlist, isReady, offerId]);\n\n return { offerDetailsState };\n}\n","import { useEffect, useState } from 'react';\nimport { useCoinList } from '@/client/hooks/useCoinList';\nimport { NotAuthenticatedError } from '@/shared/types/errors';\nimport type { Offer } from '@/shared/types/offer';\n\nexport type LoadOffersReason = 'not-authenticated' | 'generic-error';\n\nexport type LoadOffersState =\n | {\n type: 'LOADING';\n }\n | {\n type: 'ERROR';\n reason: LoadOffersReason;\n }\n | {\n type: 'CONTENT';\n offers: Offer[];\n };\n\nexport interface UseCoinListOffersResult {\n offersState: LoadOffersState;\n}\n\nconst LOADING_STATE: LoadOffersState = { type: 'LOADING' };\n\n/**\n * Loads all CoinList offers for the current user and exposes a UI-friendly state.\n *\n * Returns `LOADING` while CoinList is initializing or while offers are being fetched.\n * Returns `CONTENT` with all offers when `fetchAllOffers()` succeeds.\n * Returns `ERROR` with:\n * - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}\n * - `generic-error` for any other failure\n */\nexport function useCoinListOffers(): UseCoinListOffersResult {\n const { coinlist, isReady } = useCoinList();\n const [offersState, setOffersState] =\n useState<LoadOffersState>(LOADING_STATE);\n\n useEffect(() => {\n let isCancelled = false;\n\n // Wait until CoinListProvider finishes auth initialization.\n if (!isReady) {\n setOffersState(LOADING_STATE);\n return () => {\n isCancelled = true;\n };\n }\n\n setOffersState(LOADING_STATE);\n coinlist\n .fetchAllOffers()\n .then((offers) => {\n if (!isCancelled) {\n setOffersState({ type: 'CONTENT', offers });\n }\n })\n .catch((error: unknown) => {\n if (!isCancelled) {\n const reason: LoadOffersReason =\n error instanceof NotAuthenticatedError\n ? 'not-authenticated'\n : 'generic-error';\n setOffersState({ type: 'ERROR', reason });\n }\n });\n\n return () => {\n isCancelled = true;\n };\n }, [coinlist, isReady]);\n\n return { offersState };\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,WAAW,gBAAgB;AAyBpC,IAAM,gBAAuC,EAAE,MAAM,UAAU;AAWxD,SAAS,wBACd,SAC+B;AAC/B,QAAM,EAAE,UAAU,QAAQ,IAAI,YAAY;AAC1C,QAAM,CAAC,mBAAmB,oBAAoB,IAC5C,SAAgC,aAAa;AAE/C,YAAU,MAAM;AACd,QAAI,cAAc;AAElB,QAAI,CAAC,SAAS;AACZ,2BAAqB,aAAa;AAClC,aAAO,MAAM;AACX,sBAAc;AAAA,MACh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E,YAAY;AACvB;","names":["useEffect","useState","LOADING_STATE","useState","useEffect"]}
|
package/dist/chunk-IDCROXPS.js
DELETED
|
@@ -1,412 +0,0 @@
|
|
|
1
|
-
// src/client/components/requirements/RequirementItem.tsx
|
|
2
|
-
import { ChevronRight } from "lucide-react";
|
|
3
|
-
|
|
4
|
-
// src/client/components/design-system/AlertBanner.tsx
|
|
5
|
-
import { CircleCheck, Info } from "lucide-react";
|
|
6
|
-
|
|
7
|
-
// src/client/components/design-system/tokens/typography.ts
|
|
8
|
-
var typeClasses = {
|
|
9
|
-
hero: "text-[64px] leading-[110%] font-semibold",
|
|
10
|
-
display: "text-[48px] leading-[110%] font-semibold",
|
|
11
|
-
h1: "text-[36px] leading-[120%] font-semibold",
|
|
12
|
-
h2: "text-[28px] leading-[125%] font-semibold",
|
|
13
|
-
h3: "text-[22px] leading-[130%] font-semibold",
|
|
14
|
-
h4: "text-[18px] leading-[135%] font-medium",
|
|
15
|
-
body: "text-[16px] leading-[150%] font-normal",
|
|
16
|
-
subhead: "text-[14px] leading-[150%] font-normal",
|
|
17
|
-
caption: "text-[12px] leading-[140%] font-normal",
|
|
18
|
-
label: "text-[14px] leading-[140%] font-medium",
|
|
19
|
-
data: "text-[14px] leading-[140%] font-normal"
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// src/client/components/design-system/utils.ts
|
|
23
|
-
import { clsx } from "clsx";
|
|
24
|
-
function cn(...inputs) {
|
|
25
|
-
return clsx(inputs);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// src/client/components/design-system/AlertBanner.tsx
|
|
29
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
|
-
var variantConfig = {
|
|
31
|
-
info: {
|
|
32
|
-
container: "bg-surface border-border",
|
|
33
|
-
text: "text-text-secondary",
|
|
34
|
-
Icon: Info
|
|
35
|
-
},
|
|
36
|
-
success: {
|
|
37
|
-
container: "bg-success-subtle border-success-border",
|
|
38
|
-
text: "text-success",
|
|
39
|
-
Icon: CircleCheck
|
|
40
|
-
},
|
|
41
|
-
warning: {
|
|
42
|
-
container: "bg-warning-subtle border-warning-border",
|
|
43
|
-
text: "text-warning",
|
|
44
|
-
Icon: Info
|
|
45
|
-
},
|
|
46
|
-
error: {
|
|
47
|
-
container: "bg-error-subtle border-error-border",
|
|
48
|
-
text: "text-error",
|
|
49
|
-
Icon: Info
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
function AlertBanner({
|
|
53
|
-
variant,
|
|
54
|
-
content,
|
|
55
|
-
icon = false,
|
|
56
|
-
className
|
|
57
|
-
}) {
|
|
58
|
-
const { container, text, Icon } = variantConfig[variant];
|
|
59
|
-
return /* @__PURE__ */ jsxs(
|
|
60
|
-
"div",
|
|
61
|
-
{
|
|
62
|
-
className: cn(
|
|
63
|
-
"flex items-center rounded-btn border p-3",
|
|
64
|
-
icon && "gap-2",
|
|
65
|
-
container,
|
|
66
|
-
className
|
|
67
|
-
),
|
|
68
|
-
children: [
|
|
69
|
-
icon && /* @__PURE__ */ jsx(Icon, { className: cn("h-4 w-4 shrink-0", text), "aria-hidden": "true" }),
|
|
70
|
-
/* @__PURE__ */ jsx("p", { className: cn(typeClasses.subhead, text), children: content })
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// src/client/components/design-system/ClButton.tsx
|
|
77
|
-
import { cva } from "class-variance-authority";
|
|
78
|
-
import { forwardRef } from "react";
|
|
79
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
80
|
-
var buttonVariants = cva(
|
|
81
|
-
"inline-flex items-center justify-center gap-3 whitespace-nowrap transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-40 cursor-pointer",
|
|
82
|
-
{
|
|
83
|
-
variants: {
|
|
84
|
-
variant: {
|
|
85
|
-
// Primary — tokens auto-switch: dark bg (#171717) → light bg (#f4f4f5) in dark mode
|
|
86
|
-
primary: "bg-brand-primary text-text-inverse font-semibold hover:bg-brand-primary-hover active:bg-brand-primary-active focus-visible:ring-gray-500",
|
|
87
|
-
// Secondary — bg-section, border-border, text-text-primary all auto-switch
|
|
88
|
-
// hover maps to border token value; active has no token so uses dark: override
|
|
89
|
-
secondary: "bg-section border border-border text-text-primary font-medium hover:bg-border active:bg-[#d9d9d9] dark:active:bg-divider focus-visible:ring-gray-400",
|
|
90
|
-
// Destructive — error tokens auto-switch to translucent dark equivalents
|
|
91
|
-
// hover/active have no tokens so use dark: overrides
|
|
92
|
-
destructive: "bg-error-subtle border border-error-border text-error font-semibold hover:bg-[#fcdcd8] active:bg-[#f9c9c4] dark:hover:bg-[rgba(248,113,113,0.20)] dark:active:bg-[rgba(248,113,113,0.30)] focus-visible:ring-red-400",
|
|
93
|
-
// Ghost — transparent base; hover/active use section/border tokens (auto-switch)
|
|
94
|
-
ghost: "bg-transparent text-text-primary font-medium hover:bg-section active:bg-border focus-visible:ring-gray-400",
|
|
95
|
-
// Link — text-text-primary auto-switches light/dark
|
|
96
|
-
link: "h-auto p-0 text-text-primary font-medium underline-offset-4 hover:underline focus-visible:ring-gray-500",
|
|
97
|
-
// Destructive link — text-error auto-switches (#b42318 → #f87171 in dark)
|
|
98
|
-
destructiveLink: "h-auto p-0 text-error font-medium hover:text-[#8b1a13] active:text-[#6d1510] dark:hover:text-[#fca5a5] dark:active:text-[#f87171] focus-visible:ring-red-500"
|
|
99
|
-
},
|
|
100
|
-
size: {
|
|
101
|
-
sm: "h-9 px-4 text-sm tracking-[0.28px]",
|
|
102
|
-
default: "h-11 px-5 text-sm tracking-[0.28px]",
|
|
103
|
-
lg: "h-14 px-6 text-base",
|
|
104
|
-
icon: "h-12 w-12"
|
|
105
|
-
},
|
|
106
|
-
radius: {
|
|
107
|
-
pill: "rounded-full",
|
|
108
|
-
// compound variants below handle size-specific radii
|
|
109
|
-
rounded: ""
|
|
110
|
-
},
|
|
111
|
-
fullWidth: {
|
|
112
|
-
true: "w-full",
|
|
113
|
-
false: ""
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
compoundVariants: [
|
|
117
|
-
{ size: "sm", radius: "rounded", className: "rounded-lg" },
|
|
118
|
-
{ size: "default", radius: "rounded", className: "rounded-2xl" },
|
|
119
|
-
{ size: "lg", radius: "rounded", className: "rounded-2xl" },
|
|
120
|
-
{ size: "icon", radius: "rounded", className: "rounded-md" }
|
|
121
|
-
],
|
|
122
|
-
defaultVariants: {
|
|
123
|
-
variant: "primary",
|
|
124
|
-
size: "default",
|
|
125
|
-
radius: "pill",
|
|
126
|
-
fullWidth: false
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
var ClButton = forwardRef(
|
|
131
|
-
({
|
|
132
|
-
className,
|
|
133
|
-
variant,
|
|
134
|
-
size,
|
|
135
|
-
radius,
|
|
136
|
-
fullWidth,
|
|
137
|
-
children,
|
|
138
|
-
isLoading = false,
|
|
139
|
-
loadingText,
|
|
140
|
-
startIcon,
|
|
141
|
-
endIcon,
|
|
142
|
-
disabled,
|
|
143
|
-
...props
|
|
144
|
-
}, ref) => {
|
|
145
|
-
const isDisabled = disabled || isLoading;
|
|
146
|
-
return /* @__PURE__ */ jsxs2(
|
|
147
|
-
"button",
|
|
148
|
-
{
|
|
149
|
-
className: cn(
|
|
150
|
-
buttonVariants({ variant, size, radius, fullWidth }),
|
|
151
|
-
className
|
|
152
|
-
),
|
|
153
|
-
ref,
|
|
154
|
-
disabled: isDisabled,
|
|
155
|
-
...props,
|
|
156
|
-
children: [
|
|
157
|
-
isLoading && /* @__PURE__ */ jsx2(
|
|
158
|
-
"span",
|
|
159
|
-
{
|
|
160
|
-
className: "h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent opacity-60",
|
|
161
|
-
"aria-hidden": "true"
|
|
162
|
-
}
|
|
163
|
-
),
|
|
164
|
-
startIcon && !isLoading && /* @__PURE__ */ jsx2("span", { className: "shrink-0", children: startIcon }),
|
|
165
|
-
/* @__PURE__ */ jsx2("span", { className: cn(isLoading && "opacity-60"), children: isLoading && loadingText ? loadingText : children }),
|
|
166
|
-
endIcon && !isLoading && /* @__PURE__ */ jsx2("span", { className: "shrink-0", children: endIcon })
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
ClButton.displayName = "ClButton";
|
|
173
|
-
|
|
174
|
-
// src/client/components/design-system/StepStatusIcon.tsx
|
|
175
|
-
import { CircleCheck as CircleCheck2, CircleX, Info as Info2 } from "lucide-react";
|
|
176
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
177
|
-
var statusConfig = {
|
|
178
|
-
required: {
|
|
179
|
-
Icon: Info2,
|
|
180
|
-
colorClass: "text-warning",
|
|
181
|
-
fillClass: "[&_circle]:fill-warning-subtle"
|
|
182
|
-
},
|
|
183
|
-
pending: {
|
|
184
|
-
Icon: Info2,
|
|
185
|
-
colorClass: "text-warning",
|
|
186
|
-
fillClass: "[&_circle]:fill-warning-subtle"
|
|
187
|
-
},
|
|
188
|
-
completed: {
|
|
189
|
-
Icon: CircleCheck2,
|
|
190
|
-
colorClass: "text-success",
|
|
191
|
-
fillClass: "[&_circle]:fill-success-subtle"
|
|
192
|
-
},
|
|
193
|
-
rejected: {
|
|
194
|
-
Icon: CircleX,
|
|
195
|
-
colorClass: "text-error",
|
|
196
|
-
fillClass: "[&_circle]:fill-error-subtle"
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
function StepStatusIcon({ status, className }) {
|
|
200
|
-
const { Icon, colorClass, fillClass } = statusConfig[status];
|
|
201
|
-
return /* @__PURE__ */ jsx3(
|
|
202
|
-
Icon,
|
|
203
|
-
{
|
|
204
|
-
className: cn("h-6 w-6 shrink-0", colorClass, fillClass, className),
|
|
205
|
-
"aria-hidden": "true"
|
|
206
|
-
}
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// src/client/components/requirements/RequirementItem.tsx
|
|
211
|
-
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
212
|
-
var RequirementVariant = {
|
|
213
|
-
fromType(type) {
|
|
214
|
-
switch (type) {
|
|
215
|
-
case "external_wallet":
|
|
216
|
-
case "whitelisted_wallet":
|
|
217
|
-
return "wallet";
|
|
218
|
-
default:
|
|
219
|
-
return "verification";
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
var RequirementStatus = {
|
|
224
|
-
fromStatusValue(status) {
|
|
225
|
-
switch (status) {
|
|
226
|
-
case "not_started":
|
|
227
|
-
case "action_needed":
|
|
228
|
-
return "required";
|
|
229
|
-
case "in_progress":
|
|
230
|
-
return "pending";
|
|
231
|
-
case "completed":
|
|
232
|
-
return "completed";
|
|
233
|
-
case "rejected":
|
|
234
|
-
return "rejected";
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
var ChecklistStatus = {
|
|
239
|
-
derive(statuses) {
|
|
240
|
-
if (statuses.some((s) => s.status === "rejected")) return "ineligible";
|
|
241
|
-
if (statuses.every((s) => s.status === "completed")) return "eligible";
|
|
242
|
-
return "inProgress";
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
var RequirementItemUi = {
|
|
246
|
-
fromDomain(req, statusInfo, label, description, walletAddress) {
|
|
247
|
-
return {
|
|
248
|
-
variant: RequirementVariant.fromType(req.type),
|
|
249
|
-
status: statusInfo ? RequirementStatus.fromStatusValue(statusInfo.status) : "required",
|
|
250
|
-
label,
|
|
251
|
-
description,
|
|
252
|
-
walletAddress
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
function VerificationActionZone({
|
|
257
|
-
status,
|
|
258
|
-
onAction,
|
|
259
|
-
onContactSupport
|
|
260
|
-
}) {
|
|
261
|
-
switch (status) {
|
|
262
|
-
case "required":
|
|
263
|
-
return /* @__PURE__ */ jsx4(ClButton, { size: "sm", onClick: onAction, children: "Continue" });
|
|
264
|
-
case "pending":
|
|
265
|
-
return /* @__PURE__ */ jsx4(
|
|
266
|
-
AlertBanner,
|
|
267
|
-
{
|
|
268
|
-
variant: "warning",
|
|
269
|
-
content: "Under review. We'll notify you when complete."
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
case "completed":
|
|
273
|
-
return /* @__PURE__ */ jsx4(AlertBanner, { variant: "success", content: "Identity verified." });
|
|
274
|
-
case "rejected":
|
|
275
|
-
return /* @__PURE__ */ jsx4(
|
|
276
|
-
AlertBanner,
|
|
277
|
-
{
|
|
278
|
-
variant: "error",
|
|
279
|
-
content: /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
280
|
-
"Verification rejected.",
|
|
281
|
-
" ",
|
|
282
|
-
/* @__PURE__ */ jsx4(
|
|
283
|
-
"button",
|
|
284
|
-
{
|
|
285
|
-
type: "button",
|
|
286
|
-
onClick: onContactSupport,
|
|
287
|
-
className: "underline",
|
|
288
|
-
children: "Contact support"
|
|
289
|
-
}
|
|
290
|
-
),
|
|
291
|
-
"."
|
|
292
|
-
] })
|
|
293
|
-
}
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
function WalletActionZone({
|
|
298
|
-
status,
|
|
299
|
-
walletAddress,
|
|
300
|
-
onAction
|
|
301
|
-
}) {
|
|
302
|
-
if (status === "completed") {
|
|
303
|
-
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
304
|
-
/* @__PURE__ */ jsx4(ClButton, { size: "sm", variant: "secondary", onClick: onAction, children: "Change wallet" }),
|
|
305
|
-
/* @__PURE__ */ jsx4(
|
|
306
|
-
AlertBanner,
|
|
307
|
-
{
|
|
308
|
-
variant: "success",
|
|
309
|
-
content: walletAddress ?? "Connected: 0xBa4b...9f2c"
|
|
310
|
-
}
|
|
311
|
-
)
|
|
312
|
-
] });
|
|
313
|
-
}
|
|
314
|
-
if (status === "rejected") {
|
|
315
|
-
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
316
|
-
/* @__PURE__ */ jsx4(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" }),
|
|
317
|
-
/* @__PURE__ */ jsx4(
|
|
318
|
-
AlertBanner,
|
|
319
|
-
{
|
|
320
|
-
variant: "error",
|
|
321
|
-
content: "This wallet is not eligible for this sale."
|
|
322
|
-
}
|
|
323
|
-
)
|
|
324
|
-
] });
|
|
325
|
-
}
|
|
326
|
-
return /* @__PURE__ */ jsx4(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" });
|
|
327
|
-
}
|
|
328
|
-
function RequirementItem({
|
|
329
|
-
ui,
|
|
330
|
-
expanded = false,
|
|
331
|
-
onToggle,
|
|
332
|
-
className,
|
|
333
|
-
onAction,
|
|
334
|
-
onContactSupport
|
|
335
|
-
}) {
|
|
336
|
-
return /* @__PURE__ */ jsxs3("div", { className: cn("flex w-full flex-col", className), children: [
|
|
337
|
-
/* @__PURE__ */ jsxs3(
|
|
338
|
-
"button",
|
|
339
|
-
{
|
|
340
|
-
type: "button",
|
|
341
|
-
onClick: onToggle,
|
|
342
|
-
"aria-expanded": expanded,
|
|
343
|
-
className: "flex h-14 w-full cursor-pointer items-center justify-between rounded-2xl px-2 transition-colors hover:bg-surface",
|
|
344
|
-
children: [
|
|
345
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
|
|
346
|
-
/* @__PURE__ */ jsx4(StepStatusIcon, { status: ui.status }),
|
|
347
|
-
/* @__PURE__ */ jsx4(
|
|
348
|
-
"span",
|
|
349
|
-
{
|
|
350
|
-
className: cn(
|
|
351
|
-
typeClasses.body,
|
|
352
|
-
"whitespace-nowrap font-medium text-text-primary"
|
|
353
|
-
),
|
|
354
|
-
children: ui.label
|
|
355
|
-
}
|
|
356
|
-
)
|
|
357
|
-
] }),
|
|
358
|
-
/* @__PURE__ */ jsx4(
|
|
359
|
-
ChevronRight,
|
|
360
|
-
{
|
|
361
|
-
className: cn(
|
|
362
|
-
"h-6 w-6 shrink-0 text-text-secondary transition-transform duration-300",
|
|
363
|
-
expanded && "rotate-90"
|
|
364
|
-
),
|
|
365
|
-
"aria-hidden": "true"
|
|
366
|
-
}
|
|
367
|
-
)
|
|
368
|
-
]
|
|
369
|
-
}
|
|
370
|
-
),
|
|
371
|
-
/* @__PURE__ */ jsx4(
|
|
372
|
-
"div",
|
|
373
|
-
{
|
|
374
|
-
className: cn(
|
|
375
|
-
"grid transition-[grid-template-rows] duration-300 ease-in-out",
|
|
376
|
-
expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
377
|
-
),
|
|
378
|
-
children: /* @__PURE__ */ jsx4("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-4 px-2 pb-4", children: [
|
|
379
|
-
/* @__PURE__ */ jsx4("p", { className: cn(typeClasses.subhead, "text-text-secondary"), children: ui.description }),
|
|
380
|
-
ui.variant === "verification" ? /* @__PURE__ */ jsx4(
|
|
381
|
-
VerificationActionZone,
|
|
382
|
-
{
|
|
383
|
-
status: ui.status,
|
|
384
|
-
onAction,
|
|
385
|
-
onContactSupport
|
|
386
|
-
}
|
|
387
|
-
) : /* @__PURE__ */ jsx4(
|
|
388
|
-
WalletActionZone,
|
|
389
|
-
{
|
|
390
|
-
status: ui.status,
|
|
391
|
-
walletAddress: ui.walletAddress,
|
|
392
|
-
onAction
|
|
393
|
-
}
|
|
394
|
-
)
|
|
395
|
-
] }) })
|
|
396
|
-
}
|
|
397
|
-
)
|
|
398
|
-
] });
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
export {
|
|
402
|
-
typeClasses,
|
|
403
|
-
cn,
|
|
404
|
-
AlertBanner,
|
|
405
|
-
ClButton,
|
|
406
|
-
RequirementVariant,
|
|
407
|
-
RequirementStatus,
|
|
408
|
-
ChecklistStatus,
|
|
409
|
-
RequirementItemUi,
|
|
410
|
-
RequirementItem
|
|
411
|
-
};
|
|
412
|
-
//# sourceMappingURL=chunk-IDCROXPS.js.map
|