@bikdotai/bik-component-library 0.0.570 → 0.0.572-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/BikSidebar.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +2 -0
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/productInfoOverlay.js +9 -8
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/utility.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/utility.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/BikSidebar.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +2 -0
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/productInfoOverlay.js +3 -2
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/utility.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/utility.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=require("react/jsx-runtime"),i=require("../../assets/icons/Bik_logo.svg.js"),n=require("react"),t=require("../progress-bar/CircularProgressBar.js"),o=require("../../constants/Theme.js"),s=require("../navigation-hyperlink/NavigationHyperlink.js"),l=require("./SidebarPopup.js"),d=require("./SidebarStyles.js"),r=require("./SimpleSidebar.js");const a=i=>{const{icon:n,isActive:t,activeStateIcon:s,hoverStateIcon:l,isHovered:d}=i,r=n,a=s,u=l;return e.jsx(e.Fragment,{children:t?e.jsx(a,{width:20,height:20}):d?e.jsx(u,{width:20,height:20,color:o.COLORS.surface.standard}):e.jsx(r,{width:20,height:20,color:o.COLORS.surface.standard})})};exports.BikSidebar=o=>{const{logoSvg:u,allMenuList:c,activeMainMenu:v,activeSubMenu:g,router:m,onClickingMainMenu:h,onClickingSubMenu:p,onClickingAccessUpgradePanel:y,onClickingPopupMenuItem:j,popupMinHeight:k,isNewSidebar:b}=o,[S,x]=n.useState(v),[w,f]=n.useState(),[N,M]=n.useState(g),[O,C]=n.useState(!1),[L,B]=n.useState(),[E,I]=n.useState(),[P,q]=n.useState(),_=c.filter((e=>e.is2ndLastSticky||e.isLastSticky)).length;n.useEffect((()=>{x(v)}),[v]),n.useEffect((()=>{M(g)}),[g]);const H=e=>{var i,n;if(f(void 0),B(void 0),"popup"==(null==e?void 0:e.layout)){const i=F();i&&I(i),B(e)}else{const t=document.getElementById((null===(n=null===(i=e.displayName)||void 0===i?void 0:i.split(" "))||void 0===n?void 0:n.join(""))||e.key.toString());if(t){const e=A(t);q(e)}f(e)}},A=e=>{const i=e.getBoundingClientRect();let n=i.top;const t=e.querySelectorAll("div");let o=null;if(t.forEach((e=>{e.className.includes("sticky")&&(o=e)})),o){const e=window.innerHeight-i.bottom;n=i.top+e-140}return n},R=(i,n)=>{var t,o,s,l,d,r;return e.jsxs("div",Object.assign({id:(null===(o=null===(t=i.displayName)||void 0===t?void 0:t.split(" "))||void 0===o?void 0:o.join(""))||i.key.toString(),className:"main--sidebar",onClick:()=>(e=>{var i;"popup"!==(null==e?void 0:e.layout)&&(B(void 0),f(void 0),C(!0),x(e),!e.path&&h(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?M(null==e?void 0:e.children[0]):M({}),f(void 0),setTimeout((()=>{C(!1)}),1e3))})(i),onMouseEnter:()=>{!O&&H(i)},onMouseOver:()=>{!O&&H(i)},onMouseLeave:()=>{var e;(null===(e=null==i?void 0:i.children)||void 0===e?void 0:e.length)||(f(void 0),B(void 0))},onFocus:()=>{console.log(";")},"aria-hidden":"true"},{children:[i.isNew&&e.jsx("div",Object.assign({className:"new-tag "+(i.isLastSticky?"tag-sticky":"")},{children:"NEW"})),e.jsxs("div",Object.assign({id:(null===(l=null===(s=i.displayName)||void 0===s?void 0:s.split(" "))||void 0===l?void 0:l.join(""))+"_sub"||i.key.toString()+"_sub",className:`sidebar-menu-item ${(null==S?void 0:S.key)
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("../../assets/icons/Bik_logo.svg.js"),n=require("react"),t=require("../progress-bar/CircularProgressBar.js"),o=require("../../constants/Theme.js"),s=require("../navigation-hyperlink/NavigationHyperlink.js"),l=require("./SidebarPopup.js"),d=require("./SidebarStyles.js"),r=require("./SimpleSidebar.js");const a=i=>{const{icon:n,isActive:t,activeStateIcon:s,hoverStateIcon:l,isHovered:d}=i,r=n,a=s,u=l;return e.jsx(e.Fragment,{children:t?e.jsx(a,{width:20,height:20}):d?e.jsx(u,{width:20,height:20,color:o.COLORS.surface.standard}):e.jsx(r,{width:20,height:20,color:o.COLORS.surface.standard})})};exports.BikSidebar=o=>{const{logoSvg:u,allMenuList:c,activeMainMenu:v,activeSubMenu:g,router:m,onClickingMainMenu:h,onClickingSubMenu:p,onClickingAccessUpgradePanel:y,onClickingPopupMenuItem:j,popupMinHeight:k,isNewSidebar:b}=o,[S,x]=n.useState(v),[w,f]=n.useState(),[N,M]=n.useState(g),[O,C]=n.useState(!1),[L,B]=n.useState(),[E,I]=n.useState(),[P,q]=n.useState(),_=c.filter((e=>e.is2ndLastSticky||e.isLastSticky)).length;n.useEffect((()=>{x(v)}),[v]),n.useEffect((()=>{M(g)}),[g]);const H=e=>{var i,n;if(f(void 0),B(void 0),"popup"==(null==e?void 0:e.layout)){const i=F();i&&I(i),B(e)}else{const t=document.getElementById((null===(n=null===(i=e.displayName)||void 0===i?void 0:i.split(" "))||void 0===n?void 0:n.join(""))||e.key.toString());if(t){const e=A(t);q(e)}f(e)}},A=e=>{const i=e.getBoundingClientRect();let n=i.top;const t=e.querySelectorAll("div");let o=null;if(t.forEach((e=>{e.className.includes("sticky")&&(o=e)})),o){const e=window.innerHeight-i.bottom;n=i.top+e-140}return n},R=(i,n)=>{var t,o,s,l,d,r;return e.jsxs("div",Object.assign({id:(null===(o=null===(t=i.displayName)||void 0===t?void 0:t.split(" "))||void 0===o?void 0:o.join(""))||i.key.toString(),className:"main--sidebar",onClick:()=>(e=>{var i;"popup"!==(null==e?void 0:e.layout)&&(B(void 0),f(void 0),C(!0),x(e),!e.path&&h(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?M(null==e?void 0:e.children[0]):M({}),f(void 0),setTimeout((()=>{C(!1)}),1e3))})(i),onMouseEnter:()=>{!O&&H(i)},onMouseOver:()=>{!O&&H(i)},onMouseLeave:()=>{var e;(null===(e=null==i?void 0:i.children)||void 0===e?void 0:e.length)||(f(void 0),B(void 0))},onFocus:()=>{console.log(";")},"aria-hidden":"true"},{children:[i.isNew&&e.jsx("div",Object.assign({className:"new-tag "+(i.isLastSticky?"tag-sticky":"")},{children:"NEW"})),e.jsxs("div",Object.assign({id:(null===(l=null===(s=i.displayName)||void 0===s?void 0:s.split(" "))||void 0===l?void 0:l.join(""))+"_sub"||i.key.toString()+"_sub",className:`sidebar-menu-item \n\t\t\t\t\t${(null==S?void 0:S.key)===i.key?"main-menu-active-class":""} \n\t\t\t\t\t${i.isLastSticky?"sticky-menu-int":""} \n\t\t\t\t\t${i.is2ndLastSticky?"sticky-menu":""} \n\t\t\t\t\t${i.key===(null==w?void 0:w.key)?"sidebar-menu-item-hover":""} \n\t\t\t\t\t${i.isNew?"new-menu-item":""}`},{children:[e.jsx(a,{icon:i.icon,isActive:i.key==(null==S?void 0:S.key),activeStateIcon:null!==(d=i.activeIcon)&&void 0!==d?d:{},hoverStateIcon:null!==(r=i.hoverIcon)&&void 0!==r?r:{},isHovered:i.key==(null==w?void 0:w.key)||i.key==(null==L?void 0:L.key)}),e.jsx("div",Object.assign({className:"menu-item-container"},{children:e.jsx("p",Object.assign({className:"menu-item-text "+((null==i?void 0:i.key)===(null==S?void 0:S.key)?"active-menu-item-text":"")},{children:i.displayName}))}))]}),n)]}),n)};n.useEffect((()=>{const e=()=>{const e=F();e&&I(e),$()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const $=()=>{const e=document.getElementById("_sub-menu"),i=null==e?void 0:e.getBoundingClientRect().height;i&&q(window.innerHeight-i)},F=()=>{var e,i;if(L){const n=(null===(i=null===(e=L.displayName)||void 0===e?void 0:e.split(" "))||void 0===i?void 0:i.join(""))+"_sub"||L.key.toString()+"_sub",t=document.getElementById(n);if(t){const e=t.getBoundingClientRect();let i=e.top;const n=null!=k?k:320;return e.bottom+n>window.innerHeight&&(i-=e.bottom+n-window.innerHeight),i}return null}};return e.jsxs(d.SideBarContainer,{children:[e.jsx("div",Object.assign({className:"bik-header-logo",onClick:()=>{},onKeyDown:()=>{},"aria-hidden":"true"},{children:u||e.jsx(i.default,{})})),e.jsxs(d.SibeBarMenuItem,{children:[null==c?void 0:c.map(((i,t)=>{var o,d;return e.jsxs(n.Fragment,{children:[i.path?e.jsx(s.NavigationHyperlink,Object.assign({href:i.path,router:m},{children:R(i,t)})):R(i,t),e.jsxs(e.Fragment,{children:["popup"===i.layout&&(null===(o=null==L?void 0:L.children)||void 0===o?void 0:o.length)&&e.jsx(l.SidebarPopup,{top:null!=E?E:void 0,menuList:null==L?void 0:L.children,onClickingPopupMenu:e=>{j&&j(e),B(void 0)},onMouseLeaveOnMenu:()=>B(void 0)}),(null===(d=null==w?void 0:w.children)||void 0===d?void 0:d.length)&&e.jsx(r.SimpleSidebar,{menuList:null==w?void 0:w.children,activeMenu:N,onMouseLeaveOnMenu:()=>f(void 0),left:b?92:88,postion:"fixed",header:w.displayName,theme:"brand",router:m,showAccessUpgradePanel:w.showAccessUpgradePanel,onMenuClick:(e,i)=>{M(e),x(w),f(void 0),B(void 0),i&&p(e)},onUpgrade:y,top:b&&P||0,isNewSidebar:b})]})]},t)})),"number"==typeof o.onboardingPercentage&&e.jsx("div",Object.assign({className:"main--sidebar"},{children:e.jsx("div",Object.assign({id:"bik-onboarding__checklist",className:"sidebar-menu-item "+(0===_?"sticky-menu":1===_?"sticky-menu-int":"sticky-menu-three")},{children:e.jsx(t.default,{percentage:o.onboardingPercentage,width:48})}))}))]})]})};
|
|
@@ -9,6 +9,7 @@ export interface ProductVariant {
|
|
|
9
9
|
displayOrder?: number | null;
|
|
10
10
|
fbStatus?: FbProductStatus;
|
|
11
11
|
description?: string;
|
|
12
|
+
id: string;
|
|
12
13
|
}
|
|
13
14
|
export interface Product {
|
|
14
15
|
name: string;
|
|
@@ -17,6 +18,7 @@ export interface Product {
|
|
|
17
18
|
variants?: {
|
|
18
19
|
[key: string]: ProductVariant;
|
|
19
20
|
};
|
|
21
|
+
id: string;
|
|
20
22
|
}
|
|
21
23
|
export interface Collection {
|
|
22
24
|
name: 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"),l=require("../input/Input.js"),i=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"),x=require("./searchScreen.js"),g=require("./selectedScreen.js"),j=require("./style.js"),y=require("./type.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:
|
|
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"),l=require("../input/Input.js"),i=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"),x=require("./searchScreen.js"),g=require("./selectedScreen.js"),j=require("./style.js"),y=require("./type.js"),f=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:m,onClose:v,visible:P,zIndex:k,exactLimit:O,limit:I,hideCollectionCheckbox:F,hideProductCheckbox:R,outOfStockAction:T=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:q,selectProductsFromCustomCollection:D,hideSelectionCount:E,title:w,width:A,left:N,renderWithoutModal:B,onClickSave:V,pickerType:L,hideProductVariants:M=!1,startupScreen:$=exports.ScreenName.Collections,rearrangeEnabled:_,selectSingleItem:z=!1,showProductDetails:H,containerStyle:W,crossButtonInsideHeader:G=!1}=e,[K,U]=c.useReducer(C.collectionsReducer,{}),[Y,J]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes($)?$:exports.ScreenName.Collections),[Q,X]=c.useState("grid"),[Z,ee]=c.useState(""),[te,oe]=c.useState(""),[ce,re]=c.useState(0),[se,ne]=c.useState(!1),[le,ie]=c.useState(0),[ae,de]=c.useState(""),[ue,he]=c.useState(!1),[pe,Se]=c.useState(!1),[Ce,xe]=c.useReducer(C.searchReducer,{collections:{},products:{}}),[ge,je]=c.useReducer(C.selectedColectionsReducer,Object.keys(m).length>0?m:{}),ye=c.useRef(null),[fe,be]=c.useState(!1),[me,ve]=c.useState();c.useEffect((()=>{ne(!0),Se(!0),e.collectionFetcher(ce,b).then((e=>{U({type:"fetched",data:(null==e?void 0:e.collections)||{}}),ne(!1),re((e=>e+1)),Se(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;M?Object.keys(ge||[]).forEach((t=>{var o;Object.keys((null===(o=ge[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&ge[-1]&&(null===(c=ge[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(ge||[]).forEach((t=>{var o;Object.keys((null===(o=ge[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=ge[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),ie(e)}),[K,ge,M]),c.useEffect((()=>{te&&(ne(!0),e.productFetcher(te,b).then((e=>{const t=f.addIdToProductsAndVariants(e);Object.keys(e).length&&U({type:"productsFetched",data:{collectionId:te,products:t}}),ne(!1)})).catch())}),[te]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==Y&&(ae.length||"collections"!==Y)&&(ae.length?(he(!0),e.searchFetcher(b,ae).then((e=>{"collections"in e&&"products"in e?(xe({type:"set",data:e}),U({type:"searched",data:e.collections})):(xe({type:"set",data:{collections:{},products:e}}),U({type:"searched",data:e})),J("searchProducts"),ne(!1),he(!1)}))):J("collections"))}),800);return()=>clearTimeout(t)}),[ae]),c.useEffect((()=>{V&&(e.onAdd(ge,le),Pe())}),[V]),c.useEffect((()=>{z&&Object.keys(ge||{}).length&&le&&(e.onAdd(ge,le),Pe())}),[z,ge,le]);const Pe=()=>{je({type:"reset",data:{}})},ke=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"===Y||"searchProducts"===Y)&&t.jsx("div",Object.assign({style:{padding:B?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(l.Input,{placeholder:"Search for collections and products, or type a product ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ue?t.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:ae,onChangeText:e=>{e.length&&e.trim().length?de(e):de("")}})}))}),t.jsxs(j.ScrollContainerStyle,Object.assign({ref:ye,screenName:Y},{children:["collections"===Y&&t.jsx(u.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:pe,collections:K,selectedCollectionsDispatch:je,setCollectionId:ee,setSelectedCollectionId:oe,setScreen:J,selectedCollections:ge,collectionFetcher:e.collectionFetcher,storeId:b,collectionsDispatch:U,setSaveDisabled:ne,pagingControls:{curPage:ce,setCurPage:re},hideCollectionCheckbox:F,renderWithoutModal:B,pickerType:L,scrollContainerRef:ye}),"products"===Y&&Z&&t.jsx(C.CollectionIdContext.Provider,Object.assign({value:Z},{children:t.jsx(p.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:J,storeId:b,data:K[Z],collectionsDispatch:U,selectedCollectionsDispatch:je,selectedData:ge,setSaveDisabled:ne,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:R,outOfStockAction:T,hideVariantCheckbox:q,selectProductsFromCustomCollection:D,renderWithoutModal:B,pickerType:L,hideProductVariants:M,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{be(!0),ve(e)},showProductDetailInfoIcon:H,scrollContainerRef:ye})})),"view"===Y&&t.jsx(g.SelectedScreen,{selectedCollections:ge||{},selectedCollectionsDispatch:je,setScreen:J,collections:K,hideProductVariants:M,outOfStockAction:T,storeId:b,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===Y&&t.jsx(S.RearrangeScreen,{selectedCollections:ge||{},selectedCollectionsDispatch:je,setScreen:J,outOfStockAction:T,rearrangeViewType:"grid"===Q?"list":"grid",scrollContainerRef:ye,storeId:b,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===Y&&t.jsx(x.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:ge||{},searchedCollections:Ce||{},searchedCollectionsDispatch:xe,selectedCollectionsDispatch:je,setScreen:J,collections:K,onBackPress:()=>{de(""),xe({type:"set",data:{collections:{},products:{}}})},pickerType:L,hideProductCheckbox:R,hideProductVariants:M,hideVariantCheckbox:q,storeId:b,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:ee,setSelectedCollectionId:oe,renderWithoutModal:B,hideCollectionCheckbox:F,outOfStockAction:T})]}))]}));return t.jsx(t.Fragment,{children:B?ke:t.jsxs(i.StyledModal,Object.assign({zIndex:k,open:P,onClose:()=>{null==v||v(),Pe()},headingTitle:w||("collections"===Y||"products"===Y?"Select Products":"view"===Y?"Selected Products":"searchProducts"===Y?"Searched Results":"rearrange"===Y?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:A||"600px",left:N||"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:{buttonText:se?"Loading...":Y===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:se||le<1||O&&le<O||!O&&I&&le>I||!1,onClick:()=>{e.onAdd(ge,le),Pe()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:E?t.jsx(t.Fragment,{}):O&&le>O?t.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):I&&le>I?t.jsx(d.Tag,{tagText:`You can only select ${I} products`,type:"negative"}):le>0?t.jsx(n.Button,{onClick:()=>{J(_?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:O?`${le}/${O} products selected`:`${le} products selected`,buttonType:["rearrange","view"].includes(Y)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(Y)}):t.jsx(n.Button,{disabled:!0,buttonText:O?`${le}/${O} products selected`:`${le} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:fe||G},{children:[ke,fe&&me?t.jsx(h.ProductInfoOverlay,{productData:me,outOfStockAction:T,onClose:()=>{be(!1)}}):t.jsx(t.Fragment,{})]}))})};
|
|
@@ -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"),r=require("../../assets/icons/cross.svg.js"),i=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.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"),r=require("../../assets/icons/cross.svg.js"),i=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.js"),d=require("../TypographyStyle.js"),s=require("./ProductPickerTag.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=n(t);const l=t=>{var r;const i=void 0===t.productData.variants;return e.jsxs(f,{children:[e.jsx(g,{children:e.jsx(a.ShimmerImage,{imageUrl:t.productData.image,width:"200px",height:200,borderRadius:4})}),e.jsxs(h,{children:[e.jsx(d.TitleRegular,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:`Product ID: ${t.productData.id}`})),e.jsx(d.BodyCaption,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(r=t.productData.description)&&void 0!==r?r:""}}),e.jsx(s.ProductPickerTag,{isVariant:i,data:t.productData,outOfStockAction:t.outOfStockAction})]})]})},u=c.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1;
|
|
4
4
|
background: rgba(0, 0, 0, 0.5);
|
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
max-height: 300px;
|
|
16
16
|
overflow-y: auto;
|
|
17
17
|
word-break: break-word;
|
|
18
|
+
margin-top: 8px;
|
|
18
19
|
}
|
|
19
|
-
`,p=
|
|
20
|
+
`,p=c.default.div`
|
|
20
21
|
display: flex;
|
|
21
22
|
flex: 1;
|
|
22
23
|
background: rgba(0, 0, 0, 0.5);
|
|
23
|
-
`,x=
|
|
24
|
+
`,x=c.default.div`
|
|
24
25
|
position: relative;
|
|
25
26
|
|
|
26
27
|
.close-button {
|
|
@@ -31,17 +32,17 @@
|
|
|
31
32
|
background: ${o.COLORS.surface.standard};
|
|
32
33
|
border-radius: 50%;
|
|
33
34
|
}
|
|
34
|
-
`,f=
|
|
35
|
+
`,f=c.default.div`
|
|
35
36
|
display: flex;
|
|
36
37
|
background: white;
|
|
37
38
|
padding: 24px;
|
|
38
39
|
gap: 24px;
|
|
39
40
|
border-radius: 8px 8px 0px 0px;
|
|
40
|
-
`,g=
|
|
41
|
+
`,g=c.default.div`
|
|
41
42
|
display: flex;
|
|
42
|
-
`,h=
|
|
43
|
+
`,h=c.default.div`
|
|
43
44
|
display: flex;
|
|
44
45
|
flex: 1;
|
|
45
46
|
flex-direction: column;
|
|
46
|
-
gap:
|
|
47
|
-
`;exports.ProductInfoCard=
|
|
47
|
+
gap: 4px;
|
|
48
|
+
`;exports.ProductInfoCard=l,exports.ProductInfoOverlay=t=>e.jsxs(u,{children:[e.jsx(p,{}),e.jsx(x,{children:e.jsx(i.IconButton,{className:"close-button",onClick:t.onClose,Icon:r.default,width:20,height:20})}),e.jsx(l,{productData:t.productData,outOfStockAction:t.outOfStockAction})]});
|
|
@@ -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"),o=require("../../assets/icons/box.svg.js"),r=require("../../assets/icons/search.svg.js"),c=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 P,k;const{data:C,collectionsDispatch:x,selectedData:S,selectedCollectionsDispatch:I,productFetcher:m,storeId:q,setScreen:A,setSaveDisabled:T,hideInCollectionSearch:D,customCollectionRestriction:E,hideProductCheckbox:R,outOfStockAction:V=O.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:L=!1,selectProductsFromCustomCollection:F=!1,pickerType:w,hideProductVariants:B,fbStatusFetcher:_,onProductDetailClick:M,showProductDetailInfoIcon:U,scrollContainerRef:H}=f,J=s.useContext(g.CollectionIdContext),K=s.useRef(0),N=s.useRef(!1),[W,z]=s.useState(""),[G,Q]=s.useState(!1),[X,Y]=s.useState(C),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,J,W).then((e=>{const t=c.cloneDeep(C);t.products=e,Y(t);const o=b.getVariantIdsToFetchAtProductLevel(null!=e?e:{});te(o,null!=e?e:{},!0),T(!1),Q(!1)}))):Y(C)}),800);return()=>clearTimeout(e)}),[W]);s.useEffect((()=>{var e,t,o,r;$.current=!1,K.current=Math.floor((null===(t=Object.keys(null!==(e=C.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const c=b.getVariantIdsToFetchAtProductLevel(null!==(o=C.products)&&void 0!==o?o:{});te(c,null!==(r=C.products)&&void 0!==r?r:{})}),[J]);const ee=!!E&&C.isSmartCollection;s.useEffect((()=>{(null==C?void 0:C.products)||oe(10)}),[]);const te=(e,t,o)=>{_||(o?b.markVariantsAsApprovedProductsLevel(t,x,J,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,J)),e.length>0&&_&&_(q,e).then((e=>{const r=Object.assign({},t);Object.keys(t).forEach((o=>{var c,s;Object.keys(null!==(s=null===(c=null==t?void 0:t[o])||void 0===c?void 0:c.variants)&&void 0!==s?s:{}).forEach((c=>{var s,n;const i=null===(s=null==t?void 0:t[o].variants)||void 0===s?void 0:s[c];i&&"REJECTED"===e[c]?i.fbStatus="REJECTED":i&&"APPROVED"===e[c]&&(i.fbStatus="APPROVED");const l=null===(n=null==r?void 0:r[o])||void 0===n?void 0:n.variants;l&&l[c]&&(l[c]=i)}))})),o?(Y((e=>{const t=Object.assign({},e);return t.products=r,t})),x({type:"productsPaged",data:{collectionId:J,products:r}})):x({type:"productsPaged",data:{collectionId:J,products:r}})})).catch((e=>{o?b.markVariantsAsApprovedProductsLevel(t,x,J,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,J)}))},oe=e=>{T(!0),Q(!0),m(J,q,e,0).then((t=>{const o=b.addIdToProductsAndVariants(t);if(Object.keys(t).length||($.current=!0),Object.keys(t).length){Y(Object.assign(Object.assign({},X),{products:o}));const e=b.getVariantIdsToFetchAtProductLevel(o);te(e,o),K.current=1}e||I({type:"selected",data:{id:J,val:Object.assign(Object.assign({},C),{products:o})}}),T(!1),Q(!1)})).catch()},re=(e,t)=>{const o=b.liftTheStateUp(t,C);I({type:e,data:Object.assign(Object.assign({},o),{isRestricted:E})})},ce=!!(null==S?void 0:S[J])&&!!Object.keys(null!==(k=null===(P=null==S?void 0:S[J])||void 0===P?void 0:P.products)&&void 0!==k?k:{}).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:C.name}))]}),!D&&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(r.default,{})},id:"listInput",height:"24px",type:"text",value:W,onChangeText:e=>{e.length&&e.trim().length?z(e):z("")},placeholder:"Search for a product or type a product ID"})})),Object.keys((null==X?void 0:X.products)||[]).length>0&&!ee&&!W.length&&!R&&"-1"!==J&&e.jsxs(y.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:ce,isPartiallyChecked:b.isCollectionPartiallyChecked(J,X,S,B),onValueChange:function(e){e?oe():I({type:"unselected",data:{id:J}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(o.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:()=>(N.current=!0,m(J,q,10,K.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 o=b.getVariantIdsToFetchAtProductLevel(e);te(o,e)}return T(!1),N.current=!1,K.current+=1,t}))),containerRef:H},{children:Object.keys((null==X?void 0:X.products)||[]).length?Object.keys(X.products||[]).map((t=>e.jsx(j.ProductGroup,{outOfStockAction:V,collectionId:J,isProductPartiallyChecked:b.isProductPartiallyChecked(J,t,S,X,B),productId:t,data:X.products[t],selectedData:S,selectedCollectionsDispatch:I,viewOnly:!F&&!!ee,upliftAdditions:re,hideProductCheckbox:R,hideVariantCheckbox:L,hideProductVariants:B,pickerType:w,onProductDetailClick:M,showProductDetailInfoIcon:U},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."})}))]})};
|
|
@@ -36,3 +36,4 @@ export declare const markVariantsAsApprovedProductsLevel: (products: {
|
|
|
36
36
|
export declare const shouldShowVariant: (data: Product) => boolean;
|
|
37
37
|
export declare const isProductPartiallyChecked: (collectionId: string, productId: string, selectedData: SelectedItems, currentCollection: Collection, hideProductVariants?: boolean) => boolean;
|
|
38
38
|
export declare const isCollectionPartiallyChecked: (collectionId: string, collection: Collection, selectedCollections: SelectedItems, hideProductVariants?: boolean) => boolean;
|
|
39
|
+
export declare const addIdToProductsAndVariants: (productData: any) => {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("lodash");function t(o,t,l){if(!o)return{};const i=Object.keys(o).slice(l,l+t),n={};return i.forEach((t=>{n[t]=o[t]})),n}const l=(o,t,l)=>{Object.keys(o).forEach((t=>{var l,i;const n=null!==(i=null===(l=o[t])||void 0===l?void 0:l.products)&&void 0!==i?i:{};Object.keys(n).forEach((l=>{var i,n,d,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("lodash");function t(o,t,l){if(!o)return{};const i=Object.keys(o).slice(l,l+t),n={};return i.forEach((t=>{n[t]=o[t]})),n}const l=(o,t,l)=>{Object.keys(o).forEach((t=>{var l,i;const n=null!==(i=null===(l=o[t])||void 0===l?void 0:l.products)&&void 0!==i?i:{};Object.keys(n).forEach((l=>{var i,n,d,s;const v=null!==(s=null===(d=null===(n=null===(i=o[t])||void 0===i?void 0:i.products)||void 0===n?void 0:n[l])||void 0===d?void 0:d.variants)&&void 0!==s?s:{};Object.keys(v).forEach((i=>{var n,d,s,v;const e=null===(v=null===(s=null===(d=null===(n=o[t])||void 0===n?void 0:n.products)||void 0===d?void 0:d[l])||void 0===s?void 0:s.variants)||void 0===v?void 0:v[i];e&&!e.fbStatus&&(e.fbStatus="APPROVED")}))}))})),t({type:l,data:o})};exports.addIdToProductsAndVariants=o=>{const t={};return Object.keys(o).length?(Object.keys(o).map((l=>{var i,n;const d=null===(i=o[l])||void 0===i?void 0:i.variants,s={};Object.keys(d).length&&Object.keys(null===(n=o[l])||void 0===n?void 0:n.variants).map((o=>{s[o]=Object.assign(Object.assign({},d[o]),{id:o})})),t[l]=Object.assign(Object.assign({},o[l]),{variants:s,id:l})})),t):{}},exports.fetchFbStatusCollection=function(o,t,i,n){let d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";n||l(o,i,d);const s=(o=>{const t=[];return Object.keys(o).forEach((l=>{var i,n;const d=null!==(n=null===(i=o[l])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,s,v;const e=null!==(v=null===(s=null===(d=null===(n=o[l])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===s?void 0:s.variants)&&void 0!==v?v:{};Object.keys(e).forEach((n=>{var d,s,v,e;const c=null===(e=null===(v=null===(s=null===(d=o[l])||void 0===d?void 0:d.products)||void 0===s?void 0:s[i])||void 0===v?void 0:v.variants)||void 0===e?void 0:e[n];(null==c?void 0:c.fbStatus)||t.push(n)}))}))})),t})(o);s.length>0&&n&&n(t,s).then((t=>{const l=Object.assign({},o);Object.keys(l).forEach((o=>{var i,n;const d=null!==(n=null===(i=l[o])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,s,v;const e=null!==(v=null===(s=null===(d=null===(n=l[o])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===s?void 0:s.variants)&&void 0!==v?v:{};Object.keys(e).forEach((n=>{var d,s,v,e;const c=null===(e=null===(v=null===(s=null===(d=l[o])||void 0===d?void 0:d.products)||void 0===s?void 0:s[i])||void 0===v?void 0:v.variants)||void 0===e?void 0:e[n];c&&"REJECTED"===t[n]?c.fbStatus="REJECTED":c&&"APPROVED"===t[n]&&(c.fbStatus="APPROVED")}))}))})),i({type:d,data:l})})).catch((t=>{console.error("Error in fbStatusFetcher",t),l(o,i,d)}))},exports.getVariantIdsToFetchAtProductLevel=(o,t)=>{const l=[];return Object.keys(null!=o?o:{}).forEach((i=>{var n,d;const s=null!==(d=null===(n=null==o?void 0:o[i])||void 0===n?void 0:n.variants)&&void 0!==d?d:{};Object.keys(s).forEach((n=>{var d,s,v,e,c;let r;r=t?Object.assign(Object.assign({},null===(v=null===(s=null===(d=null==t?void 0:t.products)||void 0===d?void 0:d[i])||void 0===s?void 0:s.variants)||void 0===v?void 0:v[n]),{id:n}):Object.assign(Object.assign({},null===(c=null===(e=null==o?void 0:o[i])||void 0===e?void 0:e.variants)||void 0===c?void 0:c[n]),{id:n}),(null==r?void 0:r.fbStatus)||l.push(n)}))})),l},exports.isCollectionPartiallyChecked=function(o,t,l){var i,n,d,s;let v=0,e=0;if(arguments.length>3&&void 0!==arguments[3]&&arguments[3]){const s=null!==(i=null==t?void 0:t.products)&&void 0!==i?i:{};v=Object.keys(s).length;const c=null!==(d=null===(n=l[o])||void 0===n?void 0:n.products)&&void 0!==d?d:{};e=Object.keys(c).length}else if(l[o]){const i=null==t?void 0:t.products;i&&Object.keys(i).forEach((o=>{var t;const l=null===(t=i[o])||void 0===t?void 0:t.variants;l&&Object.keys(l).forEach((o=>v+=1))}));const n=null===(s=l[o])||void 0===s?void 0:s.products;if(n&&Object.keys(n).forEach((o=>{var t;const l=null===(t=n[o])||void 0===t?void 0:t.variants;l&&Object.keys(l).forEach((o=>e+=1))})),v<=0&&e>0)return!1}return e>0&&v!==e},exports.isProductPartiallyChecked=(o,t,l,i,n)=>{var d,s,v,e,c,r,a,u,p,b,O,f,j,h,y,g,k,E,P;let S=0,D=0;if(null===(s=null===(d=null==l?void 0:l[o])||void 0===d?void 0:d.products)||void 0===s?void 0:s[t]){if(n)return!1;const d=(null===(c=null===(e=null===(v=null==l?void 0:l[o])||void 0===v?void 0:v.products)||void 0===e?void 0:e[t])||void 0===c?void 0:c.variants)||[];if(1===Object.keys(d).length)for(const i in d){const n=null===(a=null===(r=null==l?void 0:l[o])||void 0===r?void 0:r.products)||void 0===a?void 0:a[t],d=null===(O=null===(b=null===(p=null===(u=null==l?void 0:l[o])||void 0===u?void 0:u.products)||void 0===p?void 0:p[t])||void 0===b?void 0:b.variants)||void 0===O?void 0:O[i];if(null===(f=null==d?void 0:d.name)||void 0===f?void 0:f.includes(null!==(j=null==n?void 0:n.name)&&void 0!==j?j:""))return!1}if(null===(g=Object.keys((null===(y=null===(h=null==i?void 0:i.products)||void 0===h?void 0:h[t])||void 0===y?void 0:y.variants)||[]))||void 0===g||g.forEach((()=>D++)),Object.keys((null===(P=null===(E=null===(k=null==l?void 0:l[o])||void 0===k?void 0:k.products)||void 0===E?void 0:E[t])||void 0===P?void 0:P.variants)||[]).forEach((()=>S++)),S>0&&D!==S)return!0}return!1},exports.liftTheStateUp=(t,l)=>{const i=o.cloneDeep(l);if(delete i.products,(t=Object.assign(Object.assign({},t),{catalogOnlyData:i})).productId&&l.products){const n=o.cloneDeep(l.products[t.productId]);(null==n?void 0:n.variants)&&delete n.variants,t=Object.assign(Object.assign({},t),{catalogOnlyData:i,productOnlyData:n})}return t},exports.markVariantsAsApprovedProductsLevel=(o,t,l,i,n)=>{const d=Object.assign({},o);if(Object.keys(o).forEach((t=>{var l,i;Object.keys(null!==(i=null===(l=null==o?void 0:o[t])||void 0===l?void 0:l.variants)&&void 0!==i?i:{}).forEach((l=>{var i,n;const s=null===(i=null==o?void 0:o[t].variants)||void 0===i?void 0:i[l];s&&(s.fbStatus="APPROVED");const v=null===(n=null==d?void 0:d[t])||void 0===n?void 0:n.variants;v&&v[l]&&(v[l]=s)}))})),i&&n){const o=Object.assign({},i);o.products=d,n(o),t({type:"productsPaged",data:{collectionId:l,products:d}})}else t({type:"productsPaged",data:{collectionId:l,products:d}})},exports.paginateSelectedItems=function(o,l,i){var n;const d={};let s=0;for(const v in o)if(Object.prototype.hasOwnProperty.call(o,v)){const e=o[v],c=t(e.products,l,i-s);c&&Object.keys(c).length>0&&(d[v]=Object.assign(Object.assign({},e),{products:c})),s+=Object.keys(null!==(n=e.products)&&void 0!==n?n:{}).length}return d},exports.shouldShowVariant=o=>{const t=Object.keys(o.variants||[]);let l=!1;return!(t.length<=1)||(t.forEach((t=>{var i,n;l=null!==(n=null===(i=o.variants)||void 0===i?void 0:i[t].name.includes(o.name))&&void 0!==n&&n})),!l)};
|
|
@@ -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 i,Fragment as n}from"react/jsx-runtime";import t from"../../assets/icons/Bik_logo.svg.js";import{useState as o,useEffect as l,Fragment as s}from"react";import d from"../progress-bar/CircularProgressBar.js";import{COLORS as r}from"../../constants/Theme.js";import{NavigationHyperlink as a}from"../navigation-hyperlink/NavigationHyperlink.js";import{SidebarPopup as c}from"./SidebarPopup.js";import{SideBarContainer as u,SibeBarMenuItem as v}from"./SidebarStyles.js";import{SimpleSidebar as m}from"./SimpleSidebar.js";const g=r=>{const{logoSvg:g,allMenuList:p,activeMainMenu:y,activeSubMenu:k,router:b,onClickingMainMenu:w,onClickingSubMenu:S,onClickingAccessUpgradePanel:f,onClickingPopupMenuItem:j,popupMinHeight:N,isNewSidebar:M}=r,[L,C]=o(y),[O,I]=o(),[P,B]=o(k),[E,H]=o(!1),[_,A]=o(),[x,$]=o(),[U,R]=o(),z=p.filter((e=>e.is2ndLastSticky||e.isLastSticky)).length;l((()=>{C(y)}),[y]),l((()=>{B(k)}),[k]);const F=e=>{var i,n;if(I(void 0),A(void 0),"popup"==(null==e?void 0:e.layout)){const i=K();i&&$(i),A(e)}else{const t=document.getElementById((null===(n=null===(i=e.displayName)||void 0===i?void 0:i.split(" "))||void 0===n?void 0:n.join(""))||e.key.toString());if(t){const e=T(t);R(e)}I(e)}},T=e=>{const i=e.getBoundingClientRect();let n=i.top;const t=e.querySelectorAll("div");let o=null;if(t.forEach((e=>{e.className.includes("sticky")&&(o=e)})),o){const e=window.innerHeight-i.bottom;n=i.top+e-140}return n},q=(n,t)=>{var o,l,s,d,r,a;return e("div",Object.assign({id:(null===(l=null===(o=n.displayName)||void 0===o?void 0:o.split(" "))||void 0===l?void 0:l.join(""))||n.key.toString(),className:"main--sidebar",onClick:()=>(e=>{var i;"popup"!==(null==e?void 0:e.layout)&&(A(void 0),I(void 0),H(!0),C(e),!e.path&&w(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?B(null==e?void 0:e.children[0]):B({}),I(void 0),setTimeout((()=>{H(!1)}),1e3))})(n),onMouseEnter:()=>{!E&&F(n)},onMouseOver:()=>{!E&&F(n)},onMouseLeave:()=>{var e;(null===(e=null==n?void 0:n.children)||void 0===e?void 0:e.length)||(I(void 0),A(void 0))},onFocus:()=>{console.log(";")},"aria-hidden":"true"},{children:[n.isNew&&i("div",Object.assign({className:"new-tag "+(n.isLastSticky?"tag-sticky":"")},{children:"NEW"})),e("div",Object.assign({id:(null===(d=null===(s=n.displayName)||void 0===s?void 0:s.split(" "))||void 0===d?void 0:d.join(""))+"_sub"||n.key.toString()+"_sub",className:`sidebar-menu-item ${(null==L?void 0:L.key)
|
|
1
|
+
import{jsxs as e,jsx as i,Fragment as n}from"react/jsx-runtime";import t from"../../assets/icons/Bik_logo.svg.js";import{useState as o,useEffect as l,Fragment as s}from"react";import d from"../progress-bar/CircularProgressBar.js";import{COLORS as r}from"../../constants/Theme.js";import{NavigationHyperlink as a}from"../navigation-hyperlink/NavigationHyperlink.js";import{SidebarPopup as c}from"./SidebarPopup.js";import{SideBarContainer as u,SibeBarMenuItem as v}from"./SidebarStyles.js";import{SimpleSidebar as m}from"./SimpleSidebar.js";const g=r=>{const{logoSvg:g,allMenuList:p,activeMainMenu:y,activeSubMenu:k,router:b,onClickingMainMenu:w,onClickingSubMenu:S,onClickingAccessUpgradePanel:f,onClickingPopupMenuItem:j,popupMinHeight:N,isNewSidebar:M}=r,[L,C]=o(y),[O,I]=o(),[P,B]=o(k),[E,H]=o(!1),[_,A]=o(),[x,$]=o(),[U,R]=o(),z=p.filter((e=>e.is2ndLastSticky||e.isLastSticky)).length;l((()=>{C(y)}),[y]),l((()=>{B(k)}),[k]);const F=e=>{var i,n;if(I(void 0),A(void 0),"popup"==(null==e?void 0:e.layout)){const i=K();i&&$(i),A(e)}else{const t=document.getElementById((null===(n=null===(i=e.displayName)||void 0===i?void 0:i.split(" "))||void 0===n?void 0:n.join(""))||e.key.toString());if(t){const e=T(t);R(e)}I(e)}},T=e=>{const i=e.getBoundingClientRect();let n=i.top;const t=e.querySelectorAll("div");let o=null;if(t.forEach((e=>{e.className.includes("sticky")&&(o=e)})),o){const e=window.innerHeight-i.bottom;n=i.top+e-140}return n},q=(n,t)=>{var o,l,s,d,r,a;return e("div",Object.assign({id:(null===(l=null===(o=n.displayName)||void 0===o?void 0:o.split(" "))||void 0===l?void 0:l.join(""))||n.key.toString(),className:"main--sidebar",onClick:()=>(e=>{var i;"popup"!==(null==e?void 0:e.layout)&&(A(void 0),I(void 0),H(!0),C(e),!e.path&&w(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?B(null==e?void 0:e.children[0]):B({}),I(void 0),setTimeout((()=>{H(!1)}),1e3))})(n),onMouseEnter:()=>{!E&&F(n)},onMouseOver:()=>{!E&&F(n)},onMouseLeave:()=>{var e;(null===(e=null==n?void 0:n.children)||void 0===e?void 0:e.length)||(I(void 0),A(void 0))},onFocus:()=>{console.log(";")},"aria-hidden":"true"},{children:[n.isNew&&i("div",Object.assign({className:"new-tag "+(n.isLastSticky?"tag-sticky":"")},{children:"NEW"})),e("div",Object.assign({id:(null===(d=null===(s=n.displayName)||void 0===s?void 0:s.split(" "))||void 0===d?void 0:d.join(""))+"_sub"||n.key.toString()+"_sub",className:`sidebar-menu-item \n\t\t\t\t\t${(null==L?void 0:L.key)===n.key?"main-menu-active-class":""} \n\t\t\t\t\t${n.isLastSticky?"sticky-menu-int":""} \n\t\t\t\t\t${n.is2ndLastSticky?"sticky-menu":""} \n\t\t\t\t\t${n.key===(null==O?void 0:O.key)?"sidebar-menu-item-hover":""} \n\t\t\t\t\t${n.isNew?"new-menu-item":""}`},{children:[i(h,{icon:n.icon,isActive:n.key==(null==L?void 0:L.key),activeStateIcon:null!==(r=n.activeIcon)&&void 0!==r?r:{},hoverStateIcon:null!==(a=n.hoverIcon)&&void 0!==a?a:{},isHovered:n.key==(null==O?void 0:O.key)||n.key==(null==_?void 0:_.key)}),i("div",Object.assign({className:"menu-item-container"},{children:i("p",Object.assign({className:"menu-item-text "+((null==n?void 0:n.key)===(null==L?void 0:L.key)?"active-menu-item-text":"")},{children:n.displayName}))}))]}),t)]}),t)};l((()=>{const e=()=>{const e=K();e&&$(e),D()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const D=()=>{const e=document.getElementById("_sub-menu"),i=null==e?void 0:e.getBoundingClientRect().height;i&&R(window.innerHeight-i)},K=()=>{var e,i;if(_){const n=(null===(i=null===(e=_.displayName)||void 0===e?void 0:e.split(" "))||void 0===i?void 0:i.join(""))+"_sub"||_.key.toString()+"_sub",t=document.getElementById(n);if(t){const e=t.getBoundingClientRect();let i=e.top;const n=null!=N?N:320;return e.bottom+n>window.innerHeight&&(i-=e.bottom+n-window.innerHeight),i}return null}};return e(u,{children:[i("div",Object.assign({className:"bik-header-logo",onClick:()=>{},onKeyDown:()=>{},"aria-hidden":"true"},{children:g||i(t,{})})),e(v,{children:[null==p?void 0:p.map(((t,o)=>{var l,d;return e(s,{children:[t.path?i(a,Object.assign({href:t.path,router:b},{children:q(t,o)})):q(t,o),e(n,{children:["popup"===t.layout&&(null===(l=null==_?void 0:_.children)||void 0===l?void 0:l.length)&&i(c,{top:null!=x?x:void 0,menuList:null==_?void 0:_.children,onClickingPopupMenu:e=>{j&&j(e),A(void 0)},onMouseLeaveOnMenu:()=>A(void 0)}),(null===(d=null==O?void 0:O.children)||void 0===d?void 0:d.length)&&i(m,{menuList:null==O?void 0:O.children,activeMenu:P,onMouseLeaveOnMenu:()=>I(void 0),left:M?92:88,postion:"fixed",header:O.displayName,theme:"brand",router:b,showAccessUpgradePanel:O.showAccessUpgradePanel,onMenuClick:(e,i)=>{B(e),C(O),I(void 0),A(void 0),i&&S(e)},onUpgrade:f,top:M&&U||0,isNewSidebar:M})]})]},o)})),"number"==typeof r.onboardingPercentage&&i("div",Object.assign({className:"main--sidebar"},{children:i("div",Object.assign({id:"bik-onboarding__checklist",className:"sidebar-menu-item "+(0===z?"sticky-menu":1===z?"sticky-menu-int":"sticky-menu-three")},{children:i(d,{percentage:r.onboardingPercentage,width:48})}))}))]})]})},h=e=>{const{icon:t,isActive:o,activeStateIcon:l,hoverStateIcon:s,isHovered:d}=e,a=t,c=s;return i(n,{children:o?i(l,{width:20,height:20}):i(d?c:a,{width:20,height:20,color:r.surface.standard})})};export{g as BikSidebar};
|
|
@@ -9,6 +9,7 @@ export interface ProductVariant {
|
|
|
9
9
|
displayOrder?: number | null;
|
|
10
10
|
fbStatus?: FbProductStatus;
|
|
11
11
|
description?: string;
|
|
12
|
+
id: string;
|
|
12
13
|
}
|
|
13
14
|
export interface Product {
|
|
14
15
|
name: string;
|
|
@@ -17,6 +18,7 @@ export interface Product {
|
|
|
17
18
|
variants?: {
|
|
18
19
|
[key: string]: ProductVariant;
|
|
19
20
|
};
|
|
21
|
+
id: string;
|
|
20
22
|
}
|
|
21
23
|
export interface Collection {
|
|
22
24
|
name: 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 l}from"react";import{COLORS as n}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
|
|
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 l}from"react";import{COLORS as n}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 f}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as y}from"./rearrangeScreen.js";import{collectionsReducer as b,searchReducer as S,selectedColectionsReducer as v,CollectionIdContext as k}from"./reducers.js";import{SearchScreen as j}from"./searchScreen.js";import{SelectedScreen as x}from"./selectedScreen.js";import{ContainerStyle as P,ScrollContainerStyle as I}from"./style.js";import{OUT_OF_STOCK_ACTION as F}from"./type.js";import{addIdToProductsAndVariants as O}from"./utility.js";var D;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(D||(D={}));const T=T=>{const{storeId:R,selectedItems:w,onClose:E,visible:A,zIndex:V,exactLimit:$,limit:B,hideCollectionCheckbox:L,hideProductCheckbox:M,outOfStockAction:z=F.BLUR,hideVariantCheckbox:H,selectProductsFromCustomCollection:W,hideSelectionCount:G,title:Y,width:K,left:N,renderWithoutModal:U,onClickSave:q,pickerType:J,hideProductVariants:Q=!1,startupScreen:X=D.Collections,rearrangeEnabled:Z,selectSingleItem:_=!1,showProductDetails:ee,containerStyle:te,crossButtonInsideHeader:oe=!1}=T,[ce,re]=r(b,{}),[se,ie]=s([D.Collections,D.RearrangeProducts].includes(X)?X:D.Collections),[le,ne]=s("grid"),[de,ae]=s(""),[ue,he]=s(""),[pe,me]=s(0),[Ce,fe]=s(!1),[ge,ye]=s(0),[be,Se]=s(""),[ve,ke]=s(!1),[je,xe]=s(!1),[Pe,Ie]=r(S,{collections:{},products:{}}),[Fe,Oe]=r(v,Object.keys(w).length>0?w:{}),De=i(null),[Te,Re]=s(!1),[we,Ee]=s();l((()=>{fe(!0),xe(!0),T.collectionFetcher(pe,R).then((e=>{re({type:"fetched",data:(null==e?void 0:e.collections)||{}}),fe(!1),me((e=>e+1)),xe(!1)})).catch()}),[]),l((()=>{let e=0;Q?Object.keys(Fe||[]).forEach((t=>{var o;Object.keys((null===(o=Fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&Fe[-1]&&(null===(c=Fe[-1].products)||void 0===c?void 0:c[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 c,r;Object.keys((null===(r=null===(c=Fe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),ye(e)}),[ce,Fe,Q]),l((()=>{ue&&(fe(!0),T.productFetcher(ue,R).then((e=>{const t=O(e);Object.keys(e).length&&re({type:"productsFetched",data:{collectionId:ue,products:t}}),fe(!1)})).catch())}),[ue]),l((()=>{const e=setTimeout((()=>{"rearrange"!==se&&(be.length||"collections"!==se)&&(be.length?(ke(!0),T.searchFetcher(R,be).then((e=>{"collections"in e&&"products"in e?(Ie({type:"set",data:e}),re({type:"searched",data:e.collections})):(Ie({type:"set",data:{collections:{},products:e}}),re({type:"searched",data:e})),ie("searchProducts"),fe(!1),ke(!1)}))):ie("collections"))}),800);return()=>clearTimeout(e)}),[be]),l((()=>{q&&(T.onAdd(Fe,ge),Ae())}),[q]),l((()=>{_&&Object.keys(Fe||{}).length&&ge&&(T.onAdd(Fe,ge),Ae())}),[_,Fe,ge]);const Ae=()=>{Oe({type:"reset",data:{}})},Ve=e(P,Object.assign({style:null!=te?te:{}},{children:[T.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:T.postHeader})),!T.hideGlobalSearch&&t(o,{children:("collections"===se||"searchProducts"===se)&&t("div",Object.assign({style:{padding:U?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(u,{placeholder:"Search for collections and products, or type a product ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ve?t(p,{size:"small",color:n.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:be,onChangeText:e=>{e.length&&e.trim().length?Se(e):Se("")}})}))}),e(I,Object.assign({ref:De,screenName:se},{children:["collections"===se&&t(C,{customCollectionRestriction:T.customCollectionRestriction,dataLoading:je,collections:ce,selectedCollectionsDispatch:Oe,setCollectionId:ae,setSelectedCollectionId:he,setScreen:ie,selectedCollections:Fe,collectionFetcher:T.collectionFetcher,storeId:R,collectionsDispatch:re,setSaveDisabled:fe,pagingControls:{curPage:pe,setCurPage:me},hideCollectionCheckbox:L,renderWithoutModal:U,pickerType:J,scrollContainerRef:De}),"products"===se&&de&&t(k.Provider,Object.assign({value:de},{children:t(g,{hideInCollectionSearch:T.hideInCollectionSearch,customCollectionRestriction:T.customCollectionRestriction,productFetcher:T.productFetcher,setScreen:ie,storeId:R,data:ce[de],collectionsDispatch:re,selectedCollectionsDispatch:Oe,selectedData:Fe,setSaveDisabled:fe,searchInCollectionFetcher:T.searchInCollectionFetcher,hideProductCheckbox:M,outOfStockAction:z,hideVariantCheckbox:H,selectProductsFromCustomCollection:W,renderWithoutModal:U,pickerType:J,hideProductVariants:Q,fbStatusFetcher:T.fbStatusFetcher,onProductDetailClick:e=>{Re(!0),Ee(e)},showProductDetailInfoIcon:ee,scrollContainerRef:De})})),"view"===se&&t(x,{selectedCollections:Fe||{},selectedCollectionsDispatch:Oe,setScreen:ie,collections:ce,hideProductVariants:Q,outOfStockAction:z,storeId:R,fbStatusFetcher:T.fbStatusFetcher}),"rearrange"===se&&t(y,{selectedCollections:Fe||{},selectedCollectionsDispatch:Oe,setScreen:ie,outOfStockAction:z,rearrangeViewType:"grid"===le?"list":"grid",scrollContainerRef:De,storeId:R,fbStatusFetcher:T.fbStatusFetcher}),"searchProducts"===se&&t(j,{customCollectionRestriction:T.customCollectionRestriction,selectedCollections:Fe||{},searchedCollections:Pe||{},searchedCollectionsDispatch:Ie,selectedCollectionsDispatch:Oe,setScreen:ie,collections:ce,onBackPress:()=>{Se(""),Ie({type:"set",data:{collections:{},products:{}}})},pickerType:J,hideProductCheckbox:M,hideProductVariants:Q,hideVariantCheckbox:H,storeId:R,fbStatusFetcher:T.fbStatusFetcher,setCollectionId:ae,setSelectedCollectionId:he,renderWithoutModal:U,hideCollectionCheckbox:L,outOfStockAction:z})]}))]}));return t(o,{children:U?Ve:e(h,Object.assign({zIndex:V,open:A,onClose:()=>{null==E||E(),Ae()},headingTitle:Y||("collections"===se||"products"===se?"Select Products":"view"===se?"Selected Products":"searchProducts"===se?"Searched Results":"rearrange"===se?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:K||"600px",left:N||"auto"},headerRightCustomElement:oe?t("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:E},{children:t(d,{width:20,height:20,color:n.content.secondary})})):t(o,{}),footerContainerStyle:T.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:{buttonText:Ce?"Loading...":se===D.RearrangeProducts?"Done":"Add",disabled:Ce||ge<1||$&&ge<$||!$&&B&&ge>B||!1,onClick:()=>{T.onAdd(Fe,ge),Ae()}},wrapperStyle:T.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:G?t(o,{}):$&&ge>$?t(m,{tagText:`You can only select ${$} products`,type:"negative"}):B&&ge>B?t(m,{tagText:`You can only select ${B} products`,type:"negative"}):t(a,ge>0?{onClick:()=>{ie(Z?D.RearrangeProducts:D.SelectedProducts)},buttonText:$?`${ge}/${$} products selected`:`${ge} products selected`,buttonType:["rearrange","view"].includes(se)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(se)}:{disabled:!0,buttonText:$?`${ge}/${$} products selected`:`${ge} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:Te||oe},{children:[Ve,Te&&we?t(f,{productData:we,outOfStockAction:z,onClose:()=>{Re(!1)}}):t(o,{})]}))})};export{T as ProductPickerModal,D as ScreenName};
|
|
@@ -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 e from"../../assets/icons/cross.svg.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as d}from"../shimmer-image/ShimmerImage.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 d}from"../shimmer-image/ShimmerImage.js";import{TitleRegular as n,BodyCaption as c}from"../TypographyStyle.js";import{ProductPickerTag as s}from"./ProductPickerTag.js";const l=i=>o(m,{children:[t(u,{}),t(x,{children:t(a,{className:"close-button",onClick:i.onClose,Icon:e,width:20,height:20})}),t(p,{productData:i.productData,outOfStockAction:i.outOfStockAction})]}),p=i=>{var e;const a=void 0===i.productData.variants;return o(f,{children:[t(g,{children:t(d,{imageUrl:i.productData.image,width:"200px",height:200,borderRadius:4})}),o(h,{children:[t(n,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(c,Object.assign({color:r.content.secondary},{children:`Product ID: ${i.productData.id}`})),t(c,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(e=i.productData.description)&&void 0!==e?e:""}}),t(s,{isVariant:a,data:i.productData,outOfStockAction:i.outOfStockAction})]})]})},m=i.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1;
|
|
4
4
|
background: rgba(0, 0, 0, 0.5);
|
|
@@ -15,6 +15,7 @@ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-component
|
|
|
15
15
|
max-height: 300px;
|
|
16
16
|
overflow-y: auto;
|
|
17
17
|
word-break: break-word;
|
|
18
|
+
margin-top: 8px;
|
|
18
19
|
}
|
|
19
20
|
`,u=i.div`
|
|
20
21
|
display: flex;
|
|
@@ -43,5 +44,5 @@ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-component
|
|
|
43
44
|
display: flex;
|
|
44
45
|
flex: 1;
|
|
45
46
|
flex-direction: column;
|
|
46
|
-
gap:
|
|
47
|
+
gap: 4px;
|
|
47
48
|
`;export{p as ProductInfoCard,l as ProductInfoOverlay};
|
|
@@ -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 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,
|
|
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,addIdToProductsAndVariants as S,isCollectionPartiallyChecked as x,isProductPartiallyChecked as E,liftTheStateUp as R}from"./utility.js";const T=T=>{var w,V;const{data:A,collectionsDispatch:B,selectedData:F,selectedCollectionsDispatch:J,productFetcher:M,storeId:W,setScreen:z,setSaveDisabled:H,hideInCollectionSearch:K,customCollectionRestriction:L,hideProductCheckbox:N,outOfStockAction:U=P.BLUR,hideVariantCheckbox:_=!1,selectProductsFromCustomCollection:q=!1,pickerType:G,hideProductVariants:Q,fbStatusFetcher:X,onProductDetailClick:Y,showProductDetailInfoIcon:Z,scrollContainerRef:$}=T,tt=i(O),et=s(0),ot=s(!1),[ct,nt]=l(""),[rt,it]=l(!1),[st,lt]=l(A),dt=s(!0),at=s(!1);d((()=>{if(dt.current)return void(dt.current=!1);const t=setTimeout((()=>{ct.length?(it(!0),T.searchInCollectionFetcher(W,tt,ct).then((t=>{const e=r(A);e.products=t,lt(e);const o=I(null!=t?t:{});ht(o,null!=t?t:{},!0),H(!1),it(!1)}))):lt(A)}),800);return()=>clearTimeout(t)}),[ct]);d((()=>{var t,e,o,c;at.current=!1,et.current=Math.floor((null===(e=Object.keys(null!==(t=A.products)&&void 0!==t?t:{}))||void 0===e?void 0:e.length)/10);const n=I(null!==(o=A.products)&&void 0!==o?o:{});ht(n,null!==(c=A.products)&&void 0!==c?c:{})}),[tt]);const ut=!!L&&A.isSmartCollection;d((()=>{(null==A?void 0:A.products)||pt(10)}),[]);const ht=(t,e,o)=>{X||(o?D(e,B,tt,st,lt):D(e,B,tt)),t.length>0&&X&&X(W,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?(lt((t=>{const e=Object.assign({},t);return e.products=c,e})),B({type:"productsPaged",data:{collectionId:tt,products:c}})):B({type:"productsPaged",data:{collectionId:tt,products:c}})})).catch((t=>{o?D(e,B,tt,st,lt):D(e,B,tt)}))},pt=t=>{H(!0),it(!0),M(tt,W,t,0).then((e=>{const o=S(e);if(Object.keys(e).length||(at.current=!0),Object.keys(e).length){lt(Object.assign(Object.assign({},st),{products:o}));const t=I(o);ht(t,o),et.current=1}t||J({type:"selected",data:{id:tt,val:Object.assign(Object.assign({},A),{products:o})}}),H(!1),it(!1)})).catch()},mt=(t,e)=>{const o=R(e,A);J({type:t,data:Object.assign(Object.assign({},o),{isRestricted:L})})},gt=!!(null==F?void 0:F[tt])&&!!Object.keys(null!==(V=null===(w=null==F?void 0:F[tt])||void 0===w?void 0:w.products)&&void 0!==V?V:{}).length;return t("div",{children:[t(k,{children:[e(h,{Icon:o,height:16,onClick:()=>{z("collections")}}),e(j,Object.assign({style:{color:a.content.secondary}},{children:A.name}))]}),!K&&e("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e(m,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>rt&&ct.length?e(g,{size:"small",color:a.content.primary}):e(n,{})},id:"listInput",height:"24px",type:"text",value:ct,onChangeText:t=>{t.length&&t.trim().length?nt(t):nt("")},placeholder:"Search for a product or type a product ID"})})),Object.keys((null==st?void 0:st.products)||[]).length>0&&!ut&&!ct.length&&!N&&"-1"!==tt&&t(C,{children:[e(u,{isChecked:gt,isPartiallyChecked:x(tt,st,F,Q),onValueChange:function(t){t?pt():J({type:"unselected",data:{id:tt}})}}),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==st?void 0:st.products)||[]).length<10)&&!!Object.keys((null==st?void 0:st.products)||[]).length,fetchMore:()=>(ot.current=!0,M(tt,W,10,et.current).then((t=>{let e=!1;if(Object.keys(t).length||(e=!0),Object.keys(t).length){const e=st;e.products=Object.assign(Object.assign({},st.products),t),lt(Object.assign({},e));const o=I(t);ht(o,t)}return H(!1),ot.current=!1,et.current+=1,e}))),containerRef:$},{children:Object.keys((null==st?void 0:st.products)||[]).length?Object.keys(st.products||[]).map((t=>e(b,{outOfStockAction:U,collectionId:tt,isProductPartiallyChecked:E(tt,t,F,st,Q),productId:t,data:st.products[t],selectedData:F,selectedCollectionsDispatch:J,viewOnly:!q&&!!ut,upliftAdditions:mt,hideProductCheckbox:N,hideVariantCheckbox:_,hideProductVariants:Q,pickerType:G,onProductDetailClick:Y,showProductDetailInfoIcon:Z},t))):rt?e(y,{limit:10}):e(v,{title:"No products to show",subtitle:ct.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})}))]})};export{T as ProductsScreen};
|
|
@@ -36,3 +36,4 @@ export declare const markVariantsAsApprovedProductsLevel: (products: {
|
|
|
36
36
|
export declare const shouldShowVariant: (data: Product) => boolean;
|
|
37
37
|
export declare const isProductPartiallyChecked: (collectionId: string, productId: string, selectedData: SelectedItems, currentCollection: Collection, hideProductVariants?: boolean) => boolean;
|
|
38
38
|
export declare const isCollectionPartiallyChecked: (collectionId: string, collection: Collection, selectedCollections: SelectedItems, hideProductVariants?: boolean) => boolean;
|
|
39
|
+
export declare const addIdToProductsAndVariants: (productData: any) => {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cloneDeep as o}from"lodash";const
|
|
1
|
+
import{cloneDeep as o}from"lodash";const n=(n,t)=>{const i=o(t);if(delete i.products,(n=Object.assign(Object.assign({},n),{catalogOnlyData:i})).productId&&t.products){const l=o(t.products[n.productId]);(null==l?void 0:l.variants)&&delete l.variants,n=Object.assign(Object.assign({},n),{catalogOnlyData:i,productOnlyData:l})}return n};function t(o,n,t){var l;const d={};let v=0;for(const s in o)if(Object.prototype.hasOwnProperty.call(o,s)){const c=o[s],u=i(c.products,n,t-v);u&&Object.keys(u).length>0&&(d[s]=Object.assign(Object.assign({},c),{products:u})),v+=Object.keys(null!==(l=c.products)&&void 0!==l?l:{}).length}return d}function i(o,n,t){if(!o)return{};const i=Object.keys(o).slice(t,t+n),l={};return i.forEach((n=>{l[n]=o[n]})),l}const l=(o,n,t)=>{Object.keys(o).forEach((n=>{var t,i;const l=null!==(i=null===(t=o[n])||void 0===t?void 0:t.products)&&void 0!==i?i:{};Object.keys(l).forEach((t=>{var i,l,d,v;const s=null!==(v=null===(d=null===(l=null===(i=o[n])||void 0===i?void 0:i.products)||void 0===l?void 0:l[t])||void 0===d?void 0:d.variants)&&void 0!==v?v:{};Object.keys(s).forEach((i=>{var l,d,v,s;const c=null===(s=null===(v=null===(d=null===(l=o[n])||void 0===l?void 0:l.products)||void 0===d?void 0:d[t])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[i];c&&!c.fbStatus&&(c.fbStatus="APPROVED")}))}))})),n({type:t,data:o})},d=function(o,n,t,i){let d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";i||l(o,t,d);const v=(o=>{const n=[];return Object.keys(o).forEach((t=>{var i,l;const d=null!==(l=null===(i=o[t])||void 0===i?void 0:i.products)&&void 0!==l?l:{};Object.keys(d).forEach((i=>{var l,d,v,s;const c=null!==(s=null===(v=null===(d=null===(l=o[t])||void 0===l?void 0:l.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(c).forEach((l=>{var d,v,s,c;const u=null===(c=null===(s=null===(v=null===(d=o[t])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===c?void 0:c[l];(null==u?void 0:u.fbStatus)||n.push(l)}))}))})),n})(o);v.length>0&&i&&i(n,v).then((n=>{const i=Object.assign({},o);Object.keys(i).forEach((o=>{var t,l;const d=null!==(l=null===(t=i[o])||void 0===t?void 0:t.products)&&void 0!==l?l:{};Object.keys(d).forEach((t=>{var l,d,v,s;const c=null!==(s=null===(v=null===(d=null===(l=i[o])||void 0===l?void 0:l.products)||void 0===d?void 0:d[t])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(c).forEach((l=>{var d,v,s,c;const u=null===(c=null===(s=null===(v=null===(d=i[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[t])||void 0===s?void 0:s.variants)||void 0===c?void 0:c[l];u&&"REJECTED"===n[l]?u.fbStatus="REJECTED":u&&"APPROVED"===n[l]&&(u.fbStatus="APPROVED")}))}))})),t({type:d,data:i})})).catch((n=>{console.error("Error in fbStatusFetcher",n),l(o,t,d)}))},v=(o,n)=>{const t=[];return Object.keys(null!=o?o:{}).forEach((i=>{var l,d;const v=null!==(d=null===(l=null==o?void 0:o[i])||void 0===l?void 0:l.variants)&&void 0!==d?d:{};Object.keys(v).forEach((l=>{var d,v,s,c,u;let a;a=n?Object.assign(Object.assign({},null===(s=null===(v=null===(d=null==n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[l]),{id:l}):Object.assign(Object.assign({},null===(u=null===(c=null==o?void 0:o[i])||void 0===c?void 0:c.variants)||void 0===u?void 0:u[l]),{id:l}),(null==a?void 0:a.fbStatus)||t.push(l)}))})),t},s=(o,n,t,i,l)=>{const d=Object.assign({},o);if(Object.keys(o).forEach((n=>{var t,i;Object.keys(null!==(i=null===(t=null==o?void 0:o[n])||void 0===t?void 0:t.variants)&&void 0!==i?i:{}).forEach((t=>{var i,l;const v=null===(i=null==o?void 0:o[n].variants)||void 0===i?void 0:i[t];v&&(v.fbStatus="APPROVED");const s=null===(l=null==d?void 0:d[n])||void 0===l?void 0:l.variants;s&&s[t]&&(s[t]=v)}))})),i&&l){const o=Object.assign({},i);o.products=d,l(o),n({type:"productsPaged",data:{collectionId:t,products:d}})}else n({type:"productsPaged",data:{collectionId:t,products:d}})},c=o=>{const n=Object.keys(o.variants||[]);let t=!1;return!(n.length<=1)||(n.forEach((n=>{var i,l;t=null!==(l=null===(i=o.variants)||void 0===i?void 0:i[n].name.includes(o.name))&&void 0!==l&&l})),!t)},u=(o,n,t,i,l)=>{var d,v,s,c,u,a,e,r,b,O,f,j,p,h,y,g,E,k,P;let D=0,m=0;if(null===(v=null===(d=null==t?void 0:t[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[n]){if(l)return!1;const d=(null===(u=null===(c=null===(s=null==t?void 0:t[o])||void 0===s?void 0:s.products)||void 0===c?void 0:c[n])||void 0===u?void 0:u.variants)||[];if(1===Object.keys(d).length)for(const i in d){const l=null===(e=null===(a=null==t?void 0:t[o])||void 0===a?void 0:a.products)||void 0===e?void 0:e[n],d=null===(f=null===(O=null===(b=null===(r=null==t?void 0:t[o])||void 0===r?void 0:r.products)||void 0===b?void 0:b[n])||void 0===O?void 0:O.variants)||void 0===f?void 0:f[i];if(null===(j=null==d?void 0:d.name)||void 0===j?void 0:j.includes(null!==(p=null==l?void 0:l.name)&&void 0!==p?p:""))return!1}if(null===(g=Object.keys((null===(y=null===(h=null==i?void 0:i.products)||void 0===h?void 0:h[n])||void 0===y?void 0:y.variants)||[]))||void 0===g||g.forEach((()=>m++)),Object.keys((null===(P=null===(k=null===(E=null==t?void 0:t[o])||void 0===E?void 0:E.products)||void 0===k?void 0:k[n])||void 0===P?void 0:P.variants)||[]).forEach((()=>D++)),D>0&&m!==D)return!0}return!1},a=function(o,n,t){var i,l,d,v;let s=0,c=0;if(arguments.length>3&&void 0!==arguments[3]&&arguments[3]){const v=null!==(i=null==n?void 0:n.products)&&void 0!==i?i:{};s=Object.keys(v).length;const u=null!==(d=null===(l=t[o])||void 0===l?void 0:l.products)&&void 0!==d?d:{};c=Object.keys(u).length}else if(t[o]){const i=null==n?void 0:n.products;i&&Object.keys(i).forEach((o=>{var n;const t=null===(n=i[o])||void 0===n?void 0:n.variants;t&&Object.keys(t).forEach((o=>s+=1))}));const l=null===(v=t[o])||void 0===v?void 0:v.products;if(l&&Object.keys(l).forEach((o=>{var n;const t=null===(n=l[o])||void 0===n?void 0:n.variants;t&&Object.keys(t).forEach((o=>c+=1))})),s<=0&&c>0)return!1}return c>0&&s!==c},e=o=>{const n={};return Object.keys(o).length?(Object.keys(o).map((t=>{var i,l;const d=null===(i=o[t])||void 0===i?void 0:i.variants,v={};Object.keys(d).length&&Object.keys(null===(l=o[t])||void 0===l?void 0:l.variants).map((o=>{v[o]=Object.assign(Object.assign({},d[o]),{id:o})})),n[t]=Object.assign(Object.assign({},o[t]),{variants:v,id:t})})),n):{}};export{e as addIdToProductsAndVariants,d as fetchFbStatusCollection,v as getVariantIdsToFetchAtProductLevel,a as isCollectionPartiallyChecked,u as isProductPartiallyChecked,n as liftTheStateUp,s as markVariantsAsApprovedProductsLevel,t as paginateSelectedItems,c as shouldShowVariant};
|