@quiltt/react 3.6.8 → 3.6.10

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,5 +1,23 @@
1
1
  # @quiltt/react
2
2
 
3
+ ## 3.6.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#268](https://github.com/quiltt/quiltt-js/pull/268) [`8a82094`](https://github.com/quiltt/quiltt-js/commit/8a82094a709d0d7e1478ec32142be33825323708) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Migrate linter to Biome
8
+
9
+ - Updated dependencies [[`8a82094`](https://github.com/quiltt/quiltt-js/commit/8a82094a709d0d7e1478ec32142be33825323708)]:
10
+ - @quiltt/core@3.6.10
11
+
12
+ ## 3.6.9
13
+
14
+ ### Patch Changes
15
+
16
+ - [#260](https://github.com/quiltt/quiltt-js/pull/260) [`6e80930`](https://github.com/quiltt/quiltt-js/commit/6e80930f84013f483e2c75fcb37a28dc4996dadc) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Refactor QuilttConnector to remove URL allow list
17
+
18
+ - Updated dependencies [[`6e80930`](https://github.com/quiltt/quiltt-js/commit/6e80930f84013f483e2c75fcb37a28dc4996dadc)]:
19
+ - @quiltt/core@3.6.9
20
+
3
21
  ## 3.6.8
4
22
 
5
23
  ### Patch Changes
@@ -2,10 +2,10 @@
2
2
  'use client';
3
3
  import require$$0, { useCallback, useEffect } from 'react';
4
4
  import { JsonWebTokenParse, QuilttClient, InMemoryCache as InMemoryCache$1 } from '@quiltt/core';
5
- import './useSession-client-Cew1m26_.js';
5
+ import './useSession-client-CG5lGS9F.js';
6
6
  import './useQuilttSettings-client-DU_Qfc8X.js';
7
7
  import { jsx } from 'react/jsx-runtime';
8
- import { u as useQuilttSession } from './useQuilttSession-client-C2Wc0RQE.js';
8
+ import { u as useQuilttSession } from './useQuilttSession-client-Btezo4Pr.js';
9
9
 
10
10
  function _mergeNamespaces(n, m) {
11
11
  m.forEach(function (e) {
@@ -12971,14 +12971,14 @@ const GraphQLClient = new QuilttClient({
12971
12971
  // Import passed in token
12972
12972
  useEffect(()=>{
12973
12973
  if (token) importSession(token);
12974
- // eslint-disable-next-line react-hooks/exhaustive-deps
12975
12974
  }, [
12976
- token
12975
+ token,
12976
+ importSession
12977
12977
  ]);
12978
12978
  // Reset Client Store when logging in or out
12979
+ // biome-ignore lint/correctness/useExhaustiveDependencies: We should reset the store whenever the session changes
12979
12980
  useEffect(()=>{
12980
12981
  GraphQLClient.resetStore();
12981
- // eslint-disable-next-line react-hooks/exhaustive-deps
12982
12982
  }, [
12983
12983
  session
12984
12984
  ]);
@@ -2,7 +2,7 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { useState } from 'react';
4
4
  import '@quiltt/core';
5
- import './useSession-client-Cew1m26_.js';
5
+ import './useSession-client-CG5lGS9F.js';
6
6
  import { Q as QuilttSettings } from './useQuilttSettings-client-DU_Qfc8X.js';
7
7
 
8
8
  const QuilttSettingsProvider = ({ clientId, children })=>{
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  export * from '@quiltt/core';
2
- export { u as useEventListener } from './useEventListener-client-CTa_g_PX.js';
2
+ export { u as useEventListener } from './useEventListener-client-DVM5xwKY.js';
3
3
  export { u as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect-client-DeTHOKz1.js';
4
- import { Q as QuilttAuthProvider } from './QuilttAuthProvider-client-DzZJ_7r3.js';
5
- export { c as useAuthenticateSession, b as useIdentifySession, a as useImportSession, d as useRevokeSession } from './QuilttAuthProvider-client-DzZJ_7r3.js';
6
- export { u as useQuilttClient } from './useQuilttClient-client-4g4cdtMX.js';
7
- import { u as useQuilttConnector } from './useQuilttConnector-client-C9h3wqtR.js';
8
- export { u as useQuilttSession } from './useQuilttSession-client-C2Wc0RQE.js';
4
+ import { Q as QuilttAuthProvider } from './QuilttAuthProvider-client-CU3f0mM4.js';
5
+ export { c as useAuthenticateSession, b as useIdentifySession, a as useImportSession, d as useRevokeSession } from './QuilttAuthProvider-client-CU3f0mM4.js';
6
+ export { u as useQuilttClient } from './useQuilttClient-client-zSMGqVAq.js';
7
+ import { u as useQuilttConnector } from './useQuilttConnector-client-DGOhCF0v.js';
8
+ export { u as useQuilttSession } from './useQuilttSession-client-Btezo4Pr.js';
9
9
  export { Q as QuilttSettings, u as useQuilttSettings } from './useQuilttSettings-client-DU_Qfc8X.js';
10
- export { u as useSession } from './useSession-client-Cew1m26_.js';
11
- export { u as useStorage } from './useStorage-client-C91C8oXS.js';
10
+ export { u as useSession } from './useSession-client-CG5lGS9F.js';
11
+ export { u as useStorage } from './useStorage-client-B3keU-oI.js';
12
12
  import { jsx } from 'react/jsx-runtime';
13
- import { Q as QuilttSettingsProvider } from './QuilttSettingsProvider-client-BOiVpLF3.js';
13
+ import { Q as QuilttSettingsProvider } from './QuilttSettingsProvider-client-DkJG70n_.js';
14
14
 
15
15
  const QuilttProvider = ({ clientId, token, children })=>{
16
16
  return /*#__PURE__*/ jsx(QuilttSettingsProvider, {
@@ -16,7 +16,7 @@ import { u as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect-clie
16
16
  useEffect(()=>{
17
17
  // Define the listening target
18
18
  const targetElement = element?.current ?? window;
19
- if (!(targetElement && targetElement.addEventListener)) return;
19
+ if (!targetElement?.addEventListener) return;
20
20
  // Create event listener that calls handler function stored in ref
21
21
  const listener = (event)=>savedHandler.current(event);
22
22
  targetElement.addEventListener(eventName, listener, options);
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { u as useApolloClient } from './QuilttAuthProvider-client-DzZJ_7r3.js';
2
+ import { u as useApolloClient } from './QuilttAuthProvider-client-CU3f0mM4.js';
3
3
 
4
4
  const useQuilttClient = useApolloClient;
5
5
 
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
  import { useState, useEffect, useCallback } from 'react';
3
- import { u as useQuilttSession } from './useQuilttSession-client-C2Wc0RQE.js';
4
- import { u as useScript } from './useScript-client-Cx5nb9RW.js';
5
3
  import { cdnBase } from '@quiltt/core';
4
+ import { u as useQuilttSession } from './useQuilttSession-client-Btezo4Pr.js';
5
+ import { u as useScript } from './useScript-client-Cx5nb9RW.js';
6
6
 
7
7
  // Generated by genversion.
8
- const version = '3.6.8';
8
+ const version = '3.6.10';
9
9
 
10
10
  const useQuilttConnector = (connectorId, options)=>{
11
11
  const status = useScript(`${cdnBase}/v1/connector.js?agent=react-${version}`);
@@ -13,14 +13,16 @@ const useQuilttConnector = (connectorId, options)=>{
13
13
  const [connector, setConnector] = useState();
14
14
  const [isOpening, setIsOpening] = useState(false);
15
15
  // Set Session
16
+ // biome-ignore lint/correctness/useExhaustiveDependencies: We also need to update on status change
16
17
  useEffect(()=>{
17
18
  if (typeof Quiltt === 'undefined') return;
18
19
  Quiltt.authenticate(session?.token);
19
20
  }, [
20
21
  status,
21
- session
22
+ session?.token
22
23
  ]);
23
24
  // Set Connector
25
+ // biome-ignore lint/correctness/useExhaustiveDependencies: We also need to update on status change
24
26
  useEffect(()=>{
25
27
  if (typeof Quiltt === 'undefined' || !connectorId) return;
26
28
  if (options?.connectionId) {
@@ -110,8 +112,7 @@ const useQuilttConnector = (connectorId, options)=>{
110
112
  throw new Error('Must provide `connectorId` to `open` Quiltt Connector with Method Call');
111
113
  }
112
114
  }, [
113
- connectorId,
114
- setIsOpening
115
+ connectorId
115
116
  ]);
116
117
  return {
117
118
  open
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import { useCallback } from 'react';
3
- import { u as useSession } from './useSession-client-Cew1m26_.js';
4
3
  import { AuthAPI } from '@quiltt/core';
5
- import { a as useImportSession, b as useIdentifySession, c as useAuthenticateSession, d as useRevokeSession } from './QuilttAuthProvider-client-DzZJ_7r3.js';
4
+ import { u as useSession } from './useSession-client-CG5lGS9F.js';
5
+ import { a as useImportSession, b as useIdentifySession, c as useAuthenticateSession, d as useRevokeSession } from './QuilttAuthProvider-client-CU3f0mM4.js';
6
6
  import { u as useQuilttSettings } from './useQuilttSettings-client-DU_Qfc8X.js';
7
7
 
8
8
  const useQuilttSession = (environmentId)=>{
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { useMemo, useEffect, useCallback } from 'react';
3
3
  import { Timeoutable, JsonWebTokenParse } from '@quiltt/core';
4
- import { u as useStorage } from './useStorage-client-C91C8oXS.js';
4
+ import { u as useStorage } from './useStorage-client-B3keU-oI.js';
5
5
 
6
6
  const parse = JsonWebTokenParse;
7
7
  /**
@@ -22,6 +22,7 @@ import { GlobalStorage } from '@quiltt/core';
22
22
  */ const useStorage = (key, initialState)=>{
23
23
  const getStorage = useCallback(()=>{
24
24
  let state;
25
+ // biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
25
26
  if ((state = GlobalStorage.get(key)) !== undefined) {
26
27
  return state;
27
28
  }
@@ -46,11 +47,11 @@ import { GlobalStorage } from '@quiltt/core';
46
47
  * props or state variables that could change during the component's lifetime.
47
48
  *
48
49
  * Use an empty dependency array to avoid unnecessary re-renders.
49
- */ useEffect(()=>{
50
+ */ // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
51
+ useEffect(()=>{
50
52
  GlobalStorage.subscribe(key, setHookState);
51
53
  setHookState(getStorage());
52
54
  return ()=>GlobalStorage.unsubscribe(key, setHookState);
53
- // eslint-disable-next-line react-hooks/exhaustive-deps
54
55
  }, []);
55
56
  return [
56
57
  hookState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quiltt/react",
3
- "version": "3.6.8",
3
+ "version": "3.6.10",
4
4
  "description": "React components and hooks for Quiltt Connector",
5
5
  "keywords": [
6
6
  "quiltt",
@@ -37,24 +37,15 @@
37
37
  "CHANGELOG.md"
38
38
  ],
39
39
  "dependencies": {
40
- "@quiltt/core": "3.6.8"
40
+ "@quiltt/core": "3.6.10"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@apollo/client": "3.9.9",
44
- "@trivago/prettier-plugin-sort-imports": "4.1.1",
45
- "@types/node": "20.12.7",
44
+ "@biomejs/biome": "1.8.1",
45
+ "@types/node": "20.14.5",
46
46
  "@types/react": "18.2.73",
47
47
  "@types/react-dom": "18.2.6",
48
- "@typescript-eslint/eslint-plugin": "5.60.1",
49
- "@typescript-eslint/parser": "5.60.1",
50
48
  "bunchee": "4.4.8",
51
- "eslint": "8.43.0",
52
- "eslint-config-prettier": "8.8.0",
53
- "eslint-plugin-jsx-a11y": "6.7.1",
54
- "eslint-plugin-prettier": "4.2.1",
55
- "eslint-plugin-react": "7.32.2",
56
- "eslint-plugin-react-hooks": "4.6.0",
57
- "prettier": "2.8.8",
58
49
  "react": "18.2.0",
59
50
  "react-dom": "18.2.0",
60
51
  "rimraf": "5.0.5",
@@ -72,7 +63,7 @@
72
63
  "build": "pnpm run addVersion && bunchee",
73
64
  "clean": "rimraf .turbo dist",
74
65
  "dev": "bunchee --watch",
75
- "lint": "TIMING=1 eslint --ext .js,.jsx,.ts,.tsx src/ --fix",
66
+ "lint": "TIMING=1 biome check src/ --fix",
76
67
  "typecheck": "tsc --project tsconfig.json --noEmit"
77
68
  }
78
69
  }
@@ -1,9 +1,9 @@
1
- import { PropsWithChildren } from 'react'
1
+ import type { PropsWithChildren } from 'react'
2
2
 
3
- import { ConnectorSDKCallbacks } from '@quiltt/core'
3
+ import type { ConnectorSDKCallbacks } from '@quiltt/core'
4
4
 
5
5
  import { useQuilttConnector } from '../hooks/useQuilttConnector'
6
- import { AnyTag, PropsOf } from '../types'
6
+ import type { AnyTag, PropsOf } from '../types'
7
7
 
8
8
  type QuilttButtonProps<T extends AnyTag> = PropsWithChildren<
9
9
  {
@@ -1,9 +1,9 @@
1
- import { PropsWithChildren } from 'react'
1
+ import type { PropsWithChildren } from 'react'
2
2
 
3
- import { ConnectorSDKCallbacks } from '@quiltt/core'
3
+ import type { ConnectorSDKCallbacks } from '@quiltt/core'
4
4
 
5
5
  import { useQuilttConnector } from '../hooks/useQuilttConnector'
6
- import { AnyTag, PropsOf } from '../types'
6
+ import type { AnyTag, PropsOf } from '../types'
7
7
 
8
8
  type QuilttContainerProps<T extends AnyTag> = PropsWithChildren<
9
9
  {
@@ -1,6 +1,7 @@
1
1
  'use client'
2
2
 
3
- import { RefObject, useEffect, useRef } from 'react'
3
+ import { useEffect, useRef } from 'react'
4
+ import type { RefObject } from 'react'
4
5
 
5
6
  import useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect'
6
7
 
@@ -23,7 +24,7 @@ export function useEventListener<K extends keyof WindowEventMap>(
23
24
  // Element Event based useEventListener interface
24
25
  export function useEventListener<
25
26
  K extends keyof HTMLElementEventMap,
26
- T extends HTMLElement = HTMLDivElement
27
+ T extends HTMLElement = HTMLDivElement,
27
28
  >(
28
29
  eventName: K,
29
30
  handler: (event: HTMLElementEventMap[K]) => void,
@@ -47,7 +48,8 @@ export function useEventListener<
47
48
  KW extends keyof WindowEventMap,
48
49
  KH extends keyof HTMLElementEventMap,
49
50
  KM extends keyof MediaQueryListEventMap,
50
- T extends HTMLElement | MediaQueryList | void = void
51
+ // biome-ignore lint/suspicious/noConfusingVoidType: <explanation>
52
+ T extends HTMLElement | MediaQueryList | void = void,
51
53
  >(
52
54
  eventName: KW | KH | KM,
53
55
  handler: (
@@ -67,7 +69,7 @@ export function useEventListener<
67
69
  // Define the listening target
68
70
  const targetElement: T | Window = element?.current ?? window
69
71
 
70
- if (!(targetElement && targetElement.addEventListener)) return
72
+ if (!targetElement?.addEventListener) return
71
73
 
72
74
  // Create event listener that calls handler function stored in ref
73
75
  const listener: typeof handler = (event) => savedHandler.current(event)
@@ -1,7 +1,8 @@
1
1
  import { useCallback } from 'react'
2
2
 
3
3
  import type { AuthAPI, Maybe, QuilttJWT } from '@quiltt/core'
4
- import { JsonWebTokenParse, PrivateClaims } from '@quiltt/core'
4
+ import { JsonWebTokenParse } from '@quiltt/core'
5
+ import type { PrivateClaims } from '@quiltt/core'
5
6
 
6
7
  import type { SetSession } from '../useSession'
7
8
 
@@ -40,11 +41,9 @@ export const useImportSession: UseImportSession = (auth, session, setSession, en
40
41
  case 200:
41
42
  setSession(token)
42
43
  return true
43
- break
44
44
 
45
45
  case 401:
46
46
  return false
47
- break
48
47
 
49
48
  default:
50
49
  throw new Error(`AuthAPI.ping: Unexpected response status ${response.status}`)
@@ -1,15 +1,17 @@
1
1
  'use client'
2
2
 
3
3
  import { useCallback, useEffect, useState } from 'react'
4
- import { useQuilttSession } from './useQuilttSession'
5
- import { useScript } from './useScript'
4
+
6
5
  import {
6
+ type ConnectorSDK,
7
+ type ConnectorSDKConnector,
8
+ type ConnectorSDKConnectorOptions,
7
9
  cdnBase,
8
- ConnectorSDK,
9
- ConnectorSDKConnector,
10
- ConnectorSDKConnectorOptions,
11
10
  } from '@quiltt/core'
11
+
12
12
  import { version } from '../version'
13
+ import { useQuilttSession } from './useQuilttSession'
14
+ import { useScript } from './useScript'
13
15
 
14
16
  declare const Quiltt: ConnectorSDK
15
17
 
@@ -23,13 +25,15 @@ export const useQuilttConnector = (
23
25
  const [isOpening, setIsOpening] = useState<boolean>(false)
24
26
 
25
27
  // Set Session
28
+ // biome-ignore lint/correctness/useExhaustiveDependencies: We also need to update on status change
26
29
  useEffect(() => {
27
30
  if (typeof Quiltt === 'undefined') return
28
31
 
29
32
  Quiltt.authenticate(session?.token)
30
- }, [status, session])
33
+ }, [status, session?.token])
31
34
 
32
35
  // Set Connector
36
+ // biome-ignore lint/correctness/useExhaustiveDependencies: We also need to update on status change
33
37
  useEffect(() => {
34
38
  if (typeof Quiltt === 'undefined' || !connectorId) return
35
39
 
@@ -103,7 +107,7 @@ export const useQuilttConnector = (
103
107
  } else {
104
108
  throw new Error('Must provide `connectorId` to `open` Quiltt Connector with Method Call')
105
109
  }
106
- }, [connectorId, setIsOpening])
110
+ }, [connectorId])
107
111
 
108
112
  return { open }
109
113
  }
@@ -2,20 +2,17 @@
2
2
 
3
3
  import { useCallback } from 'react'
4
4
 
5
- import { useSession } from './useSession'
6
-
7
- import { AuthAPI, Maybe, QuilttJWT } from '@quiltt/core'
5
+ import { AuthAPI } from '@quiltt/core'
6
+ import type { Maybe, QuilttJWT } from '@quiltt/core'
8
7
 
8
+ import { useSession } from './useSession'
9
9
  import {
10
- AuthenticateSession,
11
- IdentifySession,
12
- ImportSession,
13
- RevokeSession,
14
10
  useAuthenticateSession,
15
11
  useIdentifySession,
16
12
  useImportSession,
17
13
  useRevokeSession,
18
14
  } from './session'
15
+ import type { AuthenticateSession, IdentifySession, ImportSession, RevokeSession } from './session'
19
16
  import { useQuilttSettings } from './useQuilttSettings'
20
17
 
21
18
  export type UseQuilttSession = (environmentId?: string) => {
@@ -1,7 +1,7 @@
1
1
  'use client'
2
2
 
3
- import { Dispatch, SetStateAction, useMemo } from 'react'
4
- import { useEffect, useCallback } from 'react'
3
+ import { useCallback, useEffect, useMemo } from 'react'
4
+ import type { Dispatch, SetStateAction } from 'react'
5
5
 
6
6
  import type { Maybe, PrivateClaims, QuilttJWT } from '@quiltt/core'
7
7
  import { JsonWebTokenParse, Timeoutable } from '@quiltt/core'
@@ -29,8 +29,9 @@ export const useStorage = <T>(
29
29
  initialState?: Maybe<T>
30
30
  ): [Maybe<T> | undefined, Dispatch<SetStateAction<Maybe<T> | undefined>>] => {
31
31
  const getStorage = useCallback(() => {
32
- let state
32
+ let state: Maybe<T>
33
33
 
34
+ // biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
34
35
  if ((state = GlobalStorage.get(key)) !== undefined) {
35
36
  return state
36
37
  }
@@ -58,13 +59,13 @@ export const useStorage = <T>(
58
59
  *
59
60
  * Use an empty dependency array to avoid unnecessary re-renders.
60
61
  */
62
+ // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
61
63
  useEffect(() => {
62
64
  GlobalStorage.subscribe(key, setHookState)
63
65
 
64
66
  setHookState(getStorage())
65
67
 
66
68
  return () => GlobalStorage.unsubscribe(key, setHookState)
67
- // eslint-disable-next-line react-hooks/exhaustive-deps
68
69
  }, [])
69
70
 
70
71
  return [hookState, setStorage]
@@ -28,13 +28,12 @@ export const QuilttAuthProvider: FC<QuilttAuthProviderProps> = ({ token, childre
28
28
  // Import passed in token
29
29
  useEffect(() => {
30
30
  if (token) importSession(token)
31
- // eslint-disable-next-line react-hooks/exhaustive-deps
32
- }, [token])
31
+ }, [token, importSession])
33
32
 
34
33
  // Reset Client Store when logging in or out
34
+ // biome-ignore lint/correctness/useExhaustiveDependencies: We should reset the store whenever the session changes
35
35
  useEffect(() => {
36
36
  GraphQLClient.resetStore()
37
- // eslint-disable-next-line react-hooks/exhaustive-deps
38
37
  }, [session])
39
38
 
40
39
  return <ApolloProvider client={GraphQLClient}>{children}</ApolloProvider>
package/src/types.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Component, ComponentType, FC } from 'react'
1
+ import type { Component, ComponentType, FC } from 'react'
2
2
 
3
3
  export type AnyTag = string | FC<any> | (new (props: any) => Component)
4
4
 
5
5
  export type PropsOf<Tag> = Tag extends keyof JSX.IntrinsicElements
6
6
  ? JSX.IntrinsicElements[Tag]
7
7
  : Tag extends ComponentType<infer Props>
8
- ? Props & JSX.IntrinsicAttributes
9
- : never
8
+ ? Props & JSX.IntrinsicAttributes
9
+ : never
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '3.6.8'
2
+ export const version = '3.6.10'