oneentry 1.0.157 → 1.0.159
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 +20 -0
- package/changelog.md +89 -0
- package/dist/admins/adminsApi.js +36 -2
- package/dist/attribute-sets/attributeSetsApi.d.ts +2 -2
- package/dist/attribute-sets/attributeSetsApi.js +40 -6
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +19 -7
- package/dist/auth-provider/authProviderApi.js +38 -4
- package/dist/base/asyncModules.d.ts +6 -4
- package/dist/base/asyncModules.js +44 -8
- package/dist/base/syncModules.d.ts +2 -1
- package/dist/base/syncModules.js +10 -1
- package/dist/base/timeIntervals.js +6 -5
- package/dist/base/utils.d.ts +12 -8
- package/dist/blocks/blocksApi.d.ts +21 -21
- package/dist/blocks/blocksApi.js +48 -14
- 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/file-uploading/fileUploadingApi.js +36 -2
- package/dist/filters/filtersApi.js +36 -2
- package/dist/forms/formsApi.js +37 -3
- package/dist/forms/formsInterfaces.d.ts +22 -20
- package/dist/forms-data/formsDataApi.js +38 -4
- package/dist/general-types/generalTypesApi.js +36 -2
- package/dist/index.d.ts +2 -2
- package/dist/integration-collections/integrationCollectionsApi.js +43 -9
- package/dist/locales/localesApi.js +36 -2
- package/dist/menus/menusApi.js +36 -2
- package/dist/orders/ordersApi.js +39 -5
- package/dist/orders/ordersInterfaces.d.ts +11 -3
- package/dist/pages/pagesApi.js +42 -8
- package/dist/payments/paymentsApi.js +39 -5
- package/dist/product-statuses/productStatusesApi.js +38 -4
- package/dist/products/productsApi.d.ts +2 -2
- package/dist/products/productsApi.js +42 -8
- package/dist/products/productsInterfaces.d.ts +23 -15
- package/dist/products/productsSchemas.d.ts +1 -0
- package/dist/products/productsSchemas.js +1 -0
- package/dist/subscriptions/subscriptionsApi.js +38 -4
- package/dist/templates/templatesApi.js +38 -4
- package/dist/templates-preview/templatesPreviewApi.js +37 -3
- package/dist/users/usersApi.js +45 -11
- package/dist/web-socket/wsApi.d.ts +2 -0
- package/dist/web-socket/wsApi.js +47 -10
- package/package.json +6 -1
package/dist/menus/menusApi.js
CHANGED
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
|
-
const
|
|
40
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
41
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./menusSchemas'))));
|
|
8
42
|
/**
|
|
9
43
|
* Controllers for working with menu objects
|
|
10
44
|
* @handle /api/content/menus
|
|
@@ -33,7 +67,7 @@ class MenusApi extends asyncModules_1.default {
|
|
|
33
67
|
async getMenusByMarker(marker, langCode = this.state.lang) {
|
|
34
68
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
35
69
|
// Validate response if validation is enabled
|
|
36
|
-
const validated = this._validateResponse(result,
|
|
70
|
+
const validated = await this._validateResponse(result, schema('MenuEntitySchema'));
|
|
37
71
|
return this._normalizeData(validated, langCode);
|
|
38
72
|
}
|
|
39
73
|
}
|
package/dist/orders/ordersApi.js
CHANGED
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
|
-
const
|
|
40
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
41
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./ordersSchemas'))));
|
|
8
42
|
/**
|
|
9
43
|
* Controllers for working with orders.
|
|
10
44
|
* @handle /api/content/orders-storage
|
|
@@ -54,7 +88,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
54
88
|
async getAllOrdersByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
55
89
|
const result = await this._fetchGet(`/marker/${marker}/orders?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
56
90
|
// Validate response if validation is enabled
|
|
57
|
-
const validated = this._validateResponse(result,
|
|
91
|
+
const validated = await this._validateResponse(result, schema('OrdersResponseSchema'));
|
|
58
92
|
return this._normalizeData(validated);
|
|
59
93
|
}
|
|
60
94
|
/**
|
|
@@ -87,7 +121,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
87
121
|
async getOrderByMarkerAndId(marker, id, langCode = this.state.lang) {
|
|
88
122
|
const result = await this._fetchGet(`/marker/${marker}/orders/${id}?langCode=${langCode}`);
|
|
89
123
|
// Validate response if validation is enabled
|
|
90
|
-
const validated = this._validateResponse(result,
|
|
124
|
+
const validated = await this._validateResponse(result, schema('OrderEntitySchema'));
|
|
91
125
|
return this._normalizeData(validated);
|
|
92
126
|
}
|
|
93
127
|
/**
|
|
@@ -142,7 +176,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
142
176
|
body.formData = formData;
|
|
143
177
|
const result = await this._fetchPost(`/marker/${marker}/orders`, body);
|
|
144
178
|
// Validate response if validation is enabled
|
|
145
|
-
const validated = this._validateResponse(result,
|
|
179
|
+
const validated = await this._validateResponse(result, schema('CreateOrderResponseSchema'));
|
|
146
180
|
return this._normalizeData(validated);
|
|
147
181
|
}
|
|
148
182
|
/**
|
|
@@ -184,7 +218,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
184
218
|
body.formData = formData;
|
|
185
219
|
const result = await this._fetchPut(`/marker/${marker}/orders/${id}?langCode=${langCode}`, body);
|
|
186
220
|
// Validate response if validation is enabled
|
|
187
|
-
const validated = this._validateResponse(result,
|
|
221
|
+
const validated = await this._validateResponse(result, schema('UpdateOrderResponseSchema'));
|
|
188
222
|
return this._normalizeData(validated);
|
|
189
223
|
}
|
|
190
224
|
/**
|
|
@@ -314,7 +314,7 @@ interface IOrderProductsData {
|
|
|
314
314
|
}
|
|
315
315
|
]
|
|
316
316
|
* @property {string} currency - Currency used to pay for the order. Example: "USD".
|
|
317
|
-
* @property {
|
|
317
|
+
* @property {number} totalSum - Total order amount. Example: 150.
|
|
318
318
|
* @property {string} [createdDate] - Order creation date. Example: "2023-10-01T12:00:00Z".
|
|
319
319
|
* @property {string} [statusIdentifier] - Text identifier of order status object (if not set, default status will be assigned). Example: "status-1".
|
|
320
320
|
* @property {ILocalizeInfo} [statusLocalizeInfos] - Localized status name assigned to the created/updated order.
|
|
@@ -332,7 +332,7 @@ interface IBaseOrdersEntity {
|
|
|
332
332
|
formData: IOrdersFormData[];
|
|
333
333
|
products: IOrderProductsData[];
|
|
334
334
|
currency: string;
|
|
335
|
-
totalSum:
|
|
335
|
+
totalSum: number;
|
|
336
336
|
createdDate?: string;
|
|
337
337
|
statusIdentifier?: string;
|
|
338
338
|
statusLocalizeInfos?: ILocalizeInfo;
|
|
@@ -608,10 +608,14 @@ interface IOrderByMarkerEntity {
|
|
|
608
608
|
* @interface IOrderStatus
|
|
609
609
|
* @property {number} [id] - Status identifier. Example: 1.
|
|
610
610
|
* @property {ILocalizeInfo} [localizeInfos] - Localized information for the status.
|
|
611
|
-
* @property {string} [identifier] - Text identifier of the status. Example: "inProgress".
|
|
611
|
+
* @property {string} [identifier] - Text identifier of the status. Example: "inProgress-payment".
|
|
612
612
|
* @property {number} [position] - Position of the status. Example: 1.
|
|
613
613
|
* @property {boolean} [isUsed] - Whether the status is in use. Example: true.
|
|
614
614
|
* @property {boolean} [isDefault] - Whether the status is the default status. Example: true.
|
|
615
|
+
* @property {string} [axis] - Status axis (pipeline) the status belongs to. Example: "payment".
|
|
616
|
+
* @property {boolean} [isCancelFinal] - Whether the status is a final cancellation status. Example: false.
|
|
617
|
+
* @property {boolean} [isFinalSuccess] - Whether the status is a final successful status. Example: true.
|
|
618
|
+
* @property {boolean} [isMapped] - Whether the status is mapped to its axis. Example: true.
|
|
615
619
|
*/
|
|
616
620
|
interface IOrderStatus {
|
|
617
621
|
id?: number;
|
|
@@ -620,6 +624,10 @@ interface IOrderStatus {
|
|
|
620
624
|
position?: number;
|
|
621
625
|
isUsed?: boolean;
|
|
622
626
|
isDefault?: boolean;
|
|
627
|
+
axis?: string;
|
|
628
|
+
isCancelFinal?: boolean;
|
|
629
|
+
isFinalSuccess?: boolean;
|
|
630
|
+
isMapped?: boolean;
|
|
623
631
|
}
|
|
624
632
|
/**
|
|
625
633
|
* Interface representing a product in an order preview.
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
@@ -6,8 +39,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
39
|
/* eslint-disable jsdoc/reject-any-type */
|
|
7
40
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
41
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
42
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
9
43
|
const templatesApi_1 = __importDefault(require("../templates/templatesApi"));
|
|
10
|
-
const
|
|
44
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./pagesSchemas'))));
|
|
11
45
|
/**
|
|
12
46
|
* Controllers for working with page objects, including catalog pages
|
|
13
47
|
* @handle /api/content/pages
|
|
@@ -36,7 +70,7 @@ class PagesApi extends asyncModules_1.default {
|
|
|
36
70
|
// Fetch data from the server using a GET request to retrieve root pages for the specified language code
|
|
37
71
|
const data = await this._fetchGet(`/root?langCode=${langCode}`);
|
|
38
72
|
// Validate response if validation is enabled
|
|
39
|
-
const validated = this._validateResponse(data,
|
|
73
|
+
const validated = await this._validateResponse(data, schema('PagesResponseSchema'));
|
|
40
74
|
// Add template information to each page in the fetched root pages data
|
|
41
75
|
const withTemplate = await this.addTemplateToPages(validated);
|
|
42
76
|
// Normalize the data and return it; ensures consistent structure or handles errors
|
|
@@ -55,7 +89,7 @@ class PagesApi extends asyncModules_1.default {
|
|
|
55
89
|
// Fetch data from the server using a GET request to retrieve all pages for the specified language code
|
|
56
90
|
const data = await this._fetchGet(`?langCode=${langCode}`);
|
|
57
91
|
// Validate response if validation is enabled
|
|
58
|
-
const validated = this._validateResponse(data,
|
|
92
|
+
const validated = await this._validateResponse(data, schema('PagesResponseSchema'));
|
|
59
93
|
// Add template information to each page in the fetched data
|
|
60
94
|
const withTemplate = await this.addTemplateToPages(validated);
|
|
61
95
|
// Normalize the data and return it; ensures consistent structure or handles errors
|
|
@@ -75,7 +109,7 @@ class PagesApi extends asyncModules_1.default {
|
|
|
75
109
|
// Fetch data from the server using a GET request to retrieve page details by ID and language code
|
|
76
110
|
const data = await this._fetchGet(`/${id}?langCode=${langCode}`);
|
|
77
111
|
// Validate response if validation is enabled
|
|
78
|
-
const validated = this._validateResponse(data,
|
|
112
|
+
const validated = await this._validateResponse(data, schema('PageEntitySchema'));
|
|
79
113
|
// Add template information to the fetched page data
|
|
80
114
|
const withTemplate = await this.addTemplateToPage(validated);
|
|
81
115
|
// Normalize the data and return it; ensures consistent structure or handles errors
|
|
@@ -95,7 +129,7 @@ class PagesApi extends asyncModules_1.default {
|
|
|
95
129
|
// Fetch data from the server using a GET request with the specified URL and language code
|
|
96
130
|
const data = await this._fetchGet(`/url/${url}?langCode=${langCode}`);
|
|
97
131
|
// Validate response if validation is enabled
|
|
98
|
-
const validated = this._validateResponse(data,
|
|
132
|
+
const validated = await this._validateResponse(data, schema('PageEntitySchema'));
|
|
99
133
|
// Add template information to the fetched page data
|
|
100
134
|
const withTemplate = await this.addTemplateToPage(validated);
|
|
101
135
|
// Normalize the result data and return it; ensures consistent structure or handles errors
|
|
@@ -115,7 +149,7 @@ class PagesApi extends asyncModules_1.default {
|
|
|
115
149
|
// Fetch data from the server using a GET request to retrieve child pages for the specified parent URL and language code
|
|
116
150
|
const data = await this._fetchGet(`/${url}/children?langCode=${langCode}`);
|
|
117
151
|
// Validate response if validation is enabled
|
|
118
|
-
const validated = this._validateResponse(data,
|
|
152
|
+
const validated = await this._validateResponse(data, schema('PagesResponseSchema'));
|
|
119
153
|
// Add template information to each of the fetched child pages
|
|
120
154
|
const withTemplate = await this.addTemplateToPages(validated);
|
|
121
155
|
// Normalize the result data and return it; ensures consistent structure or handles errors
|
|
@@ -191,7 +225,7 @@ class PagesApi extends asyncModules_1.default {
|
|
|
191
225
|
// Fetch data from the server using a GET request to retrieve forms for the specified page URL and language code
|
|
192
226
|
const result = await this._fetchGet(`/${url}/config`);
|
|
193
227
|
// Validate response if validation is enabled
|
|
194
|
-
const validated = this._validateResponse(result,
|
|
228
|
+
const validated = await this._validateResponse(result, schema('PageConfigSchema'));
|
|
195
229
|
// return fetched data
|
|
196
230
|
return validated;
|
|
197
231
|
}
|
|
@@ -212,7 +246,7 @@ class PagesApi extends asyncModules_1.default {
|
|
|
212
246
|
const searchPages = await this._fetchGet(`/quick/search?${urlPart}lang=${encodeURIComponent(langCode)}&name=${encodeURIComponent(name)}`);
|
|
213
247
|
// /quick/search?url=catalog&langCode=en_US&name=cat
|
|
214
248
|
// Validate response if validation is enabled
|
|
215
|
-
const data = this._validateResponse(searchPages,
|
|
249
|
+
const data = (await this._validateResponse(searchPages, schema('PageSearchResponseSchema')));
|
|
216
250
|
// Check if there is no traffic limit set in the state
|
|
217
251
|
if (!this.state.traficLimit && Array.isArray(data)) {
|
|
218
252
|
// Initialize an empty array to store detailed page information
|
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
|
-
const
|
|
40
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
41
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./paymentsSchemas'))));
|
|
8
42
|
/**
|
|
9
43
|
* Controllers for working with payments
|
|
10
44
|
* @handle /api/content/payments
|
|
@@ -38,7 +72,7 @@ class PaymentsApi extends asyncModules_1.default {
|
|
|
38
72
|
};
|
|
39
73
|
const result = await this._fetchGet('/sessions/?' + this._queryParamsToString(query));
|
|
40
74
|
// Validate response if validation is enabled
|
|
41
|
-
const validated = this._validateResponse(result,
|
|
75
|
+
const validated = await this._validateResponse(result, schema('PaymentSessionsResponseSchema'));
|
|
42
76
|
return validated;
|
|
43
77
|
}
|
|
44
78
|
/**
|
|
@@ -68,7 +102,7 @@ class PaymentsApi extends asyncModules_1.default {
|
|
|
68
102
|
async getSessionByOrderId(id) {
|
|
69
103
|
const result = await this._fetchGet(`/sessions/order/${id}`);
|
|
70
104
|
// Validate response if validation is enabled
|
|
71
|
-
const validated = this._validateResponse(result,
|
|
105
|
+
const validated = await this._validateResponse(result, schema('SinglePaymentSessionSchema'));
|
|
72
106
|
return validated;
|
|
73
107
|
}
|
|
74
108
|
/**
|
|
@@ -90,7 +124,7 @@ class PaymentsApi extends asyncModules_1.default {
|
|
|
90
124
|
automaticTaxEnabled,
|
|
91
125
|
});
|
|
92
126
|
// Validate response if validation is enabled
|
|
93
|
-
const validated = this._validateResponse(result,
|
|
127
|
+
const validated = await this._validateResponse(result, schema('PaymentSessionSchema'));
|
|
94
128
|
return validated;
|
|
95
129
|
}
|
|
96
130
|
/**
|
|
@@ -105,7 +139,7 @@ class PaymentsApi extends asyncModules_1.default {
|
|
|
105
139
|
async getAccounts() {
|
|
106
140
|
const result = await this._fetchGet('/accounts');
|
|
107
141
|
// Validate response if validation is enabled
|
|
108
|
-
const validated = this._validateResponse(result,
|
|
142
|
+
const validated = await this._validateResponse(result, schema('PaymentAccountsResponseSchema'));
|
|
109
143
|
return this._normalizeData(validated);
|
|
110
144
|
}
|
|
111
145
|
/**
|
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
|
-
const
|
|
40
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
41
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./productStatusesSchemas'))));
|
|
8
42
|
/**
|
|
9
43
|
* Controllers for working with product statuses
|
|
10
44
|
* @handle /api/content/product-statuses
|
|
@@ -32,7 +66,7 @@ class ProductStatusesApi extends asyncModules_1.default {
|
|
|
32
66
|
async getProductStatuses(langCode = this.state.lang) {
|
|
33
67
|
const result = await this._fetchGet('');
|
|
34
68
|
// Validate response if validation is enabled
|
|
35
|
-
const validated = this._validateResponse(result,
|
|
69
|
+
const validated = await this._validateResponse(result, schema('ProductStatusesResponseSchema'));
|
|
36
70
|
return this._normalizeData(validated, langCode);
|
|
37
71
|
}
|
|
38
72
|
/**
|
|
@@ -48,7 +82,7 @@ class ProductStatusesApi extends asyncModules_1.default {
|
|
|
48
82
|
async getProductsByStatusMarker(marker, langCode = this.state.lang) {
|
|
49
83
|
const result = await this._fetchGet(`/marker/${marker}`);
|
|
50
84
|
// Validate response if validation is enabled
|
|
51
|
-
const validated = this._validateResponse(result,
|
|
85
|
+
const validated = await this._validateResponse(result, schema('ProductStatusEntitySchema'));
|
|
52
86
|
return this._normalizeData(validated, langCode);
|
|
53
87
|
}
|
|
54
88
|
/**
|
|
@@ -63,7 +97,7 @@ class ProductStatusesApi extends asyncModules_1.default {
|
|
|
63
97
|
async validateMarker(marker) {
|
|
64
98
|
const result = await this._fetchGet(`/marker-validation/${marker}`);
|
|
65
99
|
// Validate response if validation is enabled
|
|
66
|
-
const validated = this._validateResponse(result,
|
|
100
|
+
const validated = await this._validateResponse(result, schema('ValidateMarkerResponseSchema'));
|
|
67
101
|
// Extract the 'valid' boolean value from the response object
|
|
68
102
|
return typeof validated === 'object' && 'valid' in validated
|
|
69
103
|
? validated.valid
|
|
@@ -350,12 +350,12 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
350
350
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
351
351
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
352
352
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
353
|
-
* @returns {Promise<
|
|
353
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of found products and total count.
|
|
354
354
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
355
355
|
* @description This method performs a semantic (vector) search for products.
|
|
356
356
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsByVectorSearch getProductsByVectorSearch} documentation.
|
|
357
357
|
*/
|
|
358
|
-
getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<
|
|
358
|
+
getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<IProductsResponse | IError>;
|
|
359
359
|
/**
|
|
360
360
|
* Get products by page url.
|
|
361
361
|
* @param {string} url - Page url.
|
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
/* eslint-disable jsdoc/reject-any-type */
|
|
7
40
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
|
-
const
|
|
41
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
42
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./productsSchemas'))));
|
|
9
43
|
/**
|
|
10
44
|
* Controllers for working with product pages
|
|
11
45
|
* @handle /api/content/products
|
|
@@ -74,7 +108,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
74
108
|
};
|
|
75
109
|
const result = await this._fetchPost(`/all?` + this._queryParamsToString(query), { filter: body });
|
|
76
110
|
// Validate response if validation is enabled
|
|
77
|
-
const validated = this._validateResponse(result,
|
|
111
|
+
const validated = await this._validateResponse(result, schema('ProductsResponseSchema'));
|
|
78
112
|
return this._normalizeData(validated, langCode);
|
|
79
113
|
}
|
|
80
114
|
/**
|
|
@@ -149,7 +183,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
149
183
|
const query = { ...userQuery };
|
|
150
184
|
const result = await this._fetchPost(`/page/${id}?langCode=${langCode}&` + this._queryParamsToString(query), { filter: body });
|
|
151
185
|
// Validate response if validation is enabled
|
|
152
|
-
const validated = this._validateResponse(result,
|
|
186
|
+
const validated = await this._validateResponse(result, schema('ProductsResponseSchema'));
|
|
153
187
|
return this._normalizeData(validated, langCode);
|
|
154
188
|
}
|
|
155
189
|
/**
|
|
@@ -228,7 +262,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
228
262
|
const result = await this._fetchPost(`/page/url/${url}?langCode=${langCode}&` +
|
|
229
263
|
this._queryParamsToString(query), { filter: body });
|
|
230
264
|
// Validate response if validation is enabled
|
|
231
|
-
const validated = this._validateResponse(result,
|
|
265
|
+
const validated = await this._validateResponse(result, schema('ProductsResponseSchema'));
|
|
232
266
|
return this._normalizeData(validated, langCode);
|
|
233
267
|
}
|
|
234
268
|
/**
|
|
@@ -260,7 +294,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
260
294
|
const query = { ...userQuery };
|
|
261
295
|
const result = await this._fetchGet(`/${id}/related?langCode=${langCode}&` + this._queryParamsToString(query));
|
|
262
296
|
// Validate response if validation is enabled
|
|
263
|
-
const validated = this._validateResponse(result,
|
|
297
|
+
const validated = await this._validateResponse(result, schema('ProductsResponseSchema'));
|
|
264
298
|
return this._normalizeData(validated, langCode);
|
|
265
299
|
}
|
|
266
300
|
/**
|
|
@@ -309,7 +343,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
309
343
|
query.isNormalized = isNormalized;
|
|
310
344
|
const result = await this._fetchGet(`/${id}?` + this._queryParamsToString(query));
|
|
311
345
|
// Validate response if validation is enabled
|
|
312
|
-
const validated = this._validateResponse(result,
|
|
346
|
+
const validated = await this._validateResponse(result, schema('ProductEntitySchema'));
|
|
313
347
|
return this._normalizeData(validated, langCode);
|
|
314
348
|
}
|
|
315
349
|
/**
|
|
@@ -338,7 +372,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
338
372
|
async searchProduct(name, langCode = this.state.lang) {
|
|
339
373
|
const result = await this._fetchGet(`/quick/search?langCode=${encodeURIComponent(langCode)}&name=${encodeURIComponent(name)}`);
|
|
340
374
|
// Validate response if validation is enabled
|
|
341
|
-
const searchProducts = this._validateResponse(result,
|
|
375
|
+
const searchProducts = (await this._validateResponse(result, schema('ProductSearchResponseSchema')));
|
|
342
376
|
if (!this.state.traficLimit && Array.isArray(searchProducts)) {
|
|
343
377
|
if (searchProducts.length === 0)
|
|
344
378
|
return searchProducts;
|
|
@@ -443,7 +477,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
443
477
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
444
478
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
445
479
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
446
|
-
* @returns {Promise<
|
|
480
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of found products and total count.
|
|
447
481
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
448
482
|
* @description This method performs a semantic (vector) search for products.
|
|
449
483
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsByVectorSearch getProductsByVectorSearch} documentation.
|
|
@@ -299,11 +299,11 @@ interface IProductsApi {
|
|
|
299
299
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
300
300
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
301
301
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
302
|
-
* @returns {
|
|
302
|
+
* @returns {IProductsResponse} A promise that resolves to a products response (items + total) or an error.
|
|
303
303
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
304
304
|
* @description This method performs a semantic (vector) search for products.
|
|
305
305
|
*/
|
|
306
|
-
getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<
|
|
306
|
+
getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<IProductsResponse | IError>;
|
|
307
307
|
}
|
|
308
308
|
/**
|
|
309
309
|
* @interface IProductsQueryBase
|
|
@@ -533,11 +533,13 @@ interface IProductsEntity {
|
|
|
533
533
|
"title": "Product 2"
|
|
534
534
|
}
|
|
535
535
|
]
|
|
536
|
+
* @property {number} [totalFound] - Number of products matched before limits are applied; returned by block product endpoints (`similarProducts`, cart/wishlist recommendations, frequently ordered). Optional. Example: 2.
|
|
536
537
|
* @description This interface defines the structure of a response containing multiple product entities, including the total count and an array of product items.
|
|
537
538
|
*/
|
|
538
539
|
interface IProductsResponse {
|
|
539
540
|
items: IProductsEntity[];
|
|
540
541
|
total: number;
|
|
542
|
+
totalFound?: number;
|
|
541
543
|
}
|
|
542
544
|
/**
|
|
543
545
|
* @interface IProductSearchResult
|
|
@@ -644,31 +646,37 @@ interface IProductBlockSettings {
|
|
|
644
646
|
}
|
|
645
647
|
/**
|
|
646
648
|
* @interface IProductBlockProductConfig
|
|
647
|
-
* @property {string | number} quantity - Number of products to render. Example: 9.
|
|
648
|
-
* @property {string | number} countElementsPerRow - Products per row. Example: 3.
|
|
649
|
+
* @property {string | number} [quantity] - Number of products to render; absent when the block config is empty. Example: 9.
|
|
650
|
+
* @property {string | number} [countElementsPerRow] - Products per row; absent when the block config is empty. Example: 3.
|
|
649
651
|
* @property {string | number} [sortType] - Sort field. Example: "price".
|
|
650
652
|
* @property {string | number} [sortOrder] - Sort direction. Example: "ASC".
|
|
651
|
-
* @description Layout config for products inside a {@link IProductBlock}.
|
|
653
|
+
* @description Layout config for products inside a {@link IProductBlock}; an empty object when the block is not configured.
|
|
652
654
|
*/
|
|
653
655
|
interface IProductBlockProductConfig {
|
|
654
|
-
quantity
|
|
655
|
-
countElementsPerRow
|
|
656
|
+
quantity?: string | number;
|
|
657
|
+
countElementsPerRow?: string | number;
|
|
656
658
|
sortType?: string | number;
|
|
657
659
|
sortOrder?: string | number;
|
|
658
660
|
}
|
|
659
661
|
/**
|
|
660
662
|
* @interface IProductBlockSimilarRule
|
|
661
|
-
* @property {string}
|
|
662
|
-
* @property {string}
|
|
663
|
-
* @property {string}
|
|
664
|
-
* @property {string}
|
|
663
|
+
* @property {string} id - Rule identifier (UUID). Example: "812ee2bb-a90f-4743-9643-663f87acedf5".
|
|
664
|
+
* @property {string} title - Rule title; empty string when not set. Example: "".
|
|
665
|
+
* @property {string} attributeMarker - Marker of the product attribute the rule matches on. Example: "nameofproduct_3".
|
|
666
|
+
* @property {string} conditionMarker - Condition operator applied to the attribute. Example: "in".
|
|
667
|
+
* @property {string} conditionValue - Value the condition compares against. Example: "Blue".
|
|
668
|
+
* @property {string} statusMarker - Product status marker the rule is limited to; empty string when not limited. Example: "".
|
|
669
|
+
* @property {string[]} pageUrls - Page URLs the rule is scoped to; empty array when not restricted.
|
|
665
670
|
* @description Single rule used to compute similar products for a {@link IProductBlock}.
|
|
666
671
|
*/
|
|
667
672
|
interface IProductBlockSimilarRule {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
673
|
+
id: string;
|
|
674
|
+
title: string;
|
|
675
|
+
attributeMarker: string;
|
|
676
|
+
conditionMarker: string;
|
|
677
|
+
conditionValue: string;
|
|
678
|
+
statusMarker: string;
|
|
679
|
+
pageUrls: string[];
|
|
672
680
|
}
|
|
673
681
|
interface IProductBlock {
|
|
674
682
|
id: number;
|