@bikdotai/bik-component-library 0.0.547-drop.1 → 0.0.548-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  2. package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  3. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +2 -5
  4. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +1 -1
  5. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +2 -6
  6. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
  7. package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +0 -3
  8. package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
  9. package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +0 -2
  10. package/dist/cjs/components/dropdown/type.d.ts +0 -4
  11. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  12. package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
  13. package/dist/esm/components/dropdown/Dropdown.js +1 -1
  14. package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  15. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +2 -5
  16. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +1 -1
  17. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +2 -6
  18. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
  19. package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +0 -3
  20. package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
  21. package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +0 -2
  22. package/dist/esm/components/dropdown/type.d.ts +0 -4
  23. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  24. package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
  25. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),r=require("../../constants/Theme.js"),o=require("../../assets/icons/chevronDown.svg.js"),i=require("../input/Input.js"),s=require("../input/context/InputStyleProvider.js"),l=require("./DropdownPopover/index.js"),a=require("./OpenedDropdown/utils/iterationOnOptions.js");function d(){}const u=u=>{var c,p,h,{placeHolder:v,size:g,onSelect:j,defaultOptions:f,disabled:x,noErrorHint:b,placeHolderHeight:w,showPlaceholderWhenSelected:O=!1,inputStyle:S={}}=u,y=e.__rest(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle"]);const[H,m]=n.useState(!1),q=null!=g?g:"default",D=n.useRef(),[E,I]=n.useState(null!=f?f:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==y?void 0:y.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),I([...t])}),[y.options]),n.useEffect((()=>{f&&I([...f])}),[f]);const P=a.getSelectedOptionsAsText(E);return t.jsx(s.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:w||("small"===q?32:48),width:null!==(p=null!==(c=y.buttonWidth)&&void 0!==c?c:y.width)&&void 0!==p?p:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},S),input:{minHeight:"100%"}}},{children:t.jsx(l.DropdownPopover,Object.assign({ref:D,onSelect:function(e){Array.isArray(e)?I([...e]):I([e]),null==j||j(e)},disabled:x,onDropdownVisbilityChange:e=>m(e)},y,{children:t.jsx(i.Input,{version:y.version,noErrorHint:b,state:x?"disabled":"none",value:O?v:null!=P?P:"",errorMessage:y.error,variant:q,placeholder:null!=v?v:"Select an option",width:null!==(h=y.width)&&void 0!==h?h:"100%",onChangeText:d,rightIcon:{icon:()=>t.jsx(o.default,{style:{transform:H?"rotate(180deg)":"rotate(0deg)"},onClick:d,width:"small"===q?20:24,height:"small"===q?20:24,color:r.COLORS.content.primary})},truncateText:!0})}))}))};u.displayName="Dropdown",exports.Dropdown=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),r=require("../../constants/Theme.js"),o=require("../../assets/icons/chevronDown.svg.js"),i=require("../input/Input.js"),l=require("../input/context/InputStyleProvider.js"),s=require("./DropdownPopover/index.js");function a(){}const d=d=>{var u,c,p,{placeHolder:h,size:v,onSelect:g,defaultOptions:j,disabled:b,noErrorHint:f,placeHolderHeight:x,showPlaceholderWhenSelected:w=!1,inputStyle:S={}}=d,y=e.__rest(d,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle"]);const[m,H]=n.useState(!1),O=null!=v?v:"default",q=n.useRef(),[E,I]=n.useState(null!=j?j:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==y?void 0:y.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),I([...t])}),[y.options]),n.useEffect((()=>{j&&I([...j])}),[j]);const P=E.length?E.map((e=>e.label)).join(", "):void 0;return t.jsx(l.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:x||("small"===O?32:48),width:null!==(c=null!==(u=y.buttonWidth)&&void 0!==u?u:y.width)&&void 0!==c?c:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},S),input:{minHeight:"100%"}}},{children:t.jsx(s.DropdownPopover,Object.assign({ref:q,onSelect:function(e){Array.isArray(e)?I([...e]):I([e]),null==g||g(e)},disabled:b,onDropdownVisbilityChange:e=>H(e)},y,{children:t.jsx(i.Input,{version:y.version,noErrorHint:f,state:b?"disabled":"none",value:w?h:null!=P?P:"",errorMessage:y.error,variant:O,placeholder:null!=h?h:"Select an option",width:null!==(p=y.width)&&void 0!==p?p:"100%",onChangeText:a,rightIcon:{icon:()=>t.jsx(o.default,{style:{transform:m?"rotate(180deg)":"rotate(0deg)"},onClick:a,width:"small"===O?20:24,height:"small"===O?20:24,color:r.COLORS.content.primary})},truncateText:!0})}))}))};d.displayName="Dropdown",exports.Dropdown=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),r=require("../../../../hooks/useOutside.js"),o=require("../../hooks/useDropdown.js"),s=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),c=require("./multiSelect/MultiSelectDropdownBottomBar.js"),a=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,S=290;exports.OpenedDropdown=j=>{let{options:f,isSearchable:x,isMultiSelect:g,width:w,allowFreeForm:v,height:b,onClose:m,onSelect:y,onSearch:M,version:O,skipSorting:q,headerRef:C,hideSelectAll:D,primaryButtonText:L,onInfiniteScroll:F,onMultiSelectClear:k,onDropdownItemClick:A}=j;const{dropdownOptions:B,search:I,searchedString:H,searchedOptions:Z,onApplyHandler:R,selectAllHandler:T,onMultiSelectClear:P,onFreeFormSelect:_,onMultiSelectApply:z,latestDropdownOptionsRef:E,getSelectedOptions:K}=o.useDropdown(O,f,y,q,g,M),[N,W]=t.useState(null!=w?w:S),[G,J]=t.useState(null),Q=t.useRef(null);r.useOutside(Q,(()=>{if(J(null),g&&"2.0"===O){const e=K(E.current);null==m||m(e)}else null==m||m(B)}),[C]);const U=null!=b?b:h,V="number"==typeof U?x&&g?U-96:x&&!g||!x&&g?U-48:U:U;t.useEffect((()=>{const e=null!=w?w:S;if(null===G)W(e);else if("number"==typeof e)W(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));W(t)}}),[G]);const X=[],Y=(H&&M?Z:B).map((e=>{var t,n;if(H&&!M){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(H.toLowerCase()))&&(X.push(!H||e.label===H),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(H.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(H.toLowerCase()))?(X.push(!H||e.label===H),e):null}return e})).filter((e=>null!==e)),$=!!x&&H&&0===Y.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({version:O,ref:Q,style:{width:N}},{children:[e.jsxs("div",Object.assign({style:{width:G?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!x&&e.jsx(d.SearchBox,{onSearch:I,version:O}),Y.length||H?e.jsxs(a.MenuListContainer,Object.assign({minHeight:U,maxHeight:V},{children:[!!g&&!$&&!D&&e.jsx(u.SelectAllMenu,{version:O,options:H&&M?Z:B,onSelect:T}),!v&&$&&e.jsx(p.SearchZeroState,{height:V,searchedString:H}),v&&($||!!X.length&&X.every((e=>!1===e)))&&e.jsx(i.FreeFormMenu,{version:O,isMultiSelect:g,onSelect:_,searchedString:H}),e.jsx(l.MenuList,{onInfiniteScroll:F,onDropdownItemClick:A,version:O,onSelect:R,showDescription:function(e,t){J(e&&t?{title:e,description:t}:null)},isMultiSelect:g,options:Y})]})):e.jsx("div",Object.assign({style:{height:U,display:"flex"}},{children:e.jsx(n.ZeroState,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!g&&!(!Y.length&&!H)&&"2.0"!==O&&e.jsx(c.default,{onClear:()=>{P(),null==k||k()},onApply:z,list:H&&M?Z:B,buttonText:L})]})),!!G&&e.jsx(s.Description,{title:G.title,description:G.description,version:O})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../../../zeroState/ZeroState.js"),s=require("../../../../hooks/useOutside.js"),n=require("../../hooks/useDropdown.js"),o=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),c=require("./multiSelect/MultiSelectDropdownBottomBar.js"),a=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,S=290;exports.OpenedDropdown=j=>{let{options:x,isSearchable:f,isMultiSelect:g,width:v,allowFreeForm:w,height:b,onClose:y,onSelect:m,onSearch:O,version:q,skipSorting:M,headerRef:C,hideSelectAll:D,primaryButtonText:L}=j;const{dropdownOptions:F,search:A,searchedString:k,searchedOptions:B,onApplyHandler:H,selectAllHandler:Z,onMultiSelectClear:R,onFreeFormSelect:T,onMultiSelectApply:P,latestDropdownOptionsRef:_,getSelectedOptions:z}=n.useDropdown(q,x,m,M,g,O),[E,I]=t.useState(null!=v?v:S),[K,N]=t.useState(null),W=t.useRef(null);s.useOutside(W,(()=>{if(N(null),g&&"2.0"===q){const e=z(_.current);null==y||y(e)}else null==y||y(F)}),[C]);const G=null!=b?b:h,J="number"==typeof G?f&&g?G-96:f&&!g||!f&&g?G-48:G:G;t.useEffect((()=>{const e=null!=v?v:S;if(null===K)I(e);else if("number"==typeof e)I(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));I(t)}}),[K]);const Q=[],U=(k&&O?B:F).map((e=>{var t,r;if(k&&!O){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(k.toLowerCase()))&&(Q.push(!k||e.label===k),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(k.toLowerCase()))||(null===(r=e.searchKey)||void 0===r?void 0:r.toLowerCase().includes(k.toLowerCase()))?(Q.push(!k||e.label===k),e):null}return e})).filter((e=>null!==e)),V=!!f&&k&&0===U.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({version:q,ref:W,style:{width:E}},{children:[e.jsxs("div",Object.assign({style:{width:K?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!f&&e.jsx(d.SearchBox,{onSearch:A,version:q}),U.length||k?e.jsxs(a.MenuListContainer,Object.assign({minHeight:G,maxHeight:J},{children:[!!g&&!V&&!D&&e.jsx(u.SelectAllMenu,{version:q,options:k&&O?B:F,onSelect:Z}),!w&&V&&e.jsx(p.SearchZeroState,{height:J,searchedString:k}),w&&(V||!!Q.length&&Q.every((e=>!1===e)))&&e.jsx(i.FreeFormMenu,{version:q,isMultiSelect:g,onSelect:T,searchedString:k}),e.jsx(l.MenuList,{version:q,onSelect:H,showDescription:function(e,t){N(e&&t?{title:e,description:t}:null)},isMultiSelect:g,options:U})]})):e.jsx("div",Object.assign({style:{height:G,display:"flex"}},{children:e.jsx(r.ZeroState,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!g&&!(!U.length&&!k)&&"2.0"!==q&&e.jsx(c.default,{onClear:R,onApply:P,list:k&&O?B:F,buttonText:L})]})),!!K&&e.jsx(o.Description,{title:K.title,description:K.description,version:q})]}))};
@@ -1,13 +1,10 @@
1
1
  import React from 'react';
2
2
  import { MultiSelectOption, SingleOption } from '../../../type';
3
- interface MenuItemProps {
3
+ export declare const MenuItem: React.FC<{
4
4
  option: SingleOption | MultiSelectOption;
5
5
  isMultiSelect?: boolean;
6
6
  showDescription: (title?: string, description?: string) => void;
7
7
  onSelect: (option: SingleOption) => void;
8
- onDropdownItemClick?: (option: SingleOption) => void;
9
8
  last?: boolean;
10
9
  version?: '1.0' | '2.0';
11
- }
12
- export declare const MenuItem: React.FC<MenuItemProps>;
13
- export {};
10
+ }>;
@@ -2,4 +2,4 @@
2
2
  padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
3
3
  cursor: pointer;
4
4
  margin-top: ${e=>"2.0"===e.version?"2px":"0"};
5
- `;exports.MenuItem=t=>{let{option:i,isMultiSelect:l,showDescription:a,onSelect:d,last:u,version:p,onDropdownItemClick:m}=t;var x;function g(e){i.disabled||d(Object.assign(Object.assign({},i),{selected:e}))}return e.jsx(c,{version:p,style:u?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),g(!i.selected),null==m||m(i)},onMouseOver:function(){i.description?a(i.label,i.description):a()},listItem:{value:i.value,label:i.label},subText:i.subText,leadingIcon:l?e.jsxs("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e.jsx(n.CheckBox,{size:"2.0"===p?"SMALL":"DEFAULT",isDisabled:null!==(x=i.disabled)&&void 0!==x&&x,isChecked:!!i.selected,onValueChange:g}),e.jsx("div",Object.assign({style:{marginRight:"-4px"}},{children:i.leadingIcon}))]})):i.leadingIcon?e.jsx(e.Fragment,{children:i.leadingIcon}):e.jsx(e.Fragment,{}),customComponent:i.customComponent,trailingIcon:i.isFreeForm?e.jsx(o.FreeFormContainer,{children:e.jsx(s.BodyCaption,Object.assign({style:{color:r.COLORS.content.secondary}},{children:"Freeform"}))}):i.trailingIcon?e.jsx(e.Fragment,{children:i.trailingIcon}):e.jsx(e.Fragment,{}),variant:i.disabled?"inactive":i.selected?"selected":"default"})};
5
+ `;exports.MenuItem=t=>{let{option:i,isMultiSelect:l,showDescription:a,onSelect:d,last:u,version:p}=t;var x;function g(e){i.disabled||d(Object.assign(Object.assign({},i),{selected:e}))}return e.jsx(c,{version:p,style:u?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),g(!i.selected)},onMouseOver:function(){i.description?a(i.label,i.description):a()},listItem:{value:i.value,label:i.label},subText:i.subText,leadingIcon:l?e.jsxs("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e.jsx(n.CheckBox,{size:"2.0"===p?"SMALL":"DEFAULT",isDisabled:null!==(x=i.disabled)&&void 0!==x&&x,isChecked:!!i.selected,onValueChange:g}),e.jsx("div",Object.assign({style:{marginRight:"-4px"}},{children:i.leadingIcon}))]})):i.leadingIcon?e.jsx(e.Fragment,{children:i.leadingIcon}):e.jsx(e.Fragment,{}),customComponent:i.customComponent,trailingIcon:i.isFreeForm?e.jsx(o.FreeFormContainer,{children:e.jsx(s.BodyCaption,Object.assign({style:{color:r.COLORS.content.secondary}},{children:"Freeform"}))}):i.trailingIcon?e.jsx(e.Fragment,{children:i.trailingIcon}):e.jsx(e.Fragment,{}),variant:i.disabled?"inactive":i.selected?"selected":"default"})};
@@ -1,13 +1,9 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption, SingleOption } from '../../../type';
3
- interface MenuListProps {
3
+ export declare const MenuList: React.FC<{
4
4
  options: DropdownOption[];
5
5
  isMultiSelect?: boolean;
6
6
  showDescription: (title?: string, description?: string) => void;
7
7
  onSelect: (optionSelect: SingleOption) => void;
8
8
  version?: '1.0' | '2.0';
9
- onInfiniteScroll?: () => void;
10
- onDropdownItemClick?: (option: DropdownOption) => void;
11
- }
12
- export declare const MenuList: React.FC<MenuListProps>;
13
- export {};
9
+ }>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("./MenuItem.js"),r=require("./MenuList.styled.js");exports.MenuList=s=>{let{options:i,isMultiSelect:o,showDescription:c,onSelect:l,version:u,onInfiniteScroll:a,onDropdownItemClick:p}=s;const d=n.useRef(null),j=n.useRef(null),g=n.useCallback((()=>{d.current&&d.current.disconnect(),d.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==a||a())})),j.current&&d.current.observe(j.current)}),[a]);return n.useEffect((()=>(g(),()=>{d.current&&d.current.disconnect()})),[g,i]),e.jsx(e.Fragment,{children:i.map(((n,s)=>{const a=s===i.length-1;if(n.options){const i=n;return e.jsxs("div",Object.assign({style:{marginTop:"2.0"===u?2:0}},{children:[e.jsxs(r.StyledGroupedLabel,Object.assign({version:u},{children:[i.leadingIcon?e.jsx("span",Object.assign({style:{marginRight:8}},{children:i.leadingIcon})):e.jsx(e.Fragment,{}),i.label]})),i.options.map(((n,r)=>e.jsx(t.MenuItem,{version:u,last:r===i.options.length-1,onSelect:l,showDescription:c,onDropdownItemClick:p,isMultiSelect:o,option:n},`${s}-${r}`)))]}),s)}return e.jsxs("div",{children:[e.jsx(t.MenuItem,{version:u,last:a,onSelect:l,showDescription:c,onDropdownItemClick:p,isMultiSelect:o,option:n},s),a?e.jsx("span",{ref:j}):null]},s)}))})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("./MenuItem.js"),s=require("./MenuList.styled.js");exports.MenuList=n=>{let{options:i,isMultiSelect:r,showDescription:o,onSelect:l,version:c}=n;return e.jsx(e.Fragment,{children:i.map(((n,a)=>{const u=a===i.length-1;if(n.options){const i=n;return e.jsxs("div",Object.assign({style:{marginTop:"2.0"===c?2:0}},{children:[e.jsxs(s.StyledGroupedLabel,Object.assign({version:c},{children:[i.leadingIcon?e.jsx("span",Object.assign({style:{marginRight:8}},{children:i.leadingIcon})):e.jsx(e.Fragment,{}),i.label]})),i.options.map(((s,n)=>e.jsx(t.MenuItem,{version:c,last:n===i.options.length-1,onSelect:l,showDescription:o,isMultiSelect:r,option:s},`${a}-${n}`)))]}),a)}return e.jsx(t.MenuItem,{version:c,last:u,onSelect:l,showDescription:o,isMultiSelect:r,option:n},a)}))})};
@@ -12,7 +12,6 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
12
12
  leadingIcon?: JSX.Element | undefined;
13
13
  customComponent?: JSX.Element | undefined;
14
14
  searchKey?: string | undefined;
15
- selectedLabel?: string | undefined;
16
15
  } | {
17
16
  label?: string | undefined;
18
17
  value?: string | undefined;
@@ -25,8 +24,6 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
25
24
  leadingIcon?: JSX.Element | undefined;
26
25
  customComponent?: JSX.Element | undefined;
27
26
  searchKey?: string | undefined;
28
- selectedLabel?: string | undefined;
29
27
  options: SingleOption[];
30
28
  })[];
31
29
  export declare function iterateOnOptionsRaw(options: DropdownOption[], cb: (option: SingleOption) => void): void;
32
- export declare function getSelectedOptionsAsText(selectedOption: DropdownOption[]): string | undefined;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSelectedOptionsAsText=function(t){if(console.log(t),t&&t.length)return t.map((t=>{var e;const n=t;return null!==(e=n.selectedLabel)&&void 0!==e?e:n.label})).join(", ")},exports.iterateOnOptions=function(t,e,n){return t.map((t=>{if(t.options){const s=t.options.map((t=>!n||n(t)?Object.assign(Object.assign({},t),e):Object.assign({},t)));return Object.assign(Object.assign({},t),{options:[...s]})}return!n||n(t)?Object.assign(Object.assign({},t),e):Object.assign({},t)}))},exports.iterateOnOptionsRaw=function(t,e){t.forEach((t=>{t.options?t.options.forEach(e):e(t)}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.iterateOnOptions=function(t,s,e){return t.map((t=>{if(t.options){const n=t.options.map((t=>!e||e(t)?Object.assign(Object.assign({},t),s):Object.assign({},t)));return Object.assign(Object.assign({},t),{options:[...n]})}return!e||e(t)?Object.assign(Object.assign({},t),s):Object.assign({},t)}))},exports.iterateOnOptionsRaw=function(t,s){t.forEach((t=>{t.options?t.options.forEach(s):s(t)}))};
@@ -19,7 +19,6 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
19
19
  leadingIcon?: JSX.Element | undefined;
20
20
  customComponent?: JSX.Element | undefined;
21
21
  searchKey?: string | undefined;
22
- selectedLabel?: string | undefined;
23
22
  } | {
24
23
  label?: string | undefined;
25
24
  value?: string | undefined;
@@ -32,7 +31,6 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
32
31
  leadingIcon?: JSX.Element | undefined;
33
32
  customComponent?: JSX.Element | undefined;
34
33
  searchKey?: string | undefined;
35
- selectedLabel?: string | undefined;
36
34
  options: SingleOption[];
37
35
  })[] | undefined;
38
36
  selectAllHandler: (newState: SelectAllCheckboxState) => void;
@@ -19,9 +19,6 @@ export interface OpenDropdownProps {
19
19
  headerRef?: any;
20
20
  hideSelectAll?: boolean;
21
21
  primaryButtonText?: string;
22
- onInfiniteScroll?: () => void;
23
- onMultiSelectClear?: () => void;
24
- onDropdownItemClick?: (option: DropdownOption) => void;
25
22
  }
26
23
  export type GroupedOption = {
27
24
  label?: string;
@@ -40,7 +37,6 @@ export type SingleOption = {
40
37
  leadingIcon?: JSX.Element;
41
38
  customComponent?: JSX.Element;
42
39
  searchKey?: string;
43
- selectedLabel?: string;
44
40
  };
45
41
  export type MultiSelectOption = SingleOption;
46
42
  export type DropdownOption = MultiSelectOption | SingleOption | GroupedOption;
@@ -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("../button/Button.js"),n=require("../input/Input.js"),l=require("../modals/styledModal.js"),i=require("../spinner/Spinner.js"),a=require("../tag/Tag.js"),d=require("./collectionScreen.js"),u=require("./productInfoOverlay.js"),h=require("./productScreen.js"),p=require("./rearrangeScreen.js"),S=require("./reducers.js"),C=require("./searchScreen.js"),x=require("./selectedScreen.js"),g=require("./style.js"),j=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:y,selectedItems:b,onClose:f,visible:m,zIndex:v,exactLimit:P,limit:k,hideCollectionCheckbox:O,hideProductCheckbox:I,outOfStockAction:F=j.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,hideSelectionCount:q,title:E,width:D,renderWithoutModal:w,onClickSave:N,pickerType:A,hideProductVariants:B=!1,startupScreen:M=exports.ScreenName.Collections,rearrangeEnabled:V,selectSingleItem:$=!1,showProductDetails:L,containerStyle:_}=e,[z,W]=c.useReducer(S.collectionsReducer,{}),[G,H]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(M)?M:exports.ScreenName.Collections),[K,U]=c.useState("grid"),[Y,J]=c.useState(""),[Q,X]=c.useState(""),[Z,ee]=c.useState(0),[te,oe]=c.useState(!1),[ce,re]=c.useState(0),[se,ne]=c.useState(""),[le,ie]=c.useState(!1),[ae,de]=c.useState(!1),[ue,he]=c.useReducer(S.searchReducer,{collections:{},products:{}}),[pe,Se]=c.useReducer(S.selectedColectionsReducer,Object.keys(b).length>0?b:{}),Ce=c.useRef(null),[xe,ge]=c.useState(!1),[je,ye]=c.useState();c.useEffect((()=>{oe(!0),de(!0),e.collectionFetcher(Z,y).then((e=>{W({type:"fetched",data:(null==e?void 0:e.collections)||{}}),oe(!1),ee((e=>e+1)),de(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;B?Object.keys(pe||[]).forEach((t=>{var o;Object.keys((null===(o=pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&pe[-1]&&(null===(c=pe[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(pe||[]).forEach((t=>{var o;Object.keys((null===(o=pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=pe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),re(e)}),[z,pe,B]),c.useEffect((()=>{Q&&(oe(!0),e.productFetcher(Q,y).then((e=>{Object.keys(e).length&&W({type:"productsFetched",data:{collectionId:Q,products:e}}),oe(!1)})).catch())}),[Q]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==G&&(se.length||"collections"!==G)&&(se.length?(ie(!0),e.searchFetcher(y,se).then((e=>{"collections"in e&&"products"in e?(he({type:"set",data:e}),W({type:"searched",data:e.collections})):(he({type:"set",data:{collections:{},products:e}}),W({type:"searched",data:e})),H("searchProducts"),oe(!1),ie(!1)}))):H("collections"))}),800);return()=>clearTimeout(t)}),[se]),c.useEffect((()=>{N&&(e.onAdd(pe,ce),be())}),[N]),c.useEffect((()=>{$&&Object.keys(pe||{}).length&&ce&&(e.onAdd(pe,ce),be())}),[$,pe,ce]);const be=()=>{Se({type:"reset",data:{}})},fe=t.jsxs(g.ContainerStyle,Object.assign({style:null!=_?_:{}},{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===G||"searchProducts"===G)&&t.jsx("div",Object.assign({style:{padding:w?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(n.Input,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>le?t.jsx(i.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:se,onChangeText:e=>{e.length&&e.trim().length?ne(e):ne("")}})}))}),t.jsxs(g.ScrollContainerStyle,Object.assign({ref:Ce,screenName:G},{children:["collections"===G&&t.jsx(d.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:ae,collections:z,selectedCollectionsDispatch:Se,setCollectionId:J,setSelectedCollectionId:X,setScreen:H,selectedCollections:pe,collectionFetcher:e.collectionFetcher,storeId:y,collectionsDispatch:W,setSaveDisabled:oe,pagingControls:{curPage:Z,setCurPage:ee},hideCollectionCheckbox:O,renderWithoutModal:w,pickerType:A,scrollContainerRef:Ce}),"products"===G&&Y&&t.jsx(S.CollectionIdContext.Provider,Object.assign({value:Y},{children:t.jsx(h.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:H,storeId:y,data:z[Y],collectionsDispatch:W,selectedCollectionsDispatch:Se,selectedData:pe,setSaveDisabled:oe,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:I,outOfStockAction:F,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,renderWithoutModal:w,pickerType:A,hideProductVariants:B,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{ge(!0),ye(e)},showProductDetailInfoIcon:L,scrollContainerRef:Ce})})),"view"===G&&t.jsx(x.SelectedScreen,{selectedCollections:pe||{},selectedCollectionsDispatch:Se,setScreen:H,collections:z,hideProductVariants:B,outOfStockAction:F,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===G&&t.jsx(p.RearrangeScreen,{selectedCollections:pe||{},selectedCollectionsDispatch:Se,setScreen:H,outOfStockAction:F,rearrangeViewType:"grid"===K?"list":"grid",scrollContainerRef:Ce,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===G&&t.jsx(C.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:pe||{},searchedCollections:ue||{},searchedCollectionsDispatch:he,selectedCollectionsDispatch:Se,setScreen:H,collections:z,onBackPress:()=>{ne(""),he({type:"set",data:{collections:{},products:{}}})},pickerType:A,hideProductCheckbox:I,hideProductVariants:B,hideVariantCheckbox:R,storeId:y,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:J,setSelectedCollectionId:X,renderWithoutModal:w,hideCollectionCheckbox:O,outOfStockAction:F})]}))]}));return t.jsx(t.Fragment,{children:w?fe:t.jsxs(l.StyledModal,Object.assign({zIndex:v,open:m,onClose:()=>{null==f||f(),be()},headingTitle:E||("collections"===G||"products"===G?"Select Products":"view"===G?"Selected Products":"searchProducts"===G?"Searched Results":"rearrange"===G?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:D||"600px"},headerRightCustomElement: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:te?"Loading...":G===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:te||ce<1||P&&ce<P||!P&&k&&ce>k||!1,onClick:()=>{e.onAdd(pe,ce),be()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:q?t.jsx(t.Fragment,{}):P&&ce>P?t.jsx(a.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):k&&ce>k?t.jsx(a.Tag,{tagText:`You can only select ${k} products`,type:"negative"}):ce>0?t.jsx(s.Button,{onClick:()=>{H(V?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:P?`${ce}/${P} products selected`:`${ce} products selected`,buttonType:["rearrange","view"].includes(G)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(G)}):t.jsx(s.Button,{disabled:!0,buttonText:P?`${ce}/${P} products selected`:`${ce} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:xe},{children:[fe,xe&&je?t.jsx(u.ProductInfoOverlay,{productData:je,outOfStockAction:F,onClose:()=>{ge(!1)}}):t.jsx(t.Fragment,{})]}))})};
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("../button/Button.js"),n=require("../input/Input.js"),l=require("../modals/styledModal.js"),i=require("../spinner/Spinner.js"),a=require("../tag/Tag.js"),d=require("./collectionScreen.js"),u=require("./productInfoOverlay.js"),h=require("./productScreen.js"),p=require("./rearrangeScreen.js"),S=require("./reducers.js"),C=require("./searchScreen.js"),x=require("./selectedScreen.js"),g=require("./style.js"),j=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:y,selectedItems:b,onClose:f,visible:m,zIndex:v,exactLimit:P,limit:k,hideCollectionCheckbox:I,hideProductCheckbox:O,outOfStockAction:F=j.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,hideSelectionCount:E,title:q,width:D,renderWithoutModal:w,onClickSave:N,pickerType:A,hideProductVariants:B=!1,startupScreen:M=exports.ScreenName.Collections,rearrangeEnabled:V,selectSingleItem:$=!1,showProductDetails:L,containerStyle:_}=e,[z,W]=c.useReducer(S.collectionsReducer,{}),[G,H]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(M)?M:exports.ScreenName.Collections),[K,U]=c.useState("grid"),[Y,J]=c.useState(""),[Q,X]=c.useState(""),[Z,ee]=c.useState(0),[te,oe]=c.useState(!1),[ce,re]=c.useState(0),[se,ne]=c.useState(""),[le,ie]=c.useState(!1),[ae,de]=c.useState(!1),[ue,he]=c.useReducer(S.searchReducer,{collections:{},products:{}}),[pe,Se]=c.useReducer(S.selectedColectionsReducer,Object.keys(b).length>0?b:{}),Ce=c.useRef(null),[xe,ge]=c.useState(!1),[je,ye]=c.useState();c.useEffect((()=>{oe(!0),de(!0),e.collectionFetcher(Z,y).then((e=>{W({type:"fetched",data:(null==e?void 0:e.collections)||{}}),oe(!1),ee((e=>e+1)),de(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;B?Object.keys(pe||[]).forEach((t=>{var o;Object.keys((null===(o=pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&pe[-1]&&(null===(c=pe[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(pe||[]).forEach((t=>{var o;Object.keys((null===(o=pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=pe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),re(e)}),[z,pe,B]),c.useEffect((()=>{Q&&(oe(!0),console.log("useEffect selectedCollectionId modal.tsx:277",Q),e.productFetcher(Q,y).then((e=>{Object.keys(e).length&&W({type:"productsFetched",data:{collectionId:Q,products:e}}),oe(!1)})).catch())}),[Q]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==G&&(se.length||"collections"!==G)&&(se.length?(ie(!0),e.searchFetcher(y,se).then((e=>{"collections"in e&&"products"in e?(he({type:"set",data:e}),W({type:"searched",data:e.collections})):(he({type:"set",data:{collections:{},products:e}}),W({type:"searched",data:e})),H("searchProducts"),oe(!1),ie(!1)}))):H("collections"))}),800);return()=>clearTimeout(t)}),[se]),c.useEffect((()=>{N&&(e.onAdd(pe,ce),be())}),[N]),c.useEffect((()=>{$&&Object.keys(pe||{}).length&&ce&&(e.onAdd(pe,ce),be())}),[$,pe,ce]);const be=()=>{Se({type:"reset",data:{}})},fe=t.jsxs(g.ContainerStyle,Object.assign({style:null!=_?_:{}},{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===G||"searchProducts"===G)&&t.jsx("div",Object.assign({style:{padding:w?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(n.Input,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>le?t.jsx(i.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:se,onChangeText:e=>{e.length&&e.trim().length?ne(e):ne("")}})}))}),t.jsxs(g.ScrollContainerStyle,Object.assign({ref:Ce,screenName:G},{children:["collections"===G&&t.jsx(d.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:ae,collections:z,selectedCollectionsDispatch:Se,setCollectionId:J,setSelectedCollectionId:X,setScreen:H,selectedCollections:pe,collectionFetcher:e.collectionFetcher,storeId:y,collectionsDispatch:W,setSaveDisabled:oe,pagingControls:{curPage:Z,setCurPage:ee},hideCollectionCheckbox:I,renderWithoutModal:w,pickerType:A,scrollContainerRef:Ce}),"products"===G&&Y&&t.jsx(S.CollectionIdContext.Provider,Object.assign({value:Y},{children:t.jsx(h.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:H,storeId:y,data:z[Y],collectionsDispatch:W,selectedCollectionsDispatch:Se,selectedData:pe,setSaveDisabled:oe,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:O,outOfStockAction:F,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,renderWithoutModal:w,pickerType:A,hideProductVariants:B,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{ge(!0),ye(e)},showProductDetailInfoIcon:L,scrollContainerRef:Ce})})),"view"===G&&t.jsx(x.SelectedScreen,{selectedCollections:pe||{},selectedCollectionsDispatch:Se,setScreen:H,collections:z,hideProductVariants:B,outOfStockAction:F,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===G&&t.jsx(p.RearrangeScreen,{selectedCollections:pe||{},selectedCollectionsDispatch:Se,setScreen:H,outOfStockAction:F,rearrangeViewType:"grid"===K?"list":"grid",scrollContainerRef:Ce,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===G&&t.jsx(C.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:pe||{},searchedCollections:ue||{},searchedCollectionsDispatch:he,selectedCollectionsDispatch:Se,setScreen:H,collections:z,onBackPress:()=>{ne(""),he({type:"set",data:{collections:{},products:{}}})},pickerType:A,hideProductCheckbox:O,hideProductVariants:B,hideVariantCheckbox:R,storeId:y,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:J,setSelectedCollectionId:X,renderWithoutModal:w,hideCollectionCheckbox:I,outOfStockAction:F})]}))]}));return t.jsx(t.Fragment,{children:w?fe:t.jsxs(l.StyledModal,Object.assign({zIndex:v,open:m,onClose:()=>{null==f||f(),be()},headingTitle:q||("collections"===G||"products"===G?"Select Products":"view"===G?"Selected Products":"searchProducts"===G?"Searched Results":"rearrange"===G?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:D||"600px"},headerRightCustomElement: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:te?"Loading...":G===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:te||ce<1||P&&ce<P||!P&&k&&ce>k||!1,onClick:()=>{e.onAdd(pe,ce),be()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:E?t.jsx(t.Fragment,{}):P&&ce>P?t.jsx(a.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):k&&ce>k?t.jsx(a.Tag,{tagText:`You can only select ${k} products`,type:"negative"}):ce>0?t.jsx(s.Button,{onClick:()=>{H(V?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:P?`${ce}/${P} products selected`:`${ce} products selected`,buttonType:["rearrange","view"].includes(G)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(G)}):t.jsx(s.Button,{disabled:!0,buttonText:P?`${ce}/${P} products selected`:`${ce} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:xe},{children:[fe,xe&&je?t.jsx(u.ProductInfoOverlay,{productData:je,outOfStockAction:F,onClose:()=>{ge(!1)}}):t.jsx(t.Fragment,{})]}))})};
@@ -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"),r=require("../../assets/icons/box.svg.js"),c=require("../../assets/icons/search.svg.js"),o=require("lodash"),s=require("react"),n=require("../../constants/Theme.js"),i=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),u=require("../input/Input.js"),d=require("../spinner/Spinner.js"),a=require("../TypographyStyle.js"),h=require("./emptyState.js"),p=require("./product.js"),v=require("./ProductPickerShimmer.js"),j=require("./reducers.js"),g=require("./style.js"),y=require("./type.js"),P=require("./utility.js");exports.ProductsScreen=C=>{var k,O;const{data:b,collectionsDispatch:f,selectedData:x,selectedCollectionsDispatch:S,productFetcher:m,storeId:I,setScreen:E,setSaveDisabled:q,hideInCollectionSearch:A,customCollectionRestriction:T,hideProductCheckbox:D,outOfStockAction:V=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:R=!1,selectProductsFromCustomCollection:L=!1,pickerType:F,hideProductVariants:w,fbStatusFetcher:B,onProductDetailClick:_,showProductDetailInfoIcon:H,scrollContainerRef:U}=C,J=s.useContext(j.CollectionIdContext),K=s.useRef(0),M=s.useRef(!1),[N,W]=s.useState(!1),[z,G]=s.useState(""),[Q,X]=s.useState(!1),[Y,Z]=s.useState(b),$=s.useRef(!1);s.useEffect((()=>{const e=setTimeout((()=>{z.length?(X(!0),C.searchInCollectionFetcher(I,J,z).then((e=>{const t=o.cloneDeep(b);t.products=e,Z(t);const r=P.getVariantIdsToFetchAtProductLevel(null!=e?e:{});re(r,null!=e?e:{},!0),q(!1),X(!1)}))):Z(b)}),800);return()=>clearTimeout(e)}),[z]);const ee=()=>{if(!U||!(null==U?void 0:U.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:r}=U.current;e+t>=r-20&&!$.current&&!M.current&&(q(!0),W(!0),M.current=!0,m(J,I,10,K.current).then((e=>{if(Object.keys(e).length||($.current=!0),Object.keys(e).length){const t=Y;t.products=Object.assign(Object.assign({},Y.products),e),Z(t);const r=P.getVariantIdsToFetchAtProductLevel(e);re(r,e),K.current+=1}M.current=!1,W(!1),q(!1)})).catch())};s.useEffect((()=>{var e;return null===(e=null==U?void 0:U.current)||void 0===e||e.addEventListener("scroll",ee),()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.removeEventListener("scroll",ee)}}),[]),s.useEffect((()=>{var e,t,r,c;$.current=!1,K.current=Math.floor((null===(t=Object.keys(null!==(e=b.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const o=P.getVariantIdsToFetchAtProductLevel(null!==(r=b.products)&&void 0!==r?r:{});re(o,null!==(c=b.products)&&void 0!==c?c:{})}),[J]);const te=!!T&&b.isSmartCollection;s.useEffect((()=>{(null==b?void 0:b.products)||ce(10)}),[]);const re=(e,t,r)=>{B||(r?P.markVariantsAsApprovedProductsLevel(t,f,J,Y,Z):P.markVariantsAsApprovedProductsLevel(t,f,J)),e.length>0&&B&&B(I,e).then((e=>{const c=Object.assign({},t);Object.keys(t).forEach((r=>{var o,s;Object.keys(null!==(s=null===(o=null==t?void 0:t[r])||void 0===o?void 0:o.variants)&&void 0!==s?s:{}).forEach((o=>{var s,n;const i=null===(s=null==t?void 0:t[r].variants)||void 0===s?void 0:s[o];i&&"REJECTED"===e[o]?i.fbStatus="REJECTED":i&&"APPROVED"===e[o]&&(i.fbStatus="APPROVED");const l=null===(n=null==c?void 0:c[r])||void 0===n?void 0:n.variants;l&&l[o]&&(l[o]=i)}))})),r?(Z((e=>{const t=Object.assign({},e);return t.products=c,t})),f({type:"productsPaged",data:{collectionId:J,products:c}})):f({type:"productsPaged",data:{collectionId:J,products:c}})})).catch((e=>{r?P.markVariantsAsApprovedProductsLevel(t,f,J,Y,Z):P.markVariantsAsApprovedProductsLevel(t,f,J)}))},ce=e=>{q(!0),X(!0),m(J,I,e,0).then((t=>{if(Object.keys(t).length||($.current=!0),Object.keys(t).length){Z(Object.assign(Object.assign({},Y),{products:t}));const e=P.getVariantIdsToFetchAtProductLevel(t);re(e,t),K.current=1}e||S({type:"selected",data:{id:J,val:Object.assign(Object.assign({},b),{products:t})}}),q(!1),X(!1)})).catch()},oe=(e,t)=>{const r=P.liftTheStateUp(t,b);S({type:e,data:Object.assign(Object.assign({},r),{isRestricted:T})})},se=!!(null==x?void 0:x[J])&&!!Object.keys(null!==(O=null===(k=null==x?void 0:x[J])||void 0===k?void 0:k.products)&&void 0!==O?O:{}).length;return e.jsxs("div",{children:[e.jsxs(g.ProductScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,height:16,onClick:()=>{E("collections")}}),e.jsx(a.BodyCaption,Object.assign({style:{color:n.COLORS.content.secondary}},{children:b.name}))]}),!A&&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:()=>Q&&z.length?e.jsx(d.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(c.default,{})},id:"listInput",height:"24px",type:"text",value:z,onChangeText:e=>{e.length&&e.trim().length?G(e):G("")},placeholder:"Search products in this collection..."})})),e.jsxs("div",{children:[Object.keys((null==Y?void 0:Y.products)||[]).length>0&&!te&&!z.length&&!D&&"-1"!==J&&e.jsxs(g.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:se,isPartiallyChecked:P.isCollectionPartiallyChecked(J,Y,x,w),onValueChange:function(e){e?ce():S({type:"unselected",data:{id:J}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(r.default,{})})),e.jsx(a.TitleRegular,{children:"All Products"})]}),Object.keys((null==Y?void 0:Y.products)||[]).length?Object.keys(Y.products||[]).map((t=>e.jsx(p.ProductGroup,{outOfStockAction:V,collectionId:J,isProductPartiallyChecked:P.isProductPartiallyChecked(J,t,x,Y,w),productId:t,data:Y.products[t],selectedData:x,selectedCollectionsDispatch:S,viewOnly:!L&&!!te,upliftAdditions:oe,hideProductCheckbox:D,hideVariantCheckbox:R,hideProductVariants:w,pickerType:F,onProductDetailClick:_,showProductDetailInfoIcon:H},t))):Q?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(h.EmptyState,{title:"No products to show",subtitle:z.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]}),N&&e.jsx(v.ProductPickerShimmer,{})]})};
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"),c=require("../../assets/icons/search.svg.js"),r=require("lodash"),s=require("react"),n=require("../../constants/Theme.js"),l=require("../checkBox/CheckBox.js"),i=require("../icon-button/IconButton.js"),u=require("../input/Input.js"),d=require("../spinner/Spinner.js"),a=require("../TypographyStyle.js"),h=require("./emptyState.js"),p=require("./product.js"),v=require("./ProductPickerShimmer.js"),j=require("./reducers.js"),g=require("./style.js"),y=require("./type.js"),P=require("./utility.js");exports.ProductsScreen=b=>{var C,f;const{data:k,collectionsDispatch:O,selectedData:x,selectedCollectionsDispatch:S,productFetcher:m,storeId:I,setScreen:E,setSaveDisabled:T,hideInCollectionSearch:q,customCollectionRestriction:A,hideProductCheckbox:D,outOfStockAction:R=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:V=!1,selectProductsFromCustomCollection:L=!1,pickerType:F,hideProductVariants:w,fbStatusFetcher:B,onProductDetailClick:H,showProductDetailInfoIcon:_,scrollContainerRef:U}=b,J=s.useContext(j.CollectionIdContext),K=s.useRef(0),M=s.useRef(!1),[N,W]=s.useState(!1),[z,G]=s.useState(""),[Q,X]=s.useState(!1),[Y,Z]=s.useState(k),$=s.useRef(!1);s.useEffect((()=>{const e=setTimeout((()=>{z.length?(X(!0),b.searchInCollectionFetcher(I,J,z).then((e=>{const t=r.cloneDeep(k);t.products=e,Z(t);const o=P.getVariantIdsToFetchAtProductLevel(null!=e?e:{});ce(o,null!=e?e:{},!0),T(!1),X(!1)}))):Z(k)}),800);return()=>clearTimeout(e)}),[z]);const ee=s.useCallback((()=>{if(!U||!(null==U?void 0:U.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:o}=U.current;console.log({scrollTop:e,clientHeight:t,scrollHeight:o}),e+t>=o-20&&!$.current&&!M.current&&(T(!0),W(!0),M.current=!0,console.log("handleScroll productFetcher",{collectionId:J,storeId:I,o:10,nc:K.current}),m(J,I,10,K.current).then((c=>{var r;if(Object.keys(c).length||($.current=!0),Object.keys(c).length){const s=Y;s.products=Object.assign(Object.assign({},Y.products),c),Z(s);const n=P.getVariantIdsToFetchAtProductLevel(c);ce(n,c),console.log("new scroll position",e+t-100),K.current+=1;const l=U.current.scrollHeight-o+e;null===(r=U.current)||void 0===r||r.scrollTo({top:l-100,behavior:"smooth"})}M.current=!1,W(!1),T(!1)})).catch())}),[J,Y,U,I]),te=s.useRef(r.debounce(ee,200)).current;s.useEffect((()=>{var e;return null===(e=null==U?void 0:U.current)||void 0===e||e.addEventListener("scroll",te),()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.removeEventListener("scroll",te)}}),[U,te]),s.useEffect((()=>{var e,t,o,c;console.log("useEffect productScreen, collectionId",{collectionId:J}),$.current=!1,K.current=Math.floor((null===(t=Object.keys(null!==(e=k.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const r=P.getVariantIdsToFetchAtProductLevel(null!==(o=k.products)&&void 0!==o?o:{});ce(r,null!==(c=k.products)&&void 0!==c?c:{})}),[J]);const oe=!!A&&k.isSmartCollection;s.useEffect((()=>{(null==k?void 0:k.products)||re(10)}),[]);const ce=(e,t,o)=>{B||(o?P.markVariantsAsApprovedProductsLevel(t,O,J,Y,Z):P.markVariantsAsApprovedProductsLevel(t,O,J)),e.length>0&&B&&B(I,e).then((e=>{const c=Object.assign({},t);Object.keys(t).forEach((o=>{var r,s;Object.keys(null!==(s=null===(r=null==t?void 0:t[o])||void 0===r?void 0:r.variants)&&void 0!==s?s:{}).forEach((r=>{var s,n;const l=null===(s=null==t?void 0:t[o].variants)||void 0===s?void 0:s[r];l&&"REJECTED"===e[r]?l.fbStatus="REJECTED":l&&"APPROVED"===e[r]&&(l.fbStatus="APPROVED");const i=null===(n=null==c?void 0:c[o])||void 0===n?void 0:n.variants;i&&i[r]&&(i[r]=l)}))})),o?(Z((e=>{const t=Object.assign({},e);return t.products=c,t})),O({type:"productsPaged",data:{collectionId:J,products:c}})):O({type:"productsPaged",data:{collectionId:J,products:c}})})).catch((e=>{o?P.markVariantsAsApprovedProductsLevel(t,O,J,Y,Z):P.markVariantsAsApprovedProductsLevel(t,O,J)}))},re=e=>{T(!0),X(!0),m(J,I,e,0).then((t=>{if(Object.keys(t).length||($.current=!0),Object.keys(t).length){Z(Object.assign(Object.assign({},Y),{products:t}));const e=P.getVariantIdsToFetchAtProductLevel(t);ce(e,t),K.current=1}e||S({type:"selected",data:{id:J,val:Object.assign(Object.assign({},k),{products:t})}}),T(!1),X(!1)})).catch()},se=(e,t)=>{const o=P.liftTheStateUp(t,k);S({type:e,data:Object.assign(Object.assign({},o),{isRestricted:A})})},ne=!!(null==x?void 0:x[J])&&!!Object.keys(null!==(f=null===(C=null==x?void 0:x[J])||void 0===C?void 0:C.products)&&void 0!==f?f:{}).length;return e.jsxs("div",{children:[e.jsxs(g.ProductScreenHeader,{children:[e.jsx(i.IconButton,{Icon:t.default,height:16,onClick:()=>{E("collections")}}),e.jsx(a.BodyCaption,Object.assign({style:{color:n.COLORS.content.secondary}},{children:k.name}))]}),!q&&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:()=>Q&&z.length?e.jsx(d.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(c.default,{})},id:"listInput",height:"24px",type:"text",value:z,onChangeText:e=>{e.length&&e.trim().length?G(e):G("")},placeholder:"Search products in this collection..."})})),e.jsxs("div",{children:[Object.keys((null==Y?void 0:Y.products)||[]).length>0&&!oe&&!z.length&&!D&&"-1"!==J&&e.jsxs(g.ProductScreenCollectionCardStyle,{children:[e.jsx(l.CheckBox,{isChecked:ne,isPartiallyChecked:P.isCollectionPartiallyChecked(J,Y,x,w),onValueChange:function(e){e?re():S({type:"unselected",data:{id:J}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(o.default,{})})),e.jsx(a.TitleRegular,{children:"All Products"})]}),Object.keys((null==Y?void 0:Y.products)||[]).length?Object.keys(Y.products||[]).map((t=>e.jsx(p.ProductGroup,{outOfStockAction:R,collectionId:J,isProductPartiallyChecked:P.isProductPartiallyChecked(J,t,x,Y,w),productId:t,data:Y.products[t],selectedData:x,selectedCollectionsDispatch:S,viewOnly:!L&&!!oe,upliftAdditions:se,hideProductCheckbox:D,hideVariantCheckbox:V,hideProductVariants:w,pickerType:F,onProductDetailClick:H,showProductDetailInfoIcon:_},t))):Q?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(h.EmptyState,{title:"No products to show",subtitle:z.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]}),N&&e.jsx(v.ProductPickerShimmer,{limit:1})]})};
@@ -1 +1 @@
1
- import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o}from"react/jsx-runtime";import{useState as t,useRef as n,useEffect as r}from"react";import{COLORS as i}from"../../constants/Theme.js";import l from"../../assets/icons/chevronDown.svg.js";import{Input as s}from"../input/Input.js";import{InputStyleContext as a}from"../input/context/InputStyleProvider.js";import{DropdownPopover as d}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as p}from"./OpenedDropdown/utils/iterationOnOptions.js";function c(){}const u=u=>{var h,m,f,{placeHolder:g,size:v,onSelect:b,defaultOptions:j,disabled:w,noErrorHint:H,placeHolderHeight:O,showPlaceholderWhenSelected:x=!1,inputStyle:y={}}=u,S=e(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle"]);const[D,E]=t(!1),I=null!=v?v:"default",P=n(),[W,z]=t(null!=j?j:[]);r((()=>{var e;const o=[];null===(e=null==S?void 0:S.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&o.push(e)})),z([...o])}),[S.options]),r((()=>{j&&z([...j])}),[j]);const C=p(W);return o(a.Provider,Object.assign({value:{InputWrapper:Object.assign({height:O||("small"===I?32:48),width:null!==(m=null!==(h=S.buttonWidth)&&void 0!==h?h:S.width)&&void 0!==m?m:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},y),input:{minHeight:"100%"}}},{children:o(d,Object.assign({ref:P,onSelect:function(e){Array.isArray(e)?z([...e]):z([e]),null==b||b(e)},disabled:w,onDropdownVisbilityChange:e=>E(e)},S,{children:o(s,{version:S.version,noErrorHint:H,state:w?"disabled":"none",value:x?g:null!=C?C:"",errorMessage:S.error,variant:I,placeholder:null!=g?g:"Select an option",width:null!==(f=S.width)&&void 0!==f?f:"100%",onChangeText:c,rightIcon:{icon:()=>o(l,{style:{transform:D?"rotate(180deg)":"rotate(0deg)"},onClick:c,width:"small"===I?20:24,height:"small"===I?20:24,color:i.content.primary})},truncateText:!0})}))}))};u.displayName="Dropdown";export{u as Dropdown};
1
+ import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o}from"react/jsx-runtime";import{useState as t,useRef as n,useEffect as r}from"react";import{COLORS as i}from"../../constants/Theme.js";import l from"../../assets/icons/chevronDown.svg.js";import{Input as s}from"../input/Input.js";import{InputStyleContext as a}from"../input/context/InputStyleProvider.js";import{DropdownPopover as d}from"./DropdownPopover/index.js";function p(){}const c=c=>{var u,h,m,{placeHolder:g,size:v,onSelect:f,defaultOptions:b,disabled:j,noErrorHint:w,placeHolderHeight:H,showPlaceholderWhenSelected:x=!1,inputStyle:y={}}=c,S=e(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle"]);const[O,E]=t(!1),I=null!=v?v:"default",P=n(),[D,W]=t(null!=b?b:[]);r((()=>{var e;const o=[];null===(e=null==S?void 0:S.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&o.push(e)})),W([...o])}),[S.options]),r((()=>{b&&W([...b])}),[b]);const z=D.length?D.map((e=>e.label)).join(", "):void 0;return o(a.Provider,Object.assign({value:{InputWrapper:Object.assign({height:H||("small"===I?32:48),width:null!==(h=null!==(u=S.buttonWidth)&&void 0!==u?u:S.width)&&void 0!==h?h:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},y),input:{minHeight:"100%"}}},{children:o(d,Object.assign({ref:P,onSelect:function(e){Array.isArray(e)?W([...e]):W([e]),null==f||f(e)},disabled:j,onDropdownVisbilityChange:e=>E(e)},S,{children:o(s,{version:S.version,noErrorHint:w,state:j?"disabled":"none",value:x?g:null!=z?z:"",errorMessage:S.error,variant:I,placeholder:null!=g?g:"Select an option",width:null!==(m=S.width)&&void 0!==m?m:"100%",onChangeText:p,rightIcon:{icon:()=>o(l,{style:{transform:O?"rotate(180deg)":"rotate(0deg)"},onClick:p,width:"small"===I?20:24,height:"small"===I?20:24,color:i.content.primary})},truncateText:!0})}))}))};c.displayName="Dropdown";export{c as Dropdown};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as r}from"react";import{ZeroState as l}from"../../../zeroState/ZeroState.js";import{useOutside as i}from"../../../../hooks/useOutside.js";import{useDropdown as s}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as p}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as m,MenuListContainer as h}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as S}from"./searchbox/SearchZeroState.js";const g=304,w=290,b=b=>{let{options:v,isSearchable:j,isMultiSelect:y,width:x,allowFreeForm:C,height:O,onClose:M,onSelect:D,onSearch:k,version:L,skipSorting:A,headerRef:F,hideSelectAll:I,primaryButtonText:B,onInfiniteScroll:H,onMultiSelectClear:T,onDropdownItemClick:R}=b;const{dropdownOptions:Z,search:q,searchedString:z,searchedOptions:K,onApplyHandler:N,selectAllHandler:P,onMultiSelectClear:W,onFreeFormSelect:E,onMultiSelectApply:G,latestDropdownOptionsRef:J,getSelectedOptions:Q}=s(L,v,D,A,y,k),[U,V]=o(null!=x?x:w),[X,Y]=o(null),$=n(null);i($,(()=>{if(Y(null),y&&"2.0"===L){const e=Q(J.current);null==M||M(e)}else null==M||M(Z)}),[F]);const _=null!=O?O:g,ee="number"==typeof _?j&&y?_-96:j&&!y||!j&&y?_-48:_:_;r((()=>{const e=null!=x?x:w;if(null===X)V(e);else if("number"==typeof e)V(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));V(t)}}),[X]);const te=[],oe=(z&&k?K:Z).map((e=>{var t,o;if(z&&!k){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(z.toLowerCase()))&&(te.push(!z||e.label===z),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(z.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(z.toLowerCase()))?(te.push(!z||e.label===z),e):null}return e})).filter((e=>null!==e)),ne=!!j&&z&&0===oe.length;return e(m,Object.assign({version:L,ref:$,style:{width:U}},{children:[e("div",Object.assign({style:{width:X?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!j&&t(f,{onSearch:q,version:L}),oe.length||z?e(h,Object.assign({minHeight:_,maxHeight:ee},{children:[!!y&&!ne&&!I&&t(u,{version:L,options:z&&k?K:Z,onSelect:P}),!C&&ne&&t(S,{height:ee,searchedString:z}),C&&(ne||!!te.length&&te.every((e=>!1===e)))&&t(a,{version:L,isMultiSelect:y,onSelect:E,searchedString:z}),t(p,{onInfiniteScroll:H,onDropdownItemClick:R,version:L,onSelect:N,showDescription:function(e,t){Y(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:oe})]})):t("div",Object.assign({style:{height:_,display:"flex"}},{children:t(l,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!oe.length&&!z)&&"2.0"!==L&&t(d,{onClear:()=>{W(),null==T||T()},onApply:G,list:z&&k?K:Z,buttonText:B})]})),!!X&&t(c,{title:X.title,description:X.description,version:L})]}))};export{b as OpenedDropdown};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as r,useEffect as i}from"react";import{ZeroState as n}from"../../../zeroState/ZeroState.js";import{useOutside as l}from"../../../../hooks/useOutside.js";import{useDropdown as s}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as p}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as S}from"./searchbox/SearchZeroState.js";const g=304,b=290,v=v=>{let{options:j,isSearchable:w,isMultiSelect:y,width:x,allowFreeForm:O,height:C,onClose:M,onSelect:D,onSearch:L,version:A,skipSorting:F,headerRef:k,hideSelectAll:B,primaryButtonText:H}=v;const{dropdownOptions:T,search:R,searchedString:Z,searchedOptions:q,onApplyHandler:z,selectAllHandler:I,onMultiSelectClear:K,onFreeFormSelect:N,onMultiSelectApply:P,latestDropdownOptionsRef:W,getSelectedOptions:E}=s(A,j,D,F,y,L),[G,J]=o(null!=x?x:b),[Q,U]=o(null),V=r(null);l(V,(()=>{if(U(null),y&&"2.0"===A){const e=E(W.current);null==M||M(e)}else null==M||M(T)}),[k]);const X=null!=C?C:g,Y="number"==typeof X?w&&y?X-96:w&&!y||!w&&y?X-48:X:X;i((()=>{const e=null!=x?x:b;if(null===Q)J(e);else if("number"==typeof e)J(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));J(t)}}),[Q]);const $=[],_=(Z&&L?q:T).map((e=>{var t,o;if(Z&&!L){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(Z.toLowerCase()))&&($.push(!Z||e.label===Z),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(Z.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(Z.toLowerCase()))?($.push(!Z||e.label===Z),e):null}return e})).filter((e=>null!==e)),ee=!!w&&Z&&0===_.length;return e(h,Object.assign({version:A,ref:V,style:{width:G}},{children:[e("div",Object.assign({style:{width:Q?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!w&&t(f,{onSearch:R,version:A}),_.length||Z?e(m,Object.assign({minHeight:X,maxHeight:Y},{children:[!!y&&!ee&&!B&&t(u,{version:A,options:Z&&L?q:T,onSelect:I}),!O&&ee&&t(S,{height:Y,searchedString:Z}),O&&(ee||!!$.length&&$.every((e=>!1===e)))&&t(a,{version:A,isMultiSelect:y,onSelect:N,searchedString:Z}),t(p,{version:A,onSelect:z,showDescription:function(e,t){U(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:_})]})):t("div",Object.assign({style:{height:X,display:"flex"}},{children:t(n,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!_.length&&!Z)&&"2.0"!==A&&t(d,{onClear:K,onApply:P,list:Z&&L?q:T,buttonText:H})]})),!!Q&&t(c,{title:Q.title,description:Q.description,version:A})]}))};export{v as OpenedDropdown};
@@ -1,13 +1,10 @@
1
1
  import React from 'react';
2
2
  import { MultiSelectOption, SingleOption } from '../../../type';
3
- interface MenuItemProps {
3
+ export declare const MenuItem: React.FC<{
4
4
  option: SingleOption | MultiSelectOption;
5
5
  isMultiSelect?: boolean;
6
6
  showDescription: (title?: string, description?: string) => void;
7
7
  onSelect: (option: SingleOption) => void;
8
- onDropdownItemClick?: (option: SingleOption) => void;
9
8
  last?: boolean;
10
9
  version?: '1.0' | '2.0';
11
- }
12
- export declare const MenuItem: React.FC<MenuItemProps>;
13
- export {};
10
+ }>;
@@ -2,4 +2,4 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import i from"st
2
2
  padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
3
3
  cursor: pointer;
4
4
  margin-top: ${e=>"2.0"===e.version?"2px":"0"};
5
- `,d=i=>{let{option:s,isMultiSelect:d,showDescription:m,onSelect:p,last:g,version:u,onDropdownItemClick:b}=i;var f;function h(e){s.disabled||p(Object.assign(Object.assign({},s),{selected:e}))}return e(a,{version:u,style:g?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),h(!s.selected),null==b||b(s)},onMouseOver:function(){s.description?m(s.label,s.description):m()},listItem:{value:s.value,label:s.label},subText:s.subText,leadingIcon:d?t("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e(o,{size:"2.0"===u?"SMALL":"DEFAULT",isDisabled:null!==(f=s.disabled)&&void 0!==f&&f,isChecked:!!s.selected,onValueChange:h}),e("div",Object.assign({style:{marginRight:"-4px"}},{children:s.leadingIcon}))]})):s.leadingIcon?e(n,{children:s.leadingIcon}):e(n,{}),customComponent:s.customComponent,trailingIcon:s.isFreeForm?e(c,{children:e(r,Object.assign({style:{color:l.content.secondary}},{children:"Freeform"}))}):s.trailingIcon?e(n,{children:s.trailingIcon}):e(n,{}),variant:s.disabled?"inactive":s.selected?"selected":"default"})};export{d as MenuItem};
5
+ `,d=i=>{let{option:s,isMultiSelect:d,showDescription:m,onSelect:p,last:g,version:u}=i;var b;function f(e){s.disabled||p(Object.assign(Object.assign({},s),{selected:e}))}return e(a,{version:u,style:g?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),f(!s.selected)},onMouseOver:function(){s.description?m(s.label,s.description):m()},listItem:{value:s.value,label:s.label},subText:s.subText,leadingIcon:d?t("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e(o,{size:"2.0"===u?"SMALL":"DEFAULT",isDisabled:null!==(b=s.disabled)&&void 0!==b&&b,isChecked:!!s.selected,onValueChange:f}),e("div",Object.assign({style:{marginRight:"-4px"}},{children:s.leadingIcon}))]})):s.leadingIcon?e(n,{children:s.leadingIcon}):e(n,{}),customComponent:s.customComponent,trailingIcon:s.isFreeForm?e(c,{children:e(r,Object.assign({style:{color:l.content.secondary}},{children:"Freeform"}))}):s.trailingIcon?e(n,{children:s.trailingIcon}):e(n,{}),variant:s.disabled?"inactive":s.selected?"selected":"default"})};export{d as MenuItem};
@@ -1,13 +1,9 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption, SingleOption } from '../../../type';
3
- interface MenuListProps {
3
+ export declare const MenuList: React.FC<{
4
4
  options: DropdownOption[];
5
5
  isMultiSelect?: boolean;
6
6
  showDescription: (title?: string, description?: string) => void;
7
7
  onSelect: (optionSelect: SingleOption) => void;
8
8
  version?: '1.0' | '2.0';
9
- onInfiniteScroll?: () => void;
10
- onDropdownItemClick?: (option: DropdownOption) => void;
11
- }
12
- export declare const MenuList: React.FC<MenuListProps>;
13
- export {};
9
+ }>;
@@ -1 +1 @@
1
- import{jsx as n,Fragment as e,jsxs as t}from"react/jsx-runtime";import{useRef as r,useCallback as o,useEffect as i}from"react";import{MenuItem as s}from"./MenuItem.js";import{StyledGroupedLabel as c}from"./MenuList.styled.js";const l=l=>{let{options:p,isMultiSelect:u,showDescription:m,onSelect:a,version:d,onInfiniteScroll:g,onDropdownItemClick:h}=l;const I=r(null),v=r(null),f=o((()=>{I.current&&I.current.disconnect(),I.current=new IntersectionObserver((n=>{n[0].isIntersecting&&(null==g||g())})),v.current&&I.current.observe(v.current)}),[g]);return i((()=>(f(),()=>{I.current&&I.current.disconnect()})),[f,p]),n(e,{children:p.map(((r,o)=>{const i=o===p.length-1;if(r.options){const i=r;return t("div",Object.assign({style:{marginTop:"2.0"===d?2:0}},{children:[t(c,Object.assign({version:d},{children:[i.leadingIcon?n("span",Object.assign({style:{marginRight:8}},{children:i.leadingIcon})):n(e,{}),i.label]})),i.options.map(((e,t)=>n(s,{version:d,last:t===i.options.length-1,onSelect:a,showDescription:m,onDropdownItemClick:h,isMultiSelect:u,option:e},`${o}-${t}`)))]}),o)}return t("div",{children:[n(s,{version:d,last:i,onSelect:a,showDescription:m,onDropdownItemClick:h,isMultiSelect:u,option:r},o),i?n("span",{ref:v}):null]},o)}))})};export{l as MenuList};
1
+ import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import{MenuItem as n}from"./MenuItem.js";import{StyledGroupedLabel as o}from"./MenuList.styled.js";const s=s=>{let{options:r,isMultiSelect:l,showDescription:c,onSelect:p,version:a}=s;return e(t,{children:r.map(((s,m)=>{const g=m===r.length-1;if(s.options){const r=s;return i("div",Object.assign({style:{marginTop:"2.0"===a?2:0}},{children:[i(o,Object.assign({version:a},{children:[r.leadingIcon?e("span",Object.assign({style:{marginRight:8}},{children:r.leadingIcon})):e(t,{}),r.label]})),r.options.map(((t,i)=>e(n,{version:a,last:i===r.options.length-1,onSelect:p,showDescription:c,isMultiSelect:l,option:t},`${m}-${i}`)))]}),m)}return e(n,{version:a,last:g,onSelect:p,showDescription:c,isMultiSelect:l,option:s},m)}))})};export{s as MenuList};
@@ -12,7 +12,6 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
12
12
  leadingIcon?: JSX.Element | undefined;
13
13
  customComponent?: JSX.Element | undefined;
14
14
  searchKey?: string | undefined;
15
- selectedLabel?: string | undefined;
16
15
  } | {
17
16
  label?: string | undefined;
18
17
  value?: string | undefined;
@@ -25,8 +24,6 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
25
24
  leadingIcon?: JSX.Element | undefined;
26
25
  customComponent?: JSX.Element | undefined;
27
26
  searchKey?: string | undefined;
28
- selectedLabel?: string | undefined;
29
27
  options: SingleOption[];
30
28
  })[];
31
29
  export declare function iterateOnOptionsRaw(options: DropdownOption[], cb: (option: SingleOption) => void): void;
32
- export declare function getSelectedOptionsAsText(selectedOption: DropdownOption[]): string | undefined;
@@ -1 +1 @@
1
- function n(n,t,s){return n.map((n=>{if(n.options){const o=n.options.map((n=>!s||s(n)?Object.assign(Object.assign({},n),t):Object.assign({},n)));return Object.assign(Object.assign({},n),{options:[...o]})}return!s||s(n)?Object.assign(Object.assign({},n),t):Object.assign({},n)}))}function t(n,t){n.forEach((n=>{n.options?n.options.forEach(t):t(n)}))}function s(n){if(console.log(n),n&&n.length)return n.map((n=>{var t;const s=n;return null!==(t=s.selectedLabel)&&void 0!==t?t:s.label})).join(", ")}export{s as getSelectedOptionsAsText,n as iterateOnOptions,t as iterateOnOptionsRaw};
1
+ function s(s,n,t){return s.map((s=>{if(s.options){const i=s.options.map((s=>!t||t(s)?Object.assign(Object.assign({},s),n):Object.assign({},s)));return Object.assign(Object.assign({},s),{options:[...i]})}return!t||t(s)?Object.assign(Object.assign({},s),n):Object.assign({},s)}))}function n(s,n){s.forEach((s=>{s.options?s.options.forEach(n):n(s)}))}export{s as iterateOnOptions,n as iterateOnOptionsRaw};
@@ -19,7 +19,6 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
19
19
  leadingIcon?: JSX.Element | undefined;
20
20
  customComponent?: JSX.Element | undefined;
21
21
  searchKey?: string | undefined;
22
- selectedLabel?: string | undefined;
23
22
  } | {
24
23
  label?: string | undefined;
25
24
  value?: string | undefined;
@@ -32,7 +31,6 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
32
31
  leadingIcon?: JSX.Element | undefined;
33
32
  customComponent?: JSX.Element | undefined;
34
33
  searchKey?: string | undefined;
35
- selectedLabel?: string | undefined;
36
34
  options: SingleOption[];
37
35
  })[] | undefined;
38
36
  selectAllHandler: (newState: SelectAllCheckboxState) => void;
@@ -19,9 +19,6 @@ export interface OpenDropdownProps {
19
19
  headerRef?: any;
20
20
  hideSelectAll?: boolean;
21
21
  primaryButtonText?: string;
22
- onInfiniteScroll?: () => void;
23
- onMultiSelectClear?: () => void;
24
- onDropdownItemClick?: (option: DropdownOption) => void;
25
22
  }
26
23
  export type GroupedOption = {
27
24
  label?: string;
@@ -40,7 +37,6 @@ export type SingleOption = {
40
37
  leadingIcon?: JSX.Element;
41
38
  customComponent?: JSX.Element;
42
39
  searchKey?: string;
43
- selectedLabel?: string;
44
40
  };
45
41
  export type MultiSelectOption = SingleOption;
46
42
  export type DropdownOption = MultiSelectOption | SingleOption | GroupedOption;
@@ -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{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as f}from"./rearrangeScreen.js";import{collectionsReducer as b,searchReducer as y,selectedColectionsReducer as S,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as k}from"./searchScreen.js";import{SelectedScreen as P}from"./selectedScreen.js";import{ContainerStyle as j,ScrollContainerStyle as x}from"./style.js";import{OUT_OF_STOCK_ACTION as I}from"./type.js";var F;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(F||(F={}));const O=O=>{const{storeId:T,selectedItems:D,onClose:R,visible:w,zIndex:E,exactLimit:A,limit:V,hideCollectionCheckbox:$,hideProductCheckbox:B,outOfStockAction:L=I.BLUR,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,hideSelectionCount:W,title:G,width:H,renderWithoutModal:Y,onClickSave:K,pickerType:N,hideProductVariants:U=!1,startupScreen:q=F.Collections,rearrangeEnabled:J,selectSingleItem:Q=!1,showProductDetails:X,containerStyle:Z}=O,[_,ee]=r(b,{}),[te,oe]=s([F.Collections,F.RearrangeProducts].includes(q)?q:F.Collections),[ce,re]=s("grid"),[se,ie]=s(""),[le,ne]=s(""),[de,ae]=s(0),[ue,he]=s(!1),[pe,me]=s(0),[Ce,ge]=s(""),[fe,be]=s(!1),[ye,Se]=s(!1),[ve,ke]=r(y,{collections:{},products:{}}),[Pe,je]=r(S,Object.keys(D).length>0?D:{}),xe=i(null),[Ie,Fe]=s(!1),[Oe,Te]=s();l((()=>{he(!0),Se(!0),O.collectionFetcher(de,T).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),he(!1),ae((e=>e+1)),Se(!1)})).catch()}),[]),l((()=>{let e=0;U?Object.keys(Pe||[]).forEach((t=>{var o;Object.keys((null===(o=Pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&Pe[-1]&&(null===(c=Pe[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(Pe||[]).forEach((t=>{var o;Object.keys((null===(o=Pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=Pe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),me(e)}),[_,Pe,U]),l((()=>{le&&(he(!0),O.productFetcher(le,T).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:le,products:e}}),he(!1)})).catch())}),[le]),l((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(Ce.length||"collections"!==te)&&(Ce.length?(be(!0),O.searchFetcher(T,Ce).then((e=>{"collections"in e&&"products"in e?(ke({type:"set",data:e}),ee({type:"searched",data:e.collections})):(ke({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),he(!1),be(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[Ce]),l((()=>{K&&(O.onAdd(Pe,pe),De())}),[K]),l((()=>{Q&&Object.keys(Pe||{}).length&&pe&&(O.onAdd(Pe,pe),De())}),[Q,Pe,pe]);const De=()=>{je({type:"reset",data:{}})},Re=e(j,Object.assign({style:null!=Z?Z:{}},{children:[O.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:O.postHeader})),!O.hideGlobalSearch&&t(o,{children:("collections"===te||"searchProducts"===te)&&t("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(a,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>fe?t(h,{size:"small",color:n.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:Ce,onChangeText:e=>{e.length&&e.trim().length?ge(e):ge("")}})}))}),e(x,Object.assign({ref:xe,screenName:te},{children:["collections"===te&&t(m,{customCollectionRestriction:O.customCollectionRestriction,dataLoading:ye,collections:_,selectedCollectionsDispatch:je,setCollectionId:ie,setSelectedCollectionId:ne,setScreen:oe,selectedCollections:Pe,collectionFetcher:O.collectionFetcher,storeId:T,collectionsDispatch:ee,setSaveDisabled:he,pagingControls:{curPage:de,setCurPage:ae},hideCollectionCheckbox:$,renderWithoutModal:Y,pickerType:N,scrollContainerRef:xe}),"products"===te&&se&&t(v.Provider,Object.assign({value:se},{children:t(g,{hideInCollectionSearch:O.hideInCollectionSearch,customCollectionRestriction:O.customCollectionRestriction,productFetcher:O.productFetcher,setScreen:oe,storeId:T,data:_[se],collectionsDispatch:ee,selectedCollectionsDispatch:je,selectedData:Pe,setSaveDisabled:he,searchInCollectionFetcher:O.searchInCollectionFetcher,hideProductCheckbox:B,outOfStockAction:L,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,renderWithoutModal:Y,pickerType:N,hideProductVariants:U,fbStatusFetcher:O.fbStatusFetcher,onProductDetailClick:e=>{Fe(!0),Te(e)},showProductDetailInfoIcon:X,scrollContainerRef:xe})})),"view"===te&&t(P,{selectedCollections:Pe||{},selectedCollectionsDispatch:je,setScreen:oe,collections:_,hideProductVariants:U,outOfStockAction:L,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"rearrange"===te&&t(f,{selectedCollections:Pe||{},selectedCollectionsDispatch:je,setScreen:oe,outOfStockAction:L,rearrangeViewType:"grid"===ce?"list":"grid",scrollContainerRef:xe,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"searchProducts"===te&&t(k,{customCollectionRestriction:O.customCollectionRestriction,selectedCollections:Pe||{},searchedCollections:ve||{},searchedCollectionsDispatch:ke,selectedCollectionsDispatch:je,setScreen:oe,collections:_,onBackPress:()=>{ge(""),ke({type:"set",data:{collections:{},products:{}}})},pickerType:N,hideProductCheckbox:B,hideProductVariants:U,hideVariantCheckbox:M,storeId:T,fbStatusFetcher:O.fbStatusFetcher,setCollectionId:ie,setSelectedCollectionId:ne,renderWithoutModal:Y,hideCollectionCheckbox:$,outOfStockAction:L})]}))]}));return t(o,{children:Y?Re:e(u,Object.assign({zIndex:E,open:w,onClose:()=>{null==R||R(),De()},headingTitle:G||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:H||"600px"},headerRightCustomElement:t(o,{}),footerContainerStyle:O.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:{buttonText:ue?"Loading...":te===F.RearrangeProducts?"Done":"Add",disabled:ue||pe<1||A&&pe<A||!A&&V&&pe>V||!1,onClick:()=>{O.onAdd(Pe,pe),De()}},wrapperStyle:O.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?t(o,{}):A&&pe>A?t(p,{tagText:`You can only select ${A} products`,type:"negative"}):V&&pe>V?t(p,{tagText:`You can only select ${V} products`,type:"negative"}):t(d,pe>0?{onClick:()=>{oe(J?F.RearrangeProducts:F.SelectedProducts)},buttonText:A?`${pe}/${A} products selected`:`${pe} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}:{disabled:!0,buttonText:A?`${pe}/${A} products selected`:`${pe} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:Ie},{children:[Re,Ie&&Oe?t(C,{productData:Oe,outOfStockAction:L,onClose:()=>{Fe(!1)}}):t(o,{})]}))})};export{O as ProductPickerModal,F as ScreenName};
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 l,useEffect as i}from"react";import{COLORS as n}from"../../constants/Theme.js";import{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as f}from"./rearrangeScreen.js";import{collectionsReducer as b,searchReducer as y,selectedColectionsReducer as S,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as k}from"./searchScreen.js";import{SelectedScreen as P}from"./selectedScreen.js";import{ContainerStyle as x,ScrollContainerStyle as j}from"./style.js";import{OUT_OF_STOCK_ACTION as I}from"./type.js";var F;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(F||(F={}));const O=O=>{const{storeId:T,selectedItems:D,onClose:R,visible:w,zIndex:E,exactLimit:A,limit:V,hideCollectionCheckbox:$,hideProductCheckbox:B,outOfStockAction:L=I.BLUR,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,hideSelectionCount:W,title:G,width:H,renderWithoutModal:Y,onClickSave:K,pickerType:N,hideProductVariants:U=!1,startupScreen:q=F.Collections,rearrangeEnabled:J,selectSingleItem:Q=!1,showProductDetails:X,containerStyle:Z}=O,[_,ee]=r(b,{}),[te,oe]=s([F.Collections,F.RearrangeProducts].includes(q)?q:F.Collections),[ce,re]=s("grid"),[se,le]=s(""),[ie,ne]=s(""),[de,ae]=s(0),[ue,he]=s(!1),[pe,me]=s(0),[Ce,ge]=s(""),[fe,be]=s(!1),[ye,Se]=s(!1),[ve,ke]=r(y,{collections:{},products:{}}),[Pe,xe]=r(S,Object.keys(D).length>0?D:{}),je=l(null),[Ie,Fe]=s(!1),[Oe,Te]=s();i((()=>{he(!0),Se(!0),O.collectionFetcher(de,T).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),he(!1),ae((e=>e+1)),Se(!1)})).catch()}),[]),i((()=>{let e=0;U?Object.keys(Pe||[]).forEach((t=>{var o;Object.keys((null===(o=Pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&Pe[-1]&&(null===(c=Pe[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(Pe||[]).forEach((t=>{var o;Object.keys((null===(o=Pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=Pe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),me(e)}),[_,Pe,U]),i((()=>{ie&&(he(!0),console.log("useEffect selectedCollectionId modal.tsx:277",ie),O.productFetcher(ie,T).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),he(!1)})).catch())}),[ie]),i((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(Ce.length||"collections"!==te)&&(Ce.length?(be(!0),O.searchFetcher(T,Ce).then((e=>{"collections"in e&&"products"in e?(ke({type:"set",data:e}),ee({type:"searched",data:e.collections})):(ke({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),he(!1),be(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[Ce]),i((()=>{K&&(O.onAdd(Pe,pe),De())}),[K]),i((()=>{Q&&Object.keys(Pe||{}).length&&pe&&(O.onAdd(Pe,pe),De())}),[Q,Pe,pe]);const De=()=>{xe({type:"reset",data:{}})},Re=e(x,Object.assign({style:null!=Z?Z:{}},{children:[O.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:O.postHeader})),!O.hideGlobalSearch&&t(o,{children:("collections"===te||"searchProducts"===te)&&t("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(a,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>fe?t(h,{size:"small",color:n.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:Ce,onChangeText:e=>{e.length&&e.trim().length?ge(e):ge("")}})}))}),e(j,Object.assign({ref:je,screenName:te},{children:["collections"===te&&t(m,{customCollectionRestriction:O.customCollectionRestriction,dataLoading:ye,collections:_,selectedCollectionsDispatch:xe,setCollectionId:le,setSelectedCollectionId:ne,setScreen:oe,selectedCollections:Pe,collectionFetcher:O.collectionFetcher,storeId:T,collectionsDispatch:ee,setSaveDisabled:he,pagingControls:{curPage:de,setCurPage:ae},hideCollectionCheckbox:$,renderWithoutModal:Y,pickerType:N,scrollContainerRef:je}),"products"===te&&se&&t(v.Provider,Object.assign({value:se},{children:t(g,{hideInCollectionSearch:O.hideInCollectionSearch,customCollectionRestriction:O.customCollectionRestriction,productFetcher:O.productFetcher,setScreen:oe,storeId:T,data:_[se],collectionsDispatch:ee,selectedCollectionsDispatch:xe,selectedData:Pe,setSaveDisabled:he,searchInCollectionFetcher:O.searchInCollectionFetcher,hideProductCheckbox:B,outOfStockAction:L,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,renderWithoutModal:Y,pickerType:N,hideProductVariants:U,fbStatusFetcher:O.fbStatusFetcher,onProductDetailClick:e=>{Fe(!0),Te(e)},showProductDetailInfoIcon:X,scrollContainerRef:je})})),"view"===te&&t(P,{selectedCollections:Pe||{},selectedCollectionsDispatch:xe,setScreen:oe,collections:_,hideProductVariants:U,outOfStockAction:L,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"rearrange"===te&&t(f,{selectedCollections:Pe||{},selectedCollectionsDispatch:xe,setScreen:oe,outOfStockAction:L,rearrangeViewType:"grid"===ce?"list":"grid",scrollContainerRef:je,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"searchProducts"===te&&t(k,{customCollectionRestriction:O.customCollectionRestriction,selectedCollections:Pe||{},searchedCollections:ve||{},searchedCollectionsDispatch:ke,selectedCollectionsDispatch:xe,setScreen:oe,collections:_,onBackPress:()=>{ge(""),ke({type:"set",data:{collections:{},products:{}}})},pickerType:N,hideProductCheckbox:B,hideProductVariants:U,hideVariantCheckbox:M,storeId:T,fbStatusFetcher:O.fbStatusFetcher,setCollectionId:le,setSelectedCollectionId:ne,renderWithoutModal:Y,hideCollectionCheckbox:$,outOfStockAction:L})]}))]}));return t(o,{children:Y?Re:e(u,Object.assign({zIndex:E,open:w,onClose:()=>{null==R||R(),De()},headingTitle:G||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:H||"600px"},headerRightCustomElement:t(o,{}),footerContainerStyle:O.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:{buttonText:ue?"Loading...":te===F.RearrangeProducts?"Done":"Add",disabled:ue||pe<1||A&&pe<A||!A&&V&&pe>V||!1,onClick:()=>{O.onAdd(Pe,pe),De()}},wrapperStyle:O.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?t(o,{}):A&&pe>A?t(p,{tagText:`You can only select ${A} products`,type:"negative"}):V&&pe>V?t(p,{tagText:`You can only select ${V} products`,type:"negative"}):t(d,pe>0?{onClick:()=>{oe(J?F.RearrangeProducts:F.SelectedProducts)},buttonText:A?`${pe}/${A} products selected`:`${pe} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}:{disabled:!0,buttonText:A?`${pe}/${A} products selected`:`${pe} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:Ie},{children:[Re,Ie&&Oe?t(C,{productData:Oe,outOfStockAction:L,onClose:()=>{Fe(!1)}}):t(o,{})]}))})};export{O as ProductPickerModal,F as ScreenName};
@@ -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 r from"../../assets/icons/search.svg.js";import{cloneDeep as n}from"lodash";import{useContext as i,useRef as s,useState as l,useEffect as d}from"react";import{COLORS as u}from"../../constants/Theme.js";import{CheckBox as a}from"../checkBox/CheckBox.js";import{IconButton as h}from"../icon-button/IconButton.js";import{Input as p}from"../input/Input.js";import{Spinner as m}from"../spinner/Spinner.js";import{BodyCaption as v,TitleRegular as g}from"../TypographyStyle.js";import{EmptyState as j}from"./emptyState.js";import{ProductGroup as f}from"./product.js";import{ProductPickerShimmer as y}from"./ProductPickerShimmer.js";import{CollectionIdContext as b}from"./reducers.js";import{ProductScreenHeader as k,ProductScreenCollectionCardStyle as O}from"./style.js";import{OUT_OF_STOCK_ACTION as C}from"./type.js";import{getVariantIdsToFetchAtProductLevel as P,markVariantsAsApprovedProductsLevel as E,isCollectionPartiallyChecked as I,isProductPartiallyChecked as D,liftTheStateUp as x}from"./utility.js";const S=S=>{var T,w;const{data:R,collectionsDispatch:V,selectedData:A,selectedCollectionsDispatch:B,productFetcher:F,storeId:H,setScreen:L,setSaveDisabled:J,hideInCollectionSearch:W,customCollectionRestriction:z,hideProductCheckbox:K,outOfStockAction:M=C.BLUR,hideVariantCheckbox:N=!1,selectProductsFromCustomCollection:U=!1,pickerType:_,hideProductVariants:q,fbStatusFetcher:G,onProductDetailClick:Q,showProductDetailInfoIcon:X,scrollContainerRef:Y}=S,Z=i(b),$=s(0),tt=s(!1),[et,ot]=l(!1),[ct,rt]=l(""),[nt,it]=l(!1),[st,lt]=l(R),dt=s(!1);d((()=>{const t=setTimeout((()=>{ct.length?(it(!0),S.searchInCollectionFetcher(H,Z,ct).then((t=>{const e=n(R);e.products=t,lt(e);const o=P(null!=t?t:{});ht(o,null!=t?t:{},!0),J(!1),it(!1)}))):lt(R)}),800);return()=>clearTimeout(t)}),[ct]);const ut=()=>{if(!Y||!(null==Y?void 0:Y.current))return;const{scrollTop:t,clientHeight:e,scrollHeight:o}=Y.current;t+e>=o-20&&!dt.current&&!tt.current&&(J(!0),ot(!0),tt.current=!0,F(Z,H,10,$.current).then((t=>{if(Object.keys(t).length||(dt.current=!0),Object.keys(t).length){const e=st;e.products=Object.assign(Object.assign({},st.products),t),lt(e);const o=P(t);ht(o,t),$.current+=1}tt.current=!1,ot(!1),J(!1)})).catch())};d((()=>{var t;return null===(t=null==Y?void 0:Y.current)||void 0===t||t.addEventListener("scroll",ut),()=>{var t;null===(t=null==Y?void 0:Y.current)||void 0===t||t.removeEventListener("scroll",ut)}}),[]),d((()=>{var t,e,o,c;dt.current=!1,$.current=Math.floor((null===(e=Object.keys(null!==(t=R.products)&&void 0!==t?t:{}))||void 0===e?void 0:e.length)/10);const r=P(null!==(o=R.products)&&void 0!==o?o:{});ht(r,null!==(c=R.products)&&void 0!==c?c:{})}),[Z]);const at=!!z&&R.isSmartCollection;d((()=>{(null==R?void 0:R.products)||pt(10)}),[]);const ht=(t,e,o)=>{G||(o?E(e,V,Z,st,lt):E(e,V,Z)),t.length>0&&G&&G(H,t).then((t=>{const c=Object.assign({},e);Object.keys(e).forEach((o=>{var r,n;Object.keys(null!==(n=null===(r=null==e?void 0:e[o])||void 0===r?void 0:r.variants)&&void 0!==n?n:{}).forEach((r=>{var n,i;const s=null===(n=null==e?void 0:e[o].variants)||void 0===n?void 0:n[r];s&&"REJECTED"===t[r]?s.fbStatus="REJECTED":s&&"APPROVED"===t[r]&&(s.fbStatus="APPROVED");const l=null===(i=null==c?void 0:c[o])||void 0===i?void 0:i.variants;l&&l[r]&&(l[r]=s)}))})),o?(lt((t=>{const e=Object.assign({},t);return e.products=c,e})),V({type:"productsPaged",data:{collectionId:Z,products:c}})):V({type:"productsPaged",data:{collectionId:Z,products:c}})})).catch((t=>{o?E(e,V,Z,st,lt):E(e,V,Z)}))},pt=t=>{J(!0),it(!0),F(Z,H,t,0).then((e=>{if(Object.keys(e).length||(dt.current=!0),Object.keys(e).length){lt(Object.assign(Object.assign({},st),{products:e}));const t=P(e);ht(t,e),$.current=1}t||B({type:"selected",data:{id:Z,val:Object.assign(Object.assign({},R),{products:e})}}),J(!1),it(!1)})).catch()},mt=(t,e)=>{const o=x(e,R);B({type:t,data:Object.assign(Object.assign({},o),{isRestricted:z})})},vt=!!(null==A?void 0:A[Z])&&!!Object.keys(null!==(w=null===(T=null==A?void 0:A[Z])||void 0===T?void 0:T.products)&&void 0!==w?w:{}).length;return t("div",{children:[t(k,{children:[e(h,{Icon:o,height:16,onClick:()=>{L("collections")}}),e(v,Object.assign({style:{color:u.content.secondary}},{children:R.name}))]}),!W&&e("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e(p,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>nt&&ct.length?e(m,{size:"small",color:u.content.primary}):e(r,{})},id:"listInput",height:"24px",type:"text",value:ct,onChangeText:t=>{t.length&&t.trim().length?rt(t):rt("")},placeholder:"Search products in this collection..."})})),t("div",{children:[Object.keys((null==st?void 0:st.products)||[]).length>0&&!at&&!ct.length&&!K&&"-1"!==Z&&t(O,{children:[e(a,{isChecked:vt,isPartiallyChecked:I(Z,st,A,q),onValueChange:function(t){t?pt():B({type:"unselected",data:{id:Z}})}}),e("div",Object.assign({style:{width:40,height:40}},{children:e(c,{})})),e(g,{children:"All Products"})]}),Object.keys((null==st?void 0:st.products)||[]).length?Object.keys(st.products||[]).map((t=>e(f,{outOfStockAction:M,collectionId:Z,isProductPartiallyChecked:D(Z,t,A,st,q),productId:t,data:st.products[t],selectedData:A,selectedCollectionsDispatch:B,viewOnly:!U&&!!at,upliftAdditions:mt,hideProductCheckbox:K,hideVariantCheckbox:N,hideProductVariants:q,pickerType:_,onProductDetailClick:Q,showProductDetailInfoIcon:X},t))):nt?e(y,{limit:10}):e(j,{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."})]}),et&&e(y,{})]})};export{S as ProductsScreen};
1
+ import{jsxs as t,jsx as o}from"react/jsx-runtime";import e from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import r from"../../assets/icons/search.svg.js";import{cloneDeep as n,debounce as i}from"lodash";import{useContext as l,useRef as s,useState as d,useEffect as u,useCallback as a}from"react";import{COLORS as h}from"../../constants/Theme.js";import{CheckBox as p}from"../checkBox/CheckBox.js";import{IconButton as m}from"../icon-button/IconButton.js";import{Input as v}from"../input/Input.js";import{Spinner as g}from"../spinner/Spinner.js";import{BodyCaption as f,TitleRegular as j}from"../TypographyStyle.js";import{EmptyState as b}from"./emptyState.js";import{ProductGroup as y}from"./product.js";import{ProductPickerShimmer as k}from"./ProductPickerShimmer.js";import{CollectionIdContext as O}from"./reducers.js";import{ProductScreenHeader as C,ProductScreenCollectionCardStyle as P}from"./style.js";import{OUT_OF_STOCK_ACTION as I}from"./type.js";import{getVariantIdsToFetchAtProductLevel as E,markVariantsAsApprovedProductsLevel as S,isCollectionPartiallyChecked as D,isProductPartiallyChecked as x,liftTheStateUp as T}from"./utility.js";const w=w=>{var R,V;const{data:A,collectionsDispatch:H,selectedData:B,selectedCollectionsDispatch:F,productFetcher:L,storeId:J,setScreen:W,setSaveDisabled:z,hideInCollectionSearch:K,customCollectionRestriction:M,hideProductCheckbox:N,outOfStockAction:U=I.BLUR,hideVariantCheckbox:_=!1,selectProductsFromCustomCollection:q=!1,pickerType:G,hideProductVariants:Q,fbStatusFetcher:X,onProductDetailClick:Y,showProductDetailInfoIcon:Z,scrollContainerRef:$}=w,tt=l(O),ot=s(0),et=s(!1),[ct,rt]=d(!1),[nt,it]=d(""),[lt,st]=d(!1),[dt,ut]=d(A),at=s(!1);u((()=>{const t=setTimeout((()=>{nt.length?(st(!0),w.searchInCollectionFetcher(J,tt,nt).then((t=>{const o=n(A);o.products=t,ut(o);const e=E(null!=t?t:{});vt(e,null!=t?t:{},!0),z(!1),st(!1)}))):ut(A)}),800);return()=>clearTimeout(t)}),[nt]);const ht=a((()=>{if(!$||!(null==$?void 0:$.current))return;const{scrollTop:t,clientHeight:o,scrollHeight:e}=$.current;console.log({scrollTop:t,clientHeight:o,scrollHeight:e}),t+o>=e-20&&!at.current&&!et.current&&(z(!0),rt(!0),et.current=!0,console.log("handleScroll productFetcher",{collectionId:tt,storeId:J,o:10,nc:ot.current}),L(tt,J,10,ot.current).then((c=>{var r;if(Object.keys(c).length||(at.current=!0),Object.keys(c).length){const n=dt;n.products=Object.assign(Object.assign({},dt.products),c),ut(n);const i=E(c);vt(i,c),console.log("new scroll position",t+o-100),ot.current+=1;const l=$.current.scrollHeight-e+t;null===(r=$.current)||void 0===r||r.scrollTo({top:l-100,behavior:"smooth"})}et.current=!1,rt(!1),z(!1)})).catch())}),[tt,dt,$,J]),pt=s(i(ht,200)).current;u((()=>{var t;return null===(t=null==$?void 0:$.current)||void 0===t||t.addEventListener("scroll",pt),()=>{var t;null===(t=null==$?void 0:$.current)||void 0===t||t.removeEventListener("scroll",pt)}}),[$,pt]),u((()=>{var t,o,e,c;console.log("useEffect productScreen, collectionId",{collectionId:tt}),at.current=!1,ot.current=Math.floor((null===(o=Object.keys(null!==(t=A.products)&&void 0!==t?t:{}))||void 0===o?void 0:o.length)/10);const r=E(null!==(e=A.products)&&void 0!==e?e:{});vt(r,null!==(c=A.products)&&void 0!==c?c:{})}),[tt]);const mt=!!M&&A.isSmartCollection;u((()=>{(null==A?void 0:A.products)||gt(10)}),[]);const vt=(t,o,e)=>{X||(e?S(o,H,tt,dt,ut):S(o,H,tt)),t.length>0&&X&&X(J,t).then((t=>{const c=Object.assign({},o);Object.keys(o).forEach((e=>{var r,n;Object.keys(null!==(n=null===(r=null==o?void 0:o[e])||void 0===r?void 0:r.variants)&&void 0!==n?n:{}).forEach((r=>{var n,i;const l=null===(n=null==o?void 0:o[e].variants)||void 0===n?void 0:n[r];l&&"REJECTED"===t[r]?l.fbStatus="REJECTED":l&&"APPROVED"===t[r]&&(l.fbStatus="APPROVED");const s=null===(i=null==c?void 0:c[e])||void 0===i?void 0:i.variants;s&&s[r]&&(s[r]=l)}))})),e?(ut((t=>{const o=Object.assign({},t);return o.products=c,o})),H({type:"productsPaged",data:{collectionId:tt,products:c}})):H({type:"productsPaged",data:{collectionId:tt,products:c}})})).catch((t=>{e?S(o,H,tt,dt,ut):S(o,H,tt)}))},gt=t=>{z(!0),st(!0),L(tt,J,t,0).then((o=>{if(Object.keys(o).length||(at.current=!0),Object.keys(o).length){ut(Object.assign(Object.assign({},dt),{products:o}));const t=E(o);vt(t,o),ot.current=1}t||F({type:"selected",data:{id:tt,val:Object.assign(Object.assign({},A),{products:o})}}),z(!1),st(!1)})).catch()},ft=(t,o)=>{const e=T(o,A);F({type:t,data:Object.assign(Object.assign({},e),{isRestricted:M})})},jt=!!(null==B?void 0:B[tt])&&!!Object.keys(null!==(V=null===(R=null==B?void 0:B[tt])||void 0===R?void 0:R.products)&&void 0!==V?V:{}).length;return t("div",{children:[t(C,{children:[o(m,{Icon:e,height:16,onClick:()=>{W("collections")}}),o(f,Object.assign({style:{color:h.content.secondary}},{children:A.name}))]}),!K&&o("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:o(v,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>lt&&nt.length?o(g,{size:"small",color:h.content.primary}):o(r,{})},id:"listInput",height:"24px",type:"text",value:nt,onChangeText:t=>{t.length&&t.trim().length?it(t):it("")},placeholder:"Search products in this collection..."})})),t("div",{children:[Object.keys((null==dt?void 0:dt.products)||[]).length>0&&!mt&&!nt.length&&!N&&"-1"!==tt&&t(P,{children:[o(p,{isChecked:jt,isPartiallyChecked:D(tt,dt,B,Q),onValueChange:function(t){t?gt():F({type:"unselected",data:{id:tt}})}}),o("div",Object.assign({style:{width:40,height:40}},{children:o(c,{})})),o(j,{children:"All Products"})]}),Object.keys((null==dt?void 0:dt.products)||[]).length?Object.keys(dt.products||[]).map((t=>o(y,{outOfStockAction:U,collectionId:tt,isProductPartiallyChecked:x(tt,t,B,dt,Q),productId:t,data:dt.products[t],selectedData:B,selectedCollectionsDispatch:F,viewOnly:!q&&!!mt,upliftAdditions:ft,hideProductCheckbox:N,hideVariantCheckbox:_,hideProductVariants:Q,pickerType:G,onProductDetailClick:Y,showProductDetailInfoIcon:Z},t))):lt?o(k,{limit:10}):o(b,{title:"No products to show",subtitle:nt.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]}),ct&&o(k,{limit:1})]})};export{w as ProductsScreen};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.547-drop.1",
3
+ "version": "0.0.548-beta.0",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",