@trycourier/react-hooks 7.4.7 → 7.4.9-internal.ca28d5c.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/preferences/reducer.js +9 -0
- package/dist/preferences/use-preferences-actions.js +89 -32
- package/package.json +4 -4
- package/typings/preferences/reducer.d.ts +10 -0
- package/typings/preferences/reducer.d.ts.map +1 -1
- package/typings/preferences/types.d.ts +1 -0
- package/typings/preferences/types.d.ts.map +1 -1
- package/typings/preferences/use-preferences-actions.d.ts +3 -3
- package/typings/preferences/use-preferences-actions.d.ts.map +1 -1
|
@@ -70,6 +70,7 @@ var _default = function _default() {
|
|
|
70
70
|
|
|
71
71
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
72
72
|
isUpdating: false,
|
|
73
|
+
error: undefined,
|
|
73
74
|
recipientPreferences: (_state$recipientPrefe = state.recipientPreferences) === null || _state$recipientPrefe === void 0 ? void 0 : _state$recipientPrefe.map(function (preference) {
|
|
74
75
|
var _action$payload;
|
|
75
76
|
|
|
@@ -81,6 +82,14 @@ var _default = function _default() {
|
|
|
81
82
|
})
|
|
82
83
|
});
|
|
83
84
|
}
|
|
85
|
+
|
|
86
|
+
case "preferences/UPDATE_RECIPIENT_PREFERENCES/ERROR":
|
|
87
|
+
{
|
|
88
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
89
|
+
isUpdating: false,
|
|
90
|
+
error: action === null || action === void 0 ? void 0 : action.ex
|
|
91
|
+
});
|
|
92
|
+
}
|
|
84
93
|
}
|
|
85
94
|
|
|
86
95
|
return state;
|
|
@@ -35,55 +35,112 @@ var usePreferencesActions = function usePreferencesActions() {
|
|
|
35
35
|
client: courierClient
|
|
36
36
|
});
|
|
37
37
|
return {
|
|
38
|
-
fetchRecipientPreferences: function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
fetchRecipientPreferences: function () {
|
|
39
|
+
var _fetchRecipientPreferences = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(tenantId) {
|
|
40
|
+
var promise;
|
|
41
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
42
|
+
while (1) {
|
|
43
|
+
switch (_context.prev = _context.next) {
|
|
44
|
+
case 0:
|
|
45
|
+
promise = preferences.getRecipientPreferences(tenantId);
|
|
46
|
+
dispatch({
|
|
47
|
+
type: "preferences/FETCH_RECIPIENT_PREFERENCES",
|
|
48
|
+
payload: function payload() {
|
|
49
|
+
return promise;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return _context.abrupt("return", promise);
|
|
53
|
+
|
|
54
|
+
case 3:
|
|
55
|
+
case "end":
|
|
56
|
+
return _context.stop();
|
|
57
|
+
}
|
|
54
58
|
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
}, _callee);
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
function fetchRecipientPreferences(_x) {
|
|
63
|
+
return _fetchRecipientPreferences.apply(this, arguments);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return fetchRecipientPreferences;
|
|
67
|
+
}(),
|
|
68
|
+
fetchPreferencePage: function () {
|
|
69
|
+
var _fetchPreferencePage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(tenantId) {
|
|
70
|
+
var draft,
|
|
71
|
+
promise,
|
|
72
|
+
_promise,
|
|
73
|
+
_args2 = arguments;
|
|
74
|
+
|
|
75
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
76
|
+
while (1) {
|
|
77
|
+
switch (_context2.prev = _context2.next) {
|
|
78
|
+
case 0:
|
|
79
|
+
draft = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : false;
|
|
80
|
+
|
|
81
|
+
if (!draft) {
|
|
82
|
+
_context2.next = 7;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
promise = preferences.getDraftPreferencePage();
|
|
87
|
+
dispatch({
|
|
88
|
+
type: "preferences/FETCH_DRAFT_PREFERENCE_PAGE",
|
|
89
|
+
payload: function payload() {
|
|
90
|
+
return promise;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return _context2.abrupt("return", promise);
|
|
94
|
+
|
|
95
|
+
case 7:
|
|
96
|
+
_promise = preferences.getPreferencePage(tenantId);
|
|
97
|
+
dispatch({
|
|
98
|
+
type: "preferences/FETCH_PREFERENCE_PAGE",
|
|
99
|
+
payload: function payload() {
|
|
100
|
+
return _promise;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return _context2.abrupt("return", _promise);
|
|
104
|
+
|
|
105
|
+
case 10:
|
|
106
|
+
case "end":
|
|
107
|
+
return _context2.stop();
|
|
108
|
+
}
|
|
61
109
|
}
|
|
62
|
-
});
|
|
110
|
+
}, _callee2);
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
function fetchPreferencePage(_x2) {
|
|
114
|
+
return _fetchPreferencePage.apply(this, arguments);
|
|
63
115
|
}
|
|
64
|
-
|
|
116
|
+
|
|
117
|
+
return fetchPreferencePage;
|
|
118
|
+
}(),
|
|
65
119
|
updateRecipientPreferences: function () {
|
|
66
|
-
var _updateRecipientPreferences = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
67
|
-
|
|
120
|
+
var _updateRecipientPreferences = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(payload) {
|
|
121
|
+
var promise;
|
|
122
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
68
123
|
while (1) {
|
|
69
|
-
switch (
|
|
124
|
+
switch (_context3.prev = _context3.next) {
|
|
70
125
|
case 0:
|
|
126
|
+
promise = preferences.updateRecipientPreferences(payload);
|
|
71
127
|
dispatch({
|
|
72
128
|
type: "preferences/UPDATE_RECIPIENT_PREFERENCES",
|
|
73
129
|
payload: function payload() {
|
|
74
|
-
return
|
|
130
|
+
return promise;
|
|
75
131
|
}
|
|
76
132
|
});
|
|
133
|
+
return _context3.abrupt("return", promise);
|
|
77
134
|
|
|
78
|
-
case
|
|
135
|
+
case 3:
|
|
79
136
|
case "end":
|
|
80
|
-
return
|
|
137
|
+
return _context3.stop();
|
|
81
138
|
}
|
|
82
139
|
}
|
|
83
|
-
},
|
|
140
|
+
}, _callee3);
|
|
84
141
|
}));
|
|
85
142
|
|
|
86
|
-
function updateRecipientPreferences(
|
|
143
|
+
function updateRecipientPreferences(_x3) {
|
|
87
144
|
return _updateRecipientPreferences.apply(this, arguments);
|
|
88
145
|
}
|
|
89
146
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trycourier/react-hooks",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.9-internal.ca28d5c.0+ca28d5c",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "typings/index.d.ts",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"concat-md": "^0.3.5"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@trycourier/client-graphql": "^7.4.
|
|
24
|
-
"@trycourier/core": "^7.4.
|
|
23
|
+
"@trycourier/client-graphql": "^7.4.9-internal.ca28d5c.0+ca28d5c",
|
|
24
|
+
"@trycourier/core": "^7.4.9-internal.ca28d5c.0+ca28d5c",
|
|
25
25
|
"deep-extend": "^0.6.0",
|
|
26
26
|
"jwt-decode": "^4.0.0"
|
|
27
27
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
},
|
|
47
47
|
"./use-inbox": "./dist/inbox/use-inbox.js"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "ca28d5cd522bf7a92061cca5ddd7d1d60b86c365"
|
|
50
50
|
}
|
|
@@ -2,21 +2,31 @@ import { PreferenceState } from "./types";
|
|
|
2
2
|
declare const _default: (state: PreferenceState | undefined, action: any) => PreferenceState | {
|
|
3
3
|
isLoading: boolean;
|
|
4
4
|
recipientPreferences: any;
|
|
5
|
+
error?: Error | undefined;
|
|
5
6
|
isUpdating?: boolean | undefined;
|
|
6
7
|
preferences?: import("./types").IPreferenceTemplate[] | undefined;
|
|
7
8
|
preferencePage?: import("./types").PreferencePage | undefined;
|
|
8
9
|
} | {
|
|
9
10
|
isLoading: boolean;
|
|
10
11
|
preferencePage: any;
|
|
12
|
+
error?: Error | undefined;
|
|
11
13
|
isUpdating?: boolean | undefined;
|
|
12
14
|
preferences?: import("./types").IPreferenceTemplate[] | undefined;
|
|
13
15
|
recipientPreferences?: import("./types").IRecipientPreference[] | undefined;
|
|
14
16
|
} | {
|
|
15
17
|
isUpdating: boolean;
|
|
18
|
+
error: undefined;
|
|
16
19
|
recipientPreferences: any[] | undefined;
|
|
17
20
|
isLoading?: boolean | undefined;
|
|
18
21
|
preferences?: import("./types").IPreferenceTemplate[] | undefined;
|
|
19
22
|
preferencePage?: import("./types").PreferencePage | undefined;
|
|
23
|
+
} | {
|
|
24
|
+
isUpdating: boolean;
|
|
25
|
+
error: any;
|
|
26
|
+
isLoading?: boolean | undefined;
|
|
27
|
+
preferences?: import("./types").IPreferenceTemplate[] | undefined;
|
|
28
|
+
recipientPreferences?: import("./types").IRecipientPreference[] | undefined;
|
|
29
|
+
preferencePage?: import("./types").PreferencePage | undefined;
|
|
20
30
|
};
|
|
21
31
|
export default _default;
|
|
22
32
|
//# sourceMappingURL=reducer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/preferences/reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/preferences/reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQ1C,wBAsEE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/preferences/types.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc,GAAG;IAC3B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,KAAK,EAAE;QACL,QAAQ,EAAE;YACR,MAAM,EAAE;gBACN,OAAO,EAAE,MAAM,CAAC;aACjB,CAAC;SACH,CAAC;QACF,KAAK,EAAE;YACL,QAAQ,EAAE;gBACR,GAAG,EAAE,MAAM,CAAC;aACb,CAAC;YACF,SAAS,EAAE;gBACT,GAAG,EAAE,MAAM,CAAC;aACb,CAAC;YACF,QAAQ,EAAE;gBACR,GAAG,EAAE,MAAM,CAAC;aACb,CAAC;YACF,MAAM,EAAE;gBACN,GAAG,EAAE,MAAM,CAAC;aACb,CAAC;YACF,OAAO,EAAE;gBACP,GAAG,EAAE,MAAM,CAAC;aACb,CAAC;SACH,CAAC;QACF,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;IACF,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,cAAc,EAAE;QACd,aAAa,EAAE,KAAK,CAAC;YACnB,OAAO,EAAE,qBAAqB,CAAC;YAC/B,IAAI,EAAE,MAAM,CAAC;SACd,CAAC,CAAC;KACJ,CAAC;CACH,CAAC;AAEF,oBAAY,iBAAiB,GAAG;IAC9B,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QACl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EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACpC,oBAAoB,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,oBAAY,qBAAqB,GAC7B,OAAO,GACP,MAAM,GACN,OAAO,GACP,gBAAgB,GAChB,KAAK,GACL,SAAS,CAAC;AAEd,oBAAY,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,gBAAgB,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,mBAAmB,CAAC,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,gBAAgB,CAAC;CACjC;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,gBAAgB,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACjD,cAAc,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UpdateRecipientPreferencesPayload } from "@trycourier/client-graphql";
|
|
2
2
|
export interface UsePreferenceActions {
|
|
3
|
-
fetchRecipientPreferences: (tenantId?: string) =>
|
|
4
|
-
fetchPreferencePage: (tenantId?: string, draft?: boolean) =>
|
|
5
|
-
updateRecipientPreferences: (payload: UpdateRecipientPreferencesPayload) =>
|
|
3
|
+
fetchRecipientPreferences: (tenantId?: string) => Promise<any>;
|
|
4
|
+
fetchPreferencePage: (tenantId?: string, draft?: boolean) => Promise<any>;
|
|
5
|
+
updateRecipientPreferences: (payload: UpdateRecipientPreferencesPayload) => Promise<any>;
|
|
6
6
|
}
|
|
7
7
|
declare const usePreferencesActions: () => UsePreferenceActions;
|
|
8
8
|
export default usePreferencesActions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-preferences-actions.d.ts","sourceRoot":"","sources":["../../src/preferences/use-preferences-actions.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,iCAAiC,EAClC,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,oBAAoB;IACnC,yBAAyB,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"use-preferences-actions.d.ts","sourceRoot":"","sources":["../../src/preferences/use-preferences-actions.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,iCAAiC,EAClC,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,oBAAoB;IACnC,yBAAyB,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/D,mBAAmB,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1E,0BAA0B,EAAE,CAC1B,OAAO,EAAE,iCAAiC,KACvC,OAAO,CAAC,GAAG,CAAC,CAAC;CACnB;AAED,QAAA,MAAM,qBAAqB,QAAO,oBAiDjC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|