kyd-shared-badge 0.3.63 → 0.3.64

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": "kyd-shared-badge",
3
- "version": "0.3.63",
3
+ "version": "0.3.64",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -23,6 +23,7 @@
23
23
  "@chatscope/chat-ui-kit-styles": "^1.4.0",
24
24
  "ai": "5.0.47",
25
25
  "i18n-iso-countries": "^7.14.0",
26
+ "next-auth": "^4.24.11",
26
27
  "react-hot-toast": "^2.6.0",
27
28
  "react-icons": "^5.5.0",
28
29
  "recharts": "^2.15.4",
@@ -348,7 +348,7 @@ const SharedBadgeDisplay = ({ badgeData, chatProps, headless }: { badgeData: Pub
348
348
  resume={resumeJson}
349
349
  roleName={roleName}
350
350
  badgeId={badgeId}
351
- isPublic={true}
351
+ isPublic={badgeData.isPublic}
352
352
  showDownloadButton={true}
353
353
  />
354
354
  </div>
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
 
3
- import { useState, useMemo } from 'react';
3
+ import { useState } from 'react';
4
+ import { Spinner } from './spinner';
5
+ import { useSession } from 'next-auth/react';
4
6
 
5
7
  type ResumeJSON = Partial<{
6
8
  header: Partial<{ name: string; title: string; contact: Partial<{ email: string; phone: string; location: string; links: string[] }> }>;
@@ -18,7 +20,6 @@ interface ResumeViewProps {
18
20
  roleName?: string;
19
21
  badgeId?: string;
20
22
  isPublic?: boolean;
21
- idToken?: string;
22
23
  showDownloadButton?: boolean;
23
24
  }
24
25
 
@@ -38,8 +39,9 @@ const Row = ({ label, value }: { label: string; value?: string }) => {
38
39
  );
39
40
  };
40
41
 
41
- export default function ResumeView({ resume, roleName, badgeId, isPublic, idToken, showDownloadButton }: ResumeViewProps) {
42
+ export default function ResumeView({ resume, roleName, badgeId, isPublic, showDownloadButton }: ResumeViewProps) {
42
43
  const [isDownloading, setIsDownloading] = useState(false);
44
+ const { data: session } = useSession();
43
45
 
44
46
  const header = resume?.header || {};
45
47
  const contact = header?.contact || {} as any;
@@ -59,6 +61,7 @@ export default function ResumeView({ resume, roleName, badgeId, isPublic, idToke
59
61
  const apiGatewayUrl = process.env.NEXT_PUBLIC_API_GATEWAY_URL;
60
62
  if (!apiGatewayUrl) throw new Error('API not configured');
61
63
  const usePublic = !!isPublic;
64
+ const idToken = (session as any)?.id_token;
62
65
  const path = usePublic ? `/share/badge/${badgeId}/resume` : `/user/assessment/${badgeId}/resume`;
63
66
  const res = await fetch(`${apiGatewayUrl}${path}`, {
64
67
  method: 'GET',
@@ -98,7 +101,7 @@ export default function ResumeView({ resume, roleName, badgeId, isPublic, idToke
98
101
  className={'px-3 py-2 text-sm rounded-md border'}
99
102
  style={{ borderColor: 'var(--icon-button-secondary)', color: 'var(--text-main)', background: 'var(--content-card-background)' }}
100
103
  >
101
- {isDownloading ? 'Preparing…' : 'Download Resume (.docx)'}
104
+ {isDownloading ? <Spinner /> : 'Download Resume (.docx)'}
102
105
  </button>
103
106
  ) : null}
104
107
  </div>
@@ -0,0 +1,12 @@
1
+ 'use client'
2
+ import React from 'react'
3
+
4
+ export function Spinner() {
5
+ return (
6
+ <div className="animate-spin rounded-full h-6 w-6 border-b-2 border-[var(--icon-accent-hover)]"></div>
7
+ )
8
+ }
9
+
10
+ export default Spinner
11
+
12
+