idosell 0.4.4 → 0.4.9

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/dist/helpers.js CHANGED
@@ -324,3 +324,20 @@ export const setOmp = (object, value = false, wholesale = false, mode = false) =
324
324
  }
325
325
  return { omnibusPrices };
326
326
  };
327
+ export const appendPackageParams = (object, id, defaultValue) => (value) => {
328
+ let current;
329
+ if (!value?.length)
330
+ value = defaultValue;
331
+ if (!value?.length)
332
+ return false;
333
+ const parcelParameters = object.params.parcelParameters ?? [];
334
+ if (parcelParameters.length) {
335
+ current = parcelParameters.find(item => item.id === id);
336
+ if (current)
337
+ current.value = value;
338
+ }
339
+ if (!current) {
340
+ parcelParameters.push({ id, value });
341
+ }
342
+ return { root: { parcelParameters: parcelParameters } };
343
+ };
@@ -1,6 +1,11 @@
1
1
  import { paramsProxy } from "../params.js";
2
+ import { appendPackageParams } from "../helpers.js";
2
3
  export default (object) => {
3
4
  object.gate = { method: 'post', node: '/packages/labels' };
5
+ object.custom = {
6
+ orderSn: (orderSn) => ({ root: { eventId: orderSn, eventType: "order" } }),
7
+ size: appendPackageParams(object, "defaultParcelGauge", "auto")
8
+ };
4
9
  object.appendable = {
5
10
  except: ["eventId", "eventType", "parcelParameters"],
6
11
  arrayNode: "parcelParametersByPackages",
@@ -10,7 +10,7 @@ export default (object) => {
10
10
  arrayNode: "productsAttachments",
11
11
  index: 0
12
12
  };
13
- object.req = ["attachmentUrl", "identValue", "productIdentType", "productIdent", "attachmentName", "langId", "attachmentFileType", "attachmentEnable", "attachmentDownloadLog"];
13
+ object.req = ["productIdent", { "any": ["attachments", "virtualAttachments"] }];
14
14
  object.arrays = ["productsAttachments"];
15
15
  return new Proxy(object, paramsProxy);
16
16
  };
@@ -2,8 +2,8 @@ import { paramsProxy } from "../params.js";
2
2
  export default (object) => {
3
3
  object.gate = { method: 'put', node: '/products/marketingZones' };
4
4
  object.appendable = {
5
- except: ["products", "assignment_mode", "marketing_zones", "shops"],
6
- arrayNode: "shops",
5
+ except: ["assignment_mode", "shops", "marketing_zones"],
6
+ arrayNode: "products",
7
7
  index: 0
8
8
  };
9
9
  object.req = ["ident"];