@commercetools-frontend/sdk 24.7.2 → 24.8.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/commercetools-frontend-sdk.cjs.d.ts +2 -2
- package/dist/commercetools-frontend-sdk.cjs.dev.js +6 -19
- package/dist/commercetools-frontend-sdk.cjs.prod.js +6 -10
- package/dist/commercetools-frontend-sdk.esm.js +6 -18
- package/dist/declarations/src/actions/actions.d.ts +1 -1
- package/dist/declarations/src/actions/index.d.ts +1 -1
- package/dist/declarations/src/components/sdk-get/sdk-get.d.ts +15 -4
- package/dist/declarations/src/hooks/use-async-dispatch.d.ts +1 -1
- package/dist/declarations/src/index.d.ts +17 -14
- package/dist/declarations/src/middleware/index.d.ts +1 -1
- package/dist/declarations/src/middleware/middleware.d.ts +1 -2
- package/dist/declarations/src/test-utils/index.d.ts +1 -1
- package/dist/declarations/src/test-utils/test-utils.d.ts +1 -1
- package/dist/declarations/src/types.d.ts +8 -0
- package/package.json +8 -8
- package/test-utils/dist/commercetools-frontend-sdk-test-utils.cjs.d.ts +2 -2
- package/dist/commercetools-frontend-sdk.cjs.d.ts.map +0 -1
- package/dist/declarations/src/components/sdk-get/index.d.ts +0 -1
- package/dist/declarations/src/middleware/client.d.ts +0 -5
- package/dist/declarations/src/utils/index.d.ts +0 -1
- package/dist/declarations/src/utils/logger.d.ts +0 -9
- package/dist/declarations/src/utils/utils.d.ts +0 -26
- package/test-utils/dist/commercetools-frontend-sdk-test-utils.cjs.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./declarations/src/index";
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
export * from "./declarations/src/index.js";
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy1mcm9udGVuZC1zZGsuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
|
|
@@ -18,10 +18,9 @@ var omitEmpty = require('omit-empty-es');
|
|
|
18
18
|
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
19
19
|
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
20
20
|
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
21
|
-
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
22
21
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
23
22
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
24
|
-
var
|
|
23
|
+
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
25
24
|
var react = require('react');
|
|
26
25
|
var fastEquals = require('fast-equals');
|
|
27
26
|
var reactRedux = require('react-redux');
|
|
@@ -50,7 +49,6 @@ var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInsta
|
|
|
50
49
|
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
51
50
|
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
52
51
|
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
53
|
-
var _pt__default = /*#__PURE__*/_interopDefault(_pt);
|
|
54
52
|
var _URL__default = /*#__PURE__*/_interopDefault(_URL);
|
|
55
53
|
var _globalThis__default = /*#__PURE__*/_interopDefault(_globalThis);
|
|
56
54
|
var createHttpUserAgent__default = /*#__PURE__*/_interopDefault(createHttpUserAgent);
|
|
@@ -163,22 +161,20 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
163
161
|
forwardTo: forwardTo
|
|
164
162
|
});
|
|
165
163
|
|
|
166
|
-
function
|
|
164
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
167
165
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
168
166
|
const defaultProps = {
|
|
169
167
|
actionCreatorArgs: [],
|
|
170
168
|
shouldRefetch: (prevArgs, nextArgs) => !fastEquals.deepEqual(prevArgs, nextArgs)
|
|
171
169
|
};
|
|
172
170
|
let SdkGet = /*#__PURE__*/function (_Component) {
|
|
173
|
-
_inherits(SdkGet, _Component);
|
|
174
|
-
var _super = _createSuper(SdkGet);
|
|
175
171
|
function SdkGet() {
|
|
176
172
|
var _this;
|
|
177
173
|
_classCallCheck(this, SdkGet);
|
|
178
174
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
179
175
|
args[_key] = arguments[_key];
|
|
180
176
|
}
|
|
181
|
-
_this =
|
|
177
|
+
_this = _callSuper(this, SdkGet, [...args]);
|
|
182
178
|
_this.state = {
|
|
183
179
|
// We want the component to have a loading state by default, so we
|
|
184
180
|
// keep track of whether the first request has completed.
|
|
@@ -228,7 +224,8 @@ let SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
228
224
|
});
|
|
229
225
|
return _this;
|
|
230
226
|
}
|
|
231
|
-
|
|
227
|
+
_inherits(SdkGet, _Component);
|
|
228
|
+
return _createClass(SdkGet, [{
|
|
232
229
|
key: "componentDidMount",
|
|
233
230
|
value: function componentDidMount() {
|
|
234
231
|
this.isComponentMounted = true;
|
|
@@ -280,28 +277,18 @@ let SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
280
277
|
});
|
|
281
278
|
}
|
|
282
279
|
}]);
|
|
283
|
-
return SdkGet;
|
|
284
280
|
}(react.Component);
|
|
285
281
|
SdkGet.displayName = 'SdkGet';
|
|
286
282
|
SdkGet.errorHandler = error => {
|
|
287
283
|
throw error;
|
|
288
284
|
};
|
|
289
|
-
SdkGet.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
290
|
-
dispatch: _pt__default["default"].func.isRequired,
|
|
291
|
-
actionCreator: _pt__default["default"].func.isRequired,
|
|
292
|
-
actionCreatorArgs: _pt__default["default"].arrayOf(_pt__default["default"].any),
|
|
293
|
-
shouldRefetch: _pt__default["default"].func,
|
|
294
|
-
onSuccess: _pt__default["default"].func,
|
|
295
|
-
onError: _pt__default["default"].func,
|
|
296
|
-
render: _pt__default["default"].func.isRequired
|
|
297
|
-
} : {};
|
|
298
285
|
const mapDispatchToProps = dispatch => ({
|
|
299
286
|
dispatch
|
|
300
287
|
});
|
|
301
288
|
var SdkGet$1 = reactRedux.connect(null, mapDispatchToProps)(SdkGet);
|
|
302
289
|
|
|
303
290
|
// NOTE: This string will be replaced on build time with the package version.
|
|
304
|
-
var version = "24.
|
|
291
|
+
var version = "24.8.0";
|
|
305
292
|
|
|
306
293
|
/* eslint-disable no-console */
|
|
307
294
|
|
|
@@ -18,10 +18,9 @@ var omitEmpty = require('omit-empty-es');
|
|
|
18
18
|
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
19
19
|
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
20
20
|
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
21
|
-
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
22
21
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
23
22
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
24
|
-
require('
|
|
23
|
+
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
25
24
|
var react = require('react');
|
|
26
25
|
var fastEquals = require('fast-equals');
|
|
27
26
|
var reactRedux = require('react-redux');
|
|
@@ -162,22 +161,20 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
162
161
|
forwardTo: forwardTo
|
|
163
162
|
});
|
|
164
163
|
|
|
165
|
-
function
|
|
164
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
166
165
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
167
166
|
const defaultProps = {
|
|
168
167
|
actionCreatorArgs: [],
|
|
169
168
|
shouldRefetch: (prevArgs, nextArgs) => !fastEquals.deepEqual(prevArgs, nextArgs)
|
|
170
169
|
};
|
|
171
170
|
let SdkGet = /*#__PURE__*/function (_Component) {
|
|
172
|
-
_inherits(SdkGet, _Component);
|
|
173
|
-
var _super = _createSuper(SdkGet);
|
|
174
171
|
function SdkGet() {
|
|
175
172
|
var _this;
|
|
176
173
|
_classCallCheck(this, SdkGet);
|
|
177
174
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
178
175
|
args[_key] = arguments[_key];
|
|
179
176
|
}
|
|
180
|
-
_this =
|
|
177
|
+
_this = _callSuper(this, SdkGet, [...args]);
|
|
181
178
|
_this.state = {
|
|
182
179
|
// We want the component to have a loading state by default, so we
|
|
183
180
|
// keep track of whether the first request has completed.
|
|
@@ -227,7 +224,8 @@ let SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
227
224
|
});
|
|
228
225
|
return _this;
|
|
229
226
|
}
|
|
230
|
-
|
|
227
|
+
_inherits(SdkGet, _Component);
|
|
228
|
+
return _createClass(SdkGet, [{
|
|
231
229
|
key: "componentDidMount",
|
|
232
230
|
value: function componentDidMount() {
|
|
233
231
|
this.isComponentMounted = true;
|
|
@@ -279,20 +277,18 @@ let SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
279
277
|
});
|
|
280
278
|
}
|
|
281
279
|
}]);
|
|
282
|
-
return SdkGet;
|
|
283
280
|
}(react.Component);
|
|
284
281
|
SdkGet.displayName = 'SdkGet';
|
|
285
282
|
SdkGet.errorHandler = error => {
|
|
286
283
|
throw error;
|
|
287
284
|
};
|
|
288
|
-
SdkGet.propTypes = {};
|
|
289
285
|
const mapDispatchToProps = dispatch => ({
|
|
290
286
|
dispatch
|
|
291
287
|
});
|
|
292
288
|
var SdkGet$1 = reactRedux.connect(null, mapDispatchToProps)(SdkGet);
|
|
293
289
|
|
|
294
290
|
// NOTE: This string will be replaced on build time with the package version.
|
|
295
|
-
var version = "24.
|
|
291
|
+
var version = "24.8.0";
|
|
296
292
|
|
|
297
293
|
const mcHostnameRegex = /^mc(-(\d){4,})?\.(.*)$/;
|
|
298
294
|
const mcPreviewHostnameRegex = /^.*\.mc-preview\.(.*)$/;
|
|
@@ -14,10 +14,9 @@ import omitEmpty from 'omit-empty-es';
|
|
|
14
14
|
import _Reflect$construct from '@babel/runtime-corejs3/core-js-stable/reflect/construct';
|
|
15
15
|
import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
|
|
16
16
|
import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
|
|
17
|
-
import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
18
17
|
import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn';
|
|
19
18
|
import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
|
|
20
|
-
import
|
|
19
|
+
import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
21
20
|
import { Component } from 'react';
|
|
22
21
|
import { deepEqual } from 'fast-equals';
|
|
23
22
|
import { connect, useDispatch } from 'react-redux';
|
|
@@ -140,22 +139,20 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
140
139
|
forwardTo: forwardTo
|
|
141
140
|
});
|
|
142
141
|
|
|
143
|
-
function
|
|
142
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
144
143
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
145
144
|
const defaultProps = {
|
|
146
145
|
actionCreatorArgs: [],
|
|
147
146
|
shouldRefetch: (prevArgs, nextArgs) => !deepEqual(prevArgs, nextArgs)
|
|
148
147
|
};
|
|
149
148
|
let SdkGet = /*#__PURE__*/function (_Component) {
|
|
150
|
-
_inherits(SdkGet, _Component);
|
|
151
|
-
var _super = _createSuper(SdkGet);
|
|
152
149
|
function SdkGet() {
|
|
153
150
|
var _this;
|
|
154
151
|
_classCallCheck(this, SdkGet);
|
|
155
152
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
156
153
|
args[_key] = arguments[_key];
|
|
157
154
|
}
|
|
158
|
-
_this =
|
|
155
|
+
_this = _callSuper(this, SdkGet, [...args]);
|
|
159
156
|
_this.state = {
|
|
160
157
|
// We want the component to have a loading state by default, so we
|
|
161
158
|
// keep track of whether the first request has completed.
|
|
@@ -205,7 +202,8 @@ let SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
205
202
|
});
|
|
206
203
|
return _this;
|
|
207
204
|
}
|
|
208
|
-
|
|
205
|
+
_inherits(SdkGet, _Component);
|
|
206
|
+
return _createClass(SdkGet, [{
|
|
209
207
|
key: "componentDidMount",
|
|
210
208
|
value: function componentDidMount() {
|
|
211
209
|
this.isComponentMounted = true;
|
|
@@ -257,28 +255,18 @@ let SdkGet = /*#__PURE__*/function (_Component) {
|
|
|
257
255
|
});
|
|
258
256
|
}
|
|
259
257
|
}]);
|
|
260
|
-
return SdkGet;
|
|
261
258
|
}(Component);
|
|
262
259
|
SdkGet.displayName = 'SdkGet';
|
|
263
260
|
SdkGet.errorHandler = error => {
|
|
264
261
|
throw error;
|
|
265
262
|
};
|
|
266
|
-
SdkGet.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
267
|
-
dispatch: _pt.func.isRequired,
|
|
268
|
-
actionCreator: _pt.func.isRequired,
|
|
269
|
-
actionCreatorArgs: _pt.arrayOf(_pt.any),
|
|
270
|
-
shouldRefetch: _pt.func,
|
|
271
|
-
onSuccess: _pt.func,
|
|
272
|
-
onError: _pt.func,
|
|
273
|
-
render: _pt.func.isRequired
|
|
274
|
-
} : {};
|
|
275
263
|
const mapDispatchToProps = dispatch => ({
|
|
276
264
|
dispatch
|
|
277
265
|
});
|
|
278
266
|
var SdkGet$1 = connect(null, mapDispatchToProps)(SdkGet);
|
|
279
267
|
|
|
280
268
|
// NOTE: This string will be replaced on build time with the package version.
|
|
281
|
-
var version = "24.
|
|
269
|
+
var version = "24.8.0";
|
|
282
270
|
|
|
283
271
|
/* eslint-disable no-console */
|
|
284
272
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TSdkActionPayloadBody, TSdkActionPayloadForUri, TSdkActionPayloadForService, TSdkActionGetForUri, TSdkActionGetForService, TSdkActionDeleteForUri, TSdkActionDeleteForService, TSdkActionHeadForUri, TSdkActionHeadForService, TSdkActionPostForUri, TSdkActionPostForService } from
|
|
1
|
+
import type { TSdkActionPayloadBody, TSdkActionPayloadForUri, TSdkActionPayloadForService, TSdkActionGetForUri, TSdkActionGetForService, TSdkActionDeleteForUri, TSdkActionDeleteForService, TSdkActionHeadForUri, TSdkActionHeadForService, TSdkActionPostForUri, TSdkActionPostForService } from "../types.js";
|
|
2
2
|
export type THeaders = Record<string, string>;
|
|
3
3
|
export declare function get(payload: TSdkActionPayloadForUri): TSdkActionGetForUri;
|
|
4
4
|
export declare function get(payload: TSdkActionPayloadForService): TSdkActionGetForService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./actions.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="commercetools__sdk-client" />
|
|
2
1
|
import { Component, JSX } from 'react';
|
|
3
2
|
import type { SuccessResult, HttpErrorType } from '@commercetools/sdk-client';
|
|
4
|
-
import type { TSdkAction } from
|
|
3
|
+
import type { TSdkAction } from "../../types.js";
|
|
5
4
|
type TSdkError = Error | HttpErrorType;
|
|
6
5
|
type TActionCreatorArgs = unknown[];
|
|
7
6
|
type State = {
|
|
@@ -43,9 +42,21 @@ export declare class SdkGet extends Component<Props, State> {
|
|
|
43
42
|
componentDidMount(): void;
|
|
44
43
|
componentDidUpdate(prevProps: Props): void;
|
|
45
44
|
componentWillUnmount(): void;
|
|
46
|
-
fetch: ({ dispatch, actionCreator, actionCreatorArgs, onSuccess, onError, }: Pick<Props,
|
|
45
|
+
fetch: ({ dispatch, actionCreator, actionCreatorArgs, onSuccess, onError, }: Pick<Props, "dispatch" | "actionCreator" | "actionCreatorArgs" | "onSuccess" | "onError">) => Promise<void | import("@commercetools/sdk-client").Json>;
|
|
47
46
|
refresh: () => Promise<void | import("@commercetools/sdk-client").Json>;
|
|
48
47
|
render(): JSX.Element;
|
|
49
48
|
}
|
|
50
|
-
declare const _default: import("react-redux").ConnectedComponent<typeof SdkGet,
|
|
49
|
+
declare const _default: import("react-redux").ConnectedComponent<typeof SdkGet, {
|
|
50
|
+
render: (options: TRenderOptions) => JSX.Element;
|
|
51
|
+
ref?: import("react").Ref<SdkGet> | undefined;
|
|
52
|
+
key?: import("react").Key | null | undefined;
|
|
53
|
+
onError?: ((error: TSdkError) => void) | undefined;
|
|
54
|
+
css?: import("@emotion/react").Interpolation<import("@emotion/react").Theme>;
|
|
55
|
+
actionCreator: (...args: TActionCreatorArgs) => TSdkAction;
|
|
56
|
+
actionCreatorArgs?: TActionCreatorArgs | undefined;
|
|
57
|
+
shouldRefetch?: ((prevArgs: TActionCreatorArgs, nextArgs: TActionCreatorArgs) => boolean) | undefined;
|
|
58
|
+
onSuccess?: ((result: SuccessResult["body"]) => void) | undefined;
|
|
59
|
+
context?: import("react").Context<import("react-redux").ReactReduxContextValue<any, import("redux").UnknownAction> | null> | undefined;
|
|
60
|
+
store?: import("redux").Store | undefined;
|
|
61
|
+
}>;
|
|
51
62
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TSdkAction } from
|
|
1
|
+
import type { TSdkAction } from "../types.js";
|
|
2
2
|
type TAsyncDispatch<Action extends TSdkAction, Data> = (action: Action) => Promise<Data>;
|
|
3
3
|
declare function useAsyncDispatch<Action extends TSdkAction, Data>(): TAsyncDispatch<Action, Data>;
|
|
4
4
|
export default useAsyncDispatch;
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { default as
|
|
5
|
-
export
|
|
6
|
-
export { default as useAsyncDispatch } from './hooks/use-async-dispatch';
|
|
7
|
-
export * from './types';
|
|
1
|
+
import * as actions from "./actions/index.js";
|
|
2
|
+
export { default as version } from "./version.js";
|
|
3
|
+
export { default as createMiddleware } from "./middleware/index.js";
|
|
4
|
+
export { default as useAsyncDispatch } from "./hooks/use-async-dispatch.js";
|
|
5
|
+
export * from "./types.js";
|
|
8
6
|
declare const Sdk: {
|
|
9
|
-
Get: import("react-redux").ConnectedComponent<typeof import("./components/sdk-get/sdk-get").SdkGet,
|
|
10
|
-
actionCreator: (...args: unknown[]) => import("./types").TSdkAction;
|
|
11
|
-
actionCreatorArgs?: unknown[] | undefined;
|
|
12
|
-
shouldRefetch?: ((prevArgs: unknown[], nextArgs: unknown[]) => boolean) | undefined;
|
|
13
|
-
onSuccess?: ((result: import("@commercetools/sdk-client").Json) => void) | undefined;
|
|
14
|
-
onError?: ((error: Error | import("@commercetools/sdk-client").HttpErrorType) => void) | undefined;
|
|
7
|
+
Get: import("react-redux").ConnectedComponent<typeof import("./components/sdk-get/sdk-get.js").SdkGet, {
|
|
15
8
|
render: (options: {
|
|
16
9
|
isLoading: boolean;
|
|
17
|
-
refresh: () => Promise<void | import("@commercetools/sdk-client").
|
|
10
|
+
refresh: () => Promise<void | import("@commercetools/sdk-client").SuccessResult["body"]>;
|
|
18
11
|
result?: import("@commercetools/sdk-client").Json | undefined;
|
|
19
12
|
error?: (Error | import("@commercetools/sdk-client").HttpErrorType) | undefined;
|
|
20
13
|
}) => import("react").JSX.Element;
|
|
14
|
+
ref?: import("react").Ref<import("./components/sdk-get/sdk-get.js").SdkGet> | undefined;
|
|
15
|
+
key?: import("react").Key | null | undefined;
|
|
16
|
+
onError?: ((error: Error | import("@commercetools/sdk-client").HttpErrorType) => void) | undefined;
|
|
17
|
+
css?: import("@emotion/react").Interpolation<import("@emotion/react").Theme>;
|
|
18
|
+
actionCreator: (...args: unknown[]) => import("./types.js").TSdkAction;
|
|
19
|
+
actionCreatorArgs?: unknown[] | undefined;
|
|
20
|
+
shouldRefetch?: ((prevArgs: unknown[], nextArgs: unknown[]) => boolean) | undefined;
|
|
21
|
+
onSuccess?: ((result: import("@commercetools/sdk-client").SuccessResult["body"]) => void) | undefined;
|
|
22
|
+
context?: import("react").Context<import("react-redux").ReactReduxContextValue<any, import("redux").UnknownAction> | null> | undefined;
|
|
23
|
+
store?: import("redux").Store | undefined;
|
|
21
24
|
}>;
|
|
22
25
|
};
|
|
23
26
|
export { Sdk, actions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from "./middleware.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="commercetools__sdk-client" />
|
|
2
1
|
import type { Dispatch, MiddlewareAPI } from 'redux';
|
|
3
|
-
import type { TSdkAction } from
|
|
2
|
+
import type { TSdkAction } from "../types.js";
|
|
4
3
|
export default function createSdkMiddleware({ getCorrelationId, getProjectKey, getAdditionalHeaders, }: {
|
|
5
4
|
getCorrelationId: () => string;
|
|
6
5
|
getProjectKey: () => string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./test-utils.js";
|
|
@@ -30,37 +30,45 @@ export type TSdkActionPayload = TSdkActionPayloadForUri | TSdkActionPayloadForSe
|
|
|
30
30
|
export type TSdkActionGetForUri = {
|
|
31
31
|
type: 'SDK';
|
|
32
32
|
payload: TSdkActionPayloadForUri & TSdkActionPayloadMethod<'GET'>;
|
|
33
|
+
[key: string]: unknown;
|
|
33
34
|
};
|
|
34
35
|
export type TSdkActionGetForService = {
|
|
35
36
|
type: 'SDK';
|
|
36
37
|
payload: TSdkActionPayloadForService & TSdkActionPayloadMethod<'GET'>;
|
|
38
|
+
[key: string]: unknown;
|
|
37
39
|
};
|
|
38
40
|
export type TSdkActionGet = TSdkActionGetForUri | TSdkActionGetForService;
|
|
39
41
|
export type TSdkActionPostForUri = {
|
|
40
42
|
type: 'SDK';
|
|
41
43
|
payload: TSdkActionPayloadForUri & TSdkActionPayloadMethod<'POST'> & TSdkActionPayloadBody;
|
|
44
|
+
[key: string]: unknown;
|
|
42
45
|
};
|
|
43
46
|
export type TSdkActionPostForService = {
|
|
44
47
|
type: 'SDK';
|
|
45
48
|
payload: TSdkActionPayloadForService & TSdkActionPayloadMethod<'POST'> & TSdkActionPayloadBody;
|
|
49
|
+
[key: string]: unknown;
|
|
46
50
|
};
|
|
47
51
|
export type TSdkActionPost = TSdkActionPostForUri | TSdkActionPostForService;
|
|
48
52
|
export type TSdkActionDeleteForUri = {
|
|
49
53
|
type: 'SDK';
|
|
50
54
|
payload: TSdkActionPayloadForUri & TSdkActionPayloadMethod<'DELETE'>;
|
|
55
|
+
[key: string]: unknown;
|
|
51
56
|
};
|
|
52
57
|
export type TSdkActionDeleteForService = {
|
|
53
58
|
type: 'SDK';
|
|
54
59
|
payload: TSdkActionPayloadForService & TSdkActionPayloadMethod<'DELETE'>;
|
|
60
|
+
[key: string]: unknown;
|
|
55
61
|
};
|
|
56
62
|
export type TSdkActionDelete = TSdkActionDeleteForUri | TSdkActionDeleteForService;
|
|
57
63
|
export type TSdkActionHeadForUri = {
|
|
58
64
|
type: 'SDK';
|
|
59
65
|
payload: TSdkActionPayloadForUri & TSdkActionPayloadMethod<'HEAD'>;
|
|
66
|
+
[key: string]: unknown;
|
|
60
67
|
};
|
|
61
68
|
export type TSdkActionHeadForService = {
|
|
62
69
|
type: 'SDK';
|
|
63
70
|
payload: TSdkActionPayloadForService & TSdkActionPayloadMethod<'HEAD'>;
|
|
71
|
+
[key: string]: unknown;
|
|
64
72
|
};
|
|
65
73
|
export type TSdkActionHead = TSdkActionHeadForUri | TSdkActionHeadForService;
|
|
66
74
|
export type TSdkAction = TSdkActionGet | TSdkActionPost | TSdkActionDelete | TSdkActionHead;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/sdk",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.8.0",
|
|
4
4
|
"description": "Tools for declarative fetching",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@babel/runtime": "^7.22.15",
|
|
39
39
|
"@babel/runtime-corejs3": "^7.22.15",
|
|
40
|
-
"@commercetools-frontend/constants": "24.
|
|
40
|
+
"@commercetools-frontend/constants": "24.8.0",
|
|
41
41
|
"@commercetools/api-request-builder": "6.0.0",
|
|
42
42
|
"@commercetools/http-user-agent": "3.0.0",
|
|
43
43
|
"@commercetools/sdk-client": "3.0.0",
|
|
44
44
|
"@commercetools/sdk-middleware-correlation-id": "3.0.0",
|
|
45
45
|
"@commercetools/sdk-middleware-http": "7.0.4",
|
|
46
|
-
"@types/node-fetch": "2.6.
|
|
46
|
+
"@types/node-fetch": "2.6.13",
|
|
47
47
|
"@types/prop-types": "^15.7.5",
|
|
48
48
|
"@types/react": "^19.0.3",
|
|
49
49
|
"@types/react-redux": "^7.1.26",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
"jest-mock": "29.7.0",
|
|
63
63
|
"react": "19.0.0",
|
|
64
64
|
"react-dom": "19.0.0",
|
|
65
|
-
"react-redux": "
|
|
66
|
-
"redux": "
|
|
67
|
-
"redux-thunk": "
|
|
65
|
+
"react-redux": "9.2.0",
|
|
66
|
+
"redux": "5.0.1",
|
|
67
|
+
"redux-thunk": "3.1.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"react": "19.x",
|
|
71
|
-
"react-redux": "7.x",
|
|
72
|
-
"redux": "4.x"
|
|
71
|
+
"react-redux": "7.x || 9.x",
|
|
72
|
+
"redux": "4.x || 5.x"
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "../../dist/declarations/src/test-utils/index";
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
export * from "../../dist/declarations/src/test-utils/index.js";
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy1mcm9udGVuZC1zZGstdGVzdC11dGlscy5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL2Rpc3QvZGVjbGFyYXRpb25zL3NyYy90ZXN0LXV0aWxzL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commercetools-frontend-sdk.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './sdk-get';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { parseUri, logRequest, getMcApiUrl } from './utils';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const logger: {
|
|
2
|
-
groupCollapsed(groupTitle?: string, ...optionalParams: unknown[]): void;
|
|
3
|
-
groupEnd(): void;
|
|
4
|
-
info(message?: unknown, ...optionalParams: unknown[]): void;
|
|
5
|
-
log(message?: unknown, ...optionalParams: unknown[]): void;
|
|
6
|
-
error(message?: unknown, ...optionalParams: unknown[]): void;
|
|
7
|
-
warn(message?: unknown, ...optionalParams: unknown[]): void;
|
|
8
|
-
};
|
|
9
|
-
export default logger;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { THttpMethod, TSdkAction, Json } from '../types';
|
|
2
|
-
type LogRequestParams = {
|
|
3
|
-
method: THttpMethod;
|
|
4
|
-
request: {
|
|
5
|
-
headers: {
|
|
6
|
-
[key: string]: string;
|
|
7
|
-
};
|
|
8
|
-
uri: string;
|
|
9
|
-
};
|
|
10
|
-
response?: Json;
|
|
11
|
-
error?: Error;
|
|
12
|
-
action: TSdkAction;
|
|
13
|
-
};
|
|
14
|
-
export declare const parseUri: (uri: string) => {
|
|
15
|
-
pathname: string;
|
|
16
|
-
search: Partial<{}>;
|
|
17
|
-
};
|
|
18
|
-
export declare const logRequest: ({ method, request, response, error, action, }: LogRequestParams) => void;
|
|
19
|
-
export interface ApplicationWindow extends Window {
|
|
20
|
-
app: {
|
|
21
|
-
servedByProxy: string | boolean;
|
|
22
|
-
mcApiUrl: string;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export declare function getMcApiUrl(actualWindow?: ApplicationWindow): string;
|
|
26
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commercetools-frontend-sdk-test-utils.cjs.d.ts","sourceRoot":"","sources":["../../dist/declarations/src/test-utils/index.d.ts"],"names":[],"mappings":"AAAA"}
|