@trycourier/react-provider 4.11.3-internal.aabbe8d.0 → 5.0.1-internal.36c17ff.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/README.md +11 -0
- package/dist/index.js +11 -7
- package/dist/ws.js +1 -1
- package/package.json +3 -3
- package/typings/index.d.ts.map +1 -1
- package/typings/types.d.ts +5 -5
- package/typings/types.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
2
2
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
3
3
|
|
|
4
|
+
- [Version 5.X CSP Migration](#version-5-csp-migration)
|
|
4
5
|
- [Props](#props)
|
|
5
6
|
- [Listening to Messsages](#listening-to-messsages)
|
|
6
7
|
- [Dark Mode / Theme Variables](#dark-mode--theme-variables)
|
|
@@ -9,6 +10,16 @@
|
|
|
9
10
|
|
|
10
11
|
<a name="0propsmd"></a>
|
|
11
12
|
|
|
13
|
+
### [Version 5.X CSP Migration](#version-5-migration)
|
|
14
|
+
|
|
15
|
+
We've released new subdomains to power Inbox and Toast. This migration only applies to Inbox and Toast users who applied our old URLs to their Content Security Policy.
|
|
16
|
+
|
|
17
|
+
| Before | After | Usage |
|
|
18
|
+
| ------------------------------------------------------ | -------------------------- | --------------------------- |
|
|
19
|
+
| https://api.courier.com | https://api.courier.com | Brands and User Preferences |
|
|
20
|
+
| wss://1x60p1o3h8.execute-api.us-east-1.amazonaws.com | wss://realtime.courier.com | Websockets |
|
|
21
|
+
| https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com | https://inbox.courier.com | Inbox Messages |
|
|
22
|
+
|
|
12
23
|
### [Props](#props)
|
|
13
24
|
|
|
14
25
|
```ts
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var _createReducer = _interopRequireDefault(require("react-use/lib/factory/creat
|
|
|
27
27
|
|
|
28
28
|
var _reducer = _interopRequireWildcard(require("./reducer"));
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _middleware = _interopRequireWildcard(require("./middleware"));
|
|
31
31
|
|
|
32
32
|
var _useCourierActions = _interopRequireDefault(require("./hooks/use-courier-actions"));
|
|
33
33
|
|
|
@@ -98,7 +98,7 @@ if (typeof window !== "undefined") {
|
|
|
98
98
|
|
|
99
99
|
var registerReducer = _reducer.registerReducer;
|
|
100
100
|
exports.registerReducer = registerReducer;
|
|
101
|
-
var registerMiddleware =
|
|
101
|
+
var registerMiddleware = _middleware.registerMiddleware;
|
|
102
102
|
exports.registerMiddleware = registerMiddleware;
|
|
103
103
|
var GlobalThemeVariables = (0, _styledComponents.createGlobalStyle)(function (_ref) {
|
|
104
104
|
var _theme$variables, _theme$variables2, _theme$variables3, _theme$variables4, _theme$variables5;
|
|
@@ -134,8 +134,7 @@ var CourierProvider = function CourierProvider(_ref2) {
|
|
|
134
134
|
inboxApiUrl = _ref2.inboxApiUrl,
|
|
135
135
|
_ref2$localStorage = _ref2.localStorage,
|
|
136
136
|
localStorage = _ref2$localStorage === void 0 ? typeof window !== "undefined" ? (_window = window) === null || _window === void 0 ? void 0 : _window.localStorage : undefined : _ref2$localStorage,
|
|
137
|
-
|
|
138
|
-
_middleware = _ref2$middleware === void 0 ? [] : _ref2$middleware,
|
|
137
|
+
applyMiddleware = _ref2.applyMiddleware,
|
|
139
138
|
onMessage = _ref2.onMessage,
|
|
140
139
|
onRouteChange = _ref2.onRouteChange,
|
|
141
140
|
_transport = _ref2.transport,
|
|
@@ -154,8 +153,14 @@ var CourierProvider = function CourierProvider(_ref2) {
|
|
|
154
153
|
localStorage: localStorage,
|
|
155
154
|
userId: userId
|
|
156
155
|
});
|
|
157
|
-
var middleware =
|
|
158
|
-
|
|
156
|
+
var middleware = (0, _react.useMemo)(function () {
|
|
157
|
+
if (!applyMiddleware) {
|
|
158
|
+
return _middleware["default"];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return applyMiddleware(_middleware["default"]);
|
|
162
|
+
}, [applyMiddleware]);
|
|
163
|
+
var useReducer = (0, _react.useCallback)(_createReducer["default"].apply(void 0, (0, _toConsumableArray2["default"])(middleware)), [middleware]);
|
|
159
164
|
var transport = typeof window === "undefined" ? undefined : (0, _useTransport["default"])({
|
|
160
165
|
tenantId: tenantId,
|
|
161
166
|
authorization: authorization,
|
|
@@ -182,7 +187,6 @@ var CourierProvider = function CourierProvider(_ref2) {
|
|
|
182
187
|
clientSourceId: clientSourceId,
|
|
183
188
|
inboxApiUrl: inboxApiUrl,
|
|
184
189
|
localStorage: localStorage,
|
|
185
|
-
middleware: middleware,
|
|
186
190
|
onRouteChange: onRouteChange,
|
|
187
191
|
tenantId: tenantId,
|
|
188
192
|
transport: transport,
|
package/dist/ws.js
CHANGED
|
@@ -40,7 +40,7 @@ var WS = /*#__PURE__*/function () {
|
|
|
40
40
|
this.messageCallback = null;
|
|
41
41
|
this.connection = undefined;
|
|
42
42
|
this.connected = false;
|
|
43
|
-
this.url = (options === null || options === void 0 ? void 0 : options.url) || "" || "wss://
|
|
43
|
+
this.url = (options === null || options === void 0 ? void 0 : options.url) || "" || "wss://realtime.courier.com";
|
|
44
44
|
this.clientSourceId = clientSourceId;
|
|
45
45
|
this.clientKey = clientKey;
|
|
46
46
|
this.userSignature = userSignature;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trycourier/react-provider",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1-internal.36c17ff.0+36c17ff",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "typings/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@trycourier/client-graphql": "^
|
|
19
|
+
"@trycourier/client-graphql": "^5.0.1-internal.36c17ff.0+36c17ff",
|
|
20
20
|
"buffer": "^6.0.3",
|
|
21
21
|
"jwt-decode": "^3.1.2",
|
|
22
22
|
"react-use": "^17.2.1",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"dist/",
|
|
34
34
|
"typings/"
|
|
35
35
|
],
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "36c17ff9571ca3b695f604c2faaf321d96f25741"
|
|
37
37
|
}
|
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,KAAK,EAAE,EAIZ,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,KAAK,EACL,SAAS,EACT,eAAe,EACf,qBAAqB,EACrB,OAAO,EACP,UAAU,EACV,aAAa,EAEb,SAAS,EACV,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B,OAA0B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EAIZ,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,KAAK,EACL,SAAS,EACT,eAAe,EACf,qBAAqB,EACrB,OAAO,EACP,UAAU,EACV,aAAa,EAEb,SAAS,EACV,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B,OAA0B,EACxB,UAAU,EAEX,MAAM,cAAc,CAAC;AAStB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AAEtB,eAAO,MAAM,eAAe,oCAAmB,CAAC;AAChD,eAAO,MAAM,kBAAkB,8CAAsB,CAAC;AAEtD,YAAY,EACV,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,UAAU,EACV,OAAO,EACP,UAAU,EACV,aAAa,EACb,SAAS,GACV,CAAC;AAkBF,eAAO,MAAM,cAAc,4CACkC,CAAC;AAE9D,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,iBAAiB,CACnD,iBAAiB,CAAC,qBAAqB,CAAC,CA2NzC,CAAC"}
|
package/typings/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ErrorEvent } from "reconnecting-websocket";
|
|
1
2
|
import { CourierTransport, Transport } from "./transports";
|
|
2
3
|
import { IInboxMessagePreview, Interceptor } from "./transports/types";
|
|
3
|
-
import { ErrorEvent } from "reconnecting-websocket";
|
|
4
4
|
export { IInboxMessagePreview } from "@trycourier/client-graphql";
|
|
5
5
|
export { Interceptor } from "./transports/types";
|
|
6
6
|
export declare type ErrorEventHandler = (event: ErrorEvent) => void;
|
|
@@ -31,7 +31,6 @@ export interface Brand {
|
|
|
31
31
|
inapp?: {
|
|
32
32
|
disableCourierFooter?: boolean;
|
|
33
33
|
borderRadius?: string;
|
|
34
|
-
renderActionsAsButtons?: boolean;
|
|
35
34
|
disableMessageIcon?: boolean;
|
|
36
35
|
placement?: "top" | "bottom" | "left" | "right";
|
|
37
36
|
emptyState?: {
|
|
@@ -51,6 +50,7 @@ export interface Brand {
|
|
|
51
50
|
borderRadius?: string;
|
|
52
51
|
timerAutoClose?: number;
|
|
53
52
|
};
|
|
53
|
+
renderActionsAsButtons?: boolean;
|
|
54
54
|
};
|
|
55
55
|
colors?: {
|
|
56
56
|
primary?: string;
|
|
@@ -72,19 +72,19 @@ export interface ProviderTheme {
|
|
|
72
72
|
variables?: ThemeVariables;
|
|
73
73
|
}
|
|
74
74
|
export interface ICourierProviderProps {
|
|
75
|
-
tenantId?: string;
|
|
76
75
|
apiUrl?: string;
|
|
76
|
+
applyMiddleware?: (defaultMiddleware: any) => any[];
|
|
77
77
|
authorization?: string;
|
|
78
78
|
brand?: Brand;
|
|
79
|
-
theme?: ProviderTheme;
|
|
80
79
|
brandId?: string;
|
|
81
80
|
clientKey?: string;
|
|
82
81
|
id?: string;
|
|
83
82
|
inboxApiUrl?: string;
|
|
84
83
|
localStorage?: Storage;
|
|
85
|
-
middleware?: any;
|
|
86
84
|
onMessage?: Interceptor;
|
|
87
85
|
onRouteChange?: (route: string) => void;
|
|
86
|
+
tenantId?: string;
|
|
87
|
+
theme?: ProviderTheme;
|
|
88
88
|
transport?: CourierTransport | Transport;
|
|
89
89
|
userId?: string;
|
|
90
90
|
userSignature?: string;
|
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,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,oBAAY,iBAAiB,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;AAE5D,oBAAY,SAAS,GAAG;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI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