@bikdotai/bik-component-library 0.0.662 → 0.0.664-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.
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/product.js +1 -1
- package/dist/cjs/components/product-picker-v2/productInfoOverlay.js +2 -2
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/product.js +1 -1
- package/dist/esm/components/product-picker-v2/productInfoOverlay.js +3 -3
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
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 "../../../
|
|
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 "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=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"),h=require("./productInfoOverlay.js"),p=require("./productScreen.js"),S=require("./rearrangeScreen.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=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"),h=require("./productInfoOverlay.js"),p=require("./productScreen.js"),S=require("./rearrangeScreen.js"),C=require("./reducers.js"),g=require("./searchScreen.js"),x=require("./selectedScreen.js"),j=require("./style.js"),y=require("./type.js"),m=require("./utility.js");exports.ScreenName=void 0,(e=exports.ScreenName||(exports.ScreenName={})).Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products";exports.ProductPickerModal=e=>{const{storeId:b,selectedItems:f,onClose:v,visible:I,zIndex:k,exactLimit:P,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:R,outOfStockAction:D=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:T,selectProductsFromCustomCollection:N,hideSelectionCount:q,title:E,width:A,left:w,renderWithoutModal:B,onClickSave:L,pickerType:M,hideProductVariants:V=!1,startupScreen:z=exports.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:_=!1,showProductDetails:H,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:K={},primaryButton:U,secondaryButton:Y,subtitle:J}=e,[Q,X]=c.useReducer(C.collectionsReducer,{}),[Z,ee]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections),[te,oe]=c.useState("grid"),[ce,re]=c.useState(""),[se,ne]=c.useState(""),[ie,le]=c.useState(0),[ae,de]=c.useState(!1),[ue,he]=c.useState(0),[pe,Se]=c.useState(""),[Ce,ge]=c.useState(!1),[xe,je]=c.useState(!1),[ye,me]=c.useReducer(C.searchReducer,{collections:{},products:{}}),[be,fe]=c.useReducer(C.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ve=c.useRef(null),[Ie,ke]=c.useState(!1),[Pe,Oe]=c.useState();c.useEffect((()=>{de(!0),je(!0),e.collectionFetcher(ie,b).then((e=>{X({type:"fetched",data:(null==e?void 0:e.collections)||{}}),de(!1),le((e=>e+1)),je(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;V?Object.keys(be||[]).forEach((t=>{var o;Object.keys((null===(o=be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&be[-1]&&(null===(c=be[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(be||[]).forEach((t=>{var o;Object.keys((null===(o=be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=be[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Q,be,V]),c.useEffect((()=>{se&&(de(!0),e.productFetcher(se,b).then((e=>{Object.keys(e).length&&X({type:"productsFetched",data:{collectionId:se,products:e}}),de(!1)})).catch())}),[se]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==Z&&(pe.length||"collections"!==Z)&&(pe.length?(ge(!0),e.searchFetcher(b,pe).then((e=>{"collections"in e&&"products"in e?(me({type:"set",data:e}),X({type:"searched",data:e.collections})):(me({type:"set",data:{collections:{},products:e}}),X({type:"searched",data:e})),ee("searchProducts"),de(!1),ge(!1)}))):ee("collections"))}),800);return()=>clearTimeout(t)}),[pe]),c.useEffect((()=>{L&&(e.onAdd(be,ue),Fe())}),[L]),c.useEffect((()=>{_&&Object.keys(be||{}).length&&ue&&(e.onAdd(be,ue),Fe())}),[_,be,ue]);const Fe=()=>{fe({type:"reset",data:{}})},Re=()=>P&&ue>P?t.jsx(d.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):O&&ue>O?t.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):ue>0?t.jsx(n.Button,{onClick:()=>{ee($?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:P?`${ue}/${P} products selected`:`${ue} products selected`,buttonType:["rearrange","view"].includes(Z)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(Z)}):t.jsx(n.Button,{disabled:!0,buttonText:P?`${ue}/${P} products selected`:`${ue} products selected`,buttonType:"tertiaryGray"}),De=e=>ae?"Loading...":Z===exports.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",Te=t.jsxs(j.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===Z||"searchProducts"===Z)&&t.jsx("div",Object.assign({style:{padding:B?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(i.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Ce?t.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:pe,onChangeText:e=>{e.length&&e.trim().length?Se(e):Se("")}})}))}),t.jsxs(j.ScrollContainerStyle,Object.assign({ref:ve,screenName:Z},{children:["collections"===Z&&t.jsx(u.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:xe,collections:Q,selectedCollectionsDispatch:fe,setCollectionId:re,setSelectedCollectionId:ne,setScreen:ee,selectedCollections:be,collectionFetcher:e.collectionFetcher,storeId:b,collectionsDispatch:X,setSaveDisabled:de,pagingControls:{curPage:ie,setCurPage:le},hideCollectionCheckbox:F,renderWithoutModal:B,pickerType:M,scrollContainerRef:ve}),"products"===Z&&ce&&t.jsx(C.CollectionIdContext.Provider,Object.assign({value:ce},{children:t.jsx(p.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:ee,storeId:b,data:Q[ce],collectionsDispatch:X,selectedCollectionsDispatch:fe,selectedData:be,setSaveDisabled:de,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:R,outOfStockAction:D,hideVariantCheckbox:T,selectProductsFromCustomCollection:N,renderWithoutModal:B,pickerType:M,hideProductVariants:V,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{ke(!0),Oe(e)},showProductDetailInfoIcon:H,scrollContainerRef:ve})})),"view"===Z&&t.jsx(x.SelectedScreen,{selectedCollections:be||{},selectedCollectionsDispatch:fe,setScreen:ee,collections:Q,hideProductVariants:V,outOfStockAction:D,storeId:b,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===Z&&t.jsx(S.RearrangeScreen,{selectedCollections:be||{},selectedCollectionsDispatch:fe,setScreen:ee,outOfStockAction:D,rearrangeViewType:"grid"===te?"list":"grid",scrollContainerRef:ve,storeId:b,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===Z&&t.jsx(g.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:be||{},searchedCollections:ye||{},searchedCollectionsDispatch:me,selectedCollectionsDispatch:fe,setScreen:ee,collections:Q,onBackPress:()=>{Se(""),me({type:"set",data:{collections:{},products:{}}})},pickerType:M,hideProductCheckbox:R,hideProductVariants:V,hideVariantCheckbox:T,storeId:b,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:re,setSelectedCollectionId:ne,renderWithoutModal:B,hideCollectionCheckbox:F,outOfStockAction:D})]}))]}));return t.jsx(t.Fragment,{children:B?t.jsxs(t.Fragment,{children:[Te,K.renderFooter?t.jsxs(j.StyledFooterForNonModal,{children:[Re(),t.jsx(n.Button,{buttonText:De(K.primaryButtonText),disabled:!K.isLoading&&(ae||ue<1||P&&ue<P||!P&&O&&ue>O)||K.primaryButtonDisabled,isLoading:K.isLoading,onClick:()=>{e.onAdd(be,ue),Fe(),ee([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections)}})]}):t.jsx(t.Fragment,{}),Ie&&Pe?t.jsx(h.ProductInfoOverlay,{productData:Pe,outOfStockAction:D,useDynamicInfoImageSize:e.useDynamicInfoImageSize,onClose:()=>{ke(!1)}}):t.jsx(t.Fragment,{})]}):t.jsxs(l.StyledModal,Object.assign({zIndex:k,open:I,onClose:()=>{null==v||v(),Fe()},headingTitle:E||("collections"===Z||"products"===Z?"Select Products":"view"===Z?"Selected Products":"searchProducts"===Z?"Searched Results":"rearrange"===Z?"Rearrange Products":void 0),headingSubtitle:J,footerShadow:!0,centralContainerStyles:{width:A||"600px",left:w||"auto"},headerRightCustomElement:G?t.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:v},{children:t.jsx(s.default,{width:20,height:20,color:r.COLORS.content.secondary})})):t.jsx(t.Fragment,{}),footerContainerStyle:e.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:U?(t=>Object.assign(Object.assign({},t),{disabled:!t.isLoading&&(ae||ue<1||P&&ue<P||!P&&O&&ue>O)||t.disabled,onClick:()=>{e.onAdd(be,ue),Fe(),ee([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections)}}))(U):{buttonText:De(),disabled:ae||ue<1||P&&ue<P||!P&&O&&ue>O||!1,onClick:()=>{e.onAdd(be,ue),Fe()}},secondaryButton:Y?(t=>Object.assign(Object.assign({},t),{disabled:ae||ue<1||P&&ue<P||!P&&O&&ue>O||!1,onClick:()=>{const t=m.updateAllVariantsForSelectedProducts(be,Q,ye);e.onAdd(t,ue,!0)}}))(Y):void 0,wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:q?t.jsx(t.Fragment,{}):Re(),hideCrossButton:Ie||G},{children:[Te,Ie&&Pe?t.jsx(h.ProductInfoOverlay,{productData:Pe,useDynamicInfoImageSize:e.useDynamicInfoImageSize,outOfStockAction:D,onClose:()=>{ke(!1)}}):t.jsx(t.Fragment,{})]}))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../constants/Theme.js"),i=require("../../assets/icons/info.svg.js"),o=require("../checkBox/CheckBox.js"),c=require("../icon-button/IconButton.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../constants/Theme.js"),i=require("../../assets/icons/info.svg.js"),o=require("../checkBox/CheckBox.js"),c=require("../icon-button/IconButton.js"),d=require("../shimmer-image/ShimmerImage.js"),r=require("../tooltips/Tooltip.js"),l=require("../TypographyStyle.js"),n=require("./constants.js"),a=require("./helpers/ProductHelper.js"),s=require("./ProductPickerTag.js"),u=require("./style.js"),v=require("./utility.js");const p=n=>{const{isVariant:p,data:h,productId:I,collectionId:y,variantId:j,isSelected:P,selectedCollectionsDispatch:x,viewOnly:g,upliftAdditions:k,isPartiallyChecked:C,hideProductCheckbox:b,outOfStockAction:O,hideVariantCheckbox:S,hideProductVariants:f,pickerType:m="PRODUCT",onProductDetailClick:T,showProductDetailInfoIcon:D,currencyAndPrice:V}=n,{isVariantForProductPickerTag:q,dataForProductPickerTag:w,tagText:A,tagType:U}=a.ProductHelper.getDataForProductPickerTag(h,p,O),B=v.getSkuId(h,p);return e.jsxs(u.ProductCardStyle,Object.assign({isVariant:p,onClick:e=>{if(e.stopPropagation(),"PRODUCT"===m&&(b||S)){const e=Object.keys(h.variants);f?P?x({type:"productUnselected",data:{productId:I,collectionId:y}}):k("productSelected",{productId:I,variantId:j,collectionId:y,product:h}):P?x({type:"variantUnselected",data:{productId:I,variantId:j,collectionId:y}}):k("variantSelected",{productId:I,variantId:j||e[0],collectionId:y,variant:h})}},isActive:P},{children:[p&&!g&&!S||!p&&!g&&!b?e.jsx(o.CheckBox,{isChecked:P,isPartiallyChecked:C||!1,onValueChange:function(e,t,i){null==i||i.stopPropagation(),console.log("checkbox clicked: ",e," isVariant: ",p),p?e?(console.log("4",{productId:I,collectionId:y,variantId:j,variant:h,hideProductVariants:f}),k(f?"productSelected":"variantSelected",{productId:I,variantId:j,collectionId:y,variant:h})):(console.log("3",{productId:I,collectionId:y,variantId:j,hideProductVariants:f}),x({type:f?"productUnselected":"variantUnselected",data:{productId:I,variantId:j,collectionId:y}})):e?(console.log("2",{productId:I,collectionId:y,product:h}),k("productSelected",{productId:I,collectionId:y,product:h})):(console.log("1",{productId:I,collectionId:y}),x({type:"productUnselected",data:{productId:I,collectionId:y}}))}}):e.jsx(e.Fragment,{}),e.jsx("div",{children:e.jsx(d.ShimmerImage,{width:40,height:40,imageUrl:h.image,alt:"Item",borderRadius:4})}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16}},{children:[e.jsx(r.Tooltip,Object.assign({variant:"light",body:h.name,placement:"bottom",delay:400},{children:e.jsx(l.TitleSmall,Object.assign({style:{flex:1},numberOfLines:1},{children:h.name}))})),e.jsxs(u.ProductInfo,{children:[e.jsx(s.ProductPickerTag,{isVariant:q,data:w,tagText:A,tagType:U}),D&&e.jsx(c.IconButton,{onClick:()=>{null==T||T(h)},Icon:()=>e.jsx(i.default,{width:20,height:20,color:t.COLORS.content.placeholder})})]})]})),e.jsxs(u.ProductSubTitle,{children:[!(null==w?void 0:w.fbStatus)&&q||A?null:e.jsx(l.BodyCaption,Object.assign({color:t.COLORS.content.secondary},{children:V})),B&&e.jsx(r.Tooltip,Object.assign({body:B,placement:"top"},{children:e.jsx(u.SKUIDBadge,{children:e.jsx(u.EllipsedBodyTiny,{children:`SKU ID: ${B}`})})}))]})]}))]}))};exports.ProductCard=p,exports.ProductGroup=t=>{var i,o,c,d,r,l,a,s,u;const{collectionId:h,productId:I,data:y,selectedData:j,selectedCollectionsDispatch:P,viewOnly:x,upliftAdditions:g,isProductPartiallyChecked:k,hideProductCheckbox:C,outOfStockAction:b,hideVariantCheckbox:O,hideProductVariants:S,pickerType:f,onProductDetailClick:m,showProductDetailInfoIcon:T}=t,D=e=>{var t,i,o,c,d,r;if(!(null===(i=null===(t=null==j?void 0:j[h])||void 0===t?void 0:t.products)||void 0===i?void 0:i[I]))return!1;return!!(null===(r=null===(d=null===(c=null===(o=null==j?void 0:j[h])||void 0===o?void 0:o.products)||void 0===c?void 0:c[I])||void 0===d?void 0:d.variants)||void 0===r?void 0:r[e])},V=S||!v.shouldShowVariant(y)?`${y.currency&&null!==(i=n.CurrencySymbols[y.currency])&&void 0!==i?i:""}${null!==(u=null!==(r=null===(d=null===(c=Object.values(null!==(o=y.variants)&&void 0!==o?o:{}))||void 0===c?void 0:c[0])||void 0===d?void 0:d.price)&&void 0!==r?r:null===(s=null===(a=Object.values(null!==(l=y.variants)&&void 0!==l?l:{}))||void 0===a?void 0:a[0])||void 0===s?void 0:s.actualPrice)&&void 0!==u?u:""}`:"";return e.jsxs("div",{children:[e.jsx(p,{isVariant:!1,data:y,productId:I,collectionId:h,isSelected:(()=>{var e,t;return!!(null===(t=null===(e=null==j?void 0:j[h])||void 0===e?void 0:e.products)||void 0===t?void 0:t[I])})(),isPartiallyChecked:k,selectedCollectionsDispatch:P,upliftAdditions:g,viewOnly:x,hideProductCheckbox:C,hideVariantCheckbox:O,hideProductVariants:S,pickerType:f,outOfStockAction:b,onProductDetailClick:m,showProductDetailInfoIcon:T,currencyAndPrice:V},I),S?null:v.shouldShowVariant(y)&&Object.keys(y.variants||[]).map((t=>{var i,o,c,d,r,l,a;const s=`${y.currency&&null!==(i=n.CurrencySymbols[y.currency])&&void 0!==i?i:""}${null!==(a=null!==(d=null===(c=null===(o=y.variants)||void 0===o?void 0:o[t])||void 0===c?void 0:c.price)&&void 0!==d?d:null===(l=null===(r=y.variants)||void 0===r?void 0:r[t])||void 0===l?void 0:l.actualPrice)&&void 0!==a?a:""}`;return e.jsx(p,{isVariant:!0,hideVariantCheckbox:O,data:Object.assign(Object.assign({},y.variants[t]),{currency:y.currency}),variantId:t,productId:I,viewOnly:x,upliftAdditions:g,collectionId:h,isSelected:D(t),selectedCollectionsDispatch:P,outOfStockAction:b,onProductDetailClick:m,showProductDetailInfoIcon:T,currencyAndPrice:s},t)}))]})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),i=require("../../assets/icons/cross.svg.js"),r=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.js"),d=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),l=require("./constants.js"),c=require("./helpers/ProductHelper.js"),s=require("./ProductPickerTag.js"),u=require("./style.js"),p=require("./utility.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=x(t);const v=t=>{var i,r,x,g,v,y,m,f,D,I,S,P,O,k,T,q;const C=void 0===t.productData.variants;let w;if(C)w=`${t.productData.currency&&null!==(i=l.CurrencySymbols[t.productData.currency])&&void 0!==i?i:""}${null!==(v=null!==(x=null===(r=t.productData)||void 0===r?void 0:r.price)&&void 0!==x?x:null===(g=t.productData)||void 0===g?void 0:g.actualPrice)&&void 0!==v?v:""}`;else{const e=null===(y=t.productData)||void 0===y?void 0:y.currency;w=`${e&&null!==(m=l.CurrencySymbols[e])&&void 0!==m?m:""}${null!==(T=null!==(S=null===(I=null===(D=Object.values(null!==(f=t.productData.variants)&&void 0!==f?f:{}))||void 0===D?void 0:D[0])||void 0===I?void 0:I.price)&&void 0!==S?S:null===(k=null===(O=Object.values(null!==(P=t.productData.variants)&&void 0!==P?P:{}))||void 0===O?void 0:O[0])||void 0===k?void 0:k.actualPrice)&&void 0!==T?T:""}`}const{isVariantForProductPickerTag:B,dataForProductPickerTag:$,tagText:z,tagType:R}=c.ProductHelper.getDataForProductPickerTag(t.productData,C,t.outOfStockAction),L=p.getSkuId(t.productData,C);return e.jsxs(j,{children:[e.jsx(h,{children:e.jsx(a.ShimmerImage,{useDynamicInfoImageSize:t.useDynamicInfoImageSize,imageUrl:t.productData.image,width:200,height:200,borderRadius:4})}),e.jsxs(b,{children:[L&&e.jsx(d.Tooltip,Object.assign({body:L,placement:"top"},{children:e.jsx(u.SKUIDBadge,{children:e.jsx(u.EllipsedBodyTiny,{children:`SKU ID: ${L}`})})})),e.jsx(n.TitleRegular,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(n.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:`Product ID: ${t.productData.id}`})),e.jsx(n.BodyCaption,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(q=t.productData.description)&&void 0!==q?q:""}}),e.jsx(n.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:C?w:p.shouldShowVariant(t.productData)?null:w})),e.jsx(s.ProductPickerTag,{isVariant:B,data:$,tagText:z,tagType:R})]})]})},y=g.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1;
|
|
4
4
|
background: rgba(0, 0, 0, 0.5);
|
|
@@ -49,4 +49,4 @@
|
|
|
49
49
|
flex: 1;
|
|
50
50
|
flex-direction: column;
|
|
51
51
|
gap: 4px;
|
|
52
|
-
`;exports.ProductInfoCard=v,exports.ProductInfoOverlay=t=>e.jsxs(y,{children:[e.jsx(m,{}),e.jsx(f,{children:e.jsx(
|
|
52
|
+
`;exports.ProductInfoCard=v,exports.ProductInfoOverlay=t=>e.jsxs(y,{children:[e.jsx(m,{}),e.jsx(f,{children:e.jsx(r.IconButton,{className:"close-button",onClick:t.onClose,Icon:i.default,width:20,height:20})}),e.jsx(v,{productData:t.productData,outOfStockAction:t.outOfStockAction,useDynamicInfoImageSize:t.useDynamicInfoImageSize})]});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("../../assets/icons/box.svg.js"),c=require("../../assets/icons/search.svg.js"),o=require("lodash"),s=require("react"),n=require("../../constants/Theme.js"),i=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),d=require("../InfiniteScroll/InfiniteScroll.js"),u=require("../input/Input.js"),a=require("../spinner/Spinner.js"),h=require("../TypographyStyle.js"),p=require("./emptyState.js"),j=require("./product.js"),v=require("./ProductPickerShimmer.js"),g=require("./reducers.js"),y=require("./style.js"),O=require("./type.js"),b=require("./utility.js");exports.ProductsScreen=f=>{var k,C;const{data:P,collectionsDispatch:x,selectedData:S,selectedCollectionsDispatch:I,productFetcher:m,storeId:q,setScreen:A,setSaveDisabled:D,hideInCollectionSearch:E,customCollectionRestriction:T,hideProductCheckbox:R,outOfStockAction:V=O.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:L=!1,selectProductsFromCustomCollection:F=!1,pickerType:w,hideProductVariants:B,fbStatusFetcher:_,onProductDetailClick:U,showProductDetailInfoIcon:K,scrollContainerRef:M}=f,N=s.useContext(g.CollectionIdContext),H=s.useRef(0),J=s.useRef(!1),[W,z]=s.useState(""),[G,Q]=s.useState(!1),[X,Y]=s.useState(P),Z=s.useRef(!0),$=s.useRef(!1);s.useEffect((()=>{if(Z.current)return void(Z.current=!1);const e=setTimeout((()=>{W.length?(Q(!0),f.searchInCollectionFetcher(q,N,W).then((e=>{const t=o.cloneDeep(P);t.products=e,Y(t);const r=b.getVariantIdsToFetchAtProductLevel(null!=e?e:{});te(r,null!=e?e:{},!0),D(!1),Q(!1)}))):Y(P)}),800);return()=>clearTimeout(e)}),[W]);s.useEffect((()=>{var e,t,r,c;$.current=!1,H.current=Math.floor((null===(t=Object.keys(null!==(e=P.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const o=b.getVariantIdsToFetchAtProductLevel(null!==(r=P.products)&&void 0!==r?r:{});te(o,null!==(c=P.products)&&void 0!==c?c:{})}),[N]);const ee=!!T&&P.isSmartCollection;s.useEffect((()=>{(null==P?void 0:P.products)||re(10)}),[]);const te=(e,t,r)=>{_||(r?b.markVariantsAsApprovedProductsLevel(t,x,N,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,N)),e.length>0&&_&&_(q,e).then((e=>{const c=Object.assign({},t);Object.keys(t).forEach((r=>{var o,s;Object.keys(null!==(s=null===(o=null==t?void 0:t[r])||void 0===o?void 0:o.variants)&&void 0!==s?s:{}).forEach((o=>{var s,n;const i=null===(s=null==t?void 0:t[r].variants)||void 0===s?void 0:s[o];i&&"REJECTED"===e[o]?i.fbStatus="REJECTED":i&&"APPROVED"===e[o]&&(i.fbStatus="APPROVED");const l=null===(n=null==c?void 0:c[r])||void 0===n?void 0:n.variants;l&&l[o]&&(l[o]=i)}))})),r?(Y((e=>{const t=Object.assign({},e);return t.products=c,t})),x({type:"productsPaged",data:{collectionId:N,products:c}})):x({type:"productsPaged",data:{collectionId:N,products:c}})})).catch((e=>{r?b.markVariantsAsApprovedProductsLevel(t,x,N,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,N)}))},re=e=>{D(!0),Q(!0),m(N,q,e,0).then((t=>{if(Object.keys(t).length||($.current=!0),Object.keys(t).length){Y(Object.assign(Object.assign({},X),{products:t}));const e=b.getVariantIdsToFetchAtProductLevel(t);te(e,t),H.current=1}e||I({type:"selected",data:{id:N,val:Object.assign(Object.assign({},P),{products:t})}}),D(!1),Q(!1)})).catch()},ce=(e,t)=>{const r=b.liftTheStateUp(t,P);I({type:e,data:Object.assign(Object.assign({},r),{isRestricted:T})})},oe=!!(null==S?void 0:S[N])&&!!Object.keys(null!==(C=null===(k=null==S?void 0:S[N])||void 0===k?void 0:k.products)&&void 0!==C?C:{}).length;return e.jsxs("div",{children:[e.jsxs(y.ProductScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,height:16,onClick:()=>{A("collections")}}),e.jsx(h.BodyCaption,Object.assign({style:{color:n.COLORS.content.secondary}},{children:P.name}))]}),!E&&e.jsx("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(u.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>G&&W.length?e.jsx(a.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(c.default,{})},id:"listInput",height:"24px",type:"text",value:W,onChangeText:e=>{e.length&&e.trim().length?z(e):z("")},placeholder:"Search using ID, Name or SKU ID"})})),Object.keys((null==X?void 0:X.products)||[]).length>0&&!ee&&!W.length&&!R&&"-1"!==N&&e.jsxs(y.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:oe,isPartiallyChecked:b.isCollectionPartiallyChecked(N,X,S,B),onValueChange:function(e){e?re():I({type:"unselected",data:{id:N}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(r.default,{})})),e.jsx(h.TitleRegular,{children:"All Products"})]}),e.jsx(d.InfiniteScroll,Object.assign({hasData:!(Object.keys((null==X?void 0:X.products)||[]).length<10)&&!!Object.keys((null==X?void 0:X.products)||[]).length,fetchMore:()=>(J.current=!0,m(N,q,10,H.current).then((e=>{let t=!1;if(Object.keys(e).length||(t=!0),Object.keys(e).length){const t=X;t.products=Object.assign(Object.assign({},X.products),e),Y(Object.assign({},t));const r=b.getVariantIdsToFetchAtProductLevel(e);te(r,e)}return D(!1),J.current=!1,H.current+=1,t}))),containerRef:M},{children:Object.keys((null==X?void 0:X.products)||[]).length?Object.keys(X.products||[]).map((t=>e.jsx(j.ProductGroup,{outOfStockAction:V,collectionId:N,isProductPartiallyChecked:b.isProductPartiallyChecked(N,t,S,X,B),productId:t,data:X.products[t],selectedData:S,selectedCollectionsDispatch:I,viewOnly:!F&&!!ee,upliftAdditions:ce,hideProductCheckbox:R,hideVariantCheckbox:L,hideProductVariants:B,pickerType:w,onProductDetailClick:U,showProductDetailInfoIcon:K},t))):G?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(p.EmptyState,{title:"No products to show",subtitle:W.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})}))]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("react"),l=require("../icon-button/IconButton.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("react"),l=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),c=require("./collectionScreen.js"),s=require("./emptyState.js"),d=require("./product.js"),r=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{var a;const{customCollectionRestriction:h,selectedCollections:p,searchedCollections:v,searchedCollectionsDispatch:C,selectedCollectionsDispatch:j,setScreen:y,collections:k,onBackPress:b,hideVariantCheckbox:x,pickerType:S,hideProductVariants:f,hideProductCheckbox:P,storeId:g,fbStatusFetcher:m,setCollectionId:I,setSelectedCollectionId:O,hideCollectionCheckbox:q,renderWithoutModal:D,outOfStockAction:F}=u;o.useEffect((()=>{var e;n.fetchFbStatusCollection(null!==(e=v.products)&&void 0!==e?e:{},g,C,m,"setProducts")}),[null==v?void 0:v.products]);const T=!!h&&(null==p?void 0:p.isCustom);return e.jsxs("div",{children:[e.jsxs(r.SelectedScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,onClick:()=>{y("collections"),b()}}),e.jsx(i.BodyCaption,{children:(null===(a=Object.keys(null==v?void 0:v.collections))||void 0===a?void 0:a.length)?"Searched Collections & Products":"Searched Products"})]}),e.jsx("div",{children:Object.keys(null==v?void 0:v.products).length||Object.keys(null==v?void 0:v.collections).length?e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:Object.keys(null==v?void 0:v.collections).map((t=>e.jsx(c.CollectionCard,{customCollectionRestriction:h,data:null==k?void 0:k[t],isDisabled:T&&!(null==p?void 0:p[t]),isChecked:!!(null==p?void 0:p[t]),isPartiallyChecked:n.isCollectionPartiallyChecked(t,null==k?void 0:k[t],p,f),selectedCollectionsDispatch:j,setCollectionId:I,setSelectedCollectionId:O,setScreen:y,id:t,hideCollectionCheckbox:q||"-1"===t,selectedCollections:p,renderWithoutModal:D,pickerType:S,usedInSearch:!0},t)))}),e.jsx(e.Fragment,{children:Object.keys(null==v?void 0:v.products).map((t=>{var o,l;return Object.keys((null===(l=null===(o=null==v?void 0:v.products)||void 0===o?void 0:o[t])||void 0===l?void 0:l.products)||[]).map((o=>{var l,i,c;let s=!1;return(null===(l=null==v?void 0:v.products)||void 0===l?void 0:l.isCustom)&&(s=!0),e.jsx(d.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>{console.log("uplift additions in search screen called with : ",{collectionId:t,type:e,payload:o}),((e,t,o)=>{var l;const i=n.liftTheStateUp(o,null===(l=null==v?void 0:v.products)||void 0===l?void 0:l[e]);console.log("final payload: ",i," type: ",t," isRestricted: ",h),j({type:t,data:Object.assign(Object.assign({},i),{isRestricted:h})})})(t,e,o)},productId:o,data:(null===(i=null==v?void 0:v.products)||void 0===i?void 0:i[t].products)[o],isProductPartiallyChecked:n.isProductPartiallyChecked(t,o,p,null===(c=v.products)||void 0===c?void 0:c[t],f),selectedData:p,selectedCollectionsDispatch:j,viewOnly:s,hideProductCheckbox:P,hideVariantCheckbox:x,hideProductVariants:f,pickerType:S,outOfStockAction:F},o)}))}))})]}):e.jsx(s.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
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 "../../../
|
|
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 "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
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 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as n}from"react";import{COLORS as l}from"../../constants/Theme.js";import d from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as u}from"../input/Input.js";import{StyledModal as h}from"../modals/styledModal.js";import{Spinner as p}from"../spinner/Spinner.js";import{Tag as m}from"../tag/Tag.js";import{CollectionsScreen as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as n}from"react";import{COLORS as l}from"../../constants/Theme.js";import d from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as u}from"../input/Input.js";import{StyledModal as h}from"../modals/styledModal.js";import{Spinner as p}from"../spinner/Spinner.js";import{Tag as m}from"../tag/Tag.js";import{CollectionsScreen as C}from"./collectionScreen.js";import{ProductInfoOverlay as g}from"./productInfoOverlay.js";import{ProductsScreen as b}from"./productScreen.js";import{RearrangeScreen as f}from"./rearrangeScreen.js";import{collectionsReducer as y,searchReducer as S,selectedColectionsReducer as v,CollectionIdContext as k}from"./reducers.js";import{SearchScreen as j}from"./searchScreen.js";import{SelectedScreen as I}from"./selectedScreen.js";import{ContainerStyle as x,ScrollContainerStyle as P,StyledFooterForNonModal as O}from"./style.js";import{OUT_OF_STOCK_ACTION as D}from"./type.js";import{updateAllVariantsForSelectedProducts as F}from"./utility.js";var T;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(T||(T={}));const R=R=>{const{storeId:w,selectedItems:A,onClose:B,visible:E,zIndex:L,exactLimit:z,limit:V,hideCollectionCheckbox:$,hideProductCheckbox:M,outOfStockAction:H=D.BLUR,hideVariantCheckbox:W,selectProductsFromCustomCollection:G,hideSelectionCount:N,title:K,width:U,left:Y,renderWithoutModal:q,onClickSave:J,pickerType:Q,hideProductVariants:X=!1,startupScreen:Z=T.Collections,rearrangeEnabled:_,selectSingleItem:ee=!1,showProductDetails:te,containerStyle:oe,crossButtonInsideHeader:ce=!1,footerForNonModal:re={},primaryButton:se,secondaryButton:ie,subtitle:ne}=R,[le,de]=r(y,{}),[ae,ue]=s([T.Collections,T.RearrangeProducts].includes(Z)?Z:T.Collections),[he,pe]=s("grid"),[me,Ce]=s(""),[ge,be]=s(""),[fe,ye]=s(0),[Se,ve]=s(!1),[ke,je]=s(0),[Ie,xe]=s(""),[Pe,Oe]=s(!1),[De,Fe]=s(!1),[Te,Re]=r(S,{collections:{},products:{}}),[we,Ae]=r(v,Object.keys(A).length>0?A:{}),Be=i(null),[Ee,Le]=s(!1),[ze,Ve]=s();n((()=>{ve(!0),Fe(!0),R.collectionFetcher(fe,w).then((e=>{de({type:"fetched",data:(null==e?void 0:e.collections)||{}}),ve(!1),ye((e=>e+1)),Fe(!1)})).catch()}),[]),n((()=>{let e=0;X?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,r;Object.keys((null===(r=null===(c=we[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),je(e)}),[le,we,X]),n((()=>{ge&&(ve(!0),R.productFetcher(ge,w).then((e=>{Object.keys(e).length&&de({type:"productsFetched",data:{collectionId:ge,products:e}}),ve(!1)})).catch())}),[ge]),n((()=>{const e=setTimeout((()=>{"rearrange"!==ae&&(Ie.length||"collections"!==ae)&&(Ie.length?(Oe(!0),R.searchFetcher(w,Ie).then((e=>{"collections"in e&&"products"in e?(Re({type:"set",data:e}),de({type:"searched",data:e.collections})):(Re({type:"set",data:{collections:{},products:e}}),de({type:"searched",data:e})),ue("searchProducts"),ve(!1),Oe(!1)}))):ue("collections"))}),800);return()=>clearTimeout(e)}),[Ie]),n((()=>{J&&(R.onAdd(we,ke),$e())}),[J]),n((()=>{ee&&Object.keys(we||{}).length&&ke&&(R.onAdd(we,ke),$e())}),[ee,we,ke]);const $e=()=>{Ae({type:"reset",data:{}})},Me=()=>z&&ke>z?t(m,{tagText:`You can only select ${z} products`,type:"negative"}):V&&ke>V?t(m,{tagText:`You can only select ${V} products`,type:"negative"}):t(a,ke>0?{onClick:()=>{ue(_?T.RearrangeProducts:T.SelectedProducts)},buttonText:z?`${ke}/${z} products selected`:`${ke} products selected`,buttonType:["rearrange","view"].includes(ae)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(ae)}:{disabled:!0,buttonText:z?`${ke}/${z} products selected`:`${ke} products selected`,buttonType:"tertiaryGray"}),He=e=>Se?"Loading...":ae===T.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",We=e(x,Object.assign({style:null!=oe?oe:{}},{children:[R.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:R.postHeader})),!R.hideGlobalSearch&&t(o,{children:("collections"===ae||"searchProducts"===ae)&&t("div",Object.assign({style:{padding:q?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(u,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Pe?t(p,{size:"small",color:l.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:Ie,onChangeText:e=>{e.length&&e.trim().length?xe(e):xe("")}})}))}),e(P,Object.assign({ref:Be,screenName:ae},{children:["collections"===ae&&t(C,{customCollectionRestriction:R.customCollectionRestriction,dataLoading:De,collections:le,selectedCollectionsDispatch:Ae,setCollectionId:Ce,setSelectedCollectionId:be,setScreen:ue,selectedCollections:we,collectionFetcher:R.collectionFetcher,storeId:w,collectionsDispatch:de,setSaveDisabled:ve,pagingControls:{curPage:fe,setCurPage:ye},hideCollectionCheckbox:$,renderWithoutModal:q,pickerType:Q,scrollContainerRef:Be}),"products"===ae&&me&&t(k.Provider,Object.assign({value:me},{children:t(b,{hideInCollectionSearch:R.hideInCollectionSearch,customCollectionRestriction:R.customCollectionRestriction,productFetcher:R.productFetcher,setScreen:ue,storeId:w,data:le[me],collectionsDispatch:de,selectedCollectionsDispatch:Ae,selectedData:we,setSaveDisabled:ve,searchInCollectionFetcher:R.searchInCollectionFetcher,hideProductCheckbox:M,outOfStockAction:H,hideVariantCheckbox:W,selectProductsFromCustomCollection:G,renderWithoutModal:q,pickerType:Q,hideProductVariants:X,fbStatusFetcher:R.fbStatusFetcher,onProductDetailClick:e=>{Le(!0),Ve(e)},showProductDetailInfoIcon:te,scrollContainerRef:Be})})),"view"===ae&&t(I,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,hideProductVariants:X,outOfStockAction:H,storeId:w,fbStatusFetcher:R.fbStatusFetcher}),"rearrange"===ae&&t(f,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,outOfStockAction:H,rearrangeViewType:"grid"===he?"list":"grid",scrollContainerRef:Be,storeId:w,fbStatusFetcher:R.fbStatusFetcher}),"searchProducts"===ae&&t(j,{customCollectionRestriction:R.customCollectionRestriction,selectedCollections:we||{},searchedCollections:Te||{},searchedCollectionsDispatch:Re,selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,onBackPress:()=>{xe(""),Re({type:"set",data:{collections:{},products:{}}})},pickerType:Q,hideProductCheckbox:M,hideProductVariants:X,hideVariantCheckbox:W,storeId:w,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:Ce,setSelectedCollectionId:be,renderWithoutModal:q,hideCollectionCheckbox:$,outOfStockAction:H})]}))]}));return t(o,{children:q?e(o,{children:[We,re.renderFooter?e(O,{children:[Me(),t(a,{buttonText:He(re.primaryButtonText),disabled:!re.isLoading&&(Se||ke<1||z&&ke<z||!z&&V&&ke>V)||re.primaryButtonDisabled,isLoading:re.isLoading,onClick:()=>{R.onAdd(we,ke),$e(),ue([T.Collections,T.RearrangeProducts].includes(Z)?Z:T.Collections)}})]}):t(o,{}),Ee&&ze?t(g,{productData:ze,outOfStockAction:H,useDynamicInfoImageSize:R.useDynamicInfoImageSize,onClose:()=>{Le(!1)}}):t(o,{})]}):e(h,Object.assign({zIndex:L,open:E,onClose:()=>{null==B||B(),$e()},headingTitle:K||("collections"===ae||"products"===ae?"Select Products":"view"===ae?"Selected Products":"searchProducts"===ae?"Searched Results":"rearrange"===ae?"Rearrange Products":void 0),headingSubtitle:ne,footerShadow:!0,centralContainerStyles:{width:U||"600px",left:Y||"auto"},headerRightCustomElement:ce?t("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:B},{children:t(d,{width:20,height:20,color:l.content.secondary})})):t(o,{}),footerContainerStyle:R.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:l.surface.standard}:void 0,primaryButton:se?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(Se||ke<1||z&&ke<z||!z&&V&&ke>V)||e.disabled,onClick:()=>{R.onAdd(we,ke),$e(),ue([T.Collections,T.RearrangeProducts].includes(Z)?Z:T.Collections)}}))(se):{buttonText:He(),disabled:Se||ke<1||z&&ke<z||!z&&V&&ke>V||!1,onClick:()=>{R.onAdd(we,ke),$e()}},secondaryButton:ie?(e=>Object.assign(Object.assign({},e),{disabled:Se||ke<1||z&&ke<z||!z&&V&&ke>V||!1,onClick:()=>{const e=F(we,le,Te);R.onAdd(e,ke,!0)}}))(ie):void 0,wrapperStyle:R.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?t(o,{}):Me(),hideCrossButton:Ee||ce},{children:[We,Ee&&ze?t(g,{productData:ze,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:H,onClose:()=>{Le(!1)}}):t(o,{})]}))})};export{R as ProductPickerModal,T as ScreenName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as
|
|
1
|
+
import{jsxs as t,jsx as o,Fragment as i}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import c from"../../assets/icons/info.svg.js";import{CheckBox as d}from"../checkBox/CheckBox.js";import{IconButton as l}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{Tooltip as r}from"../tooltips/Tooltip.js";import{TitleSmall as a,BodyCaption as s}from"../TypographyStyle.js";import{CurrencySymbols as u}from"./constants.js";import{ProductHelper as v}from"./helpers/ProductHelper.js";import{ProductPickerTag as p}from"./ProductPickerTag.js";import{ProductCardStyle as h,ProductInfo as I,ProductSubTitle as m,SKUIDBadge as y,EllipsedBodyTiny as P}from"./style.js";import{shouldShowVariant as f,getSkuId as g}from"./utility.js";const k=i=>{var e,c,d,l,n,r,a,s,v;const{collectionId:p,productId:h,data:I,selectedData:m,selectedCollectionsDispatch:y,viewOnly:P,upliftAdditions:g,isProductPartiallyChecked:k,hideProductCheckbox:j,outOfStockAction:C,hideVariantCheckbox:O,hideProductVariants:x,pickerType:D,onProductDetailClick:V,showProductDetailInfoIcon:S}=i,T=t=>{var o,i,e,c,d,l;if(!(null===(i=null===(o=null==m?void 0:m[p])||void 0===o?void 0:o.products)||void 0===i?void 0:i[h]))return!1;return!!(null===(l=null===(d=null===(c=null===(e=null==m?void 0:m[p])||void 0===e?void 0:e.products)||void 0===c?void 0:c[h])||void 0===d?void 0:d.variants)||void 0===l?void 0:l[t])},A=x||!f(I)?`${I.currency&&null!==(e=u[I.currency])&&void 0!==e?e:""}${null!==(v=null!==(n=null===(l=null===(d=Object.values(null!==(c=I.variants)&&void 0!==c?c:{}))||void 0===d?void 0:d[0])||void 0===l?void 0:l.price)&&void 0!==n?n:null===(s=null===(a=Object.values(null!==(r=I.variants)&&void 0!==r?r:{}))||void 0===a?void 0:a[0])||void 0===s?void 0:s.actualPrice)&&void 0!==v?v:""}`:"";return t("div",{children:[o(b,{isVariant:!1,data:I,productId:h,collectionId:p,isSelected:(()=>{var t,o;return!!(null===(o=null===(t=null==m?void 0:m[p])||void 0===t?void 0:t.products)||void 0===o?void 0:o[h])})(),isPartiallyChecked:k,selectedCollectionsDispatch:y,upliftAdditions:g,viewOnly:P,hideProductCheckbox:j,hideVariantCheckbox:O,hideProductVariants:x,pickerType:D,outOfStockAction:C,onProductDetailClick:V,showProductDetailInfoIcon:S,currencyAndPrice:A},h),x?null:f(I)&&Object.keys(I.variants||[]).map((t=>{var i,e,c,d,l,n,r;const a=`${I.currency&&null!==(i=u[I.currency])&&void 0!==i?i:""}${null!==(r=null!==(d=null===(c=null===(e=I.variants)||void 0===e?void 0:e[t])||void 0===c?void 0:c.price)&&void 0!==d?d:null===(n=null===(l=I.variants)||void 0===l?void 0:l[t])||void 0===n?void 0:n.actualPrice)&&void 0!==r?r:""}`;return o(b,{isVariant:!0,hideVariantCheckbox:O,data:Object.assign(Object.assign({},I.variants[t]),{currency:I.currency}),variantId:t,productId:h,viewOnly:P,upliftAdditions:g,collectionId:p,isSelected:T(t),selectedCollectionsDispatch:y,outOfStockAction:C,onProductDetailClick:V,showProductDetailInfoIcon:S,currencyAndPrice:a},t)}))]})},b=u=>{const{isVariant:f,data:k,productId:b,collectionId:j,variantId:C,isSelected:O,selectedCollectionsDispatch:x,viewOnly:D,upliftAdditions:V,isPartiallyChecked:S,hideProductCheckbox:T,outOfStockAction:A,hideVariantCheckbox:w,hideProductVariants:U,pickerType:$="PRODUCT",onProductDetailClick:B,showProductDetailInfoIcon:F,currencyAndPrice:R}=u,{isVariantForProductPickerTag:H,dataForProductPickerTag:K,tagText:L,tagType:q}=v.getDataForProductPickerTag(k,f,A),z=g(k,f);return t(h,Object.assign({isVariant:f,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===$&&(T||w)){const t=Object.keys(k.variants);U?O?x({type:"productUnselected",data:{productId:b,collectionId:j}}):V("productSelected",{productId:b,variantId:C,collectionId:j,product:k}):O?x({type:"variantUnselected",data:{productId:b,variantId:C,collectionId:j}}):V("variantSelected",{productId:b,variantId:C||t[0],collectionId:j,variant:k})}},isActive:O},{children:[f&&!D&&!w||!f&&!D&&!T?o(d,{isChecked:O,isPartiallyChecked:S||!1,onValueChange:function(t,o,i){null==i||i.stopPropagation(),console.log("checkbox clicked: ",t," isVariant: ",f),f?t?(console.log("4",{productId:b,collectionId:j,variantId:C,variant:k,hideProductVariants:U}),V(U?"productSelected":"variantSelected",{productId:b,variantId:C,collectionId:j,variant:k})):(console.log("3",{productId:b,collectionId:j,variantId:C,hideProductVariants:U}),x({type:U?"productUnselected":"variantUnselected",data:{productId:b,variantId:C,collectionId:j}})):t?(console.log("2",{productId:b,collectionId:j,product:k}),V("productSelected",{productId:b,collectionId:j,product:k})):(console.log("1",{productId:b,collectionId:j}),x({type:"productUnselected",data:{productId:b,collectionId:j}}))}}):o(i,{}),o("div",{children:o(n,{width:40,height:40,imageUrl:k.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16}},{children:[o(r,Object.assign({variant:"light",body:k.name,placement:"bottom",delay:400},{children:o(a,Object.assign({style:{flex:1},numberOfLines:1},{children:k.name}))})),t(I,{children:[o(p,{isVariant:H,data:K,tagText:L,tagType:q}),F&&o(l,{onClick:()=>{null==B||B(k)},Icon:()=>o(c,{width:20,height:20,color:e.content.placeholder})})]})]})),t(m,{children:[!(null==K?void 0:K.fbStatus)&&H||L?null:o(s,Object.assign({color:e.content.secondary},{children:R})),z&&o(r,Object.assign({body:z,placement:"top"},{children:o(y,{children:o(P,{children:`SKU ID: ${z}`})})}))]})]}))]}))};export{b as ProductCard,k as ProductGroup};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-components";import{COLORS as r}from"../../constants/Theme.js";import
|
|
1
|
+
import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-components";import{COLORS as r}from"../../constants/Theme.js";import e from"../../assets/icons/cross.svg.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{Tooltip as c}from"../tooltips/Tooltip.js";import{TitleRegular as d,BodyCaption as l}from"../TypographyStyle.js";import{CurrencySymbols as s}from"./constants.js";import{ProductHelper as u}from"./helpers/ProductHelper.js";import{ProductPickerTag as p}from"./ProductPickerTag.js";import{SKUIDBadge as m,EllipsedBodyTiny as g}from"./style.js";import{getSkuId as v,shouldShowVariant as f}from"./utility.js";const x=i=>o(y,{children:[t(b,{}),t(D,{children:t(a,{className:"close-button",onClick:i.onClose,Icon:e,width:20,height:20})}),t(h,{productData:i.productData,outOfStockAction:i.outOfStockAction,useDynamicInfoImageSize:i.useDynamicInfoImageSize})]}),h=i=>{var e,a,x,h,y,b,D,P,T,S,O,w,$,z,A,F;const C=void 0===i.productData.variants;let H;if(C)H=`${i.productData.currency&&null!==(e=s[i.productData.currency])&&void 0!==e?e:""}${null!==(y=null!==(x=null===(a=i.productData)||void 0===a?void 0:a.price)&&void 0!==x?x:null===(h=i.productData)||void 0===h?void 0:h.actualPrice)&&void 0!==y?y:""}`;else{const o=null===(b=i.productData)||void 0===b?void 0:b.currency;H=`${o&&null!==(D=s[o])&&void 0!==D?D:""}${null!==(A=null!==(O=null===(S=null===(T=Object.values(null!==(P=i.productData.variants)&&void 0!==P?P:{}))||void 0===T?void 0:T[0])||void 0===S?void 0:S.price)&&void 0!==O?O:null===(z=null===($=Object.values(null!==(w=i.productData.variants)&&void 0!==w?w:{}))||void 0===$?void 0:$[0])||void 0===z?void 0:z.actualPrice)&&void 0!==A?A:""}`}const{isVariantForProductPickerTag:N,dataForProductPickerTag:U,tagText:V,tagType:_}=u.getDataForProductPickerTag(i.productData,C,i.outOfStockAction),B=v(i.productData,C);return o(j,{children:[t(k,{children:t(n,{useDynamicInfoImageSize:i.useDynamicInfoImageSize,imageUrl:i.productData.image,width:200,height:200,borderRadius:4})}),o(I,{children:[B&&t(c,Object.assign({body:B,placement:"top"},{children:t(m,{children:t(g,{children:`SKU ID: ${B}`})})})),t(d,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(l,Object.assign({color:r.content.secondary},{children:`Product ID: ${i.productData.id}`})),t(l,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(F=i.productData.description)&&void 0!==F?F:""}}),t(l,Object.assign({color:r.content.secondary},{children:C?H:f(i.productData)?null:H})),t(p,{isVariant:N,data:U,tagText:V,tagType:_})]})]})},y=i.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1;
|
|
4
4
|
background: rgba(0, 0, 0, 0.5);
|
|
@@ -17,11 +17,11 @@ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-component
|
|
|
17
17
|
word-break: break-word;
|
|
18
18
|
margin-top: 8px;
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,b=i.div`
|
|
21
21
|
display: flex;
|
|
22
22
|
flex: 1;
|
|
23
23
|
background: rgba(0, 0, 0, 0.5);
|
|
24
|
-
`,
|
|
24
|
+
`,D=i.div`
|
|
25
25
|
position: relative;
|
|
26
26
|
|
|
27
27
|
.close-button {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import n from"../../assets/icons/search.svg.js";import{cloneDeep as r}from"lodash";import{useContext as
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import n from"../../assets/icons/search.svg.js";import{cloneDeep as r}from"lodash";import{useContext as i,useRef as s,useState as l,useEffect as d}from"react";import{COLORS as a}from"../../constants/Theme.js";import{CheckBox as u}from"../checkBox/CheckBox.js";import{IconButton as h}from"../icon-button/IconButton.js";import{InfiniteScroll as p}from"../InfiniteScroll/InfiniteScroll.js";import{Input as m}from"../input/Input.js";import{Spinner as g}from"../spinner/Spinner.js";import{BodyCaption as j,TitleRegular as f}from"../TypographyStyle.js";import{EmptyState as v}from"./emptyState.js";import{ProductGroup as b}from"./product.js";import{ProductPickerShimmer as y}from"./ProductPickerShimmer.js";import{CollectionIdContext as O}from"./reducers.js";import{ProductScreenHeader as k,ProductScreenCollectionCardStyle as C}from"./style.js";import{OUT_OF_STOCK_ACTION as P}from"./type.js";import{getVariantIdsToFetchAtProductLevel as I,markVariantsAsApprovedProductsLevel as D,isCollectionPartiallyChecked as S,isProductPartiallyChecked as x,liftTheStateUp as E}from"./utility.js";const R=R=>{var T,w;const{data:V,collectionsDispatch:A,selectedData:B,selectedCollectionsDispatch:F,productFetcher:J,storeId:K,setScreen:M,setSaveDisabled:N,hideInCollectionSearch:U,customCollectionRestriction:W,hideProductCheckbox:z,outOfStockAction:H=P.BLUR,hideVariantCheckbox:L=!1,selectProductsFromCustomCollection:_=!1,pickerType:q,hideProductVariants:G,fbStatusFetcher:Q,onProductDetailClick:X,showProductDetailInfoIcon:Y,scrollContainerRef:Z}=R,$=i(O),tt=s(0),et=s(!1),[ot,ct]=l(""),[nt,rt]=l(!1),[it,st]=l(V),lt=s(!0),dt=s(!1);d((()=>{if(lt.current)return void(lt.current=!1);const t=setTimeout((()=>{ot.length?(rt(!0),R.searchInCollectionFetcher(K,$,ot).then((t=>{const e=r(V);e.products=t,st(e);const o=I(null!=t?t:{});ut(o,null!=t?t:{},!0),N(!1),rt(!1)}))):st(V)}),800);return()=>clearTimeout(t)}),[ot]);d((()=>{var t,e,o,c;dt.current=!1,tt.current=Math.floor((null===(e=Object.keys(null!==(t=V.products)&&void 0!==t?t:{}))||void 0===e?void 0:e.length)/10);const n=I(null!==(o=V.products)&&void 0!==o?o:{});ut(n,null!==(c=V.products)&&void 0!==c?c:{})}),[$]);const at=!!W&&V.isSmartCollection;d((()=>{(null==V?void 0:V.products)||ht(10)}),[]);const ut=(t,e,o)=>{Q||(o?D(e,A,$,it,st):D(e,A,$)),t.length>0&&Q&&Q(K,t).then((t=>{const c=Object.assign({},e);Object.keys(e).forEach((o=>{var n,r;Object.keys(null!==(r=null===(n=null==e?void 0:e[o])||void 0===n?void 0:n.variants)&&void 0!==r?r:{}).forEach((n=>{var r,i;const s=null===(r=null==e?void 0:e[o].variants)||void 0===r?void 0:r[n];s&&"REJECTED"===t[n]?s.fbStatus="REJECTED":s&&"APPROVED"===t[n]&&(s.fbStatus="APPROVED");const l=null===(i=null==c?void 0:c[o])||void 0===i?void 0:i.variants;l&&l[n]&&(l[n]=s)}))})),o?(st((t=>{const e=Object.assign({},t);return e.products=c,e})),A({type:"productsPaged",data:{collectionId:$,products:c}})):A({type:"productsPaged",data:{collectionId:$,products:c}})})).catch((t=>{o?D(e,A,$,it,st):D(e,A,$)}))},ht=t=>{N(!0),rt(!0),J($,K,t,0).then((e=>{if(Object.keys(e).length||(dt.current=!0),Object.keys(e).length){st(Object.assign(Object.assign({},it),{products:e}));const t=I(e);ut(t,e),tt.current=1}t||F({type:"selected",data:{id:$,val:Object.assign(Object.assign({},V),{products:e})}}),N(!1),rt(!1)})).catch()},pt=(t,e)=>{const o=E(e,V);F({type:t,data:Object.assign(Object.assign({},o),{isRestricted:W})})},mt=!!(null==B?void 0:B[$])&&!!Object.keys(null!==(w=null===(T=null==B?void 0:B[$])||void 0===T?void 0:T.products)&&void 0!==w?w:{}).length;return t("div",{children:[t(k,{children:[e(h,{Icon:o,height:16,onClick:()=>{M("collections")}}),e(j,Object.assign({style:{color:a.content.secondary}},{children:V.name}))]}),!U&&e("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e(m,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>nt&&ot.length?e(g,{size:"small",color:a.content.primary}):e(n,{})},id:"listInput",height:"24px",type:"text",value:ot,onChangeText:t=>{t.length&&t.trim().length?ct(t):ct("")},placeholder:"Search using ID, Name or SKU ID"})})),Object.keys((null==it?void 0:it.products)||[]).length>0&&!at&&!ot.length&&!z&&"-1"!==$&&t(C,{children:[e(u,{isChecked:mt,isPartiallyChecked:S($,it,B,G),onValueChange:function(t){t?ht():F({type:"unselected",data:{id:$}})}}),e("div",Object.assign({style:{width:40,height:40}},{children:e(c,{})})),e(f,{children:"All Products"})]}),e(p,Object.assign({hasData:!(Object.keys((null==it?void 0:it.products)||[]).length<10)&&!!Object.keys((null==it?void 0:it.products)||[]).length,fetchMore:()=>(et.current=!0,J($,K,10,tt.current).then((t=>{let e=!1;if(Object.keys(t).length||(e=!0),Object.keys(t).length){const e=it;e.products=Object.assign(Object.assign({},it.products),t),st(Object.assign({},e));const o=I(t);ut(o,t)}return N(!1),et.current=!1,tt.current+=1,e}))),containerRef:Z},{children:Object.keys((null==it?void 0:it.products)||[]).length?Object.keys(it.products||[]).map((t=>e(b,{outOfStockAction:H,collectionId:$,isProductPartiallyChecked:x($,t,B,it,G),productId:t,data:it.products[t],selectedData:B,selectedCollectionsDispatch:F,viewOnly:!_&&!!at,upliftAdditions:pt,hideProductCheckbox:z,hideVariantCheckbox:L,hideProductVariants:G,pickerType:q,onProductDetailClick:X,showProductDetailInfoIcon:Y},t))):nt?e(y,{limit:10}):e(v,{title:"No products to show",subtitle:ot.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})}))]})};export{R as ProductsScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as o,jsx as e,Fragment as t}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import{useEffect as i}from"react";import{IconButton as c}from"../icon-button/IconButton.js";import{BodyCaption as d}from"../TypographyStyle.js";import{CollectionCard as s}from"./collectionScreen.js";import{EmptyState as
|
|
1
|
+
import{jsxs as o,jsx as e,Fragment as t}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import{useEffect as i}from"react";import{IconButton as c}from"../icon-button/IconButton.js";import{BodyCaption as d}from"../TypographyStyle.js";import{CollectionCard as s}from"./collectionScreen.js";import{EmptyState as n}from"./emptyState.js";import{ProductGroup as r}from"./product.js";import{SelectedScreenHeader as u}from"./style.js";import{fetchFbStatusCollection as a,isCollectionPartiallyChecked as p,isProductPartiallyChecked as h,liftTheStateUp as v}from"./utility.js";const m=m=>{var C;const{customCollectionRestriction:y,selectedCollections:k,searchedCollections:f,searchedCollectionsDispatch:b,selectedCollectionsDispatch:j,setScreen:S,collections:I,onBackPress:O,hideVariantCheckbox:P,pickerType:g,hideProductVariants:x,hideProductCheckbox:D,storeId:w,fbStatusFetcher:R,setCollectionId:T,setSelectedCollectionId:V,hideCollectionCheckbox:A,renderWithoutModal:W,outOfStockAction:B}=m;i((()=>{var o;a(null!==(o=f.products)&&void 0!==o?o:{},w,b,R,"setProducts")}),[null==f?void 0:f.products]);const M=!!y&&(null==k?void 0:k.isCustom);return o("div",{children:[o(u,{children:[e(c,{Icon:l,onClick:()=>{S("collections"),O()}}),e(d,{children:(null===(C=Object.keys(null==f?void 0:f.collections))||void 0===C?void 0:C.length)?"Searched Collections & Products":"Searched Products"})]}),e("div",{children:Object.keys(null==f?void 0:f.products).length||Object.keys(null==f?void 0:f.collections).length?o(t,{children:[e(t,{children:Object.keys(null==f?void 0:f.collections).map((o=>e(s,{customCollectionRestriction:y,data:null==I?void 0:I[o],isDisabled:M&&!(null==k?void 0:k[o]),isChecked:!!(null==k?void 0:k[o]),isPartiallyChecked:p(o,null==I?void 0:I[o],k,x),selectedCollectionsDispatch:j,setCollectionId:T,setSelectedCollectionId:V,setScreen:S,id:o,hideCollectionCheckbox:A||"-1"===o,selectedCollections:k,renderWithoutModal:W,pickerType:g,usedInSearch:!0},o)))}),e(t,{children:Object.keys(null==f?void 0:f.products).map((o=>{var t,l;return Object.keys((null===(l=null===(t=null==f?void 0:f.products)||void 0===t?void 0:t[o])||void 0===l?void 0:l.products)||[]).map((t=>{var l,i,c;let d=!1;return(null===(l=null==f?void 0:f.products)||void 0===l?void 0:l.isCustom)&&(d=!0),e(r,{collectionId:o,upliftAdditions:(e,t)=>{console.log("uplift additions in search screen called with : ",{collectionId:o,type:e,payload:t}),((o,e,t)=>{var l;const i=v(t,null===(l=null==f?void 0:f.products)||void 0===l?void 0:l[o]);console.log("final payload: ",i," type: ",e," isRestricted: ",y),j({type:e,data:Object.assign(Object.assign({},i),{isRestricted:y})})})(o,e,t)},productId:t,data:(null===(i=null==f?void 0:f.products)||void 0===i?void 0:i[o].products)[t],isProductPartiallyChecked:h(o,t,k,null===(c=f.products)||void 0===c?void 0:c[o],x),selectedData:k,selectedCollectionsDispatch:j,viewOnly:d,hideProductCheckbox:D,hideVariantCheckbox:P,hideProductVariants:x,pickerType:g,outOfStockAction:B},t)}))}))})]}):e(n,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{m as SearchScreen};
|