oneentry 1.0.156 → 1.0.158
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/changelog.md +143 -0
- package/dist/attribute-sets/attributeSetsApi.d.ts +2 -2
- package/dist/attribute-sets/attributeSetsApi.js +5 -5
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +20 -8
- package/dist/auth-provider/authProviderSchemas.d.ts +2 -0
- package/dist/auth-provider/authProviderSchemas.js +2 -0
- package/dist/auth-provider/authProvidersInterfaces.d.ts +4 -0
- package/dist/base/asyncModules.d.ts +18 -2
- package/dist/base/asyncModules.js +32 -8
- package/dist/base/syncModules.d.ts +37 -36
- package/dist/base/syncModules.js +69 -82
- package/dist/base/timeIntervals.js +6 -5
- package/dist/base/utils.d.ts +14 -10
- package/dist/blocks/blocksApi.d.ts +21 -21
- package/dist/blocks/blocksApi.js +10 -10
- package/dist/blocks/blocksInterfaces.d.ts +20 -20
- package/dist/blocks/blocksSchemas.d.ts +2 -0
- package/dist/discounts/discountsInterfaces.d.ts +4 -4
- package/dist/events/eventsApi.d.ts +3 -3
- package/dist/events/eventsApi.js +1 -1
- package/dist/events/eventsInterfaces.d.ts +16 -5
- package/dist/forms/formsApi.js +2 -2
- package/dist/forms/formsInterfaces.d.ts +23 -21
- package/dist/forms-data/formsDataApi.js +2 -2
- package/dist/forms-data/formsDataInterfaces.d.ts +4 -4
- package/dist/integration-collections/integrationCollectionsApi.js +6 -6
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +4 -0
- package/dist/integration-collections/integrationCollectionsSchemas.d.ts +4 -0
- package/dist/integration-collections/integrationCollectionsSchemas.js +2 -0
- package/dist/menus/menusApi.js +1 -1
- package/dist/orders/ordersInterfaces.d.ts +21 -3
- package/dist/orders/ordersSchemas.d.ts +10 -0
- package/dist/orders/ordersSchemas.js +12 -0
- package/dist/pages/pagesApi.d.ts +4 -4
- package/dist/pages/pagesApi.js +10 -9
- package/dist/pages/pagesInterfaces.d.ts +14 -4
- package/dist/pages/pagesSchemas.d.ts +15 -0
- package/dist/pages/pagesSchemas.js +13 -1
- package/dist/products/productsApi.d.ts +6 -6
- package/dist/products/productsApi.js +13 -11
- package/dist/products/productsInterfaces.d.ts +39 -19
- package/dist/products/productsSchemas.d.ts +18 -0
- package/dist/products/productsSchemas.js +15 -1
- package/dist/subscriptions/subscriptionsApi.d.ts +4 -4
- package/dist/subscriptions/subscriptionsApi.js +3 -3
- package/dist/subscriptions/subscriptionsInterfaces.d.ts +26 -5
- package/dist/subscriptions/subscriptionsSchemas.d.ts +27 -1
- package/dist/subscriptions/subscriptionsSchemas.js +20 -2
- package/package.json +1 -1
package/dist/base/syncModules.js
CHANGED
|
@@ -91,14 +91,17 @@ class SyncModules {
|
|
|
91
91
|
/**
|
|
92
92
|
* Sorts attributes by their positions.
|
|
93
93
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* @
|
|
94
|
+
* Each attribute has a `position` field, and the API returns them in no
|
|
95
|
+
* particular order. The method rebuilds the collection sorted by ascending
|
|
96
|
+
* `position`, so the display order matches the order defined in the CMS.
|
|
97
|
+
* Both container shapes the API uses are handled: an object keyed by marker
|
|
98
|
+
* (`attributeValues`) and an array (form `attributes`).
|
|
99
|
+
* @param {any} data - The attributes collection to sort.
|
|
100
|
+
* @returns {any} Sorted attributes, in the same container shape.
|
|
100
101
|
*/
|
|
101
|
-
this._sortAttributes = (data) =>
|
|
102
|
+
this._sortAttributes = (data) => Array.isArray(data)
|
|
103
|
+
? [...data].sort((a, b) => a.position - b.position)
|
|
104
|
+
: Object.fromEntries(Object.entries(data).sort(([, a], [, b]) => a.position - b.position));
|
|
102
105
|
this.state = state;
|
|
103
106
|
this._url = state.url;
|
|
104
107
|
this._nodeDeviceId = _generateId();
|
|
@@ -240,50 +243,42 @@ class SyncModules {
|
|
|
240
243
|
return body;
|
|
241
244
|
}
|
|
242
245
|
/**
|
|
243
|
-
*
|
|
246
|
+
* Normalizes the value of a single attribute in place.
|
|
244
247
|
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* In that case `value` is unwrapped: `[img]` → `img`.
|
|
248
|
+
* Applies the three type-driven fixes the API response needs, so that an
|
|
249
|
+
* attribute of a given type always reaches the consumer in the same shape,
|
|
250
|
+
* no matter which collection it arrived in:
|
|
249
251
|
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
252
|
+
* 1. **Single-file values** (`image`, `file`) — the API always sends an array,
|
|
253
|
+
* even for one file: `[img]` → `img`. Multi-file values and `groupOfImages`
|
|
254
|
+
* (a collection by definition) stay an array.
|
|
255
|
+
* 2. **Empty values** — an attribute with no value comes back as an empty
|
|
256
|
+
* localization map `{}`; it is replaced with `null`, the same marker the
|
|
257
|
+
* numeric branch already produced.
|
|
258
|
+
* 3. **Numbers** (`integer`, `float`, `real`) — cast to a JS number; anything
|
|
259
|
+
* that is not a number (including an empty value) becomes `null`.
|
|
260
|
+
* @param {any} attr - The attribute object to normalize in place.
|
|
253
261
|
*/
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
|
|
262
|
+
_normalizeAttrValue(attr) {
|
|
263
|
+
if ((attr.type === 'image' || attr.type === 'file') &&
|
|
264
|
+
Array.isArray(attr.value) &&
|
|
265
|
+
attr.value.length === 1) {
|
|
266
|
+
attr.value = attr.value[0];
|
|
257
267
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
else if (!data[key] || typeof data[key] !== 'object') {
|
|
265
|
-
normalizeData[key] = data[key];
|
|
266
|
-
}
|
|
267
|
-
else if (key === 'attributeValues') {
|
|
268
|
-
const attrs = data[key];
|
|
269
|
-
Object.keys(attrs).forEach((attr) => {
|
|
270
|
-
// If an image attribute has a single-element value array,
|
|
271
|
-
// unwrap it to a plain object for consumer convenience.
|
|
272
|
-
if (attrs[attr].type === 'image' &&
|
|
273
|
-
attrs[attr].value.length === 1) {
|
|
274
|
-
attrs[attr].value = attrs[attr].value[0];
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
normalizeData[key] = data[key];
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
normalizeData[key] = this._clearArray(data[key]);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
return normalizeData;
|
|
268
|
+
// An attribute with no value arrives as an empty localization map.
|
|
269
|
+
if (attr.value &&
|
|
270
|
+
typeof attr.value === 'object' &&
|
|
271
|
+
!Array.isArray(attr.value) &&
|
|
272
|
+
Object.keys(attr.value).length === 0) {
|
|
273
|
+
attr.value = null;
|
|
284
274
|
}
|
|
285
|
-
|
|
286
|
-
|
|
275
|
+
if (attr.type === 'integer' ||
|
|
276
|
+
attr.type === 'float' ||
|
|
277
|
+
attr.type === 'real') {
|
|
278
|
+
// Number(null) is 0 and Number('') is 0 — an empty value must stay empty.
|
|
279
|
+
const isEmpty = attr.value === null || attr.value === undefined || attr.value === '';
|
|
280
|
+
const numValue = isEmpty ? NaN : Number(attr.value);
|
|
281
|
+
attr.value = isNaN(numValue) ? null : numValue;
|
|
287
282
|
}
|
|
288
283
|
}
|
|
289
284
|
/**
|
|
@@ -306,18 +301,24 @@ class SyncModules {
|
|
|
306
301
|
*
|
|
307
302
|
* Handles three different attribute formats returned by the API:
|
|
308
303
|
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
* - `_normalizeAdditionalFields`
|
|
312
|
-
* -
|
|
313
|
-
*
|
|
304
|
+
* All three go through the same steps, so an attribute of a given type looks
|
|
305
|
+
* the same whichever collection it arrived in:
|
|
306
|
+
* - `_normalizeAdditionalFields` turns nested fields into a marker map;
|
|
307
|
+
* - `_normalizeAttrValue` unwraps single-file values, empties to `null` and
|
|
308
|
+
* casts numbers;
|
|
309
|
+
* - the collection is re-sorted by `position`.
|
|
310
|
+
*
|
|
311
|
+
* **1. `attributeValues`** — attributes of pages, products and other entities,
|
|
312
|
+
* an object `{ marker: AttrObject }`.
|
|
314
313
|
*
|
|
315
|
-
* **2. `attributes`** — form attributes (
|
|
316
|
-
*
|
|
317
|
-
*
|
|
314
|
+
* **2. `attributes`** — form attributes, an array (or a marker map on some
|
|
315
|
+
* endpoints); form-only boolean flags (`isLogin`, `isSignUp`, notifications)
|
|
316
|
+
* are additionally coerced from `null` to `false`. A form with no attributes
|
|
317
|
+
* arrives as an empty object `{}` — it is normalized to an empty array.
|
|
318
318
|
*
|
|
319
|
-
* **3. `type`** — a
|
|
320
|
-
*
|
|
319
|
+
* **3. `type`** — a standalone attribute: an attribute-set entry, a form-data
|
|
320
|
+
* field or a nested `additionalFields` entry. Same transformations, but there
|
|
321
|
+
* is no collection to sort.
|
|
321
322
|
*
|
|
322
323
|
* `timeInterval` attributes are left exactly as the API returned them — a
|
|
323
324
|
* compact recurrence rule. Resolving one into concrete slots is the caller's
|
|
@@ -334,11 +335,7 @@ class SyncModules {
|
|
|
334
335
|
Object.keys(data.attributeValues).forEach((attr) => {
|
|
335
336
|
const d = data.attributeValues[attr];
|
|
336
337
|
this._normalizeAdditionalFields(d);
|
|
337
|
-
|
|
338
|
-
if (d.type === 'integer' || d.type === 'float') {
|
|
339
|
-
const numValue = Number(d.value);
|
|
340
|
-
d.value = isNaN(numValue) ? null : numValue;
|
|
341
|
-
}
|
|
338
|
+
this._normalizeAttrValue(d);
|
|
342
339
|
});
|
|
343
340
|
return {
|
|
344
341
|
...data,
|
|
@@ -355,47 +352,37 @@ class SyncModules {
|
|
|
355
352
|
// for forms attributes - forms attributes collections
|
|
356
353
|
if ('attributes' in data) {
|
|
357
354
|
const d = data.attributes;
|
|
355
|
+
// A form with no attributes arrives as an empty object `{}` — normalize
|
|
356
|
+
// it to an empty array, the container every non-empty form uses.
|
|
357
|
+
if (d &&
|
|
358
|
+
typeof d === 'object' &&
|
|
359
|
+
!Array.isArray(d) &&
|
|
360
|
+
Object.keys(d).length === 0) {
|
|
361
|
+
return { ...data, attributes: [] };
|
|
362
|
+
}
|
|
358
363
|
Object.keys(d).forEach((attr) => {
|
|
359
364
|
this._normalizeAdditionalFields(d[attr]);
|
|
365
|
+
this._normalizeAttrValue(d[attr]);
|
|
360
366
|
for (const field of booleanFields) {
|
|
361
367
|
if (field in d[attr] && d[attr][field] === null) {
|
|
362
368
|
d[attr][field] = false;
|
|
363
369
|
}
|
|
364
370
|
}
|
|
365
371
|
});
|
|
366
|
-
return data;
|
|
372
|
+
return { ...data, attributes: this._sortAttributes(d) };
|
|
367
373
|
}
|
|
368
374
|
// For single attribute - for attribute sets
|
|
369
375
|
if ('type' in data) {
|
|
370
376
|
this._normalizeAdditionalFields(data);
|
|
377
|
+
this._normalizeAttrValue(data);
|
|
371
378
|
for (const field of booleanFields) {
|
|
372
379
|
if (field in data && data[field] === null) {
|
|
373
380
|
data[field] = false;
|
|
374
381
|
}
|
|
375
382
|
}
|
|
376
|
-
// Normalize numbers
|
|
377
|
-
if (data.type === 'integer' || data.type === 'float') {
|
|
378
|
-
const numValue = Number(data.value);
|
|
379
|
-
data.value = isNaN(numValue) ? null : numValue;
|
|
380
|
-
}
|
|
381
383
|
}
|
|
382
384
|
return data;
|
|
383
385
|
}
|
|
384
|
-
/**
|
|
385
|
-
* Processes data after fetching or receiving it.
|
|
386
|
-
*
|
|
387
|
-
* Final post-processing of the API response: first unwraps localized fields
|
|
388
|
-
* (`_normalizeData`), then fixes single-element image attributes
|
|
389
|
-
* (`_clearArray`). Called at the end of every fetch method.
|
|
390
|
-
* @param {any} data - The data to process.
|
|
391
|
-
* @param {any} [langCode] - The language code for processing.
|
|
392
|
-
* @returns {any} Processed data.
|
|
393
|
-
*/
|
|
394
|
-
_dataPostProcess(data, langCode = this.state.lang) {
|
|
395
|
-
const normalize = this._normalizeData(data, langCode);
|
|
396
|
-
const result = this._clearArray(normalize);
|
|
397
|
-
return result;
|
|
398
|
-
}
|
|
399
386
|
/**
|
|
400
387
|
* Sets the access token in the state.
|
|
401
388
|
* @param {string} accessToken - The access token to set.
|
|
@@ -136,13 +136,14 @@ function _addSlotsFromRanges(day, ranges, out) {
|
|
|
136
136
|
const endMinutes = _toMinutes(range === null || range === void 0 ? void 0 : range.end);
|
|
137
137
|
if (startMinutes === null || endMinutes === null)
|
|
138
138
|
return;
|
|
139
|
-
// A non-positive period would never advance the cursor; a
|
|
140
|
-
// would concatenate into it.
|
|
141
|
-
|
|
139
|
+
// A non-positive period would never advance the cursor; a null or
|
|
140
|
+
// non-numeric one would concatenate into it.
|
|
141
|
+
const period = range === null || range === void 0 ? void 0 : range.period;
|
|
142
|
+
if (typeof period !== 'number' || !Number.isFinite(period) || period <= 0)
|
|
142
143
|
return;
|
|
143
|
-
for (let minutes = startMinutes; minutes +
|
|
144
|
+
for (let minutes = startMinutes; minutes + period <= endMinutes; minutes += period) {
|
|
144
145
|
const from = day + minutes * _MS_PER_MINUTE;
|
|
145
|
-
const to = day + (minutes +
|
|
146
|
+
const to = day + (minutes + period) * _MS_PER_MINUTE;
|
|
146
147
|
out.push([new Date(from).toISOString(), new Date(to).toISOString()]);
|
|
147
148
|
}
|
|
148
149
|
});
|
package/dist/base/utils.d.ts
CHANGED
|
@@ -136,6 +136,7 @@ interface IAttributes {
|
|
|
136
136
|
* @property {string | null} [plainValue] - Localized plain-text content (without HTML markup). Example: "Plain description".
|
|
137
137
|
* @property {string | null} [htmlValue] - Localized HTML-rendered content. Example: "<p>Description</p>".
|
|
138
138
|
* @property {string | null} [htmlContent] - Localized HTML body content for richer pages. Example: "<div>...</div>".
|
|
139
|
+
* @property {string | null} [plainContent] - Localized plain-text version of `htmlContent`; returned by pages and menus. Example: "Description".
|
|
139
140
|
* @property {string | null} [menuTitle] - Localized title used in menus and navigation. Example: "Home".
|
|
140
141
|
* @description Normalized localization payload for a single locale, returned by the SDK after unwrapping the API's per-language map.
|
|
141
142
|
*/
|
|
@@ -144,23 +145,26 @@ interface ILocalizeInfo {
|
|
|
144
145
|
plainValue?: string | null;
|
|
145
146
|
htmlValue?: string | null;
|
|
146
147
|
htmlContent?: string | null;
|
|
148
|
+
plainContent?: string | null;
|
|
147
149
|
menuTitle?: string | null;
|
|
148
150
|
}
|
|
149
151
|
/**
|
|
150
152
|
* @interface IAttributeLocalizeInfo
|
|
153
|
+
* @property {string} [title] - Localized title of the attribute. Optional — the payload is an empty object when the attribute has no localization for the requested language (e.g. form attributes in list responses). Example: "Color".
|
|
151
154
|
* @property {ITimeIntervalSchedule[]} [intervals] - For attributes of type `timeInterval`, the schedule data attached to the localization payload. Each entry is a compact recurrence rule — pass it to `expandTimeIntervals` to resolve concrete slots.
|
|
152
|
-
* @description Extension of {@link ILocalizeInfo} used by attribute entities — adds attribute-type-specific fields the API exposes via `localizeInfos`.
|
|
155
|
+
* @description Extension of {@link ILocalizeInfo} used by attribute entities — adds attribute-type-specific fields the API exposes via `localizeInfos`. Unlike the base type, `title` is optional here.
|
|
153
156
|
*/
|
|
154
|
-
interface IAttributeLocalizeInfo extends ILocalizeInfo {
|
|
157
|
+
interface IAttributeLocalizeInfo extends Omit<ILocalizeInfo, 'title'> {
|
|
158
|
+
title?: string;
|
|
155
159
|
intervals?: ITimeIntervalSchedule[];
|
|
156
160
|
[key: string]: unknown;
|
|
157
161
|
}
|
|
158
162
|
/**
|
|
159
163
|
* @interface ITimeIntervalSchedule
|
|
160
164
|
* @property {string} id - Schedule entry identifier (UUID). Example: "c6466cd8-c55d-4583-97c5-42b684210f12".
|
|
161
|
-
* @property {number} fullMonth - Month index this schedule covers (0-11). Example: 2.
|
|
165
|
+
* @property {number} [fullMonth] - Month index this schedule covers (0-11). Optional — present when the schedule is pinned to a month/year rather than an explicit date `range`. Example: 2.
|
|
162
166
|
* @property {boolean} inEveryMonth - Whether the schedule repeats every month. Example: true.
|
|
163
|
-
* @property {number} selectedYear - Year the schedule applies to. Example: 2025.
|
|
167
|
+
* @property {number} [selectedYear] - Year the schedule applies to. Optional — present when the schedule is pinned to a month/year rather than an explicit date `range`. Example: 2025.
|
|
164
168
|
* @property {ITimeIntervalRange[]} intervals - Daily time ranges configured for the schedule.
|
|
165
169
|
* @property {unknown[]} external - External overrides; empty array when none.
|
|
166
170
|
* @property {string[]} range - Validity range as a pair of ISO dates `[from, to]`; empty array when none. When both entries are equal the schedule is anchored to that single day and its recurrence is open-ended. Example: ["2025-05-07T21:00:00.000Z", "2025-05-07T21:00:00.000Z"].
|
|
@@ -169,9 +173,9 @@ interface IAttributeLocalizeInfo extends ILocalizeInfo {
|
|
|
169
173
|
*/
|
|
170
174
|
interface ITimeIntervalSchedule {
|
|
171
175
|
id: string;
|
|
172
|
-
fullMonth
|
|
176
|
+
fullMonth?: number;
|
|
173
177
|
inEveryMonth: boolean;
|
|
174
|
-
selectedYear
|
|
178
|
+
selectedYear?: number;
|
|
175
179
|
intervals: ITimeIntervalRange[];
|
|
176
180
|
external: unknown[];
|
|
177
181
|
range: string[];
|
|
@@ -248,20 +252,20 @@ interface ITimeIntervalPoint {
|
|
|
248
252
|
* @property {string} id - Range identifier (UUID).
|
|
249
253
|
* @property {ITimeIntervalPoint} start - Start time of the range.
|
|
250
254
|
* @property {ITimeIntervalPoint} end - End time of the range.
|
|
251
|
-
* @property {number} period - Slot duration in minutes. Example: 60.
|
|
255
|
+
* @property {number | null} period - Slot duration in minutes; `null` when the range is not sliced into slots. Example: 60.
|
|
252
256
|
* @description A single daily time range inside a {@link ITimeIntervalSchedule}.
|
|
253
257
|
*/
|
|
254
258
|
interface ITimeIntervalRange {
|
|
255
259
|
id: string;
|
|
256
260
|
start: ITimeIntervalPoint;
|
|
257
261
|
end: ITimeIntervalPoint;
|
|
258
|
-
period: number;
|
|
262
|
+
period: number | null;
|
|
259
263
|
}
|
|
260
264
|
/**
|
|
261
265
|
* @interface IAttributeValue
|
|
262
266
|
* @property {string} type - Attribute data type (e.g. "string", "integer", "list", "file", "image").
|
|
263
|
-
* @property {unknown} value - Attribute value — actual TS type depends on `type`
|
|
264
|
-
* @property {number} [position] - Sort position of the value inside its set. Example: 0.
|
|
267
|
+
* @property {unknown} value - Attribute value — actual TS type depends on `type`, and the SDK normalizes it to the same shape in every module: `string` for "string"/"text"; `number | null` for "integer"/"float"/"real"; the file object itself for a single-file "image"/"file" and an array of them for several; an array for "list" and "groupOfImages". An attribute with no value is always `null`. Example: "Admins text".
|
|
268
|
+
* @property {number} [position] - Sort position of the value inside its set; the containing collection is returned sorted by it. Example: 0.
|
|
265
269
|
* @property {Record<string, IAttributeValue> | unknown[]} [additionalFields] - Nested attribute values keyed by marker; the API may also return an empty array when none are configured. Optional.
|
|
266
270
|
* @property {boolean} [isIcon] - Block/preview attribute flag — whether the field is treated as an icon. Optional.
|
|
267
271
|
* @property {boolean} [isProductPreview] - Block/preview attribute flag — whether the field is shown in product preview. Optional.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AsyncModules from '../base/asyncModules';
|
|
2
2
|
import type StateModule from '../base/stateModule';
|
|
3
3
|
import type { IError } from '../base/utils';
|
|
4
|
-
import type {
|
|
4
|
+
import type { IProductsResponse } from '../products/productsInterfaces';
|
|
5
5
|
import type { BlockType, IBlockEntity, IBlockProductsLookup, IBlocks, IBlockSlidesResponse, IBlocksResponse, ISearchBlock } from './blocksInterfaces';
|
|
6
6
|
/**
|
|
7
7
|
* Controllers for working with blocks.
|
|
@@ -118,11 +118,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
118
118
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
119
119
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
120
120
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
121
|
-
* @returns {Promise<
|
|
121
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
122
122
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
123
123
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplement getCartComplement} documentation.
|
|
124
124
|
*/
|
|
125
|
-
getCartComplement(marker: string, langCode?: string, signPrice?: string): Promise<
|
|
125
|
+
getCartComplement(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
126
126
|
/**
|
|
127
127
|
* Get "complete your cart" products by an explicit list of productIds (POST body).
|
|
128
128
|
* @handleName getCartComplementByProductIds
|
|
@@ -133,11 +133,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
133
133
|
"productIds": [1, 2],
|
|
134
134
|
"langCode": "en_US"
|
|
135
135
|
}
|
|
136
|
-
* @returns {Promise<
|
|
136
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
137
137
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
138
138
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplementByProductIds getCartComplementByProductIds} documentation.
|
|
139
139
|
*/
|
|
140
|
-
getCartComplementByProductIds(marker: string, body: IBlockProductsLookup): Promise<
|
|
140
|
+
getCartComplementByProductIds(marker: string, body: IBlockProductsLookup): Promise<IProductsResponse | IError>;
|
|
141
141
|
/**
|
|
142
142
|
* Get "similar to cart" products by the cart from context (auth user or guest).
|
|
143
143
|
* @handleName getCartSimilar
|
|
@@ -145,11 +145,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
145
145
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
146
146
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
147
147
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
148
|
-
* @returns {Promise<
|
|
148
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
149
149
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
150
150
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilar getCartSimilar} documentation.
|
|
151
151
|
*/
|
|
152
|
-
getCartSimilar(marker: string, langCode?: string, signPrice?: string): Promise<
|
|
152
|
+
getCartSimilar(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
153
153
|
/**
|
|
154
154
|
* Get "similar to cart" products by an explicit list of productIds (POST body).
|
|
155
155
|
* @handleName getCartSimilarByProductIds
|
|
@@ -160,11 +160,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
160
160
|
"productIds": [1, 2],
|
|
161
161
|
"langCode": "en_US"
|
|
162
162
|
}
|
|
163
|
-
* @returns {Promise<
|
|
163
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
164
164
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
165
165
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilarByProductIds getCartSimilarByProductIds} documentation.
|
|
166
166
|
*/
|
|
167
|
-
getCartSimilarByProductIds(marker: string, body: IBlockProductsLookup): Promise<
|
|
167
|
+
getCartSimilarByProductIds(marker: string, body: IBlockProductsLookup): Promise<IProductsResponse | IError>;
|
|
168
168
|
/**
|
|
169
169
|
* Get personal recommendations for the user.
|
|
170
170
|
* @handleName getPersonalRecommendations
|
|
@@ -172,11 +172,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
172
172
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
173
173
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
174
174
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
175
|
-
* @returns {Promise<
|
|
175
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
176
176
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
177
177
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getPersonalRecommendations getPersonalRecommendations} documentation.
|
|
178
178
|
*/
|
|
179
|
-
getPersonalRecommendations(marker: string, langCode?: string, signPrice?: string): Promise<
|
|
179
|
+
getPersonalRecommendations(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
180
180
|
/**
|
|
181
181
|
* Get recently viewed products.
|
|
182
182
|
* @handleName getRecentlyViewed
|
|
@@ -184,11 +184,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
184
184
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
185
185
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
186
186
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
187
|
-
* @returns {Promise<
|
|
187
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
188
188
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
189
189
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRecentlyViewed getRecentlyViewed} documentation.
|
|
190
190
|
*/
|
|
191
|
-
getRecentlyViewed(marker: string, langCode?: string, signPrice?: string): Promise<
|
|
191
|
+
getRecentlyViewed(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
192
192
|
/**
|
|
193
193
|
* Get products for repeat purchase.
|
|
194
194
|
* @handleName getRepeatPurchase
|
|
@@ -196,11 +196,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
196
196
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
197
197
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
198
198
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
199
|
-
* @returns {Promise<
|
|
199
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
200
200
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
201
201
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRepeatPurchase getRepeatPurchase} documentation.
|
|
202
202
|
*/
|
|
203
|
-
getRepeatPurchase(marker: string, langCode?: string, signPrice?: string): Promise<
|
|
203
|
+
getRepeatPurchase(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
204
204
|
/**
|
|
205
205
|
* Get the block's slides tree as a flat pre-order array (slider_block only).
|
|
206
206
|
* @handleName getSlides
|
|
@@ -217,11 +217,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
217
217
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
218
218
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
219
219
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
220
|
-
* @returns {Promise<
|
|
220
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
221
221
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
222
222
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getTrending getTrending} documentation.
|
|
223
223
|
*/
|
|
224
|
-
getTrending(marker: string, langCode?: string, signPrice?: string): Promise<
|
|
224
|
+
getTrending(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
225
225
|
/**
|
|
226
226
|
* Get "similar to wishlist" products by the wishlist from context (auth user or guest).
|
|
227
227
|
* @handleName getWishlistSimilar
|
|
@@ -229,11 +229,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
229
229
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
230
230
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
231
231
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
232
|
-
* @returns {Promise<
|
|
232
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
233
233
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
234
234
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilar getWishlistSimilar} documentation.
|
|
235
235
|
*/
|
|
236
|
-
getWishlistSimilar(marker: string, langCode?: string, signPrice?: string): Promise<
|
|
236
|
+
getWishlistSimilar(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
237
237
|
/**
|
|
238
238
|
* Get "similar to wishlist" products by an explicit list of productIds (POST body).
|
|
239
239
|
* @handleName getWishlistSimilarByProductIds
|
|
@@ -244,9 +244,9 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
244
244
|
"productIds": [1, 2],
|
|
245
245
|
"langCode": "en_US"
|
|
246
246
|
}
|
|
247
|
-
* @returns {Promise<
|
|
247
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
248
248
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
249
249
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilarByProductIds getWishlistSimilarByProductIds} documentation.
|
|
250
250
|
*/
|
|
251
|
-
getWishlistSimilarByProductIds(marker: string, body: IBlockProductsLookup): Promise<
|
|
251
|
+
getWishlistSimilarByProductIds(marker: string, body: IBlockProductsLookup): Promise<IProductsResponse | IError>;
|
|
252
252
|
}
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -224,7 +224,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
224
224
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
225
225
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
226
226
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
227
|
-
* @returns {Promise<
|
|
227
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
228
228
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
229
229
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplement getCartComplement} documentation.
|
|
230
230
|
*/
|
|
@@ -243,7 +243,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
243
243
|
"productIds": [1, 2],
|
|
244
244
|
"langCode": "en_US"
|
|
245
245
|
}
|
|
246
|
-
* @returns {Promise<
|
|
246
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
247
247
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
248
248
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplementByProductIds getCartComplementByProductIds} documentation.
|
|
249
249
|
*/
|
|
@@ -258,7 +258,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
258
258
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
259
259
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
260
260
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
261
|
-
* @returns {Promise<
|
|
261
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
262
262
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
263
263
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilar getCartSimilar} documentation.
|
|
264
264
|
*/
|
|
@@ -277,7 +277,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
277
277
|
"productIds": [1, 2],
|
|
278
278
|
"langCode": "en_US"
|
|
279
279
|
}
|
|
280
|
-
* @returns {Promise<
|
|
280
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
281
281
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
282
282
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilarByProductIds getCartSimilarByProductIds} documentation.
|
|
283
283
|
*/
|
|
@@ -292,7 +292,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
292
292
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
293
293
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
294
294
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
295
|
-
* @returns {Promise<
|
|
295
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
296
296
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
297
297
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getPersonalRecommendations getPersonalRecommendations} documentation.
|
|
298
298
|
*/
|
|
@@ -308,7 +308,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
308
308
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
309
309
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
310
310
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
311
|
-
* @returns {Promise<
|
|
311
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
312
312
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
313
313
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRecentlyViewed getRecentlyViewed} documentation.
|
|
314
314
|
*/
|
|
@@ -324,7 +324,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
324
324
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
325
325
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
326
326
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
327
|
-
* @returns {Promise<
|
|
327
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
328
328
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
329
329
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRepeatPurchase getRepeatPurchase} documentation.
|
|
330
330
|
*/
|
|
@@ -352,7 +352,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
352
352
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
353
353
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
354
354
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
355
|
-
* @returns {Promise<
|
|
355
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
356
356
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
357
357
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getTrending getTrending} documentation.
|
|
358
358
|
*/
|
|
@@ -368,7 +368,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
368
368
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
369
369
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
370
370
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
371
|
-
* @returns {Promise<
|
|
371
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
372
372
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
373
373
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilar getWishlistSimilar} documentation.
|
|
374
374
|
*/
|
|
@@ -387,7 +387,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
387
387
|
"productIds": [1, 2],
|
|
388
388
|
"langCode": "en_US"
|
|
389
389
|
}
|
|
390
|
-
* @returns {Promise<
|
|
390
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
391
391
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
392
392
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilarByProductIds getWishlistSimilarByProductIds} documentation.
|
|
393
393
|
*/
|