@forjio/auth-ui 0.2.0 → 0.3.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.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/providers.cjs +40 -0
- package/dist/providers.cjs.map +1 -0
- package/dist/providers.d.cts +24 -0
- package/dist/providers.d.ts +24 -0
- package/dist/providers.js +16 -0
- package/dist/providers.js.map +1 -0
- package/package.json +9 -2
package/dist/index.cjs
CHANGED
|
@@ -21,18 +21,21 @@ __export(index_exports, {
|
|
|
21
21
|
AuthForm: () => import_AuthForm.AuthForm,
|
|
22
22
|
ForgotPasswordForm: () => import_ForgotPasswordForm.ForgotPasswordForm,
|
|
23
23
|
ResetPasswordForm: () => import_ResetPasswordForm.ResetPasswordForm,
|
|
24
|
-
defaultEndpoints: () => import_types.defaultEndpoints
|
|
24
|
+
defaultEndpoints: () => import_types.defaultEndpoints,
|
|
25
|
+
fetchSocialProviders: () => import_providers.fetchSocialProviders
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(index_exports);
|
|
27
28
|
var import_AuthForm = require("./AuthForm");
|
|
28
29
|
var import_ForgotPasswordForm = require("./ForgotPasswordForm");
|
|
29
30
|
var import_ResetPasswordForm = require("./ResetPasswordForm");
|
|
30
31
|
var import_types = require("./types");
|
|
32
|
+
var import_providers = require("./providers");
|
|
31
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
34
|
0 && (module.exports = {
|
|
33
35
|
AuthForm,
|
|
34
36
|
ForgotPasswordForm,
|
|
35
37
|
ResetPasswordForm,
|
|
36
|
-
defaultEndpoints
|
|
38
|
+
defaultEndpoints,
|
|
39
|
+
fetchSocialProviders
|
|
37
40
|
});
|
|
38
41
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { AuthForm } from './AuthForm';\nexport type { AuthFormProps } from './AuthForm';\nexport { ForgotPasswordForm } from './ForgotPasswordForm';\nexport type { ForgotPasswordFormProps } from './ForgotPasswordForm';\nexport { ResetPasswordForm } from './ResetPasswordForm';\nexport type { ResetPasswordFormProps } from './ResetPasswordForm';\nexport type { AuthEndpoints, SocialProviders } from './types';\nexport { defaultEndpoints } from './types';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AAEzB,gCAAmC;AAEnC,+BAAkC;AAGlC,mBAAiC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { AuthForm } from './AuthForm';\nexport type { AuthFormProps } from './AuthForm';\nexport { ForgotPasswordForm } from './ForgotPasswordForm';\nexport type { ForgotPasswordFormProps } from './ForgotPasswordForm';\nexport { ResetPasswordForm } from './ResetPasswordForm';\nexport type { ResetPasswordFormProps } from './ResetPasswordForm';\nexport type { AuthEndpoints, SocialProviders } from './types';\nexport { defaultEndpoints } from './types';\nexport { fetchSocialProviders } from './providers';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AAEzB,gCAAmC;AAEnC,+BAAkC;AAGlC,mBAAiC;AACjC,uBAAqC;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -2,4 +2,5 @@ export { AuthForm, AuthFormProps } from './AuthForm.cjs';
|
|
|
2
2
|
export { ForgotPasswordForm, ForgotPasswordFormProps } from './ForgotPasswordForm.cjs';
|
|
3
3
|
export { ResetPasswordForm, ResetPasswordFormProps } from './ResetPasswordForm.cjs';
|
|
4
4
|
export { AuthEndpoints, SocialProviders, defaultEndpoints } from './types.cjs';
|
|
5
|
+
export { fetchSocialProviders } from './providers.cjs';
|
|
5
6
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export { AuthForm, AuthFormProps } from './AuthForm.js';
|
|
|
2
2
|
export { ForgotPasswordForm, ForgotPasswordFormProps } from './ForgotPasswordForm.js';
|
|
3
3
|
export { ResetPasswordForm, ResetPasswordFormProps } from './ResetPasswordForm.js';
|
|
4
4
|
export { AuthEndpoints, SocialProviders, defaultEndpoints } from './types.js';
|
|
5
|
+
export { fetchSocialProviders } from './providers.js';
|
|
5
6
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,12 @@ import { AuthForm } from "./AuthForm";
|
|
|
2
2
|
import { ForgotPasswordForm } from "./ForgotPasswordForm";
|
|
3
3
|
import { ResetPasswordForm } from "./ResetPasswordForm";
|
|
4
4
|
import { defaultEndpoints } from "./types";
|
|
5
|
+
import { fetchSocialProviders } from "./providers";
|
|
5
6
|
export {
|
|
6
7
|
AuthForm,
|
|
7
8
|
ForgotPasswordForm,
|
|
8
9
|
ResetPasswordForm,
|
|
9
|
-
defaultEndpoints
|
|
10
|
+
defaultEndpoints,
|
|
11
|
+
fetchSocialProviders
|
|
10
12
|
};
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { AuthForm } from './AuthForm';\nexport type { AuthFormProps } from './AuthForm';\nexport { ForgotPasswordForm } from './ForgotPasswordForm';\nexport type { ForgotPasswordFormProps } from './ForgotPasswordForm';\nexport { ResetPasswordForm } from './ResetPasswordForm';\nexport type { ResetPasswordFormProps } from './ResetPasswordForm';\nexport type { AuthEndpoints, SocialProviders } from './types';\nexport { defaultEndpoints } from './types';\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,SAAS,0BAA0B;AAEnC,SAAS,yBAAyB;AAGlC,SAAS,wBAAwB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { AuthForm } from './AuthForm';\nexport type { AuthFormProps } from './AuthForm';\nexport { ForgotPasswordForm } from './ForgotPasswordForm';\nexport type { ForgotPasswordFormProps } from './ForgotPasswordForm';\nexport { ResetPasswordForm } from './ResetPasswordForm';\nexport type { ResetPasswordFormProps } from './ResetPasswordForm';\nexport type { AuthEndpoints, SocialProviders } from './types';\nexport { defaultEndpoints } from './types';\nexport { fetchSocialProviders } from './providers';\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,SAAS,0BAA0B;AAEnC,SAAS,yBAAyB;AAGlC,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;","names":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var providers_exports = {};
|
|
20
|
+
__export(providers_exports, {
|
|
21
|
+
fetchSocialProviders: () => fetchSocialProviders
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(providers_exports);
|
|
24
|
+
async function fetchSocialProviders(huudisBaseUrl, opts = {}) {
|
|
25
|
+
try {
|
|
26
|
+
const base = huudisBaseUrl.replace(/\/+$/, "");
|
|
27
|
+
const init = { next: { revalidate: opts.revalidate ?? 300 } };
|
|
28
|
+
const res = await fetch(`${base}/api/v1/auth/providers`, init);
|
|
29
|
+
if (!res.ok) return {};
|
|
30
|
+
const body = await res.json();
|
|
31
|
+
return body.data ?? {};
|
|
32
|
+
} catch {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
fetchSocialProviders
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=providers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/providers.ts"],"sourcesContent":["import type { SocialProviders } from './types';\n\n/** Next.js augments `RequestInit` with `next`; typed loosely here so the\n * package still builds standalone (outside a Next app). */\ntype FetchInit = RequestInit & { next?: { revalidate?: number } };\n\n/**\n * Server-side fetch of which social providers Huudis has configured.\n *\n * Call this in the auth page's **Server Component** and pass the result\n * to `<AuthForm providers={...} />`. Resolving provider status on the\n * server means the SSR HTML already carries the correct set of social\n * buttons — no client-fetch \"flash\" where disabled providers (Apple,\n * Facebook) appear for a moment and then vanish.\n *\n * Fails open: on any network/parse error it returns `{}`, which the\n * form treats as \"show all\" — matching `AuthForm`'s fail-open default,\n * so a transient blip degrades to the old behaviour rather than hiding\n * a working login.\n *\n * @param huudisBaseUrl e.g. `https://huudis.com` (the product's `HUUDIS_ISSUER`).\n * @param opts.revalidate ISR cache window in seconds; default 300.\n */\nexport async function fetchSocialProviders(\n huudisBaseUrl: string,\n opts: { revalidate?: number } = {},\n): Promise<SocialProviders> {\n try {\n const base = huudisBaseUrl.replace(/\\/+$/, '');\n const init: FetchInit = { next: { revalidate: opts.revalidate ?? 300 } };\n const res = await fetch(`${base}/api/v1/auth/providers`, init);\n if (!res.ok) return {};\n const body = (await res.json()) as { data?: SocialProviders };\n return body.data ?? {};\n } catch {\n return {};\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBA,eAAsB,qBACpB,eACA,OAAgC,CAAC,GACP;AAC1B,MAAI;AACF,UAAM,OAAO,cAAc,QAAQ,QAAQ,EAAE;AAC7C,UAAM,OAAkB,EAAE,MAAM,EAAE,YAAY,KAAK,cAAc,IAAI,EAAE;AACvE,UAAM,MAAM,MAAM,MAAM,GAAG,IAAI,0BAA0B,IAAI;AAC7D,QAAI,CAAC,IAAI,GAAI,QAAO,CAAC;AACrB,UAAM,OAAQ,MAAM,IAAI,KAAK;AAC7B,WAAO,KAAK,QAAQ,CAAC;AAAA,EACvB,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SocialProviders } from './types.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Server-side fetch of which social providers Huudis has configured.
|
|
5
|
+
*
|
|
6
|
+
* Call this in the auth page's **Server Component** and pass the result
|
|
7
|
+
* to `<AuthForm providers={...} />`. Resolving provider status on the
|
|
8
|
+
* server means the SSR HTML already carries the correct set of social
|
|
9
|
+
* buttons — no client-fetch "flash" where disabled providers (Apple,
|
|
10
|
+
* Facebook) appear for a moment and then vanish.
|
|
11
|
+
*
|
|
12
|
+
* Fails open: on any network/parse error it returns `{}`, which the
|
|
13
|
+
* form treats as "show all" — matching `AuthForm`'s fail-open default,
|
|
14
|
+
* so a transient blip degrades to the old behaviour rather than hiding
|
|
15
|
+
* a working login.
|
|
16
|
+
*
|
|
17
|
+
* @param huudisBaseUrl e.g. `https://huudis.com` (the product's `HUUDIS_ISSUER`).
|
|
18
|
+
* @param opts.revalidate ISR cache window in seconds; default 300.
|
|
19
|
+
*/
|
|
20
|
+
declare function fetchSocialProviders(huudisBaseUrl: string, opts?: {
|
|
21
|
+
revalidate?: number;
|
|
22
|
+
}): Promise<SocialProviders>;
|
|
23
|
+
|
|
24
|
+
export { fetchSocialProviders };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SocialProviders } from './types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Server-side fetch of which social providers Huudis has configured.
|
|
5
|
+
*
|
|
6
|
+
* Call this in the auth page's **Server Component** and pass the result
|
|
7
|
+
* to `<AuthForm providers={...} />`. Resolving provider status on the
|
|
8
|
+
* server means the SSR HTML already carries the correct set of social
|
|
9
|
+
* buttons — no client-fetch "flash" where disabled providers (Apple,
|
|
10
|
+
* Facebook) appear for a moment and then vanish.
|
|
11
|
+
*
|
|
12
|
+
* Fails open: on any network/parse error it returns `{}`, which the
|
|
13
|
+
* form treats as "show all" — matching `AuthForm`'s fail-open default,
|
|
14
|
+
* so a transient blip degrades to the old behaviour rather than hiding
|
|
15
|
+
* a working login.
|
|
16
|
+
*
|
|
17
|
+
* @param huudisBaseUrl e.g. `https://huudis.com` (the product's `HUUDIS_ISSUER`).
|
|
18
|
+
* @param opts.revalidate ISR cache window in seconds; default 300.
|
|
19
|
+
*/
|
|
20
|
+
declare function fetchSocialProviders(huudisBaseUrl: string, opts?: {
|
|
21
|
+
revalidate?: number;
|
|
22
|
+
}): Promise<SocialProviders>;
|
|
23
|
+
|
|
24
|
+
export { fetchSocialProviders };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
async function fetchSocialProviders(huudisBaseUrl, opts = {}) {
|
|
2
|
+
try {
|
|
3
|
+
const base = huudisBaseUrl.replace(/\/+$/, "");
|
|
4
|
+
const init = { next: { revalidate: opts.revalidate ?? 300 } };
|
|
5
|
+
const res = await fetch(`${base}/api/v1/auth/providers`, init);
|
|
6
|
+
if (!res.ok) return {};
|
|
7
|
+
const body = await res.json();
|
|
8
|
+
return body.data ?? {};
|
|
9
|
+
} catch {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
fetchSocialProviders
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/providers.ts"],"sourcesContent":["import type { SocialProviders } from './types';\n\n/** Next.js augments `RequestInit` with `next`; typed loosely here so the\n * package still builds standalone (outside a Next app). */\ntype FetchInit = RequestInit & { next?: { revalidate?: number } };\n\n/**\n * Server-side fetch of which social providers Huudis has configured.\n *\n * Call this in the auth page's **Server Component** and pass the result\n * to `<AuthForm providers={...} />`. Resolving provider status on the\n * server means the SSR HTML already carries the correct set of social\n * buttons — no client-fetch \"flash\" where disabled providers (Apple,\n * Facebook) appear for a moment and then vanish.\n *\n * Fails open: on any network/parse error it returns `{}`, which the\n * form treats as \"show all\" — matching `AuthForm`'s fail-open default,\n * so a transient blip degrades to the old behaviour rather than hiding\n * a working login.\n *\n * @param huudisBaseUrl e.g. `https://huudis.com` (the product's `HUUDIS_ISSUER`).\n * @param opts.revalidate ISR cache window in seconds; default 300.\n */\nexport async function fetchSocialProviders(\n huudisBaseUrl: string,\n opts: { revalidate?: number } = {},\n): Promise<SocialProviders> {\n try {\n const base = huudisBaseUrl.replace(/\\/+$/, '');\n const init: FetchInit = { next: { revalidate: opts.revalidate ?? 300 } };\n const res = await fetch(`${base}/api/v1/auth/providers`, init);\n if (!res.ok) return {};\n const body = (await res.json()) as { data?: SocialProviders };\n return body.data ?? {};\n } catch {\n return {};\n }\n}\n"],"mappings":"AAuBA,eAAsB,qBACpB,eACA,OAAgC,CAAC,GACP;AAC1B,MAAI;AACF,UAAM,OAAO,cAAc,QAAQ,QAAQ,EAAE;AAC7C,UAAM,OAAkB,EAAE,MAAM,EAAE,YAAY,KAAK,cAAc,IAAI,EAAE;AACvE,UAAM,MAAM,MAAM,MAAM,GAAG,IAAI,0BAA0B,IAAI;AAC7D,QAAI,CAAC,IAAI,GAAI,QAAO,CAAC;AACrB,UAAM,OAAQ,MAAM,IAAI,KAAK;AAC7B,WAAO,KAAK,QAAQ,CAAC;AAAA,EACvB,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forjio/auth-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Shared auth forms (login, signup, forgot-password, reset-password) for the Forjio family of SaaS products. Sister package to @forjio/website-ui and @forjio/portal-ui.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -47,5 +47,12 @@
|
|
|
47
47
|
"tsup": "^8.3.0",
|
|
48
48
|
"typescript": "^5.5.0"
|
|
49
49
|
},
|
|
50
|
-
"keywords": [
|
|
50
|
+
"keywords": [
|
|
51
|
+
"forjio",
|
|
52
|
+
"auth",
|
|
53
|
+
"ui",
|
|
54
|
+
"login",
|
|
55
|
+
"signup",
|
|
56
|
+
"huudis"
|
|
57
|
+
]
|
|
51
58
|
}
|