@commercetools-frontend/sdk 21.23.10 → 21.24.1
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/commercetools-frontend-sdk.cjs.dev.js +324 -356
- package/dist/commercetools-frontend-sdk.cjs.prod.js +284 -302
- package/dist/commercetools-frontend-sdk.esm.js +321 -353
- package/dist/declarations/src/components/sdk-get/sdk-get.d.ts +1 -1
- package/package.json +2 -2
- package/test-utils/dist/commercetools-frontend-sdk-test-utils.cjs.dev.js +20 -34
- package/test-utils/dist/commercetools-frontend-sdk-test-utils.cjs.prod.js +20 -34
- package/test-utils/dist/commercetools-frontend-sdk-test-utils.esm.js +20 -34
|
@@ -2,18 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
6
|
-
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
7
|
-
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
8
|
-
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
9
|
-
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
10
|
-
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
11
|
-
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
12
|
-
require('prop-types');
|
|
13
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
14
|
-
var react = require('react');
|
|
15
|
-
var reactRedux = require('react-redux');
|
|
16
|
-
var fastEquals = require('fast-equals');
|
|
17
5
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
18
6
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
19
7
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -27,21 +15,30 @@ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
|
27
15
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
28
16
|
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
29
17
|
var omitEmpty = require('omit-empty-es');
|
|
18
|
+
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
19
|
+
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
20
|
+
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
21
|
+
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
22
|
+
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
23
|
+
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
24
|
+
require('prop-types');
|
|
25
|
+
var react = require('react');
|
|
26
|
+
var fastEquals = require('fast-equals');
|
|
27
|
+
var reactRedux = require('react-redux');
|
|
28
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
30
29
|
var apiRequestBuilder = require('@commercetools/api-request-builder');
|
|
31
30
|
var constants = require('@commercetools-frontend/constants');
|
|
32
31
|
var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
|
|
33
32
|
require('qss');
|
|
34
33
|
var _globalThis = require('@babel/runtime-corejs3/core-js/global-this');
|
|
35
34
|
var buffer = require('buffer');
|
|
35
|
+
var createHttpUserAgent = require('@commercetools/http-user-agent');
|
|
36
36
|
var sdkClient = require('@commercetools/sdk-client');
|
|
37
|
-
var sdkMiddlewareHttp = require('@commercetools/sdk-middleware-http');
|
|
38
37
|
var sdkMiddlewareCorrelationId = require('@commercetools/sdk-middleware-correlation-id');
|
|
39
|
-
var
|
|
38
|
+
var sdkMiddlewareHttp = require('@commercetools/sdk-middleware-http');
|
|
40
39
|
|
|
41
40
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
42
41
|
|
|
43
|
-
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
44
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
45
42
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
46
43
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
47
44
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
@@ -53,21 +50,138 @@ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defin
|
|
|
53
50
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
54
51
|
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
55
52
|
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
53
|
+
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
54
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
56
55
|
var _URL__default = /*#__PURE__*/_interopDefault(_URL);
|
|
57
56
|
var _globalThis__default = /*#__PURE__*/_interopDefault(_globalThis);
|
|
58
57
|
var createHttpUserAgent__default = /*#__PURE__*/_interopDefault(createHttpUserAgent);
|
|
59
58
|
|
|
59
|
+
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
60
|
+
|
|
61
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$2(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
62
|
+
function get(payload) {
|
|
63
|
+
return {
|
|
64
|
+
type: 'SDK',
|
|
65
|
+
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
66
|
+
method: 'GET'
|
|
67
|
+
})
|
|
68
|
+
};
|
|
69
|
+
} // contrary to the other methods this does not bear the exact name of the HTTP-verb
|
|
70
|
+
// because `delete` is a reserved keyword in ECMAScript
|
|
71
|
+
|
|
72
|
+
function del(payload) {
|
|
73
|
+
return {
|
|
74
|
+
type: 'SDK',
|
|
75
|
+
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
76
|
+
method: 'DELETE'
|
|
77
|
+
})
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function head(payload) {
|
|
81
|
+
return {
|
|
82
|
+
type: 'SDK',
|
|
83
|
+
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
84
|
+
method: 'HEAD'
|
|
85
|
+
})
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function post(payload) {
|
|
89
|
+
return {
|
|
90
|
+
type: 'SDK',
|
|
91
|
+
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
92
|
+
method: 'POST'
|
|
93
|
+
})
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const enhancePayloadForForwardToProxy = payload => {
|
|
98
|
+
var _payload$headers, _context;
|
|
99
|
+
|
|
100
|
+
const headers = (_payload$headers = payload.headers) !== null && _payload$headers !== void 0 ? _payload$headers : {};
|
|
101
|
+
const exchangeTokenClaims = [];
|
|
102
|
+
|
|
103
|
+
if (payload.includeUserPermissions) {
|
|
104
|
+
exchangeTokenClaims.push('permissions');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
uri: '/proxy/forward-to',
|
|
109
|
+
mcApiProxyTarget: undefined,
|
|
110
|
+
headers: omitEmpty__default["default"](_objectSpread$2(_objectSpread$2({}, _reduceInstanceProperty__default["default"](_context = _Object$entries__default["default"](headers)).call(_context, (customForwardHeaders, _ref) => {
|
|
111
|
+
let _ref2 = _slicedToArray(_ref, 2),
|
|
112
|
+
headerName = _ref2[0],
|
|
113
|
+
headerValue = _ref2[1];
|
|
114
|
+
|
|
115
|
+
return _objectSpread$2(_objectSpread$2({}, customForwardHeaders), {}, {
|
|
116
|
+
// Prefix headers so that the MC API can allow and forward them.
|
|
117
|
+
["x-forward-header-".concat(headerName)]: headerValue
|
|
118
|
+
});
|
|
119
|
+
}, {})), {}, {
|
|
120
|
+
'Accept-version': 'v2',
|
|
121
|
+
'X-Forward-To': payload.uri,
|
|
122
|
+
'X-Forward-To-Audience-Policy': payload.audiencePolicy || 'forward-url-full-path',
|
|
123
|
+
'X-Forward-To-Claims': exchangeTokenClaims.join(' ')
|
|
124
|
+
}))
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const forwardTo = {
|
|
129
|
+
get(payload) {
|
|
130
|
+
return {
|
|
131
|
+
type: 'SDK',
|
|
132
|
+
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
133
|
+
method: 'GET'
|
|
134
|
+
}, enhancePayloadForForwardToProxy(payload))
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
del(payload) {
|
|
139
|
+
return {
|
|
140
|
+
type: 'SDK',
|
|
141
|
+
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
142
|
+
method: 'DELETE'
|
|
143
|
+
}, enhancePayloadForForwardToProxy(payload))
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
head(payload) {
|
|
148
|
+
return {
|
|
149
|
+
type: 'SDK',
|
|
150
|
+
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
151
|
+
method: 'HEAD'
|
|
152
|
+
}, enhancePayloadForForwardToProxy(payload))
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
post(payload) {
|
|
157
|
+
return {
|
|
158
|
+
type: 'SDK',
|
|
159
|
+
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
160
|
+
method: 'POST'
|
|
161
|
+
}, enhancePayloadForForwardToProxy(payload))
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
168
|
+
__proto__: null,
|
|
169
|
+
get: get,
|
|
170
|
+
del: del,
|
|
171
|
+
head: head,
|
|
172
|
+
post: post,
|
|
173
|
+
forwardTo: forwardTo
|
|
174
|
+
});
|
|
175
|
+
|
|
60
176
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
61
177
|
|
|
62
178
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
63
|
-
|
|
179
|
+
let SdkGet = /*#__PURE__*/function (_Component) {
|
|
64
180
|
_inherits(SdkGet, _Component);
|
|
65
181
|
|
|
66
182
|
var _super = _createSuper(SdkGet);
|
|
67
183
|
|
|
68
184
|
function SdkGet() {
|
|
69
|
-
var _context;
|
|
70
|
-
|
|
71
185
|
var _this;
|
|
72
186
|
|
|
73
187
|
_classCallCheck(this, SdkGet);
|
|
@@ -76,7 +190,7 @@ var SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
76
190
|
args[_key] = arguments[_key];
|
|
77
191
|
}
|
|
78
192
|
|
|
79
|
-
_this = _super.call
|
|
193
|
+
_this = _super.call(this, ...args);
|
|
80
194
|
_this.state = {
|
|
81
195
|
// We want the component to have a loading state by default, so we
|
|
82
196
|
// keep track of whether the first request has completed.
|
|
@@ -89,16 +203,14 @@ var SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
89
203
|
};
|
|
90
204
|
_this.isComponentMounted = false;
|
|
91
205
|
|
|
92
|
-
_this.changeRequestsInFlight =
|
|
93
|
-
if (_this.isComponentMounted) _this.setState(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
97
|
-
});
|
|
206
|
+
_this.changeRequestsInFlight = delta => {
|
|
207
|
+
if (_this.isComponentMounted) _this.setState(prevState => ({
|
|
208
|
+
requestsInFlight: prevState.requestsInFlight + delta
|
|
209
|
+
}));
|
|
98
210
|
};
|
|
99
211
|
|
|
100
|
-
_this.fetch =
|
|
101
|
-
|
|
212
|
+
_this.fetch = _ref => {
|
|
213
|
+
let dispatch = _ref.dispatch,
|
|
102
214
|
actionCreator = _ref.actionCreator,
|
|
103
215
|
actionCreatorArgs = _ref.actionCreatorArgs,
|
|
104
216
|
onSuccess = _ref.onSuccess,
|
|
@@ -106,35 +218,33 @@ var SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
106
218
|
|
|
107
219
|
_this.changeRequestsInFlight(1);
|
|
108
220
|
|
|
109
|
-
return dispatch(actionCreator
|
|
221
|
+
return dispatch(actionCreator(...actionCreatorArgs)).then(result => {
|
|
110
222
|
_this.changeRequestsInFlight(-1);
|
|
111
223
|
|
|
112
224
|
if (_this.isComponentMounted) _this.setState({
|
|
113
225
|
error: undefined,
|
|
114
|
-
result
|
|
226
|
+
result
|
|
115
227
|
});
|
|
116
228
|
if (onSuccess) onSuccess(result);
|
|
117
229
|
return result;
|
|
118
|
-
},
|
|
230
|
+
}, error => {
|
|
119
231
|
_this.changeRequestsInFlight(-1);
|
|
120
232
|
|
|
121
233
|
if (_this.isComponentMounted) _this.setState({
|
|
122
|
-
error
|
|
234
|
+
error,
|
|
123
235
|
result: undefined
|
|
124
236
|
});
|
|
125
237
|
if (onError) onError(error);else SdkGet.errorHandler(error);
|
|
126
238
|
});
|
|
127
239
|
};
|
|
128
240
|
|
|
129
|
-
_this.refresh =
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
});
|
|
137
|
-
};
|
|
241
|
+
_this.refresh = () => _this.fetch({
|
|
242
|
+
dispatch: _this.props.dispatch,
|
|
243
|
+
actionCreator: _this.props.actionCreator,
|
|
244
|
+
actionCreatorArgs: _this.props.actionCreatorArgs,
|
|
245
|
+
onSuccess: _this.props.onSuccess,
|
|
246
|
+
onError: _this.props.onError
|
|
247
|
+
});
|
|
138
248
|
|
|
139
249
|
return _this;
|
|
140
250
|
}
|
|
@@ -142,8 +252,6 @@ var SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
142
252
|
_createClass(SdkGet, [{
|
|
143
253
|
key: "componentDidMount",
|
|
144
254
|
value: function componentDidMount() {
|
|
145
|
-
var _this2 = this;
|
|
146
|
-
|
|
147
255
|
this.isComponentMounted = true;
|
|
148
256
|
this.fetch({
|
|
149
257
|
dispatch: this.props.dispatch,
|
|
@@ -151,13 +259,13 @@ var SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
151
259
|
actionCreatorArgs: this.props.actionCreatorArgs,
|
|
152
260
|
onSuccess: this.props.onSuccess,
|
|
153
261
|
onError: this.props.onError
|
|
154
|
-
}).then(
|
|
155
|
-
if (
|
|
262
|
+
}).then(result => {
|
|
263
|
+
if (this.isComponentMounted) this.setState({
|
|
156
264
|
isWaitingForCompletionOfFirstRequest: false
|
|
157
265
|
});
|
|
158
266
|
return result;
|
|
159
|
-
},
|
|
160
|
-
if (
|
|
267
|
+
}, error => {
|
|
268
|
+
if (this.isComponentMounted) this.setState({
|
|
161
269
|
isWaitingForCompletionOfFirstRequest: false
|
|
162
270
|
});
|
|
163
271
|
throw error;
|
|
@@ -195,143 +303,29 @@ var SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
195
303
|
}(react.Component);
|
|
196
304
|
SdkGet.displayName = 'SdkGet';
|
|
197
305
|
|
|
198
|
-
SdkGet.errorHandler =
|
|
306
|
+
SdkGet.errorHandler = error => {
|
|
199
307
|
throw error;
|
|
200
308
|
};
|
|
201
309
|
|
|
202
310
|
SdkGet.defaultProps = {
|
|
203
311
|
actionCreatorArgs: [],
|
|
204
|
-
shouldRefetch:
|
|
205
|
-
return !fastEquals.deepEqual(prevArgs, nextArgs);
|
|
206
|
-
}
|
|
312
|
+
shouldRefetch: (prevArgs, nextArgs) => !fastEquals.deepEqual(prevArgs, nextArgs)
|
|
207
313
|
};
|
|
208
314
|
SdkGet.propTypes = {};
|
|
209
315
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
};
|
|
214
|
-
};
|
|
316
|
+
const mapDispatchToProps = dispatch => ({
|
|
317
|
+
dispatch
|
|
318
|
+
});
|
|
215
319
|
|
|
216
320
|
var SdkGet$1 = reactRedux.connect(null, mapDispatchToProps)(SdkGet);
|
|
217
321
|
|
|
218
|
-
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
219
|
-
|
|
220
|
-
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$2(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
221
|
-
function get(payload) {
|
|
222
|
-
return {
|
|
223
|
-
type: 'SDK',
|
|
224
|
-
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
225
|
-
method: 'GET'
|
|
226
|
-
})
|
|
227
|
-
};
|
|
228
|
-
} // contrary to the other methods this does not bear the exact name of the HTTP-verb
|
|
229
|
-
// because `delete` is a reserved keyword in ECMAScript
|
|
230
|
-
|
|
231
|
-
function del(payload) {
|
|
232
|
-
return {
|
|
233
|
-
type: 'SDK',
|
|
234
|
-
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
235
|
-
method: 'DELETE'
|
|
236
|
-
})
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
function head(payload) {
|
|
240
|
-
return {
|
|
241
|
-
type: 'SDK',
|
|
242
|
-
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
243
|
-
method: 'HEAD'
|
|
244
|
-
})
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
function post(payload) {
|
|
248
|
-
return {
|
|
249
|
-
type: 'SDK',
|
|
250
|
-
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
251
|
-
method: 'POST'
|
|
252
|
-
})
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
var enhancePayloadForForwardToProxy = function enhancePayloadForForwardToProxy(payload) {
|
|
257
|
-
var _payload$headers, _context;
|
|
258
|
-
|
|
259
|
-
var headers = (_payload$headers = payload.headers) !== null && _payload$headers !== void 0 ? _payload$headers : {};
|
|
260
|
-
var exchangeTokenClaims = [];
|
|
261
|
-
|
|
262
|
-
if (payload.includeUserPermissions) {
|
|
263
|
-
exchangeTokenClaims.push('permissions');
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
return {
|
|
267
|
-
uri: '/proxy/forward-to',
|
|
268
|
-
mcApiProxyTarget: undefined,
|
|
269
|
-
headers: omitEmpty__default["default"](_objectSpread$2(_objectSpread$2({}, _reduceInstanceProperty__default["default"](_context = _Object$entries__default["default"](headers)).call(_context, function (customForwardHeaders, _ref) {
|
|
270
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
271
|
-
headerName = _ref2[0],
|
|
272
|
-
headerValue = _ref2[1];
|
|
273
|
-
|
|
274
|
-
return _objectSpread$2(_objectSpread$2({}, customForwardHeaders), {}, _defineProperty({}, "x-forward-header-".concat(headerName), headerValue));
|
|
275
|
-
}, {})), {}, {
|
|
276
|
-
'Accept-version': 'v2',
|
|
277
|
-
'X-Forward-To': payload.uri,
|
|
278
|
-
'X-Forward-To-Audience-Policy': payload.audiencePolicy || 'forward-url-full-path',
|
|
279
|
-
'X-Forward-To-Claims': exchangeTokenClaims.join(' ')
|
|
280
|
-
}))
|
|
281
|
-
};
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
var forwardTo = {
|
|
285
|
-
get: function get(payload) {
|
|
286
|
-
return {
|
|
287
|
-
type: 'SDK',
|
|
288
|
-
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
289
|
-
method: 'GET'
|
|
290
|
-
}, enhancePayloadForForwardToProxy(payload))
|
|
291
|
-
};
|
|
292
|
-
},
|
|
293
|
-
del: function del(payload) {
|
|
294
|
-
return {
|
|
295
|
-
type: 'SDK',
|
|
296
|
-
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
297
|
-
method: 'DELETE'
|
|
298
|
-
}, enhancePayloadForForwardToProxy(payload))
|
|
299
|
-
};
|
|
300
|
-
},
|
|
301
|
-
head: function head(payload) {
|
|
302
|
-
return {
|
|
303
|
-
type: 'SDK',
|
|
304
|
-
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
305
|
-
method: 'HEAD'
|
|
306
|
-
}, enhancePayloadForForwardToProxy(payload))
|
|
307
|
-
};
|
|
308
|
-
},
|
|
309
|
-
post: function post(payload) {
|
|
310
|
-
return {
|
|
311
|
-
type: 'SDK',
|
|
312
|
-
payload: _objectSpread$2(_objectSpread$2({}, payload), {}, {
|
|
313
|
-
method: 'POST'
|
|
314
|
-
}, enhancePayloadForForwardToProxy(payload))
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
320
|
-
__proto__: null,
|
|
321
|
-
get: get,
|
|
322
|
-
del: del,
|
|
323
|
-
head: head,
|
|
324
|
-
post: post,
|
|
325
|
-
forwardTo: forwardTo
|
|
326
|
-
});
|
|
327
|
-
|
|
328
322
|
// NOTE: This string will be replaced on build time with the package version.
|
|
329
|
-
var version = "21.
|
|
323
|
+
var version = "21.24.1";
|
|
330
324
|
|
|
331
|
-
|
|
332
|
-
|
|
325
|
+
const mcHostnameRegex = /^mc(-(\d){4,})?\.(.*)$/;
|
|
326
|
+
const mcPreviewHostnameRegex = /^.*\.mc-preview\.(.*)$/;
|
|
333
327
|
|
|
334
|
-
|
|
328
|
+
const getMcOriginTld = host => {
|
|
335
329
|
if (host.match(mcPreviewHostnameRegex)) {
|
|
336
330
|
return host.replace(mcPreviewHostnameRegex, '$1');
|
|
337
331
|
}
|
|
@@ -339,21 +333,19 @@ var getMcOriginTld = function getMcOriginTld(host) {
|
|
|
339
333
|
return host.replace(mcHostnameRegex, '$3');
|
|
340
334
|
};
|
|
341
335
|
|
|
342
|
-
|
|
336
|
+
const getMcApiUrlFromOrigin = actualWindow => {
|
|
343
337
|
var _context2;
|
|
344
338
|
|
|
345
|
-
|
|
346
|
-
|
|
339
|
+
const url = new _URL__default["default"](actualWindow.origin);
|
|
340
|
+
const originTld = getMcOriginTld(url.host);
|
|
347
341
|
return _concatInstanceProperty__default["default"](_context2 = "".concat(url.protocol, "//mc-api.")).call(_context2, originTld);
|
|
348
342
|
};
|
|
349
343
|
|
|
350
|
-
|
|
351
|
-
return value === true || value === 'true';
|
|
352
|
-
};
|
|
344
|
+
const parseAsBoolean = value => value === true || value === 'true';
|
|
353
345
|
|
|
354
346
|
function getMcApiUrl() {
|
|
355
|
-
|
|
356
|
-
|
|
347
|
+
let actualWindow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
|
|
348
|
+
const isServedByProxy = parseAsBoolean(actualWindow.app.servedByProxy);
|
|
357
349
|
/**
|
|
358
350
|
* Prefer using the origin URL for the MC API based on the origin value
|
|
359
351
|
* of the browser's `window.location`.
|
|
@@ -373,7 +365,7 @@ function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["d
|
|
|
373
365
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
374
366
|
|
|
375
367
|
_globalThis__default["default"].Buffer = buffer.Buffer;
|
|
376
|
-
|
|
368
|
+
const userAgent = createHttpUserAgent__default["default"]({
|
|
377
369
|
name: '@commercetools/sdk-client',
|
|
378
370
|
libraryName: [window.app.applicationName, 'sdk'].join('/'),
|
|
379
371
|
libraryVersion: version,
|
|
@@ -382,39 +374,37 @@ var userAgent = createHttpUserAgent__default["default"]({
|
|
|
382
374
|
contactEmail: 'mc@commercetools.com'
|
|
383
375
|
});
|
|
384
376
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
});
|
|
377
|
+
const customUserAgentMiddleware = next => (request, response) => {
|
|
378
|
+
const requestWithCustomUserAgent = _objectSpread$1(_objectSpread$1({}, request), {}, {
|
|
379
|
+
headers: _objectSpread$1(_objectSpread$1({}, request.headers), {}, {
|
|
380
|
+
'X-User-Agent': userAgent
|
|
381
|
+
})
|
|
382
|
+
});
|
|
392
383
|
|
|
393
|
-
|
|
394
|
-
};
|
|
384
|
+
next(requestWithCustomUserAgent, response);
|
|
395
385
|
}; // NOTE we should not use these directly but rather have them passed in from
|
|
396
386
|
// the application
|
|
397
387
|
|
|
398
388
|
|
|
399
|
-
|
|
389
|
+
const httpMiddleware = sdkMiddlewareHttp.createHttpMiddleware({
|
|
400
390
|
host: getMcApiUrl(),
|
|
401
391
|
includeResponseHeaders: true,
|
|
402
392
|
credentialsMode: 'include',
|
|
403
|
-
fetch
|
|
393
|
+
fetch
|
|
404
394
|
});
|
|
405
395
|
|
|
406
|
-
|
|
407
|
-
|
|
396
|
+
const createCorrelationIdMiddleware = _ref => {
|
|
397
|
+
let getCorrelationId = _ref.getCorrelationId;
|
|
408
398
|
return sdkMiddlewareCorrelationId.createCorrelationIdMiddleware({
|
|
409
399
|
generate: getCorrelationId
|
|
410
400
|
});
|
|
411
401
|
};
|
|
412
402
|
|
|
413
|
-
|
|
414
|
-
|
|
403
|
+
const createClient = _ref2 => {
|
|
404
|
+
let getCorrelationId = _ref2.getCorrelationId;
|
|
415
405
|
return sdkClient.createClient({
|
|
416
406
|
middlewares: [createCorrelationIdMiddleware({
|
|
417
|
-
getCorrelationId
|
|
407
|
+
getCorrelationId
|
|
418
408
|
}), customUserAgentMiddleware, httpMiddleware]
|
|
419
409
|
});
|
|
420
410
|
};
|
|
@@ -423,14 +413,12 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["def
|
|
|
423
413
|
|
|
424
414
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
425
415
|
|
|
426
|
-
|
|
427
|
-
return actionPayload.uri !== undefined;
|
|
428
|
-
}; // https://github.com/commercetools/nodejs/blob/master/packages/api-request-builder/src/default-services.js#L200:L200
|
|
416
|
+
const isSdkActionForUri = actionPayload => actionPayload.uri !== undefined; // https://github.com/commercetools/nodejs/blob/master/packages/api-request-builder/src/default-services.js#L200:L200
|
|
429
417
|
|
|
430
418
|
|
|
431
|
-
|
|
419
|
+
const ORDER_EDIT_SERVICE = 'orderEdits';
|
|
432
420
|
|
|
433
|
-
|
|
421
|
+
const actionToUri = (action, projectKey) => {
|
|
434
422
|
var _action$payload$optio;
|
|
435
423
|
|
|
436
424
|
if (isSdkActionForUri(action.payload)) return action.payload.uri; // Validate that `projectKey` exists
|
|
@@ -441,13 +429,13 @@ var actionToUri = function actionToUri(action, projectKey) {
|
|
|
441
429
|
throw new Error(_concatInstanceProperty__default["default"](_context = "Expected projectKey to be defined for action service \"".concat(action.payload.service, "\" (method \"")).call(_context, action.payload.method, "\")"));
|
|
442
430
|
}
|
|
443
431
|
|
|
444
|
-
|
|
445
|
-
projectKey
|
|
432
|
+
const requestBuilder = apiRequestBuilder.createRequestBuilder({
|
|
433
|
+
projectKey
|
|
446
434
|
}); // NOTE it's weird that we have to access this from the request builder.
|
|
447
435
|
// Shouldn't it just be a part of the object we parse?
|
|
448
436
|
// NOTE shouldn't requestBuilder be called requestUriBuilder instead?
|
|
449
437
|
|
|
450
|
-
|
|
438
|
+
const service = requestBuilder[action.payload.service];
|
|
451
439
|
if (action.payload.options) service.parse(action.payload.options);
|
|
452
440
|
return service.build({
|
|
453
441
|
// given `service=orderEdits` and given `applyOrderEditTo`, we build an apply endpoint
|
|
@@ -460,117 +448,111 @@ var actionToUri = function actionToUri(action, projectKey) {
|
|
|
460
448
|
}; // Force TS cast of generic action to TNotificationAction
|
|
461
449
|
|
|
462
450
|
|
|
463
|
-
|
|
464
|
-
return action.type === 'SDK';
|
|
465
|
-
};
|
|
451
|
+
const isSdkAction = action => action.type === 'SDK';
|
|
466
452
|
|
|
467
|
-
|
|
468
|
-
return error.statusCode !== undefined;
|
|
469
|
-
};
|
|
453
|
+
const isSdkError = error => error.statusCode !== undefined;
|
|
470
454
|
|
|
471
455
|
function createSdkMiddleware(_ref) {
|
|
472
|
-
|
|
456
|
+
let getCorrelationId = _ref.getCorrelationId,
|
|
473
457
|
getProjectKey = _ref.getProjectKey,
|
|
474
458
|
getAdditionalHeaders = _ref.getAdditionalHeaders;
|
|
475
|
-
|
|
476
|
-
getCorrelationId
|
|
459
|
+
const client = createClient({
|
|
460
|
+
getCorrelationId
|
|
477
461
|
});
|
|
478
462
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
return
|
|
482
|
-
|
|
483
|
-
|
|
463
|
+
const middleware = _ref2 => {
|
|
464
|
+
let dispatch = _ref2.dispatch;
|
|
465
|
+
return next => action => {
|
|
466
|
+
var _context2, _context3;
|
|
467
|
+
|
|
468
|
+
if (!isSdkAction(action)) {
|
|
469
|
+
return next(action);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const projectKey = getProjectKey();
|
|
473
|
+
|
|
474
|
+
const uri = _filterInstanceProperty__default["default"](_context2 = [action.payload.mcApiProxyTarget && "/proxy/".concat(action.payload.mcApiProxyTarget), actionToUri(action, projectKey)]).call(_context2, Boolean).join(''); // This `requestName` is never really used.
|
|
475
|
+
//
|
|
476
|
+
// We keep track of requests which are in progress in the `loading` state of
|
|
477
|
+
// the application. The `loading` state is an array of strings
|
|
478
|
+
// (which are correlation Ids, action types or request names).
|
|
479
|
+
// This is just done so that debugging is easier.
|
|
480
|
+
//
|
|
481
|
+
// It's easier to debug
|
|
482
|
+
// loading: ['PRODUCTS_FETCHED', 'sdk.fetch(/product-projection-search)']
|
|
483
|
+
// than to debug
|
|
484
|
+
// loading: 2
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
const requestName = _concatInstanceProperty__default["default"](_context3 = "sdk.".concat(action.payload.method.toLowerCase(), "(")).call(_context3, uri, ")"); // NOTE here the middleware is aware of the application
|
|
488
|
+
// Instead we should probably convert to a middleware factory
|
|
489
|
+
// and provide hooks for `onFetch`, `onResult` and `onError
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
dispatch({
|
|
493
|
+
type: constants.SHOW_LOADING,
|
|
494
|
+
payload: requestName
|
|
495
|
+
}); // NOTE the promise returned by the client resolves to a custom format
|
|
496
|
+
// it will contain { statusCode, headers, body }
|
|
497
|
+
// NOTE This retry logic could be moved to an sdk client middleware,
|
|
498
|
+
// but the client's middleware system is not capable of that right now
|
|
499
|
+
// https://github.com/commercetools/merchant-center-frontend/pull/3304
|
|
500
|
+
// https://github.com/commercetools/nodejs/issues/390
|
|
501
|
+
|
|
502
|
+
const sendRequest = function () {
|
|
503
|
+
let _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
504
|
+
shouldRenewToken = _ref3.shouldRenewToken;
|
|
505
|
+
|
|
506
|
+
const additionalHeaders = getAdditionalHeaders();
|
|
507
|
+
|
|
508
|
+
const headers = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
509
|
+
Accept: 'application/json'
|
|
510
|
+
}, action.payload.headers || {}), shouldRenewToken ? {
|
|
511
|
+
'X-Force-Token': 'true'
|
|
512
|
+
} : {}), projectKey && {
|
|
513
|
+
'X-Project-Key': projectKey
|
|
514
|
+
}), additionalHeaders !== null && additionalHeaders !== void 0 ? additionalHeaders : {});
|
|
515
|
+
|
|
516
|
+
const body = action.payload.method === 'POST' ? action.payload.payload : undefined;
|
|
517
|
+
return client.execute({
|
|
518
|
+
uri,
|
|
519
|
+
method: action.payload.method,
|
|
520
|
+
headers,
|
|
521
|
+
body
|
|
522
|
+
}).then(result => {
|
|
523
|
+
return result;
|
|
524
|
+
}, error => {
|
|
525
|
+
throw error;
|
|
526
|
+
});
|
|
527
|
+
};
|
|
484
528
|
|
|
485
|
-
|
|
486
|
-
|
|
529
|
+
return sendRequest().catch(error => {
|
|
530
|
+
// in case of 401 error, try again with a new token
|
|
531
|
+
// https://github.com/commercetools/merchant-center-backend/blob/master/docs/AUTHENTICATION.md#problems-due-to-oauth-token-caching
|
|
532
|
+
if (isSdkError(error) && error.statusCode === constants.STATUS_CODES.UNAUTHORIZED) {
|
|
533
|
+
return sendRequest({
|
|
534
|
+
shouldRenewToken: true
|
|
535
|
+
});
|
|
487
536
|
}
|
|
488
537
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
var uri = _filterInstanceProperty__default["default"](_context2 = [action.payload.mcApiProxyTarget && "/proxy/".concat(action.payload.mcApiProxyTarget), actionToUri(action, projectKey)]).call(_context2, Boolean).join(''); // This `requestName` is never really used.
|
|
492
|
-
//
|
|
493
|
-
// We keep track of requests which are in progress in the `loading` state of
|
|
494
|
-
// the application. The `loading` state is an array of strings
|
|
495
|
-
// (which are correlation Ids, action types or request names).
|
|
496
|
-
// This is just done so that debugging is easier.
|
|
497
|
-
//
|
|
498
|
-
// It's easier to debug
|
|
499
|
-
// loading: ['PRODUCTS_FETCHED', 'sdk.fetch(/product-projection-search)']
|
|
500
|
-
// than to debug
|
|
501
|
-
// loading: 2
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
var requestName = _concatInstanceProperty__default["default"](_context3 = "sdk.".concat(action.payload.method.toLowerCase(), "(")).call(_context3, uri, ")"); // NOTE here the middleware is aware of the application
|
|
505
|
-
// Instead we should probably convert to a middleware factory
|
|
506
|
-
// and provide hooks for `onFetch`, `onResult` and `onError
|
|
507
|
-
|
|
508
|
-
|
|
538
|
+
throw error;
|
|
539
|
+
}).then(result => {
|
|
509
540
|
dispatch({
|
|
510
|
-
type: constants.
|
|
541
|
+
type: constants.HIDE_LOADING,
|
|
511
542
|
payload: requestName
|
|
512
|
-
}); //
|
|
513
|
-
//
|
|
514
|
-
//
|
|
515
|
-
//
|
|
516
|
-
// https://github.com/commercetools/merchant-center-frontend/pull/3304
|
|
517
|
-
// https://github.com/commercetools/nodejs/issues/390
|
|
518
|
-
|
|
519
|
-
var sendRequest = function sendRequest() {
|
|
520
|
-
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
521
|
-
shouldRenewToken = _ref3.shouldRenewToken;
|
|
522
|
-
|
|
523
|
-
var additionalHeaders = getAdditionalHeaders();
|
|
524
|
-
|
|
525
|
-
var headers = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
526
|
-
Accept: 'application/json'
|
|
527
|
-
}, action.payload.headers || {}), shouldRenewToken ? {
|
|
528
|
-
'X-Force-Token': 'true'
|
|
529
|
-
} : {}), projectKey && {
|
|
530
|
-
'X-Project-Key': projectKey
|
|
531
|
-
}), additionalHeaders !== null && additionalHeaders !== void 0 ? additionalHeaders : {});
|
|
532
|
-
|
|
533
|
-
var body = action.payload.method === 'POST' ? action.payload.payload : undefined;
|
|
534
|
-
return client.execute({
|
|
535
|
-
uri: uri,
|
|
536
|
-
method: action.payload.method,
|
|
537
|
-
headers: headers,
|
|
538
|
-
body: body
|
|
539
|
-
}).then(function (result) {
|
|
540
|
-
return result;
|
|
541
|
-
}, function (error) {
|
|
542
|
-
throw error;
|
|
543
|
-
});
|
|
544
|
-
};
|
|
545
|
-
|
|
546
|
-
return sendRequest().catch(function (error) {
|
|
547
|
-
// in case of 401 error, try again with a new token
|
|
548
|
-
// https://github.com/commercetools/merchant-center-backend/blob/master/docs/AUTHENTICATION.md#problems-due-to-oauth-token-caching
|
|
549
|
-
if (isSdkError(error) && error.statusCode === constants.STATUS_CODES.UNAUTHORIZED) {
|
|
550
|
-
return sendRequest({
|
|
551
|
-
shouldRenewToken: true
|
|
552
|
-
});
|
|
553
|
-
}
|
|
543
|
+
}); // The promise returned by "fetch" will reject when the request fails,
|
|
544
|
+
// but only in certain cases. See "Checking that the fetch was successful"
|
|
545
|
+
// in https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
|
|
546
|
+
// The SDK already handles this case for us.
|
|
554
547
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
}); // The promise returned by "fetch" will reject when the request fails,
|
|
561
|
-
// but only in certain cases. See "Checking that the fetch was successful"
|
|
562
|
-
// in https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
|
|
563
|
-
// The SDK already handles this case for us.
|
|
564
|
-
|
|
565
|
-
return result.body;
|
|
566
|
-
}, function (error) {
|
|
567
|
-
dispatch({
|
|
568
|
-
type: constants.HIDE_LOADING,
|
|
569
|
-
payload: requestName
|
|
570
|
-
});
|
|
571
|
-
throw error;
|
|
548
|
+
return result.body;
|
|
549
|
+
}, error => {
|
|
550
|
+
dispatch({
|
|
551
|
+
type: constants.HIDE_LOADING,
|
|
552
|
+
payload: requestName
|
|
572
553
|
});
|
|
573
|
-
|
|
554
|
+
throw error;
|
|
555
|
+
});
|
|
574
556
|
};
|
|
575
557
|
};
|
|
576
558
|
|
|
@@ -580,11 +562,11 @@ function createSdkMiddleware(_ref) {
|
|
|
580
562
|
// Wraps `dispatch` and cast the return type to a Promise, as the middleware
|
|
581
563
|
// returns a Promise.
|
|
582
564
|
function useAsyncDispatch() {
|
|
583
|
-
|
|
565
|
+
const dispatch = reactRedux.useDispatch();
|
|
584
566
|
return dispatch;
|
|
585
567
|
}
|
|
586
568
|
|
|
587
|
-
|
|
569
|
+
const Sdk = {
|
|
588
570
|
Get: SdkGet$1
|
|
589
571
|
};
|
|
590
572
|
|