kyd-shared-badge 0.3.80 → 0.3.82
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 +1 -1
- package/src/connect/ConnectAccounts.tsx +11 -14
- package/src/connect/types.ts +1 -0
package/package.json
CHANGED
|
@@ -41,6 +41,7 @@ export function ConnectAccounts(props: ConnectAccountsProps) {
|
|
|
41
41
|
initialProviderId,
|
|
42
42
|
githubAppSlugId,
|
|
43
43
|
userId,
|
|
44
|
+
inviteId,
|
|
44
45
|
} = props;
|
|
45
46
|
|
|
46
47
|
const router = useRouter();
|
|
@@ -164,6 +165,14 @@ export function ConnectAccounts(props: ConnectAccountsProps) {
|
|
|
164
165
|
if (url) router.push(url);
|
|
165
166
|
};
|
|
166
167
|
|
|
168
|
+
const onGithubAppInstall = () => {
|
|
169
|
+
const opaqueState = window.crypto?.randomUUID?.() || Math.random().toString(36).substring(2);
|
|
170
|
+
const stateObj = { opaqueState, userId, companyId, inviteId };
|
|
171
|
+
const stateString = encodeURIComponent(JSON.stringify(stateObj));
|
|
172
|
+
const redirectUrl = `https://github.com/apps/${githubAppSlugId}/installations/new?state=${stateString}`;
|
|
173
|
+
window.location.href = redirectUrl;
|
|
174
|
+
};
|
|
175
|
+
|
|
167
176
|
const selectedProvider = useMemo(() => {
|
|
168
177
|
if (!selectedProviderId) return null;
|
|
169
178
|
if (selectedProviderId.toLowerCase() === 'githubapp') {
|
|
@@ -339,13 +348,7 @@ export function ConnectAccounts(props: ConnectAccountsProps) {
|
|
|
339
348
|
<motion.div whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }}>
|
|
340
349
|
<Button
|
|
341
350
|
className="w-full sm:w-auto bg-[var(--icon-accent)] text-white transition-colors font-semibold"
|
|
342
|
-
onClick={
|
|
343
|
-
const opaqueState = window.crypto?.randomUUID?.() || Math.random().toString(36).substring(2);
|
|
344
|
-
const stateObj = { opaqueState, userId, companyId };
|
|
345
|
-
const stateString = encodeURIComponent(JSON.stringify(stateObj));
|
|
346
|
-
const redirectUrl = `https://github.com/apps/${githubAppSlugId}/installations/new?state=${stateString}`;
|
|
347
|
-
window.location.href = redirectUrl;
|
|
348
|
-
}}
|
|
351
|
+
onClick={onGithubAppInstall}
|
|
349
352
|
>
|
|
350
353
|
<span className="flex items-center justify-center">
|
|
351
354
|
<ExternalLink className="w-4 h-4 mr-2" />
|
|
@@ -432,13 +435,7 @@ export function ConnectAccounts(props: ConnectAccountsProps) {
|
|
|
432
435
|
</Button>
|
|
433
436
|
) : (
|
|
434
437
|
<Button
|
|
435
|
-
onClick={
|
|
436
|
-
const opaqueState = window.crypto?.randomUUID?.() || Math.random().toString(36).substring(2);
|
|
437
|
-
const stateObj = { opaqueState, userId };
|
|
438
|
-
const stateString = encodeURIComponent(JSON.stringify(stateObj));
|
|
439
|
-
const redirectUrl = `https://github.com/apps/${githubAppSlugId}/installations/new?state=${stateString}`;
|
|
440
|
-
window.location.href = redirectUrl;
|
|
441
|
-
}}
|
|
438
|
+
onClick={onGithubAppInstall}
|
|
442
439
|
className="bg-[var(--icon-accent)] text-white hover:bg-[var(--icon-accent-hover)]"
|
|
443
440
|
>
|
|
444
441
|
<ExternalLink className="w-4 h-4 mr-2" />
|