@licklist/design 0.44.550 → 0.44.551-dev.0

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 (95) hide show
  1. package/dist/calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
  2. package/dist/calendar/components/CalendarDates/CalendarDates.js +1 -1
  3. package/dist/date-time-button/DateContent.d.ts +2 -2
  4. package/dist/date-time-button/DateContent.d.ts.map +1 -1
  5. package/dist/date-time-button/DateContent.js +1 -1
  6. package/dist/date-time-button/DateTimeButton.d.ts +10 -6
  7. package/dist/date-time-button/DateTimeButton.d.ts.map +1 -1
  8. package/dist/date-time-button/DateTimeButton.js +1 -1
  9. package/dist/events/event-card/utils.d.ts.map +1 -1
  10. package/dist/events/event-card/utils.js +1 -1
  11. package/dist/events/event-statistic-modal/utils/index.d.ts +10 -4
  12. package/dist/events/event-statistic-modal/utils/index.d.ts.map +1 -1
  13. package/dist/events/event-statistic-modal/utils/index.js +1 -1
  14. package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts +1 -1
  15. package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts.map +1 -1
  16. package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts +4 -2
  17. package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts.map +1 -1
  18. package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts +4 -2
  19. package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts.map +1 -1
  20. package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts +1 -1
  21. package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts.map +1 -1
  22. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
  23. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
  24. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts +10 -0
  25. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +1 -0
  26. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +1 -0
  27. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts +2 -0
  28. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts.map +1 -0
  29. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts +4 -3
  30. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts.map +1 -1
  31. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.js +1 -1
  32. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +3 -4
  33. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
  34. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +4 -2
  35. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
  36. package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
  37. package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts +1 -1
  38. package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts.map +1 -1
  39. package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts +1 -1
  40. package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts.map +1 -1
  41. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts +1 -1
  42. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
  43. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +1 -1
  44. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  45. package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +2 -2
  46. package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
  47. package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
  48. package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
  49. package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts +2 -2
  50. package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts.map +1 -1
  51. package/dist/iframe/payment/payment-status-page/PaymentStatusPage.js +1 -1
  52. package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts +2 -2
  53. package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts.map +1 -1
  54. package/dist/index.js +1 -1
  55. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  56. package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts +3 -1
  57. package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts.map +1 -1
  58. package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.js +1 -1
  59. package/dist/styles/iframe-order-process/IframeOrderProcess.scss +6 -4
  60. package/dist/styles/sales/BookingResults.scss +1 -1
  61. package/dist/types/iframe.d.ts +2 -50
  62. package/dist/types/iframe.d.ts.map +1 -1
  63. package/package.json +3 -3
  64. package/src/calendar/components/CalendarDates/CalendarDates.tsx +3 -4
  65. package/src/date-time-button/DateContent.tsx +27 -9
  66. package/src/date-time-button/DateTimeButton.stories.tsx +13 -14
  67. package/src/date-time-button/DateTimeButton.tsx +35 -26
  68. package/src/events/event-card/utils.ts +10 -2
  69. package/src/events/event-statistic-modal/EventStatisticModal.stories.tsx +51 -0
  70. package/src/events/event-statistic-modal/utils/index.ts +81 -45
  71. package/src/events/event-venue-map/components/MapPoint/MapPoint.tsx +1 -1
  72. package/src/iframe/event/event-booking-products/EventBookingProducts.tsx +4 -3
  73. package/src/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.tsx +8 -4
  74. package/src/iframe/event/event-order-summary/EventOrderSummary.tsx +0 -2
  75. package/src/iframe/order-process/components/BookingSummary/BookingSummary.stories.tsx +46 -31
  76. package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +12 -19
  77. package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +43 -0
  78. package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/index.ts +1 -0
  79. package/src/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.tsx +48 -66
  80. package/src/iframe/order-process/components/BookingSummary/types/index.ts +3 -4
  81. package/src/iframe/order-process/components/BookingSummary/utils/index.ts +11 -2
  82. package/src/iframe/order-process/components/CalendarStepsForm/components/Category.tsx +1 -1
  83. package/src/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.tsx +4 -1
  84. package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +4 -1
  85. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +4 -1
  86. package/src/iframe/order-process/components/utils/useCategoryVerification.ts +3 -2
  87. package/src/iframe/payment/payment-page/PaymentPage.tsx +5 -6
  88. package/src/iframe/payment/payment-status-page/PaymentStatusPage.tsx +13 -26
  89. package/src/iframe/payment/payment-status-page/component/PaymentStatusBody.tsx +2 -2
  90. package/src/product-set/control/DateAndRecurrenceInput.tsx +2 -1
  91. package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.stories.tsx +48 -0
  92. package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.tsx +17 -4
  93. package/src/styles/iframe-order-process/IframeOrderProcess.scss +6 -4
  94. package/src/styles/sales/BookingResults.scss +1 -1
  95. package/src/types/iframe.ts +2 -58
@@ -91,6 +91,57 @@ 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
+ ],
94
145
  },
95
146
  },
96
147
  };
@@ -8,6 +8,19 @@ 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
+
11
24
  export const convertEventStatisticToTableData = (
12
25
  date: string,
13
26
  eventStatistic: EventStatistic
@@ -19,15 +32,6 @@ export const convertEventStatisticToTableData = (
19
32
  return [];
20
33
  }
21
34
 
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
-
31
35
  const summaryFormattedDate = DateTime.fromISO(date)
32
36
  .toUTC()
33
37
  .toFormat(DATE_FORMAT);
@@ -40,16 +44,26 @@ export const convertEventStatisticToTableData = (
40
44
  ) === summaryFormattedDate
41
45
  ) ?? [];
42
46
 
47
+ const summaryMap = new Map<string, TableDataRecord>();
48
+
43
49
  summaryDays
44
50
  .map((day) => eventStatistic?.productCategorySummary[day])
45
- .forEach((summaries) => {
46
- summaries.forEach(
47
- ({ totalPerCategory, productsSummary = [], categoryName, eventId }) => {
48
- let quantity = 0;
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;
49
62
 
50
- totalAmount += totalPerCategory || 0;
63
+ totalAmount += totalPerCategory || 0;
51
64
 
52
- tableDataArray.push({
65
+ if (!summaryMap.has(`${categoryName}`)) {
66
+ summaryMap.set(`${categoryName}`, {
53
67
  name: categoryName,
54
68
  key: `${eventId}.${categoryName}`,
55
69
  isBold: true,
@@ -57,42 +71,64 @@ export const convertEventStatisticToTableData = (
57
71
  quantity: TRANSLATION_KEYS.shortQuantity,
58
72
  total: TRANSLATION_KEYS.total,
59
73
  });
74
+ }
60
75
 
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
- });
76
+ productsSummary?.forEach(
77
+ ({ productsSold, name, totalQuantity, total }) => {
78
+ quantity += productsSold;
83
79
 
84
- totalQuantity += quantity;
85
- }
86
- );
87
- });
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
+ });
120
+
121
+ totalQuantity += quantity;
122
+ }
123
+ );
88
124
 
89
- tableDataArray.push({
125
+ summaryMap.set(`${TRANSLATION_KEYS.total}.${totalAmount}`, {
90
126
  name: TRANSLATION_KEYS.total,
91
127
  key: `${TRANSLATION_KEYS.total}.${totalAmount}`,
92
- quantity: totalQuantity,
93
- total: totalAmount,
128
+ quantity: String(totalQuantity),
129
+ total: String(totalAmount),
94
130
  isBold: true,
95
131
  });
96
132
 
97
- return tableDataArray;
133
+ return [...summaryMap.values()];
98
134
  };
@@ -3,6 +3,7 @@ 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";
6
7
  import { ImageOffset } from "../../types";
7
8
  import { PointIcon } from "./components/PointIcon";
8
9
  import {
@@ -10,7 +11,6 @@ import {
10
11
  calculatePointsCoordinates,
11
12
  } from "../../utils";
12
13
  import { ProductIcon } from "./components/ProductIcon";
13
- import { Product } from "../../../../types";
14
14
 
15
15
  type MapPointProps = Partial<Point> &
16
16
  ImageOffset & {
@@ -1,13 +1,14 @@
1
1
  import React from "react";
2
-
3
2
  import Accordion from "react-bootstrap/Accordion";
4
- import { ProductCategory, Order, SetOrderFn } from "../../../types";
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";
5
6
  import { AccordionItem } from "./components/AccordionItem";
6
7
 
7
8
  export interface EventBookingProductsProps {
8
9
  productsCategories?: ProductCategory[];
9
10
  setOrder: SetOrderFn;
10
- order: Record<number, Order>;
11
+ order: OrderItems;
11
12
  }
12
13
 
13
14
  export function EventBookingProducts({
@@ -1,14 +1,18 @@
1
1
  import React from "react";
2
2
  import clsx from "clsx";
3
3
  import { useIntl } from "react-intl";
4
-
5
4
  import Accordion from "react-bootstrap/Accordion";
6
5
  import Card from "react-bootstrap/Card";
7
6
  import { useAccordionToggle } from "react-bootstrap/AccordionToggle";
8
7
  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";
9
13
  import { NumberInput } from "../../../../../static";
10
14
  import Icon from "../../../../../static/Icon";
11
- import { Order, Product, SetOrderFn } from "../../../../../types";
15
+ import { SetOrderFn } from "../../../../../types";
12
16
 
13
17
  interface CustomToggleProps {
14
18
  eventKey: string;
@@ -19,7 +23,7 @@ interface AccordionItemProps {
19
23
  name: string;
20
24
  products: Product[];
21
25
  setOrder: SetOrderFn;
22
- order: Record<number, Order>;
26
+ order: Record<number, OrderItem>;
23
27
  productsCategoryId: number;
24
28
  }
25
29
 
@@ -86,7 +90,7 @@ interface ProductItemProps {
86
90
  name: string;
87
91
  price: number;
88
92
  description: string;
89
- order: Record<number, Order>;
93
+ order: OrderItems;
90
94
  setOrder: SetOrderFn;
91
95
  productsCategoryId: number;
92
96
  }
@@ -1,9 +1,7 @@
1
1
  import React from "react";
2
2
  import { useTranslation } from "react-i18next";
3
-
4
3
  import { StaticTable, StaticTableData } from "../../../table/StaticTable";
5
4
 
6
- export { Order } from "../../../types";
7
5
  interface EventOrderSummaryProps {
8
6
  data: StaticTableData[];
9
7
  tableName?: string;
@@ -10,11 +10,11 @@ export default {
10
10
  const productCategories = [
11
11
  {
12
12
  id: 1,
13
- name: "Early Bird General Admission",
13
+ name: "cat 1",
14
14
  products: [
15
15
  {
16
- id: 7,
17
- name: "Beer",
16
+ id: 11,
17
+ name: "cat 1 prod 1",
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: 8,
27
- name: "Wine",
26
+ id: 12,
27
+ name: "cat 2 prod 2",
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: "Nice",
40
+ name: "cat 2",
41
41
  products: [
42
42
  {
43
- id: 3,
44
- name: "Beer",
43
+ id: 21,
44
+ name: "cat 2 prod 1",
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: 5,
54
- name: "Wine",
53
+ id: 22,
54
+ name: "cat 2 prod 2",
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: "fine",
69
+ name: "cat 3",
70
70
  products: [
71
71
  {
72
- id: 9,
73
- name: "Beer",
72
+ id: 31,
73
+ name: "cat 3 prod 1",
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: 10,
83
- name: "Wine",
82
+ id: 32,
83
+ name: "cat 3 prod 2",
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,14 +90,15 @@ const productCategories2 = [
90
90
  // isRequired: true,
91
91
  },
92
92
  ],
93
+ zone: 1,
93
94
  },
94
95
  {
95
96
  id: 4,
96
- name: "Twice",
97
+ name: "cat 4",
97
98
  products: [
98
99
  {
99
- id: 11,
100
- name: "Beer",
100
+ id: 41,
101
+ name: "cat 4 prod 1",
101
102
  description: `Ticket is valid for students and non students.
102
103
  You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
103
104
  Ticket valid for entry before 11.30pm for 12.30am showtime.`,
@@ -106,8 +107,8 @@ const productCategories2 = [
106
107
  price: 1,
107
108
  },
108
109
  {
109
- id: 12,
110
- name: "Wine",
110
+ id: 42,
111
+ name: "cat 4 prod 1",
111
112
  description: `Ticket is valid for students and non students.
112
113
  You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
113
114
  Ticket valid for entry before 11.30pm for 12.30am showtime.`,
@@ -141,26 +142,40 @@ export function Default() {
141
142
  menuSteps={menuSteps as any}
142
143
  peopleAmount={5}
143
144
  formValues={{
144
- "3": {
145
- id: 3,
145
+ "11": {
146
+ id: 11,
146
147
  quantity: 1,
147
- name: "Beer",
148
+ name: "cat 1 prod 1",
148
149
  price: 0,
149
- productsCategoryId: 2,
150
+ productsCategoryId: 1,
150
151
  },
151
- "5": {
152
- id: 5,
152
+ "21": {
153
+ id: 21,
153
154
  quantity: 2,
154
- name: "Wine",
155
+ name: "cat 2 prod 1",
155
156
  price: 1,
156
157
  productsCategoryId: 2,
157
158
  },
158
- "7": {
159
- id: 7,
159
+ "31": {
160
+ id: 31,
160
161
  quantity: 4,
161
- name: "Beer",
162
+ name: "cat 3 prod 1",
162
163
  price: 1,
163
- productsCategoryId: 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,
164
179
  },
165
180
  }}
166
181
  totalWithDiscount={5}
@@ -1,9 +1,9 @@
1
- import React, { useMemo } from "react";
1
+ import React 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";
5
6
  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,15 +25,6 @@ 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
-
37
28
  if (isLoading) {
38
29
  return (
39
30
  <div className="payment-booking-summary">
@@ -52,19 +43,20 @@ export const BookingSummary = ({
52
43
  </div>
53
44
  <hr />
54
45
 
55
- {orderProducts?.length > 0 ? (
46
+ {values(formValues)?.length > 0 ? (
56
47
  <div>
57
48
  <div className="cart-items">
58
- {menuSteps.map((menuStep: MenuStep) => {
59
- return (
49
+ <div className="products-by-menu-step">
50
+ {menuSteps.map((menuStep) => (
60
51
  <ProductsByMenuStep
61
52
  key={menuStep.id}
62
- orderProducts={orderProducts}
53
+ orderItems={formValues}
63
54
  step={menuStep}
64
55
  productsWithErrors={productsWithErrors}
65
56
  />
66
- );
67
- })}
57
+ ))}
58
+ </div>
59
+
68
60
  {!shouldHidePeopleAmount && peopleAmount > 0 && (
69
61
  <>
70
62
  <hr />
@@ -74,6 +66,7 @@ export const BookingSummary = ({
74
66
  </div>
75
67
  </>
76
68
  )}
69
+
77
70
  {!!transactionFee && (
78
71
  <>
79
72
  <hr />
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { useTranslation } from "react-i18next";
3
+ import { useIntl } from "react-intl";
4
+ import * as Config from "@licklist/core/dist/Config";
5
+ import { OrderItem } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
6
+
7
+ type ProductSummaryProps = {
8
+ name?: string;
9
+ productQuantityError?: string;
10
+ orderProduct: OrderItem;
11
+ };
12
+
13
+ export const ProductSummary = ({
14
+ name,
15
+ productQuantityError,
16
+ orderProduct,
17
+ }: ProductSummaryProps) => {
18
+ const { t } = useTranslation("Design");
19
+ const { formatNumber } = useIntl();
20
+
21
+ const price = formatNumber(
22
+ (orderProduct?.deposit || orderProduct?.price || 0) *
23
+ orderProduct?.quantity,
24
+ { style: "currency", currency: Config.Currency.GBP }
25
+ );
26
+
27
+ return (
28
+ <div className="product">
29
+ <p className="m-0 name">{name ?? orderProduct?.name}</p>
30
+ <div className="d-flex justify-content-between">
31
+ <p className="m-0">
32
+ {t("shortQuantity")}:&nbsp;{orderProduct?.quantity}
33
+ </p>
34
+
35
+ <p className="price">{price}</p>
36
+ </div>
37
+
38
+ {productQuantityError && (
39
+ <p className="iframe-event__message-error">{productQuantityError}</p>
40
+ )}
41
+ </div>
42
+ );
43
+ };
@@ -0,0 +1 @@
1
+ export * from "./ProductSummary";