@bikdotai/bik-component-library 0.0.245-beta.6 → 0.0.246-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.
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +0 -6
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/cjs/components/bik-layout/BikHeader.d.ts +0 -3
- package/dist/cjs/components/bik-layout/BikHeader.js +1 -1
- package/dist/cjs/components/bik-layout/BikLayout.d.ts +0 -6
- package/dist/cjs/components/bik-layout/BikLayout.js +1 -1
- package/dist/cjs/components/bik-layout/BikSidebar.js +1 -1
- package/dist/cjs/components/bik-layout/CommonStyles.js +1 -1
- package/dist/cjs/components/bik-layout/FeatureModal.d.ts +0 -4
- package/dist/cjs/components/bik-layout/FeatureModal.js +1 -1
- package/dist/cjs/components/button/model.d.ts +0 -1
- package/dist/cjs/components/buttonGroup/ButtonGroup.d.ts +0 -2
- package/dist/cjs/components/buttonGroup/ButtonGroup.js +1 -1
- package/dist/cjs/components/buttonGroup/ButtonGroupStyle.d.ts +0 -2
- package/dist/cjs/components/buttonGroup/ButtonGroupStyle.js +2 -2
- package/dist/cjs/components/checkBox/CheckBox.d.ts +0 -1
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/dropdown/MenuItem/MenuItem.d.ts +0 -1
- package/dist/cjs/components/dropdown/MenuItem/MenuItem.js +2 -2
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +2 -2
- package/dist/cjs/components/dropdown/type.d.ts +0 -1
- package/dist/cjs/components/input/Input.styled.js +1 -1
- package/dist/cjs/components/list-item/ListItem.js +1 -1
- package/dist/cjs/components/modals/Modal.d.ts +0 -1
- package/dist/cjs/components/modals/Modal.js +1 -1
- package/dist/cjs/components/modals/styledModal.d.ts +0 -1
- package/dist/cjs/components/modals/styledModal.js +1 -1
- package/dist/cjs/components/plans/SubscriptionPlan.js +1 -1
- package/dist/cjs/components/plans/SubscriptionPlanSelector.js +1 -1
- package/dist/cjs/components/plans/SubscriptionPlanStyled.d.ts +0 -1
- package/dist/cjs/components/plans/SubscriptionPlanStyled.js +1 -1
- package/dist/cjs/components/states/index.d.ts +0 -1
- package/dist/cjs/components/states-modal/StateModalComponent.d.ts +0 -1
- package/dist/cjs/components/states-modal/StateModalComponent.js +1 -1
- package/dist/cjs/components/tabs/Tabs.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +0 -6
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/esm/components/bik-layout/BikHeader.d.ts +0 -3
- package/dist/esm/components/bik-layout/BikHeader.js +1 -1
- package/dist/esm/components/bik-layout/BikLayout.d.ts +0 -6
- package/dist/esm/components/bik-layout/BikLayout.js +1 -1
- package/dist/esm/components/bik-layout/BikSidebar.js +1 -1
- package/dist/esm/components/bik-layout/CommonStyles.js +1 -1
- package/dist/esm/components/bik-layout/FeatureModal.d.ts +0 -4
- package/dist/esm/components/bik-layout/FeatureModal.js +1 -1
- package/dist/esm/components/button/model.d.ts +0 -1
- package/dist/esm/components/buttonGroup/ButtonGroup.d.ts +0 -2
- package/dist/esm/components/buttonGroup/ButtonGroup.js +1 -1
- package/dist/esm/components/buttonGroup/ButtonGroupStyle.d.ts +0 -2
- package/dist/esm/components/buttonGroup/ButtonGroupStyle.js +2 -2
- package/dist/esm/components/checkBox/CheckBox.d.ts +0 -1
- package/dist/esm/components/checkBox/CheckBox.js +1 -1
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/dropdown/MenuItem/MenuItem.d.ts +0 -1
- package/dist/esm/components/dropdown/MenuItem/MenuItem.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +2 -2
- package/dist/esm/components/dropdown/type.d.ts +0 -1
- package/dist/esm/components/input/Input.styled.js +1 -1
- package/dist/esm/components/list-item/ListItem.js +1 -1
- package/dist/esm/components/modals/Modal.d.ts +0 -1
- package/dist/esm/components/modals/Modal.js +1 -1
- package/dist/esm/components/modals/styledModal.d.ts +0 -1
- package/dist/esm/components/modals/styledModal.js +1 -1
- package/dist/esm/components/plans/SubscriptionPlan.js +1 -1
- package/dist/esm/components/plans/SubscriptionPlanSelector.js +1 -1
- package/dist/esm/components/plans/SubscriptionPlanStyled.d.ts +0 -1
- package/dist/esm/components/plans/SubscriptionPlanStyled.js +1 -1
- package/dist/esm/components/states/index.d.ts +0 -1
- package/dist/esm/components/states-modal/StateModalComponent.d.ts +0 -1
- package/dist/esm/components/states-modal/StateModalComponent.js +1 -1
- package/dist/esm/components/tabs/Tabs.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/states/ShopifyScopeWrapper.d.ts +0 -14
- package/dist/cjs/components/states/ShopifyScopeWrapper.js +0 -1
- package/dist/esm/components/states/ShopifyScopeWrapper.d.ts +0 -14
- package/dist/esm/components/states/ShopifyScopeWrapper.js +0 -1
|
@@ -5,9 +5,5 @@ export interface FeatureModalProps {
|
|
|
5
5
|
onClickingCross: () => void;
|
|
6
6
|
otherContent?: JSX.Element;
|
|
7
7
|
onUpgrade?: () => void;
|
|
8
|
-
title?: string;
|
|
9
|
-
subTitle?: string;
|
|
10
|
-
showBookADemo?: boolean;
|
|
11
|
-
demoLink?: string;
|
|
12
8
|
}
|
|
13
9
|
export declare const FeatureModal: React.FC<FeatureModalProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../constants/Theme.js"),t=require("../../assets/icons/cross.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../constants/Theme.js"),t=require("../../assets/icons/cross.svg.js"),r=require("../button/Button.js"),n=require("../TypographyStyle.js"),i=require("./CommonStyles.js");exports.FeatureModal=a=>{const{zIndex:o,disableCross:c=!1,otherContent:l,onClickingCross:d,onUpgrade:u}=a;return e.jsxs(i.FeatureModalContainer,Object.assign({zIndex:o},{children:[!c&&e.jsx("div",Object.assign({className:"cross-button",onClick:()=>d(),"aria-hidden":"true"},{children:e.jsx(t.default,{height:20,width:20,color:s.COLORS.surface.subdued})})),e.jsx(i.InnerModalContainer,{children:l?e.jsx(e.Fragment,{children:l}):e.jsxs("div",Object.assign({className:"content-layout"},{children:[e.jsxs("div",{children:[e.jsx(n.TitleMedium,Object.assign({className:"title-color"},{children:"Upgrade to access this feature"})),e.jsx(n.BodyPrimary,Object.assign({className:"title-color mt-8"},{children:"This feature is not included in the current plan. Upgrade to get access and use this feature."}))]}),e.jsx(r.Button,{buttonText:"Upgrade plan",buttonType:"primary",size:"large",inverse:!0,onClick:()=>u?u():""})]}))})]}))};
|
|
@@ -15,7 +15,5 @@ export interface ButtonGroupProps {
|
|
|
15
15
|
activeButtonId?: string;
|
|
16
16
|
buttonGroup: Array<ButtonGroupInterface>;
|
|
17
17
|
size: 'small' | 'medium' | 'large';
|
|
18
|
-
matchParentWidth?: boolean;
|
|
19
|
-
borderRadius?: string;
|
|
20
18
|
}
|
|
21
19
|
export declare const ButtonGroup: React.FC<ButtonGroupProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("react/jsx-runtime"),t=require("react"),e=require("../TypographyStyle.js"),n=require("../../constants/Theme.js"),o=require("./ButtonGroupStyle.js");exports.ButtonGroup=s=>{const[r,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("react/jsx-runtime"),t=require("react"),e=require("../TypographyStyle.js"),n=require("../../constants/Theme.js"),o=require("./ButtonGroupStyle.js");exports.ButtonGroup=s=>{const[r,c]=t.useState(void 0);t.useEffect((()=>{c((null==s?void 0:s.activeButtonId)||void 0)}),[null==s?void 0:s.activeButtonId]);return i.jsx(o.ButtonGroupStyle,Object.assign({className:"button-group",width:s.width||"100%",gap:null==s?void 0:s.gap,size:null==s?void 0:s.size},{children:s.buttonGroup.map((t=>{const u=null==t?void 0:t.icon;return i.jsxs(o.Button,Object.assign({className:"button",isActive:r===t.id,onClick:()=>(i=>{c(i.id),s.onButtonClick(i.id)})(t),iconPosition:null==s?void 0:s.iconPosition,size:null==s?void 0:s.size},{children:[(null==s?void 0:s.iconPosition)&&u&&i.jsx("div",Object.assign({className:"button__image"},{children:i.jsx(u,{color:r===t.id?n.COLORS.background.inverseLight:n.COLORS.content.secondary,width:(null==s?void 0:s.iconWidth)||"18px",height:(null==s?void 0:s.iconHeight)||"18px"})})),i.jsx("div",Object.assign({className:"button__name"},{children:i.jsx(e.BodySecondary,Object.assign({style:{color:r===t.id?n.COLORS.background.inverseLight:n.COLORS.content.secondary}},{children:t.title}))}))]}),t.id)}))}))};
|
|
@@ -5,8 +5,6 @@ export declare const ButtonGroupStyle: import("styled-components").StyledCompone
|
|
|
5
5
|
}, never>;
|
|
6
6
|
export declare const Button: import("styled-components").StyledComponent<"div", any, {
|
|
7
7
|
isActive: boolean;
|
|
8
|
-
matchParentWidth: boolean;
|
|
9
|
-
borderRadius: string;
|
|
10
8
|
iconPosition?: "left" | "right" | "top" | undefined;
|
|
11
9
|
size: 'small' | 'medium' | 'large';
|
|
12
10
|
}, never>;
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
`,s=o.default.div`
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: ${e=>(null==e?void 0:e.iconPosition)&&"top"!==e.iconPosition?"left"===e.iconPosition?"row":"row-reverse":"column"};
|
|
10
|
-
flex:
|
|
10
|
+
flex: 1;
|
|
11
11
|
height: 100%;
|
|
12
12
|
background: ${e=>(null==e?void 0:e.isActive)?i.COLORS.background.brandLight:i.COLORS.surface.subdued};
|
|
13
13
|
border: 1px solid
|
|
14
14
|
${e=>(null==e?void 0:e.isActive)?i.COLORS.background.inverseLight:i.COLORS.stroke.primary};
|
|
15
|
-
border-radius:
|
|
15
|
+
border-radius: 4px;
|
|
16
16
|
align-items: center;
|
|
17
17
|
justify-content: center;
|
|
18
18
|
padding: ${e=>(null==e?void 0:e.size)?n[e.size]:"8px 10px"};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),i=require("./CheckBox.styled.js"),l=require("../TypographyStyle.js"),t=require("../../constants/Theme.js");const a=s=>e.jsxs("svg",Object.assign({width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",viewBox:s.isSmall?"0 0 16 16":"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("rect",{x:"0",y:"0",width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",rx:"4",fill:s.isDisabled?t.COLORS.content.inactive:t.COLORS.background.positive.vibrant}),!s.isPartial&&e.jsx("svg",Object.assign({width:s.isSmall?"8":"10",height:s.isSmall?"7":"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),s.isPartial&&e.jsx("rect",{x:"5",y:s.isSmall?"7":"8",width:s.isSmall?"6":"8",height:"2",rx:"1",fill:t.COLORS.surface.standard})]}));exports.CheckBox=r=>{const[c,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),i=require("./CheckBox.styled.js"),l=require("../TypographyStyle.js"),t=require("../../constants/Theme.js");const a=s=>e.jsxs("svg",Object.assign({width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",viewBox:s.isSmall?"0 0 16 16":"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("rect",{x:"0",y:"0",width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",rx:"4",fill:s.isDisabled?t.COLORS.content.inactive:t.COLORS.background.positive.vibrant}),!s.isPartial&&e.jsx("svg",Object.assign({width:s.isSmall?"8":"10",height:s.isSmall?"7":"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),s.isPartial&&e.jsx("rect",{x:"5",y:s.isSmall?"7":"8",width:s.isSmall?"6":"8",height:"2",rx:"1",fill:t.COLORS.surface.standard})]}));exports.CheckBox=r=>{const[c,n]=s.useState(r.isChecked||!1),[o,d]=s.useState(r.isPartiallyChecked||!1),[h,x]=s.useState(r.isDisabled||!1),[u,S]=s.useState(!1),[b,C]=s.useState(!1);return s.useEffect((()=>{n(r.isChecked)}),[r.isChecked]),s.useEffect((()=>{x(r.isDisabled||!1)}),[r.isDisabled]),s.useEffect((()=>{d(r.isPartiallyChecked||!1)}),[r.isPartiallyChecked]),e.jsxs(i.CheckboxContainer,Object.assign({onClick:()=>{var e;if(!r.isDisabled){const s=!c;n(s),null===(e=r.onValueChange)||void 0===e||e.call(r,s,r.value)}},onMouseEnter:()=>S(!r.skipHoverState),onMouseLeave:()=>S(!1),onMouseDown:()=>C(!r.skipHoverState),onMouseUp:()=>C(!1)},{children:[e.jsx(i.CheckboxIcon,Object.assign({checked:c,hovered:u,clicked:b,isDisabled:h,size:r.size},{children:c&&e.jsx(a,{isPartial:o||!1,isDisabled:h,isSmall:"SMALL"===r.size})})),r.label&&"SMALL"!==r.size&&e.jsx(l.BodyPrimary,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})),r.label&&"SMALL"===r.size&&e.jsx(l.BodySecondary,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),o=require("./type.js");require("../dropdown/DropdownPopover/index.js");var i=require("../dropdown/Dropdown.js");require("../zeroState/ZeroState.js");var n=require("../TypographyStyle.js"),r=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var s=require("../modals/styledModal.js"),d=require("../product-picker/ProductPickerModal.js"),a=require("../tag/Tag.js"),u=require("../tooltips/Tooltip.js"),c=require("../../assets/icons/triangle_error.svg.js"),l=require("./DiscountModal.styled.js"),T=require("./DiscountUtils.js"),p=require("./DynamicCoupon/DynamicCoupon.js"),E=require("./StaticCoupon/StaticCoupon.js");exports.DiscountModal=S=>{var C,I,P,_;const[y,O]=t.useState(),[b,D]=t.useState(null!==(C=S.data)&&void 0!==C?C:{isStaticCoupon:!1}),[N,j]=t.useState(!0),[v,U]=t.useState(),[g,m]=t.useState((null===(I=S.data)||void 0===I?void 0:I.minAmount)?o.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(P=S.data)||void 0===P?void 0:P.minQuantity)?o.MIN_PURCHASE_REQUIREMENT.QUANTITY:o.MIN_PURCHASE_REQUIREMENT.NA),[q,A]=t.useState([]),[h,x]=t.useState([]),[R,Y]=t.useState(0);t.useEffect((()=>{let e;S.hideProbability||(e=M()),j(T.validateDiscountData(b,g,v,S.hideProbability||!1,e,!!b.isStaticCoupon)),S.hideProbability||M()}),[]),t.useEffect((()=>{let e;S.hideProbability||(e=M()),j(T.validateDiscountData(b,g,v,S.hideProbability||!1,e,!!b.isStaticCoupon))}),[b,R,v,g]),t.useEffect((()=>{var e,t;if(S.products){if(null===(e=S.data)||void 0===e?void 0:e.entitledProductIds){const e=S.products.filter((e=>{var t,o;return null===(o=null===(t=S.data)||void 0===t?void 0:t.entitledProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));x(e)}if(null===(t=S.data)||void 0===t?void 0:t.prerequisiteProductIds){const e=S.products.filter((e=>{var t,o;return null===(o=null===(t=S.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));A(e)}}}),[]),t.useEffect((()=>{const e=h.map((e=>parseInt(e.id)));D(Object.assign(Object.assign({},b),{entitledProductIds:e}))}),[h]),t.useEffect((()=>{const e=q.map((e=>parseInt(e.id)));D(Object.assign(Object.assign({},b),{prerequisiteProductIds:e}))}),[q]),t.useEffect((()=>{b.targetType===o.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?U(o.DISCOUNT_TYPES.FREE_SHIPPING):b.targetSelection===o.DISCOUNT_TARGET_SELECTION.ENTITLED?U(o.DISCOUNT_TYPES.BUY_X_GET_Y):b.valueType===o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?U(o.DISCOUNT_TYPES.FIXED_AMOUNT):b.valueType===o.DISCOUNT_VALUE_TYPES.PERCENTAGE&&U(o.DISCOUNT_TYPES.PERCENTAGE)}),[]);const L=[{value:o.DISCOUNT_TYPES.FIXED_AMOUNT,label:"Fixed Amount",selected:v===o.DISCOUNT_TYPES.FIXED_AMOUNT},{value:o.DISCOUNT_TYPES.PERCENTAGE,label:"Percentage",selected:v===o.DISCOUNT_TYPES.PERCENTAGE},{value:o.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:v===o.DISCOUNT_TYPES.BUY_X_GET_Y},{value:o.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:v===o.DISCOUNT_TYPES.FREE_SHIPPING}],M=()=>{if(!S.quadrant||!S.probability)return;const e=[...S.probability];let t=[];e.length>=S.quadrant&&e.splice(S.quadrant-1,1),t=e;const o=t.reduce(((e,t)=>e+t),0)+(b.probability||0);return Y(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),o=require("./type.js");require("../dropdown/DropdownPopover/index.js");var i=require("../dropdown/Dropdown.js");require("../zeroState/ZeroState.js");var n=require("../TypographyStyle.js"),r=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var s=require("../modals/styledModal.js"),d=require("../product-picker/ProductPickerModal.js"),a=require("../tag/Tag.js"),u=require("../tooltips/Tooltip.js"),c=require("../../assets/icons/triangle_error.svg.js"),l=require("./DiscountModal.styled.js"),T=require("./DiscountUtils.js"),p=require("./DynamicCoupon/DynamicCoupon.js"),E=require("./StaticCoupon/StaticCoupon.js");exports.DiscountModal=S=>{var C,I,P,_;const[y,O]=t.useState(),[b,D]=t.useState(null!==(C=S.data)&&void 0!==C?C:{isStaticCoupon:!1}),[N,j]=t.useState(!0),[v,U]=t.useState(),[g,m]=t.useState((null===(I=S.data)||void 0===I?void 0:I.minAmount)?o.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(P=S.data)||void 0===P?void 0:P.minQuantity)?o.MIN_PURCHASE_REQUIREMENT.QUANTITY:o.MIN_PURCHASE_REQUIREMENT.NA),[q,A]=t.useState([]),[h,x]=t.useState([]),[R,Y]=t.useState(0);t.useEffect((()=>{let e;S.hideProbability||(e=M()),j(T.validateDiscountData(b,g,v,S.hideProbability||!1,e,!!b.isStaticCoupon)),S.hideProbability||M()}),[]),t.useEffect((()=>{let e;S.hideProbability||(e=M()),j(T.validateDiscountData(b,g,v,S.hideProbability||!1,e,!!b.isStaticCoupon))}),[b,R,v,g]),t.useEffect((()=>{var e,t;if(S.products){if(null===(e=S.data)||void 0===e?void 0:e.entitledProductIds){const e=S.products.filter((e=>{var t,o;return null===(o=null===(t=S.data)||void 0===t?void 0:t.entitledProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));x(e)}if(null===(t=S.data)||void 0===t?void 0:t.prerequisiteProductIds){const e=S.products.filter((e=>{var t,o;return null===(o=null===(t=S.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));A(e)}}}),[]),t.useEffect((()=>{const e=h.map((e=>parseInt(e.id)));D(Object.assign(Object.assign({},b),{entitledProductIds:e}))}),[h]),t.useEffect((()=>{const e=q.map((e=>parseInt(e.id)));D(Object.assign(Object.assign({},b),{prerequisiteProductIds:e}))}),[q]),t.useEffect((()=>{b.targetType===o.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?U(o.DISCOUNT_TYPES.FREE_SHIPPING):b.targetSelection===o.DISCOUNT_TARGET_SELECTION.ENTITLED?U(o.DISCOUNT_TYPES.BUY_X_GET_Y):b.valueType===o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?U(o.DISCOUNT_TYPES.FIXED_AMOUNT):b.valueType===o.DISCOUNT_VALUE_TYPES.PERCENTAGE&&U(o.DISCOUNT_TYPES.PERCENTAGE)}),[]);const L=[{value:o.DISCOUNT_TYPES.FIXED_AMOUNT,label:"Fixed Amount",selected:v===o.DISCOUNT_TYPES.FIXED_AMOUNT},{value:o.DISCOUNT_TYPES.PERCENTAGE,label:"Percentage",selected:v===o.DISCOUNT_TYPES.PERCENTAGE},{value:o.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:v===o.DISCOUNT_TYPES.BUY_X_GET_Y},{value:o.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:v===o.DISCOUNT_TYPES.FREE_SHIPPING}],M=()=>{if(!S.quadrant||!S.probability)return;const e=[...S.probability];let t=[];e.length>=S.quadrant&&e.splice(S.quadrant-1,1),t=e;const o=t.reduce(((e,t)=>e+t),0)+(b.probability||0);return Y(o),parseFloat(o.toFixed(4))},G=e=>{const t=e.value;U(t),t===o.DISCOUNT_TYPES.FREE_SHIPPING?(A([]),x([]),D(Object.assign(Object.assign({},b),{value:100,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,targetType:o.DISCOUNT_TARGET_TYPES.SHIPPING_LINE,valueType:o.DISCOUNT_VALUE_TYPES.PERCENTAGE,entitledQuantity:void 0,prerequisiteQuantity:void 0,entitledProductIds:void 0,prerequisiteProductIds:void 0}))):t===o.DISCOUNT_TYPES.BUY_X_GET_Y?D(Object.assign(Object.assign({},b),{targetSelection:o.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:o.DISCOUNT_VALUE_TYPES.PERCENTAGE})):t===o.DISCOUNT_TYPES.PERCENTAGE?(A([]),x([]),D(Object.assign(Object.assign({},b),{targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:o.DISCOUNT_VALUE_TYPES.PERCENTAGE,entitledQuantity:void 0,prerequisiteQuantity:void 0,entitledProductIds:void 0,prerequisiteProductIds:void 0}))):t===o.DISCOUNT_TYPES.FIXED_AMOUNT&&(A([]),x([]),D(Object.assign(Object.assign({},b),{targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,entitledQuantity:void 0,prerequisiteQuantity:void 0,entitledProductIds:void 0,prerequisiteProductIds:void 0})))};return e.jsxs(s.StyledModal,Object.assign({open:S.isOpen,headingTitle:y?"Select Products":S.title,headingSubtitle:y?void 0:S.subTitle,footerLeftCustomElement:!S.quadrant||S.hideProbability?e.jsx(e.Fragment,{}):R<=1?e.jsx(a.Tag,{theme:"light",tagText:`Current probability sum: ${R}`,type:"white"}):e.jsx(u.Tooltip,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e.jsx("div",{children:e.jsx(a.Tag,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${R}`,type:"negative",LeadingIcon:c.default})})})),headerRightCustomElement:S.allowStaticCoupon||y?void 0:e.jsx(i.Dropdown,{options:L,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{G(e)}}),onClose:S.onClose,footerShadow:!0,primaryButton:y?{buttonType:"primary",onClick:()=>{O(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Add code",disabled:N,onClick:()=>{b.isStaticCoupon?S.onSaveClicked({quadrant:b.quadrant,couponCode:b.couponCode,description:b.description,isStaticCoupon:b.isStaticCoupon,probability:b.probability,title:b.title}):S.onSaveClicked(b),D({})}},secondaryButton:y?{buttonType:"tertiaryGray",onClick:()=>{O(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:S.onClose,buttonText:"Close"}},{children:[!y&&e.jsxs(l.StyledDiscountDialogueContainer,{children:[S.allowStaticCoupon&&!y&&e.jsxs(l.CouponTypeContainerStyled,Object.assign({selectedDiv:b.isStaticCoupon?1:2},{children:[e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{D({isStaticCoupon:!0,couponCode:b.couponCode,description:b.description,quadrant:b.quadrant})}},{children:[e.jsx(n.TitleSmall,Object.assign({style:b.isStaticCoupon?{color:r.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"Static code"})),e.jsx(n.BodyCaption,Object.assign({style:b.isStaticCoupon?{color:r.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"One static code for all customers"}))]})),e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{D(Object.assign(Object.assign({},b),{isStaticCoupon:!1}))}},{children:[e.jsx(n.TitleSmall,Object.assign({style:b.isStaticCoupon?{}:{color:r.DEFAULT_THEME.colorsV2.content.brand}},{children:"Dynamic code"})),e.jsx(n.BodyCaption,Object.assign({style:b.isStaticCoupon?{}:{color:r.DEFAULT_THEME.colorsV2.content.brand}},{children:"New code generated for everyone"}))]}))]})),b.isStaticCoupon&&!y&&e.jsx(E.default,{discountData:b,setDiscountData:D,hideProbability:S.hideProbability||!1,discountAdminUrl:S.discountAdminUrl}),!b.isStaticCoupon&&!y&&e.jsx(p.default,{currency:S.currency,entitledProducts:h,prerequisiteProducts:q,setEntitledProducts:x,setPrerequisiteProducts:A,discountData:b,productPickerOpen:y,setIsProductPickerOpen:O,setDiscountData:D,selectedCouponType:v,setSelectedCouponType:U,selectedMinimumRequirement:g,setSelectedMinimumRequirement:m,hideProbability:S.hideProbability||!1,hideExpiration:S.hideExpiration||!1,allowStaticCoupon:S.allowStaticCoupon,onChangeCouponType:G})]}),!!y&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsx(d.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(_=S.products)&&void 0!==_?_:[],title:"Select Products",onClose:()=>{O(void 0)},selectedProducts:y===p.DISCOUNT_PRODUCTS.ENTITLED?h:q,setSelectedProducts:y===p.DISCOUNT_PRODUCTS.ENTITLED?x:A,onSearchKeyChange:S.onProductSearch})}))]}))};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../assets/icons/horizontal_dots.svg.js"),o=require("../../../assets/icons/vertical_dots.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../assets/icons/horizontal_dots.svg.js"),o=require("../../../assets/icons/vertical_dots.svg.js"),n=require("styled-components"),t=require("../DropdownPopover/index.js");require("../Dropdown.js"),require("react"),require("../../zeroState/ZeroState.js"),require("../../TypographyStyle.js");var s=require("../../../constants/Theme.js");require("../OpenedDropdown/components/description/Description.styled.js"),require("../../checkBox/CheckBox.styled.js"),require("../../list-item/ListItem.js"),require("../OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../OpenedDropdown/components/menu/MenuItem.js"),require("../OpenedDropdown/components/menu/MenuList.styled.js"),require("../../button/Button.js"),require("../OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../input/Input.js");var i=require("../../icon-button/IconButton.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=u(n).default.div`
|
|
2
2
|
:hover {
|
|
3
3
|
background: ${s.COLORS.surface.subdued};
|
|
4
4
|
}
|
|
5
|
-
`,p=
|
|
5
|
+
`,p=n=>e.jsx(d,{children:e.jsx(t.DropdownPopover,Object.assign({},n,{children:e.jsx("div",{children:e.jsx(i.IconButton,{Icon:n.isHorizontal?r.default:o.default,bordered:!(null==n?void 0:n.hideBorder)})})}))});p.displayName="MenuItemDropdown",exports.MenuItemDropdown=p;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),n=require("../../../../checkBox/CheckBox.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),n=require("../../../../checkBox/CheckBox.js"),i=require("../../../../list-item/ListItem.js"),s=require("../../../../TypographyStyle.js"),r=require("../../../../../constants/Theme.js"),o=require("./FreeFormMenu.styled.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const c=l(t).default(i.ListItem)`
|
|
2
2
|
padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
|
|
3
3
|
cursor: pointer;
|
|
4
4
|
margin-top: ${e=>"2.0"===e.version?"2px":"0"};
|
|
5
|
-
`;exports.MenuItem=t=>{let{option:
|
|
5
|
+
`;exports.MenuItem=t=>{let{option:i,isMultiSelect:l,showDescription:a,onSelect:d,last:u,version:p}=t;var m;function x(e){i.disabled||d(Object.assign(Object.assign({},i),{selected:e}))}return e.jsx(c,{version:p,style:u?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),x(!i.selected)},onMouseOver:function(){i.description?a(i.label,i.description):a()},listItem:{value:i.value,label:i.label},subText:i.subText,leadingIcon:l?e.jsx("div",Object.assign({style:{width:18,display:"flex",alignContent:"center",justifyContent:"center"}},{children:e.jsx(n.CheckBox,{size:"2.0"===p?"SMALL":"DEFAULT",isDisabled:null!==(m=i.disabled)&&void 0!==m&&m,isChecked:!!i.selected,onValueChange:x})})):i.leadingIcon?e.jsx(e.Fragment,{children:i.leadingIcon}):e.jsx(e.Fragment,{}),customComponent:i.customComponent,trailingIcon:i.isFreeForm?e.jsx(o.FreeFormContainer,{children:e.jsx(s.BodyCaption,Object.assign({style:{color:r.COLORS.content.secondary}},{children:"Freeform"}))}):i.trailingIcon?e.jsx(e.Fragment,{children:i.trailingIcon}):e.jsx(e.Fragment,{}),variant:i.disabled?"inactive":i.selected?"selected":"default"})};
|
|
@@ -33,7 +33,6 @@ export type SingleOption = {
|
|
|
33
33
|
leadingIcon?: JSX.Element;
|
|
34
34
|
customComponent?: JSX.Element;
|
|
35
35
|
searchKey?: string;
|
|
36
|
-
'data-test'?: string;
|
|
37
36
|
};
|
|
38
37
|
export type MultiSelectOption = SingleOption;
|
|
39
38
|
export type DropdownOption = MultiSelectOption | SingleOption | GroupedOption;
|