@bikdotai/bik-component-library 0.0.558-beta.1 → 0.0.558-beta.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/toaster/Toaster.d.ts +1 -3
- package/dist/cjs/components/toaster/Toaster.js +1 -1
- package/dist/cjs/components/toaster/Toaster.styled.d.ts +0 -3
- package/dist/cjs/components/toaster/Toaster.styled.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/toaster/Toaster.d.ts +1 -3
- package/dist/esm/components/toaster/Toaster.js +1 -1
- package/dist/esm/components/toaster/Toaster.styled.d.ts +0 -3
- package/dist/esm/components/toaster/Toaster.styled.js +1 -1
- package/package.json +1 -1
|
@@ -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"),c=require("../../assets/icons/box.svg.js"),o=require("../../assets/icons/search.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),c=require("../../assets/icons/box.svg.js"),o=require("../../assets/icons/search.svg.js"),r=require("lodash"),s=require("react"),n=require("../../constants/Theme.js"),i=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),d=require("../InfiniteScroll/InfiniteScroll.js"),u=require("../input/Input.js"),a=require("../spinner/Spinner.js"),h=require("../TypographyStyle.js"),p=require("./emptyState.js"),j=require("./product.js"),v=require("./ProductPickerShimmer.js"),g=require("./reducers.js"),y=require("./style.js"),O=require("./type.js"),b=require("./utility.js");exports.ProductsScreen=f=>{var k,C;const{data:P,collectionsDispatch:x,selectedData:S,selectedCollectionsDispatch:I,productFetcher:m,storeId:q,setScreen:A,setSaveDisabled:E,hideInCollectionSearch:T,customCollectionRestriction:D,hideProductCheckbox:R,outOfStockAction:V=O.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:L=!1,selectProductsFromCustomCollection:F=!1,pickerType:w,hideProductVariants:B,fbStatusFetcher:_,onProductDetailClick:M,showProductDetailInfoIcon:U,scrollContainerRef:H}=f,J=s.useContext(g.CollectionIdContext),K=s.useRef(0),N=s.useRef(!1),[W,z]=s.useState(""),[G,Q]=s.useState(!1),[X,Y]=s.useState(P),Z=s.useRef(!0),$=s.useRef(!1);s.useEffect((()=>{if(Z.current)return void(Z.current=!1);const e=setTimeout((()=>{W.length?(Q(!0),f.searchInCollectionFetcher(q,J,W).then((e=>{const t=r.cloneDeep(P);t.products=e,Y(t);const c=b.getVariantIdsToFetchAtProductLevel(null!=e?e:{});te(c,null!=e?e:{},!0),E(!1),Q(!1)}))):Y(P)}),800);return()=>clearTimeout(e)}),[W]);s.useEffect((()=>{var e,t,c,o;$.current=!1,K.current=Math.floor((null===(t=Object.keys(null!==(e=P.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const r=b.getVariantIdsToFetchAtProductLevel(null!==(c=P.products)&&void 0!==c?c:{});te(r,null!==(o=P.products)&&void 0!==o?o:{})}),[J]);const ee=!!D&&P.isSmartCollection;s.useEffect((()=>{(null==P?void 0:P.products)||ce(10)}),[]);const te=(e,t,c)=>{_||(c?b.markVariantsAsApprovedProductsLevel(t,x,J,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,J)),e.length>0&&_&&_(q,e).then((e=>{const o=Object.assign({},t);Object.keys(t).forEach((c=>{var r,s;Object.keys(null!==(s=null===(r=null==t?void 0:t[c])||void 0===r?void 0:r.variants)&&void 0!==s?s:{}).forEach((r=>{var s,n;const i=null===(s=null==t?void 0:t[c].variants)||void 0===s?void 0:s[r];i&&"REJECTED"===e[r]?i.fbStatus="REJECTED":i&&"APPROVED"===e[r]&&(i.fbStatus="APPROVED");const l=null===(n=null==o?void 0:o[c])||void 0===n?void 0:n.variants;l&&l[r]&&(l[r]=i)}))})),c?(Y((e=>{const t=Object.assign({},e);return t.products=o,t})),x({type:"productsPaged",data:{collectionId:J,products:o}})):x({type:"productsPaged",data:{collectionId:J,products:o}})})).catch((e=>{c?b.markVariantsAsApprovedProductsLevel(t,x,J,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,J)}))},ce=e=>{E(!0),Q(!0),m(J,q,e,0).then((t=>{if(Object.keys(t).length||($.current=!0),Object.keys(t).length){Y(Object.assign(Object.assign({},X),{products:t}));const e=b.getVariantIdsToFetchAtProductLevel(t);te(e,t),K.current=1}e||I({type:"selected",data:{id:J,val:Object.assign(Object.assign({},P),{products:t})}}),E(!1),Q(!1)})).catch()},oe=(e,t)=>{const c=b.liftTheStateUp(t,P);I({type:e,data:Object.assign(Object.assign({},c),{isRestricted:D})})},re=!!(null==S?void 0:S[J])&&!!Object.keys(null!==(C=null===(k=null==S?void 0:S[J])||void 0===k?void 0:k.products)&&void 0!==C?C:{}).length;return e.jsxs("div",{children:[e.jsxs(y.ProductScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,height:16,onClick:()=>{A("collections")}}),e.jsx(h.BodyCaption,Object.assign({style:{color:n.COLORS.content.secondary}},{children:P.name}))]}),!T&&e.jsx("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(u.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>G&&W.length?e.jsx(a.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:W,onChangeText:e=>{e.length&&e.trim().length?z(e):z("")},placeholder:"Search products in this collection..."})})),Object.keys((null==X?void 0:X.products)||[]).length>0&&!ee&&!W.length&&!R&&"-1"!==J&&e.jsxs(y.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:re,isPartiallyChecked:b.isCollectionPartiallyChecked(J,X,S,B),onValueChange:function(e){e?ce():I({type:"unselected",data:{id:J}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(c.default,{})})),e.jsx(h.TitleRegular,{children:"All Products"})]}),e.jsx(d.InfiniteScroll,Object.assign({hasData:!(Object.keys((null==X?void 0:X.products)||[]).length<10)&&!!Object.keys((null==X?void 0:X.products)||[]).length,fetchMore:()=>(N.current=!0,m(J,q,10,K.current).then((e=>{let t=!1;if(Object.keys(e).length||(t=!0),Object.keys(e).length){const t=X;t.products=Object.assign(Object.assign({},X.products),e),Y(Object.assign({},t));const c=b.getVariantIdsToFetchAtProductLevel(e);te(c,e)}return E(!1),N.current=!1,K.current+=1,t}))),containerRef:H},{children:Object.keys((null==X?void 0:X.products)||[]).length?Object.keys(X.products||[]).map((t=>e.jsx(j.ProductGroup,{outOfStockAction:V,collectionId:J,isProductPartiallyChecked:b.isProductPartiallyChecked(J,t,S,X,B),productId:t,data:X.products[t],selectedData:S,selectedCollectionsDispatch:I,viewOnly:!F&&!!ee,upliftAdditions:oe,hideProductCheckbox:R,hideVariantCheckbox:L,hideProductVariants:B,pickerType:w,onProductDetailClick:M,showProductDetailInfoIcon:U},t))):G?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(p.EmptyState,{title:"No products to show",subtitle:W.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})}))]})};
|
|
@@ -3,12 +3,11 @@ import { ToastPosition } from 'react-toastify';
|
|
|
3
3
|
import { IconProps } from 'react-toastify/dist/components';
|
|
4
4
|
export type ToasterButtonProps = {
|
|
5
5
|
showButton?: boolean;
|
|
6
|
-
onButtonClick?:
|
|
6
|
+
onButtonClick?: any;
|
|
7
7
|
buttonText?: string;
|
|
8
8
|
};
|
|
9
9
|
export type ToasterProps = {
|
|
10
10
|
text: string;
|
|
11
|
-
subText?: string;
|
|
12
11
|
position?: ToastPosition;
|
|
13
12
|
type?: 'info' | 'success' | 'error' | 'default' | 'warning';
|
|
14
13
|
closeOnClick?: boolean;
|
|
@@ -17,7 +16,6 @@ export type ToasterProps = {
|
|
|
17
16
|
leftIcon?: React.ReactElement<IconProps>;
|
|
18
17
|
hideLeftIcon?: boolean;
|
|
19
18
|
buttonProps?: ToasterButtonProps;
|
|
20
|
-
secondButtonProps?: ToasterButtonProps;
|
|
21
19
|
onCloseToast?: <T>(props: T) => void;
|
|
22
20
|
width?: string;
|
|
23
21
|
height?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("../../assets/icons/cross.svg.js"),o=require("react"),n=require("react-dom"),s=require("react-toastify"),r=require("./Toaster.styled.js"),i=require("../TypographyStyle.js"),a=require("../../constants/Theme.js");function u(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var l=u(o),d=u(n);const c=o=>{const n="default"===o.type?a.COLORS.content.secondary:a.COLORS.content.secondaryInverse;return t.jsx("div",Object.assign({tabIndex:0,role:"button",style:{width:20,display:"flex",margin:"auto",cursor:"pointer"},onClick:o.closeToast,onKeyDown:t=>{"Enter"===t.key&&o.closeToast()}},{children:t.jsx(e.default,{height:20,width:20,color:n})}))},h=e=>{var n;const s="default"===e.type?a.COLORS.stroke.primary:"success"===e.type?a.COLORS.background.positive.vibrant:"error"===e.type?a.COLORS.background.negative.vibrant:"warning"===e.type?a.COLORS.background.warning.vibrant:a.COLORS.background.inverseLight,{toasterText:r}=o.useContext(p);return t.jsx(t.Fragment,{children:t.jsxs("div",Object.assign({style:{display:"flex",flexGrow:1,borderRight:e.hideCloseButton?"unset":`1px solid ${s}`}},{children:[t.jsx("div",Object.assign({style:{flexGrow:1,marginRight:e.showButton?16:e.hideCloseButton?0:12}},{children:t.jsx(i.BodyPrimary,Object.assign({color:"inherit"},{children:null!==(n=e.toastText)&&void 0!==n?n:r}))})),e.showButton&&t.jsx(i.ButtonRegular,Object.assign({style:{marginRight:e.hideCloseButton?0:12,marginTop:"auto",marginBottom:"auto",display:"flex",cursor:"pointer"},onClick:e.onButtonClick,color:"default"===e.type?a.COLORS.content.brand:"inherit"},{children:e.buttonText}))]}))})},p=l.default.createContext({toasterText:""});exports.Toaster=e=>{const n=o.useRef(""),[i,a]=o.useState(e.text);o.useEffect((()=>{n.current&&n.current===e.toastId?(a(e.text),s.toast.update(n.current,{autoClose:e.autoClose})):n.current&&n.current!==e.toastId&&u(e.text)}),[e.toastId,e.text]);const u=o=>{var r,i,a,u,l,d;void 0!==e.hideLeftIcon||e.leftIcon?s.toast(t.jsx(h,{toastText:o,type:e.type||"info",buttonText:null===(r=e.buttonProps)||void 0===r?void 0:r.buttonText,showButton:null===(i=e.buttonProps)||void 0===i?void 0:i.showButton,onButtonClick:null===(a=e.buttonProps)||void 0===a?void 0:a.onButtonClick,hideCloseButton:e.hideCloseButton}),{onClose:e.onCloseToast?e.onCloseToast:()=>({}),icon:t=>!1!==e.hideLeftIcon&&(e.leftIcon?e.leftIcon:null),type:e.type,closeButton:!e.hideCloseButton&&t.jsx(c,{type:e.type||"default"}),toastId:e.toastId}):n.current=s.toast(t.jsx(h,{toastText:o,type:e.type||"info",buttonText:null===(u=e.buttonProps)||void 0===u?void 0:u.buttonText,showButton:null===(l=e.buttonProps)||void 0===l?void 0:l.showButton,onButtonClick:null===(d=e.buttonProps)||void 0===d?void 0:d.onButtonClick,hideCloseButton:e.hideCloseButton}),{onClose:e.onCloseToast?e.onCloseToast:()=>({}),type:e.type,closeButton:!e.hideCloseButton&&t.jsx(c,{type:e.type||"info"}),toastId:e.toastId})};return o.useEffect((()=>{u()}),[]),d.default.createPortal(t.jsx(r.ToasterStyled,Object.assign({width:e.width,height:e.height,zIndex:e.zIndex},{children:t.jsx(p.Provider,Object.assign({value:{toasterText:i}},{children:t.jsx(s.ToastContainer,{position:e.position||"top-right",closeOnClick:e.closeOnClick||!1,hideProgressBar:e.hideProgressBar||!1,draggable:!1,autoClose:e.autoClose||!1,theme:"colored"})}))})),document.body)};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TypeOptions } from 'react-toastify';
|
|
3
2
|
export declare const ToasterStyled: import("@emotion/styled").StyledComponent<{
|
|
4
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
4
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -7,6 +6,4 @@ export declare const ToasterStyled: import("@emotion/styled").StyledComponent<{
|
|
|
7
6
|
width?: string | undefined;
|
|
8
7
|
height?: string | undefined;
|
|
9
8
|
zIndex?: number | undefined;
|
|
10
|
-
isSubTextIncluded?: boolean | undefined;
|
|
11
|
-
type?: TypeOptions | undefined;
|
|
12
9
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@emotion/styled/base"),c=require("../../constants/Theme.js"),b=require("../../constants/zindex.js");function d(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}const o=d(t).default("div","production"===process.env.NODE_ENV?{target:"e1tdeuzc0"}:{target:"e1tdeuzc0",label:"ToasterStyled"})("--toastify-color-light:#fff;--toastify-color-dark:#121212;--toastify-color-info:",c.COLORS.background.inverse,";--toastify-color-success:",c.COLORS.content.positive,";--toastify-color-error:",c.COLORS.content.negative,";--toastify-color-warning:",c.COLORS.content.warning,";--toastify-text-color-light:",c.COLORS.content.primary,';--toastify-toast-width:"fit-content";--toastify-toast-min-height:',(t=>t.height||"44px"),";--toastify-toast-max-height:",(t=>t.height||"fit-content"),";font-family:inherit;z-index:",(t=>t.zIndex||b.ComponentZindex.TOASTER),";.custom-position{position:relative;}.Toastify__toast{padding:6px;max-width:",(t=>t.width),";.Toastify__close-button{display:block;margin:auto;}.Toastify__toast-body{padding:0 6px;}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--default{background:",c.COLORS.content.brand,";}.Toastify__toast-body>div:last-child{display:flex;}}"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRvYXN0ZXIuc3R5bGVkLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHd0MiLCJmaWxlIjoiVG9hc3Rlci5zdHlsZWQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xyXG5pbXBvcnQgeyBDT0xPUlMgfSBmcm9tIFwiLi4vLi4vY29uc3RhbnRzL1RoZW1lXCI7XHJcbmltcG9ydCB7IENvbXBvbmVudFppbmRleCB9IGZyb20gXCIuLi8uLi9jb25zdGFudHMvemluZGV4XCI7XHJcbmV4cG9ydCBjb25zdCBUb2FzdGVyU3R5bGVkID0gc3R5bGVkLmRpdiBgXG5cblx0LS10b2FzdGlmeS1jb2xvci1saWdodDogI2ZmZjtcblx0LS10b2FzdGlmeS1jb2xvci1kYXJrOiAjMTIxMjEyO1xuXHQtLXRvYXN0aWZ5LWNvbG9yLWluZm86ICR7Q09MT1JTLmJhY2tncm91bmQuaW52ZXJzZX07XG5cdC0tdG9hc3RpZnktY29sb3Itc3VjY2VzczogJHtDT0xPUlMuY29udGVudC5wb3NpdGl2ZX07XG5cdC0tdG9hc3RpZnktY29sb3ItZXJyb3I6ICR7Q09MT1JTLmNvbnRlbnQubmVnYXRpdmV9O1xuXHQtLXRvYXN0aWZ5LWNvbG9yLXdhcm5pbmc6ICR7Q09MT1JTLmNvbnRlbnQud2FybmluZ307XG5cdC0tdG9hc3RpZnktdGV4dC1jb2xvci1saWdodDogJHtDT0xPUlMuY29udGVudC5wcmltYXJ5fTtcblx0LS10b2FzdGl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=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import n from"../../assets/icons/search.svg.js";import{cloneDeep as
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import n from"../../assets/icons/search.svg.js";import{cloneDeep as r}from"lodash";import{useContext as i,useRef as s,useState as l,useEffect as d}from"react";import{COLORS as a}from"../../constants/Theme.js";import{CheckBox as u}from"../checkBox/CheckBox.js";import{IconButton as h}from"../icon-button/IconButton.js";import{InfiniteScroll as p}from"../InfiniteScroll/InfiniteScroll.js";import{Input as m}from"../input/Input.js";import{Spinner as g}from"../spinner/Spinner.js";import{BodyCaption as j,TitleRegular as f}from"../TypographyStyle.js";import{EmptyState as v}from"./emptyState.js";import{ProductGroup as b}from"./product.js";import{ProductPickerShimmer as y}from"./ProductPickerShimmer.js";import{CollectionIdContext as O}from"./reducers.js";import{ProductScreenHeader as k,ProductScreenCollectionCardStyle as C}from"./style.js";import{OUT_OF_STOCK_ACTION as P}from"./type.js";import{getVariantIdsToFetchAtProductLevel as I,markVariantsAsApprovedProductsLevel as D,isCollectionPartiallyChecked as S,isProductPartiallyChecked as x,liftTheStateUp as E}from"./utility.js";const R=R=>{var T,w;const{data:V,collectionsDispatch:A,selectedData:B,selectedCollectionsDispatch:F,productFetcher:J,storeId:M,setScreen:W,setSaveDisabled:z,hideInCollectionSearch:H,customCollectionRestriction:K,hideProductCheckbox:L,outOfStockAction:N=P.BLUR,hideVariantCheckbox:U=!1,selectProductsFromCustomCollection:_=!1,pickerType:q,hideProductVariants:G,fbStatusFetcher:Q,onProductDetailClick:X,showProductDetailInfoIcon:Y,scrollContainerRef:Z}=R,$=i(O),tt=s(0),et=s(!1),[ot,ct]=l(""),[nt,rt]=l(!1),[it,st]=l(V),lt=s(!0),dt=s(!1);d((()=>{if(lt.current)return void(lt.current=!1);const t=setTimeout((()=>{ot.length?(rt(!0),R.searchInCollectionFetcher(M,$,ot).then((t=>{const e=r(V);e.products=t,st(e);const o=I(null!=t?t:{});ut(o,null!=t?t:{},!0),z(!1),rt(!1)}))):st(V)}),800);return()=>clearTimeout(t)}),[ot]);d((()=>{var t,e,o,c;dt.current=!1,tt.current=Math.floor((null===(e=Object.keys(null!==(t=V.products)&&void 0!==t?t:{}))||void 0===e?void 0:e.length)/10);const n=I(null!==(o=V.products)&&void 0!==o?o:{});ut(n,null!==(c=V.products)&&void 0!==c?c:{})}),[$]);const at=!!K&&V.isSmartCollection;d((()=>{(null==V?void 0:V.products)||ht(10)}),[]);const ut=(t,e,o)=>{Q||(o?D(e,A,$,it,st):D(e,A,$)),t.length>0&&Q&&Q(M,t).then((t=>{const c=Object.assign({},e);Object.keys(e).forEach((o=>{var n,r;Object.keys(null!==(r=null===(n=null==e?void 0:e[o])||void 0===n?void 0:n.variants)&&void 0!==r?r:{}).forEach((n=>{var r,i;const s=null===(r=null==e?void 0:e[o].variants)||void 0===r?void 0:r[n];s&&"REJECTED"===t[n]?s.fbStatus="REJECTED":s&&"APPROVED"===t[n]&&(s.fbStatus="APPROVED");const l=null===(i=null==c?void 0:c[o])||void 0===i?void 0:i.variants;l&&l[n]&&(l[n]=s)}))})),o?(st((t=>{const e=Object.assign({},t);return e.products=c,e})),A({type:"productsPaged",data:{collectionId:$,products:c}})):A({type:"productsPaged",data:{collectionId:$,products:c}})})).catch((t=>{o?D(e,A,$,it,st):D(e,A,$)}))},ht=t=>{z(!0),rt(!0),J($,M,t,0).then((e=>{if(Object.keys(e).length||(dt.current=!0),Object.keys(e).length){st(Object.assign(Object.assign({},it),{products:e}));const t=I(e);ut(t,e),tt.current=1}t||F({type:"selected",data:{id:$,val:Object.assign(Object.assign({},V),{products:e})}}),z(!1),rt(!1)})).catch()},pt=(t,e)=>{const o=E(e,V);F({type:t,data:Object.assign(Object.assign({},o),{isRestricted:K})})},mt=!!(null==B?void 0:B[$])&&!!Object.keys(null!==(w=null===(T=null==B?void 0:B[$])||void 0===T?void 0:T.products)&&void 0!==w?w:{}).length;return t("div",{children:[t(k,{children:[e(h,{Icon:o,height:16,onClick:()=>{W("collections")}}),e(j,Object.assign({style:{color:a.content.secondary}},{children:V.name}))]}),!H&&e("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e(m,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>nt&&ot.length?e(g,{size:"small",color:a.content.primary}):e(n,{})},id:"listInput",height:"24px",type:"text",value:ot,onChangeText:t=>{t.length&&t.trim().length?ct(t):ct("")},placeholder:"Search products in this collection..."})})),Object.keys((null==it?void 0:it.products)||[]).length>0&&!at&&!ot.length&&!L&&"-1"!==$&&t(C,{children:[e(u,{isChecked:mt,isPartiallyChecked:S($,it,B,G),onValueChange:function(t){t?ht():F({type:"unselected",data:{id:$}})}}),e("div",Object.assign({style:{width:40,height:40}},{children:e(c,{})})),e(f,{children:"All Products"})]}),e(p,Object.assign({hasData:!(Object.keys((null==it?void 0:it.products)||[]).length<10)&&!!Object.keys((null==it?void 0:it.products)||[]).length,fetchMore:()=>(et.current=!0,J($,M,10,tt.current).then((t=>{let e=!1;if(Object.keys(t).length||(e=!0),Object.keys(t).length){const e=it;e.products=Object.assign(Object.assign({},it.products),t),st(Object.assign({},e));const o=I(t);ut(o,t)}return z(!1),et.current=!1,tt.current+=1,e}))),containerRef:Z},{children:Object.keys((null==it?void 0:it.products)||[]).length?Object.keys(it.products||[]).map((t=>e(b,{outOfStockAction:N,collectionId:$,isProductPartiallyChecked:x($,t,B,it,G),productId:t,data:it.products[t],selectedData:B,selectedCollectionsDispatch:F,viewOnly:!_&&!!at,upliftAdditions:pt,hideProductCheckbox:L,hideVariantCheckbox:U,hideProductVariants:G,pickerType:q,onProductDetailClick:X,showProductDetailInfoIcon:Y},t))):nt?e(y,{limit:10}):e(v,{title:"No products to show",subtitle:ot.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})}))]})};export{R as ProductsScreen};
|
|
@@ -3,12 +3,11 @@ import { ToastPosition } from 'react-toastify';
|
|
|
3
3
|
import { IconProps } from 'react-toastify/dist/components';
|
|
4
4
|
export type ToasterButtonProps = {
|
|
5
5
|
showButton?: boolean;
|
|
6
|
-
onButtonClick?:
|
|
6
|
+
onButtonClick?: any;
|
|
7
7
|
buttonText?: string;
|
|
8
8
|
};
|
|
9
9
|
export type ToasterProps = {
|
|
10
10
|
text: string;
|
|
11
|
-
subText?: string;
|
|
12
11
|
position?: ToastPosition;
|
|
13
12
|
type?: 'info' | 'success' | 'error' | 'default' | 'warning';
|
|
14
13
|
closeOnClick?: boolean;
|
|
@@ -17,7 +16,6 @@ export type ToasterProps = {
|
|
|
17
16
|
leftIcon?: React.ReactElement<IconProps>;
|
|
18
17
|
hideLeftIcon?: boolean;
|
|
19
18
|
buttonProps?: ToasterButtonProps;
|
|
20
|
-
secondButtonProps?: ToasterButtonProps;
|
|
21
19
|
onCloseToast?: <T>(props: T) => void;
|
|
22
20
|
width?: string;
|
|
23
21
|
height?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,Fragment as o,jsxs as e}from"react/jsx-runtime";import n from"../../assets/icons/
|
|
1
|
+
import{jsx as t,Fragment as o,jsxs as e}from"react/jsx-runtime";import n from"../../assets/icons/cross.svg.js";import r,{useRef as s,useState as i,useEffect as l,useContext as a}from"react";import d from"react-dom";import{toast as c,ToastContainer as u}from"react-toastify";import{ToasterStyled as p}from"./Toaster.styled.js";import{BodyPrimary as h,ButtonRegular as y}from"../TypographyStyle.js";import{COLORS as g}from"../../constants/Theme.js";const b=o=>{const e="default"===o.type?g.content.secondary:g.content.secondaryInverse;return t("div",Object.assign({tabIndex:0,role:"button",style:{width:20,display:"flex",margin:"auto",cursor:"pointer"},onClick:o.closeToast,onKeyDown:t=>{"Enter"===t.key&&o.closeToast()}},{children:t(n,{height:20,width:20,color:e})}))},v=n=>{var r;const s="default"===n.type?g.stroke.primary:"success"===n.type?g.background.positive.vibrant:"error"===n.type?g.background.negative.vibrant:"warning"===n.type?g.background.warning.vibrant:g.background.inverseLight,{toasterText:i}=a(m);return t(o,{children:e("div",Object.assign({style:{display:"flex",flexGrow:1,borderRight:n.hideCloseButton?"unset":`1px solid ${s}`}},{children:[t("div",Object.assign({style:{flexGrow:1,marginRight:n.showButton?16:n.hideCloseButton?0:12}},{children:t(h,Object.assign({color:"inherit"},{children:null!==(r=n.toastText)&&void 0!==r?r:i}))})),n.showButton&&t(y,Object.assign({style:{marginRight:n.hideCloseButton?0:12,marginTop:"auto",marginBottom:"auto",display:"flex",cursor:"pointer"},onClick:n.onButtonClick,color:"default"===n.type?g.content.brand:"inherit"},{children:n.buttonText}))]}))})},C=o=>{const e=s(""),[n,r]=i(o.text);l((()=>{e.current&&e.current===o.toastId?(r(o.text),c.update(e.current,{autoClose:o.autoClose})):e.current&&e.current!==o.toastId&&a(o.text)}),[o.toastId,o.text]);const a=n=>{var r,s,i,l,a,d;void 0!==o.hideLeftIcon||o.leftIcon?c(t(v,{toastText:n,type:o.type||"info",buttonText:null===(r=o.buttonProps)||void 0===r?void 0:r.buttonText,showButton:null===(s=o.buttonProps)||void 0===s?void 0:s.showButton,onButtonClick:null===(i=o.buttonProps)||void 0===i?void 0:i.onButtonClick,hideCloseButton:o.hideCloseButton}),{onClose:o.onCloseToast?o.onCloseToast:()=>({}),icon:t=>!1!==o.hideLeftIcon&&(o.leftIcon?o.leftIcon:null),type:o.type,closeButton:!o.hideCloseButton&&t(b,{type:o.type||"default"}),toastId:o.toastId}):e.current=c(t(v,{toastText:n,type:o.type||"info",buttonText:null===(l=o.buttonProps)||void 0===l?void 0:l.buttonText,showButton:null===(a=o.buttonProps)||void 0===a?void 0:a.showButton,onButtonClick:null===(d=o.buttonProps)||void 0===d?void 0:d.onButtonClick,hideCloseButton:o.hideCloseButton}),{onClose:o.onCloseToast?o.onCloseToast:()=>({}),type:o.type,closeButton:!o.hideCloseButton&&t(b,{type:o.type||"info"}),toastId:o.toastId})};return l((()=>{a()}),[]),d.createPortal(t(p,Object.assign({width:o.width,height:o.height,zIndex:o.zIndex},{children:t(m.Provider,Object.assign({value:{toasterText:n}},{children:t(u,{position:o.position||"top-right",closeOnClick:o.closeOnClick||!1,hideProgressBar:o.hideProgressBar||!1,draggable:!1,autoClose:o.autoClose||!1,theme:"colored"})}))})),document.body)},m=r.createContext({toasterText:""});export{C as Toaster};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TypeOptions } from 'react-toastify';
|
|
3
2
|
export declare const ToasterStyled: import("@emotion/styled").StyledComponent<{
|
|
4
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
4
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -7,6 +6,4 @@ export declare const ToasterStyled: import("@emotion/styled").StyledComponent<{
|
|
|
7
6
|
width?: string | undefined;
|
|
8
7
|
height?: string | undefined;
|
|
9
8
|
zIndex?: number | undefined;
|
|
10
|
-
isSubTextIncluded?: boolean | undefined;
|
|
11
|
-
type?: TypeOptions | undefined;
|
|
12
9
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"@emotion/styled/base";import{COLORS as c}from"../../constants/Theme.js";import{ComponentZindex as b}from"../../constants/zindex.js";const o=t("div","production"===process.env.NODE_ENV?{target:"e1tdeuzc0"}:{target:"e1tdeuzc0",label:"ToasterStyled"})("--toastify-color-light:#fff;--toastify-color-dark:#121212;--toastify-color-info:",c.background.inverse,";--toastify-color-success:",c.content.positive,";--toastify-color-error:",c.content.negative,";--toastify-color-warning:",c.content.warning,";--toastify-text-color-light:",c.content.primary,';--toastify-toast-width:"fit-content";--toastify-toast-min-height:',(t=>t.height||"44px"),";--toastify-toast-max-height:",(t=>t.height||"fit-content"),";font-family:inherit;z-index:",(t=>t.zIndex||b.TOASTER),";.custom-position{position:relative;}.Toastify__toast{padding:6px;max-width:",(t=>t.width),";.Toastify__close-button{display:block;margin:auto;}.Toastify__toast-body{padding:0 6px;}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--default{background:",c.content.brand,";}.Toastify__toast-body>div:last-child{display:flex;}}"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRvYXN0ZXIuc3R5bGVkLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHd0MiLCJmaWxlIjoiVG9hc3Rlci5zdHlsZWQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xyXG5pbXBvcnQgeyBDT0xPUlMgfSBmcm9tIFwiLi4vLi4vY29uc3RhbnRzL1RoZW1lXCI7XHJcbmltcG9ydCB7IENvbXBvbmVudFppbmRleCB9IGZyb20gXCIuLi8uLi9jb25zdGFudHMvemluZGV4XCI7XHJcbmV4cG9ydCBjb25zdCBUb2FzdGVyU3R5bGVkID0gc3R5bGVkLmRpdiBgXG5cblx0LS10b2FzdGlmeS1jb2xvci1saWdodDogI2ZmZjtcblx0LS10b2FzdGlmeS1jb2xvci1kYXJrOiAjMTIxMjEyO1xuXHQtLXRvYXN0aWZ5LWNvbG9yLWluZm86ICR7Q09MT1JTLmJhY2tncm91bmQuaW52ZXJzZX07XG5cdC0tdG9hc3RpZnktY29sb3Itc3VjY2VzczogJHtDT0xPUlMuY29udGVudC5wb3NpdGl2ZX07XG5cdC0tdG9hc3RpZnktY29sb3ItZXJyb3I6ICR7Q09MT1JTLmNvbnRlbnQubmVnYXRpdmV9O1xuXHQtLXRvYXN0aWZ5LWNvbG9yLXdhcm5pbmc6ICR7Q09MT1JTLmNvbnRlbnQud2FybmluZ307XG5cdC0tdG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