@licklist/design 0.44.550-dev.4 → 0.44.550-dev.6
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.
- package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts +1 -1
- package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts.map +1 -1
- package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts +4 -2
- package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts.map +1 -1
- package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts +4 -2
- package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts +1 -1
- package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts +10 -0
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +1 -0
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +1 -0
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts +2 -0
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts.map +1 -0
- package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts +4 -3
- package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +3 -4
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +4 -2
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +2 -2
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts +2 -2
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.js +1 -1
- package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts +2 -2
- package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts.map +1 -1
- package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
- package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts +2 -1
- package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts.map +1 -1
- package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.js +1 -1
- package/dist/styles/iframe-order-process/IframeOrderProcess.scss +6 -4
- package/dist/types/iframe.d.ts +2 -50
- package/dist/types/iframe.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/events/event-venue-map/components/MapPoint/MapPoint.tsx +1 -1
- package/src/iframe/event/event-booking-products/EventBookingProducts.tsx +4 -3
- package/src/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.tsx +8 -4
- package/src/iframe/event/event-order-summary/EventOrderSummary.tsx +0 -2
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.stories.tsx +46 -31
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +12 -19
- package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +43 -0
- package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/index.ts +1 -0
- package/src/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.tsx +48 -66
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +3 -4
- package/src/iframe/order-process/components/BookingSummary/utils/index.ts +11 -2
- package/src/iframe/order-process/components/CalendarStepsForm/components/Category.tsx +1 -1
- package/src/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.tsx +4 -1
- package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +4 -1
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +4 -1
- package/src/iframe/order-process/components/utils/useCategoryVerification.ts +3 -2
- package/src/iframe/payment/payment-page/PaymentPage.tsx +5 -6
- package/src/iframe/payment/payment-status-page/PaymentStatusPage.tsx +13 -26
- package/src/iframe/payment/payment-status-page/component/PaymentStatusBody.tsx +2 -2
- package/src/product-set/control/DateAndRecurrenceInput.tsx +2 -1
- package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.stories.tsx +48 -0
- package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.tsx +14 -4
- package/src/styles/iframe-order-process/IframeOrderProcess.scss +6 -4
- package/src/types/iframe.ts +2 -58
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
2
|
import Accordion from "react-bootstrap/Accordion";
|
|
4
|
-
import {
|
|
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:
|
|
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 {
|
|
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,
|
|
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:
|
|
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: "
|
|
13
|
+
name: "cat 1",
|
|
14
14
|
products: [
|
|
15
15
|
{
|
|
16
|
-
id:
|
|
17
|
-
name: "
|
|
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:
|
|
27
|
-
name: "
|
|
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: "
|
|
40
|
+
name: "cat 2",
|
|
41
41
|
products: [
|
|
42
42
|
{
|
|
43
|
-
id:
|
|
44
|
-
name: "
|
|
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:
|
|
54
|
-
name: "
|
|
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: "
|
|
69
|
+
name: "cat 3",
|
|
70
70
|
products: [
|
|
71
71
|
{
|
|
72
|
-
id:
|
|
73
|
-
name: "
|
|
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:
|
|
83
|
-
name: "
|
|
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: "
|
|
97
|
+
name: "cat 4",
|
|
97
98
|
products: [
|
|
98
99
|
{
|
|
99
|
-
id:
|
|
100
|
-
name: "
|
|
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:
|
|
110
|
-
name: "
|
|
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
|
-
"
|
|
145
|
-
id:
|
|
145
|
+
"11": {
|
|
146
|
+
id: 11,
|
|
146
147
|
quantity: 1,
|
|
147
|
-
name: "
|
|
148
|
+
name: "cat 1 prod 1",
|
|
148
149
|
price: 0,
|
|
149
|
-
productsCategoryId:
|
|
150
|
+
productsCategoryId: 1,
|
|
150
151
|
},
|
|
151
|
-
"
|
|
152
|
-
id:
|
|
152
|
+
"21": {
|
|
153
|
+
id: 21,
|
|
153
154
|
quantity: 2,
|
|
154
|
-
name: "
|
|
155
|
+
name: "cat 2 prod 1",
|
|
155
156
|
price: 1,
|
|
156
157
|
productsCategoryId: 2,
|
|
157
158
|
},
|
|
158
|
-
"
|
|
159
|
-
id:
|
|
159
|
+
"31": {
|
|
160
|
+
id: 31,
|
|
160
161
|
quantity: 4,
|
|
161
|
-
name: "
|
|
162
|
+
name: "cat 3 prod 1",
|
|
162
163
|
price: 1,
|
|
163
|
-
productsCategoryId:
|
|
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
|
|
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
|
-
{
|
|
46
|
+
{values(formValues)?.length > 0 ? (
|
|
56
47
|
<div>
|
|
57
48
|
<div className="cart-items">
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
<div className="products-by-menu-step">
|
|
50
|
+
{menuSteps.map((menuStep) => (
|
|
60
51
|
<ProductsByMenuStep
|
|
61
52
|
key={menuStep.id}
|
|
62
|
-
|
|
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")}: {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";
|
|
@@ -1,90 +1,72 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import { useIntl } from "react-intl";
|
|
4
|
-
import * as Config from "@licklist/core/dist/Config";
|
|
1
|
+
import React from "react";
|
|
5
2
|
import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
6
|
-
import {
|
|
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);
|
|
7
27
|
|
|
8
28
|
export type ProductsByMenuStepsProps = {
|
|
9
|
-
|
|
29
|
+
orderItems: OrderItems;
|
|
10
30
|
step: MenuStep;
|
|
11
31
|
productsWithErrors?: QuantityCheckProductInfo[];
|
|
12
32
|
};
|
|
13
33
|
|
|
14
|
-
const getIdFromEntity = (entities: { id: number }[]) =>
|
|
15
|
-
entities.map(({ id }) => id);
|
|
16
|
-
|
|
17
34
|
export const ProductsByMenuStep = ({
|
|
18
|
-
|
|
35
|
+
orderItems,
|
|
19
36
|
step,
|
|
20
|
-
productsWithErrors,
|
|
37
|
+
productsWithErrors = [],
|
|
21
38
|
}: ProductsByMenuStepsProps) => {
|
|
22
|
-
const { t } = useTranslation("Design");
|
|
23
|
-
const { formatNumber } = useIntl();
|
|
24
39
|
const { productCategories } = step;
|
|
25
40
|
|
|
26
|
-
|
|
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
|
-
}
|
|
41
|
+
if (!doesStepHaveItems(orderItems, step)) return null;
|
|
39
42
|
|
|
40
43
|
return (
|
|
41
|
-
<div className="
|
|
42
|
-
{productCategories.map((
|
|
43
|
-
const
|
|
44
|
-
|
|
44
|
+
<div className="categories">
|
|
45
|
+
{productCategories.map((category) => {
|
|
46
|
+
const categoryOrderItems = getOrderItemsForCategory(
|
|
47
|
+
orderItems,
|
|
48
|
+
category.id
|
|
45
49
|
);
|
|
46
50
|
|
|
47
|
-
if (
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
51
|
+
if (categoryOrderItems.length === 0) return null;
|
|
50
52
|
|
|
51
53
|
return (
|
|
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
|
|
57
|
-
);
|
|
54
|
+
<div key={category.id} className="products">
|
|
55
|
+
<p className="m-0 title">{category.name}</p>
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
{categoryOrderItems.map((orderItem) => {
|
|
58
|
+
const productQuantityError = getProductError(
|
|
59
|
+
productsWithErrors,
|
|
60
|
+
orderItem.id
|
|
61
|
+
);
|
|
63
62
|
|
|
64
63
|
return (
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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>
|
|
64
|
+
<ProductSummary
|
|
65
|
+
key={orderItem.id}
|
|
66
|
+
name={orderItem.name}
|
|
67
|
+
productQuantityError={productQuantityError}
|
|
68
|
+
orderProduct={orderItem}
|
|
69
|
+
/>
|
|
88
70
|
);
|
|
89
71
|
})}
|
|
90
72
|
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
2
|
-
import {
|
|
2
|
+
import { OrderItems } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
|
|
3
|
+
import { MenuStep } from "@licklist/plugins/dist/types/context/sale/menuSteps";
|
|
3
4
|
|
|
4
5
|
export const MOBILE_WIDTH = 576;
|
|
5
6
|
export const ACCORDION_KEY = "booking-summary";
|
|
@@ -8,9 +9,7 @@ export type BookingSummaryProps = {
|
|
|
8
9
|
date: string;
|
|
9
10
|
time?: string;
|
|
10
11
|
menuSteps?: MenuStep[];
|
|
11
|
-
formValues?:
|
|
12
|
-
[key: string]: Order;
|
|
13
|
-
};
|
|
12
|
+
formValues?: OrderItems;
|
|
14
13
|
totalWithDiscount?: number;
|
|
15
14
|
shouldHidePeopleAmount?: boolean;
|
|
16
15
|
eventName?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
2
|
+
import { OrderItem } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
|
|
2
3
|
|
|
3
|
-
export const cartSumByOrderProducts = (orderProducts?:
|
|
4
|
+
export const cartSumByOrderProducts = (orderProducts?: OrderItem[]) => {
|
|
4
5
|
if (!orderProducts || !orderProducts.length) {
|
|
5
6
|
return 0;
|
|
6
7
|
}
|
|
@@ -12,3 +13,11 @@ export const cartSumByOrderProducts = (orderProducts?: Order[]) => {
|
|
|
12
13
|
);
|
|
13
14
|
}, 0);
|
|
14
15
|
};
|
|
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 "
|
|
4
|
+
import { ProductCategory } from "@licklist/plugins/dist/types/context/sale/menuSteps";
|
|
5
5
|
import { CategoryProductModal } from "./CategoryProductModal";
|
|
6
6
|
|
|
7
7
|
export type CategoryProps = {
|
package/src/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.tsx
CHANGED
|
@@ -3,7 +3,10 @@ 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 {
|
|
6
|
+
import {
|
|
7
|
+
Product,
|
|
8
|
+
ProductCategory,
|
|
9
|
+
} from "@licklist/plugins/dist/types/context/sale/menuSteps";
|
|
7
10
|
import { CategoryProduct } from "../../CategoryProduct";
|
|
8
11
|
import Icon from "../../../../../static/Icon";
|
|
9
12
|
|
|
@@ -6,8 +6,11 @@ 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";
|
|
9
13
|
import { TicketDescription } from "../../../event/ticket-description";
|
|
10
|
-
import { ProductCategory, Product } from "../../../../types";
|
|
11
14
|
import { ProductQuantityInput } from "./components/ProductQuantityInput";
|
|
12
15
|
|
|
13
16
|
interface CategoryProductProps {
|
|
@@ -4,8 +4,11 @@ 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";
|
|
7
11
|
import { NumberInput } from "../NumberInput";
|
|
8
|
-
import { Product, ProductCategory } from "../../../../../../types";
|
|
9
12
|
|
|
10
13
|
interface FormOrderItem {
|
|
11
14
|
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 {
|
|
5
|
+
import { OrderItems } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
|
|
6
6
|
|
|
7
7
|
interface CategoryError {
|
|
8
8
|
message: string;
|
|
@@ -13,8 +13,9 @@ interface CategoryError {
|
|
|
13
13
|
export const useCategoryVerification = () => {
|
|
14
14
|
const { t } = useTranslation("Validation");
|
|
15
15
|
const { formatNumber } = useIntl();
|
|
16
|
+
|
|
16
17
|
return (
|
|
17
|
-
values:
|
|
18
|
+
values: OrderItems,
|
|
18
19
|
productCategories?: ProductCategory[],
|
|
19
20
|
isLastPage?: boolean
|
|
20
21
|
): CategoryError | void => {
|
|
@@ -49,7 +49,7 @@ export const PaymentPage = ({
|
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
const onCloseWindow = () => {
|
|
52
|
-
//
|
|
52
|
+
// TODO discuss redirect to site
|
|
53
53
|
window.location.href = "https://booked.it/";
|
|
54
54
|
};
|
|
55
55
|
|
|
@@ -101,14 +101,13 @@ export const PaymentPage = ({
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
const orderTotalAmountByFormValues = cartSumByOrderProducts(
|
|
104
|
-
bookingSummaryProps &&
|
|
105
|
-
|
|
106
|
-
: undefined
|
|
104
|
+
bookingSummaryProps?.formValues &&
|
|
105
|
+
Object.values(bookingSummaryProps?.formValues)
|
|
107
106
|
);
|
|
108
107
|
|
|
109
108
|
// User can fill promo code only in iframe application.
|
|
110
|
-
// It
|
|
111
|
-
// be applied when there
|
|
109
|
+
// It isn't possible via payment link. This check will
|
|
110
|
+
// be applied when there is no metadata and in case when
|
|
112
111
|
// orderValues sum is greater than amount in order.
|
|
113
112
|
const isCalculatedAmountGreaterThanOrderAmount =
|
|
114
113
|
orderTotalAmountByFormValues > data?.amount;
|