@licklist/design 0.44.550-dev.7 → 0.44.550

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.
Files changed (82) hide show
  1. package/dist/events/event-card/utils.d.ts.map +1 -1
  2. package/dist/events/event-card/utils.js +1 -1
  3. package/dist/events/event-statistic-modal/utils/index.d.ts +4 -10
  4. package/dist/events/event-statistic-modal/utils/index.d.ts.map +1 -1
  5. package/dist/events/event-statistic-modal/utils/index.js +1 -1
  6. package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts +1 -1
  7. package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts.map +1 -1
  8. package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts +2 -4
  9. package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts.map +1 -1
  10. package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts +2 -4
  11. package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts.map +1 -1
  12. package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts +1 -1
  13. package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts.map +1 -1
  14. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
  15. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
  16. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts +3 -4
  17. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts.map +1 -1
  18. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.js +1 -1
  19. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +4 -3
  20. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
  21. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +2 -4
  22. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
  23. package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
  24. package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts +1 -1
  25. package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts.map +1 -1
  26. package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts +1 -1
  27. package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts.map +1 -1
  28. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts +1 -1
  29. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
  30. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +1 -1
  31. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  32. package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +2 -2
  33. package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
  34. package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
  35. package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
  36. package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts +2 -2
  37. package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts.map +1 -1
  38. package/dist/iframe/payment/payment-status-page/PaymentStatusPage.js +1 -1
  39. package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts +2 -2
  40. package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts.map +1 -1
  41. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  42. package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts +1 -3
  43. package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts.map +1 -1
  44. package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.js +1 -1
  45. package/dist/styles/iframe-order-process/IframeOrderProcess.scss +4 -6
  46. package/dist/styles/sales/BookingResults.scss +1 -1
  47. package/dist/types/iframe.d.ts +50 -2
  48. package/dist/types/iframe.d.ts.map +1 -1
  49. package/package.json +3 -3
  50. package/src/events/event-card/utils.ts +2 -10
  51. package/src/events/event-statistic-modal/EventStatisticModal.stories.tsx +0 -51
  52. package/src/events/event-statistic-modal/utils/index.ts +45 -81
  53. package/src/events/event-venue-map/components/MapPoint/MapPoint.tsx +1 -1
  54. package/src/iframe/event/event-booking-products/EventBookingProducts.tsx +3 -4
  55. package/src/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.tsx +4 -8
  56. package/src/iframe/event/event-order-summary/EventOrderSummary.tsx +2 -0
  57. package/src/iframe/order-process/components/BookingSummary/BookingSummary.stories.tsx +31 -46
  58. package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +19 -12
  59. package/src/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.tsx +66 -48
  60. package/src/iframe/order-process/components/BookingSummary/types/index.ts +4 -3
  61. package/src/iframe/order-process/components/BookingSummary/utils/index.ts +2 -11
  62. package/src/iframe/order-process/components/CalendarStepsForm/components/Category.tsx +1 -1
  63. package/src/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.tsx +1 -4
  64. package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +1 -4
  65. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -4
  66. package/src/iframe/order-process/components/utils/useCategoryVerification.ts +2 -3
  67. package/src/iframe/payment/payment-page/PaymentPage.tsx +6 -5
  68. package/src/iframe/payment/payment-status-page/PaymentStatusPage.tsx +26 -13
  69. package/src/iframe/payment/payment-status-page/component/PaymentStatusBody.tsx +2 -2
  70. package/src/product-set/control/DateAndRecurrenceInput.tsx +1 -2
  71. package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.tsx +4 -17
  72. package/src/styles/iframe-order-process/IframeOrderProcess.scss +4 -6
  73. package/src/styles/sales/BookingResults.scss +1 -1
  74. package/src/types/iframe.ts +58 -2
  75. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts +0 -10
  76. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +0 -1
  77. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +0 -1
  78. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts +0 -2
  79. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts.map +0 -1
  80. package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +0 -43
  81. package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/index.ts +0 -1
  82. package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.stories.tsx +0 -48
@@ -1,3 +1,51 @@
1
- import { OrderItems } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
2
- export type SetOrderFn = (val: OrderItems | ((prevVar: OrderItems) => OrderItems)) => void;
1
+ import { Product as CoreProduct } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
2
+ import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
3
+ export interface Product {
4
+ id: number;
5
+ name: string;
6
+ description: string;
7
+ deposit: number;
8
+ price: number;
9
+ minSub?: number;
10
+ minAmount?: number;
11
+ maxAmount?: number;
12
+ minSpend?: number | null;
13
+ isSoldOut?: boolean;
14
+ isRequired?: boolean;
15
+ isUnlimited?: boolean;
16
+ images: CoreProduct["images"];
17
+ capacity?: number | null;
18
+ uuid: string;
19
+ }
20
+ export interface ProductCategory {
21
+ id: number;
22
+ name: string;
23
+ allowDeposits?: boolean;
24
+ remainderExpireAfter?: number | null;
25
+ minSubItems: number | null;
26
+ maxSubItems: number | null;
27
+ products?: Product[];
28
+ zone?: Zone | null;
29
+ }
30
+ export interface MenuStep {
31
+ id: number;
32
+ name: string;
33
+ productCategories?: ProductCategory[];
34
+ }
35
+ export interface Menu {
36
+ id: number;
37
+ menuSteps: MenuStep[];
38
+ }
39
+ export interface Order {
40
+ id: number;
41
+ quantity: number;
42
+ price: number;
43
+ name: string;
44
+ productsCategoryId: number;
45
+ deposit?: number | null;
46
+ }
47
+ export type SetOrderFn = (val: Record<number, Order> | ((prevVar: Record<number, Order>) => Record<number, Order>)) => void;
48
+ export type WizardFormValues = {
49
+ [key: string]: any;
50
+ };
3
51
  //# sourceMappingURL=iframe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../../src/types/iframe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wDAAwD,CAAC;AAEpF,MAAM,MAAM,UAAU,GAAG,CACvB,GAAG,EAAE,UAAU,GAAG,CAAC,CAAC,OAAO,EAAE,UAAU,KAAK,UAAU,CAAC,KACpD,IAAI,CAAC"}
1
+ {"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../../src/types/iframe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAE9E,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB;AAID,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,MAAM,UAAU,GAAG,CACvB,GAAG,EACC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACrB,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,KAC5D,IAAI,CAAC;AAEV,MAAM,MAAM,gBAAgB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.550-dev.7",
3
+ "version": "0.44.550",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -53,9 +53,9 @@
53
53
  "@fortawesome/free-brands-svg-icons": "5.15.2",
54
54
  "@fortawesome/free-solid-svg-icons": "5.15.2",
55
55
  "@fortawesome/react-fontawesome": "0.1.9",
56
- "@licklist/core": ">=0.15.41-dev.0 < 0.15.41",
56
+ "@licklist/core": "0.15.x",
57
57
  "@licklist/eslint-config": "0.3.4",
58
- "@licklist/plugins": ">=0.20.133-dev.5 < 0.20.133",
58
+ "@licklist/plugins": "0.20.x",
59
59
  "@mdx-js/react": "1.6.22",
60
60
  "@popperjs/core": "2.11.8",
61
61
  "@react-aria/utils": "3.9.0",
@@ -103,19 +103,11 @@ export const getStatisticInfo = (
103
103
  .toFormat(DATE_FORMAT);
104
104
  const summaryFormattedDate = DateTime.fromISO(date)
105
105
  .toUTC()
106
- .toFormat(DATE_FORMAT);
107
-
108
- const summaryDays =
109
- Object.keys(eventStatistic?.productCategorySummary)?.filter(
110
- (date) =>
111
- DateTime.fromFormat(date, DATE_TIME_FULL_FORMAT).toFormat(
112
- DATE_FORMAT
113
- ) === summaryFormattedDate
114
- ) ?? [];
106
+ .toFormat(DATE_TIME_FULL_FORMAT);
115
107
 
116
108
  const totalViews = calculateTotalViews([viewsFormattedDate], eventStatistic);
117
109
  const [totalSold, totalAmount] = calculateTotalSoldAndAmount(
118
- summaryDays,
110
+ [summaryFormattedDate],
119
111
  eventStatistic
120
112
  );
121
113
 
@@ -91,57 +91,6 @@ Default.args = {
91
91
  ],
92
92
  },
93
93
  ],
94
- "2023-08-31 10:35:00": [
95
- {
96
- eventId: 1236,
97
- categoryName: "ticket",
98
- totalPerCategory: 1300,
99
- productsSummary: [
100
- {
101
- id: 221,
102
- name: "VIP",
103
- productsSold: 13,
104
- totalQuantity: 25,
105
- total: 1300,
106
- },
107
- ],
108
- },
109
- {
110
- eventId: 1236,
111
- categoryName: "booking cat",
112
- totalPerCategory: 275,
113
- productsSummary: [
114
- {
115
- id: 222,
116
- name: "Table booking",
117
- productsSold: 11,
118
- totalQuantity: null,
119
- total: 275,
120
- },
121
- ],
122
- },
123
- {
124
- eventId: 1236,
125
- categoryName: "Menu",
126
- totalPerCategory: 450,
127
- productsSummary: [
128
- {
129
- id: 223,
130
- name: "Wine 1 bottle",
131
- productsSold: 9,
132
- totalQuantity: null,
133
- total: 360,
134
- },
135
- {
136
- id: 224,
137
- name: "caesar salad",
138
- productsSold: 9,
139
- totalQuantity: null,
140
- total: 90,
141
- },
142
- ],
143
- },
144
- ],
145
94
  },
146
95
  },
147
96
  };
@@ -8,19 +8,6 @@ export const TRANSLATION_KEYS = {
8
8
  totalPerCategory: "totalPerCategory",
9
9
  };
10
10
 
11
- type TableDataRecord = {
12
- name: string;
13
- key: string;
14
- isHeader?: boolean;
15
- isBold?: boolean;
16
- quantity: string;
17
- total: string;
18
- metadata?: {
19
- _productsSold: number;
20
- _total: number;
21
- };
22
- };
23
-
24
11
  export const convertEventStatisticToTableData = (
25
12
  date: string,
26
13
  eventStatistic: EventStatistic
@@ -32,6 +19,15 @@ export const convertEventStatisticToTableData = (
32
19
  return [];
33
20
  }
34
21
 
22
+ const tableDataArray: {
23
+ name: string;
24
+ key: string;
25
+ isHeader?: boolean;
26
+ isBold?: boolean;
27
+ quantity: string | number;
28
+ total: string | number;
29
+ }[] = [];
30
+
35
31
  const summaryFormattedDate = DateTime.fromISO(date)
36
32
  .toUTC()
37
33
  .toFormat(DATE_FORMAT);
@@ -44,26 +40,16 @@ export const convertEventStatisticToTableData = (
44
40
  ) === summaryFormattedDate
45
41
  ) ?? [];
46
42
 
47
- const summaryMap = new Map<string, TableDataRecord>();
48
-
49
43
  summaryDays
50
44
  .map((day) => eventStatistic?.productCategorySummary[day])
51
- .flat()
52
- .sort((prev, next) =>
53
- prev.categoryName === next.categoryName
54
- ? 0
55
- : prev.categoryName > next.categoryName
56
- ? 1
57
- : -1
58
- )
59
- .forEach(
60
- ({ totalPerCategory, productsSummary = [], categoryName, eventId }) => {
61
- let quantity = 0;
45
+ .forEach((summaries) => {
46
+ summaries.forEach(
47
+ ({ totalPerCategory, productsSummary = [], categoryName, eventId }) => {
48
+ let quantity = 0;
62
49
 
63
- totalAmount += totalPerCategory || 0;
50
+ totalAmount += totalPerCategory || 0;
64
51
 
65
- if (!summaryMap.has(`${categoryName}`)) {
66
- summaryMap.set(`${categoryName}`, {
52
+ tableDataArray.push({
67
53
  name: categoryName,
68
54
  key: `${eventId}.${categoryName}`,
69
55
  isBold: true,
@@ -71,64 +57,42 @@ export const convertEventStatisticToTableData = (
71
57
  quantity: TRANSLATION_KEYS.shortQuantity,
72
58
  total: TRANSLATION_KEYS.total,
73
59
  });
74
- }
75
-
76
- productsSummary?.forEach(
77
- ({ productsSold, name, totalQuantity, total }) => {
78
- quantity += productsSold;
79
60
 
80
- const existingProduct = summaryMap.get(
81
- `${categoryName}.${name}`
82
- ) ?? {
83
- metadata: {
84
- _productsSold: 0,
85
- _total: 0,
86
- },
87
- };
88
-
89
- summaryMap.set(`${categoryName}.${name}`, {
90
- name,
91
- key: `${eventId}.${categoryName}.${name}`,
92
- quantity: totalQuantity
93
- ? `${
94
- existingProduct.metadata._productsSold + productsSold
95
- } / ${totalQuantity}`
96
- : String(existingProduct.metadata._productsSold + productsSold),
97
- total: String(existingProduct.metadata._total + total),
98
- metadata: {
99
- _productsSold:
100
- existingProduct.metadata._productsSold + productsSold,
101
- _total: existingProduct.metadata._total + total,
102
- },
103
- });
104
- }
105
- );
106
-
107
- const prevTotalPerCategory = summaryMap.get(
108
- `${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`
109
- ) ?? {
110
- quantity: 0,
111
- total: 0,
112
- };
113
- summaryMap.set(`${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`, {
114
- name: TRANSLATION_KEYS.totalPerCategory,
115
- key: `${eventId}.${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
116
- quantity: String(Number(prevTotalPerCategory.quantity) + quantity),
117
- total: String(Number(prevTotalPerCategory.total) + totalPerCategory),
118
- isBold: true,
119
- });
61
+ productsSummary?.forEach(
62
+ ({ productsSold, name, totalQuantity, total }) => {
63
+ quantity += productsSold;
64
+
65
+ tableDataArray.push({
66
+ name,
67
+ key: `${eventId}.${categoryName}.${name}`,
68
+ quantity: totalQuantity
69
+ ? `${productsSold} / ${totalQuantity}`
70
+ : String(productsSold),
71
+ total: String(total),
72
+ });
73
+ }
74
+ );
75
+
76
+ tableDataArray.push({
77
+ name: TRANSLATION_KEYS.totalPerCategory,
78
+ key: `${eventId}.${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
79
+ quantity,
80
+ total: totalPerCategory,
81
+ isBold: true,
82
+ });
120
83
 
121
- totalQuantity += quantity;
122
- }
123
- );
84
+ totalQuantity += quantity;
85
+ }
86
+ );
87
+ });
124
88
 
125
- summaryMap.set(`${TRANSLATION_KEYS.total}.${totalAmount}`, {
89
+ tableDataArray.push({
126
90
  name: TRANSLATION_KEYS.total,
127
91
  key: `${TRANSLATION_KEYS.total}.${totalAmount}`,
128
- quantity: String(totalQuantity),
129
- total: String(totalAmount),
92
+ quantity: totalQuantity,
93
+ total: totalAmount,
130
94
  isBold: true,
131
95
  });
132
96
 
133
- return [...summaryMap.values()];
97
+ return tableDataArray;
134
98
  };
@@ -3,7 +3,6 @@ import { Group } from "react-konva";
3
3
  import Konva from "konva";
4
4
  import { EventVenueMapContext } from "@licklist/plugins/dist/context/event/EventVenueMapContext";
5
5
  import { Point } from "@licklist/plugins/dist/types/context/event/point";
6
- import { Product } from "@licklist/plugins/dist/types/context/sale/menuSteps";
7
6
  import { ImageOffset } from "../../types";
8
7
  import { PointIcon } from "./components/PointIcon";
9
8
  import {
@@ -11,6 +10,7 @@ import {
11
10
  calculatePointsCoordinates,
12
11
  } from "../../utils";
13
12
  import { ProductIcon } from "./components/ProductIcon";
13
+ import { Product } from "../../../../types";
14
14
 
15
15
  type MapPointProps = Partial<Point> &
16
16
  ImageOffset & {
@@ -1,14 +1,13 @@
1
1
  import React from "react";
2
+
2
3
  import Accordion from "react-bootstrap/Accordion";
3
- import { OrderItems } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
4
- import { ProductCategory } from "@licklist/plugins/dist/types/context/sale/menuSteps";
5
- import { SetOrderFn } from "../../../types";
4
+ import { ProductCategory, Order, SetOrderFn } from "../../../types";
6
5
  import { AccordionItem } from "./components/AccordionItem";
7
6
 
8
7
  export interface EventBookingProductsProps {
9
8
  productsCategories?: ProductCategory[];
10
9
  setOrder: SetOrderFn;
11
- order: OrderItems;
10
+ order: Record<number, Order>;
12
11
  }
13
12
 
14
13
  export function EventBookingProducts({
@@ -1,18 +1,14 @@
1
1
  import React from "react";
2
2
  import clsx from "clsx";
3
3
  import { useIntl } from "react-intl";
4
+
4
5
  import Accordion from "react-bootstrap/Accordion";
5
6
  import Card from "react-bootstrap/Card";
6
7
  import { useAccordionToggle } from "react-bootstrap/AccordionToggle";
7
8
  import AccordionContext from "react-bootstrap/AccordionContext";
8
- import {
9
- OrderItem,
10
- OrderItems,
11
- } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
12
- import { Product } from "@licklist/plugins/dist/types/context/sale/menuSteps";
13
9
  import { NumberInput } from "../../../../../static";
14
10
  import Icon from "../../../../../static/Icon";
15
- import { SetOrderFn } from "../../../../../types";
11
+ import { Order, Product, SetOrderFn } from "../../../../../types";
16
12
 
17
13
  interface CustomToggleProps {
18
14
  eventKey: string;
@@ -23,7 +19,7 @@ interface AccordionItemProps {
23
19
  name: string;
24
20
  products: Product[];
25
21
  setOrder: SetOrderFn;
26
- order: Record<number, OrderItem>;
22
+ order: Record<number, Order>;
27
23
  productsCategoryId: number;
28
24
  }
29
25
 
@@ -90,7 +86,7 @@ interface ProductItemProps {
90
86
  name: string;
91
87
  price: number;
92
88
  description: string;
93
- order: OrderItems;
89
+ order: Record<number, Order>;
94
90
  setOrder: SetOrderFn;
95
91
  productsCategoryId: number;
96
92
  }
@@ -1,7 +1,9 @@
1
1
  import React from "react";
2
2
  import { useTranslation } from "react-i18next";
3
+
3
4
  import { StaticTable, StaticTableData } from "../../../table/StaticTable";
4
5
 
6
+ export { Order } from "../../../types";
5
7
  interface EventOrderSummaryProps {
6
8
  data: StaticTableData[];
7
9
  tableName?: string;
@@ -10,11 +10,11 @@ export default {
10
10
  const productCategories = [
11
11
  {
12
12
  id: 1,
13
- name: "cat 1",
13
+ name: "Early Bird General Admission",
14
14
  products: [
15
15
  {
16
- id: 11,
17
- name: "cat 1 prod 1",
16
+ id: 7,
17
+ name: "Beer",
18
18
  description: `Ticket <em>is</em> valid for students and non students.
19
19
  You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
20
20
  Ticket valid for entry before 11.30pm for 12.30am showtime.`,
@@ -23,8 +23,8 @@ const productCategories = [
23
23
  price: 1,
24
24
  },
25
25
  {
26
- id: 12,
27
- name: "cat 2 prod 2",
26
+ id: 8,
27
+ name: "Wine",
28
28
  description: `Ticket is valid for students and non students.
29
29
  You do not need <strong>student ID</strong> for this event but do require regular age ID e.g. driving licence or passport.
30
30
  Ticket valid for entry before 11.30pm for 12.30am showtime.`,
@@ -37,11 +37,11 @@ const productCategories = [
37
37
  },
38
38
  {
39
39
  id: 2,
40
- name: "cat 2",
40
+ name: "Nice",
41
41
  products: [
42
42
  {
43
- id: 21,
44
- name: "cat 2 prod 1",
43
+ id: 3,
44
+ name: "Beer",
45
45
  description: `Ticket is valid for students and non students.
46
46
  You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
47
47
  Ticket valid for entry before 11.30pm for 12.30am showtime.`,
@@ -50,8 +50,8 @@ const productCategories = [
50
50
  price: 1,
51
51
  },
52
52
  {
53
- id: 22,
54
- name: "cat 2 prod 2",
53
+ id: 5,
54
+ name: "Wine",
55
55
  description: `Ticket is valid for students and non students.
56
56
  You do not need <strong>student ID</strong> for this event but do require regular age ID e.g. driving licence or passport.
57
57
  Ticket valid for entry before 11.30pm for 12.30am showtime.`,
@@ -66,11 +66,11 @@ const productCategories = [
66
66
  const productCategories2 = [
67
67
  {
68
68
  id: 3,
69
- name: "cat 3",
69
+ name: "fine",
70
70
  products: [
71
71
  {
72
- id: 31,
73
- name: "cat 3 prod 1",
72
+ id: 9,
73
+ name: "Beer",
74
74
  description: `Ticket is valid for students and non students.
75
75
  You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
76
76
  Ticket valid for entry before 11.30pm for 12.30am showtime.`,
@@ -79,8 +79,8 @@ const productCategories2 = [
79
79
  price: 1,
80
80
  },
81
81
  {
82
- id: 32,
83
- name: "cat 3 prod 2",
82
+ id: 10,
83
+ name: "Wine",
84
84
  description: `Ticket is valid for students and non students.
85
85
  You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
86
86
  Ticket valid for entry before 11.30pm for 12.30am showtime.`,
@@ -90,15 +90,14 @@ const productCategories2 = [
90
90
  // isRequired: true,
91
91
  },
92
92
  ],
93
- zone: 1,
94
93
  },
95
94
  {
96
95
  id: 4,
97
- name: "cat 4",
96
+ name: "Twice",
98
97
  products: [
99
98
  {
100
- id: 41,
101
- name: "cat 4 prod 1",
99
+ id: 11,
100
+ name: "Beer",
102
101
  description: `Ticket is valid for students and non students.
103
102
  You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
104
103
  Ticket valid for entry before 11.30pm for 12.30am showtime.`,
@@ -107,8 +106,8 @@ const productCategories2 = [
107
106
  price: 1,
108
107
  },
109
108
  {
110
- id: 42,
111
- name: "cat 4 prod 1",
109
+ id: 12,
110
+ name: "Wine",
112
111
  description: `Ticket is valid for students and non students.
113
112
  You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
114
113
  Ticket valid for entry before 11.30pm for 12.30am showtime.`,
@@ -142,40 +141,26 @@ export function Default() {
142
141
  menuSteps={menuSteps as any}
143
142
  peopleAmount={5}
144
143
  formValues={{
145
- "11": {
146
- id: 11,
144
+ "3": {
145
+ id: 3,
147
146
  quantity: 1,
148
- name: "cat 1 prod 1",
147
+ name: "Beer",
149
148
  price: 0,
150
- productsCategoryId: 1,
149
+ productsCategoryId: 2,
151
150
  },
152
- "21": {
153
- id: 21,
151
+ "5": {
152
+ id: 5,
154
153
  quantity: 2,
155
- name: "cat 2 prod 1",
154
+ name: "Wine",
156
155
  price: 1,
157
156
  productsCategoryId: 2,
158
157
  },
159
- "31": {
160
- id: 31,
158
+ "7": {
159
+ id: 7,
161
160
  quantity: 4,
162
- name: "cat 3 prod 1",
161
+ name: "Beer",
163
162
  price: 1,
164
- productsCategoryId: 3,
165
- },
166
- "32": {
167
- id: 32,
168
- quantity: 4,
169
- name: "cat 3 prod 2",
170
- price: 1,
171
- productsCategoryId: 3,
172
- },
173
- "41": {
174
- id: 41,
175
- quantity: 4,
176
- name: "cat 4 prod 1",
177
- price: 1,
178
- productsCategoryId: 4,
163
+ productsCategoryId: 1,
179
164
  },
180
165
  }}
181
166
  totalWithDiscount={5}
@@ -1,9 +1,9 @@
1
- import React from "react";
1
+ import React, { useMemo } from "react";
2
2
  import { useTranslation } from "react-i18next";
3
3
  import { useIntl } from "react-intl";
4
4
  import * as Config from "@licklist/core/dist/Config";
5
- import { values } from "lodash";
6
5
  import { LoaderIndicator } from "../../../../static";
6
+ import { MenuStep, Order } from "../../../../types";
7
7
  import { ProductsByMenuStep } from "./components/ProductsByMenuStep";
8
8
  import { BookingSummaryProps } from "./types";
9
9
  import { SummaryTotal } from "./components/SummaryTotal";
@@ -13,11 +13,11 @@ export const BookingSummary = ({
13
13
  date,
14
14
  time,
15
15
  menuSteps,
16
- formValues = {},
16
+ formValues,
17
17
  shouldHidePeopleAmount,
18
18
  eventName,
19
19
  transactionFee = 0,
20
- productsWithErrors = [],
20
+ productsWithErrors,
21
21
  isLoading,
22
22
  hasPeopleInput,
23
23
  peopleAmount,
@@ -25,6 +25,15 @@ export const BookingSummary = ({
25
25
  const { t } = useTranslation("Design");
26
26
  const { formatNumber } = useIntl();
27
27
 
28
+ const orderProducts = useMemo(() => {
29
+ if (!formValues) {
30
+ return undefined;
31
+ }
32
+ const products = Object.values(formValues).filter(Boolean) as Order[];
33
+
34
+ return products?.filter((prod) => prod?.quantity !== 0);
35
+ }, [formValues]);
36
+
28
37
  if (isLoading) {
29
38
  return (
30
39
  <div className="payment-booking-summary">
@@ -43,20 +52,19 @@ export const BookingSummary = ({
43
52
  </div>
44
53
  <hr />
45
54
 
46
- {values(formValues)?.length > 0 ? (
55
+ {orderProducts?.length > 0 ? (
47
56
  <div>
48
57
  <div className="cart-items">
49
- <div className="products-by-menu-step">
50
- {menuSteps.map((menuStep) => (
58
+ {menuSteps.map((menuStep: MenuStep) => {
59
+ return (
51
60
  <ProductsByMenuStep
52
61
  key={menuStep.id}
53
- orderItems={formValues}
62
+ orderProducts={orderProducts}
54
63
  step={menuStep}
55
64
  productsWithErrors={productsWithErrors}
56
65
  />
57
- ))}
58
- </div>
59
-
66
+ );
67
+ })}
60
68
  {!shouldHidePeopleAmount && peopleAmount > 0 && (
61
69
  <>
62
70
  <hr />
@@ -66,7 +74,6 @@ export const BookingSummary = ({
66
74
  </div>
67
75
  </>
68
76
  )}
69
-
70
77
  {!!transactionFee && (
71
78
  <>
72
79
  <hr />