@coinlist-co/react 0.12.1-rc.a230abc → 0.12.1-rc.c2b6ba5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/{chunk-GFLU5OMP.js → chunk-6CQHDASY.js} +643 -643
  2. package/dist/chunk-6CQHDASY.js.map +1 -0
  3. package/dist/{chunk-HLL7IBIS.js → chunk-F6WGUKZC.js} +9 -9
  4. package/dist/chunk-F6WGUKZC.js.map +1 -0
  5. package/dist/{chunk-RPE7XIBV.js → chunk-ZFBEI3BW.js} +126 -126
  6. package/dist/chunk-ZFBEI3BW.js.map +1 -0
  7. package/dist/client/index.cjs +2032 -2030
  8. package/dist/client/index.cjs.map +1 -1
  9. package/dist/client/index.d.cts +149 -149
  10. package/dist/client/index.d.ts +149 -149
  11. package/dist/client/index.js +481 -481
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/{collections-CAfs2Eww.d.cts → collections-DOm9VKVm.d.cts} +1 -1
  14. package/dist/{collections-DZZFrizd.d.ts → collections-aCv-Wr2a.d.ts} +1 -1
  15. package/dist/{config-D19ktBr0.d.cts → config-DIaFzrMW.d.cts} +13 -13
  16. package/dist/{config-D19ktBr0.d.ts → config-DIaFzrMW.d.ts} +13 -13
  17. package/dist/server/index.cjs +232 -232
  18. package/dist/server/index.cjs.map +1 -1
  19. package/dist/server/index.d.cts +4 -4
  20. package/dist/server/index.d.ts +4 -4
  21. package/dist/server/index.js +3 -3
  22. package/dist/server/index.js.map +1 -1
  23. package/dist/{shared → universal}/index.cjs +850 -848
  24. package/dist/universal/index.cjs.map +1 -0
  25. package/dist/{shared → universal}/index.d.cts +557 -557
  26. package/dist/{shared → universal}/index.d.ts +557 -557
  27. package/dist/{shared → universal}/index.js +2 -2
  28. package/package.json +6 -5
  29. package/dist/chunk-GFLU5OMP.js.map +0 -1
  30. package/dist/chunk-HLL7IBIS.js.map +0 -1
  31. package/dist/chunk-RPE7XIBV.js.map +0 -1
  32. package/dist/shared/index.cjs.map +0 -1
  33. /package/dist/{shared → universal}/index.js.map +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  PINO_LEVEL,
5
5
  SDK_LOGGER_NAME,
6
6
  loggerOverPino
7
- } from "../chunk-HLL7IBIS.js";
7
+ } from "../chunk-F6WGUKZC.js";
8
8
  import {
9
9
  AuthorizationCode,
10
10
  CodeVerifier,
@@ -38,7 +38,7 @@ import {
38
38
  isStopped,
39
39
  superstateSwapContractAddress,
40
40
  swapSpender
41
- } from "../chunk-RPE7XIBV.js";
41
+ } from "../chunk-ZFBEI3BW.js";
42
42
  import {
43
43
  API_VERSION,
44
44
  AssetDecimals,
@@ -85,7 +85,7 @@ import {
85
85
  shortenAddress,
86
86
  txExplorerUrl,
87
87
  usdAmount
88
- } from "../chunk-GFLU5OMP.js";
88
+ } from "../chunk-6CQHDASY.js";
89
89
 
90
90
  // src/client/CoinListProvider.tsx
91
91
  import {
@@ -233,7 +233,7 @@ var ClientAuthNamespaceImpl = class {
233
233
  }
234
234
  };
235
235
 
236
- // src/client/core/blockchain/wallet-error.ts
236
+ // src/client/core/shared/blockchain/wallet-error.ts
237
237
  import {
238
238
  BaseError,
239
239
  ContractFunctionRevertedError,
@@ -268,7 +268,7 @@ function revertReason(error) {
268
268
  return error.reason ?? error.data?.errorName ?? error.signature ?? null;
269
269
  }
270
270
 
271
- // src/client/core/blockchain/erc20/approval.ts
271
+ // src/client/core/shared/blockchain/erc20/approval.ts
272
272
  async function ensureErc20Allowance({
273
273
  erc20,
274
274
  chain,
@@ -445,7 +445,7 @@ async function executeTokenSale(params) {
445
445
  return { type: "success", participation, approvalTxHash };
446
446
  }
447
447
 
448
- // src/client/core/observability/flow-logging.ts
448
+ // src/client/core/shared/observability/flow-logging.ts
449
449
  async function withFlowLogging(log, flow, fields, onProgress, run) {
450
450
  const flowLog = log.child({ flow });
451
451
  flowLog.info(() => ({ msg: "flow started", fields }));
@@ -895,7 +895,7 @@ var ClientSuperstateSwapNamespaceImpl = class extends SuperstateSwapNamespaceImp
895
895
  }
896
896
  };
897
897
 
898
- // src/client/core/utils/open-in-new-tab.ts
898
+ // src/client/core/shared/utils/open-in-new-tab.ts
899
899
  function openInNewTab(url) {
900
900
  window.open(url, "_blank", "noopener,noreferrer");
901
901
  }
@@ -9723,7 +9723,7 @@ function OffersGridContainer({
9723
9723
  return /* @__PURE__ */ jsx55(OffersGridView, { state, onEvent, ...viewProps });
9724
9724
  }
9725
9725
 
9726
- // src/client/components/requirements/checklist/ConnectedWalletList.tsx
9726
+ // src/client/components/requirements/ConnectedWalletList.tsx
9727
9727
  import { useState as useState25 } from "react";
9728
9728
  import { jsx as jsx56, jsxs as jsxs40 } from "react/jsx-runtime";
9729
9729
  function ConnectedWalletRow({
@@ -9839,12 +9839,228 @@ function ConnectedWalletListBody({
9839
9839
  );
9840
9840
  }
9841
9841
 
9842
- // src/client/components/requirements/checklist/RequirementItem.tsx
9842
+ // src/client/components/requirements/identity-verification/IdentityVerificationView.tsx
9843
+ import SumsubWebSdk from "@sumsub/websdk-react";
9844
+ import { jsx as jsx57, jsxs as jsxs41 } from "react/jsx-runtime";
9845
+ function IdentityVerificationView(props) {
9846
+ return /* @__PURE__ */ jsx57(CoinListStyleScope, { children: /* @__PURE__ */ jsx57(IdentityVerificationViewBody, { ...props }) });
9847
+ }
9848
+ function IdentityVerificationViewBody({
9849
+ state,
9850
+ onEvent,
9851
+ className
9852
+ }) {
9853
+ switch (state.type) {
9854
+ case "loading":
9855
+ return /* @__PURE__ */ jsx57(
9856
+ "output",
9857
+ {
9858
+ "aria-live": "polite",
9859
+ className: cn(
9860
+ "clcosdk:flex clcosdk:min-h-40 clcosdk:items-center clcosdk:justify-center",
9861
+ className
9862
+ ),
9863
+ children: /* @__PURE__ */ jsx57("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Loading identity verification..." })
9864
+ }
9865
+ );
9866
+ case "error":
9867
+ return /* @__PURE__ */ jsxs41(
9868
+ "div",
9869
+ {
9870
+ className: cn(
9871
+ "clcosdk:flex clcosdk:flex-col clcosdk:gap-4",
9872
+ className
9873
+ ),
9874
+ children: [
9875
+ /* @__PURE__ */ jsx57(AlertBanner, { variant: "error", icon: true, content: state.message }),
9876
+ state.retryable && /* @__PURE__ */ jsx57(ClButton, { size: "sm", onClick: () => onEvent({ type: "ON_RETRY" }), children: "Try again" })
9877
+ ]
9878
+ }
9879
+ );
9880
+ case "ready":
9881
+ return /* @__PURE__ */ jsx57("div", { className: cn("clcosdk:w-full", className), children: /* @__PURE__ */ jsx57(
9882
+ SumsubWebSdk,
9883
+ {
9884
+ accessToken: state.accessToken,
9885
+ expirationHandler: state.refreshToken,
9886
+ config: state.locale === void 0 ? {} : { lang: state.locale },
9887
+ options: { addViewportTag: false, adaptIframeHeight: true },
9888
+ onMessage: (type, payload) => {
9889
+ onSumsubMessage(type, payload, onEvent);
9890
+ },
9891
+ onError: (error) => {
9892
+ onEvent({ type: "ON_ERROR", error: toError(error) });
9893
+ }
9894
+ }
9895
+ ) });
9896
+ default: {
9897
+ const exhaustive = state;
9898
+ return exhaustive;
9899
+ }
9900
+ }
9901
+ }
9902
+ function onSumsubMessage(type, payload, onEvent) {
9903
+ switch (type) {
9904
+ case "idCheck.onApplicantSubmitted":
9905
+ onEvent({ type: "ON_SUBMITTED" });
9906
+ return;
9907
+ case "idCheck.onError": {
9908
+ const message = payload?.message ?? "Verification error";
9909
+ onEvent({ type: "ON_ERROR", error: new Error(message) });
9910
+ return;
9911
+ }
9912
+ default:
9913
+ return;
9914
+ }
9915
+ }
9916
+ function toError(error) {
9917
+ return error instanceof Error ? error : new Error("Verification error");
9918
+ }
9919
+
9920
+ // src/client/hooks/requirements/identity-verification/useIdentityVerificationViewModel.ts
9921
+ import { useCallback as useCallback8, useEffect as useEffect22, useMemo as useMemo5, useRef as useRef15 } from "react";
9922
+
9923
+ // src/client/hooks/requirements/data/useKycToken.ts
9924
+ import { useCallback as useCallback7, useEffect as useEffect21, useRef as useRef14, useState as useState26 } from "react";
9925
+ var IDLE_STATE = { type: "IDLE" };
9926
+ var LOADING_STATE4 = { type: "LOADING" };
9927
+ function useKycToken(levelName, reset) {
9928
+ const { coinlist } = useCoinList();
9929
+ const log = useLogger("useKycToken");
9930
+ const [kycTokenState, setKycTokenState] = useState26(IDLE_STATE);
9931
+ const resetPendingRef = useRef14(reset === true);
9932
+ const tokenIssuedRef = useRef14(false);
9933
+ useEffect21(() => {
9934
+ if (!tokenIssuedRef.current) {
9935
+ resetPendingRef.current = reset === true;
9936
+ }
9937
+ }, [reset]);
9938
+ const fetchToken = useCallback7(async () => {
9939
+ setKycTokenState(LOADING_STATE4);
9940
+ try {
9941
+ const kycToken = await coinlist.requirements.createKycToken({
9942
+ levelName,
9943
+ reset: resetPendingRef.current
9944
+ });
9945
+ resetPendingRef.current = false;
9946
+ tokenIssuedRef.current = true;
9947
+ log.debug(() => ({
9948
+ msg: "settled",
9949
+ fields: { state: "CONTENT" }
9950
+ }));
9951
+ setKycTokenState({ type: "CONTENT", token: kycToken.token });
9952
+ return kycToken.token;
9953
+ } catch (error) {
9954
+ const reason = error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
9955
+ log.failure(
9956
+ () => ({ msg: "settled", fields: { state: "ERROR", reason } }),
9957
+ error
9958
+ );
9959
+ setKycTokenState({ type: "ERROR", reason });
9960
+ throw error;
9961
+ }
9962
+ }, [coinlist, levelName, log]);
9963
+ return { kycTokenState, fetchToken };
9964
+ }
9965
+
9966
+ // src/client/hooks/requirements/identity-verification/useIdentityVerificationViewModel.ts
9967
+ var NOT_AUTHENTICATED_MESSAGE2 = "Sign in to verify your identity.";
9968
+ var GENERIC_ERROR_MESSAGE2 = "Unable to start identity verification right now. Please try again.";
9969
+ function useIdentityVerificationViewModel(options = {}) {
9970
+ const { levelName, reset, locale, onSubmitted, onError } = options;
9971
+ const { kycTokenState, fetchToken } = useKycToken(levelName, reset);
9972
+ const fetchedRef = useRef15(false);
9973
+ useEffect22(() => {
9974
+ if (fetchedRef.current) {
9975
+ return;
9976
+ }
9977
+ fetchedRef.current = true;
9978
+ fetchToken().catch(() => {
9979
+ });
9980
+ }, [fetchToken]);
9981
+ const state = useMemo5(() => {
9982
+ switch (kycTokenState.type) {
9983
+ case "IDLE":
9984
+ case "LOADING":
9985
+ return { type: "loading" };
9986
+ case "ERROR": {
9987
+ const notAuthenticated = kycTokenState.reason === "not-authenticated";
9988
+ return {
9989
+ type: "error",
9990
+ message: notAuthenticated ? NOT_AUTHENTICATED_MESSAGE2 : GENERIC_ERROR_MESSAGE2,
9991
+ retryable: !notAuthenticated
9992
+ };
9993
+ }
9994
+ case "CONTENT":
9995
+ return {
9996
+ type: "ready",
9997
+ accessToken: kycTokenState.token,
9998
+ locale,
9999
+ refreshToken: fetchToken
10000
+ };
10001
+ default: {
10002
+ const exhaustive = kycTokenState;
10003
+ return exhaustive;
10004
+ }
10005
+ }
10006
+ }, [kycTokenState, locale, fetchToken]);
10007
+ const onEvent = useCallback8(
10008
+ (event) => {
10009
+ switch (event.type) {
10010
+ case "ON_RETRY":
10011
+ fetchToken().catch(() => {
10012
+ });
10013
+ return;
10014
+ case "ON_SUBMITTED":
10015
+ onSubmitted?.();
10016
+ return;
10017
+ case "ON_ERROR":
10018
+ onError?.(event.error);
10019
+ return;
10020
+ default: {
10021
+ const exhaustive = event;
10022
+ return exhaustive;
10023
+ }
10024
+ }
10025
+ },
10026
+ [fetchToken, onSubmitted, onError]
10027
+ );
10028
+ return { state, onEvent };
10029
+ }
10030
+
10031
+ // src/client/components/requirements/identity-verification/IdentityVerificationContainer.tsx
10032
+ import { jsx as jsx58 } from "react/jsx-runtime";
10033
+ function IdentityVerificationContainer({
10034
+ levelName,
10035
+ reset,
10036
+ locale,
10037
+ onSubmitted,
10038
+ onError,
10039
+ className
10040
+ }) {
10041
+ const { state, onEvent } = useIdentityVerificationViewModel({
10042
+ levelName,
10043
+ reset,
10044
+ locale,
10045
+ onSubmitted,
10046
+ onError
10047
+ });
10048
+ return /* @__PURE__ */ jsx58(
10049
+ IdentityVerificationView,
10050
+ {
10051
+ state,
10052
+ onEvent,
10053
+ className
10054
+ }
10055
+ );
10056
+ }
10057
+
10058
+ // src/client/components/requirements/RequirementItem.tsx
9843
10059
  import { ChevronRight } from "lucide-react";
9844
10060
 
9845
10061
  // src/client/components/design-system/StepStatusIcon.tsx
9846
10062
  import { CircleCheck as CircleCheck2, CircleX, Info as Info5 } from "lucide-react";
9847
- import { jsx as jsx57 } from "react/jsx-runtime";
10063
+ import { jsx as jsx59 } from "react/jsx-runtime";
9848
10064
  var statusConfig = {
9849
10065
  required: {
9850
10066
  Icon: Info5,
@@ -9869,7 +10085,7 @@ var statusConfig = {
9869
10085
  };
9870
10086
  function StepStatusIcon({ status, className }) {
9871
10087
  const { Icon, colorClass, fillClass } = statusConfig[status];
9872
- return /* @__PURE__ */ jsx57(
10088
+ return /* @__PURE__ */ jsx59(
9873
10089
  Icon,
9874
10090
  {
9875
10091
  className: cn(
@@ -9883,8 +10099,8 @@ function StepStatusIcon({ status, className }) {
9883
10099
  );
9884
10100
  }
9885
10101
 
9886
- // src/client/components/requirements/checklist/RequirementItem.tsx
9887
- import { Fragment as Fragment9, jsx as jsx58, jsxs as jsxs41 } from "react/jsx-runtime";
10102
+ // src/client/components/requirements/RequirementItem.tsx
10103
+ import { Fragment as Fragment9, jsx as jsx60, jsxs as jsxs42 } from "react/jsx-runtime";
9888
10104
  function VerificationActionZone({
9889
10105
  status,
9890
10106
  onAction,
@@ -9893,9 +10109,9 @@ function VerificationActionZone({
9893
10109
  switch (status) {
9894
10110
  case "required":
9895
10111
  if (onAction === null) return null;
9896
- return /* @__PURE__ */ jsx58(ClButton, { size: "sm", onClick: onAction, children: "Continue" });
10112
+ return /* @__PURE__ */ jsx60(ClButton, { size: "sm", onClick: onAction, children: "Continue" });
9897
10113
  case "pending":
9898
- return /* @__PURE__ */ jsx58(
10114
+ return /* @__PURE__ */ jsx60(
9899
10115
  AlertBanner,
9900
10116
  {
9901
10117
  variant: "warning",
@@ -9903,16 +10119,16 @@ function VerificationActionZone({
9903
10119
  }
9904
10120
  );
9905
10121
  case "completed":
9906
- return /* @__PURE__ */ jsx58(AlertBanner, { variant: "success", content: "Identity verified." });
10122
+ return /* @__PURE__ */ jsx60(AlertBanner, { variant: "success", content: "Identity verified." });
9907
10123
  case "rejected":
9908
- return /* @__PURE__ */ jsx58(
10124
+ return /* @__PURE__ */ jsx60(
9909
10125
  AlertBanner,
9910
10126
  {
9911
10127
  variant: "error",
9912
- content: onContactSupport === null ? "Verification rejected." : /* @__PURE__ */ jsxs41(Fragment9, { children: [
10128
+ content: onContactSupport === null ? "Verification rejected." : /* @__PURE__ */ jsxs42(Fragment9, { children: [
9913
10129
  "Verification rejected.",
9914
10130
  " ",
9915
- /* @__PURE__ */ jsx58(
10131
+ /* @__PURE__ */ jsx60(
9916
10132
  "button",
9917
10133
  {
9918
10134
  type: "button",
@@ -9936,8 +10152,8 @@ function WalletActionZone({
9936
10152
  onRemoveWallet
9937
10153
  }) {
9938
10154
  if (multiWallet) {
9939
- return /* @__PURE__ */ jsxs41(Fragment9, { children: [
9940
- /* @__PURE__ */ jsx58(
10155
+ return /* @__PURE__ */ jsxs42(Fragment9, { children: [
10156
+ /* @__PURE__ */ jsx60(
9941
10157
  ConnectedWalletList,
9942
10158
  {
9943
10159
  wallets: connectedWallets,
@@ -9946,7 +10162,7 @@ function WalletActionZone({
9946
10162
  status: walletsStatus
9947
10163
  }
9948
10164
  ),
9949
- status === "rejected" && /* @__PURE__ */ jsx58(
10165
+ status === "rejected" && /* @__PURE__ */ jsx60(
9950
10166
  AlertBanner,
9951
10167
  {
9952
10168
  variant: "error",
@@ -9957,21 +10173,21 @@ function WalletActionZone({
9957
10173
  }
9958
10174
  if (status === "completed") {
9959
10175
  const connected = connectedWallets[0];
9960
- return /* @__PURE__ */ jsxs41(Fragment9, { children: [
9961
- onAction !== null && /* @__PURE__ */ jsx58(ClButton, { size: "sm", variant: "secondary", onClick: onAction, children: "Change wallet" }),
9962
- walletsStatus === "loading" ? /* @__PURE__ */ jsx58(
10176
+ return /* @__PURE__ */ jsxs42(Fragment9, { children: [
10177
+ onAction !== null && /* @__PURE__ */ jsx60(ClButton, { size: "sm", variant: "secondary", onClick: onAction, children: "Change wallet" }),
10178
+ walletsStatus === "loading" ? /* @__PURE__ */ jsx60(
9963
10179
  AlertBanner,
9964
10180
  {
9965
10181
  variant: "info",
9966
10182
  content: "Loading your connected wallet\u2026"
9967
10183
  }
9968
- ) : walletsStatus === "error" ? /* @__PURE__ */ jsx58(
10184
+ ) : walletsStatus === "error" ? /* @__PURE__ */ jsx60(
9969
10185
  AlertBanner,
9970
10186
  {
9971
10187
  variant: "error",
9972
10188
  content: "Couldn't load your connected wallet."
9973
10189
  }
9974
- ) : /* @__PURE__ */ jsx58(
10190
+ ) : /* @__PURE__ */ jsx60(
9975
10191
  AlertBanner,
9976
10192
  {
9977
10193
  variant: "success",
@@ -9981,9 +10197,9 @@ function WalletActionZone({
9981
10197
  ] });
9982
10198
  }
9983
10199
  if (status === "rejected") {
9984
- return /* @__PURE__ */ jsxs41(Fragment9, { children: [
9985
- onAction !== null && /* @__PURE__ */ jsx58(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" }),
9986
- /* @__PURE__ */ jsx58(
10200
+ return /* @__PURE__ */ jsxs42(Fragment9, { children: [
10201
+ onAction !== null && /* @__PURE__ */ jsx60(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" }),
10202
+ /* @__PURE__ */ jsx60(
9987
10203
  AlertBanner,
9988
10204
  {
9989
10205
  variant: "error",
@@ -9993,7 +10209,7 @@ function WalletActionZone({
9993
10209
  ] });
9994
10210
  }
9995
10211
  if (onAction === null) return null;
9996
- return /* @__PURE__ */ jsx58(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" });
10212
+ return /* @__PURE__ */ jsx60(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" });
9997
10213
  }
9998
10214
  function RequirementItem({
9999
10215
  ui,
@@ -10005,7 +10221,7 @@ function RequirementItem({
10005
10221
  walletsStatus,
10006
10222
  onContactSupport
10007
10223
  }) {
10008
- return /* @__PURE__ */ jsx58(CoinListStyleScope, { children: /* @__PURE__ */ jsxs41(
10224
+ return /* @__PURE__ */ jsx60(CoinListStyleScope, { children: /* @__PURE__ */ jsxs42(
10009
10225
  "div",
10010
10226
  {
10011
10227
  className: cn(
@@ -10013,7 +10229,7 @@ function RequirementItem({
10013
10229
  className
10014
10230
  ),
10015
10231
  children: [
10016
- /* @__PURE__ */ jsxs41(
10232
+ /* @__PURE__ */ jsxs42(
10017
10233
  "button",
10018
10234
  {
10019
10235
  type: "button",
@@ -10021,9 +10237,9 @@ function RequirementItem({
10021
10237
  "aria-expanded": expanded,
10022
10238
  className: "clcosdk:flex clcosdk:h-14 clcosdk:w-full clcosdk:cursor-pointer clcosdk:items-center clcosdk:justify-between clcosdk:rounded-2xl clcosdk:px-2 clcosdk:transition-colors clcosdk:hover:bg-surface",
10023
10239
  children: [
10024
- /* @__PURE__ */ jsxs41("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-3", children: [
10025
- /* @__PURE__ */ jsx58(StepStatusIcon, { status: ui.status }),
10026
- /* @__PURE__ */ jsx58(
10240
+ /* @__PURE__ */ jsxs42("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-3", children: [
10241
+ /* @__PURE__ */ jsx60(StepStatusIcon, { status: ui.status }),
10242
+ /* @__PURE__ */ jsx60(
10027
10243
  "span",
10028
10244
  {
10029
10245
  className: cn(
@@ -10034,7 +10250,7 @@ function RequirementItem({
10034
10250
  }
10035
10251
  )
10036
10252
  ] }),
10037
- /* @__PURE__ */ jsx58(
10253
+ /* @__PURE__ */ jsx60(
10038
10254
  ChevronRight,
10039
10255
  {
10040
10256
  className: cn(
@@ -10047,15 +10263,15 @@ function RequirementItem({
10047
10263
  ]
10048
10264
  }
10049
10265
  ),
10050
- /* @__PURE__ */ jsx58(
10266
+ /* @__PURE__ */ jsx60(
10051
10267
  "div",
10052
10268
  {
10053
10269
  className: cn(
10054
10270
  "clcosdk:grid clcosdk:transition-[grid-template-rows] clcosdk:duration-300 clcosdk:ease-in-out",
10055
10271
  expanded ? "clcosdk:grid-rows-[1fr]" : "clcosdk:grid-rows-[0fr]"
10056
10272
  ),
10057
- children: /* @__PURE__ */ jsx58("div", { className: "clcosdk:min-h-0 clcosdk:overflow-hidden", children: /* @__PURE__ */ jsxs41("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:px-2 clcosdk:pb-4", children: [
10058
- /* @__PURE__ */ jsx58(
10273
+ children: /* @__PURE__ */ jsx60("div", { className: "clcosdk:min-h-0 clcosdk:overflow-hidden", children: /* @__PURE__ */ jsxs42("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:px-2 clcosdk:pb-4", children: [
10274
+ /* @__PURE__ */ jsx60(
10059
10275
  "p",
10060
10276
  {
10061
10277
  className: cn(
@@ -10065,14 +10281,14 @@ function RequirementItem({
10065
10281
  children: ui.description
10066
10282
  }
10067
10283
  ),
10068
- ui.variant === "verification" ? /* @__PURE__ */ jsx58(
10284
+ ui.variant === "verification" ? /* @__PURE__ */ jsx60(
10069
10285
  VerificationActionZone,
10070
10286
  {
10071
10287
  status: ui.status,
10072
10288
  onAction,
10073
10289
  onContactSupport
10074
10290
  }
10075
- ) : /* @__PURE__ */ jsx58(
10291
+ ) : /* @__PURE__ */ jsx60(
10076
10292
  WalletActionZone,
10077
10293
  {
10078
10294
  status: ui.status,
@@ -10082,363 +10298,114 @@ function RequirementItem({
10082
10298
  onAction,
10083
10299
  onRemoveWallet
10084
10300
  }
10085
- )
10086
- ] }) })
10087
- }
10088
- )
10089
- ]
10090
- }
10091
- ) });
10092
- }
10093
-
10094
- // src/client/components/requirements/checklist/RequirementsChecklistView.tsx
10095
- import { jsx as jsx59, jsxs as jsxs42 } from "react/jsx-runtime";
10096
- function RequirementsChecklistView(props) {
10097
- return /* @__PURE__ */ jsx59(CoinListStyleScope, { children: /* @__PURE__ */ jsx59(RequirementsChecklistViewBody, { ...props }) });
10098
- }
10099
- function RequirementsChecklistViewBody({
10100
- state,
10101
- onEvent,
10102
- loading,
10103
- error,
10104
- unauthenticatedState,
10105
- className
10106
- }) {
10107
- switch (state.type) {
10108
- case "loading":
10109
- return loading ?? /* @__PURE__ */ jsx59(LoadingState2, {});
10110
- case "not-authenticated":
10111
- return unauthenticatedState ?? null;
10112
- case "error":
10113
- return error ?? /* @__PURE__ */ jsx59(
10114
- AlertBanner,
10115
- {
10116
- variant: "error",
10117
- icon: true,
10118
- content: "Unable to load requirements right now. Please try again.",
10119
- className: "clcosdk:w-full clcosdk:max-w-[28rem]"
10120
- }
10121
- );
10122
- case "content":
10123
- return /* @__PURE__ */ jsxs42(
10124
- "div",
10125
- {
10126
- className: cn(
10127
- "clcosdk:flex clcosdk:w-full clcosdk:flex-col clcosdk:gap-4",
10128
- className
10129
- ),
10130
- children: [
10131
- /* @__PURE__ */ jsxs42("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
10132
- /* @__PURE__ */ jsx59("h3", { className: cn(typeClasses.h3, "clcosdk:text-text-primary"), children: state.title }),
10133
- /* @__PURE__ */ jsx59("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: state.description })
10134
- ] }),
10135
- /* @__PURE__ */ jsx59("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:divide-y clcosdk:divide-divider", children: state.items.map((row) => /* @__PURE__ */ jsx59(
10136
- RequirementItem,
10137
- {
10138
- ui: row.item,
10139
- expanded: row.expanded,
10140
- onToggle: () => onEvent({ type: "ON_TOGGLE_ITEM", requirementId: row.id }),
10141
- onAction: row.actionEnabled ? () => onEvent({
10142
- type: "ON_REQUIREMENT_ACTION",
10143
- requirementId: row.id
10144
- }) : null,
10145
- onRemoveWallet: row.wallets ? (id) => state.removeWallet(id) : void 0,
10146
- walletsStatus: row.wallets?.status,
10147
- onContactSupport: row.contactSupportEnabled ? () => onEvent({
10148
- type: "ON_CONTACT_SUPPORT",
10149
- requirementId: row.id
10150
- }) : null
10151
- },
10152
- row.id
10153
- )) }),
10154
- state.ineligible && /* @__PURE__ */ jsx59(
10155
- AlertBanner,
10156
- {
10157
- variant: "error",
10158
- icon: true,
10159
- content: "You are not eligible to participate."
10160
- }
10161
- ),
10162
- state.continueAction && /* @__PURE__ */ jsx59(
10163
- ClButton,
10164
- {
10165
- fullWidth: true,
10166
- disabled: !state.continueAction.enabled,
10167
- onClick: () => onEvent({ type: "ON_CONTINUE" }),
10168
- children: "Continue"
10169
- }
10170
- )
10171
- ]
10172
- }
10173
- );
10174
- default: {
10175
- const exhaustive = state;
10176
- return exhaustive;
10177
- }
10178
- }
10179
- }
10180
- function LoadingState2() {
10181
- return /* @__PURE__ */ jsx59(
10182
- "output",
10183
- {
10184
- "aria-live": "polite",
10185
- className: "clcosdk:flex clcosdk:min-h-40 clcosdk:items-center clcosdk:justify-center clcosdk:rounded-2xl clcosdk:border clcosdk:border-border clcosdk:bg-background clcosdk:p-6",
10186
- children: /* @__PURE__ */ jsx59("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Loading requirements..." })
10187
- }
10188
- );
10189
- }
10190
-
10191
- // src/client/components/requirements/checklist/VerificationOverlay.tsx
10192
- import { jsx as jsx60, jsxs as jsxs43 } from "react/jsx-runtime";
10193
- function VerificationOverlay({
10194
- onClose,
10195
- children
10196
- }) {
10197
- return /* @__PURE__ */ jsx60(CoinListStyleScope, { children: /* @__PURE__ */ jsx60(VerificationOverlayBody, { onClose, children }) });
10198
- }
10199
- function VerificationOverlayBody({
10200
- onClose,
10201
- children
10202
- }) {
10203
- return /* @__PURE__ */ jsx60(
10204
- "div",
10205
- {
10206
- role: "dialog",
10207
- "aria-modal": "true",
10208
- "aria-label": "Identity verification",
10209
- className: "clcosdk:fixed clcosdk:inset-0 clcosdk:z-50 clcosdk:flex clcosdk:items-center clcosdk:justify-center clcosdk:bg-overlay clcosdk:p-4",
10210
- children: /* @__PURE__ */ jsxs43("div", { className: "clcosdk:relative clcosdk:flex clcosdk:max-h-[92vh] clcosdk:w-full clcosdk:max-w-[760px] clcosdk:flex-col clcosdk:overflow-y-auto clcosdk:rounded-2xl clcosdk:bg-background clcosdk:p-6 clcosdk:pt-14", children: [
10211
- /* @__PURE__ */ jsx60(
10212
- CloseButton,
10213
- {
10214
- onClick: onClose,
10215
- className: "clcosdk:absolute clcosdk:top-4 clcosdk:right-4"
10216
- }
10217
- ),
10218
- children
10219
- ] })
10220
- }
10221
- );
10222
- }
10223
-
10224
- // src/client/components/requirements/identity-verification/IdentityVerificationView.tsx
10225
- import SumsubWebSdk from "@sumsub/websdk-react";
10226
- import { jsx as jsx61, jsxs as jsxs44 } from "react/jsx-runtime";
10227
- function IdentityVerificationView(props) {
10228
- return /* @__PURE__ */ jsx61(CoinListStyleScope, { children: /* @__PURE__ */ jsx61(IdentityVerificationViewBody, { ...props }) });
10229
- }
10230
- function IdentityVerificationViewBody({
10231
- state,
10232
- onEvent,
10233
- className
10234
- }) {
10235
- switch (state.type) {
10236
- case "loading":
10237
- return /* @__PURE__ */ jsx61(
10238
- "output",
10239
- {
10240
- "aria-live": "polite",
10241
- className: cn(
10242
- "clcosdk:flex clcosdk:min-h-40 clcosdk:items-center clcosdk:justify-center",
10243
- className
10244
- ),
10245
- children: /* @__PURE__ */ jsx61("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Loading identity verification..." })
10246
- }
10247
- );
10248
- case "error":
10249
- return /* @__PURE__ */ jsxs44(
10250
- "div",
10251
- {
10252
- className: cn(
10253
- "clcosdk:flex clcosdk:flex-col clcosdk:gap-4",
10254
- className
10255
- ),
10256
- children: [
10257
- /* @__PURE__ */ jsx61(AlertBanner, { variant: "error", icon: true, content: state.message }),
10258
- state.retryable && /* @__PURE__ */ jsx61(ClButton, { size: "sm", onClick: () => onEvent({ type: "ON_RETRY" }), children: "Try again" })
10259
- ]
10260
- }
10261
- );
10262
- case "ready":
10263
- return /* @__PURE__ */ jsx61("div", { className: cn("clcosdk:w-full", className), children: /* @__PURE__ */ jsx61(
10264
- SumsubWebSdk,
10265
- {
10266
- accessToken: state.accessToken,
10267
- expirationHandler: state.refreshToken,
10268
- config: state.locale === void 0 ? {} : { lang: state.locale },
10269
- options: { addViewportTag: false, adaptIframeHeight: true },
10270
- onMessage: (type, payload) => {
10271
- onSumsubMessage(type, payload, onEvent);
10272
- },
10273
- onError: (error) => {
10274
- onEvent({ type: "ON_ERROR", error: toError(error) });
10275
- }
10276
- }
10277
- ) });
10278
- default: {
10279
- const exhaustive = state;
10280
- return exhaustive;
10281
- }
10282
- }
10283
- }
10284
- function onSumsubMessage(type, payload, onEvent) {
10285
- switch (type) {
10286
- case "idCheck.onApplicantSubmitted":
10287
- onEvent({ type: "ON_SUBMITTED" });
10288
- return;
10289
- case "idCheck.onError": {
10290
- const message = payload?.message ?? "Verification error";
10291
- onEvent({ type: "ON_ERROR", error: new Error(message) });
10292
- return;
10293
- }
10294
- default:
10295
- return;
10296
- }
10297
- }
10298
- function toError(error) {
10299
- return error instanceof Error ? error : new Error("Verification error");
10300
- }
10301
-
10302
- // src/client/hooks/requirements/identity-verification/useIdentityVerificationViewModel.ts
10303
- import { useCallback as useCallback8, useEffect as useEffect22, useMemo as useMemo5, useRef as useRef15 } from "react";
10304
-
10305
- // src/client/hooks/requirements/data/useKycToken.ts
10306
- import { useCallback as useCallback7, useEffect as useEffect21, useRef as useRef14, useState as useState26 } from "react";
10307
- var IDLE_STATE = { type: "IDLE" };
10308
- var LOADING_STATE4 = { type: "LOADING" };
10309
- function useKycToken(levelName, reset) {
10310
- const { coinlist } = useCoinList();
10311
- const log = useLogger("useKycToken");
10312
- const [kycTokenState, setKycTokenState] = useState26(IDLE_STATE);
10313
- const resetPendingRef = useRef14(reset === true);
10314
- const tokenIssuedRef = useRef14(false);
10315
- useEffect21(() => {
10316
- if (!tokenIssuedRef.current) {
10317
- resetPendingRef.current = reset === true;
10318
- }
10319
- }, [reset]);
10320
- const fetchToken = useCallback7(async () => {
10321
- setKycTokenState(LOADING_STATE4);
10322
- try {
10323
- const kycToken = await coinlist.requirements.createKycToken({
10324
- levelName,
10325
- reset: resetPendingRef.current
10326
- });
10327
- resetPendingRef.current = false;
10328
- tokenIssuedRef.current = true;
10329
- log.debug(() => ({
10330
- msg: "settled",
10331
- fields: { state: "CONTENT" }
10332
- }));
10333
- setKycTokenState({ type: "CONTENT", token: kycToken.token });
10334
- return kycToken.token;
10335
- } catch (error) {
10336
- const reason = error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
10337
- log.failure(
10338
- () => ({ msg: "settled", fields: { state: "ERROR", reason } }),
10339
- error
10340
- );
10341
- setKycTokenState({ type: "ERROR", reason });
10342
- throw error;
10343
- }
10344
- }, [coinlist, levelName, log]);
10345
- return { kycTokenState, fetchToken };
10346
- }
10347
-
10348
- // src/client/hooks/requirements/identity-verification/useIdentityVerificationViewModel.ts
10349
- var NOT_AUTHENTICATED_MESSAGE2 = "Sign in to verify your identity.";
10350
- var GENERIC_ERROR_MESSAGE2 = "Unable to start identity verification right now. Please try again.";
10351
- function useIdentityVerificationViewModel(options = {}) {
10352
- const { levelName, reset, locale, onSubmitted, onError } = options;
10353
- const { kycTokenState, fetchToken } = useKycToken(levelName, reset);
10354
- const fetchedRef = useRef15(false);
10355
- useEffect22(() => {
10356
- if (fetchedRef.current) {
10357
- return;
10358
- }
10359
- fetchedRef.current = true;
10360
- fetchToken().catch(() => {
10361
- });
10362
- }, [fetchToken]);
10363
- const state = useMemo5(() => {
10364
- switch (kycTokenState.type) {
10365
- case "IDLE":
10366
- case "LOADING":
10367
- return { type: "loading" };
10368
- case "ERROR": {
10369
- const notAuthenticated = kycTokenState.reason === "not-authenticated";
10370
- return {
10371
- type: "error",
10372
- message: notAuthenticated ? NOT_AUTHENTICATED_MESSAGE2 : GENERIC_ERROR_MESSAGE2,
10373
- retryable: !notAuthenticated
10374
- };
10375
- }
10376
- case "CONTENT":
10377
- return {
10378
- type: "ready",
10379
- accessToken: kycTokenState.token,
10380
- locale,
10381
- refreshToken: fetchToken
10382
- };
10383
- default: {
10384
- const exhaustive = kycTokenState;
10385
- return exhaustive;
10386
- }
10301
+ )
10302
+ ] }) })
10303
+ }
10304
+ )
10305
+ ]
10387
10306
  }
10388
- }, [kycTokenState, locale, fetchToken]);
10389
- const onEvent = useCallback8(
10390
- (event) => {
10391
- switch (event.type) {
10392
- case "ON_RETRY":
10393
- fetchToken().catch(() => {
10394
- });
10395
- return;
10396
- case "ON_SUBMITTED":
10397
- onSubmitted?.();
10398
- return;
10399
- case "ON_ERROR":
10400
- onError?.(event.error);
10401
- return;
10402
- default: {
10403
- const exhaustive = event;
10404
- return exhaustive;
10405
- }
10406
- }
10407
- },
10408
- [fetchToken, onSubmitted, onError]
10409
- );
10410
- return { state, onEvent };
10307
+ ) });
10411
10308
  }
10412
10309
 
10413
- // src/client/components/requirements/identity-verification/IdentityVerificationContainer.tsx
10414
- import { jsx as jsx62 } from "react/jsx-runtime";
10415
- function IdentityVerificationContainer({
10416
- levelName,
10417
- reset,
10418
- locale,
10419
- onSubmitted,
10420
- onError,
10310
+ // src/client/components/requirements/RequirementsChecklistView.tsx
10311
+ import { jsx as jsx61, jsxs as jsxs43 } from "react/jsx-runtime";
10312
+ function RequirementsChecklistView(props) {
10313
+ return /* @__PURE__ */ jsx61(CoinListStyleScope, { children: /* @__PURE__ */ jsx61(RequirementsChecklistViewBody, { ...props }) });
10314
+ }
10315
+ function RequirementsChecklistViewBody({
10316
+ state,
10317
+ onEvent,
10318
+ loading,
10319
+ error,
10320
+ unauthenticatedState,
10421
10321
  className
10422
10322
  }) {
10423
- const { state, onEvent } = useIdentityVerificationViewModel({
10424
- levelName,
10425
- reset,
10426
- locale,
10427
- onSubmitted,
10428
- onError
10429
- });
10430
- return /* @__PURE__ */ jsx62(
10431
- IdentityVerificationView,
10323
+ switch (state.type) {
10324
+ case "loading":
10325
+ return loading ?? /* @__PURE__ */ jsx61(LoadingState2, {});
10326
+ case "not-authenticated":
10327
+ return unauthenticatedState ?? null;
10328
+ case "error":
10329
+ return error ?? /* @__PURE__ */ jsx61(
10330
+ AlertBanner,
10331
+ {
10332
+ variant: "error",
10333
+ icon: true,
10334
+ content: "Unable to load requirements right now. Please try again.",
10335
+ className: "clcosdk:w-full clcosdk:max-w-[28rem]"
10336
+ }
10337
+ );
10338
+ case "content":
10339
+ return /* @__PURE__ */ jsxs43(
10340
+ "div",
10341
+ {
10342
+ className: cn(
10343
+ "clcosdk:flex clcosdk:w-full clcosdk:flex-col clcosdk:gap-4",
10344
+ className
10345
+ ),
10346
+ children: [
10347
+ /* @__PURE__ */ jsxs43("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
10348
+ /* @__PURE__ */ jsx61("h3", { className: cn(typeClasses.h3, "clcosdk:text-text-primary"), children: state.title }),
10349
+ /* @__PURE__ */ jsx61("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: state.description })
10350
+ ] }),
10351
+ /* @__PURE__ */ jsx61("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:divide-y clcosdk:divide-divider", children: state.items.map((row) => /* @__PURE__ */ jsx61(
10352
+ RequirementItem,
10353
+ {
10354
+ ui: row.item,
10355
+ expanded: row.expanded,
10356
+ onToggle: () => onEvent({ type: "ON_TOGGLE_ITEM", requirementId: row.id }),
10357
+ onAction: row.actionEnabled ? () => onEvent({
10358
+ type: "ON_REQUIREMENT_ACTION",
10359
+ requirementId: row.id
10360
+ }) : null,
10361
+ onRemoveWallet: row.wallets ? (id) => state.removeWallet(id) : void 0,
10362
+ walletsStatus: row.wallets?.status,
10363
+ onContactSupport: row.contactSupportEnabled ? () => onEvent({
10364
+ type: "ON_CONTACT_SUPPORT",
10365
+ requirementId: row.id
10366
+ }) : null
10367
+ },
10368
+ row.id
10369
+ )) }),
10370
+ state.ineligible && /* @__PURE__ */ jsx61(
10371
+ AlertBanner,
10372
+ {
10373
+ variant: "error",
10374
+ icon: true,
10375
+ content: "You are not eligible to participate."
10376
+ }
10377
+ ),
10378
+ state.continueAction && /* @__PURE__ */ jsx61(
10379
+ ClButton,
10380
+ {
10381
+ fullWidth: true,
10382
+ disabled: !state.continueAction.enabled,
10383
+ onClick: () => onEvent({ type: "ON_CONTINUE" }),
10384
+ children: "Continue"
10385
+ }
10386
+ )
10387
+ ]
10388
+ }
10389
+ );
10390
+ default: {
10391
+ const exhaustive = state;
10392
+ return exhaustive;
10393
+ }
10394
+ }
10395
+ }
10396
+ function LoadingState2() {
10397
+ return /* @__PURE__ */ jsx61(
10398
+ "output",
10432
10399
  {
10433
- state,
10434
- onEvent,
10435
- className
10400
+ "aria-live": "polite",
10401
+ className: "clcosdk:flex clcosdk:min-h-40 clcosdk:items-center clcosdk:justify-center clcosdk:rounded-2xl clcosdk:border clcosdk:border-border clcosdk:bg-background clcosdk:p-6",
10402
+ children: /* @__PURE__ */ jsx61("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Loading requirements..." })
10436
10403
  }
10437
10404
  );
10438
10405
  }
10439
10406
 
10440
10407
  // src/client/components/requirements/tax-document/TaxDocumentModalView.tsx
10441
- import { jsx as jsx63, jsxs as jsxs45 } from "react/jsx-runtime";
10408
+ import { jsx as jsx62, jsxs as jsxs44 } from "react/jsx-runtime";
10442
10409
  function TaxDocumentModalView({
10443
10410
  state,
10444
10411
  onEvent,
@@ -10447,7 +10414,7 @@ function TaxDocumentModalView({
10447
10414
  if (state.type === "hidden") {
10448
10415
  return null;
10449
10416
  }
10450
- return /* @__PURE__ */ jsx63(CoinListStyleScope, { children: /* @__PURE__ */ jsx63("div", { className: "clcosdk:fixed clcosdk:inset-0 clcosdk:z-50 clcosdk:flex clcosdk:items-center clcosdk:justify-center clcosdk:bg-black/50 clcosdk:p-4", children: /* @__PURE__ */ jsxs45(
10417
+ return /* @__PURE__ */ jsx62(CoinListStyleScope, { children: /* @__PURE__ */ jsx62("div", { className: "clcosdk:fixed clcosdk:inset-0 clcosdk:z-50 clcosdk:flex clcosdk:items-center clcosdk:justify-center clcosdk:bg-black/50 clcosdk:p-4", children: /* @__PURE__ */ jsxs44(
10451
10418
  "div",
10452
10419
  {
10453
10420
  className: cn(
@@ -10455,11 +10422,11 @@ function TaxDocumentModalView({
10455
10422
  className
10456
10423
  ),
10457
10424
  children: [
10458
- /* @__PURE__ */ jsxs45("div", { className: "clcosdk:flex clcosdk:items-start clcosdk:justify-between clcosdk:gap-4", children: [
10459
- /* @__PURE__ */ jsx63("h3", { className: cn(typeClasses.h3, "clcosdk:text-text-primary"), children: state.title }),
10460
- /* @__PURE__ */ jsx63(CloseButton, { onClick: () => onEvent({ type: "ON_CLOSE" }) })
10425
+ /* @__PURE__ */ jsxs44("div", { className: "clcosdk:flex clcosdk:items-start clcosdk:justify-between clcosdk:gap-4", children: [
10426
+ /* @__PURE__ */ jsx62("h3", { className: cn(typeClasses.h3, "clcosdk:text-text-primary"), children: state.title }),
10427
+ /* @__PURE__ */ jsx62(CloseButton, { onClick: () => onEvent({ type: "ON_CLOSE" }) })
10461
10428
  ] }),
10462
- /* @__PURE__ */ jsx63(Screen, { screen: state.screen, onEvent })
10429
+ /* @__PURE__ */ jsx62(Screen, { screen: state.screen, onEvent })
10463
10430
  ]
10464
10431
  }
10465
10432
  ) }) });
@@ -10470,11 +10437,11 @@ function Screen({
10470
10437
  }) {
10471
10438
  switch (screen.type) {
10472
10439
  case "loading":
10473
- return /* @__PURE__ */ jsx63(LoadingScreen, {});
10440
+ return /* @__PURE__ */ jsx62(LoadingScreen, {});
10474
10441
  case "error":
10475
- return /* @__PURE__ */ jsx63(AlertBanner, { variant: "error", icon: true, content: screen.message });
10442
+ return /* @__PURE__ */ jsx62(AlertBanner, { variant: "error", icon: true, content: screen.message });
10476
10443
  case "review":
10477
- return /* @__PURE__ */ jsx63(
10444
+ return /* @__PURE__ */ jsx62(
10478
10445
  ReviewScreen,
10479
10446
  {
10480
10447
  fields: screen.fields,
@@ -10485,9 +10452,9 @@ function Screen({
10485
10452
  }
10486
10453
  );
10487
10454
  case "editing":
10488
- return /* @__PURE__ */ jsx63(EditScreen, { fields: screen.fields, onEvent });
10455
+ return /* @__PURE__ */ jsx62(EditScreen, { fields: screen.fields, onEvent });
10489
10456
  case "sign-only":
10490
- return /* @__PURE__ */ jsx63(
10457
+ return /* @__PURE__ */ jsx62(
10491
10458
  SignOnlyScreen,
10492
10459
  {
10493
10460
  signing: screen.signing,
@@ -10502,14 +10469,14 @@ function Screen({
10502
10469
  }
10503
10470
  }
10504
10471
  function LoadingScreen() {
10505
- return /* @__PURE__ */ jsx63(
10472
+ return /* @__PURE__ */ jsx62(
10506
10473
  "output",
10507
10474
  {
10508
10475
  "aria-live": "polite",
10509
10476
  className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4",
10510
- children: [0, 1, 2, 3, 4].map((row) => /* @__PURE__ */ jsxs45("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-1", children: [
10511
- /* @__PURE__ */ jsx63("div", { className: "clcosdk:h-3 clcosdk:w-28 clcosdk:animate-pulse clcosdk:rounded clcosdk:bg-surface" }),
10512
- /* @__PURE__ */ jsx63("div", { className: "clcosdk:h-5 clcosdk:w-48 clcosdk:animate-pulse clcosdk:rounded clcosdk:bg-surface" })
10477
+ children: [0, 1, 2, 3, 4].map((row) => /* @__PURE__ */ jsxs44("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-1", children: [
10478
+ /* @__PURE__ */ jsx62("div", { className: "clcosdk:h-3 clcosdk:w-28 clcosdk:animate-pulse clcosdk:rounded clcosdk:bg-surface" }),
10479
+ /* @__PURE__ */ jsx62("div", { className: "clcosdk:h-5 clcosdk:w-48 clcosdk:animate-pulse clcosdk:rounded clcosdk:bg-surface" })
10513
10480
  ] }, row))
10514
10481
  }
10515
10482
  );
@@ -10521,9 +10488,9 @@ function ReviewScreen({
10521
10488
  signError,
10522
10489
  onEvent
10523
10490
  }) {
10524
- return /* @__PURE__ */ jsxs45("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
10525
- /* @__PURE__ */ jsx63("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Review your information below. If anything looks incorrect, edit before signing." }),
10526
- piiUnavailable && /* @__PURE__ */ jsx63(
10491
+ return /* @__PURE__ */ jsxs44("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
10492
+ /* @__PURE__ */ jsx62("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Review your information below. If anything looks incorrect, edit before signing." }),
10493
+ piiUnavailable && /* @__PURE__ */ jsx62(
10527
10494
  AlertBanner,
10528
10495
  {
10529
10496
  variant: "info",
@@ -10531,27 +10498,27 @@ function ReviewScreen({
10531
10498
  content: "We don't have this information on file yet \u2014 please fill it in below."
10532
10499
  }
10533
10500
  ),
10534
- /* @__PURE__ */ jsx63("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:border-t clcosdk:border-divider clcosdk:pt-4", children: fields.map(({ field, label, displayValue }) => /* @__PURE__ */ jsxs45(
10501
+ /* @__PURE__ */ jsx62("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:border-t clcosdk:border-divider clcosdk:pt-4", children: fields.map(({ field, label, displayValue }) => /* @__PURE__ */ jsxs44(
10535
10502
  "div",
10536
10503
  {
10537
10504
  className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-1",
10538
10505
  children: [
10539
- /* @__PURE__ */ jsx63(
10506
+ /* @__PURE__ */ jsx62(
10540
10507
  "span",
10541
10508
  {
10542
10509
  className: cn(typeClasses.label, "clcosdk:text-text-secondary"),
10543
10510
  children: label
10544
10511
  }
10545
10512
  ),
10546
- /* @__PURE__ */ jsx63("span", { className: cn(typeClasses.body, "clcosdk:text-text-primary"), children: displayValue })
10513
+ /* @__PURE__ */ jsx62("span", { className: cn(typeClasses.body, "clcosdk:text-text-primary"), children: displayValue })
10547
10514
  ]
10548
10515
  },
10549
10516
  field
10550
10517
  )) }),
10551
- /* @__PURE__ */ jsx63("p", { className: cn(typeClasses.caption, "clcosdk:text-text-secondary"), children: "By signing, you certify that the information above is accurate and that you are the beneficial owner of the income this form relates to. This document cannot be edited once signed." }),
10552
- signError && /* @__PURE__ */ jsx63(AlertBanner, { variant: "error", icon: true, content: signError }),
10553
- /* @__PURE__ */ jsxs45("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
10554
- /* @__PURE__ */ jsx63(
10518
+ /* @__PURE__ */ jsx62("p", { className: cn(typeClasses.caption, "clcosdk:text-text-secondary"), children: "By signing, you certify that the information above is accurate and that you are the beneficial owner of the income this form relates to. This document cannot be edited once signed." }),
10519
+ signError && /* @__PURE__ */ jsx62(AlertBanner, { variant: "error", icon: true, content: signError }),
10520
+ /* @__PURE__ */ jsxs44("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
10521
+ /* @__PURE__ */ jsx62(
10555
10522
  ClButton,
10556
10523
  {
10557
10524
  fullWidth: true,
@@ -10561,7 +10528,7 @@ function ReviewScreen({
10561
10528
  children: "Sign W-8BEN"
10562
10529
  }
10563
10530
  ),
10564
- /* @__PURE__ */ jsx63(
10531
+ /* @__PURE__ */ jsx62(
10565
10532
  ClButton,
10566
10533
  {
10567
10534
  fullWidth: true,
@@ -10578,20 +10545,20 @@ function EditScreen({
10578
10545
  fields,
10579
10546
  onEvent
10580
10547
  }) {
10581
- return /* @__PURE__ */ jsxs45("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
10582
- /* @__PURE__ */ jsx63("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:border-t clcosdk:border-divider clcosdk:pt-4", children: fields.map(({ field, label, placeholder, value }) => /* @__PURE__ */ jsxs45(
10548
+ return /* @__PURE__ */ jsxs44("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
10549
+ /* @__PURE__ */ jsx62("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:border-t clcosdk:border-divider clcosdk:pt-4", children: fields.map(({ field, label, placeholder, value }) => /* @__PURE__ */ jsxs44(
10583
10550
  "label",
10584
10551
  {
10585
10552
  className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-1",
10586
10553
  children: [
10587
- /* @__PURE__ */ jsx63(
10554
+ /* @__PURE__ */ jsx62(
10588
10555
  "span",
10589
10556
  {
10590
10557
  className: cn(typeClasses.label, "clcosdk:text-text-secondary"),
10591
10558
  children: label
10592
10559
  }
10593
10560
  ),
10594
- /* @__PURE__ */ jsx63(
10561
+ /* @__PURE__ */ jsx62(
10595
10562
  "input",
10596
10563
  {
10597
10564
  type: "text",
@@ -10612,9 +10579,9 @@ function EditScreen({
10612
10579
  },
10613
10580
  field
10614
10581
  )) }),
10615
- /* @__PURE__ */ jsxs45("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
10616
- /* @__PURE__ */ jsx63(ClButton, { fullWidth: true, onClick: () => onEvent({ type: "ON_SAVE_EDIT" }), children: "Save & review" }),
10617
- /* @__PURE__ */ jsx63(
10582
+ /* @__PURE__ */ jsxs44("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
10583
+ /* @__PURE__ */ jsx62(ClButton, { fullWidth: true, onClick: () => onEvent({ type: "ON_SAVE_EDIT" }), children: "Save & review" }),
10584
+ /* @__PURE__ */ jsx62(
10618
10585
  ClButton,
10619
10586
  {
10620
10587
  fullWidth: true,
@@ -10631,10 +10598,10 @@ function SignOnlyScreen({
10631
10598
  signError,
10632
10599
  onEvent
10633
10600
  }) {
10634
- return /* @__PURE__ */ jsxs45("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
10635
- /* @__PURE__ */ jsx63("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "As an entity investor, you must complete a W-8BEN-E to confirm your foreign tax status and claim applicable treaty benefits. You'll receive an email to complete the signing." }),
10636
- signError && /* @__PURE__ */ jsx63(AlertBanner, { variant: "error", icon: true, content: signError }),
10637
- /* @__PURE__ */ jsx63(
10601
+ return /* @__PURE__ */ jsxs44("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
10602
+ /* @__PURE__ */ jsx62("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "As an entity investor, you must complete a W-8BEN-E to confirm your foreign tax status and claim applicable treaty benefits. You'll receive an email to complete the signing." }),
10603
+ signError && /* @__PURE__ */ jsx62(AlertBanner, { variant: "error", icon: true, content: signError }),
10604
+ /* @__PURE__ */ jsx62(
10638
10605
  ClButton,
10639
10606
  {
10640
10607
  fullWidth: true,
@@ -10946,7 +10913,7 @@ function toFieldsUi(fields) {
10946
10913
  }
10947
10914
 
10948
10915
  // src/client/components/requirements/tax-document/TaxDocumentModalContainer.tsx
10949
- import { jsx as jsx64 } from "react/jsx-runtime";
10916
+ import { jsx as jsx63 } from "react/jsx-runtime";
10950
10917
  function TaxDocumentModalContainer({
10951
10918
  isOpen,
10952
10919
  onClose,
@@ -10958,7 +10925,7 @@ function TaxDocumentModalContainer({
10958
10925
  onClose,
10959
10926
  onSubmitted
10960
10927
  });
10961
- return /* @__PURE__ */ jsx64(
10928
+ return /* @__PURE__ */ jsx63(
10962
10929
  TaxDocumentModalView,
10963
10930
  {
10964
10931
  state,
@@ -10968,6 +10935,39 @@ function TaxDocumentModalContainer({
10968
10935
  );
10969
10936
  }
10970
10937
 
10938
+ // src/client/components/requirements/VerificationOverlay.tsx
10939
+ import { jsx as jsx64, jsxs as jsxs45 } from "react/jsx-runtime";
10940
+ function VerificationOverlay({
10941
+ onClose,
10942
+ children
10943
+ }) {
10944
+ return /* @__PURE__ */ jsx64(CoinListStyleScope, { children: /* @__PURE__ */ jsx64(VerificationOverlayBody, { onClose, children }) });
10945
+ }
10946
+ function VerificationOverlayBody({
10947
+ onClose,
10948
+ children
10949
+ }) {
10950
+ return /* @__PURE__ */ jsx64(
10951
+ "div",
10952
+ {
10953
+ role: "dialog",
10954
+ "aria-modal": "true",
10955
+ "aria-label": "Identity verification",
10956
+ className: "clcosdk:fixed clcosdk:inset-0 clcosdk:z-50 clcosdk:flex clcosdk:items-center clcosdk:justify-center clcosdk:bg-overlay clcosdk:p-4",
10957
+ children: /* @__PURE__ */ jsxs45("div", { className: "clcosdk:relative clcosdk:flex clcosdk:max-h-[92vh] clcosdk:w-full clcosdk:max-w-[760px] clcosdk:flex-col clcosdk:overflow-y-auto clcosdk:rounded-2xl clcosdk:bg-background clcosdk:p-6 clcosdk:pt-14", children: [
10958
+ /* @__PURE__ */ jsx64(
10959
+ CloseButton,
10960
+ {
10961
+ onClick: onClose,
10962
+ className: "clcosdk:absolute clcosdk:top-4 clcosdk:right-4"
10963
+ }
10964
+ ),
10965
+ children
10966
+ ] })
10967
+ }
10968
+ );
10969
+ }
10970
+
10971
10971
  // src/client/components/requirements/wallet/ConnectWalletModalView.tsx
10972
10972
  import { useId as useId5 } from "react";
10973
10973
  import { jsx as jsx65, jsxs as jsxs46 } from "react/jsx-runtime";
@@ -11363,60 +11363,9 @@ function ConnectWalletModalContainer({
11363
11363
  );
11364
11364
  }
11365
11365
 
11366
- // src/client/hooks/requirements/checklist/useRequirementsChecklistViewModel.ts
11366
+ // src/client/hooks/requirements/useRequirementsChecklistViewModel.ts
11367
11367
  import { useCallback as useCallback15, useEffect as useEffect29, useMemo as useMemo8, useRef as useRef17, useState as useState31 } from "react";
11368
11368
 
11369
- // src/client/hooks/requirements/checklist/useRequirementsChecklistViewModel.types.ts
11370
- var RequirementItemUi = {
11371
- fromDomain(req, statusInfo, label, description2, addresses = []) {
11372
- return {
11373
- variant: RequirementVariant.fromType(req.type),
11374
- status: statusInfo ? RequirementStatus.fromStatusValue(statusInfo.status) : "required",
11375
- label,
11376
- description: description2,
11377
- multiWallet: req.type === "whitelisted_wallet",
11378
- connectedWallets: addresses.map((address) => ({
11379
- id: address.id,
11380
- address: address.address,
11381
- shortAddress: shortenAddress(address.address)
11382
- }))
11383
- };
11384
- }
11385
- };
11386
- var RequirementVariant = {
11387
- fromType(type) {
11388
- switch (type) {
11389
- case "external_wallet":
11390
- case "whitelisted_wallet":
11391
- return "wallet";
11392
- default:
11393
- return "verification";
11394
- }
11395
- }
11396
- };
11397
- var RequirementStatus = {
11398
- fromStatusValue(status) {
11399
- switch (status) {
11400
- case "not_started":
11401
- case "action_needed":
11402
- return "required";
11403
- case "in_progress":
11404
- return "pending";
11405
- case "completed":
11406
- return "completed";
11407
- case "rejected":
11408
- return "rejected";
11409
- }
11410
- }
11411
- };
11412
- var ChecklistStatus = {
11413
- derive(statuses) {
11414
- if (statuses.some((s) => s.status === "rejected")) return "ineligible";
11415
- if (statuses.every((s) => s.status === "completed")) return "eligible";
11416
- return "inProgress";
11417
- }
11418
- };
11419
-
11420
11369
  // src/client/hooks/requirements/data/useOptionAddresses.ts
11421
11370
  import { useCallback as useCallback13, useEffect as useEffect27, useState as useState29 } from "react";
11422
11371
  var LOADING_STATE6 = { type: "LOADING" };
@@ -11565,7 +11514,58 @@ function useRequirements(offerId, options = {}) {
11565
11514
  return { requirementsState, refetch };
11566
11515
  }
11567
11516
 
11568
- // src/client/hooks/requirements/checklist/useRequirementsChecklistViewModel.ts
11517
+ // src/client/hooks/requirements/useRequirementsChecklistViewModel.types.ts
11518
+ var RequirementItemUi = {
11519
+ fromDomain(req, statusInfo, label, description2, addresses = []) {
11520
+ return {
11521
+ variant: RequirementVariant.fromType(req.type),
11522
+ status: statusInfo ? RequirementStatus.fromStatusValue(statusInfo.status) : "required",
11523
+ label,
11524
+ description: description2,
11525
+ multiWallet: req.type === "whitelisted_wallet",
11526
+ connectedWallets: addresses.map((address) => ({
11527
+ id: address.id,
11528
+ address: address.address,
11529
+ shortAddress: shortenAddress(address.address)
11530
+ }))
11531
+ };
11532
+ }
11533
+ };
11534
+ var RequirementVariant = {
11535
+ fromType(type) {
11536
+ switch (type) {
11537
+ case "external_wallet":
11538
+ case "whitelisted_wallet":
11539
+ return "wallet";
11540
+ default:
11541
+ return "verification";
11542
+ }
11543
+ }
11544
+ };
11545
+ var RequirementStatus = {
11546
+ fromStatusValue(status) {
11547
+ switch (status) {
11548
+ case "not_started":
11549
+ case "action_needed":
11550
+ return "required";
11551
+ case "in_progress":
11552
+ return "pending";
11553
+ case "completed":
11554
+ return "completed";
11555
+ case "rejected":
11556
+ return "rejected";
11557
+ }
11558
+ }
11559
+ };
11560
+ var ChecklistStatus = {
11561
+ derive(statuses) {
11562
+ if (statuses.some((s) => s.status === "rejected")) return "ineligible";
11563
+ if (statuses.every((s) => s.status === "completed")) return "eligible";
11564
+ return "inProgress";
11565
+ }
11566
+ };
11567
+
11568
+ // src/client/hooks/requirements/useRequirementsChecklistViewModel.ts
11569
11569
  var DEFAULT_LABELS = {
11570
11570
  kyc_approved: "KYC Verification",
11571
11571
  external_wallet: "External Wallet",
@@ -11880,7 +11880,7 @@ function toVerificationUi(verifyingRequirementId, statusById, identityVerificati
11880
11880
  };
11881
11881
  }
11882
11882
 
11883
- // src/client/components/requirements/checklist/RequirementsChecklistContainer.tsx
11883
+ // src/client/components/requirements/RequirementsChecklistContainer.tsx
11884
11884
  import { Fragment as Fragment10, jsx as jsx67, jsxs as jsxs47 } from "react/jsx-runtime";
11885
11885
  function RequirementsChecklistContainer({
11886
11886
  loading,
@@ -11946,7 +11946,7 @@ function RequirementsChecklistContainer({
11946
11946
  ] });
11947
11947
  }
11948
11948
 
11949
- // src/client/core/observability/pino-client-logger.ts
11949
+ // src/client/core/shared/observability/pino-client-logger.ts
11950
11950
  import { pino } from "pino";
11951
11951
  function pinoClientLogger(options) {
11952
11952
  return loggerOverPino(