@trycourier/react-provider 1.57.1-internal.bf0253d.0 → 1.58.2-internal.7c87b6f.0
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/hooks/use-client-source-id.js +17 -7
- package/dist/hooks/use-transport.js +43 -9
- package/dist/index.js +6 -0
- package/dist/transports/courier/index.js +7 -0
- package/dist/ws.js +6 -1
- package/package.json +6 -4
- package/typings/hooks/use-client-source-id.d.ts.map +1 -1
- package/typings/hooks/use-transport.d.ts +11 -10
- package/typings/hooks/use-transport.d.ts.map +1 -1
- package/typings/index.d.ts.map +1 -1
- package/typings/transports/courier/index.d.ts +1 -0
- package/typings/transports/courier/index.d.ts.map +1 -1
- package/typings/types.d.ts +2 -2
- package/typings/types.d.ts.map +1 -1
- package/typings/ws.d.ts +1 -0
- package/typings/ws.d.ts.map +1 -1
- package/dist/hooks/use-hash.js +0 -31
- package/typings/hooks/use-hash.d.ts +0 -3
- package/typings/hooks/use-hash.d.ts.map +0 -1
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _useHash = _interopRequireDefault(require("./use-hash"));
|
|
13
|
-
|
|
14
12
|
var uuid = _interopRequireWildcard(require("uuid"));
|
|
15
13
|
|
|
16
14
|
var _react = require("react");
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
var _jwtDecode = _interopRequireDefault(require("jwt-decode"));
|
|
17
|
+
|
|
20
18
|
var useClientSourceId = function useClientSourceId(_ref) {
|
|
21
19
|
var clientKey = _ref.clientKey,
|
|
22
20
|
userId = _ref.userId,
|
|
23
21
|
authorization = _ref.authorization,
|
|
24
22
|
id = _ref.id,
|
|
25
23
|
localStorage = _ref.localStorage;
|
|
26
|
-
var clientSourceKey = (0,
|
|
24
|
+
var clientSourceKey = (0, _react.useMemo)(function () {
|
|
25
|
+
var _decoded$scope, _decoded$scope$split, _decoded$scope$split$;
|
|
26
|
+
|
|
27
|
+
if (!authorization) {
|
|
28
|
+
return "".concat(clientKey, "/").concat(userId);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var decoded = (0, _jwtDecode["default"])(authorization);
|
|
32
|
+
var scopeUserId = decoded === null || decoded === void 0 ? void 0 : (_decoded$scope = decoded.scope) === null || _decoded$scope === void 0 ? void 0 : (_decoded$scope$split = _decoded$scope.split(" ")) === null || _decoded$scope$split === void 0 ? void 0 : (_decoded$scope$split$ = _decoded$scope$split.find(function (s) {
|
|
33
|
+
return s.includes("user_id");
|
|
34
|
+
})) === null || _decoded$scope$split$ === void 0 ? void 0 : _decoded$scope$split$.replace("user_id", "");
|
|
35
|
+
return "".concat(decoded === null || decoded === void 0 ? void 0 : decoded.tenantId, "/").concat(scopeUserId);
|
|
36
|
+
}, [authorization, clientKey, userId]);
|
|
27
37
|
return (0, _react.useMemo)(function () {
|
|
28
38
|
if (!localStorage) {
|
|
29
39
|
return;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -9,29 +11,61 @@ var _react = require("react");
|
|
|
9
11
|
|
|
10
12
|
var _transports = require("../transports");
|
|
11
13
|
|
|
12
|
-
var
|
|
14
|
+
var _jwtDecode = _interopRequireDefault(require("jwt-decode"));
|
|
15
|
+
|
|
16
|
+
var useTransport = function useTransport(_ref) {
|
|
13
17
|
var authorization = _ref.authorization,
|
|
14
18
|
clientSourceId = _ref.clientSourceId,
|
|
15
19
|
clientKey = _ref.clientKey,
|
|
16
20
|
transport = _ref.transport,
|
|
17
21
|
userSignature = _ref.userSignature,
|
|
18
22
|
wsOptions = _ref.wsOptions;
|
|
23
|
+
var transportRef = (0, _react.useRef)();
|
|
19
24
|
return (0, _react.useMemo)(function () {
|
|
25
|
+
var _transportRef$current;
|
|
26
|
+
|
|
20
27
|
if (transport) {
|
|
21
28
|
return transport;
|
|
22
29
|
}
|
|
23
30
|
|
|
24
|
-
if ((
|
|
25
|
-
|
|
31
|
+
if (authorization && transportRef !== null && transportRef !== void 0 && (_transportRef$current = transportRef.current) !== null && _transportRef$current !== void 0 && _transportRef$current.authorization && transportRef !== null && transportRef !== void 0 && transportRef.current.transport) {
|
|
32
|
+
var _transportRef$current2;
|
|
33
|
+
|
|
34
|
+
var oldDecodedAuth = (0, _jwtDecode["default"])(transportRef === null || transportRef === void 0 ? void 0 : (_transportRef$current2 = transportRef.current) === null || _transportRef$current2 === void 0 ? void 0 : _transportRef$current2.authorization);
|
|
35
|
+
var newDecodedAuth = (0, _jwtDecode["default"])(authorization);
|
|
36
|
+
|
|
37
|
+
if (oldDecodedAuth.scope === newDecodedAuth.scope && oldDecodedAuth.tenantId === newDecodedAuth.tenantId) {
|
|
38
|
+
transportRef.current.transport.renewSession(authorization);
|
|
39
|
+
return transportRef.current.transport;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!clientKey && !authorization) {
|
|
44
|
+
throw new Error("Missing ClientKey or Authorization");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!clientSourceId) {
|
|
48
|
+
throw new Error("Missing ClientSourceId");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var newTransport = new _transports.CourierTransport({
|
|
52
|
+
authorization: authorization,
|
|
53
|
+
clientSourceId: clientSourceId,
|
|
54
|
+
clientKey: clientKey,
|
|
55
|
+
userSignature: userSignature,
|
|
56
|
+
wsOptions: wsOptions
|
|
57
|
+
}); // keep track of the transport so we don't reconnect when we don't have to
|
|
58
|
+
|
|
59
|
+
if (authorization) {
|
|
60
|
+
transportRef.current = {
|
|
26
61
|
authorization: authorization,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
userSignature: userSignature,
|
|
30
|
-
wsOptions: wsOptions
|
|
31
|
-
});
|
|
62
|
+
transport: newTransport
|
|
63
|
+
};
|
|
32
64
|
}
|
|
65
|
+
|
|
66
|
+
return newTransport;
|
|
33
67
|
}, [authorization, clientKey, transport, userSignature, wsOptions]);
|
|
34
68
|
};
|
|
35
69
|
|
|
36
|
-
var _default =
|
|
70
|
+
var _default = useTransport;
|
|
37
71
|
exports["default"] = _default;
|
package/dist/index.js
CHANGED
|
@@ -176,8 +176,14 @@ var CourierProvider = function CourierProvider(_ref) {
|
|
|
176
176
|
courierTransport.intercept(onMessage);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
var intervalId = setInterval(function () {
|
|
180
|
+
courierTransport.keepAlive();
|
|
181
|
+
}, 300000); // 5 minutes
|
|
182
|
+
|
|
179
183
|
return function () {
|
|
184
|
+
clearInterval(intervalId);
|
|
180
185
|
courierTransport.unsubscribe(userId);
|
|
186
|
+
courierTransport.closeConnection();
|
|
181
187
|
};
|
|
182
188
|
}, [actions, transport, userId]);
|
|
183
189
|
(0, _react.useEffect)(function () {
|
|
@@ -73,6 +73,13 @@ var CourierTransport = /*#__PURE__*/function (_Transport) {
|
|
|
73
73
|
value: function connect() {
|
|
74
74
|
this.ws.connect();
|
|
75
75
|
}
|
|
76
|
+
}, {
|
|
77
|
+
key: "keepAlive",
|
|
78
|
+
value: function keepAlive() {
|
|
79
|
+
this.ws.send({
|
|
80
|
+
action: "keepAlive"
|
|
81
|
+
});
|
|
82
|
+
}
|
|
76
83
|
}, {
|
|
77
84
|
key: "send",
|
|
78
85
|
value: function send(message) {
|
package/dist/ws.js
CHANGED
|
@@ -56,10 +56,15 @@ var WS = /*#__PURE__*/function () {
|
|
|
56
56
|
|
|
57
57
|
this.connection.close();
|
|
58
58
|
}
|
|
59
|
+
}, {
|
|
60
|
+
key: "getUrl",
|
|
61
|
+
value: function getUrl() {
|
|
62
|
+
return "".concat(this.url, "/?").concat(this.authorization ? "auth=".concat(this.authorization) : "clientKey=".concat(this.clientKey));
|
|
63
|
+
}
|
|
59
64
|
}, {
|
|
60
65
|
key: "connect",
|
|
61
66
|
value: function connect() {
|
|
62
|
-
this.connection = new _reconnectingWebsocket["default"](
|
|
67
|
+
this.connection = new _reconnectingWebsocket["default"](this.getUrl.bind(this), [], {
|
|
63
68
|
connectionTimeout: this.connectionTimeout
|
|
64
69
|
});
|
|
65
70
|
this.connection.onopen = this._onOpen.bind(this);
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trycourier/react-provider",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.58.2-internal.7c87b6f.0+7c87b6f",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "typings/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
8
|
+
"test": "jest -c jest.config.js --runInBand",
|
|
9
|
+
"babel": "babel src -d dist --extensions \".ts,.tsx\" --ignore \"src/**/__tests__/**\" --ignore \"src/**/__mocks__/**\"",
|
|
9
10
|
"build:watch": "yarn babel --watch",
|
|
10
11
|
"build": "rimraf dist && yarn babel",
|
|
11
12
|
"clean": "rimraf dist",
|
|
@@ -15,8 +16,9 @@
|
|
|
15
16
|
},
|
|
16
17
|
"license": "ISC",
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@trycourier/client-graphql": "^1.
|
|
19
|
+
"@trycourier/client-graphql": "^1.58.2-internal.7c87b6f.0+7c87b6f",
|
|
19
20
|
"buffer": "^6.0.3",
|
|
21
|
+
"jwt-decode": "^3.1.2",
|
|
20
22
|
"react-use": "^17.2.1",
|
|
21
23
|
"reconnecting-websocket": "^4.4.0",
|
|
22
24
|
"rimraf": "^3.0.2",
|
|
@@ -31,5 +33,5 @@
|
|
|
31
33
|
"dist/",
|
|
32
34
|
"typings/"
|
|
33
35
|
],
|
|
34
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "7c87b6f4083f3aef18d771c57046148d021f26ad"
|
|
35
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-client-source-id.d.ts","sourceRoot":"","sources":["../../src/hooks/use-client-source-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-client-source-id.d.ts","sourceRoot":"","sources":["../../src/hooks/use-client-source-id.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,iBAAiB;;;;;;MAMnB,MAqCH,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Transport } from "~/transports";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { CourierTransport, Transport } from "~/transports";
|
|
2
|
+
import { ITransportOptions } from "~/transports/courier/types";
|
|
3
|
+
declare const useTransport: ({ authorization, clientSourceId, clientKey, transport, userSignature, wsOptions, }: {
|
|
4
|
+
authorization?: string | undefined;
|
|
5
|
+
clientSourceId?: string | undefined;
|
|
6
|
+
clientKey?: string | undefined;
|
|
7
|
+
transport?: Transport | CourierTransport | undefined;
|
|
8
|
+
userSignature?: string | undefined;
|
|
9
|
+
wsOptions?: ITransportOptions["wsOptions"];
|
|
10
|
+
}) => CourierTransport | Transport;
|
|
11
|
+
export default useTransport;
|
|
11
12
|
//# sourceMappingURL=use-transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-transport.d.ts","sourceRoot":"","sources":["../../src/hooks/use-transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"use-transport.d.ts","sourceRoot":"","sources":["../../src/hooks/use-transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAM/D,QAAA,MAAM,YAAY;;;;;;gBAaJ,iBAAiB,CAAC,WAAW,CAAC;MACxC,gBAAgB,GAAG,SAwDtB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/typings/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAG/D,OAAO,EACL,KAAK,EACL,eAAe,EACf,qBAAqB,EACrB,QAAQ,EACR,SAAS,EACV,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B,OAA0B,EAExB,UAAU,EACX,MAAM,cAAc,CAAC;AAMtB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,eAAe,oCAAmB,CAAC;AAChD,eAAO,MAAM,kBAAkB,8CAAsB,CAAC;AAEtD,YAAY,EACV,KAAK,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,GACV,CAAC;AAEF,eAAO,MAAM,cAAc,4CACkC,CAAC;AAE9D,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAG/D,OAAO,EACL,KAAK,EACL,eAAe,EACf,qBAAqB,EACrB,QAAQ,EACR,SAAS,EACV,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B,OAA0B,EAExB,UAAU,EACX,MAAM,cAAc,CAAC;AAMtB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,eAAe,oCAAmB,CAAC;AAChD,eAAO,MAAM,kBAAkB,8CAAsB,CAAC;AAEtD,YAAY,EACV,KAAK,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,GACV,CAAC;AAEF,eAAO,MAAM,cAAc,4CACkC,CAAC;AAE9D,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAC,qBAAqB,CAuLxE,CAAC"}
|
|
@@ -12,6 +12,7 @@ export declare class CourierTransport extends Transport {
|
|
|
12
12
|
constructor(options: ITransportOptions);
|
|
13
13
|
closeConnection(): void;
|
|
14
14
|
connect(): void;
|
|
15
|
+
keepAlive(): void;
|
|
15
16
|
send(message: ICourierMessage): void;
|
|
16
17
|
subscribe(channel: string, event?: string): void;
|
|
17
18
|
unsubscribe(channel: string, event?: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transports/courier/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,iBA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,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAIlD,cAAc,CAAC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,IAAI;IAInE,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAGlC"}
|
package/typings/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transport } from "./transports";
|
|
1
|
+
import { CourierTransport, Transport } from "./transports";
|
|
2
2
|
import { IActionBlock, Interceptor, ITextBlock } from "./transports/types";
|
|
3
3
|
import { ErrorEvent } from "reconnecting-websocket";
|
|
4
4
|
export declare type ErrorEventHandler = (event: ErrorEvent) => void;
|
|
@@ -68,7 +68,7 @@ export interface ICourierProviderProps {
|
|
|
68
68
|
middleware?: any;
|
|
69
69
|
localStorage?: Storage;
|
|
70
70
|
onMessage?: Interceptor;
|
|
71
|
-
transport?: Transport;
|
|
71
|
+
transport?: CourierTransport | Transport;
|
|
72
72
|
userId?: string;
|
|
73
73
|
userSignature?: string;
|
|
74
74
|
wsOptions?: WSOptions;
|
package/typings/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,oBAAY,iBAAiB,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;AAE5D,MAAM,WA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|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAGtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,qBAAqC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAqB,SAAS,EAAE,MAAM,SAAS,CAAC;AAEvD,qBAAa,EAAE;IACb,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,OAAO,CAAC,aAAa,CAIlB;IACH,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,iBAAiB,CAAC,CAAS;IACnC,OAAO,CAAC,OAAO,CAAC,CAAoB;IACpC,OAAO,CAAC,OAAO,CAAC,CAAa;IAC7B,OAAO,CAAC,sBAAsB,CAG3B;IACH,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,eAAe,CAAS;IAChC,SAAS,CAAC,SAAS,MAAC;IACpB,SAAS,CAAC,eAAe,MAAC;gBAEd,EACV,aAAa,EACb,SAAS,EACT,OAAO,EACP,cAAc,EACd,aAAa,GACd,EAAE;QACD,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,SAAS,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB;IAoBD,KAAK,IAAI,IAAI;IAQb,OAAO,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAGtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,qBAAqC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAqB,SAAS,EAAE,MAAM,S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AAI;IAiBjD,YAAY,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI;IAgB5C,cAAc,CAAC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,IAAI;CAOpE"}
|
package/dist/hooks/use-hash.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
A string hashing function based on Daniel J. Bernstein's popular 'times 33' hash algorithm.
|
|
12
|
-
*/
|
|
13
|
-
function hash(text) {
|
|
14
|
-
var hash = 5381;
|
|
15
|
-
var index = text.length;
|
|
16
|
-
|
|
17
|
-
while (index) {
|
|
18
|
-
hash = hash * 33 ^ text.charCodeAt(--index);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return hash >>> 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var useHash = function useHash(input) {
|
|
25
|
-
return (0, _react.useMemo)(function () {
|
|
26
|
-
return hash(input).toString(16);
|
|
27
|
-
}, [input]);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
var _default = useHash;
|
|
31
|
-
exports["default"] = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-hash.d.ts","sourceRoot":"","sources":["../../src/hooks/use-hash.ts"],"names":[],"mappings":"AAiBA,QAAA,MAAM,OAAO,UAAW,MAAM,WAI7B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|