@bikdotai/bik-component-library 0.0.616-beta.himanshu-16 → 0.0.616
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 +0 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +1 -4
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/style.d.ts +0 -1
- package/dist/cjs/components/product-picker-v2/style.js +5 -12
- package/dist/cjs/components/product-picker-v2/type.d.ts +0 -6
- 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 +0 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +1 -4
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/style.d.ts +0 -1
- package/dist/esm/components/product-picker-v2/style.js +3 -10
- package/dist/esm/components/product-picker-v2/type.d.ts +0 -6
- 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,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { OUT_OF_STOCK_ACTION } from './type';
|
|
3
3
|
export interface ProductVariant {
|
|
4
4
|
name: string;
|
|
5
5
|
price: string;
|
|
@@ -10,7 +10,6 @@ export interface ProductVariant {
|
|
|
10
10
|
fbStatus?: FbProductStatus;
|
|
11
11
|
description?: string;
|
|
12
12
|
id?: string;
|
|
13
|
-
actualPrice?: string;
|
|
14
13
|
}
|
|
15
14
|
export interface Product {
|
|
16
15
|
name: string;
|
|
@@ -20,7 +19,6 @@ export interface Product {
|
|
|
20
19
|
[key: string]: ProductVariant;
|
|
21
20
|
};
|
|
22
21
|
id?: string;
|
|
23
|
-
handle?: string;
|
|
24
22
|
}
|
|
25
23
|
export interface Collection {
|
|
26
24
|
name: string;
|
|
@@ -97,7 +95,6 @@ export type ProductPickerInterface = {
|
|
|
97
95
|
showProductDetails?: boolean;
|
|
98
96
|
containerStyle?: React.CSSProperties;
|
|
99
97
|
crossButtonInsideHeader?: boolean;
|
|
100
|
-
footerForNonModal?: FooterForNonModalI;
|
|
101
98
|
} & ({
|
|
102
99
|
startupScreen: ScreenName.RearrangeProducts;
|
|
103
100
|
rearrangeEnabled: true;
|
|
@@ -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:f,selectedItems:b,onClose:m,visible:v,zIndex:k,exactLimit:P,limit:O,hideCollectionCheckbox:
|
|
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:f,selectedItems:b,onClose:m,visible:v,zIndex:k,exactLimit:P,limit:O,hideCollectionCheckbox:I,hideProductCheckbox:F,outOfStockAction:R=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:T,selectProductsFromCustomCollection:q,hideSelectionCount:D,title:E,width:w,left:N,renderWithoutModal:A,onClickSave:B,pickerType:L,hideProductVariants:M=!1,startupScreen:V=exports.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:_=!1,showProductDetails:z,containerStyle:H,crossButtonInsideHeader:W=!1}=e,[G,K]=c.useReducer(C.collectionsReducer,{}),[U,Y]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(V)?V:exports.ScreenName.Collections),[J,Q]=c.useState("grid"),[X,Z]=c.useState(""),[ee,te]=c.useState(""),[oe,ce]=c.useState(0),[re,se]=c.useState(!1),[ne,le]=c.useState(0),[ie,ae]=c.useState(""),[de,ue]=c.useState(!1),[he,pe]=c.useState(!1),[Se,Ce]=c.useReducer(C.searchReducer,{collections:{},products:{}}),[xe,ge]=c.useReducer(C.selectedColectionsReducer,Object.keys(b).length>0?b:{}),je=c.useRef(null),[ye,fe]=c.useState(!1),[be,me]=c.useState();c.useEffect((()=>{se(!0),pe(!0),e.collectionFetcher(oe,f).then((e=>{K({type:"fetched",data:(null==e?void 0:e.collections)||{}}),se(!1),ce((e=>e+1)),pe(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;M?Object.keys(xe||[]).forEach((t=>{var o;Object.keys((null===(o=xe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&xe[-1]&&(null===(c=xe[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(xe||[]).forEach((t=>{var o;Object.keys((null===(o=xe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=xe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),le(e)}),[G,xe,M]),c.useEffect((()=>{ee&&(se(!0),e.productFetcher(ee,f).then((e=>{Object.keys(e).length&&K({type:"productsFetched",data:{collectionId:ee,products:e}}),se(!1)})).catch())}),[ee]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==U&&(ie.length||"collections"!==U)&&(ie.length?(ue(!0),e.searchFetcher(f,ie).then((e=>{"collections"in e&&"products"in e?(Ce({type:"set",data:e}),K({type:"searched",data:e.collections})):(Ce({type:"set",data:{collections:{},products:e}}),K({type:"searched",data:e})),Y("searchProducts"),se(!1),ue(!1)}))):Y("collections"))}),800);return()=>clearTimeout(t)}),[ie]),c.useEffect((()=>{B&&(e.onAdd(xe,ne),ve())}),[B]),c.useEffect((()=>{_&&Object.keys(xe||{}).length&&ne&&(e.onAdd(xe,ne),ve())}),[_,xe,ne]);const ve=()=>{ge({type:"reset",data:{}})},ke=t.jsxs(j.ContainerStyle,Object.assign({style:null!=H?H:{}},{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===U||"searchProducts"===U)&&t.jsx("div",Object.assign({style:{padding:A?"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:()=>de?t.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:ie,onChangeText:e=>{e.length&&e.trim().length?ae(e):ae("")}})}))}),t.jsxs(j.ScrollContainerStyle,Object.assign({ref:je,screenName:U},{children:["collections"===U&&t.jsx(u.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:he,collections:G,selectedCollectionsDispatch:ge,setCollectionId:Z,setSelectedCollectionId:te,setScreen:Y,selectedCollections:xe,collectionFetcher:e.collectionFetcher,storeId:f,collectionsDispatch:K,setSaveDisabled:se,pagingControls:{curPage:oe,setCurPage:ce},hideCollectionCheckbox:I,renderWithoutModal:A,pickerType:L,scrollContainerRef:je}),"products"===U&&X&&t.jsx(C.CollectionIdContext.Provider,Object.assign({value:X},{children:t.jsx(p.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:Y,storeId:f,data:G[X],collectionsDispatch:K,selectedCollectionsDispatch:ge,selectedData:xe,setSaveDisabled:se,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:F,outOfStockAction:R,hideVariantCheckbox:T,selectProductsFromCustomCollection:q,renderWithoutModal:A,pickerType:L,hideProductVariants:M,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{fe(!0),me(e)},showProductDetailInfoIcon:z,scrollContainerRef:je})})),"view"===U&&t.jsx(g.SelectedScreen,{selectedCollections:xe||{},selectedCollectionsDispatch:ge,setScreen:Y,collections:G,hideProductVariants:M,outOfStockAction:R,storeId:f,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===U&&t.jsx(S.RearrangeScreen,{selectedCollections:xe||{},selectedCollectionsDispatch:ge,setScreen:Y,outOfStockAction:R,rearrangeViewType:"grid"===J?"list":"grid",scrollContainerRef:je,storeId:f,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===U&&t.jsx(x.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:xe||{},searchedCollections:Se||{},searchedCollectionsDispatch:Ce,selectedCollectionsDispatch:ge,setScreen:Y,collections:G,onBackPress:()=>{ae(""),Ce({type:"set",data:{collections:{},products:{}}})},pickerType:L,hideProductCheckbox:F,hideProductVariants:M,hideVariantCheckbox:T,storeId:f,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:Z,setSelectedCollectionId:te,renderWithoutModal:A,hideCollectionCheckbox:I,outOfStockAction:R})]}))]}));return t.jsx(t.Fragment,{children:A?ke:t.jsxs(i.StyledModal,Object.assign({zIndex:k,open:v,onClose:()=>{null==m||m(),ve()},headingTitle:E||("collections"===U||"products"===U?"Select Products":"view"===U?"Selected Products":"searchProducts"===U?"Searched Results":"rearrange"===U?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:w||"600px",left:N||"auto"},headerRightCustomElement:W?t.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:m},{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:re?"Loading...":U===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:re||ne<1||P&&ne<P||!P&&O&&ne>O||!1,onClick:()=>{e.onAdd(xe,ne),ve()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:D?t.jsx(t.Fragment,{}):P&&ne>P?t.jsx(d.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):O&&ne>O?t.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):ne>0?t.jsx(n.Button,{onClick:()=>{Y($?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:P?`${ne}/${P} products selected`:`${ne} products selected`,buttonType:["rearrange","view"].includes(U)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(U)}):t.jsx(n.Button,{disabled:!0,buttonText:P?`${ne}/${P} products selected`:`${ne} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:ye||W},{children:[ke,ye&&be?t.jsx(h.ProductInfoOverlay,{productData:be,outOfStockAction:R,onClose:()=>{fe(!1)}}):t.jsx(t.Fragment,{})]}))})};
|
|
@@ -20,4 +20,3 @@ export declare const CollectionNameHolder: import("styled-components").StyledCom
|
|
|
20
20
|
export declare const VariantCardListStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
21
21
|
export declare const VariantCardGridStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
22
22
|
export declare const StyledHeaderRightIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
23
|
-
export declare const StyledFooterForNonModal: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("./modal.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(e);const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("./modal.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(e);const l=r.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
background-color: white;
|
|
4
4
|
height: 75vh;
|
|
5
5
|
flex-direction: column;
|
|
6
|
-
`,
|
|
6
|
+
`,n=r.default.div`
|
|
7
7
|
overflow-y: scroll;
|
|
8
8
|
overflow-x: hidden;
|
|
9
9
|
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
justify-content: center;
|
|
37
37
|
align-items: center;
|
|
38
38
|
column-gap: 18px;
|
|
39
|
-
`,
|
|
39
|
+
`,c=r.default.div`
|
|
40
40
|
display: flex;
|
|
41
41
|
flex-direction: column;
|
|
42
42
|
justify-content: center;
|
|
43
|
-
`,
|
|
43
|
+
`,p=r.default.div`
|
|
44
44
|
display: flex;
|
|
45
45
|
flex-direction: row;
|
|
46
46
|
max-height: 32px;
|
|
@@ -127,11 +127,4 @@
|
|
|
127
127
|
align-items: center;
|
|
128
128
|
border: 1px solid ${t.COLORS.stroke.primary};
|
|
129
129
|
border-radius: 4px;
|
|
130
|
-
|
|
131
|
-
padding: 16px 24px;
|
|
132
|
-
display: flex;
|
|
133
|
-
align-items: center;
|
|
134
|
-
justify-content: space-between;
|
|
135
|
-
margin-top: auto;
|
|
136
|
-
width: 100%;
|
|
137
|
-
`;exports.CollectionCardDetailStyle=p,exports.CollectionCardInfoStyle=a,exports.CollectionCardStyle=d,exports.CollectionNameHolder=u,exports.ContainerStyle=n,exports.ProductCardStyle=x,exports.ProductScreenCollectionCardStyle=s,exports.ProductScreenHeader=c,exports.ScrollContainerStyle=l,exports.SelectedScreenHeader=f,exports.StyledFooterForNonModal=h,exports.VariantCardGridStyle=y,exports.VariantCardListStyle=g;
|
|
130
|
+
`,exports.CollectionCardDetailStyle=c,exports.CollectionCardInfoStyle=a,exports.CollectionCardStyle=d,exports.CollectionNameHolder=u,exports.ContainerStyle=l,exports.ProductCardStyle=x,exports.ProductScreenCollectionCardStyle=s,exports.ProductScreenHeader=p,exports.ScrollContainerStyle=n,exports.SelectedScreenHeader=f,exports.VariantCardGridStyle=y,exports.VariantCardListStyle=g;
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { OUT_OF_STOCK_ACTION } from './type';
|
|
3
3
|
export interface ProductVariant {
|
|
4
4
|
name: string;
|
|
5
5
|
price: string;
|
|
@@ -10,7 +10,6 @@ export interface ProductVariant {
|
|
|
10
10
|
fbStatus?: FbProductStatus;
|
|
11
11
|
description?: string;
|
|
12
12
|
id?: string;
|
|
13
|
-
actualPrice?: string;
|
|
14
13
|
}
|
|
15
14
|
export interface Product {
|
|
16
15
|
name: string;
|
|
@@ -20,7 +19,6 @@ export interface Product {
|
|
|
20
19
|
[key: string]: ProductVariant;
|
|
21
20
|
};
|
|
22
21
|
id?: string;
|
|
23
|
-
handle?: string;
|
|
24
22
|
}
|
|
25
23
|
export interface Collection {
|
|
26
24
|
name: string;
|
|
@@ -97,7 +95,6 @@ export type ProductPickerInterface = {
|
|
|
97
95
|
showProductDetails?: boolean;
|
|
98
96
|
containerStyle?: React.CSSProperties;
|
|
99
97
|
crossButtonInsideHeader?: boolean;
|
|
100
|
-
footerForNonModal?: FooterForNonModalI;
|
|
101
98
|
} & ({
|
|
102
99
|
startupScreen: ScreenName.RearrangeProducts;
|
|
103
100
|
rearrangeEnabled: true;
|
|
@@ -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
|
|
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 g}from"./productInfoOverlay.js";import{ProductsScreen as f}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";var O;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(O||(O={}));const D=D=>{const{storeId:T,selectedItems:R,onClose:w,visible:E,zIndex:A,exactLimit:V,limit:$,hideCollectionCheckbox:B,hideProductCheckbox:L,outOfStockAction:M=F.BLUR,hideVariantCheckbox:z,selectProductsFromCustomCollection:H,hideSelectionCount:W,title:G,width:Y,left:K,renderWithoutModal:N,onClickSave:U,pickerType:q,hideProductVariants:J=!1,startupScreen:Q=O.Collections,rearrangeEnabled:X,selectSingleItem:Z=!1,showProductDetails:_,containerStyle:ee,crossButtonInsideHeader:te=!1}=D,[oe,ce]=r(b,{}),[re,se]=s([O.Collections,O.RearrangeProducts].includes(Q)?Q:O.Collections),[ie,le]=s("grid"),[ne,de]=s(""),[ae,ue]=s(""),[he,pe]=s(0),[me,Ce]=s(!1),[ge,fe]=s(0),[ye,be]=s(""),[Se,ve]=s(!1),[ke,je]=s(!1),[xe,Pe]=r(S,{collections:{},products:{}}),[Ie,Fe]=r(v,Object.keys(R).length>0?R:{}),Oe=i(null),[De,Te]=s(!1),[Re,we]=s();l((()=>{Ce(!0),je(!0),D.collectionFetcher(he,T).then((e=>{ce({type:"fetched",data:(null==e?void 0:e.collections)||{}}),Ce(!1),pe((e=>e+1)),je(!1)})).catch()}),[]),l((()=>{let e=0;J?Object.keys(Ie||[]).forEach((t=>{var o;Object.keys((null===(o=Ie[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&Ie[-1]&&(null===(c=Ie[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(Ie||[]).forEach((t=>{var o;Object.keys((null===(o=Ie[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=Ie[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),fe(e)}),[oe,Ie,J]),l((()=>{ae&&(Ce(!0),D.productFetcher(ae,T).then((e=>{Object.keys(e).length&&ce({type:"productsFetched",data:{collectionId:ae,products:e}}),Ce(!1)})).catch())}),[ae]),l((()=>{const e=setTimeout((()=>{"rearrange"!==re&&(ye.length||"collections"!==re)&&(ye.length?(ve(!0),D.searchFetcher(T,ye).then((e=>{"collections"in e&&"products"in e?(Pe({type:"set",data:e}),ce({type:"searched",data:e.collections})):(Pe({type:"set",data:{collections:{},products:e}}),ce({type:"searched",data:e})),se("searchProducts"),Ce(!1),ve(!1)}))):se("collections"))}),800);return()=>clearTimeout(e)}),[ye]),l((()=>{U&&(D.onAdd(Ie,ge),Ee())}),[U]),l((()=>{Z&&Object.keys(Ie||{}).length&&ge&&(D.onAdd(Ie,ge),Ee())}),[Z,Ie,ge]);const Ee=()=>{Fe({type:"reset",data:{}})},Ae=e(P,Object.assign({style:null!=ee?ee:{}},{children:[D.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:D.postHeader})),!D.hideGlobalSearch&&t(o,{children:("collections"===re||"searchProducts"===re)&&t("div",Object.assign({style:{padding:N?"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:()=>Se?t(p,{size:"small",color:n.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:ye,onChangeText:e=>{e.length&&e.trim().length?be(e):be("")}})}))}),e(I,Object.assign({ref:Oe,screenName:re},{children:["collections"===re&&t(C,{customCollectionRestriction:D.customCollectionRestriction,dataLoading:ke,collections:oe,selectedCollectionsDispatch:Fe,setCollectionId:de,setSelectedCollectionId:ue,setScreen:se,selectedCollections:Ie,collectionFetcher:D.collectionFetcher,storeId:T,collectionsDispatch:ce,setSaveDisabled:Ce,pagingControls:{curPage:he,setCurPage:pe},hideCollectionCheckbox:B,renderWithoutModal:N,pickerType:q,scrollContainerRef:Oe}),"products"===re&&ne&&t(k.Provider,Object.assign({value:ne},{children:t(f,{hideInCollectionSearch:D.hideInCollectionSearch,customCollectionRestriction:D.customCollectionRestriction,productFetcher:D.productFetcher,setScreen:se,storeId:T,data:oe[ne],collectionsDispatch:ce,selectedCollectionsDispatch:Fe,selectedData:Ie,setSaveDisabled:Ce,searchInCollectionFetcher:D.searchInCollectionFetcher,hideProductCheckbox:L,outOfStockAction:M,hideVariantCheckbox:z,selectProductsFromCustomCollection:H,renderWithoutModal:N,pickerType:q,hideProductVariants:J,fbStatusFetcher:D.fbStatusFetcher,onProductDetailClick:e=>{Te(!0),we(e)},showProductDetailInfoIcon:_,scrollContainerRef:Oe})})),"view"===re&&t(x,{selectedCollections:Ie||{},selectedCollectionsDispatch:Fe,setScreen:se,collections:oe,hideProductVariants:J,outOfStockAction:M,storeId:T,fbStatusFetcher:D.fbStatusFetcher}),"rearrange"===re&&t(y,{selectedCollections:Ie||{},selectedCollectionsDispatch:Fe,setScreen:se,outOfStockAction:M,rearrangeViewType:"grid"===ie?"list":"grid",scrollContainerRef:Oe,storeId:T,fbStatusFetcher:D.fbStatusFetcher}),"searchProducts"===re&&t(j,{customCollectionRestriction:D.customCollectionRestriction,selectedCollections:Ie||{},searchedCollections:xe||{},searchedCollectionsDispatch:Pe,selectedCollectionsDispatch:Fe,setScreen:se,collections:oe,onBackPress:()=>{be(""),Pe({type:"set",data:{collections:{},products:{}}})},pickerType:q,hideProductCheckbox:L,hideProductVariants:J,hideVariantCheckbox:z,storeId:T,fbStatusFetcher:D.fbStatusFetcher,setCollectionId:de,setSelectedCollectionId:ue,renderWithoutModal:N,hideCollectionCheckbox:B,outOfStockAction:M})]}))]}));return t(o,{children:N?Ae:e(h,Object.assign({zIndex:A,open:E,onClose:()=>{null==w||w(),Ee()},headingTitle:G||("collections"===re||"products"===re?"Select Products":"view"===re?"Selected Products":"searchProducts"===re?"Searched Results":"rearrange"===re?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:Y||"600px",left:K||"auto"},headerRightCustomElement:te?t("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:w},{children:t(d,{width:20,height:20,color:n.content.secondary})})):t(o,{}),footerContainerStyle:D.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:{buttonText:me?"Loading...":re===O.RearrangeProducts?"Done":"Add",disabled:me||ge<1||V&&ge<V||!V&&$&&ge>$||!1,onClick:()=>{D.onAdd(Ie,ge),Ee()}},wrapperStyle:D.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?t(o,{}):V&&ge>V?t(m,{tagText:`You can only select ${V} products`,type:"negative"}):$&&ge>$?t(m,{tagText:`You can only select ${$} products`,type:"negative"}):t(a,ge>0?{onClick:()=>{se(X?O.RearrangeProducts:O.SelectedProducts)},buttonText:V?`${ge}/${V} products selected`:`${ge} products selected`,buttonType:["rearrange","view"].includes(re)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(re)}:{disabled:!0,buttonText:V?`${ge}/${V} products selected`:`${ge} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:De||te},{children:[Ae,De&&Re?t(g,{productData:Re,outOfStockAction:M,onClose:()=>{Te(!1)}}):t(o,{})]}))})};export{D as ProductPickerModal,O as ScreenName};
|
|
@@ -20,4 +20,3 @@ export declare const CollectionNameHolder: import("styled-components").StyledCom
|
|
|
20
20
|
export declare const VariantCardListStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
21
21
|
export declare const VariantCardGridStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
22
22
|
export declare const StyledHeaderRightIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
23
|
-
export declare const StyledFooterForNonModal: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -75,7 +75,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
75
75
|
cursor: pointer;
|
|
76
76
|
background-color: ${i.surface.hovered};
|
|
77
77
|
}
|
|
78
|
-
`,
|
|
78
|
+
`,x=e.div`
|
|
79
79
|
display: flex;
|
|
80
80
|
flex-direction: row;
|
|
81
81
|
max-height: 32px;
|
|
@@ -87,7 +87,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
87
87
|
position: sticky;
|
|
88
88
|
top: 0;
|
|
89
89
|
z-index: 10;
|
|
90
|
-
`,
|
|
90
|
+
`,s=e.div`
|
|
91
91
|
display: flex;
|
|
92
92
|
flex-direction: column;
|
|
93
93
|
`,g=e.div`
|
|
@@ -127,11 +127,4 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
127
127
|
align-items: center;
|
|
128
128
|
border: 1px solid ${i.stroke.primary};
|
|
129
129
|
border-radius: 4px;
|
|
130
|
-
`;
|
|
131
|
-
padding: 16px 24px;
|
|
132
|
-
display: flex;
|
|
133
|
-
align-items: center;
|
|
134
|
-
justify-content: space-between;
|
|
135
|
-
margin-top: auto;
|
|
136
|
-
width: 100%;
|
|
137
|
-
`;export{p as CollectionCardDetailStyle,d as CollectionCardInfoStyle,r as CollectionCardStyle,x as CollectionNameHolder,o as ContainerStyle,a as ProductCardStyle,c as ProductScreenCollectionCardStyle,l as ProductScreenHeader,n as ScrollContainerStyle,s as SelectedScreenHeader,m as StyledFooterForNonModal,f as VariantCardGridStyle,g as VariantCardListStyle};
|
|
130
|
+
`;export{p as CollectionCardDetailStyle,d as CollectionCardInfoStyle,r as CollectionCardStyle,s as CollectionNameHolder,o as ContainerStyle,a as ProductCardStyle,c as ProductScreenCollectionCardStyle,l as ProductScreenHeader,n as ScrollContainerStyle,x as SelectedScreenHeader,f as VariantCardGridStyle,g as VariantCardListStyle};
|