@kontrolia/react 1.2.1 → 1.3.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAyB,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,wBAAwB,CAAC;AACzF,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG9E,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC3C,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAID,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BAsDnE;AAED,wBAAgB,uBAAuB,IAAI,kBAAkB,CAM5D"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAyB,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,wBAAwB,CAAC;AACzF,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG9E,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC3C,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAID,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BA6DnE;AAED,wBAAgB,uBAAuB,IAAI,kBAAkB,CAM5D"}
package/dist/context.js CHANGED
@@ -5,6 +5,13 @@ import { createPermissionChecker } from "@kontrolia/permissions";
5
5
  import { createContext, useContext, useEffect, useMemo, useState } from "react";
6
6
  const KontroliaAuthContext = createContext(null);
7
7
  export function AuthProvider({ config, children }) {
8
+ // Deliberately narrower than the whole `config` object: consumers
9
+ // commonly pass an inline object literal (`<AuthProvider config={{...}}>`),
10
+ // which is a new reference every render — depending on `config` itself
11
+ // would recreate the Supabase client (and tear down its auth listener)
12
+ // on every render. supabaseUrl/supabaseAnonKey are the only fields that
13
+ // actually determine client identity.
14
+ // eslint-disable-next-line react-hooks/exhaustive-deps
8
15
  const client = useMemo(() => createKontroliaClient(config), [config.supabaseUrl, config.supabaseAnonKey]);
9
16
  const [state, setState] = useState({
10
17
  isLoading: true,
@@ -14,6 +14,13 @@ export declare function useAuth(): {
14
14
  updatePassword: (newPassword: string) => Promise<void>;
15
15
  updateProfile: (input: import("@kontrolia/auth").UpdateProfileInput) => Promise<void>;
16
16
  getMemberships: () => Promise<import("@kontrolia/shared").KontroliaMembershipWithOrganization[]>;
17
+ listOrganizationMembers: (organizationId: string, options?: {
18
+ offset?: number;
19
+ }) => Promise<import("@kontrolia/auth").OrganizationMembersPage>;
20
+ searchOrganizationMembers: (organizationId: string, query: string, options?: {
21
+ offset?: number;
22
+ }) => Promise<import("@kontrolia/auth").OrganizationMembersPage>;
23
+ getOrganizationMemberCount: (organizationId: string) => Promise<number>;
17
24
  isPlatformAdmin: () => Promise<boolean>;
18
25
  switchOrganization: (organizationId: string) => Promise<void>;
19
26
  buildOAuthServerAuthorizeUrl: (request: import("@kontrolia/auth").OAuthServerAuthorizeRequest) => Promise<import("@kontrolia/auth").OAuthServerAuthorizeResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"use-auth.d.ts","sourceRoot":"","sources":["../src/use-auth.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BtB"}
1
+ {"version":3,"file":"use-auth.d.ts","sourceRoot":"","sources":["../src/use-auth.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,OAAO;;;;;;;;;;;cAmCs3F,CAAC;;;cAAgQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAD9oG"}
package/dist/use-auth.js CHANGED
@@ -19,6 +19,9 @@ export function useAuth() {
19
19
  updatePassword: client.updatePassword.bind(client),
20
20
  updateProfile: client.updateProfile.bind(client),
21
21
  getMemberships: client.getMemberships.bind(client),
22
+ listOrganizationMembers: client.listOrganizationMembers.bind(client),
23
+ searchOrganizationMembers: client.searchOrganizationMembers.bind(client),
24
+ getOrganizationMemberCount: client.getOrganizationMemberCount.bind(client),
22
25
  isPlatformAdmin: client.isPlatformAdmin.bind(client),
23
26
  switchOrganization: client.switchOrganization.bind(client),
24
27
  buildOAuthServerAuthorizeUrl: client.buildOAuthServerAuthorizeUrl.bind(client),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontrolia/react",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
4
4
  "license": "MIT",
5
5
  "description": "React bindings for KontrolIA Auth: <AuthProvider>, <AuthGuard>, <GuestGuard>, <RequireRole>, <RequirePermission> and useAuth().",
6
6
  "keywords": [
@@ -34,17 +34,21 @@
34
34
  "react-dom": ">=18.0.0"
35
35
  },
36
36
  "dependencies": {
37
- "@kontrolia/auth": "2.0.0",
37
+ "@kontrolia/auth": "2.1.1",
38
38
  "@kontrolia/permissions": "1.0.1",
39
39
  "@kontrolia/shared": "1.1.0"
40
40
  },
41
41
  "devDependencies": {
42
+ "@testing-library/dom": "^10.4.1",
43
+ "@testing-library/react": "^16.3.2",
42
44
  "@types/react": "^18.3.17",
43
45
  "@types/react-dom": "^18.3.5",
44
46
  "eslint": "^9.17.0",
47
+ "jsdom": "^30.0.1",
45
48
  "react": "^18.3.1",
46
49
  "react-dom": "^18.3.1",
47
50
  "typescript": "^5.7.2",
51
+ "vitest": "^2.1.8",
48
52
  "@kontrolia/config": "0.1.0"
49
53
  },
50
54
  "scripts": {
@@ -52,6 +56,7 @@
52
56
  "dev": "tsc -p tsconfig.json --watch",
53
57
  "lint": "eslint .",
54
58
  "typecheck": "tsc -p tsconfig.json --noEmit",
59
+ "test": "vitest run",
55
60
  "clean": "rimraf dist"
56
61
  }
57
62
  }