repzo-sap-absjo 1.0.24 → 1.0.25

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 CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  ### Added
6
6
 
7
+ - [util] in method: getUniqueConcatenatedValues, also add the promotions for items.buy @maramalshen
7
8
  - [actions/***] add 2 keys in integration_meta: sync_to_sap_started & sync_to_sap_succeeded @maramalshen
8
9
  - [commands/product] assign Foreign Name (ITEMDESCF) in SAP to local_name in Repzo @maramalshen
9
10
  - [actions/payment] add the field UserId where it equals USERID of the SAP API REP @maramalshen
package/lib/util.js CHANGED
@@ -198,7 +198,7 @@ export const getUniqueConcatenatedValues = function (
198
198
  delimiter,
199
199
  all_promos
200
200
  ) {
201
- var _a, _b, _c;
201
+ var _a, _b, _c, _d, _e, _f, _g;
202
202
  item.general_promotions = item.general_promotions || [];
203
203
  item.used_promotions = item.used_promotions || [];
204
204
  const allPromotions = [...item.general_promotions, ...item.used_promotions];
@@ -212,6 +212,38 @@ export const getUniqueConcatenatedValues = function (
212
212
  : _c.promotion;
213
213
  if (promo_id && all_promos[promo_id])
214
214
  allPromotions.push(all_promos[promo_id]);
215
+ } else if (
216
+ (_e =
217
+ (_d = item.promotions) === null || _d === void 0
218
+ ? void 0
219
+ : _d.bookings) === null || _e === void 0
220
+ ? void 0
221
+ : _e.length
222
+ ) {
223
+ const promos = {};
224
+ (_g =
225
+ (_f = item.promotions) === null || _f === void 0
226
+ ? void 0
227
+ : _f.bookings) === null || _g === void 0
228
+ ? void 0
229
+ : _g.forEach((booking) => {
230
+ if (
231
+ booking === null || booking === void 0 ? void 0 : booking.promotion
232
+ ) {
233
+ promos[
234
+ booking === null || booking === void 0
235
+ ? void 0
236
+ : booking.promotion
237
+ ] =
238
+ booking === null || booking === void 0
239
+ ? void 0
240
+ : booking.promotion;
241
+ }
242
+ });
243
+ for (let promo_id in promos) {
244
+ if (promo_id && all_promos[promo_id])
245
+ allPromotions.push(all_promos[promo_id]);
246
+ }
215
247
  }
216
248
  const uniqueValues = new Set(
217
249
  allPromotions.map((promotion) => promotion[key]).filter((value) => value)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "repzo-sap-absjo",
3
3
  "description": "repzo SAP ABS jo integration",
4
- "version": "1.0.24",
4
+ "version": "1.0.25",
5
5
  "homepage": "",
6
6
  "keywords": [],
7
7
  "author": {
package/src/util.ts CHANGED
@@ -260,6 +260,17 @@ export const getUniqueConcatenatedValues = function (
260
260
  const promo_id = item.promotions.bookings?.[0]?.promotion;
261
261
  if (promo_id && all_promos[promo_id])
262
262
  allPromotions.push(all_promos[promo_id]);
263
+ } else if (item.promotions?.bookings?.length) {
264
+ const promos: { [promo_id: string]: string } = {};
265
+ item.promotions?.bookings?.forEach((booking) => {
266
+ if (booking?.promotion) {
267
+ promos[booking?.promotion] = booking?.promotion;
268
+ }
269
+ });
270
+ for (let promo_id in promos) {
271
+ if (promo_id && all_promos[promo_id])
272
+ allPromotions.push(all_promos[promo_id]);
273
+ }
263
274
  }
264
275
  const uniqueValues = new Set(
265
276
  allPromotions.map((promotion) => promotion[key]).filter((value) => value)