@trycourier/react-provider 1.46.2 → 1.47.1-internal.0937bfb.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-transport.js +4 -2
- package/dist/index.js +2 -1
- package/dist/transports/courier/index.js +4 -2
- package/dist/ws.js +4 -2
- package/package.json +3 -3
- package/typings/hooks/use-transport.d.ts +2 -1
- 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 +2 -1
- package/typings/transports/courier/index.d.ts.map +1 -1
- package/typings/transports/courier/types.d.ts +2 -1
- package/typings/transports/courier/types.d.ts.map +1 -1
- package/typings/ws.d.ts +5 -3
- package/typings/ws.d.ts.map +1 -1
|
@@ -11,6 +11,7 @@ var _transports = require("../transports");
|
|
|
11
11
|
|
|
12
12
|
var useCourierTransport = function useCourierTransport(_ref) {
|
|
13
13
|
var transport = _ref.transport,
|
|
14
|
+
authorization = _ref.authorization,
|
|
14
15
|
clientKey = _ref.clientKey,
|
|
15
16
|
userSignature = _ref.userSignature,
|
|
16
17
|
wsOptions = _ref.wsOptions;
|
|
@@ -19,14 +20,15 @@ var useCourierTransport = function useCourierTransport(_ref) {
|
|
|
19
20
|
return transport;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
if (clientKey && !transport) {
|
|
23
|
+
if ((clientKey || authorization) && !transport) {
|
|
23
24
|
return new _transports.CourierTransport({
|
|
25
|
+
authorization: authorization,
|
|
24
26
|
userSignature: userSignature,
|
|
25
27
|
clientKey: clientKey,
|
|
26
28
|
wsOptions: wsOptions
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
|
-
}, [
|
|
31
|
+
}, [authorization, clientKey, transport, userSignature, wsOptions]);
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
var _default = useCourierTransport;
|
package/dist/index.js
CHANGED
|
@@ -103,9 +103,10 @@ var CourierProvider = function CourierProvider(_ref) {
|
|
|
103
103
|
var middleware = [].concat((0, _toConsumableArray2["default"])(_middleware), (0, _toConsumableArray2["default"])(_middleware2["default"]));
|
|
104
104
|
var useReducer = (0, _react.useCallback)(_createReducer["default"].apply(void 0, (0, _toConsumableArray2["default"])(middleware)), [_middleware]);
|
|
105
105
|
var transport = disableTransport || typeof window === "undefined" ? undefined : (0, _useTransport["default"])({
|
|
106
|
+
authorization: authorization,
|
|
107
|
+
clientKey: clientKey,
|
|
106
108
|
transport: _transport,
|
|
107
109
|
userSignature: userSignature,
|
|
108
|
-
clientKey: clientKey,
|
|
109
110
|
wsOptions: wsOptions
|
|
110
111
|
});
|
|
111
112
|
|
|
@@ -42,13 +42,15 @@ var CourierTransport = /*#__PURE__*/function (_Transport) {
|
|
|
42
42
|
(0, _classCallCheck2["default"])(this, CourierTransport);
|
|
43
43
|
_this = _super.call(this);
|
|
44
44
|
|
|
45
|
-
if (!options.clientKey) {
|
|
46
|
-
throw new Error("Missing
|
|
45
|
+
if (!options.clientKey && !options.authorization) {
|
|
46
|
+
throw new Error("Missing Authorization");
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
_this.authorization = options.authorization;
|
|
49
50
|
_this.clientKey = options.clientKey;
|
|
50
51
|
_this.userSignature = options.userSignature;
|
|
51
52
|
_this.ws = new _ws.WS({
|
|
53
|
+
authorization: options.authorization,
|
|
52
54
|
clientKey: options.clientKey,
|
|
53
55
|
options: options.wsOptions,
|
|
54
56
|
userSignature: options.userSignature
|
package/dist/ws.js
CHANGED
|
@@ -25,10 +25,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
25
25
|
|
|
26
26
|
var WS = /*#__PURE__*/function () {
|
|
27
27
|
function WS(_ref) {
|
|
28
|
-
var
|
|
28
|
+
var authorization = _ref.authorization,
|
|
29
|
+
clientKey = _ref.clientKey,
|
|
29
30
|
options = _ref.options,
|
|
30
31
|
userSignature = _ref.userSignature;
|
|
31
32
|
(0, _classCallCheck2["default"])(this, WS);
|
|
33
|
+
this.authorization = authorization;
|
|
32
34
|
this.messageCallback = null;
|
|
33
35
|
this.connection = undefined;
|
|
34
36
|
this.connected = false;
|
|
@@ -43,7 +45,7 @@ var WS = /*#__PURE__*/function () {
|
|
|
43
45
|
(0, _createClass2["default"])(WS, [{
|
|
44
46
|
key: "connect",
|
|
45
47
|
value: function connect() {
|
|
46
|
-
this.connection = new _reconnectingWebsocket["default"]("".concat(this.url, "/?clientKey="
|
|
48
|
+
this.connection = new _reconnectingWebsocket["default"]("".concat(this.url, "/?").concat(this.authorization ? "auth=".concat(this.authorization) : "clientKey=".concat(this.clientKey)), [], {
|
|
47
49
|
connectionTimeout: this.connectionTimeout
|
|
48
50
|
});
|
|
49
51
|
this.connection.onopen = this._onOpen.bind(this);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trycourier/react-provider",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.1-internal.0937bfb.0+0937bfb",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "typings/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@trycourier/client-graphql": "^1.
|
|
18
|
+
"@trycourier/client-graphql": "^1.47.1-internal.0937bfb.0+0937bfb",
|
|
19
19
|
"buffer": "^6.0.3",
|
|
20
20
|
"graphql": "^15.5.0",
|
|
21
21
|
"localstorage-polyfill": "^1.0.1",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"dist/",
|
|
33
33
|
"typings/"
|
|
34
34
|
],
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "0937bfb881765dea4b28574a7983a2d0c2678ac3"
|
|
36
36
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Transport } from "~/transports";
|
|
2
|
-
declare const useCourierTransport: ({ transport, clientKey, userSignature, wsOptions, }: {
|
|
2
|
+
declare const useCourierTransport: ({ transport, authorization, clientKey, userSignature, wsOptions, }: {
|
|
3
3
|
transport: any;
|
|
4
|
+
authorization: any;
|
|
4
5
|
clientKey: any;
|
|
5
6
|
userSignature: any;
|
|
6
7
|
wsOptions: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-transport.d.ts","sourceRoot":"","sources":["../../src/hooks/use-transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAE3D,QAAA,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"use-transport.d.ts","sourceRoot":"","sources":["../../src/hooks/use-transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAE3D,QAAA,MAAM,mBAAmB;;;;;;MAMrB,SAeH,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/typings/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAEtD,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,KAAK,EACL,SAAS,EACV,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAM/E,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,eAAe,oCAAmB,CAAC;AAEhD,YAAY,EACV,KAAK,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,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":"AAWA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAEtD,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,KAAK,EACL,SAAS,EACV,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAM/E,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,eAAe,oCAAmB,CAAC;AAEhD,YAAY,EACV,KAAK,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,CAAC;AAEF,eAAO,MAAM,cAAc,4CACkC,CAAC;AAE9D,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAC,qBAAqB,CA0JxE,CAAC"}
|
|
@@ -4,7 +4,8 @@ import { Interceptor, ICourierMessage } from "../types";
|
|
|
4
4
|
import { ITransportOptions } from "./types";
|
|
5
5
|
export declare class CourierTransport extends Transport {
|
|
6
6
|
protected ws: WS;
|
|
7
|
-
protected
|
|
7
|
+
protected authorization?: string;
|
|
8
|
+
protected clientKey?: string;
|
|
8
9
|
protected userSignature?: string;
|
|
9
10
|
protected interceptor?: Interceptor;
|
|
10
11
|
constructor(options: ITransportOptions);
|
|
@@ -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,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;IACjB,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;
|
|
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,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;IACjB,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IACjC,UAAkB,WAAW,CAAC,EAAE,WAAW,CAAC;gBAEhC,OAAO,EAAE,iBAAiB;IAoBtC,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAUpC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAchD,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;CAGnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/transports/courier/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/transports/courier/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE;QACV,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;KACvC,CAAC;CACH"}
|
package/typings/ws.d.ts
CHANGED
|
@@ -4,15 +4,17 @@ import { ErrorEventHandler } from "./types";
|
|
|
4
4
|
export declare class WS {
|
|
5
5
|
connection?: ReconnectingWebSocket;
|
|
6
6
|
private subscriptions;
|
|
7
|
-
private
|
|
7
|
+
private authorization?;
|
|
8
|
+
private clientKey?;
|
|
8
9
|
private connectionTimeout?;
|
|
9
10
|
private onError?;
|
|
10
11
|
private url;
|
|
11
12
|
private userSignature?;
|
|
12
13
|
protected connected: any;
|
|
13
14
|
protected messageCallback: any;
|
|
14
|
-
constructor({ clientKey, options, userSignature, }: {
|
|
15
|
-
|
|
15
|
+
constructor({ authorization, clientKey, options, userSignature, }: {
|
|
16
|
+
authorization?: string;
|
|
17
|
+
clientKey?: string;
|
|
16
18
|
options?: {
|
|
17
19
|
connectionTimeout?: number;
|
|
18
20
|
onError?: ErrorEventHandler;
|
package/typings/ws.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAmB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,qBAAqB,EAAE,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,qBAAa,EAAE;IACb,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,OAAO,CAAC,aAAa,CAIlB;IACH,OAAO,CAAC,SAAS,CAAS;
|
|
1
|
+
{"version":3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