@bikdotai/bik-component-library 0.0.159-beta.2 → 0.0.159-beta.3

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.
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -43,5 +43,6 @@ export interface ProductPickerInterface {
43
43
  onClose: () => void;
44
44
  visible: boolean;
45
45
  zIndex?: number;
46
+ limit?: number;
46
47
  }
47
48
  export declare const ProductPickerModal: (props: ProductPickerInterface) => JSX.Element;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),c=require("../button/Button.js"),o=require("../modals/styledModal.js"),s=require("./collectionScreen.js"),l=require("./productScreen.js"),r=require("./reducers.js"),n=require("./selectedScreen.js"),d=require("./style.js");exports.ProductPickerModal=i=>{const{storeId:u,selectedItems:a,onClose:p,visible:h,zIndex:j}=i;console.log("selectedItems",a);const[v,S]=t.useReducer(r.collectionsReducer,{}),[y,C]=t.useState("collections"),[x,b]=t.useState(""),[f,g]=t.useState(0),[I,m]=t.useReducer(r.selectedColectionsReducer,Object.keys(a).length>0?a:{});console.log("selectedCollections",I),t.useEffect((()=>{P(!0),i.collectionFetcher(f,u).then((e=>{S({type:"fetched",data:(null==e?void 0:e.collections)||{}}),P(!1),g((e=>e+1))})).catch()}),[]);const[q,P]=t.useState(!1),[k,D]=t.useState(0);t.useEffect((()=>{let e=0;Object.keys(I||[]).forEach((t=>{var c;Object.keys((null===(c=I[t])||void 0===c?void 0:c.products)||[]).forEach((c=>{var o,s;Object.keys((null===(s=null===(o=I[t].products)||void 0===o?void 0:o[c])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),D(e)})),t.useEffect((()=>{var e;x&&!(null===(e=null==v?void 0:v[x])||void 0===e?void 0:e.products)&&(P(!0),i.productFetcher(x,u).then((e=>{Object.keys(e).length&&(S({type:"productsFetched",data:{collectionId:x,products:e}}),P(!1))})).catch())}),[x]);const F=()=>{m({type:"reset",data:{}})};return e.jsx(o.StyledModal,Object.assign({zIndex:j,open:h,onClose:()=>{p(),F()},headingTitle:"collections"===y?"Select Products":"products"===y?v[x].name:"view"===y?"Selected Products":void 0,footerShadow:!0,centralContainerStyles:{width:"480px"},primaryButton:{buttonText:q?"Loading...":"Add",disabled:q,onClick:()=>{i.onAdd(I,k),F()}},footerLeftCustomElement:e.jsx(e.Fragment,{children:k>0?e.jsx(c.Button,{onClick:()=>{C("view")},buttonText:`${k} products selected`,buttonType:"tertiaryGray"}):e.jsx(c.Button,{disabled:!0,buttonText:`${k} products selected`,buttonType:"tertiaryGray"})})},{children:e.jsx(d.ContainerStyle,{children:e.jsxs(d.ScrollContainerStyle,{children:["collections"===y&&e.jsx(s.CollectionsScreen,{collections:v,selectedCollectionsDispatch:m,setCollectionId:b,setScreen:C,selectedCollections:I,collectionFetcher:i.collectionFetcher,storeId:u,collectionsDispatch:S,setSaveDisabled:P,pagingControls:{curPage:f,setCurPage:g}}),"products"===y&&x&&e.jsx(r.CollectionIdContext.Provider,Object.assign({value:x},{children:e.jsx(l.ProductsScreen,{productFetcher:i.productFetcher,setScreen:C,storeId:u,data:v[x],collectionsDispatch:S,selectedCollectionsDispatch:m,selectedData:I,setSaveDisabled:P})})),"view"===y&&e.jsx(n.SelectedScreen,{selectedCollections:I||{},selectedCollectionsDispatch:m,upliftAdditions:null,setScreen:C,collections:v})]})})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),c=require("../button/Button.js"),o=require("../modals/styledModal.js"),s=require("../tag/Tag.js"),l=require("./collectionScreen.js"),r=require("./productScreen.js"),n=require("./reducers.js"),d=require("./selectedScreen.js"),i=require("./style.js");exports.ProductPickerModal=u=>{const{storeId:a,selectedItems:p,onClose:h,visible:j,zIndex:v,limit:S}=u,[y,x]=t.useReducer(n.collectionsReducer,{}),[C,b]=t.useState("collections"),[f,g]=t.useState(""),[q,I]=t.useState(0),[P,T]=t.useState(!1),[k,m]=t.useState(0),[D,O]=t.useReducer(n.selectedColectionsReducer,Object.keys(p).length>0?p:{});t.useEffect((()=>{T(!0),u.collectionFetcher(q,a).then((e=>{x({type:"fetched",data:(null==e?void 0:e.collections)||{}}),T(!1),I((e=>e+1))})).catch()}),[]),t.useEffect((()=>{let e=0;Object.keys(D||[]).forEach((t=>{var c;Object.keys((null===(c=D[t])||void 0===c?void 0:c.products)||[]).forEach((c=>{var o,s;Object.keys((null===(s=null===(o=D[t].products)||void 0===o?void 0:o[c])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),m(e)})),t.useEffect((()=>{var e;f&&!(null===(e=null==y?void 0:y[f])||void 0===e?void 0:e.products)&&(T(!0),u.productFetcher(f,a).then((e=>{Object.keys(e).length&&(x({type:"productsFetched",data:{collectionId:f,products:e}}),T(!1))})).catch())}),[f]);const E=()=>{O({type:"reset",data:{}})};return e.jsx(o.StyledModal,Object.assign({zIndex:v,open:j,onClose:()=>{h(),E()},headingTitle:"collections"===C?"Select Products":"products"===C?y[f].name:"view"===C?"Selected Products":void 0,footerShadow:!0,centralContainerStyles:{width:"480px"},primaryButton:{buttonText:P?"Loading...":"Add",disabled:P||S&&k>S||!1,onClick:()=>{u.onAdd(D,k),E()}},footerLeftCustomElement:S&&k>S?e.jsx(s.Tag,{tagText:`You can only select ${S} products`,type:"negative"}):k>0?e.jsx(c.Button,{onClick:()=>{b("view")},buttonText:`${k} products selected`,buttonType:"tertiaryGray"}):e.jsx(c.Button,{disabled:!0,buttonText:`${k} products selected`,buttonType:"tertiaryGray"})},{children:e.jsx(i.ContainerStyle,{children:e.jsxs(i.ScrollContainerStyle,{children:["collections"===C&&e.jsx(l.CollectionsScreen,{collections:y,selectedCollectionsDispatch:O,setCollectionId:g,setScreen:b,selectedCollections:D,collectionFetcher:u.collectionFetcher,storeId:a,collectionsDispatch:x,setSaveDisabled:T,pagingControls:{curPage:q,setCurPage:I}}),"products"===C&&f&&e.jsx(n.CollectionIdContext.Provider,Object.assign({value:f},{children:e.jsx(r.ProductsScreen,{productFetcher:u.productFetcher,setScreen:b,storeId:a,data:y[f],collectionsDispatch:x,selectedCollectionsDispatch:O,selectedData:D,setSaveDisabled:T})})),"view"===C&&e.jsx(d.SelectedScreen,{selectedCollections:D||{},selectedCollectionsDispatch:O,upliftAdditions:null,setScreen:b,collections:y})]})})}))};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const WorkingStepper: () => JSX.Element;
2
3
  export declare enum STEPENUM {
3
4
  STEP1 = "STEP1",
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -43,5 +43,6 @@ export interface ProductPickerInterface {
43
43
  onClose: () => void;
44
44
  visible: boolean;
45
45
  zIndex?: number;
46
+ limit?: number;
46
47
  }
47
48
  export declare const ProductPickerModal: (props: ProductPickerInterface) => JSX.Element;
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import{useReducer as c,useState as l,useEffect as s}from"react";import{Button as r}from"../button/Button.js";import{StyledModal as n}from"../modals/styledModal.js";import{CollectionsScreen as d}from"./collectionScreen.js";import{ProductsScreen as i}from"./productScreen.js";import{collectionsReducer as a,selectedColectionsReducer as p,CollectionIdContext as u}from"./reducers.js";import{SelectedScreen as h}from"./selectedScreen.js";import{ContainerStyle as m,ScrollContainerStyle as v}from"./style.js";const b=b=>{const{storeId:y,selectedItems:f,onClose:j,visible:C,zIndex:g}=b;console.log("selectedItems",f);const[S,I]=c(a,{}),[x,D]=l("collections"),[k,F]=l(""),[O,T]=l(0),[w,P]=c(p,Object.keys(f).length>0?f:{});console.log("selectedCollections",w),s((()=>{A(!0),b.collectionFetcher(O,y).then((e=>{I({type:"fetched",data:(null==e?void 0:e.collections)||{}}),A(!1),T((e=>e+1))})).catch()}),[]);const[E,A]=l(!1),[z,B]=l(0);s((()=>{let e=0;Object.keys(w||[]).forEach((t=>{var o;Object.keys((null===(o=w[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,l;Object.keys((null===(l=null===(c=w[t].products)||void 0===c?void 0:c[o])||void 0===l?void 0:l.variants)||[]).forEach((()=>{e+=1}))}))})),B(e)})),s((()=>{var e;k&&!(null===(e=null==S?void 0:S[k])||void 0===e?void 0:e.products)&&(A(!0),b.productFetcher(k,y).then((e=>{Object.keys(e).length&&(I({type:"productsFetched",data:{collectionId:k,products:e}}),A(!1))})).catch())}),[k]);const G=()=>{P({type:"reset",data:{}})};return e(n,Object.assign({zIndex:g,open:C,onClose:()=>{j(),G()},headingTitle:"collections"===x?"Select Products":"products"===x?S[k].name:"view"===x?"Selected Products":void 0,footerShadow:!0,centralContainerStyles:{width:"480px"},primaryButton:{buttonText:E?"Loading...":"Add",disabled:E,onClick:()=>{b.onAdd(w,z),G()}},footerLeftCustomElement:e(t,{children:e(r,z>0?{onClick:()=>{D("view")},buttonText:`${z} products selected`,buttonType:"tertiaryGray"}:{disabled:!0,buttonText:`${z} products selected`,buttonType:"tertiaryGray"})})},{children:e(m,{children:o(v,{children:["collections"===x&&e(d,{collections:S,selectedCollectionsDispatch:P,setCollectionId:F,setScreen:D,selectedCollections:w,collectionFetcher:b.collectionFetcher,storeId:y,collectionsDispatch:I,setSaveDisabled:A,pagingControls:{curPage:O,setCurPage:T}}),"products"===x&&k&&e(u.Provider,Object.assign({value:k},{children:e(i,{productFetcher:b.productFetcher,setScreen:D,storeId:y,data:S[k],collectionsDispatch:I,selectedCollectionsDispatch:P,selectedData:w,setSaveDisabled:A})})),"view"===x&&e(h,{selectedCollections:w||{},selectedCollectionsDispatch:P,upliftAdditions:null,setScreen:D,collections:S})]})})}))};export{b as ProductPickerModal};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useReducer as o,useState as c,useEffect as l}from"react";import{Button as s}from"../button/Button.js";import{StyledModal as r}from"../modals/styledModal.js";import{Tag as i}from"../tag/Tag.js";import{CollectionsScreen as n}from"./collectionScreen.js";import{ProductsScreen as d}from"./productScreen.js";import{collectionsReducer as a,selectedColectionsReducer as p,CollectionIdContext as u}from"./reducers.js";import{SelectedScreen as h}from"./selectedScreen.js";import{ContainerStyle as m,ScrollContainerStyle as v}from"./style.js";const y=y=>{const{storeId:b,selectedItems:f,onClose:j,visible:g,zIndex:C,limit:S}=y,[x,D]=o(a,{}),[I,T]=c("collections"),[k,F]=c(""),[O,w]=c(0),[P,E]=c(!1),[A,$]=c(0),[z,B]=o(p,Object.keys(f).length>0?f:{});l((()=>{E(!0),y.collectionFetcher(O,b).then((e=>{D({type:"fetched",data:(null==e?void 0:e.collections)||{}}),E(!1),w((e=>e+1))})).catch()}),[]),l((()=>{let e=0;Object.keys(z||[]).forEach((t=>{var o;Object.keys((null===(o=z[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,l;Object.keys((null===(l=null===(c=z[t].products)||void 0===c?void 0:c[o])||void 0===l?void 0:l.variants)||[]).forEach((()=>{e+=1}))}))})),$(e)})),l((()=>{var e;k&&!(null===(e=null==x?void 0:x[k])||void 0===e?void 0:e.products)&&(E(!0),y.productFetcher(k,b).then((e=>{Object.keys(e).length&&(D({type:"productsFetched",data:{collectionId:k,products:e}}),E(!1))})).catch())}),[k]);const G=()=>{B({type:"reset",data:{}})};return e(r,Object.assign({zIndex:C,open:g,onClose:()=>{j(),G()},headingTitle:"collections"===I?"Select Products":"products"===I?x[k].name:"view"===I?"Selected Products":void 0,footerShadow:!0,centralContainerStyles:{width:"480px"},primaryButton:{buttonText:P?"Loading...":"Add",disabled:P||S&&A>S||!1,onClick:()=>{y.onAdd(z,A),G()}},footerLeftCustomElement:S&&A>S?e(i,{tagText:`You can only select ${S} products`,type:"negative"}):e(s,A>0?{onClick:()=>{T("view")},buttonText:`${A} products selected`,buttonType:"tertiaryGray"}:{disabled:!0,buttonText:`${A} products selected`,buttonType:"tertiaryGray"})},{children:e(m,{children:t(v,{children:["collections"===I&&e(n,{collections:x,selectedCollectionsDispatch:B,setCollectionId:F,setScreen:T,selectedCollections:z,collectionFetcher:y.collectionFetcher,storeId:b,collectionsDispatch:D,setSaveDisabled:E,pagingControls:{curPage:O,setCurPage:w}}),"products"===I&&k&&e(u.Provider,Object.assign({value:k},{children:e(d,{productFetcher:y.productFetcher,setScreen:T,storeId:b,data:x[k],collectionsDispatch:D,selectedCollectionsDispatch:B,selectedData:z,setSaveDisabled:E})})),"view"===I&&e(h,{selectedCollections:z||{},selectedCollectionsDispatch:B,upliftAdditions:null,setScreen:T,collections:x})]})})}))};export{y as ProductPickerModal};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const WorkingStepper: () => JSX.Element;
2
3
  export declare enum STEPENUM {
3
4
  STEP1 = "STEP1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.159-beta.2",
3
+ "version": "0.0.159-beta.3",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",