@licklist/design 0.44.551-dev.7 → 0.44.551

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 (126) 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 +6 -10
  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-venue-map/components/MapPoint/MapPoint.d.ts +1 -1
  10. package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts.map +1 -1
  11. package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts +2 -4
  12. package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts.map +1 -1
  13. package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts +2 -4
  14. package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts.map +1 -1
  15. package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts +1 -1
  16. package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts.map +1 -1
  17. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
  18. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
  19. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts +3 -4
  20. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts.map +1 -1
  21. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.js +1 -1
  22. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +4 -3
  23. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
  24. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +2 -4
  25. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
  26. package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
  27. package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts +1 -1
  28. package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts.map +1 -1
  29. package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts +1 -1
  30. package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts.map +1 -1
  31. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts +1 -1
  32. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
  33. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +1 -1
  34. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  35. package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +2 -2
  36. package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
  37. package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
  38. package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
  39. package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts +2 -2
  40. package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts.map +1 -1
  41. package/dist/iframe/payment/payment-status-page/PaymentStatusPage.js +1 -1
  42. package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts +2 -2
  43. package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts.map +1 -1
  44. package/dist/index.js +1 -1
  45. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  46. package/dist/report/index.d.ts +0 -3
  47. package/dist/report/index.d.ts.map +1 -1
  48. package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts +1 -4
  49. package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts.map +1 -1
  50. package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.js +1 -1
  51. package/dist/styles/date-time-button/DateTimeButton.scss +4 -0
  52. package/dist/styles/iframe-order-process/IframeOrderProcess.scss +4 -6
  53. package/dist/styles/iframe-page/PageBody.scss +3 -3
  54. package/dist/styles/report/_index.scss +1 -3
  55. package/dist/styles/sales/BookingResults.scss +1 -1
  56. package/dist/styles/sales/ManualBooking.scss +4 -1
  57. package/dist/types/iframe.d.ts +50 -2
  58. package/dist/types/iframe.d.ts.map +1 -1
  59. package/package.json +3 -3
  60. package/src/calendar/components/CalendarDates/CalendarDates.tsx +4 -3
  61. package/src/date-time-button/DateContent.tsx +9 -27
  62. package/src/date-time-button/DateTimeButton.stories.tsx +14 -13
  63. package/src/date-time-button/DateTimeButton.tsx +26 -35
  64. package/src/events/event-venue-map/components/MapPoint/MapPoint.tsx +1 -1
  65. package/src/iframe/event/event-booking-products/EventBookingProducts.tsx +3 -4
  66. package/src/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.tsx +4 -8
  67. package/src/iframe/event/event-order-summary/EventOrderSummary.tsx +2 -0
  68. package/src/iframe/order-process/components/BookingSummary/BookingSummary.stories.tsx +31 -46
  69. package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +19 -12
  70. package/src/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.tsx +66 -48
  71. package/src/iframe/order-process/components/BookingSummary/types/index.ts +4 -3
  72. package/src/iframe/order-process/components/BookingSummary/utils/index.ts +2 -11
  73. package/src/iframe/order-process/components/CalendarStepsForm/components/Category.tsx +1 -1
  74. package/src/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.tsx +1 -4
  75. package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +1 -4
  76. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -4
  77. package/src/iframe/order-process/components/utils/useCategoryVerification.ts +2 -3
  78. package/src/iframe/payment/payment-page/PaymentPage.tsx +6 -5
  79. package/src/iframe/payment/payment-status-page/PaymentStatusPage.tsx +26 -13
  80. package/src/iframe/payment/payment-status-page/component/PaymentStatusBody.tsx +2 -2
  81. package/src/product-set/control/DateAndRecurrenceInput.tsx +1 -2
  82. package/src/report/index.ts +0 -3
  83. package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.tsx +5 -19
  84. package/src/styles/date-time-button/DateTimeButton.scss +4 -0
  85. package/src/styles/iframe-order-process/IframeOrderProcess.scss +4 -6
  86. package/src/styles/iframe-page/PageBody.scss +3 -3
  87. package/src/styles/report/_index.scss +1 -3
  88. package/src/styles/sales/BookingResults.scss +1 -1
  89. package/src/styles/sales/ManualBooking.scss +4 -1
  90. package/src/types/iframe.ts +58 -2
  91. package/dist/assets/dashboard/info.svg +0 -8
  92. package/dist/assets/dashboard/info.svg.js +0 -1
  93. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts +0 -10
  94. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +0 -1
  95. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +0 -1
  96. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts +0 -2
  97. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts.map +0 -1
  98. package/dist/report/DataFieldsSelector/DataFieldsSelector.d.ts +0 -13
  99. package/dist/report/DataFieldsSelector/DataFieldsSelector.d.ts.map +0 -1
  100. package/dist/report/DataFieldsSelector/DataFieldsSelector.js +0 -1
  101. package/dist/report/DataFieldsSelector/index.d.ts +0 -2
  102. package/dist/report/DataFieldsSelector/index.d.ts.map +0 -1
  103. package/dist/report/ReportRunnerModal/ReportRunnerModal.d.ts +0 -22
  104. package/dist/report/ReportRunnerModal/ReportRunnerModal.d.ts.map +0 -1
  105. package/dist/report/ReportRunnerModal/ReportRunnerModal.js +0 -1
  106. package/dist/report/ReportRunnerModal/index.d.ts +0 -2
  107. package/dist/report/ReportRunnerModal/index.d.ts.map +0 -1
  108. package/dist/report/ReportTypeSelect/ReportTypeSelect.d.ts +0 -3
  109. package/dist/report/ReportTypeSelect/ReportTypeSelect.d.ts.map +0 -1
  110. package/dist/report/ReportTypeSelect/ReportTypeSelect.js +0 -1
  111. package/dist/report/ReportTypeSelect/index.d.ts +0 -2
  112. package/dist/report/ReportTypeSelect/index.d.ts.map +0 -1
  113. package/dist/styles/report/ReportEditorModal.scss +0 -98
  114. package/dist/styles/report/ReportRunnerModal.scss +0 -95
  115. package/src/assets/dashboard/info.svg +0 -8
  116. package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +0 -43
  117. package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/index.ts +0 -1
  118. package/src/report/DataFieldsSelector/DataFieldsSelector.tsx +0 -112
  119. package/src/report/DataFieldsSelector/index.ts +0 -1
  120. package/src/report/ReportRunnerModal/ReportRunnerModal.tsx +0 -187
  121. package/src/report/ReportRunnerModal/index.ts +0 -1
  122. package/src/report/ReportTypeSelect/ReportTypeSelect.tsx +0 -68
  123. package/src/report/ReportTypeSelect/index.ts +0 -1
  124. package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.stories.tsx +0 -48
  125. package/src/styles/report/ReportEditorModal.scss +0 -98
  126. package/src/styles/report/ReportRunnerModal.scss +0 -95
@@ -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 />
@@ -1,72 +1,90 @@
1
- import React from "react";
1
+ import React, { useMemo } from "react";
2
+ import { useTranslation } from "react-i18next";
3
+ import { useIntl } from "react-intl";
4
+ import * as Config from "@licklist/core/dist/Config";
2
5
  import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
3
- import {
4
- OrderItem,
5
- OrderItems,
6
- } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
7
- import { MenuStep } from "@licklist/plugins/dist/types/context/sale/menuSteps";
8
- import { values } from "lodash";
9
- import { ProductSummary } from "../ProductSummary";
10
- import { getProductError } from "../../utils";
11
-
12
- const doesStepHaveItems = (orderItems: OrderItems, step: MenuStep): boolean => {
13
- const categoriesIds = step.productCategories.map((category) => category.id);
14
-
15
- const stepItems = values(orderItems).filter((item) =>
16
- categoriesIds.includes(item.productsCategoryId)
17
- );
18
-
19
- return stepItems.length > 0;
20
- };
21
-
22
- const getOrderItemsForCategory = (
23
- orderItems: OrderItems,
24
- categoryId: number
25
- ): OrderItem[] =>
26
- values(orderItems).filter((item) => item.productsCategoryId === categoryId);
6
+ import { Order, MenuStep } from "../../../../../../types";
27
7
 
28
8
  export type ProductsByMenuStepsProps = {
29
- orderItems: OrderItems;
9
+ orderProducts: Order[];
30
10
  step: MenuStep;
31
11
  productsWithErrors?: QuantityCheckProductInfo[];
32
12
  };
33
13
 
14
+ const getIdFromEntity = (entities: { id: number }[]) =>
15
+ entities.map(({ id }) => id);
16
+
34
17
  export const ProductsByMenuStep = ({
35
- orderItems,
18
+ orderProducts,
36
19
  step,
37
- productsWithErrors = [],
20
+ productsWithErrors,
38
21
  }: ProductsByMenuStepsProps) => {
22
+ const { t } = useTranslation("Design");
23
+ const { formatNumber } = useIntl();
39
24
  const { productCategories } = step;
40
25
 
41
- if (!doesStepHaveItems(orderItems, step)) return null;
26
+ const productsByCategories = useMemo(() => {
27
+ const productsInCategoriesIds = getIdFromEntity(productCategories);
28
+
29
+ return orderProducts.filter(({ productsCategoryId }) =>
30
+ productsInCategoriesIds.includes(productsCategoryId)
31
+ );
32
+ }, [productCategories, orderProducts]);
33
+
34
+ const productIds = getIdFromEntity(productsByCategories);
35
+
36
+ if (!productsByCategories.length) {
37
+ return null;
38
+ }
42
39
 
43
40
  return (
44
- <div className="categories">
45
- {productCategories.map((category) => {
46
- const categoryOrderItems = getOrderItemsForCategory(
47
- orderItems,
48
- category.id
41
+ <div className="products-by-menu-step">
42
+ {productCategories.map(({ name, id, products }) => {
43
+ const selectedProducts = products.filter(({ id: productId }) =>
44
+ productIds.includes(productId)
49
45
  );
50
46
 
51
- if (categoryOrderItems.length === 0) return null;
47
+ if (!selectedProducts.length) {
48
+ return null;
49
+ }
52
50
 
53
51
  return (
54
- <div key={category.id} className="products">
55
- <p className="m-0 title">{category.name}</p>
56
-
57
- {categoryOrderItems.map((orderItem) => {
58
- const productQuantityError = getProductError(
59
- productsWithErrors,
60
- orderItem.id
52
+ <div key={id} className="products">
53
+ <p className="m-0 title">{name}</p>
54
+ {selectedProducts.map(({ id, name }) => {
55
+ const orderProduct = productsByCategories.find(
56
+ ({ id: productId }) => productId === id
61
57
  );
62
58
 
59
+ const productQuantityError = (productsWithErrors ?? []).find(
60
+ (productWithError) =>
61
+ productWithError.product_id === orderProduct.id
62
+ )?.message;
63
+
63
64
  return (
64
- <ProductSummary
65
- key={orderItem.id}
66
- name={orderItem.name}
67
- productQuantityError={productQuantityError}
68
- orderProduct={orderItem}
69
- />
65
+ <div className="product" key={id}>
66
+ <p className="m-0 name">{name}</p>
67
+ <div className="d-flex justify-content-between">
68
+ <p className="m-0">
69
+ {t("shortQuantity")}:&nbsp;{orderProduct?.quantity}
70
+ </p>
71
+ <p className="price">
72
+ {formatNumber(
73
+ (orderProduct?.deposit || orderProduct?.price || 0) *
74
+ orderProduct?.quantity,
75
+ {
76
+ style: "currency",
77
+ currency: Config.Currency.GBP,
78
+ }
79
+ )}
80
+ </p>
81
+ </div>
82
+ {productQuantityError && (
83
+ <p className="iframe-event__message-error">
84
+ {productQuantityError}
85
+ </p>
86
+ )}
87
+ </div>
70
88
  );
71
89
  })}
72
90
  </div>
@@ -1,6 +1,5 @@
1
1
  import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
2
- import { OrderItems } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
3
- import { MenuStep } from "@licklist/plugins/dist/types/context/sale/menuSteps";
2
+ import { MenuStep, Order } from "../../../../../types";
4
3
 
5
4
  export const MOBILE_WIDTH = 576;
6
5
  export const ACCORDION_KEY = "booking-summary";
@@ -9,7 +8,9 @@ export type BookingSummaryProps = {
9
8
  date: string;
10
9
  time?: string;
11
10
  menuSteps?: MenuStep[];
12
- formValues?: OrderItems;
11
+ formValues?: {
12
+ [key: string]: Order;
13
+ };
13
14
  totalWithDiscount?: number;
14
15
  shouldHidePeopleAmount?: boolean;
15
16
  eventName?: string;
@@ -1,7 +1,6 @@
1
- import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
2
- import { OrderItem } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
1
+ import { Order } from "../../../../../types";
3
2
 
4
- export const cartSumByOrderProducts = (orderProducts?: OrderItem[]) => {
3
+ export const cartSumByOrderProducts = (orderProducts?: Order[]) => {
5
4
  if (!orderProducts || !orderProducts.length) {
6
5
  return 0;
7
6
  }
@@ -13,11 +12,3 @@ export const cartSumByOrderProducts = (orderProducts?: OrderItem[]) => {
13
12
  );
14
13
  }, 0);
15
14
  };
16
-
17
- export const getProductError = (
18
- productsWithErrors: QuantityCheckProductInfo[],
19
- productId: OrderItem["id"]
20
- ): string | undefined =>
21
- productsWithErrors.find(
22
- (productWithError) => productWithError.product_id === productId
23
- )?.message;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { PointProduct } from "@licklist/core/dist/DataMapper/Product/PointProductDataMapper";
3
3
  import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
4
- import { ProductCategory } from "@licklist/plugins/dist/types/context/sale/menuSteps";
4
+ import { ProductCategory } from "../../../../../types";
5
5
  import { CategoryProductModal } from "./CategoryProductModal";
6
6
 
7
7
  export type CategoryProps = {
@@ -3,10 +3,7 @@ import clsx from "clsx";
3
3
  import { Button } from "react-bootstrap";
4
4
  import { PointProduct } from "@licklist/core/dist/DataMapper/Product/PointProductDataMapper";
5
5
  import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
6
- import {
7
- Product,
8
- ProductCategory,
9
- } from "@licklist/plugins/dist/types/context/sale/menuSteps";
6
+ import { ProductCategory, Product } from "../../../../../types";
10
7
  import { CategoryProduct } from "../../CategoryProduct";
11
8
  import Icon from "../../../../../static/Icon";
12
9
 
@@ -6,11 +6,8 @@ import { useIntl } from "react-intl";
6
6
  import * as Config from "@licklist/core/dist/Config";
7
7
  import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
8
8
  import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
9
- import {
10
- Product,
11
- ProductCategory,
12
- } from "@licklist/plugins/dist/types/context/sale/menuSteps";
13
9
  import { TicketDescription } from "../../../event/ticket-description";
10
+ import { ProductCategory, Product } from "../../../../types";
14
11
  import { ProductQuantityInput } from "./components/ProductQuantityInput";
15
12
 
16
13
  interface CategoryProductProps {
@@ -4,11 +4,8 @@ import { Button } from "react-bootstrap";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import { FieldValues, RefCallBack, UseFormClearErrors } from "react-hook-form";
6
6
  import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
7
- import {
8
- Product,
9
- ProductCategory,
10
- } from "@licklist/plugins/dist/types/context/sale/menuSteps";
11
7
  import { NumberInput } from "../NumberInput";
8
+ import { Product, ProductCategory } from "../../../../../../types";
12
9
 
13
10
  interface FormOrderItem {
14
11
  id: number;
@@ -2,7 +2,7 @@ import { ProductCategory } from "@licklist/core/dist/DataMapper/Product/ProductC
2
2
  import { Currency } from "@licklist/core/dist/Config";
3
3
  import { useIntl } from "react-intl";
4
4
  import { useTranslation } from "react-i18next";
5
- import { OrderItems } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
5
+ import { Order } from "src/types";
6
6
 
7
7
  interface CategoryError {
8
8
  message: string;
@@ -13,9 +13,8 @@ interface CategoryError {
13
13
  export const useCategoryVerification = () => {
14
14
  const { t } = useTranslation("Validation");
15
15
  const { formatNumber } = useIntl();
16
-
17
16
  return (
18
- values: OrderItems,
17
+ values: Record<Order["id"], Order>,
19
18
  productCategories?: ProductCategory[],
20
19
  isLastPage?: boolean
21
20
  ): CategoryError | void => {
@@ -49,7 +49,7 @@ export const PaymentPage = ({
49
49
  );
50
50
 
51
51
  const onCloseWindow = () => {
52
- // TODO discuss redirect to site
52
+ // @TODO discuss redirect to site
53
53
  window.location.href = "https://booked.it/";
54
54
  };
55
55
 
@@ -101,13 +101,14 @@ export const PaymentPage = ({
101
101
  }
102
102
 
103
103
  const orderTotalAmountByFormValues = cartSumByOrderProducts(
104
- bookingSummaryProps?.formValues &&
105
- Object.values(bookingSummaryProps?.formValues)
104
+ bookingSummaryProps && bookingSummaryProps?.formValues
105
+ ? Object.values(bookingSummaryProps?.formValues)
106
+ : undefined
106
107
  );
107
108
 
108
109
  // User can fill promo code only in iframe application.
109
- // It isn't possible via payment link. This check will
110
- // be applied when there is no metadata and in case when
110
+ // It didn't possible via payment link. This check will
111
+ // be applied when there are no metadata and in case when
111
112
  // orderValues sum is greater than amount in order.
112
113
  const isCalculatedAmountGreaterThanOrderAmount =
113
114
  orderTotalAmountByFormValues > data?.amount;