@bikdotai/bik-component-library 0.0.370-beta-nth → 0.0.370

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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -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("../dropdown/ChipDropdown.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"),c=require("../product-picker/ProductPickerModal.js"),d=require("../tag/Tag.js"),l=require("../tooltips/Tooltip.js"),a=require("../../assets/icons/triangle_error.svg.js"),u=require("../product-picker-v2/modal.js"),p=require("./DiscountModal.styled.js"),T=require("./DiscountUtils.js"),C=require("./DynamicCoupon/DynamicCoupon.js"),S=require("./StaticCoupon/StaticCoupon.js");exports.DiscountModal=E=>{var I,P,O,v,_,D,b,h;const[N,y]=t.useState(),[j,U]=t.useState(),[f,g]=t.useState(null!==(I=E.data)&&void 0!==I?I:"string"==typeof E.hideOption?{isStaticCoupon:"dynamic"===E.hideOption}:{isStaticCoupon:!1}),[m,q]=t.useState(!0),[x,R]=t.useState(),[A,k]=t.useState((null===(P=E.data)||void 0===P?void 0:P.minAmount)?o.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(O=E.data)||void 0===O?void 0:O.minQuantity)?o.MIN_PURCHASE_REQUIREMENT.QUANTITY:o.MIN_PURCHASE_REQUIREMENT.NA),[w,F]=t.useState([]),[M,L]=t.useState([]),[Y,G]=t.useState([]),[B,H]=t.useState([]),[V,X]=t.useState(0);t.useEffect((()=>{let e;Q(),E.hideProbability||(e=K()),q(T.validateDiscountData(f,A,x,E.hideProbability||!1,e,!!f.isStaticCoupon)),E.hideProbability||K()}),[]),t.useEffect((()=>{let e;E.hideProbability||(e=K()),q(T.validateDiscountData(f,A,x,E.hideProbability||!1,e,!!f.isStaticCoupon))}),[f,V,x,A]),t.useEffect((()=>{var e,t,o,i,n;if(!E.newPickerConf){if(E.products&&(null===(e=E.products)||void 0===e?void 0:e.length)){if(null===(t=E.data)||void 0===t?void 0:t.entitledProductIds){const e=E.products.filter((e=>{var t,o;return null===(o=null===(t=E.data)||void 0===t?void 0:t.entitledProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));L(e)}if(null===(o=E.data)||void 0===o?void 0:o.prerequisiteProductIds){const e=E.products.filter((e=>{var t,o;return null===(o=null===(t=E.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));F(e)}}if(E.collection&&E.collection.length){if(null===(i=E.data)||void 0===i?void 0:i.entitledCollectionIds){const e=E.collection.filter((e=>{var t,o;return null===(o=null===(t=E.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));H(e)}if(null===(n=E.data)||void 0===n?void 0:n.prerequisiteCollectionIds){const e=E.collection.filter((e=>{var t,o;return null===(o=null===(t=E.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));G(e)}}}}),[E.products,E.collection]),t.useEffect((()=>{var e,t,o,i,n,r,s,c;(null===(t=null===(e=E.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&L(E.data.productsConf.entitledProducts),(null===(i=null===(o=E.data)||void 0===o?void 0:o.productsConf)||void 0===i?void 0:i.prerequisiteProducts)&&F(E.data.productsConf.prerequisiteProducts),(null===(r=null===(n=E.data)||void 0===n?void 0:n.collectionsConf)||void 0===r?void 0:r.entitledCollections)&&H(E.data.collectionsConf.entitledCollections),(null===(c=null===(s=E.data)||void 0===s?void 0:s.collectionsConf)||void 0===c?void 0:c.prerequisiteCollections)&&G(E.data.collectionsConf.prerequisiteCollections)}),[null===(v=E.data)||void 0===v?void 0:v.productsConf,null===(_=E.data)||void 0===_?void 0:_.collectionsConf]),t.useEffect((()=>{if(E.newPickerConf){const e=[];return Object.values(M).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void g(Object.assign(Object.assign({},f),{entitledProductIds:e}))}const e=M.map((e=>parseInt(e.id)));g(Object.assign(Object.assign({},f),{entitledProductIds:e}))}),[M]),t.useEffect((()=>{if(E.newPickerConf){const e=[];return Object.values(w).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void g(Object.assign(Object.assign({},f),{prerequisiteProductIds:e}))}const e=w.map((e=>parseInt(e.id)));g(Object.assign(Object.assign({},f),{prerequisiteProductIds:e}))}),[w]),t.useEffect((()=>{if(E.newPickerConf){(null==B?void 0:B.isCustom)&&delete B.isCustom;const e=Object.keys(B).map((e=>parseInt(e)));return void g(Object.assign(Object.assign({},f),{entitledCollectionIds:e}))}const e=B.map((e=>parseInt(e.id)));g(Object.assign(Object.assign({},f),{entitledCollectionIds:e}))}),[B]),t.useEffect((()=>{if(E.newPickerConf){(null==Y?void 0:Y.isCustom)&&delete Y.isCustom;const e=Object.keys(Y).map((e=>parseInt(e)));return void g(Object.assign(Object.assign({},f),{prerequisiteCollectionIds:e}))}const e=Y.map((e=>parseInt(e.id)));g(Object.assign(Object.assign({},f),{prerequisiteCollectionIds:e}))}),[Y]);const Q=()=>{var e,t;f.isStaticCoupon||(f.targetType===o.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?R(o.DISCOUNT_TYPES.FREE_SHIPPING):f.targetType===o.DISCOUNT_TARGET_TYPES.LINE_ITEM?f.targetSelection===o.DISCOUNT_TARGET_SELECTION.ENTITLED?(null===(e=f.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=f.prerequisiteCollectionIds)||void 0===t?void 0:t.length)?R(o.DISCOUNT_TYPES.BUY_X_GET_Y):R(o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS):R(o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER):(g(Object.assign(Object.assign({},f),{targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,valueType:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT})),R(o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)))};t.useEffect((()=>{Q()}),[f.isStaticCoupon]);const z=[{value:o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:x===o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:x===o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:o.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:x===o.DISCOUNT_TYPES.BUY_X_GET_Y},{value:o.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:x===o.DISCOUNT_TYPES.FREE_SHIPPING}],K=()=>{if(!E.quadrant||!E.probability)return;const e=[...E.probability];let t=[];e.length>=E.quadrant&&e.splice(E.quadrant-1,1),t=e;const o=t.reduce(((e,t)=>e+t),0)+(f.probability||0);return X(parseFloat(o.toFixed(4))),parseFloat(o.toFixed(4))},$=e=>{var t,i,n,r;const s=e.value;R(s),F([]),L([]),G([]),H([]),k(o.MIN_PURCHASE_REQUIREMENT.NA),s===o.DISCOUNT_TYPES.FREE_SHIPPING?g({value:100,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,targetType:o.DISCOUNT_TARGET_TYPES.SHIPPING_LINE,valueType:o.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:f.quadrant,isStaticCoupon:!1}):s===o.DISCOUNT_TYPES.BUY_X_GET_Y?g({targetSelection:o.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:o.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:f.quadrant,isStaticCoupon:!1}):s===o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER?g({targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(i=null===(t=E.data)||void 0===t?void 0:t.valueType)&&void 0!==i?i:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:f.quadrant,isStaticCoupon:!1}):s===o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&g({targetSelection:o.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(r=null===(n=E.data)||void 0===n?void 0:n.valueType)&&void 0!==r?r:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:f.quadrant,isStaticCoupon:!1})};return e.jsxs(s.StyledModal,Object.assign({width:(j||N)&&E.newPickerConf?"25px":"750px",open:E.isOpen,headingTitle:N?"Select Products":E.title,headingSubtitle:N?void 0:E.subTitle,footerLeftCustomElement:E.errorMsg?E.errorMsg&&e.jsx(d.Tag,{theme:"light",tagText:E.errorMsg,type:"negative"}):!E.quadrant||E.hideProbability?e.jsx(e.Fragment,{}):V<=1?e.jsx(d.Tag,{theme:"light",tagText:`Current probability sum: ${V}`,type:"white"}):e.jsx(l.Tooltip,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e.jsx("div",{children:e.jsx(d.Tag,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${V}`,type:"negative",LeadingIcon:a.default})})})),headerRightCustomElement:E.allowStaticCoupon||N?void 0:e.jsx(i.Dropdown,{options:z,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{$(e)}}),onClose:E.onClose,footerShadow:!0,primaryButton:N?{buttonType:"primary",onClick:()=>{y(void 0)},buttonText:"Add"}:j?{buttonType:"primary",onClick:()=>{U(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Add code",disabled:m,isLoading:null!==(D=E.loading)&&void 0!==D&&D,onClick:()=>{var e,t;f.isStaticCoupon?E.onSaveClicked({quadrant:f.quadrant,couponCode:f.couponCode,description:f.description,isStaticCoupon:f.isStaticCoupon,probability:f.probability,title:f.title}):E.onSaveClicked(Object.assign(Object.assign({},f),{description:T.descriptionBuilder(f,E.currency,null!==(e=E.products)&&void 0!==e?e:[],null!==(t=E.collection)&&void 0!==t?t:[]),productsConf:{entitledProducts:M,prerequisiteProducts:w},collectionsConf:{entitledCollections:B,prerequisiteCollections:Y}}))}},secondaryButton:N?{buttonType:"tertiaryGray",onClick:()=>{y(void 0)},buttonText:"Back"}:j?{buttonType:"tertiaryGray",onClick:()=>{U(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:E.onClose,buttonText:"Close"}},{children:[!N&&!j&&e.jsxs(p.StyledDiscountDialogueContainer,{children:[E.allowStaticCoupon&&!N&&e.jsxs(p.CouponTypeContainerStyled,Object.assign({selectedDiv:f.isStaticCoupon?1:2},{children:["static"===E.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{f.isStaticCoupon||g({isStaticCoupon:!0,quadrant:f.quadrant})}},{children:[e.jsx(n.TitleSmall,Object.assign({style:f.isStaticCoupon?{color:r.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"Static code"})),e.jsx(n.BodyCaption,Object.assign({style:f.isStaticCoupon?{color:r.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"One static code for all customers"}))]})),"dynamic"===E.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{f.isStaticCoupon&&g({isStaticCoupon:!1,quadrant:f.quadrant})}},{children:[e.jsx(n.TitleSmall,Object.assign({style:f.isStaticCoupon?{}:{color:r.DEFAULT_THEME.colorsV2.content.brand}},{children:"Dynamic code"})),e.jsx(n.BodyCaption,Object.assign({style:f.isStaticCoupon?{}:{color:r.DEFAULT_THEME.colorsV2.content.brand}},{children:"New code generated for everyone"}))]}))]})),f.isStaticCoupon&&!N&&e.jsx(S.default,{discountData:f,setDiscountData:g,hideProbability:E.hideProbability||!1,discountAdminUrl:E.discountAdminUrl}),!f.isStaticCoupon&&!N&&!j&&e.jsx(C.default,{currency:E.currency,entitledProducts:M,prerequisiteProducts:w,setEntitledProducts:L,setPrerequisiteProducts:F,discountData:f,productPickerOpen:N,setIsProductPickerOpen:y,setDiscountData:g,selectedCouponType:x,setSelectedCouponType:R,selectedMinimumRequirement:A,setSelectedMinimumRequirement:k,hideProbability:E.hideProbability||!1,hideExpiration:E.hideExpiration||!1,allowStaticCoupon:E.allowStaticCoupon,onChangeCouponType:$,collectionPickerOpen:j,entitledCollections:B,prerequisiteCollections:Y,setIsCollectionPickerOpen:U,setEntitledCollections:H,setPrerequisiteCollections:G,useNewPicker:!!E.newPickerConf})]}),!!N&&e.jsxs(e.Fragment,{children:[!E.newPickerConf&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsx(c.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(b=E.products)&&void 0!==b?b:[],title:"Select Products",onClose:()=>{y(void 0)},selectedProducts:N===C.DISCOUNT_PRODUCTS.ENTITLED?M:w,setSelectedProducts:N===C.DISCOUNT_PRODUCTS.ENTITLED?L:F,onSearchKeyChange:E.onProductSearch})})),E.newPickerConf&&e.jsx(u.ProductPickerModal,{visible:!0,onClose:()=>y(void 0),collectionFetcher:E.newPickerConf.fetchCollections,productFetcher:E.newPickerConf.fetchProducts,selectedItems:N===C.DISCOUNT_PRODUCTS.ENTITLED?M:w,onAdd:e=>{N===C.DISCOUNT_PRODUCTS.ENTITLED?L(e):F(e),y(void 0)},zIndex:200,storeId:E.newPickerConf.storeId,searchInCollectionFetcher:E.newPickerConf.searchInCollection,customCollectionRestriction:!1,searchFetcher:E.newPickerConf.searchProducts,hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!j&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxs(e.Fragment,{children:[E.newPickerConf&&e.jsx(u.ProductPickerModal,{visible:!0,onClose:()=>U(void 0),collectionFetcher:E.newPickerConf.fetchCollections,productFetcher:E.newPickerConf.fetchProducts,selectedItems:j===C.DISCOUNT_PRODUCTS.ENTITLED?B:Y,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),j===C.DISCOUNT_PRODUCTS.ENTITLED?H(e):G(e),U(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:E.newPickerConf.storeId,searchInCollectionFetcher:E.newPickerConf.searchInCollection,searchFetcher:E.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!E.newPickerConf&&e.jsx(c.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(h=E.collection)&&void 0!==h?h:[],title:"Select Products",onClose:()=>{U(void 0)},selectedProducts:j===C.DISCOUNT_PRODUCTS.ENTITLED?B:Y,setSelectedProducts:j===C.DISCOUNT_PRODUCTS.ENTITLED?H:G,onSearchKeyChange:E.onCollectionSearch,searchPlaceholder:"Search collections..."})]})}))]}))};
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("../dropdown/ChipDropdown.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"),c=require("../product-picker/ProductPickerModal.js"),d=require("../tag/Tag.js"),l=require("../tooltips/Tooltip.js"),a=require("../../assets/icons/triangle_error.svg.js"),u=require("../product-picker-v2/modal.js"),T=require("./DiscountModal.styled.js"),p=require("./DiscountUtils.js"),C=require("./DynamicCoupon/DynamicCoupon.js"),S=require("./StaticCoupon/StaticCoupon.js");exports.DiscountModal=E=>{var O,I,P,v,_,D,N,b;const[h,y]=t.useState(),[U,j]=t.useState(),[g,f]=t.useState(null!==(O=E.data)&&void 0!==O?O:"string"==typeof E.hideOption?{isStaticCoupon:"dynamic"===E.hideOption}:{isStaticCoupon:!1}),[m,q]=t.useState(!0),[A,R]=t.useState(),[x,k]=t.useState((null===(I=E.data)||void 0===I?void 0:I.minAmount)?o.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(P=E.data)||void 0===P?void 0:P.minQuantity)?o.MIN_PURCHASE_REQUIREMENT.QUANTITY:o.MIN_PURCHASE_REQUIREMENT.NA),[w,F]=t.useState([]),[M,L]=t.useState([]),[Y,G]=t.useState([]),[B,H]=t.useState([]),[V,X]=t.useState(0);t.useEffect((()=>{let e;Q(),E.hideProbability||(e=K()),q(p.validateDiscountData(g,x,A,E.hideProbability||!1,e,!!g.isStaticCoupon)),E.hideProbability||K()}),[]),t.useEffect((()=>{let e;E.hideProbability||(e=K()),q(p.validateDiscountData(g,x,A,E.hideProbability||!1,e,!!g.isStaticCoupon))}),[g,V,A,x]),t.useEffect((()=>{var e,t,o,i,n;if(!E.newPickerConf){if(E.products&&(null===(e=E.products)||void 0===e?void 0:e.length)){if(null===(t=E.data)||void 0===t?void 0:t.entitledProductIds){const e=E.products.filter((e=>{var t,o;return null===(o=null===(t=E.data)||void 0===t?void 0:t.entitledProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));L(e)}if(null===(o=E.data)||void 0===o?void 0:o.prerequisiteProductIds){const e=E.products.filter((e=>{var t,o;return null===(o=null===(t=E.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));F(e)}}if(E.collection&&E.collection.length){if(null===(i=E.data)||void 0===i?void 0:i.entitledCollectionIds){const e=E.collection.filter((e=>{var t,o;return null===(o=null===(t=E.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));H(e)}if(null===(n=E.data)||void 0===n?void 0:n.prerequisiteCollectionIds){const e=E.collection.filter((e=>{var t,o;return null===(o=null===(t=E.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));G(e)}}}}),[E.products,E.collection]),t.useEffect((()=>{var e,t,o,i,n,r,s,c;(null===(t=null===(e=E.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&L(E.data.productsConf.entitledProducts),(null===(i=null===(o=E.data)||void 0===o?void 0:o.productsConf)||void 0===i?void 0:i.prerequisiteProducts)&&F(E.data.productsConf.prerequisiteProducts),(null===(r=null===(n=E.data)||void 0===n?void 0:n.collectionsConf)||void 0===r?void 0:r.entitledCollections)&&H(E.data.collectionsConf.entitledCollections),(null===(c=null===(s=E.data)||void 0===s?void 0:s.collectionsConf)||void 0===c?void 0:c.prerequisiteCollections)&&G(E.data.collectionsConf.prerequisiteCollections)}),[null===(v=E.data)||void 0===v?void 0:v.productsConf,null===(_=E.data)||void 0===_?void 0:_.collectionsConf]),t.useEffect((()=>{if(E.newPickerConf){const e=[];return Object.values(M).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void f(Object.assign(Object.assign({},g),{entitledProductIds:e}))}const e=M.map((e=>parseInt(e.id)));f(Object.assign(Object.assign({},g),{entitledProductIds:e}))}),[M]),t.useEffect((()=>{if(E.newPickerConf){const e=[];return Object.values(w).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void f(Object.assign(Object.assign({},g),{prerequisiteProductIds:e}))}const e=w.map((e=>parseInt(e.id)));f(Object.assign(Object.assign({},g),{prerequisiteProductIds:e}))}),[w]),t.useEffect((()=>{if(E.newPickerConf){(null==B?void 0:B.isCustom)&&delete B.isCustom;const e=Object.keys(B).map((e=>parseInt(e)));return void f(Object.assign(Object.assign({},g),{entitledCollectionIds:e}))}const e=B.map((e=>parseInt(e.id)));f(Object.assign(Object.assign({},g),{entitledCollectionIds:e}))}),[B]),t.useEffect((()=>{if(E.newPickerConf){(null==Y?void 0:Y.isCustom)&&delete Y.isCustom;const e=Object.keys(Y).map((e=>parseInt(e)));return void f(Object.assign(Object.assign({},g),{prerequisiteCollectionIds:e}))}const e=Y.map((e=>parseInt(e.id)));f(Object.assign(Object.assign({},g),{prerequisiteCollectionIds:e}))}),[Y]);const Q=()=>{var e,t;g.isStaticCoupon||(g.targetType===o.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?R(o.DISCOUNT_TYPES.FREE_SHIPPING):g.targetType===o.DISCOUNT_TARGET_TYPES.LINE_ITEM?g.targetSelection===o.DISCOUNT_TARGET_SELECTION.ENTITLED?(null===(e=g.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=g.prerequisiteCollectionIds)||void 0===t?void 0:t.length)?R(o.DISCOUNT_TYPES.BUY_X_GET_Y):R(o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS):R(o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER):(f(Object.assign(Object.assign({},g),{targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,valueType:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT})),R(o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)))};t.useEffect((()=>{f(Object.assign(Object.assign({},g),{targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,valueType:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT})),R(o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)}),[g.isStaticCoupon]);const z=[{value:o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:A===o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:A===o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:o.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:A===o.DISCOUNT_TYPES.BUY_X_GET_Y},{value:o.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:A===o.DISCOUNT_TYPES.FREE_SHIPPING}],K=()=>{if(!E.quadrant||!E.probability)return;const e=[...E.probability];let t=[];e.length>=E.quadrant&&e.splice(E.quadrant-1,1),t=e;const o=t.reduce(((e,t)=>e+t),0)+(g.probability||0);return X(parseFloat(o.toFixed(4))),parseFloat(o.toFixed(4))},$=e=>{var t,i,n,r;const s=e.value;R(s),F([]),L([]),G([]),H([]),k(o.MIN_PURCHASE_REQUIREMENT.NA),s===o.DISCOUNT_TYPES.FREE_SHIPPING?f({value:100,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,targetType:o.DISCOUNT_TARGET_TYPES.SHIPPING_LINE,valueType:o.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:g.quadrant,isStaticCoupon:!1}):s===o.DISCOUNT_TYPES.BUY_X_GET_Y?f({targetSelection:o.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:o.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:g.quadrant,isStaticCoupon:!1}):s===o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER?f({targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(i=null===(t=E.data)||void 0===t?void 0:t.valueType)&&void 0!==i?i:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:g.quadrant,isStaticCoupon:!1}):s===o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&f({targetSelection:o.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(r=null===(n=E.data)||void 0===n?void 0:n.valueType)&&void 0!==r?r:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:g.quadrant,isStaticCoupon:!1})};return e.jsxs(s.StyledModal,Object.assign({width:(U||h)&&E.newPickerConf?"25px":"750px",open:E.isOpen,headingTitle:h?"Select Products":E.title,headingSubtitle:h?void 0:E.subTitle,footerLeftCustomElement:E.errorMsg?E.errorMsg&&e.jsx(d.Tag,{theme:"light",tagText:E.errorMsg,type:"negative"}):!E.quadrant||E.hideProbability?e.jsx(e.Fragment,{}):V<=1?e.jsx(d.Tag,{theme:"light",tagText:`Current probability sum: ${V}`,type:"white"}):e.jsx(l.Tooltip,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e.jsx("div",{children:e.jsx(d.Tag,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${V}`,type:"negative",LeadingIcon:a.default})})})),headerRightCustomElement:E.allowStaticCoupon||h?void 0:e.jsx(i.Dropdown,{options:z,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{$(e)}}),onClose:E.onClose,footerShadow:!0,primaryButton:h?{buttonType:"primary",onClick:()=>{y(void 0)},buttonText:"Add"}:U?{buttonType:"primary",onClick:()=>{j(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Add code",disabled:m,isLoading:null!==(D=E.loading)&&void 0!==D&&D,onClick:()=>{var e,t;g.isStaticCoupon?E.onSaveClicked({quadrant:g.quadrant,couponCode:g.couponCode,description:g.description,isStaticCoupon:g.isStaticCoupon,probability:g.probability,title:g.title}):E.onSaveClicked(Object.assign(Object.assign({},g),{description:p.descriptionBuilder(g,E.currency,null!==(e=E.products)&&void 0!==e?e:[],null!==(t=E.collection)&&void 0!==t?t:[]),productsConf:{entitledProducts:M,prerequisiteProducts:w},collectionsConf:{entitledCollections:B,prerequisiteCollections:Y}}))}},secondaryButton:h?{buttonType:"tertiaryGray",onClick:()=>{y(void 0)},buttonText:"Back"}:U?{buttonType:"tertiaryGray",onClick:()=>{j(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:E.onClose,buttonText:"Close"}},{children:[!h&&!U&&e.jsxs(T.StyledDiscountDialogueContainer,{children:[E.allowStaticCoupon&&!h&&e.jsxs(T.CouponTypeContainerStyled,Object.assign({selectedDiv:g.isStaticCoupon?1:2},{children:["static"===E.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{g.isStaticCoupon||f({isStaticCoupon:!0,quadrant:g.quadrant})}},{children:[e.jsx(n.TitleSmall,Object.assign({style:g.isStaticCoupon?{color:r.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"Static code"})),e.jsx(n.BodyCaption,Object.assign({style:g.isStaticCoupon?{color:r.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"One static code for all customers"}))]})),"dynamic"===E.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{g.isStaticCoupon&&f({isStaticCoupon:!1,quadrant:g.quadrant})}},{children:[e.jsx(n.TitleSmall,Object.assign({style:g.isStaticCoupon?{}:{color:r.DEFAULT_THEME.colorsV2.content.brand}},{children:"Dynamic code"})),e.jsx(n.BodyCaption,Object.assign({style:g.isStaticCoupon?{}:{color:r.DEFAULT_THEME.colorsV2.content.brand}},{children:"New code generated for everyone"}))]}))]})),g.isStaticCoupon&&!h&&e.jsx(S.default,{discountData:g,setDiscountData:f,hideProbability:E.hideProbability||!1,discountAdminUrl:E.discountAdminUrl}),!g.isStaticCoupon&&!h&&!U&&e.jsx(C.default,{currency:E.currency,entitledProducts:M,prerequisiteProducts:w,setEntitledProducts:L,setPrerequisiteProducts:F,discountData:g,productPickerOpen:h,setIsProductPickerOpen:y,setDiscountData:f,selectedCouponType:A,setSelectedCouponType:R,selectedMinimumRequirement:x,setSelectedMinimumRequirement:k,hideProbability:E.hideProbability||!1,hideExpiration:E.hideExpiration||!1,allowStaticCoupon:E.allowStaticCoupon,onChangeCouponType:$,collectionPickerOpen:U,entitledCollections:B,prerequisiteCollections:Y,setIsCollectionPickerOpen:j,setEntitledCollections:H,setPrerequisiteCollections:G,useNewPicker:!!E.newPickerConf})]}),!!h&&e.jsxs(e.Fragment,{children:[!E.newPickerConf&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsx(c.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(N=E.products)&&void 0!==N?N:[],title:"Select Products",onClose:()=>{y(void 0)},selectedProducts:h===C.DISCOUNT_PRODUCTS.ENTITLED?M:w,setSelectedProducts:h===C.DISCOUNT_PRODUCTS.ENTITLED?L:F,onSearchKeyChange:E.onProductSearch})})),E.newPickerConf&&e.jsx(u.ProductPickerModal,{visible:!0,onClose:()=>y(void 0),collectionFetcher:E.newPickerConf.fetchCollections,productFetcher:E.newPickerConf.fetchProducts,selectedItems:h===C.DISCOUNT_PRODUCTS.ENTITLED?M:w,onAdd:e=>{h===C.DISCOUNT_PRODUCTS.ENTITLED?L(e):F(e),y(void 0)},zIndex:200,storeId:E.newPickerConf.storeId,searchInCollectionFetcher:E.newPickerConf.searchInCollection,customCollectionRestriction:!1,searchFetcher:E.newPickerConf.searchProducts,hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!U&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxs(e.Fragment,{children:[E.newPickerConf&&e.jsx(u.ProductPickerModal,{visible:!0,onClose:()=>j(void 0),collectionFetcher:E.newPickerConf.fetchCollections,productFetcher:E.newPickerConf.fetchProducts,selectedItems:U===C.DISCOUNT_PRODUCTS.ENTITLED?B:Y,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),U===C.DISCOUNT_PRODUCTS.ENTITLED?H(e):G(e),j(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:E.newPickerConf.storeId,searchInCollectionFetcher:E.newPickerConf.searchInCollection,searchFetcher:E.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!E.newPickerConf&&e.jsx(c.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(b=E.collection)&&void 0!==b?b:[],title:"Select Products",onClose:()=>{j(void 0)},selectedProducts:U===C.DISCOUNT_PRODUCTS.ENTITLED?B:Y,setSelectedProducts:U===C.DISCOUNT_PRODUCTS.ENTITLED?H:G,onSearchKeyChange:E.onCollectionSearch,searchPlaceholder:"Search collections..."})]})}))]}))};
@@ -11,7 +11,6 @@ export interface NewSubscriptionPlanProps extends SubscriptionPlanProps {
11
11
  isPlanSelected?: boolean;
12
12
  onClickShowAllFeatures?: () => void;
13
13
  showSelectedPlanChip?: boolean;
14
- perMonthForYearly?: string;
15
14
  }
16
15
  type Props = NewSubscriptionPlanProps;
17
16
  export declare const NewSubscriptionPlan: FunctionComponent<Props>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/check.svg.js"),t=require("../../assets/icons/checkCircle.svg.js"),i=require("../../assets/icons/quotes.svg.js"),a=require("../../assets/icons/WhiteStarFilled.svg.js"),n=require("../button/Button.js"),r=require("./SubscriptionPlanStyled.js"),o=require("../TypographyStyle.js"),l=require("../../hooks/useCurreny.js"),c=require("../../constants/Theme.js"),d=require("../tag/Tag.js");exports.NewSubscriptionPlan=h=>{var u;const{formatCurrency:j}=l.useCurrency(),p=h.showMonthlyOptions?h.features:h.annualFeatures||[],g=h.showMonthlyOptions?h.monthlyPlan:h.yearlyPlan,m=!h.isDisabled&&h.isMostPopular,y=h.showMonthlyOptions?h.code:null!==(u=h.yearlyCode)&&void 0!==u?u:h.code,x=e=>0==e?"$0":j(e,"USD"),{planName:b,isSelected:O=!1,isDisabled:C=!1,onPlanSelect:v,oldPrice:S,hideMonthYearTag:T,planDescription:N,planDescriptionDiscount:f,showTrialOptions:L,freeTrialMessages:P,extraBlockMessage:w,isLoading:k,buttonText:B,bottomDescription:M,showMonthlyOptions:q,popularTestimony:R,skipRadioSelection:D=!1,includeText:F,height:_,showFeaturesButton:z,businessDescription:W,isPlanSelected:$=!1,onClickShowAllFeatures:H,showSelectedPlanChip:I=!1,perMonthForYearly:Y}=h;return e.jsxs(r.NewSubscriptionStyled,Object.assign({height:_,showMostPopularChip:m||!1,onClick:()=>v(y)},{children:[m&&e.jsxs("div",Object.assign({className:"most-popular-chip"},{children:[e.jsx(o.Caption,Object.assign({className:"popular-text"},{children:"Most popular "})),e.jsx(a.default,{height:12,width:12})]})),e.jsxs("div",Object.assign({className:`box ${C?"disabled":""} \n\t\t\t\t`},{children:[e.jsxs("div",Object.assign({className:"radio-flex"},{children:[!D&&e.jsx("input",{type:"radio",id:"html",name:"fav_language",value:"HTML",disabled:null!=C&&C,onChange:()=>v(y),className:"radio-button",checked:$}),e.jsx(o.TitleRegular,Object.assign({style:{color:c.COLORS.content.secondary,marginBottom:4}},{children:b})),I&&e.jsx("div",Object.assign({style:{marginLeft:"auto"}},{children:e.jsx(d.Tag,{tagText:"Current plan",type:"positive",theme:"dark"})}))]})),e.jsxs("div",Object.assign({className:"price-block"},{children:[S?e.jsx(o.BodyCaption,Object.assign({className:"old--price"},{children:x(g.price)})):e.jsx(e.Fragment,{}),e.jsx(o.TitleLarge,Object.assign({style:{color:c.COLORS.content.primary}},{children:x(S||g.price)})),e.jsx(o.BodyPrimary,Object.assign({style:{color:c.COLORS.content.secondary,marginLeft:4}},{children:T?"":"/ "+(q?"month":Y?"/month billed annually":"year")}))]})),N&&e.jsxs("div",Object.assign({className:"per-message-price"},{children:[e.jsx(o.BodyCaption,Object.assign({style:{color:c.COLORS.content.secondary}},{children:N})),f&&e.jsx(o.BodyCaption,Object.assign({style:{color:c.COLORS.background.positive.vibrant,marginLeft:4}},{children:f}))]})),W&&W.length&&e.jsx("div",Object.assign({style:{marginTop:4}},{children:W.map(((s,t)=>e.jsx(o.BodySecondary,{style:{color:c.COLORS.content.secondary},dangerouslySetInnerHTML:{__html:s}},t)))})),L&&e.jsxs(o.Caption,Object.assign({className:"trial "+(O?"selected":"")},{children:["7 day free trial with ",P," messages"]})),w&&e.jsx(o.Caption,Object.assign({className:"trial "+(O?"selected":"")},{children:w})),e.jsx(o.TitleSmall,Object.assign({className:"extra-include-margin",style:{height:F?"":"20px"}},{children:F||""})),e.jsx("div",Object.assign({className:"features"},{children:p.map(((s,i)=>e.jsxs("div",Object.assign({className:"feature"},{children:[e.jsx("div",{children:e.jsx(t.default,{height:20,width:20,color:c.COLORS.content.primary})}),e.jsx(o.BodySecondary,Object.assign({className:"feature-text"},{children:s.detail}),i)]}),s.detail)))})),z&&e.jsx(n.Button,{isLoading:!1,buttonType:"tertiary",buttonText:"See all features",size:"small",onClick:e=>{e.stopPropagation(),H&&H()}}),D&&e.jsx("div",Object.assign({className:"button-box"},{children:k?e.jsx(n.Button,{isLoading:!0,buttonType:"primary",buttonText:"Choose plan",size:"medium",matchParentWidth:!0}):e.jsxs(e.Fragment,{children:[O&&e.jsx(n.Button,{disabled:C,LeadingIcon:s.default,buttonType:"tertiary",size:"medium",matchParentWidth:!0,buttonText:B||"Selected Plan"}),!O&&!C&&e.jsx(n.Button,{buttonType:"primary",size:"medium",onClick:e=>{e.stopPropagation(),v(y)},matchParentWidth:!0,buttonText:B||"Choose plan"})]})})),R&&e.jsxs("div",Object.assign({className:"popular-testimony"},{children:[e.jsx(i.default,{height:26,width:70}),e.jsx("div",Object.assign({className:"testimony-text"},{children:R}))]}))]})),M&&e.jsx("div",Object.assign({className:`plan-bottom-information\n\t\t\t\t\t${C?"disabled":""}\n\t\t\t\t\t${O?"selected":""}\n\t\t\t\t`},{children:e.jsx(o.Caption,Object.assign({className:"text",style:{color:c.COLORS.background.inverse}},{children:M}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/check.svg.js"),t=require("../../assets/icons/checkCircle.svg.js"),i=require("../../assets/icons/quotes.svg.js"),a=require("../../assets/icons/WhiteStarFilled.svg.js"),n=require("../button/Button.js"),r=require("./SubscriptionPlanStyled.js"),o=require("../TypographyStyle.js"),l=require("../../hooks/useCurreny.js"),c=require("../../constants/Theme.js"),d=require("../tag/Tag.js");exports.NewSubscriptionPlan=h=>{var u;const{formatCurrency:j}=l.useCurrency(),p=h.showMonthlyOptions?h.features:h.annualFeatures||[],g=h.showMonthlyOptions?h.monthlyPlan:h.yearlyPlan,m=!h.isDisabled&&h.isMostPopular,x=h.showMonthlyOptions?h.code:null!==(u=h.yearlyCode)&&void 0!==u?u:h.code,y=e=>0==e?"$0":j(e,"USD"),{planName:b,isSelected:O=!1,isDisabled:C=!1,onPlanSelect:v,oldPrice:S,hideMonthYearTag:T,planDescription:N,planDescriptionDiscount:f,showTrialOptions:L,freeTrialMessages:P,extraBlockMessage:w,isLoading:k,buttonText:B,bottomDescription:M,showMonthlyOptions:q,popularTestimony:R,skipRadioSelection:D=!1,includeText:F,height:_,showFeaturesButton:z,businessDescription:W,isPlanSelected:$=!1,onClickShowAllFeatures:H,showSelectedPlanChip:I=!1}=h;return e.jsxs(r.NewSubscriptionStyled,Object.assign({height:_,showMostPopularChip:m||!1,onClick:()=>v(x)},{children:[m&&e.jsxs("div",Object.assign({className:"most-popular-chip"},{children:[e.jsx(o.Caption,Object.assign({className:"popular-text"},{children:"Most popular "})),e.jsx(a.default,{height:12,width:12})]})),e.jsxs("div",Object.assign({className:`box ${C?"disabled":""} \n\t\t\t\t`},{children:[e.jsxs("div",Object.assign({className:"radio-flex"},{children:[!D&&e.jsx("input",{type:"radio",id:"html",name:"fav_language",value:"HTML",disabled:null!=C&&C,onChange:()=>v(x),className:"radio-button",checked:$}),e.jsx(o.TitleRegular,Object.assign({style:{color:c.COLORS.content.secondary,marginBottom:4}},{children:b})),I&&e.jsx("div",Object.assign({style:{marginLeft:"auto"}},{children:e.jsx(d.Tag,{tagText:"Current plan",type:"positive",theme:"dark"})}))]})),e.jsxs("div",Object.assign({className:"price-block"},{children:[S?e.jsx(o.BodyCaption,Object.assign({className:"old--price"},{children:y(g.price)})):e.jsx(e.Fragment,{}),e.jsx(o.TitleLarge,Object.assign({style:{color:c.COLORS.content.primary}},{children:y(S||g.price)})),e.jsx(o.BodyPrimary,Object.assign({style:{color:c.COLORS.content.secondary,marginLeft:4}},{children:T?"":"/ "+(q?"month":"year")}))]})),N&&e.jsxs("div",Object.assign({className:"per-message-price"},{children:[e.jsx(o.BodyCaption,Object.assign({style:{color:c.COLORS.content.secondary}},{children:N})),f&&e.jsx(o.BodyCaption,Object.assign({style:{color:c.COLORS.background.positive.vibrant,marginLeft:4}},{children:f}))]})),W&&W.length&&e.jsx("div",Object.assign({style:{marginTop:4}},{children:W.map(((s,t)=>e.jsx(o.BodySecondary,{style:{color:c.COLORS.content.secondary},dangerouslySetInnerHTML:{__html:s}},t)))})),L&&e.jsxs(o.Caption,Object.assign({className:"trial "+(O?"selected":"")},{children:["7 day free trial with ",P," messages"]})),w&&e.jsx(o.Caption,Object.assign({className:"trial "+(O?"selected":"")},{children:w})),F&&e.jsx(o.TitleSmall,Object.assign({className:"extra-include-margin"},{children:F})),e.jsx("div",Object.assign({className:"features"},{children:p.map(((s,i)=>e.jsxs("div",Object.assign({className:"feature"},{children:[e.jsx("div",{children:e.jsx(t.default,{height:20,width:20,color:c.COLORS.content.primary})}),e.jsx(o.BodySecondary,Object.assign({className:"feature-text"},{children:s.detail}),i)]}),s.detail)))})),z&&e.jsx(n.Button,{isLoading:!1,buttonType:"tertiary",buttonText:"See all features",size:"small",onClick:e=>{e.stopPropagation(),H&&H()}}),D&&e.jsx("div",Object.assign({className:"button-box"},{children:k?e.jsx(n.Button,{isLoading:!0,buttonType:"primary",buttonText:"Choose plan",size:"medium",matchParentWidth:!0}):e.jsxs(e.Fragment,{children:[O&&e.jsx(n.Button,{disabled:C,LeadingIcon:s.default,buttonType:"tertiary",size:"medium",matchParentWidth:!0,buttonText:B||"Selected Plan"}),!O&&!C&&e.jsx(n.Button,{buttonType:"primary",size:"medium",onClick:e=>{e.stopPropagation(),v(x)},matchParentWidth:!0,buttonText:B||"Choose plan"})]})})),R&&e.jsxs("div",Object.assign({className:"popular-testimony"},{children:[e.jsx(i.default,{height:26,width:70}),e.jsx("div",Object.assign({className:"testimony-text"},{children:R}))]}))]})),M&&e.jsx("div",Object.assign({className:`plan-bottom-information\n\t\t\t\t\t${C?"disabled":""}\n\t\t\t\t\t${O?"selected":""}\n\t\t\t\t`},{children:e.jsx(o.Caption,Object.assign({className:"text",style:{color:c.COLORS.background.inverse}},{children:M}))}))]}))};
@@ -9,7 +9,6 @@ type Props = {
9
9
  selectedTab?: 'monthly' | 'annually';
10
10
  selectedPlan?: string;
11
11
  currentPlan?: string;
12
- perMonthForYearly?: boolean;
13
12
  };
14
13
  export declare const SubscriptionPlansCollected: FunctionComponent<Props>;
15
14
  export {};
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("styled-components"),n=require("./NewSubscriptionPlan.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const r=o(l).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("styled-components"),n=require("./NewSubscriptionPlan.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const o=s(l).default.div`
2
2
  display: flex;
3
3
  column-gap: 22px;
4
4
  align-items: stretch;
5
5
  overflow-x: auto;
6
- `;exports.SubscriptionPlansCollected=l=>{var o;const[s,a]=t.useState(null!==(o=l.selectedPlan)&&void 0!==o?o:"");return e.jsx(r,Object.assign({style:{padding:"28px 0px"}},{children:l.plans.map(((o,r)=>{var i,c;return e.jsx("div",Object.assign({style:{width:null!==(i=l.staticWidth)&&void 0!==i?i:308}},{children:t.createElement(n.NewSubscriptionPlan,Object.assign({},o,{showMonthly:!0,showMonthlyOptions:null!==(c="monthly"==l.selectedTab)&&void 0!==c&&c,showTrialOptions:l.showTrialOptions||!1,onPlanSelect:e=>{l.onPlanSelect(e),a(e)},key:o.planName,isPlanSelected:s==("monthly"==l.selectedTab?o.code:o.yearlyCode),onClickShowAllFeatures:l.onClickShowAllFeatures,showSelectedPlanChip:l.currentPlan==("monthly"==l.selectedTab?o.code:o.yearlyCode),perMonthForYearly:o.perMonthForYearly}))}),r)}))}))};
6
+ `;exports.SubscriptionPlansCollected=l=>{var s;const[a,i]=t.useState(null!==(s=l.selectedPlan)&&void 0!==s?s:"");return e.jsx(o,Object.assign({style:{padding:"28px 0px"}},{children:l.plans.map(((s,o)=>{var r,c;return e.jsx("div",Object.assign({style:{width:null!==(r=l.staticWidth)&&void 0!==r?r:308}},{children:t.createElement(n.NewSubscriptionPlan,Object.assign({},s,{showMonthly:!0,showMonthlyOptions:null!==(c="monthly"==l.selectedTab)&&void 0!==c&&c,showTrialOptions:l.showTrialOptions||!1,onPlanSelect:e=>{l.onPlanSelect(e),i(e)},key:s.planName,isPlanSelected:a==("monthly"==l.selectedTab?s.code:s.yearlyCode),onClickShowAllFeatures:l.onClickShowAllFeatures,showSelectedPlanChip:l.currentPlan==("monthly"==l.selectedTab?s.code:s.yearlyCode)}))}),o)}))}))};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{MIN_PURCHASE_REQUIREMENT as r,DISCOUNT_TARGET_TYPES as c,DISCOUNT_TYPES as d,DISCOUNT_TARGET_SELECTION as s,DISCOUNT_VALUE_TYPES as l}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as a}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{TitleSmall as u,BodyCaption as p}from"../TypographyStyle.js";import{DEFAULT_THEME as C}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledModal as v}from"../modals/styledModal.js";import{ProductPickerContent as m}from"../product-picker/ProductPickerModal.js";import{Tag as h}from"../tag/Tag.js";import{Tooltip as b}from"../tooltips/Tooltip.js";import y from"../../assets/icons/triangle_error.svg.js";import{ProductPickerModal as P}from"../product-picker-v2/modal.js";import{StyledDiscountDialogueContainer as T,CouponTypeContainerStyled as I}from"./DiscountModal.styled.js";import{validateDiscountData as O,descriptionBuilder as f}from"./DiscountUtils.js";import g,{DISCOUNT_PRODUCTS as S}from"./DynamicCoupon/DynamicCoupon.js";import E from"./StaticCoupon/StaticCoupon.js";const j=j=>{var w,k,_,D,N,F,q,M;const[A,x]=i(),[L,R]=i(),[U,G]=i(null!==(w=j.data)&&void 0!==w?w:"string"==typeof j.hideOption?{isStaticCoupon:"dynamic"===j.hideOption}:{isStaticCoupon:!1}),[B,Y]=i(!0),[X,H]=i(),[V,z]=i((null===(k=j.data)||void 0===k?void 0:k.minAmount)?r.AMOUNT:(null===(_=j.data)||void 0===_?void 0:_.minQuantity)?r.QUANTITY:r.NA),[K,Q]=i([]),[$,Z]=i([]),[J,W]=i([]),[ee,te]=i([]),[oe,ie]=i(0);n((()=>{let e;ne(),j.hideProbability||(e=ce()),Y(O(U,V,X,j.hideProbability||!1,e,!!U.isStaticCoupon)),j.hideProbability||ce()}),[]),n((()=>{let e;j.hideProbability||(e=ce()),Y(O(U,V,X,j.hideProbability||!1,e,!!U.isStaticCoupon))}),[U,oe,X,V]),n((()=>{var e,t,o,i,n;if(!j.newPickerConf){if(j.products&&(null===(e=j.products)||void 0===e?void 0:e.length)){if(null===(t=j.data)||void 0===t?void 0:t.entitledProductIds){const e=j.products.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.entitledProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));Z(e)}if(null===(o=j.data)||void 0===o?void 0:o.prerequisiteProductIds){const e=j.products.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));Q(e)}}if(j.collection&&j.collection.length){if(null===(i=j.data)||void 0===i?void 0:i.entitledCollectionIds){const e=j.collection.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));te(e)}if(null===(n=j.data)||void 0===n?void 0:n.prerequisiteCollectionIds){const e=j.collection.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));W(e)}}}}),[j.products,j.collection]),n((()=>{var e,t,o,i,n,r,c,d;(null===(t=null===(e=j.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&Z(j.data.productsConf.entitledProducts),(null===(i=null===(o=j.data)||void 0===o?void 0:o.productsConf)||void 0===i?void 0:i.prerequisiteProducts)&&Q(j.data.productsConf.prerequisiteProducts),(null===(r=null===(n=j.data)||void 0===n?void 0:n.collectionsConf)||void 0===r?void 0:r.entitledCollections)&&te(j.data.collectionsConf.entitledCollections),(null===(d=null===(c=j.data)||void 0===c?void 0:c.collectionsConf)||void 0===d?void 0:d.prerequisiteCollections)&&W(j.data.collectionsConf.prerequisiteCollections)}),[null===(D=j.data)||void 0===D?void 0:D.productsConf,null===(N=j.data)||void 0===N?void 0:N.collectionsConf]),n((()=>{if(j.newPickerConf){const e=[];return Object.values($).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},U),{entitledProductIds:e}))}const e=$.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},U),{entitledProductIds:e}))}),[$]),n((()=>{if(j.newPickerConf){const e=[];return Object.values(K).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},U),{prerequisiteProductIds:e}))}const e=K.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},U),{prerequisiteProductIds:e}))}),[K]),n((()=>{if(j.newPickerConf){(null==ee?void 0:ee.isCustom)&&delete ee.isCustom;const e=Object.keys(ee).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},U),{entitledCollectionIds:e}))}const e=ee.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},U),{entitledCollectionIds:e}))}),[ee]),n((()=>{if(j.newPickerConf){(null==J?void 0:J.isCustom)&&delete J.isCustom;const e=Object.keys(J).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},U),{prerequisiteCollectionIds:e}))}const e=J.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},U),{prerequisiteCollectionIds:e}))}),[J]);const ne=()=>{var e,t;U.isStaticCoupon||(U.targetType===c.SHIPPING_LINE?H(d.FREE_SHIPPING):U.targetType===c.LINE_ITEM?U.targetSelection===s.ENTITLED?(null===(e=U.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=U.prerequisiteCollectionIds)||void 0===t?void 0:t.length)?H(d.BUY_X_GET_Y):H(d.AMOUNT_OFF_PRODUCTS):H(d.AMOUNT_OFF_ORDER):(G(Object.assign(Object.assign({},U),{targetType:c.LINE_ITEM,targetSelection:s.ALL,valueType:l.FIXED_AMOUNT})),H(d.AMOUNT_OFF_ORDER)))};n((()=>{ne()}),[U.isStaticCoupon]);const re=[{value:d.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:X===d.AMOUNT_OFF_ORDER},{value:d.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:X===d.AMOUNT_OFF_PRODUCTS},{value:d.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:X===d.BUY_X_GET_Y},{value:d.FREE_SHIPPING,label:"Free shipping",selected:X===d.FREE_SHIPPING}],ce=()=>{if(!j.quadrant||!j.probability)return;const e=[...j.probability];let t=[];e.length>=j.quadrant&&e.splice(j.quadrant-1,1),t=e;const o=t.reduce(((e,t)=>e+t),0)+(U.probability||0);return ie(parseFloat(o.toFixed(4))),parseFloat(o.toFixed(4))},de=e=>{var t,o,i,n;const a=e.value;H(a),Q([]),Z([]),W([]),te([]),z(r.NA),a===d.FREE_SHIPPING?G({value:100,targetSelection:s.ALL,targetType:c.SHIPPING_LINE,valueType:l.PERCENTAGE,quadrant:U.quadrant,isStaticCoupon:!1}):a===d.BUY_X_GET_Y?G({targetSelection:s.ENTITLED,targetType:c.LINE_ITEM,valueType:l.PERCENTAGE,quadrant:U.quadrant,isStaticCoupon:!1}):a===d.AMOUNT_OFF_ORDER?G({targetSelection:s.ALL,targetType:c.LINE_ITEM,valueType:null!==(o=null===(t=j.data)||void 0===t?void 0:t.valueType)&&void 0!==o?o:l.FIXED_AMOUNT,quadrant:U.quadrant,isStaticCoupon:!1}):a===d.AMOUNT_OFF_PRODUCTS&&G({targetSelection:s.ENTITLED,targetType:c.LINE_ITEM,valueType:null!==(n=null===(i=j.data)||void 0===i?void 0:i.valueType)&&void 0!==n?n:l.FIXED_AMOUNT,quadrant:U.quadrant,isStaticCoupon:!1})};return e(v,Object.assign({width:(L||A)&&j.newPickerConf?"25px":"750px",open:j.isOpen,headingTitle:A?"Select Products":j.title,headingSubtitle:A?void 0:j.subTitle,footerLeftCustomElement:j.errorMsg?j.errorMsg&&t(h,{theme:"light",tagText:j.errorMsg,type:"negative"}):!j.quadrant||j.hideProbability?t(o,{}):oe<=1?t(h,{theme:"light",tagText:`Current probability sum: ${oe}`,type:"white"}):t(b,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:t("div",{children:t(h,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${oe}`,type:"negative",LeadingIcon:y})})})),headerRightCustomElement:j.allowStaticCoupon||A?void 0:t(a,{options:re,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{de(e)}}),onClose:j.onClose,footerShadow:!0,primaryButton:A?{buttonType:"primary",onClick:()=>{x(void 0)},buttonText:"Add"}:L?{buttonType:"primary",onClick:()=>{R(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Add code",disabled:B,isLoading:null!==(F=j.loading)&&void 0!==F&&F,onClick:()=>{var e,t;U.isStaticCoupon?j.onSaveClicked({quadrant:U.quadrant,couponCode:U.couponCode,description:U.description,isStaticCoupon:U.isStaticCoupon,probability:U.probability,title:U.title}):j.onSaveClicked(Object.assign(Object.assign({},U),{description:f(U,j.currency,null!==(e=j.products)&&void 0!==e?e:[],null!==(t=j.collection)&&void 0!==t?t:[]),productsConf:{entitledProducts:$,prerequisiteProducts:K},collectionsConf:{entitledCollections:ee,prerequisiteCollections:J}}))}},secondaryButton:A?{buttonType:"tertiaryGray",onClick:()=>{x(void 0)},buttonText:"Back"}:L?{buttonType:"tertiaryGray",onClick:()=>{R(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:j.onClose,buttonText:"Close"}},{children:[!A&&!L&&e(T,{children:[j.allowStaticCoupon&&!A&&e(I,Object.assign({selectedDiv:U.isStaticCoupon?1:2},{children:["static"===j.hideOption?t(o,{}):e("div",Object.assign({className:"coupon-type__container",onClick:()=>{U.isStaticCoupon||G({isStaticCoupon:!0,quadrant:U.quadrant})}},{children:[t(u,Object.assign({style:U.isStaticCoupon?{color:C.colorsV2.content.brand}:{}},{children:"Static code"})),t(p,Object.assign({style:U.isStaticCoupon?{color:C.colorsV2.content.brand}:{}},{children:"One static code for all customers"}))]})),"dynamic"===j.hideOption?t(o,{}):e("div",Object.assign({className:"coupon-type__container",onClick:()=>{U.isStaticCoupon&&G({isStaticCoupon:!1,quadrant:U.quadrant})}},{children:[t(u,Object.assign({style:U.isStaticCoupon?{}:{color:C.colorsV2.content.brand}},{children:"Dynamic code"})),t(p,Object.assign({style:U.isStaticCoupon?{}:{color:C.colorsV2.content.brand}},{children:"New code generated for everyone"}))]}))]})),U.isStaticCoupon&&!A&&t(E,{discountData:U,setDiscountData:G,hideProbability:j.hideProbability||!1,discountAdminUrl:j.discountAdminUrl}),!U.isStaticCoupon&&!A&&!L&&t(g,{currency:j.currency,entitledProducts:$,prerequisiteProducts:K,setEntitledProducts:Z,setPrerequisiteProducts:Q,discountData:U,productPickerOpen:A,setIsProductPickerOpen:x,setDiscountData:G,selectedCouponType:X,setSelectedCouponType:H,selectedMinimumRequirement:V,setSelectedMinimumRequirement:z,hideProbability:j.hideProbability||!1,hideExpiration:j.hideExpiration||!1,allowStaticCoupon:j.allowStaticCoupon,onChangeCouponType:de,collectionPickerOpen:L,entitledCollections:ee,prerequisiteCollections:J,setIsCollectionPickerOpen:R,setEntitledCollections:te,setPrerequisiteCollections:W,useNewPicker:!!j.newPickerConf})]}),!!A&&e(o,{children:[!j.newPickerConf&&t("div",Object.assign({style:{padding:"12px 0"}},{children:t(m,{show:!0,onSave:()=>{},products:null!==(q=j.products)&&void 0!==q?q:[],title:"Select Products",onClose:()=>{x(void 0)},selectedProducts:A===S.ENTITLED?$:K,setSelectedProducts:A===S.ENTITLED?Z:Q,onSearchKeyChange:j.onProductSearch})})),j.newPickerConf&&t(P,{visible:!0,onClose:()=>x(void 0),collectionFetcher:j.newPickerConf.fetchCollections,productFetcher:j.newPickerConf.fetchProducts,selectedItems:A===S.ENTITLED?$:K,onAdd:e=>{A===S.ENTITLED?Z(e):Q(e),x(void 0)},zIndex:200,storeId:j.newPickerConf.storeId,searchInCollectionFetcher:j.newPickerConf.searchInCollection,customCollectionRestriction:!1,searchFetcher:j.newPickerConf.searchProducts,hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!L&&t("div",Object.assign({style:{padding:"12px 0"}},{children:e(o,{children:[j.newPickerConf&&t(P,{visible:!0,onClose:()=>R(void 0),collectionFetcher:j.newPickerConf.fetchCollections,productFetcher:j.newPickerConf.fetchProducts,selectedItems:L===S.ENTITLED?ee:J,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),L===S.ENTITLED?te(e):W(e),R(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:j.newPickerConf.storeId,searchInCollectionFetcher:j.newPickerConf.searchInCollection,searchFetcher:j.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!j.newPickerConf&&t(m,{show:!0,onSave:()=>{},products:null!==(M=j.collection)&&void 0!==M?M:[],title:"Select Products",onClose:()=>{R(void 0)},selectedProducts:L===S.ENTITLED?ee:J,setSelectedProducts:L===S.ENTITLED?te:W,onSearchKeyChange:j.onCollectionSearch,searchPlaceholder:"Search collections..."})]})}))]}))};export{j as DiscountModal};
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{MIN_PURCHASE_REQUIREMENT as r,DISCOUNT_TARGET_TYPES as c,DISCOUNT_TYPES as s,DISCOUNT_TARGET_SELECTION as d,DISCOUNT_VALUE_TYPES as l}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as a}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{TitleSmall as u,BodyCaption as p}from"../TypographyStyle.js";import{DEFAULT_THEME as C}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledModal as v}from"../modals/styledModal.js";import{ProductPickerContent as m}from"../product-picker/ProductPickerModal.js";import{Tag as b}from"../tag/Tag.js";import{Tooltip as h}from"../tooltips/Tooltip.js";import y from"../../assets/icons/triangle_error.svg.js";import{ProductPickerModal as P}from"../product-picker-v2/modal.js";import{StyledDiscountDialogueContainer as T,CouponTypeContainerStyled as I}from"./DiscountModal.styled.js";import{validateDiscountData as O,descriptionBuilder as f}from"./DiscountUtils.js";import g,{DISCOUNT_PRODUCTS as E}from"./DynamicCoupon/DynamicCoupon.js";import S from"./StaticCoupon/StaticCoupon.js";const j=j=>{var w,_,k,D,N,F,q,M;const[A,L]=i(),[x,R]=i(),[U,G]=i(null!==(w=j.data)&&void 0!==w?w:"string"==typeof j.hideOption?{isStaticCoupon:"dynamic"===j.hideOption}:{isStaticCoupon:!1}),[B,Y]=i(!0),[X,H]=i(),[V,z]=i((null===(_=j.data)||void 0===_?void 0:_.minAmount)?r.AMOUNT:(null===(k=j.data)||void 0===k?void 0:k.minQuantity)?r.QUANTITY:r.NA),[K,Q]=i([]),[$,Z]=i([]),[J,W]=i([]),[ee,te]=i([]),[oe,ie]=i(0);n((()=>{let e;ne(),j.hideProbability||(e=ce()),Y(O(U,V,X,j.hideProbability||!1,e,!!U.isStaticCoupon)),j.hideProbability||ce()}),[]),n((()=>{let e;j.hideProbability||(e=ce()),Y(O(U,V,X,j.hideProbability||!1,e,!!U.isStaticCoupon))}),[U,oe,X,V]),n((()=>{var e,t,o,i,n;if(!j.newPickerConf){if(j.products&&(null===(e=j.products)||void 0===e?void 0:e.length)){if(null===(t=j.data)||void 0===t?void 0:t.entitledProductIds){const e=j.products.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.entitledProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));Z(e)}if(null===(o=j.data)||void 0===o?void 0:o.prerequisiteProductIds){const e=j.products.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));Q(e)}}if(j.collection&&j.collection.length){if(null===(i=j.data)||void 0===i?void 0:i.entitledCollectionIds){const e=j.collection.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));te(e)}if(null===(n=j.data)||void 0===n?void 0:n.prerequisiteCollectionIds){const e=j.collection.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));W(e)}}}}),[j.products,j.collection]),n((()=>{var e,t,o,i,n,r,c,s;(null===(t=null===(e=j.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&Z(j.data.productsConf.entitledProducts),(null===(i=null===(o=j.data)||void 0===o?void 0:o.productsConf)||void 0===i?void 0:i.prerequisiteProducts)&&Q(j.data.productsConf.prerequisiteProducts),(null===(r=null===(n=j.data)||void 0===n?void 0:n.collectionsConf)||void 0===r?void 0:r.entitledCollections)&&te(j.data.collectionsConf.entitledCollections),(null===(s=null===(c=j.data)||void 0===c?void 0:c.collectionsConf)||void 0===s?void 0:s.prerequisiteCollections)&&W(j.data.collectionsConf.prerequisiteCollections)}),[null===(D=j.data)||void 0===D?void 0:D.productsConf,null===(N=j.data)||void 0===N?void 0:N.collectionsConf]),n((()=>{if(j.newPickerConf){const e=[];return Object.values($).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},U),{entitledProductIds:e}))}const e=$.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},U),{entitledProductIds:e}))}),[$]),n((()=>{if(j.newPickerConf){const e=[];return Object.values(K).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},U),{prerequisiteProductIds:e}))}const e=K.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},U),{prerequisiteProductIds:e}))}),[K]),n((()=>{if(j.newPickerConf){(null==ee?void 0:ee.isCustom)&&delete ee.isCustom;const e=Object.keys(ee).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},U),{entitledCollectionIds:e}))}const e=ee.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},U),{entitledCollectionIds:e}))}),[ee]),n((()=>{if(j.newPickerConf){(null==J?void 0:J.isCustom)&&delete J.isCustom;const e=Object.keys(J).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},U),{prerequisiteCollectionIds:e}))}const e=J.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},U),{prerequisiteCollectionIds:e}))}),[J]);const ne=()=>{var e,t;U.isStaticCoupon||(U.targetType===c.SHIPPING_LINE?H(s.FREE_SHIPPING):U.targetType===c.LINE_ITEM?U.targetSelection===d.ENTITLED?(null===(e=U.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=U.prerequisiteCollectionIds)||void 0===t?void 0:t.length)?H(s.BUY_X_GET_Y):H(s.AMOUNT_OFF_PRODUCTS):H(s.AMOUNT_OFF_ORDER):(G(Object.assign(Object.assign({},U),{targetType:c.LINE_ITEM,targetSelection:d.ALL,valueType:l.FIXED_AMOUNT})),H(s.AMOUNT_OFF_ORDER)))};n((()=>{G(Object.assign(Object.assign({},U),{targetType:c.LINE_ITEM,targetSelection:d.ALL,valueType:l.FIXED_AMOUNT})),H(s.AMOUNT_OFF_ORDER)}),[U.isStaticCoupon]);const re=[{value:s.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:X===s.AMOUNT_OFF_ORDER},{value:s.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:X===s.AMOUNT_OFF_PRODUCTS},{value:s.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:X===s.BUY_X_GET_Y},{value:s.FREE_SHIPPING,label:"Free shipping",selected:X===s.FREE_SHIPPING}],ce=()=>{if(!j.quadrant||!j.probability)return;const e=[...j.probability];let t=[];e.length>=j.quadrant&&e.splice(j.quadrant-1,1),t=e;const o=t.reduce(((e,t)=>e+t),0)+(U.probability||0);return ie(parseFloat(o.toFixed(4))),parseFloat(o.toFixed(4))},se=e=>{var t,o,i,n;const a=e.value;H(a),Q([]),Z([]),W([]),te([]),z(r.NA),a===s.FREE_SHIPPING?G({value:100,targetSelection:d.ALL,targetType:c.SHIPPING_LINE,valueType:l.PERCENTAGE,quadrant:U.quadrant,isStaticCoupon:!1}):a===s.BUY_X_GET_Y?G({targetSelection:d.ENTITLED,targetType:c.LINE_ITEM,valueType:l.PERCENTAGE,quadrant:U.quadrant,isStaticCoupon:!1}):a===s.AMOUNT_OFF_ORDER?G({targetSelection:d.ALL,targetType:c.LINE_ITEM,valueType:null!==(o=null===(t=j.data)||void 0===t?void 0:t.valueType)&&void 0!==o?o:l.FIXED_AMOUNT,quadrant:U.quadrant,isStaticCoupon:!1}):a===s.AMOUNT_OFF_PRODUCTS&&G({targetSelection:d.ENTITLED,targetType:c.LINE_ITEM,valueType:null!==(n=null===(i=j.data)||void 0===i?void 0:i.valueType)&&void 0!==n?n:l.FIXED_AMOUNT,quadrant:U.quadrant,isStaticCoupon:!1})};return e(v,Object.assign({width:(x||A)&&j.newPickerConf?"25px":"750px",open:j.isOpen,headingTitle:A?"Select Products":j.title,headingSubtitle:A?void 0:j.subTitle,footerLeftCustomElement:j.errorMsg?j.errorMsg&&t(b,{theme:"light",tagText:j.errorMsg,type:"negative"}):!j.quadrant||j.hideProbability?t(o,{}):oe<=1?t(b,{theme:"light",tagText:`Current probability sum: ${oe}`,type:"white"}):t(h,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:t("div",{children:t(b,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${oe}`,type:"negative",LeadingIcon:y})})})),headerRightCustomElement:j.allowStaticCoupon||A?void 0:t(a,{options:re,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{se(e)}}),onClose:j.onClose,footerShadow:!0,primaryButton:A?{buttonType:"primary",onClick:()=>{L(void 0)},buttonText:"Add"}:x?{buttonType:"primary",onClick:()=>{R(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Add code",disabled:B,isLoading:null!==(F=j.loading)&&void 0!==F&&F,onClick:()=>{var e,t;U.isStaticCoupon?j.onSaveClicked({quadrant:U.quadrant,couponCode:U.couponCode,description:U.description,isStaticCoupon:U.isStaticCoupon,probability:U.probability,title:U.title}):j.onSaveClicked(Object.assign(Object.assign({},U),{description:f(U,j.currency,null!==(e=j.products)&&void 0!==e?e:[],null!==(t=j.collection)&&void 0!==t?t:[]),productsConf:{entitledProducts:$,prerequisiteProducts:K},collectionsConf:{entitledCollections:ee,prerequisiteCollections:J}}))}},secondaryButton:A?{buttonType:"tertiaryGray",onClick:()=>{L(void 0)},buttonText:"Back"}:x?{buttonType:"tertiaryGray",onClick:()=>{R(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:j.onClose,buttonText:"Close"}},{children:[!A&&!x&&e(T,{children:[j.allowStaticCoupon&&!A&&e(I,Object.assign({selectedDiv:U.isStaticCoupon?1:2},{children:["static"===j.hideOption?t(o,{}):e("div",Object.assign({className:"coupon-type__container",onClick:()=>{U.isStaticCoupon||G({isStaticCoupon:!0,quadrant:U.quadrant})}},{children:[t(u,Object.assign({style:U.isStaticCoupon?{color:C.colorsV2.content.brand}:{}},{children:"Static code"})),t(p,Object.assign({style:U.isStaticCoupon?{color:C.colorsV2.content.brand}:{}},{children:"One static code for all customers"}))]})),"dynamic"===j.hideOption?t(o,{}):e("div",Object.assign({className:"coupon-type__container",onClick:()=>{U.isStaticCoupon&&G({isStaticCoupon:!1,quadrant:U.quadrant})}},{children:[t(u,Object.assign({style:U.isStaticCoupon?{}:{color:C.colorsV2.content.brand}},{children:"Dynamic code"})),t(p,Object.assign({style:U.isStaticCoupon?{}:{color:C.colorsV2.content.brand}},{children:"New code generated for everyone"}))]}))]})),U.isStaticCoupon&&!A&&t(S,{discountData:U,setDiscountData:G,hideProbability:j.hideProbability||!1,discountAdminUrl:j.discountAdminUrl}),!U.isStaticCoupon&&!A&&!x&&t(g,{currency:j.currency,entitledProducts:$,prerequisiteProducts:K,setEntitledProducts:Z,setPrerequisiteProducts:Q,discountData:U,productPickerOpen:A,setIsProductPickerOpen:L,setDiscountData:G,selectedCouponType:X,setSelectedCouponType:H,selectedMinimumRequirement:V,setSelectedMinimumRequirement:z,hideProbability:j.hideProbability||!1,hideExpiration:j.hideExpiration||!1,allowStaticCoupon:j.allowStaticCoupon,onChangeCouponType:se,collectionPickerOpen:x,entitledCollections:ee,prerequisiteCollections:J,setIsCollectionPickerOpen:R,setEntitledCollections:te,setPrerequisiteCollections:W,useNewPicker:!!j.newPickerConf})]}),!!A&&e(o,{children:[!j.newPickerConf&&t("div",Object.assign({style:{padding:"12px 0"}},{children:t(m,{show:!0,onSave:()=>{},products:null!==(q=j.products)&&void 0!==q?q:[],title:"Select Products",onClose:()=>{L(void 0)},selectedProducts:A===E.ENTITLED?$:K,setSelectedProducts:A===E.ENTITLED?Z:Q,onSearchKeyChange:j.onProductSearch})})),j.newPickerConf&&t(P,{visible:!0,onClose:()=>L(void 0),collectionFetcher:j.newPickerConf.fetchCollections,productFetcher:j.newPickerConf.fetchProducts,selectedItems:A===E.ENTITLED?$:K,onAdd:e=>{A===E.ENTITLED?Z(e):Q(e),L(void 0)},zIndex:200,storeId:j.newPickerConf.storeId,searchInCollectionFetcher:j.newPickerConf.searchInCollection,customCollectionRestriction:!1,searchFetcher:j.newPickerConf.searchProducts,hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!x&&t("div",Object.assign({style:{padding:"12px 0"}},{children:e(o,{children:[j.newPickerConf&&t(P,{visible:!0,onClose:()=>R(void 0),collectionFetcher:j.newPickerConf.fetchCollections,productFetcher:j.newPickerConf.fetchProducts,selectedItems:x===E.ENTITLED?ee:J,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),x===E.ENTITLED?te(e):W(e),R(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:j.newPickerConf.storeId,searchInCollectionFetcher:j.newPickerConf.searchInCollection,searchFetcher:j.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!j.newPickerConf&&t(m,{show:!0,onSave:()=>{},products:null!==(M=j.collection)&&void 0!==M?M:[],title:"Select Products",onClose:()=>{R(void 0)},selectedProducts:x===E.ENTITLED?ee:J,setSelectedProducts:x===E.ENTITLED?te:W,onSearchKeyChange:j.onCollectionSearch,searchPlaceholder:"Search collections..."})]})}))]}))};export{j as DiscountModal};
@@ -11,7 +11,6 @@ export interface NewSubscriptionPlanProps extends SubscriptionPlanProps {
11
11
  isPlanSelected?: boolean;
12
12
  onClickShowAllFeatures?: () => void;
13
13
  showSelectedPlanChip?: boolean;
14
- perMonthForYearly?: string;
15
14
  }
16
15
  type Props = NewSubscriptionPlanProps;
17
16
  export declare const NewSubscriptionPlan: FunctionComponent<Props>;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as s}from"react/jsx-runtime";import i from"../../assets/icons/check.svg.js";import a from"../../assets/icons/checkCircle.svg.js";import n from"../../assets/icons/quotes.svg.js";import o from"../../assets/icons/WhiteStarFilled.svg.js";import{Button as r}from"../button/Button.js";import{NewSubscriptionStyled as l}from"./SubscriptionPlanStyled.js";import{Caption as c,TitleRegular as d,BodyCaption as h,TitleLarge as m,BodyPrimary as p,BodySecondary as g,TitleSmall as b}from"../TypographyStyle.js";import{useCurrency as u}from"../../hooks/useCurreny.js";import{COLORS as y}from"../../constants/Theme.js";import{Tag as j}from"../tag/Tag.js";const O=O=>{var v;const{formatCurrency:f}=u(),T=O.showMonthlyOptions?O.features:O.annualFeatures||[],N=O.showMonthlyOptions?O.monthlyPlan:O.yearlyPlan,x=!O.isDisabled&&O.isMostPopular,P=O.showMonthlyOptions?O.code:null!==(v=O.yearlyCode)&&void 0!==v?v:O.code,k=e=>0==e?"$0":f(e,"USD"),{planName:C,isSelected:S=!1,isDisabled:w=!1,onPlanSelect:M,oldPrice:L,hideMonthYearTag:D,planDescription:F,planDescriptionDiscount:z,showTrialOptions:B,freeTrialMessages:W,extraBlockMessage:$,isLoading:_,buttonText:H,bottomDescription:I,showMonthlyOptions:Y,popularTestimony:q,skipRadioSelection:A=!1,includeText:R,height:U,showFeaturesButton:E,businessDescription:G,isPlanSelected:J=!1,onClickShowAllFeatures:K,showSelectedPlanChip:Q=!1,perMonthForYearly:V}=O;return e(l,Object.assign({height:U,showMostPopularChip:x||!1,onClick:()=>M(P)},{children:[x&&e("div",Object.assign({className:"most-popular-chip"},{children:[t(c,Object.assign({className:"popular-text"},{children:"Most popular "})),t(o,{height:12,width:12})]})),e("div",Object.assign({className:`box ${w?"disabled":""} \n\t\t\t\t`},{children:[e("div",Object.assign({className:"radio-flex"},{children:[!A&&t("input",{type:"radio",id:"html",name:"fav_language",value:"HTML",disabled:null!=w&&w,onChange:()=>M(P),className:"radio-button",checked:J}),t(d,Object.assign({style:{color:y.content.secondary,marginBottom:4}},{children:C})),Q&&t("div",Object.assign({style:{marginLeft:"auto"}},{children:t(j,{tagText:"Current plan",type:"positive",theme:"dark"})}))]})),e("div",Object.assign({className:"price-block"},{children:[L?t(h,Object.assign({className:"old--price"},{children:k(N.price)})):t(s,{}),t(m,Object.assign({style:{color:y.content.primary}},{children:k(L||N.price)})),t(p,Object.assign({style:{color:y.content.secondary,marginLeft:4}},{children:D?"":"/ "+(Y?"month":V?"/month billed annually":"year")}))]})),F&&e("div",Object.assign({className:"per-message-price"},{children:[t(h,Object.assign({style:{color:y.content.secondary}},{children:F})),z&&t(h,Object.assign({style:{color:y.background.positive.vibrant,marginLeft:4}},{children:z}))]})),G&&G.length&&t("div",Object.assign({style:{marginTop:4}},{children:G.map(((e,s)=>t(g,{style:{color:y.content.secondary},dangerouslySetInnerHTML:{__html:e}},s)))})),B&&e(c,Object.assign({className:"trial "+(S?"selected":"")},{children:["7 day free trial with ",W," messages"]})),$&&t(c,Object.assign({className:"trial "+(S?"selected":"")},{children:$})),t(b,Object.assign({className:"extra-include-margin",style:{height:R?"":"20px"}},{children:R||""})),t("div",Object.assign({className:"features"},{children:T.map(((s,i)=>e("div",Object.assign({className:"feature"},{children:[t("div",{children:t(a,{height:20,width:20,color:y.content.primary})}),t(g,Object.assign({className:"feature-text"},{children:s.detail}),i)]}),s.detail)))})),E&&t(r,{isLoading:!1,buttonType:"tertiary",buttonText:"See all features",size:"small",onClick:e=>{e.stopPropagation(),K&&K()}}),A&&t("div",Object.assign({className:"button-box"},{children:_?t(r,{isLoading:!0,buttonType:"primary",buttonText:"Choose plan",size:"medium",matchParentWidth:!0}):e(s,{children:[S&&t(r,{disabled:w,LeadingIcon:i,buttonType:"tertiary",size:"medium",matchParentWidth:!0,buttonText:H||"Selected Plan"}),!S&&!w&&t(r,{buttonType:"primary",size:"medium",onClick:e=>{e.stopPropagation(),M(P)},matchParentWidth:!0,buttonText:H||"Choose plan"})]})})),q&&e("div",Object.assign({className:"popular-testimony"},{children:[t(n,{height:26,width:70}),t("div",Object.assign({className:"testimony-text"},{children:q}))]}))]})),I&&t("div",Object.assign({className:`plan-bottom-information\n\t\t\t\t\t${w?"disabled":""}\n\t\t\t\t\t${S?"selected":""}\n\t\t\t\t`},{children:t(c,Object.assign({className:"text",style:{color:y.background.inverse}},{children:I}))}))]}))};export{O as NewSubscriptionPlan};
1
+ import{jsxs as e,jsx as t,Fragment as s}from"react/jsx-runtime";import i from"../../assets/icons/check.svg.js";import a from"../../assets/icons/checkCircle.svg.js";import n from"../../assets/icons/quotes.svg.js";import o from"../../assets/icons/WhiteStarFilled.svg.js";import{Button as r}from"../button/Button.js";import{NewSubscriptionStyled as l}from"./SubscriptionPlanStyled.js";import{Caption as c,TitleRegular as d,BodyCaption as m,TitleLarge as h,BodyPrimary as p,BodySecondary as g,TitleSmall as b}from"../TypographyStyle.js";import{useCurrency as u}from"../../hooks/useCurreny.js";import{COLORS as y}from"../../constants/Theme.js";import{Tag as j}from"../tag/Tag.js";const O=O=>{var v;const{formatCurrency:f}=u(),T=O.showMonthlyOptions?O.features:O.annualFeatures||[],N=O.showMonthlyOptions?O.monthlyPlan:O.yearlyPlan,x=!O.isDisabled&&O.isMostPopular,P=O.showMonthlyOptions?O.code:null!==(v=O.yearlyCode)&&void 0!==v?v:O.code,k=e=>0==e?"$0":f(e,"USD"),{planName:C,isSelected:S=!1,isDisabled:w=!1,onPlanSelect:M,oldPrice:L,hideMonthYearTag:D,planDescription:z,planDescriptionDiscount:B,showTrialOptions:F,freeTrialMessages:W,extraBlockMessage:$,isLoading:_,buttonText:H,bottomDescription:I,showMonthlyOptions:q,popularTestimony:A,skipRadioSelection:R=!1,includeText:U,height:Y,showFeaturesButton:E,businessDescription:G,isPlanSelected:J=!1,onClickShowAllFeatures:K,showSelectedPlanChip:Q=!1}=O;return e(l,Object.assign({height:Y,showMostPopularChip:x||!1,onClick:()=>M(P)},{children:[x&&e("div",Object.assign({className:"most-popular-chip"},{children:[t(c,Object.assign({className:"popular-text"},{children:"Most popular "})),t(o,{height:12,width:12})]})),e("div",Object.assign({className:`box ${w?"disabled":""} \n\t\t\t\t`},{children:[e("div",Object.assign({className:"radio-flex"},{children:[!R&&t("input",{type:"radio",id:"html",name:"fav_language",value:"HTML",disabled:null!=w&&w,onChange:()=>M(P),className:"radio-button",checked:J}),t(d,Object.assign({style:{color:y.content.secondary,marginBottom:4}},{children:C})),Q&&t("div",Object.assign({style:{marginLeft:"auto"}},{children:t(j,{tagText:"Current plan",type:"positive",theme:"dark"})}))]})),e("div",Object.assign({className:"price-block"},{children:[L?t(m,Object.assign({className:"old--price"},{children:k(N.price)})):t(s,{}),t(h,Object.assign({style:{color:y.content.primary}},{children:k(L||N.price)})),t(p,Object.assign({style:{color:y.content.secondary,marginLeft:4}},{children:D?"":"/ "+(q?"month":"year")}))]})),z&&e("div",Object.assign({className:"per-message-price"},{children:[t(m,Object.assign({style:{color:y.content.secondary}},{children:z})),B&&t(m,Object.assign({style:{color:y.background.positive.vibrant,marginLeft:4}},{children:B}))]})),G&&G.length&&t("div",Object.assign({style:{marginTop:4}},{children:G.map(((e,s)=>t(g,{style:{color:y.content.secondary},dangerouslySetInnerHTML:{__html:e}},s)))})),F&&e(c,Object.assign({className:"trial "+(S?"selected":"")},{children:["7 day free trial with ",W," messages"]})),$&&t(c,Object.assign({className:"trial "+(S?"selected":"")},{children:$})),U&&t(b,Object.assign({className:"extra-include-margin"},{children:U})),t("div",Object.assign({className:"features"},{children:T.map(((s,i)=>e("div",Object.assign({className:"feature"},{children:[t("div",{children:t(a,{height:20,width:20,color:y.content.primary})}),t(g,Object.assign({className:"feature-text"},{children:s.detail}),i)]}),s.detail)))})),E&&t(r,{isLoading:!1,buttonType:"tertiary",buttonText:"See all features",size:"small",onClick:e=>{e.stopPropagation(),K&&K()}}),R&&t("div",Object.assign({className:"button-box"},{children:_?t(r,{isLoading:!0,buttonType:"primary",buttonText:"Choose plan",size:"medium",matchParentWidth:!0}):e(s,{children:[S&&t(r,{disabled:w,LeadingIcon:i,buttonType:"tertiary",size:"medium",matchParentWidth:!0,buttonText:H||"Selected Plan"}),!S&&!w&&t(r,{buttonType:"primary",size:"medium",onClick:e=>{e.stopPropagation(),M(P)},matchParentWidth:!0,buttonText:H||"Choose plan"})]})})),A&&e("div",Object.assign({className:"popular-testimony"},{children:[t(n,{height:26,width:70}),t("div",Object.assign({className:"testimony-text"},{children:A}))]}))]})),I&&t("div",Object.assign({className:`plan-bottom-information\n\t\t\t\t\t${w?"disabled":""}\n\t\t\t\t\t${S?"selected":""}\n\t\t\t\t`},{children:t(c,Object.assign({className:"text",style:{color:y.background.inverse}},{children:I}))}))]}))};export{O as NewSubscriptionPlan};
@@ -9,7 +9,6 @@ type Props = {
9
9
  selectedTab?: 'monthly' | 'annually';
10
10
  selectedPlan?: string;
11
11
  currentPlan?: string;
12
- perMonthForYearly?: boolean;
13
12
  };
14
13
  export declare const SubscriptionPlansCollected: FunctionComponent<Props>;
15
14
  export {};
@@ -1,6 +1,6 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useState as l,createElement as t}from"react";import o from"styled-components";import{NewSubscriptionPlan as n}from"./NewSubscriptionPlan.js";const r=o.div`
1
+ import{jsx as e}from"react/jsx-runtime";import{useState as l,createElement as t}from"react";import o from"styled-components";import{NewSubscriptionPlan as n}from"./NewSubscriptionPlan.js";const s=o.div`
2
2
  display: flex;
3
3
  column-gap: 22px;
4
4
  align-items: stretch;
5
5
  overflow-x: auto;
6
- `,a=o=>{var a;const[s,i]=l(null!==(a=o.selectedPlan)&&void 0!==a?a:"");return e(r,Object.assign({style:{padding:"28px 0px"}},{children:o.plans.map(((l,r)=>{var a,c;return e("div",Object.assign({style:{width:null!==(a=o.staticWidth)&&void 0!==a?a:308}},{children:t(n,Object.assign({},l,{showMonthly:!0,showMonthlyOptions:null!==(c="monthly"==o.selectedTab)&&void 0!==c&&c,showTrialOptions:o.showTrialOptions||!1,onPlanSelect:e=>{o.onPlanSelect(e),i(e)},key:l.planName,isPlanSelected:s==("monthly"==o.selectedTab?l.code:l.yearlyCode),onClickShowAllFeatures:o.onClickShowAllFeatures,showSelectedPlanChip:o.currentPlan==("monthly"==o.selectedTab?l.code:l.yearlyCode),perMonthForYearly:l.perMonthForYearly}))}),r)}))}))};export{a as SubscriptionPlansCollected};
6
+ `,a=o=>{var a;const[i,r]=l(null!==(a=o.selectedPlan)&&void 0!==a?a:"");return e(s,Object.assign({style:{padding:"28px 0px"}},{children:o.plans.map(((l,s)=>{var a,c;return e("div",Object.assign({style:{width:null!==(a=o.staticWidth)&&void 0!==a?a:308}},{children:t(n,Object.assign({},l,{showMonthly:!0,showMonthlyOptions:null!==(c="monthly"==o.selectedTab)&&void 0!==c&&c,showTrialOptions:o.showTrialOptions||!1,onPlanSelect:e=>{o.onPlanSelect(e),r(e)},key:l.planName,isPlanSelected:i==("monthly"==o.selectedTab?l.code:l.yearlyCode),onClickShowAllFeatures:o.onClickShowAllFeatures,showSelectedPlanChip:o.currentPlan==("monthly"==o.selectedTab?l.code:l.yearlyCode)}))}),s)}))}))};export{a as SubscriptionPlansCollected};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.370-beta-nth",
3
+ "version": "0.0.370",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",