@unisim/sdk 0.6.4 → 0.8.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/AppSettingsShell.d.ts +38 -0
- package/dist/AppSettingsShell.d.ts.map +1 -0
- package/dist/AppSettingsShell.js +275 -0
- package/dist/AppSettingsShell.js.map +1 -0
- package/dist/SettingsMenu.d.ts +22 -17
- package/dist/SettingsMenu.d.ts.map +1 -1
- package/dist/SettingsMenu.js +13 -111
- package/dist/SettingsMenu.js.map +1 -1
- package/dist/SuiteSwitcher.d.ts +15 -1
- package/dist/SuiteSwitcher.d.ts.map +1 -1
- package/dist/SuiteSwitcher.js +78 -25
- package/dist/SuiteSwitcher.js.map +1 -1
- package/dist/UniversalNavBar.d.ts +18 -6
- package/dist/UniversalNavBar.d.ts.map +1 -1
- package/dist/UniversalNavBar.js +34 -12
- package/dist/UniversalNavBar.js.map +1 -1
- package/dist/UserProfile.d.ts +18 -1
- package/dist/UserProfile.d.ts.map +1 -1
- package/dist/UserProfile.js +37 -2
- package/dist/UserProfile.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
export interface AppSettingsShellProps {
|
|
3
|
+
/**
|
|
4
|
+
* Human-readable product name shown in the page heading — e.g.
|
|
5
|
+
* "Cyber Assess UK", "Ergo Assess UK", "Workplace Assess".
|
|
6
|
+
*/
|
|
7
|
+
productName: string;
|
|
8
|
+
/**
|
|
9
|
+
* Where the "Open global settings" link goes. Defaults to
|
|
10
|
+
* `https://app.unisim.co.uk/settings` — the hub's global preferences page,
|
|
11
|
+
* which is the single source of truth for cross-product language / theme
|
|
12
|
+
* / etc. Override only if you're testing locally.
|
|
13
|
+
*/
|
|
14
|
+
globalSettingsHref?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Where the "Manage in My Company" link goes. Defaults to
|
|
17
|
+
* `https://app.unisim.co.uk` — the hub's My Company landing page.
|
|
18
|
+
*/
|
|
19
|
+
myCompanyHref?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Product-specific settings content (e.g. Ergo's default analysis methods).
|
|
22
|
+
* Rendered inside the "App settings" card. Pass null/undefined to hide the
|
|
23
|
+
* card entirely (useful for products that don't yet expose any app-level
|
|
24
|
+
* settings — they still get the company / contact / global sections).
|
|
25
|
+
*/
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Optional label for the "App settings" card. Defaults to
|
|
29
|
+
* `{productName} settings`.
|
|
30
|
+
*/
|
|
31
|
+
appSettingsLabel?: string;
|
|
32
|
+
/** Extra content rendered above the cards (e.g. an unsaved-changes notice). */
|
|
33
|
+
banner?: ReactNode;
|
|
34
|
+
style?: CSSProperties;
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function AppSettingsShell({ productName, globalSettingsHref, myCompanyHref, children, appSettingsLabel, banner, style, className, }: AppSettingsShellProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=AppSettingsShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppSettingsShell.d.ts","sourceRoot":"","sources":["../src/AppSettingsShell.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAU1D,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAeD,wBAAgB,gBAAgB,CAAC,EAC/B,WAAW,EACX,kBAAwD,EACxD,aAA+C,EAC/C,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,KAAK,EACL,SAAS,GACV,EAAE,qBAAqB,2CAoHvB"}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useOrg } from './auth.js';
|
|
4
|
+
import { useOrgBranding } from './branding.js';
|
|
5
|
+
import { useOrgMembers } from './admin.js';
|
|
6
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
// Component
|
|
8
|
+
//
|
|
9
|
+
// AppSettingsShell is the layout every product mounts at its `/settings` route
|
|
10
|
+
// since SDK 0.7.0. The shell handles the "this is your company / this is your
|
|
11
|
+
// admin / here's how to change preferences globally" framing; the product fills
|
|
12
|
+
// in the app-specific section via `children`.
|
|
13
|
+
//
|
|
14
|
+
// All data comes from `@unisim/sdk` hooks (useOrg, useOrgBranding,
|
|
15
|
+
// useOrgMembers) so the page stays in sync with whatever the user has set on
|
|
16
|
+
// the hub — no per-product re-implementation needed.
|
|
17
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
18
|
+
export function AppSettingsShell({ productName, globalSettingsHref = 'https://app.unisim.co.uk/settings', myCompanyHref = 'https://app.unisim.co.uk', children, appSettingsLabel, banner, style, className, }) {
|
|
19
|
+
const { org, loading: orgLoading } = useOrg();
|
|
20
|
+
const branding = useOrgBranding();
|
|
21
|
+
const { members, loading: membersLoading } = useOrgMembers();
|
|
22
|
+
// "Account contact" = the org owner, falling back to any admin. We surface
|
|
23
|
+
// one person rather than the full member list so the page reads as
|
|
24
|
+
// "here's who to talk to" — full membership / role management lives on the
|
|
25
|
+
// hub at app.unisim.co.uk.
|
|
26
|
+
const contact = pickAccountContact(members);
|
|
27
|
+
const memberCount = members.length;
|
|
28
|
+
return (_jsxs("div", { className: className, style: { ...pageStyle, ...style }, children: [banner, _jsxs("header", { style: pageHeaderStyle, children: [_jsx("h1", { style: pageTitleStyle, children: "Settings" }), _jsxs("p", { style: pageSubtitleStyle, children: [productName, " \u00B7 one stop for things that affect just this app."] })] }), children !== null && children !== undefined && children !== false && (_jsxs("section", { style: cardStyle, children: [_jsx(SectionHeader, { label: appSettingsLabel ?? `${productName} settings` }), _jsx("div", { style: cardBodyStyle, children: children })] })), _jsxs("section", { style: cardStyle, children: [_jsx(SectionHeader, { label: "Your company" }), _jsx("div", { style: cardBodyStyle, children: orgLoading ? (_jsx("p", { style: mutedStyle, children: "Loading\u2026" })) : !org ? (_jsxs("p", { style: mutedStyle, children: ["You aren't linked to a company yet.", ' ', _jsx("a", { href: myCompanyHref, style: linkStyle, children: "Set one up on the hub" }), " to share branding and team membership across the suite."] })) : (_jsxs("div", { style: companyRowStyle, children: [_jsx(CompanyAvatar, { iconUrl: branding.icon_url ?? org.icon_url, initial: (org.name?.[0] ?? '?').toUpperCase(), brandColor: branding.brand_color ?? org.brand_color }), _jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [_jsx("div", { style: companyNameStyle, children: org.name }), _jsxs("div", { style: mutedSmallStyle, children: [memberCount, " member", memberCount === 1 ? '' : 's', org.slug && _jsxs(_Fragment, { children: [" \u00B7 ", _jsx("code", { style: slugStyle, children: org.slug })] })] })] }), _jsx("a", { href: myCompanyHref, style: ghostButtonStyle, children: "Manage in My Company \u2192" })] })) })] }), _jsxs("section", { style: cardStyle, children: [_jsx(SectionHeader, { label: "Account contact" }), _jsx("div", { style: cardBodyStyle, children: membersLoading ? (_jsx("p", { style: mutedStyle, children: "Loading\u2026" })) : !contact ? (_jsx("p", { style: mutedStyle, children: "No admin on file. If something needs changing for your team, contact UNISIM support and we'll re-link your account." })) : (_jsxs("div", { style: contactRowStyle, children: [_jsx(ContactAvatar, { photoUrl: contact.profile?.avatar_url, initials: initialsFor(contact.profile?.display_name) }), _jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [_jsxs("div", { style: contactNameStyle, children: [contact.profile?.display_name ?? 'Unnamed admin', _jsx("span", { style: roleBadgeStyle, children: contact.role })] }), _jsxs("div", { style: mutedSmallStyle, children: ["Joined ", formatDate(contact.joined_at)] })] })] })) })] }), _jsxs("section", { style: cardStyle, children: [_jsx(SectionHeader, { label: "Global settings" }), _jsxs("div", { style: cardBodyStyle, children: [_jsxs("p", { style: paragraphStyle, children: ["Some preferences \u2014 like language, light/dark theme, and the avatar that every product reads \u2014 live on your ", _jsx("strong", { children: "Universal ID" }), " so they follow you across the suite. Setting them there overrides anything you change in this app."] }), _jsx("a", { href: globalSettingsHref, style: primaryButtonStyle, children: "Open global settings \u2192" })] })] })] }));
|
|
29
|
+
}
|
|
30
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
31
|
+
// Helpers
|
|
32
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
33
|
+
function pickAccountContact(members) {
|
|
34
|
+
if (members.length === 0)
|
|
35
|
+
return null;
|
|
36
|
+
const owner = members.find((m) => m.role === 'owner');
|
|
37
|
+
if (owner)
|
|
38
|
+
return owner;
|
|
39
|
+
const admin = members.find((m) => m.role === 'admin');
|
|
40
|
+
if (admin)
|
|
41
|
+
return admin;
|
|
42
|
+
return members[0] ?? null;
|
|
43
|
+
}
|
|
44
|
+
function initialsFor(name) {
|
|
45
|
+
if (!name)
|
|
46
|
+
return '?';
|
|
47
|
+
const parts = name.trim().split(/\s+/);
|
|
48
|
+
if (parts.length === 0)
|
|
49
|
+
return '?';
|
|
50
|
+
if (parts.length === 1)
|
|
51
|
+
return parts[0].slice(0, 2).toUpperCase();
|
|
52
|
+
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
53
|
+
}
|
|
54
|
+
function formatDate(iso) {
|
|
55
|
+
if (!iso)
|
|
56
|
+
return '—';
|
|
57
|
+
const d = new Date(iso);
|
|
58
|
+
if (Number.isNaN(d.getTime()))
|
|
59
|
+
return iso;
|
|
60
|
+
return d.toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' });
|
|
61
|
+
}
|
|
62
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
63
|
+
// Subcomponents
|
|
64
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
65
|
+
function SectionHeader({ label }) {
|
|
66
|
+
return (_jsx("div", { style: sectionHeaderStyle, children: _jsx("span", { style: sectionLabelStyle, children: label }) }));
|
|
67
|
+
}
|
|
68
|
+
function CompanyAvatar({ iconUrl, initial, brandColor, }) {
|
|
69
|
+
if (iconUrl) {
|
|
70
|
+
return (_jsx("span", { style: companyIconImgWrapperStyle, children: _jsx("img", { src: iconUrl, alt: "", "aria-hidden": true, style: iconImgStyle }) }));
|
|
71
|
+
}
|
|
72
|
+
return (_jsx("span", { style: {
|
|
73
|
+
...companyIconFallbackStyle,
|
|
74
|
+
background: brandColor ?? '#e2e8f0',
|
|
75
|
+
color: brandColor ? readableTextOn(brandColor) : '#64748b',
|
|
76
|
+
}, "aria-hidden": true, children: initial }));
|
|
77
|
+
}
|
|
78
|
+
function ContactAvatar({ photoUrl, initials }) {
|
|
79
|
+
if (photoUrl) {
|
|
80
|
+
return (_jsx("span", { style: contactAvatarWrapperStyle, children: _jsx("img", { src: photoUrl, alt: "", "aria-hidden": true, style: iconImgStyle }) }));
|
|
81
|
+
}
|
|
82
|
+
return _jsx("span", { style: contactAvatarFallbackStyle, "aria-hidden": true, children: initials });
|
|
83
|
+
}
|
|
84
|
+
function readableTextOn(bgHex) {
|
|
85
|
+
const m = /^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(bgHex);
|
|
86
|
+
if (!m)
|
|
87
|
+
return '#0f172a';
|
|
88
|
+
const r = parseInt(m[1], 16), g = parseInt(m[2], 16), b = parseInt(m[3], 16);
|
|
89
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
90
|
+
return luminance > 0.6 ? '#0f172a' : '#ffffff';
|
|
91
|
+
}
|
|
92
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
93
|
+
// Styles — inline so the shell renders consistently inside Vite + Tailwind
|
|
94
|
+
// (Cyber, Workplace), Next.js + Tailwind (Ergo), and the central hub without
|
|
95
|
+
// depending on any host-specific CSS. Picks up the suite's neutral slate +
|
|
96
|
+
// orange-accent palette already used by the navbar components.
|
|
97
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
98
|
+
const pageStyle = {
|
|
99
|
+
maxWidth: 760,
|
|
100
|
+
margin: '0 auto',
|
|
101
|
+
padding: '32px 20px 64px',
|
|
102
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif",
|
|
103
|
+
color: '#0f172a',
|
|
104
|
+
};
|
|
105
|
+
const pageHeaderStyle = {
|
|
106
|
+
marginBottom: 20,
|
|
107
|
+
};
|
|
108
|
+
const pageTitleStyle = {
|
|
109
|
+
fontSize: 28,
|
|
110
|
+
fontWeight: 700,
|
|
111
|
+
margin: 0,
|
|
112
|
+
letterSpacing: '-0.01em',
|
|
113
|
+
};
|
|
114
|
+
const pageSubtitleStyle = {
|
|
115
|
+
fontSize: 14,
|
|
116
|
+
color: '#64748b',
|
|
117
|
+
margin: '6px 0 0',
|
|
118
|
+
};
|
|
119
|
+
const cardStyle = {
|
|
120
|
+
background: '#ffffff',
|
|
121
|
+
border: '1px solid #e2e8f0',
|
|
122
|
+
borderRadius: 12,
|
|
123
|
+
marginBottom: 16,
|
|
124
|
+
overflow: 'hidden',
|
|
125
|
+
};
|
|
126
|
+
const sectionHeaderStyle = {
|
|
127
|
+
padding: '10px 16px',
|
|
128
|
+
borderBottom: '1px solid #f1f5f9',
|
|
129
|
+
background: '#f8fafc',
|
|
130
|
+
};
|
|
131
|
+
const sectionLabelStyle = {
|
|
132
|
+
fontSize: 11,
|
|
133
|
+
fontWeight: 700,
|
|
134
|
+
letterSpacing: '0.08em',
|
|
135
|
+
textTransform: 'uppercase',
|
|
136
|
+
color: '#64748b',
|
|
137
|
+
};
|
|
138
|
+
const cardBodyStyle = {
|
|
139
|
+
padding: 16,
|
|
140
|
+
};
|
|
141
|
+
const mutedStyle = {
|
|
142
|
+
fontSize: 13,
|
|
143
|
+
color: '#64748b',
|
|
144
|
+
margin: 0,
|
|
145
|
+
lineHeight: 1.5,
|
|
146
|
+
};
|
|
147
|
+
const mutedSmallStyle = {
|
|
148
|
+
fontSize: 12,
|
|
149
|
+
color: '#94a3b8',
|
|
150
|
+
marginTop: 4,
|
|
151
|
+
};
|
|
152
|
+
const paragraphStyle = {
|
|
153
|
+
fontSize: 13,
|
|
154
|
+
color: '#334155',
|
|
155
|
+
margin: '0 0 12px',
|
|
156
|
+
lineHeight: 1.5,
|
|
157
|
+
};
|
|
158
|
+
const linkStyle = {
|
|
159
|
+
color: '#c2410c',
|
|
160
|
+
textDecoration: 'underline',
|
|
161
|
+
};
|
|
162
|
+
const companyRowStyle = {
|
|
163
|
+
display: 'flex',
|
|
164
|
+
alignItems: 'center',
|
|
165
|
+
gap: 14,
|
|
166
|
+
};
|
|
167
|
+
const companyNameStyle = {
|
|
168
|
+
fontSize: 15,
|
|
169
|
+
fontWeight: 600,
|
|
170
|
+
color: '#0f172a',
|
|
171
|
+
};
|
|
172
|
+
const slugStyle = {
|
|
173
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace',
|
|
174
|
+
fontSize: 11,
|
|
175
|
+
background: '#f1f5f9',
|
|
176
|
+
padding: '1px 5px',
|
|
177
|
+
borderRadius: 4,
|
|
178
|
+
};
|
|
179
|
+
const companyIconImgWrapperStyle = {
|
|
180
|
+
width: 44,
|
|
181
|
+
height: 44,
|
|
182
|
+
borderRadius: 10,
|
|
183
|
+
overflow: 'hidden',
|
|
184
|
+
border: '1px solid #e2e8f0',
|
|
185
|
+
background: '#ffffff',
|
|
186
|
+
flexShrink: 0,
|
|
187
|
+
};
|
|
188
|
+
const companyIconFallbackStyle = {
|
|
189
|
+
width: 44,
|
|
190
|
+
height: 44,
|
|
191
|
+
borderRadius: 10,
|
|
192
|
+
display: 'inline-flex',
|
|
193
|
+
alignItems: 'center',
|
|
194
|
+
justifyContent: 'center',
|
|
195
|
+
fontSize: 18,
|
|
196
|
+
fontWeight: 700,
|
|
197
|
+
flexShrink: 0,
|
|
198
|
+
};
|
|
199
|
+
const iconImgStyle = {
|
|
200
|
+
width: '100%',
|
|
201
|
+
height: '100%',
|
|
202
|
+
objectFit: 'cover',
|
|
203
|
+
display: 'block',
|
|
204
|
+
};
|
|
205
|
+
const contactRowStyle = {
|
|
206
|
+
display: 'flex',
|
|
207
|
+
alignItems: 'center',
|
|
208
|
+
gap: 12,
|
|
209
|
+
};
|
|
210
|
+
const contactNameStyle = {
|
|
211
|
+
fontSize: 14,
|
|
212
|
+
fontWeight: 600,
|
|
213
|
+
color: '#0f172a',
|
|
214
|
+
display: 'flex',
|
|
215
|
+
alignItems: 'center',
|
|
216
|
+
gap: 8,
|
|
217
|
+
};
|
|
218
|
+
const roleBadgeStyle = {
|
|
219
|
+
fontSize: 9,
|
|
220
|
+
fontWeight: 800,
|
|
221
|
+
letterSpacing: '0.08em',
|
|
222
|
+
textTransform: 'uppercase',
|
|
223
|
+
padding: '2px 6px',
|
|
224
|
+
borderRadius: 999,
|
|
225
|
+
background: '#fff7ed',
|
|
226
|
+
color: '#c2410c',
|
|
227
|
+
border: '1px solid #fed7aa',
|
|
228
|
+
};
|
|
229
|
+
const contactAvatarWrapperStyle = {
|
|
230
|
+
width: 36,
|
|
231
|
+
height: 36,
|
|
232
|
+
borderRadius: '50%',
|
|
233
|
+
overflow: 'hidden',
|
|
234
|
+
border: '1px solid #e2e8f0',
|
|
235
|
+
background: '#ffffff',
|
|
236
|
+
flexShrink: 0,
|
|
237
|
+
};
|
|
238
|
+
const contactAvatarFallbackStyle = {
|
|
239
|
+
width: 36,
|
|
240
|
+
height: 36,
|
|
241
|
+
borderRadius: '50%',
|
|
242
|
+
background: '#fff7ed',
|
|
243
|
+
color: '#c2410c',
|
|
244
|
+
fontSize: 12,
|
|
245
|
+
fontWeight: 700,
|
|
246
|
+
display: 'inline-flex',
|
|
247
|
+
alignItems: 'center',
|
|
248
|
+
justifyContent: 'center',
|
|
249
|
+
flexShrink: 0,
|
|
250
|
+
};
|
|
251
|
+
const ghostButtonStyle = {
|
|
252
|
+
fontSize: 12,
|
|
253
|
+
color: '#c2410c',
|
|
254
|
+
fontWeight: 600,
|
|
255
|
+
textDecoration: 'none',
|
|
256
|
+
padding: '6px 10px',
|
|
257
|
+
border: '1px solid #fed7aa',
|
|
258
|
+
borderRadius: 8,
|
|
259
|
+
background: '#fff7ed',
|
|
260
|
+
whiteSpace: 'nowrap',
|
|
261
|
+
flexShrink: 0,
|
|
262
|
+
};
|
|
263
|
+
const primaryButtonStyle = {
|
|
264
|
+
display: 'inline-flex',
|
|
265
|
+
alignItems: 'center',
|
|
266
|
+
gap: 6,
|
|
267
|
+
fontSize: 13,
|
|
268
|
+
fontWeight: 600,
|
|
269
|
+
color: '#ffffff',
|
|
270
|
+
background: '#f97316',
|
|
271
|
+
padding: '8px 14px',
|
|
272
|
+
borderRadius: 8,
|
|
273
|
+
textDecoration: 'none',
|
|
274
|
+
};
|
|
275
|
+
//# sourceMappingURL=AppSettingsShell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppSettingsShell.js","sourceRoot":"","sources":["../src/AppSettingsShell.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAGZ,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AA2C1C,iFAAiF;AACjF,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IAClB,UAAU,EAAM,GAAG;IACnB,OAAO,EAAS,aAAa;IAC7B,UAAU,EAAM,QAAQ;IACxB,cAAc,EAAE,QAAQ;IACxB,UAAU,EAAM,CAAC;CAClB,CAAA;AAED,MAAM,gBAAgB,GAAkB;IACtC,QAAQ,EAAQ,EAAE;IAClB,KAAK,EAAW,SAAS;IACzB,UAAU,EAAM,GAAG;IACnB,cAAc,EAAE,MAAM;IACtB,OAAO,EAAS,UAAU;IAC1B,MAAM,EAAU,mBAAmB;IACnC,YAAY,EAAI,CAAC;IACjB,UAAU,EAAM,SAAS;IACzB,UAAU,EAAM,QAAQ;IACxB,UAAU,EAAM,CAAC;CAClB,CAAA;AAED,MAAM,kBAAkB,GAAkB;IACxC,OAAO,EAAS,aAAa;IAC7B,UAAU,EAAM,QAAQ;IACxB,GAAG,EAAa,CAAC;IACjB,QAAQ,EAAQ,EAAE;IAClB,UAAU,EAAM,GAAG;IACnB,KAAK,EAAW,SAAS;IACzB,UAAU,EAAM,SAAS;IACzB,OAAO,EAAS,UAAU;IAC1B,YAAY,EAAI,CAAC;IACjB,cAAc,EAAE,MAAM;CACvB,CAAA"}
|
package/dist/SettingsMenu.d.ts
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { type CSSProperties, type
|
|
2
|
-
export interface SettingsItem {
|
|
3
|
-
/** Display label, e.g. "Default analysis methods". */
|
|
4
|
-
label: string;
|
|
5
|
-
/** Either provide href (renders as link) or onClick (renders as button). */
|
|
6
|
-
href?: string;
|
|
7
|
-
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
8
|
-
/** Optional small icon shown left of the label. */
|
|
9
|
-
icon?: ReactNode;
|
|
10
|
-
/** Render in red — for destructive actions like "Sign out". */
|
|
11
|
-
danger?: boolean;
|
|
12
|
-
}
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
13
2
|
export interface SettingsMenuProps {
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Where the gear icon links to. Should be the product's app-level settings
|
|
5
|
+
* page, e.g. `${BASE_URL}settings` for Vite consumers or
|
|
6
|
+
* `${basePath}/settings` for Next.js. Defaults to `/settings` (which is
|
|
7
|
+
* portal-rooted for products served under a base path — pass an absolute
|
|
8
|
+
* or base-prefixed value if you're under one).
|
|
9
|
+
*/
|
|
10
|
+
href?: string;
|
|
18
11
|
/** Trigger className — typically Tailwind classes from the host nav. */
|
|
19
12
|
triggerClassName?: string;
|
|
20
13
|
/** aria-label for the trigger. Defaults to "Settings". */
|
|
@@ -22,5 +15,17 @@ export interface SettingsMenuProps {
|
|
|
22
15
|
style?: CSSProperties;
|
|
23
16
|
className?: string;
|
|
24
17
|
}
|
|
25
|
-
export declare function SettingsMenu({
|
|
18
|
+
export declare function SettingsMenu({ href, triggerClassName, ariaLabel, style, className, }: SettingsMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Since SDK 0.7.0 the settings menu is a plain link; per-item
|
|
21
|
+
* dropdown rows are no longer rendered. Type is kept exported for callers that
|
|
22
|
+
* still import it.
|
|
23
|
+
*/
|
|
24
|
+
export interface SettingsItem {
|
|
25
|
+
label: string;
|
|
26
|
+
href?: string;
|
|
27
|
+
onClick?: (e: any) => void;
|
|
28
|
+
icon?: ReactNode;
|
|
29
|
+
danger?: boolean;
|
|
30
|
+
}
|
|
26
31
|
//# sourceMappingURL=SettingsMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsMenu.d.ts","sourceRoot":"","sources":["../src/SettingsMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"SettingsMenu.d.ts","sourceRoot":"","sources":["../src/SettingsMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAkB1D,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAkB,EAClB,gBAAgB,EAChB,SAAsB,EACtB,KAAK,EACL,SAAS,GACV,EAAE,iBAAiB,2CAWnB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAK,MAAM,CAAA;IAChB,IAAI,CAAC,EAAK,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;IAC1B,IAAI,CAAC,EAAK,SAAS,CAAA;IACnB,MAAM,CAAC,EAAG,OAAO,CAAA;CAClB"}
|
package/dist/SettingsMenu.js
CHANGED
|
@@ -1,130 +1,32 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// Component
|
|
6
|
-
// ──────────────────────────────────────────────────────────────────────────────
|
|
7
|
-
export function SettingsMenu({ productItems, globalItems, triggerClassName, ariaLabel = 'Settings', style, className, }) {
|
|
8
|
-
const [open, setOpen] = useState(false);
|
|
9
|
-
const wrapRef = useRef(null);
|
|
10
|
-
const closeTimer = useRef(null);
|
|
11
|
-
function openNow() {
|
|
12
|
-
if (closeTimer.current)
|
|
13
|
-
clearTimeout(closeTimer.current);
|
|
14
|
-
setOpen(true);
|
|
15
|
-
}
|
|
16
|
-
function closeSoon() {
|
|
17
|
-
if (closeTimer.current)
|
|
18
|
-
clearTimeout(closeTimer.current);
|
|
19
|
-
closeTimer.current = setTimeout(() => setOpen(false), 220);
|
|
20
|
-
}
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
function onDown(e) {
|
|
23
|
-
if (wrapRef.current && !wrapRef.current.contains(e.target))
|
|
24
|
-
setOpen(false);
|
|
25
|
-
}
|
|
26
|
-
function onKey(e) {
|
|
27
|
-
if (e.key === 'Escape')
|
|
28
|
-
setOpen(false);
|
|
29
|
-
}
|
|
30
|
-
document.addEventListener('mousedown', onDown);
|
|
31
|
-
document.addEventListener('keydown', onKey);
|
|
32
|
-
return () => {
|
|
33
|
-
document.removeEventListener('mousedown', onDown);
|
|
34
|
-
document.removeEventListener('keydown', onKey);
|
|
35
|
-
};
|
|
36
|
-
}, []);
|
|
37
|
-
const hasProduct = productItems && productItems.length > 0;
|
|
38
|
-
const hasGlobal = globalItems && globalItems.length > 0;
|
|
39
|
-
return (_jsxs("div", { ref: wrapRef, className: className, style: { position: 'relative', display: 'inline-block', ...style }, onMouseEnter: openNow, onMouseLeave: closeSoon, children: [_jsx("button", { type: "button", "aria-label": ariaLabel, "aria-expanded": open, "aria-haspopup": "true", onClick: () => setOpen((v) => !v), onFocus: openNow, className: triggerClassName, style: triggerClassName ? undefined : defaultTriggerStyle, children: _jsx(IconGear, {}) }), _jsxs("div", { role: "menu", style: menuStyle(open), children: [hasProduct && (_jsxs(_Fragment, { children: [_jsx(SectionHeader, { label: "Product Settings" }), productItems.map((item, i) => (_jsx(Item, { item: item }, `p${i}`)))] })), hasProduct && hasGlobal && _jsx(Divider, {}), hasGlobal && (_jsxs(_Fragment, { children: [_jsx(SectionHeader, { label: "Global Settings" }), globalItems.map((item, i) => (_jsx(Item, { item: item }, `g${i}`)))] })), !hasProduct && !hasGlobal && (_jsx("div", { style: { padding: '12px 14px', fontSize: 12, color: '#94a3b8', fontStyle: 'italic' }, children: "No settings yet." }))] })] }));
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
export function SettingsMenu({ href = '/settings', triggerClassName, ariaLabel = 'Settings', style, className, }) {
|
|
4
|
+
return (_jsx("a", { href: href, "aria-label": ariaLabel, className: className ? `${className} ${triggerClassName ?? ''}`.trim() : triggerClassName, style: className || triggerClassName ? style : { ...defaultTriggerStyle, ...style }, children: _jsx(IconGear, {}) }));
|
|
40
5
|
}
|
|
41
6
|
// ──────────────────────────────────────────────────────────────────────────────
|
|
42
|
-
//
|
|
7
|
+
// Icon
|
|
43
8
|
// ──────────────────────────────────────────────────────────────────────────────
|
|
44
|
-
function Item({ item }) {
|
|
45
|
-
const restingColor = item.danger ? '#dc2626' : '#374151';
|
|
46
|
-
const hoverColor = item.danger ? '#b91c1c' : '#111827';
|
|
47
|
-
const hoverBg = item.danger ? '#fef2f2' : '#f3f4f6';
|
|
48
|
-
const baseStyle = {
|
|
49
|
-
display: 'flex',
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
gap: 10,
|
|
52
|
-
padding: '8px 14px',
|
|
53
|
-
fontSize: 13,
|
|
54
|
-
color: restingColor,
|
|
55
|
-
background: 'transparent',
|
|
56
|
-
border: 0,
|
|
57
|
-
cursor: 'pointer',
|
|
58
|
-
width: '100%',
|
|
59
|
-
textAlign: 'left',
|
|
60
|
-
textDecoration: 'none',
|
|
61
|
-
fontFamily: 'inherit',
|
|
62
|
-
transition: 'background 120ms, color 120ms',
|
|
63
|
-
};
|
|
64
|
-
const onEnter = (e) => {
|
|
65
|
-
e.currentTarget.style.background = hoverBg;
|
|
66
|
-
e.currentTarget.style.color = hoverColor;
|
|
67
|
-
};
|
|
68
|
-
const onLeave = (e) => {
|
|
69
|
-
e.currentTarget.style.background = 'transparent';
|
|
70
|
-
e.currentTarget.style.color = restingColor;
|
|
71
|
-
};
|
|
72
|
-
if (item.onClick) {
|
|
73
|
-
return (_jsxs("button", { type: "button", role: "menuitem", onClick: item.onClick, onMouseEnter: onEnter, onMouseLeave: onLeave, style: baseStyle, children: [item.icon, item.label] }));
|
|
74
|
-
}
|
|
75
|
-
return (_jsxs("a", { role: "menuitem", href: item.href, onMouseEnter: onEnter, onMouseLeave: onLeave, style: baseStyle, children: [item.icon, item.label] }));
|
|
76
|
-
}
|
|
77
|
-
function SectionHeader({ label }) {
|
|
78
|
-
return _jsx("div", { style: sectionHeaderStyle, children: label });
|
|
79
|
-
}
|
|
80
|
-
function Divider() {
|
|
81
|
-
return _jsx("div", { style: { height: 1, background: '#e5e7eb', margin: '4px 0' }, "aria-hidden": true });
|
|
82
|
-
}
|
|
83
9
|
function IconGear() {
|
|
84
10
|
return (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [_jsx("circle", { cx: "12", cy: "12", r: "3" }), _jsx("path", { d: "M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z" })] }));
|
|
85
11
|
}
|
|
86
12
|
// ──────────────────────────────────────────────────────────────────────────────
|
|
87
13
|
// Styles
|
|
88
14
|
// ──────────────────────────────────────────────────────────────────────────────
|
|
15
|
+
// Matches the right-cluster button chrome (Profile, ChangelogMenu) so the row
|
|
16
|
+
// reads as a uniform set of chips rather than a bare icon next to chips.
|
|
89
17
|
const defaultTriggerStyle = {
|
|
90
18
|
display: 'inline-flex',
|
|
91
19
|
alignItems: 'center',
|
|
92
20
|
justifyContent: 'center',
|
|
93
|
-
width:
|
|
94
|
-
height:
|
|
95
|
-
borderRadius:
|
|
96
|
-
border:
|
|
97
|
-
background: '
|
|
21
|
+
width: 38,
|
|
22
|
+
height: 38,
|
|
23
|
+
borderRadius: 10,
|
|
24
|
+
border: '1px solid #e2e8f0',
|
|
25
|
+
background: '#ffffff',
|
|
98
26
|
color: '#64748b',
|
|
99
27
|
cursor: 'pointer',
|
|
100
28
|
padding: 0,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
function menuStyle(open) {
|
|
104
|
-
return {
|
|
105
|
-
position: 'absolute',
|
|
106
|
-
right: 0,
|
|
107
|
-
top: 'calc(100% + 8px)',
|
|
108
|
-
minWidth: 220,
|
|
109
|
-
background: '#ffffff',
|
|
110
|
-
border: '1px solid #e5e7eb',
|
|
111
|
-
borderRadius: 12,
|
|
112
|
-
boxShadow: '0 16px 32px -8px rgba(15,23,42,0.16), 0 4px 8px -2px rgba(15,23,42,0.08)',
|
|
113
|
-
padding: '6px 0',
|
|
114
|
-
opacity: open ? 1 : 0,
|
|
115
|
-
visibility: open ? 'visible' : 'hidden',
|
|
116
|
-
transform: open ? 'translateY(0)' : 'translateY(-4px)',
|
|
117
|
-
transition: 'opacity 150ms cubic-bezier(0.16,1,0.3,1), transform 150ms cubic-bezier(0.16,1,0.3,1), visibility 150ms',
|
|
118
|
-
zIndex: 50,
|
|
119
|
-
color: '#111827',
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
const sectionHeaderStyle = {
|
|
123
|
-
padding: '8px 14px 4px',
|
|
124
|
-
fontSize: 10,
|
|
125
|
-
fontWeight: 700,
|
|
126
|
-
letterSpacing: '0.08em',
|
|
127
|
-
textTransform: 'uppercase',
|
|
128
|
-
color: '#64748b',
|
|
29
|
+
textDecoration: 'none',
|
|
30
|
+
transition: 'background 120ms, border-color 120ms, color 120ms',
|
|
129
31
|
};
|
|
130
32
|
//# sourceMappingURL=SettingsMenu.js.map
|
package/dist/SettingsMenu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsMenu.js","sourceRoot":"","sources":["../src/SettingsMenu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;
|
|
1
|
+
{"version":3,"file":"SettingsMenu.js","sourceRoot":"","sources":["../src/SettingsMenu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAqCZ,MAAM,UAAU,YAAY,CAAC,EAC3B,IAAI,GAAG,WAAW,EAClB,gBAAgB,EAChB,SAAS,GAAG,UAAU,EACtB,KAAK,EACL,SAAS,GACS;IAClB,OAAO,CACL,YACE,IAAI,EAAE,IAAI,gBACE,SAAS,EACrB,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,gBAAgB,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,gBAAgB,EACzF,KAAK,EAAE,SAAS,IAAI,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,mBAAmB,EAAE,GAAG,KAAK,EAAE,YAEnF,KAAC,QAAQ,KAAG,GACV,CACL,CAAA;AACH,CAAC;AAeD,iFAAiF;AACjF,OAAO;AACP,iFAAiF;AAEjF,SAAS,QAAQ;IACf,OAAO,CACL,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,kCAC5I,iBAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,GAAG,GAAG,EAChC,eAAM,CAAC,EAAC,6kBAA6kB,GAAG,IACplB,CACP,CAAA;AACH,CAAC;AAED,iFAAiF;AACjF,SAAS;AACT,iFAAiF;AAEjF,8EAA8E;AAC9E,yEAAyE;AACzE,MAAM,mBAAmB,GAAkB;IACzC,OAAO,EAAS,aAAa;IAC7B,UAAU,EAAM,QAAQ;IACxB,cAAc,EAAE,QAAQ;IACxB,KAAK,EAAW,EAAE;IAClB,MAAM,EAAU,EAAE;IAClB,YAAY,EAAI,EAAE;IAClB,MAAM,EAAU,mBAAmB;IACnC,UAAU,EAAM,SAAS;IACzB,KAAK,EAAW,SAAS;IACzB,MAAM,EAAU,SAAS;IACzB,OAAO,EAAS,CAAC;IACjB,cAAc,EAAE,MAAM;IACtB,UAAU,EAAM,mDAAmD;CACpE,CAAA"}
|
package/dist/SuiteSwitcher.d.ts
CHANGED
|
@@ -14,6 +14,13 @@ export interface SuiteProduct {
|
|
|
14
14
|
* Used for region indicators — e.g. UK-only products show <UKFlag />.
|
|
15
15
|
*/
|
|
16
16
|
flag?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Mark the product as "Coming soon" — renders the menu item with a muted
|
|
19
|
+
* "Coming soon" badge and disables navigation. Use when a product is
|
|
20
|
+
* temporarily withdrawn from the suite (so users can see it's part of the
|
|
21
|
+
* roadmap without being able to navigate to a half-built page).
|
|
22
|
+
*/
|
|
23
|
+
comingSoon?: boolean;
|
|
17
24
|
}
|
|
18
25
|
export interface SuiteSwitcherProps {
|
|
19
26
|
/** Which product is currently being viewed — gets the "You're here" badge. */
|
|
@@ -55,6 +62,13 @@ export interface SuiteSwitcherProps {
|
|
|
55
62
|
* should use <ChangelogMenu /> in the navbar's right cluster instead.
|
|
56
63
|
*/
|
|
57
64
|
chip?: ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Where the suite-home entry (the top "Universal Simulation · The Assess
|
|
67
|
+
* suite" row inside the dropdown) navigates to. Defaults to the assess
|
|
68
|
+
* portal at https://assess.unisim.co.uk. Override per-suite for non-Assess
|
|
69
|
+
* portals (e.g. the Universal Apps portal once it exists).
|
|
70
|
+
*/
|
|
71
|
+
portalHref?: string;
|
|
58
72
|
/** Apply to the outermost wrapper if you need to nudge positioning. */
|
|
59
73
|
style?: CSSProperties;
|
|
60
74
|
className?: string;
|
|
@@ -64,5 +78,5 @@ export declare function UKFlag({ width, height }: {
|
|
|
64
78
|
height?: number;
|
|
65
79
|
}): import("react/jsx-runtime").JSX.Element;
|
|
66
80
|
export declare const DEFAULT_SUITE_PRODUCTS: SuiteProduct[];
|
|
67
|
-
export declare function SuiteSwitcher({ current, products, iconSrc, ariaLabel, children, align, chip, style, className, }: SuiteSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
export declare function SuiteSwitcher({ current, products, iconSrc, ariaLabel, children, align, chip, portalHref, style, className, }: SuiteSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
68
82
|
//# sourceMappingURL=SuiteSwitcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuiteSwitcher.d.ts","sourceRoot":"","sources":["../src/SuiteSwitcher.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,OAAO,CAAA;AAMd,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,cAAc,GACd,kBAAkB,GAClB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEjB,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,cAAc,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAA;IACZ,sEAAsE;IACtE,KAAK,EAAE,SAAS,CAAA;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"SuiteSwitcher.d.ts","sourceRoot":"","sources":["../src/SuiteSwitcher.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,OAAO,CA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