@quiltt/react 3.8.0 → 3.8.2
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 +18 -0
- package/README.md +5 -1
- package/dist/{QuilttAuthProvider-client-CU478Ahm.js → QuilttAuthProvider-client-DE7DRmFG.js} +31 -22
- package/dist/index.d.ts +2 -4
- package/dist/index.js +5 -5
- package/dist/{useQuilttClient-client-Bwrsgaab.js → useQuilttClient-client-D5o2Whsn.js} +1 -1
- package/dist/{useQuilttConnector-client-D_LGauFU.js → useQuilttConnector-client-_DPRlIM5.js} +2 -2
- package/dist/{useQuilttSession-client-C0NMXZs8.js → useQuilttSession-client-YSZevZF3.js} +1 -1
- package/package.json +3 -3
- package/src/providers/QuilttAuthProvider.tsx +12 -7
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @quiltt/react
|
|
2
2
|
|
|
3
|
+
## 3.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#303](https://github.com/quiltt/quiltt-js/pull/303) [`d1ceb66`](https://github.com/quiltt/quiltt-js/commit/d1ceb6648f4c2747988f8d6cacbee9946beaea0c) Thanks [@rubendinho](https://github.com/rubendinho)! - Reduce bundle size
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`d1ceb66`](https://github.com/quiltt/quiltt-js/commit/d1ceb6648f4c2747988f8d6cacbee9946beaea0c)]:
|
|
10
|
+
- @quiltt/core@3.8.2
|
|
11
|
+
|
|
12
|
+
## 3.8.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#300](https://github.com/quiltt/quiltt-js/pull/300) [`a359810`](https://github.com/quiltt/quiltt-js/commit/a3598104565b4428beef9de37f85211e9caf465b) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Make @quiltt/react-native ESM only
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`a359810`](https://github.com/quiltt/quiltt-js/commit/a3598104565b4428beef9de37f85211e9caf465b)]:
|
|
19
|
+
- @quiltt/core@3.8.1
|
|
20
|
+
|
|
3
21
|
## 3.8.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
`@quiltt/react` provides React Components and Hooks for integrating Quiltt into React-based applications.
|
|
7
7
|
|
|
8
|
+
See the guides [here](https://www.quiltt.dev/connector/sdks/react).
|
|
9
|
+
|
|
8
10
|
## Installation
|
|
9
11
|
|
|
10
12
|
```shell
|
|
@@ -100,7 +102,9 @@ A provider component for passing Session and settings down to the rest of your a
|
|
|
100
102
|
import { QuilttProvider } from '@quiltt/react'
|
|
101
103
|
|
|
102
104
|
const Layout = ({ children }) => {
|
|
103
|
-
|
|
105
|
+
const sessionToken = "<SESSION_TOKEN_FROM_SERVER>"
|
|
106
|
+
|
|
107
|
+
return <QuilttProvider token={sessionToken}>{children}</QuilttProvider>
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
export default Layout
|
package/dist/{QuilttAuthProvider-client-CU478Ahm.js → QuilttAuthProvider-client-DE7DRmFG.js}
RENAMED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
'use strict';
|
|
2
1
|
'use client';
|
|
3
|
-
import require$$0, { useCallback, useEffect } from 'react';
|
|
2
|
+
import require$$0, { useCallback, useMemo, useEffect } from 'react';
|
|
4
3
|
import { JsonWebTokenParse, QuilttClient, InMemoryCache as InMemoryCache$1 } from '@quiltt/core';
|
|
5
4
|
import './useQuilttSettings-client-DU_Qfc8X.js';
|
|
6
5
|
import './useSession-client-CG5lGS9F.js';
|
|
7
6
|
import { jsx } from 'react/jsx-runtime';
|
|
8
|
-
import { u as useQuilttSession } from './useQuilttSession-client-
|
|
7
|
+
import { u as useQuilttSession } from './useQuilttSession-client-YSZevZF3.js';
|
|
9
8
|
|
|
10
9
|
function _mergeNamespaces(n, m) {
|
|
11
10
|
m.forEach(function (e) {
|
|
@@ -6947,6 +6946,10 @@ function supportsResultCaching(store) {
|
|
|
6947
6946
|
return !!(store instanceof EntityStore && store.group.caching);
|
|
6948
6947
|
}
|
|
6949
6948
|
|
|
6949
|
+
function getDefaultExportFromCjs (x) {
|
|
6950
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
6951
|
+
}
|
|
6952
|
+
|
|
6950
6953
|
function shallowCopy(value) {
|
|
6951
6954
|
if (isNonNullObject(value)) {
|
|
6952
6955
|
return isArray(value) ? value.slice(0) : __assign({
|
|
@@ -12590,18 +12593,23 @@ if (globalThis.__DEV__ !== false) {
|
|
|
12590
12593
|
|
|
12591
12594
|
setVerbosity(globalThis.__DEV__ !== false ? "log" : "silent");
|
|
12592
12595
|
|
|
12593
|
-
|
|
12594
|
-
|
|
12595
|
-
}
|
|
12596
|
+
var rehackt;
|
|
12597
|
+
var hasRequiredRehackt;
|
|
12596
12598
|
|
|
12597
|
-
|
|
12599
|
+
function requireRehackt () {
|
|
12600
|
+
if (hasRequiredRehackt) return rehackt;
|
|
12601
|
+
hasRequiredRehackt = 1;
|
|
12602
|
+
rehackt = require$$0;
|
|
12603
|
+
return rehackt;
|
|
12604
|
+
}
|
|
12598
12605
|
|
|
12599
|
-
var
|
|
12606
|
+
var rehacktExports = requireRehackt();
|
|
12607
|
+
var index = /*@__PURE__*/getDefaultExportFromCjs(rehacktExports);
|
|
12600
12608
|
|
|
12601
12609
|
var React = /*#__PURE__*/_mergeNamespaces({
|
|
12602
12610
|
__proto__: null,
|
|
12603
12611
|
default: index
|
|
12604
|
-
}, [
|
|
12612
|
+
}, [rehacktExports]);
|
|
12605
12613
|
|
|
12606
12614
|
// To make sure Apollo Client doesn't create more than one React context
|
|
12607
12615
|
// (which can lead to problems like having an Apollo Client instance added
|
|
@@ -12610,10 +12618,10 @@ var React = /*#__PURE__*/_mergeNamespaces({
|
|
|
12610
12618
|
var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
|
|
12611
12619
|
function getApolloContext() {
|
|
12612
12620
|
invariant("createContext" in React, 45);
|
|
12613
|
-
var context =
|
|
12621
|
+
var context = rehacktExports.createContext[contextKey];
|
|
12614
12622
|
if (!context) {
|
|
12615
|
-
Object.defineProperty(
|
|
12616
|
-
value: context =
|
|
12623
|
+
Object.defineProperty(rehacktExports.createContext, contextKey, {
|
|
12624
|
+
value: context = rehacktExports.createContext({}),
|
|
12617
12625
|
enumerable: false,
|
|
12618
12626
|
writable: false,
|
|
12619
12627
|
configurable: true
|
|
@@ -12626,8 +12634,8 @@ function getApolloContext() {
|
|
|
12626
12634
|
var ApolloProvider = function(_a) {
|
|
12627
12635
|
var client = _a.client, children = _a.children;
|
|
12628
12636
|
var ApolloContext = getApolloContext();
|
|
12629
|
-
var parentContext =
|
|
12630
|
-
var context =
|
|
12637
|
+
var parentContext = rehacktExports.useContext(ApolloContext);
|
|
12638
|
+
var context = rehacktExports.useMemo(function() {
|
|
12631
12639
|
return __assign(__assign({}, parentContext), {
|
|
12632
12640
|
client: client || parentContext.client
|
|
12633
12641
|
});
|
|
@@ -12636,7 +12644,7 @@ var ApolloProvider = function(_a) {
|
|
|
12636
12644
|
client
|
|
12637
12645
|
]);
|
|
12638
12646
|
invariant(context.client, 46);
|
|
12639
|
-
return
|
|
12647
|
+
return rehacktExports.createElement(ApolloContext.Provider, {
|
|
12640
12648
|
value: context
|
|
12641
12649
|
}, children);
|
|
12642
12650
|
};
|
|
@@ -12656,7 +12664,7 @@ var ApolloProvider = function(_a) {
|
|
|
12656
12664
|
* @since 3.0.0
|
|
12657
12665
|
* @returns The `ApolloClient` instance being used by the application.
|
|
12658
12666
|
*/ function useApolloClient(override) {
|
|
12659
|
-
var context =
|
|
12667
|
+
var context = rehacktExports.useContext(getApolloContext());
|
|
12660
12668
|
var client = override || context.client;
|
|
12661
12669
|
invariant(!!client, 49);
|
|
12662
12670
|
return client;
|
|
@@ -12951,9 +12959,6 @@ var OBSERVED_CHANGED_OPTIONS = [
|
|
|
12951
12959
|
return InternalQueryReference;
|
|
12952
12960
|
})();
|
|
12953
12961
|
|
|
12954
|
-
const GraphQLClient = new QuilttClient({
|
|
12955
|
-
cache: new InMemoryCache$1()
|
|
12956
|
-
});
|
|
12957
12962
|
/**
|
|
12958
12963
|
* If a token is provided, will validate the token against the api and then import
|
|
12959
12964
|
* it into trusted storage. While this process is happening, the component is put
|
|
@@ -12962,6 +12967,10 @@ const GraphQLClient = new QuilttClient({
|
|
|
12962
12967
|
*
|
|
12963
12968
|
*/ const QuilttAuthProvider = ({ token, children })=>{
|
|
12964
12969
|
const { session, importSession } = useQuilttSession();
|
|
12970
|
+
// @todo: extract into a provider so it can accessed by child components
|
|
12971
|
+
const graphQLClient = useMemo(()=>new QuilttClient({
|
|
12972
|
+
cache: new InMemoryCache$1()
|
|
12973
|
+
}), []);
|
|
12965
12974
|
// Import passed in token
|
|
12966
12975
|
useEffect(()=>{
|
|
12967
12976
|
if (token) importSession(token);
|
|
@@ -12972,14 +12981,14 @@ const GraphQLClient = new QuilttClient({
|
|
|
12972
12981
|
// Reset Client Store when logging in or out
|
|
12973
12982
|
// biome-ignore lint/correctness/useExhaustiveDependencies: We should reset the store whenever the session changes
|
|
12974
12983
|
useEffect(()=>{
|
|
12975
|
-
|
|
12984
|
+
graphQLClient.resetStore();
|
|
12976
12985
|
}, [
|
|
12977
12986
|
session
|
|
12978
12987
|
]);
|
|
12979
12988
|
return /*#__PURE__*/ jsx(ApolloProvider, {
|
|
12980
|
-
client:
|
|
12989
|
+
client: graphQLClient,
|
|
12981
12990
|
children: children
|
|
12982
12991
|
});
|
|
12983
12992
|
};
|
|
12984
12993
|
|
|
12985
|
-
export {
|
|
12994
|
+
export { QuilttAuthProvider as Q, useImportSession as a, useIdentifySession as b, useAuthenticateSession as c, useRevokeSession as d, useApolloClient as u };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Maybe, QuilttJWT, UsernamePayload, UnprocessableData, AuthAPI, PasscodePayload, ConnectorSDKConnectorOptions,
|
|
1
|
+
import { Maybe, QuilttJWT, UsernamePayload, UnprocessableData, AuthAPI, PasscodePayload, ConnectorSDKConnectorOptions, ConnectorSDKCallbacks } from '@quiltt/core';
|
|
2
2
|
export * from '@quiltt/core';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { RefObject, useLayoutEffect, Dispatch, SetStateAction, FC, PropsWithChildren, Component, ComponentType } from 'react';
|
|
5
5
|
import { useApolloClient } from '@apollo/client/index.js';
|
|
6
|
-
import * as _apollo_client from '@apollo/client';
|
|
7
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
7
|
|
|
9
8
|
declare function useEventListener<K extends keyof MediaQueryListEventMap>(eventName: K, handler: (event: MediaQueryListEventMap[K]) => void, element: RefObject<MediaQueryList>, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -111,7 +110,6 @@ type QuilttAuthProviderProps = PropsWithChildren & {
|
|
|
111
110
|
/** The Session token obtained from the server */
|
|
112
111
|
token?: string;
|
|
113
112
|
};
|
|
114
|
-
declare const GraphQLClient: QuilttClient<_apollo_client.NormalizedCacheObject>;
|
|
115
113
|
/**
|
|
116
114
|
* If a token is provided, will validate the token against the api and then import
|
|
117
115
|
* it into trusted storage. While this process is happening, the component is put
|
|
@@ -157,4 +155,4 @@ type QuilttContainerProps<T extends AnyTag> = PropsWithChildren<{
|
|
|
157
155
|
*/
|
|
158
156
|
declare const QuilttContainer: <T extends AnyTag = "div">({ as, connectorId, connectionId, onEvent, onLoad, onExit, onExitSuccess, onExitAbort, onExitError, children, ...props }: QuilttContainerProps<T> & PropsOf<T>) => react_jsx_runtime.JSX.Element;
|
|
159
157
|
|
|
160
|
-
export { type AuthenticateSession,
|
|
158
|
+
export { type AuthenticateSession, type IdentifySession, type ImportSession, QuilttAuthProvider, QuilttButton, QuilttContainer, QuilttProvider, QuilttSettings, QuilttSettingsProvider, type RevokeSession, type SetSession, type UseQuilttSession, useAuthenticateSession, useEventListener, useIdentifySession, useImportSession, useIsomorphicLayoutEffect, useQuilttClient, useQuilttConnector, useQuilttSession, useQuilttSettings, useRevokeSession, useSession, useStorage };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export * from '@quiltt/core';
|
|
2
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-
|
|
5
|
-
export {
|
|
6
|
-
export { u as useQuilttClient } from './useQuilttClient-client-
|
|
7
|
-
import { u as useQuilttConnector } from './useQuilttConnector-client-
|
|
8
|
-
export { u as useQuilttSession } from './useQuilttSession-client-
|
|
4
|
+
import { Q as QuilttAuthProvider } from './QuilttAuthProvider-client-DE7DRmFG.js';
|
|
5
|
+
export { c as useAuthenticateSession, b as useIdentifySession, a as useImportSession, d as useRevokeSession } from './QuilttAuthProvider-client-DE7DRmFG.js';
|
|
6
|
+
export { u as useQuilttClient } from './useQuilttClient-client-D5o2Whsn.js';
|
|
7
|
+
import { u as useQuilttConnector } from './useQuilttConnector-client-_DPRlIM5.js';
|
|
8
|
+
export { u as useQuilttSession } from './useQuilttSession-client-YSZevZF3.js';
|
|
9
9
|
export { Q as QuilttSettings, u as useQuilttSettings } from './useQuilttSettings-client-DU_Qfc8X.js';
|
|
10
10
|
export { u as useSession } from './useSession-client-CG5lGS9F.js';
|
|
11
11
|
export { u as useStorage } from './useStorage-client-B3keU-oI.js';
|
package/dist/{useQuilttConnector-client-D_LGauFU.js → useQuilttConnector-client-_DPRlIM5.js}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useState, useEffect, useCallback } from 'react';
|
|
3
3
|
import { cdnBase } from '@quiltt/core';
|
|
4
|
-
import { u as useQuilttSession } from './useQuilttSession-client-
|
|
4
|
+
import { u as useQuilttSession } from './useQuilttSession-client-YSZevZF3.js';
|
|
5
5
|
import { u as useScript } from './useScript-client-Cx5nb9RW.js';
|
|
6
6
|
|
|
7
7
|
// Generated by genversion.
|
|
8
|
-
const version = '3.8.
|
|
8
|
+
const version = '3.8.2';
|
|
9
9
|
|
|
10
10
|
const useQuilttConnector = (connectorId, options)=>{
|
|
11
11
|
const status = useScript(`${cdnBase}/v1/connector.js?agent=react-${version}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { AuthAPI } from '@quiltt/core';
|
|
4
|
-
import { a as useImportSession, b as useIdentifySession, c as useAuthenticateSession, d as useRevokeSession } from './QuilttAuthProvider-client-
|
|
4
|
+
import { a as useImportSession, b as useIdentifySession, c as useAuthenticateSession, d as useRevokeSession } from './QuilttAuthProvider-client-DE7DRmFG.js';
|
|
5
5
|
import { u as useQuilttSettings } from './useQuilttSettings-client-DU_Qfc8X.js';
|
|
6
6
|
import { u as useSession } from './useSession-client-CG5lGS9F.js';
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quiltt/react",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.2",
|
|
4
4
|
"description": "React components and hooks for Quiltt Connector",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"quiltt",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"CHANGELOG.md"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@quiltt/core": "3.8.
|
|
38
|
+
"@quiltt/core": "3.8.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@apollo/client": "3.9.11",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/node": "22.9.0",
|
|
44
44
|
"@types/react": "18.3.12",
|
|
45
45
|
"@types/react-dom": "18.3.1",
|
|
46
|
-
"bunchee": "5.
|
|
46
|
+
"bunchee": "5.6.1",
|
|
47
47
|
"react": "18.3.1",
|
|
48
48
|
"react-dom": "18.3.1",
|
|
49
49
|
"rimraf": "6.0.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import type { FC, PropsWithChildren } from 'react'
|
|
4
|
-
import { useEffect } from 'react'
|
|
4
|
+
import { useEffect, useMemo } from 'react'
|
|
5
5
|
|
|
6
6
|
import { ApolloProvider } from '@apollo/client'
|
|
7
7
|
import { InMemoryCache, QuilttClient } from '@quiltt/core'
|
|
@@ -12,10 +12,6 @@ type QuilttAuthProviderProps = PropsWithChildren & {
|
|
|
12
12
|
token?: string
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const GraphQLClient = new QuilttClient({
|
|
16
|
-
cache: new InMemoryCache(),
|
|
17
|
-
})
|
|
18
|
-
|
|
19
15
|
/**
|
|
20
16
|
* If a token is provided, will validate the token against the api and then import
|
|
21
17
|
* it into trusted storage. While this process is happening, the component is put
|
|
@@ -26,6 +22,15 @@ export const GraphQLClient = new QuilttClient({
|
|
|
26
22
|
export const QuilttAuthProvider: FC<QuilttAuthProviderProps> = ({ token, children }) => {
|
|
27
23
|
const { session, importSession } = useQuilttSession()
|
|
28
24
|
|
|
25
|
+
// @todo: extract into a provider so it can accessed by child components
|
|
26
|
+
const graphQLClient = useMemo(
|
|
27
|
+
() =>
|
|
28
|
+
new QuilttClient({
|
|
29
|
+
cache: new InMemoryCache(),
|
|
30
|
+
}),
|
|
31
|
+
[]
|
|
32
|
+
)
|
|
33
|
+
|
|
29
34
|
// Import passed in token
|
|
30
35
|
useEffect(() => {
|
|
31
36
|
if (token) importSession(token)
|
|
@@ -34,10 +39,10 @@ export const QuilttAuthProvider: FC<QuilttAuthProviderProps> = ({ token, childre
|
|
|
34
39
|
// Reset Client Store when logging in or out
|
|
35
40
|
// biome-ignore lint/correctness/useExhaustiveDependencies: We should reset the store whenever the session changes
|
|
36
41
|
useEffect(() => {
|
|
37
|
-
|
|
42
|
+
graphQLClient.resetStore()
|
|
38
43
|
}, [session])
|
|
39
44
|
|
|
40
|
-
return <ApolloProvider client={
|
|
45
|
+
return <ApolloProvider client={graphQLClient}>{children}</ApolloProvider>
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
export default QuilttAuthProvider
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '3.8.
|
|
2
|
+
export const version = '3.8.2'
|