@bikdotai/bik-component-library 0.0.340 → 0.0.341-beta-relative
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/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/cjs/components/bik-layout/CommonStyles.js +1 -1
- package/dist/cjs/components/bik-layout/{ShowShopifyRestrictedModal.d.ts → RelativeModal.d.ts} +2 -3
- package/dist/cjs/components/bik-layout/RelativeModal.js +1 -0
- package/dist/cjs/components/bik-layout/index.d.ts +1 -1
- package/dist/cjs/components/discount-modal/DiscountModal.d.ts +0 -7
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/discount-modal/DiscountUtils.d.ts +0 -2
- package/dist/cjs/components/discount-modal/DiscountUtils.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +1 -3
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/discount-modal/StaticCoupon/StaticCoupon.js +1 -1
- package/dist/cjs/components/discount-modal/type.d.ts +2 -11
- package/dist/cjs/components/discount-modal/type.js +1 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +0 -4
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/productScreen.d.ts +0 -4
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/esm/components/bik-layout/CommonStyles.js +1 -1
- package/dist/esm/components/bik-layout/{ShowShopifyRestrictedModal.d.ts → RelativeModal.d.ts} +2 -3
- package/dist/esm/components/bik-layout/RelativeModal.js +1 -0
- package/dist/esm/components/bik-layout/index.d.ts +1 -1
- package/dist/esm/components/discount-modal/DiscountModal.d.ts +0 -7
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/discount-modal/DiscountUtils.d.ts +0 -2
- package/dist/esm/components/discount-modal/DiscountUtils.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +1 -3
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/discount-modal/StaticCoupon/StaticCoupon.js +1 -1
- package/dist/esm/components/discount-modal/type.d.ts +2 -11
- package/dist/esm/components/discount-modal/type.js +1 -1
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +0 -4
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/productScreen.d.ts +0 -4
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/bik-layout/ShowShopifyRestrictedModal.js +0 -1
- package/dist/esm/components/bik-layout/ShowShopifyRestrictedModal.js +0 -1
package/dist/esm/components/bik-layout/{ShowShopifyRestrictedModal.d.ts → RelativeModal.d.ts}
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export interface
|
|
3
|
-
containerType: 'demo_store' | 'connect_shopify';
|
|
2
|
+
export interface RelativeModalProps {
|
|
4
3
|
handleButtonClick: (type: 'shopify' | 'demo' | 'close') => void;
|
|
5
4
|
zIndex?: number;
|
|
6
5
|
isDemoContainer?: boolean;
|
|
@@ -9,4 +8,4 @@ export interface ShowShopifyRestrictedModalProps {
|
|
|
9
8
|
left: number;
|
|
10
9
|
};
|
|
11
10
|
}
|
|
12
|
-
export declare const
|
|
11
|
+
export declare const RelativeModal: React.FC<RelativeModalProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"react-dom";import{COLORS as i}from"../../constants/Theme.js";import n from"../../assets/icons/cross.svg.js";import{Button as s}from"../button/Button.js";import{TitleMedium as a,BodyPrimary as r}from"../TypographyStyle.js";import{FeatureModalContainer as c,RelativeModalContainer as l}from"./CommonStyles.js";const d=d=>{const{zIndex:m,isDemoContainer:h=!1,handleButtonClick:p,triggerPosition:b}=d,u=e=>{p(e)},g=b&&window.innerHeight-b.top<100,y=b?{position:"fixed",top:g?"auto":b.top,bottom:g?"0":"auto",left:b.left,width:"unset",background:"none"}:{alignItems:"center"};return o.createPortal(e(c,Object.assign({zIndex:m,resetHeight:!0,style:y,relativePostion:!!b},{children:t(l,{children:[e("div",Object.assign({className:"cross-container",onClick:()=>u("close"),"aria-hidden":"true"},{children:e(n,{height:24,width:24,color:"#000000"})})),t("div",h?Object.assign({className:"demo-container"},{children:[e(a,Object.assign({color:i.background.negative.vibrant},{children:"Demo Store Limitations"})),e(r,{children:"Apologies, but you are unable to save or take any actions as you are currently in the demo store."})]}):Object.assign({className:"content-layout"},{children:[e("div",Object.assign({className:"left-content"},{children:e("img",{src:"https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F6300e18e-16ef-4f65-9861-26476d2a3d9a?alt=media&token=0da9e429-4c12-4a06-bba8-9ac7c3fdd2c4",alt:"left-panel"})})),t("div",Object.assign({className:"right-content"},{children:[e(a,{children:"Connect Shopify "}),e(r,Object.assign({style:{maxWidth:432}},{children:"Connect Shopify to publish your bot on your Shopify store. Or, explore our demo store to see it in action."})),t("div",Object.assign({className:"cta-button-container"},{children:[e(s,{buttonText:"Connect shopify",buttonType:"primary",size:"small",onClick:()=>u("shopify")}),e(s,{buttonText:"View demo store",buttonType:"secondary",size:"small",onClick:()=>u("demo")})]}))]}))]}))]})})),document.body)};export{d as RelativeModal};
|
|
@@ -20,12 +20,5 @@ export interface DiscountDialogueI {
|
|
|
20
20
|
collection?: Collection[];
|
|
21
21
|
discountAdminUrl?: string;
|
|
22
22
|
currency?: string;
|
|
23
|
-
newPickerConf?: {
|
|
24
|
-
searchInCollection: any;
|
|
25
|
-
searchProducts: any;
|
|
26
|
-
fetchCollections: any;
|
|
27
|
-
fetchProducts: any;
|
|
28
|
-
storeId: string;
|
|
29
|
-
};
|
|
30
23
|
}
|
|
31
24
|
export declare const DiscountModal: React.FC<DiscountDialogueI>;
|
|
@@ -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 b}from"../tag/Tag.js";import{Tooltip as h}from"../tooltips/Tooltip.js";import P from"../../assets/icons/triangle_error.svg.js";import{ProductPickerModal as y}from"../product-picker-v2/modal.js";import{StyledDiscountDialogueContainer as I,CouponTypeContainerStyled as T}from"./DiscountModal.styled.js";import{validateDiscountData as O,descriptionBuilder as f}from"./DiscountUtils.js";import S,{DISCOUNT_PRODUCTS as E}from"./DynamicCoupon/DynamicCoupon.js";import g from"./StaticCoupon/StaticCoupon.js";const j=j=>{var w,k,_,D,N,F,q;const[A,x]=i(),[M,L]=i(),[R,U]=i(null!==(w=j.data)&&void 0!==w?w:"string"==typeof j.hideOption?{isStaticCoupon:"dynamic"===j.hideOption}:{isStaticCoupon:!1}),[G,B]=i(!0),[Y,X]=i(),[H,V]=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),[z,K]=i([]),[Q,$]=i([]),[Z,J]=i([]),[W,ee]=i([]),[te,oe]=i(0);n((()=>{let e;ie(),j.hideProbability||(e=re()),B(O(R,H,Y,j.hideProbability||!1,e,!!R.isStaticCoupon)),j.hideProbability||re()}),[]),n((()=>{let e;j.hideProbability||(e=re()),B(O(R,H,Y,j.hideProbability||!1,e,!!R.isStaticCoupon))}),[R,te,Y,H]),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))}));$(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))}));K(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))}));ee(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))}));J(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)&&$(j.data.productsConf.entitledProducts),(null===(i=null===(o=j.data)||void 0===o?void 0:o.productsConf)||void 0===i?void 0:i.prerequisiteProducts)&&K(j.data.productsConf.prerequisiteProducts),(null===(r=null===(n=j.data)||void 0===n?void 0:n.collectionsConf)||void 0===r?void 0:r.entitledCollections)&&ee(j.data.collectionsConf.entitledCollections),(null===(d=null===(c=j.data)||void 0===c?void 0:c.collectionsConf)||void 0===d?void 0:d.prerequisiteCollections)&&J(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(Q).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void U(Object.assign(Object.assign({},R),{entitledProductIds:e}))}const e=Q.map((e=>parseInt(e.id)));U(Object.assign(Object.assign({},R),{entitledProductIds:e}))}),[Q]),n((()=>{if(j.newPickerConf){const e=[];return Object.values(z).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void U(Object.assign(Object.assign({},R),{prerequisiteProductIds:e}))}const e=z.map((e=>parseInt(e.id)));U(Object.assign(Object.assign({},R),{prerequisiteProductIds:e}))}),[z]),n((()=>{if(j.newPickerConf){(null==W?void 0:W.isCustom)&&delete W.isCustom;const e=Object.keys(W).map((e=>parseInt(e)));return void U(Object.assign(Object.assign({},R),{entitledCollectionIds:e}))}const e=W.map((e=>parseInt(e.id)));U(Object.assign(Object.assign({},R),{entitledCollectionIds:e}))}),[W]),n((()=>{if(j.newPickerConf){(null==Z?void 0:Z.isCustom)&&delete Z.isCustom;const e=Object.keys(Z).map((e=>parseInt(e)));return void U(Object.assign(Object.assign({},R),{prerequisiteCollectionIds:e}))}const e=Z.map((e=>parseInt(e.id)));U(Object.assign(Object.assign({},R),{prerequisiteCollectionIds:e}))}),[Z]);const ie=()=>{var e,t;R.isStaticCoupon||(R.targetType===c.SHIPPING_LINE?X(d.FREE_SHIPPING):R.targetType===c.LINE_ITEM?R.targetSelection===s.ENTITLED?(null===(e=R.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=R.prerequisiteCollectionIds)||void 0===t?void 0:t.length)?X(d.BUY_X_GET_Y):X(d.AMOUNT_OFF_PRODUCTS):X(d.AMOUNT_OFF_ORDER):(U(Object.assign(Object.assign({},R),{targetType:c.LINE_ITEM,targetSelection:s.ALL,valueType:l.FIXED_AMOUNT})),X(d.AMOUNT_OFF_ORDER)))};n((()=>{ie()}),[R.isStaticCoupon]);const ne=[{value:d.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:Y===d.AMOUNT_OFF_ORDER},{value:d.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:Y===d.AMOUNT_OFF_PRODUCTS},{value:d.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:Y===d.BUY_X_GET_Y},{value:d.FREE_SHIPPING,label:"Free shipping",selected:Y===d.FREE_SHIPPING}],re=()=>{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)+(R.probability||0);return oe(parseFloat(o.toFixed(4))),parseFloat(o.toFixed(4))},ce=e=>{var t,o,i,n;const a=e.value;X(a),K([]),$([]),J([]),ee([]),V(r.NA),a===d.FREE_SHIPPING?U({value:100,targetSelection:s.ALL,targetType:c.SHIPPING_LINE,valueType:l.PERCENTAGE,quadrant:R.quadrant,isStaticCoupon:!1}):a===d.BUY_X_GET_Y?U({targetSelection:s.ENTITLED,targetType:c.LINE_ITEM,valueType:l.PERCENTAGE,quadrant:R.quadrant,isStaticCoupon:!1}):a===d.AMOUNT_OFF_ORDER?U({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:R.quadrant,isStaticCoupon:!1}):a===d.AMOUNT_OFF_PRODUCTS&&U({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:R.quadrant,isStaticCoupon:!1})};return e(v,Object.assign({width:(M||A)&&j.newPickerConf?"25px":"750px",open:j.isOpen,headingTitle:A?"Select Products":j.title,headingSubtitle:A?void 0:j.subTitle,footerLeftCustomElement:!j.quadrant||j.hideProbability?t(o,{}):te<=1?t(b,{theme:"light",tagText:`Current probability sum: ${te}`,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: ${te}`,type:"negative",LeadingIcon:P})})})),headerRightCustomElement:j.allowStaticCoupon||A?void 0:t(a,{options:ne,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{ce(e)}}),onClose:j.onClose,footerShadow:!0,primaryButton:A?{buttonType:"primary",onClick:()=>{x(void 0)},buttonText:"Add"}:M?{buttonType:"primary",onClick:()=>{L(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Add code",disabled:G,onClick:()=>{var e,t;R.isStaticCoupon?j.onSaveClicked({quadrant:R.quadrant,couponCode:R.couponCode,description:R.description,isStaticCoupon:R.isStaticCoupon,probability:R.probability,title:R.title}):j.onSaveClicked(Object.assign(Object.assign({},R),{description:f(R,j.currency,null!==(e=j.products)&&void 0!==e?e:[],null!==(t=j.collection)&&void 0!==t?t:[]),productsConf:{entitledProducts:Q,prerequisiteProducts:z},collectionsConf:{entitledCollections:W,prerequisiteCollections:Z}})),U({})}},secondaryButton:A?{buttonType:"tertiaryGray",onClick:()=>{x(void 0)},buttonText:"Back"}:M?{buttonType:"tertiaryGray",onClick:()=>{L(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:j.onClose,buttonText:"Close"}},{children:[!A&&!M&&e(I,{children:[j.allowStaticCoupon&&!A&&e(T,Object.assign({selectedDiv:R.isStaticCoupon?1:2},{children:["static"===j.hideOption?t(o,{}):e("div",Object.assign({className:"coupon-type__container",onClick:()=>{R.isStaticCoupon||U({isStaticCoupon:!0,quadrant:R.quadrant})}},{children:[t(u,Object.assign({style:R.isStaticCoupon?{color:C.colorsV2.content.brand}:{}},{children:"Static code"})),t(p,Object.assign({style:R.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:()=>{R.isStaticCoupon&&U({isStaticCoupon:!1,quadrant:R.quadrant})}},{children:[t(u,Object.assign({style:R.isStaticCoupon?{}:{color:C.colorsV2.content.brand}},{children:"Dynamic code"})),t(p,Object.assign({style:R.isStaticCoupon?{}:{color:C.colorsV2.content.brand}},{children:"New code generated for everyone"}))]}))]})),R.isStaticCoupon&&!A&&t(g,{discountData:R,setDiscountData:U,hideProbability:j.hideProbability||!1,discountAdminUrl:j.discountAdminUrl}),!R.isStaticCoupon&&!A&&!M&&t(S,{currency:j.currency,entitledProducts:Q,prerequisiteProducts:z,setEntitledProducts:$,setPrerequisiteProducts:K,discountData:R,productPickerOpen:A,setIsProductPickerOpen:x,setDiscountData:U,selectedCouponType:Y,setSelectedCouponType:X,selectedMinimumRequirement:H,setSelectedMinimumRequirement:V,hideProbability:j.hideProbability||!1,hideExpiration:j.hideExpiration||!1,allowStaticCoupon:j.allowStaticCoupon,onChangeCouponType:ce,collectionPickerOpen:M,entitledCollections:W,prerequisiteCollections:Z,setIsCollectionPickerOpen:L,setEntitledCollections:ee,setPrerequisiteCollections:J,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!==(F=j.products)&&void 0!==F?F:[],title:"Select Products",onClose:()=>{x(void 0)},selectedProducts:A===E.ENTITLED?Q:z,setSelectedProducts:A===E.ENTITLED?$:K,onSearchKeyChange:j.onProductSearch})})),j.newPickerConf&&t(y,{visible:!0,onClose:()=>x(void 0),collectionFetcher:j.newPickerConf.fetchCollections,productFetcher:j.newPickerConf.fetchProducts,selectedItems:A===E.ENTITLED?Q:z,onAdd:e=>{A===E.ENTITLED?$(e):K(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})]}),!!M&&t("div",Object.assign({style:{padding:"12px 0"}},{children:e(o,{children:[j.newPickerConf&&t(y,{visible:!0,onClose:()=>L(void 0),collectionFetcher:j.newPickerConf.fetchCollections,productFetcher:j.newPickerConf.fetchProducts,selectedItems:M===E.ENTITLED?W:Z,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),M===E.ENTITLED?ee(e):J(e),L(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!==(q=j.collection)&&void 0!==q?q:[],title:"Select Products",onClose:()=>{L(void 0)},selectedProducts:M===E.ENTITLED?W:Z,setSelectedProducts:M===E.ENTITLED?ee:J,onSearchKeyChange:j.onCollectionSearch,searchPlaceholder:"Search collections..."})]})}))]}))};export{j as DiscountModal};
|
|
1
|
+
import{jsxs as t,jsx as e,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 d,DISCOUNT_TYPES as s,DISCOUNT_TARGET_SELECTION as c,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 p,BodyCaption as u}from"../TypographyStyle.js";import{DEFAULT_THEME as m}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 y}from"../modals/styledModal.js";import{ProductPickerContent as b}from"../product-picker/ProductPickerModal.js";import{Tag as v}from"../tag/Tag.js";import{Tooltip as C}from"../tooltips/Tooltip.js";import E from"../../assets/icons/triangle_error.svg.js";import{StyledDiscountDialogueContainer as T,CouponTypeContainerStyled as I}from"./DiscountModal.styled.js";import{validateDiscountData as P}from"./DiscountUtils.js";import g,{DISCOUNT_PRODUCTS as h}from"./DynamicCoupon/DynamicCoupon.js";import S from"./StaticCoupon/StaticCoupon.js";const j=j=>{var O,N,D,f,w;const[_,A]=i(),[q,x]=i(),[G,L]=i(null!==(O=j.data)&&void 0!==O?O:"string"==typeof j.hideOption?{isStaticCoupon:"dynamic"===j.hideOption}:{isStaticCoupon:!1}),[M,k]=i(!0),[F,R]=i(),[U,B]=i((null===(N=j.data)||void 0===N?void 0:N.minAmount)?r.AMOUNT:(null===(D=j.data)||void 0===D?void 0:D.minQuantity)?r.QUANTITY:r.NA),[X,Y]=i([]),[Q,H]=i([]),[V,z]=i([]),[K,$]=i([]),[Z,J]=i(0);n((()=>{let t;j.hideProbability||(t=tt()),k(P(G,U,F,j.hideProbability||!1,t,!!G.isStaticCoupon)),j.hideProbability||tt()}),[]),n((()=>{let t;j.hideProbability||(t=tt()),k(P(G,U,F,j.hideProbability||!1,t,!!G.isStaticCoupon))}),[G,Z,F,U]),n((()=>{var t,e,o,i,n;if(j.products&&(null===(t=j.products)||void 0===t?void 0:t.length)){if(null===(e=j.data)||void 0===e?void 0:e.entitledProductIds){const t=j.products.filter((t=>{var e,o;return null===(o=null===(e=j.data)||void 0===e?void 0:e.entitledProductIds)||void 0===o?void 0:o.includes(parseInt(t.id))}));H(t)}if(null===(o=j.data)||void 0===o?void 0:o.prerequisiteProductIds){const t=j.products.filter((t=>{var e,o;return null===(o=null===(e=j.data)||void 0===e?void 0:e.prerequisiteProductIds)||void 0===o?void 0:o.includes(parseInt(t.id))}));Y(t)}}if(j.collection&&j.collection.length){if(null===(i=j.data)||void 0===i?void 0:i.entitledCollectionIds){const t=j.collection.filter((t=>{var e,o;return null===(o=null===(e=j.data)||void 0===e?void 0:e.entitledCollectionIds)||void 0===o?void 0:o.includes(parseInt(t.id))}));$(t)}if(null===(n=j.data)||void 0===n?void 0:n.prerequisiteCollectionIds){const t=j.collection.filter((t=>{var e,o;return null===(o=null===(e=j.data)||void 0===e?void 0:e.prerequisiteCollectionIds)||void 0===o?void 0:o.includes(parseInt(t.id))}));z(t)}}}),[j.products,j.collection]),n((()=>{const t=Q.map((t=>parseInt(t.id)));L(Object.assign(Object.assign({},G),{entitledProductIds:t}))}),[Q]),n((()=>{const t=X.map((t=>parseInt(t.id)));L(Object.assign(Object.assign({},G),{prerequisiteProductIds:t}))}),[X]),n((()=>{const t=K.map((t=>parseInt(t.id)));L(Object.assign(Object.assign({},G),{entitledCollectionIds:t}))}),[K]),n((()=>{const t=V.map((t=>parseInt(t.id)));L(Object.assign(Object.assign({},G),{prerequisiteCollectionIds:t}))}),[V]),n((()=>{G.targetType===d.SHIPPING_LINE?R(s.FREE_SHIPPING):G.targetSelection===c.ENTITLED?R(s.BUY_X_GET_Y):G.valueType===l.FIXED_AMOUNT?R(s.FIXED_AMOUNT):G.valueType===l.PERCENTAGE&&R(s.PERCENTAGE)}),[]);const W=[{value:s.FIXED_AMOUNT,label:"Fixed Amount",selected:F===s.FIXED_AMOUNT},{value:s.PERCENTAGE,label:"Percentage",selected:F===s.PERCENTAGE},{value:s.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:F===s.BUY_X_GET_Y},{value:s.FREE_SHIPPING,label:"Free shipping",selected:F===s.FREE_SHIPPING}],tt=()=>{if(!j.quadrant||!j.probability)return;const t=[...j.probability];let e=[];t.length>=j.quadrant&&t.splice(j.quadrant-1,1),e=t;const o=e.reduce(((t,e)=>t+e),0)+(G.probability||0);return J(parseFloat(o.toFixed(4))),parseFloat(o.toFixed(4))},et=t=>{const e=t.value;R(e),e===s.FREE_SHIPPING?(Y([]),H([]),L(Object.assign(Object.assign({},G),{value:100,targetSelection:c.ALL,targetType:d.SHIPPING_LINE,valueType:l.PERCENTAGE,entitledQuantity:void 0,prerequisiteQuantity:void 0,entitledProductIds:void 0,prerequisiteProductIds:void 0}))):e===s.BUY_X_GET_Y?L(Object.assign(Object.assign({},G),{targetSelection:c.ENTITLED,targetType:d.LINE_ITEM,valueType:l.PERCENTAGE})):e===s.PERCENTAGE?(Y([]),H([]),L(Object.assign(Object.assign({},G),{targetSelection:c.ALL,targetType:d.LINE_ITEM,valueType:l.PERCENTAGE,entitledQuantity:void 0,prerequisiteQuantity:void 0,entitledProductIds:void 0,prerequisiteProductIds:void 0}))):e===s.FIXED_AMOUNT&&(Y([]),H([]),L(Object.assign(Object.assign({},G),{targetSelection:c.ALL,targetType:d.LINE_ITEM,valueType:l.FIXED_AMOUNT,entitledQuantity:void 0,prerequisiteQuantity:void 0,entitledProductIds:void 0,prerequisiteProductIds:void 0})))};return t(y,Object.assign({width:"750px",open:j.isOpen,headingTitle:_?"Select Products":j.title,headingSubtitle:_?void 0:j.subTitle,footerLeftCustomElement:!j.quadrant||j.hideProbability?e(o,{}):Z<=1?e(v,{theme:"light",tagText:`Current probability sum: ${Z}`,type:"white"}):e(C,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e("div",{children:e(v,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${Z}`,type:"negative",LeadingIcon:E})})})),headerRightCustomElement:j.allowStaticCoupon||_?void 0:e(a,{options:W,width:"200px",placement:"bottom-start",size:"small",onSelect:t=>{et(t)}}),onClose:j.onClose,footerShadow:!0,primaryButton:_?{buttonType:"primary",onClick:()=>{A(void 0)},buttonText:"Add"}:q?{buttonType:"primary",onClick:()=>{x(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Add code",disabled:M,onClick:()=>{G.isStaticCoupon?j.onSaveClicked({quadrant:G.quadrant,couponCode:G.couponCode,description:G.description,isStaticCoupon:G.isStaticCoupon,probability:G.probability,title:G.title}):j.onSaveClicked(G),L({})}},secondaryButton:_?{buttonType:"tertiaryGray",onClick:()=>{A(void 0)},buttonText:"Back"}:q?{buttonType:"tertiaryGray",onClick:()=>{x(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:j.onClose,buttonText:"Close"}},{children:[!_&&!q&&t(T,{children:[j.allowStaticCoupon&&!_&&t(I,Object.assign({selectedDiv:G.isStaticCoupon?1:2},{children:["static"===j.hideOption?e(o,{}):t("div",Object.assign({className:"coupon-type__container",onClick:()=>{L({isStaticCoupon:!0,couponCode:G.couponCode,description:G.description,quadrant:G.quadrant})}},{children:[e(p,Object.assign({style:G.isStaticCoupon?{color:m.colorsV2.content.brand}:{}},{children:"Static code"})),e(u,Object.assign({style:G.isStaticCoupon?{color:m.colorsV2.content.brand}:{}},{children:"One static code for all customers"}))]})),"dynamic"===j.hideOption?e(o,{}):t("div",Object.assign({className:"coupon-type__container",onClick:()=>{L(Object.assign(Object.assign({},G),{isStaticCoupon:!1}))}},{children:[e(p,Object.assign({style:G.isStaticCoupon?{}:{color:m.colorsV2.content.brand}},{children:"Dynamic code"})),e(u,Object.assign({style:G.isStaticCoupon?{}:{color:m.colorsV2.content.brand}},{children:"New code generated for everyone"}))]}))]})),G.isStaticCoupon&&!_&&e(S,{discountData:G,setDiscountData:L,hideProbability:j.hideProbability||!1,discountAdminUrl:j.discountAdminUrl}),!G.isStaticCoupon&&!_&&!q&&e(g,{currency:j.currency,entitledProducts:Q,prerequisiteProducts:X,setEntitledProducts:H,setPrerequisiteProducts:Y,discountData:G,productPickerOpen:_,setIsProductPickerOpen:A,setDiscountData:L,selectedCouponType:F,setSelectedCouponType:R,selectedMinimumRequirement:U,setSelectedMinimumRequirement:B,hideProbability:j.hideProbability||!1,hideExpiration:j.hideExpiration||!1,allowStaticCoupon:j.allowStaticCoupon,onChangeCouponType:et,collectionPickerOpen:q,entitledCollections:K,prerequisiteCollections:V,setIsCollectionPickerOpen:x,setEntitledCollections:$,setPrerequisiteCollections:z})]}),!!_&&e("div",Object.assign({style:{padding:"12px 0"}},{children:e(b,{show:!0,onSave:()=>{},products:null!==(f=j.products)&&void 0!==f?f:[],title:"Select Products",onClose:()=>{A(void 0)},selectedProducts:_===h.ENTITLED?Q:X,setSelectedProducts:_===h.ENTITLED?H:Y,onSearchKeyChange:j.onProductSearch})})),!!q&&e("div",Object.assign({style:{padding:"12px 0"}},{children:e(b,{show:!0,onSave:()=>{},products:null!==(w=j.collection)&&void 0!==w?w:[],title:"Select Products",onClose:()=>{x(void 0)},selectedProducts:q===h.ENTITLED?K:V,setSelectedProducts:q===h.ENTITLED?$:z,onSearchKeyChange:j.onCollectionSearch,searchPlaceholder:"Search collections..."})}))]}))};export{j as DiscountModal};
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import { DISCOUNT_TYPES, ICouponData, MIN_PURCHASE_REQUIREMENT } from "./type";
|
|
2
|
-
import { Collection, Product } from '../product-picker/type';
|
|
3
2
|
export declare const validateDiscountData: (couponData: ICouponData, selectedMinimumRequirement: MIN_PURCHASE_REQUIREMENT | undefined, selectedCouponType: DISCOUNT_TYPES | undefined, hideProbability: boolean, currentProbability: number, isStatic: boolean) => boolean;
|
|
4
|
-
export declare const descriptionBuilder: (data: ICouponData, currencySymbol: string, products: Product[], collections: Collection[]) => string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DISCOUNT_TYPES as e,DISCOUNT_VALUE_TYPES as i,MIN_PURCHASE_REQUIREMENT as t,DISCOUNT_TARGET_TYPES as
|
|
1
|
+
import{DISCOUNT_TYPES as e,DISCOUNT_VALUE_TYPES as i,MIN_PURCHASE_REQUIREMENT as t,DISCOUNT_TARGET_TYPES as r,DISCOUNT_TARGET_SELECTION as n}from"./type.js";const u=(u,l,o,f,v,a)=>{var d,T,A,E;if(!u.title)return!0;if(!f){if(isNaN(u.probability))return!0;if((u.probability||0)>1)return!0;if((u.probability||0)<0)return!0;if(v>1)return!0}if(a){if(!(null==u?void 0:u.couponCode))return!0;if(!u.description)return!0}else{if(o&&o===e.FIXED_AMOUNT){if(u.valueType!==i.FIXED_AMOUNT)return!0;if(!(null==u?void 0:u.value)||(null==u?void 0:u.value)<=0)return!0;if(l===t.AMOUNT&&(!u.minAmount||(null==u?void 0:u.minAmount)<=0))return!0;if(l===t.QUANTITY&&(!(null==u?void 0:u.minQuantity)||(null==u?void 0:u.minQuantity)<=0))return!0;if(u.targetType!==r.LINE_ITEM)return!0;if(u.targetSelection!==n.ALL)return!0}else if(o&&o===e.PERCENTAGE){if(u.valueType!==i.PERCENTAGE)return!0;if(!(null==u?void 0:u.value)||(null==u?void 0:u.value)<=0||(null==u?void 0:u.value)>100)return!0;if(l===t.AMOUNT&&(!u.minAmount||(null==u?void 0:u.minAmount)<=0))return!0;if(l===t.QUANTITY&&(!(null==u?void 0:u.minQuantity)||(null==u?void 0:u.minQuantity)<=0))return!0;if(u.targetType!==r.LINE_ITEM)return!0;if(u.targetSelection!==n.ALL)return!0}else if(o&&o===e.BUY_X_GET_Y){if(!u.entitledQuantity||!(null===(d=u.entitledProductIds)||void 0===d?void 0:d.length)&&!(null===(T=u.entitledCollectionIds)||void 0===T?void 0:T.length)||!u.prerequisiteQuantity||!(null===(A=u.prerequisiteProductIds)||void 0===A?void 0:A.length)&&!(null===(E=u.prerequisiteCollectionIds)||void 0===E?void 0:E.length))return!0;if(u.valueType!==i.PERCENTAGE)return!0;if(!u.value)return!0;if(u.value<=0||u.value>100)return!0;if(u.targetSelection!==n.ENTITLED)return!0;if(u.targetType!==r.LINE_ITEM)return!0}else if(o&&e.FREE_SHIPPING){if(u.valueType!==i.PERCENTAGE)return!0;if(u.targetType!==r.SHIPPING_LINE)return!0;if(100!==u.value)return!0;if(u.targetSelection!==n.ALL)return!0;if(l===t.AMOUNT&&(!u.minAmount||(null==u?void 0:u.minAmount)<=0))return!0;if(l===t.QUANTITY&&(!(null==u?void 0:u.minQuantity)||(null==u?void 0:u.minQuantity)<=0))return!0}if(null!==u.expireAfter&&void 0!==u.expireAfter&&u.expireAfter<=0)return!0;if(u.expireAt&&u.expireAt<new Date)return!0}return!1};export{u as validateDiscountData};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DISCOUNT_TYPES } from "
|
|
3
|
-
import { ICouponData, MIN_PURCHASE_REQUIREMENT } from "../type";
|
|
2
|
+
import { DISCOUNT_TYPES, ICouponData, MIN_PURCHASE_REQUIREMENT } from "../type";
|
|
4
3
|
import { SingleOption } from "../../dropdown/type";
|
|
5
4
|
import { Collection, Product } from "../../product-picker/type";
|
|
6
5
|
export declare enum DISCOUNT_PRODUCTS {
|
|
@@ -31,7 +30,6 @@ interface DynamicCouponI {
|
|
|
31
30
|
hideProbability?: boolean;
|
|
32
31
|
allowStaticCoupon: boolean;
|
|
33
32
|
currency?: string;
|
|
34
|
-
useNewPicker?: boolean;
|
|
35
33
|
}
|
|
36
34
|
declare const DynamicCoupon: React.FC<DynamicCouponI>;
|
|
37
35
|
export default DynamicCoupon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import{cloneDeep as s}from"lodash";import{Button as n}from"../../button/Button.js";import"react";import{DISCOUNT_TYPES as a,MIN_PURCHASE_REQUIREMENT as o,DISCOUNT_VALUE_TYPES as l}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as r}from"../../dropdown/Dropdown.js";import"../../dropdown/ChipDropdown.js";import"../../zeroState/ZeroState.js";import{TitleRegular as d,TitleSmall as c,TitleMedium as u,BodyPrimary as p,BodySecondary as m}from"../../TypographyStyle.js";import{DEFAULT_THEME as v}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"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import{Input as b}from"../../input/Input.js";import g from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import"../../modals/styledModal.js";import"../../../node_modules/lodash.debounce/index.js";import"../../bik-layout/CommonStyles.js";import"../../product-picker/ProductPicker.styled.js";import"../../../utils/DateUtils.js";import"../../tag/Tag.js";import"@tippyjs/react";import"../../tooltips/TooltipInternal.js";import"../../spinner/Spinner.js";import"../../icon-button/IconButton.js";import"../../shimmer/ShimmerComponent/ShimmerStyled.js";import"../../product-picker-v2/emptyState.js";import"../../product-picker-v2/style.js";import"../../product-picker-v2/type.js";import{DynamicCouponContainer as D}from"../DiscountModal.styled.js";import{CouponExpiration as h}from"../CouponExpiration/CouponExpiration.js";import{RadioButton as y}from"../../radioButton/RadioButton.js";import O from"../../../assets/icons/cursor.svg.js";import T from"../../../assets/icons/plus.svg.js";const j="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg";var x;function E(){return null}!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(x||(x={}));const _=_=>{var C;const f=[{value:a.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:_.selectedCouponType===a.AMOUNT_OFF_ORDER},{value:a.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:_.selectedCouponType===a.AMOUNT_OFF_PRODUCTS},{value:a.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:_.selectedCouponType===a.BUY_X_GET_Y},{value:a.FREE_SHIPPING,label:"Free shipping",selected:_.selectedCouponType===a.FREE_SHIPPING}],N=[{selected:_.selectedMinimumRequirement===o.NA,label:"No minimum requirements",value:o.NA},{selected:_.selectedMinimumRequirement===o.AMOUNT,label:`Minimum purchase amount (${null!==(C=_.currency)&&void 0!==C?C:"₹"})`,value:o.AMOUNT},{selected:_.selectedMinimumRequirement===o.QUANTITY,label:"Minimum quantity of items",value:o.QUANTITY}],F=()=>{var e,t,i,s,n;if(_.discountData.valueType===l.FIXED_AMOUNT){if((null===(e=_.discountData)||void 0===e?void 0:e.value)&&(null===(t=_.discountData)||void 0===t?void 0:t.value)<=0)return"Enter a valid input"}else if((null===(i=_.discountData)||void 0===i?void 0:i.value)&&((null===(s=_.discountData)||void 0===s?void 0:s.value)<=0||(null===(n=_.discountData)||void 0===n?void 0:n.value)>100))return"Enter a valid input"},I=()=>{var i,s,n,a,l;return e("div",Object.assign({className:"input__rows"},{children:[e("div",Object.assign({className:"input__wrapper"},{children:[t(m,Object.assign({style:{marginBottom:10}},{children:"Min purchase requirements"})),t(r,{options:N,placement:"bottom-start",onSelect:e=>{const t=e.value;_.setSelectedMinimumRequirement(t),_.setDiscountData(Object.assign(Object.assign({},_.discountData),{minQuantity:void 0,minAmount:void 0}))}})]})),t("div",Object.assign({className:"input__wrapper"},{children:_.selectedMinimumRequirement!==o.NA&&t(b,{value:_.selectedMinimumRequirement===o.AMOUNT?null!==(s=null===(i=_.discountData.minAmount)||void 0===i?void 0:i.toString())&&void 0!==s?s:"":null!==(a=null===(n=_.discountData.minQuantity)||void 0===n?void 0:n.toString())&&void 0!==a?a:"",onChangeText:e=>{_.selectedMinimumRequirement===o.AMOUNT?_.setDiscountData(Object.assign(Object.assign({},_.discountData),{minAmount:parseInt(e)})):_.selectedMinimumRequirement===o.QUANTITY&&_.setDiscountData(Object.assign(Object.assign({},_.discountData),{minQuantity:parseInt(e)}))},labelText:_.selectedMinimumRequirement===o.AMOUNT?"Minimum purchase amount":"Minimum purchase quantity",prefixText:_.selectedMinimumRequirement===o.AMOUNT?null!==(l=_.currency)&&void 0!==l?l:"₹":void 0,type:"number",placeholder:_.selectedMinimumRequirement===o.AMOUNT?"1000.00":"2"})}))]}))},w=(a,o)=>{var l,r,u,p;let m=[],D=[],h={},y={};return _.useNewPicker?(h=a===x.ENTITLED?_.entitledProducts:_.prerequisiteProducts,y=null!==(l=a===x.ENTITLED?_.entitledCollections:_.prerequisiteCollections)&&void 0!==l?l:[],(null==h?void 0:h.isCustom)&&delete h.isCustom,(null==y?void 0:y.isCustom)&&delete y.isCustom,Object.values(h).forEach((e=>{Object.keys(e.products).forEach((t=>{m.push({id:t,name:e.products[t].name,image:e.products[t].image})}))})),Object.keys(y).forEach((e=>{"isCustom"!==e&&D.push({id:e,name:y[e].name,image:y[e].image})}))):(m=a===x.ENTITLED?_.entitledProducts:_.prerequisiteProducts,D=null!==(r=a===x.ENTITLED?_.entitledCollections:_.prerequisiteCollections)&&void 0!==r?r:[]),e(i,{children:[!o&&e(i,{children:[t(d,{children:a===x.PREREQUISITE?"Customer buys":"Customer gets"}),e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:a===x.ENTITLED?null===(u=_.discountData.entitledQuantity)||void 0===u?void 0:u.toString():null===(p=_.discountData.prerequisiteQuantity)||void 0===p?void 0:p.toString(),type:"number",onChangeText:e=>{a===x.ENTITLED?_.setDiscountData(Object.assign(Object.assign({},_.discountData),{entitledQuantity:parseInt(e)})):_.setDiscountData(Object.assign(Object.assign({},_.discountData),{prerequisiteQuantity:parseInt(e)}))},labelText:"Add quantity",placeholder:"Add quantity"})})),t("div",{className:"input__wrapper"})]}))]}),e("div",Object.assign({style:{display:"flex",gap:18}},{children:[!(null==D?void 0:D.length)&&t(n,{buttonText:"Add product",buttonType:"tertiary",LeadingIcon:T,onClick:()=>{_.setIsProductPickerOpen(a)}}),!(null==m?void 0:m.length)&&t(n,{buttonText:"Add collection",buttonType:"tertiary",LeadingIcon:T,onClick:()=>{_.setIsCollectionPickerOpen(a)}})]})),!!m.length&&e("div",Object.assign({style:{margin:"8px 0"}},{children:[t(c,{children:"Products"}),m.map((i=>e("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${v.colorsV2.stroke.primary}`,display:"flex"}},{children:[e("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[t("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),t(c,{children:i.name})]})),t("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:t("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(_.useNewPicker){const e=s(h);Object.values(e).forEach((e=>{var t,s;(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t[i.id])&&(null===(s=null==e?void 0:e.products)||void 0===s||delete s[i.id])})),a===x.ENTITLED?_.setEntitledProducts(e):_.setPrerequisiteProducts(e)}else{const e=m.filter((e=>e.id!==i.id));a===x.ENTITLED?_.setEntitledProducts(e):_.setPrerequisiteProducts(e)}}},{children:t(g,{width:14,color:v.colorsV2.content.primary})}))}))]}),i.id)))]})),!!D.length&&e("div",Object.assign({style:{margin:"8px 0"}},{children:[t(c,{children:"Collections"}),D.map((i=>e("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${v.colorsV2.stroke.primary}`,display:"flex"}},{children:[e("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[t("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),t(c,{children:i.name})]})),t("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:t("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(_.useNewPicker){const e=s(y);delete e[i.id],a===x.ENTITLED?_.setEntitledCollections(e):_.setPrerequisiteCollections(e)}else{const e=D.filter((e=>e.id!==i.id));a===x.ENTITLED?_.setEntitledCollections(e):_.setPrerequisiteCollections(e)}}},{children:t(g,{width:14,color:v.colorsV2.content.primary})}))}))]}),i.id)))]}))]})};return e(D,{children:[_.allowStaticCoupon&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(r,{options:f,width:"338px",placement:"bottom-start",onSelect:e=>{_.onChangeCouponType(e)}})})),t("div",Object.assign({className:"input__wrapper",style:{display:"flex",alignItems:"center",gap:8}},{children:(_.selectedCouponType===a.AMOUNT_OFF_PRODUCTS||_.selectedCouponType===a.AMOUNT_OFF_ORDER)&&e(i,{children:[t(y,{isActive:_.discountData.valueType===l.FIXED_AMOUNT,onValueChange:()=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{valueType:l.FIXED_AMOUNT,value:void 0}))},label:"Fixed amount"}),t(y,{isActive:_.discountData.valueType===l.PERCENTAGE,onValueChange:()=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{valueType:l.PERCENTAGE,value:void 0}))},label:"Percentage"})]})}))]})),_.selectedCouponType===a.AMOUNT_OFF_ORDER&&(()=>{var s,n,a,o,r;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:null!==(a=null===(n=null===(s=_.discountData)||void 0===s?void 0:s.value)||void 0===n?void 0:n.toString())&&void 0!==a?a:"",labelText:"Discount code value",type:"number",errorMessage:F(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:parseInt(e)}))},placeholder:_.discountData.valueType===l.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:_.discountData.valueType===l.FIXED_AMOUNT?null!==(o=_.currency)&&void 0!==o?o:"₹":void 0,suffixText:_.discountData.valueType===l.PERCENTAGE?"%":void 0})}))]})),I(),!_.hideProbability&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{type:"number",value:null===(r=_.discountData.probability)||void 0===r?void 0:r.toString(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})})),t("div",{className:"input__wrapper"})]}))]})})(),_.selectedCouponType===a.AMOUNT_OFF_PRODUCTS&&(()=>{var s,n,a,o,r;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:null!==(a=null===(n=null===(s=_.discountData)||void 0===s?void 0:s.value)||void 0===n?void 0:n.toString())&&void 0!==a?a:"",labelText:"Discount code value",type:"number",errorMessage:F(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:parseInt(e)}))},placeholder:_.discountData.valueType===l.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:_.discountData.valueType===l.FIXED_AMOUNT?null!==(o=_.currency)&&void 0!==o?o:"₹":void 0,suffixText:_.discountData.valueType===l.PERCENTAGE?"%":void 0})}))]})),w(x.ENTITLED,!0),!_.hideProbability&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{type:"number",value:null===(r=_.discountData.probability)||void 0===r?void 0:r.toString(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})})),t("div",{className:"input__wrapper"})]}))]})})(),_.selectedCouponType===a.FREE_SHIPPING&&(()=>{var s;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},labelText:"Code title",placeholder:"eg: Flat 50% Off",maxCharLimit:18})})),t("div",Object.assign({className:"input__wrapper"},{children:!_.hideProbability&&t(b,{value:null===(s=_.discountData.probability)||void 0===s?void 0:s.toString(),type:"number",onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})}))]})),I()]})})(),_.selectedCouponType===a.BUY_X_GET_Y&&(()=>{var i,s,n,a;return e(D,{children:[t("div",Object.assign({className:"input__rows"},{children:e("div",Object.assign({style:{display:"flex",gap:20,flex:1}},{children:[t("div",Object.assign({style:{flex:1}},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),!_.hideProbability&&t("div",Object.assign({style:{flex:1}},{children:t(b,{value:null===(i=_.discountData.probability)||void 0===i?void 0:i.toString(),type:"number",onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})}))]}))})),t(E,{}),w(x.PREREQUISITE),t(E,{}),w(x.ENTITLED),t(E,{}),t(d,{children:"At a discount value"}),e("div",Object.assign({style:{display:"flex",gap:18,alignItems:"flex-start"}},{children:[t(y,{label:"Percentage",isActive:100!==_.discountData.value,onValueChange:()=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:void 0}))}}),100!==_.discountData.value&&t(b,{variant:"small",value:null!==(a=null===(n=null===(s=_.discountData)||void 0===s?void 0:s.value)||void 0===n?void 0:n.toString())&&void 0!==a?a:"",onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:parseInt(e)}))},errorMessage:F(),type:"number",placeholder:"Enter percentage eg: 10%",suffixText:"%",width:"238px"})]})),t("div",{children:t(y,{label:"Free",isActive:100===_.discountData.value,onValueChange:e=>{e?_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:100})):_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:void 0}))}})})]})})(),_.selectedCouponType&&!_.hideExpiration&&e(i,{children:[t("div",{style:_.selectedCouponType!==a.BUY_X_GET_Y&&_.selectedCouponType!==a.AMOUNT_OFF_PRODUCTS||!_.hideProbability?{height:6,borderTop:`1px solid ${v.colorsV2.stroke.primary}`,marginTop:12}:{}}),t(h,{discountData:_.discountData,setDiscountData:_.setDiscountData})]}),!_.selectedCouponType&&e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:10,padding:"40px 0",justifyContent:"center",alignItems:"center"}},{children:[t("div",Object.assign({style:{height:52,width:52,backgroundColor:v.colorsV2.background.inverse,borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},{children:t(O,{width:32,color:v.colorsV2.content.primaryInverse})})),t(u,{children:"No discount has been selected"}),t(p,{children:"Please select a discount type"})]}))]})};export{x as DISCOUNT_PRODUCTS,_ as default};
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import{Button as n}from"../../button/Button.js";import"react";import{DISCOUNT_TYPES as s,MIN_PURCHASE_REQUIREMENT as a}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as o}from"../../dropdown/Dropdown.js";import"../../dropdown/ChipDropdown.js";import"../../zeroState/ZeroState.js";import{TitleRegular as r,BodySecondary as l,TitleMedium as c,BodyPrimary as d,TitleSmall as p}from"../../TypographyStyle.js";import{DEFAULT_THEME as u}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"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import{Input as m}from"../../input/Input.js";import g from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import"../../modals/styledModal.js";import"../../../node_modules/lodash.debounce/index.js";import"../../bik-layout/CommonStyles.js";import"../../product-picker/ProductPicker.styled.js";import"../../../utils/DateUtils.js";import"../../tag/Tag.js";import"@tippyjs/react";import"../../tooltips/TooltipInternal.js";import{DynamicCouponContainer as b}from"../DiscountModal.styled.js";import{CouponExpiration as v}from"../CouponExpiration/CouponExpiration.js";import{RadioButton as y}from"../../radioButton/RadioButton.js";import h from"../../../assets/icons/cursor.svg.js";import j from"../../../assets/icons/plus.svg.js";const D="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg";var O;function T(){return null}!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(O||(O={}));const x=x=>{var E;const C=[{value:s.FIXED_AMOUNT,label:"Fixed Amount",selected:x.selectedCouponType===s.FIXED_AMOUNT},{value:s.PERCENTAGE,label:"Percentage",selected:x.selectedCouponType===s.PERCENTAGE},{value:s.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:x.selectedCouponType===s.BUY_X_GET_Y},{value:s.FREE_SHIPPING,label:"Free shipping",selected:x.selectedCouponType===s.FREE_SHIPPING}],f=[{selected:x.selectedMinimumRequirement===a.NA,label:"No minimum requirements",value:a.NA},{selected:x.selectedMinimumRequirement===a.AMOUNT,label:`Minimum purchase amount (${null!==(E=x.currency)&&void 0!==E?E:"₹"})`,value:a.AMOUNT},{selected:x.selectedMinimumRequirement===a.QUANTITY,label:"Minimum quantity of items",value:a.QUANTITY}],_=()=>{var i,n,s,r,c;return e("div",Object.assign({className:"input__rows"},{children:[e("div",Object.assign({className:"input__wrapper"},{children:[t(l,Object.assign({style:{marginBottom:10}},{children:"Min purchase requirements"})),t(o,{options:f,placement:"bottom-start",onSelect:e=>{const t=e.value;x.setSelectedMinimumRequirement(t),x.setDiscountData(Object.assign(Object.assign({},x.discountData),{minQuantity:void 0,minAmount:void 0}))}})]})),t("div",Object.assign({className:"input__wrapper"},{children:x.selectedMinimumRequirement!==a.NA&&t(m,{value:x.selectedMinimumRequirement===a.AMOUNT?null!==(n=null===(i=x.discountData.minAmount)||void 0===i?void 0:i.toString())&&void 0!==n?n:"":null!==(r=null===(s=x.discountData.minQuantity)||void 0===s?void 0:s.toString())&&void 0!==r?r:"",onChangeText:e=>{x.selectedMinimumRequirement===a.AMOUNT?x.setDiscountData(Object.assign(Object.assign({},x.discountData),{minAmount:parseInt(e)})):x.selectedMinimumRequirement===a.QUANTITY&&x.setDiscountData(Object.assign(Object.assign({},x.discountData),{minQuantity:parseInt(e)}))},labelText:x.selectedMinimumRequirement===a.AMOUNT?"Minimum purchase amount":"Minimum purchase quantity",prefixText:x.selectedMinimumRequirement===a.AMOUNT?null!==(c=x.currency)&&void 0!==c?c:"₹":void 0,type:"number",placeholder:x.selectedMinimumRequirement===a.AMOUNT?"1000.00":"2"})}))]}))},N=s=>{var a,o,l;const c=s===O.ENTITLED?x.entitledProducts:x.prerequisiteProducts,d=null!==(a=s===O.ENTITLED?x.entitledCollections:x.prerequisiteCollections)&&void 0!==a?a:[];return e(i,{children:[t(r,{children:s===O.PREREQUISITE?"Customer spends":"Customer gets"}),e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(m,{value:s===O.ENTITLED?null===(o=x.discountData.entitledQuantity)||void 0===o?void 0:o.toString():null===(l=x.discountData.prerequisiteQuantity)||void 0===l?void 0:l.toString(),type:"number",onChangeText:e=>{s===O.ENTITLED?x.setDiscountData(Object.assign(Object.assign({},x.discountData),{entitledQuantity:parseInt(e)})):x.setDiscountData(Object.assign(Object.assign({},x.discountData),{prerequisiteQuantity:parseInt(e)}))},labelText:"Add quantity",placeholder:"Add quantity"})})),t("div",{className:"input__wrapper"})]})),e("div",Object.assign({style:{display:"flex",gap:18}},{children:[t(n,{buttonText:"Add product",buttonType:"tertiary",LeadingIcon:j,onClick:()=>{x.setIsProductPickerOpen(s)}}),t(n,{buttonText:"Add collection",buttonType:"tertiary",LeadingIcon:j,onClick:()=>{x.setIsCollectionPickerOpen(s)}})]})),!!c.length&&e("div",Object.assign({style:{margin:"8px 0"}},{children:[t(p,{children:"Products"}),c.map((i=>e("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${u.colorsV2.stroke.primary}`,display:"flex"}},{children:[e("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[t("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src=D},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),t(p,{children:i.name})]})),t("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:t("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{const e=c.filter((e=>e.id!==i.id));s===O.ENTITLED?x.setEntitledProducts(e):x.setPrerequisiteProducts(e)}},{children:t(g,{width:14,color:u.colorsV2.content.primary})}))}))]}),i.id)))]})),!!d.length&&e("div",Object.assign({style:{margin:"8px 0"}},{children:[t(p,{children:"Collections"}),d.map((i=>e("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${u.colorsV2.stroke.primary}`,display:"flex"}},{children:[e("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[t("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src=D},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),t(p,{children:i.name})]})),t("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:t("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{const e=d.filter((e=>e.id!==i.id));s===O.ENTITLED?x.setEntitledCollections(e):x.setPrerequisiteCollections(e)}},{children:t(g,{width:14,color:u.colorsV2.content.primary})}))}))]}),i.id)))]}))]})};return e(b,{children:[x.allowStaticCoupon&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(o,{options:C,width:"290px",placement:"bottom-start",onSelect:e=>{x.onChangeCouponType(e)}})})),t("div",{className:"input__wrapper"})]})),(x.selectedCouponType===s.PERCENTAGE||x.selectedCouponType===s.FIXED_AMOUNT)&&(()=>{var n,a,o,r;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(m,{value:x.discountData.title,onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{title:e}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),t("div",Object.assign({className:"input__wrapper"},{children:t(m,{value:null===(a=null===(n=x.discountData)||void 0===n?void 0:n.value)||void 0===a?void 0:a.toString(),labelText:"Discount code value",type:"number",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:parseInt(e)}))},placeholder:x.selectedCouponType===s.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:x.selectedCouponType===s.FIXED_AMOUNT?null!==(o=x.currency)&&void 0!==o?o:"₹":void 0,suffixText:x.selectedCouponType===s.PERCENTAGE?"%":void 0})}))]})),_(),!x.hideProbability&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(m,{type:"number",value:null===(r=x.discountData.probability)||void 0===r?void 0:r.toString(),onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{probability:e.startsWith(".")?parseFloat(`0${e}`):parseFloat(e)}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})})),t("div",{className:"input__wrapper"})]}))]})})(),x.selectedCouponType===s.FREE_SHIPPING&&(()=>{var n;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(m,{value:x.discountData.title,onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{title:e}))},labelText:"Code title",placeholder:"eg: Flat 50% Off",maxCharLimit:18})})),t("div",Object.assign({className:"input__wrapper"},{children:!x.hideProbability&&t(m,{value:null===(n=x.discountData.probability)||void 0===n?void 0:n.toString(),type:"number",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{probability:e.startsWith(".")?parseFloat(`0${e}`):parseFloat(e)}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})}))]})),_()]})})(),x.selectedCouponType===s.BUY_X_GET_Y&&(()=>{var i;return e(b,{children:[t("div",Object.assign({className:"input__rows"},{children:e("div",Object.assign({style:{display:"flex",gap:20,flex:1}},{children:[t("div",Object.assign({style:{flex:1}},{children:t(m,{value:x.discountData.title,onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{title:e}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),!x.hideProbability&&t("div",Object.assign({style:{flex:1}},{children:t(m,{value:null===(i=x.discountData.probability)||void 0===i?void 0:i.toString(),type:"number",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{probability:e.startsWith(".")?parseFloat(`0${e}`):parseFloat(e)}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})}))]}))})),t(T,{}),N(O.PREREQUISITE),t(T,{}),N(O.ENTITLED),t(T,{}),t(r,{children:"At a discount value"}),e("div",Object.assign({style:{display:"flex",gap:18,alignItems:"center"}},{children:[t(y,{isActive:100!==x.discountData.value,onValueChange:()=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:void 0}))}}),t(l,{children:"Percentage"}),100!==x.discountData.value&&t(m,{variant:"small",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Enter percentage eg: 10%",suffixText:"%",width:"238px"})]})),e("div",Object.assign({style:{display:"flex",gap:18}},{children:[t(y,{isActive:100===x.discountData.value,onValueChange:e=>{e?x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:100})):x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:void 0}))}}),t(l,{children:"Free"})]}))]})})(),x.selectedCouponType&&!x.hideExpiration&&e(i,{children:[t("div",{style:{height:6,borderTop:`1px solid ${u.colorsV2.stroke.primary}`,marginTop:12}}),t(v,{discountData:x.discountData,setDiscountData:x.setDiscountData})]}),!x.selectedCouponType&&e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:10,padding:"40px 0",justifyContent:"center",alignItems:"center"}},{children:[t("div",Object.assign({style:{height:52,width:52,backgroundColor:u.colorsV2.background.inverse,borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},{children:t(h,{width:32,color:u.colorsV2.content.primaryInverse})})),t(c,{children:"No discount has been selected"}),t(d,{children:"Please select a discount type"})]}))]})};export{O as DISCOUNT_PRODUCTS,x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import i from"../../../assets/icons/info.svg.js";import{Input as a}from"../../input/Input.js";import{BodySecondaryLink as o,BodySecondary as n}from"../../TypographyStyle.js";import{DEFAULT_THEME as s}from"../../../constants/Theme.js";import{StaticCouponContainerStyled as c}from"../DiscountModal.styled.js";const r=r=>t(c,{children:[t("div",Object.assign({className:"static-coupon__data"},{children:[e("div",Object.assign({className:"static-input__wrapper"},{children:e(a,{onChangeText:t=>{r.setDiscountData(Object.assign(Object.assign({},r.discountData),{couponCode:t}))},labelText:"Coupon code",value:r.discountData.couponCode,placeholder:"Enter code created on shopify"})})),e("div",Object.assign({className:"static-input__wrapper"},{children:e(a,{maxCharLimit:18,labelText:"Coupon title",value:r.discountData.title,onChangeText:t=>{r.setDiscountData(Object.assign(Object.assign({},r.discountData),{title:t}))},placeholder:"Enter coupon title"})}))]})),e(a,{labelText:"Coupon description",value:r.discountData.description,onChangeText:t=>{r.setDiscountData(Object.assign(Object.assign({},r.discountData),{description:t}))},placeholder:"Enter coupon description"}),!r.hideProbability&&e(a,{labelText:"Probability",value:r.discountData.probability?r.discountData.probability.toString():"",onChangeText:t=>{r.setDiscountData(Object.assign(Object.assign({},r.discountData),{probability:t.startsWith(".")?parseFloat(`0${t}`):parseFloat(t)}))},placeholder:"Enter probability in decimals (0 - 1)"}),r.discountAdminUrl&&t("div",Object.assign({className:"info__container"},{children:[e(i,{height:18,width:18,color:s.colorsV2.content.secondary}),e(o,Object.assign({onClick:()=>{window.open(r.discountAdminUrl,"_blank")}},{children:"Click here"})),e(n,{children:"to create discount code on Shopify"})]}))]});export{r as default};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SelectedItems } from '../product-picker-v2';
|
|
2
1
|
export declare enum MIN_PURCHASE_REQUIREMENT {
|
|
3
2
|
AMOUNT = "amount",
|
|
4
3
|
QUANTITY = "quantity",
|
|
@@ -17,8 +16,8 @@ export declare enum DISCOUNT_TARGET_SELECTION {
|
|
|
17
16
|
ALL = "all"
|
|
18
17
|
}
|
|
19
18
|
export declare enum DISCOUNT_TYPES {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
FIXED_AMOUNT = "fixedAmount",
|
|
20
|
+
PERCENTAGE = "percentage",
|
|
22
21
|
BUY_X_GET_Y = "buyXGetY",
|
|
23
22
|
FREE_SHIPPING = "freeShipping"
|
|
24
23
|
}
|
|
@@ -47,12 +46,4 @@ export interface ICouponData {
|
|
|
47
46
|
entitledQuantity?: number;
|
|
48
47
|
minPurchaseReq?: MIN_PURCHASE_REQUIREMENT;
|
|
49
48
|
probability?: number;
|
|
50
|
-
productsConf?: {
|
|
51
|
-
entitledProducts: SelectedItems;
|
|
52
|
-
prerequisiteProducts: SelectedItems;
|
|
53
|
-
};
|
|
54
|
-
collectionsConf?: {
|
|
55
|
-
entitledCollections: SelectedItems;
|
|
56
|
-
prerequisiteCollections: SelectedItems;
|
|
57
|
-
};
|
|
58
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var n,t,
|
|
1
|
+
var n,e,t,E,i;!function(n){n.AMOUNT="amount",n.QUANTITY="quantity",n.NA="na"}(n||(n={})),function(n){n.FIXED_AMOUNT="fixedAmount",n.PERCENTAGE="percentage"}(e||(e={})),function(n){n.LINE_ITEM="lineItem",n.SHIPPING_LINE="shippingLine"}(t||(t={})),function(n){n.ENTITLED="entitled",n.ALL="all"}(E||(E={})),function(n){n.FIXED_AMOUNT="fixedAmount",n.PERCENTAGE="percentage",n.BUY_X_GET_Y="buyXGetY",n.FREE_SHIPPING="freeShipping"}(i||(i={}));export{E as DISCOUNT_TARGET_SELECTION,t as DISCOUNT_TARGET_TYPES,i as DISCOUNT_TYPES,e as DISCOUNT_VALUE_TYPES,n as MIN_PURCHASE_REQUIREMENT};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import{forwardRef as i,useState as
|
|
1
|
+
import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import{forwardRef as i,useState as l,useContext as r,useRef as o,useEffect as a}from"react";import{Button as s}from"../button/Button.js";import{isFunction as c,validateInput as u}from"./Input-helper.js";import{BodySecondary as d}from"../TypographyStyle.js";import v from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as h}from"./context/InputStyleProvider.js";import{RootContainer as p,InputFooter as g,InputWrapper as m,IconHolder as f,PrefixHolder as x,InputContainer as b,InputContainerSmall as y,SuffixHolder as j,InputHeader as C,MaxCharStyle as I}from"./Input.styled.js";const w=i(((i,w)=>{var k,O,T,A,F;const{placeholder:L,leftIcon:M,rightIcon:z,labelText:B,maxCharLimit:D,isRequired:S,hintText:E,type:K,state:R,validate:H,variant:q,button:N,suffixText:P,prefixText:V,onChangeText:W,value:G,noErrorHint:J,reset:Q,rangeValidation:U,noKeyDownChange:X,version:Y,noMaxCharCheck:Z}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},i),$=null==M?void 0:M.icon,_=null==z?void 0:z.icon,[ee,ne]=l(!1),[te,ie]=l(!1),[le,re]=l(),oe="small"===q?"18px":"22px",ae=r(h),[se,ce]=l(),ue=o(null),de=null!=w?w:ue;a((()=>{ce(G)}),[G]),a((()=>{var e;de.current&&(null===(e=i.onReferenceInit)||void 0===e||e.call(i,de.current))}),[de]),a((()=>{Q&&ce("")}),[Q]),a((()=>{var e;ie(!!i.isActive),i.isActive&&(null===(e=de.current)||void 0===e||e.focus())}),[i.isActive]),a((()=>{re(i.errorMessage)}),[i.errorMessage]),a((()=>{var e;ne(!1),("invalid"===i.state||le)&&ne(!0),"active"===i.state&&(null===(e=de.current)||void 0===e||e.focus())}),[i.state,le]),a((()=>{ne(!!le)}),[le]);const ve=function(e){if(c(e)){for(var n=arguments.length,t=new Array(n>1?n-1:0),i=1;i<n;i++)t[i-1]=arguments[i];e(...t)}},he=e=>{const n=D||("zip"===K?6:60);X||W(G||"",e),Z||![8].includes(e.which)&&n>0&&e.target.value.length===n&&e.preventDefault()},pe=e=>{const n=e.target.value;W(n,e),i.textControl||ce(n);const t=H||u;if(!t||!c(t))return;const[l,r]=t(n,K,U);ne(!l),re(i.errorMessage?i.errorMessage:r)},ge=e=>{var n;i.skipFocus||ie(!0),ve(null===(n=i.onFocus)||void 0===n?void 0:n.call(i,e))},me=e=>{var n;i.skipFocus||ie(!1),ve(null===(n=i.onBlur)||void 0===n?void 0:n.call(i,e))},fe=()=>{var l;return e(t,{children:["multiline"!==K&&n("input",{id:i.id,style:null!==(l=null==ae?void 0:ae.input)&&void 0!==l?l:{},ref:de,type:["phonenumber","zip","number"].includes(K)?"number":K,value:se,onFocus:e=>ge(e),onBlur:e=>me(e),placeholder:L||"Enter here",onChange:pe,onKeyDown:e=>he(e)}),"multiline"===K&&n("textarea",{value:se,ref:de,onFocus:e=>ge(e),onBlur:e=>me(e),placeholder:L||"Enter here",onChange:pe,onKeyDown:e=>he(e),maxLength:D>0?D:void 0})]})};return e(p,Object.assign({width:i.width,height:i.height,state:R,type:K,style:null!==(k=null==ae?void 0:ae.RootContainer)&&void 0!==k?k:{}},{children:[!J&&(!!E||!!le)&&e(g,Object.assign({invalid:!!le},{children:[!!le&&n(v,{width:16,height:16}),le||E]})),e(m,Object.assign({variant:q,state:R,width:i.width,isActive:"active"===R||te,isInvalid:ee,style:null!==(O=null==ae?void 0:ae.InputWrapper)&&void 0!==O?O:{},version:Y},{children:[!!$&&n(f,Object.assign({variant:q,iconSize:oe,onClick:()=>ve(null==M?void 0:M.callback),isLeft:!0,style:null!==(T=null==ae?void 0:ae.IconHolder)&&void 0!==T?T:{}},{children:n($,{})})),!!V&&n(x,Object.assign({variant:q},{children:V})),"default"===q&&n(b,{children:fe()}),"small"===q&&n(y,{children:fe()}),!!_&&n(f,Object.assign({variant:q,iconSize:oe,onClick:()=>ve(null==z?void 0:z.callback),isLeft:!1},{children:n(_,{})})),!!P&&n(j,Object.assign({variant:q},{children:P})),N&&N.text&&n(s,{buttonText:N.text,onClick:()=>ve(null==N?void 0:N.onClick)})]})),(!!B||!!D)&&e(C,Object.assign({invalid:ee},{children:[e(d,{children:[B,S?n("span",{children:"*"}):""]}),D>0&&e(I,{children:[null!==(F=null===(A=i.value)||void 0===A?void 0:A.length)&&void 0!==F?F:0,"/",D]})]}))]}))}));w.displayName="Input";export{w as Input};
|
|
@@ -54,9 +54,5 @@ export interface ProductPickerInterface {
|
|
|
54
54
|
hideCollectionCheckbox?: boolean;
|
|
55
55
|
hideProductCheckbox?: boolean;
|
|
56
56
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
57
|
-
hideVariantCheckbox?: boolean;
|
|
58
|
-
selectProductsFromCustomCollection?: boolean;
|
|
59
|
-
hideSelectionCount?: boolean;
|
|
60
|
-
title?: string;
|
|
61
57
|
}
|
|
62
58
|
export declare const ProductPickerModal: (props: ProductPickerInterface) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as s,useState as r,useEffect as i}from"react";import{COLORS as l}from"../../constants/Theme.js";import{Button as n}from"../button/Button.js";import{Input as d}from"../input/Input.js";import{StyledModal as a}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as u}from"./collectionScreen.js";import{ProductsScreen as m}from"./productScreen.js";import{collectionsReducer as C,selectedColectionsReducer as v,CollectionIdContext as b}from"./reducers.js";import{SearchScreen as g}from"./searchScreen.js";import{SelectedScreen as f}from"./selectedScreen.js";import{ContainerStyle as y,ScrollContainerStyle as j}from"./style.js";import{OUT_OF_STOCK_ACTION as S}from"./type.js";const x=x=>{const{storeId:I,selectedItems:k,onClose:P,visible:T,zIndex:O,limit:D,hideCollectionCheckbox:F,hideProductCheckbox:E,outOfStockAction:R=S.BLUR}=x,[w,B]=s(C,{}),[A,L]=r("collections"),[z,G]=r(""),[$,H]=r(0),[K,M]=r(!1),[U,Y]=r(0),[q,J]=r(""),[N,Q]=r(!1),[V,W]=r(!1),[X,Z]=r(),[_,ee]=s(v,Object.keys(k).length>0?k:{});i((()=>{M(!0),W(!0),x.collectionFetcher($,I).then((e=>{B({type:"fetched",data:(null==e?void 0:e.collections)||{}}),M(!1),H((e=>e+1)),W(!1)})).catch()}),[]),i((()=>{let e=0;Object.keys(_||[]).forEach((t=>{var o;Object.keys((null===(o=_[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,s;Object.keys((null===(s=null===(c=_[t].products)||void 0===c?void 0:c[o])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),Y(e)})),i((()=>{var e;z&&!(null===(e=null==w?void 0:w[z])||void 0===e?void 0:e.products)&&(M(!0),x.productFetcher(z,I).then((e=>{Object.keys(e).length&&B({type:"productsFetched",data:{collectionId:z,products:e}}),M(!1)})).catch())}),[z]),i((()=>{const e=setTimeout((()=>{q.length?(Q(!0),x.searchFetcher(I,q).then((e=>{Z(Object.assign({},e)),L("searchProducts"),M(!1),Q(!1)}))):L("collections")}),800);return()=>clearTimeout(e)}),[q]);const te=()=>{ee({type:"reset",data:{}})};return e(a,Object.assign({zIndex:O,open:T,onClose:()=>{P(),te()},headingTitle:"collections"===A||"products"===A?"Select Products":"view"===A?"Selected Products":"searchProducts"===A?"Searched Products":void 0,footerShadow:!0,centralContainerStyles:{width:"480px"},primaryButton:{buttonText:K?"Loading...":"Add",disabled:K||U<1||D&&U>D||!1,onClick:()=>{x.onAdd(_,U),te()}},footerLeftCustomElement:D&&U>D?e(p,{tagText:`You can only select ${D} products`,type:"negative"}):e(n,U>0?{onClick:()=>{L("view")},buttonText:`${U} products selected`,buttonType:"tertiaryGray"}:{disabled:!0,buttonText:`${U} products selected`,buttonType:"tertiaryGray"})},{children:t(y,{children:[!x.hideGlobalSearch&&e(o,{children:("collections"===A||"searchProducts"===A)&&e("div",Object.assign({style:{padding:"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e(d,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>N?e(h,{size:"small",color:l.content.primary}):e(c,{})},id:"listInput",height:"24px",type:"text",value:q,onChangeText:e=>{e.length&&e.trim().length?J(e):J("")},placeholder:"Search products..."})}))}),t(j,{children:["collections"===A&&e(u,{customCollectionRestriction:x.customCollectionRestriction,dataLoading:V,collections:w,selectedCollectionsDispatch:ee,setCollectionId:G,setScreen:L,selectedCollections:_,collectionFetcher:x.collectionFetcher,storeId:I,collectionsDispatch:B,setSaveDisabled:M,pagingControls:{curPage:$,setCurPage:H},hideCollectionCheckbox:F}),"products"===A&&z&&e(b.Provider,Object.assign({value:z},{children:e(m,{hideInCollectionSearch:x.hideInCollectionSearch,customCollectionRestriction:x.customCollectionRestriction,productFetcher:x.productFetcher,setScreen:L,storeId:I,data:w[z],collectionsDispatch:B,selectedCollectionsDispatch:ee,selectedData:_,setSaveDisabled:M,searchInCollectionFetcher:x.searchInCollectionFetcher,hideProductCheckbox:E,outOfStockAction:R})})),"view"===A&&e(f,{selectedCollections:_||{},selectedCollectionsDispatch:ee,setScreen:L,collections:w}),"searchProducts"===A&&e(g,{customCollectionRestriction:x.customCollectionRestriction,selectedCollections:_||{},searchedCollections:X||{},selectedCollectionsDispatch:ee,setScreen:L,collections:w,onBackPress:()=>{J(""),Z({})}})]})]})}))};export{x as ProductPickerModal};
|
|
@@ -16,8 +16,6 @@ interface ProductsScreenInterface {
|
|
|
16
16
|
setSaveDisabled: React.Dispatch<React.SetStateAction<boolean>>;
|
|
17
17
|
hideProductCheckbox?: boolean;
|
|
18
18
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
19
|
-
hideVariantCheckbox?: boolean;
|
|
20
|
-
selectProductsFromCustomCollection?: boolean;
|
|
21
19
|
}
|
|
22
20
|
export declare const ProductsScreen: (props: ProductsScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
23
21
|
interface ProductGroupInterface {
|
|
@@ -31,7 +29,6 @@ interface ProductGroupInterface {
|
|
|
31
29
|
upliftAdditions: any;
|
|
32
30
|
hideProductCheckbox?: boolean;
|
|
33
31
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
34
|
-
hideVariantCheckbox?: boolean;
|
|
35
32
|
}
|
|
36
33
|
export declare const ProductGroup: (props: ProductGroupInterface) => import("react/jsx-runtime").JSX.Element;
|
|
37
34
|
interface ProductCardInterface {
|
|
@@ -47,7 +44,6 @@ interface ProductCardInterface {
|
|
|
47
44
|
upliftAdditions: any;
|
|
48
45
|
hideProductCheckbox?: boolean;
|
|
49
46
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
50
|
-
hideVariantCheckbox?: boolean;
|
|
51
47
|
}
|
|
52
48
|
export declare const ProductCard: (props: ProductCardInterface) => import("react/jsx-runtime").JSX.Element;
|
|
53
49
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as
|
|
1
|
+
import{jsxs as t,jsx as o,Fragment as e}from"react/jsx-runtime";import i from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import d from"../../assets/icons/search.svg.js";import{cloneDeep as l}from"lodash";import{useContext as n,useState as r,useEffect as s}from"react";import{Tag as a}from"../tag/Tag.js";import{COLORS as u}from"../../constants/Theme.js";import{CheckBox as p}from"../checkBox/CheckBox.js";import{IconButton as h}from"../icon-button/IconButton.js";import{Input as v}from"../input/Input.js";import{BikShimmer as m}from"../shimmer/ShimmerComponent/BikShimmer.js";import{ShimmerImage as f}from"../shimmer-image/ShimmerImage.js";import{Spinner as y}from"../spinner/Spinner.js";import{BodyCaption as g,TitleRegular as j}from"../TypographyStyle.js";import{truncate as b}from"./collectionScreen.js";import{EmptyState as k}from"./emptyState.js";import{ProductHelper as I}from"./helpers/ProductHelper.js";import{CollectionIdContext as O}from"./reducers.js";import{ProductScreenHeader as C,ProductScreenCollectionCardStyle as x,ProductCardStyle as S}from"./style.js";import{OUT_OF_STOCK_ACTION as P}from"./type.js";import{liftTheStateUp as w}from"./utility.js";const D=e=>{const a=n(O),{data:f,collectionsDispatch:b,selectedData:I,selectedCollectionsDispatch:S,productFetcher:D,storeId:A,setScreen:T,setSaveDisabled:B,hideInCollectionSearch:V,customCollectionRestriction:R,hideProductCheckbox:U,outOfStockAction:F=P.BLUR}=e,[H,L]=r(""),[W,z]=r(!1),[K,N]=r(f);s((()=>{const t=setTimeout((()=>{H.length?(z(!0),e.searchInCollectionFetcher(A,a,H).then((t=>{var o;const e=l(f);e.products={};for(const i of t)(null===(o=null==f?void 0:f.products)||void 0===o?void 0:o[i])&&(e.products[i]=f.products[i]);N(e),B(!1),z(!1)}))):N(f)}),800);return()=>clearTimeout(t)}),[H]);const _=!!R&&f.isSmartCollection,q=t=>{var o,e,i,c,d,l,n,r;let s=0,u=0;return!!((null===(e=null===(o=null==I?void 0:I[a])||void 0===o?void 0:o.products)||void 0===e?void 0:e[t])&&(null===(d=Object.keys((null===(c=null===(i=null==f?void 0:f.products)||void 0===i?void 0:i[t])||void 0===c?void 0:c.variants)||[]))||void 0===d||d.forEach((()=>u++)),Object.keys((null===(r=null===(n=null===(l=null==I?void 0:I[a])||void 0===l?void 0:l.products)||void 0===n?void 0:n[t])||void 0===r?void 0:r.variants)||[]).forEach((()=>s++)),s>0&&u!==s))};s((()=>{(null==f?void 0:f.products)||G()}),[]);const G=()=>{B(!0),z(!0),D(a,A).then((t=>{Object.keys(t).length&&(b({type:"productsFetched",data:{collectionId:a,products:t}}),N(Object.assign(Object.assign({},K),{products:t}))),B(!1),z(!1)})).catch()},J=(t,o)=>{const e=w(o,f);S({type:t,data:Object.assign(Object.assign({},e),{isRestricted:R})})};return t("div",{children:[t(C,{children:[o(h,{Icon:i,height:16,onClick:()=>{T("collections")}}),o(g,Object.assign({style:{color:u.content.secondary}},{children:f.name}))]}),!V&&o("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:o(v,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>W&&H.length?o(y,{size:"small",color:u.content.primary}):o(d,{})},id:"listInput",height:"24px",type:"text",value:H,onChangeText:t=>{t.length&&t.trim().length?L(t):L("")},placeholder:"Search products in this collection..."})})),t("div",{children:[Object.keys((null==K?void 0:K.products)||[]).length>0&&!_&&!H.length&&!U&&t(x,{children:[o(p,{isChecked:!!(null==I?void 0:I[a]),isPartiallyChecked:(t=>{var o;let e=0,i=0;if(I[t]){const c=null==f?void 0:f.products;c&&Object.keys(c).forEach((t=>{var o;const i=null===(o=c[t])||void 0===o?void 0:o.variants;i&&Object.keys(i).forEach((t=>e+=1))}));const d=null===(o=I[t])||void 0===o?void 0:o.products;return d&&Object.keys(d).forEach((t=>{var o;const e=null===(o=d[t])||void 0===o?void 0:o.variants;e&&Object.keys(e).forEach((()=>i+=1))})),i>0&&e!==i}return!1})(a),onValueChange:function(t){S(t?{type:"selected",data:{id:a,val:f}}:{type:"unselected",data:{id:a}})}}),o("div",Object.assign({style:{width:40,height:40}},{children:o(c,{})})),o(j,{children:"All Products"})]}),Object.keys((null==K?void 0:K.products)||[]).length?Object.keys(K.products||[]).map((t=>o(E,{outOfStockAction:F,collectionId:a,isProductPartiallyChecked:q(t),productId:t,data:K.products[t],selectedData:I,selectedCollectionsDispatch:S,viewOnly:!!_,upliftAdditions:J,hideProductCheckbox:U},t))):W?[1,2,3,4,5,6,7,8,9,10].map(((t,e)=>o("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:o(m,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),e))):o(k,{title:"No products to show",subtitle:H.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]})]})},E=e=>{const{collectionId:i,productId:c,data:d,selectedData:l,selectedCollectionsDispatch:n,viewOnly:r,upliftAdditions:s,isProductPartiallyChecked:a,hideProductCheckbox:u,outOfStockAction:p}=e,h=t=>{var o,e,d,n,r,s;if(!(null===(e=null===(o=null==l?void 0:l[i])||void 0===o?void 0:o.products)||void 0===e?void 0:e[c]))return!1;return!!(null===(s=null===(r=null===(n=null===(d=null==l?void 0:l[i])||void 0===d?void 0:d.products)||void 0===n?void 0:n[c])||void 0===r?void 0:r.variants)||void 0===s?void 0:s[t])};return t("div",{children:[o(A,{isVariant:!1,data:d,productId:c,collectionId:i,isSelected:!!(null===(m=null===(v=null==l?void 0:l[i])||void 0===v?void 0:v.products)||void 0===m?void 0:m[c]),isPartiallyChecked:a,selectedCollectionsDispatch:n,upliftAdditions:s,viewOnly:r,hideProductCheckbox:u},c),Object.keys(d.variants||[]).map((t=>o(A,{isVariant:!0,data:d.variants[t],variantId:t,productId:c,viewOnly:r,upliftAdditions:s,collectionId:i,isSelected:h(t),selectedCollectionsDispatch:n,outOfStockAction:p},t)))]});var v,m},A=i=>{const{isVariant:c,data:d,productId:l,collectionId:n,variantId:r,isSelected:s,selectedCollectionsDispatch:u,viewOnly:h,upliftAdditions:v,isPartiallyChecked:m,hideProductCheckbox:y,outOfStockAction:g}=i,k=I.getProductLabels(d,g);return t(S,Object.assign({isVariant:c},{children:[y||h?o(e,{}):o(p,{isChecked:s,isPartiallyChecked:m||!1,onValueChange:function(t){c?t?v("variantSelected",{productId:l,variantId:r,collectionId:n,variant:d}):u({type:"variantUnselected",data:{productId:l,variantId:r,collectionId:n}}):t?v("productSelected",{productId:l,collectionId:n,product:d}):u({type:"productUnselected",data:{productId:l,collectionId:n}})}}),o("div",{children:o(f,{width:40,height:40,imageUrl:d.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[o(j,{children:b(d.name,40,!0)}),k?o("div",Object.assign({style:{width:90,display:"flex"}},{children:o(a,{tagText:k,type:"warning",theme:"light"})})):o(e,{})]}))]}))};export{A as ProductCard,E as ProductGroup,D as ProductsScreen};
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as o from"./components/template-preview/constants/regexPatterns.js";export{o as regexPatterns};export{default as StringUtils}from"./utils/StringUtils.js";export{BASE_COLORS,COLORS,DEFAULT_THEME,FONTS}from"./constants/Theme.js";export{ComponentZindex}from"./constants/zindex.js";export{CheckBox}from"./components/checkBox/CheckBox.js";export{ListItem}from"./components/list-item/ListItem.js";export{Pagination}from"./components/pagination/Pagination.js";export{RadioButton}from"./components/radioButton/RadioButton.js";export{Toaster}from"./components/toaster/Toaster.js";export{Tooltip}from"./components/tooltips/Tooltip.js";export{Spinner}from"./components/spinner/Spinner.js";export{Stepper}from"./components/stepper/Stepper.js";export{Tag}from"./components/tag/Tag.js";export{IconButton}from"./components/icon-button/IconButton.js";export{TemplatePreview}from"./components/template-preview/TemplatePreview.js";export{WhatsappLikePreview}from"./components/template-preview/WhatsApp/WhatsAppLikePreview.js";export{WhatsappLikePreviewV2}from"./components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js";export{renderVariableUIForPreview}from"./components/template-preview/helpers/SmsTemplateHelper.js";export{WhatsAppFormatToHTML}from"./components/template-preview/helpers/WhatsAppFormatToHTML.js";export{VariableEditorHelper}from"./components/template-preview/helpers/VariableEditorHelper.js";export{ACTIONS_TYPES,CUSTOM_URL_NAME,HEADER_TYPES,TEMPLATE_EDITOR,TEMPLATE_STATUS}from"./components/template-preview/models/TemplateMeta.js";export{TemplateContextMapper}from"./components/template-context-mapper/TemplateContextMapper.js";export{getAllDataFromTemplateComponent}from"./components/template-context-mapper/utils/getDataFromTemplateComponent.js";export{validateIsUrl}from"./components/template-context-mapper/utils/validateIsUrl.js";export{FABMenu}from"./components/fab-menu/FABMenu.js";export{FloatingActionButton}from"./components/floating-action-button/FloatingActionButton.js";export{DROP_POSITION,DropdownToggleContainer,FAB_POSITION,FloatingActionButtonContainer,FloatingActionButtonOuterContainer,MENU_ALIGNMENT,StyledDropdown,TooltipStyled}from"./components/floating-action-button/FloatingActionButton.styles.js";export{ImageService}from"./components/image-compress/ImageCompress.js";export{BodyCaption,BodyLarge,BodyPrimary,BodyPrimaryLink,BodyRegular,BodySecondary,BodySecondaryLink,BodyTiny,ButtonLarge,ButtonRegular,Caption,Display,SmallRegular,SubHeading,TitleLarge,TitleMedium,TitleRegular,TitleSmall}from"./components/TypographyStyle.js";export{Button}from"./components/button/Button.js";export{ProgressBarComponent,ProgressCompletedBar}from"./components/progress-bar/ProgressBarComponent.js";export{QueryBuilder}from"./components/QueryBuilder/QueryBuilder.js";export{BaseQueryBuilderNode}from"./components/QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.js";export{PropertyNode,PropertyNodeHeadless}from"./components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js";export{queryBuilderSlice}from"./components/QueryBuilder/redux/queryBuilder.reducer.js";export{queryBuilderCacheSlice}from"./components/QueryBuilder/redux/queryBuilderCache.reducer.js";export{AD_STRING_OPERATORS,ANY_AD_OPERATORS,ANY_IG_OPERATORS,BOOLEAN_OPERATORS,DATE_OPERATORS,EVENT_VALUES,EXACTLY_OPERATORS,FREQUENCY_OPERATORS,ICE_BREAKER_OPERATORS,IG_STRING_OPERATORS,INTEGER_OPERATORS,MAIL_SUBJECT_OPERATORS,REACTION_OPERATORS,SPECIFIC_IG_OPERATORS,STRING_OPERATORS,STRING_RESTRICTED_OPERATORS,STRING_RESTRICTED_OPERATORS_2,STRING_RESTRICTED_OPERATORS_3}from"./components/QueryBuilder/types/QueryBuilderOperator.type.js";export{StyledModal}from"./components/modals/styledModal.js";export{DropdownPopover}from"./components/dropdown/DropdownPopover/index.js";export{Dropdown}from"./components/dropdown/Dropdown.js";export{ChipDropdown}from"./components/dropdown/ChipDropdown.js";export{OpenedDropdown}from"./components/dropdown/OpenedDropdown/components/OpennedDropdown.js";export{MenuItemDropdown}from"./components/dropdown/MenuItem/MenuItem.js";export{AnalyticsCard}from"./components/analytics-card/AnalyticsCard.js";export{AnalyticsContainer,CardDataContainer}from"./components/analytics-card/AnalyticsCard.styled.js";export{Input}from"./components/input/Input.js";export{AnalyticsChip}from"./components/analytics-chips-and-dropdowns/AnalyticsChip.js";export{AnalyticsDropdown,EachItem,formatDate}from"./components/analytics-chips-and-dropdowns/AnalyticsDropdown.js";export{AnalyticsMultiChip}from"./components/analytics-chips-and-dropdowns/AnalyticsMultiChip.js";export{AnalyticsMetric}from"./components/analytics-chips-and-dropdowns/AnalyticsMetric.js";export{AnalyticsTrend}from"./components/analytics-chips-and-dropdowns/AnalyticsTrend.js";export{LineChart}from"./components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js";export{LinearChipGroupedChart}from"./components/analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.js";export{Card,PieChartAnalytics}from"./components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js";export{PieChart}from"./components/analytics-chips-and-dropdowns/chart/Pie/PieChart.js";export{HorizontalGraph}from"./components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js";export{StackedBarChart}from"./components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js";export{VerticalGraph}from"./components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";export{HEAT,HEAT_COLORS,HEAT_GRADING_TYPE,HeatMap}from"./components/analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js";export{VerticalBarAndLinearGraph}from"./components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";export{AVATAR_SIZE_VS_ICON_SIZE_MAP,Avatar,BACKGROUND_VS_TEXT_COLOR_MAP}from"./components/avatar/Avatar.js";export{AVATAR_BACKGROUND,AVATAR_SIZE_MAP,AVATAR_TYPES,SIZE}from"./components/avatar/AvatarHelper.js";export{Alert}from"./components/alerts/Alert.js";export{ALERT_TYPES,COLOR_CONFIG_MAP}from"./components/alerts/AlertHelper.js";export{RATIO,Thumbnail}from"./components/thumbnail/Thumbnail.js";export{Curtain}from"./components/curtain/Curtain.js";export{DatePicker}from"./components/datePicker/DatePicker.js";export{Loader,Switch,SwitchContainer,Thumb}from"./components/switch/Switch.js";export{SubscriptionPlan}from"./components/plans/SubscriptionPlan.js";export{BottomWrapper,HeaderWrapper,SubscriptionPlanSelector,defaultTabs}from"./components/plans/SubscriptionPlanSelector.js";export{TabItemComponent,Tabs}from"./components/tabs/Tabs.js";export{DynamicTabs}from"./components/dynamic-tabs/DynamicTabs.js";export{BikShimmer}from"./components/shimmer/ShimmerComponent/BikShimmer.js";export{TablePagination}from"./components/TablePagination/TablePagination.js";export{TablePaginationCard,TablePaginationCardStyled}from"./components/TablePagination/TablePaginationCard.js";export{StateModalComponent}from"./components/states-modal/StateModalComponent.js";export{DeleteConfirmationModal}from"./components/states-modal/DeleteConfirmationModal.js";export{ButtonActions,ButtonTypes,StateComponent,StateInterface}from"./components/states/StateComponent.js";export{ShopifyScopeWrapper}from"./components/states/ShopifyScopeWrapper.js";export{WhatsAppTextEditor}from"./components/WhatsAppTextEditor/WhatsAppTextEditor.js";export{EditorActionTypes,WhatsAppTextEditorHeader}from"./components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js";export{BaseWhatsappContentLangHelper}from"./helpers/BaseWhatsappContentLang.helper.js";export{CardSelectionModal}from"./components/card-selection-modal/CardSelectionModal.js";export{BikImageCropper}from"./components/image-cropper/BikImageCropper.js";export{BikImagePipeline}from"./components/image-cropper/BikImagePipeline/BikImagePipeline.js";export{ButtonGroup}from"./components/buttonGroup/ButtonGroup.js";export{BikAccordion}from"./components/accordion/Accordion.js";export{FileUploader}from"./components/file-uploader/FileUploader.js";export{ColourInput}from"./components/colourInput/ColourInput.js";export{BikHeader}from"./components/bik-layout/BikHeader.js";export{BikLayout}from"./components/bik-layout/BikLayout.js";export{BikProfile}from"./components/bik-layout/BikProfile.js";export{SimpleSidebar}from"./components/bik-layout/SimpleSidebar.js";export{BikSidebar}from"./components/bik-layout/BikSidebar.js";export{FeatureModal}from"./components/bik-layout/FeatureModal.js";export{SidebarSkeleton}from"./components/bik-layout/SidebarSkeleton.js";export{ShowShopifyRestrictedModal}from"./components/bik-layout/ShowShopifyRestrictedModal.js";export{SearchBar}from"./components/searchBar/searchBar.js";export{CustomDateTime}from"./components/custom-date-time/CustomDateTime.js";export{PricePleaseProductPicker,ProductPickerContent}from"./components/product-picker/ProductPickerModal.js";export{DiscountModal}from"./components/discount-modal/DiscountModal.js";export{COUPON_EXPIRATION,CouponExpiration}from"./components/discount-modal/CouponExpiration/CouponExpiration.js";export{DISCOUNT_TARGET_SELECTION,DISCOUNT_TARGET_TYPES,DISCOUNT_TYPES,DISCOUNT_VALUE_TYPES,MIN_PURCHASE_REQUIREMENT}from"./components/discount-modal/type.js";export{CountryCodePicker}from"./components/country-code-picker/CountryCodePicker.js";export{CountriesData}from"./components/country-code-picker/CountryCodePicker.modal.js";export{ShimmerImage}from"./components/shimmer-image/ShimmerImage.js";export{ProductPickerModal}from"./components/product-picker-v2/modal.js";export{Carousel}from"./components/carousel/carousel.js";export{CarouselSecondary}from"./components/carousel-secondary/CarouselSecondary.js";export{AccessTokenTroubleshootDialog}from"./components/access-token-troubleshoot-dialog/AccessTokenTroubleshootDialog.js";export{RadioList}from"./components/radioList/RadioList.js";export{CheckList}from"./components/checkList/CheckList.js";export{DateKeys,MEDIA_TYPES,PostPicker,dateOptions}from"./components/postPicker/postPicker.js";export{DropdownButton}from"./components/dropdown-button/DropdownButton.js";export{SideModal}from"./components/side-modal/SideModal.js";export{KeywordsInput}from"./components/keywords-input/KeywordsInput.js";export{AddVariableV2SideModal}from"./components/add-variableV2/AddVariableV2SideModal.js";export{AddVariableV2}from"./components/add-variableV2/AddVariableV2.js";export{NaLinkWrapper,NavigationHyperlink}from"./components/navigation-hyperlink/NavigationHyperlink.js";export{SearchFilter}from"./components/SearchFilter/index.js";export{InputWithVariables}from"./components/input-with-vars/InputWithVariables.js";export{DashboardReviewPopUp}from"./components/dashboard-review-popup/DashboardReviewPopUp.js";export{StarRating}from"./components/star-rating/StarRating.js";
|
|
1
|
+
import*as o from"./components/template-preview/constants/regexPatterns.js";export{o as regexPatterns};export{default as StringUtils}from"./utils/StringUtils.js";export{BASE_COLORS,COLORS,DEFAULT_THEME,FONTS}from"./constants/Theme.js";export{ComponentZindex}from"./constants/zindex.js";export{CheckBox}from"./components/checkBox/CheckBox.js";export{ListItem}from"./components/list-item/ListItem.js";export{Pagination}from"./components/pagination/Pagination.js";export{RadioButton}from"./components/radioButton/RadioButton.js";export{Toaster}from"./components/toaster/Toaster.js";export{Tooltip}from"./components/tooltips/Tooltip.js";export{Spinner}from"./components/spinner/Spinner.js";export{Stepper}from"./components/stepper/Stepper.js";export{Tag}from"./components/tag/Tag.js";export{IconButton}from"./components/icon-button/IconButton.js";export{TemplatePreview}from"./components/template-preview/TemplatePreview.js";export{WhatsappLikePreview}from"./components/template-preview/WhatsApp/WhatsAppLikePreview.js";export{WhatsappLikePreviewV2}from"./components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js";export{renderVariableUIForPreview}from"./components/template-preview/helpers/SmsTemplateHelper.js";export{WhatsAppFormatToHTML}from"./components/template-preview/helpers/WhatsAppFormatToHTML.js";export{VariableEditorHelper}from"./components/template-preview/helpers/VariableEditorHelper.js";export{ACTIONS_TYPES,CUSTOM_URL_NAME,HEADER_TYPES,TEMPLATE_EDITOR,TEMPLATE_STATUS}from"./components/template-preview/models/TemplateMeta.js";export{TemplateContextMapper}from"./components/template-context-mapper/TemplateContextMapper.js";export{getAllDataFromTemplateComponent}from"./components/template-context-mapper/utils/getDataFromTemplateComponent.js";export{validateIsUrl}from"./components/template-context-mapper/utils/validateIsUrl.js";export{FABMenu}from"./components/fab-menu/FABMenu.js";export{FloatingActionButton}from"./components/floating-action-button/FloatingActionButton.js";export{DROP_POSITION,DropdownToggleContainer,FAB_POSITION,FloatingActionButtonContainer,FloatingActionButtonOuterContainer,MENU_ALIGNMENT,StyledDropdown,TooltipStyled}from"./components/floating-action-button/FloatingActionButton.styles.js";export{ImageService}from"./components/image-compress/ImageCompress.js";export{BodyCaption,BodyLarge,BodyPrimary,BodyPrimaryLink,BodyRegular,BodySecondary,BodySecondaryLink,BodyTiny,ButtonLarge,ButtonRegular,Caption,Display,SmallRegular,SubHeading,TitleLarge,TitleMedium,TitleRegular,TitleSmall}from"./components/TypographyStyle.js";export{Button}from"./components/button/Button.js";export{ProgressBarComponent,ProgressCompletedBar}from"./components/progress-bar/ProgressBarComponent.js";export{QueryBuilder}from"./components/QueryBuilder/QueryBuilder.js";export{BaseQueryBuilderNode}from"./components/QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.js";export{PropertyNode,PropertyNodeHeadless}from"./components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js";export{queryBuilderSlice}from"./components/QueryBuilder/redux/queryBuilder.reducer.js";export{queryBuilderCacheSlice}from"./components/QueryBuilder/redux/queryBuilderCache.reducer.js";export{AD_STRING_OPERATORS,ANY_AD_OPERATORS,ANY_IG_OPERATORS,BOOLEAN_OPERATORS,DATE_OPERATORS,EVENT_VALUES,EXACTLY_OPERATORS,FREQUENCY_OPERATORS,ICE_BREAKER_OPERATORS,IG_STRING_OPERATORS,INTEGER_OPERATORS,MAIL_SUBJECT_OPERATORS,REACTION_OPERATORS,SPECIFIC_IG_OPERATORS,STRING_OPERATORS,STRING_RESTRICTED_OPERATORS,STRING_RESTRICTED_OPERATORS_2,STRING_RESTRICTED_OPERATORS_3}from"./components/QueryBuilder/types/QueryBuilderOperator.type.js";export{StyledModal}from"./components/modals/styledModal.js";export{DropdownPopover}from"./components/dropdown/DropdownPopover/index.js";export{Dropdown}from"./components/dropdown/Dropdown.js";export{ChipDropdown}from"./components/dropdown/ChipDropdown.js";export{OpenedDropdown}from"./components/dropdown/OpenedDropdown/components/OpennedDropdown.js";export{MenuItemDropdown}from"./components/dropdown/MenuItem/MenuItem.js";export{AnalyticsCard}from"./components/analytics-card/AnalyticsCard.js";export{AnalyticsContainer,CardDataContainer}from"./components/analytics-card/AnalyticsCard.styled.js";export{Input}from"./components/input/Input.js";export{AnalyticsChip}from"./components/analytics-chips-and-dropdowns/AnalyticsChip.js";export{AnalyticsDropdown,EachItem,formatDate}from"./components/analytics-chips-and-dropdowns/AnalyticsDropdown.js";export{AnalyticsMultiChip}from"./components/analytics-chips-and-dropdowns/AnalyticsMultiChip.js";export{AnalyticsMetric}from"./components/analytics-chips-and-dropdowns/AnalyticsMetric.js";export{AnalyticsTrend}from"./components/analytics-chips-and-dropdowns/AnalyticsTrend.js";export{LineChart}from"./components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js";export{LinearChipGroupedChart}from"./components/analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.js";export{Card,PieChartAnalytics}from"./components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js";export{PieChart}from"./components/analytics-chips-and-dropdowns/chart/Pie/PieChart.js";export{HorizontalGraph}from"./components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js";export{StackedBarChart}from"./components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js";export{VerticalGraph}from"./components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";export{HEAT,HEAT_COLORS,HEAT_GRADING_TYPE,HeatMap}from"./components/analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js";export{VerticalBarAndLinearGraph}from"./components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";export{AVATAR_SIZE_VS_ICON_SIZE_MAP,Avatar,BACKGROUND_VS_TEXT_COLOR_MAP}from"./components/avatar/Avatar.js";export{AVATAR_BACKGROUND,AVATAR_SIZE_MAP,AVATAR_TYPES,SIZE}from"./components/avatar/AvatarHelper.js";export{Alert}from"./components/alerts/Alert.js";export{ALERT_TYPES,COLOR_CONFIG_MAP}from"./components/alerts/AlertHelper.js";export{RATIO,Thumbnail}from"./components/thumbnail/Thumbnail.js";export{Curtain}from"./components/curtain/Curtain.js";export{DatePicker}from"./components/datePicker/DatePicker.js";export{Loader,Switch,SwitchContainer,Thumb}from"./components/switch/Switch.js";export{SubscriptionPlan}from"./components/plans/SubscriptionPlan.js";export{BottomWrapper,HeaderWrapper,SubscriptionPlanSelector,defaultTabs}from"./components/plans/SubscriptionPlanSelector.js";export{TabItemComponent,Tabs}from"./components/tabs/Tabs.js";export{DynamicTabs}from"./components/dynamic-tabs/DynamicTabs.js";export{BikShimmer}from"./components/shimmer/ShimmerComponent/BikShimmer.js";export{TablePagination}from"./components/TablePagination/TablePagination.js";export{TablePaginationCard,TablePaginationCardStyled}from"./components/TablePagination/TablePaginationCard.js";export{StateModalComponent}from"./components/states-modal/StateModalComponent.js";export{DeleteConfirmationModal}from"./components/states-modal/DeleteConfirmationModal.js";export{ButtonActions,ButtonTypes,StateComponent,StateInterface}from"./components/states/StateComponent.js";export{ShopifyScopeWrapper}from"./components/states/ShopifyScopeWrapper.js";export{WhatsAppTextEditor}from"./components/WhatsAppTextEditor/WhatsAppTextEditor.js";export{EditorActionTypes,WhatsAppTextEditorHeader}from"./components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js";export{BaseWhatsappContentLangHelper}from"./helpers/BaseWhatsappContentLang.helper.js";export{CardSelectionModal}from"./components/card-selection-modal/CardSelectionModal.js";export{BikImageCropper}from"./components/image-cropper/BikImageCropper.js";export{BikImagePipeline}from"./components/image-cropper/BikImagePipeline/BikImagePipeline.js";export{ButtonGroup}from"./components/buttonGroup/ButtonGroup.js";export{BikAccordion}from"./components/accordion/Accordion.js";export{FileUploader}from"./components/file-uploader/FileUploader.js";export{ColourInput}from"./components/colourInput/ColourInput.js";export{BikHeader}from"./components/bik-layout/BikHeader.js";export{BikLayout}from"./components/bik-layout/BikLayout.js";export{BikProfile}from"./components/bik-layout/BikProfile.js";export{SimpleSidebar}from"./components/bik-layout/SimpleSidebar.js";export{BikSidebar}from"./components/bik-layout/BikSidebar.js";export{FeatureModal}from"./components/bik-layout/FeatureModal.js";export{SidebarSkeleton}from"./components/bik-layout/SidebarSkeleton.js";export{RelativeModal}from"./components/bik-layout/RelativeModal.js";export{SearchBar}from"./components/searchBar/searchBar.js";export{CustomDateTime}from"./components/custom-date-time/CustomDateTime.js";export{PricePleaseProductPicker,ProductPickerContent}from"./components/product-picker/ProductPickerModal.js";export{DiscountModal}from"./components/discount-modal/DiscountModal.js";export{COUPON_EXPIRATION,CouponExpiration}from"./components/discount-modal/CouponExpiration/CouponExpiration.js";export{DISCOUNT_TARGET_SELECTION,DISCOUNT_TARGET_TYPES,DISCOUNT_TYPES,DISCOUNT_VALUE_TYPES,MIN_PURCHASE_REQUIREMENT}from"./components/discount-modal/type.js";export{CountryCodePicker}from"./components/country-code-picker/CountryCodePicker.js";export{CountriesData}from"./components/country-code-picker/CountryCodePicker.modal.js";export{ShimmerImage}from"./components/shimmer-image/ShimmerImage.js";export{ProductPickerModal}from"./components/product-picker-v2/modal.js";export{Carousel}from"./components/carousel/carousel.js";export{CarouselSecondary}from"./components/carousel-secondary/CarouselSecondary.js";export{AccessTokenTroubleshootDialog}from"./components/access-token-troubleshoot-dialog/AccessTokenTroubleshootDialog.js";export{RadioList}from"./components/radioList/RadioList.js";export{CheckList}from"./components/checkList/CheckList.js";export{DateKeys,MEDIA_TYPES,PostPicker,dateOptions}from"./components/postPicker/postPicker.js";export{DropdownButton}from"./components/dropdown-button/DropdownButton.js";export{SideModal}from"./components/side-modal/SideModal.js";export{KeywordsInput}from"./components/keywords-input/KeywordsInput.js";export{AddVariableV2SideModal}from"./components/add-variableV2/AddVariableV2SideModal.js";export{AddVariableV2}from"./components/add-variableV2/AddVariableV2.js";export{NaLinkWrapper,NavigationHyperlink}from"./components/navigation-hyperlink/NavigationHyperlink.js";export{SearchFilter}from"./components/SearchFilter/index.js";export{InputWithVariables}from"./components/input-with-vars/InputWithVariables.js";export{DashboardReviewPopUp}from"./components/dashboard-review-popup/DashboardReviewPopUp.js";export{StarRating}from"./components/star-rating/StarRating.js";
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react-dom"),o=require("../../constants/Theme.js"),s=require("../../assets/icons/cross.svg.js"),i=require("../button/Button.js"),n=require("../TypographyStyle.js"),a=require("./CommonStyles.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=r(t);exports.ShowShopifyRestrictedModal=t=>{const{zIndex:r,containerType:l,handleButtonClick:d,triggerPosition:u}=t,h=e=>{d(e)},m=u&&window.innerHeight-u.top<100,j=u?{position:"fixed",top:m?"auto":u.top,bottom:m?"0":"auto",left:u.left,width:"unset",background:"none"}:{alignItems:"center",height:950};return c.default.createPortal(e.jsx(a.FeatureModalContainer,Object.assign({zIndex:r,resetHeight:!0,style:j,relativePostion:!!u},{children:e.jsxs(a.RelativeModalContainer,{children:[e.jsx("div",Object.assign({className:"cross-container",onClick:()=>h("close"),"aria-hidden":"true"},{children:e.jsx(s.default,{height:24,width:24,color:"#000000"})})),"demo_store"==l?e.jsxs("div",Object.assign({className:"demo-container"},{children:[e.jsx(n.TitleMedium,Object.assign({color:o.COLORS.background.negative.vibrant},{children:"Demo Store Limitations"})),e.jsx(n.BodyPrimary,{children:"Apologies, but you are unable to save or take any actions as you are currently in the demo store."})]})):e.jsxs("div",Object.assign({className:"content-layout"},{children:[e.jsx("div",Object.assign({className:"left-content"},{children:e.jsx("img",{src:"https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F6300e18e-16ef-4f65-9861-26476d2a3d9a?alt=media&token=0da9e429-4c12-4a06-bba8-9ac7c3fdd2c4",alt:"left-panel"})})),e.jsxs("div",Object.assign({className:"right-content"},{children:[e.jsx(n.TitleMedium,{children:"Connect Shopify "}),e.jsx(n.BodyPrimary,Object.assign({style:{maxWidth:432}},{children:"Connect Shopify to publish your bot on your Shopify store. Or, explore our demo store to see it in action."})),e.jsxs("div",Object.assign({className:"cta-button-container"},{children:[e.jsx(i.Button,{buttonText:"Connect shopify",buttonType:"primary",size:"small",onClick:()=>h("shopify")}),e.jsx(i.Button,{buttonText:"View demo store",buttonType:"secondary",size:"small",onClick:()=>h("demo")})]}))]}))]}))]})})),document.body)};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"react-dom";import{COLORS as i}from"../../constants/Theme.js";import n from"../../assets/icons/cross.svg.js";import{Button as s}from"../button/Button.js";import{TitleMedium as a,BodyPrimary as r}from"../TypographyStyle.js";import{FeatureModalContainer as c,RelativeModalContainer as l}from"./CommonStyles.js";const d=d=>{const{zIndex:m,containerType:h,handleButtonClick:p,triggerPosition:b}=d,g=e=>{p(e)},u=b&&window.innerHeight-b.top<100,y=b?{position:"fixed",top:u?"auto":b.top,bottom:u?"0":"auto",left:b.left,width:"unset",background:"none"}:{alignItems:"center",height:950};return o.createPortal(e(c,Object.assign({zIndex:m,resetHeight:!0,style:y,relativePostion:!!b},{children:t(l,{children:[e("div",Object.assign({className:"cross-container",onClick:()=>g("close"),"aria-hidden":"true"},{children:e(n,{height:24,width:24,color:"#000000"})})),t("div","demo_store"==h?Object.assign({className:"demo-container"},{children:[e(a,Object.assign({color:i.background.negative.vibrant},{children:"Demo Store Limitations"})),e(r,{children:"Apologies, but you are unable to save or take any actions as you are currently in the demo store."})]}):Object.assign({className:"content-layout"},{children:[e("div",Object.assign({className:"left-content"},{children:e("img",{src:"https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F6300e18e-16ef-4f65-9861-26476d2a3d9a?alt=media&token=0da9e429-4c12-4a06-bba8-9ac7c3fdd2c4",alt:"left-panel"})})),t("div",Object.assign({className:"right-content"},{children:[e(a,{children:"Connect Shopify "}),e(r,Object.assign({style:{maxWidth:432}},{children:"Connect Shopify to publish your bot on your Shopify store. Or, explore our demo store to see it in action."})),t("div",Object.assign({className:"cta-button-container"},{children:[e(s,{buttonText:"Connect shopify",buttonType:"primary",size:"small",onClick:()=>g("shopify")}),e(s,{buttonText:"View demo store",buttonType:"secondary",size:"small",onClick:()=>g("demo")})]}))]}))]}))]})})),document.body)};export{d as ShowShopifyRestrictedModal};
|