@softwear/latestcollectioncore 1.0.110 → 1.0.112

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.
@@ -30,7 +30,6 @@ let globalNrAggegationExpressions = 0; // tracks the # aggregations rows so we c
30
30
  * TODO: Functional: Experiment with curried functions
31
31
  */
32
32
  function propFunction(propertyName, getPropertyName, obj) {
33
- var _a, _b;
34
33
  const positionOfDot = propertyName.indexOf('.');
35
34
  if (positionOfDot < 0)
36
35
  return obj[propertyName];
@@ -38,7 +37,7 @@ function propFunction(propertyName, getPropertyName, obj) {
38
37
  const field = propertyName.substring(positionOfDot + 1);
39
38
  if (table == 'transaction')
40
39
  return obj[field];
41
- return ((_b = (_a = globalRelations[table]) === null || _a === void 0 ? void 0 : _a[obj[globalJoinableTables[table]]]) === null || _b === void 0 ? void 0 : _b[field]) || '~ ?';
40
+ return globalRelations[table]?.[obj[globalJoinableTables[table]]]?.[field] || '~ ?';
42
41
  }
43
42
  const lower = (s) => s.toLowerCase();
44
43
  const upper = (s) => s.toUpperCase();
@@ -167,10 +166,13 @@ function aggregator({ beginTimestamp, endTimestamp, filterExpression, aggregatio
167
166
  const sku = globalRelations['sku'][transaction.ean];
168
167
  if (!transaction.vector)
169
168
  transaction.vector = transaction_1.default.buildVector(transaction);
170
- if (Array.isArray(transaction.vector))
171
- transaction.vector = Float64Array.from(transaction.vector);
169
+ if (Array.isArray(transaction.vector)) {
170
+ const tmp = new Float64Array(AMOUNT_SOLD_DISCOUNT + 1);
171
+ tmp.set(transaction.vector);
172
+ transaction.vector = tmp;
173
+ }
172
174
  const v = transaction.vector;
173
- v[AMOUNT_SOLD_MAX] = (0, index_1.round2)(((sku === null || sku === void 0 ? void 0 : sku.price) || 0) * v[QTY_SOLD]);
175
+ v[AMOUNT_SOLD_MAX] = (0, index_1.round2)((sku?.price || 0) * v[QTY_SOLD]);
174
176
  v[AMOUNT_SOLD_DISCOUNT] = (0, index_1.round2)(v[AMOUNT_SOLD_MAX] - v[AMOUNT_SOLD]);
175
177
  }
176
178
  if (totals)
@@ -30,7 +30,7 @@ function default_1(brands, strategy) {
30
30
  brands.forEach(({ id, propertyMapping }) => {
31
31
  if (!indexedByBrandPropertyMapping[id])
32
32
  indexedByBrandPropertyMapping[id] = {};
33
- propertyMapping === null || propertyMapping === void 0 ? void 0 : propertyMapping.forEach((mapping) => {
33
+ propertyMapping?.forEach((mapping) => {
34
34
  if (!indexedByBrandPropertyMapping[id][mapping.category])
35
35
  indexedByBrandPropertyMapping[id][mapping.category] = {};
36
36
  indexedByBrandPropertyMapping[id][mapping.category][mapping.from] = mapping.to;
@@ -41,9 +41,8 @@ function default_1(brands, strategy) {
41
41
  const brand = sku.BRANDHASH || (0, index_1.hashBrand)(sku.brand);
42
42
  const mapping = indexedByBrandPropertyMapping[brand];
43
43
  mappingPairs.forEach((pair) => {
44
- var _a;
45
44
  const from = evaluateFromExpr(sku, pair.from) || '';
46
- const to = (_a = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _a === void 0 ? void 0 : _a[from];
45
+ const to = mapping?.[pair.category]?.[from];
47
46
  if (!from || !to)
48
47
  return;
49
48
  if (sku[pair.to] == to || from == sku[pair.to])
@@ -56,11 +55,10 @@ function default_1(brands, strategy) {
56
55
  const brand = sku.BRANDHASH || (0, index_1.hashBrand)(sku.brand);
57
56
  const mapping = indexedByBrandPropertyMapping[brand];
58
57
  mappingPairs.forEach((pair) => {
59
- var _a, _b, _c, _d, _e;
60
58
  const from = evaluateFromExpr(sku, pair.from) || '';
61
- const redirectedMappingSource = ((_a = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _a === void 0 ? void 0 : _a['~~']) || pair.defaultMappingSource;
59
+ const redirectedMappingSource = mapping?.[pair.category]?.['~~'] || pair.defaultMappingSource;
62
60
  const redirectedMapping = redirectedMappingSource ? indexedByBrandPropertyMapping[redirectedMappingSource] : {};
63
- const to = ((_b = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _b === void 0 ? void 0 : _b[from]) || ((_c = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _c === void 0 ? void 0 : _c['']) || ((_d = redirectedMapping === null || redirectedMapping === void 0 ? void 0 : redirectedMapping[pair.category]) === null || _d === void 0 ? void 0 : _d[from]) || ((_e = redirectedMapping === null || redirectedMapping === void 0 ? void 0 : redirectedMapping[pair.category]) === null || _e === void 0 ? void 0 : _e['']);
61
+ const to = mapping?.[pair.category]?.[from] || mapping?.[pair.category]?.[''] || redirectedMapping?.[pair.category]?.[from] || redirectedMapping?.[pair.category]?.[''];
64
62
  if (to == undefined)
65
63
  sku[pair.to] = '***';
66
64
  });
@@ -70,13 +68,12 @@ function default_1(brands, strategy) {
70
68
  const brand = sku.BRANDHASH || (0, index_1.hashBrand)(sku.brand);
71
69
  const mapping = indexedByBrandPropertyMapping[brand];
72
70
  mappingPairs.forEach((pair) => {
73
- var _a, _b, _c, _d, _e;
74
71
  if (sku[pair.to])
75
72
  return; // Do not replace sku-level-user-supplied values
76
73
  const from = evaluateFromExpr(sku, pair.from);
77
- const redirectedMappingSource = ((_a = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _a === void 0 ? void 0 : _a['~~']) || pair.defaultMappingSource;
74
+ const redirectedMappingSource = mapping?.[pair.category]?.['~~'] || pair.defaultMappingSource;
78
75
  const redirectedMapping = redirectedMappingSource ? indexedByBrandPropertyMapping[redirectedMappingSource] : {};
79
- const to = ((_b = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _b === void 0 ? void 0 : _b[from]) || ((_c = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _c === void 0 ? void 0 : _c['']) || ((_d = redirectedMapping === null || redirectedMapping === void 0 ? void 0 : redirectedMapping[pair.category]) === null || _d === void 0 ? void 0 : _d[from]) || ((_e = redirectedMapping === null || redirectedMapping === void 0 ? void 0 : redirectedMapping[pair.category]) === null || _e === void 0 ? void 0 : _e['']);
76
+ const to = mapping?.[pair.category]?.[from] || mapping?.[pair.category]?.[''] || redirectedMapping?.[pair.category]?.[from] || redirectedMapping?.[pair.category]?.[''];
80
77
  if (!from && !to)
81
78
  return;
82
79
  if (pair.mustMatch) {
@@ -0,0 +1,6 @@
1
+ import { MarkedSkuI } from './types';
2
+ declare const _default: {
3
+ skusToPricat: (skus: MarkedSkuI[], fromGLN: string, toGLN: string, supplierGLN: string, refID: number, date: string) => any[];
4
+ pricatToCsv: (pricat: any) => string;
5
+ };
6
+ export default _default;
@@ -0,0 +1,334 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const skusToPricat = function (skus, fromGLN, toGLN, supplierGLN, refID, date) {
4
+ const pricat = [];
5
+ if (typeof fromGLN != 'string' || fromGLN.length != 13)
6
+ return [];
7
+ if (typeof toGLN != 'string' || toGLN.length != 13)
8
+ return [];
9
+ if (typeof supplierGLN != 'string' || supplierGLN.length != 13)
10
+ return [];
11
+ if (typeof refID != 'number' || !refID)
12
+ return [];
13
+ if (typeof date != 'string' || date.length != 8)
14
+ return [];
15
+ const brand = skus[0]?.brand;
16
+ if (!brand)
17
+ return [];
18
+ if (!skus.every((sku) => sku.brand == brand))
19
+ return [];
20
+ const env = { Tag: 'ENV', SenderGLN: fromGLN, RecipientGLN: toGLN, InterchangeReference: refID };
21
+ const hdr = {
22
+ Tag: 'HDR',
23
+ DocumentType: '9',
24
+ DocumentName: `"Via LatestCollection:${brand}"`.substring(0, 35),
25
+ DocumentFunction: '"9"',
26
+ DocumentDate: date,
27
+ VATPercentage: 21,
28
+ SupplierGLN: supplierGLN,
29
+ };
30
+ const grp = { Tag: 'GRP', 'Product Group Type': '3' };
31
+ pricat.push(env);
32
+ pricat.push(hdr);
33
+ pricat.push(grp);
34
+ let lineNumber = 1;
35
+ skus.forEach((sku) => {
36
+ const lin = {
37
+ Tag: 'LIN',
38
+ LineNumber: lineNumber++,
39
+ GTIN: sku.id || sku.barcode,
40
+ ItemNumberSupplier: sku.articleCode || sku.articleCodeSupplier,
41
+ ItemName: sku.articleDescription,
42
+ SupplierSize: (sku.mainSize || sku.sizeSupplier || '').replaceAll('"', ''),
43
+ SupplierSubSize: sku.subSize?.replaceAll('"', '') || '',
44
+ 'Purchase Price': sku.buyPrice || 0,
45
+ SuggestedRetailPrice: sku.price || 0,
46
+ BrandName: sku.brand,
47
+ ProductGroupSupplier: sku.articleGroupSupplier || '',
48
+ ProductGroupNameSupplier: sku.articleGroup,
49
+ SeasonSupplier: sku.collectionSupplier || sku.collection,
50
+ SeasonIndustry: sku.collection || sku.collectionSupplier,
51
+ ColourSupplier: sku.colorSupplier || sku.colorFamily,
52
+ ColourCodeSupplier: sku.colorCodeSupplier || sku.colorCode,
53
+ MaterialName: sku['_quality'] || '',
54
+ Gender: sku['_gender'] || '',
55
+ Images: sku.images || '',
56
+ };
57
+ pricat.push(lin);
58
+ });
59
+ return pricat;
60
+ };
61
+ const pricatToCsv = function (pricat) {
62
+ if (!pricat || pricat.length == 0)
63
+ return '';
64
+ const env = pricat[0];
65
+ const envValues = ['"ENV"', env.SenderGLN, env.RecipientGLN, env.InterchangeReference, 0, '"FUEB 5.00"', null, null, null, null, null];
66
+ const envString = envValues.join(',') + '\n';
67
+ //
68
+ //
69
+ //
70
+ //
71
+ //
72
+ //
73
+ //
74
+ //
75
+ //
76
+ //
77
+ //
78
+ //
79
+ //
80
+ //
81
+ //
82
+ //
83
+ //
84
+ //
85
+ //
86
+ //
87
+ //
88
+ //
89
+ const hdr = pricat[1];
90
+ const hdrValues = [
91
+ '"HDR"',
92
+ '"9"',
93
+ null,
94
+ hdr.DocumentName,
95
+ hdr.DocumentFunction,
96
+ hdr.DocumentDate,
97
+ null,
98
+ null,
99
+ null,
100
+ null,
101
+ null,
102
+ '"EUR"',
103
+ null,
104
+ null,
105
+ null,
106
+ hdr.SupplierGLN,
107
+ null,
108
+ null,
109
+ null,
110
+ null,
111
+ null,
112
+ null,
113
+ null,
114
+ null,
115
+ null,
116
+ null,
117
+ null,
118
+ null,
119
+ null,
120
+ null,
121
+ null,
122
+ null,
123
+ env.RecipientGLN,
124
+ null,
125
+ null,
126
+ null,
127
+ null,
128
+ null,
129
+ null,
130
+ null,
131
+ null,
132
+ null,
133
+ null,
134
+ null,
135
+ null,
136
+ null,
137
+ null,
138
+ ];
139
+ const hdrString = hdrValues.join(',') + '\n';
140
+ const grpString = `"GRP","3",,"91",\n`;
141
+ //
142
+ // These comment lines are added to align the linenumbers in the texteditor with positionnumbers in the documentation of Fashion United PRICAT 5.00
143
+ // This makes it easier to verify if a given value is alligned in the collect position
144
+ //
145
+ //
146
+ //
147
+ //
148
+ //
149
+ //
150
+ //
151
+ //
152
+ //
153
+ //
154
+ //
155
+ //
156
+ //
157
+ //
158
+ //
159
+ //
160
+ //
161
+ //
162
+ //
163
+ //
164
+ //
165
+ //
166
+ //
167
+ //
168
+ //
169
+ //
170
+ //
171
+ //
172
+ //
173
+ //
174
+ //
175
+ //
176
+ const lines = [];
177
+ pricat
178
+ .filter((r) => r.Tag == 'LIN')
179
+ .forEach((r) => {
180
+ const linValues = [
181
+ '"LIN"',
182
+ r.LineNumber,
183
+ 1,
184
+ `"${r.GTIN.length == 13 ? 'EAN' : 'UPC'}"`,
185
+ r.GTIN,
186
+ `"${r.ItemNumberSupplier}"`,
187
+ null,
188
+ null,
189
+ null,
190
+ null,
191
+ null,
192
+ null,
193
+ null,
194
+ null,
195
+ null,
196
+ null,
197
+ null,
198
+ `"${r.ProductGroupSupplier}"`,
199
+ `"${r.ProductGroupNameSupplier}"`,
200
+ null,
201
+ null,
202
+ null,
203
+ null,
204
+ null,
205
+ null,
206
+ `"${r.BrandName}"`,
207
+ `"${r.BrandName}"`,
208
+ null,
209
+ null,
210
+ null,
211
+ null,
212
+ null,
213
+ `"${r.ItemName}"`,
214
+ null,
215
+ null,
216
+ `"${r.Gender}"`,
217
+ null,
218
+ null,
219
+ `"${r.SeasonSupplier}"`,
220
+ `"${r.SeasonIndustry}"`,
221
+ null,
222
+ `"${r.ColourCodeSupplier}"`,
223
+ `"${r.ColourSupplier}"`,
224
+ null,
225
+ null,
226
+ null,
227
+ null,
228
+ null,
229
+ null,
230
+ null,
231
+ null,
232
+ `"${r.SupplierSize}"`,
233
+ `"${r.SupplierSubSize}"`,
234
+ null,
235
+ null,
236
+ null,
237
+ null,
238
+ null,
239
+ null,
240
+ null,
241
+ null,
242
+ null,
243
+ null,
244
+ null,
245
+ null,
246
+ null,
247
+ null,
248
+ null,
249
+ null,
250
+ null,
251
+ null,
252
+ null,
253
+ null,
254
+ null,
255
+ null,
256
+ null,
257
+ null,
258
+ null,
259
+ null,
260
+ null,
261
+ null,
262
+ null,
263
+ null,
264
+ '"EUR"',
265
+ r['Purchase Price'],
266
+ null,
267
+ null,
268
+ r.SuggestedRetailPrice,
269
+ null,
270
+ null,
271
+ null,
272
+ null,
273
+ null,
274
+ null,
275
+ null,
276
+ null,
277
+ r.MaterialName,
278
+ null,
279
+ null,
280
+ null,
281
+ null,
282
+ null,
283
+ null,
284
+ null,
285
+ null,
286
+ null,
287
+ null,
288
+ null,
289
+ null,
290
+ null,
291
+ null,
292
+ null,
293
+ null,
294
+ null,
295
+ null,
296
+ null,
297
+ null,
298
+ null,
299
+ null,
300
+ null,
301
+ null,
302
+ null,
303
+ null,
304
+ null,
305
+ null,
306
+ null,
307
+ null,
308
+ null,
309
+ null,
310
+ null,
311
+ null,
312
+ null,
313
+ null,
314
+ null,
315
+ null,
316
+ null,
317
+ null,
318
+ null,
319
+ null,
320
+ null,
321
+ ];
322
+ lines.push(linValues.join(','));
323
+ if (r.Images) {
324
+ const images = r.Images.split(',');
325
+ images.forEach((image) => {
326
+ const picValues = [`"PIC"`, `""`, `""`, `""`, `""`, `""`, `""`, `""`, `"${image.includes('https://') ? image : 'https://' + image}"`];
327
+ lines.push(picValues.join(','));
328
+ });
329
+ }
330
+ });
331
+ const linString = lines.join('\n');
332
+ return envString + hdrString + grpString + linString;
333
+ };
334
+ exports.default = { skusToPricat, pricatToCsv };
@@ -14,7 +14,7 @@ const lookupAlternativeSkuInArray = function (skus, barcodeToFind) {
14
14
  if (barcodeToFind.length !== 13)
15
15
  return null;
16
16
  const prefix = barcodeToFind.substring(0, 12);
17
- const foundSku = skus.find((sku) => { var _a; return ((_a = sku.id) === null || _a === void 0 ? void 0 : _a.substring(0, 12)) === prefix; });
17
+ const foundSku = skus.find((sku) => sku.id?.substring(0, 12) === prefix);
18
18
  return foundSku ? foundSku : null;
19
19
  };
20
20
  /**
@@ -3,15 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  // This function combined the 3 levels of property mapping into one mapping object
4
4
  // Each level can be opted in/out in the tenantPreferences defined in the activeConfig parameter
5
5
  function default_1(activeConfig, metaBrandSetting, dataProviderBrandSetting, tenantBrandSetting) {
6
- var _a, _b, _c, _d, _e, _f;
7
6
  let allMappings = [];
8
- if ((_b = (_a = activeConfig === null || activeConfig === void 0 ? void 0 : activeConfig.products) === null || _a === void 0 ? void 0 : _a.applyLatestCollectionMapping) === null || _b === void 0 ? void 0 : _b.value)
7
+ if (activeConfig?.products?.applyLatestCollectionMapping?.value)
9
8
  allMappings = metaBrandSetting;
10
- if ((_d = (_c = activeConfig === null || activeConfig === void 0 ? void 0 : activeConfig.products) === null || _c === void 0 ? void 0 : _c.applyDataProviderMapping) === null || _d === void 0 ? void 0 : _d.value)
9
+ if (activeConfig?.products?.applyDataProviderMapping?.value)
11
10
  activeConfig.products.applyDataProviderMapping.value.forEach((provider) => {
12
- allMappings = allMappings.concat(dataProviderBrandSetting.filter((s) => s.dataProvider == provider).map((s) => (Object.assign(Object.assign({}, s), { id: s.id.split(":")[0] }))));
11
+ allMappings = allMappings.concat(dataProviderBrandSetting.filter((s) => s.dataProvider == provider).map((s) => ({ ...s, id: s.id.split(":")[0] })));
13
12
  });
14
- if ((_f = (_e = activeConfig === null || activeConfig === void 0 ? void 0 : activeConfig.products) === null || _e === void 0 ? void 0 : _e.applyTenantMapping) === null || _f === void 0 ? void 0 : _f.value)
13
+ if (activeConfig?.products?.applyTenantMapping?.value)
15
14
  allMappings = allMappings.concat(tenantBrandSetting);
16
15
  return allMappings;
17
16
  }
package/dist/index.d.ts CHANGED
@@ -11,5 +11,6 @@ export { default as round2 } from './round2';
11
11
  export { default as transaction } from './transaction';
12
12
  export { default as articleStatus } from './articleStatus';
13
13
  export { default as pivotTable } from './pivotTable';
14
+ export { default as edifact } from './edifact';
14
15
  export * from './types';
15
16
  export * from './consts';
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.pivotTable = exports.articleStatus = exports.transaction = exports.round2 = exports.findSkuByBarcode = exports.sizeToMap = exports.hasOnlyDigits = exports.hashBrand = exports.getPreferedPropertyMappings = exports.isean13 = exports.ean13 = exports.deepCopy = exports.buildPropertyMappingFn = void 0;
20
+ exports.edifact = exports.pivotTable = exports.articleStatus = exports.transaction = exports.round2 = exports.findSkuByBarcode = exports.sizeToMap = exports.hasOnlyDigits = exports.hashBrand = exports.getPreferedPropertyMappings = exports.isean13 = exports.ean13 = exports.deepCopy = exports.buildPropertyMappingFn = void 0;
21
21
  var buildPropertyMappingFn_1 = require("./buildPropertyMappingFn");
22
22
  Object.defineProperty(exports, "buildPropertyMappingFn", { enumerable: true, get: function () { return __importDefault(buildPropertyMappingFn_1).default; } });
23
23
  var deepCopy_1 = require("./deepCopy");
@@ -44,5 +44,7 @@ var articleStatus_1 = require("./articleStatus");
44
44
  Object.defineProperty(exports, "articleStatus", { enumerable: true, get: function () { return __importDefault(articleStatus_1).default; } });
45
45
  var pivotTable_1 = require("./pivotTable");
46
46
  Object.defineProperty(exports, "pivotTable", { enumerable: true, get: function () { return __importDefault(pivotTable_1).default; } });
47
+ var edifact_1 = require("./edifact");
48
+ Object.defineProperty(exports, "edifact", { enumerable: true, get: function () { return __importDefault(edifact_1).default; } });
47
49
  __exportStar(require("./types"), exports);
48
50
  __exportStar(require("./consts"), exports);
@@ -98,7 +98,7 @@ const buildVector = function (transaction) {
98
98
  vector[tv.COSTPRICE_SOLD] = (0, index_1.round2)(transaction.buyprice * transaction.qty);
99
99
  return vector;
100
100
  }
101
- if (transaction.type == types_1.transactionTypeE.RE_SOLD) {
101
+ if (transaction.type == types_1.transactionTypeE.B2B_SOLD) {
102
102
  const vector = new Float64Array(tv.COSTPRICE_B2B_SOLD + 1);
103
103
  vector[tv.QTY_TRANSACTION] = transaction.qty;
104
104
  vector[tv.QTY_STOCK] = -transaction.qty;
@@ -110,6 +110,18 @@ const buildVector = function (transaction) {
110
110
  vector[tv.COSTPRICE_B2B_SOLD] = (0, index_1.round2)(transaction.buyprice * transaction.qty);
111
111
  return vector;
112
112
  }
113
+ if (transaction.type == types_1.transactionTypeE.B2B_RE_SOLD) {
114
+ const vector = new Float64Array(tv.COSTPRICE_B2B_RESOLD + 1);
115
+ vector[tv.QTY_TRANSACTION] = transaction.qty;
116
+ vector[tv.QTY_STOCK] = -transaction.qty;
117
+ vector[tv.AMOUNT_STOCK] = (0, index_1.round2)(-transaction.buyprice * transaction.qty);
118
+ vector[tv.QTY_SHELF_STOCK] = -transaction.qty;
119
+ vector[tv.AMOUNT_SHELF_STOCK] = (0, index_1.round2)(-transaction.buyprice * transaction.qty);
120
+ vector[tv.QTY_B2B_RESOLD] = transaction.qty;
121
+ vector[tv.AMOUNT_B2B_RESOLD] = (0, index_1.round2)(transaction.sellprice * transaction.qty);
122
+ vector[tv.COSTPRICE_B2B_RESOLD] = (0, index_1.round2)(transaction.buyprice * transaction.qty);
123
+ return vector;
124
+ }
113
125
  if (transaction.type == types_1.transactionTypeE.TRANSIT) {
114
126
  const vector = new Float64Array(tv.AMOUNT_TRANSIT + 1);
115
127
  vector[tv.QTY_TRANSACTION] = transaction.qty;
package/dist/types.d.ts CHANGED
@@ -240,7 +240,8 @@ declare enum transactionTypeE {
240
240
  PURCHASE_ORDER = "14",
241
241
  PURCHASE_ORDER_COMPLETE = "15",
242
242
  MINIMUM_STOCK = "18",
243
- RE_SOLD = "93",
243
+ B2B_SOLD = "92",
244
+ B2B_RE_SOLD = "93",
244
245
  PICK_LIST = "94",
245
246
  ORDER = "96",
246
247
  RE_ORDER = "97",
package/dist/types.js CHANGED
@@ -46,7 +46,8 @@ var transactionTypeE;
46
46
  transactionTypeE["PURCHASE_ORDER"] = "14";
47
47
  transactionTypeE["PURCHASE_ORDER_COMPLETE"] = "15";
48
48
  transactionTypeE["MINIMUM_STOCK"] = "18";
49
- transactionTypeE["RE_SOLD"] = "93";
49
+ transactionTypeE["B2B_SOLD"] = "92";
50
+ transactionTypeE["B2B_RE_SOLD"] = "93";
50
51
  transactionTypeE["PICK_LIST"] = "94";
51
52
  transactionTypeE["ORDER"] = "96";
52
53
  transactionTypeE["RE_ORDER"] = "97";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwear/latestcollectioncore",
3
- "version": "1.0.110",
3
+ "version": "1.0.112",
4
4
  "description": "Core functions for LatestCollections applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -243,7 +243,11 @@ function aggregator({
243
243
  if (transaction.type == transactionTypeE.SALE) {
244
244
  const sku = globalRelations['sku'][transaction.ean]
245
245
  if (!transaction.vector) transaction.vector = transactionFunctions.buildVector(transaction)
246
- if (Array.isArray(transaction.vector)) transaction.vector = Float64Array.from(transaction.vector)
246
+ if (Array.isArray(transaction.vector)) {
247
+ const tmp = new Float64Array(AMOUNT_SOLD_DISCOUNT + 1)
248
+ tmp.set(transaction.vector)
249
+ transaction.vector = tmp
250
+ }
247
251
  const v = transaction.vector
248
252
  v[AMOUNT_SOLD_MAX] = round2((sku?.price || 0) * v[QTY_SOLD])
249
253
  v[AMOUNT_SOLD_DISCOUNT] = round2(v[AMOUNT_SOLD_MAX] - v[AMOUNT_SOLD])