oneentry 1.0.153 → 1.0.155
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 +2 -0
- package/changelog.md +58 -0
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +0 -9
- package/dist/attribute-sets/attributeSetsSchemas.d.ts +0 -4
- package/dist/attribute-sets/attributeSetsSchemas.js +0 -2
- package/dist/base/asyncModules.d.ts +10 -2
- package/dist/base/asyncModules.js +57 -227
- package/dist/base/stateModule.d.ts +5 -13
- package/dist/base/stateModule.js +15 -96
- package/dist/base/syncModules.d.ts +32 -0
- package/dist/base/syncModules.js +42 -1
- package/dist/base/utils.d.ts +2 -0
- package/dist/blocks/blocksApi.d.ts +20 -10
- package/dist/blocks/blocksApi.js +32 -12
- package/dist/blocks/blocksInterfaces.d.ts +18 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -0
- package/dist/orders/ordersInterfaces.d.ts +1 -0
- package/dist/pages/pagesApi.js +13 -1
- package/dist/products/productsApi.d.ts +25 -64
- package/dist/products/productsApi.js +19 -61
- package/dist/products/productsInterfaces.d.ts +74 -70
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +1 -3
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -2
- package/dist/templates-preview/templatesPreviewSchemas.js +0 -1
- package/package.json +4 -1
- package/dist/base/result.d.ts +0 -39
- package/dist/base/result.js +0 -154
package/dist/base/stateModule.js
CHANGED
|
@@ -1,38 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// HTTP status codes for which a custom error handler may be configured.
|
|
4
|
+
const ERROR_STATUS_CODES = [
|
|
5
|
+
400, 401, 403, 404, 429, 500, 502, 503, 504,
|
|
6
|
+
];
|
|
36
7
|
/**
|
|
37
8
|
* State module for managing application state and configuration.
|
|
38
9
|
* @description State module for managing application state and configuration.
|
|
@@ -45,7 +16,7 @@ class StateModule {
|
|
|
45
16
|
* @description Constructor for StateModule.
|
|
46
17
|
*/
|
|
47
18
|
constructor(url, config) {
|
|
48
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
19
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
49
20
|
// In-flight token refresh, shared across all module instances (they share this
|
|
50
21
|
// state object). De-duplicates concurrent refreshes so the single-use refresh
|
|
51
22
|
// token is not burned by parallel requests. Null when no refresh is running.
|
|
@@ -56,6 +27,9 @@ class StateModule {
|
|
|
56
27
|
// Normalize empty string to undefined: an explicit '' must not masquerade
|
|
57
28
|
// as a set guest id (it would otherwise suppress id resolution).
|
|
58
29
|
this.guestId = config.guestId || undefined;
|
|
30
|
+
// Same normalization as guestId: an explicit '' must not suppress the
|
|
31
|
+
// environment-derived fingerprint.
|
|
32
|
+
this.deviceMetadata = config.deviceMetadata || undefined;
|
|
59
33
|
this.traficLimit = config.traficLimit || false;
|
|
60
34
|
this.validationEnabled = (_c = (_b = config.validation) === null || _b === void 0 ? void 0 : _b.enabled) !== null && _c !== void 0 ? _c : false;
|
|
61
35
|
this.validationStrictMode = (_e = (_d = config.validation) === null || _d === void 0 ? void 0 : _d.strictMode) !== null && _e !== void 0 ? _e : false;
|
|
@@ -64,71 +38,16 @@ class StateModule {
|
|
|
64
38
|
this.refreshToken = (_k = (_j = config.auth) === null || _j === void 0 ? void 0 : _j.refreshToken) !== null && _k !== void 0 ? _k : undefined;
|
|
65
39
|
this.providerMarker = (_m = (_l = config.auth) === null || _l === void 0 ? void 0 : _l.providerMarker) !== null && _m !== void 0 ? _m : 'email';
|
|
66
40
|
this.customAuth = (_p = (_o = config.auth) === null || _o === void 0 ? void 0 : _o.customAuth) !== null && _p !== void 0 ? _p : false;
|
|
67
|
-
this.errorsFunctions = {
|
|
68
|
-
'400': undefined,
|
|
69
|
-
'401': undefined,
|
|
70
|
-
'403': undefined,
|
|
71
|
-
'404': undefined,
|
|
72
|
-
'429': undefined,
|
|
73
|
-
'500': undefined,
|
|
74
|
-
'502': undefined,
|
|
75
|
-
'503': undefined,
|
|
76
|
-
'504': undefined,
|
|
77
|
-
};
|
|
41
|
+
this.errorsFunctions = {};
|
|
78
42
|
this.saveFunction = (_r = (_q = config.auth) === null || _q === void 0 ? void 0 : _q.saveFunction) !== null && _r !== void 0 ? _r : null;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
(_u = config.errors.customErrors['401']) !== null && _u !== void 0 ? _u : undefined;
|
|
86
|
-
this.errorsFunctions['403'] =
|
|
87
|
-
(_v = config.errors.customErrors['403']) !== null && _v !== void 0 ? _v : undefined;
|
|
88
|
-
this.errorsFunctions['404'] =
|
|
89
|
-
(_w = config.errors.customErrors['404']) !== null && _w !== void 0 ? _w : undefined;
|
|
90
|
-
this.errorsFunctions['429'] =
|
|
91
|
-
(_x = config.errors.customErrors['429']) !== null && _x !== void 0 ? _x : undefined;
|
|
92
|
-
this.errorsFunctions['500'] =
|
|
93
|
-
(_y = config.errors.customErrors['500']) !== null && _y !== void 0 ? _y : undefined;
|
|
94
|
-
this.errorsFunctions['502'] =
|
|
95
|
-
(_z = config.errors.customErrors['502']) !== null && _z !== void 0 ? _z : undefined;
|
|
96
|
-
this.errorsFunctions['503'] =
|
|
97
|
-
(_0 = config.errors.customErrors['503']) !== null && _0 !== void 0 ? _0 : undefined;
|
|
98
|
-
this.errorsFunctions['504'] =
|
|
99
|
-
(_1 = config.errors.customErrors['504']) !== null && _1 !== void 0 ? _1 : undefined;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
this.isShell = true;
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
if (typeof process === 'object' &&
|
|
107
|
-
+process.versions.node.split('.')[0] < 18) {
|
|
108
|
-
try {
|
|
109
|
-
this._NO_FETCH = true;
|
|
110
|
-
// Dynamically import https for older Node.js versions
|
|
111
|
-
Promise.resolve().then(() => __importStar(require('https'))).then((https) => {
|
|
112
|
-
this._https = https;
|
|
113
|
-
})
|
|
114
|
-
.catch(() => {
|
|
115
|
-
this._https = null;
|
|
116
|
-
});
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
43
|
+
this.isShell = (_t = (_s = config.errors) === null || _s === void 0 ? void 0 : _s.isShell) !== null && _t !== void 0 ? _t : true;
|
|
44
|
+
const customErrors = (_u = config.errors) === null || _u === void 0 ? void 0 : _u.customErrors;
|
|
45
|
+
if (customErrors) {
|
|
46
|
+
for (const code of ERROR_STATUS_CODES) {
|
|
47
|
+
if (customErrors[code]) {
|
|
48
|
+
this.errorsFunctions[code] = customErrors[code];
|
|
118
49
|
}
|
|
119
|
-
catch (e) {
|
|
120
|
-
this._https = null;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
this._NO_FETCH = false;
|
|
125
|
-
this._https = null;
|
|
126
50
|
}
|
|
127
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
128
|
-
}
|
|
129
|
-
catch (e) {
|
|
130
|
-
this._NO_FETCH = false;
|
|
131
|
-
this._https = null;
|
|
132
51
|
}
|
|
133
52
|
}
|
|
134
53
|
}
|
|
@@ -40,6 +40,10 @@ export default abstract class SyncModules {
|
|
|
40
40
|
protected _getFullPath(path: string): string;
|
|
41
41
|
/**
|
|
42
42
|
* Converts query parameters into a query string.
|
|
43
|
+
*
|
|
44
|
+
* Values are percent-encoded so free-text and special characters (spaces,
|
|
45
|
+
* `&`, `=`, non-ASCII) cannot corrupt the query string. Keys are known,
|
|
46
|
+
* machine-safe field names and are left as-is.
|
|
43
47
|
* @param {IProductsQuery | IUploadingQuery | any} query - The query object containing key-value pairs.
|
|
44
48
|
* @returns {string} A string representation of the query parameters.
|
|
45
49
|
*/
|
|
@@ -283,6 +287,30 @@ export default abstract class SyncModules {
|
|
|
283
287
|
* @returns {any} The instance of SyncModules for chaining.
|
|
284
288
|
*/
|
|
285
289
|
setGuestId(guestId: string): any;
|
|
290
|
+
/**
|
|
291
|
+
* Sets the device-metadata override in the state.
|
|
292
|
+
*
|
|
293
|
+
* Once set, the string is sent as the `x-device-metadata` header on POST
|
|
294
|
+
* requests and token refresh instead of the environment-derived fingerprint.
|
|
295
|
+
* The API binds refresh tokens to this header, so server-side flows that issue
|
|
296
|
+
* tokens on behalf of a browser (e.g. an OAuth code exchange) must set the
|
|
297
|
+
* browser's string (obtained there via `getDeviceMetadata`). Pass an empty
|
|
298
|
+
* string to clear the override and fall back to the computed fingerprint.
|
|
299
|
+
* @param {string} deviceMetadata - The metadata string to send (empty string clears the override).
|
|
300
|
+
* @returns {any} The instance of SyncModules for chaining.
|
|
301
|
+
*/
|
|
302
|
+
setDeviceMetadata(deviceMetadata: string): any;
|
|
303
|
+
/**
|
|
304
|
+
* Returns the device-metadata string the SDK sends as the `x-device-metadata` header.
|
|
305
|
+
*
|
|
306
|
+
* Public counterpart of `_getDeviceMetadata`: an explicit override (config or
|
|
307
|
+
* `setDeviceMetadata`) wins, otherwise the environment-derived fingerprint is
|
|
308
|
+
* computed. Use it in the browser to obtain the string that a server-side
|
|
309
|
+
* token-issuing flow (OAuth code exchange) must forward, so the issued refresh
|
|
310
|
+
* token stays refreshable from this browser.
|
|
311
|
+
* @returns {string} The metadata string sent with requests from this instance.
|
|
312
|
+
*/
|
|
313
|
+
getDeviceMetadata(): string;
|
|
286
314
|
/**
|
|
287
315
|
* Get deviceMetadata
|
|
288
316
|
*
|
|
@@ -309,6 +337,10 @@ export default abstract class SyncModules {
|
|
|
309
337
|
* lives until the process restarts.
|
|
310
338
|
*
|
|
311
339
|
* In a Node.js environment (no `window`) returns a simplified object without screen/navigator.
|
|
340
|
+
*
|
|
341
|
+
* An explicitly provided string (`deviceMetadata` in config or `setDeviceMetadata`)
|
|
342
|
+
* takes precedence over the environment-derived fingerprint — this lets a server
|
|
343
|
+
* issue tokens bound to the browser's fingerprint (see `IConfig.deviceMetadata`).
|
|
312
344
|
* @returns {string} - Returns an object containing device metadata.
|
|
313
345
|
*/
|
|
314
346
|
protected _getDeviceMetadata(): string;
|
package/dist/base/syncModules.js
CHANGED
|
@@ -143,6 +143,10 @@ class SyncModules {
|
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* Converts query parameters into a query string.
|
|
146
|
+
*
|
|
147
|
+
* Values are percent-encoded so free-text and special characters (spaces,
|
|
148
|
+
* `&`, `=`, non-ASCII) cannot corrupt the query string. Keys are known,
|
|
149
|
+
* machine-safe field names and are left as-is.
|
|
146
150
|
* @param {IProductsQuery | IUploadingQuery | any} query - The query object containing key-value pairs.
|
|
147
151
|
* @returns {string} A string representation of the query parameters.
|
|
148
152
|
*/
|
|
@@ -151,7 +155,7 @@ class SyncModules {
|
|
|
151
155
|
// 0, false and '' are kept — they are semantically meaningful.
|
|
152
156
|
return Object.keys(query)
|
|
153
157
|
.filter((key) => query[key] !== null && query[key] !== undefined)
|
|
154
|
-
.map((key) => `${key}=${query[key]}`)
|
|
158
|
+
.map((key) => `${key}=${encodeURIComponent(query[key])}`)
|
|
155
159
|
.join('&');
|
|
156
160
|
}
|
|
157
161
|
/**
|
|
@@ -694,6 +698,35 @@ class SyncModules {
|
|
|
694
698
|
this.state.guestId = guestId || undefined;
|
|
695
699
|
return this;
|
|
696
700
|
}
|
|
701
|
+
/**
|
|
702
|
+
* Sets the device-metadata override in the state.
|
|
703
|
+
*
|
|
704
|
+
* Once set, the string is sent as the `x-device-metadata` header on POST
|
|
705
|
+
* requests and token refresh instead of the environment-derived fingerprint.
|
|
706
|
+
* The API binds refresh tokens to this header, so server-side flows that issue
|
|
707
|
+
* tokens on behalf of a browser (e.g. an OAuth code exchange) must set the
|
|
708
|
+
* browser's string (obtained there via `getDeviceMetadata`). Pass an empty
|
|
709
|
+
* string to clear the override and fall back to the computed fingerprint.
|
|
710
|
+
* @param {string} deviceMetadata - The metadata string to send (empty string clears the override).
|
|
711
|
+
* @returns {any} The instance of SyncModules for chaining.
|
|
712
|
+
*/
|
|
713
|
+
setDeviceMetadata(deviceMetadata) {
|
|
714
|
+
this.state.deviceMetadata = deviceMetadata || undefined;
|
|
715
|
+
return this;
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Returns the device-metadata string the SDK sends as the `x-device-metadata` header.
|
|
719
|
+
*
|
|
720
|
+
* Public counterpart of `_getDeviceMetadata`: an explicit override (config or
|
|
721
|
+
* `setDeviceMetadata`) wins, otherwise the environment-derived fingerprint is
|
|
722
|
+
* computed. Use it in the browser to obtain the string that a server-side
|
|
723
|
+
* token-issuing flow (OAuth code exchange) must forward, so the issued refresh
|
|
724
|
+
* token stays refreshable from this browser.
|
|
725
|
+
* @returns {string} The metadata string sent with requests from this instance.
|
|
726
|
+
*/
|
|
727
|
+
getDeviceMetadata() {
|
|
728
|
+
return this._getDeviceMetadata();
|
|
729
|
+
}
|
|
697
730
|
/**
|
|
698
731
|
* Get deviceMetadata
|
|
699
732
|
*
|
|
@@ -720,10 +753,18 @@ class SyncModules {
|
|
|
720
753
|
* lives until the process restarts.
|
|
721
754
|
*
|
|
722
755
|
* In a Node.js environment (no `window`) returns a simplified object without screen/navigator.
|
|
756
|
+
*
|
|
757
|
+
* An explicitly provided string (`deviceMetadata` in config or `setDeviceMetadata`)
|
|
758
|
+
* takes precedence over the environment-derived fingerprint — this lets a server
|
|
759
|
+
* issue tokens bound to the browser's fingerprint (see `IConfig.deviceMetadata`).
|
|
723
760
|
* @returns {string} - Returns an object containing device metadata.
|
|
724
761
|
*/
|
|
725
762
|
_getDeviceMetadata() {
|
|
726
763
|
var _a;
|
|
764
|
+
// Explicit override wins: the API binds refresh tokens to this header, so
|
|
765
|
+
// server-side token issuance must be able to stamp the browser's string.
|
|
766
|
+
if (this.state.deviceMetadata)
|
|
767
|
+
return this.state.deviceMetadata;
|
|
727
768
|
// Check if we're in a browser environment
|
|
728
769
|
if (typeof globalThis === 'undefined') {
|
|
729
770
|
return '';
|
package/dist/base/utils.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @interface IConfig
|
|
3
3
|
* @property {string} [token] - If your project is protected by a token, specify this token in this parameter.
|
|
4
4
|
* @property {string} [guestId] - Guest identifier sent as the `x-guest-id` header on unauthenticated requests. Lets cart/wishlist/activity endpoints work for a guest. In the browser a stable id is auto-generated (localStorage) when omitted; on the server pass a per-visitor id. Can also be set later via `setGuestId`.
|
|
5
|
+
* @property {string} [deviceMetadata] - Device-metadata string sent as the `x-device-metadata` header on POST requests and token refresh, overriding the environment-derived fingerprint. The API binds refresh tokens to this header, so server-side flows that issue tokens on behalf of a browser (e.g. an OAuth code exchange) must pass the browser's string here — otherwise the token is bound to the server's fingerprint and cannot be refreshed from the browser. Obtain the string in the browser via `getDeviceMetadata()`. Can also be set later via `setDeviceMetadata`.
|
|
5
6
|
* @property {string} [langCode] - specify the default language to avoid specifying it in every request.
|
|
6
7
|
* @property {boolean} [traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
|
|
7
8
|
* @property {boolean} [rawData] - Set to true to receive raw API responses without any transformation.
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
interface IConfig {
|
|
45
46
|
token?: string;
|
|
46
47
|
guestId?: string;
|
|
48
|
+
deviceMetadata?: string;
|
|
47
49
|
langCode?: string;
|
|
48
50
|
traficLimit?: boolean;
|
|
49
51
|
rawData?: boolean;
|
|
@@ -66,7 +66,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
66
66
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
67
67
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
68
68
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
69
|
-
* @param {string} [signPrice] -
|
|
69
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
70
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
70
71
|
* @param {number} [productId] - Optional product id to find similar products for.
|
|
71
72
|
* @returns {Promise<IProductsResponse | IError>} Returns the total count and an array of product items in object by specified block marker.
|
|
72
73
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
@@ -80,7 +81,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
80
81
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
81
82
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
82
83
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
83
|
-
* @param {string} [signPrice] -
|
|
84
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
85
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
84
86
|
* @returns {Promise<IProductsEntity[] | IError>} Return array of BlocksEntity object.
|
|
85
87
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
86
88
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getProductsByBlockMarker getProductsByBlockMarker} documentation.
|
|
@@ -92,7 +94,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
92
94
|
* @param {number} productId - Product id. Example: 1.
|
|
93
95
|
* @param {string} marker - Block marker. Example: "frequently_ordered_block".
|
|
94
96
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
95
|
-
* @param {string} [signPrice] -
|
|
97
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
98
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
96
99
|
* @returns {Promise<IProductsResponse | IError>} Returns a products response with items and total.
|
|
97
100
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
98
101
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getFrequentlyOrderedProducts getFrequentlyOrderedProducts} documentation.
|
|
@@ -113,7 +116,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
113
116
|
* @handleName getCartComplement
|
|
114
117
|
* @param {string} marker - Block marker. Example: "cart_complement_block".
|
|
115
118
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
116
|
-
* @param {string} [signPrice] -
|
|
119
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
120
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
117
121
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
118
122
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
119
123
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplement getCartComplement} documentation.
|
|
@@ -139,7 +143,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
139
143
|
* @handleName getCartSimilar
|
|
140
144
|
* @param {string} marker - Block marker. Example: "cart_similar_block".
|
|
141
145
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
142
|
-
* @param {string} [signPrice] -
|
|
146
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
147
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
143
148
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
144
149
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
145
150
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilar getCartSimilar} documentation.
|
|
@@ -165,7 +170,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
165
170
|
* @handleName getPersonalRecommendations
|
|
166
171
|
* @param {string} marker - Block marker. Example: "personal_recommendations_block".
|
|
167
172
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
168
|
-
* @param {string} [signPrice] -
|
|
173
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
174
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
169
175
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
170
176
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
171
177
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getPersonalRecommendations getPersonalRecommendations} documentation.
|
|
@@ -176,7 +182,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
176
182
|
* @handleName getRecentlyViewed
|
|
177
183
|
* @param {string} marker - Block marker. Example: "recently_viewed_block".
|
|
178
184
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
179
|
-
* @param {string} [signPrice] -
|
|
185
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
186
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
180
187
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
181
188
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
182
189
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRecentlyViewed getRecentlyViewed} documentation.
|
|
@@ -187,7 +194,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
187
194
|
* @handleName getRepeatPurchase
|
|
188
195
|
* @param {string} marker - Block marker. Example: "repeat_purchase_block".
|
|
189
196
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
190
|
-
* @param {string} [signPrice] -
|
|
197
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
198
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
191
199
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
192
200
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
193
201
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRepeatPurchase getRepeatPurchase} documentation.
|
|
@@ -207,7 +215,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
207
215
|
* @handleName getTrending
|
|
208
216
|
* @param {string} marker - Block marker. Example: "trending_block".
|
|
209
217
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
210
|
-
* @param {string} [signPrice] -
|
|
218
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
219
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
211
220
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
212
221
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
213
222
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getTrending getTrending} documentation.
|
|
@@ -218,7 +227,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
218
227
|
* @handleName getWishlistSimilar
|
|
219
228
|
* @param {string} marker - Block marker. Example: "wishlist_similar_block".
|
|
220
229
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
221
|
-
* @param {string} [signPrice] -
|
|
230
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
231
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
222
232
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
223
233
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
224
234
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilar getWishlistSimilar} documentation.
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -43,7 +43,12 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
43
43
|
const validated = this._validateResponse(response, blocksSchemas_1.BlocksResponseSchema);
|
|
44
44
|
if (!this.state.traficLimit) {
|
|
45
45
|
const normalizeResponse = this._normalizeData(validated);
|
|
46
|
-
|
|
46
|
+
// On API error responses (e.g. 403 without list permission, 422) the
|
|
47
|
+
// normalized value is an IError without `items` — skip enrichment and
|
|
48
|
+
// return it as-is
|
|
49
|
+
if (Array.isArray(normalizeResponse.items)) {
|
|
50
|
+
await Promise.all(normalizeResponse.items.map((block) => this._enrichBlock(block, langCode, offset, limit, true)));
|
|
51
|
+
}
|
|
47
52
|
return normalizeResponse;
|
|
48
53
|
}
|
|
49
54
|
return this._normalizeData(validated);
|
|
@@ -130,7 +135,8 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
130
135
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
131
136
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
132
137
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
133
|
-
* @param {string} [signPrice] -
|
|
138
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
139
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
134
140
|
* @param {number} [productId] - Optional product id to find similar products for.
|
|
135
141
|
* @returns {Promise<IProductsResponse | IError>} Returns the total count and an array of product items in object by specified block marker.
|
|
136
142
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
@@ -154,7 +160,8 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
154
160
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
155
161
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
156
162
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
157
|
-
* @param {string} [signPrice] -
|
|
163
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
164
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
158
165
|
* @returns {Promise<IProductsEntity[] | IError>} Return array of BlocksEntity object.
|
|
159
166
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
160
167
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getProductsByBlockMarker getProductsByBlockMarker} documentation.
|
|
@@ -167,6 +174,11 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
167
174
|
signPrice,
|
|
168
175
|
};
|
|
169
176
|
const result = await this._fetchGet(`/${marker}/products?` + this._queryParamsToString(query));
|
|
177
|
+
// On API error responses there is no `items` array — return the (normalized)
|
|
178
|
+
// error as-is instead of producing `undefined` from `result.items`.
|
|
179
|
+
if (!Array.isArray(result === null || result === void 0 ? void 0 : result.items)) {
|
|
180
|
+
return this._normalizeData(result);
|
|
181
|
+
}
|
|
170
182
|
return this._normalizeData(result.items);
|
|
171
183
|
}
|
|
172
184
|
/**
|
|
@@ -175,7 +187,8 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
175
187
|
* @param {number} productId - Product id. Example: 1.
|
|
176
188
|
* @param {string} marker - Block marker. Example: "frequently_ordered_block".
|
|
177
189
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
178
|
-
* @param {string} [signPrice] -
|
|
190
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
191
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
179
192
|
* @returns {Promise<IProductsResponse | IError>} Returns a products response with items and total.
|
|
180
193
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
181
194
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getFrequentlyOrderedProducts getFrequentlyOrderedProducts} documentation.
|
|
@@ -199,7 +212,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
199
212
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/searchBlock searchBlock} documentation.
|
|
200
213
|
*/
|
|
201
214
|
async searchBlock(name, langCode = this.state.lang) {
|
|
202
|
-
const result = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
|
|
215
|
+
const result = await this._fetchGet(`/quick/search?langCode=${encodeURIComponent(langCode)}&name=${encodeURIComponent(name)}`);
|
|
203
216
|
// Validate response if validation is enabled
|
|
204
217
|
const validated = this._validateResponse(result, blocksSchemas_1.SearchBlocksResponseSchema);
|
|
205
218
|
return validated;
|
|
@@ -209,7 +222,8 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
209
222
|
* @handleName getCartComplement
|
|
210
223
|
* @param {string} marker - Block marker. Example: "cart_complement_block".
|
|
211
224
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
212
|
-
* @param {string} [signPrice] -
|
|
225
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
226
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
213
227
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
214
228
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
215
229
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplement getCartComplement} documentation.
|
|
@@ -242,7 +256,8 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
242
256
|
* @handleName getCartSimilar
|
|
243
257
|
* @param {string} marker - Block marker. Example: "cart_similar_block".
|
|
244
258
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
245
|
-
* @param {string} [signPrice] -
|
|
259
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
260
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
246
261
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
247
262
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
248
263
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilar getCartSimilar} documentation.
|
|
@@ -275,7 +290,8 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
275
290
|
* @handleName getPersonalRecommendations
|
|
276
291
|
* @param {string} marker - Block marker. Example: "personal_recommendations_block".
|
|
277
292
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
278
|
-
* @param {string} [signPrice] -
|
|
293
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
294
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
279
295
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
280
296
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
281
297
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getPersonalRecommendations getPersonalRecommendations} documentation.
|
|
@@ -290,7 +306,8 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
290
306
|
* @handleName getRecentlyViewed
|
|
291
307
|
* @param {string} marker - Block marker. Example: "recently_viewed_block".
|
|
292
308
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
293
|
-
* @param {string} [signPrice] -
|
|
309
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
310
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
294
311
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
295
312
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
296
313
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRecentlyViewed getRecentlyViewed} documentation.
|
|
@@ -305,7 +322,8 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
305
322
|
* @handleName getRepeatPurchase
|
|
306
323
|
* @param {string} marker - Block marker. Example: "repeat_purchase_block".
|
|
307
324
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
308
|
-
* @param {string} [signPrice] -
|
|
325
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
326
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
309
327
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
310
328
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
311
329
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRepeatPurchase getRepeatPurchase} documentation.
|
|
@@ -332,7 +350,8 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
332
350
|
* @handleName getTrending
|
|
333
351
|
* @param {string} marker - Block marker. Example: "trending_block".
|
|
334
352
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
335
|
-
* @param {string} [signPrice] -
|
|
353
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
354
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
336
355
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
337
356
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
338
357
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getTrending getTrending} documentation.
|
|
@@ -347,7 +366,8 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
347
366
|
* @handleName getWishlistSimilar
|
|
348
367
|
* @param {string} marker - Block marker. Example: "wishlist_similar_block".
|
|
349
368
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
350
|
-
* @param {string} [signPrice] -
|
|
369
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
370
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
351
371
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
352
372
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
353
373
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilar getWishlistSimilar} documentation.
|
|
@@ -46,7 +46,8 @@ interface IBlocks {
|
|
|
46
46
|
* @param {number} productId - Product id. Example: 1.
|
|
47
47
|
* @param {string} marker - Block marker. Example: "frequently_ordered_block".
|
|
48
48
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
49
|
-
* @param {string} [signPrice] -
|
|
49
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
50
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
50
51
|
* @returns {IProductsResponse} A promise that resolves to a products response (items + total) or an error.
|
|
51
52
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
52
53
|
*/
|
|
@@ -56,7 +57,8 @@ interface IBlocks {
|
|
|
56
57
|
* @handleName getCartComplement
|
|
57
58
|
* @param {string} marker - Block marker. Example: "cart_complement_block".
|
|
58
59
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
59
|
-
* @param {string} [signPrice] -
|
|
60
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
61
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
60
62
|
* @returns {IProductsEntity[]} A promise that resolves to an array of products or an error.
|
|
61
63
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
62
64
|
*/
|
|
@@ -80,7 +82,8 @@ interface IBlocks {
|
|
|
80
82
|
* @handleName getCartSimilar
|
|
81
83
|
* @param {string} marker - Block marker. Example: "cart_similar_block".
|
|
82
84
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
83
|
-
* @param {string} [signPrice] -
|
|
85
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
86
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
84
87
|
* @returns {IProductsEntity[]} A promise that resolves to an array of products or an error.
|
|
85
88
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
86
89
|
*/
|
|
@@ -104,7 +107,8 @@ interface IBlocks {
|
|
|
104
107
|
* @handleName getPersonalRecommendations
|
|
105
108
|
* @param {string} marker - Block marker. Example: "personal_recommendations_block".
|
|
106
109
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
107
|
-
* @param {string} [signPrice] -
|
|
110
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
111
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
108
112
|
* @returns {IProductsEntity[]} A promise that resolves to an array of products or an error.
|
|
109
113
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
110
114
|
*/
|
|
@@ -114,7 +118,8 @@ interface IBlocks {
|
|
|
114
118
|
* @handleName getRecentlyViewed
|
|
115
119
|
* @param {string} marker - Block marker. Example: "recently_viewed_block".
|
|
116
120
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
117
|
-
* @param {string} [signPrice] -
|
|
121
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
122
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
118
123
|
* @returns {IProductsEntity[]} A promise that resolves to an array of products or an error.
|
|
119
124
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
120
125
|
*/
|
|
@@ -124,7 +129,8 @@ interface IBlocks {
|
|
|
124
129
|
* @handleName getRepeatPurchase
|
|
125
130
|
* @param {string} marker - Block marker. Example: "repeat_purchase_block".
|
|
126
131
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
127
|
-
* @param {string} [signPrice] -
|
|
132
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
133
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
128
134
|
* @returns {IProductsEntity[]} A promise that resolves to an array of products or an error.
|
|
129
135
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
130
136
|
*/
|
|
@@ -142,7 +148,8 @@ interface IBlocks {
|
|
|
142
148
|
* @handleName getTrending
|
|
143
149
|
* @param {string} marker - Block marker. Example: "trending_block".
|
|
144
150
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
145
|
-
* @param {string} [signPrice] -
|
|
151
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
152
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
146
153
|
* @returns {IProductsEntity[]} A promise that resolves to an array of products or an error.
|
|
147
154
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
148
155
|
*/
|
|
@@ -152,7 +159,8 @@ interface IBlocks {
|
|
|
152
159
|
* @handleName getWishlistSimilar
|
|
153
160
|
* @param {string} marker - Block marker. Example: "wishlist_similar_block".
|
|
154
161
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
155
|
-
* @param {string} [signPrice] -
|
|
162
|
+
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
163
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
156
164
|
* @returns {IProductsEntity[]} A promise that resolves to an array of products or an error.
|
|
157
165
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
158
166
|
*/
|
|
@@ -302,7 +310,8 @@ type BlockType = 'product' | 'error_page' | 'catalog_page' | 'product_preview' |
|
|
|
302
310
|
* @property {number[]} productIds - Product identifiers to look up. Example: [1, 2, 3].
|
|
303
311
|
* @property {string} [langCode] - Language code. Default: "en_US".
|
|
304
312
|
* @property {number} [limit] - Max number of products to return. Example: 10.
|
|
305
|
-
* @property {string} [signPrice] -
|
|
313
|
+
* @property {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
314
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
306
315
|
* @description Body for the POST block product endpoints (cart-complement / cart-similar / wishlist-similar) that accept an explicit list of productIds.
|
|
307
316
|
*/
|
|
308
317
|
interface IBlockProductsLookup {
|
package/dist/index.d.ts
CHANGED
|
@@ -123,6 +123,7 @@ interface IDefineApi {
|
|
|
123
123
|
* @param {IConfig} config - Custom configuration settings
|
|
124
124
|
* @param {string} [config.token] - Optional token parameter
|
|
125
125
|
* @param {string} [config.guestId] - Optional guest identifier sent as the `x-guest-id` header for guest cart/wishlist/activity flows (only while unauthenticated). In the browser, if omitted, a stable per-device id is generated and persisted in localStorage. On the server you MUST pass a per-visitor `guestId` (or call `setGuestId`): the SDK never auto-generates a server id, to avoid sharing one guest across visitors.
|
|
126
|
+
* @param {string} [config.deviceMetadata] - Optional device-metadata string sent as the `x-device-metadata` header instead of the environment-derived fingerprint. Refresh tokens are bound to this header, so a server issuing tokens for a browser (OAuth code exchange) must pass the browser's string (from `getDeviceMetadata()`), or the token will not be refreshable from that browser.
|
|
126
127
|
* @param {string} [config.langCode] - Optional langCode parameter
|
|
127
128
|
* @param {boolean} [config.traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
|
|
128
129
|
* @param {string} [config.auth] - An object with authorization settings.
|