@coinlist-co/react 0.1.2 → 0.3.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/RequirementItem-BpkJQep8.d.ts +37 -0
- package/dist/RequirementItem-BvwsFu9e.d.cts +37 -0
- package/dist/{chunk-WFA6X7E2.js → chunk-IADBIDY6.js} +3 -3
- package/dist/chunk-IDCROXPS.js +412 -0
- package/dist/chunk-IDCROXPS.js.map +1 -0
- package/dist/{chunk-6CG7JT7Q.js → chunk-P4DTIPEX.js} +144 -5
- package/dist/chunk-P4DTIPEX.js.map +1 -0
- package/dist/{chunk-DLEKT4T4.js → chunk-V5M7SA3C.js} +47 -4
- package/dist/chunk-V5M7SA3C.js.map +1 -0
- package/dist/client/components/index.cjs +467 -5
- package/dist/client/components/index.cjs.map +1 -1
- package/dist/client/components/index.d.cts +61 -11
- package/dist/client/components/index.d.ts +61 -11
- package/dist/client/components/index.js +268 -240
- package/dist/client/components/index.js.map +1 -1
- package/dist/client/core/index.cjs +146 -4
- package/dist/client/core/index.cjs.map +1 -1
- package/dist/client/core/index.d.cts +2 -2
- package/dist/client/core/index.d.ts +2 -2
- package/dist/client/core/index.js +13 -1
- package/dist/client/hooks/index.cjs +49 -6
- package/dist/client/hooks/index.cjs.map +1 -1
- package/dist/client/hooks/index.d.cts +6 -5
- package/dist/client/hooks/index.d.ts +6 -5
- package/dist/client/hooks/index.js +5 -3
- package/dist/client/index.cjs +244 -10
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +6 -4
- package/dist/client/index.d.ts +6 -4
- package/dist/client/index.js +30 -2
- package/dist/client/styles.css +1 -1
- package/dist/coinlist-client-B_dJkbwB.d.ts +283 -0
- package/dist/coinlist-client-DBKa6j3f.d.cts +283 -0
- package/dist/requirement-CxbdY8l4.d.cts +202 -0
- package/dist/requirement-fJsQ3f9_.d.ts +202 -0
- package/dist/{useCoinListOffers-DIdOb5hB.d.ts → useCoinListOffers-C5lBlzcC.d.ts} +1 -1
- package/dist/{useCoinListOffers-DvJxu6qj.d.cts → useCoinListOffers-CguwXaCX.d.cts} +1 -1
- package/dist/useCoinListRequirements-BECx1cIw.d.ts +31 -0
- package/dist/useCoinListRequirements-CX2gV9gJ.d.cts +31 -0
- package/dist/{useCompleteCoinListOAuth-6Z4DGuiH.d.cts → useCompleteCoinListOAuth-BRhAqD4_.d.cts} +1 -1
- package/dist/{useCompleteCoinListOAuth-C3G1Vsf8.d.ts → useCompleteCoinListOAuth-DEZpHjd6.d.ts} +1 -1
- package/package.json +4 -4
- package/dist/chunk-6CG7JT7Q.js.map +0 -1
- package/dist/chunk-DLEKT4T4.js.map +0 -1
- package/dist/coinlist-client-BiA8a2yU.d.ts +0 -272
- package/dist/coinlist-client-DXKFDGhP.d.cts +0 -272
- package/dist/offer-D6p_Ijme.d.cts +0 -30
- package/dist/offer-DnFEFJw9.d.ts +0 -30
- /package/dist/{chunk-WFA6X7E2.js.map → chunk-IADBIDY6.js.map} +0 -0
|
@@ -21,9 +21,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var components_exports = {};
|
|
22
22
|
__export(components_exports, {
|
|
23
23
|
BaseCoinListSignInCard: () => BaseCoinListSignInCard,
|
|
24
|
+
BaseRequirementsChecklist: () => BaseRequirementsChecklist,
|
|
25
|
+
ChecklistStatus: () => ChecklistStatus,
|
|
24
26
|
CoinListSignInCard: () => CoinListSignInCard,
|
|
25
27
|
OfferCard: () => OfferCard,
|
|
26
|
-
|
|
28
|
+
OfferCardUi: () => OfferCardUi,
|
|
29
|
+
OffersGrid: () => OffersGrid,
|
|
30
|
+
RequirementItem: () => RequirementItem,
|
|
31
|
+
RequirementItemUi: () => RequirementItemUi,
|
|
32
|
+
RequirementStatus: () => RequirementStatus,
|
|
33
|
+
RequirementVariant: () => RequirementVariant,
|
|
34
|
+
RequirementsChecklist: () => RequirementsChecklist
|
|
27
35
|
});
|
|
28
36
|
module.exports = __toCommonJS(components_exports);
|
|
29
37
|
var import_styles = require("../styles.css");
|
|
@@ -456,6 +464,15 @@ var monthYearFormatter = new Intl.DateTimeFormat("en-US", {
|
|
|
456
464
|
month: "short",
|
|
457
465
|
year: "numeric"
|
|
458
466
|
});
|
|
467
|
+
var OfferCardUi = {
|
|
468
|
+
fromDomain: (offer) => ({
|
|
469
|
+
tagline: offer.tagline,
|
|
470
|
+
bannerUrl: offer.bannerUrl,
|
|
471
|
+
logoUrl: offer.logoUrl,
|
|
472
|
+
formattedStartsAt: monthYearFormatter.format(offer.startsAt),
|
|
473
|
+
formattedEndsAt: monthYearFormatter.format(offer.endsAt)
|
|
474
|
+
})
|
|
475
|
+
};
|
|
459
476
|
function OfferCard({
|
|
460
477
|
offer,
|
|
461
478
|
onClick,
|
|
@@ -487,11 +504,11 @@ function OfferCard({
|
|
|
487
504
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-4 grid grid-cols-2 gap-5 border-t border-divider pt-4", children: [
|
|
488
505
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
489
506
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn(typeClasses.subhead, "text-text-secondary"), children: "Starts" }),
|
|
490
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn(typeClasses.label, "text-text-primary"), children:
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn(typeClasses.label, "text-text-primary"), children: offer.formattedStartsAt })
|
|
491
508
|
] }),
|
|
492
509
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
493
510
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn(typeClasses.subhead, "text-text-secondary"), children: "Ends" }),
|
|
494
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn(typeClasses.label, "text-text-primary"), children:
|
|
511
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn(typeClasses.label, "text-text-primary"), children: offer.formattedEndsAt })
|
|
495
512
|
] })
|
|
496
513
|
] })
|
|
497
514
|
] });
|
|
@@ -553,6 +570,47 @@ function useCoinListOffers() {
|
|
|
553
570
|
return { offersState };
|
|
554
571
|
}
|
|
555
572
|
|
|
573
|
+
// src/client/hooks/useCoinListRequirements.ts
|
|
574
|
+
var import_react5 = require("react");
|
|
575
|
+
var LOADING_STATE2 = { type: "LOADING" };
|
|
576
|
+
function useCoinListRequirements(offerId) {
|
|
577
|
+
const { coinlist, isReady } = useCoinList();
|
|
578
|
+
const [requirementsState, setRequirementsState] = (0, import_react5.useState)(LOADING_STATE2);
|
|
579
|
+
const [fetchKey, setFetchKey] = (0, import_react5.useState)(0);
|
|
580
|
+
const refetch = (0, import_react5.useCallback)(() => setFetchKey((k) => k + 1), []);
|
|
581
|
+
(0, import_react5.useEffect)(() => {
|
|
582
|
+
let isCancelled = false;
|
|
583
|
+
if (!isReady) {
|
|
584
|
+
setRequirementsState(LOADING_STATE2);
|
|
585
|
+
return () => {
|
|
586
|
+
isCancelled = true;
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
setRequirementsState(LOADING_STATE2);
|
|
590
|
+
Promise.all([
|
|
591
|
+
coinlist.fetchOfferRequirements(offerId),
|
|
592
|
+
coinlist.fetchRequirementStatuses(offerId)
|
|
593
|
+
]).then(([requirementsByOptionId, statuses]) => {
|
|
594
|
+
if (!isCancelled) {
|
|
595
|
+
setRequirementsState({
|
|
596
|
+
type: "CONTENT",
|
|
597
|
+
requirementsByOptionId,
|
|
598
|
+
statuses
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
}).catch((error) => {
|
|
602
|
+
if (!isCancelled) {
|
|
603
|
+
const reason = error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
|
|
604
|
+
setRequirementsState({ type: "ERROR", reason });
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
return () => {
|
|
608
|
+
isCancelled = true;
|
|
609
|
+
};
|
|
610
|
+
}, [coinlist, isReady, offerId, fetchKey]);
|
|
611
|
+
return { requirementsState, refetch };
|
|
612
|
+
}
|
|
613
|
+
|
|
556
614
|
// src/client/components/offers/OffersGrid.tsx
|
|
557
615
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
558
616
|
var DEFAULT_MAX_COLUMNS = 3;
|
|
@@ -627,7 +685,7 @@ function BaseOffersGrid({
|
|
|
627
685
|
children: offersState.offers.map((offer) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
628
686
|
OfferCard,
|
|
629
687
|
{
|
|
630
|
-
offer,
|
|
688
|
+
offer: OfferCardUi.fromDomain(offer),
|
|
631
689
|
onClick: onOfferClick ? () => onOfferClick(offer) : void 0
|
|
632
690
|
},
|
|
633
691
|
offer.id
|
|
@@ -635,11 +693,415 @@ function BaseOffersGrid({
|
|
|
635
693
|
}
|
|
636
694
|
) });
|
|
637
695
|
}
|
|
696
|
+
|
|
697
|
+
// src/client/components/requirements/RequirementItem.tsx
|
|
698
|
+
var import_lucide_react4 = require("lucide-react");
|
|
699
|
+
|
|
700
|
+
// src/client/components/design-system/StepStatusIcon.tsx
|
|
701
|
+
var import_lucide_react3 = require("lucide-react");
|
|
702
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
703
|
+
var statusConfig = {
|
|
704
|
+
required: {
|
|
705
|
+
Icon: import_lucide_react3.Info,
|
|
706
|
+
colorClass: "text-warning",
|
|
707
|
+
fillClass: "[&_circle]:fill-warning-subtle"
|
|
708
|
+
},
|
|
709
|
+
pending: {
|
|
710
|
+
Icon: import_lucide_react3.Info,
|
|
711
|
+
colorClass: "text-warning",
|
|
712
|
+
fillClass: "[&_circle]:fill-warning-subtle"
|
|
713
|
+
},
|
|
714
|
+
completed: {
|
|
715
|
+
Icon: import_lucide_react3.CircleCheck,
|
|
716
|
+
colorClass: "text-success",
|
|
717
|
+
fillClass: "[&_circle]:fill-success-subtle"
|
|
718
|
+
},
|
|
719
|
+
rejected: {
|
|
720
|
+
Icon: import_lucide_react3.CircleX,
|
|
721
|
+
colorClass: "text-error",
|
|
722
|
+
fillClass: "[&_circle]:fill-error-subtle"
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
function StepStatusIcon({ status, className }) {
|
|
726
|
+
const { Icon, colorClass, fillClass } = statusConfig[status];
|
|
727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
728
|
+
Icon,
|
|
729
|
+
{
|
|
730
|
+
className: cn("h-6 w-6 shrink-0", colorClass, fillClass, className),
|
|
731
|
+
"aria-hidden": "true"
|
|
732
|
+
}
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// src/client/components/requirements/RequirementItem.tsx
|
|
737
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
738
|
+
var RequirementVariant = {
|
|
739
|
+
fromType(type) {
|
|
740
|
+
switch (type) {
|
|
741
|
+
case "external_wallet":
|
|
742
|
+
case "whitelisted_wallet":
|
|
743
|
+
return "wallet";
|
|
744
|
+
default:
|
|
745
|
+
return "verification";
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
var RequirementStatus = {
|
|
750
|
+
fromStatusValue(status) {
|
|
751
|
+
switch (status) {
|
|
752
|
+
case "not_started":
|
|
753
|
+
case "action_needed":
|
|
754
|
+
return "required";
|
|
755
|
+
case "in_progress":
|
|
756
|
+
return "pending";
|
|
757
|
+
case "completed":
|
|
758
|
+
return "completed";
|
|
759
|
+
case "rejected":
|
|
760
|
+
return "rejected";
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
var ChecklistStatus = {
|
|
765
|
+
derive(statuses) {
|
|
766
|
+
if (statuses.some((s) => s.status === "rejected")) return "ineligible";
|
|
767
|
+
if (statuses.every((s) => s.status === "completed")) return "eligible";
|
|
768
|
+
return "inProgress";
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
var RequirementItemUi = {
|
|
772
|
+
fromDomain(req, statusInfo, label, description, walletAddress) {
|
|
773
|
+
return {
|
|
774
|
+
variant: RequirementVariant.fromType(req.type),
|
|
775
|
+
status: statusInfo ? RequirementStatus.fromStatusValue(statusInfo.status) : "required",
|
|
776
|
+
label,
|
|
777
|
+
description,
|
|
778
|
+
walletAddress
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
function VerificationActionZone({
|
|
783
|
+
status,
|
|
784
|
+
onAction,
|
|
785
|
+
onContactSupport
|
|
786
|
+
}) {
|
|
787
|
+
switch (status) {
|
|
788
|
+
case "required":
|
|
789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ClButton, { size: "sm", onClick: onAction, children: "Continue" });
|
|
790
|
+
case "pending":
|
|
791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
792
|
+
AlertBanner,
|
|
793
|
+
{
|
|
794
|
+
variant: "warning",
|
|
795
|
+
content: "Under review. We'll notify you when complete."
|
|
796
|
+
}
|
|
797
|
+
);
|
|
798
|
+
case "completed":
|
|
799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AlertBanner, { variant: "success", content: "Identity verified." });
|
|
800
|
+
case "rejected":
|
|
801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
802
|
+
AlertBanner,
|
|
803
|
+
{
|
|
804
|
+
variant: "error",
|
|
805
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
806
|
+
"Verification rejected.",
|
|
807
|
+
" ",
|
|
808
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
809
|
+
"button",
|
|
810
|
+
{
|
|
811
|
+
type: "button",
|
|
812
|
+
onClick: onContactSupport,
|
|
813
|
+
className: "underline",
|
|
814
|
+
children: "Contact support"
|
|
815
|
+
}
|
|
816
|
+
),
|
|
817
|
+
"."
|
|
818
|
+
] })
|
|
819
|
+
}
|
|
820
|
+
);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
function WalletActionZone({
|
|
824
|
+
status,
|
|
825
|
+
walletAddress,
|
|
826
|
+
onAction
|
|
827
|
+
}) {
|
|
828
|
+
if (status === "completed") {
|
|
829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
830
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ClButton, { size: "sm", variant: "secondary", onClick: onAction, children: "Change wallet" }),
|
|
831
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
832
|
+
AlertBanner,
|
|
833
|
+
{
|
|
834
|
+
variant: "success",
|
|
835
|
+
content: walletAddress ?? "Connected: 0xBa4b...9f2c"
|
|
836
|
+
}
|
|
837
|
+
)
|
|
838
|
+
] });
|
|
839
|
+
}
|
|
840
|
+
if (status === "rejected") {
|
|
841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" }),
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
844
|
+
AlertBanner,
|
|
845
|
+
{
|
|
846
|
+
variant: "error",
|
|
847
|
+
content: "This wallet is not eligible for this sale."
|
|
848
|
+
}
|
|
849
|
+
)
|
|
850
|
+
] });
|
|
851
|
+
}
|
|
852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" });
|
|
853
|
+
}
|
|
854
|
+
function RequirementItem({
|
|
855
|
+
ui,
|
|
856
|
+
expanded = false,
|
|
857
|
+
onToggle,
|
|
858
|
+
className,
|
|
859
|
+
onAction,
|
|
860
|
+
onContactSupport
|
|
861
|
+
}) {
|
|
862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("flex w-full flex-col", className), children: [
|
|
863
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
864
|
+
"button",
|
|
865
|
+
{
|
|
866
|
+
type: "button",
|
|
867
|
+
onClick: onToggle,
|
|
868
|
+
"aria-expanded": expanded,
|
|
869
|
+
className: "flex h-14 w-full cursor-pointer items-center justify-between rounded-2xl px-2 transition-colors hover:bg-surface",
|
|
870
|
+
children: [
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StepStatusIcon, { status: ui.status }),
|
|
873
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
874
|
+
"span",
|
|
875
|
+
{
|
|
876
|
+
className: cn(
|
|
877
|
+
typeClasses.body,
|
|
878
|
+
"whitespace-nowrap font-medium text-text-primary"
|
|
879
|
+
),
|
|
880
|
+
children: ui.label
|
|
881
|
+
}
|
|
882
|
+
)
|
|
883
|
+
] }),
|
|
884
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
885
|
+
import_lucide_react4.ChevronRight,
|
|
886
|
+
{
|
|
887
|
+
className: cn(
|
|
888
|
+
"h-6 w-6 shrink-0 text-text-secondary transition-transform duration-300",
|
|
889
|
+
expanded && "rotate-90"
|
|
890
|
+
),
|
|
891
|
+
"aria-hidden": "true"
|
|
892
|
+
}
|
|
893
|
+
)
|
|
894
|
+
]
|
|
895
|
+
}
|
|
896
|
+
),
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
898
|
+
"div",
|
|
899
|
+
{
|
|
900
|
+
className: cn(
|
|
901
|
+
"grid transition-[grid-template-rows] duration-300 ease-in-out",
|
|
902
|
+
expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
903
|
+
),
|
|
904
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-4 px-2 pb-4", children: [
|
|
905
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: cn(typeClasses.subhead, "text-text-secondary"), children: ui.description }),
|
|
906
|
+
ui.variant === "verification" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
907
|
+
VerificationActionZone,
|
|
908
|
+
{
|
|
909
|
+
status: ui.status,
|
|
910
|
+
onAction,
|
|
911
|
+
onContactSupport
|
|
912
|
+
}
|
|
913
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
914
|
+
WalletActionZone,
|
|
915
|
+
{
|
|
916
|
+
status: ui.status,
|
|
917
|
+
walletAddress: ui.walletAddress,
|
|
918
|
+
onAction
|
|
919
|
+
}
|
|
920
|
+
)
|
|
921
|
+
] }) })
|
|
922
|
+
}
|
|
923
|
+
)
|
|
924
|
+
] });
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// src/client/components/requirements/RequirementsChecklist.tsx
|
|
928
|
+
var import_react6 = require("react");
|
|
929
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
930
|
+
var DEFAULT_LABELS = {
|
|
931
|
+
kyc_approved: "KYC Verification",
|
|
932
|
+
identity_verified: "Identity Verification",
|
|
933
|
+
proof_of_address: "Proof of Address",
|
|
934
|
+
source_of_funds: "Source of Funds",
|
|
935
|
+
external_wallet: "External Wallet",
|
|
936
|
+
whitelisted_wallet: "Whitelisted Wallet",
|
|
937
|
+
jurisdiction: "Jurisdiction Check",
|
|
938
|
+
accreditation: "Accreditation"
|
|
939
|
+
};
|
|
940
|
+
var DEFAULT_DESCRIPTIONS = {
|
|
941
|
+
kyc_approved: "Complete Know Your Customer verification.",
|
|
942
|
+
identity_verified: "Verify your identity.",
|
|
943
|
+
proof_of_address: "Provide proof of your residential address.",
|
|
944
|
+
source_of_funds: "Provide documentation for your source of funds.",
|
|
945
|
+
external_wallet: "Connect an external wallet.",
|
|
946
|
+
whitelisted_wallet: "Connect a whitelisted wallet.",
|
|
947
|
+
jurisdiction: "Confirm your jurisdiction eligibility.",
|
|
948
|
+
accreditation: "Verify your accreditation status."
|
|
949
|
+
};
|
|
950
|
+
function RequirementsChecklist(props) {
|
|
951
|
+
if ("status" in props) {
|
|
952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StaticRequirementsChecklist, { ...props });
|
|
953
|
+
}
|
|
954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DynamicRequirementsChecklist, { ...props });
|
|
955
|
+
}
|
|
956
|
+
function DynamicRequirementsChecklist(props) {
|
|
957
|
+
const { requirementsState } = useCoinListRequirements(props.offerId);
|
|
958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
959
|
+
BaseRequirementsChecklist,
|
|
960
|
+
{
|
|
961
|
+
...props,
|
|
962
|
+
requirementsState
|
|
963
|
+
}
|
|
964
|
+
);
|
|
965
|
+
}
|
|
966
|
+
function StaticRequirementsChecklist({
|
|
967
|
+
title,
|
|
968
|
+
description,
|
|
969
|
+
status,
|
|
970
|
+
onContinue,
|
|
971
|
+
children,
|
|
972
|
+
className
|
|
973
|
+
}) {
|
|
974
|
+
const [expandedIndex, setExpandedIndex] = (0, import_react6.useState)(null);
|
|
975
|
+
const accordionChildren = import_react6.Children.map(children, (child, index) => {
|
|
976
|
+
if (!(0, import_react6.isValidElement)(child)) return child;
|
|
977
|
+
return (0, import_react6.cloneElement)(
|
|
978
|
+
child,
|
|
979
|
+
{
|
|
980
|
+
expanded: expandedIndex === index,
|
|
981
|
+
onToggle: () => setExpandedIndex((prev) => prev === index ? null : index)
|
|
982
|
+
}
|
|
983
|
+
);
|
|
984
|
+
});
|
|
985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("flex w-full flex-col gap-4", className), children: [
|
|
986
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
987
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: cn(typeClasses.h3, "text-text-primary"), children: title }),
|
|
988
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: cn(typeClasses.body, "text-text-secondary"), children: description })
|
|
989
|
+
] }),
|
|
990
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-col divide-y divide-divider", children: accordionChildren }),
|
|
991
|
+
status === "ineligible" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
992
|
+
AlertBanner,
|
|
993
|
+
{
|
|
994
|
+
variant: "error",
|
|
995
|
+
icon: true,
|
|
996
|
+
content: "You are not eligible to participate."
|
|
997
|
+
}
|
|
998
|
+
),
|
|
999
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ClButton, { fullWidth: true, disabled: status !== "eligible", onClick: onContinue, children: "Continue" })
|
|
1000
|
+
] });
|
|
1001
|
+
}
|
|
1002
|
+
function BaseRequirementsChecklist({
|
|
1003
|
+
requirementsState,
|
|
1004
|
+
optionId,
|
|
1005
|
+
title,
|
|
1006
|
+
description,
|
|
1007
|
+
onContinue,
|
|
1008
|
+
onRequirementAction,
|
|
1009
|
+
onContactSupport,
|
|
1010
|
+
getLabel,
|
|
1011
|
+
getDescription,
|
|
1012
|
+
loading,
|
|
1013
|
+
error,
|
|
1014
|
+
className
|
|
1015
|
+
}) {
|
|
1016
|
+
const [expandedIndex, setExpandedIndex] = (0, import_react6.useState)(null);
|
|
1017
|
+
if (requirementsState.type === "LOADING") {
|
|
1018
|
+
if (loading) return loading;
|
|
1019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1020
|
+
"output",
|
|
1021
|
+
{
|
|
1022
|
+
"aria-live": "polite",
|
|
1023
|
+
className: "flex min-h-40 items-center justify-center rounded-2xl border border-border bg-background p-6",
|
|
1024
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: cn(typeClasses.body, "text-text-secondary"), children: "Loading requirements..." })
|
|
1025
|
+
}
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
if (requirementsState.type === "ERROR") {
|
|
1029
|
+
if (error) return error;
|
|
1030
|
+
const errorMessage = requirementsState.reason === "not-authenticated" ? "Sign in to view requirements." : "Unable to load requirements right now. Please try again.";
|
|
1031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1032
|
+
AlertBanner,
|
|
1033
|
+
{
|
|
1034
|
+
variant: "error",
|
|
1035
|
+
icon: true,
|
|
1036
|
+
content: errorMessage,
|
|
1037
|
+
className: "w-full max-w-[28rem]"
|
|
1038
|
+
}
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
const { requirementsByOptionId, statuses } = requirementsState;
|
|
1042
|
+
const requirements = requirementsByOptionId[optionId] ?? [];
|
|
1043
|
+
const requirementIds = new Set(requirements.map((r) => r.id));
|
|
1044
|
+
const optionStatuses = statuses.filter((s) => requirementIds.has(s.id));
|
|
1045
|
+
const statusByRequirementId = new Map(optionStatuses.map((s) => [s.id, s]));
|
|
1046
|
+
const checklistStatus = ChecklistStatus.derive(optionStatuses);
|
|
1047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("flex w-full flex-col gap-4", className), children: [
|
|
1048
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1049
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: cn(typeClasses.h3, "text-text-primary"), children: title }),
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: cn(typeClasses.body, "text-text-secondary"), children: description })
|
|
1051
|
+
] }),
|
|
1052
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-col divide-y divide-divider", children: requirements.map((req, index) => {
|
|
1053
|
+
const statusInfo = statusByRequirementId.get(req.id);
|
|
1054
|
+
const label = getLabel ? getLabel(req) : DEFAULT_LABELS[req.type];
|
|
1055
|
+
const description2 = (getDescription ? getDescription(req) : null) ?? DEFAULT_DESCRIPTIONS[req.type];
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1057
|
+
RequirementItem,
|
|
1058
|
+
{
|
|
1059
|
+
ui: RequirementItemUi.fromDomain(
|
|
1060
|
+
req,
|
|
1061
|
+
statusInfo,
|
|
1062
|
+
label,
|
|
1063
|
+
description2
|
|
1064
|
+
),
|
|
1065
|
+
expanded: expandedIndex === index,
|
|
1066
|
+
onToggle: () => setExpandedIndex((prev) => prev === index ? null : index),
|
|
1067
|
+
onAction: onRequirementAction ? () => onRequirementAction(req) : void 0,
|
|
1068
|
+
onContactSupport: onContactSupport ? () => onContactSupport(req) : void 0
|
|
1069
|
+
},
|
|
1070
|
+
req.id
|
|
1071
|
+
);
|
|
1072
|
+
}) }),
|
|
1073
|
+
checklistStatus === "ineligible" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1074
|
+
AlertBanner,
|
|
1075
|
+
{
|
|
1076
|
+
variant: "error",
|
|
1077
|
+
icon: true,
|
|
1078
|
+
content: "You are not eligible to participate."
|
|
1079
|
+
}
|
|
1080
|
+
),
|
|
1081
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1082
|
+
ClButton,
|
|
1083
|
+
{
|
|
1084
|
+
fullWidth: true,
|
|
1085
|
+
disabled: checklistStatus !== "eligible",
|
|
1086
|
+
onClick: onContinue,
|
|
1087
|
+
children: "Continue"
|
|
1088
|
+
}
|
|
1089
|
+
)
|
|
1090
|
+
] });
|
|
1091
|
+
}
|
|
638
1092
|
// Annotate the CommonJS export names for ESM import in node:
|
|
639
1093
|
0 && (module.exports = {
|
|
640
1094
|
BaseCoinListSignInCard,
|
|
1095
|
+
BaseRequirementsChecklist,
|
|
1096
|
+
ChecklistStatus,
|
|
641
1097
|
CoinListSignInCard,
|
|
642
1098
|
OfferCard,
|
|
643
|
-
|
|
1099
|
+
OfferCardUi,
|
|
1100
|
+
OffersGrid,
|
|
1101
|
+
RequirementItem,
|
|
1102
|
+
RequirementItemUi,
|
|
1103
|
+
RequirementStatus,
|
|
1104
|
+
RequirementVariant,
|
|
1105
|
+
RequirementsChecklist
|
|
644
1106
|
});
|
|
645
1107
|
//# sourceMappingURL=index.cjs.map
|