@bikdotai/bik-component-library 0.0.331-discount-modal-beta-5 → 0.0.331

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 (51) hide show
  1. package/dist/cjs/components/QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js +2 -2
  2. package/dist/cjs/components/QueryBuilder/components/Connectors/Components/NumberTime.js +1 -1
  3. package/dist/cjs/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.js +1 -1
  4. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  5. package/dist/cjs/components/colourInput/ColourInput.js +1 -1
  6. package/dist/cjs/components/discount-modal/DiscountModal.d.ts +0 -7
  7. package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
  8. package/dist/cjs/components/discount-modal/DiscountUtils.d.ts +0 -2
  9. package/dist/cjs/components/discount-modal/DiscountUtils.js +1 -1
  10. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +0 -1
  11. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  12. package/dist/cjs/components/discount-modal/StaticCoupon/StaticCoupon.js +1 -1
  13. package/dist/cjs/components/discount-modal/type.d.ts +2 -11
  14. package/dist/cjs/components/discount-modal/type.js +1 -1
  15. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
  16. package/dist/cjs/components/dropdown/type.d.ts +0 -1
  17. package/dist/cjs/components/input/Input.js +1 -1
  18. package/dist/cjs/components/product-picker-v2/modal.d.ts +0 -7
  19. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  20. package/dist/cjs/components/product-picker-v2/productScreen.d.ts +0 -8
  21. package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
  22. package/dist/esm/components/QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js +2 -2
  23. package/dist/esm/components/QueryBuilder/components/Connectors/Components/NumberTime.js +1 -1
  24. package/dist/esm/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.js +1 -1
  25. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  26. package/dist/esm/components/colourInput/ColourInput.js +1 -1
  27. package/dist/esm/components/discount-modal/DiscountModal.d.ts +0 -7
  28. package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
  29. package/dist/esm/components/discount-modal/DiscountUtils.d.ts +0 -2
  30. package/dist/esm/components/discount-modal/DiscountUtils.js +1 -1
  31. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +0 -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 +2 -11
  35. package/dist/esm/components/discount-modal/type.js +1 -1
  36. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
  37. package/dist/esm/components/dropdown/type.d.ts +0 -1
  38. package/dist/esm/components/input/Input.js +1 -1
  39. package/dist/esm/components/product-picker-v2/modal.d.ts +0 -7
  40. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  41. package/dist/esm/components/product-picker-v2/productScreen.d.ts +0 -8
  42. package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
  43. package/package.json +1 -1
  44. package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.d.ts +0 -33
  45. package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.js +0 -1
  46. package/dist/cjs/components/product-picker-v2/type.d.ts +0 -6
  47. package/dist/cjs/components/product-picker-v2/type.js +0 -1
  48. package/dist/esm/components/product-picker-v2/helpers/ProductHelper.d.ts +0 -33
  49. package/dist/esm/components/product-picker-v2/helpers/ProductHelper.js +0 -1
  50. package/dist/esm/components/product-picker-v2/type.d.ts +0 -6
  51. package/dist/esm/components/product-picker-v2/type.js +0 -1
@@ -1 +1 @@
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};
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 d from"../../assets/icons/box.svg.js";import c 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 y}from"../shimmer-image/ShimmerImage.js";import{Spinner as g}from"../spinner/Spinner.js";import{BodyCaption as f,TitleRegular as j}from"../TypographyStyle.js";import{truncate as b}from"./collectionScreen.js";import{EmptyState as I}from"./emptyState.js";import{CollectionIdContext as k}from"./reducers.js";import{ProductScreenHeader as C,ProductScreenCollectionCardStyle as O,ProductCardStyle as x}from"./style.js";import{liftTheStateUp as S}from"./utility.js";const P=o=>{const a=n(k),{data:y,collectionsDispatch:b,selectedData:x,selectedCollectionsDispatch:P,productFetcher:E,storeId:D,setScreen:T,setSaveDisabled:A,hideInCollectionSearch:B,customCollectionRestriction:V,hideProductCheckbox:F}=o,[R,U]=r(""),[q,W]=r(!1),[z,H]=r(y);s((()=>{const t=setTimeout((()=>{R.length?(W(!0),o.searchInCollectionFetcher(D,a,R).then((t=>{var e;const o=l(y);o.products={};for(const i of t)(null===(e=null==y?void 0:y.products)||void 0===e?void 0:e[i])&&(o.products[i]=y.products[i]);H(o),A(!1),W(!1)}))):H(y)}),800);return()=>clearTimeout(t)}),[R]);const N=!!V&&y.isSmartCollection,_=t=>{var e,o,i,d,c,l,n,r;let s=0,u=0;return!!((null===(o=null===(e=null==x?void 0:x[a])||void 0===e?void 0:e.products)||void 0===o?void 0:o[t])&&(null===(c=Object.keys((null===(d=null===(i=null==y?void 0:y.products)||void 0===i?void 0:i[t])||void 0===d?void 0:d.variants)||[]))||void 0===c||c.forEach((()=>u++)),Object.keys((null===(r=null===(n=null===(l=null==x?void 0:x[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==y?void 0:y.products)||G()}),[]);const G=()=>{A(!0),W(!0),E(a,D).then((t=>{Object.keys(t).length&&(b({type:"productsFetched",data:{collectionId:a,products:t}}),H(Object.assign(Object.assign({},z),{products:t}))),A(!1),W(!1)})).catch()},J=(t,e)=>{const o=S(e,y);P({type:t,data:Object.assign(Object.assign({},o),{isRestricted:V})})};return t("div",{children:[t(C,{children:[e(p,{Icon:i,height:16,onClick:()=>{T("collections")}}),e(f,Object.assign({style:{color:u.content.secondary}},{children:y.name}))]}),!B&&e("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e(v,{noErrorHint:!0,rightIcon:{icon:()=>q&&R.length?e(g,{size:"small",color:u.content.primary}):e(c,{})},id:"listInput",height:"24px",type:"text",value:R,onChangeText:t=>{t.length&&t.trim().length&&U(t)},placeholder:"Search products in this collection..."})})),t("div",{children:[Object.keys((null==z?void 0:z.products)||[]).length>0&&!N&&!R.length&&!F&&t(O,{children:[e(h,{isChecked:!!(null==x?void 0:x[a]),isPartiallyChecked:(t=>{var e;let o=0,i=0;if(x[t]){const d=null==y?void 0:y.products;d&&Object.keys(d).forEach((t=>{var e;const i=null===(e=d[t])||void 0===e?void 0:e.variants;i&&Object.keys(i).forEach((t=>o+=1))}));const c=null===(e=x[t])||void 0===e?void 0:e.products;return c&&Object.keys(c).forEach((t=>{var e;const o=null===(e=c[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){P(t?{type:"selected",data:{id:a,val:y}}:{type:"unselected",data:{id:a}})}}),e("div",Object.assign({style:{width:40,height:40}},{children:e(d,{})})),e(j,{children:"All Products"})]}),Object.keys((null==z?void 0:z.products)||[]).length?Object.keys(z.products||[]).map((t=>e(w,{collectionId:a,isProductPartiallyChecked:_(t),productId:t,data:z.products[t],selectedData:x,selectedCollectionsDispatch:P,viewOnly:!!N,upliftAdditions:J,hideProductCheckbox:F},t))):q?[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(I,{title:"No products to show",subtitle:R.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]})]})},w=o=>{const{collectionId:i,productId:d,data:c,selectedData:l,selectedCollectionsDispatch:n,viewOnly:r,upliftAdditions:s,isProductPartiallyChecked:a,hideProductCheckbox:u}=o,h=t=>{var e,o,c,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[d]))return!1;return!!(null===(s=null===(r=null===(n=null===(c=null==l?void 0:l[i])||void 0===c?void 0:c.products)||void 0===n?void 0:n[d])||void 0===r?void 0:r.variants)||void 0===s?void 0:s[t])};return t("div",{children:[e(E,{isVariant:!1,data:c,productId:d,collectionId:i,isSelected:!!(null===(v=null===(p=null==l?void 0:l[i])||void 0===p?void 0:p.products)||void 0===v?void 0:v[d]),isPartiallyChecked:a,selectedCollectionsDispatch:n,upliftAdditions:s,viewOnly:r,hideProductCheckbox:u},d),Object.keys(c.variants||[]).map((t=>e(E,{isVariant:!0,data:c.variants[t],variantId:t,productId:d,viewOnly:r,upliftAdditions:s,collectionId:i,isSelected:h(t),selectedCollectionsDispatch:n},t)))]});var p,v},E=i=>{const{isVariant:d,data:c,productId:l,collectionId:n,variantId:r,isSelected:s,selectedCollectionsDispatch:u,viewOnly:p,upliftAdditions:v,isPartiallyChecked:m,hideProductCheckbox:g}=i,f=c;return t(x,Object.assign({isVariant:d},{children:[g||p?e(o,{}):e(h,{isChecked:s,isPartiallyChecked:m||!1,onValueChange:function(t){d?t?v("variantSelected",{productId:l,variantId:r,collectionId:n,variant:c}):u({type:"variantUnselected",data:{productId:l,variantId:r,collectionId:n}}):t?v("productSelected",{productId:l,collectionId:n,product:c}):u({type:"productUnselected",data:{productId:l,collectionId:n}})}}),e("div",{children:e(y,{width:40,height:40,imageUrl:c.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[e(j,{children:b(c.name,40,!0)}),0===(null==f?void 0:f.quantity)||-2===(null==f?void 0:f.quantity)?e("div",Object.assign({style:{width:90}},{children:e(a,{tagText:"Out of stock",type:"warning"})})):e(o,{})]}))]}))};export{E as ProductCard,w as ProductGroup,P as ProductsScreen};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.331-discount-modal-beta-5",
3
+ "version": "0.0.331",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,33 +0,0 @@
1
- import { Product, ProductVariant } from '../modal';
2
- import { OUT_OF_STOCK_ACTION } from '../type';
3
- export declare class ProductHelper {
4
- /**
5
- * how to know if a product is out of stock? currentCombination.quantity === 0 (OOS)
6
- * how to know if a product is hidden ? skipSync === true (not-synced)
7
- *
8
- * if outOfStockAction === OUT_OF_STOCK_ACTION.HIDE
9
- * - not-synced && OOS => NOT_SYNCED
10
- * - not-synced && !OOS => NOT_SYNCED
11
- * - !not-synced && OOS => NOT_SYNCED
12
- * - !not-synced && !OOS => NORMAL
13
- *
14
- *
15
- * if outOfStockAction === OUT_OF_STOCK_ACTION.BLUR
16
- * - not-synced && OOS => NOT_SYNCED
17
- * - not-synced && !OOS => NOT_SYNCED
18
- * - !not-synced && OOS => OUT_OF_STOCK
19
- * - !not-synced && !OOS => NORMAL
20
- *
21
- *
22
- * if outOfStockAction === OUT_OF_STOCK_ACTION.NORMAL
23
- * - not-synced && OOS => NOT_SYNCED
24
- * - not-synced && !OOS => NOT_SYNCED
25
- * - !not-synced && OOS => NORMAL
26
- * - !not-synced && !OOS => NORMAL
27
- *
28
- * @param product
29
- * @param currentCombination
30
- * @param outOfStockAction
31
- */
32
- static getProductLabels(productVariant: Product | ProductVariant, outOfStockAction?: OUT_OF_STOCK_ACTION): string | null;
33
- }
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("../type.js");const t={NORMAL:null,NOT_SYNCED:"Hidden",OUT_OF_STOCK:"Out of Stock"};exports.ProductHelper=class{static getProductLabels(i){let u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.OUT_OF_STOCK_ACTION.NORMAL,l="NORMAL";if(i.variants)return t[l];const O=i;return u===n.OUT_OF_STOCK_ACTION.HIDE&&(!O.skipSync||0!==(null==O?void 0:O.quantity)&&-2!==(null==O?void 0:O.quantity)||(l="NOT_SYNCED"),O.skipSync&&0!==(null==O?void 0:O.quantity)&&-2!==(null==O?void 0:O.quantity)&&(l="NOT_SYNCED"),O.skipSync||0!==(null==O?void 0:O.quantity)&&-2!==(null==O?void 0:O.quantity)||(l="NOT_SYNCED"),O.skipSync||0===(null==O?void 0:O.quantity)||-2===(null==O?void 0:O.quantity)||(l="NORMAL")),u===n.OUT_OF_STOCK_ACTION.BLUR&&(!O.skipSync||0!==(null==O?void 0:O.quantity)&&-2!==(null==O?void 0:O.quantity)||(l="NOT_SYNCED"),O.skipSync&&0!==(null==O?void 0:O.quantity)&&-2!==(null==O?void 0:O.quantity)&&(l="NOT_SYNCED"),O.skipSync||0!==(null==O?void 0:O.quantity)&&-2!==(null==O?void 0:O.quantity)||(l="OUT_OF_STOCK"),O.skipSync||0===(null==O?void 0:O.quantity)||-2===(null==O?void 0:O.quantity)||(l="NORMAL")),u===n.OUT_OF_STOCK_ACTION.NORMAL&&(!O.skipSync||0!==(null==O?void 0:O.quantity)&&-2!==(null==O?void 0:O.quantity)||(l="NOT_SYNCED"),O.skipSync&&0!==(null==O?void 0:O.quantity)&&-2!==(null==O?void 0:O.quantity)&&(l="NOT_SYNCED"),O.skipSync||0!==(null==O?void 0:O.quantity)&&-2!==(null==O?void 0:O.quantity)||(l="NORMAL"),O.skipSync||0===(null==O?void 0:O.quantity)||-2===(null==O?void 0:O.quantity)||(l="NORMAL")),t[l]}};
@@ -1,6 +0,0 @@
1
- export declare enum OUT_OF_STOCK_ACTION {
2
- HIDE = "HIDE",
3
- NORMAL = "NORMAL",
4
- /** @description shows OOS label */
5
- BLUR = "BLUR"
6
- }
@@ -1 +0,0 @@
1
- "use strict";var O;Object.defineProperty(exports,"__esModule",{value:!0}),exports.OUT_OF_STOCK_ACTION=void 0,(O=exports.OUT_OF_STOCK_ACTION||(exports.OUT_OF_STOCK_ACTION={})).HIDE="HIDE",O.NORMAL="NORMAL",O.BLUR="BLUR";
@@ -1,33 +0,0 @@
1
- import { Product, ProductVariant } from '../modal';
2
- import { OUT_OF_STOCK_ACTION } from '../type';
3
- export declare class ProductHelper {
4
- /**
5
- * how to know if a product is out of stock? currentCombination.quantity === 0 (OOS)
6
- * how to know if a product is hidden ? skipSync === true (not-synced)
7
- *
8
- * if outOfStockAction === OUT_OF_STOCK_ACTION.HIDE
9
- * - not-synced && OOS => NOT_SYNCED
10
- * - not-synced && !OOS => NOT_SYNCED
11
- * - !not-synced && OOS => NOT_SYNCED
12
- * - !not-synced && !OOS => NORMAL
13
- *
14
- *
15
- * if outOfStockAction === OUT_OF_STOCK_ACTION.BLUR
16
- * - not-synced && OOS => NOT_SYNCED
17
- * - not-synced && !OOS => NOT_SYNCED
18
- * - !not-synced && OOS => OUT_OF_STOCK
19
- * - !not-synced && !OOS => NORMAL
20
- *
21
- *
22
- * if outOfStockAction === OUT_OF_STOCK_ACTION.NORMAL
23
- * - not-synced && OOS => NOT_SYNCED
24
- * - not-synced && !OOS => NOT_SYNCED
25
- * - !not-synced && OOS => NORMAL
26
- * - !not-synced && !OOS => NORMAL
27
- *
28
- * @param product
29
- * @param currentCombination
30
- * @param outOfStockAction
31
- */
32
- static getProductLabels(productVariant: Product | ProductVariant, outOfStockAction?: OUT_OF_STOCK_ACTION): string | null;
33
- }
@@ -1 +0,0 @@
1
- import{OUT_OF_STOCK_ACTION as n}from"../type.js";const i={NORMAL:null,NOT_SYNCED:"Hidden",OUT_OF_STOCK:"Out of Stock"};class t{static getProductLabels(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.NORMAL,u="NORMAL";if(t.variants)return i[u];const y=t;return l===n.HIDE&&(!y.skipSync||0!==(null==y?void 0:y.quantity)&&-2!==(null==y?void 0:y.quantity)||(u="NOT_SYNCED"),y.skipSync&&0!==(null==y?void 0:y.quantity)&&-2!==(null==y?void 0:y.quantity)&&(u="NOT_SYNCED"),y.skipSync||0!==(null==y?void 0:y.quantity)&&-2!==(null==y?void 0:y.quantity)||(u="NOT_SYNCED"),y.skipSync||0===(null==y?void 0:y.quantity)||-2===(null==y?void 0:y.quantity)||(u="NORMAL")),l===n.BLUR&&(!y.skipSync||0!==(null==y?void 0:y.quantity)&&-2!==(null==y?void 0:y.quantity)||(u="NOT_SYNCED"),y.skipSync&&0!==(null==y?void 0:y.quantity)&&-2!==(null==y?void 0:y.quantity)&&(u="NOT_SYNCED"),y.skipSync||0!==(null==y?void 0:y.quantity)&&-2!==(null==y?void 0:y.quantity)||(u="OUT_OF_STOCK"),y.skipSync||0===(null==y?void 0:y.quantity)||-2===(null==y?void 0:y.quantity)||(u="NORMAL")),l===n.NORMAL&&(!y.skipSync||0!==(null==y?void 0:y.quantity)&&-2!==(null==y?void 0:y.quantity)||(u="NOT_SYNCED"),y.skipSync&&0!==(null==y?void 0:y.quantity)&&-2!==(null==y?void 0:y.quantity)&&(u="NOT_SYNCED"),y.skipSync||0!==(null==y?void 0:y.quantity)&&-2!==(null==y?void 0:y.quantity)||(u="NORMAL"),y.skipSync||0===(null==y?void 0:y.quantity)||-2===(null==y?void 0:y.quantity)||(u="NORMAL")),i[u]}}export{t as ProductHelper};
@@ -1,6 +0,0 @@
1
- export declare enum OUT_OF_STOCK_ACTION {
2
- HIDE = "HIDE",
3
- NORMAL = "NORMAL",
4
- /** @description shows OOS label */
5
- BLUR = "BLUR"
6
- }
@@ -1 +0,0 @@
1
- var L;!function(L){L.HIDE="HIDE",L.NORMAL="NORMAL",L.BLUR="BLUR"}(L||(L={}));export{L as OUT_OF_STOCK_ACTION};