@bikdotai/bik-component-library 0.0.344-beta-relative → 0.0.345

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 (41) hide show
  1. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  2. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  3. package/dist/cjs/components/bik-layout/ShowShopifyRestrictedModal.d.ts +2 -1
  4. package/dist/cjs/components/bik-layout/ShowShopifyRestrictedModal.js +1 -1
  5. package/dist/cjs/components/button/Button.js +1 -1
  6. package/dist/cjs/components/datePicker/DatePicker.js +1 -1
  7. package/dist/cjs/components/discount-modal/DiscountModal.d.ts +9 -0
  8. package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
  9. package/dist/cjs/components/discount-modal/DiscountUtils.d.ts +2 -0
  10. package/dist/cjs/components/discount-modal/DiscountUtils.js +1 -1
  11. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +3 -1
  12. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  13. package/dist/cjs/components/discount-modal/StaticCoupon/StaticCoupon.js +1 -1
  14. package/dist/cjs/components/discount-modal/type.d.ts +11 -2
  15. package/dist/cjs/components/discount-modal/type.js +1 -1
  16. package/dist/cjs/components/input/Input.js +1 -1
  17. package/dist/cjs/components/product-picker-v2/modal.d.ts +4 -0
  18. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  19. package/dist/cjs/components/product-picker-v2/productScreen.d.ts +4 -0
  20. package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
  21. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  22. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  23. package/dist/esm/components/bik-layout/ShowShopifyRestrictedModal.d.ts +2 -1
  24. package/dist/esm/components/bik-layout/ShowShopifyRestrictedModal.js +1 -1
  25. package/dist/esm/components/button/Button.js +1 -1
  26. package/dist/esm/components/datePicker/DatePicker.js +1 -1
  27. package/dist/esm/components/discount-modal/DiscountModal.d.ts +9 -0
  28. package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
  29. package/dist/esm/components/discount-modal/DiscountUtils.d.ts +2 -0
  30. package/dist/esm/components/discount-modal/DiscountUtils.js +1 -1
  31. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +3 -1
  32. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  33. package/dist/esm/components/discount-modal/StaticCoupon/StaticCoupon.js +1 -1
  34. package/dist/esm/components/discount-modal/type.d.ts +11 -2
  35. package/dist/esm/components/discount-modal/type.js +1 -1
  36. package/dist/esm/components/input/Input.js +1 -1
  37. package/dist/esm/components/product-picker-v2/modal.d.ts +4 -0
  38. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  39. package/dist/esm/components/product-picker-v2/productScreen.d.ts +4 -0
  40. package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
  41. package/package.json +1 -1
@@ -1 +1 @@
1
- import{jsxs as t,jsx as o,Fragment as e}from"react/jsx-runtime";import i from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import d from"../../assets/icons/search.svg.js";import{cloneDeep as l}from"lodash";import{useContext as n,useState as r,useEffect as s}from"react";import{Tag as a}from"../tag/Tag.js";import{COLORS as u}from"../../constants/Theme.js";import{CheckBox as p}from"../checkBox/CheckBox.js";import{IconButton as h}from"../icon-button/IconButton.js";import{Input as v}from"../input/Input.js";import{BikShimmer as m}from"../shimmer/ShimmerComponent/BikShimmer.js";import{ShimmerImage as f}from"../shimmer-image/ShimmerImage.js";import{Spinner as y}from"../spinner/Spinner.js";import{BodyCaption as g,TitleRegular as j}from"../TypographyStyle.js";import{truncate as b}from"./collectionScreen.js";import{EmptyState as k}from"./emptyState.js";import{ProductHelper as I}from"./helpers/ProductHelper.js";import{CollectionIdContext as O}from"./reducers.js";import{ProductScreenHeader as C,ProductScreenCollectionCardStyle as x,ProductCardStyle as S}from"./style.js";import{OUT_OF_STOCK_ACTION as P}from"./type.js";import{liftTheStateUp as w}from"./utility.js";const D=e=>{const a=n(O),{data:f,collectionsDispatch:b,selectedData:I,selectedCollectionsDispatch:S,productFetcher:D,storeId:A,setScreen:T,setSaveDisabled:B,hideInCollectionSearch:V,customCollectionRestriction:R,hideProductCheckbox:U,outOfStockAction:F=P.BLUR}=e,[H,L]=r(""),[W,z]=r(!1),[K,N]=r(f);s((()=>{const t=setTimeout((()=>{H.length?(z(!0),e.searchInCollectionFetcher(A,a,H).then((t=>{var o;const e=l(f);e.products={};for(const i of t)(null===(o=null==f?void 0:f.products)||void 0===o?void 0:o[i])&&(e.products[i]=f.products[i]);N(e),B(!1),z(!1)}))):N(f)}),800);return()=>clearTimeout(t)}),[H]);const _=!!R&&f.isSmartCollection,q=t=>{var o,e,i,c,d,l,n,r;let s=0,u=0;return!!((null===(e=null===(o=null==I?void 0:I[a])||void 0===o?void 0:o.products)||void 0===e?void 0:e[t])&&(null===(d=Object.keys((null===(c=null===(i=null==f?void 0:f.products)||void 0===i?void 0:i[t])||void 0===c?void 0:c.variants)||[]))||void 0===d||d.forEach((()=>u++)),Object.keys((null===(r=null===(n=null===(l=null==I?void 0:I[a])||void 0===l?void 0:l.products)||void 0===n?void 0:n[t])||void 0===r?void 0:r.variants)||[]).forEach((()=>s++)),s>0&&u!==s))};s((()=>{(null==f?void 0:f.products)||G()}),[]);const G=()=>{B(!0),z(!0),D(a,A).then((t=>{Object.keys(t).length&&(b({type:"productsFetched",data:{collectionId:a,products:t}}),N(Object.assign(Object.assign({},K),{products:t}))),B(!1),z(!1)})).catch()},J=(t,o)=>{const e=w(o,f);S({type:t,data:Object.assign(Object.assign({},e),{isRestricted:R})})};return t("div",{children:[t(C,{children:[o(h,{Icon:i,height:16,onClick:()=>{T("collections")}}),o(g,Object.assign({style:{color:u.content.secondary}},{children:f.name}))]}),!V&&o("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:o(v,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>W&&H.length?o(y,{size:"small",color:u.content.primary}):o(d,{})},id:"listInput",height:"24px",type:"text",value:H,onChangeText:t=>{t.length&&t.trim().length?L(t):L("")},placeholder:"Search products in this collection..."})})),t("div",{children:[Object.keys((null==K?void 0:K.products)||[]).length>0&&!_&&!H.length&&!U&&t(x,{children:[o(p,{isChecked:!!(null==I?void 0:I[a]),isPartiallyChecked:(t=>{var o;let e=0,i=0;if(I[t]){const c=null==f?void 0:f.products;c&&Object.keys(c).forEach((t=>{var o;const i=null===(o=c[t])||void 0===o?void 0:o.variants;i&&Object.keys(i).forEach((t=>e+=1))}));const d=null===(o=I[t])||void 0===o?void 0:o.products;return d&&Object.keys(d).forEach((t=>{var o;const e=null===(o=d[t])||void 0===o?void 0:o.variants;e&&Object.keys(e).forEach((()=>i+=1))})),i>0&&e!==i}return!1})(a),onValueChange:function(t){S(t?{type:"selected",data:{id:a,val:f}}:{type:"unselected",data:{id:a}})}}),o("div",Object.assign({style:{width:40,height:40}},{children:o(c,{})})),o(j,{children:"All Products"})]}),Object.keys((null==K?void 0:K.products)||[]).length?Object.keys(K.products||[]).map((t=>o(E,{outOfStockAction:F,collectionId:a,isProductPartiallyChecked:q(t),productId:t,data:K.products[t],selectedData:I,selectedCollectionsDispatch:S,viewOnly:!!_,upliftAdditions:J,hideProductCheckbox:U},t))):W?[1,2,3,4,5,6,7,8,9,10].map(((t,e)=>o("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:o(m,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),e))):o(k,{title:"No products to show",subtitle:H.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]})]})},E=e=>{const{collectionId:i,productId:c,data:d,selectedData:l,selectedCollectionsDispatch:n,viewOnly:r,upliftAdditions:s,isProductPartiallyChecked:a,hideProductCheckbox:u,outOfStockAction:p}=e,h=t=>{var o,e,d,n,r,s;if(!(null===(e=null===(o=null==l?void 0:l[i])||void 0===o?void 0:o.products)||void 0===e?void 0:e[c]))return!1;return!!(null===(s=null===(r=null===(n=null===(d=null==l?void 0:l[i])||void 0===d?void 0:d.products)||void 0===n?void 0:n[c])||void 0===r?void 0:r.variants)||void 0===s?void 0:s[t])};return t("div",{children:[o(A,{isVariant:!1,data:d,productId:c,collectionId:i,isSelected:!!(null===(m=null===(v=null==l?void 0:l[i])||void 0===v?void 0:v.products)||void 0===m?void 0:m[c]),isPartiallyChecked:a,selectedCollectionsDispatch:n,upliftAdditions:s,viewOnly:r,hideProductCheckbox:u},c),Object.keys(d.variants||[]).map((t=>o(A,{isVariant:!0,data:d.variants[t],variantId:t,productId:c,viewOnly:r,upliftAdditions:s,collectionId:i,isSelected:h(t),selectedCollectionsDispatch:n,outOfStockAction:p},t)))]});var v,m},A=i=>{const{isVariant:c,data:d,productId:l,collectionId:n,variantId:r,isSelected:s,selectedCollectionsDispatch:u,viewOnly:h,upliftAdditions:v,isPartiallyChecked:m,hideProductCheckbox:y,outOfStockAction:g}=i,k=I.getProductLabels(d,g);return t(S,Object.assign({isVariant:c},{children:[y||h?o(e,{}):o(p,{isChecked:s,isPartiallyChecked:m||!1,onValueChange:function(t){c?t?v("variantSelected",{productId:l,variantId:r,collectionId:n,variant:d}):u({type:"variantUnselected",data:{productId:l,variantId:r,collectionId:n}}):t?v("productSelected",{productId:l,collectionId:n,product:d}):u({type:"productUnselected",data:{productId:l,collectionId:n}})}}),o("div",{children:o(f,{width:40,height:40,imageUrl:d.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[o(j,{children:b(d.name,40,!0)}),k?o("div",Object.assign({style:{width:90,display:"flex"}},{children:o(a,{tagText:k,type:"warning",theme:"light"})})):o(e,{})]}))]}))};export{A as ProductCard,E as ProductGroup,D as ProductsScreen};
1
+ import{jsxs as t,jsx as e,Fragment as o}from"react/jsx-runtime";import i from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import d from"../../assets/icons/search.svg.js";import{cloneDeep as l}from"lodash";import{useContext as n,useState as r,useEffect as s}from"react";import{Tag as a}from"../tag/Tag.js";import{COLORS as u}from"../../constants/Theme.js";import{CheckBox as h}from"../checkBox/CheckBox.js";import{IconButton as p}from"../icon-button/IconButton.js";import{Input as v}from"../input/Input.js";import{BikShimmer as m}from"../shimmer/ShimmerComponent/BikShimmer.js";import{ShimmerImage as f}from"../shimmer-image/ShimmerImage.js";import{Spinner as y}from"../spinner/Spinner.js";import{BodyCaption as g,TitleRegular as b}from"../TypographyStyle.js";import{truncate as j}from"./collectionScreen.js";import{EmptyState as k}from"./emptyState.js";import{ProductHelper as C}from"./helpers/ProductHelper.js";import{CollectionIdContext as I}from"./reducers.js";import{ProductScreenHeader as O,ProductScreenCollectionCardStyle as x,ProductCardStyle as S}from"./style.js";import{OUT_OF_STOCK_ACTION as P}from"./type.js";import{liftTheStateUp as w}from"./utility.js";const D=o=>{const a=n(I),{data:f,collectionsDispatch:j,selectedData:C,selectedCollectionsDispatch:S,productFetcher:D,storeId:V,setScreen:A,setSaveDisabled:T,hideInCollectionSearch:B,customCollectionRestriction:F,hideProductCheckbox:R,outOfStockAction:U=P.BLUR,hideVariantCheckbox:H=!1,selectProductsFromCustomCollection:L=!1}=o,[W,z]=r(""),[K,N]=r(!1),[_,q]=r(f);s((()=>{const t=setTimeout((()=>{W.length?(N(!0),o.searchInCollectionFetcher(V,a,W).then((t=>{var e;const o=l(f);o.products={};for(const i of t)(null===(e=null==f?void 0:f.products)||void 0===e?void 0:e[i])&&(o.products[i]=f.products[i]);q(o),T(!1),N(!1)}))):q(f)}),800);return()=>clearTimeout(t)}),[W]);const G=!!F&&f.isSmartCollection,J=t=>{var e,o,i,c,d,l,n,r;let s=0,u=0;return!!((null===(o=null===(e=null==C?void 0:C[a])||void 0===e?void 0:e.products)||void 0===o?void 0:o[t])&&(null===(d=Object.keys((null===(c=null===(i=null==f?void 0:f.products)||void 0===i?void 0:i[t])||void 0===c?void 0:c.variants)||[]))||void 0===d||d.forEach((()=>u++)),Object.keys((null===(r=null===(n=null===(l=null==C?void 0:C[a])||void 0===l?void 0:l.products)||void 0===n?void 0:n[t])||void 0===r?void 0:r.variants)||[]).forEach((()=>s++)),s>0&&u!==s))};s((()=>{(null==f?void 0:f.products)||M()}),[]);const M=()=>{T(!0),N(!0),D(a,V).then((t=>{Object.keys(t).length&&(j({type:"productsFetched",data:{collectionId:a,products:t}}),q(Object.assign(Object.assign({},_),{products:t}))),T(!1),N(!1)})).catch()},Q=(t,e)=>{const o=w(e,f);S({type:t,data:Object.assign(Object.assign({},o),{isRestricted:F})})};return t("div",{children:[t(O,{children:[e(p,{Icon:i,height:16,onClick:()=>{A("collections")}}),e(g,Object.assign({style:{color:u.content.secondary}},{children:f.name}))]}),!B&&e("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e(v,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>K&&W.length?e(y,{size:"small",color:u.content.primary}):e(d,{})},id:"listInput",height:"24px",type:"text",value:W,onChangeText:t=>{t.length&&t.trim().length?z(t):z("")},placeholder:"Search products in this collection..."})})),t("div",{children:[Object.keys((null==_?void 0:_.products)||[]).length>0&&!G&&!W.length&&!R&&t(x,{children:[e(h,{isChecked:!!(null==C?void 0:C[a]),isPartiallyChecked:(t=>{var e;let o=0,i=0;if(C[t]){const c=null==f?void 0:f.products;c&&Object.keys(c).forEach((t=>{var e;const i=null===(e=c[t])||void 0===e?void 0:e.variants;i&&Object.keys(i).forEach((t=>o+=1))}));const d=null===(e=C[t])||void 0===e?void 0:e.products;return d&&Object.keys(d).forEach((t=>{var e;const o=null===(e=d[t])||void 0===e?void 0:e.variants;o&&Object.keys(o).forEach((()=>i+=1))})),i>0&&o!==i}return!1})(a),onValueChange:function(t){S(t?{type:"selected",data:{id:a,val:f}}:{type:"unselected",data:{id:a}})}}),e("div",Object.assign({style:{width:40,height:40}},{children:e(c,{})})),e(b,{children:"All Products"})]}),Object.keys((null==_?void 0:_.products)||[]).length?Object.keys(_.products||[]).map((t=>e(E,{outOfStockAction:U,collectionId:a,isProductPartiallyChecked:J(t),productId:t,data:_.products[t],selectedData:C,selectedCollectionsDispatch:S,viewOnly:!L&&!!G,upliftAdditions:Q,hideProductCheckbox:R,hideVariantCheckbox:H},t))):K?[1,2,3,4,5,6,7,8,9,10].map(((t,o)=>e("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e(m,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o))):e(k,{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."})]})]})},E=o=>{const{collectionId:i,productId:c,data:d,selectedData:l,selectedCollectionsDispatch:n,viewOnly:r,upliftAdditions:s,isProductPartiallyChecked:a,hideProductCheckbox:u,outOfStockAction:h,hideVariantCheckbox:p}=o,v=t=>{var e,o,d,n,r,s;if(!(null===(o=null===(e=null==l?void 0:l[i])||void 0===e?void 0:e.products)||void 0===o?void 0:o[c]))return!1;return!!(null===(s=null===(r=null===(n=null===(d=null==l?void 0:l[i])||void 0===d?void 0:d.products)||void 0===n?void 0:n[c])||void 0===r?void 0:r.variants)||void 0===s?void 0:s[t])};return t("div",{children:[e(V,{isVariant:!1,data:d,productId:c,collectionId:i,isSelected:!!(null===(f=null===(m=null==l?void 0:l[i])||void 0===m?void 0:m.products)||void 0===f?void 0:f[c]),isPartiallyChecked:a,selectedCollectionsDispatch:n,upliftAdditions:s,viewOnly:r,hideProductCheckbox:u,hideVariantCheckbox:p},c),Object.keys(d.variants||[]).map((t=>e(V,{isVariant:!0,hideVariantCheckbox:p,data:d.variants[t],variantId:t,productId:c,viewOnly:r,upliftAdditions:s,collectionId:i,isSelected:v(t),selectedCollectionsDispatch:n,outOfStockAction:h},t)))]});var m,f},V=i=>{const{isVariant:c,data:d,productId:l,collectionId:n,variantId:r,isSelected:s,selectedCollectionsDispatch:u,viewOnly:p,upliftAdditions:v,isPartiallyChecked:m,hideProductCheckbox:y,outOfStockAction:g,hideVariantCheckbox:k}=i,I=C.getProductLabels(d,g);return t(S,Object.assign({isVariant:c},{children:[c&&!p&&!k||!c&&!p&&!y?e(h,{isChecked:s,isPartiallyChecked:m||!1,onValueChange:function(t){c?t?v("variantSelected",{productId:l,variantId:r,collectionId:n,variant:d}):u({type:"variantUnselected",data:{productId:l,variantId:r,collectionId:n}}):t?v("productSelected",{productId:l,collectionId:n,product:d}):u({type:"productUnselected",data:{productId:l,collectionId:n}})}}):e(o,{}),e("div",{children:e(f,{width:40,height:40,imageUrl:d.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[e(b,{children:j(d.name,40,!0)}),I?e("div",Object.assign({style:{width:90,display:"flex"}},{children:e(a,{tagText:I,type:"warning",theme:"light"})})):e(o,{})]}))]}))};export{V as ProductCard,E as ProductGroup,D as ProductsScreen};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.344-beta-relative",
3
+ "version": "0.0.345",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",