meemup-library 1.2.18 → 1.2.19

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.
@@ -12,9 +12,9 @@ declare const _default: {
12
12
  getExtraSelectedItems(list: ISelectedProductExtra[], extraId: number): ISelectedExtraItem[];
13
13
  canAddToBasket(product: IProduct, selected: ISelectedProductExtra[], extras: IExtra[]): boolean;
14
14
  productModalToBasketItem(product: IProduct, selectedExtraList: ISelectedProductExtra[], extras: IExtra[], count: number, price: number, note: string): IOrderItem;
15
- productName(product: IProduct | IProduct): string;
16
- productImage(product: IProduct | IProduct): string;
17
- productPrice(product: IProduct | IProduct, orderType: EnumOrderType): number;
15
+ productName(product: IProduct): string;
16
+ productImage(product: IProduct): string;
17
+ productPrice(product: IProduct, orderType: EnumOrderType): number;
18
18
  baseItem(list: ISelectedProductExtra[], extraList: IExtra[]): TBaseExtra;
19
19
  defaultExtraOfProductToSelectedExtras(product: IProduct, extras: IExtra[]): ISelectedProductExtra[];
20
20
  defaultExtraOfProductToBasketItem(product: IProduct, extras: IExtra[], orderType: EnumOrderType): IOrderItem;
@@ -126,7 +126,8 @@ export default new class ProductModalController {
126
126
  cartItemId: -1,
127
127
  extraItemTitle: extraItem.title,
128
128
  extraTitle: ((_a = extras.find(i => i.id === extra.extraId)) === null || _a === void 0 ? void 0 : _a.title) + "",
129
- extraItemOptionId: extraItem.optionId
129
+ extraItemOptionId: extraItem.optionId,
130
+ extraItemOptionTitle: extraItem.optionTitle,
130
131
  });
131
132
  });
132
133
  });
@@ -187,6 +188,7 @@ export default new class ProductModalController {
187
188
  let selectedList = [];
188
189
  if (extraModel !== undefined) {
189
190
  value.items.forEach(it => {
191
+ var _a;
190
192
  let extraItemModel = extraModel.items.find((i) => i.id === it.extraItemId);
191
193
  if (extraItemModel !== undefined) {
192
194
  selectedList.push({
@@ -215,7 +217,8 @@ export default new class ProductModalController {
215
217
  packagingCost: extraItemModel.packagingCost,
216
218
  weight: extraItemModel.weight,
217
219
  options: extraItemModel.options,
218
- optionId: it.extraItemOptionId
220
+ optionId: it.extraItemOptionId,
221
+ optionTitle: ((_a = extraItemModel.options.find(i => i.id === it.extraItemOptionId)) === null || _a === void 0 ? void 0 : _a.title) + ""
219
222
  });
220
223
  }
221
224
  });
@@ -257,64 +260,6 @@ export default new class ProductModalController {
257
260
  }
258
261
  return list;
259
262
  }
260
- // pizzaSelectExtraPrice = (extra: IExtra, base: TBaseExtra, item: IExtraItem, selectedList: ISelectedExtraItem[] = []) => {
261
- //
262
- // let _item: ISelectedExtraItem | undefined = selectedList.find(i => i.id === item.id);
263
- //
264
- // if (_item !== undefined) {
265
- //
266
- // let p: number = +item.price;
267
- //
268
- // if (base[1] && base[1]?.increasingOtherExtraItemsPrice) {
269
- // // @ts-ignore
270
- // if (+base[0]?.extraId === +extra.id) return p;
271
- //
272
- // // @ts-ignore
273
- // const { increasingPriceType, increasingAmount, increasingPercentage } = base[0]?.selected[0];
274
- //
275
- // switch (increasingPriceType) {
276
- // case 1:
277
- // p += (item.price * increasingPercentage) / 100;
278
- // break;
279
- // case 2:
280
- // p += increasingAmount;
281
- // if (p < 0) p = 0;
282
- // break;
283
- // default:
284
- // break;
285
- // }
286
- // }
287
- //
288
- // if (extra.choosablePizzaToppingsSides) {
289
- // if (this.scaleSum(selectedList) <= extra.numberOfFreeItems)
290
- // return 0;
291
- //
292
- // let index = selectedList.findIndex((element) => +element.id === +item.id);
293
- //
294
- // if (index === -1)
295
- // return p;
296
- //
297
- // let sliceArray = selectedList.slice(0, index + 1);
298
- //
299
- // if (this.scaleSum(sliceArray) <= extra.numberOfFreeItems)
300
- // return 0;
301
- //
302
- // }
303
- //
304
- // return +p;
305
- // }
306
- // return 0;
307
- // };
308
- // scalePizzaSum(array: ISelectedExtraItem[] = []) {
309
- // let s = 0;
310
- // array.forEach((item) => {
311
- // s += item["quantity"] * item["scale"];
312
- // if (item.pizzaSide === EnumPizzaSide.right || item.pizzaSide === EnumPizzaSide.left)
313
- // s = parseInt((s / 2) + "");
314
- //
315
- // });
316
- // return s;
317
- // }
318
263
  scaleSum(array = []) {
319
264
  let s = 0;
320
265
  array.forEach((item) => {
@@ -420,16 +365,6 @@ export default new class ProductModalController {
420
365
  });
421
366
  return s;
422
367
  }
423
- // createSubtitle(items: ISelectedExtraItem[] = []): string {
424
- // if (items.length === 1) {
425
- // let { title, quantity } = items[0];
426
- // return (quantity > 1 ? quantity + "x " : "") + title;
427
- // } else if (items.length > 1) {
428
- // return this.quantitySum(items) + " Item selected";
429
- // } else {
430
- // return "";
431
- // }
432
- // };
433
368
  productMinAndMaxOptions(product) {
434
369
  let list = [];
435
370
  for (let index = product.minOrderQuantity; index <= product.maxOrderQuantity; index++) {
@@ -4,5 +4,6 @@ interface ISelectedExtraItem extends IExtraItem {
4
4
  quantity: number;
5
5
  pizzaSide: EnumPizzaSide;
6
6
  optionId: number;
7
+ optionTitle: string;
7
8
  }
8
9
  export default ISelectedExtraItem;
@@ -10,6 +10,7 @@ interface IOrderExtraItem {
10
10
  totalAmount: number;
11
11
  pizzaSide: number;
12
12
  text: string;
13
+ extraItemOptionTitle: string;
13
14
  extraItemOptionId: number;
14
15
  }
15
16
  export default IOrderExtraItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meemup-library",
3
- "version": "1.2.18",
3
+ "version": "1.2.19",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "remove:one": "rimraf dist",
12
12
  "remove:two": "rimraf ./src/dist",
13
13
  "test": "echo \"Error: no test specified\" && exit 1",
14
- "commit": "git add . && git commit -m \"version.1.2.18\" && git push origin "
14
+ "commit": "git add . && git commit -m \"version.1.2.19\" && git push origin "
15
15
  },
16
16
  "files": [
17
17
  "/dist"