idosell 0.4.27 → 0.4.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +12 -0
- package/dist/enums.d.ts +426 -404
- package/dist/enums.js +9 -1
- package/dist/gates.js +10 -6
- package/dist/gateways.d.ts +157 -212
- package/dist/helpers.js +1 -1
- package/dist/index.js +1 -1
- package/dist/methods/getProductsAttachmentsGetContent.js +5 -0
- package/dist/methods/getProductsBrands.js +1 -1
- package/dist/methods/getProductsCategories.js +1 -1
- package/dist/methods/getProductsMarketingPromotion.js +1 -0
- package/dist/methods/getRegulationsHistory.js +10 -0
- package/dist/methods/getReturns.js +1 -1
- package/dist/methods/getWarranties.js +1 -1
- package/dist/methods/getWmsStocksdocumentsProducts.js +1 -1
- package/dist/methods/postProductsMarketingPromotion.js +1 -0
- package/dist/methods/putClientsExternalCode.js +6 -0
- package/dist/methods/putProductsMarketingPromotion.js +1 -0
- package/dist/methods/searchClientsNewsletterEmail.js +1 -1
- package/dist/methods/searchClientsNewsletterSms.js +1 -1
- package/dist/reqparams.d.ts +19 -111
- package/dist/request.js +11 -13
- package/dist/responses.d.ts +50 -19
- package/dist/utils.d.ts +34 -41
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/tests/getProductsAttachmentsGetContent.test.js +7 -0
- package/tests/putClientsExternalCode.test.js +3 -3
- package/tests/utilMapAllProductCodes.test.js +0 -3
package/dist/helpers.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import ENUMS from "./enums.js";
|
|
|
2
2
|
import utils from "./utils.js";
|
|
3
3
|
import { gateProxy } from "./gates.js";
|
|
4
4
|
import { IdosellFaultStringError, catchEmptyList } from "./errors.js";
|
|
5
|
-
export const DEFAULT_VERSION =
|
|
5
|
+
export const DEFAULT_VERSION = 8;
|
|
6
6
|
function normalizeUrl(input = "") {
|
|
7
7
|
if (!input.length)
|
|
8
8
|
return "";
|
|
@@ -3,7 +3,7 @@ import { page } from "../helpers.js";
|
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'get', node: '/products/brands' };
|
|
5
5
|
object.custom = {
|
|
6
|
-
page
|
|
6
|
+
page: (pageIndex, limit) => page(pageIndex, limit, true)
|
|
7
7
|
};
|
|
8
8
|
object.snakeCase = true;
|
|
9
9
|
return new Proxy(object, paramsProxy);
|
|
@@ -3,7 +3,7 @@ import { page } from "../helpers.js";
|
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'get', node: '/products/categories' };
|
|
5
5
|
object.custom = {
|
|
6
|
-
page
|
|
6
|
+
page: (pageIndex, limit) => page(pageIndex, limit, true)
|
|
7
7
|
};
|
|
8
8
|
object.snakeCase = true;
|
|
9
9
|
return new Proxy(object, paramsProxy);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { paramsProxy } from "../params.js";
|
|
2
|
+
import { page } from "../helpers.js";
|
|
3
|
+
export default (object) => {
|
|
4
|
+
object.gate = { method: 'get', node: '/regulations/history' };
|
|
5
|
+
object.custom = {
|
|
6
|
+
page
|
|
7
|
+
};
|
|
8
|
+
object.req = ["langId"];
|
|
9
|
+
return new Proxy(object, paramsProxy);
|
|
10
|
+
};
|
|
@@ -4,7 +4,7 @@ export default (object) => {
|
|
|
4
4
|
object.gate = { method: 'get', node: '/returns/returns' };
|
|
5
5
|
object.custom = {
|
|
6
6
|
dates: dateRangeType({ "nodeName": "range", "fromName": "date][date_begin", "toName": "date][date_end", "typeName": "date][dates_type", "defaultType": "date_add" }),
|
|
7
|
-
page
|
|
7
|
+
page: (pageIndex, limit) => page(pageIndex, limit, true)
|
|
8
8
|
};
|
|
9
9
|
object.snakeCase = true;
|
|
10
10
|
object.req = [{ "any": true }];
|
|
@@ -3,7 +3,7 @@ import { page } from "../helpers.js";
|
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'get', node: '/warranties/warranties' };
|
|
5
5
|
object.custom = {
|
|
6
|
-
page
|
|
6
|
+
page: (pageIndex, limit) => page(pageIndex, limit, true)
|
|
7
7
|
};
|
|
8
8
|
object.snakeCase = true;
|
|
9
9
|
return new Proxy(object, paramsProxy);
|
|
@@ -3,7 +3,7 @@ import { page } from "../helpers.js";
|
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'get', node: '/wms/stocksdocuments/products' };
|
|
5
5
|
object.custom = {
|
|
6
|
-
page
|
|
6
|
+
page: (pageIndex, limit) => page(pageIndex, limit, true)
|
|
7
7
|
};
|
|
8
8
|
object.snakeCase = true;
|
|
9
9
|
object.req = ["type", "id"];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
2
|
export default (object) => {
|
|
3
3
|
object.gate = { method: 'post', node: '/products/marketing/promotion' };
|
|
4
|
+
object.auth.version = 7;
|
|
4
5
|
object.appendable = {
|
|
5
6
|
except: ["promotionName", "shopsIds", "marketingZones", "newPriceSettings", "startDate", "endDate", "changeProductsToVisibleWhileStarting", "removeProductsAfterStockLevelRunsDown", "reduceBasingPrice", "calculationMethod"],
|
|
6
7
|
arrayNode: "promotionElements",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
2
|
export default (object) => {
|
|
3
3
|
object.gate = { method: 'put', node: '/clients/externalCode' };
|
|
4
|
+
object.appendable = {
|
|
5
|
+
except: [],
|
|
6
|
+
arrayNode: "clients",
|
|
7
|
+
index: 0
|
|
8
|
+
};
|
|
4
9
|
object.req = [{ "any": ["client_id", "client_login"] }];
|
|
10
|
+
object.arrays = ["clients"];
|
|
5
11
|
return new Proxy(object, paramsProxy);
|
|
6
12
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
2
|
export default (object) => {
|
|
3
3
|
object.gate = { method: 'put', node: '/products/marketing/promotion' };
|
|
4
|
+
object.auth.version = 7;
|
|
4
5
|
object.appendable = {
|
|
5
6
|
except: ["promotionId", "promotionName", "shopsIds", "marketingZones", "newPriceSettings", "startDate", "endDate", "changeProductsToVisibleWhileStarting", "removeProductsAfterStockLevelRunsDown", "reduceBasingPrice", "calculationMethod", "removeAllPromotionElements"],
|
|
6
7
|
arrayNode: "promotionElements",
|
|
@@ -4,7 +4,7 @@ export default (object) => {
|
|
|
4
4
|
object.gate = { method: 'post', node: '/clients/newsletter/email/search' };
|
|
5
5
|
object.custom = {
|
|
6
6
|
dates: dateRange({ "nodeName": "date", "fromName": "from", "toName": "to" }),
|
|
7
|
-
page
|
|
7
|
+
page: (pageIndex, limit) => page(pageIndex, limit, true)
|
|
8
8
|
};
|
|
9
9
|
object.snakeCase = true;
|
|
10
10
|
object.arrays = ["shops", "return_elements"];
|
|
@@ -4,7 +4,7 @@ export default (object) => {
|
|
|
4
4
|
object.gate = { method: 'post', node: '/clients/newsletter/sms/search' };
|
|
5
5
|
object.custom = {
|
|
6
6
|
dates: dateRange({ "nodeName": "date", "fromName": "from", "toName": "to" }),
|
|
7
|
-
page
|
|
7
|
+
page: (pageIndex, limit) => page(pageIndex, limit, true)
|
|
8
8
|
};
|
|
9
9
|
object.snakeCase = true;
|
|
10
10
|
object.arrays = ["shops", "return_elements"];
|
package/dist/reqparams.d.ts
CHANGED
|
@@ -325,50 +325,6 @@ export type PostProductsParams = {
|
|
|
325
325
|
productPictures?: string[];
|
|
326
326
|
/** @description List of photos descriptions */
|
|
327
327
|
productDescriptionPictures?: string[];
|
|
328
|
-
/** @description Reduced price */
|
|
329
|
-
productPromotion?: {
|
|
330
|
-
/** @description Object determines if the promotion should be active.. Allowed values "y" - active promotion, "n" - inactive promotion. */
|
|
331
|
-
promoteInEnabled?: string;
|
|
332
|
-
/** @description Strikethrough price */
|
|
333
|
-
promoteItemNormalPrice?: number;
|
|
334
|
-
/** @description Strikethrough wholesale price */
|
|
335
|
-
promoteItemWholesaleNormalPrice?: number;
|
|
336
|
-
/** @description Switching off date */
|
|
337
|
-
promoteItemEndingDate?: string;
|
|
338
|
-
};
|
|
339
|
-
/** @description Discount for shop. */
|
|
340
|
-
productDiscount?: {
|
|
341
|
-
/** @description Object determines if the promotion should be active.. Allowed values "y" - active promotion, "n" - inactive promotion. */
|
|
342
|
-
promoteInEnabled?: string;
|
|
343
|
-
/** @description Strikethrough price */
|
|
344
|
-
promoteItemNormalPrice?: number;
|
|
345
|
-
/** @description Strikethrough wholesale price */
|
|
346
|
-
promoteItemWholesaleNormalPrice?: number;
|
|
347
|
-
/** @description Switching off date */
|
|
348
|
-
promoteItemEndingDate?: string;
|
|
349
|
-
};
|
|
350
|
-
/** @description Distinguished product in store. */
|
|
351
|
-
productDistinguished?: {
|
|
352
|
-
/** @description Object determines if the promotion should be active.. Allowed values "y" - active promotion, "n" - inactive promotion. */
|
|
353
|
-
promoteInEnabled?: string;
|
|
354
|
-
/** @description Strikethrough price */
|
|
355
|
-
promoteItemNormalPrice?: number;
|
|
356
|
-
/** @description Strikethrough wholesale price */
|
|
357
|
-
promoteItemWholesaleNormalPrice?: number;
|
|
358
|
-
/** @description Switching off date */
|
|
359
|
-
promoteItemEndingDate?: string;
|
|
360
|
-
};
|
|
361
|
-
/** @description Special product in store. */
|
|
362
|
-
productSpecial?: {
|
|
363
|
-
/** @description Object determines if the promotion should be active.. Allowed values "y" - active promotion, "n" - inactive promotion. */
|
|
364
|
-
promoteInEnabled?: string;
|
|
365
|
-
/** @description Strikethrough price */
|
|
366
|
-
promoteItemNormalPrice?: number;
|
|
367
|
-
/** @description Strikethrough wholesale price */
|
|
368
|
-
promoteItemWholesaleNormalPrice?: number;
|
|
369
|
-
/** @description Switching off date */
|
|
370
|
-
promoteItemEndingDate?: string;
|
|
371
|
-
};
|
|
372
328
|
/** @description Parameters (distinguished). */
|
|
373
329
|
productParametersDistinction?: {
|
|
374
330
|
/** @description Parameter ID */
|
|
@@ -1094,66 +1050,6 @@ export type PutProductsParams = {
|
|
|
1094
1050
|
/** @description A picture in url or base64 (depends on pictures_input_type). */
|
|
1095
1051
|
productPictureSource?: string;
|
|
1096
1052
|
}[];
|
|
1097
|
-
/** @description Reduced price */
|
|
1098
|
-
productPromotion?: {
|
|
1099
|
-
/** @description Is attribute set */
|
|
1100
|
-
promoteIsEnabled?: string;
|
|
1101
|
-
/** @description Strikethrough price */
|
|
1102
|
-
promoteItemNormalPrice?: number;
|
|
1103
|
-
/** @description Net strikethrough price. */
|
|
1104
|
-
promoteItemNormalPriceNet?: number;
|
|
1105
|
-
/** @description Strikethrough wholesale price */
|
|
1106
|
-
promoteItemWholesaleNormalPrice?: number;
|
|
1107
|
-
/** @description Net wholesale strikethrough price. */
|
|
1108
|
-
promoteItemWholesaleNormalPriceNet?: number;
|
|
1109
|
-
/** @description Switching off date */
|
|
1110
|
-
promoteItemEndingDate?: string;
|
|
1111
|
-
};
|
|
1112
|
-
/** @description Discount for shop. */
|
|
1113
|
-
productDiscount?: {
|
|
1114
|
-
/** @description Is attribute set */
|
|
1115
|
-
promoteIsEnabled?: string;
|
|
1116
|
-
/** @description Strikethrough price */
|
|
1117
|
-
promoteItemNormalPrice?: number;
|
|
1118
|
-
/** @description Net strikethrough price. */
|
|
1119
|
-
promoteItemNormalPriceNet?: number;
|
|
1120
|
-
/** @description Strikethrough wholesale price */
|
|
1121
|
-
promoteItemWholesaleNormalPrice?: number;
|
|
1122
|
-
/** @description Net wholesale strikethrough price. */
|
|
1123
|
-
promoteItemWholesaleNormalPriceNet?: number;
|
|
1124
|
-
/** @description Switching off date */
|
|
1125
|
-
promoteItemEndingDate?: string;
|
|
1126
|
-
};
|
|
1127
|
-
/** @description Distinguished product in store. */
|
|
1128
|
-
productDistinguished?: {
|
|
1129
|
-
/** @description Is attribute set */
|
|
1130
|
-
promoteIsEnabled?: string;
|
|
1131
|
-
/** @description Strikethrough price */
|
|
1132
|
-
promoteItemNormalPrice?: number;
|
|
1133
|
-
/** @description Net strikethrough price. */
|
|
1134
|
-
promoteItemNormalPriceNet?: number;
|
|
1135
|
-
/** @description Strikethrough wholesale price */
|
|
1136
|
-
promoteItemWholesaleNormalPrice?: number;
|
|
1137
|
-
/** @description Switching off date */
|
|
1138
|
-
promoteItemEndingDate?: string;
|
|
1139
|
-
/** @description Net wholesale strikethrough price. */
|
|
1140
|
-
promoteItemWholesaleNormalPriceNet?: number;
|
|
1141
|
-
};
|
|
1142
|
-
/** @description Special product in store. */
|
|
1143
|
-
productSpecial?: {
|
|
1144
|
-
/** @description Is attribute set */
|
|
1145
|
-
promoteIsEnabled?: string;
|
|
1146
|
-
/** @description Strikethrough price */
|
|
1147
|
-
promoteItemNormalPrice?: number;
|
|
1148
|
-
/** @description Net strikethrough price. */
|
|
1149
|
-
promoteItemNormalPriceNet?: number;
|
|
1150
|
-
/** @description Strikethrough wholesale price */
|
|
1151
|
-
promoteItemWholesaleNormalPrice?: number;
|
|
1152
|
-
/** @description Net wholesale strikethrough price. */
|
|
1153
|
-
promoteItemWholesaleNormalPriceNet?: number;
|
|
1154
|
-
/** @description Switching off date */
|
|
1155
|
-
promoteItemEndingDate?: string;
|
|
1156
|
-
};
|
|
1157
1053
|
/** @description Parameters (distinguished). */
|
|
1158
1054
|
productParametersDistinction?: {
|
|
1159
1055
|
/** @description Parameter ID */
|
|
@@ -6512,12 +6408,15 @@ export type PostDiscountsRebatesCodeParams = {
|
|
|
6512
6408
|
};
|
|
6513
6409
|
|
|
6514
6410
|
export type PutClientsExternalCodeParams = {
|
|
6515
|
-
/** @
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6411
|
+
/** @description Customer data. */
|
|
6412
|
+
clients: {
|
|
6413
|
+
/** @example 1 */
|
|
6414
|
+
client_id?: number;
|
|
6415
|
+
/** @description Customer's login. */
|
|
6416
|
+
client_login?: string;
|
|
6417
|
+
/** @description External system code. */
|
|
6418
|
+
code_extern?: string;
|
|
6419
|
+
}[];
|
|
6521
6420
|
};
|
|
6522
6421
|
|
|
6523
6422
|
export type PutClientsGiftcardsParams = {
|
|
@@ -7168,7 +7067,7 @@ type PaginationParam = {
|
|
|
7168
7067
|
perPage?: number;
|
|
7169
7068
|
};
|
|
7170
7069
|
|
|
7171
|
-
type DateRangeParam = {
|
|
7070
|
+
export type DateRangeParam = {
|
|
7172
7071
|
/** Format: date
|
|
7173
7072
|
* @description Date "from" (RFC) */
|
|
7174
7073
|
from?: string | null;
|
|
@@ -7317,4 +7216,13 @@ export type PutPromotionsSettingsParams = {
|
|
|
7317
7216
|
daysLeftToClose?: number;
|
|
7318
7217
|
};
|
|
7319
7218
|
|
|
7219
|
+
export type GetProductsAttachmentsGetContentParams = {
|
|
7220
|
+
/** @description - product identifier value */
|
|
7221
|
+
productIdentValue: string;
|
|
7222
|
+
/** @description - product identifier type */
|
|
7223
|
+
productIdentType: "codeExtern" | "codeProducer" | "index" | "id";
|
|
7224
|
+
/** @description - product attachment ID */
|
|
7225
|
+
attachmentId: number;
|
|
7226
|
+
};
|
|
7227
|
+
|
|
7320
7228
|
export { };
|
package/dist/request.js
CHANGED
|
@@ -52,30 +52,28 @@ const checkNext = (request, response, logPage) => {
|
|
|
52
52
|
};
|
|
53
53
|
throw new IdosellFaultStringError(response.errors.faultString, faultStructure);
|
|
54
54
|
}
|
|
55
|
-
function handlePagination(currentPage, totalPages,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Object.assign(request.params, paramsUpdate);
|
|
55
|
+
function handlePagination(currentPage, totalPages, limit, request) {
|
|
56
|
+
const nextPage = currentPage + 1;
|
|
57
|
+
request.next = nextPage < totalPages;
|
|
59
58
|
if (typeof logPage === 'function') {
|
|
60
59
|
logPage('Page: ' + currentPage + ' / ' + totalPages);
|
|
61
60
|
}
|
|
61
|
+
if (request.custom && request.custom.page) {
|
|
62
|
+
const pageObj = request.custom.page(nextPage, limit);
|
|
63
|
+
Object.assign(request.params, pageObj);
|
|
64
|
+
}
|
|
62
65
|
}
|
|
63
66
|
if (response.resultsNumberPage) {
|
|
64
|
-
handlePagination(response.resultsPage, response.resultsNumberPage,
|
|
67
|
+
handlePagination(response.resultsPage, response.resultsNumberPage, response.resultsLimit, request);
|
|
65
68
|
}
|
|
66
69
|
else if (response.results_number_page) {
|
|
67
|
-
handlePagination(response.results_page, response.results_number_page,
|
|
70
|
+
handlePagination(response.results_page, response.results_number_page, response.results_limit, request);
|
|
68
71
|
}
|
|
69
72
|
else if (response.pagination) {
|
|
70
|
-
|
|
71
|
-
request.params.pagination.page = response.pagination.resultsPage + 1;
|
|
72
|
-
handlePagination(response.pagination.resultsPage, response.pagination.resultsNumberPage, request);
|
|
73
|
+
handlePagination(response.pagination.resultsPage, response.pagination.resultsNumberPage, response.pagination.resultsLimit, request);
|
|
73
74
|
}
|
|
74
75
|
else if (response.data?.pagination) {
|
|
75
|
-
|
|
76
|
-
request.params.pagination = {};
|
|
77
|
-
request.params.pagination.page = response.data.pagination.resultsPage + 1;
|
|
78
|
-
handlePagination(response.data.pagination.resultsPage, response.data.pagination.resultsNumberPage, request);
|
|
76
|
+
handlePagination(response.data.pagination.resultsPage, response.data.pagination.resultsNumberPage, response.data.pagination.resultsLimit, request);
|
|
79
77
|
}
|
|
80
78
|
return response;
|
|
81
79
|
};
|
package/dist/responses.d.ts
CHANGED
|
@@ -992,7 +992,7 @@ export type GetConfigVariablesResponse = {
|
|
|
992
992
|
/** @description Key of config value. */
|
|
993
993
|
key: string;
|
|
994
994
|
/** @description Name of config item. */
|
|
995
|
-
|
|
995
|
+
name: string;
|
|
996
996
|
/** @description Value of config item. */
|
|
997
997
|
value: string;
|
|
998
998
|
} & {
|
|
@@ -1012,7 +1012,7 @@ export type PutConfigVariablesResponse = {
|
|
|
1012
1012
|
/** @description Key of config value. */
|
|
1013
1013
|
key: string;
|
|
1014
1014
|
/** @description Name of config item. */
|
|
1015
|
-
|
|
1015
|
+
name?: string;
|
|
1016
1016
|
/** @description Value of config item. */
|
|
1017
1017
|
value: string;
|
|
1018
1018
|
} & {
|
|
@@ -1185,9 +1185,9 @@ export type GetCpaCampaignResponse = {
|
|
|
1185
1185
|
/** @description Whether the snippet is active */
|
|
1186
1186
|
active: "y" | "n";
|
|
1187
1187
|
/** @description Number of CPA programs associated with the campaign. */
|
|
1188
|
-
|
|
1188
|
+
cpaCount: number | null;
|
|
1189
1189
|
/** @description Number of active CPA programs associated with the campaign. */
|
|
1190
|
-
|
|
1190
|
+
activeCpaCount: number | null;
|
|
1191
1191
|
}[];
|
|
1192
1192
|
pagination: PagedResponse;
|
|
1193
1193
|
};
|
|
@@ -3492,8 +3492,10 @@ export type PutProductsMarketingZonesResponse = {
|
|
|
3492
3492
|
|
|
3493
3493
|
export type GetProductsOmnibusPricesResponse = {
|
|
3494
3494
|
/** @description Products list. */
|
|
3495
|
-
products:
|
|
3496
|
-
|
|
3495
|
+
products: {
|
|
3496
|
+
/** @description Product ID */
|
|
3497
|
+
productId: number;
|
|
3498
|
+
shops: {
|
|
3497
3499
|
/** @description Shop Id */
|
|
3498
3500
|
shop_id: number;
|
|
3499
3501
|
/** @description Lowest retail price before active promotion (gross). */
|
|
@@ -3503,7 +3505,7 @@ export type GetProductsOmnibusPricesResponse = {
|
|
|
3503
3505
|
/** @description How to manage the lowest price before promotion. */
|
|
3504
3506
|
omnibusPriceManagement: "automatic" | "manual";
|
|
3505
3507
|
/** @description List of sizes */
|
|
3506
|
-
sizes:
|
|
3508
|
+
sizes: {
|
|
3507
3509
|
/** @description Identifier type. */
|
|
3508
3510
|
ident: {
|
|
3509
3511
|
/** */
|
|
@@ -3516,9 +3518,12 @@ export type GetProductsOmnibusPricesResponse = {
|
|
|
3516
3518
|
/** @description Lowest wholesale price before active promotion (gross). */
|
|
3517
3519
|
omnibusPriceWholesale: number;
|
|
3518
3520
|
/** @description How to manage the lowest price before promotion. */
|
|
3519
|
-
omnibusPriceManagement: "automatic" | "manual"
|
|
3521
|
+
omnibusPriceManagement: "automatic" | "manual";
|
|
3522
|
+
}[];
|
|
3523
|
+
}[];
|
|
3520
3524
|
/** @description Error information. */
|
|
3521
|
-
error?: FaultCodeString
|
|
3525
|
+
error?: FaultCodeString;
|
|
3526
|
+
}[];
|
|
3522
3527
|
};
|
|
3523
3528
|
|
|
3524
3529
|
export type GetProductsOpinionsRateResponse = {
|
|
@@ -6251,18 +6256,18 @@ export type GetSnippetsCampaignResponse = {
|
|
|
6251
6256
|
/** @description Whether the snippet is active */
|
|
6252
6257
|
active: "y" | "n";
|
|
6253
6258
|
/** @description Whether the snippet campaign is deleted */
|
|
6254
|
-
|
|
6259
|
+
deleted: "y" | "n";
|
|
6255
6260
|
/** @description Snippet order. */
|
|
6256
6261
|
order: number;
|
|
6257
6262
|
/** @description Number of code snippets associated with the campaign. */
|
|
6258
|
-
|
|
6263
|
+
snippetCount: number | null;
|
|
6259
6264
|
/** @description Number of active code snippets associated with the campaign. */
|
|
6260
|
-
|
|
6265
|
+
activeSnippetCount: number | null;
|
|
6261
6266
|
configVariables: {
|
|
6262
6267
|
/** @description Key of config value. */
|
|
6263
6268
|
key: string;
|
|
6264
6269
|
/** @description Name of config item. */
|
|
6265
|
-
|
|
6270
|
+
name: string;
|
|
6266
6271
|
/** @description Value of config item. */
|
|
6267
6272
|
value: string;
|
|
6268
6273
|
}[];
|
|
@@ -6431,9 +6436,9 @@ export type GetSnippetsResponse = {
|
|
|
6431
6436
|
} | null;
|
|
6432
6437
|
};
|
|
6433
6438
|
/** @description Whether the snippet is marked as deleted. */
|
|
6434
|
-
|
|
6439
|
+
deleted: "y" | "n";
|
|
6435
6440
|
/** @description The number of cookies associated with the snippet. */
|
|
6436
|
-
|
|
6441
|
+
cookiesCount: number;
|
|
6437
6442
|
}[];
|
|
6438
6443
|
pagination: PagedResponse;
|
|
6439
6444
|
};
|
|
@@ -9207,10 +9212,10 @@ type PromotionArchiveData = Omit<PromotionData, "archivedDate" | "elementsCount"
|
|
|
9207
9212
|
|
|
9208
9213
|
export type SearchPromotionsHistoryResponse = PromotionApiResponse<{
|
|
9209
9214
|
list: {
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9215
|
+
id: number;
|
|
9216
|
+
date: string;
|
|
9217
|
+
login: string;
|
|
9218
|
+
description: string;
|
|
9214
9219
|
}[];
|
|
9215
9220
|
pagination: PagedResponse;
|
|
9216
9221
|
}>;
|
|
@@ -9257,4 +9262,30 @@ export type PromotionIdResponse = PromotionApiResponse<number>;
|
|
|
9257
9262
|
|
|
9258
9263
|
export type PromotionBoolResponse = PromotionApiResponse<boolean | null>;
|
|
9259
9264
|
|
|
9265
|
+
export type GetRegulationsHistoryResponse = {
|
|
9266
|
+
results: {
|
|
9267
|
+
/** @description Document's type */
|
|
9268
|
+
type: string;
|
|
9269
|
+
/** @description Language ISO code. */
|
|
9270
|
+
langId: string;
|
|
9271
|
+
/** @description Shop ID. */
|
|
9272
|
+
shopId: number;
|
|
9273
|
+
/** @description Content. */
|
|
9274
|
+
content: string;
|
|
9275
|
+
/** @description Creation time. */
|
|
9276
|
+
creationTime: number;
|
|
9277
|
+
/** @description User. */
|
|
9278
|
+
user: string;
|
|
9279
|
+
/** @description Change type. */
|
|
9280
|
+
changeType: "" | "auto" | "user";
|
|
9281
|
+
/** @description Change source (y - auto, m - markdown editor, n - WYSIWYG/HTML editor). */
|
|
9282
|
+
isDefault: "y" | "m" | "n";
|
|
9283
|
+
/** @description Setting to check if revision was published in shop. */
|
|
9284
|
+
wasPublished: number;
|
|
9285
|
+
/** @description 2-letter ISO country code. */
|
|
9286
|
+
country: string;
|
|
9287
|
+
}[];
|
|
9288
|
+
pagination: PagedResponse;
|
|
9289
|
+
};
|
|
9290
|
+
|
|
9260
9291
|
export { };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,41 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { SearchProductsResponse } from "./responses.d.ts"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/** @description The method allows
|
|
24
|
-
|
|
25
|
-
/** @description
|
|
26
|
-
|
|
27
|
-
/** @description
|
|
28
|
-
|
|
29
|
-
/** @description
|
|
30
|
-
|
|
31
|
-
/** @description
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/** @description Get first item (description, series, parameter name or value) with the selected langId */
|
|
36
|
-
const getLangData: GetLangDataFunction;
|
|
37
|
-
/** @description Modifies product response by removing all parameter names nad values that are not in selected langId */
|
|
38
|
-
const clearParametersLangData: ClearParametersLangDataFunction;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default utils;
|
|
1
|
+
import { ENUMS } from "./enums";
|
|
2
|
+
import type { SearchProductsResponse, GetRmaResponse } from "./responses.d.ts";
|
|
3
|
+
type IdosellProduct = SearchProductsResponse['results'][0];
|
|
4
|
+
type GetIaICodeFunction = (_productId: number | string, _sizeId: string) => string;
|
|
5
|
+
type SumProductQuantitiesFunction = (_productStocksData: IdosellProduct['productStocksData'], _stockType?: ENUMS.PRODUCT_SIZE_COUNTABLE | `${ENUMS.PRODUCT_SIZE_COUNTABLE}`) => number;
|
|
6
|
+
type MapSizeQuantitesFunction = (_product: IdosellProduct, _stockType?: `${ENUMS.PRODUCT_SIZE_COUNTABLE}`, _indexBy?: `${ENUMS.PRODUCE_SIZE_INDEX}`) => Record<string, number>;
|
|
7
|
+
type MapProductCodesFunction = (_product: IdosellProduct, _codeType?: `${ENUMS.PRODUCT_SIZE_CODES}`, _indexBy?: `${ENUMS.PRODUCE_SIZE_INDEX}`) => Record<string, string>;
|
|
8
|
+
type MapProductAllCodesFunction = (_product: IdosellProduct, _indexBy?: `${ENUMS.PRODUCE_SIZE_INDEX}`) => Record<string, string[]>;
|
|
9
|
+
type MapProductLocationsFunction = (_product: IdosellProduct, _stockId?: number, _codeType?: `${ENUMS.PRODUCT_SIZE_LOCATIONS}`, _indexBy?: `${ENUMS.PRODUCE_SIZE_INDEX}`) => Record<string, string[]>;
|
|
10
|
+
type GetLangDataFunction = <T extends {
|
|
11
|
+
langId: string;
|
|
12
|
+
}>(_array: T[], _langId?: string) => T | undefined;
|
|
13
|
+
type ClearParametersLangDataFunction = (_products: SearchProductsResponse['results'], _langId?: string) => SearchProductsResponse['results'];
|
|
14
|
+
declare const _default: {
|
|
15
|
+
/** @description The method allows you to build an IAI code from the product ID and size ID. */
|
|
16
|
+
getIaiCode: GetIaICodeFunction;
|
|
17
|
+
/** @description The method allows you to sum up the current stock levels: warehouses, available stocks, etc. */
|
|
18
|
+
sumProductQuantities: SumProductQuantitiesFunction;
|
|
19
|
+
/** @description The method allows mapping the sum of the current stock levels (in warehouses, at disposal, etc.) divided into sizes */
|
|
20
|
+
mapSizeQuantites: MapSizeQuantitesFunction;
|
|
21
|
+
/** @description The method allows mapping the producers's or external system's codes stored in the system to SKUs */
|
|
22
|
+
mapProductCodes: MapProductCodesFunction;
|
|
23
|
+
/** @description The method allows mapping all known codes: IAI code, manufacturer code or external code as an array */
|
|
24
|
+
mapAllProductCodes: MapProductAllCodesFunction;
|
|
25
|
+
/** @description This method allows you to map product locations stored in the system, broken down by size. You can select a specific warehouse or list all of them, both primary and secondary. */
|
|
26
|
+
mapProductLocations: MapProductLocationsFunction;
|
|
27
|
+
/** @description Get first item (description, series, parameter name or value) with the selected langId */
|
|
28
|
+
getLangData: GetLangDataFunction;
|
|
29
|
+
/** @description Modifies product response by removing all parameter names nad values that are not in selected langId */
|
|
30
|
+
clearParametersLangData: ClearParametersLangDataFunction;
|
|
31
|
+
/** @description Removes attachments to RMA that are returned by default, helps to reduce data if serialized or forwarded */
|
|
32
|
+
removeRmaAttachments: (rmaResponse: GetRmaResponse) => GetRmaResponse;
|
|
33
|
+
};
|
|
34
|
+
export default _default;
|
package/dist/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import idosell from "./dist/index.ts"
|
|
2
|
+
import { expect, test } from "vitest"
|
|
3
|
+
|
|
4
|
+
test("getProductsAttachmentsGetContentAttachmentId", () => {
|
|
5
|
+
const params = idosell().getProductsAttachmentsGetContent.productIdentType("id").productIdentValue("294").attachmentId(5).checkParams();
|
|
6
|
+
expect(params).toEqual({"productIdentType":"id","productIdentValue":"294","attachmentId":5});
|
|
7
|
+
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import idosell from "./dist/index"
|
|
1
|
+
import idosell from "./dist/index.ts"
|
|
2
2
|
import { expect, test } from "vitest"
|
|
3
3
|
|
|
4
4
|
test("putClientsExternalCodeCode_extern", () => {
|
|
5
|
-
const params = idosell().putClientsExternalCode.
|
|
6
|
-
expect(params).toEqual({"
|
|
5
|
+
const params = idosell().putClientsExternalCode.client_id(10).code_extern("vip10").checkParams();
|
|
6
|
+
expect(params).toEqual({"clients":[{"client_id":10,"code_extern":"vip10"}]});
|
|
7
7
|
})
|
|
@@ -7,18 +7,15 @@ const INDEX = ENUMS.PRODUCE_SIZE_INDEX;
|
|
|
7
7
|
|
|
8
8
|
test('Utils mapAllProductCodes by ID', () => {
|
|
9
9
|
const codes = utils.mapAllProductCodes(STOCK_PRODUCT, INDEX.ID)
|
|
10
|
-
console.log(JSON.stringify(codes));
|
|
11
10
|
expect(codes).toEqual({"3":["1234-3","1234567890128","PX-ZERO-S"],"4":["1234-4","1234567890135","PX-ZERO-M"],"5":["1234-5","1234567890142","PX-ZERO-L"],"6":["1234-6","1234567890159","PX-ZERO-X"]});
|
|
12
11
|
})
|
|
13
12
|
|
|
14
13
|
test('Utils mapAllProductCodes by IAI code', () => {
|
|
15
14
|
const codes = utils.mapAllProductCodes(STOCK_PRODUCT, INDEX.IAI_CODE)
|
|
16
|
-
console.log(JSON.stringify(codes));
|
|
17
15
|
expect(codes).toEqual({"1234-3":["1234-3","1234567890128","PX-ZERO-S"],"1234-4":["1234-4","1234567890135","PX-ZERO-M"],"1234-5":["1234-5","1234567890142","PX-ZERO-L"],"1234-6":["1234-6","1234567890159","PX-ZERO-X"]});
|
|
18
16
|
})
|
|
19
17
|
|
|
20
18
|
test('Utils mapAllProductCodes by name', () => {
|
|
21
19
|
const codes = utils.mapAllProductCodes(STOCK_PRODUCT, INDEX.NAME)
|
|
22
|
-
console.log(JSON.stringify(codes));
|
|
23
20
|
expect(codes).toEqual({"S":["1234-3","1234567890128","PX-ZERO-S"],"M":["1234-4","1234567890135","PX-ZERO-M"],"L":["1234-5","1234567890142","PX-ZERO-L"],"XL":["1234-6","1234567890159","PX-ZERO-X"]});
|
|
24
21
|
})
|