@licklist/design 0.44.550-dev.6 → 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 -2
  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 -14
  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,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;
@@ -1,5 +1,7 @@
1
+ // eslint-disable-next-line max-len
1
2
  import React, { ReactNode } from "react";
2
3
  import { useTranslation } from "react-i18next";
4
+
3
5
  import { PaymentStatusBody } from "./component";
4
6
  import { LoaderIndicator } from "../../../static/loader/LoaderIndicator";
5
7
  import { Page, PageBody } from "../../page";
@@ -14,7 +16,7 @@ export const ORDER_STATUS_FAILED = "failed";
14
16
  export const ORDER_STATUS_SUCCESS = "success";
15
17
  export const ORDER_STATUS_PENDING = "pending";
16
18
 
17
- export type OrderStatus =
19
+ export type OrderStatusPrefix =
18
20
  | typeof ORDER_STATUS_SUCCESS
19
21
  | typeof ORDER_STATUS_FAILED
20
22
  | typeof ORDER_STATUS_PENDING;
@@ -24,7 +26,7 @@ interface PaymentStatusComponentProps {
24
26
  onBack?: () => void;
25
27
  onTryAgain?: () => void;
26
28
  isLoading?: boolean;
27
- status: OrderStatus;
29
+ status: OrderStatusPrefix;
28
30
  isAppUsingInIframe?: boolean;
29
31
  bookingSummaryProps?: BookingSummaryProps;
30
32
  EventCardComponent?: ReactNode;
@@ -34,12 +36,6 @@ interface PaymentStatusComponentProps {
34
36
  paymentMetadata?: PaymentMetadata;
35
37
  }
36
38
 
37
- const titles: Record<OrderStatus, string> = {
38
- [ORDER_STATUS_SUCCESS]: "purchaseSuccessful",
39
- [ORDER_STATUS_PENDING]: "pendingPayment",
40
- [ORDER_STATUS_FAILED]: "purchaseFailed",
41
- };
42
-
43
39
  // @TODO In future think, how to reuse this component in Iframe Pending, Success and Failed Pages
44
40
  export const PaymentStatusPage = ({
45
41
  onCloseWindow,
@@ -57,10 +53,27 @@ export const PaymentStatusPage = ({
57
53
  }: PaymentStatusComponentProps) => {
58
54
  const { t } = useTranslation("Design");
59
55
 
60
- if (isLoading) return <LoaderIndicator isLoaded={false} />;
56
+ const getTitle = () => {
57
+ switch (status) {
58
+ case ORDER_STATUS_SUCCESS:
59
+ return t("purchaseSuccessful");
60
+ case ORDER_STATUS_PENDING:
61
+ return t("pendingPayment");
62
+ default:
63
+ return t("purchaseFailed");
64
+ }
65
+ };
66
+
67
+ const title = getTitle();
68
+
69
+ if (isLoading) {
70
+ return <LoaderIndicator isLoaded={false} />;
71
+ }
61
72
 
62
73
  const orderTotalAmounByFormValues = cartSumByOrderProducts(
63
- Object.values(bookingSummaryProps?.formValues ?? {})
74
+ bookingSummaryProps && bookingSummaryProps?.formValues
75
+ ? Object.values(bookingSummaryProps?.formValues)
76
+ : undefined
64
77
  );
65
78
 
66
79
  // User can fill promocode only in iframe appcliation.
@@ -75,7 +88,6 @@ export const PaymentStatusPage = ({
75
88
  return (
76
89
  <Page
77
90
  className="payment-status-page"
78
- isAppUsingInIframe={isAppUsingInIframe}
79
91
  headerBlock={
80
92
  <PaymentStatusHeader
81
93
  success={status !== ORDER_STATUS_FAILED}
@@ -86,10 +98,11 @@ export const PaymentStatusPage = ({
86
98
  }
87
99
  />
88
100
  }
101
+ isAppUsingInIframe={isAppUsingInIframe}
89
102
  >
90
103
  <PageBody
91
104
  leftBlock={
92
- <PageBody.LeftBlock title={t(titles[status])}>
105
+ <PageBody.LeftBlock title={title}>
93
106
  <div>
94
107
  {EventCardComponent}
95
108
  <PaymentStatusBody
@@ -155,7 +168,7 @@ export const PaymentStatusPage = ({
155
168
  {bookingSummaryProps ? (
156
169
  <BookingSummary {...bookingSummaryProps} />
157
170
  ) : (
158
- <h6>{t(titles[status])}</h6>
171
+ <h6>{title}</h6>
159
172
  )}
160
173
  </PageBody.RightBlock>
161
174
  }
@@ -3,12 +3,12 @@ import { useTranslation } from "react-i18next";
3
3
  import {
4
4
  ORDER_STATUS_PENDING,
5
5
  ORDER_STATUS_SUCCESS,
6
- OrderStatus,
6
+ OrderStatusPrefix,
7
7
  } from "../PaymentStatusPage";
8
8
  import { StatusBody } from "../../status-body/StatusBody";
9
9
 
10
10
  interface PaymentStatusBodyProps {
11
- status: OrderStatus;
11
+ status: OrderStatusPrefix;
12
12
  onBack: () => void;
13
13
  onTryAgain?: () => void;
14
14
  email?: string;
@@ -126,8 +126,7 @@ export const DateAndRecurrenceInput = ({
126
126
  }
127
127
  }
128
128
 
129
- const availableTime =
130
- availableTimesFormRef?.current?.getValues()?.availableTimes || null;
129
+ const availableTime = availableTimesFormRef?.current?.getValues()?.availableTimes || null;
131
130
 
132
131
  const values = {
133
132
  rrule: next.rrule,
@@ -1,5 +1,5 @@
1
1
  import clsx from "clsx";
2
- import React, { SyntheticEvent, forwardRef } from "react";
2
+ import React, { forwardRef } from "react";
3
3
  import { FormControl } from "react-bootstrap";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import { Icon } from "../../../static";
@@ -13,7 +13,6 @@ interface NumberInputHorizontalProps {
13
13
  onChange: (value: number) => void;
14
14
  onPlusClick: (value: number) => void;
15
15
  onMinusClick: (value: number) => void;
16
- onSelect?: (e: SyntheticEvent) => void;
17
16
  min?: number;
18
17
  max?: number;
19
18
  size?: Sizes;
@@ -36,7 +35,6 @@ export const NumberInputHorizontal = forwardRef<
36
35
  onChange,
37
36
  onPlusClick,
38
37
  onMinusClick,
39
- onSelect,
40
38
  min,
41
39
  max,
42
40
  defaultValue,
@@ -56,12 +54,7 @@ export const NumberInputHorizontal = forwardRef<
56
54
  }
57
55
  };
58
56
 
59
- const onClick = (e) => {
60
- if (onSelect) {
61
- onSelect(e);
62
- }
63
- e.target.select();
64
- };
57
+ const onClick = (e) => e.target.select();
65
58
 
66
59
  const handleArrowDownClick = () => {
67
60
  if (min !== undefined && value > min) {
@@ -105,16 +98,13 @@ export const NumberInputHorizontal = forwardRef<
105
98
  ref={ref}
106
99
  onClick={onClick}
107
100
  type={disabled && hasBigSize ? "text" : "number"}
108
- className={clsx(
109
- hasBigSize ? "big-sizes-input" : "small-sizes-input",
110
- disabled && "border-0"
111
- )}
101
+ className={hasBigSize ? "big-sizes-input" : "small-sizes-input"}
112
102
  onChange={(e) => onChange(Number(e.target.value))}
113
103
  value={disabled && hasBigSize && !isLoading ? soldOut : value}
114
104
  min={min}
115
105
  max={max}
116
106
  defaultValue={defaultValue}
117
- disabled={disabled && !onSelect}
107
+ disabled={disabled}
118
108
  />
119
109
  </div>
120
110
  <button
@@ -131,12 +131,6 @@
131
131
  font-weight: 500;
132
132
  }
133
133
 
134
- .categories {
135
- &:not(:last-child) {
136
- border-bottom: 2px solid $separator-color;
137
- }
138
- }
139
-
140
134
  .products {
141
135
  margin-top: 0.5rem;
142
136
 
@@ -150,6 +144,10 @@
150
144
  margin-bottom: 0.5rem;
151
145
  }
152
146
  }
147
+
148
+ &:not(:last-child) {
149
+ border-bottom: 2px solid $separator-color;
150
+ }
153
151
  }
154
152
 
155
153
  &:not(:last-child) {
@@ -5,7 +5,7 @@
5
5
  flex-wrap: wrap;
6
6
 
7
7
  .result-card {
8
- height: 14rem;
8
+ height: 14.25rem;
9
9
  border: 1px solid $gray-400;
10
10
  max-width: calc(50% - 0.75rem);
11
11
  flex: 0 0 calc(50% - 0.75rem);
@@ -1,5 +1,61 @@
1
- import { OrderItems } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
1
+ import { Product as CoreProduct } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
2
+ import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
3
+
4
+ export interface Product {
5
+ id: number;
6
+ name: string;
7
+ description: string;
8
+ deposit: number;
9
+ price: number;
10
+ minSub?: number;
11
+ minAmount?: number;
12
+ maxAmount?: number;
13
+ minSpend?: number | null;
14
+ isSoldOut?: boolean;
15
+ isRequired?: boolean;
16
+ isUnlimited?: boolean;
17
+ images: CoreProduct["images"];
18
+ capacity?: number | null;
19
+ uuid: string;
20
+ }
21
+
22
+ export interface ProductCategory {
23
+ id: number;
24
+ name: string;
25
+ allowDeposits?: boolean;
26
+ remainderExpireAfter?: number | null;
27
+ minSubItems: number | null;
28
+ maxSubItems: number | null;
29
+ products?: Product[];
30
+ zone?: Zone | null;
31
+ }
32
+
33
+ export interface MenuStep {
34
+ id: number;
35
+ name: string;
36
+ productCategories?: ProductCategory[];
37
+ }
38
+
39
+ export interface Menu {
40
+ id: number;
41
+ menuSteps: MenuStep[];
42
+ }
43
+
44
+ // TODO similar type exists in iframe app
45
+ // remove this when components are moved to iframe
46
+ export interface Order {
47
+ id: number;
48
+ quantity: number;
49
+ price: number;
50
+ name: string;
51
+ productsCategoryId: number;
52
+ deposit?: number | null;
53
+ }
2
54
 
3
55
  export type SetOrderFn = (
4
- val: OrderItems | ((prevVar: OrderItems) => OrderItems)
56
+ val:
57
+ | Record<number, Order>
58
+ | ((prevVar: Record<number, Order>) => Record<number, Order>)
5
59
  ) => void;
60
+
61
+ export type WizardFormValues = { [key: string]: any };
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { OrderItem } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
3
- type ProductSummaryProps = {
4
- name?: string;
5
- productQuantityError?: string;
6
- orderProduct: OrderItem;
7
- };
8
- export declare const ProductSummary: ({ name, productQuantityError, orderProduct, }: ProductSummaryProps) => JSX.Element;
9
- export {};
10
- //# sourceMappingURL=ProductSummary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductSummary.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,wDAAwD,CAAC;AAEnF,KAAK,mBAAmB,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,SAAS,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,cAAc,kDAIxB,mBAAmB,gBA0BrB,CAAC"}
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,a=require("@licklist/core/dist/Config"),n=require("react-i18next"),l=require("react-intl");exports.ProductSummary=function(e){var t=e.name,c=e.productQuantityError,u=e.orderProduct,i=n.useTranslation("Design").t,s=(0,l.useIntl().formatNumber)(((null==u?void 0:u.deposit)||(null==u?void 0:u.price)||0)*(null==u?void 0:u.quantity),{style:"currency",currency:a.Currency.GBP});return r.createElement("div",{className:"product"},r.createElement("p",{className:"m-0 name"},null!=t?t:null==u?void 0:u.name),r.createElement("div",{className:"d-flex justify-content-between"},r.createElement("p",{className:"m-0"},i("shortQuantity"),": ",null==u?void 0:u.quantity),r.createElement("p",{className:"price"},s)),c&&r.createElement("p",{className:"iframe-event__message-error"},c))};
@@ -1,2 +0,0 @@
1
- export * from "./ProductSummary";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/components/ProductSummary/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -1,43 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export * from "./ProductSummary";