@orangecheck/auth-client 2.18.0 → 2.20.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/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +103 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1931,7 +1931,8 @@ function OcSignIn({
|
|
|
1931
1931
|
linkPrompt = true,
|
|
1932
1932
|
add: addProp,
|
|
1933
1933
|
authOrigin = "https://ochk.io",
|
|
1934
|
-
initialPath
|
|
1934
|
+
initialPath,
|
|
1935
|
+
providersFirst = true,
|
|
1935
1936
|
paths,
|
|
1936
1937
|
className
|
|
1937
1938
|
}) {
|
|
@@ -1960,7 +1961,9 @@ function OcSignIn({
|
|
|
1960
1961
|
}
|
|
1961
1962
|
setAddMode(new URLSearchParams(window.location.search).get("add") === "1");
|
|
1962
1963
|
}, [addProp]);
|
|
1963
|
-
const [path, setPath] = React3.useState(
|
|
1964
|
+
const [path, setPath] = React3.useState(
|
|
1965
|
+
initialPath ?? (providersFirst ? "email" : "wallet")
|
|
1966
|
+
);
|
|
1964
1967
|
const [signedIn, setSignedIn] = React3.useState(null);
|
|
1965
1968
|
const [linkAlso, setLinkAlso] = React3.useState(false);
|
|
1966
1969
|
const [oauthError, setOauthError] = React3.useState(false);
|
|
@@ -2108,7 +2111,16 @@ function OcSignIn({
|
|
|
2108
2111
|
]
|
|
2109
2112
|
}
|
|
2110
2113
|
),
|
|
2111
|
-
|
|
2114
|
+
providersFirst && /* @__PURE__ */ jsx(
|
|
2115
|
+
ProviderSignIn,
|
|
2116
|
+
{
|
|
2117
|
+
authOrigin,
|
|
2118
|
+
returnTo: resolvedReturn,
|
|
2119
|
+
add: addMode,
|
|
2120
|
+
first: true
|
|
2121
|
+
}
|
|
2122
|
+
),
|
|
2123
|
+
bothEnabled && /* @__PURE__ */ jsx(
|
|
2112
2124
|
"div",
|
|
2113
2125
|
{
|
|
2114
2126
|
role: "tablist",
|
|
@@ -2120,7 +2132,24 @@ function OcSignIn({
|
|
|
2120
2132
|
marginBottom: 16,
|
|
2121
2133
|
borderBottom: "1px solid var(--border, #27272a)"
|
|
2122
2134
|
},
|
|
2123
|
-
children: [
|
|
2135
|
+
children: providersFirst ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2136
|
+
/* @__PURE__ */ jsx(
|
|
2137
|
+
SigninTab,
|
|
2138
|
+
{
|
|
2139
|
+
active: path === "email",
|
|
2140
|
+
onClick: () => setPath("email"),
|
|
2141
|
+
children: "email + otp"
|
|
2142
|
+
}
|
|
2143
|
+
),
|
|
2144
|
+
/* @__PURE__ */ jsx(
|
|
2145
|
+
SigninTab,
|
|
2146
|
+
{
|
|
2147
|
+
active: path === "wallet",
|
|
2148
|
+
onClick: () => setPath("wallet"),
|
|
2149
|
+
children: "bitcoin \xB7 self-custody"
|
|
2150
|
+
}
|
|
2151
|
+
)
|
|
2152
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2124
2153
|
/* @__PURE__ */ jsx(
|
|
2125
2154
|
SigninTab,
|
|
2126
2155
|
{
|
|
@@ -2129,8 +2158,15 @@ function OcSignIn({
|
|
|
2129
2158
|
children: "bitcoin wallet"
|
|
2130
2159
|
}
|
|
2131
2160
|
),
|
|
2132
|
-
/* @__PURE__ */ jsx(
|
|
2133
|
-
|
|
2161
|
+
/* @__PURE__ */ jsx(
|
|
2162
|
+
SigninTab,
|
|
2163
|
+
{
|
|
2164
|
+
active: path === "email",
|
|
2165
|
+
onClick: () => setPath("email"),
|
|
2166
|
+
children: "email + otp"
|
|
2167
|
+
}
|
|
2168
|
+
)
|
|
2169
|
+
] })
|
|
2134
2170
|
}
|
|
2135
2171
|
),
|
|
2136
2172
|
/* @__PURE__ */ jsxs("div", { "data-oc-signin-panel": "", role: "tabpanel", children: [
|
|
@@ -2152,7 +2188,7 @@ function OcSignIn({
|
|
|
2152
2188
|
}
|
|
2153
2189
|
)
|
|
2154
2190
|
] }),
|
|
2155
|
-
/* @__PURE__ */ jsx(ProviderSignIn, { authOrigin, returnTo: resolvedReturn, add: addMode }),
|
|
2191
|
+
!providersFirst && /* @__PURE__ */ jsx(ProviderSignIn, { authOrigin, returnTo: resolvedReturn, add: addMode }),
|
|
2156
2192
|
linkPrompt && /* @__PURE__ */ jsxs("label", { "data-oc-signin-linkalso": "", style: linkAlsoStyle, children: [
|
|
2157
2193
|
/* @__PURE__ */ jsx(
|
|
2158
2194
|
"input",
|
|
@@ -2223,7 +2259,8 @@ function ProviderIcon({ id }) {
|
|
|
2223
2259
|
function ProviderSignIn({
|
|
2224
2260
|
authOrigin,
|
|
2225
2261
|
returnTo,
|
|
2226
|
-
add
|
|
2262
|
+
add,
|
|
2263
|
+
first = false
|
|
2227
2264
|
}) {
|
|
2228
2265
|
const [providers, setProviders] = React3.useState([]);
|
|
2229
2266
|
const [origin, setOrigin] = React3.useState("");
|
|
@@ -2241,60 +2278,65 @@ function ProviderSignIn({
|
|
|
2241
2278
|
if (providers.length === 0) return null;
|
|
2242
2279
|
const providerReturnTo = returnTo.startsWith("/") ? origin ? `${origin}${returnTo}` : returnTo : returnTo;
|
|
2243
2280
|
const line = { flex: 1, height: 1, background: "var(--border, #27272a)" };
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
{
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
textTransform: "uppercase"
|
|
2258
|
-
},
|
|
2259
|
-
children: [
|
|
2260
|
-
/* @__PURE__ */ jsx("span", { style: line }),
|
|
2261
|
-
"or",
|
|
2262
|
-
/* @__PURE__ */ jsx("span", { style: line })
|
|
2263
|
-
]
|
|
2264
|
-
}
|
|
2265
|
-
),
|
|
2266
|
-
providers.map((p, i) => /* @__PURE__ */ jsxs(
|
|
2267
|
-
"a",
|
|
2268
|
-
{
|
|
2269
|
-
href: `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
|
|
2270
|
-
providerReturnTo
|
|
2271
|
-
)}${add ? "&add=1" : ""}`,
|
|
2272
|
-
"data-oc-signin-provider": p.id,
|
|
2273
|
-
style: {
|
|
2274
|
-
display: "flex",
|
|
2275
|
-
alignItems: "center",
|
|
2276
|
-
justifyContent: "center",
|
|
2277
|
-
gap: 10,
|
|
2278
|
-
boxSizing: "border-box",
|
|
2279
|
-
width: "100%",
|
|
2280
|
-
marginTop: i === 0 ? 0 : 8,
|
|
2281
|
-
padding: "0.6rem 0.875rem",
|
|
2282
|
-
border: "1px solid var(--border, #27272a)",
|
|
2283
|
-
borderRadius: 6,
|
|
2284
|
-
background: "transparent",
|
|
2285
|
-
color: "var(--muted-foreground, #a1a1aa)",
|
|
2286
|
-
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
2287
|
-
fontSize: 12,
|
|
2288
|
-
textDecoration: "none"
|
|
2289
|
-
},
|
|
2290
|
-
children: [
|
|
2291
|
-
/* @__PURE__ */ jsx(ProviderIcon, { id: p.id }),
|
|
2292
|
-
/* @__PURE__ */ jsx("span", { children: p.label })
|
|
2293
|
-
]
|
|
2281
|
+
const divider = /* @__PURE__ */ jsxs(
|
|
2282
|
+
"div",
|
|
2283
|
+
{
|
|
2284
|
+
style: {
|
|
2285
|
+
display: "flex",
|
|
2286
|
+
alignItems: "center",
|
|
2287
|
+
gap: 10,
|
|
2288
|
+
margin: first ? "14px 0 4px" : "4px 0 12px",
|
|
2289
|
+
color: "var(--muted-foreground, #a1a1aa)",
|
|
2290
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
2291
|
+
fontSize: 10,
|
|
2292
|
+
letterSpacing: "0.16em",
|
|
2293
|
+
textTransform: "uppercase"
|
|
2294
2294
|
},
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2295
|
+
children: [
|
|
2296
|
+
/* @__PURE__ */ jsx("span", { style: line }),
|
|
2297
|
+
"or",
|
|
2298
|
+
/* @__PURE__ */ jsx("span", { style: line })
|
|
2299
|
+
]
|
|
2300
|
+
}
|
|
2301
|
+
);
|
|
2302
|
+
const buttons = providers.map((p, i) => /* @__PURE__ */ jsxs(
|
|
2303
|
+
"a",
|
|
2304
|
+
{
|
|
2305
|
+
href: `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
|
|
2306
|
+
providerReturnTo
|
|
2307
|
+
)}${add ? "&add=1" : ""}`,
|
|
2308
|
+
"data-oc-signin-provider": p.id,
|
|
2309
|
+
style: {
|
|
2310
|
+
display: "flex",
|
|
2311
|
+
alignItems: "center",
|
|
2312
|
+
justifyContent: "center",
|
|
2313
|
+
gap: 10,
|
|
2314
|
+
boxSizing: "border-box",
|
|
2315
|
+
width: "100%",
|
|
2316
|
+
marginTop: i === 0 ? 0 : 8,
|
|
2317
|
+
padding: "0.6rem 0.875rem",
|
|
2318
|
+
border: "1px solid var(--border, #27272a)",
|
|
2319
|
+
borderRadius: 6,
|
|
2320
|
+
background: "transparent",
|
|
2321
|
+
color: "var(--muted-foreground, #a1a1aa)",
|
|
2322
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
2323
|
+
fontSize: 12,
|
|
2324
|
+
textDecoration: "none"
|
|
2325
|
+
},
|
|
2326
|
+
children: [
|
|
2327
|
+
/* @__PURE__ */ jsx(ProviderIcon, { id: p.id }),
|
|
2328
|
+
/* @__PURE__ */ jsx("span", { children: p.label })
|
|
2329
|
+
]
|
|
2330
|
+
},
|
|
2331
|
+
p.id
|
|
2332
|
+
));
|
|
2333
|
+
return /* @__PURE__ */ jsx("div", { "data-oc-signin-providers": "", style: first ? { marginBottom: 4 } : { marginTop: 20 }, children: first ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2334
|
+
buttons,
|
|
2335
|
+
divider
|
|
2336
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2337
|
+
divider,
|
|
2338
|
+
buttons
|
|
2339
|
+
] }) });
|
|
2298
2340
|
}
|
|
2299
2341
|
function WalletFlow({ authOrigin, audience, add, onSuccess }) {
|
|
2300
2342
|
const [address, setAddress] = React3.useState("");
|