meemup-library 1.2.18 → 1.2.20

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
  });
@@ -148,7 +149,8 @@ export default new class ProductModalController {
148
149
  relatedItemId: null,
149
150
  relatedProductId: null,
150
151
  additionalText: "",
151
- stampCardBonusItem: false
152
+ stampCardBonusItem: false,
153
+ taxable: product.taxable
152
154
  };
153
155
  }
154
156
  productName(product) {
@@ -187,6 +189,7 @@ export default new class ProductModalController {
187
189
  let selectedList = [];
188
190
  if (extraModel !== undefined) {
189
191
  value.items.forEach(it => {
192
+ var _a;
190
193
  let extraItemModel = extraModel.items.find((i) => i.id === it.extraItemId);
191
194
  if (extraItemModel !== undefined) {
192
195
  selectedList.push({
@@ -215,7 +218,8 @@ export default new class ProductModalController {
215
218
  packagingCost: extraItemModel.packagingCost,
216
219
  weight: extraItemModel.weight,
217
220
  options: extraItemModel.options,
218
- optionId: it.extraItemOptionId
221
+ optionId: it.extraItemOptionId,
222
+ optionTitle: ((_a = extraItemModel.options.find(i => i.id === it.extraItemOptionId)) === null || _a === void 0 ? void 0 : _a.title) + ""
219
223
  });
220
224
  }
221
225
  });
@@ -257,64 +261,6 @@ export default new class ProductModalController {
257
261
  }
258
262
  return list;
259
263
  }
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
264
  scaleSum(array = []) {
319
265
  let s = 0;
320
266
  array.forEach((item) => {
@@ -420,16 +366,6 @@ export default new class ProductModalController {
420
366
  });
421
367
  return s;
422
368
  }
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
369
  productMinAndMaxOptions(product) {
434
370
  let list = [];
435
371
  for (let index = product.minOrderQuantity; index <= product.maxOrderQuantity; index++) {
@@ -53,6 +53,7 @@ export default interface IProduct {
53
53
  packagingCosts: number;
54
54
  depositCost: number;
55
55
  tags: string[] | null;
56
+ taxable: boolean;
56
57
  thumbnailImage: string;
57
58
  weight: number;
58
59
  size: number;
@@ -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;
@@ -18,5 +18,6 @@ interface IOrderItem {
18
18
  promotionItem: boolean;
19
19
  promotionId: number;
20
20
  stampCardBonusItem: boolean;
21
+ taxable: boolean;
21
22
  }
22
23
  export default IOrderItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meemup-library",
3
- "version": "1.2.18",
3
+ "version": "1.2.20",
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.20\" && git push origin "
15
15
  },
16
16
  "files": [
17
17
  "/dist"