@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 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
- * **react:** lint and typecheck errors ([a090051](https://github.com/atls/reactjs/commit/a090051d1007e171df8066e85f15fcf8fd44c4ed))
10
- * upgrade react, types fixes ([34feb02](https://github.com/atls/reactjs/commit/34feb027a2e2d7e5741509fd1ff846755d217b97))
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
- * add emotion as deps, bump @types/react ([1ce29b3](https://github.com/atls/reactjs/commit/1ce29b384640d9be0550d9c6f4dc07083821137a))
17
- * **common:** bump yarn ([#143](https://github.com/atls/reactjs/issues/143)) ([8239f82](https://github.com/atls/reactjs/commit/8239f82f1c85d872a99613d3693babc761703b05))
18
- * domain based identity links ([8263449](https://github.com/atls/reactjs/commit/826344977b1a86190a47b8d8fc6eecdb432da6a8))
19
- * **identity-links:** init, also refactor react-user ([3fe1388](https://github.com/atls/reactjs/commit/3fe138854f57f7b50ce14df6c5dd9ab6f0d90dc2))
20
- * react bump ([#144](https://github.com/atls/reactjs/issues/144)) ([9770fa1](https://github.com/atls/reactjs/commit/9770fa10451b647ed48e226270da68228714d174))
21
- * root domain based identity links ([61508e4](https://github.com/atls/reactjs/commit/61508e41910a041d604999c01b74469bd1ea128c))
22
- * update kratos browser flows to client 0.8.2 ([52f9c0f](https://github.com/atls/reactjs/commit/52f9c0fa129cd7d4567ab826c754483a6ddd6817))
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,3 +1,3 @@
1
1
  import type { FC } from 'react';
2
- import type { IdentityLinkProps } from './identity-url.interfaces';
2
+ import type { IdentityLinkProps } from './identity-url.interfaces.js';
3
3
  export declare const IdentityLink: FC<IdentityLinkProps>;
@@ -1,13 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IdentityLink = void 0;
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
- "use strict";
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
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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 (0, react_1.useEffect)(effect, deps);
6
+ return useEffect(effect, deps);
10
7
  };
11
- exports.useBrowserEffect = useBrowserEffect;
@@ -1,4 +1,4 @@
1
- import type { UseIdentityUrlProps } from './identity-url.interfaces';
1
+ import type { UseIdentityUrlProps } from './identity-url.interfaces.js';
2
2
  export declare const identityUrlTypes: {
3
3
  login: string;
4
4
  registration: string;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useIdentityUrl = exports.identityUrlTypes = void 0;
4
- const react_1 = require("react");
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] = (0, react_1.useState)(null);
17
- (0, use_browser_effect_hook_1.useBrowserEffect)(() => {
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 = exports.identityUrlTypes[type];
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 = (0, tldjs_1.getDomain)(hostname);
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": "0.1.0",
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/jest-dom": "^5.16.2",
19
- "@testing-library/react": "^12.1.3",
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 {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });