@better-auth-ui/heroui 1.6.14 → 1.6.15
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/index.js
CHANGED
|
@@ -1473,11 +1473,11 @@ function vt({ account: e, provider: t }) {
|
|
|
1473
1473
|
//#endregion
|
|
1474
1474
|
//#region src/components/auth/settings/security/linked-accounts.tsx
|
|
1475
1475
|
function yt({ className: e, variant: t, ...n }) {
|
|
1476
|
-
let { authClient: r, localization: i,
|
|
1476
|
+
let { authClient: r, localization: i, multipleAccountsPerProvider: a, socialProviders: o } = m(), { data: s, isPending: c } = b(r), l = s?.filter((e) => e.providerId !== "credential"), u = new Set(l?.map((e) => e.providerId)), d = a === !1 ? o?.filter((e) => !u.has(e)) : o, f = [...l?.map((e) => ({
|
|
1477
1477
|
key: e.id,
|
|
1478
1478
|
account: e,
|
|
1479
1479
|
provider: e.providerId
|
|
1480
|
-
})) ?? [], ...
|
|
1480
|
+
})) ?? [], ...d?.map((e) => ({
|
|
1481
1481
|
key: e,
|
|
1482
1482
|
account: void 0,
|
|
1483
1483
|
provider: e
|
|
@@ -1491,7 +1491,7 @@ function yt({ className: e, variant: t, ...n }) {
|
|
|
1491
1491
|
...n,
|
|
1492
1492
|
children: /* @__PURE__ */ Q(j.Content, {
|
|
1493
1493
|
className: "gap-0",
|
|
1494
|
-
children:
|
|
1494
|
+
children: c ? o?.map((e, t) => /* @__PURE__ */ $("div", { children: [t > 0 && /* @__PURE__ */ Q("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Q(bt, {})] }, e)) : f.map((e, t) => /* @__PURE__ */ $("div", { children: [t > 0 && /* @__PURE__ */ Q("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Q(vt, {
|
|
1495
1495
|
account: e.account,
|
|
1496
1496
|
provider: e.provider
|
|
1497
1497
|
})] }, e.key))
|
package/package.json
CHANGED
|
@@ -21,7 +21,12 @@ export function LinkedAccounts({
|
|
|
21
21
|
variant,
|
|
22
22
|
...props
|
|
23
23
|
}: LinkedAccountsProps & Omit<CardProps, "children">) {
|
|
24
|
-
const {
|
|
24
|
+
const {
|
|
25
|
+
authClient,
|
|
26
|
+
localization,
|
|
27
|
+
multipleAccountsPerProvider,
|
|
28
|
+
socialProviders
|
|
29
|
+
} = useAuth()
|
|
25
30
|
|
|
26
31
|
const { data: accounts, isPending } = useListAccounts(authClient)
|
|
27
32
|
|
|
@@ -29,13 +34,20 @@ export function LinkedAccounts({
|
|
|
29
34
|
(account) => account.providerId !== "credential"
|
|
30
35
|
)
|
|
31
36
|
|
|
37
|
+
const linkedProviderIds = new Set(linkedAccounts?.map((a) => a.providerId))
|
|
38
|
+
|
|
39
|
+
const availableProviders =
|
|
40
|
+
multipleAccountsPerProvider === false
|
|
41
|
+
? socialProviders?.filter((p) => !linkedProviderIds.has(p))
|
|
42
|
+
: socialProviders
|
|
43
|
+
|
|
32
44
|
const allRows = [
|
|
33
45
|
...(linkedAccounts?.map((account) => ({
|
|
34
46
|
key: account.id,
|
|
35
47
|
account,
|
|
36
48
|
provider: account.providerId
|
|
37
49
|
})) ?? []),
|
|
38
|
-
...(
|
|
50
|
+
...(availableProviders?.map((provider) => ({
|
|
39
51
|
key: provider,
|
|
40
52
|
account: undefined,
|
|
41
53
|
provider
|