@bikdotai/bik-component-library 0.0.679-0 → 0.0.679-10
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/redux/queryBuilder.reducer.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +11 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/cjs/components/checkBox/CheckBox.d.ts +1 -0
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/country-code-picker/CountryCodePicker.d.ts +4 -0
- package/dist/cjs/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +2 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.style.js +40 -3
- package/dist/cjs/components/data-source-panel/Modals/DescriptionModal.d.ts +8 -0
- package/dist/cjs/components/data-source-panel/Modals/DescriptionModal.js +48 -0
- package/dist/cjs/components/data-source-panel/model.d.ts +8 -0
- package/dist/cjs/components/discount-modal/DiscountModal.d.ts +2 -0
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/dropdown/ChipInput.d.ts +2 -0
- package/dist/cjs/components/dropdown/ChipInput.js +1 -1
- package/dist/cjs/components/dropdown/Common.styled.d.ts +3 -1
- package/dist/cjs/components/dropdown/Common.styled.js +4 -4
- package/dist/cjs/components/dropdown/Dropdown.d.ts +1 -0
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +4 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/cjs/components/dropdown/type.d.ts +1 -0
- package/dist/cjs/components/input/Input.d.ts +2 -0
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/modals/Modal.d.ts +2 -0
- package/dist/cjs/components/modals/Modal.js +1 -1
- package/dist/cjs/components/modals/modal.styled.d.ts +6 -0
- package/dist/cjs/components/modals/modal.styled.js +1 -1
- package/dist/cjs/components/modals/styledModal.d.ts +2 -0
- package/dist/cjs/components/modals/styledModal.js +1 -1
- package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +7 -5
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/productScreen.d.ts +5 -3
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/utility.d.ts +2 -1
- package/dist/cjs/components/product-picker-v2/utility.js +1 -1
- package/dist/cjs/components/states-modal/StateModalComponent.d.ts +1 -0
- package/dist/cjs/components/states-modal/StateModalComponent.js +1 -1
- package/dist/cjs/components/tag/Tag.d.ts +1 -1
- package/dist/cjs/components/tag/Tag.js +1 -1
- package/dist/cjs/components/tag/Tag.stories.d.ts +22 -0
- package/dist/cjs/components/tag/model.d.ts +12 -1
- package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/cjs/components/zeroState/ZeroState.d.ts +1 -0
- package/dist/cjs/components/zeroState/ZeroState.js +1 -1
- package/dist/esm/components/QueryBuilder/redux/queryBuilder.reducer.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +11 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/esm/components/checkBox/CheckBox.d.ts +1 -0
- package/dist/esm/components/checkBox/CheckBox.js +1 -1
- package/dist/esm/components/country-code-picker/CountryCodePicker.d.ts +4 -0
- package/dist/esm/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +2 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.js +40 -3
- package/dist/esm/components/data-source-panel/Modals/DescriptionModal.d.ts +8 -0
- package/dist/esm/components/data-source-panel/Modals/DescriptionModal.js +48 -0
- package/dist/esm/components/data-source-panel/model.d.ts +8 -0
- package/dist/esm/components/discount-modal/DiscountModal.d.ts +2 -0
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/dropdown/ChipInput.d.ts +2 -0
- package/dist/esm/components/dropdown/ChipInput.js +1 -1
- package/dist/esm/components/dropdown/Common.styled.d.ts +3 -1
- package/dist/esm/components/dropdown/Common.styled.js +1 -1
- package/dist/esm/components/dropdown/Dropdown.d.ts +1 -0
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +4 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/esm/components/dropdown/type.d.ts +1 -0
- package/dist/esm/components/input/Input.d.ts +2 -0
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/modals/Modal.d.ts +2 -0
- package/dist/esm/components/modals/Modal.js +1 -1
- package/dist/esm/components/modals/modal.styled.d.ts +6 -0
- package/dist/esm/components/modals/modal.styled.js +1 -1
- package/dist/esm/components/modals/styledModal.d.ts +2 -0
- package/dist/esm/components/modals/styledModal.js +1 -1
- package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +7 -5
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/productScreen.d.ts +5 -3
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/utility.d.ts +2 -1
- package/dist/esm/components/product-picker-v2/utility.js +1 -1
- package/dist/esm/components/states-modal/StateModalComponent.d.ts +1 -0
- package/dist/esm/components/states-modal/StateModalComponent.js +1 -1
- package/dist/esm/components/tag/Tag.d.ts +1 -1
- package/dist/esm/components/tag/Tag.js +1 -1
- package/dist/esm/components/tag/Tag.stories.d.ts +22 -0
- package/dist/esm/components/tag/model.d.ts +12 -1
- package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/esm/components/zeroState/ZeroState.d.ts +1 -0
- package/dist/esm/components/zeroState/ZeroState.js +5 -5
- 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"),r=require("../../assets/icons/box.svg.js"),c=require("../../assets/icons/search.svg.js"),o=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:D,hideInCollectionSearch:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("../../assets/icons/box.svg.js"),c=require("../../assets/icons/search.svg.js"),o=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:D,hideInCollectionSearch:T,customCollectionRestriction:E,hideProductCheckbox:R,outOfStockAction:V=O.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:L=!1,selectProductsFromCustomCollection:F=!1,pickerType:w,hideProductVariants:B,fbStatusFetcher:_,onProductDetailClick:U,showProductDetailInfoIcon:K,scrollContainerRef:M,appType:N}=f,H=s.useContext(g.CollectionIdContext),J=s.useRef(0),W=s.useRef(!1),[z,G]=s.useState(""),[Q,X]=s.useState(!1),[Y,Z]=s.useState(P),$=s.useRef(!0),ee=s.useRef(!1);s.useEffect((()=>{if($.current)return void($.current=!1);const e=setTimeout((()=>{z.length?(X(!0),f.searchInCollectionFetcher(q,H,z,N).then((e=>{const t=o.cloneDeep(P);t.products=e,Z(t);const r=b.getVariantIdsToFetchAtProductLevel(null!=e?e:{});re(r,null!=e?e:{},!0),D(!1),X(!1)}))):Z(P)}),800);return()=>clearTimeout(e)}),[z]);s.useEffect((()=>{var e,t,r,c;ee.current=!1,J.current=Math.floor((null===(t=Object.keys(null!==(e=P.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const o=b.getVariantIdsToFetchAtProductLevel(null!==(r=P.products)&&void 0!==r?r:{});re(o,null!==(c=P.products)&&void 0!==c?c:{})}),[H]);const te=!!E&&P.isSmartCollection;s.useEffect((()=>{(null==P?void 0:P.products)||ce(10)}),[]);const re=(e,t,r)=>{_||(r?b.markVariantsAsApprovedProductsLevel(t,x,H,Y,Z):b.markVariantsAsApprovedProductsLevel(t,x,H)),e.length>0&&_&&_(q,e,N).then((e=>{const c=Object.assign({},t);Object.keys(t).forEach((r=>{var o,s;Object.keys(null!==(s=null===(o=null==t?void 0:t[r])||void 0===o?void 0:o.variants)&&void 0!==s?s:{}).forEach((o=>{var s,n;const i=null===(s=null==t?void 0:t[r].variants)||void 0===s?void 0:s[o];i&&"REJECTED"===e[o]?i.fbStatus="REJECTED":i&&"APPROVED"===e[o]&&(i.fbStatus="APPROVED");const l=null===(n=null==c?void 0:c[r])||void 0===n?void 0:n.variants;l&&l[o]&&(l[o]=i)}))})),r?(Z((e=>{const t=Object.assign({},e);return t.products=c,t})),x({type:"productsPaged",data:{collectionId:H,products:c}})):x({type:"productsPaged",data:{collectionId:H,products:c}})})).catch((e=>{r?b.markVariantsAsApprovedProductsLevel(t,x,H,Y,Z):b.markVariantsAsApprovedProductsLevel(t,x,H)}))},ce=e=>{D(!0),X(!0),m(H,q,N,e,0).then((t=>{if(Object.keys(t).length||(ee.current=!0),Object.keys(t).length){Z(Object.assign(Object.assign({},Y),{products:t}));const e=b.getVariantIdsToFetchAtProductLevel(t);re(e,t),J.current=1}e||I({type:"selected",data:{id:H,val:Object.assign(Object.assign({},P),{products:t})}}),D(!1),X(!1)})).catch()},oe=(e,t)=>{const r=b.liftTheStateUp(t,P);I({type:e,data:Object.assign(Object.assign({},r),{isRestricted:E})})},se=!!(null==S?void 0:S[H])&&!!Object.keys(null!==(C=null===(k=null==S?void 0:S[H])||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:()=>Q&&z.length?e.jsx(a.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(c.default,{})},id:"listInput",height:"24px",type:"text",value:z,onChangeText:e=>{e.length&&e.trim().length?G(e):G("")},placeholder:"Search using ID, Name or SKU ID"})})),Object.keys((null==Y?void 0:Y.products)||[]).length>0&&!te&&!z.length&&!R&&"-1"!==H&&e.jsxs(y.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:se,isPartiallyChecked:b.isCollectionPartiallyChecked(H,Y,S,B),onValueChange:function(e){e?ce():I({type:"unselected",data:{id:H}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(r.default,{})})),e.jsx(h.TitleRegular,{children:"All Products"})]}),e.jsx(d.InfiniteScroll,Object.assign({hasData:!(Object.keys((null==Y?void 0:Y.products)||[]).length<10)&&!!Object.keys((null==Y?void 0:Y.products)||[]).length,fetchMore:()=>(W.current=!0,m(H,q,N,10,J.current).then((e=>{let t=!1;if(Object.keys(e).length||(t=!0),Object.keys(e).length){const t=Y;t.products=Object.assign(Object.assign({},Y.products),e),Z(Object.assign({},t));const r=b.getVariantIdsToFetchAtProductLevel(e);re(r,e)}return D(!1),W.current=!1,J.current+=1,t}))),containerRef:M},{children:Object.keys((null==Y?void 0:Y.products)||[]).length?Object.keys(Y.products||[]).map((t=>e.jsx(j.ProductGroup,{outOfStockAction:V,collectionId:H,isProductPartiallyChecked:b.isProductPartiallyChecked(H,t,S,Y,B),productId:t,data:Y.products[t],selectedData:S,selectedCollectionsDispatch:I,viewOnly:!F&&!!te,upliftAdditions:oe,hideProductCheckbox:R,hideVariantCheckbox:L,hideProductVariants:B,pickerType:w,onProductDetailClick:U,showProductDetailInfoIcon:K},t))):Q?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(p.EmptyState,{title:"No products to show",subtitle:z.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})}))]})};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { FbStatusFetcherReturn, SelectedItems } from '.';
|
|
3
4
|
import { SelectedCollectionsActions } from './reducers';
|
|
@@ -10,7 +11,8 @@ interface RearrangeScreenInterface {
|
|
|
10
11
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
11
12
|
scrollContainerRef: React.RefObject<HTMLDivElement>;
|
|
12
13
|
storeId: string;
|
|
13
|
-
|
|
14
|
+
appType: ApplicationType;
|
|
15
|
+
fbStatusFetcher?: (storeId: string, variantIds: string[], appType: ApplicationType) => FbStatusFetcherReturn;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Screen will be opened on two conditions -
|
|
@@ -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"),r=require("react"),s=require("react-beautiful-dnd"),c=require("../../constants/Theme.js"),o=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),n=require("./emptyState.js"),a=require("./helpers/ProductHelper.js"),l=require("./style.js"),d=require("./utility.js"),u=require("./variantComponents.js");exports.RearrangeScreen=p=>{const{selectedCollections:j,selectedCollectionsDispatch:S,setScreen:h,rearrangeViewType:y,outOfStockAction:f,scrollContainerRef:x,storeId:q,fbStatusFetcher:C}=p,[
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("react"),s=require("react-beautiful-dnd"),c=require("../../constants/Theme.js"),o=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),n=require("./emptyState.js"),a=require("./helpers/ProductHelper.js"),l=require("./style.js"),d=require("./utility.js"),u=require("./variantComponents.js");exports.RearrangeScreen=p=>{const{selectedCollections:j,selectedCollectionsDispatch:S,setScreen:h,rearrangeViewType:y,outOfStockAction:f,scrollContainerRef:x,storeId:q,fbStatusFetcher:C,appType:O}=p,[g,b]=r.useState(a.parseSelectedVariantsToArray(j));r.useEffect((()=>{b(a.parseSelectedVariantsToArray(j))}),[j]),r.useEffect((()=>{var e;null===(e=null==x?void 0:x.current)||void 0===e||e.scrollTo({top:0}),d.fetchFbStatusCollection(j,q,O,S,C,"update")}),[]);return e.jsxs(s.DragDropContext,Object.assign({onDragEnd:e=>{if(!e.destination)return;const t=g,[r]=t.splice(e.source.index,1);t.splice(e.destination.index,0,r),t.forEach(((e,t)=>{e.displayOrder=t})),b(t)}},{children:[e.jsxs(l.SelectedScreenHeader,{children:[e.jsx(o.IconButton,{Icon:t.default,width:16,height:16,color:c.COLORS.content.secondary,onClick:()=>{h("collections")}}),e.jsx(i.BodyCaption,Object.assign({color:c.COLORS.content.secondary},{children:"All Products"}))]}),Object.keys(j).length>0?"list"===y?e.jsx(u.VariantsList,{selectedVariants:g,setSelectedVariants:b,selectedCollectionsDispatch:S,outOfStockAction:f}):e.jsx(u.VariantsGrid,{selectedVariants:g,setSelectedVariants:b,selectedCollectionsDispatch:S}):e.jsx(n.EmptyState,{title:"No Products Selected",subtitle:"Selected products will appear here"})]}))};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
|
|
2
3
|
import { Collection, FbStatusFetcherReturn, SearchedItems, SelectedItems } from '.';
|
|
3
4
|
import { SearchReducerActions, SelectedCollectionsActions } from './reducers';
|
|
4
5
|
import { OUT_OF_STOCK_ACTION } from './type';
|
|
@@ -20,7 +21,8 @@ interface SearchScreenInterface {
|
|
|
20
21
|
hideProductVariants?: boolean;
|
|
21
22
|
hideProductCheckbox?: boolean;
|
|
22
23
|
storeId: string;
|
|
23
|
-
|
|
24
|
+
appType: ApplicationType;
|
|
25
|
+
fbStatusFetcher?: (storeId: string, variantIds: string[], appType: ApplicationType) => FbStatusFetcherReturn;
|
|
24
26
|
hideCollectionCheckbox?: boolean;
|
|
25
27
|
renderWithoutModal?: boolean;
|
|
26
28
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
@@ -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"),o=require("react"),l=require("../icon-button/IconButton.js"),c=require("../TypographyStyle.js"),i=require("./collectionScreen.js"),s=require("./emptyState.js"),d=require("./product.js"),r=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{var a;const{customCollectionRestriction:h,selectedCollections:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("react"),l=require("../icon-button/IconButton.js"),c=require("../TypographyStyle.js"),i=require("./collectionScreen.js"),s=require("./emptyState.js"),d=require("./product.js"),r=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{var a;const{customCollectionRestriction:h,selectedCollections:p,searchedCollections:v,searchedCollectionsDispatch:C,selectedCollectionsDispatch:j,setScreen:y,collections:k,onBackPress:b,hideVariantCheckbox:x,pickerType:S,hideProductVariants:P,hideProductCheckbox:f,storeId:m,fbStatusFetcher:O,setCollectionId:g,setSelectedCollectionId:I,hideCollectionCheckbox:q,renderWithoutModal:D,outOfStockAction:T,appType:F}=u;o.useEffect((()=>{var e;n.fetchFbStatusCollection(null!==(e=v.products)&&void 0!==e?e:{},m,F,C,O,"setProducts")}),[null==v?void 0:v.products]);const B=!!h&&(null==p?void 0:p.isCustom);return e.jsxs("div",{children:[e.jsxs(r.SelectedScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,onClick:()=>{y("collections"),b()}}),e.jsx(c.BodyCaption,{children:(null===(a=Object.keys(null==v?void 0:v.collections))||void 0===a?void 0:a.length)?"Searched Collections & Products":"Searched Products"})]}),e.jsx("div",{children:Object.keys(null==v?void 0:v.products).length||Object.keys(null==v?void 0:v.collections).length?e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:Object.keys(null==v?void 0:v.collections).map((t=>e.jsx(i.CollectionCard,{customCollectionRestriction:h,data:null==k?void 0:k[t],isDisabled:B&&!(null==p?void 0:p[t]),isChecked:!!(null==p?void 0:p[t]),isPartiallyChecked:n.isCollectionPartiallyChecked(t,null==k?void 0:k[t],p,P),selectedCollectionsDispatch:j,setCollectionId:g,setSelectedCollectionId:I,setScreen:y,id:t,hideCollectionCheckbox:q||"-1"===t,selectedCollections:p,renderWithoutModal:D,pickerType:S,usedInSearch:!0},t)))}),e.jsx(e.Fragment,{children:Object.keys(null==v?void 0:v.products).map((t=>{var o,l;return Object.keys((null===(l=null===(o=null==v?void 0:v.products)||void 0===o?void 0:o[t])||void 0===l?void 0:l.products)||[]).map((o=>{var l,c,i;let s=!1;return(null===(l=null==v?void 0:v.products)||void 0===l?void 0:l.isCustom)&&(s=!0),e.jsx(d.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>((e,t,o)=>{var l;const c=n.liftTheStateUp(o,null===(l=null==v?void 0:v.products)||void 0===l?void 0:l[e]);j({type:t,data:Object.assign(Object.assign({},c),{isRestricted:h})})})(t,e,o),productId:o,data:(null===(c=null==v?void 0:v.products)||void 0===c?void 0:c[t].products)[o],isProductPartiallyChecked:n.isProductPartiallyChecked(t,o,p,null===(i=v.products)||void 0===i?void 0:i[t],P),selectedData:p,selectedCollectionsDispatch:j,viewOnly:s,hideProductCheckbox:f,hideVariantCheckbox:x,hideProductVariants:P,pickerType:S,outOfStockAction:T},o)}))}))})]}):e.jsx(s.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
|
|
2
3
|
import { Collection, FbStatusFetcherReturn, SelectedItems } from '.';
|
|
3
4
|
import { SelectedCollectionsActions } from './reducers';
|
|
4
5
|
import { OUT_OF_STOCK_ACTION } from './type';
|
|
@@ -12,7 +13,8 @@ interface SelectedScreenInterface {
|
|
|
12
13
|
hideProductVariants?: boolean;
|
|
13
14
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
14
15
|
storeId: string;
|
|
15
|
-
|
|
16
|
+
appType: ApplicationType;
|
|
17
|
+
fbStatusFetcher?: (storeId: string, variantIds: string[], appType: ApplicationType) => FbStatusFetcherReturn;
|
|
16
18
|
}
|
|
17
19
|
export declare const SelectedScreen: (props: SelectedScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
export {};
|
|
@@ -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"),r=require("react"),c=require("../icon-button/IconButton.js"),s=require("../TypographyStyle.js"),n=require("./emptyState.js"),i=require("./product.js"),o=require("./reducers.js"),u=require("./style.js"),l=require("./utility.js");exports.SelectedScreen=d=>{const{selectedCollections:a,selectedCollectionsDispatch:p,setScreen:j,collections:f,hideProductVariants:h=!1,outOfStockAction:y,storeId:S,fbStatusFetcher:v}=d,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("react"),c=require("../icon-button/IconButton.js"),s=require("../TypographyStyle.js"),n=require("./emptyState.js"),i=require("./product.js"),o=require("./reducers.js"),u=require("./style.js"),l=require("./utility.js");exports.SelectedScreen=d=>{const{selectedCollections:a,selectedCollectionsDispatch:p,setScreen:j,collections:f,hideProductVariants:h=!1,outOfStockAction:y,storeId:S,fbStatusFetcher:v,appType:b}=d,x=r.useRef(0),g=r.useRef(null),[q,C]=r.useReducer(o.paginationReducer,{});r.useEffect((()=>{x.current=0;const e=l.paginateSelectedItems(a,10,0);C({type:"paginate",data:e}),l.fetchFbStatusCollection(e,S,b,C,v,"set"),x.current+=1}),[]),r.useEffect((()=>{C({type:"filter",data:a})}),[a]),r.useEffect((()=>{const e=new IntersectionObserver((e=>{if(e[0].isIntersecting&&x.current>0){const e=l.paginateSelectedItems(a,10,x.current);C({type:"paginate",data:e}),l.fetchFbStatusCollection(e,S,b,C,v,"update"),x.current+=1}}),{threshold:1});return g.current&&e.observe(g.current),()=>{g.current&&e.unobserve(g.current)}}),[g,a]);const I=a;return e.jsxs("div",{children:[e.jsxs(u.SelectedScreenHeader,{children:[e.jsx(c.IconButton,{Icon:t.default,onClick:()=>{j("collections")}}),e.jsx(s.BodyCaption,{children:"Selected Products"})]}),e.jsxs("div",{children:[Object.keys(q).length>0?e.jsx(e.Fragment,{children:Object.keys(q).map((t=>{var r;return Object.keys((null===(r=null==q?void 0:q[t])||void 0===r?void 0:r.products)||[]).map((r=>{let c=!1;return(null==I?void 0:I.isCustom)&&(c=!0),e.jsx(i.ProductGroup,{upliftAdditions:null,collectionId:t,productId:r,data:q[t].products[r],isProductPartiallyChecked:l.isProductPartiallyChecked(t,r,I,null==f?void 0:f[t],h),selectedData:I,selectedCollectionsDispatch:p,viewOnly:c,hideProductVariants:h,outOfStockAction:y},r)}))}))}):e.jsx(n.EmptyState,{title:"No Products Selected",subtitle:"Select products will appear here"}),e.jsx("div",{ref:g})]})]})};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
|
|
1
2
|
import { Collection, FbStatusFetcherReturn, Product, ProductVariant, SearchedItems, SelectedItems } from './modal';
|
|
2
3
|
import { CollectionsActions } from './reducers';
|
|
3
4
|
export declare const liftTheStateUp: (payload: any, data: any) => any;
|
|
@@ -12,7 +13,7 @@ export declare function paginateSelectedItems(selectedItems: SelectedItems, limi
|
|
|
12
13
|
*
|
|
13
14
|
* We first get the variant ids to fetch and only if we have variant ids, we call api.
|
|
14
15
|
*/
|
|
15
|
-
export declare const fetchFbStatusCollection: (data: SelectedItems, storeId: string, dispatcher: any, fbStatusFetcher?: ((storeId: string, variantIds: string[]) => FbStatusFetcherReturn) | undefined, dispatchType?: string) => void;
|
|
16
|
+
export declare const fetchFbStatusCollection: (data: SelectedItems, storeId: string, appType: ApplicationType, dispatcher: any, fbStatusFetcher?: ((storeId: string, variantIds: string[], appType: ApplicationType) => FbStatusFetcherReturn) | undefined, dispatchType?: string) => void;
|
|
16
17
|
/**
|
|
17
18
|
* Instead of collection level, we do it product level.
|
|
18
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("lodash");function l(o,l,t){if(!o)return{};const i=Object.keys(o).slice(t,t+l),n={};return i.forEach((l=>{n[l]=o[l]})),n}const t=(o,l,t)=>{Object.keys(o).forEach((l=>{var t,i;const n=null!==(i=null===(t=o[l])||void 0===t?void 0:t.products)&&void 0!==i?i:{};Object.keys(n).forEach((t=>{var i,n,d,v;const s=null!==(v=null===(d=null===(n=null===(i=o[l])||void 0===i?void 0:i.products)||void 0===n?void 0:n[t])||void 0===d?void 0:d.variants)&&void 0!==v?v:{};Object.keys(s).forEach((i=>{var n,d,v,s;const e=null===(s=null===(v=null===(d=null===(n=o[l])||void 0===n?void 0:n.products)||void 0===d?void 0:d[t])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[i];e&&!e.fbStatus&&(e.fbStatus="APPROVED")}))}))})),l({type:t,data:o})};exports.fetchFbStatusCollection=function(o,l,i,n){let
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("lodash");function l(o,l,t){if(!o)return{};const i=Object.keys(o).slice(t,t+l),n={};return i.forEach((l=>{n[l]=o[l]})),n}const t=(o,l,t)=>{Object.keys(o).forEach((l=>{var t,i;const n=null!==(i=null===(t=o[l])||void 0===t?void 0:t.products)&&void 0!==i?i:{};Object.keys(n).forEach((t=>{var i,n,d,v;const s=null!==(v=null===(d=null===(n=null===(i=o[l])||void 0===i?void 0:i.products)||void 0===n?void 0:n[t])||void 0===d?void 0:d.variants)&&void 0!==v?v:{};Object.keys(s).forEach((i=>{var n,d,v,s;const e=null===(s=null===(v=null===(d=null===(n=o[l])||void 0===n?void 0:n.products)||void 0===d?void 0:d[t])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[i];e&&!e.fbStatus&&(e.fbStatus="APPROVED")}))}))})),l({type:t,data:o})};exports.fetchFbStatusCollection=function(o,l,i,n,d){let v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"paged";d||t(o,n,v);const s=(o=>{const l=[];return Object.keys(o).forEach((t=>{var i,n;const d=null!==(n=null===(i=o[t])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,v,s;const e=null!==(s=null===(v=null===(d=null===(n=o[t])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,v,s,e;const u=null===(e=null===(s=null===(v=null===(d=o[t])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];(null==u?void 0:u.fbStatus)||l.push(n)}))}))})),l})(o);s.length>0&&d&&d(l,s,i).then((l=>{const t=Object.assign({},o);Object.keys(t).forEach((o=>{var i,n;const d=null!==(n=null===(i=t[o])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,v,s;const e=null!==(s=null===(v=null===(d=null===(n=t[o])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,v,s,e;const u=null===(e=null===(s=null===(v=null===(d=t[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];u&&"REJECTED"===l[n]?u.fbStatus="REJECTED":u&&"APPROVED"===l[n]&&(u.fbStatus="APPROVED")}))}))})),n({type:v,data:t})})).catch((l=>{console.error("Error in fbStatusFetcher",l),t(o,n,v)}))},exports.getSkuId=(o,l)=>{var t;if(l)return o.skuId;const i=Object.values(null!==(t=null==o?void 0:o.variants)&&void 0!==t?t:{});return 1===i.length&&i[0].name.includes(o.name)?i[0].skuId:""},exports.getVariantIdsToFetchAtProductLevel=(o,l)=>{const t=[];return Object.keys(null!=o?o:{}).forEach((i=>{var n,d;const v=null!==(d=null===(n=null==o?void 0:o[i])||void 0===n?void 0:n.variants)&&void 0!==d?d:{};Object.keys(v).forEach((n=>{var d,v,s,e,u;let r;r=l?null===(s=null===(v=null===(d=null==l?void 0:l.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[n]:null===(u=null===(e=null==o?void 0:o[i])||void 0===e?void 0:e.variants)||void 0===u?void 0:u[n],(null==r?void 0:r.fbStatus)||t.push(n)}))})),t},exports.isCollectionPartiallyChecked=function(o,l,t){var i,n,d,v;let s=0,e=0;if(arguments.length>3&&void 0!==arguments[3]&&arguments[3]){const v=null!==(i=null==l?void 0:l.products)&&void 0!==i?i:{};s=Object.keys(v).length;const u=null!==(d=null===(n=t[o])||void 0===n?void 0:n.products)&&void 0!==d?d:{};e=Object.keys(u).length}else if(t[o]){const i=null==l?void 0:l.products;i&&Object.keys(i).forEach((o=>{var l;const t=null===(l=i[o])||void 0===l?void 0:l.variants;t&&Object.keys(t).forEach((o=>s+=1))}));const n=null===(v=t[o])||void 0===v?void 0:v.products;if(n&&Object.keys(n).forEach((o=>{var l;const t=null===(l=n[o])||void 0===l?void 0:l.variants;t&&Object.keys(t).forEach((o=>e+=1))})),s<=0&&e>0)return!1}return e>0&&s!==e},exports.isProductPartiallyChecked=(o,l,t,i,n)=>{var d,v,s,e,u,r,c,a,p,b,O,f,j,h,y,g,k,E,P;let D=0,S=0;if(null===(v=null===(d=null==t?void 0:t[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[l]){if(n)return!1;const d=(null===(u=null===(e=null===(s=null==t?void 0:t[o])||void 0===s?void 0:s.products)||void 0===e?void 0:e[l])||void 0===u?void 0:u.variants)||[];if(1===Object.keys(d).length)for(const i in d){const n=null===(c=null===(r=null==t?void 0:t[o])||void 0===r?void 0:r.products)||void 0===c?void 0:c[l],d=null===(O=null===(b=null===(p=null===(a=null==t?void 0:t[o])||void 0===a?void 0:a.products)||void 0===p?void 0:p[l])||void 0===b?void 0:b.variants)||void 0===O?void 0:O[i];if(null===(f=null==d?void 0:d.name)||void 0===f?void 0:f.includes(null!==(j=null==n?void 0:n.name)&&void 0!==j?j:""))return!1}if(null===(g=Object.keys((null===(y=null===(h=null==i?void 0:i.products)||void 0===h?void 0:h[l])||void 0===y?void 0:y.variants)||[]))||void 0===g||g.forEach((()=>S++)),Object.keys((null===(P=null===(E=null===(k=null==t?void 0:t[o])||void 0===k?void 0:k.products)||void 0===E?void 0:E[l])||void 0===P?void 0:P.variants)||[]).forEach((()=>D++)),D>0&&S!==D)return!0}return!1},exports.liftTheStateUp=(l,t)=>{const i=o.cloneDeep(t);if(delete i.products,(l=Object.assign(Object.assign({},l),{catalogOnlyData:i})).productId&&t.products){const n=o.cloneDeep(t.products[l.productId]);(null==n?void 0:n.variants)&&delete n.variants,l=Object.assign(Object.assign({},l),{catalogOnlyData:i,productOnlyData:n})}return l},exports.markVariantsAsApprovedProductsLevel=(o,l,t,i,n)=>{const d=Object.assign({},o);if(Object.keys(o).forEach((l=>{var t,i;Object.keys(null!==(i=null===(t=null==o?void 0:o[l])||void 0===t?void 0:t.variants)&&void 0!==i?i:{}).forEach((t=>{var i,n;const v=null===(i=null==o?void 0:o[l].variants)||void 0===i?void 0:i[t];v&&(v.fbStatus="APPROVED");const s=null===(n=null==d?void 0:d[l])||void 0===n?void 0:n.variants;s&&s[t]&&(s[t]=v)}))})),i&&n){const o=Object.assign({},i);o.products=d,n(o),l({type:"productsPaged",data:{collectionId:t,products:d}})}else l({type:"productsPaged",data:{collectionId:t,products:d}})},exports.paginateSelectedItems=function(o,t,i){var n;const d={};let v=0;for(const s in o)if(Object.prototype.hasOwnProperty.call(o,s)){const e=o[s],u=l(e.products,t,i-v);u&&Object.keys(u).length>0&&(d[s]=Object.assign(Object.assign({},e),{products:u})),v+=Object.keys(null!==(n=e.products)&&void 0!==n?n:{}).length}return d},exports.shouldShowVariant=o=>{const l=Object.keys(o.variants||[]);let t=!1;return!(l.length<=1)||(l.forEach((l=>{var i,n;t=null!==(n=null===(i=o.variants)||void 0===i?void 0:i[l].name.includes(o.name))&&void 0!==n&&n})),!t)},exports.updateAllVariantsForSelectedProducts=(l,t,i)=>Object.keys(l).reduce(((n,d)=>{var v;return d in t?(n[d]=Object.assign(Object.assign({},l[d]),{products:Object.keys(null!==(v=l[d].products)&&void 0!==v?v:{}).reduce(((n,v)=>{var s,e,u,r,c,a,p,b,O,f;const j=null===(s=t[d].products)||void 0===s?void 0:s[v],h=null===(r=null===(u=null===(e=null==i?void 0:i.products)||void 0===e?void 0:e[d])||void 0===u?void 0:u.products)||void 0===r?void 0:r[v];return j?n[v]=Object.assign(Object.assign({},(null===(c=l[d].products)||void 0===c?void 0:c[v])||{}),{allVariants:o.cloneDeep(j.variants)}):h?n[v]=Object.assign(Object.assign({},(null===(a=l[d].products)||void 0===a?void 0:a[v])||{}),{allVariants:o.cloneDeep(h.variants)}):(null===(b=null===(p=l[d].products)||void 0===p?void 0:p[v])||void 0===b?void 0:b.allVariants)&&(n[v]=Object.assign(Object.assign({},(null===(O=l[d].products)||void 0===O?void 0:O[v])||{}),{allVariants:o.cloneDeep(null===(f=l[d].products)||void 0===f?void 0:f[v].allVariants)})),n}),{})}),n):n}),{});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../constants/zindex.js"),s=require("../../assets/icons/errorIcon.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../constants/zindex.js"),s=require("../../assets/icons/errorIcon.svg.js"),o=require("../../assets/icons/successIcon.svg.js"),i=require("../../assets/icons/warningIcon.svg.js"),a=require("../modals/styledModal.js"),r=require("../spinner/Spinner.js"),c=require("../states/StateComponent.js");exports.StateModalComponent=d=>{const l=()=>u==c.StateInterface.SUCCESS?e.jsx(o.default,{}):u==c.StateInterface.WARNING?e.jsx(i.default,{}):u==c.StateInterface.ERROR?e.jsx(s.default,{}):u===c.StateInterface.LOADING?e.jsx(r.Spinner,{size:"large"}):void 0,{states:u,heading:I,subline:j,icon:x=l(),isButtonEnabled:S,type:g,buttonText:p,onButtonClick:h,leadingIcon:C,width:f,zIndex:y,headerImage:O,iconHeight:b,iconWidth:m,closeButtonType:q,secondaryButtonText:B}=d,[T,v]=t.useState(!0);return e.jsx(a.StyledModal,Object.assign({"data-test":d["data-test"],open:T,onClose:function(){d.onClose&&d.onClose(),v(!1)},closeOnOutsideClick:!(u===c.StateInterface.LOADING),centralContainerStyles:{display:"flex",alignItems:"center",justifyContent:"center",width:f},hideCrossButton:u===c.StateInterface.LOADING,zIndex:y||n.ComponentZindex.STATE_MODAL},{children:e.jsx(c.StateComponent,Object.assign({states:u,heading:I,subline:j,isButtonEnabled:S,leadingIcon:C,type:g,buttonText:p,onButtonClick:h,icon:x,width:f||400,headerImage:O,iconHeight:b,iconWidth:m,closeButtonType:q,secondaryButtonText:B},{children:d.children}))}))};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TagProps } from './model';
|
|
2
2
|
export declare const Tag: {
|
|
3
|
-
({ tagText, LeadingIcon, TrailingIcon, onLeadingIconClicked, leadingIconId, trailingIconId, onTrailingIconClicked, theme, type, variant, version, cursor, alignIcon, noBorder, tagHtmlText, contentPadding, }: TagProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ tagText, LeadingIcon, TrailingIcon, onLeadingIconClicked, leadingIconId, trailingIconId, onTrailingIconClicked, theme, type, variant, version, cursor, alignIcon, noBorder, tagHtmlText, contentPadding, leadingIconTooltip, trailingIconTooltip, }: TagProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),n=require("../
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),n=require("../tooltips/Tooltip.js"),t=require("../TypographyStyle.js"),a=require("./model.js"),r=require("./Tag.styled.js"),s=require("./themes.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=c(i);const l=i=>{let{tagText:c,LeadingIcon:l,TrailingIcon:d,onLeadingIconClicked:g,leadingIconId:p,trailingIconId:j,onTrailingIconClicked:u,theme:b="light",type:h="neutral",variant:m="regular",version:x,cursor:O,alignIcon:y,noBorder:T,tagHtmlText:I,contentPadding:C,leadingIconTooltip:f,trailingIconTooltip:w}=i,v=c;const N=b;let k=h;a.ValidTagTypeMap[m][h]||(k="neutral"),"circle"===m&&"number"==typeof v&&v>99&&(v="99+");const q={height:"compressed"===m?12:16,width:"compressed"===m?12:16,color:s.getTagIconColor(b,k),style:{display:"block"}};return e.jsx(r.Tag,Object.assign({cursor:O,theme:N,type:h,variant:m,version:x,alignIcon:y,noBorder:T,contentPadding:C},{children:e.jsxs("div",Object.assign({className:"container"},{children:[l&&(f?e.jsx(n.Tooltip,Object.assign({},f,{children:e.jsx("button",Object.assign({className:"icon-leading",onClick:g,id:`${p}-wrapper`||"leading-icon-wrapper"},{children:o.default.createElement(l,Object.assign(Object.assign({},q),{id:p||"leading-icon"}))}))})):e.jsx("button",Object.assign({className:"icon-leading",onClick:g,id:`${p}-wrapper`||"leading-icon-wrapper"},{children:o.default.createElement(l,Object.assign(Object.assign({},q),{id:p||"leading-icon"}))}))),I&&("ai"===h&&"light"===b?e.jsx(t.AiBodyCaption,{children:I}):e.jsx(t.BodyCaption,Object.assign({className:"text"},{children:I}))),!I&&""!==v&&("ai"===h&&"light"===b?e.jsx(t.AiBodyCaption,{children:v}):e.jsx(t.BodyCaption,Object.assign({className:"text"},{children:v}))),d&&(w?e.jsx(n.Tooltip,Object.assign({},w,{children:e.jsx("button",Object.assign({className:"icon-trailing",onClick:u,id:`${j}-wrapper`||"trailing-icon-wrapper"},{children:o.default.createElement(d,Object.assign(Object.assign({},q),{id:j||"trailing-icon"}))}))})):e.jsx("button",Object.assign({className:"icon-trailing",onClick:u,id:`${j}-wrapper`||"trailing-icon-wrapper"},{children:o.default.createElement(d,Object.assign(Object.assign({},q),{id:j||"trailing-icon"}))})))]}))}))};l.displayName="Tag",exports.Tag=l;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
2
|
+
declare const _default: ComponentMeta<{
|
|
3
|
+
({ tagText, LeadingIcon, TrailingIcon, onLeadingIconClicked, leadingIconId, trailingIconId, onTrailingIconClicked, theme, type, variant, version, cursor, alignIcon, noBorder, tagHtmlText, contentPadding, leadingIconTooltip, trailingIconTooltip, }: import("./model").TagProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
}>;
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare const Default: ComponentStory<{
|
|
8
|
+
({ tagText, LeadingIcon, TrailingIcon, onLeadingIconClicked, leadingIconId, trailingIconId, onTrailingIconClicked, theme, type, variant, version, cursor, alignIcon, noBorder, tagHtmlText, contentPadding, leadingIconTooltip, trailingIconTooltip, }: import("./model").TagProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const WithIcons: ComponentStory<{
|
|
12
|
+
({ tagText, LeadingIcon, TrailingIcon, onLeadingIconClicked, leadingIconId, trailingIconId, onTrailingIconClicked, theme, type, variant, version, cursor, alignIcon, noBorder, tagHtmlText, contentPadding, leadingIconTooltip, trailingIconTooltip, }: import("./model").TagProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const WithIconTooltips: ComponentStory<{
|
|
16
|
+
({ tagText, LeadingIcon, TrailingIcon, onLeadingIconClicked, leadingIconId, trailingIconId, onTrailingIconClicked, theme, type, variant, version, cursor, alignIcon, noBorder, tagHtmlText, contentPadding, leadingIconTooltip, trailingIconTooltip, }: import("./model").TagProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const DarkTheme: ComponentStory<{
|
|
20
|
+
({ tagText, LeadingIcon, TrailingIcon, onLeadingIconClicked, leadingIconId, trailingIconId, onTrailingIconClicked, theme, type, variant, version, cursor, alignIcon, noBorder, tagHtmlText, contentPadding, leadingIconTooltip, trailingIconTooltip, }: import("./model").TagProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
displayName: string;
|
|
22
|
+
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MouseEventHandler } from 'react';
|
|
3
|
+
import { TooltipProps } from '../tooltips/Tooltip';
|
|
3
4
|
export type TagTheme = 'light' | 'dark';
|
|
4
5
|
export type TagVariant = 'regular' | 'circle' | 'compressed';
|
|
5
6
|
export type TagType = 'negative' | 'warning' | 'positive' | 'neutral' | 'white' | 'purple' | 'blue' | 'grey' | 'ai';
|
|
@@ -62,9 +63,14 @@ export interface TagProps extends React.BaseHTMLAttributes<HTMLDivElement> {
|
|
|
62
63
|
*/
|
|
63
64
|
trailingIconId?: string;
|
|
64
65
|
/**
|
|
65
|
-
* The
|
|
66
|
+
* The right icon on click event, defaults to () => {}
|
|
66
67
|
*/
|
|
67
68
|
onTrailingIconClicked?: MouseEventHandler<HTMLButtonElement>;
|
|
69
|
+
/**
|
|
70
|
+
* Tooltip props for the trailing icon
|
|
71
|
+
* @default undefined
|
|
72
|
+
*/
|
|
73
|
+
trailingIconTooltip?: Omit<TooltipProps, 'children'>;
|
|
68
74
|
/**
|
|
69
75
|
* The icon component that is to the left of the text
|
|
70
76
|
* Referred to https://ozzie.sh/passing-icons-as-props-in-a-consistent-way-using-react
|
|
@@ -80,6 +86,11 @@ export interface TagProps extends React.BaseHTMLAttributes<HTMLDivElement> {
|
|
|
80
86
|
* @default leading-icon
|
|
81
87
|
*/
|
|
82
88
|
leadingIconId?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Tooltip props for the leading icon
|
|
91
|
+
* @default undefined
|
|
92
|
+
*/
|
|
93
|
+
leadingIconTooltip?: Omit<TooltipProps, 'children'>;
|
|
83
94
|
tagText: string | number;
|
|
84
95
|
version?: '1.0' | '2.0';
|
|
85
96
|
cursor?: string;
|
package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),s=require("../../dropdown/Dropdown.js"),a=require("../../input/Input.js"),n=require("../../template-preview/constants/regexPatterns.js"),i=require("../../template-preview/models/TemplateMeta.js"),o=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../../TypographyStyle.js"),u=require("../../../constants/Theme.js"),c=require("../context/templateModalContext.js"),d=require("../utils/constants.js"),b=require("../utils/validateIsUrl.js"),p=require("./VariableConnector.js");exports.default=j=>{let{variableListIndex:v,button:O,updateSelectedURLTemplateBtn:m,updateSelectedQRBTemplateBtn:g,currentVariableList:x,CTAoptions:f,QRBoptions:y,disableEdit:L}=j;var R,U,T,h,C;const[I,V]=l.useState(""),[_,q]=l.useState(),E=null==f?void 0:f.map((e=>Object.assign(Object.assign({},e),{selected:(null==_?void 0:_.value)===e.value}))),P=null==y?void 0:y.map((e=>Object.assign(Object.assign({},e),{selected:(null==_?void 0:_.value)===e.value}))),{isError:w,disableEditVariable:N,pod:S,selectedCarouselIndex:A,originalVariableList:B,setOriginalVariableList:H,isProductCarouselType:M,ctaOptionsErrors:Q,setCtaOptionsErrors:k}=c.useTemplateModalContext();function D(e){if(V(e),null!=A&&A>-1&&M){const l=t.cloneDeep(B);if("URL"===O.type){const t=l.cards.map((t=>{let l=t.buttons.filter((e=>"URL"===e.type))[v];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=t.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e));return Object.assign(Object.assign({},t),{buttons:s})}));null==H||H((e=>Object.assign(Object.assign({},e),{cards:t}))),null==m||m(`https://${e}`,"custom",v)}return}let l=x.buttons.filter((e=>"URL"===e.type))[v];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=x.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e)),a=Object.assign({},null!=A&&A>-1?B.cards[A]:B);if(a.buttons=s,null!=A&&A>-1){const e=[...B.cards];e[A]=a,null==H||H((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==H||H((e=>Object.assign(Object.assign({},e),{buttons:[...s]})));null==m||m(`https://${e}`,"custom",v)}return l.useEffect((()=>{var e;if(O.buttonVariable&&n.editableVarPattern.test(O.buttonVariable))O.buttonVariable===d.STATIC_URL_VARIABLE_NAME?q(i.STATIC_URL_CTA_OPTION):q(i.CUSTOM_URL_NAME),V((null===(e=O.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===O.type?f:y;e="URL"===O.type?t.findIndex((e=>e.placeHolder===O.buttonVariable)):t.findIndex((e=>e.label===O.flowName)),e>-1?q(t[e]):null==k||k((e=>Object.assign(Object.assign({},e),{[v]:"Required field!"})))}}),[]),S!==o.POD.CHATBOT?e.jsxs(p.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:u.COLORS.content.primary}},{children:[O.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(s.Dropdown,{disabled:N||L,truncatedText:!1,options:"URL"===O.type?"static_link"===(null==_?void 0:_.value)?[i.STATIC_URL_CTA_OPTION]:E:P,isSearchable:!0,onSelect:function(e,l){null==k||k((e=>(delete e[v],Object.assign({},e))));const s=e;q(s);const a=("URL"===O.type?f:y).find((e=>e.placeHolder===s.placeHolder));if(a)if("custom_link"!==a.value){if(null!=A&&A>-1&&M){const e=t.cloneDeep(B);if("URL"===O.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"URL"===e.type))[v];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder});const l=e.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==m||m({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",v),null==H||H((e=>Object.assign(Object.assign({},e),{cards:t})))}else if("QUICK_REPLY"===O.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"QUICK_REPLY"===e.type))[v];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value});const l=e.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==g||g({flowName:s.label,flowId:s.value},"placeholder",v),null==H||H((e=>Object.assign(Object.assign({},e),{cards:t})))}return}let e;if("URL"===O.type){let t=x.buttons.filter((e=>"URL"===e.type))[v];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder,example:[(null==s?void 0:s.value)||"https://d.bik.ai/"]}),e=x.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==m||m({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",v)}else{let t=x.buttons.filter((e=>"QUICK_REPLY"===e.type))[v];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value}),e=x.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==g||g({flowName:s.label,flowId:s.value},"placeholder",v)}const l=Object.assign({},null!=A&&A>-1?B.cards[A]:B);if(l.buttons=e,null!=A&&A>-1){const e=[...B.cards];e[A]=l,null==H||H((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==H||H((t=>Object.assign(Object.assign({},t),{buttons:[...e]})))}else D("")},defaultOptions:_?[Object.assign(Object.assign({},_),{selected:!0})]:[],error:w?null==Q?void 0:Q[v]:void 0})})),("custom_link"===(null==_?void 0:_.value)||"static_link"===(null==_?void 0:_.value))&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(a.Input,{state:N||L?"disabled":"none",errorMessage:w?I?b.validateIsUrl(I)?"":"Enter valid URL":"Required field":"",value:I,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:D,maxCharLimit:2e3})}))]}):e.jsx(p.default,{index:v,variable:{variableName:null!==(R=O.text)&&void 0!==R?R:"",updatedValue:"((customPlaceholderName))"===O.buttonVariable?`${null===(U=O.example)||void 0===U?void 0:U[0]}`:null!==(T=O.buttonVariable)&&void 0!==T?T:"",type:"link",isEditableVariable:!0,index:null!==(h=O.index)&&void 0!==h?h:0,queryParams:null!==(C=O.queryParams)&&void 0!==C?C:[]},showVariableModal:!0,componentType:"BUTTONS",buttonType:O.type,CTAoptions:f})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),s=require("../../dropdown/Dropdown.js"),a=require("../../input/Input.js"),n=require("../../template-preview/constants/regexPatterns.js"),i=require("../../template-preview/models/TemplateMeta.js"),o=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../../TypographyStyle.js"),u=require("../../../constants/Theme.js"),c=require("../context/templateModalContext.js"),d=require("../utils/constants.js"),b=require("../utils/validateIsUrl.js"),p=require("./VariableConnector.js");exports.default=j=>{let{variableListIndex:v,button:O,updateSelectedURLTemplateBtn:m,updateSelectedQRBTemplateBtn:g,currentVariableList:x,CTAoptions:f,QRBoptions:y,disableEdit:L}=j;var R,U,T,h,C;const[I,V]=l.useState(""),[_,q]=l.useState(),E=null==f?void 0:f.map((e=>Object.assign(Object.assign({},e),{selected:(null==_?void 0:_.value)===e.value&&_.label===e.label}))),P=null==y?void 0:y.map((e=>Object.assign(Object.assign({},e),{selected:(null==_?void 0:_.value)===e.value}))),{isError:w,disableEditVariable:N,pod:S,selectedCarouselIndex:A,originalVariableList:B,setOriginalVariableList:H,isProductCarouselType:M,ctaOptionsErrors:Q,setCtaOptionsErrors:k}=c.useTemplateModalContext();function D(e){if(V(e),null!=A&&A>-1&&M){const l=t.cloneDeep(B);if("URL"===O.type){const t=l.cards.map((t=>{let l=t.buttons.filter((e=>"URL"===e.type))[v];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=t.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e));return Object.assign(Object.assign({},t),{buttons:s})}));null==H||H((e=>Object.assign(Object.assign({},e),{cards:t}))),null==m||m(`https://${e}`,"custom",v)}return}let l=x.buttons.filter((e=>"URL"===e.type))[v];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=x.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e)),a=Object.assign({},null!=A&&A>-1?B.cards[A]:B);if(a.buttons=s,null!=A&&A>-1){const e=[...B.cards];e[A]=a,null==H||H((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==H||H((e=>Object.assign(Object.assign({},e),{buttons:[...s]})));null==m||m(`https://${e}`,"custom",v)}return l.useEffect((()=>{var e;if(O.buttonVariable&&n.editableVarPattern.test(O.buttonVariable))O.buttonVariable===d.STATIC_URL_VARIABLE_NAME?q(i.STATIC_URL_CTA_OPTION):q(i.CUSTOM_URL_NAME),V((null===(e=O.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===O.type?f:y;e="URL"===O.type?t.findIndex((e=>e.placeHolder===O.buttonVariable)):t.findIndex((e=>e.label===O.flowName)),e>-1?q(t[e]):null==k||k((e=>Object.assign(Object.assign({},e),{[v]:"Required field!"})))}}),[]),S!==o.POD.CHATBOT?e.jsxs(p.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:u.COLORS.content.primary}},{children:[O.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(s.Dropdown,{disabled:N||L,truncatedText:!1,options:"URL"===O.type?"static_link"===(null==_?void 0:_.value)?[i.STATIC_URL_CTA_OPTION]:E:P,isSearchable:!0,onSelect:function(e,l){null==k||k((e=>(delete e[v],Object.assign({},e))));const s=e;q(s);const a=("URL"===O.type?f:y).find((e=>e.placeHolder===s.placeHolder));if(a)if("custom_link"!==a.value){if(null!=A&&A>-1&&M){const e=t.cloneDeep(B);if("URL"===O.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"URL"===e.type))[v];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder});const l=e.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==m||m({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",v),null==H||H((e=>Object.assign(Object.assign({},e),{cards:t})))}else if("QUICK_REPLY"===O.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"QUICK_REPLY"===e.type))[v];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value});const l=e.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==g||g({flowName:s.label,flowId:s.value},"placeholder",v),null==H||H((e=>Object.assign(Object.assign({},e),{cards:t})))}return}let e;if("URL"===O.type){let t=x.buttons.filter((e=>"URL"===e.type))[v];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder,example:[(null==s?void 0:s.value)||"https://d.bik.ai/"]}),e=x.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==m||m({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",v)}else{let t=x.buttons.filter((e=>"QUICK_REPLY"===e.type))[v];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value}),e=x.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==g||g({flowName:s.label,flowId:s.value},"placeholder",v)}const l=Object.assign({},null!=A&&A>-1?B.cards[A]:B);if(l.buttons=e,null!=A&&A>-1){const e=[...B.cards];e[A]=l,null==H||H((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==H||H((t=>Object.assign(Object.assign({},t),{buttons:[...e]})))}else D("")},defaultOptions:_?[Object.assign(Object.assign({},_),{selected:!0})]:[],error:w?null==Q?void 0:Q[v]:void 0})})),("custom_link"===(null==_?void 0:_.value)||"static_link"===(null==_?void 0:_.value))&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(a.Input,{state:N||L?"disabled":"none",errorMessage:w?I?b.validateIsUrl(I)?"":"Enter valid URL":"Required field":"",value:I,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:D,maxCharLimit:2e3})}))]}):e.jsx(p.default,{index:v,variable:{variableName:null!==(R=O.text)&&void 0!==R?R:"",updatedValue:"((customPlaceholderName))"===O.buttonVariable?`${null===(U=O.example)||void 0===U?void 0:U[0]}`:null!==(T=O.buttonVariable)&&void 0!==T?T:"",type:"link",isEditableVariable:!0,index:null!==(h=O.index)&&void 0!==h?h:0,queryParams:null!==(C=O.queryParams)&&void 0!==C?C:[]},showVariableModal:!0,componentType:"BUTTONS",buttonType:O.type,CTAoptions:f})};
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
align-items: center;
|
|
15
15
|
justify-content: center;
|
|
16
16
|
border-radius: 24px;
|
|
17
|
-
`;exports.ZeroState=n=>{var{subTitle:a,title:c,IconHolderStyle:j,style:g,isLoading:y}=n,x=e.__rest(n,["subTitle","title","IconHolderStyle","style","isLoading"]);return t.jsxs(d,Object.assign({style:null!=g?g:{}},{children:[y?t.jsx(i.Spinner,{size:"large",color:s.COLORS.stroke.brand}):t.jsx(u,Object.assign({style:null!=j?j:{}},{children:(null==x?void 0:x.Icon)||t.jsx(l.default,{color:s.COLORS.content.placeholder,height:24,width:24})})),t.jsx(
|
|
17
|
+
`;exports.ZeroState=n=>{var{subTitle:a,title:c,IconHolderStyle:j,style:g,isLoading:y,containerWidth:p}=n,x=e.__rest(n,["subTitle","title","IconHolderStyle","style","isLoading","containerWidth"]);let b=r.TitleRegular;const h=p?parseFloat(p):0;return h&&!isNaN(h)&&h<=150&&(b=r.TitleSmall),t.jsxs(d,Object.assign({style:null!=g?g:{}},{children:[y?t.jsx(i.Spinner,{size:"large",color:s.COLORS.stroke.brand}):t.jsx(u,Object.assign({style:null!=j?j:{}},{children:(null==x?void 0:x.Icon)||t.jsx(l.default,{color:s.COLORS.content.placeholder,height:24,width:24})})),t.jsx(b,Object.assign({style:{marginTop:8,color:s.COLORS.content.primary}},{children:y?"Loading...":c||"No results found"})),!!a&&!y&&t.jsx(r.BodyCaption,Object.assign({style:{marginTop:4,color:s.COLORS.content.secondary,textAlign:"center",maxWidth:184}},{children:a})),!!(null==x?void 0:x.actionButton)&&t.jsx("div",Object.assign({style:(null==x?void 0:x.buttonWidth)?{width:null==x?void 0:x.buttonWidth,display:"flex"}:{}},{children:t.jsx(o.Button,Object.assign({},null==x?void 0:x.actionButton))}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createSlice as e}from"../../../node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js";import o
|
|
1
|
+
import{createSlice as e}from"../../../node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js";import{v4 as o}from"uuid";import{QueryBuilderJoinOperators as d}from"../types/QueryBuilder.type.js";const t=o,s={nodes:[{_id:t(),properties:[],metas:[]}]},n=o=>e({name:null!=o?o:"queryBuilder",initialState:s,reducers:{clearProperty(e,o){const d=e.nodes.findIndex((e=>e._id===o.payload.nodeID));d>-1&&(e.nodes[d].properties=[])},fillState:(e,o)=>Object.assign({},o.payload),initQueryBuilder(e,o){const s={type:o.payload.type,properties:[],metas:[],_id:t(),PropertyOperator:d.AND};e.nodes=[s],e.operator=d.AND},addNode(e,o){const s={type:o.payload.type,properties:[],metas:[],_id:t(),PropertyOperator:d.AND},n=e.nodes;e.nodes=[...n,s]},deleteNode(e,o){const d=e.nodes.filter((e=>e._id!==o.payload.nodeID));e.nodes=[...d]},clearNode(e,o){var d;const s=[...null!==(d=e.nodes)&&void 0!==d?d:[]];if(0===s.length){const e={type:o.payload.type,properties:[],metas:[],_id:t()};s.push(e)}e.nodes=s},createProperty(e,o){var d;const s=e.nodes.findIndex((e=>e._id===o.payload.nodeID));if(s>-1){const n=null!==(d=e.nodes[s].properties)&&void 0!==d?d:[],a=Object.assign(Object.assign({},o.payload.property),{_id:t()});e.nodes[s].properties=[...n,a]}},updateProperty(e,o){var d;const t=e.nodes.findIndex((e=>e._id===o.payload.nodeID));if(t>-1){const s=(null!==(d=e.nodes[t].properties)&&void 0!==d?d:[]).map((e=>e._id===o.payload.property._id?Object.assign(Object.assign({},e),o.payload.property):e));e.nodes[t].properties=[...s]}},deleteProperty(e,o){var d;const t=e.nodes.findIndex((e=>e._id===o.payload.nodeID));if(t>-1){const s=(null!==(d=e.nodes[t].properties)&&void 0!==d?d:[]).filter((e=>e._id!==o.payload.property._id));e.nodes[t].properties=[...s]}},createMeta(e,o){var d;const t=e.nodes.findIndex((e=>e._id===o.payload.nodeID));if(t>-1){const s=null!==(d=e.nodes[t].metas)&&void 0!==d?d:[],n=Object.assign({},o.payload.meta);e.nodes[t].metas=[...s,n]}},updateMeta(e,o){var d;const t=e.nodes.findIndex((e=>e._id===o.payload.nodeID));if(t>-1){const s=(null!==(d=e.nodes[t].metas)&&void 0!==d?d:[]).map((e=>e.key===o.payload.meta.key?Object.assign(Object.assign({},e),o.payload.meta):e));e.nodes[t].metas=[...s]}},selectPropertyJoinOperator(e,o){const d=e.nodes.findIndex((e=>e._id===o.payload.nodeID));if(-1!==d){const t=e.nodes[d];e.nodes[d]=Object.assign(Object.assign({},t),{PropertyOperator:o.payload.joinOperator})}},selectJoinOperator(e,o){e.operator=o.payload.joinOperator},selectType(e,o){const t=e.nodes.findIndex((e=>e._id===o.payload.nodeID));if(-1!==t){const s=e.nodes[t];e.nodes[t]={_id:s._id,type:o.payload.type,properties:[],metas:[],PropertyOperator:d.AND}}}}});export{n as queryBuilderSlice};
|
|
@@ -11,14 +11,18 @@ export type LineChartProps = {
|
|
|
11
11
|
legend?: string;
|
|
12
12
|
lineWidth?: number;
|
|
13
13
|
squareLegends?: boolean;
|
|
14
|
+
useSecondYAxis?: boolean;
|
|
14
15
|
}[];
|
|
15
16
|
labels: Array<string>;
|
|
16
17
|
scaleText?: {
|
|
17
18
|
x?: string;
|
|
18
19
|
y?: string;
|
|
19
20
|
yPrefix?: string;
|
|
21
|
+
y2?: string;
|
|
22
|
+
y2Prefix?: string;
|
|
20
23
|
xDrawBorder?: boolean;
|
|
21
24
|
yDrawBorder?: boolean;
|
|
25
|
+
y2DrawBorder?: boolean;
|
|
22
26
|
};
|
|
23
27
|
legends: Array<string>;
|
|
24
28
|
stepSize?: number;
|
|
@@ -39,5 +43,12 @@ export type LineChartProps = {
|
|
|
39
43
|
customYHeaders?: any;
|
|
40
44
|
legendsAndIconDirection?: 'row-reverse' | 'row';
|
|
41
45
|
headerIcons?: React.ReactNode[];
|
|
46
|
+
hasSecondYAxis?: boolean;
|
|
47
|
+
min2?: number;
|
|
48
|
+
max2?: number;
|
|
49
|
+
stepSize2?: number;
|
|
50
|
+
prefixCurrencyInY2Axis?: string;
|
|
51
|
+
useKFormat2?: boolean;
|
|
52
|
+
customY2Headers?: any;
|
|
42
53
|
};
|
|
43
54
|
export declare const LineChart: React.FC<LineChartProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{Chart as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{Chart as i,CategoryScale as n,LinearScale as o,PointElement as r,BarElement as a,LineElement as s,ArcElement as d,Filler as c,Title as u,Tooltip as p,Legend as y}from"chart.js";import{useState as g,useRef as m,useEffect as v}from"react";import{Line as b}from"react-chartjs-2";import{BodyTiny as h}from"../../../TypographyStyle.js";import{COLORS as f}from"../../../../constants/Theme.js";import{truncateValueForInternationalStore as x,truncateValueForIndianStore as k}from"../utils/calcPercentage.js";import{LegendWrapper as C,LegendContainer as j,LegendColor as w}from"./LineChart.styled.js";i.register(n,o,r,a,s,d,c,u,p,y);const S=i=>{let{scaleText:n,labels:o,canvasHeight:r,datas:a,maintainAspectRatio:s=!1,stepSize:d,min:c,max:u,isZeroState:p,tension:y,isNewStyles:S,prefixCurrencyInYAxis:B,pointRadius:O,useKFormat:$,lineThickness:A,ticksLabelCallback:z,labelCallback:D,afterBodyCallBack:I,titleTooltipCallback:F,isInternationalStore:T,customYHeaders:Y,headerIcons:P=[],legendsAndIconDirection:R="row",hasSecondYAxis:q=!1,min2:L,max2:H,stepSize2:Z,prefixCurrencyInY2Axis:E,useKFormat2:K,customY2Headers:W}=i;var G,N,J,M;const[Q,U]=g(null),V=m();v((()=>{var e,t,l,i;if(null===(i=null===(l=null===(t=null===(e=V.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.y)||void 0===l?void 0:l.ticks)||void 0===i?void 0:i.length){const e=38*V.current.scales.y.ticks.length;U(e)}}),[V]);const X=a.map((e=>({text:e.legend,color:e.lineColor?e.lineColor:e.dotted?f.content.placeholder:f.background.brand,square:e.squareLegends}))),_={labels:o,datasets:a.map(((e,t)=>{var l,i,n;return Object.assign(Object.assign({tension:null!=y?y:.4,fill:e.gradient?"start":0},((e,t)=>{const l={borderColor:e||(t?f.content.placeholder:f.background.brand)};return S?Object.assign({pointStyle:"circle",pointRadius:O||(o&&o.length>10?2.5:4),pointBorderColor:"transparent",pointBackgroundColor:e||(t?f.content.placeholder:f.background.brand)},l):Object.assign({pointRadius:null!=O?O:1},l)})(e.lineColor,e.dotted)),{borderDash:e.dotted?[8,3]:void 0,data:e.data,borderWidth:null!==(i=null!==(l=e.lineWidth)&&void 0!==l?l:A)&&void 0!==i?i:2,backgroundColor:e.gradient?e=>{const t=e.chart.ctx.createLinearGradient(0,0,0,Q?Q-75:150);return t.addColorStop(0,"#F1EEFB"),t.addColorStop(1,"rgba(127, 86, 217, 0)"),t}:null!==(n=e.backgroundColor)&&void 0!==n?n:"transparent",legend:e.legend,yAxisID:e.useSecondYAxis?"y1":"y"})}))},ee={maintainAspectRatio:s,responsive:!0,plugins:{legend:{display:!1},title:{display:!1},tooltip:{displayColors:null!=S&&S,titleFont:()=>({weight:"600",size:14,family:"inter"}),titleColor:()=>f.content.primaryInverse,backgroundColor:f.content.primary,callbacks:{labelTextColor:()=>f.content.primaryInverse,title:F,label:D,afterBody:I},bodyFont:()=>({weight:"400",size:14,family:"inter"})}},scales:{y:{beginAtZero:!0,min:p?0:c,max:p?10:u,position:"left",id:"y",ticks:{color:f.content.secondary,callback:e=>{var t,l;return $?`${null!==(t=null==n?void 0:n.yPrefix)&&void 0!==t?t:""}${T?x(e):k(e)}${null!=B?B:""}`:Y&&Object.keys(Y).length>0?Y[e]:`${null!==(l=null==n?void 0:n.yPrefix)&&void 0!==l?l:""}${e}${null!=B?B:""}`},font:{family:"inter",size:12,weight:"400"},stepSize:p?1:d,padding:S?24:0},title:{display:!!(null==n?void 0:n.y),text:null==n?void 0:n.y},grid:{color:f.background.base,drawBorder:null===(G=null==n?void 0:n.yDrawBorder)||void 0===G||G}},y1:{beginAtZero:!0,min:p?0:L,max:p?10:H,position:"right",id:"y1",display:q,ticks:{color:f.content.secondary,callback:e=>{var t,l;return K?`${null!==(t=null==n?void 0:n.y2Prefix)&&void 0!==t?t:""}${T?x(e):k(e)}${null!=E?E:""}`:W&&Object.keys(W).length>0?W[e]:`${null!==(l=null==n?void 0:n.y2Prefix)&&void 0!==l?l:""}${e}${null!=E?E:""}`},font:{family:"inter",size:12,weight:"400"},stepSize:p?1:Z,padding:S?24:0},title:{display:!!(null==n?void 0:n.y2),text:null==n?void 0:n.y2},grid:{color:"transparent",drawBorder:null===(N=null==n?void 0:n.y2DrawBorder)||void 0===N||N}},x:{ticks:{callback:z,color:f.content.secondary,font:{family:"inter",size:12,weight:"400"}},title:{display:!!(null==n?void 0:n.x),text:null==n?void 0:n.x},grid:{display:!1,drawBorder:null!==(J=null==n?void 0:n.xDrawBorder)&&void 0!==J&&J}}}};return e("div",Object.assign({style:Object.assign(Object.assign({},s?{}:{height:null!==(M=null!=r?r:Q)&&void 0!==M?M:204}),{display:"flex",flexDirection:"column",gap:2,width:"100%"})},{children:[e("div",Object.assign({style:{display:"flex",justifyContent:"space-between",width:"100%",flexDirection:R}},{children:[t(C,{children:P.map(((e,l)=>t(j,{children:e},l)))}),t(C,{children:X.map(((i,n)=>{let{text:o,color:r,square:a}=i;return o?e(j,{children:[t(w,{color:r,square:a,newStyle:S}),t(h,Object.assign({color:"#667085"},{children:o}))]},n):t(l,{})}))})]})),t("div",Object.assign({style:{flex:1}},{children:t(b,{ref:V,options:ee,data:_})}))]}))};export{S as LineChart};
|