@licklist/design 0.61.0 → 0.62.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.
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { AttemptPaymentResponse } from "@licklist/plugins/dist/hooks/Ryft/useRyftPayment";
3
+ import { ProviderPaymentSettings } from "@licklist/core/dist/DataMapper/Setting/ProviderPaymentSettingsDataMapper";
3
4
  export declare const ryftErrorMap: Record<string, string>;
4
5
  export type RyftPaymentFormValues = Record<string, never>;
5
6
  export interface RyftPaymentFormProps {
@@ -8,6 +9,7 @@ export interface RyftPaymentFormProps {
8
9
  initRyft: (onSuccess: () => void, onFailure: (error?: string) => void) => Promise<void>;
9
10
  onSubmit: () => Promise<AttemptPaymentResponse>;
10
11
  resetReferrer?: () => void;
12
+ providerPaymentSettings?: ProviderPaymentSettings;
11
13
  }
12
- export declare const RyftPaymentForm: ({ accountId, isCreateLoading, initRyft, resetReferrer, onSubmit, }: RyftPaymentFormProps) => JSX.Element;
14
+ export declare const RyftPaymentForm: ({ accountId, isCreateLoading, providerPaymentSettings, initRyft, resetReferrer, onSubmit, }: RyftPaymentFormProps) => JSX.Element;
13
15
  //# sourceMappingURL=RyftPaymentForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RyftPaymentForm.d.ts","sourceRoot":"","sources":["../../../src/iframe/ryft/RyftPaymentForm.tsx"],"names":[],"mappings":";AAOA,OAAO,EAKL,sBAAsB,EACvB,MAAM,kDAAkD,CAAC;AAI1D,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAW/C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IAEnC,SAAS,EAAE,GAAG,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,CACR,SAAS,EAAE,MAAM,IAAI,EACrB,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,KAChC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,QAAQ,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,uEAMzB,oBAAoB,gBAyJtB,CAAC"}
1
+ {"version":3,"file":"RyftPaymentForm.d.ts","sourceRoot":"","sources":["../../../src/iframe/ryft/RyftPaymentForm.tsx"],"names":[],"mappings":";AAOA,OAAO,EAKL,sBAAsB,EACvB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0EAA0E,CAAC;AAKnH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAW/C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IAEnC,SAAS,EAAE,GAAG,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,CACR,SAAS,EAAE,MAAM,IAAI,EACrB,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,KAChC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,QAAQ,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAED,eAAO,MAAM,eAAe,gGAOzB,oBAAoB,gBA8JtB,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),a=require("react-router-dom"),i=require("../../static/loader/BlockLoader.js"),o=require("react-i18next"),u=e(require("react-bootstrap/Button")),s=require("react-hook-form"),c=require("../../static/loader/ButtonLoader.js"),l=e(require("react-bootstrap/Alert"));require("../../static/index.js");var d=require("@licklist/plugins/dist/hooks/Ryft/useRyftPayment"),f=require("./utils/ryft-form.js"),m={insufficient_funds:"insufficientFunds",declined_do_not_honour:"declinedDoNotHonour",invalid_card_number:"invalidCardNumber",restricted_card:"restrictedCard",security_violation:"securityViolation",expired_card:"expiredCard",gateway_reject:"gatewayReject",bad_track_data:"badTrackData","3ds_authentication_failure":"3dsAuthenticationFailure",unknown_error:"unknownError"};exports.RyftPaymentForm=function(e){var y,_,v=e.accountId,E=e.isCreateLoading,p=e.initRyft,g=e.resetReferrer,R=e.onSubmit,b=o.useTranslation(["Design","Validation","Ryft"]).t,h=r.useRef(null),q=a.useHistory(),k=t.__read(r.useState(!1),2),w=k[0],N=k[1],S=t.__read(r.useState(!1),2),T=S[0],F=S[1],A=t.__read(r.useState(!1),2),P=A[0],j=A[1],x=t.__read(r.useState(void 0),2),C=x[0],D=x[1],L=d.useRyftPayment().addEventHandler,U=s.useForm(),V=function(){g&&g()},B=function(e){(null==e?void 0:e.id)&&(null==e?void 0:e.returnUrl)&&(window.location.href="".concat(e.returnUrl,"&ps=").concat(e.id),V())};return r.useEffect((function(){return f.injectComponentsInRyftForm({t:b})}),[null===(_=null===(y=h.current)||void 0===y?void 0:y.childNodes)||void 0===_?void 0:_.length]),r.useEffect((function(){v.data&&!v.isError&&p((function(){L("cardValidationChanged",(function(e){N(e.isValid)})),j(!1)}),(function(){return j(!0)}))}),[v.data]),v.isLoading||v.isFetching||E?n.createElement("div",{className:"mt-5 pt-5"},n.createElement(i.BlockLoader,null)):v.isError?n.createElement("div",{className:"mt-5 ryft-init-failure"},n.createElement(l,{key:"danger",variant:"danger"},n.createElement("h5",null,b("Ryft:errorMessage")),b("Ryft:noPaymentProviderFound"))):P?n.createElement("div",{className:"mt-5 ryft-init-failure"},n.createElement(l,{key:"danger",variant:"danger"},n.createElement("h5",null,b("Ryft:errorMessage")),b("Ryft:initFailureMessage"),n.createElement("div",{className:"flex flex-column align-items-center mt-4"},n.createElement(u,{variant:"primary",onClick:function(){q.go(0)}},b("Ryft:refresh"))))):n.createElement(n.Fragment,null,n.createElement("form",{ref:h,id:"ryft-pay-form",noValidate:!0,onSubmit:U.handleSubmit((function(){return t.__awaiter(void 0,void 0,void 0,(function(){var e,r,n;return t.__generator(this,(function(t){switch(t.label){case 0:F(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,R()];case 2:if((e=t.sent())||D("unknown_error"),"requiredAction"in e){if(e.status!==d.RYFT_STATUS_PENDING_ACTION||!(null===(n=e.requiredAction)||void 0===n?void 0:n.url))return B(e),[2];window.location.href=e.requiredAction.url,V()}return e.status===d.RYFT_STATUS_APPROVED||e.status===d.RYFT_STATUS_CAPTURED?(B(e),[2]):(e.lastError&&(D(e.lastError),V()),[3,5]);case 3:return r=t.sent(),D(r),[3,5];case 4:return F(!1),[7];case 5:return[2]}}))}))})),className:"ryft-payment-form"},n.createElement("div",{className:"submit-button-wrapper mt-4 p-1"},n.createElement(u,{type:"submit",disabled:T||!w},T&&n.createElement(c.ButtonLoader,null),b("Design:buyNow"))),C&&n.createElement("div",{id:"ryft-payment-error"},b("".concat(m[C])))))},exports.ryftErrorMap=m;
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),a=require("react-router-dom"),i=require("../../static/loader/BlockLoader.js"),o=require("react-i18next"),u=e(require("react-bootstrap/Button")),d=require("react-hook-form"),s=require("../../static/loader/ButtonLoader.js"),l=e(require("react-bootstrap/Alert"));require("../../static/index.js");var c=require("@licklist/plugins/dist/hooks/Ryft/useRyftPayment"),f=require("./utils/ryft-form.js"),m={insufficient_funds:"insufficientFunds",declined_do_not_honour:"declinedDoNotHonour",invalid_card_number:"invalidCardNumber",restricted_card:"restrictedCard",security_violation:"securityViolation",expired_card:"expiredCard",gateway_reject:"gatewayReject",bad_track_data:"badTrackData","3ds_authentication_failure":"3dsAuthenticationFailure",unknown_error:"unknownError"};exports.RyftPaymentForm=function(e){var y,_,v=e.accountId,E=e.isCreateLoading,p=e.providerPaymentSettings,g=e.initRyft,b=e.resetReferrer,h=e.onSubmit,R=o.useTranslation(["Design","Validation","Ryft"]).t,q=r.useRef(null),S=a.useHistory(),k=t.__read(r.useState(!1),2),w=k[0],N=k[1],P=t.__read(r.useState(!1),2),T=P[0],F=P[1],A=t.__read(r.useState(!1),2),j=A[0],x=A[1],C=t.__read(r.useState(void 0),2),D=C[0],M=C[1],L=c.useRyftPayment().addEventHandler,U=d.useForm(),V=function(){b&&b()},B=function(e){(null==e?void 0:e.id)&&(null==e?void 0:e.returnUrl)&&(window.location.href="".concat(e.returnUrl,"&ps=").concat(e.id),V())};return r.useEffect((function(){return f.injectComponentsInRyftForm({t:R,additionalPaymentMethodsEnabled:null==p?void 0:p.additionalPaymentMethodsEnabled})}),[null===(_=null===(y=q.current)||void 0===y?void 0:y.childNodes)||void 0===_?void 0:_.length]),r.useEffect((function(){v.data&&!v.isError&&g((function(){L("cardValidationChanged",(function(e){N(e.isValid)})),x(!1)}),(function(){return x(!0)}))}),[v.data]),v.isLoading||v.isFetching||E?n.createElement("div",{className:"mt-5 pt-5"},n.createElement(i.BlockLoader,null)):v.isError?n.createElement("div",{className:"mt-5 ryft-init-failure"},n.createElement(l,{key:"danger",variant:"danger"},n.createElement("h5",null,R("Ryft:errorMessage")),R("Ryft:noPaymentProviderFound"))):j?n.createElement("div",{className:"mt-5 ryft-init-failure"},n.createElement(l,{key:"danger",variant:"danger"},n.createElement("h5",null,R("Ryft:errorMessage")),R("Ryft:initFailureMessage"),n.createElement("div",{className:"flex flex-column align-items-center mt-4"},n.createElement(u,{variant:"primary",onClick:function(){S.go(0)}},R("Ryft:refresh"))))):n.createElement(n.Fragment,null,n.createElement("form",{ref:q,id:"ryft-pay-form",noValidate:!0,onSubmit:U.handleSubmit((function(){return t.__awaiter(void 0,void 0,void 0,(function(){var e,r,n;return t.__generator(this,(function(t){switch(t.label){case 0:F(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,h()];case 2:if((e=t.sent())||M("unknown_error"),"requiredAction"in e){if(e.status!==c.RYFT_STATUS_PENDING_ACTION||!(null===(n=e.requiredAction)||void 0===n?void 0:n.url))return B(e),[2];window.location.href=e.requiredAction.url,V()}return e.status===c.RYFT_STATUS_APPROVED||e.status===c.RYFT_STATUS_CAPTURED?(B(e),[2]):(e.lastError&&(M(e.lastError),V()),[3,5]);case 3:return r=t.sent(),M(r),[3,5];case 4:return F(!1),[7];case 5:return[2]}}))}))})),className:"ryft-payment-form"},n.createElement("div",{className:"submit-button-wrapper mt-4 p-1"},n.createElement(u,{type:"submit",disabled:T||!w},T&&n.createElement(s.ButtonLoader,null),R("Design:buyNow"))),D&&n.createElement("div",{id:"ryft-payment-error"},R("".concat(m[D])))))},exports.ryftErrorMap=m;
@@ -1,5 +1,6 @@
1
1
  import { TFunction } from "react-i18next";
2
- export declare const injectComponentsInRyftForm: ({ t, }: {
2
+ export declare const injectComponentsInRyftForm: ({ t, additionalPaymentMethodsEnabled, }: {
3
3
  t: TFunction<string[]>;
4
+ additionalPaymentMethodsEnabled?: boolean;
4
5
  }) => void;
5
6
  //# sourceMappingURL=ryft-form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ryft-form.d.ts","sourceRoot":"","sources":["../../../../src/iframe/ryft/utils/ryft-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,eAAO,MAAM,0BAA0B;OAGlC,UAAU,MAAM,EAAE,CAAC;UAyCvB,CAAC"}
1
+ {"version":3,"file":"ryft-form.d.ts","sourceRoot":"","sources":["../../../../src/iframe/ryft/utils/ryft-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,eAAO,MAAM,0BAA0B;OAIlC,UAAU,MAAM,EAAE,CAAC;sCACY,OAAO;UAyC1C,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.injectComponentsInRyftForm=function(e){var t=e.t,n=document.getElementById("ryft-pay-iframe"),i=document.getElementById("card-title-container");if(n&&!i){var r=document.createElement("div"),d=document.createElement("div"),a=document.createElement("div");a.id="card-title-container",r.textContent=t("Design:enterCardDetails"),d.className="bold-text form-label",d.innerText=t("Design:paymentDetails"),a.append(r,d),null==n||n.before(a);var o=document.getElementById("ryft-pay-grid");if(o){var m=document.createElement("div"),c=document.createElement("div"),l=document.createElement("div"),s=document.createElement("div");m.className="mobile-pay-title",m.innerText=t("Design:expressCheckoutWith"),c.id="mobile-pay-divider-text",c.innerText="or",l.id="mobile-pay-divider",s.id="mobile-pay-divider-container",s.append(c,l),o.before(m),o.after(s)}}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.injectComponentsInRyftForm=function(e){var t=e.t,n=e.additionalPaymentMethodsEnabled,i=document.getElementById("ryft-pay-iframe"),d=document.getElementById("card-title-container");if(i&&!d){var a=document.createElement("div"),r=document.createElement("div"),o=document.createElement("div");o.id="card-title-container",a.textContent=t("Design:enterCardDetails"),r.className="bold-text form-label",r.innerText=t("Design:paymentDetails"),o.append(a,r),null==i||i.before(o);var m=document.getElementById("ryft-pay-grid");if(m&&n){var l=document.createElement("div"),c=document.createElement("div"),s=document.createElement("div"),p=document.createElement("div");l.className="mobile-pay-title",l.innerText=t("Design:expressCheckoutWith"),c.id="mobile-pay-divider-text",c.innerText="or",s.id="mobile-pay-divider",p.id="mobile-pay-divider-container",p.append(c,s),m.before(l),m.after(p)}}};
@@ -9,6 +9,7 @@ export interface ProductCategoryControlValues extends FormValues {
9
9
  name: string;
10
10
  minSubItems: number | null;
11
11
  maxSubItems: number | null;
12
+ overallQuantity?: number | null;
12
13
  quantityType: QuantityType;
13
14
  type: CategoryType;
14
15
  isTimeRelated: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ProductCategoryControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product-category/ProductCategoryControl.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAE1F,OAAO,EACL,YAAY,EACZ,YAAY,EAKb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAG9E,OAAO,EAAE,gBAAgB,EAAmB,MAAM,UAAU,CAAC;AAI7D,MAAM,WAAW,4BAA6B,SAAQ,UAAU;IAC9D,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,2BAA4B,SAAQ,gBAAgB;IACnE,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IAErB,oBAAoB,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAQD,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,EACT,UAAkB,GACnB,EAAE,2BAA2B,eAue7B"}
1
+ {"version":3,"file":"ProductCategoryControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product-category/ProductCategoryControl.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAE1F,OAAO,EACL,YAAY,EACZ,YAAY,EAKb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAG9E,OAAO,EAAE,gBAAgB,EAAmB,MAAM,UAAU,CAAC;AAI7D,MAAM,WAAW,4BAA6B,SAAQ,UAAU;IAC9D,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,2BAA4B,SAAQ,gBAAgB;IACnE,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IAErB,oBAAoB,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAQD,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,EACT,UAAkB,GACnB,EAAE,2BAA2B,eAoiB7B"}
@@ -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"),n=require("react"),a=e(n),r=require("react-i18next"),o=require("react-bootstrap"),l=require("react-hook-form"),c=e(require("@licklist/plugins/dist/services/Form/HookFormService")),m=require("@react-aria/utils"),i=require("../../static/switch/Switch.js"),u=require("../../static/switch/BooleanSwitch.js"),s=require("../../assets/dashboard/increment.svg.js");require("../../static/index.js");var d=require("../form/context.js"),E=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),p=[E.CATEGORY_TYPE_TICKETS,E.CATEGORY_TYPE_FIXED_DURATION,E.CATEGORY_TYPE_GAME];exports.ProductCategoryControl=function(e){var v,I,C,b,f=e.isLoading,h=e.categoryName,g=e.onCategoryNameChange,F=e.productCategoryIndex,x=e.stepIndex,y=e.isOverride,T=void 0!==y&&y,S=l.useFormContext(),k=S.control,G=S.formState.errors,N=S.register,w=S.clearErrors,_=S.setValue,q=S.getValues,R=S.watch,A=S.trigger,P=r.useTranslation("Design").t,Y=t.__read(n.useState(!1),2),D=Y[0],L=Y[1],O="steps.".concat(x,".productCategories.").concat(F),V=l.useWatch({name:O}),B=R("".concat(O,".maxSubItems"))||0,M=R("".concat(O,".minSubItems"))||0,j=R("".concat(O,".allowDeposits")),z=p.includes(V.type),U=null===(b=null===(C=null===(I=null===(v=null==G?void 0:G.steps)||void 0===v?void 0:v[x])||void 0===I?void 0:I.productCategories)||void 0===C?void 0:C[F])||void 0===b?void 0:b.products,H=m.useId(),K=m.useId(),X=m.useId(),Q=m.useId(),W=m.useId(),J=m.useId(),Z=m.useId(),$=m.useId(),ee=m.useId(),te=m.useId(),ne=m.useId(),ae=n.useContext(d.ProductSetLoadingContext),re=ae.providerHasBookingManagement,oe=ae.zones,le=void 0===oe?[]:oe,ce=n.useCallback((function(){return L((function(e){return!e}))}),[]);n.useEffect((function(){A("".concat(O,".maxSubItems"))}),[M,O]),n.useEffect((function(){A("".concat(O,".minSubItems"))}),[B,O]);var me=V.type===E.CATEGORY_TYPE_FIXED_DURATION||V.type===E.CATEGORY_TYPE_GAME;return a.createElement(a.Fragment,null,a.createElement(o.Col,{md:12,xl:!0,className:"p-0"},a.createElement(o.Form.Group,{controlId:K},a.createElement(o.Form.Label,null,P("nameOfTheCategory")),a.createElement(o.Form.Control,t.__assign({},N("".concat(O,".name"),{required:P("Validation:fieldRequired",{attribute:P("name")}),validate:function(){return(null==U?void 0:U.type)===c.manualErrorType&&w("".concat(O,".products")),!0}}),{value:h,onChange:g,isInvalid:c.isInvalid("".concat(O,".name"),G),placeholder:P("name"),disabled:f||T})),a.createElement(o.Form.Control.Feedback,{type:"invalid"},c.getErrors("".concat(O,".name"),G))),a.createElement(o.Form.Group,{controlId:W},a.createElement(l.Controller,{control:k,name:"".concat(O,".quantityType"),render:function(e){var t=e.field;return a.createElement(o.Form.Group,{className:"d-flex flex-column flex-grow-1 align-items-start"},a.createElement(o.Form.Label,null,P("quantityType")),a.createElement(i.Switch,{name:t.name,options:E.QUANTITY_TYPES.map((function(e){return{key:e,id:e,value:P(e)}})),value:t.value,onChange:t.onChange,disabled:f||T}))}})),a.createElement(o.Row,null,a.createElement(o.Col,{md:6,sm:6,xs:6},a.createElement(o.Form.Group,{controlId:X},a.createElement(o.Form.Label,null,P("minItems")),a.createElement(o.InputGroup,{hasValidation:!0},a.createElement(o.InputGroup.Prepend,{className:"arrow-up-btn",onClick:function(){var e=Number(q("".concat(O,".minSubItems"))||0);_("".concat(O,".minSubItems"),e+1,{shouldValidate:!0})}},a.createElement(o.InputGroup.Text,{className:"py-0 px-3"},a.createElement(s.ReactComponent,null))),a.createElement(l.Controller,{render:function(e){var t=e.field,n=t.value,r=t.onChange,l=t.name,m=t.ref;return a.createElement(o.Form.Control,{ref:m,type:"number",min:0,step:1,value:null===n?"":n,onChange:r,isInvalid:c.isInvalid("".concat(O,".minSubItems"),G),disabled:f||T,name:l})},control:k,name:"".concat(O,".minSubItems"),rules:{min:{value:0,message:P("Validation:fieldMinNumber",{attribute:P("minItems"),min:0})},max:B?{value:Number(B),message:P("Validation:fieldMaxNumber",{attribute:P("minItems"),max:P("maxItems")})}:void 0}}),a.createElement(o.Form.Control.Feedback,{type:"invalid"},c.getErrors("".concat(O,".minSubItems"),G))))),a.createElement(o.Col,{md:6,sm:6,xs:6},a.createElement(o.Form.Group,{controlId:Q},a.createElement(o.Form.Label,null,P("maxItems")),a.createElement(o.InputGroup,{hasValidation:!0},a.createElement(o.InputGroup.Prepend,{className:"arrow-up-btn",onClick:function(){var e=Number(q("".concat(O,".maxSubItems"))||0);_("".concat(O,".maxSubItems"),e+1,{shouldValidate:!0})}},a.createElement(o.InputGroup.Text,{className:"py-0 px-3"},a.createElement(s.ReactComponent,null))),a.createElement(l.Controller,{render:function(e){var t=e.field,n=t.value,r=t.onChange,l=t.name,m=t.ref;return a.createElement(o.Form.Control,{ref:m,type:"number",step:1,name:l,value:null===n?"":n,onChange:r,isInvalid:c.isInvalid("".concat(O,".maxSubItems"),G),disabled:f||T})},control:k,name:"".concat(O,".maxSubItems"),rules:{min:{value:Number(M),message:P("Validation:fieldGreaterMinNumber",{attribute:P("maxItems"),min:P("minItems")})}}}),a.createElement(o.Form.Control.Feedback,{type:"invalid"},c.getErrors("".concat(O,".maxSubItems"),G)))))),me&&a.createElement(o.Row,null,a.createElement(o.Col,null,a.createElement(o.Form.Group,{controlId:ee},a.createElement(o.Form.Label,null,P("Design:zone")),a.createElement(l.Controller,{control:k,name:"".concat(O,".zoneId"),render:function(e){var n=e.field;return a.createElement(o.Form.Control,t.__assign({as:"select",disabled:T,isInvalid:c.isInvalid("".concat(O,".zoneId"),G)},n),a.createElement("option",{value:null},P("Design:choose")),le.map((function(e){return a.createElement("option",{key:e.id,value:e.id},e.name)})))},rules:{required:{value:re,message:P("Validation:fieldRequired",{attribute:P("zone")})}}}),a.createElement(o.Form.Control.Feedback,{type:"invalid"},c.getErrors("".concat(O,".zoneId"),G)))))),a.createElement(o.Col,{md:12,xl:!0,className:"p-0"},a.createElement(o.Form.Group,{controlId:H,className:"custom-checkbox"},a.createElement(o.Form.Check,{custom:!0,type:"checkbox",name:H,disabled:f,id:"check-api"},a.createElement(o.Form.Check.Input,{checked:D,onChange:ce,disabled:T,type:"checkbox"}),a.createElement(o.Form.Check.Label,null,P("showAdvancedOptions")))),a.createElement(o.Collapse,{in:D},a.createElement("div",null,z&&a.createElement(o.Form.Group,{controlId:$,className:"advanced-switch-container"},a.createElement(o.Form.Label,null,P("hasTicket")),a.createElement("div",null,a.createElement(l.Controller,{render:function(e){var t=e.field,n=t.name,r=t.value,o=t.onChange;return a.createElement(u.BooleanSwitch,{name:n,value:Boolean(r),onChange:o,disabled:V.type===E.CATEGORY_TYPE_TICKETS})},control:k,name:"".concat(O,".hasTicket")}))),V.hasTicket&&a.createElement(o.Form.Group,{controlId:Z,className:"advanced-switch-container"},a.createElement(o.Form.Label,null,P("collectUserInfo")),a.createElement("div",null,a.createElement(l.Controller,{render:function(e){var t=e.field,n=t.name,r=t.value,o=t.onChange;return a.createElement(u.BooleanSwitch,{name:n,value:Boolean(r),onChange:o,disabled:f||T})},control:k,name:"".concat(O,".collectUserInfo")}))),!V.hasTicket&&a.createElement(o.Form.Group,{controlId:J,className:"advanced-switch-container"},a.createElement(a.Fragment,null,a.createElement(o.Form.Label,null,P("isTimeRelated")),a.createElement("div",null,a.createElement(l.Controller,{render:function(e){var t=e.field,n=t.name,r=t.value,o=t.onChange;return a.createElement(u.BooleanSwitch,{name:n,value:Boolean(r),onChange:o,disabled:f||T})},control:k,name:"".concat(O,".isTimeRelated")})))),a.createElement(o.Form.Group,{controlId:te,className:"advanced-switch-container"},a.createElement(o.Form.Label,null,P("allowDeposits")),a.createElement("div",null,a.createElement(l.Controller,{render:function(e){var t=e.field,n=t.name,r=t.value,o=t.onChange;return a.createElement(u.BooleanSwitch,{name:n,value:Boolean(r),onChange:o,disabled:f||T})},control:k,name:"".concat(O,".allowDeposits")}))),j&&a.createElement(o.Form.Group,{controlId:ne,className:"deposit-days"},a.createElement(o.Form.Label,null,P("depositDays")),a.createElement(l.Controller,{render:function(e){var t=e.field,n=t.value,r=t.onChange,l=t.name,m=t.ref;return a.createElement(o.Form.Control,{ref:m,type:"number",min:0,step:1,value:n,onChange:r,isInvalid:c.isInvalid("".concat(O,".remainderExpireAfter"),G),disabled:f||T,name:l})},control:k,name:"".concat(O,".remainderExpireAfter")}),a.createElement(o.Form.Control.Feedback,{type:"invalid"},c.getErrors("".concat(O,".remainderExpireAfter"),G)))))))};
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"),n=require("react"),a=e(n),r=require("react-i18next"),l=require("react-bootstrap"),o=require("react-hook-form"),c=e(require("@licklist/plugins/dist/services/Form/HookFormService")),m=require("@react-aria/utils"),i=require("../../static/switch/Switch.js"),u=require("../../static/switch/BooleanSwitch.js"),s=require("../../assets/dashboard/increment.svg.js");require("../../static/index.js");var d=require("../form/context.js"),E=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),p=[E.CATEGORY_TYPE_TICKETS,E.CATEGORY_TYPE_FIXED_DURATION,E.CATEGORY_TYPE_GAME];exports.ProductCategoryControl=function(e){var v,I,C,b,f=e.isLoading,g=e.categoryName,h=e.onCategoryNameChange,F=e.productCategoryIndex,y=e.stepIndex,x=e.isOverride,T=void 0!==x&&x,G=o.useFormContext(),k=G.control,N=G.formState.errors,S=G.register,w=G.clearErrors,_=G.setValue,q=G.getValues,R=G.watch,A=G.trigger,P=r.useTranslation("Design").t,D=t.__read(n.useState(!1),2),L=D[0],V=D[1],Y="steps.".concat(y,".productCategories.").concat(F),O=o.useWatch({name:Y}),B=R("".concat(Y,".maxSubItems"))||0,M=R("".concat(Y,".minSubItems"))||0,Q=R("".concat(Y,".allowDeposits")),j=p.includes(O.type),z=null===(b=null===(C=null===(I=null===(v=null==N?void 0:N.steps)||void 0===v?void 0:v[y])||void 0===I?void 0:I.productCategories)||void 0===C?void 0:C[F])||void 0===b?void 0:b.products,U=m.useId(),H=m.useId(),K=m.useId(),X=m.useId(),W=m.useId(),J=m.useId(),Z=m.useId(),$=m.useId(),ee=m.useId(),te=m.useId(),ne=m.useId(),ae=m.useId(),re=n.useContext(d.ProductSetLoadingContext),le=re.providerHasBookingManagement,oe=re.zones,ce=void 0===oe?[]:oe,me=n.useCallback((function(){return V((function(e){return!e}))}),[]);n.useEffect((function(){A("".concat(Y,".maxSubItems"))}),[M,Y]),n.useEffect((function(){A("".concat(Y,".minSubItems"))}),[B,Y]);var ie=O.type===E.CATEGORY_TYPE_FIXED_DURATION||O.type===E.CATEGORY_TYPE_GAME;return a.createElement(a.Fragment,null,a.createElement(l.Col,{md:12,xl:!0,className:"p-0"},a.createElement(l.Form.Group,{controlId:H},a.createElement(l.Form.Label,null,P("nameOfTheCategory")),a.createElement(l.Form.Control,t.__assign({},S("".concat(Y,".name"),{required:P("Validation:fieldRequired",{attribute:P("name")}),validate:function(){return(null==z?void 0:z.type)===c.manualErrorType&&w("".concat(Y,".products")),!0}}),{value:g,onChange:h,isInvalid:c.isInvalid("".concat(Y,".name"),N),placeholder:P("name"),disabled:f||T})),a.createElement(l.Form.Control.Feedback,{type:"invalid"},c.getErrors("".concat(Y,".name"),N))),a.createElement(l.Form.Group,{controlId:W},a.createElement(o.Controller,{control:k,name:"".concat(Y,".quantityType"),render:function(e){var t=e.field;return a.createElement(l.Form.Group,{className:"d-flex flex-column flex-grow-1 align-items-start"},a.createElement(l.Form.Label,null,P("quantityType")),a.createElement(i.Switch,{name:t.name,options:E.QUANTITY_TYPES.map((function(e){return{key:e,id:e,value:P(e)}})),value:t.value,onChange:t.onChange,disabled:f||T}))}})),a.createElement(l.Row,null,a.createElement(l.Col,{md:6,sm:6,xs:6},a.createElement(l.Form.Group,{controlId:K},a.createElement(l.Form.Label,null,P("minItems")),a.createElement(l.InputGroup,{hasValidation:!0},a.createElement(l.InputGroup.Prepend,{className:"arrow-up-btn",onClick:function(){var e=Number(q("".concat(Y,".minSubItems"))||0);_("".concat(Y,".minSubItems"),e+1,{shouldValidate:!0})}},a.createElement(l.InputGroup.Text,{className:"py-0 px-3"},a.createElement(s.ReactComponent,null))),a.createElement(o.Controller,{render:function(e){var t=e.field,n=t.value,r=t.onChange,o=t.name,m=t.ref;return a.createElement(l.Form.Control,{ref:m,type:"number",min:0,step:1,value:null===n?"":n,onChange:r,isInvalid:c.isInvalid("".concat(Y,".minSubItems"),N),disabled:f||T,name:o})},control:k,name:"".concat(Y,".minSubItems"),rules:{min:{value:0,message:P("Validation:fieldMinNumber",{attribute:P("minItems"),min:0})},max:B?{value:Number(B),message:P("Validation:fieldMaxNumber",{attribute:P("minItems"),max:P("maxItems")})}:void 0}}),a.createElement(l.Form.Control.Feedback,{type:"invalid"},c.getErrors("".concat(Y,".minSubItems"),N))))),a.createElement(l.Col,{md:6,sm:6,xs:6},a.createElement(l.Form.Group,{controlId:X},a.createElement(l.Form.Label,null,P("maxItems")),a.createElement(l.InputGroup,{hasValidation:!0},a.createElement(l.InputGroup.Prepend,{className:"arrow-up-btn",onClick:function(){var e=Number(q("".concat(Y,".maxSubItems"))||0);_("".concat(Y,".maxSubItems"),e+1,{shouldValidate:!0})}},a.createElement(l.InputGroup.Text,{className:"py-0 px-3"},a.createElement(s.ReactComponent,null))),a.createElement(o.Controller,{render:function(e){var t=e.field,n=t.value,r=t.onChange,o=t.name,m=t.ref;return a.createElement(l.Form.Control,{ref:m,type:"number",step:1,name:o,value:null===n?"":n,onChange:r,isInvalid:c.isInvalid("".concat(Y,".maxSubItems"),N),disabled:f||T})},control:k,name:"".concat(Y,".maxSubItems"),rules:{min:{value:Number(M),message:P("Validation:fieldGreaterMinNumber",{attribute:P("maxItems"),min:P("minItems")})}}}),a.createElement(l.Form.Control.Feedback,{type:"invalid"},c.getErrors("".concat(Y,".maxSubItems"),N)))))),a.createElement(l.Row,null,a.createElement(l.Col,{md:6,sm:6,xs:6},a.createElement(l.Form.Group,{controlId:te},a.createElement(l.Form.Label,null,P("Design:overallQuantity")),a.createElement(l.InputGroup,{hasValidation:!0},a.createElement(l.InputGroup.Prepend,{className:"arrow-up-btn",onClick:function(){var e=Number(q("".concat(Y,".overallQuantity"))||0);_("".concat(Y,".overallQuantity"),e+1,{shouldValidate:!0})}},a.createElement(l.InputGroup.Text,{className:"py-0 px-3"},a.createElement(s.ReactComponent,null))),a.createElement(o.Controller,{control:k,name:"".concat(Y,".overallQuantity"),render:function(e){var n=e.field;return a.createElement(l.Form.Control,t.__assign({min:0,step:1,type:"number",disabled:T,isInvalid:c.isInvalid("".concat(Y,".overallQuantity"),N)},n))},rules:{min:{value:0,message:P("Validation:fieldMinNumber",{attribute:P("overallQuantity"),min:0})}}}),a.createElement(l.Form.Control.Feedback,{type:"invalid"},c.getErrors("".concat(Y,".overallQuantity"),N)))))),ie&&a.createElement(a.Fragment,null,a.createElement(l.Row,null,a.createElement(l.Col,null,a.createElement(l.Form.Group,{controlId:ee},a.createElement(l.Form.Label,null,P("Design:zone")),a.createElement(o.Controller,{control:k,name:"".concat(Y,".zoneId"),render:function(e){var n=e.field;return a.createElement(l.Form.Control,t.__assign({as:"select",disabled:T,isInvalid:c.isInvalid("".concat(Y,".zoneId"),N)},n),a.createElement("option",{value:null},P("Design:choose")),ce.map((function(e){return a.createElement("option",{key:e.id,value:e.id},e.name)})))},rules:{required:{value:le,message:P("Validation:fieldRequired",{attribute:P("zone")})}}}),a.createElement(l.Form.Control.Feedback,{type:"invalid"},c.getErrors("".concat(Y,".zoneId"),N))))))),a.createElement(l.Col,{md:12,xl:!0,className:"p-0"},a.createElement(l.Form.Group,{controlId:U,className:"custom-checkbox"},a.createElement(l.Form.Check,{custom:!0,type:"checkbox",name:U,disabled:f,id:"check-api"},a.createElement(l.Form.Check.Input,{checked:L,onChange:me,disabled:T,type:"checkbox"}),a.createElement(l.Form.Check.Label,null,P("showAdvancedOptions")))),a.createElement(l.Collapse,{in:L},a.createElement("div",null,j&&a.createElement(l.Form.Group,{controlId:$,className:"advanced-switch-container"},a.createElement(l.Form.Label,null,P("hasTicket")),a.createElement("div",null,a.createElement(o.Controller,{render:function(e){var t=e.field,n=t.name,r=t.value,l=t.onChange;return a.createElement(u.BooleanSwitch,{name:n,value:Boolean(r),onChange:l,disabled:O.type===E.CATEGORY_TYPE_TICKETS})},control:k,name:"".concat(Y,".hasTicket")}))),O.hasTicket&&a.createElement(l.Form.Group,{controlId:Z,className:"advanced-switch-container"},a.createElement(l.Form.Label,null,P("collectUserInfo")),a.createElement("div",null,a.createElement(o.Controller,{render:function(e){var t=e.field,n=t.name,r=t.value,l=t.onChange;return a.createElement(u.BooleanSwitch,{name:n,value:Boolean(r),onChange:l,disabled:f||T})},control:k,name:"".concat(Y,".collectUserInfo")}))),!O.hasTicket&&a.createElement(l.Form.Group,{controlId:J,className:"advanced-switch-container"},a.createElement(a.Fragment,null,a.createElement(l.Form.Label,null,P("isTimeRelated")),a.createElement("div",null,a.createElement(o.Controller,{render:function(e){var t=e.field,n=t.name,r=t.value,l=t.onChange;return a.createElement(u.BooleanSwitch,{name:n,value:Boolean(r),onChange:l,disabled:f||T})},control:k,name:"".concat(Y,".isTimeRelated")})))),a.createElement(l.Form.Group,{controlId:ne,className:"advanced-switch-container"},a.createElement(l.Form.Label,null,P("allowDeposits")),a.createElement("div",null,a.createElement(o.Controller,{render:function(e){var t=e.field,n=t.name,r=t.value,l=t.onChange;return a.createElement(u.BooleanSwitch,{name:n,value:Boolean(r),onChange:l,disabled:f||T})},control:k,name:"".concat(Y,".allowDeposits")}))),Q&&a.createElement(l.Form.Group,{controlId:ae,className:"deposit-days"},a.createElement(l.Form.Label,null,P("depositDays")),a.createElement(o.Controller,{render:function(e){var t=e.field,n=t.value,r=t.onChange,o=t.name,m=t.ref;return a.createElement(l.Form.Control,{ref:m,type:"number",min:0,step:1,value:n,onChange:r,isInvalid:c.isInvalid("".concat(Y,".remainderExpireAfter"),N),disabled:f||T,name:o})},control:k,name:"".concat(Y,".remainderExpireAfter")}),a.createElement(l.Form.Control.Feedback,{type:"invalid"},c.getErrors("".concat(Y,".remainderExpireAfter"),N)))))))};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.61.0",
3
+ "version": "0.62.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -12,6 +12,8 @@ import {
12
12
  RYFT_STATUS_PENDING_ACTION,
13
13
  AttemptPaymentResponse,
14
14
  } from "@licklist/plugins/dist/hooks/Ryft/useRyftPayment";
15
+ import { ProviderPaymentSettings } from "@licklist/core/dist/DataMapper/Setting/ProviderPaymentSettingsDataMapper";
16
+
15
17
  import { BlockLoader, ButtonLoader } from "../../static";
16
18
  import { injectComponentsInRyftForm } from "./utils/ryft-form";
17
19
 
@@ -40,11 +42,13 @@ export interface RyftPaymentFormProps {
40
42
  ) => Promise<void>;
41
43
  onSubmit: () => Promise<AttemptPaymentResponse>;
42
44
  resetReferrer?: () => void;
45
+ providerPaymentSettings?: ProviderPaymentSettings;
43
46
  }
44
47
 
45
48
  export const RyftPaymentForm = ({
46
49
  accountId,
47
50
  isCreateLoading,
51
+ providerPaymentSettings,
48
52
  initRyft,
49
53
  resetReferrer,
50
54
  onSubmit,
@@ -119,7 +123,12 @@ export const RyftPaymentForm = ({
119
123
  };
120
124
 
121
125
  useEffect(
122
- () => injectComponentsInRyftForm({ t }),
126
+ () =>
127
+ injectComponentsInRyftForm({
128
+ t,
129
+ additionalPaymentMethodsEnabled:
130
+ providerPaymentSettings?.additionalPaymentMethodsEnabled,
131
+ }),
123
132
  // eslint-disable-next-line react-hooks/exhaustive-deps
124
133
  [formRef.current?.childNodes?.length]
125
134
  );
@@ -2,8 +2,10 @@ import { TFunction } from "react-i18next";
2
2
 
3
3
  export const injectComponentsInRyftForm = ({
4
4
  t,
5
+ additionalPaymentMethodsEnabled,
5
6
  }: {
6
7
  t: TFunction<string[]>;
8
+ additionalPaymentMethodsEnabled?: boolean;
7
9
  }) => {
8
10
  const cardContainer = document.getElementById("ryft-pay-iframe");
9
11
  const oldCardDividerContainer = document.getElementById(
@@ -26,7 +28,7 @@ export const injectComponentsInRyftForm = ({
26
28
 
27
29
  const payGrid = document.getElementById("ryft-pay-grid");
28
30
 
29
- if (!payGrid) {
31
+ if (!payGrid || !additionalPaymentMethodsEnabled) {
30
32
  return;
31
33
  }
32
34
 
@@ -26,6 +26,7 @@ export interface ProductCategoryControlValues extends FormValues {
26
26
  name: string;
27
27
  minSubItems: number | null;
28
28
  maxSubItems: number | null;
29
+ overallQuantity?: number | null;
29
30
  quantityType: QuantityType;
30
31
  type: CategoryType;
31
32
  isTimeRelated: boolean;
@@ -102,6 +103,7 @@ export function ProductCategoryControl({
102
103
  const collectUserInfoId = useId();
103
104
  const hasTicketId = useId();
104
105
  const zoneId = useId();
106
+ const overallQuantityId = useId();
105
107
 
106
108
  const allowDepositsId = useId();
107
109
  const remainderExpireAfterId = useId();
@@ -127,7 +129,7 @@ export function ProductCategoryControl({
127
129
  // eslint-disable-next-line react-hooks/exhaustive-deps
128
130
  }, [maxSubItems, fieldNamePrefix]);
129
131
 
130
- const shouldShowZoneSelect =
132
+ const isZoneCategory =
131
133
  category.type === CATEGORY_TYPE_FIXED_DURATION ||
132
134
  category.type === CATEGORY_TYPE_GAME;
133
135
 
@@ -327,51 +329,111 @@ export function ProductCategoryControl({
327
329
  </Form.Group>
328
330
  </Col>
329
331
  </Row>
330
-
331
- {shouldShowZoneSelect && (
332
- <Row>
333
- <Col>
334
- <Form.Group controlId={zoneId}>
335
- <Form.Label>{t("Design:zone")}</Form.Label>
332
+ <Row>
333
+ <Col md={6} sm={6} xs={6}>
334
+ <Form.Group controlId={overallQuantityId}>
335
+ <Form.Label>{t("Design:overallQuantity")}</Form.Label>
336
+ <InputGroup hasValidation>
337
+ <InputGroup.Prepend
338
+ className="arrow-up-btn"
339
+ onClick={() => {
340
+ const currentOverallCapacity = Number(
341
+ getValues(`${fieldNamePrefix}.overallQuantity`) || 0
342
+ );
343
+ setValue(
344
+ `${fieldNamePrefix}.overallQuantity`,
345
+ currentOverallCapacity + 1,
346
+ { shouldValidate: true }
347
+ );
348
+ }}
349
+ >
350
+ <InputGroup.Text className="py-0 px-3">
351
+ <IncrementIcon />
352
+ </InputGroup.Text>
353
+ </InputGroup.Prepend>
336
354
  <Controller
337
355
  control={control}
338
- name={`${fieldNamePrefix}.zoneId`}
356
+ name={`${fieldNamePrefix}.overallQuantity`}
339
357
  render={({ field }) => (
340
358
  <Form.Control
341
- as="select"
359
+ min={0}
360
+ step={1}
361
+ type="number"
342
362
  disabled={isOverride}
343
363
  isInvalid={HookFormService.isInvalid<ProductSetFormValues>(
344
- `${fieldNamePrefix}.zoneId`,
364
+ `${fieldNamePrefix}.overallQuantity`,
345
365
  errors
346
366
  )}
347
367
  {...field}
348
- >
349
- <option value={null}>{t("Design:choose")}</option>
350
- {zones.map((zone) => (
351
- <option key={zone.id} value={zone.id}>
352
- {zone.name}
353
- </option>
354
- ))}
355
- </Form.Control>
368
+ />
356
369
  )}
357
370
  rules={{
358
- required: {
359
- value: providerHasBookingManagement,
360
- message: t("Validation:fieldRequired", {
361
- attribute: t("zone"),
362
- }),
371
+ min: {
372
+ value: 0,
373
+ message: t("Validation:fieldMinNumber", {
374
+ attribute: t("overallQuantity"),
375
+ min: 0,
376
+ }) as string,
363
377
  },
364
378
  }}
365
379
  />
366
380
  <Form.Control.Feedback type="invalid">
367
381
  {HookFormService.getErrors<ProductSetFormValues>(
368
- `${fieldNamePrefix}.zoneId`,
382
+ `${fieldNamePrefix}.overallQuantity`,
369
383
  errors
370
384
  )}
371
385
  </Form.Control.Feedback>
372
- </Form.Group>
373
- </Col>
374
- </Row>
386
+ </InputGroup>
387
+ </Form.Group>
388
+ </Col>
389
+ </Row>
390
+
391
+ {isZoneCategory && (
392
+ <>
393
+ <Row>
394
+ <Col>
395
+ <Form.Group controlId={zoneId}>
396
+ <Form.Label>{t("Design:zone")}</Form.Label>
397
+ <Controller
398
+ control={control}
399
+ name={`${fieldNamePrefix}.zoneId`}
400
+ render={({ field }) => (
401
+ <Form.Control
402
+ as="select"
403
+ disabled={isOverride}
404
+ isInvalid={HookFormService.isInvalid<ProductSetFormValues>(
405
+ `${fieldNamePrefix}.zoneId`,
406
+ errors
407
+ )}
408
+ {...field}
409
+ >
410
+ <option value={null}>{t("Design:choose")}</option>
411
+ {zones.map((zone) => (
412
+ <option key={zone.id} value={zone.id}>
413
+ {zone.name}
414
+ </option>
415
+ ))}
416
+ </Form.Control>
417
+ )}
418
+ rules={{
419
+ required: {
420
+ value: providerHasBookingManagement,
421
+ message: t("Validation:fieldRequired", {
422
+ attribute: t("zone"),
423
+ }),
424
+ },
425
+ }}
426
+ />
427
+ <Form.Control.Feedback type="invalid">
428
+ {HookFormService.getErrors<ProductSetFormValues>(
429
+ `${fieldNamePrefix}.zoneId`,
430
+ errors
431
+ )}
432
+ </Form.Control.Feedback>
433
+ </Form.Group>
434
+ </Col>
435
+ </Row>
436
+ </>
375
437
  )}
376
438
  </Col>
377
439