@atls/react-identity-links 0.1.0 → 1.0.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/CHANGELOG.md +11 -18
- package/dist/identity-link.component.d.ts +1 -1
- package/dist/identity-link.component.js +3 -7
- package/dist/identity-url.interfaces.js +1 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -18
- package/dist/use-browser-effect.hook.js +3 -7
- package/dist/use-identity-url.hook.d.ts +1 -1
- package/dist/use-identity-url.hook.js +9 -13
- package/package.json +8 -6
- package/dist/identity-link.component.test.d.ts +0 -1
- package/dist/identity-link.component.test.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
## 0.0.6 (2025-01-22)
|
|
4
2
|
|
|
5
|
-
|
|
6
3
|
### Bug Fixes
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* upgrade yarn, typescript, set resolutions ([b235334](https://github.com/atls/reactjs/commit/b23533417af6fb323187ef281b83d8dc5e7bd9dd))
|
|
5
|
+
- **react:** lint and typecheck errors ([a090051](https://github.com/atls/reactjs/commit/a090051d1007e171df8066e85f15fcf8fd44c4ed))
|
|
6
|
+
- upgrade react, types fixes ([34feb02](https://github.com/atls/reactjs/commit/34feb027a2e2d7e5741509fd1ff846755d217b97))
|
|
7
|
+
- upgrade yarn, typescript, set resolutions ([b235334](https://github.com/atls/reactjs/commit/b23533417af6fb323187ef281b83d8dc5e7bd9dd))
|
|
12
8
|
|
|
13
9
|
### Features
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* upgraded ([71a06f6](https://github.com/atls/reactjs/commit/71a06f6f498c928ed33b79f93af5d398a32af487))
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
- add emotion as deps, bump @types/react ([1ce29b3](https://github.com/atls/reactjs/commit/1ce29b384640d9be0550d9c6f4dc07083821137a))
|
|
12
|
+
- **common:** bump yarn ([#143](https://github.com/atls/reactjs/issues/143)) ([8239f82](https://github.com/atls/reactjs/commit/8239f82f1c85d872a99613d3693babc761703b05))
|
|
13
|
+
- domain based identity links ([8263449](https://github.com/atls/reactjs/commit/826344977b1a86190a47b8d8fc6eecdb432da6a8))
|
|
14
|
+
- **identity-links:** init, also refactor react-user ([3fe1388](https://github.com/atls/reactjs/commit/3fe138854f57f7b50ce14df6c5dd9ab6f0d90dc2))
|
|
15
|
+
- react bump ([#144](https://github.com/atls/reactjs/issues/144)) ([9770fa1](https://github.com/atls/reactjs/commit/9770fa10451b647ed48e226270da68228714d174))
|
|
16
|
+
- root domain based identity links ([61508e4](https://github.com/atls/reactjs/commit/61508e41910a041d604999c01b74469bd1ea128c))
|
|
17
|
+
- update kratos browser flows to client 0.8.2 ([52f9c0f](https://github.com/atls/reactjs/commit/52f9c0fa129cd7d4567ab826c754483a6ddd6817))
|
|
18
|
+
- upgraded ([71a06f6](https://github.com/atls/reactjs/commit/71a06f6f498c928ed33b79f93af5d398a32af487))
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const use_identity_url_hook_1 = require("./use-identity-url.hook");
|
|
5
|
-
const IdentityLink = ({ children, type, returnTo }) => {
|
|
6
|
-
const url = (0, use_identity_url_hook_1.useIdentityUrl)({ type, returnTo });
|
|
1
|
+
import { useIdentityUrl } from './use-identity-url.hook.js';
|
|
2
|
+
export const IdentityLink = ({ children, type, returnTo }) => {
|
|
3
|
+
const url = useIdentityUrl({ type, returnTo });
|
|
7
4
|
if (!children || !url)
|
|
8
5
|
return null;
|
|
9
6
|
if (typeof children !== 'function')
|
|
10
7
|
throw new Error('IdentityLink - children must be a function.');
|
|
11
8
|
return children(url);
|
|
12
9
|
};
|
|
13
|
-
exports.IdentityLink = IdentityLink;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './identity-link.component';
|
|
2
|
-
export type * from './identity-url.interfaces';
|
|
3
|
-
export * from './use-identity-url.hook';
|
|
1
|
+
export * from './identity-link.component.js';
|
|
2
|
+
export type * from './identity-url.interfaces.js';
|
|
3
|
+
export * from './use-identity-url.hook.js';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./identity-link.component"), exports);
|
|
18
|
-
__exportStar(require("./use-identity-url.hook"), exports);
|
|
1
|
+
export * from './identity-link.component.js';
|
|
2
|
+
export * from './use-identity-url.hook.js';
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.useBrowserEffect = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useBrowserEffect = (effect, deps) => {
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export const useBrowserEffect = (effect, deps) => {
|
|
6
3
|
if (typeof window === 'undefined') {
|
|
7
4
|
return undefined;
|
|
8
5
|
}
|
|
9
|
-
return
|
|
6
|
+
return useEffect(effect, deps);
|
|
10
7
|
};
|
|
11
|
-
exports.useBrowserEffect = useBrowserEffect;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const tldjs_1 = require("tldjs");
|
|
6
|
-
const use_browser_effect_hook_1 = require("./use-browser-effect.hook");
|
|
7
|
-
exports.identityUrlTypes = {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import tldjs from 'tldjs';
|
|
3
|
+
import { useBrowserEffect } from './use-browser-effect.hook.js';
|
|
4
|
+
export const identityUrlTypes = {
|
|
8
5
|
login: '/auth/login',
|
|
9
6
|
registration: '/auth/registration',
|
|
10
7
|
verification: '/auth/verification',
|
|
@@ -12,16 +9,16 @@ exports.identityUrlTypes = {
|
|
|
12
9
|
logout: '/auth/logout',
|
|
13
10
|
settings: '/profile/settings',
|
|
14
11
|
};
|
|
15
|
-
const useIdentityUrl = ({ type = 'login', returnTo = false } = {}) => {
|
|
16
|
-
const [url, setUrl] =
|
|
17
|
-
|
|
12
|
+
export const useIdentityUrl = ({ type = 'login', returnTo = false } = {}) => {
|
|
13
|
+
const [url, setUrl] = useState(null);
|
|
14
|
+
useBrowserEffect(() => {
|
|
18
15
|
const { hostname, origin, href, protocol, pathname } = window.location;
|
|
19
|
-
const path =
|
|
16
|
+
const path = identityUrlTypes[type];
|
|
20
17
|
if (hostname === 'localhost') {
|
|
21
18
|
setUrl(`${protocol}//localhost:3000${path}`);
|
|
22
19
|
}
|
|
23
20
|
else {
|
|
24
|
-
const domain =
|
|
21
|
+
const domain = tldjs.getDomain(hostname);
|
|
25
22
|
if (returnTo === false) {
|
|
26
23
|
setUrl(`${protocol}//accounts.${domain}${path}`);
|
|
27
24
|
}
|
|
@@ -39,4 +36,3 @@ const useIdentityUrl = ({ type = 'login', returnTo = false } = {}) => {
|
|
|
39
36
|
}, [type, returnTo]);
|
|
40
37
|
return url;
|
|
41
38
|
};
|
|
42
|
-
exports.useIdentityUrl = useIdentityUrl;
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atls/react-identity-links",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"files": [
|
|
7
|
-
"dist"
|
|
8
|
+
"dist",
|
|
9
|
+
"!dist/*.test.*"
|
|
8
10
|
],
|
|
9
11
|
"scripts": {
|
|
10
12
|
"build": "yarn library build",
|
|
@@ -15,13 +17,13 @@
|
|
|
15
17
|
"tldjs": "^2.3.1"
|
|
16
18
|
},
|
|
17
19
|
"devDependencies": {
|
|
18
|
-
"@testing-library/
|
|
19
|
-
"@
|
|
20
|
-
"@testing-library/react-hooks": "^7.0.2",
|
|
20
|
+
"@testing-library/react": "16.1.0",
|
|
21
|
+
"@types/node": "22.10.1",
|
|
21
22
|
"@types/react": "18.3.6",
|
|
22
23
|
"@types/react-dom": "^18.2.7",
|
|
23
|
-
"@types/testing-library__jest-dom": "^5.14.1",
|
|
24
24
|
"@types/tldjs": "2.3.4",
|
|
25
|
+
"global-jsdom": "25.0.0",
|
|
26
|
+
"jsdom": "25.0.1",
|
|
25
27
|
"react": "^18.2.0",
|
|
26
28
|
"react-dom": "^18.2.0"
|
|
27
29
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|