@licklist/design 0.44.475-dev.3 → 0.44.476-dev.1
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/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +1 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/package.json +1 -1
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.stories.tsx +1 -0
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +6 -5
- package/src/product-set/form/ProductCategoriesControl.tsx +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditEventForm.d.ts","sourceRoot":"","sources":["../../../../../src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx"],"names":[],"mappings":";AAEA,OAAO,EAIL,KAAK,EACN,MAAM,sDAAsD,CAAC;AAM9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAGvF,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAI5E,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAS7D,OAAO,EAAiB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAIzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAGnF,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;CACzC;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,WAAW,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACnD,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACvD,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC;AAOD,eAAO,MAAM,aAAa,qLAYvB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"EditEventForm.d.ts","sourceRoot":"","sources":["../../../../../src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx"],"names":[],"mappings":";AAEA,OAAO,EAIL,KAAK,EACN,MAAM,sDAAsD,CAAC;AAM9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAGvF,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAI5E,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAS7D,OAAO,EAAiB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAIzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAGnF,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;CACzC;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,WAAW,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACnD,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACvD,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC;AAOD,eAAO,MAAM,aAAa,qLAYvB,kBAAkB,gBAmVpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),i=e(r),n=require("react-i18next"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),i=e(r),n=require("react-i18next"),o=require("react-bootstrap"),l=require("react-hook-form"),a=e(require("@licklist/plugins/dist/services/Form/FormErrorService")),u=require("@react-aria/utils"),d=require("luxon"),s=require("../../../../collapsible-input-group/CollapsibleInputGroup.js"),c=require("../../../../modals/dialog/Dialog.js"),m=require("../../../../modals/dialog/DialogContext.js"),p=require("@licklist/core/dist/DataMapper/Media/ImageDataMapper"),v=require("../../../../file-upload/FileUpload.js"),g=require("../../../../tiptap-editor/TipTapEditor.js"),E=require("../SelectEventProductSet/SelectEventProductSet.js"),f=require("@licklist/plugins/dist/hooks/Media/useMultipleImages"),I=require("@licklist/plugins/dist/utils/ScrollUtils"),b=require("@licklist/plugins/dist/utils/FormValues"),S=require("../SaleDeadline/SaleDeadline.js"),P=require("../../../../provider/categories-input/CategoriesInput.js"),F=require("../../../../provider/categories-input/CategoriesInputDescription.js");require("../../../../provider/location-input/LocationInput.js"),require("../../../../provider/location-input/LocationInputDescription.js"),require("../../../../provider/provider-links-input/ProviderLinksInput.js"),require("../../../../provider/provider-details-input/ProviderDetailsInput.js"),require("../../../../provider/provider-form/ProviderForm.js"),require("../../../../provider/working-hours-input/WorkingHoursInput.js"),require("../../../../provider/working-hours-input/WorkingHoursInputDescription.js"),require("../../../../provider/venue-form/VenueForm.js"),require("../../../../provider/company/user-form/UserForm.js");var q=require("../../IntervalInput.js"),A=require("../../utils/isUrlValid.js"),D={uploadImage:p.IMAGE_TYPE_MAP[p.IMAGE_TYPE_IMAGE],uploadCover:p.IMAGE_TYPE_MAP[p.IMAGE_TYPE_COVER]},h=function(e){var t,r,i,n,o,l,a,u,s,c,m,p=function(e){return e&&d.DateTime.fromISO(e).toISO({includeOffset:!1,suppressMilliseconds:!0,suppressSeconds:!0})};return{name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"",description:null!==(r=null==e?void 0:e.description)&&void 0!==r?r:"",start:p(null!==(i=null==e?void 0:e.startAt)&&void 0!==i?i:""),end:p(null!==(n=null==e?void 0:e.endAt)&&void 0!==n?n:""),rrule:null!==(o=null==e?void 0:e.rrule)&&void 0!==o?o:void 0,categories:null!==(l=null==e?void 0:e.categories)&&void 0!==l?l:[],termsAndConditions:null!==(a=null==e?void 0:e.termsAndConditions)&&void 0!==a?a:"",visible:null!==(u=null==e?void 0:e.visible)&&void 0!==u?u:"",externalPaymentLink:null!==(s=null==e?void 0:e.externalPaymentLink)&&void 0!==s?s:"",productSetId:null==e?void 0:e.productSetId,images:null==e?void 0:e.images,saleDeadline:null==e?void 0:e.saleDeadline,integrationUrl:null!==(c=null==e?void 0:e.integrationUrl)&&void 0!==c?c:"",recurrenceEndAt:null!==(m=null==e?void 0:e.recurrenceEndAt)&&void 0!==m?m:void 0}};exports.EditEventForm=function(e){var d,C,_,y=e.disabled,k=void 0!==y&&y,M=e.categories,L=e.title,j=e.hasPermission,w=void 0===j||j,G=e.defaultEventValues,U=e.serverErrors,x=e.onSaveEvent,T=e.productSets,V=e.createProductSet,Y=e.setEditProductSetId,O=e.isExternalPaymentLinkEnabled,B=n.useTranslation(["Design","Validation"]).t,R=u.useId(),N=u.useId(),W=u.useId(),H=u.useId(),K=u.useId(),z=t.__read(r.useState(null),2),J=z[0],Q=z[1],X=t.__read(r.useState(!1),2),Z=X[0],$=X[1],ee=m.useDialogContext(),te=ee.isShownDialog,re=ee.onBeforeUnload,ie=ee.onPopState,ne=ee.onApproveDialog,oe=ee.onDeclineDialog,le=l.useForm({defaultValues:h(G)}),ae=le.register,ue=le.formState.errors,de=le.handleSubmit,se=le.formState,ce=le.reset,me=le.watch,pe=le.setValue,ve=le.setError,ge=le.getValues,Ee=le.control,fe=me("visible"),Ie=me("editedProductSet"),be=f.useMultipleImages(J),Se=be.images,Pe=be.handleImageRemove,Fe=be.handleImageUploading,qe=be.isImagesLoading,Ae=be.isCoverImagesLoading,De=r.useCallback((function(e,t){return!!A.isUrlValid(e)||B("Validation:fieldValidWebURL",{attribute:t})}),[]);return r.useEffect((function(){ce(h(G))}),[G]),r.useEffect((function(){if(G.images&&G.images.length>0){var e=ge("images");Q(e)}else Q([])}),[Q,ge,G]),r.useEffect((function(){Array.isArray(Se)&&pe("images",Se)}),[Se]),r.useEffect((function(){a.handleServerErrors(U,ve)}),[U]),r.useEffect((function(){return window.history.pushState(null,"",window.location.pathname),window.addEventListener("beforeunload",re),window.addEventListener("popstate",ie),function(){window.removeEventListener("beforeunload",re),window.removeEventListener("popstate",ie)}}),[]),i.createElement(i.Fragment,null,i.createElement(c.Dialog,{isActive:te,title:B("Design:leavePage"),content:B("Design:changesNotBeSaved"),onApprove:ne,onDecline:oe}),i.createElement("h5",{className:"edit-event-modal-title highlited-primary-title"},L),i.createElement(l.FormProvider,t.__assign({},le),i.createElement(o.Modal.Body,{as:"form",noValidate:!0,onSubmit:de(x,(function(e){I.scrollToError(b.getFirstErrorKey(e))}))},i.createElement(o.Form.Group,{controlId:"name"},i.createElement(o.Form.Label,null,B("nameOfEvent")),i.createElement(o.Form.Control,t.__assign({},ae("name",{required:B("Validation:fieldRequired",{attribute:B("name")}),maxLength:{value:255,message:B("Validation:fieldMaxLength",{attribute:B("name"),max:255})}}),{name:"name",required:!0,isInvalid:Boolean(ue.name),disabled:k})),i.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(d=ue.name)||void 0===d?void 0:d.message)),Object.keys(D).map((function(e){var t=D[e];return i.createElement(v.FileUpload,{key:e,allowedExtensions:["jpg","jpeg","png"],enablePreview:!0,defaultFiles:null==Se?void 0:Se.filter((function(e){return p.IMAGE_TYPE_MAP[e.imageType]===t})),onFilesChange:function(e){Fe(e,t)},secondSubtitle:t===p.IMAGE_TYPE_MAP[p.IMAGE_TYPE_IMAGE]?"1200x600":void 0,title:B("Design:".concat(e)),onFileRemove:function(e,r){return Pe(String(e),r,t)},isLoading:t===p.IMAGE_TYPE_MAP[p.IMAGE_TYPE_IMAGE]?qe:Ae,disabled:k})})),i.createElement(o.Form.Group,{controlId:R},i.createElement(o.Form.Label,null,B("description")),i.createElement(l.Controller,{render:function(e){var t=e.field;return i.createElement(g.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:t.onChange,content:t.value,disabled:k})},name:"description"})),i.createElement(q.IntervalInput,{key:me("rrule"),disabled:k,editedProductSet:Ie}),0!==M.length&&i.createElement(o.Form.Group,null,i.createElement(o.Accordion,null,i.createElement(s.CollapsibleInputGroup,{eventKey:"categories",label:B("categories"),description:i.createElement(F.CategoriesInputDescription,{categories:M})},i.createElement(P.CategoriesInput,{categories:M})))),i.createElement(S.SaleDeadline,{disabled:k}),i.createElement(o.Form.Group,{controlId:N},i.createElement(o.Form.Label,null,B("termsAndConditions")),i.createElement(l.Controller,{render:function(e){var t=e.field;return i.createElement(g.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:t.onChange,content:t.value,disabled:k})},name:"termsAndConditions"})),O&&i.createElement(o.Form.Group,{controlId:K},i.createElement(o.Form.Label,null,B("externalPaymentLink")),i.createElement(o.Form.Control,t.__assign({},ae("externalPaymentLink",{validate:function(e){return!e||De(e,B("Design:externalPaymentLink"))}}),{name:"externalPaymentLink",type:"url",inputMode:"url",disabled:k,isInvalid:Boolean(ue.externalPaymentLink)})),i.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(C=ue.externalPaymentLink)||void 0===C?void 0:C.message)),i.createElement(o.Form.Group,{controlId:W,className:"mt-5"},i.createElement(o.Form.Label,null,B("public")," / ",B("private")),i.createElement(l.Controller,{control:Ee,name:"visible",rules:{validate:function(e){return"boolean"==typeof e||B("Validation:fieldRequired",{attribute:B("visible")})}},render:function(e){var t=e.field,r=e.fieldState,n=r.invalid,l=r.error,a=String(t.value);return i.createElement(i.Fragment,null,i.createElement(o.Form.Control,{as:"select",onChange:function(e){var r=e.target.value;t.onChange(r?"true"===r:r)},isInvalid:n,defaultValue:"",value:a,disabled:k},i.createElement("option",{value:""},B("Design:pleaseChooseOne")),i.createElement("option",{value:"false"},B("Design:private")),i.createElement("option",{value:"true"},B("Design:public"))),i.createElement(o.Form.Control.Feedback,{type:"invalid"},null==l?void 0:l.message))}})),"boolean"!=typeof fe||fe?null:i.createElement(o.Form.Group,{controlId:H},i.createElement(o.Form.Label,null,B("Design:integrationUrl")),i.createElement(o.Form.Control,t.__assign({},ae("integrationUrl",{required:B("Validation:fieldRequired",{attribute:B("Design:integrationUrl")}),validate:function(e){return De(e,B("Design:integrationUrl"))}}),{name:"integrationUrl",isInvalid:Boolean(ue.integrationUrl),placeholder:B("Design:integrationUrl"),disabled:k})),i.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(_=ue.integrationUrl)||void 0===_?void 0:_.message)),i.createElement(E.SelectEventProductSet,{productSets:T||[],createProductSet:V,setEditProductSetId:Y,setShowEditProductSet:$,showEditProductSet:Z}),w&&!Z&&i.createElement(o.Button,{disabled:k||se.isSubmitting||qe||Ae,className:"save-event",type:"submit"},se.isSubmitting?"".concat(B("saveAndAdd"),"..."):B("saveAndAdd")))))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCategoriesControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductCategoriesControl.tsx"],"names":[],"mappings":";AAYA,OAAO,EAKL,YAAY,EACb,MAAM,kEAAkE,CAAC;AAQ1E,OAAO,EAAwB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQvE,UAAU,6BAA8B,SAAQ,aAAa;IAC3D,SAAS,EAAE,MAAM,CAAC;CACnB;AA4BD,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,SAAS,GACV,EAAE,6BAA6B,
|
|
1
|
+
{"version":3,"file":"ProductCategoriesControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductCategoriesControl.tsx"],"names":[],"mappings":";AAYA,OAAO,EAKL,YAAY,EACb,MAAM,kEAAkE,CAAC;AAQ1E,OAAO,EAAwB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQvE,UAAU,6BAA8B,SAAQ,aAAa;IAC3D,SAAS,EAAE,MAAM,CAAC;CACnB;AA4BD,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,SAAS,GACV,EAAE,6BAA6B,eAsR/B;AAED,eAAO,MAAM,cAAc,iBACX,YAAY,SACnB,MAAM;WACH,MAAM;eAAa,MAAM;CAcpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),n=e(r),o=require("react-i18next"),i=require("react-bootstrap"),a=require("react-hook-form"),u=e(require("@licklist/plugins/dist/services/Form/HookFormService")),d=e(require("clsx")),l=require("@dnd-kit/core"),s=require("lodash"),c=require("../../sortable-tree/SortableTreeItem.js"),m=require("../../sortable-tree/SortableTree.js"),p=require("../item/CreateProductSetItem.js"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),n=e(r),o=require("react-i18next"),i=require("react-bootstrap"),a=require("react-hook-form"),u=e(require("@licklist/plugins/dist/services/Form/HookFormService")),d=e(require("clsx")),l=require("@dnd-kit/core"),s=require("lodash"),c=require("../../sortable-tree/SortableTreeItem.js"),m=require("../../sortable-tree/SortableTree.js"),p=require("../item/CreateProductSetItem.js"),g=require("./context.js"),v=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),f=require("../product-category/ProductCategoryControl.js"),y=require("./ProductsControl.js"),C=require("./SelectCategoryModal.js"),E=require("./VenueMapSetModal.js"),_=require("../utils/index.js");var b=function(e,t){return e===v.CATEGORY_TYPE_GAME?{className:"game-badge",label:t}:e===v.CATEGORY_TYPE_FIXED_DURATION?{className:"fixed-duration-badge",label:t}:null};exports.ProductCategoriesControl=function(e){var I,S,q,T,x,P,N=e.isLoading,M=e.stepIndex,A=o.useTranslation("Design").t,h=r.useContext(g.ProductSetLoadingContext),k=h.providerHasMap,j=h.expandedProductCategories,D=h.setExpandedProductCategories,R=a.useFormContext(),V=t.__read(r.useState(!1),2),Y=V[0],F=V[1],O=t.__read(r.useState(!1),2),B=O[0],L=O[1],w=t.__read(r.useState(!1),2),G=w[0],H=w[1],Q=R.control,U=R.formState.errors,K=R.clearErrors,z=R.watch,W=R.trigger,X=R.getValues,J=R.setValue,Z=z("steps.".concat(M,".hasMap"))||!1,$="steps.".concat(M,".productCategories"),ee=a.useFieldArray({name:$,control:Q,keyName:"_id"}),te=ee.fields,re=ee.append,ne=ee.remove,oe=t.__read(r.useState({}),2),ie=oe[0],ae=oe[1],ue=a.useWatch({control:Q,name:$}),de=null===(S=null===(I=null==U?void 0:U.steps)||void 0===I?void 0:I[M])||void 0===S?void 0:S.productCategories,le=null===(T=null===(q=null==U?void 0:U.steps)||void 0===q?void 0:q[M])||void 0===T?void 0:T.venueMapSetId,se=null===(P=null===(x=null==U?void 0:U.steps)||void 0===x?void 0:x[M])||void 0===P?void 0:P.pointProducts,ce=Boolean(le||se),me=l.useSensor(l.MouseSensor,{activationConstraint:{distance:10}});return r.useEffect((function(){ue&&ue.length&&ue.forEach((function(e){var r,n,o=null===(r=e.products)||void 0===r?void 0:r.reduce((function(e,t){return e+Number(t.price)*Number(t.totalQuantity)}),0),i=null===(n=e.products)||void 0===n?void 0:n.reduce((function(e,t){return e+Number(t.totalQuantity)}),0);ae((function(r){var n;return t.__assign(t.__assign({},r),((n={})[(null==e?void 0:e.id)||e.uniqueId]={price:o,quantity:i},n))}))}))}),[ue]),r.useEffect((function(){1===te.length&&D((function(e){var r,n,o;return t.__assign(t.__assign({},e),((r={})[String((null===(n=te[0])||void 0===n?void 0:n.id)||(null===(o=te[0])||void 0===o?void 0:o.uniqueId))]=!0,r))}))}),[te]),n.createElement(n.Fragment,null,n.createElement(m.SortableTree,{sensors:[me],items:te.map((function(e){return String(e._id)})),onDragEnd:function(e){var t=e.active,r=e.over;if(t&&r&&(null==t?void 0:t.id)&&(null==r?void 0:r.id)){var n=te.findIndex((function(e){return e._id===t.id})),o=te.findIndex((function(e){return e._id===r.id}));if(n!==o){var i=X($);if(i){var a=_.sortArrayByIndex(_.moveArrayElements(i,n,o));J($,a)}}}}},te.map((function(e,r){var o=(null==e?void 0:e.id)?String(e.id):e.uniqueId,u=function(){!function(e){D((function(r){var n;return t.__assign(t.__assign({},r),((n={})[e]=!r[e],n))}))}(o)};return n.createElement(a.Controller,{key:"product-category-".concat(e._id),name:"".concat($,".").concat(r,".name"),control:Q,rules:{required:A("Validation:fieldRequired",{attribute:A("name")})},render:function(t){var a,d,l,s=t.field,p=s.value,g=s.onChange;return n.createElement(m.SortableTree.Item,{id:e._id,title:p,isExpanded:j[o],setIsExpanded:u,isInvalid:!!de,badge:n.createElement(i.Badge,{className:"category-badge"},A("productCategory")),isIconInHeader:!1,subTitle:n.createElement("div",{className:"product-set-badges-container"},n.createElement("div",{className:"product-set-subtitle-dot product-set-subtitle-category-dot"}),n.createElement("span",null,null!==(l=null===(d=ie[null!==(a=null==e?void 0:e.id)&&void 0!==a?a:e.uniqueId])||void 0===d?void 0:d.quantity)&&void 0!==l?l:"N/A"," ",A("products"))),treeLineIconColor:"#1A93AA",modalLabel:A("addNewCategory"),secondaryBadge:b(e.type,A(e.type)),modalClass:c.ProductSetModalClasses.category,isNewAdded:G,body:n.createElement(f.ProductCategoryControl,{isLoading:N,onCategoryNameChange:g,categoryName:p,stepIndex:M,productCategoryIndex:r}),onDelete:function(){return ne(r)},validate:function(){return W("steps.".concat(M,".productCategories.").concat(r))},sortableItems:e.products?e.products.filter((function(e){return e.id})).map((function(e){var t=e.id;return String(t)})):[]},n.createElement(y.ProductsControl,{isLoading:N,quantityType:e.quantityType,hasTicket:null==e?void 0:e.hasTicket,stepIndex:M,productCategoryIndex:r,categoryType:e.type}))}})}))),n.createElement(p.CreateProductSetItem,{title:A("addCategory"),onClick:function(){F(!0)}}),n.createElement(C.SelectCategoryModal,{isVisible:Y,onHide:function(){return F(!1)},onCategorySelect:function(e){re(function(e,t){return{id:null,uniqueId:s.uniqueId("product-category"),name:"",minSubItems:null,maxSubItems:null,quantityType:v.QUANTITY_TYPE_STANDARD,type:e,isRelyOnPeople:e===v.CATEGORY_TYPE_TICKETS,isTimeRelated:!1,collectUserInfo:!1,hasTicket:e===v.CATEGORY_TYPE_TICKETS,allowDeposits:!1,remainderExpireAfter:void 0,hasBookingManagement:!1,weight:0,isReusable:!1,hasSubEvents:!1,products:[],zoneId:null,sort:t}}(e,te.length)),H(!0),(null==de?void 0:de.type)===u.manualErrorType&&K($)}}),k&&Z&&n.createElement(n.Fragment,null,n.createElement(p.CreateProductSetItem,{title:A("editMap"),onClick:function(){L(!0)},className:d("mt-3",ce&&"mb-3",ce&&"is-invalid")}),ce&&n.createElement("div",{className:"manual-form-error"},le&&A("Validation:fieldRequired",{attribute:A("Design:venueMapSet")}),se&&A("Validation:fieldMinNumber",{attribute:A("pointProduct"),min:1})),n.createElement(E.VenueMapSetModal,{isVisible:B,setIsVisible:L,stepIndex:M})),n.createElement("div",{className:"manual-form-error"},de&&de.message))},exports.getBadgeConfig=b;
|
package/package.json
CHANGED
|
@@ -1082,6 +1082,7 @@ export const Default: Story<EditEventFormProps> = (args) => {
|
|
|
1082
1082
|
<EventEditProductSetContext.Provider value={contextValue}>
|
|
1083
1083
|
<EditEventForm
|
|
1084
1084
|
{...args}
|
|
1085
|
+
isExternalPaymentLinkEnabled
|
|
1085
1086
|
title="Create new event"
|
|
1086
1087
|
categories={categories}
|
|
1087
1088
|
setEditProductSetId={setEditProductSetId}
|
|
@@ -308,11 +308,12 @@ export const EditEventForm = ({
|
|
|
308
308
|
<Form.Label>{t("externalPaymentLink")}</Form.Label>
|
|
309
309
|
<Form.Control
|
|
310
310
|
{...register("externalPaymentLink", {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
validateURL(url, t("Design:externalPaymentLink"))
|
|
311
|
+
validate: (url) => {
|
|
312
|
+
if (!url) {
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
return validateURL(url, t("Design:externalPaymentLink"));
|
|
316
|
+
},
|
|
316
317
|
})}
|
|
317
318
|
name="externalPaymentLink"
|
|
318
319
|
type="url"
|
|
@@ -99,7 +99,7 @@ export function ProductCategoriesControl({
|
|
|
99
99
|
});
|
|
100
100
|
const [productCategoryState, setProductCategoryState] = useState<
|
|
101
101
|
Record<number, { price: number; quantity: number }>
|
|
102
|
-
>(
|
|
102
|
+
>({});
|
|
103
103
|
|
|
104
104
|
const productCategories: ProductCategory[] = useWatch({
|
|
105
105
|
control,
|
|
@@ -168,14 +168,15 @@ export function ProductCategoriesControl({
|
|
|
168
168
|
return sum + Number(product.totalQuantity);
|
|
169
169
|
}, 0);
|
|
170
170
|
|
|
171
|
-
setProductCategoryState({
|
|
171
|
+
setProductCategoryState((prevState) => ({
|
|
172
|
+
...prevState,
|
|
172
173
|
// New added categories will have uniqueId
|
|
173
174
|
// but existing have already assigned Id.
|
|
174
175
|
[productCategory?.id || productCategory.uniqueId]: {
|
|
175
176
|
price,
|
|
176
177
|
quantity,
|
|
177
178
|
},
|
|
178
|
-
});
|
|
179
|
+
}));
|
|
179
180
|
});
|
|
180
181
|
}, [productCategories]);
|
|
181
182
|
|