@saasquatch/component-boilerplate 1.2.3-9 → 1.3.1-3
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 +122 -99
- package/README.md +7 -7
- package/dist/environment/LocaleContext.d.ts +9 -0
- package/dist/environment/UserIdentityContext.d.ts +2 -0
- package/dist/environment/environment.d.ts +5 -1
- package/dist/hooks/graphql/Refresh.d.ts +9 -0
- package/dist/hooks/graphql/useBaseQuery.d.ts +4 -1
- package/dist/hooks/useDebounce.d.ts +1 -1
- package/dist/hooks/useDeepEffect.d.ts +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +36 -18
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +59 -59
- package/dist/environment/GraphQLRequestManager.d.ts +0 -1
- package/dist/environment/SquatchPortal.d.ts +0 -26
- package/dist/hooks/graphql/useBatchedQuery.d.ts +0 -45
- package/dist/hooks/graphql/useCustomQuery.d.ts +0 -30
package/package.json
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@saasquatch/component-boilerplate",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"private": false,
|
|
5
|
-
"description": "Boilerplate for writing web components for the SaaSquatch widget environments",
|
|
6
|
-
"source": "src/index.ts",
|
|
7
|
-
"main": "dist/index.js",
|
|
8
|
-
"exports": "./dist/index.modern.js",
|
|
9
|
-
"module": "dist/index.module.js",
|
|
10
|
-
"types": "dist/index.d.ts",
|
|
11
|
-
"files": [
|
|
12
|
-
"dist"
|
|
13
|
-
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "microbundle",
|
|
16
|
-
"test": "jest --forceExit",
|
|
17
|
-
"test-watch": "jest --watch"
|
|
18
|
-
},
|
|
19
|
-
"author": "SaaSquatch",
|
|
20
|
-
"license": "ISC",
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@graphql-tools/mock": "^7.0.0",
|
|
23
|
-
"@saasquatch/stencil-hooks": "^2.0.0",
|
|
24
|
-
"@saasquatch/universal-hooks-testing-library": "^0.1.0",
|
|
25
|
-
"@testing-library/react-hooks": "^5.1.0",
|
|
26
|
-
"@types/debounce": "^1.2.0",
|
|
27
|
-
"@types/debug": "^4.1.5",
|
|
28
|
-
"@types/jest": "^26.0.20",
|
|
29
|
-
"axios": "^0.21.1",
|
|
30
|
-
"esbuild-jest": "^0.5.0",
|
|
31
|
-
"graphql-tools": "^7.0.5",
|
|
32
|
-
"jest": "^26.6.3",
|
|
33
|
-
"jest-cucumber": "^3.0.1",
|
|
34
|
-
"microbundle": "^0.13.0",
|
|
35
|
-
"msw": "^0.28.1",
|
|
36
|
-
"react": "^17.0.1",
|
|
37
|
-
"react-test-renderer": "^17.0.1",
|
|
38
|
-
"ts-jest": "^26.5.4",
|
|
39
|
-
"ts-node": "^9.1.1",
|
|
40
|
-
"typescript": "^4.1.5"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@formatjs/intl": "^1.8.2",
|
|
44
|
-
"@saasquatch/dom-context-hooks": "^1.0.0",
|
|
45
|
-
"@saasquatch/universal-hooks": "^1.0.0",
|
|
46
|
-
"@wry/equality": "^0.3.3",
|
|
47
|
-
"debounce": "^1.2.0",
|
|
48
|
-
"dom-context": "^1.2.0",
|
|
49
|
-
"fast-memoize": "^2.5.2",
|
|
50
|
-
"graphql": "^15.5.0",
|
|
51
|
-
"graphql-combine-query": "^1.2.3",
|
|
52
|
-
"graphql-request": "^3.4.0",
|
|
53
|
-
"history": "^5.0.0",
|
|
54
|
-
"jsonpointer": "^4.1.0",
|
|
55
|
-
"jwt-decode": "^3.1.2",
|
|
56
|
-
"nanoid": "^3.1.23",
|
|
57
|
-
"rxjs": "^6.6.7"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@saasquatch/component-boilerplate",
|
|
3
|
+
"version": "1.3.1-3",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Boilerplate for writing web components for the SaaSquatch widget environments",
|
|
6
|
+
"source": "src/index.ts",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"exports": "./dist/index.modern.js",
|
|
9
|
+
"module": "dist/index.module.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "microbundle",
|
|
16
|
+
"test": "jest --forceExit",
|
|
17
|
+
"test-watch": "jest --watch"
|
|
18
|
+
},
|
|
19
|
+
"author": "SaaSquatch",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@graphql-tools/mock": "^7.0.0",
|
|
23
|
+
"@saasquatch/stencil-hooks": "^2.0.0",
|
|
24
|
+
"@saasquatch/universal-hooks-testing-library": "^0.1.0",
|
|
25
|
+
"@testing-library/react-hooks": "^5.1.0",
|
|
26
|
+
"@types/debounce": "^1.2.0",
|
|
27
|
+
"@types/debug": "^4.1.5",
|
|
28
|
+
"@types/jest": "^26.0.20",
|
|
29
|
+
"axios": "^0.21.1",
|
|
30
|
+
"esbuild-jest": "^0.5.0",
|
|
31
|
+
"graphql-tools": "^7.0.5",
|
|
32
|
+
"jest": "^26.6.3",
|
|
33
|
+
"jest-cucumber": "^3.0.1",
|
|
34
|
+
"microbundle": "^0.13.0",
|
|
35
|
+
"msw": "^0.28.1",
|
|
36
|
+
"react": "^17.0.1",
|
|
37
|
+
"react-test-renderer": "^17.0.1",
|
|
38
|
+
"ts-jest": "^26.5.4",
|
|
39
|
+
"ts-node": "^9.1.1",
|
|
40
|
+
"typescript": "^4.1.5"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@formatjs/intl": "^1.8.2",
|
|
44
|
+
"@saasquatch/dom-context-hooks": "^1.0.0",
|
|
45
|
+
"@saasquatch/universal-hooks": "^1.0.0",
|
|
46
|
+
"@wry/equality": "^0.3.3",
|
|
47
|
+
"debounce": "^1.2.0",
|
|
48
|
+
"dom-context": "^1.2.0",
|
|
49
|
+
"fast-memoize": "^2.5.2",
|
|
50
|
+
"graphql": "^15.5.0",
|
|
51
|
+
"graphql-combine-query": "^1.2.3",
|
|
52
|
+
"graphql-request": "^3.4.0",
|
|
53
|
+
"history": "^5.0.0",
|
|
54
|
+
"jsonpointer": "^4.1.0",
|
|
55
|
+
"jwt-decode": "^3.1.2",
|
|
56
|
+
"nanoid": "^3.1.23",
|
|
57
|
+
"rxjs": "^6.6.7"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function addQuery(queryObj: any): void;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { WidgetIdent } from "./environment";
|
|
2
|
-
/**
|
|
3
|
-
* Environment provided by components hosted in a web component (`sqh-widget`)
|
|
4
|
-
*/
|
|
5
|
-
export declare type SquatchPortal = typeof SquatchPortalInstance;
|
|
6
|
-
declare global {
|
|
7
|
-
interface Window {
|
|
8
|
-
SquatchPortal?: PortalEnv;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Portal env doesn't include User Id
|
|
13
|
-
*/
|
|
14
|
-
export declare type PortalEnv = Pick<WidgetIdent, "tenantAlias" | "appDomain" | "programId"> & { portalAuthUrl: string };
|
|
15
|
-
export declare const SquatchPortalInstance: {
|
|
16
|
-
readonly localeContext: {
|
|
17
|
-
useContext: (host: HTMLElement, options?: Pick<import("dom-context").ListenerOptions<unknown>, "onStatus" | "pollingMs" | "attempts">) => string;
|
|
18
|
-
useContextState: (host: HTMLElement, initialState?: string) => readonly [string, (value: string | ((previousState?: string) => string)) => void, import("dom-context").ContextProvider<string>];
|
|
19
|
-
Listener: new (o: Pick<import("dom-context").ListenerOptions<string>, "element" | "onChange" | "onStatus" | "pollingMs" | "attempts">) => import("dom-context").ContextListener<string>;
|
|
20
|
-
listen(o: Pick<import("dom-context").ListenerOptions<string>, "element" | "onChange" | "onStatus" | "pollingMs" | "attempts">): import("dom-context").ContextListener<string>;
|
|
21
|
-
Provider: new (o: Pick<import("dom-context").ProviderOptions<string>, "element" | "initialState">) => import("dom-context").ContextProvider<string>;
|
|
22
|
-
provide(o: Pick<import("dom-context").ProviderOptions<string>, "element" | "initialState">): import("dom-context").ContextProvider<string>;
|
|
23
|
-
provideGlobally(next: string): void;
|
|
24
|
-
name: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { RequestDocument } from "graphql-request/dist/types";
|
|
2
|
-
export declare type GqlType = RequestDocument;
|
|
3
|
-
export interface BaseQueryData<T = unknown> {
|
|
4
|
-
loading: boolean;
|
|
5
|
-
data?: T;
|
|
6
|
-
errors?: GraphQlRequestError<T>;
|
|
7
|
-
}
|
|
8
|
-
export declare type QueryData<T> = BaseQueryData<T> & {
|
|
9
|
-
refetch: (variables?: unknown) => unknown;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Note: reverse-engineered from a returned error. May not capture all error types.
|
|
13
|
-
*/
|
|
14
|
-
export declare type GraphQlRequestError<T> = {
|
|
15
|
-
response: {
|
|
16
|
-
errors: [
|
|
17
|
-
{
|
|
18
|
-
message: string;
|
|
19
|
-
locations: [{
|
|
20
|
-
line: number;
|
|
21
|
-
column: number;
|
|
22
|
-
}];
|
|
23
|
-
path: string[];
|
|
24
|
-
extensions: {
|
|
25
|
-
apiError: {
|
|
26
|
-
message: string;
|
|
27
|
-
statusCode: number;
|
|
28
|
-
apiErrorCode: string;
|
|
29
|
-
rsCode: string;
|
|
30
|
-
};
|
|
31
|
-
classification: string;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
];
|
|
35
|
-
data: Partial<T>;
|
|
36
|
-
status: number;
|
|
37
|
-
};
|
|
38
|
-
request: {
|
|
39
|
-
query: string;
|
|
40
|
-
variables: {
|
|
41
|
-
[key: string]: unknown;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
export declare function useBatchedQuery<T = any>(query: GqlType, initialState: BaseQueryData<T>): [BaseQueryData<T>, (variables: unknown) => unknown];
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { RequestDocument } from "graphql-request/dist/types";
|
|
2
|
-
declare type GqlType = RequestDocument;
|
|
3
|
-
interface CustomQueryData<T = unknown, E = any> {
|
|
4
|
-
loading: boolean;
|
|
5
|
-
data?: T;
|
|
6
|
-
errors?: CustomGraphQlRequestError<T, E>;
|
|
7
|
-
}
|
|
8
|
-
declare type QueryData<T> = CustomQueryData<T> & {
|
|
9
|
-
refetch: (variables?: unknown) => unknown;
|
|
10
|
-
};
|
|
11
|
-
declare type CustomGraphQlRequestError<T, E> = {
|
|
12
|
-
response: {
|
|
13
|
-
errors: E[];
|
|
14
|
-
data: Partial<T>;
|
|
15
|
-
status: number;
|
|
16
|
-
};
|
|
17
|
-
request: {
|
|
18
|
-
query: string;
|
|
19
|
-
variables: {
|
|
20
|
-
[key: string]: unknown;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export declare function useCustomQuery<T = any, E = any>(query: GqlType, initialState: CustomQueryData<T>, url: string): [CustomQueryData<T>, (variables: unknown) => unknown];
|
|
25
|
-
export declare const customQueryHooksFactory: <E>(url: string) => {
|
|
26
|
-
useQuery: <T = any>(query: GqlType, variables: unknown, skip?: boolean) => QueryData<T>;
|
|
27
|
-
useLazyQuery: <T_1 = any>(query: GqlType) => [(e: unknown) => unknown, QueryData<T_1>];
|
|
28
|
-
useMutation: <T_2 = any>(query: GqlType) => [(e: unknown) => unknown, CustomQueryData<T_2, any>];
|
|
29
|
-
};
|
|
30
|
-
export {};
|