@jobber/hooks 1.9.2-pre.34 → 1.9.2-pre.45
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/dist/index.js +11 -18
- package/dist/useAssert/index.js +1 -1
- package/dist/useAssert/useAssert.js +0 -1
- package/dist/useCollectionQuery/index.js +1 -1
- package/dist/useCollectionQuery/mdxUtils.js +0 -1
- package/dist/useCollectionQuery/test-utilities/index.js +6 -13
- package/dist/useCollectionQuery/test-utilities/mocks.js +0 -1
- package/dist/useCollectionQuery/test-utilities/queries.js +0 -1
- package/dist/useCollectionQuery/test-utilities/utils.js +0 -1
- package/dist/useCollectionQuery/uniqueEdges.js +0 -1
- package/dist/useCollectionQuery/uniqueNodes.js +0 -1
- package/dist/useCollectionQuery/useCollectionQuery.d.ts +1 -1
- package/dist/useCollectionQuery/useCollectionQuery.js +5 -10
- package/dist/useFormState/index.js +1 -1
- package/dist/useFormState/useFormState.d.ts +2 -0
- package/dist/useFormState/useFormState.js +0 -1
- package/dist/useIsMounted/index.js +1 -1
- package/dist/useIsMounted/useIsMounted.js +0 -1
- package/dist/useOnKeyDown/index.js +1 -1
- package/dist/useOnKeyDown/useOnKeyDown.js +0 -1
- package/dist/usePasswordStrength/index.js +1 -1
- package/dist/usePasswordStrength/usePasswordStrength.d.ts +2 -0
- package/dist/usePasswordStrength/usePasswordStrength.js +0 -1
- package/dist/useRefocusOnActivator/index.js +1 -1
- package/dist/useRefocusOnActivator/useRefocusOnActivator.js +1 -2
- package/dist/useResizeObserver.d.ts +2 -0
- package/dist/useResizeObserver.js +0 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
2
|
+
function __export(m) {
|
|
3
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
+
}
|
|
12
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
__export(require("./useResizeObserver"));
|
|
7
|
+
__export(require("./useFormState"));
|
|
8
|
+
__export(require("./useOnKeyDown"));
|
|
9
|
+
__export(require("./useCollectionQuery"));
|
|
10
|
+
__export(require("./useIsMounted"));
|
|
11
|
+
__export(require("./usePasswordStrength"));
|
|
12
|
+
__export(require("./useRefocusOnActivator"));
|
|
13
|
+
__export(require("./useAssert"));
|
package/dist/useAssert/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var useAssert_1 = require("./useAssert");
|
|
4
|
-
|
|
4
|
+
exports.useAssert = useAssert_1.useAssert;
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useAssert = void 0;
|
|
7
6
|
var process_1 = __importDefault(require("process"));
|
|
8
7
|
function useAssert(shouldShow, message, options) {
|
|
9
8
|
if (process_1.default.env.NODE_ENV !== "production" && shouldShow) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var useCollectionQuery_1 = require("./useCollectionQuery");
|
|
4
|
-
|
|
4
|
+
exports.useCollectionQuery = useCollectionQuery_1.useCollectionQuery;
|
|
@@ -4,7 +4,6 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
return cooked;
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.returnValues = exports.subscriptionPropsList = exports.propsList = exports.getLoadingState = exports.apolloClient = exports.LIST_QUERY = void 0;
|
|
8
7
|
var client_1 = require("@apollo/client");
|
|
9
8
|
exports.LIST_QUERY = client_1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query ListQuery($cursor: String) {\n allPlanets(first: 4, after: $cursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n name\n id\n }\n cursor\n }\n totalCount\n }\n }\n"], ["\n query ListQuery($cursor: String) {\n allPlanets(first: 4, after: $cursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n name\n id\n }\n cursor\n }\n totalCount\n }\n }\n"])));
|
|
10
9
|
exports.apolloClient = new client_1.ApolloClient({
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
2
|
+
function __export(m) {
|
|
3
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
+
}
|
|
12
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
__export(require("./queries"));
|
|
7
|
+
__export(require("./utils"));
|
|
8
|
+
__export(require("./mocks"));
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.setListQueryMockHasNextPage = exports.buildListRequestMockForNextPage = exports.buildSubscriptionRequestMock = exports.buildListRequestMock = exports.subscriptionQueryMock = exports.listQueryResponseMock = exports.wrapper = void 0;
|
|
7
6
|
var react_testing_1 = require("@apollo/react-testing");
|
|
8
7
|
var react_1 = __importDefault(require("react"));
|
|
9
8
|
var uuid_1 = require("uuid");
|
|
@@ -4,7 +4,6 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
return cooked;
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.SUBSCRIPTION_QUERY = exports.LIST_QUERY = void 0;
|
|
8
7
|
var client_1 = require("@apollo/client");
|
|
9
8
|
exports.LIST_QUERY = client_1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query ConversationMessages($cursor: string, $searchTerm: string) {\n conversation(id: \"MQ==\") {\n smsMessages(first: 1, after: $cursor, searchTerm: $searchTerm) {\n edges {\n node {\n __typename\n id\n }\n }\n nodes {\n __typename\n id\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n totalCount\n }\n }\n }\n"], ["\n query ConversationMessages($cursor: string, $searchTerm: string) {\n conversation(id: \"MQ==\") {\n smsMessages(first: 1, after: $cursor, searchTerm: $searchTerm) {\n edges {\n node {\n __typename\n id\n }\n }\n nodes {\n __typename\n id\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n totalCount\n }\n }\n }\n"])));
|
|
10
9
|
exports.SUBSCRIPTION_QUERY = client_1.gql(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n subscription ConversationMessage($conversationId: EncodedId!) {\n conversationMessage(conversationId: $conversationId) {\n smsMessage {\n __typename\n id\n }\n }\n }\n"], ["\n subscription ConversationMessage($conversationId: EncodedId!) {\n conversationMessage(conversationId: $conversationId) {\n smsMessage {\n __typename\n id\n }\n }\n }\n"])));
|
|
@@ -36,7 +36,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.wait = void 0;
|
|
40
39
|
function wait(milliseconds) {
|
|
41
40
|
if (milliseconds === void 0) { milliseconds = 0; }
|
|
42
41
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -31,7 +31,6 @@ var __spread = (this && this.__spread) || function () {
|
|
|
31
31
|
return ar;
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
exports.isAlreadyUpdated = exports.useCollectionQuery = void 0;
|
|
35
34
|
var client_1 = require("@apollo/client");
|
|
36
35
|
var lodash_1 = require("lodash");
|
|
37
36
|
var react_1 = require("react");
|
|
@@ -40,8 +39,8 @@ var uniqueNodes_1 = require("./uniqueNodes");
|
|
|
40
39
|
var uniqueEdges_1 = require("./uniqueEdges");
|
|
41
40
|
var useIsMounted_1 = require("../useIsMounted");
|
|
42
41
|
function useCollectionQuery(_a) {
|
|
43
|
-
var _b, _c;
|
|
44
42
|
var query = _a.query, queryOptions = _a.queryOptions, getCollectionByPath = _a.getCollectionByPath, subscription = _a.subscription;
|
|
43
|
+
var _b, _c;
|
|
45
44
|
var _d = client_1.useQuery(query, queryOptions), data = _d.data, loading = _d.loading, refetch = _d.refetch, error = _d.error, fetchMore = _d.fetchMore, subscribeToMore = _d.subscribeToMore;
|
|
46
45
|
var isMounted = useIsMounted_1.useIsMounted();
|
|
47
46
|
var _e = __read(react_1.useState(false), 2), loadingRefresh = _e[0], setLoadingRefresh = _e[1];
|
|
@@ -166,10 +165,8 @@ function fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath)
|
|
|
166
165
|
if (outputCollection.edges && nextCollection.edges) {
|
|
167
166
|
outputCollection.edges = getUpdatedEdges(outputCollection.edges, nextCollection.edges);
|
|
168
167
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
totalCount: nextCollection.totalCount,
|
|
172
|
-
});
|
|
168
|
+
var totalCount = outputCollection.totalCount != undefined ? { totalCount: nextCollection.totalCount } : {};
|
|
169
|
+
Object.assign(outputCollection, __assign({ pageInfo: lodash_1.cloneDeep(nextCollection.pageInfo) }, totalCount));
|
|
173
170
|
return output;
|
|
174
171
|
}
|
|
175
172
|
function subscribeToMoreHandler(isSearching, prev, getCollectionByPath, subscriptionData, getNodeByPath) {
|
|
@@ -187,10 +184,8 @@ function subscribeToMoreHandler(isSearching, prev, getCollectionByPath, subscrip
|
|
|
187
184
|
if (outputCollection.edges) {
|
|
188
185
|
outputCollection.edges = getUpdatedEdges(outputCollection.edges, [uniqueEdges_1.createEdge(node)], false);
|
|
189
186
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
totalCount: outputCollection.totalCount + 1,
|
|
193
|
-
});
|
|
187
|
+
var totalCount = outputCollection.totalCount != undefined ? { totalCount: outputCollection.totalCount + 1 } : {};
|
|
188
|
+
Object.assign(outputCollection, __assign({ pageInfo: lodash_1.cloneDeep(outputCollection.pageInfo) }, totalCount));
|
|
194
189
|
return output;
|
|
195
190
|
}
|
|
196
191
|
function isAlreadyUpdated(outputCollection, newNode) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var useFormState_1 = require("./useFormState");
|
|
4
|
-
|
|
4
|
+
exports.useFormState = useFormState_1.useFormState;
|
|
@@ -16,7 +16,6 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.useFormState = void 0;
|
|
20
19
|
var react_1 = require("react");
|
|
21
20
|
function useFormState() {
|
|
22
21
|
var _a = __read(react_1.useState({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var useIsMounted_1 = require("./useIsMounted");
|
|
4
|
-
|
|
4
|
+
exports.useIsMounted = useIsMounted_1.useIsMounted;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var useOnKeyDown_1 = require("./useOnKeyDown");
|
|
4
|
-
|
|
4
|
+
exports.useOnKeyDown = useOnKeyDown_1.useOnKeyDown;
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useOnKeyDown = void 0;
|
|
7
6
|
var event_listener_1 = __importDefault(require("@use-it/event-listener"));
|
|
8
7
|
function useOnKeyDown(callback, keys) {
|
|
9
8
|
event_listener_1.default("keydown", handler);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var usePasswordStrength_1 = require("./usePasswordStrength");
|
|
4
|
-
|
|
4
|
+
exports.usePasswordStrength = usePasswordStrength_1.usePasswordStrength;
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.usePasswordStrength = void 0;
|
|
7
6
|
var react_1 = require("react");
|
|
8
7
|
var zxcvbn_1 = __importDefault(require("zxcvbn"));
|
|
9
8
|
function usePasswordStrength(password, dictionary) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var useRefocusOnActivator_1 = require("./useRefocusOnActivator");
|
|
4
|
-
|
|
4
|
+
exports.useRefocusOnActivator = useRefocusOnActivator_1.useRefocusOnActivator;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useRefocusOnActivator = void 0;
|
|
4
3
|
var react_1 = require("react");
|
|
5
4
|
/**
|
|
6
5
|
* Brings back the focus to the element that opened an overlaid element once
|
|
@@ -11,7 +10,7 @@ var react_1 = require("react");
|
|
|
11
10
|
function useRefocusOnActivator(active) {
|
|
12
11
|
react_1.useEffect(function () {
|
|
13
12
|
var activator;
|
|
14
|
-
if (
|
|
13
|
+
if (active && !activator) {
|
|
15
14
|
activator = document.activeElement;
|
|
16
15
|
}
|
|
17
16
|
return function () {
|
|
@@ -19,7 +19,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.useResizeObserver = exports.Breakpoints = void 0;
|
|
23
22
|
var react_1 = require("react");
|
|
24
23
|
// Importing the polyfilled version of ResizeObserver
|
|
25
24
|
// eslint-disable-next-line import/no-internal-modules
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/hooks",
|
|
3
|
-
"version": "1.9.2-pre.
|
|
3
|
+
"version": "1.9.2-pre.45+9e05d78",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.js",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"@apollo/client": "^3.3.16",
|
|
41
41
|
"react": "^16.8.6"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "9e05d78ffd93183e0955708707b04134d9631da1"
|
|
44
44
|
}
|