@licklist/design 0.44.467 → 0.44.468
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/iframe/order-process/components/StepsForm/StepsForm.d.ts +0 -2
- package/dist/iframe/order-process/components/StepsForm/StepsForm.d.ts.map +1 -1
- package/dist/iframe/order-process/components/StepsForm/StepsForm.js +1 -1
- package/dist/styles/iframe-events/Event.scss +1 -1
- package/dist/styles/iframe-page/PageBody.scss +8 -6
- package/package.json +1 -1
- package/src/iframe/order-process/components/StepsForm/StepsForm.tsx +0 -26
- package/src/styles/iframe-events/Event.scss +1 -1
- package/src/styles/iframe-page/PageBody.scss +8 -6
|
@@ -2,8 +2,6 @@ import React from "react";
|
|
|
2
2
|
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
3
3
|
import { MenuStep } from "../../../../types";
|
|
4
4
|
export interface StepsFormProps {
|
|
5
|
-
relyOnPeopleCategoryIds?: number[];
|
|
6
|
-
ticketCategoriesIds?: number[];
|
|
7
5
|
step: MenuStep;
|
|
8
6
|
isLastMenuStep: boolean;
|
|
9
7
|
onSubmit: (values: Record<string, any>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepsForm.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/StepsForm/StepsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"StepsForm.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/StepsForm/StepsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAWf,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAE5F,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAO7C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAChD,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACrD,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;CAC/D;AAED,oBAAY,YAAY,GAAG;IACzB,aAAa,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,SAAS,qFAoIrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("tslib"),t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("tslib"),t=require("react"),s=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-i18next"),i=require("react-bootstrap"),u=require("react-hook-form"),a=require("lodash"),l=require("@licklist/plugins/dist/hooks/Value/usePreviousValue"),n=require("@licklist/plugins/dist/utils/ScrollUtils"),c=require("@licklist/plugins/dist/utils/FormValues"),m=require("../Category/Category.js"),d=require("../../constants.js"),f=require("../CalendarStepsForm/components/ErrorModal.js"),E=require("../utils/category.js"),p="NO_ORDER_ITEMS_ERROR",g=t.forwardRef((function(e,g){var v=e.step,y=e.isLastMenuStep,q=e.setFormValues,F=e.defaultValues,S=e.onSubmit,V=e.setFormErrors,_=e.id,C=void 0===_?d.STEP_FORM_ID:_,h=e.productsWithErrors,b=u.useForm({defaultValues:F}),j=o.useTranslation(["Design","Validation"]).t,O=r.__read(t.useState(""),2),P=O[0],R=O[1],T=E.useCategory().verifyCategoryItems,k=b.control,M=b.formState.errors,x=b.getValues,I=b.setError,D=b.clearErrors,K=b.reset,N=u.useWatch({control:k}),W=l.usePreviousValue(M);t.useImperativeHandle(g,(function(){return{getFormValues:function(){return x()}}})),t.useEffect((function(){h&&R(j("soldOutProduct"))}),[h]);return t.useEffect((function(){M&&setTimeout(D,0),q(N)}),[N]),t.useEffect((function(){c.isFormValuesEmpty(N)||D(p)}),[N,D]),t.useEffect((function(){K(F)}),[F]),t.useEffect((function(){!a.isEqual(M,W)&&V&&V(M)}),[M,W,V]),s.createElement(i.Form,{onSubmit:b.handleSubmit((function(e){if(y&&c.isFormValuesEmpty(e))return I(p,{}),void n.scrollToError(p);var r=T(e,v);if(r)return R(r.message),void I("category_".concat(r.id),{message:r.message});S(e)}),(function(e){n.scrollToError(c.getFirstErrorKey(e)),R(j("pleaseCheckSelectedProducts"))})),id:C},s.createElement(u.FormProvider,r.__assign({},b),s.createElement(f.ErrorModal,{isOpen:Boolean(P),messageKey:P,onClose:function(){return R("")}}),s.createElement("div",null,s.createElement("div",{className:"iframe-event"},s.createElement(m.Category,{productCategories:null==v?void 0:v.productCategories,productsWithErrors:h,errors:M}),M[p]&&s.createElement("div",{className:"d-flex m-5 justify-content-center form-error",id:p},s.createElement(o.Trans,{t:j,i18nKey:"pleaseSelectAtLeastFrom",values:{min:1,type:"item",from:"those categories"}}))))))}));exports.StepsForm=g;
|
|
@@ -119,6 +119,7 @@
|
|
|
119
119
|
|
|
120
120
|
&.show {
|
|
121
121
|
overflow: scroll;
|
|
122
|
+
overflow-x: hidden;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
@include media-breakpoint-down(sm) {
|
|
@@ -164,7 +165,8 @@
|
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
input,
|
|
168
|
+
input,
|
|
169
|
+
select {
|
|
168
170
|
border-radius: $iframe-border-radius;
|
|
169
171
|
height: 2.25rem;
|
|
170
172
|
padding: 0.25rem 0.5rem;
|
|
@@ -205,16 +207,16 @@
|
|
|
205
207
|
&:focus,
|
|
206
208
|
&.focus {
|
|
207
209
|
&:not(:disabled) {
|
|
208
|
-
background-color:
|
|
209
|
-
box-shadow: 0 0 0 $input-btn-focus-width darken(#
|
|
210
|
+
background-color: darken(#0e8ce2, 10%);
|
|
211
|
+
box-shadow: 0 0 0 $input-btn-focus-width darken(#0e8ce2, 10%);
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
214
|
|
|
213
215
|
&:active,
|
|
214
216
|
&.active {
|
|
215
217
|
&:not(:disabled) {
|
|
216
|
-
background-color: darken(#
|
|
217
|
-
box-shadow: 0 0 0 $input-btn-focus-width darken(#
|
|
218
|
+
background-color: darken(#0e8ce2, 10%);
|
|
219
|
+
box-shadow: 0 0 0 $input-btn-focus-width darken(#0e8ce2, 10%);
|
|
218
220
|
}
|
|
219
221
|
}
|
|
220
222
|
}
|
|
@@ -229,7 +231,7 @@
|
|
|
229
231
|
font-size: 0.875rem;
|
|
230
232
|
height: 2.25rem;
|
|
231
233
|
|
|
232
|
-
&:focus{
|
|
234
|
+
&:focus {
|
|
233
235
|
box-shadow: unset;
|
|
234
236
|
}
|
|
235
237
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, {
|
|
2
2
|
useEffect,
|
|
3
|
-
useMemo,
|
|
4
3
|
forwardRef,
|
|
5
4
|
useImperativeHandle,
|
|
6
5
|
useState,
|
|
@@ -17,7 +16,6 @@ import {
|
|
|
17
16
|
} from "@licklist/plugins/dist/utils/FormValues";
|
|
18
17
|
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
19
18
|
import { Category } from "../Category";
|
|
20
|
-
import { NumberOfPeopleInput } from "../../../event/event-details/components/number-of-people-input";
|
|
21
19
|
import { MenuStep } from "../../../../types";
|
|
22
20
|
import { STEP_FORM_ID } from "../../constants";
|
|
23
21
|
import { ErrorModal } from "../CalendarStepsForm/components/ErrorModal";
|
|
@@ -26,8 +24,6 @@ import { useCategory } from "../utils/category";
|
|
|
26
24
|
const NO_ORDER_ITEMS_ERROR = "NO_ORDER_ITEMS_ERROR";
|
|
27
25
|
|
|
28
26
|
export interface StepsFormProps {
|
|
29
|
-
relyOnPeopleCategoryIds?: number[];
|
|
30
|
-
ticketCategoriesIds?: number[];
|
|
31
27
|
step: MenuStep;
|
|
32
28
|
isLastMenuStep: boolean;
|
|
33
29
|
onSubmit: (values: Record<string, any>) => void;
|
|
@@ -47,8 +43,6 @@ export const StepsForm = forwardRef<StepsFormRef, StepsFormProps>(
|
|
|
47
43
|
{
|
|
48
44
|
step,
|
|
49
45
|
isLastMenuStep,
|
|
50
|
-
relyOnPeopleCategoryIds = [],
|
|
51
|
-
ticketCategoriesIds = [],
|
|
52
46
|
setFormValues,
|
|
53
47
|
defaultValues,
|
|
54
48
|
onSubmit,
|
|
@@ -74,22 +68,6 @@ export const StepsForm = forwardRef<StepsFormRef, StepsFormProps>(
|
|
|
74
68
|
const formValues = useWatch({ control });
|
|
75
69
|
const prevErrors = usePreviousValue(errors);
|
|
76
70
|
|
|
77
|
-
const shouldShowPeopleInput = useMemo(() => {
|
|
78
|
-
if (ticketCategoriesIds.length || !relyOnPeopleCategoryIds?.length) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
const values = Object.values(formValues)
|
|
82
|
-
.filter(Boolean)
|
|
83
|
-
.filter(
|
|
84
|
-
(product) =>
|
|
85
|
-
relyOnPeopleCategoryIds.includes(product.productsCategoryId) &&
|
|
86
|
-
product.quantity > 0 &&
|
|
87
|
-
!product.isSoldOut
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
return Boolean(values.length);
|
|
91
|
-
}, [formValues, relyOnPeopleCategoryIds, ticketCategoriesIds]);
|
|
92
|
-
|
|
93
71
|
useImperativeHandle(ref, () => {
|
|
94
72
|
return {
|
|
95
73
|
getFormValues: () => getValues(),
|
|
@@ -174,10 +152,6 @@ export const StepsForm = forwardRef<StepsFormRef, StepsFormProps>(
|
|
|
174
152
|
errors={errors}
|
|
175
153
|
/>
|
|
176
154
|
|
|
177
|
-
{shouldShowPeopleInput && isLastMenuStep && (
|
|
178
|
-
<NumberOfPeopleInput />
|
|
179
|
-
)}
|
|
180
|
-
|
|
181
155
|
{errors[NO_ORDER_ITEMS_ERROR] && (
|
|
182
156
|
<div
|
|
183
157
|
className="d-flex m-5 justify-content-center form-error"
|
|
@@ -119,6 +119,7 @@
|
|
|
119
119
|
|
|
120
120
|
&.show {
|
|
121
121
|
overflow: scroll;
|
|
122
|
+
overflow-x: hidden;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
@include media-breakpoint-down(sm) {
|
|
@@ -164,7 +165,8 @@
|
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
input,
|
|
168
|
+
input,
|
|
169
|
+
select {
|
|
168
170
|
border-radius: $iframe-border-radius;
|
|
169
171
|
height: 2.25rem;
|
|
170
172
|
padding: 0.25rem 0.5rem;
|
|
@@ -205,16 +207,16 @@
|
|
|
205
207
|
&:focus,
|
|
206
208
|
&.focus {
|
|
207
209
|
&:not(:disabled) {
|
|
208
|
-
background-color:
|
|
209
|
-
box-shadow: 0 0 0 $input-btn-focus-width darken(#
|
|
210
|
+
background-color: darken(#0e8ce2, 10%);
|
|
211
|
+
box-shadow: 0 0 0 $input-btn-focus-width darken(#0e8ce2, 10%);
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
214
|
|
|
213
215
|
&:active,
|
|
214
216
|
&.active {
|
|
215
217
|
&:not(:disabled) {
|
|
216
|
-
background-color: darken(#
|
|
217
|
-
box-shadow: 0 0 0 $input-btn-focus-width darken(#
|
|
218
|
+
background-color: darken(#0e8ce2, 10%);
|
|
219
|
+
box-shadow: 0 0 0 $input-btn-focus-width darken(#0e8ce2, 10%);
|
|
218
220
|
}
|
|
219
221
|
}
|
|
220
222
|
}
|
|
@@ -229,7 +231,7 @@
|
|
|
229
231
|
font-size: 0.875rem;
|
|
230
232
|
height: 2.25rem;
|
|
231
233
|
|
|
232
|
-
&:focus{
|
|
234
|
+
&:focus {
|
|
233
235
|
box-shadow: unset;
|
|
234
236
|
}
|
|
235
237
|
}
|