diff --git a/apps/web/package.json b/apps/web/package.json index aad1578..90b4547 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -29,7 +29,7 @@ "@profullstack/notifications": "^0.1.4", "@profullstack/openprofile": "^0.2.0", "@profullstack/partners": "0.2.0", - "@profullstack/profile": "0.1.6", + "@profullstack/profile": "0.1.7", "@profullstack/redeem-credits": "^0.2.0", "@profullstack/throttle": "^0.4.0", "@profullstack/webhooks": "0.2.1", diff --git a/apps/web/src/routes/coinpay.js b/apps/web/src/routes/coinpay.js index d94f7bf..7b13add 100644 --- a/apps/web/src/routes/coinpay.js +++ b/apps/web/src/routes/coinpay.js @@ -1,3 +1,4 @@ +import { saveOpenProfileContact } from '@profullstack/profile'; import { getCookie, setCookie } from 'hono/cookie'; import { beginSignIn, @@ -119,7 +120,21 @@ export function registerCoinpay(app, overrides = null) { if (!user || c.get('viaKey') || String(user.id) !== String(pending.userId)) return c.redirect(back('/login', 'Sign in first, then connect CoinPay.'), 303); const r = await store.link(user.id, { sub: who.sub, email: who.email }); - if (r.ok) return c.redirect(back('/settings', 'CoinPay connected.', 'notice'), 303); + if (r.ok) { + const openprofileUrl = who.userinfo?.openprofile_url; + if (typeof openprofileUrl === 'string') { + try { + const { profiles } = await import('../lib/profile.js'); + await saveOpenProfileContact(profiles, String(user.id), openprofileUrl); + } catch (err) { + console.warn( + '[coinpay] OpenProfile import skipped:', + err instanceof Error ? err.message : err, + ); + } + } + return c.redirect(back('/settings', 'CoinPay connected.', 'notice'), 303); + } const why = r.reason === 'taken' ? 'That CoinPay account is already linked to another nichedb account.' diff --git a/apps/web/src/views/pages.jsx b/apps/web/src/views/pages.jsx index 66d9244..caaffaa 100644 --- a/apps/web/src/views/pages.jsx +++ b/apps/web/src/views/pages.jsx @@ -837,11 +837,18 @@ export const Settings = ({ {user.email}. Also at /api/v1/me/profile.

- {raw(renderProfileFields({ fields: PROFILE_FIELDS, values: contact ?? {} }))} + {raw( + renderProfileFields({ + fields: PROFILE_FIELDS, + values: contact ?? {}, + importOpenProfile: true, + }), + )}
+