oneentry 1.0.161 → 1.0.163
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 +18 -0
- package/changelog.md +80 -3
- package/dist/admins/adminsInterfaces.d.ts +2 -0
- package/dist/admins/adminsSchemas.d.ts +8 -22
- package/dist/admins/adminsSchemas.js +3 -9
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +8 -6
- package/dist/auth-provider/authProviderSchemas.d.ts +1 -0
- package/dist/auth-provider/authProvidersInterfaces.d.ts +4 -4
- package/dist/base/attributes.d.ts +105 -0
- package/dist/base/attributes.js +172 -0
- package/dist/base/utils.d.ts +95 -2
- package/dist/base/validation.d.ts +30 -0
- package/dist/base/validation.js +94 -1
- package/dist/blocks/blocksApi.d.ts +16 -8
- package/dist/blocks/blocksApi.js +24 -15
- package/dist/blocks/blocksInterfaces.d.ts +17 -9
- package/dist/blocks/blocksSchemas.d.ts +6 -6
- package/dist/blocks/blocksSchemas.js +2 -1
- package/dist/discounts/discountsInterfaces.d.ts +3 -1
- package/dist/forms-data/formsDataApi.d.ts +16 -6
- package/dist/forms-data/formsDataApi.js +14 -4
- package/dist/forms-data/formsDataInterfaces.d.ts +57 -20
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -1
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +6 -6
- package/dist/menus/menusInterfaces.d.ts +5 -1
- package/dist/menus/menusSchemas.js +4 -1
- package/dist/orders/ordersInterfaces.d.ts +3 -1
- package/dist/orders/ordersSchemas.d.ts +2 -0
- package/dist/orders/ordersSchemas.js +1 -0
- package/dist/pages/pagesApi.d.ts +1 -11
- package/dist/pages/pagesApi.js +0 -17
- package/dist/pages/pagesInterfaces.d.ts +3 -20
- package/dist/pages/pagesSchemas.d.ts +6 -10
- package/dist/pages/pagesSchemas.js +4 -9
- package/dist/product-statuses/productStatusesInterfaces.d.ts +2 -2
- package/dist/products/productsSchemas.d.ts +5 -5
- package/dist/products/productsSchemas.js +3 -2
- package/dist/templates/templatesInterfaces.d.ts +1 -1
- package/dist/templates/templatesSchemas.d.ts +3 -3
- package/dist/templates/templatesSchemas.js +2 -1
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +2 -2
- package/dist/users/usersInterfaces.d.ts +2 -0
- package/dist/users/usersSchemas.d.ts +1 -0
- package/esm/admins/adminsInterfaces.d.ts +2 -0
- package/esm/admins/adminsSchemas.d.ts +8 -22
- package/esm/admins/adminsSchemas.js +3 -9
- package/esm/attribute-sets/attributeSetsInterfaces.d.ts +8 -6
- package/esm/auth-provider/authProviderSchemas.d.ts +1 -0
- package/esm/auth-provider/authProvidersInterfaces.d.ts +4 -4
- package/esm/base/attributes.d.ts +105 -0
- package/esm/base/attributes.js +163 -0
- package/esm/base/utils.d.ts +95 -2
- package/esm/base/validation.d.ts +30 -0
- package/esm/base/validation.js +93 -0
- package/esm/blocks/blocksApi.d.ts +16 -8
- package/esm/blocks/blocksApi.js +24 -15
- package/esm/blocks/blocksInterfaces.d.ts +17 -9
- package/esm/blocks/blocksSchemas.d.ts +6 -6
- package/esm/blocks/blocksSchemas.js +2 -1
- package/esm/discounts/discountsInterfaces.d.ts +3 -1
- package/esm/forms-data/formsDataApi.d.ts +16 -6
- package/esm/forms-data/formsDataApi.js +14 -4
- package/esm/forms-data/formsDataInterfaces.d.ts +57 -20
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +6 -6
- package/esm/menus/menusInterfaces.d.ts +5 -1
- package/esm/menus/menusSchemas.js +4 -1
- package/esm/orders/ordersInterfaces.d.ts +3 -1
- package/esm/orders/ordersSchemas.d.ts +2 -0
- package/esm/orders/ordersSchemas.js +1 -0
- package/esm/pages/pagesApi.d.ts +1 -11
- package/esm/pages/pagesApi.js +0 -17
- package/esm/pages/pagesInterfaces.d.ts +3 -20
- package/esm/pages/pagesSchemas.d.ts +6 -10
- package/esm/pages/pagesSchemas.js +3 -8
- package/esm/product-statuses/productStatusesInterfaces.d.ts +2 -2
- package/esm/products/productsSchemas.d.ts +5 -5
- package/esm/products/productsSchemas.js +3 -2
- package/esm/templates/templatesInterfaces.d.ts +1 -1
- package/esm/templates/templatesSchemas.d.ts +3 -3
- package/esm/templates/templatesSchemas.js +2 -1
- package/esm/templates-preview/templatesPreviewInterfaces.d.ts +2 -2
- package/esm/users/usersInterfaces.d.ts +2 -0
- package/esm/users/usersSchemas.d.ts +1 -0
- package/package.json +2 -2
package/dist/base/utils.d.ts
CHANGED
|
@@ -266,10 +266,19 @@ interface ITimeIntervalRange {
|
|
|
266
266
|
* @property {string} type - Attribute data type (e.g. "string", "integer", "list", "file", "image").
|
|
267
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
268
|
* @property {number} [position] - Sort position of the value inside its set; the containing collection is returned sorted by it. Example: 0.
|
|
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.
|
|
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. Read it through `getAdditionalFields`, which collapses that array to an empty map. Optional.
|
|
270
270
|
* @property {boolean} [isIcon] - Block/preview attribute flag — whether the field is treated as an icon. Optional.
|
|
271
271
|
* @property {boolean} [isProductPreview] - Block/preview attribute flag — whether the field is shown in product preview. Optional.
|
|
272
272
|
* @description A single attribute value attached to an entity (admin, user, page, product, …).
|
|
273
|
+
*
|
|
274
|
+
* `value` is `unknown` because its shape is decided by `type` at runtime, which
|
|
275
|
+
* a single interface cannot express. Do not read it by assumption — the type
|
|
276
|
+
* checker cannot catch a wrong guess (an array read on a single file yields
|
|
277
|
+
* `undefined`, silently, with no error anywhere). Reach it through the guards
|
|
278
|
+
* and helpers instead: `isFileAttribute` / `getAttributeFiles`,
|
|
279
|
+
* `isStringAttribute`, `isNumberAttribute`, `isListAttribute`,
|
|
280
|
+
* `isTimeIntervalAttribute`; or annotate with {@link ITypedAttributeValue} to
|
|
281
|
+
* have the compiler enforce the rule.
|
|
273
282
|
*/
|
|
274
283
|
interface IAttributeValue {
|
|
275
284
|
type: string;
|
|
@@ -286,6 +295,90 @@ interface IAttributeValue {
|
|
|
286
295
|
interface IAttributeValues {
|
|
287
296
|
[key: string]: IAttributeValue;
|
|
288
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* @interface IAttributeFile
|
|
300
|
+
* @property {string} filename - Storage-relative path of the file. Example: "files/project/product/2954/image/48853cbf-4462-42c6-8b99-d14f721c21a2.jpeg".
|
|
301
|
+
* @property {string} downloadLink - Public URL of the original file. Example: "https://my-project.oneentry.cloud/cloud-static/files/project/product/2954/image/48853cbf.jpeg".
|
|
302
|
+
* @property {number} size - File size in bytes. Example: 742690.
|
|
303
|
+
* @property {string} contentType - MIME type of the file. Example: "image/jpeg".
|
|
304
|
+
* @property {Record<string, string[]>} [previewLink] - Generated previews keyed by preview template. Each entry is a `[placeholder, url]` pair: the first item is an inline base64 thumbnail (usable as a `blurDataURL`), the second the preview URL. Optional — previews are generated for images; a non-image `file` may arrive without them. Example: { "default": ["data:image/webp;base64,UklGRmwA…", "https://…48853cbf.preview.default.jpeg"] }.
|
|
305
|
+
* @property {string} [defaultPreview] - Key of `previewLink` to use by default. Optional — present alongside `previewLink`. Example: "default".
|
|
306
|
+
* @description One file of an `image`, `file` or `groupOfImages` attribute value. Reach it through {@link IFileAttributeValue} — or, without caring whether the attribute holds one file or many, through `getAttributeFiles`.
|
|
307
|
+
*/
|
|
308
|
+
interface IAttributeFile {
|
|
309
|
+
filename: string;
|
|
310
|
+
downloadLink: string;
|
|
311
|
+
size: number;
|
|
312
|
+
contentType: string;
|
|
313
|
+
previewLink?: Record<string, string[]>;
|
|
314
|
+
defaultPreview?: string;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* @interface IFileAttributeValue
|
|
318
|
+
* @property {'image' | 'file' | 'groupOfImages'} type - Discriminant identifying the attribute as file-bearing.
|
|
319
|
+
* @property {IAttributeFile | IAttributeFile[] | null} value - The file itself when an `image`/`file` attribute holds exactly one, an array when it holds several, always an array for `groupOfImages`, `null` when nothing is set.
|
|
320
|
+
* @description {@link IAttributeValue} narrowed to attributes that carry files, whose generic `value: unknown` resolves to {@link IAttributeFile}. The single/array split is what the SDK's normalization produces, so it has to be handled: narrow with `isFileAttribute`, or skip the branch entirely with `getAttributeFiles` / `getAttributeFile`.
|
|
321
|
+
*/
|
|
322
|
+
interface IFileAttributeValue extends IAttributeValue {
|
|
323
|
+
type: 'image' | 'file' | 'groupOfImages';
|
|
324
|
+
value: IAttributeFile | IAttributeFile[] | null;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* @interface IStringAttributeValue
|
|
328
|
+
* @property {'string' | 'text' | 'textEditor'} type - Discriminant identifying the attribute as text-bearing.
|
|
329
|
+
* @property {string | null} value - The text; `null` when no value is set.
|
|
330
|
+
* @description {@link IAttributeValue} narrowed to text attributes. Narrow to it with `isStringAttribute`.
|
|
331
|
+
*/
|
|
332
|
+
interface IStringAttributeValue extends IAttributeValue {
|
|
333
|
+
type: 'string' | 'text' | 'textEditor';
|
|
334
|
+
value: string | null;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* @interface INumberAttributeValue
|
|
338
|
+
* @property {'integer' | 'float' | 'real'} type - Discriminant identifying the attribute as numeric.
|
|
339
|
+
* @property {number | null} value - The number, cast by the SDK from the API's string form; `null` when no value is set.
|
|
340
|
+
* @description {@link IAttributeValue} narrowed to numeric attributes. Narrow to it with `isNumberAttribute`.
|
|
341
|
+
*/
|
|
342
|
+
interface INumberAttributeValue extends IAttributeValue {
|
|
343
|
+
type: 'integer' | 'float' | 'real';
|
|
344
|
+
value: number | null;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* @interface IListAttributeValue
|
|
348
|
+
* @property {'list'} type - Discriminant identifying the attribute as a list.
|
|
349
|
+
* @property {unknown[]} value - The selected options. The option shape is defined by the attribute set, so the entries stay `unknown` — only the array container is guaranteed.
|
|
350
|
+
* @description {@link IAttributeValue} narrowed to `list` attributes. Narrow to it with `isListAttribute`.
|
|
351
|
+
*/
|
|
352
|
+
interface IListAttributeValue extends IAttributeValue {
|
|
353
|
+
type: 'list';
|
|
354
|
+
value: unknown[];
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* ITypedAttributeValue — {@link IAttributeValue} as a discriminated union over `type`.
|
|
358
|
+
*
|
|
359
|
+
* Opt-in, and deliberately closed: it lists only the types whose `value` shape
|
|
360
|
+
* the SDK guarantees, so `switch (attr.type)` narrows `value` for you. A loose
|
|
361
|
+
* member (`type: string`) would be assignable to every case and collapse the
|
|
362
|
+
* narrowing back to `unknown`, which is exactly what this type exists to avoid.
|
|
363
|
+
*
|
|
364
|
+
* `IAttributeValues` keeps the loose `IAttributeValue`, so nothing existing
|
|
365
|
+
* changes: narrow into this union with the guards (`isFileAttribute` and the
|
|
366
|
+
* rest), or annotate a value you control. Attribute types the SDK does not
|
|
367
|
+
* model (`entity`, `date`, custom ones) stay on `IAttributeValue`.
|
|
368
|
+
* @example
|
|
369
|
+
* ```ts
|
|
370
|
+
* function render(attr: ITypedAttributeValue) {
|
|
371
|
+
* switch (attr.type) {
|
|
372
|
+
* case 'image':
|
|
373
|
+
* case 'file':
|
|
374
|
+
* return attr.value; // IAttributeFile | IAttributeFile[] | null
|
|
375
|
+
* case 'integer':
|
|
376
|
+
* return attr.value; // number | null
|
|
377
|
+
* }
|
|
378
|
+
* }
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
type ITypedAttributeValue = IFileAttributeValue | IStringAttributeValue | INumberAttributeValue | IListAttributeValue | ITimeIntervalAttributeValue;
|
|
289
382
|
/**
|
|
290
383
|
* @interface IRating
|
|
291
384
|
* @property {number} [value] - Average rating value. Example: 4.5.
|
|
@@ -351,4 +444,4 @@ type LangType = string | Array<string>;
|
|
|
351
444
|
* LocalizeType
|
|
352
445
|
*/
|
|
353
446
|
type LocalizeType = ILocalizeInfo;
|
|
354
|
-
export type { IAttributeLocalizeInfo, IAttributes, IAttributeValue, IAttributeValues, IConfig, IError, IHttpHeaders, IHttpOptions, ILocalizeInfo, IRating, ITimeIntervalAttributeValue, ITimeIntervalEntitySchedule, ITimeIntervalGroup, ITimeIntervalPoint, ITimeIntervalRange, ITimeIntervalSchedule, ITimeIntervalWindow, LangType, LocalizeType, TimeIntervalPair, };
|
|
447
|
+
export type { IAttributeFile, IAttributeLocalizeInfo, IAttributes, IAttributeValue, IAttributeValues, IConfig, IError, IFileAttributeValue, IHttpHeaders, IHttpOptions, IListAttributeValue, ILocalizeInfo, INumberAttributeValue, IRating, IStringAttributeValue, ITimeIntervalAttributeValue, ITimeIntervalEntitySchedule, ITimeIntervalGroup, ITimeIntervalPoint, ITimeIntervalRange, ITimeIntervalSchedule, ITimeIntervalWindow, ITypedAttributeValue, LangType, LocalizeType, TimeIntervalPair, };
|
|
@@ -36,6 +36,35 @@ export declare const AttributeSchema: z.ZodObject<{
|
|
|
36
36
|
}, z.core.$strip>>>;
|
|
37
37
|
value: z.ZodOptional<z.ZodAny>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
|
+
/**
|
|
40
|
+
* Attribute file schema
|
|
41
|
+
*
|
|
42
|
+
* One file of an `image`, `file` or `groupOfImages` attribute value, as the API
|
|
43
|
+
* returns it — mirrors `IAttributeFile`. Loose: the API may add fields, and a
|
|
44
|
+
* new one is not a reason to report a broken response.
|
|
45
|
+
*/
|
|
46
|
+
export declare const AttributeFileSchema: z.ZodObject<{
|
|
47
|
+
filename: z.ZodString;
|
|
48
|
+
downloadLink: z.ZodString;
|
|
49
|
+
size: z.ZodNumber;
|
|
50
|
+
contentType: z.ZodString;
|
|
51
|
+
previewLink: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
52
|
+
defaultPreview: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$loose>;
|
|
54
|
+
/**
|
|
55
|
+
* Attribute values schema
|
|
56
|
+
*
|
|
57
|
+
* The container the API returns under `attributeValues`. Both nestings are
|
|
58
|
+
* accepted, since the raw response wraps the marker map in a locale
|
|
59
|
+
* (`{ en_US: { marker: attr } }`) while some endpoints return it flat.
|
|
60
|
+
*
|
|
61
|
+
* Attribute values are open by design — what `value` holds is decided by the
|
|
62
|
+
* project's attribute set — so the schema validates the one part the API fixes
|
|
63
|
+
* and the SDK relies on: the shape of files. If a future API release renames or
|
|
64
|
+
* drops a file field, `getAttributeFiles` would silently return nothing;
|
|
65
|
+
* validation (`config.validation.enabled`) reports it instead.
|
|
66
|
+
*/
|
|
67
|
+
export declare const AttributeValuesSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
39
68
|
/**
|
|
40
69
|
* User entity schema
|
|
41
70
|
*/
|
|
@@ -50,6 +79,7 @@ export declare const UserEntitySchema: z.ZodObject<{
|
|
|
50
79
|
state: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
51
80
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
52
81
|
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
82
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
53
83
|
}, z.core.$strip>;
|
|
54
84
|
/**
|
|
55
85
|
* Auth entity schema
|
package/dist/base/validation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthEntitySchema = exports.UserEntitySchema = exports.AttributeSchema = exports.LocalizeInfoSchema = exports.ErrorSchema = void 0;
|
|
3
|
+
exports.AuthEntitySchema = exports.UserEntitySchema = exports.AttributeValuesSchema = exports.AttributeFileSchema = exports.AttributeSchema = exports.LocalizeInfoSchema = exports.ErrorSchema = void 0;
|
|
4
4
|
exports.createPaginatedSchema = createPaginatedSchema;
|
|
5
5
|
exports.validateResponse = validateResponse;
|
|
6
6
|
exports.validateResponseSafe = validateResponseSafe;
|
|
@@ -39,6 +39,98 @@ exports.AttributeSchema = zod_1.z.object({
|
|
|
39
39
|
localizeInfos: zod_1.z.record(zod_1.z.string(), exports.LocalizeInfoSchema).optional(),
|
|
40
40
|
value: zod_1.z.any().optional(),
|
|
41
41
|
});
|
|
42
|
+
/**
|
|
43
|
+
* Attribute file schema
|
|
44
|
+
*
|
|
45
|
+
* One file of an `image`, `file` or `groupOfImages` attribute value, as the API
|
|
46
|
+
* returns it — mirrors `IAttributeFile`. Loose: the API may add fields, and a
|
|
47
|
+
* new one is not a reason to report a broken response.
|
|
48
|
+
*/
|
|
49
|
+
exports.AttributeFileSchema = zod_1.z.looseObject({
|
|
50
|
+
filename: zod_1.z.string(),
|
|
51
|
+
downloadLink: zod_1.z.string(),
|
|
52
|
+
size: zod_1.z.number(),
|
|
53
|
+
contentType: zod_1.z.string(),
|
|
54
|
+
previewLink: zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string())).optional(),
|
|
55
|
+
defaultPreview: zod_1.z.string().optional(),
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Attribute types whose value carries files.
|
|
59
|
+
*/
|
|
60
|
+
const FILE_ATTRIBUTE_TYPES = ['image', 'file', 'groupOfImages'];
|
|
61
|
+
/**
|
|
62
|
+
* Reports whether a value is the empty localization map the API sends for an
|
|
63
|
+
* attribute with no value set.
|
|
64
|
+
* @param {unknown} value - The value to test.
|
|
65
|
+
* @returns {boolean} True when the value carries nothing.
|
|
66
|
+
*/
|
|
67
|
+
function isEmptyValue(value) {
|
|
68
|
+
if (value === null || value === undefined)
|
|
69
|
+
return true;
|
|
70
|
+
return (typeof value === 'object' &&
|
|
71
|
+
!Array.isArray(value) &&
|
|
72
|
+
Object.keys(value).length === 0);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Validates the files of one attribute value, recursing into nested fields.
|
|
76
|
+
*
|
|
77
|
+
* Only file-bearing attributes are inspected. Everything else is left alone:
|
|
78
|
+
* the shape of `value` is defined per attribute type by the project's own
|
|
79
|
+
* attribute set, so a schema cannot describe it — but the file shape is fixed
|
|
80
|
+
* by the API, and the SDK's own helpers (`getAttributeFiles`) depend on it.
|
|
81
|
+
* @param {unknown} node - An attribute value, or a container of them.
|
|
82
|
+
* @param {string[]} path - Path to the node, for issue reporting.
|
|
83
|
+
* @param {z.RefinementCtx} ctx - Zod refinement context issues are added to.
|
|
84
|
+
*/
|
|
85
|
+
function validateAttributeFiles(node, path, ctx) {
|
|
86
|
+
if (!node || typeof node !== 'object')
|
|
87
|
+
return;
|
|
88
|
+
if (Array.isArray(node)) {
|
|
89
|
+
node.forEach((item, index) => validateAttributeFiles(item, [...path, String(index)], ctx));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const attr = node;
|
|
93
|
+
const isAttribute = typeof attr.type === 'string' && 'value' in attr;
|
|
94
|
+
if (isAttribute && FILE_ATTRIBUTE_TYPES.includes(attr.type)) {
|
|
95
|
+
if (!isEmptyValue(attr.value)) {
|
|
96
|
+
// The API always sends files as an array; the SDK unwraps a single one
|
|
97
|
+
// afterwards, so both shapes are accepted here.
|
|
98
|
+
const files = Array.isArray(attr.value) ? attr.value : [attr.value];
|
|
99
|
+
files.forEach((file, index) => {
|
|
100
|
+
const result = exports.AttributeFileSchema.safeParse(file);
|
|
101
|
+
if (result.success)
|
|
102
|
+
return;
|
|
103
|
+
result.error.issues.forEach((issue) => ctx.addIssue({
|
|
104
|
+
code: 'custom',
|
|
105
|
+
path: [...path, 'value', index, ...issue.path],
|
|
106
|
+
message: `Attribute of type "${attr.type}" carries an unexpected file shape: ${issue.message}`,
|
|
107
|
+
}));
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Nested fields carry attribute values of their own, files included.
|
|
112
|
+
if (isAttribute) {
|
|
113
|
+
validateAttributeFiles(attr.additionalFields, [...path, 'additionalFields'], ctx);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
Object.entries(attr).forEach(([key, value]) => validateAttributeFiles(value, [...path, key], ctx));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Attribute values schema
|
|
120
|
+
*
|
|
121
|
+
* The container the API returns under `attributeValues`. Both nestings are
|
|
122
|
+
* accepted, since the raw response wraps the marker map in a locale
|
|
123
|
+
* (`{ en_US: { marker: attr } }`) while some endpoints return it flat.
|
|
124
|
+
*
|
|
125
|
+
* Attribute values are open by design — what `value` holds is decided by the
|
|
126
|
+
* project's attribute set — so the schema validates the one part the API fixes
|
|
127
|
+
* and the SDK relies on: the shape of files. If a future API release renames or
|
|
128
|
+
* drops a file field, `getAttributeFiles` would silently return nothing;
|
|
129
|
+
* validation (`config.validation.enabled`) reports it instead.
|
|
130
|
+
*/
|
|
131
|
+
exports.AttributeValuesSchema = zod_1.z
|
|
132
|
+
.record(zod_1.z.string(), zod_1.z.unknown())
|
|
133
|
+
.superRefine((values, ctx) => validateAttributeFiles(values, [], ctx));
|
|
42
134
|
/**
|
|
43
135
|
* User entity schema
|
|
44
136
|
*/
|
|
@@ -53,6 +145,7 @@ exports.UserEntitySchema = zod_1.z.object({
|
|
|
53
145
|
state: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
54
146
|
moduleFormConfigs: zod_1.z.array(zod_1.z.any()).optional(),
|
|
55
147
|
rating: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
148
|
+
distance: zod_1.z.number().optional(),
|
|
56
149
|
});
|
|
57
150
|
/**
|
|
58
151
|
* Auth entity schema
|
|
@@ -96,11 +96,12 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
96
96
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
97
97
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
98
98
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
99
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
99
100
|
* @returns {Promise<IProductsResponse | IError>} Returns a products response with items and total.
|
|
100
101
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
101
102
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getFrequentlyOrderedProducts getFrequentlyOrderedProducts} documentation.
|
|
102
103
|
*/
|
|
103
|
-
getFrequentlyOrderedProducts(productId: number, marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
104
|
+
getFrequentlyOrderedProducts(productId: number, marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
104
105
|
/**
|
|
105
106
|
* Quick search for block objects with limited output.
|
|
106
107
|
* @handleName searchBlock
|
|
@@ -118,11 +119,12 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
118
119
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
119
120
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
120
121
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
122
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
121
123
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
122
124
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
123
125
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplement getCartComplement} documentation.
|
|
124
126
|
*/
|
|
125
|
-
getCartComplement(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
127
|
+
getCartComplement(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
126
128
|
/**
|
|
127
129
|
* Get "complete your cart" products by an explicit list of productIds (POST body).
|
|
128
130
|
* @handleName getCartComplementByProductIds
|
|
@@ -145,11 +147,12 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
145
147
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
146
148
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
147
149
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
150
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
148
151
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
149
152
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
150
153
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilar getCartSimilar} documentation.
|
|
151
154
|
*/
|
|
152
|
-
getCartSimilar(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
155
|
+
getCartSimilar(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
153
156
|
/**
|
|
154
157
|
* Get "similar to cart" products by an explicit list of productIds (POST body).
|
|
155
158
|
* @handleName getCartSimilarByProductIds
|
|
@@ -172,11 +175,12 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
172
175
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
173
176
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
174
177
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
178
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
175
179
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
176
180
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
177
181
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getPersonalRecommendations getPersonalRecommendations} documentation.
|
|
178
182
|
*/
|
|
179
|
-
getPersonalRecommendations(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
183
|
+
getPersonalRecommendations(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
180
184
|
/**
|
|
181
185
|
* Get recently viewed products.
|
|
182
186
|
* @handleName getRecentlyViewed
|
|
@@ -184,11 +188,12 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
184
188
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
185
189
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
186
190
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
191
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
187
192
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
188
193
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
189
194
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRecentlyViewed getRecentlyViewed} documentation.
|
|
190
195
|
*/
|
|
191
|
-
getRecentlyViewed(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
196
|
+
getRecentlyViewed(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
192
197
|
/**
|
|
193
198
|
* Get products for repeat purchase.
|
|
194
199
|
* @handleName getRepeatPurchase
|
|
@@ -196,11 +201,12 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
196
201
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
197
202
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
198
203
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
204
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
199
205
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
200
206
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
201
207
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRepeatPurchase getRepeatPurchase} documentation.
|
|
202
208
|
*/
|
|
203
|
-
getRepeatPurchase(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
209
|
+
getRepeatPurchase(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
204
210
|
/**
|
|
205
211
|
* Get the block's slides tree as a flat pre-order array (slider_block only).
|
|
206
212
|
* @handleName getSlides
|
|
@@ -217,11 +223,12 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
217
223
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
218
224
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
219
225
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
226
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
220
227
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
221
228
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
222
229
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getTrending getTrending} documentation.
|
|
223
230
|
*/
|
|
224
|
-
getTrending(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
231
|
+
getTrending(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
225
232
|
/**
|
|
226
233
|
* Get "similar to wishlist" products by the wishlist from context (auth user or guest).
|
|
227
234
|
* @handleName getWishlistSimilar
|
|
@@ -229,11 +236,12 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
229
236
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
230
237
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
231
238
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
239
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
232
240
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
233
241
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
234
242
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilar getWishlistSimilar} documentation.
|
|
235
243
|
*/
|
|
236
|
-
getWishlistSimilar(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
244
|
+
getWishlistSimilar(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
237
245
|
/**
|
|
238
246
|
* Get "similar to wishlist" products by an explicit list of productIds (POST body).
|
|
239
247
|
* @handleName getWishlistSimilarByProductIds
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -223,14 +223,16 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
223
223
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
224
224
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
225
225
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
226
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
226
227
|
* @returns {Promise<IProductsResponse | IError>} Returns a products response with items and total.
|
|
227
228
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
228
229
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getFrequentlyOrderedProducts getFrequentlyOrderedProducts} documentation.
|
|
229
230
|
*/
|
|
230
|
-
async getFrequentlyOrderedProducts(productId, marker, langCode = this.state.lang, signPrice) {
|
|
231
|
+
async getFrequentlyOrderedProducts(productId, marker, langCode = this.state.lang, signPrice, limit) {
|
|
231
232
|
const query = {
|
|
232
233
|
langCode,
|
|
233
234
|
signPrice,
|
|
235
|
+
limit,
|
|
234
236
|
};
|
|
235
237
|
const data = await this._fetchGet(`/${marker}/products/${productId}/frequently-ordered?` +
|
|
236
238
|
this._queryParamsToString(query));
|
|
@@ -258,12 +260,13 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
258
260
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
259
261
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
260
262
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
263
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
261
264
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
262
265
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
263
266
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplement getCartComplement} documentation.
|
|
264
267
|
*/
|
|
265
|
-
async getCartComplement(marker, langCode = this.state.lang, signPrice) {
|
|
266
|
-
const query = { langCode, signPrice };
|
|
268
|
+
async getCartComplement(marker, langCode = this.state.lang, signPrice, limit) {
|
|
269
|
+
const query = { langCode, signPrice, limit };
|
|
267
270
|
const data = await this._fetchGet(`/${marker}/cart-complement?` + this._queryParamsToString(query));
|
|
268
271
|
return this._normalizeData(data);
|
|
269
272
|
}
|
|
@@ -292,12 +295,13 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
292
295
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
293
296
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
294
297
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
298
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
295
299
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
296
300
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
297
301
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilar getCartSimilar} documentation.
|
|
298
302
|
*/
|
|
299
|
-
async getCartSimilar(marker, langCode = this.state.lang, signPrice) {
|
|
300
|
-
const query = { langCode, signPrice };
|
|
303
|
+
async getCartSimilar(marker, langCode = this.state.lang, signPrice, limit) {
|
|
304
|
+
const query = { langCode, signPrice, limit };
|
|
301
305
|
const data = await this._fetchGet(`/${marker}/cart-similar?` + this._queryParamsToString(query));
|
|
302
306
|
return this._normalizeData(data);
|
|
303
307
|
}
|
|
@@ -326,12 +330,13 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
326
330
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
327
331
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
328
332
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
333
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
329
334
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
330
335
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
331
336
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getPersonalRecommendations getPersonalRecommendations} documentation.
|
|
332
337
|
*/
|
|
333
|
-
async getPersonalRecommendations(marker, langCode = this.state.lang, signPrice) {
|
|
334
|
-
const query = { langCode, signPrice };
|
|
338
|
+
async getPersonalRecommendations(marker, langCode = this.state.lang, signPrice, limit) {
|
|
339
|
+
const query = { langCode, signPrice, limit };
|
|
335
340
|
const data = await this._fetchGet(`/${marker}/personal-recommendations?` + this._queryParamsToString(query));
|
|
336
341
|
return this._normalizeData(data);
|
|
337
342
|
}
|
|
@@ -342,12 +347,13 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
342
347
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
343
348
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
344
349
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
350
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
345
351
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
346
352
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
347
353
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRecentlyViewed getRecentlyViewed} documentation.
|
|
348
354
|
*/
|
|
349
|
-
async getRecentlyViewed(marker, langCode = this.state.lang, signPrice) {
|
|
350
|
-
const query = { langCode, signPrice };
|
|
355
|
+
async getRecentlyViewed(marker, langCode = this.state.lang, signPrice, limit) {
|
|
356
|
+
const query = { langCode, signPrice, limit };
|
|
351
357
|
const data = await this._fetchGet(`/${marker}/recently-viewed?` + this._queryParamsToString(query));
|
|
352
358
|
return this._normalizeData(data);
|
|
353
359
|
}
|
|
@@ -358,12 +364,13 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
358
364
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
359
365
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
360
366
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
367
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
361
368
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
362
369
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
363
370
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRepeatPurchase getRepeatPurchase} documentation.
|
|
364
371
|
*/
|
|
365
|
-
async getRepeatPurchase(marker, langCode = this.state.lang, signPrice) {
|
|
366
|
-
const query = { langCode, signPrice };
|
|
372
|
+
async getRepeatPurchase(marker, langCode = this.state.lang, signPrice, limit) {
|
|
373
|
+
const query = { langCode, signPrice, limit };
|
|
367
374
|
const data = await this._fetchGet(`/${marker}/repeat-purchase?` + this._queryParamsToString(query));
|
|
368
375
|
return this._normalizeData(data);
|
|
369
376
|
}
|
|
@@ -386,12 +393,13 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
386
393
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
387
394
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
388
395
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
396
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
389
397
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
390
398
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
391
399
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getTrending getTrending} documentation.
|
|
392
400
|
*/
|
|
393
|
-
async getTrending(marker, langCode = this.state.lang, signPrice) {
|
|
394
|
-
const query = { langCode, signPrice };
|
|
401
|
+
async getTrending(marker, langCode = this.state.lang, signPrice, limit) {
|
|
402
|
+
const query = { langCode, signPrice, limit };
|
|
395
403
|
const data = await this._fetchGet(`/${marker}/trending?` + this._queryParamsToString(query));
|
|
396
404
|
return this._normalizeData(data);
|
|
397
405
|
}
|
|
@@ -402,12 +410,13 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
402
410
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
403
411
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
404
412
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
413
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
405
414
|
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of products, total count and totalFound.
|
|
406
415
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
407
416
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilar getWishlistSimilar} documentation.
|
|
408
417
|
*/
|
|
409
|
-
async getWishlistSimilar(marker, langCode = this.state.lang, signPrice) {
|
|
410
|
-
const query = { langCode, signPrice };
|
|
418
|
+
async getWishlistSimilar(marker, langCode = this.state.lang, signPrice, limit) {
|
|
419
|
+
const query = { langCode, signPrice, limit };
|
|
411
420
|
const data = await this._fetchGet(`/${marker}/wishlist-similar?` + this._queryParamsToString(query));
|
|
412
421
|
return this._normalizeData(data);
|
|
413
422
|
}
|
|
@@ -29,7 +29,7 @@ interface IBlocks {
|
|
|
29
29
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
30
30
|
* @description This method retrieves a block object by its marker.
|
|
31
31
|
*/
|
|
32
|
-
getBlockByMarker(marker: string, langCode
|
|
32
|
+
getBlockByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IBlockEntity | IError>;
|
|
33
33
|
/**
|
|
34
34
|
* Performs a quick search for block objects with limited output.
|
|
35
35
|
* @handleName searchBlock
|
|
@@ -48,10 +48,11 @@ interface IBlocks {
|
|
|
48
48
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
49
49
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
50
50
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
51
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
51
52
|
* @returns {IProductsResponse} A promise that resolves to a products response (items + total) or an error.
|
|
52
53
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
53
54
|
*/
|
|
54
|
-
getFrequentlyOrderedProducts(productId: number, marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
55
|
+
getFrequentlyOrderedProducts(productId: number, marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
55
56
|
/**
|
|
56
57
|
* Get "complete your cart" products by the cart from context (auth user or guest).
|
|
57
58
|
* @handleName getCartComplement
|
|
@@ -59,10 +60,11 @@ interface IBlocks {
|
|
|
59
60
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
60
61
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
61
62
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
63
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
62
64
|
* @returns {IProductsResponse} A promise that resolves to a products response (items + total + totalFound) or an error.
|
|
63
65
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
64
66
|
*/
|
|
65
|
-
getCartComplement(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
67
|
+
getCartComplement(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
66
68
|
/**
|
|
67
69
|
* Get "complete your cart" products by an explicit list of productIds (POST body).
|
|
68
70
|
* @handleName getCartComplementByProductIds
|
|
@@ -84,10 +86,11 @@ interface IBlocks {
|
|
|
84
86
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
85
87
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
86
88
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
89
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
87
90
|
* @returns {IProductsResponse} A promise that resolves to a products response (items + total + totalFound) or an error.
|
|
88
91
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
89
92
|
*/
|
|
90
|
-
getCartSimilar(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
93
|
+
getCartSimilar(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
91
94
|
/**
|
|
92
95
|
* Get "similar to cart" products by an explicit list of productIds (POST body).
|
|
93
96
|
* @handleName getCartSimilarByProductIds
|
|
@@ -109,10 +112,11 @@ interface IBlocks {
|
|
|
109
112
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
110
113
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
111
114
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
115
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
112
116
|
* @returns {IProductsResponse} A promise that resolves to a products response (items + total + totalFound) or an error.
|
|
113
117
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
114
118
|
*/
|
|
115
|
-
getPersonalRecommendations(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
119
|
+
getPersonalRecommendations(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
116
120
|
/**
|
|
117
121
|
* Get recently viewed products.
|
|
118
122
|
* @handleName getRecentlyViewed
|
|
@@ -120,10 +124,11 @@ interface IBlocks {
|
|
|
120
124
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
121
125
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
122
126
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
127
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
123
128
|
* @returns {IProductsResponse} A promise that resolves to a products response (items + total + totalFound) or an error.
|
|
124
129
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
125
130
|
*/
|
|
126
|
-
getRecentlyViewed(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
131
|
+
getRecentlyViewed(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
127
132
|
/**
|
|
128
133
|
* Get products for repeat purchase.
|
|
129
134
|
* @handleName getRepeatPurchase
|
|
@@ -131,10 +136,11 @@ interface IBlocks {
|
|
|
131
136
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
132
137
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
133
138
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
139
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
134
140
|
* @returns {IProductsResponse} A promise that resolves to a products response (items + total + totalFound) or an error.
|
|
135
141
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
136
142
|
*/
|
|
137
|
-
getRepeatPurchase(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
143
|
+
getRepeatPurchase(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
138
144
|
/**
|
|
139
145
|
* Get the block's slides tree as a flat pre-order array (slider_block only).
|
|
140
146
|
* @handleName getSlides
|
|
@@ -150,10 +156,11 @@ interface IBlocks {
|
|
|
150
156
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
151
157
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
152
158
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
159
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
153
160
|
* @returns {IProductsResponse} A promise that resolves to a products response (items + total + totalFound) or an error.
|
|
154
161
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
155
162
|
*/
|
|
156
|
-
getTrending(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
163
|
+
getTrending(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
157
164
|
/**
|
|
158
165
|
* Get "similar to wishlist" products by the wishlist from context (auth user or guest).
|
|
159
166
|
* @handleName getWishlistSimilar
|
|
@@ -161,10 +168,11 @@ interface IBlocks {
|
|
|
161
168
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
162
169
|
* @param {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
|
|
163
170
|
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
171
|
+
* @param {number} [limit] - Maximum number of products to return. When omitted, the block's own quantity setting applies. Example: 10.
|
|
164
172
|
* @returns {IProductsResponse} A promise that resolves to a products response (items + total + totalFound) or an error.
|
|
165
173
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
166
174
|
*/
|
|
167
|
-
getWishlistSimilar(marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
|
|
175
|
+
getWishlistSimilar(marker: string, langCode?: string, signPrice?: string, limit?: number): Promise<IProductsResponse | IError>;
|
|
168
176
|
/**
|
|
169
177
|
* Get "similar to wishlist" products by an explicit list of productIds (POST body).
|
|
170
178
|
* @handleName getWishlistSimilarByProductIds
|