@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.
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js +2 -2
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/NumberTime.js +1 -1
- package/dist/cjs/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/cjs/components/colourInput/ColourInput.js +1 -1
- package/dist/cjs/components/discount-modal/DiscountModal.d.ts +0 -7
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/discount-modal/DiscountUtils.d.ts +0 -2
- package/dist/cjs/components/discount-modal/DiscountUtils.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +0 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/discount-modal/StaticCoupon/StaticCoupon.js +1 -1
- package/dist/cjs/components/discount-modal/type.d.ts +2 -11
- package/dist/cjs/components/discount-modal/type.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/dist/cjs/components/dropdown/type.d.ts +0 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +0 -7
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/productScreen.d.ts +0 -8
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js +2 -2
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/NumberTime.js +1 -1
- package/dist/esm/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/esm/components/colourInput/ColourInput.js +1 -1
- package/dist/esm/components/discount-modal/DiscountModal.d.ts +0 -7
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/discount-modal/DiscountUtils.d.ts +0 -2
- package/dist/esm/components/discount-modal/DiscountUtils.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +0 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/discount-modal/StaticCoupon/StaticCoupon.js +1 -1
- package/dist/esm/components/discount-modal/type.d.ts +2 -11
- package/dist/esm/components/discount-modal/type.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/dist/esm/components/dropdown/type.d.ts +0 -1
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +0 -7
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/productScreen.d.ts +0 -8
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.d.ts +0 -33
- package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.js +0 -1
- package/dist/cjs/components/product-picker-v2/type.d.ts +0 -6
- package/dist/cjs/components/product-picker-v2/type.js +0 -1
- package/dist/esm/components/product-picker-v2/helpers/ProductHelper.d.ts +0 -33
- package/dist/esm/components/product-picker-v2/helpers/ProductHelper.js +0 -1
- package/dist/esm/components/product-picker-v2/type.d.ts +0 -6
- 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
|
|
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,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 +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 +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};
|