@crossmint/client-sdk-react-ui 1.6.0 → 1.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossmint/client-sdk-react-ui",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "repository": "https://github.com/Crossmint/crossmint-sdk",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Paella Labs Inc",
@@ -31,11 +31,12 @@
31
31
  "tailwind-merge": "2.4.0",
32
32
  "tailwindcss": "3.4.10",
33
33
  "zod": "3.22.4",
34
- "@crossmint/client-sdk-auth-core": "1.4.0",
34
+ "@crossmint/client-sdk-auth": "0.2.0",
35
35
  "@crossmint/client-sdk-base": "1.2.8",
36
36
  "@crossmint/client-sdk-smart-wallet": "0.1.19",
37
37
  "@crossmint/client-sdk-window": "0.0.10",
38
- "@crossmint/common-sdk-base": "0.2.0"
38
+ "@crossmint/common-sdk-base": "0.2.0",
39
+ "@crossmint/common-sdk-auth": "0.2.0"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@types/lodash.isequal": "4.5.6",
@@ -4,10 +4,9 @@ import { z } from "zod";
4
4
 
5
5
  import { IFrameWindow } from "@crossmint/client-sdk-window";
6
6
  import type { UIConfig } from "@crossmint/common-sdk-base";
7
+ import type { AuthMaterial } from "@crossmint/common-sdk-auth";
7
8
 
8
9
  import X from "../../icons/x";
9
- import { classNames } from "../../utils/classNames";
10
- import type { AuthMaterial } from "@/hooks/useRefreshToken";
11
10
 
12
11
  const authMaterialSchema = z.object({
13
12
  oneTimeSecret: z.string(),
@@ -117,14 +116,16 @@ export default function AuthModal({ setModalOpen, apiKey, fetchAuthMaterial, bas
117
116
  src={iframeSrc}
118
117
  onLoad={handleIframeLoaded}
119
118
  title="Authentication Modal"
120
- className={classNames(
121
- "w-full h-[500px] border pt-12 pb-8",
122
- appearance?.colors?.border
123
- ? `border-[${appearance.colors.border}]`
124
- : "border-[#D0D5DD]",
125
- appearance?.borderRadius ? `rounded-[${appearance.borderRadius}]` : "rounded-2xl",
126
- appearance?.colors?.background ? `bg-[${appearance.colors.background}]` : "bg-white"
127
- )}
119
+ style={{
120
+ width: "100%",
121
+ height: "500px",
122
+ border: "1px solid",
123
+ borderColor: appearance?.colors?.border ?? "#D0D5DD",
124
+ borderRadius: appearance?.borderRadius ?? "1rem",
125
+ backgroundColor: appearance?.colors?.background ?? "white",
126
+ paddingTop: "3rem",
127
+ paddingBottom: "2rem",
128
+ }}
128
129
  />
129
130
  </div>
130
131
  </Transition.Child>
@@ -39,11 +39,19 @@ function PasskeyPromptCore({ title, content, primaryButton, secondaryAction, app
39
39
  />
40
40
  </Transition.Child>
41
41
  <div
42
- className={classNames(
43
- "flex flex-col items-center w-full max-w-[28rem] rounded-2xl shadow-sm z-30 border",
44
- appearance?.colors?.background != null ? `bg-[${appearance.colors.background}]` : "bg-white",
45
- appearance?.colors?.border != null ? `border-[${appearance.colors.border}]` : "border-[#D0D5DD]"
46
- )}
42
+ style={{
43
+ display: "flex",
44
+ flexDirection: "column",
45
+ alignItems: "center",
46
+ width: "100%",
47
+ maxWidth: "28rem",
48
+ borderRadius: "1rem",
49
+ boxShadow: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
50
+ zIndex: 30,
51
+ border: "1px solid",
52
+ backgroundColor: appearance?.colors?.background || "white",
53
+ borderColor: appearance?.colors?.border || "#D0D5DD",
54
+ }}
47
55
  onClick={(e) => e.stopPropagation()}
48
56
  >
49
57
  <div className="pt-12 pb-10 px-8">
@@ -52,24 +60,22 @@ function PasskeyPromptCore({ title, content, primaryButton, secondaryAction, app
52
60
  </div>
53
61
  <div className="flex justify-center">
54
62
  <p
55
- className={classNames(
56
- "text-lg font-bold",
57
- appearance?.colors?.textPrimary != null
58
- ? `text-[${appearance.colors.textPrimary}]`
59
- : "text-[#20343E]"
60
- )}
63
+ style={{
64
+ fontSize: "1.125rem",
65
+ lineHeight: "1.75rem",
66
+ fontWeight: "bold",
67
+ color: appearance?.colors?.textPrimary || "#20343E",
68
+ }}
61
69
  >
62
70
  {title}
63
71
  </p>
64
72
  </div>
65
73
  <div className="mt-4 mb-9">
66
74
  <div
67
- className={classNames(
68
- "font-normal",
69
- appearance?.colors?.textSecondary != null
70
- ? `text-[${appearance.colors.textSecondary}]`
71
- : "text-[#67797F]"
72
- )}
75
+ style={{
76
+ fontWeight: "normal",
77
+ color: appearance?.colors?.textSecondary || "#67797F",
78
+ }}
73
79
  >
74
80
  {content}
75
81
  </div>
@@ -199,15 +205,16 @@ export function PasskeyPrompt({ state, appearance }: PasskeyPromptProps) {
199
205
  href="https://docs.crossmint.com/wallets/smart-wallets/users/troubleshoot"
200
206
  rel="noopener noreferrer"
201
207
  target="_blank"
202
- className={classNames(
203
- "p-3.5 w-full text-center no-underline rounded-lg font-bold",
204
- appearance?.colors?.inputBackground != null
205
- ? `bg-[${appearance.colors.inputBackground}]`
206
- : "bg-[#F0F2F4]",
207
- appearance?.colors?.textSecondary != null
208
- ? `text-[${appearance.colors.textSecondary}]`
209
- : "text-[#00150D]"
210
- )}
208
+ style={{
209
+ padding: "0.875rem",
210
+ width: "100%",
211
+ textAlign: "center",
212
+ textDecoration: "none",
213
+ borderRadius: "0.5rem",
214
+ fontWeight: "bold",
215
+ backgroundColor: appearance?.colors?.inputBackground || "#F0F2F4",
216
+ color: appearance?.colors?.textSecondary || "#00150D",
217
+ }}
211
218
  >
212
219
  Troubleshoot
213
220
  </a>
@@ -1,13 +1,16 @@
1
1
  import { PoweredByLeaf } from "@/icons/poweredByLeaf";
2
- import { classNames } from "@/utils/classNames";
3
2
 
4
3
  export function PoweredByCrossmint({ color }: { color?: string }) {
5
4
  return (
6
5
  <p
7
- className={classNames(
8
- "flex text-xs font-normal -tracking-[0.2px] p-2",
9
- color ? `text-[${color}]` : "text-[#67797F]"
10
- )}
6
+ style={{
7
+ display: "flex",
8
+ fontSize: "0.75rem",
9
+ fontWeight: "400",
10
+ letterSpacing: "-0.2px",
11
+ padding: "0.5rem",
12
+ color: color || "#67797F",
13
+ }}
11
14
  >
12
15
  Powered by
13
16
  <span className="flex self-center pl-1 gap-1 items-center font-semibold">
@@ -1,13 +1,13 @@
1
1
  import { act, renderHook } from "@testing-library/react";
2
2
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3
3
 
4
- import { type CrossmintAuthService, getJWTExpiration } from "@crossmint/client-sdk-auth-core/client";
4
+ import { type CrossmintAuthService, getJWTExpiration } from "@crossmint/client-sdk-auth";
5
5
  import { queueTask } from "@crossmint/client-sdk-base";
6
6
 
7
7
  import * as authCookies from "../utils/authCookies";
8
8
  import { type AuthMaterial, useRefreshToken } from "./useRefreshToken";
9
9
 
10
- vi.mock("@crossmint/client-sdk-auth-core", () => ({
10
+ vi.mock("@crossmint/client-sdk-auth", () => ({
11
11
  CrossmintAuthService: vi.fn(),
12
12
  getJWTExpiration: vi.fn(),
13
13
  }));
@@ -1,7 +1,8 @@
1
1
  import { useCallback, useEffect, useRef } from "react";
2
2
 
3
- import type { CrossmintAuthService, SDKExternalUser } from "@crossmint/client-sdk-auth-core/client";
4
- import { getJWTExpiration } from "@crossmint/client-sdk-auth-core/client";
3
+ import type { AuthMaterial } from "@crossmint/common-sdk-auth";
4
+ import type { CrossmintAuthService } from "@crossmint/client-sdk-auth";
5
+ import { getJWTExpiration } from "@crossmint/client-sdk-auth";
5
6
  import { queueTask, type CancellableTask } from "@crossmint/client-sdk-base";
6
7
 
7
8
  import { REFRESH_TOKEN_PREFIX, getCookie } from "../utils/authCookies";
@@ -9,15 +10,6 @@ import { REFRESH_TOKEN_PREFIX, getCookie } from "../utils/authCookies";
9
10
  // 2 minutes before jwt expiration
10
11
  const TIME_BEFORE_EXPIRING_JWT_IN_SECONDS = 120;
11
12
 
12
- export type AuthMaterial = {
13
- jwtToken: string;
14
- refreshToken: {
15
- secret: string;
16
- expiresAt: string;
17
- };
18
- user: SDKExternalUser;
19
- };
20
-
21
13
  type UseAuthTokenRefreshProps = {
22
14
  crossmintAuthService: CrossmintAuthService;
23
15
  setAuthMaterial: (authMaterial: AuthMaterial) => void;
@@ -4,7 +4,7 @@ import { type ReactNode, act } from "react";
4
4
  import { beforeEach, describe, expect, vi } from "vitest";
5
5
  import { mock } from "vitest-mock-extended";
6
6
 
7
- import { CrossmintAuthService, getJWTExpiration } from "@crossmint/client-sdk-auth-core/client";
7
+ import { CrossmintAuthService, getJWTExpiration } from "@crossmint/client-sdk-auth";
8
8
  import { type EVMSmartWallet, SmartWalletSDK } from "@crossmint/client-sdk-smart-wallet";
9
9
  import { createCrossmint } from "@crossmint/common-sdk-base";
10
10
 
@@ -32,8 +32,8 @@ vi.mock("@crossmint/common-sdk-base", async () => {
32
32
  };
33
33
  });
34
34
 
35
- vi.mock("@crossmint/client-sdk-auth-core/client", async () => {
36
- const actual = await vi.importActual("@crossmint/client-sdk-auth-core/client");
35
+ vi.mock("@crossmint/client-sdk-auth", async () => {
36
+ const actual = await vi.importActual("@crossmint/client-sdk-auth");
37
37
  return {
38
38
  ...actual,
39
39
  getJWTExpiration: vi.fn(),
@@ -2,13 +2,14 @@ import { REFRESH_TOKEN_PREFIX, SESSION_PREFIX, deleteCookie, getCookie, setCooki
2
2
  import { type ReactNode, createContext, useEffect, useState } from "react";
3
3
  import { createPortal } from "react-dom";
4
4
 
5
- import { CrossmintAuthService, type SDKExternalUser } from "@crossmint/client-sdk-auth-core/client";
5
+ import { CrossmintAuthService } from "@crossmint/client-sdk-auth";
6
6
  import type { EVMSmartWalletChain } from "@crossmint/client-sdk-smart-wallet";
7
7
  import { type UIConfig, validateApiKeyAndGetCrossmintBaseUrl } from "@crossmint/common-sdk-base";
8
8
 
9
9
  import AuthModal from "../components/auth/AuthModal";
10
- import { type AuthMaterial, useCrossmint, useRefreshToken, useWallet } from "../hooks";
10
+ import { useCrossmint, useRefreshToken, useWallet } from "../hooks";
11
11
  import { CrossmintWalletProvider } from "./CrossmintWalletProvider";
12
+ import type { AuthMaterial, SDKExternalUser } from "@crossmint/common-sdk-auth";
12
13
 
13
14
  export type CrossmintAuthWalletConfig = {
14
15
  defaultChain: EVMSmartWalletChain;