@agg-build/ui 2.4.3 → 2.4.5

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 (38) hide show
  1. package/dist/{chunk-GLVLCXIM.mjs → chunk-CXSIXL7M.mjs} +29 -35
  2. package/dist/{chunk-PHAEFHBM.mjs → chunk-GWRFSQQK.mjs} +70 -17
  3. package/dist/{chunk-PHRYWSNV.mjs → chunk-I4X5UNCT.mjs} +307 -240
  4. package/dist/{chunk-3PSIO77N.mjs → chunk-JVRTJQPZ.mjs} +1 -1
  5. package/dist/{chunk-QDNG5UKJ.mjs → chunk-P5CVJQPW.mjs} +288 -291
  6. package/dist/{chunk-WZ55ERDO.mjs → chunk-PTNFXXOV.mjs} +50 -11
  7. package/dist/{chunk-STL4ZHLP.mjs → chunk-UH3DUTMG.mjs} +140 -115
  8. package/dist/events.js +440 -305
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +840 -666
  11. package/dist/index.mjs +7 -7
  12. package/dist/modals.js +333 -297
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +558 -381
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +50 -11
  17. package/dist/primitives.mjs +1 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +2597 -2384
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/events/item-details/event-list-item-details.constants.d.mts +1 -1
  23. package/dist/types/events/item-details/event-list-item-details.constants.d.ts +1 -1
  24. package/dist/types/events/item-details/settlement-summary.d.mts +1 -1
  25. package/dist/types/events/item-details/settlement-summary.d.ts +1 -1
  26. package/dist/types/onboarding/index.d.mts +1 -1
  27. package/dist/types/onboarding/index.d.ts +1 -1
  28. package/dist/types/onboarding/steps/connect-accounts.d.mts +1 -1
  29. package/dist/types/onboarding/steps/connect-accounts.d.ts +1 -1
  30. package/dist/types/primitives/icon/icon.constants.d.mts +1 -0
  31. package/dist/types/primitives/icon/icon.constants.d.ts +1 -0
  32. package/dist/types/shared/use-horizontal-scroll-state.d.mts +3 -0
  33. package/dist/types/shared/use-horizontal-scroll-state.d.ts +3 -0
  34. package/dist/types/trading/place-order/index.place-order.utils.d.mts +1 -0
  35. package/dist/types/trading/place-order/index.place-order.utils.d.ts +1 -0
  36. package/dist/types/trading/settlement/index.d.mts +1 -1
  37. package/dist/types/trading/settlement/index.d.ts +1 -1
  38. package/package.json +2 -2
package/dist/modals.js CHANGED
@@ -1213,6 +1213,12 @@ var iconSizeClasses = {
1213
1213
  medium: "h-6 w-6",
1214
1214
  large: "h-8 w-8"
1215
1215
  };
1216
+ var iconSizePixels = {
1217
+ xs: 12,
1218
+ small: 16,
1219
+ medium: 24,
1220
+ large: 32
1221
+ };
1216
1222
 
1217
1223
  // src/primitives/button/button.constants.ts
1218
1224
  var sizeClasses2 = {
@@ -4115,6 +4121,8 @@ var Icon = (_a) => {
4115
4121
  __spreadValues({
4116
4122
  color,
4117
4123
  className: cn("group/agg-icon", resolvedClassName),
4124
+ width: iconSizePixels[size],
4125
+ height: iconSizePixels[size],
4118
4126
  style: resolvedStyle
4119
4127
  }, props)
4120
4128
  );
@@ -7015,7 +7023,11 @@ var ONBOARDING_STEPS = {
7015
7023
  PROFILE_SETUP: 1,
7016
7024
  CONNECT_ACCOUNTS: 2
7017
7025
  };
7018
- var ONCHAIN_VENUES = [import_sdk10.Venue.polymarket, import_sdk10.Venue.opinion, import_sdk10.Venue.predict];
7026
+ var ONCHAIN_VENUES = [
7027
+ import_sdk10.Venue.polymarket,
7028
+ import_sdk10.Venue.opinion,
7029
+ import_sdk10.Venue.predict
7030
+ ].filter(import_sdk10.isVenueActive);
7019
7031
 
7020
7032
  // src/onboarding/steps/how-it-works.tsx
7021
7033
  var import_react9 = require("react");
@@ -7187,14 +7199,23 @@ var import_react11 = require("react");
7187
7199
  var import_react10 = require("react");
7188
7200
  var useHorizontalScrollState = () => {
7189
7201
  const containerRef = (0, import_react10.useRef)(null);
7202
+ const [hasOverflow, setHasOverflow] = (0, import_react10.useState)(false);
7203
+ const [isAtStart, setIsAtStart] = (0, import_react10.useState)(true);
7204
+ const [isAtEnd, setIsAtEnd] = (0, import_react10.useState)(true);
7190
7205
  const [canScrollLeft, setCanScrollLeft] = (0, import_react10.useState)(false);
7191
7206
  const [canScrollRight, setCanScrollRight] = (0, import_react10.useState)(false);
7192
7207
  const update = (0, import_react10.useCallback)(() => {
7193
7208
  const el = containerRef.current;
7194
7209
  if (!el) return;
7195
- const maxScroll = el.scrollWidth - el.clientWidth;
7196
- setCanScrollLeft(el.scrollLeft > 4);
7197
- setCanScrollRight(maxScroll - el.scrollLeft > 4);
7210
+ const epsilon = 2;
7211
+ const nextHasOverflow = el.scrollWidth > el.clientWidth + epsilon;
7212
+ const nextIsAtStart = el.scrollLeft <= epsilon;
7213
+ const nextIsAtEnd = el.scrollLeft + el.clientWidth >= el.scrollWidth - epsilon;
7214
+ setHasOverflow(nextHasOverflow);
7215
+ setIsAtStart(nextIsAtStart);
7216
+ setIsAtEnd(nextIsAtEnd);
7217
+ setCanScrollLeft(nextHasOverflow && !nextIsAtStart);
7218
+ setCanScrollRight(nextHasOverflow && !nextIsAtEnd);
7198
7219
  }, []);
7199
7220
  (0, import_react10.useEffect)(() => {
7200
7221
  const el = containerRef.current;
@@ -7210,7 +7231,15 @@ var useHorizontalScrollState = () => {
7210
7231
  ro.observe(el);
7211
7232
  return () => ro.disconnect();
7212
7233
  }, [update]);
7213
- return { containerRef, canScrollLeft, canScrollRight, update };
7234
+ return {
7235
+ containerRef,
7236
+ hasOverflow,
7237
+ isAtStart,
7238
+ isAtEnd,
7239
+ canScrollLeft,
7240
+ canScrollRight,
7241
+ update
7242
+ };
7214
7243
  };
7215
7244
 
7216
7245
  // src/primitives/tabs/tabs.constants.ts
@@ -7305,6 +7334,9 @@ var Tabs = ({
7305
7334
  });
7306
7335
  const {
7307
7336
  containerRef: tabListRef,
7337
+ hasOverflow,
7338
+ isAtStart,
7339
+ isAtEnd,
7308
7340
  canScrollLeft,
7309
7341
  canScrollRight,
7310
7342
  update: updateScrollState
@@ -7393,7 +7425,7 @@ var Tabs = ({
7393
7425
  "overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
7394
7426
  getMotionClassName(enableAnimations, "scroll-smooth")
7395
7427
  ) : "overflow-x-auto",
7396
- isBarVariant ? "items-start rounded-agg-lg border border-agg-separator p-1.5" : "h-15 border-b border-agg-separator -mb-[1px]",
7428
+ isBarVariant ? "items-start rounded-agg-lg border border-agg-separator p-1.5" : "h-14 md:h-15 border-b border-agg-separator -mb-[1px]",
7397
7429
  shouldUseOverflowScroll && "select-none",
7398
7430
  shouldUseOverflowScroll && !isBarVariant && "snap-x snap-mandatory",
7399
7431
  shouldUseOverflowScroll && (isDraggingTabs ? "cursor-grabbing" : "cursor-grab")
@@ -7551,7 +7583,10 @@ var Tabs = ({
7551
7583
  left: Math.max(0, nextScrollLeft),
7552
7584
  behavior: getScrollBehavior(enableAnimations)
7553
7585
  });
7554
- }, [enableAnimations, renderedItems, shouldUseOverflowScroll, value]);
7586
+ requestAnimationFrame(() => {
7587
+ updateScrollState();
7588
+ });
7589
+ }, [enableAnimations, renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
7555
7590
  if (shouldUseOverflowSelect) {
7556
7591
  return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: cn("group/agg-tabs w-full", className, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
7557
7592
  Select,
@@ -7590,6 +7625,13 @@ var Tabs = ({
7590
7625
  onPointerUp: handleEndTabListDrag,
7591
7626
  onWheel: handleTabListWheel,
7592
7627
  children: [
7628
+ shouldUseOverflowScroll && !isBarVariant && hasOverflow ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
7629
+ "span",
7630
+ {
7631
+ "aria-hidden": true,
7632
+ className: "agg-tab-scroll-start-spacer h-full w-4 shrink-0 snap-start"
7633
+ }
7634
+ ) : null,
7593
7635
  renderedItems.map((item, index) => {
7594
7636
  var _a;
7595
7637
  const isActive = item.value === value;
@@ -7624,6 +7666,7 @@ var Tabs = ({
7624
7666
  isDisabled: !!item.disabled,
7625
7667
  size
7626
7668
  }),
7669
+ !isBarVariant && (size === "s" ? "px-3 md:px-4" : "h-14 px-3 md:h-15 md:px-4"),
7627
7670
  shouldUseOverflowScroll && !isBarVariant && "snap-start",
7628
7671
  classNames == null ? void 0 : classNames.tabTrigger
7629
7672
  ),
@@ -7673,9 +7716,9 @@ var Tabs = ({
7673
7716
  "aria-hidden": true,
7674
7717
  className: cn(
7675
7718
  "agg-tab-scroll-start",
7676
- "pointer-events-none absolute top-0 bottom-0 left-0 z-10 w-12 md:w-18 bg-linear-to-r from-agg-secondary via-agg-secondary to-transparent",
7719
+ "pointer-events-none absolute inset-y-0 left-0 z-10 w-6 md:w-[60px] bg-linear-to-r from-agg-secondary to-transparent",
7677
7720
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
7678
- canScrollLeft ? "opacity-100" : "opacity-0"
7721
+ hasOverflow && canScrollLeft && !isAtStart ? "opacity-100" : "opacity-0"
7679
7722
  )
7680
7723
  }
7681
7724
  ),
@@ -7685,9 +7728,9 @@ var Tabs = ({
7685
7728
  "aria-hidden": true,
7686
7729
  className: cn(
7687
7730
  "agg-tab-scroll-end",
7688
- "pointer-events-none absolute top-0 right-0 bottom-0 z-10 w-12 md:w-18 bg-linear-to-l from-agg-secondary via-agg-secondary to-transparent",
7731
+ "pointer-events-none absolute inset-y-0 right-0 z-10 w-6 md:w-[60px] bg-linear-to-l from-agg-secondary to-transparent",
7689
7732
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
7690
- canScrollRight ? "opacity-100" : "opacity-0"
7733
+ hasOverflow && canScrollRight && !isAtEnd ? "opacity-100" : "opacity-0"
7691
7734
  )
7692
7735
  }
7693
7736
  )
@@ -7892,7 +7935,6 @@ var ProfileSetupStep = ({ onContinue }) => {
7892
7935
  ProfileSetupStep.displayName = "ProfileSetupStep";
7893
7936
 
7894
7937
  // src/onboarding/steps/connect-accounts.tsx
7895
- var import_sdk11 = require("@agg-build/sdk");
7896
7938
  var import_hooks34 = require("@agg-build/hooks");
7897
7939
  var import_jsx_runtime123 = require("react/jsx-runtime");
7898
7940
  var OnchainVenueLogos = () => {
@@ -7963,51 +8005,27 @@ var VenueCard = ({
7963
8005
  };
7964
8006
  var ConnectAccountsStep = ({
7965
8007
  onConnectOnchain,
7966
- onConnectKalshi,
7967
8008
  onContinue,
7968
- connectedOnchain = false,
7969
- connectedKalshi = false
8009
+ connectedOnchain = false
7970
8010
  }) => {
7971
8011
  const labels = (0, import_hooks34.useLabels)();
7972
- const canContinue = connectedOnchain || connectedKalshi;
8012
+ const canContinue = connectedOnchain;
7973
8013
  return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col gap-6", children: [
7974
8014
  /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
7975
- /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col gap-4", children: [
7976
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
7977
- VenueCard,
7978
- {
7979
- logos: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(OnchainVenueLogos, {}),
7980
- title: labels.onboarding.connectAccounts.onchainTitle,
7981
- mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(
7982
- ONCHAIN_VENUES.length - 1
7983
- ),
7984
- description: labels.onboarding.connectAccounts.onchainDescription,
7985
- mobileDescription: labels.onboarding.connectAccounts.onchainMobileDescription,
7986
- onConnect: onConnectOnchain,
7987
- connected: connectedOnchain
7988
- }
7989
- ),
7990
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
7991
- VenueCard,
7992
- {
7993
- logos: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "sm:flex sm:w-14 sm:items-center sm:justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
7994
- VenueLogo,
7995
- {
7996
- venue: import_sdk11.Venue.kalshi,
7997
- variant: "logo",
7998
- size: "large",
7999
- className: "h-6 w-6 sm:h-9 sm:w-9"
8000
- }
8001
- ) }),
8002
- title: labels.onboarding.connectAccounts.kalshiTitle,
8003
- mobileTitle: labels.onboarding.connectAccounts.kalshiMobileTitle,
8004
- description: labels.onboarding.connectAccounts.kalshiDescription,
8005
- mobileDescription: labels.onboarding.connectAccounts.kalshiMobileDescription,
8006
- onConnect: onConnectKalshi,
8007
- connected: connectedKalshi
8008
- }
8009
- )
8010
- ] }),
8015
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
8016
+ VenueCard,
8017
+ {
8018
+ logos: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(OnchainVenueLogos, {}),
8019
+ title: labels.onboarding.connectAccounts.onchainTitle,
8020
+ mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(
8021
+ ONCHAIN_VENUES.length - 1
8022
+ ),
8023
+ description: labels.onboarding.connectAccounts.onchainDescription,
8024
+ mobileDescription: labels.onboarding.connectAccounts.onchainMobileDescription,
8025
+ onConnect: onConnectOnchain,
8026
+ connected: connectedOnchain
8027
+ }
8028
+ ) }),
8011
8029
  /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
8012
8030
  Button,
8013
8031
  {
@@ -8023,27 +8041,135 @@ var ConnectAccountsStep = ({
8023
8041
  };
8024
8042
  ConnectAccountsStep.displayName = "ConnectAccountsStep";
8025
8043
 
8026
- // src/onboarding/steps/connect-kalshi-modal.tsx
8027
- var import_sdk12 = require("@agg-build/sdk");
8044
+ // src/onboarding/steps/connect-onchain-modal.tsx
8028
8045
  var import_react14 = require("react");
8029
8046
  var import_hooks35 = require("@agg-build/hooks");
8030
8047
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
8031
8048
  var import_jsx_runtime124 = require("react/jsx-runtime");
8032
- var ConnectKalshiModal = ({
8049
+ var ConnectOnchainModal = ({
8033
8050
  open,
8034
8051
  onOpenChange,
8035
- onVerify
8052
+ onConnect
8036
8053
  }) => {
8037
8054
  const labels = (0, import_hooks35.useLabels)();
8038
- const [apiKeyId, setApiKeyId] = (0, import_react14.useState)("");
8039
- const [privateKey, setPrivateKey] = (0, import_react14.useState)("");
8040
- const [verifying, setVerifying] = (0, import_react14.useState)(false);
8055
+ const [connecting, setConnecting] = (0, import_react14.useState)(false);
8041
8056
  const [error, setError] = (0, import_react14.useState)();
8042
- const canVerify = apiKeyId.trim().length > 0 && privateKey.trim().length > 0;
8043
8057
  const handleCancel = (0, import_react14.useCallback)(() => {
8044
8058
  onOpenChange(false);
8045
8059
  }, [onOpenChange]);
8046
- const handleVerify = (0, import_react14.useCallback)(() => __async(null, null, function* () {
8060
+ const handleConnect = (0, import_react14.useCallback)(() => __async(null, null, function* () {
8061
+ if (connecting) return;
8062
+ setConnecting(true);
8063
+ setError(void 0);
8064
+ try {
8065
+ yield onConnect();
8066
+ onOpenChange(false);
8067
+ } catch (err) {
8068
+ setError(
8069
+ err instanceof Error ? err.message : labels.onboarding.connectOnchainModal.fallbackError
8070
+ );
8071
+ } finally {
8072
+ setConnecting(false);
8073
+ }
8074
+ }), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
8075
+ const handleOpenChange = (0, import_react14.useCallback)(
8076
+ (value) => {
8077
+ if (value) {
8078
+ setError(void 0);
8079
+ setConnecting(false);
8080
+ }
8081
+ onOpenChange(value);
8082
+ },
8083
+ [onOpenChange]
8084
+ );
8085
+ return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
8086
+ Modal.Container,
8087
+ {
8088
+ maxWidth: "600px",
8089
+ "aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
8090
+ classNames: { container: "!rounded-agg-lg" },
8091
+ children: [
8092
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Dialog2.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
8093
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8094
+ Modal.Header,
8095
+ {
8096
+ hideClose: false,
8097
+ hideBorder: true,
8098
+ classNames: {
8099
+ root: "!min-h-0",
8100
+ container: "!py-[18px] !px-8"
8101
+ }
8102
+ }
8103
+ ),
8104
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
8105
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
8106
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
8107
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
8108
+ ] }),
8109
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
8110
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
8111
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center gap-[6px]", children: [
8112
+ index > 0 && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
8113
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(VenueLogo, { venue, size: "medium" }),
8114
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
8115
+ ] }, venue)) })
8116
+ ] }),
8117
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-6 items-center", children: [
8118
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-3 items-center", children: [
8119
+ error ? /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center gap-2", children: [
8120
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
8121
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
8122
+ ] }) : null,
8123
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8124
+ Button,
8125
+ {
8126
+ variant: "primary",
8127
+ size: "large",
8128
+ onClick: handleConnect,
8129
+ isLoading: connecting,
8130
+ children: labels.onboarding.connectOnchainModal.connect
8131
+ }
8132
+ )
8133
+ ] }),
8134
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8135
+ Button,
8136
+ {
8137
+ variant: "tertiary",
8138
+ size: "medium",
8139
+ className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
8140
+ onClick: handleCancel,
8141
+ children: labels.onboarding.connectOnchainModal.cancel
8142
+ }
8143
+ )
8144
+ ] })
8145
+ ] }) })
8146
+ ]
8147
+ }
8148
+ ) });
8149
+ };
8150
+ ConnectOnchainModal.displayName = "ConnectOnchainModal";
8151
+
8152
+ // src/onboarding/steps/connect-kalshi-modal.tsx
8153
+ var import_sdk11 = require("@agg-build/sdk");
8154
+ var import_react15 = require("react");
8155
+ var import_hooks36 = require("@agg-build/hooks");
8156
+ var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
8157
+ var import_jsx_runtime125 = require("react/jsx-runtime");
8158
+ var ConnectKalshiModal = ({
8159
+ open,
8160
+ onOpenChange,
8161
+ onVerify
8162
+ }) => {
8163
+ const labels = (0, import_hooks36.useLabels)();
8164
+ const [apiKeyId, setApiKeyId] = (0, import_react15.useState)("");
8165
+ const [privateKey, setPrivateKey] = (0, import_react15.useState)("");
8166
+ const [verifying, setVerifying] = (0, import_react15.useState)(false);
8167
+ const [error, setError] = (0, import_react15.useState)();
8168
+ const canVerify = apiKeyId.trim().length > 0 && privateKey.trim().length > 0;
8169
+ const handleCancel = (0, import_react15.useCallback)(() => {
8170
+ onOpenChange(false);
8171
+ }, [onOpenChange]);
8172
+ const handleVerify = (0, import_react15.useCallback)(() => __async(null, null, function* () {
8047
8173
  if (!canVerify || verifying) return;
8048
8174
  setVerifying(true);
8049
8175
  setError(void 0);
@@ -8072,7 +8198,7 @@ var ConnectKalshiModal = ({
8072
8198
  privateKey,
8073
8199
  verifying
8074
8200
  ]);
8075
- const handleOpenChange = (0, import_react14.useCallback)(
8201
+ const handleOpenChange = (0, import_react15.useCallback)(
8076
8202
  (value) => {
8077
8203
  if (value) {
8078
8204
  setApiKeyId("");
@@ -8084,15 +8210,15 @@ var ConnectKalshiModal = ({
8084
8210
  },
8085
8211
  [onOpenChange]
8086
8212
  );
8087
- return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
8213
+ return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
8088
8214
  Modal.Container,
8089
8215
  {
8090
8216
  maxWidth: "600px",
8091
8217
  "aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
8092
8218
  classNames: { container: "!rounded-agg-lg" },
8093
8219
  children: [
8094
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Dialog2.Title, { className: "sr-only", children: labels.onboarding.connectKalshiModal.title }),
8095
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8220
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Dialog3.Title, { className: "sr-only", children: labels.onboarding.connectKalshiModal.title }),
8221
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8096
8222
  Modal.Header,
8097
8223
  {
8098
8224
  hideClose: false,
@@ -8103,64 +8229,64 @@ var ConnectKalshiModal = ({
8103
8229
  }
8104
8230
  }
8105
8231
  ),
8106
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
8107
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8232
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
8233
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8108
8234
  VenueLogo,
8109
8235
  {
8110
- venue: import_sdk12.Venue.kalshi,
8236
+ venue: import_sdk11.Venue.kalshi,
8111
8237
  variant: "logo",
8112
8238
  size: "large",
8113
8239
  className: "h-[60px] w-[60px]"
8114
8240
  }
8115
8241
  ),
8116
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
8117
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
8118
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.description })
8242
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
8243
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
8244
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.description })
8119
8245
  ] }),
8120
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
8121
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
8122
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-1", children: [
8123
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
8124
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
8246
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
8247
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
8248
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-1", children: [
8249
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
8250
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
8125
8251
  ] }),
8126
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "space-y-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
8127
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
8128
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("p", { children: [
8252
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "space-y-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
8253
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
8254
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("p", { children: [
8129
8255
  labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
8130
8256
  " ",
8131
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
8257
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
8132
8258
  labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
8133
8259
  " ",
8134
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "text-agg-foreground underline", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl })
8260
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "text-agg-foreground underline", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl })
8135
8261
  ] }),
8136
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("p", { children: [
8262
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("p", { children: [
8137
8263
  labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
8138
8264
  " ",
8139
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
8265
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
8140
8266
  labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
8141
8267
  ] }),
8142
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("p", { children: [
8268
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("p", { children: [
8143
8269
  labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
8144
8270
  " ",
8145
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
8271
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
8146
8272
  labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
8147
8273
  ] }),
8148
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
8274
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
8149
8275
  ] }),
8150
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
8276
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
8151
8277
  labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
8152
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("br", {}),
8278
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("br", {}),
8153
8279
  labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
8154
8280
  ] })
8155
8281
  ] }),
8156
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
8157
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-1", children: [
8158
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
8159
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
8282
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
8283
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-1", children: [
8284
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
8285
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
8160
8286
  ] }),
8161
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
8162
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-2", children: [
8163
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8287
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
8288
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-2", children: [
8289
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8164
8290
  "label",
8165
8291
  {
8166
8292
  htmlFor: "kalshi-api-key-id",
@@ -8168,7 +8294,7 @@ var ConnectKalshiModal = ({
8168
8294
  children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
8169
8295
  }
8170
8296
  ),
8171
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8297
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8172
8298
  "input",
8173
8299
  {
8174
8300
  id: "kalshi-api-key-id",
@@ -8188,8 +8314,8 @@ var ConnectKalshiModal = ({
8188
8314
  }
8189
8315
  )
8190
8316
  ] }),
8191
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-2", children: [
8192
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8317
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-2", children: [
8318
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8193
8319
  "label",
8194
8320
  {
8195
8321
  htmlFor: "kalshi-private-key",
@@ -8197,7 +8323,7 @@ var ConnectKalshiModal = ({
8197
8323
  children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
8198
8324
  }
8199
8325
  ),
8200
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8326
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8201
8327
  "textarea",
8202
8328
  {
8203
8329
  id: "kalshi-private-key",
@@ -8219,42 +8345,42 @@ var ConnectKalshiModal = ({
8219
8345
  ] })
8220
8346
  ] })
8221
8347
  ] }),
8222
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
8223
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
8224
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center gap-3", children: [
8225
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
8348
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
8349
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
8350
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex items-center gap-3", children: [
8351
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
8226
8352
  "a",
8227
8353
  {
8228
8354
  href: "#",
8229
8355
  className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
8230
8356
  children: [
8231
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(DocumentIcon, { className: "h-4 w-4" }),
8357
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(DocumentIcon, { className: "h-4 w-4" }),
8232
8358
  labels.onboarding.connectKalshiModal.help.docsLinkLabel
8233
8359
  ]
8234
8360
  }
8235
8361
  ),
8236
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "h-3 w-px bg-agg-separator" }),
8237
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
8362
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "h-3 w-px bg-agg-separator" }),
8363
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
8238
8364
  "a",
8239
8365
  {
8240
8366
  href: "#",
8241
8367
  className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
8242
8368
  children: [
8243
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(PlaySquareIcon, { className: "h-4 w-4" }),
8369
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(PlaySquareIcon, { className: "h-4 w-4" }),
8244
8370
  labels.onboarding.connectKalshiModal.help.tutorialLinkLabel
8245
8371
  ]
8246
8372
  }
8247
8373
  )
8248
8374
  ] })
8249
8375
  ] }),
8250
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-5 items-center", children: [
8251
- error ? /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center gap-2", children: [
8252
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
8253
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
8376
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-5 items-center", children: [
8377
+ error ? /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex items-center gap-2", children: [
8378
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
8379
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
8254
8380
  ] }) : null,
8255
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center gap-3 justify-center", children: [
8256
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, children: labels.onboarding.connectKalshiModal.actions.cancel }),
8257
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8381
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex items-center gap-3 justify-center", children: [
8382
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, children: labels.onboarding.connectKalshiModal.actions.cancel }),
8383
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8258
8384
  Button,
8259
8385
  {
8260
8386
  variant: "primary",
@@ -8274,114 +8400,6 @@ var ConnectKalshiModal = ({
8274
8400
  };
8275
8401
  ConnectKalshiModal.displayName = "ConnectKalshiModal";
8276
8402
 
8277
- // src/onboarding/steps/connect-onchain-modal.tsx
8278
- var import_react15 = require("react");
8279
- var import_hooks36 = require("@agg-build/hooks");
8280
- var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
8281
- var import_jsx_runtime125 = require("react/jsx-runtime");
8282
- var ConnectOnchainModal = ({
8283
- open,
8284
- onOpenChange,
8285
- onConnect
8286
- }) => {
8287
- const labels = (0, import_hooks36.useLabels)();
8288
- const [connecting, setConnecting] = (0, import_react15.useState)(false);
8289
- const [error, setError] = (0, import_react15.useState)();
8290
- const handleCancel = (0, import_react15.useCallback)(() => {
8291
- onOpenChange(false);
8292
- }, [onOpenChange]);
8293
- const handleConnect = (0, import_react15.useCallback)(() => __async(null, null, function* () {
8294
- if (connecting) return;
8295
- setConnecting(true);
8296
- setError(void 0);
8297
- try {
8298
- yield onConnect();
8299
- onOpenChange(false);
8300
- } catch (err) {
8301
- setError(
8302
- err instanceof Error ? err.message : labels.onboarding.connectOnchainModal.fallbackError
8303
- );
8304
- } finally {
8305
- setConnecting(false);
8306
- }
8307
- }), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
8308
- const handleOpenChange = (0, import_react15.useCallback)(
8309
- (value) => {
8310
- if (value) {
8311
- setError(void 0);
8312
- setConnecting(false);
8313
- }
8314
- onOpenChange(value);
8315
- },
8316
- [onOpenChange]
8317
- );
8318
- return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
8319
- Modal.Container,
8320
- {
8321
- maxWidth: "600px",
8322
- "aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
8323
- classNames: { container: "!rounded-agg-lg" },
8324
- children: [
8325
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Dialog3.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
8326
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8327
- Modal.Header,
8328
- {
8329
- hideClose: false,
8330
- hideBorder: true,
8331
- classNames: {
8332
- root: "!min-h-0",
8333
- container: "!py-[18px] !px-8"
8334
- }
8335
- }
8336
- ),
8337
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
8338
- /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
8339
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
8340
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
8341
- ] }),
8342
- /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
8343
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
8344
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex items-center gap-[6px]", children: [
8345
- index > 0 && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
8346
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(VenueLogo, { venue, size: "medium" }),
8347
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
8348
- ] }, venue)) })
8349
- ] }),
8350
- /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-6 items-center", children: [
8351
- /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col gap-3 items-center", children: [
8352
- error ? /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex items-center gap-2", children: [
8353
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
8354
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
8355
- ] }) : null,
8356
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8357
- Button,
8358
- {
8359
- variant: "primary",
8360
- size: "large",
8361
- onClick: handleConnect,
8362
- isLoading: connecting,
8363
- children: labels.onboarding.connectOnchainModal.connect
8364
- }
8365
- )
8366
- ] }),
8367
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
8368
- Button,
8369
- {
8370
- variant: "tertiary",
8371
- size: "medium",
8372
- className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
8373
- onClick: handleCancel,
8374
- children: labels.onboarding.connectOnchainModal.cancel
8375
- }
8376
- )
8377
- ] })
8378
- ] }) })
8379
- ]
8380
- }
8381
- ) });
8382
- };
8383
- ConnectOnchainModal.displayName = "ConnectOnchainModal";
8384
-
8385
8403
  // src/onboarding/index.tsx
8386
8404
  var import_jsx_runtime126 = require("react/jsx-runtime");
8387
8405
  var OnboardingModal = ({
@@ -8389,11 +8407,9 @@ var OnboardingModal = ({
8389
8407
  onOpenChange,
8390
8408
  onProfileSubmit,
8391
8409
  onConnectOnchain,
8392
- onConnectKalshi,
8393
8410
  onComplete,
8394
8411
  howItWorksIcons,
8395
- connectedOnchain = false,
8396
- connectedKalshi = false
8412
+ connectedOnchain = false
8397
8413
  }) => {
8398
8414
  var _a;
8399
8415
  const labels = (0, import_hooks37.useLabels)();
@@ -8404,14 +8420,11 @@ var OnboardingModal = ({
8404
8420
  [ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
8405
8421
  };
8406
8422
  const resolvedTitle = (_a = stepLabels[step]) != null ? _a : labels.onboarding.modal.title;
8407
- const [kalshiModalOpen, setKalshiModalOpen] = (0, import_react16.useState)(false);
8408
- const [kalshiConnected, setKalshiConnected] = (0, import_react16.useState)(false);
8409
8423
  const [onchainModalOpen, setOnchainModalOpen] = (0, import_react16.useState)(false);
8410
8424
  const [onchainConnected, setOnchainConnected] = (0, import_react16.useState)(false);
8411
8425
  (0, import_react16.useEffect)(() => {
8412
8426
  if (open) {
8413
8427
  setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
8414
- setKalshiConnected(false);
8415
8428
  setOnchainConnected(false);
8416
8429
  }
8417
8430
  }, [open]);
@@ -8435,16 +8448,6 @@ var OnboardingModal = ({
8435
8448
  yield onConnectOnchain == null ? void 0 : onConnectOnchain();
8436
8449
  setOnchainConnected(true);
8437
8450
  }), [onConnectOnchain]);
8438
- const handleOpenKalshiModal = (0, import_react16.useCallback)(() => {
8439
- setKalshiModalOpen(true);
8440
- }, []);
8441
- const handleKalshiVerify = (0, import_react16.useCallback)(
8442
- (credentials) => __async(null, null, function* () {
8443
- yield onConnectKalshi == null ? void 0 : onConnectKalshi(credentials);
8444
- setKalshiConnected(true);
8445
- }),
8446
- [onConnectKalshi]
8447
- );
8448
8451
  return /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(import_jsx_runtime126.Fragment, { children: [
8449
8452
  /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(
8450
8453
  Modal.Container,
@@ -8461,10 +8464,8 @@ var OnboardingModal = ({
8461
8464
  ConnectAccountsStep,
8462
8465
  {
8463
8466
  onConnectOnchain: handleOpenOnchainModal,
8464
- onConnectKalshi: handleOpenKalshiModal,
8465
8467
  onContinue: handleConnectContinue,
8466
- connectedOnchain: connectedOnchain || onchainConnected,
8467
- connectedKalshi: connectedKalshi || kalshiConnected
8468
+ connectedOnchain: connectedOnchain || onchainConnected
8468
8469
  }
8469
8470
  )
8470
8471
  ] })
@@ -8478,14 +8479,6 @@ var OnboardingModal = ({
8478
8479
  onOpenChange: setOnchainModalOpen,
8479
8480
  onConnect: handleOnchainConnect
8480
8481
  }
8481
- ),
8482
- /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
8483
- ConnectKalshiModal,
8484
- {
8485
- open: kalshiModalOpen,
8486
- onOpenChange: setKalshiModalOpen,
8487
- onVerify: handleKalshiVerify
8488
- }
8489
8482
  )
8490
8483
  ] });
8491
8484
  };
@@ -8944,7 +8937,7 @@ var ProfileModal = ({
8944
8937
  }) => {
8945
8938
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
8946
8939
  const client = (0, import_hooks40.useAggClient)();
8947
- const { user, startAuth } = (0, import_hooks40.useAggAuthState)();
8940
+ const { user } = (0, import_hooks40.useAggAuthState)();
8948
8941
  const toastCtx = useOptionalToast();
8949
8942
  const [activeTab, setActiveTab] = (0, import_react19.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
8950
8943
  const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
@@ -9095,71 +9088,114 @@ var ProfileModal = ({
9095
9088
  if (typeof window === "undefined") return;
9096
9089
  ((_a2 = window.top) != null ? _a2 : window).location.assign(url);
9097
9090
  };
9091
+ const surfaceError = (0, import_react19.useCallback)(
9092
+ (err, title) => {
9093
+ const message = (err == null ? void 0 : err.message) || "Something went wrong. Please try again.";
9094
+ if (toastCtx) {
9095
+ toastCtx.toast(message, { tone: "error", title });
9096
+ } else {
9097
+ console.error(`[ProfileModal] ${title}:`, message);
9098
+ }
9099
+ },
9100
+ [toastCtx]
9101
+ );
9098
9102
  const handleConnectTwitter = (0, import_react19.useCallback)(() => __async(null, null, function* () {
9099
- const result = yield startAuth({
9100
- provider: "twitter",
9101
- redirectUrl: resolveRedirectUrl()
9102
- });
9103
- onConnectTwitter == null ? void 0 : onConnectTwitter();
9104
- if (result.type === "redirect") {
9105
- navigateTopWindow(result.url);
9103
+ try {
9104
+ const result = yield client.linkAccount({
9105
+ provider: "twitter",
9106
+ redirectUrl: resolveRedirectUrl()
9107
+ });
9108
+ onConnectTwitter == null ? void 0 : onConnectTwitter();
9109
+ if (result.type === "redirect") {
9110
+ navigateTopWindow(result.url);
9111
+ }
9112
+ } catch (err) {
9113
+ surfaceError(err, "Could not connect X (Twitter)");
9106
9114
  }
9107
- }), [onConnectTwitter, startAuth]);
9115
+ }), [client, onConnectTwitter, surfaceError]);
9108
9116
  const handleConnectGoogle = (0, import_react19.useCallback)(() => __async(null, null, function* () {
9109
- const result = yield startAuth({
9110
- provider: "google",
9111
- redirectUrl: resolveRedirectUrl()
9112
- });
9113
- onConnectGoogle == null ? void 0 : onConnectGoogle();
9114
- if (result.type === "redirect") {
9115
- navigateTopWindow(result.url);
9117
+ try {
9118
+ const result = yield client.linkAccount({
9119
+ provider: "google",
9120
+ redirectUrl: resolveRedirectUrl()
9121
+ });
9122
+ onConnectGoogle == null ? void 0 : onConnectGoogle();
9123
+ if (result.type === "redirect") {
9124
+ navigateTopWindow(result.url);
9125
+ }
9126
+ } catch (err) {
9127
+ surfaceError(err, "Could not connect Google");
9116
9128
  }
9117
- }), [onConnectGoogle, startAuth]);
9129
+ }), [client, onConnectGoogle, surfaceError]);
9118
9130
  const handleConnectApple = (0, import_react19.useCallback)(() => __async(null, null, function* () {
9119
- const result = yield startAuth({
9120
- provider: "apple",
9121
- redirectUrl: resolveRedirectUrl()
9122
- });
9123
- onConnectApple == null ? void 0 : onConnectApple();
9124
- if (result.type === "redirect") {
9125
- navigateTopWindow(result.url);
9131
+ try {
9132
+ const result = yield client.linkAccount({
9133
+ provider: "apple",
9134
+ redirectUrl: resolveRedirectUrl()
9135
+ });
9136
+ onConnectApple == null ? void 0 : onConnectApple();
9137
+ if (result.type === "redirect") {
9138
+ navigateTopWindow(result.url);
9139
+ }
9140
+ } catch (err) {
9141
+ surfaceError(err, "Could not connect Apple");
9126
9142
  }
9127
- }), [onConnectApple, startAuth]);
9143
+ }), [client, onConnectApple, surfaceError]);
9128
9144
  const handleDisconnectTwitter = (0, import_react19.useCallback)(() => __async(null, null, function* () {
9129
- yield client.disconnectAccount("twitter");
9130
- yield client.getCurrentUser();
9131
- onDisconnectTwitter == null ? void 0 : onDisconnectTwitter();
9132
- }), [client, onDisconnectTwitter]);
9145
+ try {
9146
+ yield client.disconnectAccount("twitter");
9147
+ yield client.getCurrentUser();
9148
+ onDisconnectTwitter == null ? void 0 : onDisconnectTwitter();
9149
+ } catch (err) {
9150
+ surfaceError(err, "Could not disconnect X (Twitter)");
9151
+ }
9152
+ }), [client, onDisconnectTwitter, surfaceError]);
9133
9153
  const handleDisconnectGoogle = (0, import_react19.useCallback)(() => __async(null, null, function* () {
9134
- yield client.disconnectAccount("google");
9135
- yield client.getCurrentUser();
9136
- onDisconnectGoogle == null ? void 0 : onDisconnectGoogle();
9137
- }), [client, onDisconnectGoogle]);
9154
+ try {
9155
+ yield client.disconnectAccount("google");
9156
+ yield client.getCurrentUser();
9157
+ onDisconnectGoogle == null ? void 0 : onDisconnectGoogle();
9158
+ } catch (err) {
9159
+ surfaceError(err, "Could not disconnect Google");
9160
+ }
9161
+ }), [client, onDisconnectGoogle, surfaceError]);
9138
9162
  const handleDisconnectApple = (0, import_react19.useCallback)(() => __async(null, null, function* () {
9139
- yield client.disconnectAccount("apple");
9140
- yield client.getCurrentUser();
9141
- onDisconnectApple == null ? void 0 : onDisconnectApple();
9142
- }), [client, onDisconnectApple]);
9163
+ try {
9164
+ yield client.disconnectAccount("apple");
9165
+ yield client.getCurrentUser();
9166
+ onDisconnectApple == null ? void 0 : onDisconnectApple();
9167
+ } catch (err) {
9168
+ surfaceError(err, "Could not disconnect Apple");
9169
+ }
9170
+ }), [client, onDisconnectApple, surfaceError]);
9143
9171
  const handleConnectEmail = (0, import_react19.useCallback)(() => __async(null, null, function* () {
9144
9172
  var _a2;
9145
9173
  const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
9146
9174
  if (!typedEmail) return;
9147
- yield startAuth({
9148
- provider: "email",
9149
- email: typedEmail,
9150
- redirectUrl: resolveRedirectUrl()
9151
- });
9152
- onConnectEmail == null ? void 0 : onConnectEmail();
9153
- }), [onConnectEmail, startAuth]);
9175
+ try {
9176
+ yield client.linkAccount({
9177
+ provider: "email",
9178
+ email: typedEmail,
9179
+ redirectUrl: resolveRedirectUrl()
9180
+ });
9181
+ onConnectEmail == null ? void 0 : onConnectEmail();
9182
+ } catch (err) {
9183
+ surfaceError(err, "Could not connect email");
9184
+ }
9185
+ }), [client, onConnectEmail, surfaceError]);
9154
9186
  const handleDisconnectWallet = (0, import_react19.useCallback)(
9155
9187
  (wallet) => __async(null, null, function* () {
9156
9188
  const normalizedChain = wallet.chain.toLowerCase();
9157
9189
  const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
9158
- yield client.disconnectAccount(provider);
9159
- yield client.getCurrentUser();
9160
- onDisconnectWallet == null ? void 0 : onDisconnectWallet(wallet);
9190
+ try {
9191
+ yield client.disconnectAccount(provider);
9192
+ yield client.getCurrentUser();
9193
+ onDisconnectWallet == null ? void 0 : onDisconnectWallet(wallet);
9194
+ } catch (err) {
9195
+ surfaceError(err, "Could not disconnect wallet");
9196
+ }
9161
9197
  }),
9162
- [client, onDisconnectWallet]
9198
+ [client, onDisconnectWallet, surfaceError]
9163
9199
  );
9164
9200
  const providerActionMap = (0, import_react19.useMemo)(
9165
9201
  () => ({