idosell 0.4.27 → 0.4.30
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 +7 -0
- package/dist/gates.js +10 -6
- package/dist/gateways.d.ts +151 -208
- package/dist/index.js +1 -1
- package/dist/methods/getProductsAttachmentsGetContent.js +5 -0
- package/dist/methods/getProductsMarketingPromotion.js +1 -0
- package/dist/methods/getRegulationsHistory.js +5 -0
- package/dist/methods/postProductsMarketingPromotion.js +1 -0
- package/dist/methods/putClientsExternalCode.js +6 -0
- package/dist/methods/putProductsMarketingPromotion.js +1 -0
- package/dist/reqparams.d.ts +18 -110
- package/dist/request.js +0 -1
- package/dist/responses.d.ts +52 -14
- package/package.json +1 -1
- package/tests/getProductsAttachmentsGetContent.test.js +7 -0
- package/tests/putClientsExternalCode.test.js +3 -3
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 "";
|
|
@@ -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",
|
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 = {
|
|
@@ -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
|
@@ -67,7 +67,6 @@ const checkNext = (request, response, logPage) => {
|
|
|
67
67
|
handlePagination(response.results_page, response.results_number_page, request, { results_page: response.results_page + 1 });
|
|
68
68
|
}
|
|
69
69
|
else if (response.pagination) {
|
|
70
|
-
console.log({ rp: request.params, qp: response.pagination });
|
|
71
70
|
request.params.pagination.page = response.pagination.resultsPage + 1;
|
|
72
71
|
handlePagination(response.pagination.resultsPage, response.pagination.resultsNumberPage, request);
|
|
73
72
|
}
|
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
|
};
|
|
@@ -3493,6 +3493,8 @@ export type PutProductsMarketingZonesResponse = {
|
|
|
3493
3493
|
export type GetProductsOmnibusPricesResponse = {
|
|
3494
3494
|
/** @description Products list. */
|
|
3495
3495
|
products: never[] | Record<string, {
|
|
3496
|
+
/** @description Product ID */
|
|
3497
|
+
productId: number;
|
|
3496
3498
|
shops: never[] | Record<string, {
|
|
3497
3499
|
/** @description Shop Id */
|
|
3498
3500
|
shop_id: number;
|
|
@@ -6251,18 +6253,18 @@ export type GetSnippetsCampaignResponse = {
|
|
|
6251
6253
|
/** @description Whether the snippet is active */
|
|
6252
6254
|
active: "y" | "n";
|
|
6253
6255
|
/** @description Whether the snippet campaign is deleted */
|
|
6254
|
-
|
|
6256
|
+
deleted: "y" | "n";
|
|
6255
6257
|
/** @description Snippet order. */
|
|
6256
6258
|
order: number;
|
|
6257
6259
|
/** @description Number of code snippets associated with the campaign. */
|
|
6258
|
-
|
|
6260
|
+
snippetCount: number | null;
|
|
6259
6261
|
/** @description Number of active code snippets associated with the campaign. */
|
|
6260
|
-
|
|
6262
|
+
activeSnippetCount: number | null;
|
|
6261
6263
|
configVariables: {
|
|
6262
6264
|
/** @description Key of config value. */
|
|
6263
6265
|
key: string;
|
|
6264
6266
|
/** @description Name of config item. */
|
|
6265
|
-
|
|
6267
|
+
name: string;
|
|
6266
6268
|
/** @description Value of config item. */
|
|
6267
6269
|
value: string;
|
|
6268
6270
|
}[];
|
|
@@ -6431,9 +6433,9 @@ export type GetSnippetsResponse = {
|
|
|
6431
6433
|
} | null;
|
|
6432
6434
|
};
|
|
6433
6435
|
/** @description Whether the snippet is marked as deleted. */
|
|
6434
|
-
|
|
6436
|
+
deleted: "y" | "n";
|
|
6435
6437
|
/** @description The number of cookies associated with the snippet. */
|
|
6436
|
-
|
|
6438
|
+
cookiesCount: number;
|
|
6437
6439
|
}[];
|
|
6438
6440
|
pagination: PagedResponse;
|
|
6439
6441
|
};
|
|
@@ -9207,10 +9209,10 @@ type PromotionArchiveData = Omit<PromotionData, "archivedDate" | "elementsCount"
|
|
|
9207
9209
|
|
|
9208
9210
|
export type SearchPromotionsHistoryResponse = PromotionApiResponse<{
|
|
9209
9211
|
list: {
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9212
|
+
id: number;
|
|
9213
|
+
date: string;
|
|
9214
|
+
login: string;
|
|
9215
|
+
description: string;
|
|
9214
9216
|
}[];
|
|
9215
9217
|
pagination: PagedResponse;
|
|
9216
9218
|
}>;
|
|
@@ -9257,4 +9259,40 @@ export type PromotionIdResponse = PromotionApiResponse<number>;
|
|
|
9257
9259
|
|
|
9258
9260
|
export type PromotionBoolResponse = PromotionApiResponse<boolean | null>;
|
|
9259
9261
|
|
|
9262
|
+
export type GetRegulationsHistoryResponse = {
|
|
9263
|
+
results: {
|
|
9264
|
+
/** @description Document's type */
|
|
9265
|
+
type: string;
|
|
9266
|
+
/** @description Language ISO code. */
|
|
9267
|
+
langId: string;
|
|
9268
|
+
/** @description Shop ID. */
|
|
9269
|
+
shopId: number;
|
|
9270
|
+
/** @description Content. */
|
|
9271
|
+
content: string;
|
|
9272
|
+
/** @description Creation time. */
|
|
9273
|
+
creationTime: number;
|
|
9274
|
+
/** @description User. */
|
|
9275
|
+
user: string;
|
|
9276
|
+
/** @description Change type. */
|
|
9277
|
+
changeType: "auto" | "user";
|
|
9278
|
+
/** @description Change source (y - auto, m - markdown editor, n - WYSIWYG/HTML editor). */
|
|
9279
|
+
isDefault: "y" | "m" | "n";
|
|
9280
|
+
/** @description Setting to check if revision was published in shop. */
|
|
9281
|
+
wasPublished: number;
|
|
9282
|
+
/** @description 2-letter ISO country code. */
|
|
9283
|
+
country: string;
|
|
9284
|
+
}[];
|
|
9285
|
+
pagination: {
|
|
9286
|
+
/** @description Pagination settings. */
|
|
9287
|
+
appliedFilter: {
|
|
9288
|
+
/** @description Page index (starting from 0)
|
|
9289
|
+
* @default 0 */
|
|
9290
|
+
page: number;
|
|
9291
|
+
/** @description Number of records per page.
|
|
9292
|
+
* @default 100 */
|
|
9293
|
+
perPage: number;
|
|
9294
|
+
};
|
|
9295
|
+
};
|
|
9296
|
+
};
|
|
9297
|
+
|
|
9260
9298
|
export { };
|
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
|
})
|