@bikdotai/bik-component-library 0.0.732 → 0.0.733-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default EventsTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default IGTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
3
+ import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
4
+ import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
5
5
  declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
6
6
  cacheKey: string;
7
7
  propertyAddBtnText: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth/models/bik-store"),o=require("../../assets/icons/search.svg.js"),s=require("react"),r=require("../../constants/Theme.js"),c=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),i=require("../input/Input.js"),l=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),p=require("./productInfoOverlay.js"),x=require("./productScreen.js"),h=require("./rearrangeScreen.js"),j=require("./reducers.js"),m=require("./searchScreen.js"),S=require("./selectedScreen.js"),C=require("./style.js"),g=require("./type.js"),y=require("./utility.js");exports.ProductPickerModal=R=>{const{storeId:b,selectedItems:f,onClose:E,visible:v,zIndex:k,exactLimit:I,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:P,outOfStockAction:T=g.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,hideSelectionCount:N,title:L,width:A,left:B,renderWithoutModal:w,onClickSave:$,pickerType:M,hideProductVariants:V=!1,startupScreen:z=g.ScreenName.Collections,rearrangeEnabled:_,selectSingleItem:H=!1,showProductDetails:K,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:U={},primaryButton:Y,secondaryButton:J,subtitle:Q}=R,X=R.appType||t.ApplicationType.BIK,[Z,ee]=s.useReducer(j.collectionsReducer,{}),[te,oe]=s.useState([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes(z)?z:g.ScreenName.Collections),[se,re]=s.useState("grid"),[ce,ne]=s.useState(""),[ie,le]=s.useState(""),[ae,de]=s.useState(0),[ue,pe]=s.useState(!1),[xe,he]=s.useState(0),[je,me]=s.useState(""),[Se,Ce]=s.useState(!1),[ge,ye]=s.useState(!1),[Re,be]=s.useReducer(j.searchReducer,{collections:{},products:{}}),[fe,Ee]=s.useReducer(j.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ve=s.useRef(null),[ke,Ie]=s.useState(!1),[Oe,Fe]=s.useState();s.useEffect((()=>{pe(!0),ye(!0),R.collectionFetcher(ae,b,X).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),pe(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),s.useEffect((()=>{let e=0;"COLLECTION"===M?e=Object.keys(fe||{}).filter((e=>"isCustom"!==e)).length:V?Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s;"-1"!==t&&fe[-1]&&(null===(s=fe[-1].products)||void 0===s?void 0:s[o])||(e+=1)}))})):Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s,r;Object.keys((null===(r=null===(s=fe[t].products)||void 0===s?void 0:s[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Z,fe,V,M]),s.useEffect((()=>{ie&&(pe(!0),R.productFetcher(ie,b,X).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),pe(!1)})).catch())}),[ie]),s.useEffect((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(je.length||"collections"!==te)&&(je.length?(Ce(!0),R.searchFetcher(b,je,X).then((e=>{"collections"in e&&"products"in e?(be({type:"set",data:e}),ee({type:"searched",data:e.collections}),ee({type:"searched",data:e.products})):(be({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),pe(!1),Ce(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[je]),s.useEffect((()=>{$&&(R.onAdd(fe,xe),Pe())}),[$]),s.useEffect((()=>{H&&Object.keys(fe||{}).length&&xe&&(R.onAdd(fe,xe),Pe())}),[H,fe,xe]);const Pe=()=>{Ee({type:"reset",data:{}})},Te=()=>{let t,o;return"COLLECTION"===M?(t="collection",o="collections"):V?(t="product",o="products"):(t="variant",o="variants"),I&&xe>I?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${I} ${1===I?t:o}`,type:"negative"}):O&&xe>O?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${O} ${1===O?t:o}`,type:"negative"}):xe>0?e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>{oe(_?g.ScreenName.RearrangeProducts:g.ScreenName.SelectedProducts)},buttonText:I?`${xe}/${I} ${1===xe?t:o} selected`:`${xe} ${1===xe?t:o} selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}):e.jsxRuntimeExports.jsx(n.Button,{disabled:!0,buttonText:I?`${xe}/${I} ${1===I?t:o} selected`:`${xe} ${1===xe?t:o} selected`,buttonType:"tertiaryGray"})},De=e=>ue?"Loading...":te===g.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",qe=e.jsxRuntimeExports.jsxs(C.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[R.postHeader&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:R.postHeader})),!R.hideGlobalSearch&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:("collections"===te||"searchProducts"===te)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:w?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsxRuntimeExports.jsx(i.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Se?e.jsxRuntimeExports.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):e.jsxRuntimeExports.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:je,onChangeText:e=>{e.length&&e.trim().length?me(e):me("")}})}))}),e.jsxRuntimeExports.jsxs(C.ScrollContainerStyle,Object.assign({ref:ve,screenName:te},{children:["collections"===te&&e.jsxRuntimeExports.jsx(u.CollectionsScreen,{customCollectionRestriction:R.customCollectionRestriction,dataLoading:ge,collections:Z,selectedCollectionsDispatch:Ee,setCollectionId:ne,setSelectedCollectionId:le,setScreen:oe,selectedCollections:fe,collectionFetcher:R.collectionFetcher,storeId:b,appType:X,collectionsDispatch:ee,setSaveDisabled:pe,pagingControls:{curPage:ae,setCurPage:de},hideCollectionCheckbox:F,renderWithoutModal:w,pickerType:M,scrollContainerRef:ve,limit:O,exactLimit:I}),"products"===te&&ce&&e.jsxRuntimeExports.jsx(j.CollectionIdContext.Provider,Object.assign({value:ce},{children:e.jsxRuntimeExports.jsx(x.ProductsScreen,{hideInCollectionSearch:R.hideInCollectionSearch,customCollectionRestriction:R.customCollectionRestriction,productFetcher:R.productFetcher,setScreen:oe,storeId:b,appType:X,data:Z[ce],collectionsDispatch:ee,selectedCollectionsDispatch:Ee,selectedData:fe,setSaveDisabled:pe,searchInCollectionFetcher:R.searchInCollectionFetcher,hideProductCheckbox:P,outOfStockAction:T,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,renderWithoutModal:w,pickerType:M,hideProductVariants:V,fbStatusFetcher:R.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Fe(e)},showProductDetailInfoIcon:K,scrollContainerRef:ve})})),"view"===te&&e.jsxRuntimeExports.jsx(S.SelectedScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,hideProductVariants:V,outOfStockAction:T,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"rearrange"===te&&e.jsxRuntimeExports.jsx(h.RearrangeScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,outOfStockAction:T,rearrangeViewType:"grid"===se?"list":"grid",scrollContainerRef:ve,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"searchProducts"===te&&e.jsxRuntimeExports.jsx(m.SearchScreen,{customCollectionRestriction:R.customCollectionRestriction,selectedCollections:fe||{},searchedCollections:Re||{},searchedCollectionsDispatch:be,selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,onBackPress:()=>{me(""),be({type:"set",data:{collections:{},products:{}}})},pickerType:M,hideProductCheckbox:P,hideProductVariants:V,hideVariantCheckbox:D,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:ne,setSelectedCollectionId:le,renderWithoutModal:w,hideCollectionCheckbox:F,outOfStockAction:T,limit:O,exactLimit:I})]}))]}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:w?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[qe,U.renderFooter?e.jsxRuntimeExports.jsxs(C.StyledFooterForNonModal,{children:[Te(),e.jsxRuntimeExports.jsx(n.Button,{buttonText:De(U.primaryButtonText),disabled:!U.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||U.primaryButtonDisabled,isLoading:U.isLoading,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes(z)?z:g.ScreenName.Collections)}})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),ke&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,outOfStockAction:T,useDynamicInfoImageSize:R.useDynamicInfoImageSize,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}):e.jsxRuntimeExports.jsxs(l.StyledModal,Object.assign({zIndex:k,open:v,onClose:()=>{null==E||E(),Pe()},headingTitle:L||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),headingSubtitle:Q,footerShadow:!0,centralContainerStyles:{width:A||"600px",left:B||"auto"},headerRightCustomElement:G?e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:E},{children:e.jsxRuntimeExports.jsx(c.default,{width:20,height:20,color:r.COLORS.content.secondary})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),footerContainerStyle:R.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:Y?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||e.disabled,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes(z)?z:g.ScreenName.Collections)}}))(Y):{buttonText:De(),disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{R.onAdd(fe,xe),Pe()}},secondaryButton:J?(e=>Object.assign(Object.assign({},e),{disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{const e=y.updateAllVariantsForSelectedProducts(fe,Z,Re);R.onAdd(e,xe,!0)}}))(J):void 0,wrapperStyle:R.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):Te(),hideCrossButton:ke||G},{children:[qe,ke&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}))})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth/models/bik-store"),o=require("../../assets/icons/search.svg.js"),s=require("react"),r=require("../../constants/Theme.js"),c=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),i=require("../input/Input.js"),l=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),p=require("./productInfoOverlay.js"),x=require("./productScreen.js"),h=require("./rearrangeScreen.js"),j=require("./reducers.js"),m=require("./searchScreen.js"),S=require("./selectedScreen.js"),C=require("./style.js"),g=require("./type.js"),y=require("./utility.js");exports.ProductPickerModal=R=>{const{storeId:b,selectedItems:f,onClose:E,visible:v,zIndex:k,exactLimit:I,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:P,outOfStockAction:T=g.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,hideSelectionCount:N,title:L,width:A,left:B,renderWithoutModal:w,onClickSave:$,pickerType:M,hideProductVariants:V=!1,startupScreen:z=g.ScreenName.Collections,rearrangeEnabled:_,selectSingleItem:H=!1,showProductDetails:K,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:U={},primaryButton:Y,secondaryButton:J,subtitle:Q}=R,X=R.appType||t.ApplicationType.BIK,[Z,ee]=s.useReducer(j.collectionsReducer,{}),[te,oe]=s.useState([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes(z)?z:g.ScreenName.Collections),[se,re]=s.useState("grid"),[ce,ne]=s.useState(""),[ie,le]=s.useState(""),[ae,de]=s.useState(0),[ue,pe]=s.useState(!1),[xe,he]=s.useState(0),[je,me]=s.useState(""),[Se,Ce]=s.useState(!1),[ge,ye]=s.useState(!1),[Re,be]=s.useReducer(j.searchReducer,{collections:{},products:{}}),[fe,Ee]=s.useReducer(j.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ve=s.useRef(null),[ke,Ie]=s.useState(!1),[Oe,Fe]=s.useState();s.useEffect((()=>{pe(!0),ye(!0),R.collectionFetcher(ae,b,X).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),pe(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),s.useEffect((()=>{let e=0;"COLLECTION"===M?e=Object.keys(fe||{}).filter((e=>"isCustom"!==e)).length:V?Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s;"-1"!==t&&fe[-1]&&(null===(s=fe[-1].products)||void 0===s?void 0:s[o])||(e+=1)}))})):Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s,r;Object.keys((null===(r=null===(s=fe[t].products)||void 0===s?void 0:s[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Z,fe,V,M]),s.useEffect((()=>{ie&&(pe(!0),R.productFetcher(ie,b,X).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),pe(!1)})).catch())}),[ie]),s.useEffect((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(je.length||"collections"!==te)&&(je.length?(Ce(!0),R.searchFetcher(b,je,X).then((e=>{"collections"in e&&"products"in e?(be({type:"set",data:e}),ee({type:"searched",data:e.collections}),ee({type:"searched",data:e.products})):(be({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),pe(!1),Ce(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[je]),s.useEffect((()=>{$&&(R.onAdd(fe,xe),Pe())}),[$]),s.useEffect((()=>{H&&Object.keys(fe||{}).length&&xe&&(R.onAdd(fe,xe),Pe())}),[H,fe,xe]);const Pe=()=>{Ee({type:"reset",data:{}})},Te=()=>{let t,o;return"COLLECTION"===M?(t="collection",o="collections"):V?(t="product",o="products"):(t="variant",o="variants"),I&&xe>I?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${I} ${1===I?t:o}`,type:"negative"}):O&&xe>O?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${O} ${1===O?t:o}`,type:"negative"}):xe>0?e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>{oe(_?g.ScreenName.RearrangeProducts:g.ScreenName.SelectedProducts)},buttonText:I?`${xe}/${I} ${1===xe?t:o} selected`:`${xe} ${1===xe?t:o} selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}):e.jsxRuntimeExports.jsx(n.Button,{disabled:!0,buttonText:I?`${xe}/${I} ${1===I?t:o} selected`:`${xe} ${1===xe?t:o} selected`,buttonType:"tertiaryGray"})},De=e=>ue?"Loading...":te===g.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",qe=e.jsxRuntimeExports.jsxs(C.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[R.postHeader&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:R.postHeader})),!R.hideGlobalSearch&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:("collections"===te||"searchProducts"===te)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:w?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsxRuntimeExports.jsx(i.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Se?e.jsxRuntimeExports.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):e.jsxRuntimeExports.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:je,onChangeText:e=>{e.length&&e.trim().length?me(e):me("")}})}))}),e.jsxRuntimeExports.jsxs(C.ScrollContainerStyle,Object.assign({ref:ve,screenName:te},{children:["collections"===te&&e.jsxRuntimeExports.jsx(u.CollectionsScreen,{customCollectionRestriction:R.customCollectionRestriction,dataLoading:ge,collections:Z,selectedCollectionsDispatch:Ee,setCollectionId:ne,setSelectedCollectionId:le,setScreen:oe,selectedCollections:fe,collectionFetcher:R.collectionFetcher,storeId:b,appType:X,collectionsDispatch:ee,setSaveDisabled:pe,pagingControls:{curPage:ae,setCurPage:de},hideCollectionCheckbox:F,renderWithoutModal:w,pickerType:M,scrollContainerRef:ve,limit:O,exactLimit:I}),"products"===te&&ce&&e.jsxRuntimeExports.jsx(j.CollectionIdContext.Provider,Object.assign({value:ce},{children:e.jsxRuntimeExports.jsx(x.ProductsScreen,{hideInCollectionSearch:R.hideInCollectionSearch,customCollectionRestriction:R.customCollectionRestriction,productFetcher:R.productFetcher,setScreen:oe,storeId:b,appType:X,data:Z[ce],collectionsDispatch:ee,selectedCollectionsDispatch:Ee,selectedData:fe,setSaveDisabled:pe,searchInCollectionFetcher:R.searchInCollectionFetcher,hideProductCheckbox:P,outOfStockAction:T,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,renderWithoutModal:w,pickerType:M,hideProductVariants:V,fbStatusFetcher:R.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Fe(e)},showProductDetailInfoIcon:K,scrollContainerRef:ve})})),"view"===te&&e.jsxRuntimeExports.jsx(S.SelectedScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,hideProductVariants:V,outOfStockAction:T,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"rearrange"===te&&e.jsxRuntimeExports.jsx(h.RearrangeScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,outOfStockAction:T,rearrangeViewType:"grid"===se?"list":"grid",scrollContainerRef:ve,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"searchProducts"===te&&e.jsxRuntimeExports.jsx(m.SearchScreen,{customCollectionRestriction:R.customCollectionRestriction,selectedCollections:fe||{},searchedCollections:Re||{},searchedCollectionsDispatch:be,selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,onBackPress:()=>{me(""),be({type:"set",data:{collections:{},products:{}}})},pickerType:M,hideProductCheckbox:P,hideProductVariants:V,hideVariantCheckbox:D,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:ne,setSelectedCollectionId:le,renderWithoutModal:w,hideCollectionCheckbox:F,outOfStockAction:T,limit:O,exactLimit:I})]}))]}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:w?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[qe,U.renderFooter?e.jsxRuntimeExports.jsxs(C.StyledFooterForNonModal,{children:[Te(),e.jsxRuntimeExports.jsx(n.Button,{buttonText:De(U.primaryButtonText),disabled:!U.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||U.primaryButtonDisabled,isLoading:U.isLoading,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes(z)?z:g.ScreenName.Collections)}})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),ke&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,outOfStockAction:T,useDynamicInfoImageSize:R.useDynamicInfoImageSize,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}):e.jsxRuntimeExports.jsxs(l.StyledModal,Object.assign({zIndex:k,open:v,onClose:()=>{null==E||E(),Pe()},headingTitle:L||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),headingSubtitle:Q,footerShadow:!0,centralContainerStyles:{width:A||"600px",left:B||"auto"},headerRightCustomElement:G?e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:E},{children:e.jsxRuntimeExports.jsx(c.default,{width:20,height:20,color:r.COLORS.content.secondary})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),footerContainerStyle:R.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:Y?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||e.disabled,onClick:()=>{R.onAdd(fe,xe),Pe(),me(""),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes(z)?z:g.ScreenName.Collections)}}))(Y):{buttonText:De(),disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{R.onAdd(fe,xe),Pe(),me("")}},secondaryButton:J?(e=>Object.assign(Object.assign({},e),{disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{const e=y.updateAllVariantsForSelectedProducts(fe,Z,Re);R.onAdd(e,xe,!0)}}))(J):void 0,wrapperStyle:R.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):Te(),hideCrossButton:ke||G},{children:[qe,ke&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}))})};
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default EventsTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default IGTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
3
+ import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
4
+ import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
5
5
  declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
6
6
  cacheKey: string;
7
7
  propertyAddBtnText: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -1 +1 @@
1
- import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth/models/bik-store";import o from"../../assets/icons/search.svg.js";import{useReducer as c,useState as s,useRef as r,useEffect as i}from"react";import{COLORS as n}from"../../constants/Theme.js";import l from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as d}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as g}from"./productInfoOverlay.js";import{ProductsScreen as C}from"./productScreen.js";import{RearrangeScreen as j}from"./rearrangeScreen.js";import{collectionsReducer as y,searchReducer as x,selectedColectionsReducer as b,CollectionIdContext as f}from"./reducers.js";import{SearchScreen as S}from"./searchScreen.js";import{SelectedScreen as k}from"./selectedScreen.js";import{ContainerStyle as v,ScrollContainerStyle as I,StyledFooterForNonModal as F}from"./style.js";import{OUT_OF_STOCK_ACTION as O,ScreenName as P}from"./type.js";import{updateAllVariantsForSelectedProducts as T}from"./utility.js";const D=D=>{const{storeId:R,selectedItems:w,onClose:L,visible:A,zIndex:E,exactLimit:$,limit:B,hideCollectionCheckbox:z,hideProductCheckbox:V,outOfStockAction:M=O.BLUR,hideVariantCheckbox:N,selectProductsFromCustomCollection:H,hideSelectionCount:W,title:G,width:K,left:U,renderWithoutModal:Y,onClickSave:_,pickerType:q,hideProductVariants:J=!1,startupScreen:Q=P.Collections,rearrangeEnabled:X,selectSingleItem:Z=!1,showProductDetails:ee,containerStyle:te,crossButtonInsideHeader:oe=!1,footerForNonModal:ce={},primaryButton:se,secondaryButton:re,subtitle:ie}=D,ne=D.appType||t.BIK,[le,ae]=c(y,{}),[de,ue]=s([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections),[he,pe]=s("grid"),[me,ge]=s(""),[Ce,je]=s(""),[ye,xe]=s(0),[be,fe]=s(!1),[Se,ke]=s(0),[ve,Ie]=s(""),[Fe,Oe]=s(!1),[Pe,Te]=s(!1),[De,Re]=c(x,{collections:{},products:{}}),[we,Le]=c(b,Object.keys(w).length>0?w:{}),Ae=r(null),[Ee,$e]=s(!1),[Be,ze]=s();i((()=>{fe(!0),Te(!0),D.collectionFetcher(ye,R,ne).then((e=>{ae({type:"fetched",data:(null==e?void 0:e.collections)||{}}),fe(!1),xe((e=>e+1)),Te(!1)})).catch()}),[]),i((()=>{let e=0;"COLLECTION"===q?e=Object.keys(we||{}).filter((e=>"isCustom"!==e)).length:J?Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&we[-1]&&(null===(c=we[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,s;Object.keys((null===(s=null===(c=we[t].products)||void 0===c?void 0:c[o])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),ke(e)}),[le,we,J,q]),i((()=>{Ce&&(fe(!0),D.productFetcher(Ce,R,ne).then((e=>{Object.keys(e).length&&ae({type:"productsFetched",data:{collectionId:Ce,products:e}}),fe(!1)})).catch())}),[Ce]),i((()=>{const e=setTimeout((()=>{"rearrange"!==de&&(ve.length||"collections"!==de)&&(ve.length?(Oe(!0),D.searchFetcher(R,ve,ne).then((e=>{"collections"in e&&"products"in e?(Re({type:"set",data:e}),ae({type:"searched",data:e.collections}),ae({type:"searched",data:e.products})):(Re({type:"set",data:{collections:{},products:e}}),ae({type:"searched",data:e})),ue("searchProducts"),fe(!1),Oe(!1)}))):ue("collections"))}),800);return()=>clearTimeout(e)}),[ve]),i((()=>{_&&(D.onAdd(we,Se),Ve())}),[_]),i((()=>{Z&&Object.keys(we||{}).length&&Se&&(D.onAdd(we,Se),Ve())}),[Z,we,Se]);const Ve=()=>{Le({type:"reset",data:{}})},Me=()=>{let t,o;return"COLLECTION"===q?(t="collection",o="collections"):J?(t="product",o="products"):(t="variant",o="variants"),$&&Se>$?e.jsx(p,{tagText:`You can only select ${$} ${1===$?t:o}`,type:"negative"}):B&&Se>B?e.jsx(p,{tagText:`You can only select ${B} ${1===B?t:o}`,type:"negative"}):Se>0?e.jsx(a,{onClick:()=>{ue(X?P.RearrangeProducts:P.SelectedProducts)},buttonText:$?`${Se}/${$} ${1===Se?t:o} selected`:`${Se} ${1===Se?t:o} selected`,buttonType:["rearrange","view"].includes(de)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(de)}):e.jsx(a,{disabled:!0,buttonText:$?`${Se}/${$} ${1===$?t:o} selected`:`${Se} ${1===Se?t:o} selected`,buttonType:"tertiaryGray"})},Ne=e=>be?"Loading...":de===P.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",He=e.jsxs(v,Object.assign({style:null!=te?te:{}},{children:[D.postHeader&&e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:D.postHeader})),!D.hideGlobalSearch&&e.jsx(e.Fragment,{children:("collections"===de||"searchProducts"===de)&&e.jsx("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(d,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Fe?e.jsx(h,{size:"small",color:n.content.primary}):e.jsx(o,{})},id:"listInput",height:"24px",type:"text",value:ve,onChangeText:e=>{e.length&&e.trim().length?Ie(e):Ie("")}})}))}),e.jsxs(I,Object.assign({ref:Ae,screenName:de},{children:["collections"===de&&e.jsx(m,{customCollectionRestriction:D.customCollectionRestriction,dataLoading:Pe,collections:le,selectedCollectionsDispatch:Le,setCollectionId:ge,setSelectedCollectionId:je,setScreen:ue,selectedCollections:we,collectionFetcher:D.collectionFetcher,storeId:R,appType:ne,collectionsDispatch:ae,setSaveDisabled:fe,pagingControls:{curPage:ye,setCurPage:xe},hideCollectionCheckbox:z,renderWithoutModal:Y,pickerType:q,scrollContainerRef:Ae,limit:B,exactLimit:$}),"products"===de&&me&&e.jsx(f.Provider,Object.assign({value:me},{children:e.jsx(C,{hideInCollectionSearch:D.hideInCollectionSearch,customCollectionRestriction:D.customCollectionRestriction,productFetcher:D.productFetcher,setScreen:ue,storeId:R,appType:ne,data:le[me],collectionsDispatch:ae,selectedCollectionsDispatch:Le,selectedData:we,setSaveDisabled:fe,searchInCollectionFetcher:D.searchInCollectionFetcher,hideProductCheckbox:V,outOfStockAction:M,hideVariantCheckbox:N,selectProductsFromCustomCollection:H,renderWithoutModal:Y,pickerType:q,hideProductVariants:J,fbStatusFetcher:D.fbStatusFetcher,onProductDetailClick:e=>{$e(!0),ze(e)},showProductDetailInfoIcon:ee,scrollContainerRef:Ae})})),"view"===de&&e.jsx(k,{selectedCollections:we||{},selectedCollectionsDispatch:Le,setScreen:ue,collections:le,hideProductVariants:J,outOfStockAction:M,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"rearrange"===de&&e.jsx(j,{selectedCollections:we||{},selectedCollectionsDispatch:Le,setScreen:ue,outOfStockAction:M,rearrangeViewType:"grid"===he?"list":"grid",scrollContainerRef:Ae,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"searchProducts"===de&&e.jsx(S,{customCollectionRestriction:D.customCollectionRestriction,selectedCollections:we||{},searchedCollections:De||{},searchedCollectionsDispatch:Re,selectedCollectionsDispatch:Le,setScreen:ue,collections:le,onBackPress:()=>{Ie(""),Re({type:"set",data:{collections:{},products:{}}})},pickerType:q,hideProductCheckbox:V,hideProductVariants:J,hideVariantCheckbox:N,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher,setCollectionId:ge,setSelectedCollectionId:je,renderWithoutModal:Y,hideCollectionCheckbox:z,outOfStockAction:M,limit:B,exactLimit:$})]}))]}));return e.jsx(e.Fragment,{children:Y?e.jsxs(e.Fragment,{children:[He,ce.renderFooter?e.jsxs(F,{children:[Me(),e.jsx(a,{buttonText:Ne(ce.primaryButtonText),disabled:!ce.isLoading&&(be||Se<1||$&&Se<$||!$&&B&&Se>B)||ce.primaryButtonDisabled,isLoading:ce.isLoading,onClick:()=>{D.onAdd(we,Se),Ve(),ue([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections)}})]}):e.jsx(e.Fragment,{}),Ee&&Be?e.jsx(g,{productData:Be,outOfStockAction:M,useDynamicInfoImageSize:D.useDynamicInfoImageSize,onClose:()=>{$e(!1)}}):e.jsx(e.Fragment,{})]}):e.jsxs(u,Object.assign({zIndex:E,open:A,onClose:()=>{null==L||L(),Ve()},headingTitle:G||("collections"===de||"products"===de?"Select Products":"view"===de?"Selected Products":"searchProducts"===de?"Searched Results":"rearrange"===de?"Rearrange Products":void 0),headingSubtitle:ie,footerShadow:!0,centralContainerStyles:{width:K||"600px",left:U||"auto"},headerRightCustomElement:oe?e.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:L},{children:e.jsx(l,{width:20,height:20,color:n.content.secondary})})):e.jsx(e.Fragment,{}),footerContainerStyle:D.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:se?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(be||Se<1||$&&Se<$||!$&&B&&Se>B)||e.disabled,onClick:()=>{D.onAdd(we,Se),Ve(),ue([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections)}}))(se):{buttonText:Ne(),disabled:be||Se<1||$&&Se<$||!$&&B&&Se>B||!1,onClick:()=>{D.onAdd(we,Se),Ve()}},secondaryButton:re?(e=>Object.assign(Object.assign({},e),{disabled:be||Se<1||$&&Se<$||!$&&B&&Se>B||!1,onClick:()=>{const e=T(we,le,De);D.onAdd(e,Se,!0)}}))(re):void 0,wrapperStyle:D.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?e.jsx(e.Fragment,{}):Me(),hideCrossButton:Ee||oe},{children:[He,Ee&&Be?e.jsx(g,{productData:Be,useDynamicInfoImageSize:D.useDynamicInfoImageSize,outOfStockAction:M,onClose:()=>{$e(!1)}}):e.jsx(e.Fragment,{})]}))})};export{D as ProductPickerModal};
1
+ import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth/models/bik-store";import o from"../../assets/icons/search.svg.js";import{useReducer as c,useState as s,useRef as r,useEffect as i}from"react";import{COLORS as n}from"../../constants/Theme.js";import l from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as d}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as g}from"./productInfoOverlay.js";import{ProductsScreen as C}from"./productScreen.js";import{RearrangeScreen as j}from"./rearrangeScreen.js";import{collectionsReducer as y,searchReducer as x,selectedColectionsReducer as b,CollectionIdContext as f}from"./reducers.js";import{SearchScreen as S}from"./searchScreen.js";import{SelectedScreen as k}from"./selectedScreen.js";import{ContainerStyle as v,ScrollContainerStyle as I,StyledFooterForNonModal as F}from"./style.js";import{OUT_OF_STOCK_ACTION as O,ScreenName as P}from"./type.js";import{updateAllVariantsForSelectedProducts as T}from"./utility.js";const D=D=>{const{storeId:R,selectedItems:w,onClose:L,visible:A,zIndex:E,exactLimit:$,limit:B,hideCollectionCheckbox:z,hideProductCheckbox:V,outOfStockAction:M=O.BLUR,hideVariantCheckbox:N,selectProductsFromCustomCollection:H,hideSelectionCount:W,title:G,width:K,left:U,renderWithoutModal:Y,onClickSave:_,pickerType:q,hideProductVariants:J=!1,startupScreen:Q=P.Collections,rearrangeEnabled:X,selectSingleItem:Z=!1,showProductDetails:ee,containerStyle:te,crossButtonInsideHeader:oe=!1,footerForNonModal:ce={},primaryButton:se,secondaryButton:re,subtitle:ie}=D,ne=D.appType||t.BIK,[le,ae]=c(y,{}),[de,ue]=s([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections),[he,pe]=s("grid"),[me,ge]=s(""),[Ce,je]=s(""),[ye,xe]=s(0),[be,fe]=s(!1),[Se,ke]=s(0),[ve,Ie]=s(""),[Fe,Oe]=s(!1),[Pe,Te]=s(!1),[De,Re]=c(x,{collections:{},products:{}}),[we,Le]=c(b,Object.keys(w).length>0?w:{}),Ae=r(null),[Ee,$e]=s(!1),[Be,ze]=s();i((()=>{fe(!0),Te(!0),D.collectionFetcher(ye,R,ne).then((e=>{ae({type:"fetched",data:(null==e?void 0:e.collections)||{}}),fe(!1),xe((e=>e+1)),Te(!1)})).catch()}),[]),i((()=>{let e=0;"COLLECTION"===q?e=Object.keys(we||{}).filter((e=>"isCustom"!==e)).length:J?Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&we[-1]&&(null===(c=we[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,s;Object.keys((null===(s=null===(c=we[t].products)||void 0===c?void 0:c[o])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),ke(e)}),[le,we,J,q]),i((()=>{Ce&&(fe(!0),D.productFetcher(Ce,R,ne).then((e=>{Object.keys(e).length&&ae({type:"productsFetched",data:{collectionId:Ce,products:e}}),fe(!1)})).catch())}),[Ce]),i((()=>{const e=setTimeout((()=>{"rearrange"!==de&&(ve.length||"collections"!==de)&&(ve.length?(Oe(!0),D.searchFetcher(R,ve,ne).then((e=>{"collections"in e&&"products"in e?(Re({type:"set",data:e}),ae({type:"searched",data:e.collections}),ae({type:"searched",data:e.products})):(Re({type:"set",data:{collections:{},products:e}}),ae({type:"searched",data:e})),ue("searchProducts"),fe(!1),Oe(!1)}))):ue("collections"))}),800);return()=>clearTimeout(e)}),[ve]),i((()=>{_&&(D.onAdd(we,Se),Ve())}),[_]),i((()=>{Z&&Object.keys(we||{}).length&&Se&&(D.onAdd(we,Se),Ve())}),[Z,we,Se]);const Ve=()=>{Le({type:"reset",data:{}})},Me=()=>{let t,o;return"COLLECTION"===q?(t="collection",o="collections"):J?(t="product",o="products"):(t="variant",o="variants"),$&&Se>$?e.jsx(p,{tagText:`You can only select ${$} ${1===$?t:o}`,type:"negative"}):B&&Se>B?e.jsx(p,{tagText:`You can only select ${B} ${1===B?t:o}`,type:"negative"}):Se>0?e.jsx(a,{onClick:()=>{ue(X?P.RearrangeProducts:P.SelectedProducts)},buttonText:$?`${Se}/${$} ${1===Se?t:o} selected`:`${Se} ${1===Se?t:o} selected`,buttonType:["rearrange","view"].includes(de)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(de)}):e.jsx(a,{disabled:!0,buttonText:$?`${Se}/${$} ${1===$?t:o} selected`:`${Se} ${1===Se?t:o} selected`,buttonType:"tertiaryGray"})},Ne=e=>be?"Loading...":de===P.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",He=e.jsxs(v,Object.assign({style:null!=te?te:{}},{children:[D.postHeader&&e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:D.postHeader})),!D.hideGlobalSearch&&e.jsx(e.Fragment,{children:("collections"===de||"searchProducts"===de)&&e.jsx("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(d,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Fe?e.jsx(h,{size:"small",color:n.content.primary}):e.jsx(o,{})},id:"listInput",height:"24px",type:"text",value:ve,onChangeText:e=>{e.length&&e.trim().length?Ie(e):Ie("")}})}))}),e.jsxs(I,Object.assign({ref:Ae,screenName:de},{children:["collections"===de&&e.jsx(m,{customCollectionRestriction:D.customCollectionRestriction,dataLoading:Pe,collections:le,selectedCollectionsDispatch:Le,setCollectionId:ge,setSelectedCollectionId:je,setScreen:ue,selectedCollections:we,collectionFetcher:D.collectionFetcher,storeId:R,appType:ne,collectionsDispatch:ae,setSaveDisabled:fe,pagingControls:{curPage:ye,setCurPage:xe},hideCollectionCheckbox:z,renderWithoutModal:Y,pickerType:q,scrollContainerRef:Ae,limit:B,exactLimit:$}),"products"===de&&me&&e.jsx(f.Provider,Object.assign({value:me},{children:e.jsx(C,{hideInCollectionSearch:D.hideInCollectionSearch,customCollectionRestriction:D.customCollectionRestriction,productFetcher:D.productFetcher,setScreen:ue,storeId:R,appType:ne,data:le[me],collectionsDispatch:ae,selectedCollectionsDispatch:Le,selectedData:we,setSaveDisabled:fe,searchInCollectionFetcher:D.searchInCollectionFetcher,hideProductCheckbox:V,outOfStockAction:M,hideVariantCheckbox:N,selectProductsFromCustomCollection:H,renderWithoutModal:Y,pickerType:q,hideProductVariants:J,fbStatusFetcher:D.fbStatusFetcher,onProductDetailClick:e=>{$e(!0),ze(e)},showProductDetailInfoIcon:ee,scrollContainerRef:Ae})})),"view"===de&&e.jsx(k,{selectedCollections:we||{},selectedCollectionsDispatch:Le,setScreen:ue,collections:le,hideProductVariants:J,outOfStockAction:M,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"rearrange"===de&&e.jsx(j,{selectedCollections:we||{},selectedCollectionsDispatch:Le,setScreen:ue,outOfStockAction:M,rearrangeViewType:"grid"===he?"list":"grid",scrollContainerRef:Ae,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"searchProducts"===de&&e.jsx(S,{customCollectionRestriction:D.customCollectionRestriction,selectedCollections:we||{},searchedCollections:De||{},searchedCollectionsDispatch:Re,selectedCollectionsDispatch:Le,setScreen:ue,collections:le,onBackPress:()=>{Ie(""),Re({type:"set",data:{collections:{},products:{}}})},pickerType:q,hideProductCheckbox:V,hideProductVariants:J,hideVariantCheckbox:N,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher,setCollectionId:ge,setSelectedCollectionId:je,renderWithoutModal:Y,hideCollectionCheckbox:z,outOfStockAction:M,limit:B,exactLimit:$})]}))]}));return e.jsx(e.Fragment,{children:Y?e.jsxs(e.Fragment,{children:[He,ce.renderFooter?e.jsxs(F,{children:[Me(),e.jsx(a,{buttonText:Ne(ce.primaryButtonText),disabled:!ce.isLoading&&(be||Se<1||$&&Se<$||!$&&B&&Se>B)||ce.primaryButtonDisabled,isLoading:ce.isLoading,onClick:()=>{D.onAdd(we,Se),Ve(),ue([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections)}})]}):e.jsx(e.Fragment,{}),Ee&&Be?e.jsx(g,{productData:Be,outOfStockAction:M,useDynamicInfoImageSize:D.useDynamicInfoImageSize,onClose:()=>{$e(!1)}}):e.jsx(e.Fragment,{})]}):e.jsxs(u,Object.assign({zIndex:E,open:A,onClose:()=>{null==L||L(),Ve()},headingTitle:G||("collections"===de||"products"===de?"Select Products":"view"===de?"Selected Products":"searchProducts"===de?"Searched Results":"rearrange"===de?"Rearrange Products":void 0),headingSubtitle:ie,footerShadow:!0,centralContainerStyles:{width:K||"600px",left:U||"auto"},headerRightCustomElement:oe?e.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:L},{children:e.jsx(l,{width:20,height:20,color:n.content.secondary})})):e.jsx(e.Fragment,{}),footerContainerStyle:D.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:se?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(be||Se<1||$&&Se<$||!$&&B&&Se>B)||e.disabled,onClick:()=>{D.onAdd(we,Se),Ve(),Ie(""),ue([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections)}}))(se):{buttonText:Ne(),disabled:be||Se<1||$&&Se<$||!$&&B&&Se>B||!1,onClick:()=>{D.onAdd(we,Se),Ve(),Ie("")}},secondaryButton:re?(e=>Object.assign(Object.assign({},e),{disabled:be||Se<1||$&&Se<$||!$&&B&&Se>B||!1,onClick:()=>{const e=T(we,le,De);D.onAdd(e,Se,!0)}}))(re):void 0,wrapperStyle:D.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?e.jsx(e.Fragment,{}):Me(),hideCrossButton:Ee||oe},{children:[He,Ee&&Be?e.jsx(g,{productData:Be,useDynamicInfoImageSize:D.useDynamicInfoImageSize,outOfStockAction:M,onClose:()=>{$e(!1)}}):e.jsx(e.Fragment,{})]}))})};export{D as ProductPickerModal};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.732",
3
+ "version": "0.0.733-beta.0",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",