@bikdotai/bik-component-library 0.0.32025-beta.1 → 0.0.32027-beta.1

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 (79) hide show
  1. package/dist/cjs/assets/icons/drag_handle.svg.js +1 -0
  2. package/dist/cjs/components/accordion/Accordion.d.ts +2 -0
  3. package/dist/cjs/components/accordion/Accordion.js +1 -1
  4. package/dist/cjs/components/accordion/Accordion.style.d.ts +1 -0
  5. package/dist/cjs/components/accordion/Accordion.style.js +1 -1
  6. package/dist/cjs/components/add-variableV2/AddVariableV2.js +1 -1
  7. package/dist/cjs/components/add-variableV2/AddVariableV2.styled.js +2 -0
  8. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  9. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  10. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  11. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  12. package/dist/cjs/components/input/Input.js +1 -1
  13. package/dist/cjs/components/input/Input.styled.d.ts +6 -0
  14. package/dist/cjs/components/input/Input.styled.js +1 -1
  15. package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.d.ts +13 -1
  16. package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.js +1 -1
  17. package/dist/cjs/components/product-picker-v2/modal.d.ts +16 -2
  18. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  19. package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +18 -0
  20. package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -0
  21. package/dist/cjs/components/product-picker-v2/style.d.ts +3 -0
  22. package/dist/cjs/components/product-picker-v2/style.js +43 -11
  23. package/dist/cjs/components/product-picker-v2/variant.d.ts +32 -0
  24. package/dist/cjs/components/product-picker-v2/variant.js +1 -0
  25. package/dist/cjs/components/product-picker-v2/variantComponents.d.ts +21 -0
  26. package/dist/cjs/components/product-picker-v2/variantComponents.js +1 -0
  27. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +2 -1
  28. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  29. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +2 -0
  30. package/dist/cjs/components/template-context-mapper/context/templateModalContext.js +1 -1
  31. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.d.ts +1 -0
  32. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
  33. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
  34. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  35. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -3
  36. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  37. package/dist/cjs/constants/Theme.d.ts +19 -0
  38. package/dist/cjs/constants/Theme.js +1 -1
  39. package/dist/cjs/index.js +1 -1
  40. package/dist/esm/assets/icons/drag_handle.svg.js +1 -0
  41. package/dist/esm/components/accordion/Accordion.d.ts +2 -0
  42. package/dist/esm/components/accordion/Accordion.js +1 -1
  43. package/dist/esm/components/accordion/Accordion.style.d.ts +1 -0
  44. package/dist/esm/components/accordion/Accordion.style.js +1 -1
  45. package/dist/esm/components/add-variableV2/AddVariableV2.js +1 -1
  46. package/dist/esm/components/add-variableV2/AddVariableV2.styled.js +2 -0
  47. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  48. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  49. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  50. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  51. package/dist/esm/components/input/Input.js +1 -1
  52. package/dist/esm/components/input/Input.styled.d.ts +6 -0
  53. package/dist/esm/components/input/Input.styled.js +1 -1
  54. package/dist/esm/components/product-picker-v2/helpers/ProductHelper.d.ts +13 -1
  55. package/dist/esm/components/product-picker-v2/helpers/ProductHelper.js +1 -1
  56. package/dist/esm/components/product-picker-v2/modal.d.ts +16 -2
  57. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  58. package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +18 -0
  59. package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -0
  60. package/dist/esm/components/product-picker-v2/style.d.ts +3 -0
  61. package/dist/esm/components/product-picker-v2/style.js +41 -9
  62. package/dist/esm/components/product-picker-v2/variant.d.ts +32 -0
  63. package/dist/esm/components/product-picker-v2/variant.js +1 -0
  64. package/dist/esm/components/product-picker-v2/variantComponents.d.ts +21 -0
  65. package/dist/esm/components/product-picker-v2/variantComponents.js +1 -0
  66. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +2 -1
  67. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  68. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +2 -0
  69. package/dist/esm/components/template-context-mapper/context/templateModalContext.js +1 -1
  70. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.d.ts +1 -0
  71. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
  72. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
  73. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  74. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -3
  75. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  76. package/dist/esm/constants/Theme.d.ts +19 -0
  77. package/dist/esm/constants/Theme.js +1 -1
  78. package/dist/esm/index.js +1 -1
  79. package/package.json +2 -1
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(this,arguments)}var a=e=>r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},e),t||(t=r.createElement("g",{fill:"#9E9E9E"},r.createElement("path",{d:"M5 9a1 1 0 0 0 0 2h14a1 1 0 1 0 0-2H5ZM5 13a1 1 0 1 0 0 2h14a1 1 0 1 0 0-2H5Z"}))));exports.default=a;
@@ -12,5 +12,7 @@ export interface AccordionProps {
12
12
  showBorders?: boolean;
13
13
  backgroundColor?: string;
14
14
  refresh?: number | boolean;
15
+ autoOpen?: boolean;
16
+ childrenMaxHeight?: number;
15
17
  }
16
18
  export declare const BikAccordion: React.FC<AccordionProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../TypographyStyle.js"),n=require("./Accordion.style.js"),i=require("./AccordionArrow.js");exports.BikAccordion=o=>{var s;const[a,c]=r.useState(!1),l=r.useRef(null),d=r.useRef(null),u=(e,r)=>{d.current&&l.current&&("keydown"===r.type&&"Enter"!==r.key||(c(e),d.current.style.maxHeight?(d.current.style.maxHeight="",l.current.style.transform="rotate(0deg)",l.current.style.transition="transform 0.25s ease-in-out",d.current.style.transition="padding 0s"):(d.current.style.maxHeight=d.current.scrollHeight+"px",l.current.style.transform="rotate(180deg)",l.current.style.transition="transform 0.25s ease-in-out",d.current.style.transition="max-height 0.25s ease-in-out")))};return r.useEffect((()=>{var e;a&&(null==o?void 0:o.refresh)&&(null===(e=null==d?void 0:d.current)||void 0===e?void 0:e.scrollHeight)&&setTimeout((()=>{d.current.style.maxHeight=d.current.scrollHeight+"px"}),100)}),[a,null==o?void 0:o.refresh,null===(s=null==d?void 0:d.current)||void 0===s?void 0:s.scrollHeight]),e.jsxs(n.default,Object.assign({className:"accordion",isActive:a,width:null==o?void 0:o.width,contentMargin:null==o?void 0:o.contentMargin,headerPadding:o.headerPadding,skipHoverState:o.skipHoverHeader,showBorders:o.showBorders,backgroundColor:o.backgroundColor},{children:[e.jsxs("div",Object.assign({className:"accordion__overview "+(a?"active":""),onClick:e=>u(!a,e),onKeyDown:e=>u(!a,e),role:"button",tabIndex:0},{children:[!o.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:["string"==typeof o.header?e.jsx(t.TitleRegular,{children:null==o?void 0:o.header}):o.header,e.jsx(i.default,{isNewIcon:!1,ref:l})]})),o.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:[e.jsxs("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[e.jsx(i.default,{isNewIcon:!0,ref:l}),"string"==typeof o.header?e.jsx(t.TitleRegular,{children:null==o?void 0:o.header}):o.header]})),e.jsx("div",Object.assign({onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},role:"button",tabIndex:0},{children:o.rightActionComponent}))]})),(null==o?void 0:o.caption)&&e.jsx("div",Object.assign({className:"accordion__overview__caption"},{children:e.jsx(t.BodySecondary,{children:o.caption})}))]})),e.jsx("div",Object.assign({ref:d,className:"accordion__content"},{children:o.children}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../TypographyStyle.js"),n=require("./Accordion.style.js"),i=require("./AccordionArrow.js");exports.BikAccordion=o=>{var s;const[a,c]=r.useState(!1),l=r.useRef(null),d=r.useRef(null);r.useEffect((()=>{o.autoOpen&&u(o.autoOpen,{})}),[o.autoOpen]);const u=(e,r)=>{var t;d.current&&l.current&&("keydown"===r.type&&"Enter"!==r.key||(c(e),d.current.style.maxHeight?(d.current.style.maxHeight="",l.current.style.transform="rotate(0deg)",l.current.style.transition="transform 0.25s ease-in-out",d.current.style.transition="padding 0s"):(d.current.style.maxHeight=(null!==(t=o.childrenMaxHeight)&&void 0!==t?t:d.current.scrollHeight)+"px",l.current.style.transform="rotate(180deg)",l.current.style.transition="transform 0.25s ease-in-out",d.current.style.transition="max-height 0.25s ease-in-out")))};return r.useEffect((()=>{var e;a&&(null==o?void 0:o.refresh)&&(null===(e=null==d?void 0:d.current)||void 0===e?void 0:e.scrollHeight)&&!o.childrenMaxHeight&&setTimeout((()=>{d.current.style.maxHeight=d.current.scrollHeight+"px"}),100)}),[a,null==o?void 0:o.refresh,null===(s=null==d?void 0:d.current)||void 0===s?void 0:s.scrollHeight]),e.jsxs(n.default,Object.assign({className:"accordion",isActive:a,width:null==o?void 0:o.width,contentMargin:null==o?void 0:o.contentMargin,headerPadding:o.headerPadding,skipHoverState:o.skipHoverHeader,showBorders:o.showBorders,backgroundColor:o.backgroundColor},{children:[e.jsxs("div",Object.assign({className:"accordion__overview "+(a?"active":""),onClick:e=>u(!a,e),onKeyDown:e=>u(!a,e),role:"button",tabIndex:0},{children:[!o.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:["string"==typeof o.header?e.jsx(t.TitleRegular,{children:null==o?void 0:o.header}):o.header,e.jsx(i.default,{isNewIcon:!0,ref:l})]})),o.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:[e.jsxs("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[e.jsx(i.default,{isNewIcon:!0,ref:l}),"string"==typeof o.header?e.jsx(t.TitleRegular,{children:null==o?void 0:o.header}):o.header]})),e.jsx("div",Object.assign({onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},role:"button",tabIndex:0},{children:o.rightActionComponent}))]})),(null==o?void 0:o.caption)&&e.jsx("div",Object.assign({className:"accordion__overview__caption"},{children:e.jsx(t.BodySecondary,{children:o.caption})}))]})),e.jsx("div",Object.assign({ref:d,className:"accordion__content"},{children:o.children}))]}))};
@@ -6,5 +6,6 @@ declare const AccordionStyle: import("styled-components").StyledComponent<"div",
6
6
  headerPadding?: string | undefined;
7
7
  showBorders?: boolean | undefined;
8
8
  backgroundColor?: string | undefined;
9
+ hasChildrenMaxHeight?: boolean | undefined;
9
10
  }, never>;
10
11
  export default AccordionStyle;
@@ -29,7 +29,7 @@
29
29
  }
30
30
  &__content {
31
31
  ${e=>e.isActive?{margin:(null==e?void 0:e.contentMargin)||"0px"}:{}};
32
- overflow: hidden;
32
+ overflow: ${e=>e.hasChildrenMaxHeight?"scroll":"hidden"};
33
33
  max-height: 0;
34
34
  }
35
35
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/back_icon.svg.js"),a=require("../../assets/icons/chevronRightAlt.svg.js"),i=require("../../assets/icons/cross.svg.js"),t=require("../../assets/icons/plus.svg.js"),l=require("../../assets/icons/undo.svg.js"),n=require("react"),r=require("./AddVariableV2.styled.js"),c=require("../button/Button.js"),o=require("../icon-button/IconButton.js"),d=require("../searchBar/searchBar.js"),b=require("../tooltips/Tooltip.js"),u=require("../../constants/Theme.js"),j=require("../TypographyStyle.js"),v=require("../modals/modal.styled.js");const g=n.memo((g=>{const{data:h,hasHeader:m=!0,needsBorder:p=!0,styledCloseBtn:y=!1}=g,[x,O]=n.useState({}),[f,N]=n.useState(),[S,V]=n.useState(""),[C,T]=n.useState(""),[_,w]=n.useState(!0),B=/^[^.]*\.[^.]*$/;n.useEffect((()=>{const e={};h.forEach((s=>{e[s.displayName]=[]})),N(e)}),[h]),n.useEffect((()=>{k([],S),N((e=>Object.assign(Object.assign({},e),{[S]:[]}))),V("")}),[g.reRender]),n.useEffect((()=>{if(C){g.data.filter((e=>Object.keys(e.variables).filter((s=>{var a;return(null===(a=e.variables[s].displayName)||void 0===a?void 0:a.toLowerCase().includes(C.toLowerCase()))||L(e.variables[s])})).length>0)).length>0?w(!0):w(!1)}else w(!0)}),[C]);const k=(e,s)=>{const a=h.find((e=>e.displayName===s));if(a){let i=a;e.forEach(((e,s)=>{i=i.variables[e]})),O((e=>Object.assign(Object.assign({},e),{[s]:i})))}},L=e=>{let s=!1;if(e.isSubHeader&&e.variables){const a=Object.keys(e.variables);for(let i=0;i<a.length;i++){const t=a[i];if(e.variables&&e.variables[t].displayName.toLowerCase().includes(C.toLowerCase())){s=!0;break}}}return s},q=s=>{const a=s.item.description;return e.jsx(e.Fragment,{children:e.jsx(b.Tooltip,Object.assign({body:"",tooltipContent:e.jsx(j.BodyCaption,Object.assign({color:u.COLORS.content.primaryInverse,style:{whiteSpace:"pre-line",padding:8}},{children:s.item.isAvailable?a?`• ${a}\n• Recommended here`:"Recommended here":"Not recommended here"})),width:300,delay:300,placement:"bottom"},{children:e.jsx("div",{children:e.jsx(F,{item:s.item})})}))})},F=s=>e.jsx(c.Button,{darkMode:g.enableVariable?g.enableVariable:s.item.isAvailable,size:"chip",LeadingIcon:s.item.isSubHeader?void 0:t.default,TrailingIcon:()=>s.item.isSubHeader?e.jsx("div",Object.assign({className:"icon-trailing",style:{display:"flex"}},{children:e.jsx(a.default,{})})):e.jsx(e.Fragment,{}),buttonText:s.item.displayName}),I=(s,a)=>e.jsx("div",Object.assign({onClick:s.isSubHeader?()=>{const e=[...f[S],a];k(e,S),N((s=>Object.assign(Object.assign({},s),{[S]:e})))}:()=>{g.customTrigger?(g.customTrigger(s),g.setShowVariable(!1)):g.isEvaluationList?P(s):g.setVariableValue(g.selectWithTypes?{actualValue:s.actualValue,variableType:s.variableType,needsFetching:s.needsFetching}:s.actualValue)}},{children:e.jsx(q,{item:s})})),E=(e,s)=>{const a=[...f[e.displayName],s];k(a,e.displayName),N((s=>Object.assign(Object.assign({},s),{[e.displayName]:a}))),V(e.displayName)},P=e=>{if(e.actualValue.match(B)){const s=e.actualValue.replace("{{","").replace("}}","").split("."),a=s[0]+`['${s[1]}']`;g.setVariableValue(g.selectWithTypes?{actualValue:a,variableType:e.variableType,needsFetching:e.needsFetching}:a)}else{const s=e.actualValueEval?e.actualValueEval:e.actualValue;g.setVariableValue(g.selectWithTypes?{actualValue:s,variableType:e.variableType,needsFetching:e.needsFetching}:s)}},R=(e,s)=>{if(g.customTrigger)g.customTrigger(e.variables[s]),g.setShowVariable(!1);else if(g.isEvaluationList){const a=e.variables[s];P(a)}else g.setVariableValue(g.selectWithTypes?{actualValue:e.variables[s].actualValue,variableType:e.variables[s].variableType,needsFetching:e.variables[s].needsFetching}:e.variables[s].actualValue)},z=g.isModalState?void 0:{top:`${g.topPosition?g.topPosition:"small"===g.pickerSize?"300px":"60px"}`,left:`${g.leftPosition?g.leftPosition+24:430}px`};return e.jsx("div",Object.assign({id:"varList",tabIndex:-1},{children:e.jsxs(r.AddVariableStyled,Object.assign({style:z,onClick:e=>{e.stopPropagation()},pickerSize:g.pickerSize||"large",isModalState:g.isModalState,positionStrategy:g.positionStrategy,zIndex:g.zindex,height:g.height,needsBorder:p,width:g.width},{children:[y&&e.jsx(v.CloseButtonContainer,Object.assign({onClick:()=>{g.setShowVariable(!1)},style:{zIndex:300}},{children:e.jsx(i.default,{height:20,width:20,color:u.COLORS.content.secondary})})),g.showVariable&&e.jsxs("div",Object.assign({className:"popup"},{children:[e.jsxs("div",Object.assign({className:"sticky__bar"},{children:[m&&e.jsxs("div",Object.assign({className:"header__bar"},{children:[e.jsx("div",Object.assign({className:"add__variable"},{children:"Add a new variable"})),!y&&e.jsx("div",Object.assign({onClick:()=>{g.setShowVariable(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center"}},{children:e.jsx(o.IconButton,{iconButtonType:"default",Icon:i.default})}))]})),e.jsx("div",Object.assign({className:"search__bar",onBlur:e=>{g.onSearchBlur&&g.onSearchBlur(e)}},{children:e.jsx(d.SearchBar,{width:"100%",isEnabled:!0,onChange:e=>{T(e)},onEnter:()=>{},placeholder:"Search...",variant:"default"})})),!_&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",marginTop:16}},{children:[e.jsx(j.TitleSmall,{children:"No results found!"}),e.jsx(j.BodyCaption,{children:`Sorry we could not find any results for "${C}"`})]})),S&&f[S].length>0&&e.jsxs("div",Object.assign({className:"nav__bar",style:{marginTop:8}},{children:[e.jsxs("div",Object.assign({className:"left__nav"},{children:[e.jsx(o.IconButton,{Icon:s.default,style:{color:"#919191",display:"flex"},onClick:()=>{const e=f[S].slice(0,-1);k(e,S),N((s=>Object.assign(Object.assign({},s),{[S]:e}))),e.length||V("")}}),e.jsxs("div",Object.assign({className:"block"},{children:[e.jsx(j.TitleSmall,{children:x[S].displayName}),x[S].description&&e.jsx(j.BodyCaption,{children:x[S].description})]}))]})),e.jsxs("div",Object.assign({className:"right__nav"},{children:[e.jsx(o.IconButton,{Icon:l.default,style:{display:"flex"},onClick:()=>{k([],S),N((e=>Object.assign(Object.assign({},e),{[S]:[]}))),V("")}}),e.jsx("div",{children:"First page"})]}))]}))]})),e.jsx("div",Object.assign({className:"wrapper"},{children:e.jsx("div",Object.assign({className:"list__map"},{children:e.jsxs("div",Object.assign({className:"items"},{children:[!S&&g.data.map((s=>{let a=[];return C&&(a=Object.keys(s.variables).filter((e=>{var a;return(null===(a=s.variables[e].displayName)||void 0===a?void 0:a.toLowerCase().includes(C.toLowerCase()))||L(s.variables[e])}))),e.jsxs(e.Fragment,{children:[C?a.length>0?e.jsxs("div",Object.assign({className:"block"},{children:[e.jsx("div",Object.assign({className:"heading__font"},{children:null==s?void 0:s.displayName})),e.jsx(j.BodyCaption,Object.assign({style:{marginBottom:8,color:"#616161"}},{children:null==s?void 0:s.description}))]})):e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"block"},{children:[e.jsx("div",Object.assign({className:"heading__font"},{children:null==s?void 0:s.displayName})),e.jsx(j.BodyCaption,Object.assign({style:{marginBottom:8,color:"#616161"}},{children:null==s?void 0:s.description}))]})),Object.keys(s.variables).map((a=>{var i;return C?(null===(i=s.variables[a].displayName)||void 0===i?void 0:i.toLowerCase().includes(C.toLowerCase()))||L(s.variables[a])?e.jsx("div",Object.assign({onClick:s.variables[a].isSubHeader?()=>E(s,a):()=>R(s,a)},{children:e.jsx(q,{item:s.variables[a]})})):e.jsx(e.Fragment,{}):e.jsx("div",Object.assign({onClick:s.variables[a].isSubHeader?()=>E(s,a):()=>R(s,a)},{children:e.jsx(q,{item:s.variables[a]})}))}))]})})),S&&e.jsx("div",Object.assign({className:"list__map"},{children:e.jsx("div",Object.assign({className:"items",style:{marginTop:16}},{children:Object.keys(x[S].variables).map(((s,a)=>{var i;return C?(null===(i=x[S].variables[s].displayName)||void 0===i?void 0:i.toLowerCase().includes(C.toLowerCase()))||L(x[S].variables[s])?I(x[S].variables[s],s):e.jsx(e.Fragment,{}):I(x[S].variables[s],s)}))}))}))]}))}))})),e.jsx("div",{className:"bottom__padding"})]}))]}))}))}),((e,s)=>e.enableVariable===s.enableVariable&&(e.leftPosition===s.leftPosition&&e.reRender===s.reRender)));exports.AddVariableV2=g;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),a=require("../../assets/icons/back_icon.svg.js"),i=require("../../assets/icons/chevronRightAlt.svg.js"),t=require("../../assets/icons/cross.svg.js"),l=require("../../assets/icons/plus.svg.js"),n=require("../../assets/icons/undo.svg.js"),r=require("react"),c=require("./AddVariableV2.styled.js"),o=require("../button/Button.js"),d=require("../icon-button/IconButton.js"),b=require("../searchBar/searchBar.js"),u=require("../tooltips/Tooltip.js"),j=require("../../constants/Theme.js"),v=require("../modals/modal.styled.js"),g=require("../switch/Switch.js"),h=require("../TypographyStyle.js");const m=r.memo((m=>{const{data:p,hasHeader:y=!0,needsBorder:x=!0,styledCloseBtn:f=!1}=m,[O,S]=r.useState({}),[N,C]=r.useState(),[V,w]=r.useState(""),[_,T]=r.useState(""),[B,k]=r.useState(!0),q=/^[^.]*\.[^.]*$/,[L,F]=r.useState(m.data),[I,A]=r.useState(!0);r.useEffect((()=>{const e={};p.forEach((s=>{e[s.displayName]=[]})),C(e)}),[p]),r.useEffect((()=>{z(!0)}),[]),r.useEffect((()=>{R([],V),C((e=>Object.assign(Object.assign({},e),{[V]:[]}))),w("")}),[m.reRender]),r.useEffect((()=>{if(_){E(m.data,I).length>0?k(!0):k(!1)}else k(!0)}),[_]);const E=function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.flatMap((e=>Object.keys(e.variables).filter((a=>{var i;return(null===(i=e.variables[a].displayName)||void 0===i?void 0:i.toLowerCase().includes(_.toLowerCase()))&&(!s||e.variables[a].isAvailable===s)||P(e.variables[a])}))))},R=(e,s)=>{const a=p.find((e=>e.displayName===s));if(a){let i=a;e.forEach(((e,s)=>{i=i.variables[e]})),S((e=>Object.assign(Object.assign({},e),{[s]:i})))}},P=e=>{let s=!1;if(e.isSubHeader&&e.variables){const a=Object.keys(e.variables);for(let i=0;i<a.length;i++){const t=a[i];if(e.variables&&e.variables[t].displayName.toLowerCase().includes(_.toLowerCase())&&e.variables[t].isAvailable===I){s=!0;break}}}return s},z=e=>{if(A(e),e){let s=[];if(V){const e=O[V];s=m.data.filter((e=>e.displayName===V)).map((s=>H(s,e))).filter((e=>null!=e))}else s=m.data.map((e=>H(e))).filter((e=>null!==e));F(s),_&&(s=E(s,e)),s.length>0?k(!0):k(!1)}else if(F(m.data),_){E(m.data,e).length>0?k(!0):k(!1)}else k(!0)};function H(e,s){const a={};if(s){for(const i in e.variables)if(e.variables[i]===s)for(const s in e.variables[i].variables)e.variables[i].variables[s].isAvailable&&(a[s]=e.variables[i].variables[s])}else for(const s in e.variables)e.variables[s].isAvailable&&(a[s]=e.variables[s]);return 0===Object.keys(a).length?null:Object.assign(Object.assign({},e),{variables:a})}const M=e=>{const a=e.item.description;return s.jsx(s.Fragment,{children:s.jsx(u.Tooltip,Object.assign({body:"",tooltipContent:s.jsx(h.BodyCaption,Object.assign({color:j.COLORS.content.primaryInverse,style:{whiteSpace:"pre-line",padding:8}},{children:e.item.isAvailable?a?`• ${a}\n• Recommended here`:"Recommended here":"Not recommended here"})),width:300,delay:300,placement:"bottom"},{children:s.jsx("div",{children:s.jsx($,{item:e.item})})}))})},$=e=>s.jsx(o.Button,{darkMode:m.enableVariable?m.enableVariable:e.item.isAvailable,size:"chip",LeadingIcon:e.item.isSubHeader?void 0:l.default,TrailingIcon:()=>e.item.isSubHeader?s.jsx("div",Object.assign({className:"icon-trailing",style:{display:"flex"}},{children:s.jsx(i.default,{})})):s.jsx(s.Fragment,{}),buttonText:e.item.displayName}),W=(e,a)=>I&&!e.isAvailable?s.jsx(s.Fragment,{}):s.jsx("div",Object.assign({onClick:e.isSubHeader?()=>{const e=[...N[V],a];R(e,V),C((s=>Object.assign(Object.assign({},s),{[V]:e})))}:()=>{m.customTrigger?(m.customTrigger(e),m.setShowVariable(!1)):m.isEvaluationList?G(e):m.setVariableValue(m.selectWithTypes?{actualValue:e.actualValue,variableType:e.variableType,needsFetching:e.needsFetching}:e.actualValue)}},{children:s.jsx(M,{item:e})})),D=(e,s)=>{const a=[...N[e.displayName],s];R(a,e.displayName),C((s=>Object.assign(Object.assign({},s),{[e.displayName]:a}))),w(e.displayName)},G=e=>{if(e.actualValue.match(q)){const s=e.actualValue.replace("{{","").replace("}}","").split("."),a=s[0]+`['${s[1]}']`;m.setVariableValue(m.selectWithTypes?{actualValue:a,variableType:e.variableType,needsFetching:e.needsFetching}:a)}else{const s=e.actualValueEval?e.actualValueEval:e.actualValue;m.setVariableValue(m.selectWithTypes?{actualValue:s,variableType:e.variableType,needsFetching:e.needsFetching}:s)}},J=(e,s)=>{if(m.customTrigger)m.customTrigger(e.variables[s]),m.setShowVariable(!1);else if(m.isEvaluationList){const a=e.variables[s];G(a)}else m.setVariableValue(m.selectWithTypes?{actualValue:e.variables[s].actualValue,variableType:e.variables[s].variableType,needsFetching:e.variables[s].needsFetching}:e.variables[s].actualValue)},K=m.isModalState?void 0:{top:`${m.topPosition?m.topPosition:"small"===m.pickerSize?"300px":"60px"}`,left:`${m.leftPosition?m.leftPosition+24:430}px`};return s.jsx("div",Object.assign({id:"varList",tabIndex:-1},{children:s.jsxs(c.AddVariableStyled,Object.assign({style:K,onClick:e=>{e.stopPropagation()},pickerSize:m.pickerSize||"large",isModalState:m.isModalState,positionStrategy:m.positionStrategy,zIndex:m.zindex,height:m.height,needsBorder:x,width:m.width},{children:[f&&s.jsx(v.CloseButtonContainer,Object.assign({onClick:()=>{m.setShowVariable(!1)},style:{zIndex:300}},{children:s.jsx(t.default,{height:20,width:20,color:j.COLORS.content.secondary})})),m.showVariable&&s.jsxs("div",Object.assign({className:"popup"},{children:[s.jsxs("div",Object.assign({className:"sticky__bar"},{children:[y&&s.jsxs("div",Object.assign({className:"header__bar"},{children:[s.jsx("div",Object.assign({className:"add__variable"},{children:"Add a new variable"})),!f&&s.jsx("div",Object.assign({onClick:()=>{m.setShowVariable(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center"}},{children:s.jsx(d.IconButton,{iconButtonType:"default",Icon:t.default})}))]})),s.jsxs("div",Object.assign({className:"search__bar",onBlur:e=>{m.onSearchBlur&&m.onSearchBlur(e)}},{children:[s.jsx(b.SearchBar,{width:"100%",isEnabled:!0,onChange:e=>{T(e)},onEnter:()=>{},placeholder:"Search...",variant:"default"}),s.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",marginTop:8,justifyContent:"space-between"}},{children:[s.jsx(h.BodySecondary,Object.assign({style:{color:j.COLORS.content.secondary}},{children:"Show only recommended variables"})),s.jsx(g.Switch,{value:I,onValueChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){return yield z(s)}))})]}))]})),V&&N[V].length>0&&s.jsxs("div",Object.assign({className:"nav__bar"},{children:[s.jsxs("div",Object.assign({className:"left__nav"},{children:[s.jsx(d.IconButton,{Icon:a.default,style:{color:"#919191",display:"flex"},onClick:()=>{const e=N[V].slice(0,-1);R(e,V),C((s=>Object.assign(Object.assign({},s),{[V]:e}))),e.length||w("")}}),s.jsxs("div",Object.assign({className:"block"},{children:[s.jsx(h.TitleSmall,{children:O[V].displayName}),O[V].description&&s.jsx(h.BodyCaption,{children:O[V].description})]}))]})),s.jsxs("div",Object.assign({className:"right__nav"},{children:[s.jsx(d.IconButton,{Icon:n.default,style:{display:"flex"},onClick:()=>{R([],V),C((e=>Object.assign(Object.assign({},e),{[V]:[]}))),w("")}}),s.jsx("div",{children:"First page"})]}))]}))]})),!B&&s.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",marginTop:16}},{children:[s.jsx(h.TitleSmall,{children:"No results found!"}),I?s.jsx(h.BodyCaption,{children:"Sorry we could not find any recommended variables"}):s.jsx(h.BodyCaption,{children:`Sorry we could not find any results for "${_}"`})]})),s.jsx("div",Object.assign({className:"wrapper"},{children:s.jsx("div",Object.assign({className:"list__map"},{children:s.jsxs("div",Object.assign({className:"items"},{children:[!V&&L.map((e=>{let a=[];return _&&(a=Object.keys(e.variables).filter((s=>{var a;return(null===(a=e.variables[s].displayName)||void 0===a?void 0:a.toLowerCase().includes(_.toLowerCase()))||P(e.variables[s])}))),s.jsxs(s.Fragment,{children:[_?a.length>0?s.jsxs("div",Object.assign({className:"block"},{children:[s.jsx("div",Object.assign({className:"heading__font"},{children:null==e?void 0:e.displayName})),s.jsx(h.BodyCaption,Object.assign({style:{marginBottom:8,color:"#616161"}},{children:null==e?void 0:e.description}))]})):s.jsx(s.Fragment,{}):s.jsxs("div",Object.assign({className:"block"},{children:[s.jsx("div",Object.assign({className:"heading__font"},{children:null==e?void 0:e.displayName})),s.jsx(h.BodyCaption,Object.assign({style:{marginBottom:8,color:"#616161"}},{children:null==e?void 0:e.description}))]})),Object.keys(e.variables).map((a=>{var i;return _?(null===(i=e.variables[a].displayName)||void 0===i?void 0:i.toLowerCase().includes(_.toLowerCase()))||P(e.variables[a])?s.jsx("div",Object.assign({onClick:e.variables[a].isSubHeader?()=>D(e,a):()=>J(e,a)},{children:s.jsx(M,{item:e.variables[a]})})):s.jsx(s.Fragment,{}):s.jsx("div",Object.assign({onClick:e.variables[a].isSubHeader?()=>D(e,a):()=>J(e,a)},{children:s.jsx(M,{item:e.variables[a]})}))}))]})})),V&&s.jsx("div",Object.assign({className:"list__map"},{children:s.jsx("div",Object.assign({className:"items",style:{marginTop:16}},{children:Object.keys(O[V].variables).map(((e,a)=>{var i;return _?(null===(i=O[V].variables[e].displayName)||void 0===i?void 0:i.toLowerCase().includes(_.toLowerCase()))||P(O[V].variables[e])?W(O[V].variables[e],e):s.jsx(s.Fragment,{}):W(O[V].variables[e],e)}))}))}))]}))}))})),s.jsx("div",{className:"bottom__padding"})]}))]}))}))}),((e,s)=>e.enableVariable===s.enableVariable&&(e.leftPosition===s.leftPosition&&e.reRender===s.reRender)));exports.AddVariableV2=m;
@@ -40,6 +40,8 @@
40
40
 
41
41
  .search__bar {
42
42
  padding: 24px 24px 8px 24px;
43
+ background-color: #fafafa;
44
+ border-bottom: 1px solid var(--stroke-color-stroke-primary, #e0e0e0);
43
45
  }
44
46
  .nav__bar {
45
47
  display: flex;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react"),t=require("react-bootstrap"),n=require("../../constants/Theme.js"),s=require("../datePicker/DatePicker.js"),i=require("../TypographyStyle.js"),l=require("./CommonStyles.js");const a=o=>{let{eachOption:t,selectedOption:s,selectedDate:a,onClickingEachItem:c,rangeSelection:r}=o;return e.jsxs(l.ItemMenuContainer,Object.assign({onClick:()=>c(t),isSelected:t.isCustom?t.key==(null==s?void 0:s.key)&&!!a:t.key==(null==s?void 0:s.key)},{children:[e.jsx(i.BodySecondary,Object.assign({color:t.key==(null==s?void 0:s.key)?n.BASE_COLORS.positive[900]:n.BASE_COLORS.grayscale[900]},{children:t.label})),a&&(null==s?void 0:s.isCustom)&&t.key==(null==s?void 0:s.key)&&e.jsx(i.BodyCaption,{children:r?`${d(a[0])} to ${d(a[1])}`:`${d(a[0])}`})]}),t.key)},d=e=>e.toLocaleString("default",{day:"numeric",month:"short",year:"numeric"});exports.AnalyticsDropdown=c=>{let{options:r,placeholder:u="Select an option",selected:g,onOptionSelected:p,resetDropdown:v,maxHeight:m,backgroundColor:O,calendarPopperConfig:j,variant:D="default",datePickerPlacement:y}=c;var S,b,h;const[x,f]=o.useState(!1),[k,w]=o.useState(g),[C,R]=o.useState(),[E,T]=o.useState(!1),A=()=>{!x&&T(!E)},[M,q]=o.useState(g),P="small"===D?i.Caption:i.BodySecondary;return o.useEffect((()=>{v&&w(void 0)}),[v]),o.useEffect((()=>{var e;(null==g?void 0:g.isCustom)&&(null===(e=g.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?R(g.dateRangeSelectionOptions.selectedDates):g&&w(g)}),[g]),e.jsx(e.Fragment,{children:e.jsxs(l.MainDropdown,Object.assign({drop:"down",show:E,onToggle:A,backgroundColor:O},{children:[e.jsx(t.Dropdown.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown",style:"small"===D?{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",backgroundColor:"#FAFAFA",borderRadius:4,border:`1px solid ${n.DEFAULT_THEME.colorsV2.stroke.primary}`}:void 0},{children:e.jsx(P,Object.assign({style:"small"===D?{color:n.DEFAULT_THEME.colorsV2.content.secondary}:void 0},{children:(null==k?void 0:k.isCustom)?C?d(C[0])===d(C[1])?`${d(C[0])}`:`${d(C[0])} to ${d(C[1])}`:null==M?void 0:M.label:k?null==k?void 0:k.label:u}))})),e.jsx(t.Dropdown.Menu,Object.assign({className:"main--dropdown"},{children:e.jsxs(l.MainDropdown,Object.assign({drop:null!=y?y:"end",id:"sub--dropdown",show:x,onToggle:e=>{!e&&T(!1),f(!x)}},{children:[e.jsx("div",Object.assign({style:{maxHeight:m||"auto",overflowY:"scroll"}},{children:r.map((o=>{var n;return e.jsx("div",{children:(null==o?void 0:o.isCustom)?e.jsx(t.Dropdown.Toggle,Object.assign({className:"sub--dropdown"},{children:e.jsx(a,{eachOption:o,selectedOption:k,selectedDate:C,onClickingEachItem:e=>{w(e),f(!0)},rangeSelection:!!(null===(n=null==o?void 0:o.dateRangeSelectionOptions)||void 0===n?void 0:n.selectRange)})})):e.jsx(a,{eachOption:o,selectedOption:k,selectedDate:C,onClickingEachItem:e=>{if(R(void 0),w(e),q(e),A(),!e.noOfDays)return void p(e);const o=new Date,t=new Date;t.setDate(o.getDate()-e.noOfDays),p(Object.assign(Object.assign({},e),{selectedRange:[t,o]}))}})},null==o?void 0:o.key)}))})),e.jsx(t.Dropdown.Menu,Object.assign({className:"sub--dropdown",popperConfig:{modifiers:[{name:"offset",options:{offset:[(null==j?void 0:j.offsetSkid)||0,(null==j?void 0:j.offsetDistance)||0]}}]}},{children:e.jsx(s.DatePicker,{selectRange:(null===(S=null==k?void 0:k.dateRangeSelectionOptions)||void 0===S?void 0:S.selectRange)||!1,maxDate:null===(b=null==k?void 0:k.dateRangeSelectionOptions)||void 0===b?void 0:b.maxDate,minDate:null===(h=null==k?void 0:k.dateRangeSelectionOptions)||void 0===h?void 0:h.minDate,selectedDates:C,onSelectRange:(e,o)=>{const t=[e,o];(null==k?void 0:k.dateRangeSelectionOptions)&&(k.dateRangeSelectionOptions.selectedDates=t,p(Object.assign(Object.assign({},k),{selectedRange:[e,o]}))),q(k),f(!1),R(t),T(!E)},onSelectDate:e=>{(null==k?void 0:k.dateRangeSelectionOptions)&&(k.dateRangeSelectionOptions.selectedDates=[e,e],p(Object.assign(Object.assign({},k),{selectedRange:[e,e]}))),q(k),f(!1),R([e,e]),T(!E)}})}))]}))}))]}))})},exports.EachItem=a,exports.formatDate=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react"),t=require("react-bootstrap"),n=require("../../constants/Theme.js"),s=require("../datePicker/DatePicker.js"),i=require("../TypographyStyle.js"),l=require("./CommonStyles.js");const a=o=>{let{eachOption:t,selectedOption:s,selectedDate:a,onClickingEachItem:c,rangeSelection:r}=o;return e.jsxs(l.ItemMenuContainer,Object.assign({onClick:()=>c(t),isSelected:t.isCustom?t.key==(null==s?void 0:s.key)&&!!a:t.key==(null==s?void 0:s.key)},{children:[e.jsx(i.BodySecondary,Object.assign({color:t.key==(null==s?void 0:s.key)?n.BASE_COLORS.positive[900]:n.BASE_COLORS.grayscale[900]},{children:t.label})),a&&(null==s?void 0:s.isCustom)&&t.key==(null==s?void 0:s.key)&&e.jsx(i.BodyCaption,{children:r?`${d(a[0])} to ${d(a[1])}`:`${d(a[0])}`})]}),t.key)},d=e=>e.toLocaleString("default",{day:"numeric",month:"short",year:"numeric"});exports.AnalyticsDropdown=c=>{let{options:r,placeholder:u="Select an option",selected:g,onOptionSelected:p,resetDropdown:v,maxHeight:m,backgroundColor:O,calendarPopperConfig:j,variant:D="default",datePickerPlacement:y}=c;var S,b,h;const[x,f]=o.useState(!1),[k,w]=o.useState(g),[C,R]=o.useState(),[E,T]=o.useState(!1),A=()=>{!x&&T(!E)},[M,q]=o.useState(g),P="small"===D?i.Caption:i.BodySecondary;return o.useEffect((()=>{v&&w(void 0)}),[v]),o.useEffect((()=>{var e;(null==g?void 0:g.isCustom)&&(null===(e=g.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?R(g.dateRangeSelectionOptions.selectedDates):R(void 0),w(g)}),[g]),e.jsx(e.Fragment,{children:e.jsxs(l.MainDropdown,Object.assign({drop:"down",show:E,onToggle:A,backgroundColor:O},{children:[e.jsx(t.Dropdown.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown",style:"small"===D?{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",backgroundColor:"#FAFAFA",borderRadius:4,border:`1px solid ${n.DEFAULT_THEME.colorsV2.stroke.primary}`}:void 0},{children:e.jsx(P,Object.assign({style:"small"===D?{color:n.DEFAULT_THEME.colorsV2.content.secondary}:void 0},{children:(null==k?void 0:k.isCustom)?C?d(C[0])===d(C[1])?`${d(C[0])}`:`${d(C[0])} to ${d(C[1])}`:null==M?void 0:M.label:k?null==k?void 0:k.label:u}))})),e.jsx(t.Dropdown.Menu,Object.assign({className:"main--dropdown"},{children:e.jsxs(l.MainDropdown,Object.assign({drop:null!=y?y:"end",id:"sub--dropdown",show:x,onToggle:e=>{!e&&T(!1),f(!x)}},{children:[e.jsx("div",Object.assign({style:{maxHeight:m||"auto",overflowY:"scroll"}},{children:r.map((o=>{var n;return e.jsx("div",{children:(null==o?void 0:o.isCustom)?e.jsx(t.Dropdown.Toggle,Object.assign({className:"sub--dropdown"},{children:e.jsx(a,{eachOption:o,selectedOption:k,selectedDate:C,onClickingEachItem:e=>{w(e),f(!0)},rangeSelection:!!(null===(n=null==o?void 0:o.dateRangeSelectionOptions)||void 0===n?void 0:n.selectRange)})})):e.jsx(a,{eachOption:o,selectedOption:k,selectedDate:C,onClickingEachItem:e=>{if(R(void 0),w(e),q(e),A(),!e.noOfDays)return void p(e);const o=new Date,t=new Date;t.setDate(o.getDate()-e.noOfDays),p(Object.assign(Object.assign({},e),{selectedRange:[t,o]}))}})},null==o?void 0:o.key)}))})),e.jsx(t.Dropdown.Menu,Object.assign({className:"sub--dropdown",popperConfig:{modifiers:[{name:"offset",options:{offset:[(null==j?void 0:j.offsetSkid)||0,(null==j?void 0:j.offsetDistance)||0]}}]}},{children:e.jsx(s.DatePicker,{selectRange:(null===(S=null==k?void 0:k.dateRangeSelectionOptions)||void 0===S?void 0:S.selectRange)||!1,maxDate:null===(b=null==k?void 0:k.dateRangeSelectionOptions)||void 0===b?void 0:b.maxDate,minDate:null===(h=null==k?void 0:k.dateRangeSelectionOptions)||void 0===h?void 0:h.minDate,selectedDates:C,onSelectRange:(e,o)=>{const t=[e,o];(null==k?void 0:k.dateRangeSelectionOptions)&&(k.dateRangeSelectionOptions.selectedDates=t,p(Object.assign(Object.assign({},k),{selectedRange:[e,o]}))),q(k),f(!1),R(t),T(!E)},onSelectDate:e=>{(null==k?void 0:k.dateRangeSelectionOptions)&&(k.dateRangeSelectionOptions.selectedDates=[e,e],p(Object.assign(Object.assign({},k),{selectedRange:[e,e]}))),q(k),f(!1),R([e,e]),T(!E)}})}))]}))}))]}))})},exports.EachItem=a,exports.formatDate=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@emotion/styled/base"),r=require("react/jsx-runtime"),i=require("../../../../utils/StringUtils.js"),t=require("../../../../constants/Theme.js");require("../../../../constants/zindex.js");var g=require("react");require("../../../checkBox/CheckBox.styled.js");var s=require("../../../TypographyStyle.js");require("../../../list-item/ListItem.js"),require("../../../pagination/Pagination.js"),require("../../../radioButton/RadioButton.styled.js"),require("react-dom"),require("react-toastify"),require("../../../toaster/Toaster.styled.js"),require("@tippyjs/react"),require("../../../tooltips/TooltipInternal.js"),require("../../../spinner/Spinner.js"),require("../../../stepper/Stepper.styled.js"),require("../../../tag/Tag.js"),require("../../../icon-button/IconButton.js"),require("../../../template-preview/TemplatePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../../template-preview/models/TemplateMeta.js"),require("../../../modals/styledModal.js"),require("../../../template-preview/models/Channels.js"),require("../../../template-context-mapper/context/templateModalContext.js"),require("../../../template-context-mapper/modalElements/Footer.js"),require("../../../template-context-mapper/modalElements/Body.js"),require("../../../template-context-mapper/modalElements/Header.js"),require("../../../zeroState/ZeroState.js"),require("../../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../../button/Button.js"),require("../../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../../input/Input.js"),require("react-bootstrap"),require("../../../floating-action-button/FloatingActionButton.styles.js"),require("../../../image-compress/ImageCompress.js"),require("../../../progress-bar/ProgressBarComponent.js"),require("../../../QueryBuilder/QueryBuilder.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.js"),require("../../../QueryBuilder/constants/connectorPosition.js"),require("../../../QueryBuilder/constants/connector.js"),require("../../../QueryBuilder/types/QueryBuilder.type.js"),require("../../../dropdown/Dropdown.js"),require("../../../QueryBuilder/components/InputLoader.js"),require("../../../QueryBuilder/components/Connectors/Components/EmojiPicker.js"),require("react-chips"),require("../../../input/ChipInput.styled.js"),require("../../../QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js"),require("../../../QueryBuilder/components/Connectors/Components/IgPicker.js"),require("../../../QueryBuilder/components/Connectors/Components/InTheLast.js"),require("../../../QueryBuilder/components/Connectors/Components/InTwoLast.js"),require("react-calendar"),require("../../../../utils/DateUtils.js"),require("../../../datePicker/DatePickerWrapper.styled.js"),require("../../../QueryBuilder/components/Connectors/Connector.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNodeUIWrapper.styled.js"),require("../../../QueryBuilder/redux/queryBuilder.reducer.js"),require("../../../QueryBuilder/redux/queryBuilderCache.reducer.js"),require("../../../QueryBuilder/types/QueryBuilderOperator.type.js"),require("../../../dropdown/DropdownPopover/index.js"),require("../../../dropdown/ChipDropdown.js"),require("../../../dropdown/MenuItem/MenuItem.js"),require("../../../shimmer/ShimmerComponent/ShimmerStyled.js"),require("../../../analytics-card/AnalyticsCard.styled.js"),require("../../CommonStyles.js"),require("../../../datePicker/DatePicker.styled.js"),require("../../AnalyticsMetric.js"),require("../LineChart/LineChart.js"),require("../linearChipGroupedChart/LinearChipGroupedChart.styled.js");var I=require("./PieChart.js");require("../HorizontalBarGraph/HorizontalGraph.js"),require("../StackedBarChart/StackedBarChart.js"),require("../VerticalBarGraph/VerticalGraph.js"),require("../heatmap/HeatMap.js"),require("../VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js"),require("../../../avatar/Avatar.js"),require("../../../avatar/AvatarHelper.js"),require("../../../alerts/Alert.styled.js"),require("../../../alerts/AlertHelper.js"),require("../../../thumbnail/Thumbnail.js"),require("../../../curtain/Curtain.styled.js"),require("../../../curtain/CurtainHelper.js"),require("../../../switch/Switch.js"),require("../../../plans/SubscriptionPlanStyled.js"),require("../../../plans/SubscriptionPlanSelector.js"),require("../../../plans/SubscriptionPlansCollected.js"),require("../../../tabs/Tabs.js"),require("../../../TablePagination/TablePagination.styled.js"),require("../../../TablePagination/TablePaginationCard.js"),require("../../../states/StateComponent.js"),require("../../../../_virtual/_tslib.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditor.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditorHeader.js"),require("../../../card-selection-modal/CardSelectionModal.styled.js"),require("react-image-crop"),require("../../../buttonGroup/ButtonGroupStyle.js"),require("../../../accordion/Accordion.style.js"),require("../../../accordion/AccordionArrow.js"),require("../../../file-uploader/FileUploaderStyle.js"),require("../../../colourInput/ColourInput.styled.js"),require("../../../bik-layout/CommonStyles.js"),require("../../../navigation-hyperlink/NavigationHyperlink.js"),require("../../../bik-layout/SidebarStyles.js"),require("date-fns"),require("react-popper"),require("../../../dropdown/Common.styled.js"),require("../../../custom-date-time/CustomDateTime.styled.js"),require("../../../../node_modules/lodash.debounce/index.js"),require("../../../product-picker/ProductPicker.styled.js"),require("../../../discount-modal/type.js"),require("../../../product-picker-v2/emptyState.js"),require("../../../product-picker-v2/style.js"),require("lodash"),require("../../../product-picker-v2/type.js"),require("../../../discount-modal/DiscountModal.styled.js"),require("../../../discount-modal/DynamicCoupon/DynamicCoupon.js"),require("../../../discount-modal/CouponExpiration/CouponExpiration.js"),require("../../../country-code-picker/CountryCodePicker.styled.js"),require("../../../carousel/carousel.js"),require("../../../carousel-secondary/CarouselSecondary.style.js"),require("../../../access-token-troubleshoot-dialog/AccessTokenTroubleshootDialog.styles.js"),require("../../../radioList/RadioList.styled.js"),require("../../../checkList/CheckList.styled.js"),require("../../../postPicker/postPicker.js"),require("../../../dropdown-button/DropdownButton.style.js"),require("../../../side-modal/SideModal.style.js"),require("../../../add-variableV2/AddVariableV2.styled.js"),require("../../../modals/modal.styled.js"),require("../../../SearchFilter/types/SearchFilter.type.js"),require("../../../SearchFilter/components/DatePickerButton.js"),require("../../../SearchFilter/components/DateRangeOnlyButton.js"),require("../../../input-with-vars/InputWithVariables.js"),require("../../../star-rating/StarRating.js"),require("../../../dashboard-review-popup/components/FiveStar.styled.js"),require("../../../dashboard-review-popup/components/Form.styled.js"),require("../../../dashboard-review-popup/components/ZeroState.js"),require("../../../dashboard-review-popup/DashboardReviewPopUp.styled.js"),require("../../../testimonial-card/TestimonialCard.style.js"),require("../../../slider/slider.js");var C=require("chart.js"),o=require("react-chartjs-2");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=c(e);C.Chart.register(C.ArcElement,C.Legend);const l={plugins:{legend:{display:!1},tooltip:{enabled:!0,callbacks:{label:e=>{if(!e.label)return" 0%";const r=e.dataset.data.reduce(((e,r)=>e+r),0),i=parseFloat((e.raw/r*100).toFixed(1));return` ${e.label}: ${i}%`}}}}},A=["#5E07BB","#9E77ED","#D2AEFF","#CDE1FF","#92AFFA","#3935E1"],d=a.default("div","production"===process.env.NODE_ENV?{target:"elaov7f0"}:{target:"elaov7f0",label:"CartStyled"})("background:",(e=>t.COLORS.surface.standard),";border:1px solid ",(e=>t.COLORS.stroke.primary),";border-radius:4px;"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCJdLCJu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JcbiAgICAgICAgICAgICAgICBsYWJlbDogKHRvb2x0aXBJdGVtKSA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF0b29sdGlwSXRlbS5sYWJlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCAwJWA7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsID0gdG9vbHRpcEl0ZW0uZGF0YXNldC5kYXRhLnJlZHVjZSgoYWNjLCBjdXIpID0+IGFjYyArIGN1ciwgMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGVyY2VudGFnZSA9IHBhcnNlRmxvYXQoKCh0b29sdGlwSXRlbS5yYXcgLyB0b3RhbCkgKiAxMDApLnRvRml4ZWQoMSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBgICR7dG9vbHRpcEl0ZW0ubGFiZWx9OiAke3BlcmNlbnRhZ2V9JWA7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICB9LFxyXG4gICAgICAgIH0sXHJcbiAgICB9LFxyXG59O1xyXG5jb25zdCBHUkFQSF9DT0xPUlMgPSBbXHJcbiAgICAnIzVFMDdCQicsXHJcbiAgICAnIzlFNzdFRCcsXHJcbiAgICAnI0QyQUVGRicsXHJcbiAgICAnI0NERTFGRicsXHJcbiAgICAnIzkyQUZGQScsXHJcbiAgICAnIzM5MzVFMScsXHJcbl07XHJcbmNvbnN0IENhcnRTdHlsZWQgPSBzdHlsZWQuZGl2IGBcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IENPTE9SUy5zdXJmYWNlLnN0YW5kYXJkfTtcblx0Ym9yZGVyOiAxcHggc29saWQgJHsocHJvcHMpID0+IENPTE9SUy5zdHJva2UucHJpbWFyeX07XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcbmA7XHJcbmV4cG9ydCBjb25zdCBDYXJkID0gKHByb3BzKSA9Pi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JcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjogWycjRjBGMEYwJ10sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlcldpZHRoOiAwLFxyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZXREYXRhKGRhdGFTZXQpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgY29uc3QgZGF0YVNldCA9IHtcclxuICAgICAgICAgICAgICAgIGxhYmVsczogc2xpY2VzLm1hcCgoc2xpY2UpID0+IFN0cmluZ1V0aWxzLmNhcGl0YWxpemUoc2xpY2UubmFtZSkpLFxyXG4gICAgICAgICAgICAgICAgZGF0YXNldHM6IFtcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IHNsaWNlcy5tYXAoKHNsaWNlKSA9PiBzbGljZS5jb3VudCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjogc2xpY2VzLm1hcCgoc2xpY2UsIGluZGV4KSA9PiB7IHZhciBfYTsgcmV0dXJuIChfYSA9IHNsaWNlLmNvbG9yKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBHUkFQSF9DT0xPUlNbaW5kZXggJSBHUkFQSF9DT0xPUlMubGVuZ3RoXTsgfSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlckNvbG9yOiBbJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJ10sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlcldpZHRoOiA0LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJSYWRpdXM6IDgsXHJcbiAgICAgICAgICAgICAgICAgICAgfSxccl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jbGFzc05hbWU6ICdjb2wtNicsIHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWRkaW5nTGVmdDogNDgsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGV4RGlyZWN0aW9uOiAnY29sdW1uJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGp1c3RpZnlDb250ZW50OiAnY2VudGVyJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KFBpZUNoYXJ0LCB7IHNsaWNlczogc2xpY2VzV2l0aENvbG9yIH0pIH0pKV0gfSkpXSB9KSk7XHJcbn07XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPVBpZUNoYXJ0QW5hbHl0aWNzLmpzLm1hcCJdfQ== */"));exports.Card=e=>r.jsx(d,Object.assign({style:{padding:24}},{children:e.children})),exports.PieChartAnalytics=e=>{let{title:t,slices:C,size:c}=e;const[a,d]=g.useState([]),[u,n]=g.useState();return g.useEffect((()=>{const e=C.reduce(((e,r)=>e+r.count),0);let r=[];if(r=Object.keys(C).map(((e,r)=>Object.assign({color:A[r%A.length]},C[e]))),d([...r]),0===e){n({datasets:[{data:[100],backgroundColor:["#F0F0F0"],borderWidth:0}]})}else{const e={labels:C.map((e=>i.default.capitalize(e.name))),datasets:[{data:C.map((e=>e.count)),backgroundColor:C.map(((e,r)=>{var i;return null!==(i=e.color)&&void 0!==i?i:A[r%A.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};n(e)}}),[C]),u?r.jsxs(r.Fragment,{children:[t&&r.jsx(s.TitleMedium,Object.assign({style:{marginBottom:16}},{children:t})),r.jsxs("div",Object.assign({className:"row"},{children:[r.jsx("div",Object.assign({className:"col-6"},{children:r.jsx("div",Object.assign({style:{width:c,height:c}},{children:r.jsx(o.Doughnut,{data:u,options:Object.assign(Object.assign({},l),{maintainAspectRatio:!c})})}))})),r.jsx("div",Object.assign({className:"col-6",style:{paddingLeft:48,display:"flex",flexDirection:"column",justifyContent:"center"}},{children:r.jsx(I.PieChart,{slices:a})}))]}))]}):r.jsx(r.Fragment,{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@emotion/styled/base"),r=require("react/jsx-runtime"),i=require("../../../../utils/StringUtils.js"),t=require("../../../../constants/Theme.js");require("../../../../constants/zindex.js");var g=require("react");require("../../../checkBox/CheckBox.styled.js");var s=require("../../../TypographyStyle.js");require("../../../list-item/ListItem.js"),require("../../../pagination/Pagination.js"),require("../../../radioButton/RadioButton.styled.js"),require("react-dom"),require("react-toastify"),require("../../../toaster/Toaster.styled.js"),require("@tippyjs/react"),require("../../../tooltips/TooltipInternal.js"),require("../../../spinner/Spinner.js"),require("../../../stepper/Stepper.styled.js"),require("../../../tag/Tag.js"),require("../../../icon-button/IconButton.js"),require("../../../template-preview/TemplatePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../../template-preview/models/TemplateMeta.js"),require("../../../modals/styledModal.js"),require("../../../template-preview/models/Channels.js"),require("../../../template-context-mapper/context/templateModalContext.js"),require("../../../template-context-mapper/modalElements/Footer.js"),require("../../../template-context-mapper/modalElements/Body.js"),require("../../../template-context-mapper/modalElements/Header.js"),require("../../../zeroState/ZeroState.js"),require("../../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../../button/Button.js"),require("../../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../../input/Input.js"),require("react-bootstrap"),require("../../../floating-action-button/FloatingActionButton.styles.js"),require("../../../image-compress/ImageCompress.js"),require("../../../progress-bar/ProgressBarComponent.js"),require("../../../QueryBuilder/QueryBuilder.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.js"),require("../../../QueryBuilder/constants/connectorPosition.js"),require("../../../QueryBuilder/constants/connector.js"),require("../../../QueryBuilder/types/QueryBuilder.type.js"),require("../../../dropdown/Dropdown.js"),require("../../../QueryBuilder/components/InputLoader.js"),require("../../../QueryBuilder/components/Connectors/Components/EmojiPicker.js"),require("react-chips"),require("../../../input/ChipInput.styled.js"),require("../../../QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js"),require("../../../QueryBuilder/components/Connectors/Components/IgPicker.js"),require("../../../QueryBuilder/components/Connectors/Components/InTheLast.js"),require("../../../QueryBuilder/components/Connectors/Components/InTwoLast.js"),require("react-calendar"),require("../../../../utils/DateUtils.js"),require("../../../datePicker/DatePickerWrapper.styled.js"),require("../../../QueryBuilder/components/Connectors/Connector.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNodeUIWrapper.styled.js"),require("../../../QueryBuilder/redux/queryBuilder.reducer.js"),require("../../../QueryBuilder/redux/queryBuilderCache.reducer.js"),require("../../../QueryBuilder/types/QueryBuilderOperator.type.js"),require("../../../dropdown/DropdownPopover/index.js"),require("../../../dropdown/ChipDropdown.js"),require("../../../dropdown/MenuItem/MenuItem.js"),require("../../../shimmer/ShimmerComponent/ShimmerStyled.js"),require("../../../analytics-card/AnalyticsCard.styled.js"),require("../../CommonStyles.js"),require("../../../datePicker/DatePicker.styled.js"),require("../../AnalyticsMetric.js"),require("../LineChart/LineChart.js"),require("../linearChipGroupedChart/LinearChipGroupedChart.styled.js");var I=require("./PieChart.js");require("../HorizontalBarGraph/HorizontalGraph.js"),require("../StackedBarChart/StackedBarChart.js"),require("../VerticalBarGraph/VerticalGraph.js"),require("../heatmap/HeatMap.js"),require("../VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js"),require("../../../avatar/Avatar.js"),require("../../../avatar/AvatarHelper.js"),require("../../../alerts/Alert.styled.js"),require("../../../alerts/AlertHelper.js"),require("../../../thumbnail/Thumbnail.js"),require("../../../curtain/Curtain.styled.js"),require("../../../curtain/CurtainHelper.js"),require("../../../switch/Switch.js"),require("../../../plans/SubscriptionPlanStyled.js"),require("../../../plans/SubscriptionPlanSelector.js"),require("../../../plans/SubscriptionPlansCollected.js"),require("../../../tabs/Tabs.js"),require("../../../TablePagination/TablePagination.styled.js"),require("../../../TablePagination/TablePaginationCard.js"),require("../../../states/StateComponent.js"),require("../../../../_virtual/_tslib.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditor.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditorHeader.js"),require("../../../card-selection-modal/CardSelectionModal.styled.js"),require("react-image-crop"),require("../../../buttonGroup/ButtonGroupStyle.js"),require("../../../accordion/Accordion.style.js"),require("../../../accordion/AccordionArrow.js"),require("../../../file-uploader/FileUploaderStyle.js"),require("../../../colourInput/ColourInput.styled.js"),require("../../../bik-layout/CommonStyles.js"),require("../../../navigation-hyperlink/NavigationHyperlink.js"),require("../../../bik-layout/SidebarStyles.js"),require("date-fns"),require("react-popper"),require("../../../dropdown/Common.styled.js"),require("../../../custom-date-time/CustomDateTime.styled.js"),require("../../../../node_modules/lodash.debounce/index.js"),require("../../../product-picker/ProductPicker.styled.js"),require("../../../discount-modal/type.js"),require("../../../product-picker-v2/modal.js"),require("../../../discount-modal/DiscountModal.styled.js"),require("../../../discount-modal/DynamicCoupon/DynamicCoupon.js"),require("../../../discount-modal/CouponExpiration/CouponExpiration.js"),require("../../../country-code-picker/CountryCodePicker.styled.js"),require("../../../carousel/carousel.js"),require("../../../carousel-secondary/CarouselSecondary.style.js"),require("../../../access-token-troubleshoot-dialog/AccessTokenTroubleshootDialog.styles.js"),require("../../../radioList/RadioList.styled.js"),require("../../../checkList/CheckList.styled.js"),require("../../../postPicker/postPicker.js"),require("../../../dropdown-button/DropdownButton.style.js"),require("../../../side-modal/SideModal.style.js"),require("../../../add-variableV2/AddVariableV2.styled.js"),require("../../../modals/modal.styled.js"),require("../../../SearchFilter/types/SearchFilter.type.js"),require("../../../SearchFilter/components/DatePickerButton.js"),require("../../../SearchFilter/components/DateRangeOnlyButton.js"),require("../../../input-with-vars/InputWithVariables.js"),require("../../../star-rating/StarRating.js"),require("../../../dashboard-review-popup/components/FiveStar.styled.js"),require("../../../dashboard-review-popup/components/Form.styled.js"),require("../../../dashboard-review-popup/components/ZeroState.js"),require("../../../dashboard-review-popup/DashboardReviewPopUp.styled.js"),require("../../../testimonial-card/TestimonialCard.style.js"),require("../../../slider/slider.js");var C=require("chart.js"),o=require("react-chartjs-2");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=c(e);C.Chart.register(C.ArcElement,C.Legend);const l={plugins:{legend:{display:!1},tooltip:{enabled:!0,callbacks:{label:e=>{if(!e.label)return" 0%";const r=e.dataset.data.reduce(((e,r)=>e+r),0),i=parseFloat((e.raw/r*100).toFixed(1));return` ${e.label}: ${i}%`}}}}},A=["#5E07BB","#9E77ED","#D2AEFF","#CDE1FF","#92AFFA","#3935E1"],d=a.default("div","production"===process.env.NODE_ENV?{target:"elaov7f0"}:{target:"elaov7f0",label:"CartStyled"})("background:",(e=>t.COLORS.surface.standard),";border:1px solid ",(e=>t.COLORS.stroke.primary),";border-radius:4px;"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFzQzhCIiwiZmlsZSI6IlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGpzeCBhcy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gICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZXREYXRhKGRhdGFTZXQpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgY29uc3QgZGF0YVNldCA9IHtcclxuICAgICAgICAgICAgICAgIGxhYmVsczogc2xpY2VzLm1hcCgoc2xpY2UpID0+IFN0cmluZ1V0aWxzLmNhcGl0YWxpemUoc2xpY2UubmFtZSkpLFxyXG4gICAgICAgICAgICAgICAgZGF0YXNldHM6IFtcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IHNsaWNlcy5tYXAoKHNsaWNlKSA9PiBzbGljZS5jb3VudCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjogc2xpY2VzLm1hcCgoc2xpY2UsIGluZGV4KSA9PiB7IHZhciBfYTsgcmV0dXJuIChfYSA9IHNsaWNlLmNvbG9yKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBHUkFQSF9DT0xPUlNbaW5kZXggJSBHUkFQSF9DT0xPUlMubGVuZ3RoXTsgfSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlckNvbG9yOiBbJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJ10sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlcldpZHRoOiA0LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJSYWRpdXM6IDgsXHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIF0sXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNldERhdGEoZGF0YVNldCk7XHJcbiAgICAgICAgfVxyXG4gICAgfSwgW3NsaWNlc10pO1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ICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGV4RGlyZWN0aW9uOiAnY29sdW1uJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGp1c3RpZnlDb250ZW50OiAnY2VudGVyJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KFBpZUNoYXJ0LCB7IHNsaWNlczogc2xpY2VzV2l0aENvbG9yIH0pIH0pKV0gfSkpXSB9KSk7XHJcbn07XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPVBpZUNoYXJ0QW5hbHl0aWNzLmpzLm1hcCJdfQ== */"));exports.Card=e=>r.jsx(d,Object.assign({style:{padding:24}},{children:e.children})),exports.PieChartAnalytics=e=>{let{title:t,slices:C,size:c}=e;const[a,d]=g.useState([]),[n,u]=g.useState();return g.useEffect((()=>{const e=C.reduce(((e,r)=>e+r.count),0);let r=[];if(r=Object.keys(C).map(((e,r)=>Object.assign({color:A[r%A.length]},C[e]))),d([...r]),0===e){u({datasets:[{data:[100],backgroundColor:["#F0F0F0"],borderWidth:0}]})}else{const e={labels:C.map((e=>i.default.capitalize(e.name))),datasets:[{data:C.map((e=>e.count)),backgroundColor:C.map(((e,r)=>{var i;return null!==(i=e.color)&&void 0!==i?i:A[r%A.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};u(e)}}),[C]),n?r.jsxs(r.Fragment,{children:[t&&r.jsx(s.TitleMedium,Object.assign({style:{marginBottom:16}},{children:t})),r.jsxs("div",Object.assign({className:"row"},{children:[r.jsx("div",Object.assign({className:"col-6"},{children:r.jsx("div",Object.assign({style:{width:c,height:c}},{children:r.jsx(o.Doughnut,{data:n,options:Object.assign(Object.assign({},l),{maintainAspectRatio:!c})})}))})),r.jsx("div",Object.assign({className:"col-6",style:{paddingLeft:48,display:"flex",flexDirection:"column",justifyContent:"center"}},{children:r.jsx(I.PieChart,{slices:a})}))]}))]}):r.jsx(r.Fragment,{})};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),s=require("../../button/Button.js");require("react");var i=require("../type.js");require("../../dropdown/DropdownPopover/index.js");var n=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("../../zeroState/ZeroState.js");var a=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../checkBox/CheckBox.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js");var r=require("../../input/Input.js"),l=require("../../../assets/icons/cross.svg.js");require("../../dropdown/MenuItem/MenuItem.js"),require("../../modals/styledModal.js"),require("../../../node_modules/lodash.debounce/index.js"),require("../../bik-layout/CommonStyles.js"),require("../../product-picker/ProductPicker.styled.js"),require("../../../utils/DateUtils.js"),require("../../tag/Tag.js"),require("@tippyjs/react"),require("../../tooltips/TooltipInternal.js"),require("../../spinner/Spinner.js"),require("../../icon-button/IconButton.js"),require("../../shimmer/ShimmerComponent/ShimmerStyled.js"),require("../../product-picker-v2/emptyState.js"),require("../../product-picker-v2/style.js"),require("../../product-picker-v2/type.js");var d=require("../DiscountModal.styled.js"),u=require("../CouponExpiration/CouponExpiration.js"),c=require("../../radioButton/RadioButton.js"),p=require("../../../assets/icons/cursor.svg.js"),T=require("../../../assets/icons/plus.svg.js");const j="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg";var D;function m(){return null}exports.DISCOUNT_PRODUCTS=void 0,(D=exports.DISCOUNT_PRODUCTS||(exports.DISCOUNT_PRODUCTS={})).ENTITLED="entitled",D.PREREQUISITE="prerequisite";exports.default=D=>{var v;const x=[{value:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:i.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:D.selectedCouponType===i.DISCOUNT_TYPES.BUY_X_GET_Y},{value:i.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:D.selectedCouponType===i.DISCOUNT_TYPES.FREE_SHIPPING}],E=[{selected:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.NA,label:"No minimum requirements",value:i.MIN_PURCHASE_REQUIREMENT.NA},{selected:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT,label:`Minimum purchase amount (${null!==(v=D.currency)&&void 0!==v?v:"₹"})`,value:i.MIN_PURCHASE_REQUIREMENT.AMOUNT},{selected:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.QUANTITY,label:"Minimum quantity of items",value:i.MIN_PURCHASE_REQUIREMENT.QUANTITY}],O=()=>{var e,t,s,n,a;if(D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT){if((null===(e=D.discountData)||void 0===e?void 0:e.value)&&(null===(t=D.discountData)||void 0===t?void 0:t.value)<=0)return"Enter a valid input"}else if((null===(s=D.discountData)||void 0===s?void 0:s.value)&&((null===(n=D.discountData)||void 0===n?void 0:n.value)<=0||(null===(a=D.discountData)||void 0===a?void 0:a.value)>100))return"Enter a valid input"},g=()=>{var t,s,o,l,d;return e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsxs("div",Object.assign({className:"input__wrapper"},{children:[e.jsx(a.BodySecondary,Object.assign({style:{marginBottom:10}},{children:"Min purchase requirements"})),e.jsx(n.Dropdown,{options:E,placement:"bottom-start",onSelect:e=>{const t=e.value;D.setSelectedMinimumRequirement(t),D.setDiscountData(Object.assign(Object.assign({},D.discountData),{minQuantity:void 0,minAmount:void 0}))}})]})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:D.selectedMinimumRequirement!==i.MIN_PURCHASE_REQUIREMENT.NA&&e.jsx(r.Input,{value:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(s=null===(t=D.discountData.minAmount)||void 0===t?void 0:t.toString())&&void 0!==s?s:"":null!==(l=null===(o=D.discountData.minQuantity)||void 0===o?void 0:o.toString())&&void 0!==l?l:"",onChangeText:e=>{D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?D.setDiscountData(Object.assign(Object.assign({},D.discountData),{minAmount:parseInt(e)})):D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.QUANTITY&&D.setDiscountData(Object.assign(Object.assign({},D.discountData),{minQuantity:parseInt(e)}))},labelText:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?"Minimum purchase amount":"Minimum purchase quantity",prefixText:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(d=D.currency)&&void 0!==d?d:"₹":void 0,type:"number",placeholder:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?"1000.00":"2"})}))]}))},b=(i,n)=>{var d,u,c,p;let m=[],v=[],x={},E={};return D.useNewPicker?(x=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledProducts:D.prerequisiteProducts,E=null!==(d=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledCollections:D.prerequisiteCollections)&&void 0!==d?d:[],(null==x?void 0:x.isCustom)&&delete x.isCustom,(null==E?void 0:E.isCustom)&&delete E.isCustom,Object.values(x).forEach((e=>{Object.keys(e.products).forEach((t=>{m.push({id:t,name:e.products[t].name,image:e.products[t].image})}))})),Object.keys(E).forEach((e=>{"isCustom"!==e&&v.push({id:e,name:E[e].name,image:E[e].image})}))):(m=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledProducts:D.prerequisiteProducts,v=null!==(u=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledCollections:D.prerequisiteCollections)&&void 0!==u?u:[]),e.jsxs(e.Fragment,{children:[!n&&e.jsxs(e.Fragment,{children:[e.jsx(a.TitleRegular,{children:i===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"Customer buys":"Customer gets"}),e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(r.Input,{value:i===exports.DISCOUNT_PRODUCTS.ENTITLED?null===(c=D.discountData.entitledQuantity)||void 0===c?void 0:c.toString():null===(p=D.discountData.prerequisiteQuantity)||void 0===p?void 0:p.toString(),type:"number",onChangeText:e=>{i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setDiscountData(Object.assign(Object.assign({},D.discountData),{entitledQuantity:parseInt(e)})):D.setDiscountData(Object.assign(Object.assign({},D.discountData),{prerequisiteQuantity:parseInt(e)}))},labelText:"Add quantity",placeholder:"Add quantity"})})),e.jsx("div",{className:"input__wrapper"})]}))]}),e.jsxs("div",Object.assign({style:{display:"flex",gap:18}},{children:[!(null==v?void 0:v.length)&&e.jsx(s.Button,{buttonText:"Add product",buttonType:"tertiary",LeadingIcon:T.default,onClick:()=>{D.setIsProductPickerOpen(i)}}),!(null==m?void 0:m.length)&&e.jsx(s.Button,{buttonText:"Add collection",buttonType:"tertiary",LeadingIcon:T.default,onClick:()=>{D.setIsCollectionPickerOpen(i)}})]})),!!m.length&&e.jsxs("div",Object.assign({style:{margin:"8px 0"}},{children:[e.jsx(a.TitleSmall,{children:"Products"}),m.map((s=>e.jsxs("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,display:"flex"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[e.jsx("img",{src:s.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),e.jsx(a.TitleSmall,{children:s.name})]})),e.jsx("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(D.useNewPicker){const e=t.cloneDeep(x);Object.values(e).forEach((e=>{var t,i;(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t[s.id])&&(null===(i=null==e?void 0:e.products)||void 0===i||delete i[s.id])})),i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledProducts(e):D.setPrerequisiteProducts(e)}else{const e=m.filter((e=>e.id!==s.id));i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledProducts(e):D.setPrerequisiteProducts(e)}}},{children:e.jsx(l.default,{width:14,color:o.DEFAULT_THEME.colorsV2.content.primary})}))}))]}),s.id)))]})),!!v.length&&e.jsxs("div",Object.assign({style:{margin:"8px 0"}},{children:[e.jsx(a.TitleSmall,{children:"Collections"}),v.map((s=>e.jsxs("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,display:"flex"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[e.jsx("img",{src:s.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),e.jsx(a.TitleSmall,{children:s.name})]})),e.jsx("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(D.useNewPicker){const e=t.cloneDeep(E);delete e[s.id],i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledCollections(e):D.setPrerequisiteCollections(e)}else{const e=v.filter((e=>e.id!==s.id));i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledCollections(e):D.setPrerequisiteCollections(e)}}},{children:e.jsx(l.default,{width:14,color:o.DEFAULT_THEME.colorsV2.content.primary})}))}))]}),s.id)))]}))]})};return e.jsxs(d.DynamicCouponContainer,{children:[D.allowStaticCoupon&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(n.Dropdown,{options:x,width:"338px",placement:"bottom-start",onSelect:e=>{D.onChangeCouponType(e)}})})),e.jsx("div",Object.assign({className:"input__wrapper",style:{display:"flex",alignItems:"center",gap:8}},{children:(D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)&&e.jsxs(e.Fragment,{children:[e.jsx(c.RadioButton,{isActive:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,onValueChange:()=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,value:void 0}))},label:"Fixed amount"}),e.jsx(c.RadioButton,{isActive:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.PERCENTAGE,onValueChange:()=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,value:void 0}))},label:"Percentage"})]})}))]})),D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&(()=>{var t,s,n,a,o;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(r.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(r.Input,{value:null!==(n=null===(s=null===(t=D.discountData)||void 0===t?void 0:t.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",labelText:"Discount code value",type:"number",errorMessage:O(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:parseInt(e)}))},placeholder:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(a=D.currency)&&void 0!==a?a:"₹":void 0,suffixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0})}))]})),g(),!D.hideProbability&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(r.Input,{type:"number",value:null===(o=D.discountData.probability)||void 0===o?void 0:o.toString(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})})),e.jsx("div",{className:"input__wrapper"})]}))]})})(),D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&(()=>{var t,s,n,a,o;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(r.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(r.Input,{value:null!==(n=null===(s=null===(t=D.discountData)||void 0===t?void 0:t.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",labelText:"Discount code value",type:"number",errorMessage:O(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:parseInt(e)}))},placeholder:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(a=D.currency)&&void 0!==a?a:"₹":void 0,suffixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0})}))]})),b(exports.DISCOUNT_PRODUCTS.ENTITLED,!0),!D.hideProbability&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(r.Input,{type:"number",value:null===(o=D.discountData.probability)||void 0===o?void 0:o.toString(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})})),e.jsx("div",{className:"input__wrapper"})]}))]})})(),D.selectedCouponType===i.DISCOUNT_TYPES.FREE_SHIPPING&&(()=>{var t;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(r.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},labelText:"Code title",placeholder:"eg: Flat 50% Off",maxCharLimit:18})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:!D.hideProbability&&e.jsx(r.Input,{value:null===(t=D.discountData.probability)||void 0===t?void 0:t.toString(),type:"number",onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})}))]})),g()]})})(),D.selectedCouponType===i.DISCOUNT_TYPES.BUY_X_GET_Y&&(()=>{var t,s,i,n;return e.jsxs(d.DynamicCouponContainer,{children:[e.jsx("div",Object.assign({className:"input__rows"},{children:e.jsxs("div",Object.assign({style:{display:"flex",gap:20,flex:1}},{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(r.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),!D.hideProbability&&e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(r.Input,{value:null===(t=D.discountData.probability)||void 0===t?void 0:t.toString(),type:"number",onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})}))]}))})),e.jsx(m,{}),b(exports.DISCOUNT_PRODUCTS.PREREQUISITE),e.jsx(m,{}),b(exports.DISCOUNT_PRODUCTS.ENTITLED),e.jsx(m,{}),e.jsx(a.TitleRegular,{children:"At a discount value"}),e.jsxs("div",Object.assign({style:{display:"flex",gap:18,alignItems:"flex-start"}},{children:[e.jsx(c.RadioButton,{label:"Percentage",isActive:100!==D.discountData.value,onValueChange:()=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:void 0}))}}),100!==D.discountData.value&&e.jsx(r.Input,{variant:"small",value:null!==(n=null===(i=null===(s=D.discountData)||void 0===s?void 0:s.value)||void 0===i?void 0:i.toString())&&void 0!==n?n:"",onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:parseInt(e)}))},errorMessage:O(),type:"number",placeholder:"Enter percentage eg: 10%",suffixText:"%",width:"238px"})]})),e.jsx("div",{children:e.jsx(c.RadioButton,{label:"Free",isActive:100===D.discountData.value,onValueChange:e=>{e?D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:100})):D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:void 0}))}})})]})})(),D.selectedCouponType&&!D.hideExpiration&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:D.selectedCouponType!==i.DISCOUNT_TYPES.BUY_X_GET_Y&&D.selectedCouponType!==i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||!D.hideProbability?{height:6,borderTop:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,marginTop:12}:{}}),e.jsx(u.CouponExpiration,{discountData:D.discountData,setDiscountData:D.setDiscountData})]}),!D.selectedCouponType&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:10,padding:"40px 0",justifyContent:"center",alignItems:"center"}},{children:[e.jsx("div",Object.assign({style:{height:52,width:52,backgroundColor:o.DEFAULT_THEME.colorsV2.background.inverse,borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},{children:e.jsx(p.default,{width:32,color:o.DEFAULT_THEME.colorsV2.content.primaryInverse})})),e.jsx(a.TitleMedium,{children:"No discount has been selected"}),e.jsx(a.BodyPrimary,{children:"Please select a discount type"})]}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),s=require("../../button/Button.js");require("react");var i=require("../type.js");require("../../dropdown/DropdownPopover/index.js");var n=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("../../zeroState/ZeroState.js");var a=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../checkBox/CheckBox.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js");var l=require("../../input/Input.js"),r=require("../../../assets/icons/cross.svg.js");require("../../dropdown/MenuItem/MenuItem.js"),require("../../modals/styledModal.js"),require("../../../node_modules/lodash.debounce/index.js"),require("../../bik-layout/CommonStyles.js"),require("../../product-picker/ProductPicker.styled.js"),require("../../../utils/DateUtils.js"),require("../../tag/Tag.js"),require("@tippyjs/react"),require("../../tooltips/TooltipInternal.js"),require("../../product-picker-v2/modal.js");var d=require("../DiscountModal.styled.js"),u=require("../CouponExpiration/CouponExpiration.js"),c=require("../../radioButton/RadioButton.js"),p=require("../../../assets/icons/cursor.svg.js"),T=require("../../../assets/icons/plus.svg.js");const j="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg";var D;function x(){return null}exports.DISCOUNT_PRODUCTS=void 0,(D=exports.DISCOUNT_PRODUCTS||(exports.DISCOUNT_PRODUCTS={})).ENTITLED="entitled",D.PREREQUISITE="prerequisite";exports.default=D=>{var v;const E=[{value:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:i.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:D.selectedCouponType===i.DISCOUNT_TYPES.BUY_X_GET_Y},{value:i.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:D.selectedCouponType===i.DISCOUNT_TYPES.FREE_SHIPPING}],O=[{selected:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.NA,label:"No minimum requirements",value:i.MIN_PURCHASE_REQUIREMENT.NA},{selected:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT,label:`Minimum purchase amount (${null!==(v=D.currency)&&void 0!==v?v:"₹"})`,value:i.MIN_PURCHASE_REQUIREMENT.AMOUNT},{selected:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.QUANTITY,label:"Minimum quantity of items",value:i.MIN_PURCHASE_REQUIREMENT.QUANTITY}],m=()=>{var e,t,s,n,a;if(D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT){if((null===(e=D.discountData)||void 0===e?void 0:e.value)&&(null===(t=D.discountData)||void 0===t?void 0:t.value)<=0)return"Enter a valid input"}else if((null===(s=D.discountData)||void 0===s?void 0:s.value)&&((null===(n=D.discountData)||void 0===n?void 0:n.value)<=0||(null===(a=D.discountData)||void 0===a?void 0:a.value)>100))return"Enter a valid input"},g=()=>{var t,s,o,r,d;return e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsxs("div",Object.assign({className:"input__wrapper"},{children:[e.jsx(a.BodySecondary,Object.assign({style:{marginBottom:10}},{children:"Min purchase requirements"})),e.jsx(n.Dropdown,{options:O,placement:"bottom-start",onSelect:e=>{const t=e.value;D.setSelectedMinimumRequirement(t),D.setDiscountData(Object.assign(Object.assign({},D.discountData),{minQuantity:void 0,minAmount:void 0}))}})]})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:D.selectedMinimumRequirement!==i.MIN_PURCHASE_REQUIREMENT.NA&&e.jsx(l.Input,{value:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(s=null===(t=D.discountData.minAmount)||void 0===t?void 0:t.toString())&&void 0!==s?s:"":null!==(r=null===(o=D.discountData.minQuantity)||void 0===o?void 0:o.toString())&&void 0!==r?r:"",onChangeText:e=>{D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?D.setDiscountData(Object.assign(Object.assign({},D.discountData),{minAmount:parseInt(e)})):D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.QUANTITY&&D.setDiscountData(Object.assign(Object.assign({},D.discountData),{minQuantity:parseInt(e)}))},labelText:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?"Minimum purchase amount":"Minimum purchase quantity",prefixText:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(d=D.currency)&&void 0!==d?d:"₹":void 0,type:"number",placeholder:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?"1000.00":"2"})}))]}))},b=(i,n)=>{var d,u,c,p;let x=[],v=[],E={},O={};return D.useNewPicker?(E=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledProducts:D.prerequisiteProducts,O=null!==(d=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledCollections:D.prerequisiteCollections)&&void 0!==d?d:[],(null==E?void 0:E.isCustom)&&delete E.isCustom,(null==O?void 0:O.isCustom)&&delete O.isCustom,Object.values(E).forEach((e=>{Object.keys(e.products).forEach((t=>{x.push({id:t,name:e.products[t].name,image:e.products[t].image})}))})),Object.keys(O).forEach((e=>{"isCustom"!==e&&v.push({id:e,name:O[e].name,image:O[e].image})}))):(x=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledProducts:D.prerequisiteProducts,v=null!==(u=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledCollections:D.prerequisiteCollections)&&void 0!==u?u:[]),e.jsxs(e.Fragment,{children:[!n&&e.jsxs(e.Fragment,{children:[e.jsx(a.TitleRegular,{children:i===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"Customer buys":"Customer gets"}),e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:i===exports.DISCOUNT_PRODUCTS.ENTITLED?null===(c=D.discountData.entitledQuantity)||void 0===c?void 0:c.toString():null===(p=D.discountData.prerequisiteQuantity)||void 0===p?void 0:p.toString(),type:"number",onChangeText:e=>{i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setDiscountData(Object.assign(Object.assign({},D.discountData),{entitledQuantity:parseInt(e)})):D.setDiscountData(Object.assign(Object.assign({},D.discountData),{prerequisiteQuantity:parseInt(e)}))},labelText:"Add quantity",placeholder:"Add quantity"})})),e.jsx("div",{className:"input__wrapper"})]}))]}),e.jsxs("div",Object.assign({style:{display:"flex",gap:18}},{children:[!(null==v?void 0:v.length)&&e.jsx(s.Button,{buttonText:"Add product",buttonType:"tertiary",LeadingIcon:T.default,onClick:()=>{D.setIsProductPickerOpen(i)}}),!(null==x?void 0:x.length)&&e.jsx(s.Button,{buttonText:"Add collection",buttonType:"tertiary",LeadingIcon:T.default,onClick:()=>{D.setIsCollectionPickerOpen(i)}})]})),!!x.length&&e.jsxs("div",Object.assign({style:{margin:"8px 0"}},{children:[e.jsx(a.TitleSmall,{children:"Products"}),x.map((s=>e.jsxs("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,display:"flex"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[e.jsx("img",{src:s.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),e.jsx(a.TitleSmall,{children:s.name})]})),e.jsx("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(D.useNewPicker){const e=t.cloneDeep(E);Object.values(e).forEach((e=>{var t,i;(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t[s.id])&&(null===(i=null==e?void 0:e.products)||void 0===i||delete i[s.id])})),i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledProducts(e):D.setPrerequisiteProducts(e)}else{const e=x.filter((e=>e.id!==s.id));i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledProducts(e):D.setPrerequisiteProducts(e)}}},{children:e.jsx(r.default,{width:14,color:o.DEFAULT_THEME.colorsV2.content.primary})}))}))]}),s.id)))]})),!!v.length&&e.jsxs("div",Object.assign({style:{margin:"8px 0"}},{children:[e.jsx(a.TitleSmall,{children:"Collections"}),v.map((s=>e.jsxs("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,display:"flex"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[e.jsx("img",{src:s.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),e.jsx(a.TitleSmall,{children:s.name})]})),e.jsx("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(D.useNewPicker){const e=t.cloneDeep(O);delete e[s.id],i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledCollections(e):D.setPrerequisiteCollections(e)}else{const e=v.filter((e=>e.id!==s.id));i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledCollections(e):D.setPrerequisiteCollections(e)}}},{children:e.jsx(r.default,{width:14,color:o.DEFAULT_THEME.colorsV2.content.primary})}))}))]}),s.id)))]}))]})};return e.jsxs(d.DynamicCouponContainer,{children:[D.allowStaticCoupon&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(n.Dropdown,{options:E,width:"338px",placement:"bottom-start",onSelect:e=>{D.onChangeCouponType(e)}})})),e.jsx("div",Object.assign({className:"input__wrapper",style:{display:"flex",alignItems:"center",gap:8}},{children:(D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)&&e.jsxs(e.Fragment,{children:[e.jsx(c.RadioButton,{isActive:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,onValueChange:()=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,value:void 0}))},label:"Fixed amount"}),e.jsx(c.RadioButton,{isActive:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.PERCENTAGE,onValueChange:()=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,value:void 0}))},label:"Percentage"})]})}))]})),D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&(()=>{var t,s,n,a,o;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:null!==(n=null===(s=null===(t=D.discountData)||void 0===t?void 0:t.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",labelText:"Discount code value",type:"number",errorMessage:m(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:parseInt(e)}))},placeholder:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(a=D.currency)&&void 0!==a?a:"₹":void 0,suffixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0})}))]})),g(),!D.hideProbability&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{type:"number",value:null===(o=D.discountData.probability)||void 0===o?void 0:o.toString(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})})),e.jsx("div",{className:"input__wrapper"})]}))]})})(),D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&(()=>{var t,s,n,a,o;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:null!==(n=null===(s=null===(t=D.discountData)||void 0===t?void 0:t.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",labelText:"Discount code value",type:"number",errorMessage:m(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:parseInt(e)}))},placeholder:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(a=D.currency)&&void 0!==a?a:"₹":void 0,suffixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0})}))]})),b(exports.DISCOUNT_PRODUCTS.ENTITLED,!0),!D.hideProbability&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{type:"number",value:null===(o=D.discountData.probability)||void 0===o?void 0:o.toString(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})})),e.jsx("div",{className:"input__wrapper"})]}))]})})(),D.selectedCouponType===i.DISCOUNT_TYPES.FREE_SHIPPING&&(()=>{var t;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},labelText:"Code title",placeholder:"eg: Flat 50% Off",maxCharLimit:18})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:!D.hideProbability&&e.jsx(l.Input,{value:null===(t=D.discountData.probability)||void 0===t?void 0:t.toString(),type:"number",onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})}))]})),g()]})})(),D.selectedCouponType===i.DISCOUNT_TYPES.BUY_X_GET_Y&&(()=>{var t,s,i,n;return e.jsxs(d.DynamicCouponContainer,{children:[e.jsx("div",Object.assign({className:"input__rows"},{children:e.jsxs("div",Object.assign({style:{display:"flex",gap:20,flex:1}},{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(l.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),!D.hideProbability&&e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(l.Input,{value:null===(t=D.discountData.probability)||void 0===t?void 0:t.toString(),type:"number",onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})}))]}))})),e.jsx(x,{}),b(exports.DISCOUNT_PRODUCTS.PREREQUISITE),e.jsx(x,{}),b(exports.DISCOUNT_PRODUCTS.ENTITLED),e.jsx(x,{}),e.jsx(a.TitleRegular,{children:"At a discount value"}),e.jsxs("div",Object.assign({style:{display:"flex",gap:18,alignItems:"flex-start"}},{children:[e.jsx(c.RadioButton,{label:"Percentage",isActive:100!==D.discountData.value,onValueChange:()=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:void 0}))}}),100!==D.discountData.value&&e.jsx(l.Input,{variant:"small",value:null!==(n=null===(i=null===(s=D.discountData)||void 0===s?void 0:s.value)||void 0===i?void 0:i.toString())&&void 0!==n?n:"",onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:parseInt(e)}))},errorMessage:m(),type:"number",placeholder:"Enter percentage eg: 10%",suffixText:"%",width:"238px"})]})),e.jsx("div",{children:e.jsx(c.RadioButton,{label:"Free",isActive:100===D.discountData.value,onValueChange:e=>{e?D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:100})):D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:void 0}))}})})]})})(),D.selectedCouponType&&!D.hideExpiration&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:D.selectedCouponType!==i.DISCOUNT_TYPES.BUY_X_GET_Y&&D.selectedCouponType!==i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||!D.hideProbability?{height:6,borderTop:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,marginTop:12}:{}}),e.jsx(u.CouponExpiration,{discountData:D.discountData,setDiscountData:D.setDiscountData})]}),!D.selectedCouponType&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:10,padding:"40px 0",justifyContent:"center",alignItems:"center"}},{children:[e.jsx("div",Object.assign({style:{height:52,width:52,backgroundColor:o.DEFAULT_THEME.colorsV2.background.inverse,borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},{children:e.jsx(p.default,{width:32,color:o.DEFAULT_THEME.colorsV2.content.primaryInverse})})),e.jsx(a.TitleMedium,{children:"No discount has been selected"}),e.jsx(a.BodyPrimary,{children:"Please select a discount type"})]}))]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../button/Button.js"),i=require("./Input-helper.js"),r=require("../TypographyStyle.js"),l=require("../../assets/icons/errorInfo.svg.js"),s=require("./context/InputStyleProvider.js"),o=require("./Input.styled.js");const a=t.forwardRef(((a,u)=>{var c,d,v,h,x;const{placeholder:f,leftIcon:p,rightIcon:j,labelText:g,maxCharLimit:y,isRequired:I,hintText:C,type:b,state:m,validate:w,variant:E,button:S,suffixText:O,prefixText:k,onChangeText:q,value:F,noErrorHint:H,reset:L,rangeValidation:M,noKeyDownChange:T,version:B,noMaxCharCheck:R}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},a),A=null==p?void 0:p.icon,D=null==j?void 0:j.icon,[z,K]=t.useState(!1),[P,W]=t.useState(!1),[_,N]=t.useState(),V="small"===E?"18px":"22px",G=t.useContext(s.InputStyleContext),[J,Q]=t.useState(),U=t.useRef(null),X=null!=u?u:U;t.useEffect((()=>{Q(F)}),[F]),t.useEffect((()=>{var e;X.current&&(null===(e=a.onReferenceInit)||void 0===e||e.call(a,X.current))}),[X]),t.useEffect((()=>{const e=X.current;if(e)return e.addEventListener("wheel",$,{passive:!1}),()=>{e.removeEventListener("wheel",$)}}),[]),t.useEffect((()=>{L&&Q("")}),[L]),t.useEffect((()=>{var e;W(!!a.isActive),a.isActive&&(null===(e=X.current)||void 0===e||e.focus())}),[a.isActive]),t.useEffect((()=>{N(a.errorMessage)}),[a.errorMessage]),t.useEffect((()=>{var e;K(!1),("invalid"===a.state||_)&&K(!0),"active"===a.state&&(null===(e=X.current)||void 0===e||e.focus())}),[a.state,_]),t.useEffect((()=>{K(!!_)}),[_]);const Y=function(e){if(i.isFunction(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e(...n)}},Z=e=>{const t=y||("zip"===b?6:60);T||q(F||"",e),R||![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},$=e=>{e.preventDefault()},ee=e=>{const t=e.target.value;q(t,e),a.textControl||Q(t);const n=w||i.validateInput;if(!n||!i.isFunction(n))return;const[r,l]=n(t,b,M);K(!r),N(a.errorMessage?a.errorMessage:l)},te=e=>{var t;a.skipFocus||W(!0),Y(null===(t=a.onFocus)||void 0===t?void 0:t.call(a,e))},ne=e=>{var t;a.skipFocus||W(!1),Y(null===(t=a.onBlur)||void 0===t?void 0:t.call(a,e))},ie=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==b&&e.jsx("input",{id:a.id,style:null!==(t=null==G?void 0:G.input)&&void 0!==t?t:{},ref:X,type:["phonenumber","zip","number"].includes(b)?"number":b,value:J,onFocus:e=>te(e),onBlur:e=>ne(e),placeholder:f||"Enter here",onChange:ee,onKeyDown:e=>Z(e)}),"multiline"===b&&e.jsx("textarea",{value:J,ref:X,onFocus:e=>te(e),onBlur:e=>ne(e),placeholder:f||"Enter here",onChange:ee,onKeyDown:e=>Z(e),maxLength:y>0?y:void 0})]})};return e.jsxs(o.RootContainer,Object.assign({width:a.width,height:a.height,state:m,type:b,style:null!==(c=null==G?void 0:G.RootContainer)&&void 0!==c?c:{}},{children:[!H&&(!!C||!!_)&&e.jsxs(o.InputFooter,Object.assign({invalid:!!_},{children:[!!_&&e.jsx(l.default,{width:16,height:16}),_||C]})),e.jsxs(o.InputWrapper,Object.assign({variant:E,state:m,width:a.width,isActive:"active"===m||P,isInvalid:z,style:null!==(d=null==G?void 0:G.InputWrapper)&&void 0!==d?d:{},version:B},{children:[!!A&&e.jsx(o.IconHolder,Object.assign({variant:E,iconSize:V,onClick:()=>Y(null==p?void 0:p.callback),isLeft:!0,style:null!==(v=null==G?void 0:G.IconHolder)&&void 0!==v?v:{}},{children:e.jsx(A,{})})),!!k&&e.jsx(o.PrefixHolder,Object.assign({variant:E},{children:k})),"default"===E&&e.jsx(o.InputContainer,{children:ie()}),"small"===E&&e.jsx(o.InputContainerSmall,{children:ie()}),!!D&&e.jsx(o.IconHolder,Object.assign({variant:E,iconSize:V,onClick:()=>Y(null==j?void 0:j.callback),isLeft:!1},{children:e.jsx(D,{})})),!!O&&e.jsx(o.SuffixHolder,Object.assign({variant:E},{children:O})),S&&S.text&&e.jsx(n.Button,{buttonText:S.text,onClick:()=>Y(null==S?void 0:S.onClick)})]})),(!!g||!!y)&&e.jsxs(o.InputHeader,Object.assign({invalid:z},{children:[e.jsxs(r.BodySecondary,{children:[g,I?e.jsx("span",{children:"*"}):""]}),y>0&&e.jsxs(o.MaxCharStyle,{children:[null!==(x=null===(h=a.value)||void 0===h?void 0:h.length)&&void 0!==x?x:0,"/",y]})]}))]}))}));a.displayName="Input",exports.Input=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../button/Button.js"),i=require("./Input-helper.js"),r=require("../TypographyStyle.js"),s=require("../../assets/icons/errorInfo.svg.js"),l=require("./context/InputStyleProvider.js"),a=require("./Input.styled.js");const o=t.forwardRef(((o,u)=>{var c,d,v,h,p;const{placeholder:x,leftIcon:f,rightIcon:g,labelText:j,maxCharLimit:y,isRequired:b,hintText:I,type:C,state:m,validate:w,variant:E,button:S,suffixText:O,prefixText:k,onChangeText:q,value:F,noErrorHint:H,reset:L,rangeValidation:M,noKeyDownChange:T,version:B,noMaxCharCheck:R}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},o),A=null==f?void 0:f.icon,D=null==g?void 0:g.icon,[z,K]=t.useState(!1),[P,W]=t.useState(!1),[_,N]=t.useState(),V="small"===E?"18px":"22px",G=t.useContext(l.InputStyleContext),[J,Q]=t.useState(),U=t.useRef(null),X=null!=u?u:U;t.useEffect((()=>{Q(F)}),[F]),t.useEffect((()=>{var e;X.current&&(null===(e=o.onReferenceInit)||void 0===e||e.call(o,X.current))}),[X]),t.useEffect((()=>{const e=X.current;if(e)return e.addEventListener("wheel",$,{passive:!1}),()=>{e.removeEventListener("wheel",$)}}),[]),t.useEffect((()=>{L&&Q("")}),[L]),t.useEffect((()=>{var e;W(!!o.isActive),o.isActive&&(null===(e=X.current)||void 0===e||e.focus())}),[o.isActive]),t.useEffect((()=>{N(o.errorMessage)}),[o.errorMessage]),t.useEffect((()=>{var e;K(!1),("invalid"===o.state||_)&&K(!0),"active"===o.state&&(null===(e=X.current)||void 0===e||e.focus())}),[o.state,_]),t.useEffect((()=>{K(!!_)}),[_]);const Y=function(e){if(i.isFunction(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e(...n)}},Z=e=>{const t=y||("zip"===C?6:60);T||q(F||"",e),R||![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},$=e=>{e.preventDefault()},ee=e=>{const t=e.target.value;q(t,e),o.textControl||Q(t);const n=w||i.validateInput;if(!n||!i.isFunction(n))return;const[r,s]=n(t,C,M);K(!r),N(o.errorMessage?o.errorMessage:s)},te=e=>{var t;o.skipFocus||W(!0),Y(null===(t=o.onFocus)||void 0===t?void 0:t.call(o,e))},ne=e=>{var t;o.skipFocus||W(!1),Y(null===(t=o.onBlur)||void 0===t?void 0:t.call(o,e))},ie=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==C&&e.jsx("input",{id:o.id,style:null!==(t=null==G?void 0:G.input)&&void 0!==t?t:{},ref:X,type:["phonenumber","zip","number"].includes(C)?"number":C,value:J,onFocus:e=>te(e),onBlur:e=>ne(e),placeholder:x||"Enter here",onChange:ee,onKeyDown:e=>Z(e)}),"multiline"===C&&e.jsx("textarea",{value:J,ref:X,onFocus:e=>te(e),onBlur:e=>ne(e),placeholder:x||"Enter here",onChange:ee,onKeyDown:e=>Z(e),maxLength:y>0?y:void 0})]})};return e.jsxs(a.RootContainer,Object.assign({width:o.width,height:o.height,state:m,type:C,style:null!==(c=null==G?void 0:G.RootContainer)&&void 0!==c?c:{}},{children:[!H&&(!!I||!!_)&&e.jsxs(a.InputFooter,Object.assign({invalid:!!_},{children:[!!_&&e.jsx(s.default,{width:16,height:16}),_||I]})),e.jsxs(a.InputWrapper,Object.assign({variant:E,state:m,width:o.width,isActive:"active"===m||P,isInvalid:z,style:null!==(d=null==G?void 0:G.InputWrapper)&&void 0!==d?d:{},version:B,height:o.height},{children:[!!A&&e.jsx(a.IconHolder,Object.assign({variant:E,iconSize:V,onClick:()=>Y(null==f?void 0:f.callback),isLeft:!0,style:null!==(v=null==G?void 0:G.IconHolder)&&void 0!==v?v:{}},{children:e.jsx(A,{})})),!!k&&e.jsx(a.PrefixHolder,Object.assign({variant:E},{children:k})),"default"===E&&e.jsx(a.InputContainer,Object.assign({height:o.height,type:o.type},{children:ie()})),"small"===E&&e.jsx(a.InputContainerSmall,Object.assign({height:o.height,type:o.type},{children:ie()})),!!D&&e.jsx(a.IconHolder,Object.assign({variant:E,iconSize:V,onClick:()=>Y(null==g?void 0:g.callback),isLeft:!1},{children:e.jsx(D,{})})),!!O&&e.jsx(a.SuffixHolder,Object.assign({variant:E},{children:O})),S&&S.text&&e.jsx(n.Button,{buttonText:S.text,onClick:()=>Y(null==S?void 0:S.onClick)})]})),(!!j||!!y)&&e.jsxs(a.InputHeader,Object.assign({invalid:z},{children:[e.jsxs(r.BodySecondary,{children:[j,b?e.jsx("span",{children:"*"}):""]}),y>0&&e.jsxs(a.MaxCharStyle,{children:[null!==(p=null===(h=o.value)||void 0===h?void 0:h.length)&&void 0!==p?p:0,"/",y]})]}))]}))}));o.displayName="Input",exports.Input=o;
@@ -31,6 +31,9 @@ export declare const InputContainer: import("@emotion/styled").StyledComponent<{
31
31
  forwardedAs?: string | import("react").ComponentType<any> | undefined;
32
32
  } & {
33
33
  theme?: import("@emotion/react").Theme | undefined;
34
+ } & {
35
+ height?: string | undefined;
36
+ type?: InputTypeI | undefined;
34
37
  }, {}, {}>;
35
38
  export declare const InputContainerSmall: import("@emotion/styled").StyledComponent<{
36
39
  [x: string]: any;
@@ -43,6 +46,9 @@ export declare const InputContainerSmall: import("@emotion/styled").StyledCompon
43
46
  forwardedAs?: string | import("react").ComponentType<any> | undefined;
44
47
  } & {
45
48
  theme?: import("@emotion/react").Theme | undefined;
49
+ } & {
50
+ height?: string | undefined;
51
+ type?: InputTypeI | undefined;
46
52
  }, {}, {}>;
47
53
  export declare const InputHeader: import("@emotion/styled").StyledComponent<{
48
54
  theme?: import("@emotion/react").Theme | undefined;