@licklist/design 0.44.486-dev.43 → 0.44.486-dev.45

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.
@@ -15,6 +15,7 @@ export type CalendarProps = {
15
15
  booked: number;
16
16
  total: number;
17
17
  } | undefined;
18
+ includeAvailability?: boolean;
18
19
  };
19
20
  export declare const Calendar: ({ disabledDates, initialDate, ...props }: CalendarProps) => JSX.Element;
20
21
  //# sourceMappingURL=Calendar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/calendar/Calendar.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIjC,eAAO,MAAM,eAAe,UAK1B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,QAAQ,CAAC;IACtB,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnD,aAAa,EAAE,QAAQ,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC3B,YAAY,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC9B,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,eAAe,CAAC,EAAE,CAChB,IAAI,EAAE,QAAQ,KACX;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,QAAQ,6CAIlB,aAAa,gBAaf,CAAC"}
1
+ {"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/calendar/Calendar.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIjC,eAAO,MAAM,eAAe,UAK1B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,QAAQ,CAAC;IACtB,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnD,aAAa,EAAE,QAAQ,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC3B,YAAY,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC9B,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,eAAe,CAAC,EAAE,CAChB,IAAI,EAAE,QAAQ,KACX;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACnD,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,QAAQ,6CAIlB,aAAa,gBAaf,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { CalendarProps } from "../../Calendar";
3
- export type CalendarDatesProps = Pick<CalendarProps, "calendarDates" | "fromPrice" | "isLoading" | "disabledDates" | "selectedDate" | "setSelectedDate" | "getAvailability">;
4
- export declare const CalendarDates: ({ disabledDates, isLoading, calendarDates, selectedDate, setSelectedDate, fromPrice, getAvailability, }: CalendarDatesProps) => JSX.Element;
3
+ export type CalendarDatesProps = Omit<CalendarProps, "currentDate" | "setCurrentDate" | "initialDate">;
4
+ export declare const CalendarDates: ({ disabledDates, isLoading, calendarDates, selectedDate, setSelectedDate, fromPrice, getAvailability, includeAvailability, }: CalendarDatesProps) => JSX.Element;
5
5
  //# sourceMappingURL=CalendarDates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarDates.d.ts","sourceRoot":"","sources":["../../../../src/calendar/components/CalendarDates/CalendarDates.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,aAAa,EACX,eAAe,GACf,WAAW,GACX,WAAW,GACX,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,iBAAiB,CACpB,CAAC;AAEF,eAAO,MAAM,aAAa,4GAQvB,kBAAkB,gBA8CpB,CAAC"}
1
+ {"version":3,"file":"CalendarDates.d.ts","sourceRoot":"","sources":["../../../../src/calendar/components/CalendarDates/CalendarDates.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,aAAa,EACb,aAAa,GAAG,gBAAgB,GAAG,aAAa,CACjD,CAAC;AAEF,eAAO,MAAM,aAAa,iIASvB,kBAAkB,gBA+CpB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,a=require("tslib"),r=require("react"),t=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,i=require("@licklist/core/dist/Config"),l=require("../../utils/index.js"),d=require("../../../date-time-button/DateTimeButton.js"),n=require("../CalendarWeekdays/CalendarWeekdays.js");exports.CalendarDates=function(e){var s=e.disabledDates,u=void 0===s?[]:s,o=e.isLoading,c=void 0!==o&&o,v=e.calendarDates,m=e.selectedDate,f=e.setSelectedDate,p=e.fromPrice,y=e.getAvailability,D=r.useMemo((function(){var e,r,t=null!==(r=null===(e=v[0])||void 0===e?void 0:e.weekday)&&void 0!==r?r:0;if(1===t)return v;for(var i=[];t>1;)i.push(null),t-=1;return a.__spreadArray(a.__spreadArray([],a.__read(i),!1),a.__read(v),!1)}),[v]);return t.createElement("div",{className:"calendar-dates-wrapper"},t.createElement(n.CalendarWeekdays,null),t.createElement("div",{className:"calendar-dates"},D.map((function(e){if(null===e)return t.createElement("div",null);var a=c||l.isSelectedDateDisabled(e,u);return t.createElement(d.DateTimeButton,{key:+e,isDisabled:a,isSelected:m?e.hasSame(m,"day"):void 0,date:e.toFormat(i.DAY_NUMBER),onSelect:function(){return f(e)},price:p,resources:null==y?void 0:y(e),calendarView:!0})}))))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,a=require("tslib"),r=require("react"),t=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,i=require("@licklist/core/dist/Config"),l=require("../../utils/index.js"),d=require("../../../date-time-button/DateTimeButton.js"),n=require("../CalendarWeekdays/CalendarWeekdays.js");exports.CalendarDates=function(e){var s=e.disabledDates,u=void 0===s?[]:s,o=e.isLoading,c=void 0!==o&&o,v=e.calendarDates,m=e.selectedDate,f=e.setSelectedDate,y=e.fromPrice,p=e.getAvailability,D=e.includeAvailability,_=r.useMemo((function(){var e,r,t=null!==(r=null===(e=v[0])||void 0===e?void 0:e.weekday)&&void 0!==r?r:0;if(1===t)return v;for(var i=[];t>1;)i.push(null),t-=1;return a.__spreadArray(a.__spreadArray([],a.__read(i),!1),a.__read(v),!1)}),[v]);return t.createElement("div",{className:"calendar-dates-wrapper"},t.createElement(n.CalendarWeekdays,null),t.createElement("div",{className:"calendar-dates"},_.map((function(e){if(null===e)return t.createElement("div",null);var a=c||l.isSelectedDateDisabled(e,u);return t.createElement(d.DateTimeButton,{key:+e,isDisabled:a,isSelected:m?e.hasSame(m,"day"):void 0,date:e.toFormat(i.DAY_NUMBER),onSelect:function(){return f(e)},price:y,resources:null==p?void 0:p(e),showResources:D,calendarView:!0})}))))};
@@ -12,6 +12,7 @@ export type DateTimeButtonProps<T = DateTime | string> = {
12
12
  total: number;
13
13
  };
14
14
  calendarView?: boolean;
15
+ showResources?: boolean;
15
16
  };
16
- export declare const DateTimeButton: <T extends string | DateTime>({ date, isDisabled: _isDisabled, isSelected, onSelect, isOnlyTimeContainer, price, resources, calendarView, }: DateTimeButtonProps<T>) => JSX.Element;
17
+ export declare const DateTimeButton: <T extends string | DateTime>({ date, isDisabled: _isDisabled, isSelected, onSelect, isOnlyTimeContainer, price, resources, calendarView, showResources, }: DateTimeButtonProps<T>) => JSX.Element;
17
18
  //# sourceMappingURL=DateTimeButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeButton.d.ts","sourceRoot":"","sources":["../../src/date-time-button/DateTimeButton.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIjC,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,QAAQ,GAAG,MAAM,IAAI;IACvD,IAAI,EAAE,CAAC,CAAC;IACR,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,cAAc,qLA+C1B,CAAC"}
1
+ {"version":3,"file":"DateTimeButton.d.ts","sourceRoot":"","sources":["../../src/date-time-button/DateTimeButton.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIjC,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,QAAQ,GAAG,MAAM,IAAI;IACvD,IAAI,EAAE,CAAC,CAAC;IACR,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,cAAc,oMAgD1B,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"),i=e(require("react")),a=e(require("clsx")),n=require("../availability-indicator/AvailabilityIndicator.js"),r=require("./DateContent.js");exports.DateTimeButton=function(e){var l=e.date,o=e.isDisabled,c=e.isSelected,s=e.onSelect,d=e.isOnlyTimeContainer,u=e.price,b=e.resources,m=e.calendarView,y="string"==typeof l,v=o||b&&b.booked===b.total;return i.createElement("button",{type:"button",onClick:function(){return s(l)},disabled:v,className:a("date-time-button",v&&"disabled",c&&"selected",y&&"time-button",d&&"only-time-container",!y&&"today",m&&"calendar-view")},y?l:i.createElement(r.DateContent,{date:l,isDisabled:v,isSelected:c}),u&&!v&&i.createElement("div",{className:"price"},u),b&&i.createElement(n.AvailabilityIndicator,t.__assign({},b,{notAvailable:o})))};
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"),i=e(require("react")),a=e(require("clsx")),r=require("../availability-indicator/AvailabilityIndicator.js"),n=require("./DateContent.js");exports.DateTimeButton=function(e){var l=e.date,o=e.isDisabled,s=e.isSelected,c=e.onSelect,d=e.isOnlyTimeContainer,u=e.price,b=e.resources,m=e.calendarView,y=e.showResources,v="string"==typeof l,f=o||b&&b.booked===b.total;return i.createElement("button",{type:"button",onClick:function(){return c(l)},disabled:f,className:a("date-time-button",f&&"disabled",s&&"selected",v&&"time-button",d&&"only-time-container",!v&&"today",m&&"calendar-view")},v?l:i.createElement(n.DateContent,{date:l,isDisabled:f,isSelected:s}),u&&!f&&i.createElement("div",{className:"price"},u),y&&b&&i.createElement(r.AvailabilityIndicator,t.__assign({},b,{notAvailable:o})))};
@@ -1 +1 @@
1
- {"version":3,"file":"CategoryProduct.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAExF,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG7D,UAAU,oBAAoB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAChD,eAAe,CAAC,EAAE,wBAAwB,EAAE,CAAC;CAC9C;AAED,eAAO,MAAM,eAAe,sFAMzB,oBAAoB,gBA8LtB,CAAC"}
1
+ {"version":3,"file":"CategoryProduct.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAExF,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG7D,UAAU,oBAAoB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAChD,eAAe,CAAC,EAAE,wBAAwB,EAAE,CAAC;CAC9C;AAED,eAAO,MAAM,eAAe,sFAMzB,oBAAoB,gBA0LtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCategoryVerification.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/utils/useCategoryVerification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kEAAkE,CAAC;AAInG,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAGD,eAAO,MAAM,uBAAuB,iBAIxB,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,sBACd,eAAe,EAAE,KACpC,aAAa,GAAG,IAkEpB,CAAC"}
1
+ {"version":3,"file":"useCategoryVerification.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/utils/useCategoryVerification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kEAAkE,CAAC;AAInG,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAGD,eAAO,MAAM,uBAAuB,iBAIxB,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,sBACd,eAAe,EAAE,KACpC,aAAa,GAAG,IA+DpB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@licklist/core/dist/Config"),r=require("react-i18next"),t=require("react-intl");exports.useCategoryVerification=function(){var n=r.useTranslation("Validation").t,i=t.useIntl().formatNumber;return function(r,t){var u,a=Object.values(r).filter((function(e){return(null==e?void 0:e.quantity)>0})),o=t.reduce((function(e,r){var t=r.products.filter((function(e){return a.map((function(e){return e.id})).includes(null==e?void 0:e.id)}));return t.length?e+t.reduce((function(e,r){return e+((null==r?void 0:r.minSpend)||0)}),0):0}),0),c=a.reduce((function(e,r){return e+r.price*r.quantity}),0);if(t.forEach((function(e){var r=e.minSubItems,t=e.maxSubItems,i=e.id,o=e.name;if(r||t){var c=a.filter((function(e){return(null==e?void 0:e.productsCategoryId)===i})).length;if(r&&c<r){var d=n("Validation:fieldMinNumber",{min:r,attribute:"number of products in the ".concat(o," category")});u={id:i,message:d}}else if(t&&c>t){d=n("Validation:fieldMaxNumber",{max:t,attribute:"number of products in the ".concat(o," category")});u={id:i,message:d}}}})),c<o&&!u){var d=n("Design:minimumSpendSumValidation",{minSpend:i(o,{style:"currency",currency:e.Currency.GBP})});u={message:d}}return u}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@licklist/core/dist/Config"),r=require("react-i18next"),n=require("react-intl");exports.useCategoryVerification=function(){var t=r.useTranslation("Validation").t,i=n.useIntl().formatNumber;return function(r,n){var u,a=Object.values(r).filter((function(e){return(null==e?void 0:e.quantity)>0})),o=n.reduce((function(e,r){var n=r.products.filter((function(e){return a.map((function(e){return e.id})).includes(null==e?void 0:e.id)}));return e+((null==n?void 0:n.reduce((function(e,r){return e+((null==r?void 0:r.minSpend)||0)}),0))||0)}),0),c=a.reduce((function(e,r){return e+r.price*r.quantity}),0);if(n.forEach((function(e){var r=e.minSubItems,n=e.maxSubItems,i=e.id,o=e.name;if(r||n){var c=a.filter((function(e){return(null==e?void 0:e.productsCategoryId)===i})).length;if(r&&c<r){var d=t("Validation:fieldMinNumber",{min:r,attribute:"number of products in the ".concat(o," category")});u={id:i,message:d}}else if(n&&c>n){d=t("Validation:fieldMaxNumber",{max:n,attribute:"number of products in the ".concat(o," category")});u={id:i,message:d}}}})),c<o&&!u){var d=t("Design:minimumSpendSumValidation",{minSpend:i(o,{style:"currency",currency:e.Currency.GBP})});u={message:d}}return u}};
@@ -1 +1 @@
1
- {"version":3,"file":"CouponFormControl.d.ts","sourceRoot":"","sources":["../../../../src/sales/coupon/control/CouponFormControl.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAOL,eAAe,EACf,UAAU,EACX,MAAM,yDAAyD,CAAC;AAYjE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,UAAU,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,kCAG3B,eAAe,gBA4WjB,CAAC"}
1
+ {"version":3,"file":"CouponFormControl.d.ts","sourceRoot":"","sources":["../../../../src/sales/coupon/control/CouponFormControl.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAOL,eAAe,EACf,UAAU,EACX,MAAM,yDAAyD,CAAC;AAajE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,UAAU,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,kCAG3B,eAAe,gBAgXjB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),l=require("react"),n=(e=l)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-i18next"),o=require("react-bootstrap"),a=require("react-hook-form"),i=require("luxon"),m=require("@licklist/core/dist/DataMapper/Product/CouponDataMapper");exports.CouponFormControl=function(e){var u,s,d,c,E,p,g,F,v,C=e.isLoading,_=void 0!==C&&C,b=e.productGroups,f=a.useFormContext(),D=f.register,y=f.setValue,T=f.getValues,P=f.formState.errors,x=f.watch,O=r.useTranslation(["Design","Notification","App"]).t,G=t.__read(l.useState([]),2),N=G[0],R=G[1],k=x("startFrom"),L=x("validTill"),A=l.useRef(null),h=l.useRef(null),w=((u={})[m.COUPON_TYPE_FIXED]=O("Design:fixed"),u[m.COUPON_TYPE_FIXED_PER_PERSON]=O("Design:fixedPerPerson"),u[m.COUPON_TYPE_PERCENTAGE]=O("Design:percentage"),u[m.COUPON_TYPE_PERCENTAGE_PER_PERSON]=O("Design:percentagePerPerson"),u),q=((s={})[m.COUPON_TOTAL_TYPE_GROSS]=O("Design:grossTotal"),s[m.COUPON_TOTAL_TYPE_TOTAL]=O("Design:depositTotal"),s);return l.useEffect((function(){R(T("productGroupIds"))}),[T]),l.useEffect((function(){y("productGroupIds",N)}),[T,y,N]),n.createElement(o.Row,null,n.createElement(o.Col,{md:5},n.createElement("h2",{className:"mb-5"},O("Design:coupon")),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:name")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==P.name},D("name",{required:O("Validation:fieldRequired",{attribute:O("Design:name")})}),{disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(d=null==P?void 0:P.name)||void 0===d?void 0:d.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:couponCode")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==P.code},D("code",{required:O("Validation:fieldRequired",{attribute:O("Design:code")})}),{disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(c=null==P?void 0:P.code)||void 0===c?void 0:c.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:discountType")),n.createElement(o.Form.Control,t.__assign({},D("discountType",{required:!0}),{as:"select",defaultValue:null!==(E=T("discountType"))&&void 0!==E?E:1,disabled:_}),Object.keys(w).map((function(e){return n.createElement("option",{value:e,key:e},w[e])}))))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:discount")),n.createElement(o.Form.Control,t.__assign({type:"number",isInvalid:void 0!==P.discount},D("discount",{required:O("Validation:fieldRequired",{attribute:O("Design:discount")})}),{disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(p=null==P?void 0:P.discount)||void 0===p?void 0:p.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:applyOn")),n.createElement(o.Form.Control,t.__assign({},D("totalType",{required:!0}),{as:"select",defaultValue:null!==(g=T("totalType"))&&void 0!==g?g:1,disabled:_}),Object.keys(q).map((function(e){return n.createElement("option",{value:e,key:e},q[e])}))))))),n.createElement(o.Col,{md:{span:5,offset:1}},n.createElement("h2",{className:"mb-5"},O("Design:limitations")),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:startFrom")),n.createElement(o.Form.Control,t.__assign({type:"date"},D("startFrom"),{value:k,isInvalid:void 0!==P.startFrom,onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();y("startFrom",t)},className:k&&"date-input-with-value",ref:A,onClick:function(){var e;return null===(e=null==A?void 0:A.current)||void 0===e?void 0:e.showPicker()},disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(F=null==P?void 0:P.startFrom)||void 0===F?void 0:F.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:validTill")),n.createElement(o.Form.Control,t.__assign({type:"date"},D("validTill"),{value:L,onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();y("validTill",t)},ref:h,className:L&&"date-input-with-value",onClick:function(){var e;return null===(e=null==h?void 0:h.current)||void 0===e?void 0:e.showPicker()},disabled:_}))))),b&&(null==b?void 0:b.length)>0&&n.createElement(o.Row,null,n.createElement(o.Col,{md:12},n.createElement("h5",{className:"mt-4"},O("Design:productGroups")),n.createElement(o.Form.Group,{className:"d-flex flex-wrap justify-content-between mt-4 mb-5"},null==b?void 0:b.map((function(e){var l,r,a=null!==(r=null===(l=T("productGroupIds"))||void 0===l?void 0:l.includes(String(e.id)))&&void 0!==r&&r;return n.createElement(o.Form.Check,{key:e.id,label:e.name,defaultChecked:a,disabled:_,onChange:function(l){l.target.checked?R((function(l){return Array.from(new Set(t.__spreadArray(t.__spreadArray([],t.__read(l),!1),[String(e.id)],!1)))})):R((function(t){return t.filter((function(t){return String(e.id)!==t}))}))}})})),n.createElement(o.Form.Control,t.__assign({},D("productGroupIds"),{hidden:!0,value:N,disabled:_}))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:totalCoupons")),n.createElement(o.Form.Control,t.__assign({},D("totalCoupons"),{type:"number",isInvalid:void 0!==P.totalCoupons,disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(v=null==P?void 0:P.totalCoupons)||void 0===v?void 0:v.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:usesPerUser")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("usesPerUser"),{disabled:_}))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:useAgain")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("useAgain"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:useAgainExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:usesPerUserDay")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("usesPerUserDay"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:usesPerUserDayExplanation"))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:minAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("minAmount"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:minAmountExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:maxAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("maxAmount"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:maxAmountExplanation")))))))};
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"),l=require("react"),n=e(l),r=require("react-i18next"),o=require("react-bootstrap"),a=require("react-hook-form"),i=require("luxon"),m=require("@licklist/core/dist/DataMapper/Product/CouponDataMapper"),u=e(require("@licklist/plugins/dist/validation/Rules/couponCodeRules"));exports.CouponFormControl=function(e){var s,d,c,E,p,g,v,F,C,_=e.isLoading,b=void 0!==_&&_,f=e.productGroups,D=a.useFormContext(),y=D.register,T=D.setValue,P=D.getValues,x=D.formState.errors,O=D.watch,G=r.useTranslation(["Design","Notification","App"]).t,R=t.__read(l.useState([]),2),N=R[0],k=R[1],L=O("startFrom"),A=O("validTill"),h=l.useRef(null),w=l.useRef(null),q=((s={})[m.COUPON_TYPE_FIXED]=G("Design:fixed"),s[m.COUPON_TYPE_FIXED_PER_PERSON]=G("Design:fixedPerPerson"),s[m.COUPON_TYPE_PERCENTAGE]=G("Design:percentage"),s[m.COUPON_TYPE_PERCENTAGE_PER_PERSON]=G("Design:percentagePerPerson"),s),S=((d={})[m.COUPON_TOTAL_TYPE_GROSS]=G("Design:grossTotal"),d[m.COUPON_TOTAL_TYPE_TOTAL]=G("Design:depositTotal"),d);return l.useEffect((function(){k(P("productGroupIds"))}),[P]),l.useEffect((function(){T("productGroupIds",N)}),[P,T,N]),n.createElement(o.Row,null,n.createElement(o.Col,{md:5},n.createElement("h2",{className:"mb-5"},G("Design:coupon")),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:name")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==x.name},y("name",{required:G("Validation:fieldRequired",{attribute:G("Design:name")})}),{disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(c=null==x?void 0:x.name)||void 0===c?void 0:c.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:couponCode")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==x.code},y("code",{required:G("Validation:fieldRequired",{attribute:G("Design:code")}),pattern:{message:"".concat(G("Validation:fieldCouponCode")),value:u}}),{disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(E=null==x?void 0:x.code)||void 0===E?void 0:E.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:discountType")),n.createElement(o.Form.Control,t.__assign({},y("discountType",{required:!0}),{as:"select",defaultValue:null!==(p=P("discountType"))&&void 0!==p?p:1,disabled:b}),Object.keys(q).map((function(e){return n.createElement("option",{value:e,key:e},q[e])}))))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:discount")),n.createElement(o.Form.Control,t.__assign({type:"number",isInvalid:void 0!==x.discount},y("discount",{required:G("Validation:fieldRequired",{attribute:G("Design:discount")})}),{disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(g=null==x?void 0:x.discount)||void 0===g?void 0:g.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:applyOn")),n.createElement(o.Form.Control,t.__assign({},y("totalType",{required:!0}),{as:"select",defaultValue:null!==(v=P("totalType"))&&void 0!==v?v:1,disabled:b}),Object.keys(S).map((function(e){return n.createElement("option",{value:e,key:e},S[e])}))))))),n.createElement(o.Col,{md:{span:5,offset:1}},n.createElement("h2",{className:"mb-5"},G("Design:limitations")),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:startFrom")),n.createElement(o.Form.Control,t.__assign({type:"date"},y("startFrom"),{value:L,isInvalid:void 0!==x.startFrom,onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();T("startFrom",t)},className:L&&"date-input-with-value",ref:h,onClick:function(){var e;return null===(e=null==h?void 0:h.current)||void 0===e?void 0:e.showPicker()},disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(F=null==x?void 0:x.startFrom)||void 0===F?void 0:F.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:validTill")),n.createElement(o.Form.Control,t.__assign({type:"date"},y("validTill"),{value:A,onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();T("validTill",t)},ref:w,className:A&&"date-input-with-value",onClick:function(){var e;return null===(e=null==w?void 0:w.current)||void 0===e?void 0:e.showPicker()},disabled:b}))))),f&&(null==f?void 0:f.length)>0&&n.createElement(o.Row,null,n.createElement(o.Col,{md:12},n.createElement("h5",{className:"mt-4"},G("Design:productGroups")),n.createElement(o.Form.Group,{className:"d-flex flex-wrap justify-content-between mt-4 mb-5"},null==f?void 0:f.map((function(e){var l,r,a=null!==(r=null===(l=P("productGroupIds"))||void 0===l?void 0:l.includes(String(e.id)))&&void 0!==r&&r;return n.createElement(o.Form.Check,{key:e.id,label:e.name,defaultChecked:a,disabled:b,onChange:function(l){l.target.checked?k((function(l){return Array.from(new Set(t.__spreadArray(t.__spreadArray([],t.__read(l),!1),[String(e.id)],!1)))})):k((function(t){return t.filter((function(t){return String(e.id)!==t}))}))}})})),n.createElement(o.Form.Control,t.__assign({},y("productGroupIds"),{hidden:!0,value:N,disabled:b}))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:totalCoupons")),n.createElement(o.Form.Control,t.__assign({},y("totalCoupons"),{type:"number",isInvalid:void 0!==x.totalCoupons,disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(C=null==x?void 0:x.totalCoupons)||void 0===C?void 0:C.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:usesPerUser")),n.createElement(o.Form.Control,t.__assign({type:"number"},y("usesPerUser"),{disabled:b}))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:useAgain")),n.createElement(o.Form.Control,t.__assign({type:"number"},y("useAgain"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},G("Design:useAgainExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:usesPerUserDay")),n.createElement(o.Form.Control,t.__assign({type:"number"},y("usesPerUserDay"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},G("Design:usesPerUserDayExplanation"))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:minAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},y("minAmount"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},G("Design:minAmountExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:maxAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},y("maxAmount"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},G("Design:maxAmountExplanation")))))))};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.486-dev.43",
3
+ "version": "0.44.486-dev.45",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -23,6 +23,7 @@ export type CalendarProps = {
23
23
  getAvailability?: (
24
24
  date: DateTime
25
25
  ) => { booked: number; total: number } | undefined;
26
+ includeAvailability?: boolean;
26
27
  };
27
28
 
28
29
  export const Calendar = ({
@@ -6,15 +6,9 @@ import { CalendarWeekdays } from "../CalendarWeekdays";
6
6
  import { isSelectedDateDisabled } from "../../utils";
7
7
  import { CalendarProps } from "../../Calendar";
8
8
 
9
- export type CalendarDatesProps = Pick<
9
+ export type CalendarDatesProps = Omit<
10
10
  CalendarProps,
11
- | "calendarDates"
12
- | "fromPrice"
13
- | "isLoading"
14
- | "disabledDates"
15
- | "selectedDate"
16
- | "setSelectedDate"
17
- | "getAvailability"
11
+ "currentDate" | "setCurrentDate" | "initialDate"
18
12
  >;
19
13
 
20
14
  export const CalendarDates = ({
@@ -25,6 +19,7 @@ export const CalendarDates = ({
25
19
  setSelectedDate,
26
20
  fromPrice,
27
21
  getAvailability,
22
+ includeAvailability,
28
23
  }: CalendarDatesProps) => {
29
24
  const fillCalendarDates = useMemo(() => {
30
25
  let firstDayOfWeek = calendarDates[0]?.weekday ?? 0;
@@ -64,6 +59,7 @@ export const CalendarDates = ({
64
59
  onSelect={() => setSelectedDate(date)}
65
60
  price={fromPrice}
66
61
  resources={getAvailability?.(date)}
62
+ showResources={includeAvailability}
67
63
  calendarView
68
64
  />
69
65
  );
@@ -16,6 +16,7 @@ export type DateTimeButtonProps<T = DateTime | string> = {
16
16
  total: number;
17
17
  };
18
18
  calendarView?: boolean;
19
+ showResources?: boolean;
19
20
  };
20
21
 
21
22
  export const DateTimeButton = <T extends DateTime | string>({
@@ -27,6 +28,7 @@ export const DateTimeButton = <T extends DateTime | string>({
27
28
  price,
28
29
  resources,
29
30
  calendarView,
31
+ showResources,
30
32
  }: DateTimeButtonProps<T>) => {
31
33
  const isTimeVariant = typeof date === "string";
32
34
 
@@ -60,7 +62,7 @@ export const DateTimeButton = <T extends DateTime | string>({
60
62
 
61
63
  {price && !isDisabled && <div className="price">{price}</div>}
62
64
 
63
- {resources && (
65
+ {showResources && resources && (
64
66
  <AvailabilityIndicator {...resources} notAvailable={_isDisabled} />
65
67
  )}
66
68
  </button>
@@ -84,11 +84,7 @@ export const CategoryProduct = ({
84
84
  // but didn't click on number input.
85
85
  // If it will be required then required check fired firstly.
86
86
 
87
- const {
88
- isRequired = false,
89
- maxAmount = 0,
90
- minAmount = 0,
91
- } = product;
87
+ const { isRequired = false, maxAmount = 0, minAmount = 0 } = product;
92
88
 
93
89
  const currentQuantity = value?.quantity ?? 0;
94
90
 
@@ -27,14 +27,11 @@ export const useCategoryVerification = () => {
27
27
  productArray.map((el) => el.id).includes(product?.id)
28
28
  );
29
29
 
30
- if (!selectedProducts.length) {
31
- return 0;
32
- }
33
-
34
- const productMinSpendsSum = selectedProducts.reduce(
35
- (sum, product) => sum + (product?.minSpend || 0),
36
- 0
37
- );
30
+ const productMinSpendsSum =
31
+ selectedProducts?.reduce(
32
+ (sum, product) => sum + (product?.minSpend || 0),
33
+ 0
34
+ ) || 0;
38
35
 
39
36
  return acc + productMinSpendsSum;
40
37
  }, 0);
@@ -14,6 +14,7 @@ import { DateTime } from "luxon";
14
14
  import { Col, Form, Row } from "react-bootstrap";
15
15
  import { useFormContext } from "react-hook-form";
16
16
  import { useTranslation } from "react-i18next";
17
+ import couponCodeRules from "@licklist/plugins/dist/validation/Rules/couponCodeRules";
17
18
  /* TODO: Show Recurrent date, when reccurent date bugs are fixed */
18
19
  // import { Frequency } from "rrule";
19
20
  // import { RecurrenceInput } from "../../../recurrence-input";
@@ -132,6 +133,10 @@ export const CouponFormControl = ({
132
133
  required: t("Validation:fieldRequired", {
133
134
  attribute: t("Design:code"),
134
135
  }) as string,
136
+ pattern: {
137
+ message: `${t("Validation:fieldCouponCode")}`,
138
+ value: couponCodeRules,
139
+ },
135
140
  })}
136
141
  disabled={isLoading}
137
142
  />