@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
@@ -1,90 +1,72 @@
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";
1
+ import React from "react";
5
2
  import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
6
- import { Order, MenuStep } from "../../../../../../types";
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
- orderProducts: Order[];
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
- orderProducts,
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
- 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
- }
41
+ if (!doesStepHaveItems(orderItems, step)) return null;
39
42
 
40
43
  return (
41
- <div className="products-by-menu-step">
42
- {productCategories.map(({ name, id, products }) => {
43
- const selectedProducts = products.filter(({ id: productId }) =>
44
- productIds.includes(productId)
44
+ <div className="categories">
45
+ {productCategories.map((category) => {
46
+ const categoryOrderItems = getOrderItemsForCategory(
47
+ orderItems,
48
+ category.id
45
49
  );
46
50
 
47
- if (!selectedProducts.length) {
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
- const productQuantityError = (productsWithErrors ?? []).find(
60
- (productWithError) =>
61
- productWithError.product_id === orderProduct.id
62
- )?.message;
57
+ {categoryOrderItems.map((orderItem) => {
58
+ const productQuantityError = getProductError(
59
+ productsWithErrors,
60
+ orderItem.id
61
+ );
63
62
 
64
63
  return (
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>
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 { MenuStep, Order } from "../../../../../types";
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 { Order } from "../../../../../types";
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?: Order[]) => {
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 "../../../../../types";
4
+ import { ProductCategory } from "@licklist/plugins/dist/types/context/sale/menuSteps";
5
5
  import { CategoryProductModal } from "./CategoryProductModal";
6
6
 
7
7
  export type CategoryProps = {
@@ -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 { ProductCategory, Product } from "../../../../../types";
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 { Order } from "src/types";
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: Record<Order["id"], Order>,
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
- // @TODO discuss redirect to site
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 && bookingSummaryProps?.formValues
105
- ? Object.values(bookingSummaryProps?.formValues)
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 didn't possible via payment link. This check will
111
- // be applied when there are no metadata and in case when
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;
@@ -1,7 +1,5 @@
1
- // eslint-disable-next-line max-len
2
1
  import React, { ReactNode } from "react";
3
2
  import { useTranslation } from "react-i18next";
4
-
5
3
  import { PaymentStatusBody } from "./component";
6
4
  import { LoaderIndicator } from "../../../static/loader/LoaderIndicator";
7
5
  import { Page, PageBody } from "../../page";
@@ -16,7 +14,7 @@ export const ORDER_STATUS_FAILED = "failed";
16
14
  export const ORDER_STATUS_SUCCESS = "success";
17
15
  export const ORDER_STATUS_PENDING = "pending";
18
16
 
19
- export type OrderStatusPrefix =
17
+ export type OrderStatus =
20
18
  | typeof ORDER_STATUS_SUCCESS
21
19
  | typeof ORDER_STATUS_FAILED
22
20
  | typeof ORDER_STATUS_PENDING;
@@ -26,7 +24,7 @@ interface PaymentStatusComponentProps {
26
24
  onBack?: () => void;
27
25
  onTryAgain?: () => void;
28
26
  isLoading?: boolean;
29
- status: OrderStatusPrefix;
27
+ status: OrderStatus;
30
28
  isAppUsingInIframe?: boolean;
31
29
  bookingSummaryProps?: BookingSummaryProps;
32
30
  EventCardComponent?: ReactNode;
@@ -36,6 +34,12 @@ interface PaymentStatusComponentProps {
36
34
  paymentMetadata?: PaymentMetadata;
37
35
  }
38
36
 
37
+ const titles: Record<OrderStatus, string> = {
38
+ [ORDER_STATUS_SUCCESS]: "purchaseSuccessful",
39
+ [ORDER_STATUS_PENDING]: "pendingPayment",
40
+ [ORDER_STATUS_FAILED]: "purchaseFailed",
41
+ };
42
+
39
43
  // @TODO In future think, how to reuse this component in Iframe Pending, Success and Failed Pages
40
44
  export const PaymentStatusPage = ({
41
45
  onCloseWindow,
@@ -53,27 +57,10 @@ export const PaymentStatusPage = ({
53
57
  }: PaymentStatusComponentProps) => {
54
58
  const { t } = useTranslation("Design");
55
59
 
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
- }
60
+ if (isLoading) return <LoaderIndicator isLoaded={false} />;
72
61
 
73
62
  const orderTotalAmounByFormValues = cartSumByOrderProducts(
74
- bookingSummaryProps && bookingSummaryProps?.formValues
75
- ? Object.values(bookingSummaryProps?.formValues)
76
- : undefined
63
+ Object.values(bookingSummaryProps?.formValues ?? {})
77
64
  );
78
65
 
79
66
  // User can fill promocode only in iframe appcliation.
@@ -88,6 +75,7 @@ export const PaymentStatusPage = ({
88
75
  return (
89
76
  <Page
90
77
  className="payment-status-page"
78
+ isAppUsingInIframe={isAppUsingInIframe}
91
79
  headerBlock={
92
80
  <PaymentStatusHeader
93
81
  success={status !== ORDER_STATUS_FAILED}
@@ -98,11 +86,10 @@ export const PaymentStatusPage = ({
98
86
  }
99
87
  />
100
88
  }
101
- isAppUsingInIframe={isAppUsingInIframe}
102
89
  >
103
90
  <PageBody
104
91
  leftBlock={
105
- <PageBody.LeftBlock title={title}>
92
+ <PageBody.LeftBlock title={t(titles[status])}>
106
93
  <div>
107
94
  {EventCardComponent}
108
95
  <PaymentStatusBody
@@ -168,7 +155,7 @@ export const PaymentStatusPage = ({
168
155
  {bookingSummaryProps ? (
169
156
  <BookingSummary {...bookingSummaryProps} />
170
157
  ) : (
171
- <h6>{title}</h6>
158
+ <h6>{t(titles[status])}</h6>
172
159
  )}
173
160
  </PageBody.RightBlock>
174
161
  }
@@ -3,12 +3,12 @@ import { useTranslation } from "react-i18next";
3
3
  import {
4
4
  ORDER_STATUS_PENDING,
5
5
  ORDER_STATUS_SUCCESS,
6
- OrderStatusPrefix,
6
+ OrderStatus,
7
7
  } from "../PaymentStatusPage";
8
8
  import { StatusBody } from "../../status-body/StatusBody";
9
9
 
10
10
  interface PaymentStatusBodyProps {
11
- status: OrderStatusPrefix;
11
+ status: OrderStatus;
12
12
  onBack: () => void;
13
13
  onTryAgain?: () => void;
14
14
  email?: string;
@@ -126,7 +126,8 @@ export const DateAndRecurrenceInput = ({
126
126
  }
127
127
  }
128
128
 
129
- const availableTime = availableTimesFormRef?.current?.getValues()?.availableTimes || null;
129
+ const availableTime =
130
+ availableTimesFormRef?.current?.getValues()?.availableTimes || null;
130
131
 
131
132
  const values = {
132
133
  rrule: next.rrule,
@@ -0,0 +1,48 @@
1
+ import React, { useRef, useState } from "react";
2
+ import { Meta, Story } from "@storybook/react";
3
+ import { NumberInputHorizontal } from "./NumberInputHorizontal";
4
+
5
+ export default {
6
+ title: "Manual Booking/NumberInputHorizontal",
7
+ } as Meta;
8
+
9
+ export const Default: Story<any> = (args) => {
10
+ const ref = useRef(null);
11
+ const [value, setValue] = useState(0);
12
+ const [isDisabled, setDisabled] = useState(true);
13
+
14
+ const onPriceClick = (e) => {
15
+ if (!isDisabled) {
16
+ return;
17
+ }
18
+ console.log("click");
19
+ setDisabled(false);
20
+ };
21
+
22
+ return (
23
+ <div
24
+ role="button"
25
+ tabIndex={0}
26
+ onClick={onPriceClick}
27
+ onKeyDown={onPriceClick}
28
+ style={{ height: "250px", width: "370px" }}
29
+ >
30
+ <NumberInputHorizontal
31
+ ref={ref}
32
+ hasCurrency
33
+ onSelect={onPriceClick}
34
+ onChange={(val) => {
35
+ setValue(val);
36
+ }}
37
+ onMinusClick={() => {
38
+ setValue(value - 1 || 0);
39
+ }}
40
+ onPlusClick={() => {
41
+ setValue((value ?? 0) + 1);
42
+ }}
43
+ value={value}
44
+ disabled={isDisabled}
45
+ />
46
+ </div>
47
+ );
48
+ };
@@ -1,5 +1,5 @@
1
1
  import clsx from "clsx";
2
- import React, { forwardRef } from "react";
2
+ import React, { SyntheticEvent, forwardRef } from "react";
3
3
  import { FormControl } from "react-bootstrap";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import { Icon } from "../../../static";
@@ -13,6 +13,8 @@ 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
+ step?: number;
16
18
  min?: number;
17
19
  max?: number;
18
20
  size?: Sizes;
@@ -30,11 +32,13 @@ export const NumberInputHorizontal = forwardRef<
30
32
  disabled = false,
31
33
  className = "",
32
34
  value,
35
+ step,
33
36
  size = "small",
34
37
  hasCurrency,
35
38
  onChange,
36
39
  onPlusClick,
37
40
  onMinusClick,
41
+ onSelect,
38
42
  min,
39
43
  max,
40
44
  defaultValue,
@@ -54,7 +58,12 @@ export const NumberInputHorizontal = forwardRef<
54
58
  }
55
59
  };
56
60
 
57
- const onClick = (e) => e.target.select();
61
+ const onClick = (e) => {
62
+ if (onSelect) {
63
+ onSelect(e);
64
+ }
65
+ e.target.select();
66
+ };
58
67
 
59
68
  const handleArrowDownClick = () => {
60
69
  if (min !== undefined && value > min) {
@@ -98,13 +107,17 @@ export const NumberInputHorizontal = forwardRef<
98
107
  ref={ref}
99
108
  onClick={onClick}
100
109
  type={disabled && hasBigSize ? "text" : "number"}
101
- className={hasBigSize ? "big-sizes-input" : "small-sizes-input"}
110
+ className={clsx(
111
+ hasBigSize ? "big-sizes-input" : "small-sizes-input",
112
+ disabled && "border-0"
113
+ )}
102
114
  onChange={(e) => onChange(Number(e.target.value))}
103
115
  value={disabled && hasBigSize && !isLoading ? soldOut : value}
104
116
  min={min}
105
117
  max={max}
118
+ step={step}
106
119
  defaultValue={defaultValue}
107
- disabled={disabled}
120
+ disabled={disabled && !onSelect}
108
121
  />
109
122
  </div>
110
123
  <button
@@ -131,6 +131,12 @@
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
+
134
140
  .products {
135
141
  margin-top: 0.5rem;
136
142
 
@@ -144,10 +150,6 @@
144
150
  margin-bottom: 0.5rem;
145
151
  }
146
152
  }
147
-
148
- &:not(:last-child) {
149
- border-bottom: 2px solid $separator-color;
150
- }
151
153
  }
152
154
 
153
155
  &:not(:last-child) {
@@ -5,7 +5,7 @@
5
5
  flex-wrap: wrap;
6
6
 
7
7
  .result-card {
8
- height: 14.25rem;
8
+ height: 14rem;
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,61 +1,5 @@
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
- }
1
+ import { OrderItems } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
54
2
 
55
3
  export type SetOrderFn = (
56
- val:
57
- | Record<number, Order>
58
- | ((prevVar: Record<number, Order>) => Record<number, Order>)
4
+ val: OrderItems | ((prevVar: OrderItems) => OrderItems)
59
5
  ) => void;
60
-
61
- export type WizardFormValues = { [key: string]: any };