@trycourier/react-provider 1.9.0 → 1.9.2-internal.776d32d.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/index.js +15 -1
- package/dist/ws.js +3 -5
- package/package.json +2 -2
- package/typings/index.d.ts.map +1 -1
- package/typings/transports/types.d.ts +9 -3
- package/typings/transports/types.d.ts.map +1 -1
package/dist/index.js
CHANGED
|
@@ -135,6 +135,7 @@ var CourierProvider = function CourierProvider(_ref) {
|
|
|
135
135
|
state = _useReducer2[0],
|
|
136
136
|
dispatch = _useReducer2[1];
|
|
137
137
|
|
|
138
|
+
var actions = (0, _useCourierActions["default"])(dispatch);
|
|
138
139
|
(0, _react.useEffect)(function () {
|
|
139
140
|
if (_transport) {
|
|
140
141
|
// this means the transport was passed in and we shouldn't subscribe
|
|
@@ -152,6 +153,20 @@ var CourierProvider = function CourierProvider(_ref) {
|
|
|
152
153
|
courierTransport.intercept(onMessage);
|
|
153
154
|
}
|
|
154
155
|
|
|
156
|
+
courierTransport.listen({
|
|
157
|
+
id: "deliver-tracking",
|
|
158
|
+
listener: function listener(courierEvent) {
|
|
159
|
+
var _courierEvent$data, _courierData$tracking, _courierData$tracking2;
|
|
160
|
+
|
|
161
|
+
var courierData = courierEvent === null || courierEvent === void 0 ? void 0 : (_courierEvent$data = courierEvent.data) === null || _courierEvent$data === void 0 ? void 0 : _courierEvent$data.data;
|
|
162
|
+
|
|
163
|
+
if (!(courierData !== null && courierData !== void 0 && (_courierData$tracking = courierData.trackingIds) !== null && _courierData$tracking !== void 0 && _courierData$tracking.deliverTrackingId)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
actions.createTrackEvent(courierData === null || courierData === void 0 ? void 0 : (_courierData$tracking2 = courierData.trackingIds) === null || _courierData$tracking2 === void 0 ? void 0 : _courierData$tracking2.deliverTrackingId);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
155
170
|
return function () {
|
|
156
171
|
courierTransport.unsubscribe(userId);
|
|
157
172
|
};
|
|
@@ -221,7 +236,6 @@ var CourierProvider = function CourierProvider(_ref) {
|
|
|
221
236
|
}
|
|
222
237
|
}
|
|
223
238
|
}, [clientKey, userId]);
|
|
224
|
-
var actions = (0, _useCourierActions["default"])(dispatch);
|
|
225
239
|
return /*#__PURE__*/_react["default"].createElement(CourierContext.Provider, {
|
|
226
240
|
value: _objectSpread(_objectSpread(_objectSpread({}, state), actions), {}, {
|
|
227
241
|
dispatch: dispatch
|
package/dist/ws.js
CHANGED
|
@@ -25,8 +25,6 @@ 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 _ref2, _options$url;
|
|
29
|
-
|
|
30
28
|
var clientKey = _ref.clientKey,
|
|
31
29
|
options = _ref.options,
|
|
32
30
|
userSignature = _ref.userSignature;
|
|
@@ -34,7 +32,7 @@ var WS = /*#__PURE__*/function () {
|
|
|
34
32
|
this.messageCallback = null;
|
|
35
33
|
this.connection = undefined;
|
|
36
34
|
this.connected = false;
|
|
37
|
-
this.url = (
|
|
35
|
+
this.url = (options === null || options === void 0 ? void 0 : options.url) || "" || "wss://1x60p1o3h8.execute-api.us-east-1.amazonaws.com/production";
|
|
38
36
|
this.clientKey = clientKey;
|
|
39
37
|
this.userSignature = userSignature;
|
|
40
38
|
this.subscriptions = [];
|
|
@@ -101,8 +99,8 @@ var WS = /*#__PURE__*/function () {
|
|
|
101
99
|
}
|
|
102
100
|
}, {
|
|
103
101
|
key: "_onMessage",
|
|
104
|
-
value: function _onMessage(
|
|
105
|
-
var data =
|
|
102
|
+
value: function _onMessage(_ref2) {
|
|
103
|
+
var data = _ref2.data;
|
|
106
104
|
var message;
|
|
107
105
|
|
|
108
106
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trycourier/react-provider",
|
|
3
|
-
"version": "1.9.0",
|
|
3
|
+
"version": "1.9.2-internal.776d32d.0+776d32d",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "typings/index.d.ts",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"dist/",
|
|
32
32
|
"typings/"
|
|
33
33
|
],
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "776d32db0ced6569ccd6ca04864501cd9e4099cf"
|
|
35
35
|
}
|
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,qBAAqB,EACrB,eAAe,EACf,KAAK,EACL,SAAS,EACV,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAK/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,4CAE1B,CAAC;AAEF,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,qBAAqB,EACrB,eAAe,EACf,KAAK,EACL,SAAS,EACV,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAK/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,4CAE1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAC,qBAAqB,CA6K1E,CAAC"}
|
|
@@ -18,10 +18,16 @@ export interface ICourierMessage {
|
|
|
18
18
|
icon?: string | false;
|
|
19
19
|
title?: string | React.ReactElement;
|
|
20
20
|
data?: {
|
|
21
|
+
brandId?: string;
|
|
22
|
+
trackingIds?: {
|
|
23
|
+
channelTrackingId?: string;
|
|
24
|
+
clickTrackingId?: string;
|
|
25
|
+
deliverTrackingId?: string;
|
|
26
|
+
readTrackingId?: string;
|
|
27
|
+
unreadTrackingId?: string;
|
|
28
|
+
};
|
|
29
|
+
trackingUrl?: string;
|
|
21
30
|
clickAction?: string;
|
|
22
|
-
clickTrackingId?: string;
|
|
23
|
-
readTrackingId?: string;
|
|
24
|
-
deliverTrackingId?: string;
|
|
25
31
|
};
|
|
26
32
|
brand?: Brand;
|
|
27
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/transports/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AACD,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAA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