@bikdotai/bik-component-library 0.0.684 → 0.0.685-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  2. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  3. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  4. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  5. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  6. package/dist/cjs/components/SearchFilter/components/DatePickerButton.js +1 -1
  7. package/dist/cjs/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  8. package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
  9. package/dist/cjs/components/accordion/Accordion.d.ts +8 -0
  10. package/dist/cjs/components/accordion/Accordion.js +1 -1
  11. package/dist/cjs/components/accordion/Accordion.style.d.ts +1 -0
  12. package/dist/cjs/components/accordion/Accordion.style.js +8 -1
  13. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  14. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  15. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
  16. package/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -0
  17. package/dist/cjs/components/carousel-secondary/CarouselSecondary.d.ts +2 -4
  18. package/dist/cjs/components/carousel-secondary/CarouselSecondary.js +1 -1
  19. package/dist/cjs/components/carousel-secondary/CarouselSecondary.style.d.ts +1 -1
  20. package/dist/cjs/components/carousel-secondary/CarouselSecondary.style.js +1 -1
  21. package/dist/cjs/components/carousel-secondary/model.d.ts +4 -0
  22. package/dist/cjs/components/carousel-secondary/model.js +1 -0
  23. package/dist/cjs/components/code-block/CodeBlock.d.ts +2 -0
  24. package/dist/cjs/components/code-block/CodeBlock.js +1 -0
  25. package/dist/cjs/components/code-block/CodeBlock.styled.d.ts +31 -0
  26. package/dist/cjs/components/code-block/CodeBlock.styled.js +110 -0
  27. package/dist/cjs/components/code-block/CodeBlockHelper.d.ts +1 -0
  28. package/dist/cjs/components/code-block/CodeBlockHelper.js +1 -0
  29. package/dist/cjs/components/code-block/index.d.ts +2 -0
  30. package/dist/cjs/components/code-block/languageSpecificFormatting/html.d.ts +1 -0
  31. package/dist/cjs/components/code-block/types.d.ts +18 -0
  32. package/dist/cjs/components/code-block/types.js +1 -0
  33. package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  34. package/dist/cjs/components/datePicker/DatePickerWrapper.d.ts +1 -4
  35. package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
  36. package/dist/cjs/components/datePicker/DatePickerWrapper.styled.d.ts +1 -1
  37. package/dist/cjs/components/datePicker/DatePickerWrapper.styled.js +2 -2
  38. package/dist/cjs/components/datePicker/model.d.ts +4 -0
  39. package/dist/cjs/components/datePicker/model.js +1 -0
  40. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +1 -2
  41. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  42. package/dist/cjs/components/dropdown/ChipDropdown.d.ts +1 -1
  43. package/dist/cjs/components/dropdown/ChipDropdown.js +3 -3
  44. package/dist/cjs/components/dropdown/MenuItem/MenuItem.d.ts +1 -1
  45. package/dist/cjs/components/dropdown/MenuItem/MenuItem.js +5 -5
  46. package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
  47. package/dist/cjs/components/product-picker-v2/modal.d.ts +1 -8
  48. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  49. package/dist/cjs/components/product-picker-v2/style.js +1 -1
  50. package/dist/cjs/components/product-picker-v2/type.d.ts +7 -0
  51. package/dist/cjs/components/product-picker-v2/type.js +1 -1
  52. package/dist/cjs/components/product-picker-v2/variant.js +1 -1
  53. package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
  54. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  55. package/dist/cjs/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
  56. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  57. package/dist/cjs/components/template-preview/RCS/RCSMediaCard.d.ts +1 -1
  58. package/dist/cjs/components/template-preview/RCS/RCSMediaCard.js +1 -1
  59. package/dist/cjs/components/template-preview/WhatsApp/MediaCard.js +1 -1
  60. package/dist/cjs/components/variable-picker-v3/Content.d.ts +0 -1
  61. package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
  62. package/dist/cjs/components/variable-picker-v3/SubHeaderItems.js +1 -1
  63. package/dist/cjs/components/variable-picker-v3/highlightSearchText.d.ts +1 -0
  64. package/dist/cjs/components/variable-picker-v3/highlightSearchText.js +1 -0
  65. package/dist/cjs/index.d.ts +1 -0
  66. package/dist/cjs/index.js +1 -1
  67. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  68. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  69. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  70. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  71. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  72. package/dist/esm/components/SearchFilter/components/DatePickerButton.js +1 -1
  73. package/dist/esm/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  74. package/dist/esm/components/TablePagination/TablePagination.js +1 -1
  75. package/dist/esm/components/accordion/Accordion.d.ts +8 -0
  76. package/dist/esm/components/accordion/Accordion.js +1 -1
  77. package/dist/esm/components/accordion/Accordion.style.d.ts +1 -0
  78. package/dist/esm/components/accordion/Accordion.style.js +23 -16
  79. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  80. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  81. package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
  82. package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
  83. package/dist/esm/components/carousel-secondary/CarouselSecondary.d.ts +2 -4
  84. package/dist/esm/components/carousel-secondary/CarouselSecondary.js +1 -1
  85. package/dist/esm/components/carousel-secondary/CarouselSecondary.style.d.ts +1 -1
  86. package/dist/esm/components/carousel-secondary/CarouselSecondary.style.js +1 -1
  87. package/dist/esm/components/carousel-secondary/model.d.ts +4 -0
  88. package/dist/esm/components/carousel-secondary/model.js +1 -0
  89. package/dist/esm/components/code-block/CodeBlock.d.ts +2 -0
  90. package/dist/esm/components/code-block/CodeBlock.js +1 -0
  91. package/dist/esm/components/code-block/CodeBlock.styled.d.ts +31 -0
  92. package/dist/esm/components/code-block/CodeBlock.styled.js +110 -0
  93. package/dist/esm/components/code-block/CodeBlockHelper.d.ts +1 -0
  94. package/dist/esm/components/code-block/CodeBlockHelper.js +1 -0
  95. package/dist/esm/components/code-block/index.d.ts +2 -0
  96. package/dist/esm/components/code-block/languageSpecificFormatting/html.d.ts +1 -0
  97. package/dist/esm/components/code-block/types.d.ts +18 -0
  98. package/dist/esm/components/code-block/types.js +1 -0
  99. package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  100. package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +1 -4
  101. package/dist/esm/components/datePicker/DatePickerWrapper.js +1 -1
  102. package/dist/esm/components/datePicker/DatePickerWrapper.styled.d.ts +1 -1
  103. package/dist/esm/components/datePicker/DatePickerWrapper.styled.js +11 -11
  104. package/dist/esm/components/datePicker/model.d.ts +4 -0
  105. package/dist/esm/components/datePicker/model.js +1 -0
  106. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +1 -2
  107. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  108. package/dist/esm/components/dropdown/ChipDropdown.d.ts +1 -1
  109. package/dist/esm/components/dropdown/ChipDropdown.js +3 -3
  110. package/dist/esm/components/dropdown/MenuItem/MenuItem.d.ts +1 -1
  111. package/dist/esm/components/dropdown/MenuItem/MenuItem.js +5 -5
  112. package/dist/esm/components/multi-level-dropdown/MenuItem.js +1 -1
  113. package/dist/esm/components/product-picker-v2/modal.d.ts +1 -8
  114. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  115. package/dist/esm/components/product-picker-v2/style.js +4 -4
  116. package/dist/esm/components/product-picker-v2/type.d.ts +7 -0
  117. package/dist/esm/components/product-picker-v2/type.js +1 -1
  118. package/dist/esm/components/product-picker-v2/variant.js +1 -1
  119. package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
  120. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  121. package/dist/esm/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
  122. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  123. package/dist/esm/components/template-preview/RCS/RCSMediaCard.d.ts +1 -1
  124. package/dist/esm/components/template-preview/RCS/RCSMediaCard.js +1 -1
  125. package/dist/esm/components/template-preview/WhatsApp/MediaCard.js +1 -1
  126. package/dist/esm/components/variable-picker-v3/Content.d.ts +0 -1
  127. package/dist/esm/components/variable-picker-v3/Content.js +1 -1
  128. package/dist/esm/components/variable-picker-v3/SubHeaderItems.js +1 -1
  129. package/dist/esm/components/variable-picker-v3/highlightSearchText.d.ts +1 -0
  130. package/dist/esm/components/variable-picker-v3/highlightSearchText.js +1 -0
  131. package/dist/esm/index.d.ts +1 -0
  132. package/dist/esm/index.js +1 -1
  133. package/package.json +1 -1
@@ -0,0 +1,18 @@
1
+ export declare enum CodeLanguage {
2
+ JAVASCRIPT = "javascript",
3
+ PYTHON = "python",
4
+ JAVA = "java",
5
+ CSS = "css",
6
+ HTML = "html",
7
+ JSON = "json"
8
+ }
9
+ export interface CodeBlockProps {
10
+ code?: string;
11
+ language?: CodeLanguage;
12
+ title?: string;
13
+ showTitle?: boolean;
14
+ showLineNumbers?: boolean;
15
+ maxHeight?: string;
16
+ maxWidth?: string;
17
+ theme?: 'dark' | 'light';
18
+ }
@@ -0,0 +1 @@
1
+ var a;!function(a){a.JAVASCRIPT="javascript",a.PYTHON="python",a.JAVA="java",a.CSS="css",a.HTML="html",a.JSON="json"}(a||(a={}));export{a as CodeLanguage};
@@ -1 +1 @@
1
- import{jsxs as e,Fragment as t,jsx as s}from"react/jsx-runtime";import r from"../../../assets/icons/calendar.svg.js";import o from"../../../assets/icons/chevronDown.svg.js";import i,{useState as a}from"react";import{usePopper as n}from"react-popper";import{DatePicker as c}from"../../datePicker/DatePicker.js";import"../../datePicker/DatePickerWrapper.js";import{OpenDropdownContainer as m}from"../../dropdown/Common.styled.js";import{DropShadow as p}from"../../dropShadow/DropShadow.js";import{useOutside as l}from"../../../hooks/useOutside.js";import d from"../../../utils/DateUtils.js";const f=f=>{const[h,j]=a(null),[u,g]=a(null),[D,y]=a(!1),{styles:b,attributes:w}=n(h,u,{placement:f.placement}),O=i.useRef();return l(O,(()=>{y(!1)})),e(t,{children:[e("div",Object.assign({className:"date-preview",ref:j,onClick:()=>{y(!D)}},{children:[s(r,{width:24,height:24}),s("span",Object.assign({style:{marginLeft:8}},{children:d.onlyDateFormat(f.customDate,"dd MMM yyyy")})),s(o,{style:{marginLeft:"auto"},width:22,height:22})]})),D&&s(m,Object.assign({ref:g,style:Object.assign(Object.assign({},b.popper),{zIndex:3})},w.popper,{children:s("div",Object.assign({ref:O},{children:s(p,Object.assign({level:"z2",position:"down",style:{borderRadius:4}},{children:s(c,{selectedDate:f.customDate||new Date,selectRange:!1,onSelectDate:e=>{y(!1),f.setCustomDate(e)},minDate:f.minDate})}))}))}))]})};export{f as default};
1
+ import{jsxs as e,Fragment as t,jsx as s}from"react/jsx-runtime";import r from"../../../assets/icons/calendar.svg.js";import o from"../../../assets/icons/chevronDown.svg.js";import i,{useState as a}from"react";import{usePopper as n}from"react-popper";import{DatePicker as m}from"../../datePicker/DatePicker.js";import"react-calendar";import{useOutside as c}from"../../../hooks/useOutside.js";import p from"../../../utils/DateUtils.js";import"../../../constants/Theme.js";import"../../TypographyStyle.js";import"../../datePicker/DatePickerWrapper.styled.js";import"../../datePicker/model.js";import{OpenDropdownContainer as l}from"../../dropdown/Common.styled.js";import{DropShadow as d}from"../../dropShadow/DropShadow.js";const j=j=>{const[h,f]=a(null),[g,u]=a(null),[y,D]=a(!1),{styles:b,attributes:w}=n(h,g,{placement:j.placement}),O=i.useRef();return c(O,(()=>{D(!1)})),e(t,{children:[e("div",Object.assign({className:"date-preview",ref:f,onClick:()=>{D(!y)}},{children:[s(r,{width:24,height:24}),s("span",Object.assign({style:{marginLeft:8}},{children:p.onlyDateFormat(j.customDate,"dd MMM yyyy")})),s(o,{style:{marginLeft:"auto"},width:22,height:22})]})),y&&s(l,Object.assign({ref:u,style:Object.assign(Object.assign({},b.popper),{zIndex:3})},w.popper,{children:s("div",Object.assign({ref:O},{children:s(d,Object.assign({level:"z2",position:"down",style:{borderRadius:4}},{children:s(m,{selectedDate:j.customDate||new Date,selectRange:!1,onSelectDate:e=>{D(!1),j.setCustomDate(e)},minDate:j.minDate})}))}))}))]})};export{j as default};
@@ -1,10 +1,7 @@
1
1
  import React from 'react';
2
2
  import { CalendarProps } from 'react-calendar';
3
3
  import { CSSProperties } from 'styled-components';
4
- export declare enum DateButtonType {
5
- DEFAULT = "default",
6
- LARGE = "large"
7
- }
4
+ import { DateButtonType } from './model';
8
5
  export declare const DatePickerWrapper: React.FC<{
9
6
  val?: Date | Date[];
10
7
  onChange: (val: Date | Date[]) => void;
@@ -1 +1 @@
1
- import{jsxs as t,Fragment as e,jsx as r}from"react/jsx-runtime";import{useState as o,useRef as a}from"react";import n from"react-calendar";import{useOutside as i}from"../../hooks/useOutside.js";import l from"../../utils/DateUtils.js";import{COLORS as s}from"../../constants/Theme.js";import c from"../../assets/icons/calendar.svg.js";import{BodyPrimary as d,BodySecondary as m}from"../TypographyStyle.js";import{DateBtn as u,PickerContainer as g}from"./DatePickerWrapper.styled.js";var D;!function(t){t.DEFAULT="default",t.LARGE="large"}(D||(D={}));const p=p=>{let{val:y,onChange:v,calendarProps:b,disabled:f,pickerStyles:h,nativeID:S,maxDate:j,minDate:L,dateButtonType:w,dateButtonStyles:A}=p;const[C,k]=o(!1),O=a(null),x=a(null);i(x,(()=>{k(!1)}));const E=()=>{var t,e,r,o;return y?Array.isArray(y)?(null===(t=null==y?void 0:y[0])||void 0===t?void 0:t.toString())&&(null===(e=null==y?void 0:y[1])||void 0===e?void 0:e.toString())?`${new Date(null===(r=null==y?void 0:y[0])||void 0===r?void 0:r.toString()).toLocaleDateString()}-${new Date(null===(o=null==y?void 0:y[1])||void 0===o?void 0:o.toString()).toLocaleDateString()}`:`${l.getPastDate(new Date,30).toLocaleDateString()}-${(new Date).toLocaleDateString()}`:new Date(y.toString()).toLocaleDateString():(new Date).toLocaleDateString()};return t(e,{children:[t(u,Object.assign({id:S,ref:O,bgColor:f?s.background.base:s.surface.standard,borderColor:s.stroke.primary,onClick:()=>k(!C),dateButtonType:w||D.DEFAULT,style:A},{children:[w===D.LARGE?r(d,Object.assign({style:{color:f?s.content.inactive:s.content.primary,flex:1}},{children:E()})):r(m,Object.assign({style:{color:f?s.content.inactive:s.content.primary,flex:1}},{children:E()})),r(c,{width:w===D.LARGE?24:20,height:w===D.LARGE?24:20,color:f?s.content.inactive:s.content.primary})]})),C&&!f&&r(g,Object.assign({ref:x,style:Object.assign({},h),contentPrimary:s.content.primary,subDued:s.surface.subdued,brandColor:s.background.brand,bgColor:s.surface.standard,borderColor:s.stroke.primary},{children:r(n,Object.assign({tileClassName:["custom__tile"],className:["custom__calendar"],onChange:t=>{v(t),k(!1)},maxDate:j,minDate:L,value:y?Array.isArray(y)?2===y.length?[new Date(y[0]),new Date(y[1])]:null:new Date(y):null},b))}))]})};export{D as DateButtonType,p as DatePickerWrapper};
1
+ import{jsxs as t,Fragment as e,jsx as r}from"react/jsx-runtime";import{useState as o,useRef as n}from"react";import a from"react-calendar";import{useOutside as i}from"../../hooks/useOutside.js";import l from"../../utils/DateUtils.js";import{COLORS as s}from"../../constants/Theme.js";import c from"../../assets/icons/calendar.svg.js";import{BodyPrimary as d,BodySecondary as m}from"../TypographyStyle.js";import{DateBtn as u,PickerContainer as g}from"./DatePickerWrapper.styled.js";import{DateButtonType as p}from"./model.js";const D=D=>{let{val:y,onChange:v,calendarProps:b,disabled:f,pickerStyles:h,nativeID:j,maxDate:S,minDate:w,dateButtonType:L,dateButtonStyles:C}=D;const[k,A]=o(!1),O=n(null),x=n(null);i(x,(()=>{A(!1)}));const T=()=>{var t,e,r,o;return y?Array.isArray(y)?(null===(t=null==y?void 0:y[0])||void 0===t?void 0:t.toString())&&(null===(e=null==y?void 0:y[1])||void 0===e?void 0:e.toString())?`${new Date(null===(r=null==y?void 0:y[0])||void 0===r?void 0:r.toString()).toLocaleDateString()}-${new Date(null===(o=null==y?void 0:y[1])||void 0===o?void 0:o.toString()).toLocaleDateString()}`:`${l.getPastDate(new Date,30).toLocaleDateString()}-${(new Date).toLocaleDateString()}`:new Date(y.toString()).toLocaleDateString():(new Date).toLocaleDateString()};return t(e,{children:[t(u,Object.assign({id:j,ref:O,bgColor:f?s.background.base:s.surface.standard,borderColor:s.stroke.primary,onClick:()=>A(!k),dateButtonType:L||p.DEFAULT,style:C},{children:[L===p.LARGE?r(d,Object.assign({style:{color:f?s.content.inactive:s.content.primary,flex:1}},{children:T()})):r(m,Object.assign({style:{color:f?s.content.inactive:s.content.primary,flex:1}},{children:T()})),r(c,{width:L===p.LARGE?24:20,height:L===p.LARGE?24:20,color:f?s.content.inactive:s.content.primary})]})),k&&!f&&r(g,Object.assign({ref:x,style:Object.assign({},h),contentPrimary:s.content.primary,subDued:s.surface.subdued,brandColor:s.background.brand,bgColor:s.surface.standard,borderColor:s.stroke.primary},{children:r(a,Object.assign({tileClassName:["custom__tile"],className:["custom__calendar"],onChange:t=>{v(t),A(!1)},maxDate:S,minDate:w,value:y?Array.isArray(y)?2===y.length?[new Date(y[0]),new Date(y[1])]:null:new Date(y):null},b))}))]})};export{D as DatePickerWrapper};
@@ -1,4 +1,4 @@
1
- import { DateButtonType } from './DatePickerWrapper';
1
+ import { DateButtonType } from './model';
2
2
  export declare const DateBtn: import("styled-components").StyledComponent<"div", any, {
3
3
  bgColor: string;
4
4
  borderColor: string;
@@ -1,25 +1,25 @@
1
- import r from"styled-components";import{DateButtonType as o}from"./DatePickerWrapper.js";const e=r.div`
1
+ import o from"styled-components";import{DateButtonType as r}from"./model.js";const e=o.div`
2
2
  display: flex;
3
3
  padding: 5px 8px;
4
- background: ${r=>r.bgColor};
4
+ background: ${o=>o.bgColor};
5
5
  border-width: 1px;
6
6
  border-style: solid;
7
- border-color: ${r=>r.borderColor};
7
+ border-color: ${o=>o.borderColor};
8
8
  border-radius: 4px;
9
9
  flex-direction: row;
10
10
  align-items: center;
11
11
  gap: 8px;
12
12
  position: relative;
13
- height: ${r=>r.dateButtonType===o.LARGE?"48px":"32px"};
14
- `,a=r.div`
13
+ height: ${o=>o.dateButtonType===r.LARGE?"48px":"32px"};
14
+ `,t=o.div`
15
15
  position: absolute;
16
16
  top: calc(100% + 8px);
17
17
  zindex: 9;
18
18
  .custom__calendar {
19
- background: ${r=>r.bgColor};
19
+ background: ${o=>o.bgColor};
20
20
  border-width: 1px;
21
21
  border-style: solid;
22
- border-color: ${r=>r.borderColor};
22
+ border-color: ${o=>o.borderColor};
23
23
  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.12);
24
24
  border-radius: 4px;
25
25
  }
@@ -27,7 +27,7 @@ import r from"styled-components";import{DateButtonType as o}from"./DatePickerWra
27
27
  .custom__tile:hover,
28
28
  .custom__tile:focus,
29
29
  .react-calendar__tile--active {
30
- background: ${r=>r.brandColor};
30
+ background: ${o=>o.brandColor};
31
31
  }
32
32
 
33
33
  .react-calendar__month-view__weekdays__weekday {
@@ -37,7 +37,7 @@ import r from"styled-components";import{DateButtonType as o}from"./DatePickerWra
37
37
  font-weight: 600;
38
38
  font-size: 14px;
39
39
  line-height: 20px;
40
- color: ${r=>r.contentPrimary};
40
+ color: ${o=>o.contentPrimary};
41
41
 
42
42
  abbr[title] {
43
43
  text-decoration: none !important;
@@ -45,7 +45,7 @@ import r from"styled-components";import{DateButtonType as o}from"./DatePickerWra
45
45
  }
46
46
 
47
47
  .react-calendar__month-view__weekdays {
48
- background: ${r=>r.subDued};
48
+ background: ${o=>o.subDued};
49
49
  }
50
50
 
51
51
  .react-calendar__navigation {
@@ -66,4 +66,4 @@ import r from"styled-components";import{DateButtonType as o}from"./DatePickerWra
66
66
  font-size: 20px;
67
67
  }
68
68
  }
69
- `;export{e as DateBtn,a as PickerContainer};
69
+ `;export{e as DateBtn,t as PickerContainer};
@@ -0,0 +1,4 @@
1
+ export declare enum DateButtonType {
2
+ DEFAULT = "default",
3
+ LARGE = "large"
4
+ }
@@ -0,0 +1 @@
1
+ var a;!function(a){a.DEFAULT="default",a.LARGE="large"}(a||(a={}));export{a as DateButtonType};
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
- import { DISCOUNT_TYPES } from "..";
3
2
  import { COUPON_EXPIRATION, DISCOUNT_APPLIES_TO, ICouponData, IDynamicDiscountValidationError, MIN_PURCHASE_REQUIREMENT, OFFER_APPLIES_TO } from "../type";
4
3
  import { SingleOption } from "../../dropdown/type";
5
4
  import { Collection, Product } from "../../product-picker/type";
6
5
  import { VariableListInterfaceV3 } from '../../variable-picker-v3/model';
7
- import { ProductVariable } from '../type';
6
+ import { DISCOUNT_TYPES, ProductVariable } from '../type';
8
7
  export declare enum DISCOUNT_PRODUCTS {
9
8
  ENTITLED = "entitled",
10
9
  PREREQUISITE = "prerequisite"
@@ -1 +1 @@
1
- import{__rest as e}from"../../../_virtual/_tslib.js";import{jsxs as i,jsx as t,Fragment as o}from"react/jsx-runtime";import n from"../../../assets/icons/info.svg.js";import{Alert as l}from"../../alerts/Alert.js";import{ALERT_TYPES as s,CONTENT_POSITION as r}from"../../alerts/AlertHelper.js";import{Button as a}from"../../button/Button.js";import{CheckBox as d}from"../../checkBox/CheckBox.js";import"../../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import"react";import{DISCOUNT_APPLIES_TO as c,OFFER_APPLIES_TO as u,DISCOUNT_TYPES as p,COUPON_EXPIRATION as m,DISCOUNT_VALUE_TYPES as v,DISCOUNT_TARGET_TYPES as C,DISCOUNT_TARGET_SELECTION as E}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as b}from"../../dropdown/Dropdown.js";import"../../dropdown/ChipDropdown.js";import"../../zeroState/ZeroState.js";import{BodySecondary as D,TitleRegular as g,TitleSmall as T}from"../../TypographyStyle.js";import{DEFAULT_THEME as h}from"../../../constants/Theme.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../../icon-button/IconButton.js";import{Input as y}from"../../input/Input.js";import P from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import"../../modals/styledModal.js";import"../../../node_modules/lodash.debounce/index.js";import"../../bik-layout/CommonStyles.js";import"../../product-picker/ProductPicker.styled.js";import"../../../utils/DateUtils.js";import"../../tag/Tag.js";import"../../tooltips/Tooltip.js";import"../../product-picker-v2/modal.js";import"../../variable-picker-v3/model.js";import"../../modals/modal.styled.js";import O from"../../../assets/icons/plus.svg.js";import"../../accordion/Accordion.style.js";import"../../accordion/AccordionArrow.js";import"../../switch/Switch.js";import"../../variable-picker-v3/NoResult.js";import"../../variable-picker-v3/styles.js";import"lodash";import{DynamicCouponContainer as I}from"../DiscountModal.styled.js";import{CouponExpiration as j}from"../CouponExpiration/CouponExpiration.js";import{RadioButton as V}from"../../radioButton/RadioButton.js";import S from"../../../assets/icons/cubeIcon.svg.js";import f from"../../../assets/icons/delete.svg.js";import x from"../../../assets/icons/edit.svg.js";import{DiscountOptionsContainer as R,DiscountDetailsOption as _,AddProductButtonsContainer as A,ProductCollectionCard as N,CubeIconContainer as w,IconContainer as L,ProductVariableCard as F}from"./DynamicCoupon.styled.js";import q from"./MinimumRequirementComponent.js";import k from"./ZeroState.js";var U;!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(U||(U={}));const B=B=>{var M,G,Q,Y,X,$,W,z;const Z=[{selected:B.discountCouponAppliesTo===c.ENTIRE_ORDER,label:"Entire Order",value:c.ENTIRE_ORDER},{selected:B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS,label:"Specific Product",value:c.SPECIFIC_PRODUCTS},{selected:B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:c.SPECIFIC_COLLECTIONS}],H=[{selected:B.offerAppliesToBuy===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToBuy===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],J=[{selected:B.offerAppliesToGet===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToGet===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],K=(e,d,u)=>{var p,m,v,C,E,b,g,y,I,j,V,R;let _=[],q=[],k={},M={};B.useNewPicker?(k=d===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,M=null!==(p=d===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==p?p:[],(null==k?void 0:k.isCustom)&&delete k.isCustom,(null==M?void 0:M.isCustom)&&delete M.isCustom,Object.values(k).forEach((e=>{Object.keys(e.products).forEach((i=>{_.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(M).forEach((e=>{"isCustom"!==e&&q.push({id:e,name:M[e].name,image:M[e].image})}))):(_=d===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,q=null!==(m=d===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==m?m:[]);const G=[null===(v=B.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidProductSelection,null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidProductVariableSelection,null===(E=B.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidCollectionSelection],Q=[null===(b=B.dynamicDiscountValidationError)||void 0===b?void 0:b.inValidBuyXCollectionSelection,null===(g=B.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidBuyXProductSelection,null===(y=B.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidBuyXProductVariableSelection],Y=[null===(I=B.dynamicDiscountValidationError)||void 0===I?void 0:I.inValidGetYCollectionSelection,null===(j=B.dynamicDiscountValidationError)||void 0===j?void 0:j.inValidGetYProductSelection,null===(V=B.dynamicDiscountValidationError)||void 0===V?void 0:V.inValidGetYProductVariableSelection];let X=!1;return"couponAppliesTo"===u&&(X=G.some(Boolean)),"buyX"===u&&(X=Q.some(Boolean)),"getY"===u&&(X=Y.some(Boolean)),i(o,{children:[i("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===c.SPECIFIC_PRODUCTS&&0===_.length&&(d===U.ENTITLED&&!B.entitledProductVariable||d===U.PREREQUISITE&&!B.preRequisiteProductVariable)&&!(null==q?void 0:q.length)&&i(A,{children:[t("div",Object.assign({style:{width:B.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:t(a,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:O,matchParentWidth:!0,onClick:()=>{B.setIsProductPickerOpen(d)},error:X})})),B.isProductVariableSupported&&B.productVariableList&&i(o,{children:[t(D,Object.assign({color:h.colorsV2.content.placeholder},{children:"OR"})),t(a,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:O,matchParentWidth:!0,onClick:()=>{B.setIsProductVariablePickerOpen(d)},error:X})]})]}),e===c.SPECIFIC_COLLECTIONS&&0===q.length&&!(null==_?void 0:_.length)&&t("div",Object.assign({style:{width:"300px",display:"flex"}},{children:t(a,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:O,matchParentWidth:!0,onClick:()=>{B.setIsCollectionPickerOpen(d)},style:{marginTop:"16px"},error:X})}))]})),X&&t("div",Object.assign({style:{margin:"8px 0 0"}},{children:t(l,{type:s.NEGATIVE,text:"Required Field",contentPosition:r.START,icon:()=>t(n,{width:16,height:16,color:h.colorsV2.content.negative})})})),_.length||q.length?i("div",{children:[t(D,Object.assign({style:{margin:"8px 0"}},{children:e===c.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i(N,{children:[t(w,{children:t(S,{width:20,height:20,color:h.colorsV2.content.secondary})}),i(T,{children:[e===c.SPECIFIC_PRODUCTS?_.length:q.length," ",e===c.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i("div",Object.assign({style:{display:"flex",gap:4}},{children:[t(L,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?B.setIsProductPickerOpen(d):B.setIsCollectionPickerOpen(d)}},{children:t(x,{width:24,height:24,color:h.colorsV2.content.placeholder})})),t(L,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?d===U.ENTITLED?B.setEntitledProducts([]):B.setPrerequisiteProducts([]):d===U.ENTITLED?B.setEntitledCollections([]):B.setPrerequisiteCollections([])}},{children:t(f,{width:24,height:24,color:h.colorsV2.content.placeholder})}))]}))]})]}):d===U.ENTITLED&&B.entitledProductVariable?i("div",{children:[t(D,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(F,{children:[t(T,{children:B.entitledProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(L,Object.assign({onClick:()=>{B.setEntitledProductVariable(void 0)}},{children:t(P,{width:24,height:24,color:h.colorsV2.content.primary})}))}))]})]}):d===U.PREREQUISITE&&(null===(R=B.preRequisiteProductVariable)||void 0===R?void 0:R.displayName)?i("div",{children:[t(D,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(F,{children:[t(T,{children:B.preRequisiteProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(L,Object.assign({onClick:()=>{B.setPreRequisiteProductVariable(void 0)}},{children:t(P,{width:24,height:24,color:h.colorsV2.content.primary})}))}))]})]}):t(o,{children:" "})]})},ee=(e,o)=>{var n,l,s,r,a,d,p,m,v,C;let E=[],g=[],h={},P={};B.useNewPicker?(h=e===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,P=null!==(n=e===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==n?n:[],(null==h?void 0:h.isCustom)&&delete h.isCustom,(null==P?void 0:P.isCustom)&&delete P.isCustom,Object.values(h).forEach((e=>{Object.keys(e.products).forEach((i=>{E.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(P).forEach((e=>{"isCustom"!==e&&g.push({id:e,name:P[e].name,image:P[e].image})}))):(E=e===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,g=null!==(l=e===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==l?l:[]);const O=e===U.PREREQUISITE?B.offerAppliesToBuy:B.offerAppliesToGet,I=e===U.PREREQUISITE?U.PREREQUISITE:U.ENTITLED,j=O===u.SPECIFIC_PRODUCTS?c.SPECIFIC_PRODUCTS:c.SPECIFIC_COLLECTIONS;return i("div",{children:[t(T,Object.assign({style:{marginBottom:16}},{children:e===U.PREREQUISITE?"Customer buys":"Customer gets"})),i("div",Object.assign({style:{display:"flex"}},{children:[!o&&t("div",{children:i("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:e===U.ENTITLED?null!==(r=null===(s=B.discountData.entitledQuantity)||void 0===s?void 0:s.toString())&&void 0!==r?r:"":null!==(d=null===(a=B.discountData.prerequisiteQuantity)||void 0===a?void 0:a.toString())&&void 0!==d?d:"",type:"number",onChangeText:i=>{e===U.ENTITLED?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledQuantity:parseInt(i)})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===U.PREREQUISITE&&(null===(p=B.dynamicDiscountValidationError)||void 0===p?void 0:p.inValidBuyXValue)||e===U.ENTITLED&&(null===(m=B.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYValue)?"Required Field":"",state:e===U.PREREQUISITE&&(null===(v=B.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidBuyXValue)||e===U.ENTITLED&&(null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidGetYValue)?"invalid":"none"})})),t("div",{className:"input__wrapper"})]}))}),i("div",{children:[t(D,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===U.PREREQUISITE&&t(b,{width:"244px",options:H,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToBuy(e.value),B.setPrerequisiteProducts([]),B.setPrerequisiteCollections([]),B.setPreRequisiteProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===U.ENTITLED&&t(b,{width:"244px",options:J,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToGet(e.value),B.setEntitledProducts([]),B.setEntitledCollections([]),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),K(j,I,e===U.PREREQUISITE?"buyX":"getY")]})};return i(I,{children:[i("div",{children:[i("div",Object.assign({style:{display:"flex",gap:16}},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(M=B.discountData.title)&&void 0!==M?M:"",onChangeText:e=>{var i;B.setDiscountData(Object.assign(Object.assign({},B.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(G=B.currency)&&void 0!==G?G:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(Q=B.dynamicDiscountValidationError)||void 0===Q?void 0:Q.invalidCouponTitle)?"Required Field":"",state:(null===(Y=B.dynamicDiscountValidationError)||void 0===Y?void 0:Y.invalidCouponTitle)?"invalid":"none"})})),!B.hideProbability&&t(y,{value:null!==($=null===(X=B.discountData.probability)||void 0===X?void 0:X.toString())&&void 0!==$?$:"",type:"number",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(W=B.dynamicDiscountValidationError)||void 0===W?void 0:W.inValidProbability)?"Required Field":"",state:(null===(z=B.dynamicDiscountValidationError)||void 0===z?void 0:z.inValidProbability)?"invalid":"none"})]})),t("div",{style:{height:"1px",width:"100%",background:h.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),B.allowStaticCoupon&&t((()=>i("div",{children:[t(g,{children:"Discount Details"}),t(R,{children:B.discountDetailsOptions.map((t=>{return i(_,Object.assign({selected:B.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(B.selectedDiscountDetails.id!==i.id)if(B.resetValidationErrors(),B.setValidationErrorMessage(""),B.setDiscountCouponAppliesTo(c.ENTIRE_ORDER),B.setSelectedDiscountDetails(i),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0})),B.setPreRequisiteProductVariable(void 0),B.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){B.onChangeCouponType({label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},B.discountData),{valueType:"percentage"===i.value?v.PERCENTAGE:v.FIXED_AMOUNT,value:void 0,targetType:C.LINE_ITEM,targetSelection:E.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e(t,["entitledQuantity","prerequisiteQuantity"]);B.setDiscountData(o)}else B.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,B.selectedDiscountDetails.id===o?h.colorsV2.stroke.brand:h.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(B.selectedCouponType===p.AMOUNT_OFF_ORDER||B.selectedCouponType===p.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,n,l,s,r,a;return i(o,{children:[t("div",Object.assign({className:"input__rows"},{children:t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(l=null===(n=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===n?void 0:n.toString())&&void 0!==l?l:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:B.discountData.valueType===v.FIXED_AMOUNT?null!==(s=B.currency)&&void 0!==s?s:"":void 0,suffixText:B.discountData.valueType===v.PERCENTAGE?"%":void 0,errorMessage:(null===(r=B.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"Required Field":"",state:(null===(a=B.dynamicDiscountValidationError)||void 0===a?void 0:a.inValidDiscountAmount)?"invalid":"none"})}))})),t("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${h.colorsV2.stroke.primary}`}},{children:i("div",Object.assign({className:"input__wrapper"},{children:[t(g,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),t("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:t(b,{width:"300px",options:Z,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===c.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:p.AMOUNT_OFF_PRODUCTS};B.onChangeCouponType(i),B.setDiscountCouponAppliesTo(e.value),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS||B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS)&&K(B.discountCouponAppliesTo,U.ENTITLED,"couponAppliesTo")]}))}))]})})(),B.selectedCouponType===p.BUY_X_GET_Y&&(()=>{var e,o,n,l,s;return i(I,Object.assign({style:{border:`1px solid ${h.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[ee(U.PREREQUISITE),t("div",{style:{width:"100%",height:"1px",backgroundColor:h.colorsV2.stroke.primary,margin:"8px 0"}}),ee(U.ENTITLED),t(D,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),t("div",{children:t(V,{label:"Free",isActive:100===B.discountData.value,onValueChange:e=>{e?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:100})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}})}),i("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[t(V,{label:"Percentage off",isActive:100!==B.discountData.value,onValueChange:()=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}}),100!==B.discountData.value&&t("div",Object.assign({style:{marginTop:8}},{children:t(y,{value:null!==(n=null===(o=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===o?void 0:o.toString())&&void 0!==n?n:"",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(l=B.dynamicDiscountValidationError)||void 0===l?void 0:l.inValidDiscountAmount)?"Required Field":"",state:(null===(s=B.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!B.selectedCouponType&&t(k,{}),B.allowStaticCoupon&&B.selectedCouponType!==p.BUY_X_GET_Y&&t("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${h.colorsV2.stroke.primary}`}},{children:t(q,{selectedMinimumRequirement:B.selectedMinimumRequirement,setSelectedMinimumRequirement:B.setSelectedMinimumRequirement,discountData:B.discountData,setDiscountData:B.setDiscountData,currency:B.currency,dynamicDiscountValidationError:B.dynamicDiscountValidationError})})),B.selectedCouponType&&!B.hideExpiration&&i("div",Object.assign({style:{padding:B.selectedCouponType!==p.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:B.selectedCouponType!==p.BUY_X_GET_Y?`1px solid ${h.colorsV2.stroke.primary}`:"none"}},{children:[t(d,{label:"Add expiration",isDisabled:!!B.makeExpiryMandatory,isChecked:B.isAddExpirationChecked,onValueChange:e=>{B.setIsAddExpirationChecked(e),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{expireAfter:void 0,expireAt:void 0})),B.setSelectedExpiration(m.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),t(D,Object.assign({style:{color:h.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),B.isAddExpirationChecked&&t(j,{discountData:B.discountData,setDiscountData:B.setDiscountData,isAddExpirationChecked:B.isAddExpirationChecked,inValidCouponExpiry:B.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:B.selectedExpiration,setSelectedExpiration:B.setSelectedExpiration})]}))]})};export{U as DISCOUNT_PRODUCTS,B as default};
1
+ import{__rest as e}from"../../../_virtual/_tslib.js";import{jsxs as i,jsx as t,Fragment as o}from"react/jsx-runtime";import n from"../../../assets/icons/info.svg.js";import{Alert as l}from"../../alerts/Alert.js";import{ALERT_TYPES as s,CONTENT_POSITION as r}from"../../alerts/AlertHelper.js";import{Button as a}from"../../button/Button.js";import{CheckBox as d}from"../../checkBox/CheckBox.js";import{DISCOUNT_APPLIES_TO as c,OFFER_APPLIES_TO as u,DISCOUNT_TYPES as p,COUPON_EXPIRATION as m,DISCOUNT_VALUE_TYPES as C,DISCOUNT_TARGET_TYPES as v,DISCOUNT_TARGET_SELECTION as E}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as D}from"../../dropdown/Dropdown.js";import"../../dropdown/ChipDropdown.js";import"react";import"../../zeroState/ZeroState.js";import{BodySecondary as b,TitleRegular as g,TitleSmall as T}from"../../TypographyStyle.js";import{DEFAULT_THEME as h}from"../../../constants/Theme.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../../icon-button/IconButton.js";import{Input as y}from"../../input/Input.js";import O from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import{RadioButton as P}from"../../radioButton/RadioButton.js";import I from"../../../assets/icons/cubeIcon.svg.js";import V from"../../../assets/icons/delete.svg.js";import S from"../../../assets/icons/edit.svg.js";import j from"../../../assets/icons/plus.svg.js";import{CouponExpiration as f}from"../CouponExpiration/CouponExpiration.js";import{DynamicCouponContainer as x}from"../DiscountModal.styled.js";import{DiscountOptionsContainer as R,DiscountDetailsOption as _,AddProductButtonsContainer as N,ProductCollectionCard as A,CubeIconContainer as L,IconContainer as F,ProductVariableCard as w}from"./DynamicCoupon.styled.js";import q from"./MinimumRequirementComponent.js";import k from"./ZeroState.js";var U;!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(U||(U={}));const B=B=>{var M,G,Q,Y,X,$,W,z;const Z=[{selected:B.discountCouponAppliesTo===c.ENTIRE_ORDER,label:"Entire Order",value:c.ENTIRE_ORDER},{selected:B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS,label:"Specific Product",value:c.SPECIFIC_PRODUCTS},{selected:B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:c.SPECIFIC_COLLECTIONS}],H=[{selected:B.offerAppliesToBuy===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToBuy===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],J=[{selected:B.offerAppliesToGet===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToGet===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],K=(e,d,u)=>{var p,m,C,v,E,D,g,y,P,f,x,R;let _=[],q=[],k={},M={};B.useNewPicker?(k=d===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,M=null!==(p=d===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==p?p:[],(null==k?void 0:k.isCustom)&&delete k.isCustom,(null==M?void 0:M.isCustom)&&delete M.isCustom,Object.values(k).forEach((e=>{Object.keys(e.products).forEach((i=>{_.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(M).forEach((e=>{"isCustom"!==e&&q.push({id:e,name:M[e].name,image:M[e].image})}))):(_=d===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,q=null!==(m=d===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==m?m:[]);const G=[null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidProductSelection,null===(v=B.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidProductVariableSelection,null===(E=B.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidCollectionSelection],Q=[null===(D=B.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidBuyXCollectionSelection,null===(g=B.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidBuyXProductSelection,null===(y=B.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidBuyXProductVariableSelection],Y=[null===(P=B.dynamicDiscountValidationError)||void 0===P?void 0:P.inValidGetYCollectionSelection,null===(f=B.dynamicDiscountValidationError)||void 0===f?void 0:f.inValidGetYProductSelection,null===(x=B.dynamicDiscountValidationError)||void 0===x?void 0:x.inValidGetYProductVariableSelection];let X=!1;return"couponAppliesTo"===u&&(X=G.some(Boolean)),"buyX"===u&&(X=Q.some(Boolean)),"getY"===u&&(X=Y.some(Boolean)),i(o,{children:[i("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===c.SPECIFIC_PRODUCTS&&0===_.length&&(d===U.ENTITLED&&!B.entitledProductVariable||d===U.PREREQUISITE&&!B.preRequisiteProductVariable)&&!(null==q?void 0:q.length)&&i(N,{children:[t("div",Object.assign({style:{width:B.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:t(a,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsProductPickerOpen(d)},error:X})})),B.isProductVariableSupported&&B.productVariableList&&i(o,{children:[t(b,Object.assign({color:h.colorsV2.content.placeholder},{children:"OR"})),t(a,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsProductVariablePickerOpen(d)},error:X})]})]}),e===c.SPECIFIC_COLLECTIONS&&0===q.length&&!(null==_?void 0:_.length)&&t("div",Object.assign({style:{width:"300px",display:"flex"}},{children:t(a,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsCollectionPickerOpen(d)},style:{marginTop:"16px"},error:X})}))]})),X&&t("div",Object.assign({style:{margin:"8px 0 0"}},{children:t(l,{type:s.NEGATIVE,text:"Required Field",contentPosition:r.START,icon:()=>t(n,{width:16,height:16,color:h.colorsV2.content.negative})})})),_.length||q.length?i("div",{children:[t(b,Object.assign({style:{margin:"8px 0"}},{children:e===c.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i(A,{children:[t(L,{children:t(I,{width:20,height:20,color:h.colorsV2.content.secondary})}),i(T,{children:[e===c.SPECIFIC_PRODUCTS?_.length:q.length," ",e===c.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i("div",Object.assign({style:{display:"flex",gap:4}},{children:[t(F,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?B.setIsProductPickerOpen(d):B.setIsCollectionPickerOpen(d)}},{children:t(S,{width:24,height:24,color:h.colorsV2.content.placeholder})})),t(F,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?d===U.ENTITLED?B.setEntitledProducts([]):B.setPrerequisiteProducts([]):d===U.ENTITLED?B.setEntitledCollections([]):B.setPrerequisiteCollections([])}},{children:t(V,{width:24,height:24,color:h.colorsV2.content.placeholder})}))]}))]})]}):d===U.ENTITLED&&B.entitledProductVariable?i("div",{children:[t(b,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(w,{children:[t(T,{children:B.entitledProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(F,Object.assign({onClick:()=>{B.setEntitledProductVariable(void 0)}},{children:t(O,{width:24,height:24,color:h.colorsV2.content.primary})}))}))]})]}):d===U.PREREQUISITE&&(null===(R=B.preRequisiteProductVariable)||void 0===R?void 0:R.displayName)?i("div",{children:[t(b,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(w,{children:[t(T,{children:B.preRequisiteProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(F,Object.assign({onClick:()=>{B.setPreRequisiteProductVariable(void 0)}},{children:t(O,{width:24,height:24,color:h.colorsV2.content.primary})}))}))]})]}):t(o,{children:" "})]})},ee=(e,o)=>{var n,l,s,r,a,d,p,m,C,v;let E=[],g=[],h={},O={};B.useNewPicker?(h=e===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,O=null!==(n=e===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==n?n:[],(null==h?void 0:h.isCustom)&&delete h.isCustom,(null==O?void 0:O.isCustom)&&delete O.isCustom,Object.values(h).forEach((e=>{Object.keys(e.products).forEach((i=>{E.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(O).forEach((e=>{"isCustom"!==e&&g.push({id:e,name:O[e].name,image:O[e].image})}))):(E=e===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,g=null!==(l=e===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==l?l:[]);const P=e===U.PREREQUISITE?B.offerAppliesToBuy:B.offerAppliesToGet,I=e===U.PREREQUISITE?U.PREREQUISITE:U.ENTITLED,V=P===u.SPECIFIC_PRODUCTS?c.SPECIFIC_PRODUCTS:c.SPECIFIC_COLLECTIONS;return i("div",{children:[t(T,Object.assign({style:{marginBottom:16}},{children:e===U.PREREQUISITE?"Customer buys":"Customer gets"})),i("div",Object.assign({style:{display:"flex"}},{children:[!o&&t("div",{children:i("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:e===U.ENTITLED?null!==(r=null===(s=B.discountData.entitledQuantity)||void 0===s?void 0:s.toString())&&void 0!==r?r:"":null!==(d=null===(a=B.discountData.prerequisiteQuantity)||void 0===a?void 0:a.toString())&&void 0!==d?d:"",type:"number",onChangeText:i=>{e===U.ENTITLED?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledQuantity:parseInt(i)})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===U.PREREQUISITE&&(null===(p=B.dynamicDiscountValidationError)||void 0===p?void 0:p.inValidBuyXValue)||e===U.ENTITLED&&(null===(m=B.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYValue)?"Required Field":"",state:e===U.PREREQUISITE&&(null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidBuyXValue)||e===U.ENTITLED&&(null===(v=B.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidGetYValue)?"invalid":"none"})})),t("div",{className:"input__wrapper"})]}))}),i("div",{children:[t(b,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===U.PREREQUISITE&&t(D,{width:"244px",options:H,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToBuy(e.value),B.setPrerequisiteProducts([]),B.setPrerequisiteCollections([]),B.setPreRequisiteProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===U.ENTITLED&&t(D,{width:"244px",options:J,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToGet(e.value),B.setEntitledProducts([]),B.setEntitledCollections([]),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),K(V,I,e===U.PREREQUISITE?"buyX":"getY")]})};return i(x,{children:[i("div",{children:[i("div",Object.assign({style:{display:"flex",gap:16}},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(M=B.discountData.title)&&void 0!==M?M:"",onChangeText:e=>{var i;B.setDiscountData(Object.assign(Object.assign({},B.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(G=B.currency)&&void 0!==G?G:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(Q=B.dynamicDiscountValidationError)||void 0===Q?void 0:Q.invalidCouponTitle)?"Required Field":"",state:(null===(Y=B.dynamicDiscountValidationError)||void 0===Y?void 0:Y.invalidCouponTitle)?"invalid":"none"})})),!B.hideProbability&&t(y,{value:null!==($=null===(X=B.discountData.probability)||void 0===X?void 0:X.toString())&&void 0!==$?$:"",type:"number",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(W=B.dynamicDiscountValidationError)||void 0===W?void 0:W.inValidProbability)?"Required Field":"",state:(null===(z=B.dynamicDiscountValidationError)||void 0===z?void 0:z.inValidProbability)?"invalid":"none"})]})),t("div",{style:{height:"1px",width:"100%",background:h.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),B.allowStaticCoupon&&t((()=>i("div",{children:[t(g,{children:"Discount Details"}),t(R,{children:B.discountDetailsOptions.map((t=>{return i(_,Object.assign({selected:B.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(B.selectedDiscountDetails.id!==i.id)if(B.resetValidationErrors(),B.setValidationErrorMessage(""),B.setDiscountCouponAppliesTo(c.ENTIRE_ORDER),B.setSelectedDiscountDetails(i),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0})),B.setPreRequisiteProductVariable(void 0),B.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){B.onChangeCouponType({label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},B.discountData),{valueType:"percentage"===i.value?C.PERCENTAGE:C.FIXED_AMOUNT,value:void 0,targetType:v.LINE_ITEM,targetSelection:E.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e(t,["entitledQuantity","prerequisiteQuantity"]);B.setDiscountData(o)}else B.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,B.selectedDiscountDetails.id===o?h.colorsV2.stroke.brand:h.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(B.selectedCouponType===p.AMOUNT_OFF_ORDER||B.selectedCouponType===p.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,n,l,s,r,a;return i(o,{children:[t("div",Object.assign({className:"input__rows"},{children:t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(l=null===(n=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===n?void 0:n.toString())&&void 0!==l?l:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:B.discountData.valueType===C.FIXED_AMOUNT?null!==(s=B.currency)&&void 0!==s?s:"":void 0,suffixText:B.discountData.valueType===C.PERCENTAGE?"%":void 0,errorMessage:(null===(r=B.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"Required Field":"",state:(null===(a=B.dynamicDiscountValidationError)||void 0===a?void 0:a.inValidDiscountAmount)?"invalid":"none"})}))})),t("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${h.colorsV2.stroke.primary}`}},{children:i("div",Object.assign({className:"input__wrapper"},{children:[t(g,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),t("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:t(D,{width:"300px",options:Z,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===c.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:p.AMOUNT_OFF_PRODUCTS};B.onChangeCouponType(i),B.setDiscountCouponAppliesTo(e.value),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS||B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS)&&K(B.discountCouponAppliesTo,U.ENTITLED,"couponAppliesTo")]}))}))]})})(),B.selectedCouponType===p.BUY_X_GET_Y&&(()=>{var e,o,n,l,s;return i(x,Object.assign({style:{border:`1px solid ${h.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[ee(U.PREREQUISITE),t("div",{style:{width:"100%",height:"1px",backgroundColor:h.colorsV2.stroke.primary,margin:"8px 0"}}),ee(U.ENTITLED),t(b,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),t("div",{children:t(P,{label:"Free",isActive:100===B.discountData.value,onValueChange:e=>{e?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:100})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}})}),i("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[t(P,{label:"Percentage off",isActive:100!==B.discountData.value,onValueChange:()=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}}),100!==B.discountData.value&&t("div",Object.assign({style:{marginTop:8}},{children:t(y,{value:null!==(n=null===(o=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===o?void 0:o.toString())&&void 0!==n?n:"",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(l=B.dynamicDiscountValidationError)||void 0===l?void 0:l.inValidDiscountAmount)?"Required Field":"",state:(null===(s=B.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!B.selectedCouponType&&t(k,{}),B.allowStaticCoupon&&B.selectedCouponType!==p.BUY_X_GET_Y&&t("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${h.colorsV2.stroke.primary}`}},{children:t(q,{selectedMinimumRequirement:B.selectedMinimumRequirement,setSelectedMinimumRequirement:B.setSelectedMinimumRequirement,discountData:B.discountData,setDiscountData:B.setDiscountData,currency:B.currency,dynamicDiscountValidationError:B.dynamicDiscountValidationError})})),B.selectedCouponType&&!B.hideExpiration&&i("div",Object.assign({style:{padding:B.selectedCouponType!==p.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:B.selectedCouponType!==p.BUY_X_GET_Y?`1px solid ${h.colorsV2.stroke.primary}`:"none"}},{children:[t(d,{label:"Add expiration",isDisabled:!!B.makeExpiryMandatory,isChecked:B.isAddExpirationChecked,onValueChange:e=>{B.setIsAddExpirationChecked(e),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{expireAfter:void 0,expireAt:void 0})),B.setSelectedExpiration(m.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),t(b,Object.assign({style:{color:h.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),B.isAddExpirationChecked&&t(f,{discountData:B.discountData,setDiscountData:B.setDiscountData,isAddExpirationChecked:B.isAddExpirationChecked,inValidCouponExpiry:B.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:B.selectedExpiration,setSelectedExpiration:B.setSelectedExpiration})]}))]})};export{U as DISCOUNT_PRODUCTS,B as default};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { DropdownProps } from "./";
2
+ import { DropdownProps } from './Dropdown';
3
3
  export declare const ChipDropdown: React.FC<DropdownProps>;
4
4
  export declare const ChipDropdownContainer: import("styled-components").StyledComponent<"div", any, {
5
5
  width?: string | undefined;
@@ -1,4 +1,4 @@
1
- import{__rest as t}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as e}from"react/jsx-runtime";import{useState as n,useRef as r}from"react";import i from"styled-components";import{DropdownPopover as p}from"./DropdownPopover/index.js";import"./Dropdown.js";import"../zeroState/ZeroState.js";import{BodySecondary as s}from"../TypographyStyle.js";import{COLORS as m}from"../../constants/Theme.js";import"./OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"./OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"./OpenedDropdown/components/menu/MenuItem.js";import"./OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"./OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"./OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"./MenuItem/MenuItem.js";import{Tag as d}from"../tag/Tag.js";import l from"../../assets/icons/chevronDown.svg.js";import c from"../../assets/icons/chevronDownOutline.svg.js";import a from"../../assets/icons/chevronUpOutline.svg.js";const u=i=>{var{placeHolder:u,onSelect:g}=i,j=t(i,["placeHolder","onSelect"]);const[w,f]=n(!1),y=r();return o(p,Object.assign({ref:y,onDropdownVisbilityChange:t=>f(t),onSelect:function(t){null==g||g(t)}},j,{children:"default"==j.inputType?e(h,Object.assign({width:null==j?void 0:j.width,height:null==j?void 0:j.height},{children:[o(s,Object.assign({color:m.content.placeholder},{children:u})),o(l,{style:{transform:w?"rotate(180deg)":"rotate(0deg)"},width:20,height:20,color:m.content.primary})]})):o(d,{tagText:null!=u?u:"",theme:"light",type:"neutral",variant:"regular",TrailingIcon:w?a:c})}))};u.displayName="ChipDropdown";const h=i.div`
1
+ import{__rest as t}from"../../_virtual/_tslib.js";import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useState as r,useRef as i}from"react";import n from"styled-components";import{Tag as s}from"../tag/Tag.js";import{COLORS as l}from"../../constants/Theme.js";import p from"../../assets/icons/chevronDown.svg.js";import a from"../../assets/icons/chevronDownOutline.svg.js";import c from"../../assets/icons/chevronUpOutline.svg.js";import{BodySecondary as d}from"../TypographyStyle.js";import{DropdownPopover as h}from"./DropdownPopover/index.js";const m=n=>{var{placeHolder:m,onSelect:f}=n,u=t(n,["placeHolder","onSelect"]);const[v,j]=r(!1),w=i();return e(h,Object.assign({ref:w,onDropdownVisbilityChange:t=>j(t),onSelect:function(t){null==f||f(t)}},u,{children:"default"==u.inputType?o(g,Object.assign({width:null==u?void 0:u.width,height:null==u?void 0:u.height},{children:[e(d,Object.assign({color:l.content.placeholder},{children:m})),e(p,{style:{transform:v?"rotate(180deg)":"rotate(0deg)"},width:20,height:20,color:l.content.primary})]})):e(s,{tagText:null!=m?m:"",theme:"light",type:"neutral",variant:"regular",TrailingIcon:v?c:a})}))};m.displayName="ChipDropdown";const g=n.div`
2
2
  display: flex;
3
3
  flex-direction: row;
4
4
  width: ${t=>(null==t?void 0:t.width)?t.width:"240px"};
@@ -6,9 +6,9 @@ import{__rest as t}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as e}from
6
6
  gap: 8px;
7
7
  justify-content: space-between;
8
8
  align-items: center;
9
- border: 1px solid ${m.stroke.primary};
9
+ border: 1px solid ${l.stroke.primary};
10
10
  border-radius: 4px;
11
11
  padding-left: 8px;
12
12
  padding-right: 8px;
13
13
  cursor: pointer;
14
- `;export{u as ChipDropdown,h as ChipDropdownContainer};
14
+ `;export{m as ChipDropdown,g as ChipDropdownContainer};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { OpenDropdownProps } from "../type";
2
+ import { OpenDropdownProps } from '../type';
3
3
  export type MenuItemDropdownProps = OpenDropdownProps & {
4
4
  isHorizontal: boolean;
5
5
  children?: React.ReactNode;
@@ -1,6 +1,6 @@
1
- import{jsx as o,jsxs as e}from"react/jsx-runtime";import t from"../../../assets/icons/horizontal_dots.svg.js";import n from"../../../assets/icons/vertical_dots.svg.js";import r from"styled-components";import{DropdownPopover as s}from"../DropdownPopover/index.js";import"../Dropdown.js";import"../ChipDropdown.js";import"react";import"../../zeroState/ZeroState.js";import"../../TypographyStyle.js";import{COLORS as i}from"../../../constants/Theme.js";import"../OpenedDropdown/components/description/Description.styled.js";import"../../checkBox/CheckBox.styled.js";import"../../list-item/ListItem.js";import"../OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../OpenedDropdown/components/menu/MenuItem.js";import"../OpenedDropdown/components/menu/MenuList.styled.js";import"../../button/Button.js";import"../OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../OpenedDropdown/components/OpennedDropdown.styled.js";import{IconButton as p}from"../../icon-button/IconButton.js";import"../../input/Input.js";const d=r.div`
1
+ import{jsx as o,jsxs as e}from"react/jsx-runtime";import i from"../../../assets/icons/horizontal_dots.svg.js";import r from"../../../assets/icons/vertical_dots.svg.js";import s from"styled-components";import{IconButton as t}from"../../icon-button/IconButton.js";import{COLORS as n}from"../../../constants/Theme.js";import{DropdownPopover as a}from"../DropdownPopover/index.js";const d=s.div`
2
2
  :hover {
3
- background: ${i.surface.subdued};
3
+ background: ${n.surface.subdued};
4
4
  }
5
5
  position: ${o=>o.isNewTag?"relative":""};
6
6
  .new--tag {
@@ -11,10 +11,10 @@ import{jsx as o,jsxs as e}from"react/jsx-runtime";import t from"../../../assets/
11
11
  border-radius: 50%;
12
12
  width: 14px;
13
13
  height: 14px;
14
- background: ${i.background.negative.vibrant};
15
- border: 1.25px solid ${i.surface.standard};
14
+ background: ${n.background.negative.vibrant};
15
+ border: 1.25px solid ${n.surface.standard};
16
16
  display: flex;
17
17
  justify-content: center;
18
18
  align-items: center;
19
19
  }
20
- `,m=r=>o(d,Object.assign({isNewTag:r.isNewTag},{children:e(s,Object.assign({},r,{children:[o("div",{children:o(p,{Icon:r.isHorizontal?t:n,bordered:!(null==r?void 0:r.hideBorder)})}),r.isNewTag?o("div",{className:"new--tag"}):null]}))}));m.displayName="MenuItemDropdown";export{m as MenuItemDropdown};
20
+ `,c=s=>o(d,Object.assign({isNewTag:s.isNewTag},{children:e(a,Object.assign({},s,{children:[o("div",{children:o(t,{Icon:s.isHorizontal?i:r,bordered:!(null==s?void 0:s.hideBorder)})}),s.isNewTag?o("div",{className:"new--tag"}):null]}))}));c.displayName="MenuItemDropdown";export{c as MenuItemDropdown};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import o from"../../assets/icons/chevronRight2.svg.js";import i,{useRef as l}from"react";import{COLORS as r}from"../../constants/Theme.js";import{BodyCaption as s,BodyTiny as d}from"../TypographyStyle.js";import{MenuList as c}from"./MenuList.js";import{MenuItemWrapper as a,MenuItemContainer as p,ContentContainer as u,LeadingIconContainer as h,TrailingIconContainer as m,SubMenuContainer as v,StyledSubMenuWrapper as g,SubMenuListContainer as b}from"./MultiLevelDropdown.styled.js";const f=f=>{let{width:j,onDropdownItemClick:y,option:w,parents:C}=f;var I,M,O,S,T,x,k;const[D,L]=i.useState(!1),[E,R]=i.useState(!1),[B,H]=i.useState({top:0,left:0}),N=l({top:0,left:0});return e(a,Object.assign({onMouseEnter:e=>{L(!0),(e=>{const t=e.currentTarget.getBoundingClientRect();H({top:t.top,left:t.right}),N.current={top:t.top,left:t.right}})(e)},onMouseLeave:()=>{L(!1)},onClick:()=>{var e,t;!y||null!==(e=w.disabled)&&void 0!==e&&e||(null===(t=w.children)||void 0===t?void 0:t.length)||y(w,C)},id:"menuItemWrapper",style:{cursor:null!==(I=w.disabled)&&void 0!==I&&I?"not-allowed":"pointer",backgroundColor:null!==(M=w.disabled)&&void 0!==M&&M?r.surface.standard:"transparent"}},{children:[w.customComponent?w.customComponent:e(p,Object.assign({isSelected:w.selected,isSubMenuOpen:D,isHovered:E,isDisabled:null!==(O=w.disabled)&&void 0!==O&&O},{children:[e(u,{children:[w.leadingIcon&&t(h,{children:w.leadingIcon}),e("div",{children:[t(s,Object.assign({style:{color:null!==(S=w.disabled)&&void 0!==S&&S?r.content.inactive:w.selected||E?r.content.positive:r.content.primary}},{children:w.label})),w.subText&&t(d,Object.assign({style:{color:null!==(T=w.disabled)&&void 0!==T&&T?r.content.inactive:w.selected||E?r.content.positive:r.content.secondary,marginTop:"2px"}},{children:w.subText}))]})]}),w.children&&w.children.length>0?t(m,{children:t(o,{width:16,height:16,color:null!==(x=w.disabled)&&void 0!==x&&x?r.content.inactive:w.selected||E?r.content.positive:r.content.primary})}):w.trailingIcon?t(m,{children:w.trailingIcon}):t(n,{})]})),!(null!==(k=w.disabled)&&void 0!==k&&k)&&w.children&&w.children.length>0&&D&&t(v,Object.assign({width:j,className:"submenu",onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1)},{children:t(g,Object.assign({width:j,top:B.top,left:B.left},{children:t(b,{children:t(c,{width:j,onDropdownItemClick:y,options:w.children,parents:[...C,w]})})}))}))]}))};export{f as MenuItem};
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import i from"../../assets/icons/chevronRight2.svg.js";import o,{useRef as l,Suspense as r}from"react";import{COLORS as s}from"../../constants/Theme.js";import{BodyCaption as d,BodyTiny as c}from"../TypographyStyle.js";import{MenuItemWrapper as a,MenuItemContainer as p,ContentContainer as h,LeadingIconContainer as u,TrailingIconContainer as m,SubMenuContainer as g,StyledSubMenuWrapper as v,SubMenuListContainer as b}from"./MultiLevelDropdown.styled.js";const f=o.lazy((()=>import("./MenuList.js").then((e=>({default:e.MenuList}))))),j=j=>{let{width:y,onDropdownItemClick:w,option:M,parents:O}=j;var C,I,L,S,T,k,x;const[D,E]=o.useState(!1),[R,z]=o.useState(!1),[B,H]=o.useState({top:0,left:0}),N=l({top:0,left:0});return e(a,Object.assign({onMouseEnter:e=>{E(!0),(e=>{const t=e.currentTarget.getBoundingClientRect();H({top:t.top,left:t.right}),N.current={top:t.top,left:t.right}})(e)},onMouseLeave:()=>{E(!1)},onClick:()=>{var e,t;!w||null!==(e=M.disabled)&&void 0!==e&&e||(null===(t=M.children)||void 0===t?void 0:t.length)||w(M,O)},id:"menuItemWrapper",style:{cursor:null!==(C=M.disabled)&&void 0!==C&&C?"not-allowed":"pointer",backgroundColor:null!==(I=M.disabled)&&void 0!==I&&I?s.surface.standard:"transparent"}},{children:[M.customComponent?M.customComponent:e(p,Object.assign({isSelected:M.selected,isSubMenuOpen:D,isHovered:R,isDisabled:null!==(L=M.disabled)&&void 0!==L&&L},{children:[e(h,{children:[M.leadingIcon&&t(u,{children:M.leadingIcon}),e("div",{children:[t(d,Object.assign({style:{color:null!==(S=M.disabled)&&void 0!==S&&S?s.content.inactive:M.selected||R?s.content.positive:s.content.primary}},{children:M.label})),M.subText&&t(c,Object.assign({style:{color:null!==(T=M.disabled)&&void 0!==T&&T?s.content.inactive:M.selected||R?s.content.positive:s.content.secondary,marginTop:"2px"}},{children:M.subText}))]})]}),M.children&&M.children.length>0?t(m,{children:t(i,{width:16,height:16,color:null!==(k=M.disabled)&&void 0!==k&&k?s.content.inactive:M.selected||R?s.content.positive:s.content.primary})}):M.trailingIcon?t(m,{children:M.trailingIcon}):t(n,{})]})),!(null!==(x=M.disabled)&&void 0!==x&&x)&&M.children&&M.children.length>0&&D&&t(g,Object.assign({width:y,className:"submenu",onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1)},{children:t(v,Object.assign({width:y,top:B.top,left:B.left},{children:t(b,{children:t(r,Object.assign({fallback:t("div",{children:"Loading..."})},{children:t(f,{width:y,onDropdownItemClick:w,options:M.children,parents:[...O,M]})}))})}))}))]}))};export{j as MenuItem};
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { ButtonProps } from '../button/model';
4
- import { FooterForNonModalI, OUT_OF_STOCK_ACTION } from './type';
4
+ import { FooterForNonModalI, OUT_OF_STOCK_ACTION, ScreenName } from './type';
5
5
  export interface ProductVariant {
6
6
  name: string;
7
7
  price: string;
@@ -58,13 +58,6 @@ export type FbStatusFetcherReturn = Promise<{
58
58
  [key: string]: FbProductStatus;
59
59
  }>;
60
60
  export type FbProductStatus = 'APPROVED' | 'REJECTED';
61
- export declare enum ScreenName {
62
- Collections = "collections",
63
- RearrangeProducts = "rearrange",
64
- SelectedProducts = "view",
65
- SearchProducts = "searchProducts",
66
- Products = "products"
67
- }
68
61
  export type ProductPickerInterface = {
69
62
  hideGlobalSearch?: boolean;
70
63
  hideInCollectionSearch?: boolean;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as n}from"react";import{COLORS as l}from"../../constants/Theme.js";import a from"../../assets/icons/cross.svg.js";import{Button as d}from"../button/Button.js";import{Input as u}from"../input/Input.js";import{StyledModal as p}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as m}from"../tag/Tag.js";import{CollectionsScreen as g}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as y}from"./productScreen.js";import{RearrangeScreen as b}from"./rearrangeScreen.js";import{collectionsReducer as f,searchReducer as S,selectedColectionsReducer as k,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as j}from"./searchScreen.js";import{SelectedScreen as I}from"./selectedScreen.js";import{ContainerStyle as x,ScrollContainerStyle as P,StyledFooterForNonModal as O}from"./style.js";import{OUT_OF_STOCK_ACTION as T}from"./type.js";import{updateAllVariantsForSelectedProducts as D}from"./utility.js";import{__exports as F}from"../../_virtual/bik-store.js";var R;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(R||(R={}));const w=w=>{const{storeId:A,selectedItems:B,onClose:E,visible:L,zIndex:z,exactLimit:V,limit:$,hideCollectionCheckbox:M,hideProductCheckbox:H,outOfStockAction:W=T.BLUR,hideVariantCheckbox:_,selectProductsFromCustomCollection:G,hideSelectionCount:K,title:N,width:U,left:Y,renderWithoutModal:q,onClickSave:J,pickerType:Q,hideProductVariants:X=!1,startupScreen:Z=R.Collections,rearrangeEnabled:ee,selectSingleItem:te=!1,showProductDetails:oe,containerStyle:ce,crossButtonInsideHeader:re=!1,footerForNonModal:se={},primaryButton:ie,secondaryButton:ne,subtitle:le}=w,ae=w.appType||F.ApplicationType.BIK,[de,ue]=r(f,{}),[pe,he]=s([R.Collections,R.RearrangeProducts].includes(Z)?Z:R.Collections),[me,ge]=s("grid"),[Ce,ye]=s(""),[be,fe]=s(""),[Se,ke]=s(0),[ve,je]=s(!1),[Ie,xe]=s(0),[Pe,Oe]=s(""),[Te,De]=s(!1),[Fe,Re]=s(!1),[we,Ae]=r(S,{collections:{},products:{}}),[Be,Ee]=r(k,Object.keys(B).length>0?B:{}),Le=i(null),[ze,Ve]=s(!1),[$e,Me]=s();n((()=>{je(!0),Re(!0),w.collectionFetcher(Se,A,ae).then((e=>{ue({type:"fetched",data:(null==e?void 0:e.collections)||{}}),je(!1),ke((e=>e+1)),Re(!1)})).catch()}),[]),n((()=>{let e=0;X?Object.keys(Be||[]).forEach((t=>{var o;Object.keys((null===(o=Be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&Be[-1]&&(null===(c=Be[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(Be||[]).forEach((t=>{var o;Object.keys((null===(o=Be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=Be[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),xe(e)}),[de,Be,X]),n((()=>{be&&(je(!0),w.productFetcher(be,A,ae).then((e=>{Object.keys(e).length&&ue({type:"productsFetched",data:{collectionId:be,products:e}}),je(!1)})).catch())}),[be]),n((()=>{const e=setTimeout((()=>{"rearrange"!==pe&&(Pe.length||"collections"!==pe)&&(Pe.length?(De(!0),w.searchFetcher(A,Pe,ae).then((e=>{"collections"in e&&"products"in e?(Ae({type:"set",data:e}),ue({type:"searched",data:e.collections}),ue({type:"searched",data:e.products})):(Ae({type:"set",data:{collections:{},products:e}}),ue({type:"searched",data:e})),he("searchProducts"),je(!1),De(!1)}))):he("collections"))}),800);return()=>clearTimeout(e)}),[Pe]),n((()=>{J&&(w.onAdd(Be,Ie),He())}),[J]),n((()=>{te&&Object.keys(Be||{}).length&&Ie&&(w.onAdd(Be,Ie),He())}),[te,Be,Ie]);const He=()=>{Ee({type:"reset",data:{}})},We=()=>V&&Ie>V?t(m,{tagText:`You can only select ${V} products`,type:"negative"}):$&&Ie>$?t(m,{tagText:`You can only select ${$} products`,type:"negative"}):t(d,Ie>0?{onClick:()=>{he(ee?R.RearrangeProducts:R.SelectedProducts)},buttonText:V?`${Ie}/${V} products selected`:`${Ie} products selected`,buttonType:["rearrange","view"].includes(pe)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(pe)}:{disabled:!0,buttonText:V?`${Ie}/${V} products selected`:`${Ie} products selected`,buttonType:"tertiaryGray"}),_e=e=>ve?"Loading...":pe===R.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",Ge=e(x,Object.assign({style:null!=ce?ce:{}},{children:[w.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:w.postHeader})),!w.hideGlobalSearch&&t(o,{children:("collections"===pe||"searchProducts"===pe)&&t("div",Object.assign({style:{padding:q?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(u,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Te?t(h,{size:"small",color:l.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:Pe,onChangeText:e=>{e.length&&e.trim().length?Oe(e):Oe("")}})}))}),e(P,Object.assign({ref:Le,screenName:pe},{children:["collections"===pe&&t(g,{customCollectionRestriction:w.customCollectionRestriction,dataLoading:Fe,collections:de,selectedCollectionsDispatch:Ee,setCollectionId:ye,setSelectedCollectionId:fe,setScreen:he,selectedCollections:Be,collectionFetcher:w.collectionFetcher,storeId:A,appType:ae,collectionsDispatch:ue,setSaveDisabled:je,pagingControls:{curPage:Se,setCurPage:ke},hideCollectionCheckbox:M,renderWithoutModal:q,pickerType:Q,scrollContainerRef:Le}),"products"===pe&&Ce&&t(v.Provider,Object.assign({value:Ce},{children:t(y,{hideInCollectionSearch:w.hideInCollectionSearch,customCollectionRestriction:w.customCollectionRestriction,productFetcher:w.productFetcher,setScreen:he,storeId:A,appType:ae,data:de[Ce],collectionsDispatch:ue,selectedCollectionsDispatch:Ee,selectedData:Be,setSaveDisabled:je,searchInCollectionFetcher:w.searchInCollectionFetcher,hideProductCheckbox:H,outOfStockAction:W,hideVariantCheckbox:_,selectProductsFromCustomCollection:G,renderWithoutModal:q,pickerType:Q,hideProductVariants:X,fbStatusFetcher:w.fbStatusFetcher,onProductDetailClick:e=>{Ve(!0),Me(e)},showProductDetailInfoIcon:oe,scrollContainerRef:Le})})),"view"===pe&&t(I,{selectedCollections:Be||{},selectedCollectionsDispatch:Ee,setScreen:he,collections:de,hideProductVariants:X,outOfStockAction:W,storeId:A,appType:ae,fbStatusFetcher:w.fbStatusFetcher}),"rearrange"===pe&&t(b,{selectedCollections:Be||{},selectedCollectionsDispatch:Ee,setScreen:he,outOfStockAction:W,rearrangeViewType:"grid"===me?"list":"grid",scrollContainerRef:Le,storeId:A,appType:ae,fbStatusFetcher:w.fbStatusFetcher}),"searchProducts"===pe&&t(j,{customCollectionRestriction:w.customCollectionRestriction,selectedCollections:Be||{},searchedCollections:we||{},searchedCollectionsDispatch:Ae,selectedCollectionsDispatch:Ee,setScreen:he,collections:de,onBackPress:()=>{Oe(""),Ae({type:"set",data:{collections:{},products:{}}})},pickerType:Q,hideProductCheckbox:H,hideProductVariants:X,hideVariantCheckbox:_,storeId:A,appType:ae,fbStatusFetcher:w.fbStatusFetcher,setCollectionId:ye,setSelectedCollectionId:fe,renderWithoutModal:q,hideCollectionCheckbox:M,outOfStockAction:W})]}))]}));return t(o,{children:q?e(o,{children:[Ge,se.renderFooter?e(O,{children:[We(),t(d,{buttonText:_e(se.primaryButtonText),disabled:!se.isLoading&&(ve||Ie<1||V&&Ie<V||!V&&$&&Ie>$)||se.primaryButtonDisabled,isLoading:se.isLoading,onClick:()=>{w.onAdd(Be,Ie),He(),he([R.Collections,R.RearrangeProducts].includes(Z)?Z:R.Collections)}})]}):t(o,{}),ze&&$e?t(C,{productData:$e,outOfStockAction:W,useDynamicInfoImageSize:w.useDynamicInfoImageSize,onClose:()=>{Ve(!1)}}):t(o,{})]}):e(p,Object.assign({zIndex:z,open:L,onClose:()=>{null==E||E(),He()},headingTitle:N||("collections"===pe||"products"===pe?"Select Products":"view"===pe?"Selected Products":"searchProducts"===pe?"Searched Results":"rearrange"===pe?"Rearrange Products":void 0),headingSubtitle:le,footerShadow:!0,centralContainerStyles:{width:U||"600px",left:Y||"auto"},headerRightCustomElement:re?t("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:E},{children:t(a,{width:20,height:20,color:l.content.secondary})})):t(o,{}),footerContainerStyle:w.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:l.surface.standard}:void 0,primaryButton:ie?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ve||Ie<1||V&&Ie<V||!V&&$&&Ie>$)||e.disabled,onClick:()=>{w.onAdd(Be,Ie),He(),he([R.Collections,R.RearrangeProducts].includes(Z)?Z:R.Collections)}}))(ie):{buttonText:_e(),disabled:ve||Ie<1||V&&Ie<V||!V&&$&&Ie>$||!1,onClick:()=>{w.onAdd(Be,Ie),He()}},secondaryButton:ne?(e=>Object.assign(Object.assign({},e),{disabled:ve||Ie<1||V&&Ie<V||!V&&$&&Ie>$||!1,onClick:()=>{const e=D(Be,de,we);w.onAdd(e,Ie,!0)}}))(ne):void 0,wrapperStyle:w.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:K?t(o,{}):We(),hideCrossButton:ze||re},{children:[Ge,ze&&$e?t(C,{productData:$e,useDynamicInfoImageSize:w.useDynamicInfoImageSize,outOfStockAction:W,onClose:()=>{Ve(!1)}}):t(o,{})]}))})};export{w as ProductPickerModal,R as ScreenName};
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as n}from"react";import{COLORS as l}from"../../constants/Theme.js";import a from"../../assets/icons/cross.svg.js";import{Button as d}from"../button/Button.js";import{Input as u}from"../input/Input.js";import{StyledModal as p}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as m}from"../tag/Tag.js";import{CollectionsScreen as C}from"./collectionScreen.js";import{ProductInfoOverlay as g}from"./productInfoOverlay.js";import{ProductsScreen as y}from"./productScreen.js";import{RearrangeScreen as b}from"./rearrangeScreen.js";import{collectionsReducer as f,searchReducer as S,selectedColectionsReducer as k,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as j}from"./searchScreen.js";import{SelectedScreen as I}from"./selectedScreen.js";import{ContainerStyle as x,ScrollContainerStyle as P,StyledFooterForNonModal as O}from"./style.js";import{OUT_OF_STOCK_ACTION as T,ScreenName as D}from"./type.js";import{updateAllVariantsForSelectedProducts as F}from"./utility.js";import{__exports as R}from"../../_virtual/bik-store.js";const w=w=>{const{storeId:A,selectedItems:B,onClose:E,visible:L,zIndex:z,exactLimit:V,limit:$,hideCollectionCheckbox:M,hideProductCheckbox:H,outOfStockAction:W=T.BLUR,hideVariantCheckbox:_,selectProductsFromCustomCollection:G,hideSelectionCount:K,title:N,width:U,left:Y,renderWithoutModal:q,onClickSave:J,pickerType:Q,hideProductVariants:X=!1,startupScreen:Z=D.Collections,rearrangeEnabled:ee,selectSingleItem:te=!1,showProductDetails:oe,containerStyle:ce,crossButtonInsideHeader:re=!1,footerForNonModal:se={},primaryButton:ie,secondaryButton:ne,subtitle:le}=w,ae=w.appType||R.ApplicationType.BIK,[de,ue]=r(f,{}),[pe,he]=s([D.Collections,D.RearrangeProducts].includes(Z)?Z:D.Collections),[me,Ce]=s("grid"),[ge,ye]=s(""),[be,fe]=s(""),[Se,ke]=s(0),[ve,je]=s(!1),[Ie,xe]=s(0),[Pe,Oe]=s(""),[Te,De]=s(!1),[Fe,Re]=s(!1),[we,Ae]=r(S,{collections:{},products:{}}),[Be,Ee]=r(k,Object.keys(B).length>0?B:{}),Le=i(null),[ze,Ve]=s(!1),[$e,Me]=s();n((()=>{je(!0),Re(!0),w.collectionFetcher(Se,A,ae).then((e=>{ue({type:"fetched",data:(null==e?void 0:e.collections)||{}}),je(!1),ke((e=>e+1)),Re(!1)})).catch()}),[]),n((()=>{let e=0;X?Object.keys(Be||[]).forEach((t=>{var o;Object.keys((null===(o=Be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&Be[-1]&&(null===(c=Be[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(Be||[]).forEach((t=>{var o;Object.keys((null===(o=Be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=Be[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),xe(e)}),[de,Be,X]),n((()=>{be&&(je(!0),w.productFetcher(be,A,ae).then((e=>{Object.keys(e).length&&ue({type:"productsFetched",data:{collectionId:be,products:e}}),je(!1)})).catch())}),[be]),n((()=>{const e=setTimeout((()=>{"rearrange"!==pe&&(Pe.length||"collections"!==pe)&&(Pe.length?(De(!0),w.searchFetcher(A,Pe,ae).then((e=>{"collections"in e&&"products"in e?(Ae({type:"set",data:e}),ue({type:"searched",data:e.collections}),ue({type:"searched",data:e.products})):(Ae({type:"set",data:{collections:{},products:e}}),ue({type:"searched",data:e})),he("searchProducts"),je(!1),De(!1)}))):he("collections"))}),800);return()=>clearTimeout(e)}),[Pe]),n((()=>{J&&(w.onAdd(Be,Ie),He())}),[J]),n((()=>{te&&Object.keys(Be||{}).length&&Ie&&(w.onAdd(Be,Ie),He())}),[te,Be,Ie]);const He=()=>{Ee({type:"reset",data:{}})},We=()=>V&&Ie>V?t(m,{tagText:`You can only select ${V} products`,type:"negative"}):$&&Ie>$?t(m,{tagText:`You can only select ${$} products`,type:"negative"}):t(d,Ie>0?{onClick:()=>{he(ee?D.RearrangeProducts:D.SelectedProducts)},buttonText:V?`${Ie}/${V} products selected`:`${Ie} products selected`,buttonType:["rearrange","view"].includes(pe)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(pe)}:{disabled:!0,buttonText:V?`${Ie}/${V} products selected`:`${Ie} products selected`,buttonType:"tertiaryGray"}),_e=e=>ve?"Loading...":pe===D.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",Ge=e(x,Object.assign({style:null!=ce?ce:{}},{children:[w.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:w.postHeader})),!w.hideGlobalSearch&&t(o,{children:("collections"===pe||"searchProducts"===pe)&&t("div",Object.assign({style:{padding:q?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(u,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Te?t(h,{size:"small",color:l.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:Pe,onChangeText:e=>{e.length&&e.trim().length?Oe(e):Oe("")}})}))}),e(P,Object.assign({ref:Le,screenName:pe},{children:["collections"===pe&&t(C,{customCollectionRestriction:w.customCollectionRestriction,dataLoading:Fe,collections:de,selectedCollectionsDispatch:Ee,setCollectionId:ye,setSelectedCollectionId:fe,setScreen:he,selectedCollections:Be,collectionFetcher:w.collectionFetcher,storeId:A,appType:ae,collectionsDispatch:ue,setSaveDisabled:je,pagingControls:{curPage:Se,setCurPage:ke},hideCollectionCheckbox:M,renderWithoutModal:q,pickerType:Q,scrollContainerRef:Le}),"products"===pe&&ge&&t(v.Provider,Object.assign({value:ge},{children:t(y,{hideInCollectionSearch:w.hideInCollectionSearch,customCollectionRestriction:w.customCollectionRestriction,productFetcher:w.productFetcher,setScreen:he,storeId:A,appType:ae,data:de[ge],collectionsDispatch:ue,selectedCollectionsDispatch:Ee,selectedData:Be,setSaveDisabled:je,searchInCollectionFetcher:w.searchInCollectionFetcher,hideProductCheckbox:H,outOfStockAction:W,hideVariantCheckbox:_,selectProductsFromCustomCollection:G,renderWithoutModal:q,pickerType:Q,hideProductVariants:X,fbStatusFetcher:w.fbStatusFetcher,onProductDetailClick:e=>{Ve(!0),Me(e)},showProductDetailInfoIcon:oe,scrollContainerRef:Le})})),"view"===pe&&t(I,{selectedCollections:Be||{},selectedCollectionsDispatch:Ee,setScreen:he,collections:de,hideProductVariants:X,outOfStockAction:W,storeId:A,appType:ae,fbStatusFetcher:w.fbStatusFetcher}),"rearrange"===pe&&t(b,{selectedCollections:Be||{},selectedCollectionsDispatch:Ee,setScreen:he,outOfStockAction:W,rearrangeViewType:"grid"===me?"list":"grid",scrollContainerRef:Le,storeId:A,appType:ae,fbStatusFetcher:w.fbStatusFetcher}),"searchProducts"===pe&&t(j,{customCollectionRestriction:w.customCollectionRestriction,selectedCollections:Be||{},searchedCollections:we||{},searchedCollectionsDispatch:Ae,selectedCollectionsDispatch:Ee,setScreen:he,collections:de,onBackPress:()=>{Oe(""),Ae({type:"set",data:{collections:{},products:{}}})},pickerType:Q,hideProductCheckbox:H,hideProductVariants:X,hideVariantCheckbox:_,storeId:A,appType:ae,fbStatusFetcher:w.fbStatusFetcher,setCollectionId:ye,setSelectedCollectionId:fe,renderWithoutModal:q,hideCollectionCheckbox:M,outOfStockAction:W})]}))]}));return t(o,{children:q?e(o,{children:[Ge,se.renderFooter?e(O,{children:[We(),t(d,{buttonText:_e(se.primaryButtonText),disabled:!se.isLoading&&(ve||Ie<1||V&&Ie<V||!V&&$&&Ie>$)||se.primaryButtonDisabled,isLoading:se.isLoading,onClick:()=>{w.onAdd(Be,Ie),He(),he([D.Collections,D.RearrangeProducts].includes(Z)?Z:D.Collections)}})]}):t(o,{}),ze&&$e?t(g,{productData:$e,outOfStockAction:W,useDynamicInfoImageSize:w.useDynamicInfoImageSize,onClose:()=>{Ve(!1)}}):t(o,{})]}):e(p,Object.assign({zIndex:z,open:L,onClose:()=>{null==E||E(),He()},headingTitle:N||("collections"===pe||"products"===pe?"Select Products":"view"===pe?"Selected Products":"searchProducts"===pe?"Searched Results":"rearrange"===pe?"Rearrange Products":void 0),headingSubtitle:le,footerShadow:!0,centralContainerStyles:{width:U||"600px",left:Y||"auto"},headerRightCustomElement:re?t("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:E},{children:t(a,{width:20,height:20,color:l.content.secondary})})):t(o,{}),footerContainerStyle:w.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:l.surface.standard}:void 0,primaryButton:ie?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ve||Ie<1||V&&Ie<V||!V&&$&&Ie>$)||e.disabled,onClick:()=>{w.onAdd(Be,Ie),He(),he([D.Collections,D.RearrangeProducts].includes(Z)?Z:D.Collections)}}))(ie):{buttonText:_e(),disabled:ve||Ie<1||V&&Ie<V||!V&&$&&Ie>$||!1,onClick:()=>{w.onAdd(Be,Ie),He()}},secondaryButton:ne?(e=>Object.assign(Object.assign({},e),{disabled:ve||Ie<1||V&&Ie<V||!V&&$&&Ie>$||!1,onClick:()=>{const e=F(Be,de,we);w.onAdd(e,Ie,!0)}}))(ne):void 0,wrapperStyle:w.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:K?t(o,{}):We(),hideCrossButton:ze||re},{children:[Ge,ze&&$e?t(g,{productData:$e,useDynamicInfoImageSize:w.useDynamicInfoImageSize,outOfStockAction:W,onClose:()=>{Ve(!1)}}):t(o,{})]}))})};export{w as ProductPickerModal};
@@ -1,4 +1,4 @@
1
- import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";import{BodyTiny as t,TitleSmall as o}from"../TypographyStyle.js";import{ScreenName as n}from"./modal.js";const r=e.div`
1
+ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";import{BodyTiny as t,TitleSmall as o}from"../TypographyStyle.js";import{ScreenName as n}from"./type.js";const r=e.div`
2
2
  display: flex;
3
3
  background-color: white;
4
4
  height: ${e=>e.renderWithoutModal?"90%":"75vh"};
@@ -16,7 +16,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
16
16
  background-color: ${e=>e.screenName!==n.RearrangeProducts?"#888":"#fff"};
17
17
  border-radius: 8px;
18
18
  }
19
- `,l=e.div`
19
+ `,p=e.div`
20
20
  height: 64px;
21
21
  background-color: ${e=>e.isDisabled?"#F0F0F0":e.isActive?i.background.positive.light:"white"};
22
22
  border-bottom: 1px solid #e0e0e0;
@@ -30,7 +30,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
30
30
  cursor: pointer;
31
31
  background-color: ${i.surface.hovered};
32
32
  }
33
- `,p=e.div`
33
+ `,l=e.div`
34
34
  display: flex;
35
35
  flex-direction: row;
36
36
  justify-content: center;
@@ -169,4 +169,4 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
169
169
  white-space: nowrap;
170
170
  text-overflow: ellipsis;
171
171
  display: block;
172
- `;export{a as CollectionCardDetailStyle,p as CollectionCardInfoStyle,l as CollectionCardStyle,f as CollectionNameHolder,r as ContainerStyle,y as EllipsedBodyTiny,x as ProductCardStyle,v as ProductInfo,s as ProductScreenCollectionCardStyle,c as ProductScreenHeader,w as ProductSubTitle,b as SKUIDBadge,d as ScrollContainerStyle,g as SelectedScreenHeader,u as StyledFooterForNonModal,m as VariantCardGridStyle,h as VariantCardListStyle};
172
+ `;export{a as CollectionCardDetailStyle,l as CollectionCardInfoStyle,p as CollectionCardStyle,f as CollectionNameHolder,r as ContainerStyle,y as EllipsedBodyTiny,x as ProductCardStyle,v as ProductInfo,s as ProductScreenCollectionCardStyle,c as ProductScreenHeader,w as ProductSubTitle,b as SKUIDBadge,d as ScrollContainerStyle,g as SelectedScreenHeader,u as StyledFooterForNonModal,m as VariantCardGridStyle,h as VariantCardListStyle};
@@ -10,3 +10,10 @@ export interface FooterForNonModalI {
10
10
  primaryButtonDisabled?: boolean;
11
11
  isLoading?: boolean;
12
12
  }
13
+ export declare enum ScreenName {
14
+ Collections = "collections",
15
+ RearrangeProducts = "rearrange",
16
+ SelectedProducts = "view",
17
+ SearchProducts = "searchProducts",
18
+ Products = "products"
19
+ }
@@ -1 +1 @@
1
- var L;!function(L){L.HIDE="HIDE",L.NORMAL="NORMAL",L.BLUR="BLUR"}(L||(L={}));export{L as OUT_OF_STOCK_ACTION};
1
+ var r,c;!function(r){r.HIDE="HIDE",r.NORMAL="NORMAL",r.BLUR="BLUR"}(r||(r={})),function(r){r.Collections="collections",r.RearrangeProducts="rearrange",r.SelectedProducts="view",r.SearchProducts="searchProducts",r.Products="products"}(c||(c={}));export{r as OUT_OF_STOCK_ACTION,c as ScreenName};
@@ -1 +1 @@
1
- import{jsx as t,jsxs as e}from"react/jsx-runtime";import i from"../../assets/icons/delete.svg.js";import r from"../../assets/icons/drag_handle.svg.js";import{COLORS as o}from"../../constants/Theme.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{TitleSmall as c,BodyCaption as l}from"../TypographyStyle.js";import{CurrencySymbols as s}from"./constants.js";import{ProductHelper as d}from"./helpers/ProductHelper.js";import{ProductPickerTag as m}from"./ProductPickerTag.js";import{VariantCardListStyle as h,ProductInfo as p,ProductSubTitle as g,SKUIDBadge as u,EllipsedBodyTiny as j,VariantCardGridStyle as b}from"./style.js";import{Tooltip as f}from"../tooltips/Tooltip.js";const v=b=>{var v,y,I;const{data:O,selectedCollectionsDispatch:T,outOfStockAction:P}=b,k=()=>{let t;return t=O.name.includes(O.productName)?O.name:`${O.productName} ${O.name}`,t},{dataForProductPickerTag:x,tagText:w,tagType:D}=d.getDataForProductPickerTag(O,!0,P),N=`${O.currency&&null!==(v=s[O.currency])&&void 0!==v?v:""}${null!==(I=null!==(y=O.price)&&void 0!==y?y:O.actualPrice)&&void 0!==I?I:""}`,S=O.skuId;return t(h,{children:e("div",Object.assign({className:"text-container"},{children:[t(r,{width:24,height:24,color:o.content.placeholder}),t("div",{children:t(n,{width:40,height:40,imageUrl:O.image,alt:"Item",borderRadius:4},O.variantId)}),e("div",Object.assign({className:"info-container"},{children:[e("div",Object.assign({className:"tooltip-title-tag"},{children:[t(f,Object.assign({body:k(),placement:"bottom",delay:400,variant:"light"},{children:t(c,Object.assign({numberOfLines:1,style:{flex:1,minWidth:0}},{children:k()}))})),e(p,{children:[t(m,{isVariant:!0,data:x,tagText:w,tagType:D}),t(a,{Icon:()=>t(i,{width:24,height:24,color:o.content.placeholder}),onClick:()=>{T&&T({type:"variantUnselected",data:{productId:O.productId,variantId:O.variantId,collectionId:O.collectionId}}),b.onDelete&&b.onDelete()}})]})]})),e(g,{children:[t(l,Object.assign({color:o.content.secondary},{children:!(null==x?void 0:x.fbStatus)||w?null:N})),S&&t(f,Object.assign({body:S,placement:"top"},{children:t(u,{children:t(j,{children:`SKU ID: ${S}`})})}))]})]}))]}))})},y=e=>{const{data:i}=e;return t(b,{children:t(f,Object.assign({body:i.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:t(n,{width:72,height:72,imageUrl:i.image,alt:"Item",borderRadius:4})}))})};export{y as VariantCardGridView,v as VariantCardListView};
1
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import i from"../../assets/icons/delete.svg.js";import r from"../../assets/icons/drag_handle.svg.js";import{Tooltip as o}from"../tooltips/Tooltip.js";import{COLORS as a}from"../../constants/Theme.js";import{IconButton as n}from"../icon-button/IconButton.js";import{ShimmerImage as c}from"../shimmer-image/ShimmerImage.js";import{TitleSmall as l,BodyCaption as s}from"../TypographyStyle.js";import{CurrencySymbols as d}from"./constants.js";import{ProductHelper as m}from"./helpers/ProductHelper.js";import{ProductPickerTag as h}from"./ProductPickerTag.js";import{VariantCardListStyle as p,ProductInfo as g,ProductSubTitle as u,SKUIDBadge as j,EllipsedBodyTiny as b,VariantCardGridStyle as f}from"./style.js";const v=f=>{var v,y,I;const{data:O,selectedCollectionsDispatch:T,outOfStockAction:P}=f,k=()=>{let t;return t=O.name.includes(O.productName)?O.name:`${O.productName} ${O.name}`,t},{dataForProductPickerTag:x,tagText:w,tagType:D}=m.getDataForProductPickerTag(O,!0,P),N=`${O.currency&&null!==(v=d[O.currency])&&void 0!==v?v:""}${null!==(I=null!==(y=O.price)&&void 0!==y?y:O.actualPrice)&&void 0!==I?I:""}`,S=O.skuId;return t(p,{children:e("div",Object.assign({className:"text-container"},{children:[t(r,{width:24,height:24,color:a.content.placeholder}),t("div",{children:t(c,{width:40,height:40,imageUrl:O.image,alt:"Item",borderRadius:4},O.variantId)}),e("div",Object.assign({className:"info-container"},{children:[e("div",Object.assign({className:"tooltip-title-tag"},{children:[t(o,Object.assign({body:k(),placement:"bottom",delay:400,variant:"light"},{children:t(l,Object.assign({numberOfLines:1,style:{flex:1,minWidth:0}},{children:k()}))})),e(g,{children:[t(h,{isVariant:!0,data:x,tagText:w,tagType:D}),t(n,{Icon:()=>t(i,{width:24,height:24,color:a.content.placeholder}),onClick:()=>{T&&T({type:"variantUnselected",data:{productId:O.productId,variantId:O.variantId,collectionId:O.collectionId}}),f.onDelete&&f.onDelete()}})]})]})),e(u,{children:[t(s,Object.assign({color:a.content.secondary},{children:!(null==x?void 0:x.fbStatus)||w?null:N})),S&&t(o,Object.assign({body:S,placement:"top"},{children:t(j,{children:t(b,{children:`SKU ID: ${S}`})})}))]})]}))]}))})},y=e=>{const{data:i}=e;return t(f,{children:t(o,Object.assign({body:i.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:t(c,{width:72,height:72,imageUrl:i.image,alt:"Item",borderRadius:4})}))})};export{y as VariantCardGridView,v as VariantCardListView};
@@ -1 +1 @@
1
- import{jsxs as e,Fragment as r,jsx as t}from"react/jsx-runtime";import{useState as i}from"react";import{CheckBox as a}from"../../checkBox/CheckBox.js";import{TitleSmall as n}from"../../TypographyStyle.js";import{Input as s}from"../../input/Input.js";const c=c=>{const{backTrackMessage:o,setBackTrackMessage:l}=c,[p,m]=i(!!o);return e(r,{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8,width:"300px",padding:"20px 0px"}},{children:[t(a,{isChecked:p,onValueChange:()=>{p&&l&&l(""),m(!p)}}),t(n,Object.assign({style:{marginLeft:8}},{children:"Prevent BackTracking"}))]})),p&&t("div",Object.assign({style:{margin:10}},{children:t(s,{type:"multiline",placeholder:"Enter your text here",labelText:"Message if user tries backtracking",onChangeText:e=>{l&&l(e)},height:"120px",maxCharLimit:1024,value:o,noErrorHint:!0,validate:e=>[!0,""]})}))]})};export{c as BackTrackComponent};
1
+ import{jsxs as e,Fragment as r,jsx as t}from"react/jsx-runtime";import{useState as i}from"react";import{CheckBox as a}from"../../checkBox/CheckBox.js";import{Input as n}from"../../input/Input.js";import{TitleSmall as s}from"../../TypographyStyle.js";const c=c=>{const{backTrackMessage:o,setBackTrackMessage:l}=c,[p,m]=i(!!o);return e(r,{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8,width:"300px",padding:"20px 0px"}},{children:[t(a,{isChecked:p,onValueChange:()=>{p&&l&&l(""),m(!p)}}),t(s,Object.assign({style:{marginLeft:8}},{children:"Prevent BackTracking"}))]})),p&&t("div",Object.assign({style:{margin:10}},{children:t(n,{type:"multiline",placeholder:"Enter your text here",labelText:"Message if user tries backtracking",onChangeText:e=>{l&&l(e)},height:"120px",maxCharLimit:1024,value:o,noErrorHint:!0,validate:e=>[!0,""]})}))]})};export{c as BackTrackComponent};
@@ -1 +1 @@
1
- import{jsxs as e,Fragment as r,jsx as o}from"react/jsx-runtime";import t from"../../../assets/icons/PlusIcon.js";import{useState as i,useRef as a,useEffect as n}from"react";import{CheckBox as s}from"../../checkBox/CheckBox.js";import{TitleSmall as c}from"../../TypographyStyle.js";import{useTemplateModalContext as l}from"../context/templateModalContext.js";import{AddVariableStyled as d}from"./VariableConnectorsPanel.js";import{Input as m}from"../../input/Input.js";const u=u=>{const{discountCode:h,setDiscountCode:p}=u,[g,f]=i(""),[j,b]=i(!!h),[v,C]=i(!1),{setVariableCallback:x,setShowVariablePicker:y}=l(),V=a(),k=a();n((()=>{p&&g&&p(h+g)}),[g]);const O=e=>{f(e.actualValue)};return e(r,{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[o(s,{isChecked:j,onValueChange:()=>{j&&p&&(p(""),f("")),b(!j)}}),o(c,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),j&&e("div",Object.assign({ref:V,style:{margin:10}},{children:[o(m,{placeholder:"Enter your discount code",onChangeText:e=>{p&&p(e)},value:h,onFocus:()=>{C(!0)},onBlur:e=>{var r;"addVar"===(null===(r=e.relatedTarget)||void 0===r?void 0:r.id)?(V.current&&V.current.focus(),C(!0)):C(!1)},noErrorHint:!0,validate:e=>[!0,""]}),v&&o(d,Object.assign({ref:k,id:"addVar",onClick:e=>{e.stopPropagation(),x((()=>O)),y(!0)}},{children:e("div",Object.assign({className:"add"},{children:[o(t,{width:14,height:14,color:"white"}),o("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]}))]})};export{u as DiscountCodeComponent};
1
+ import{jsxs as e,Fragment as r,jsx as o}from"react/jsx-runtime";import t from"../../../assets/icons/PlusIcon.js";import{useState as i,useRef as a,useEffect as n}from"react";import{CheckBox as s}from"../../checkBox/CheckBox.js";import{Input as c}from"../../input/Input.js";import{TitleSmall as l}from"../../TypographyStyle.js";import{useTemplateModalContext as d}from"../context/templateModalContext.js";import{AddVariableStyled as m}from"./VariableConnectorsPanel.js";const u=u=>{const{discountCode:h,setDiscountCode:p}=u,[g,f]=i(""),[j,b]=i(!!h),[v,C]=i(!1),{setVariableCallback:x,setShowVariablePicker:y}=d(),V=a(),k=a();n((()=>{p&&g&&p(h+g)}),[g]);const O=e=>{f(e.actualValue)};return e(r,{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[o(s,{isChecked:j,onValueChange:()=>{j&&p&&(p(""),f("")),b(!j)}}),o(l,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),j&&e("div",Object.assign({ref:V,style:{margin:10}},{children:[o(c,{placeholder:"Enter your discount code",onChangeText:e=>{p&&p(e)},value:h,onFocus:()=>{C(!0)},onBlur:e=>{var r;"addVar"===(null===(r=e.relatedTarget)||void 0===r?void 0:r.id)?(V.current&&V.current.focus(),C(!0)):C(!1)},noErrorHint:!0,validate:e=>[!0,""]}),v&&o(m,Object.assign({ref:k,id:"addVar",onClick:e=>{e.stopPropagation(),x((()=>O)),y(!0)}},{children:e("div",Object.assign({className:"add"},{children:[o(t,{width:14,height:14,color:"white"}),o("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]}))]})};export{u as DiscountCodeComponent};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{cloneDeep as a}from"lodash";import{useState as n,useEffect as o,useMemo as l,useRef as r}from"react";import{HEADER_TYPES as s}from"../../template-preview/models/TemplateMeta.js";import{useTemplateModalContext as d}from"../context/templateModalContext.js";import p from"../helpers/WebpushTemplateHelper.js";import{getAllDataFromWebpushTemplateComponent as m}from"../utils/getDataFromTemplateComponent.js";import u from"./EditMediaModal.js";import c from"./EditMediaV2.js";import{EditTemplateMediaContainer as h}from"./EditMediaV2.style.js";import{useEditWhatsappTemplateMedia as b}from"./useEditWhtasappTemplateMedia.js";import{Container as g}from"./VariableConnectorsPanel.js";import f from"./VariableConnectorWhatsApp.js";import M from"./VariableEditorHeader.js";import v from"./WhatsAppTemplateCardButtonV2.js";import{CHANNEL_TYPE as C}from"../../template-preview/models/Channels.js";import{Input as T}from"../../input/Input.js";const E=E=>{let{template:j,onTemplateChange:V,whatsappSpecificPickerMeta:x,showVariableModal:L}=E;var y,w,I;const[O,k]=n(null),[B,R]=n(null),{variableList:A,disableEditVariable:U,originalVariableList:W,setOriginalVariableList:F}=d(),{processWebpushTemplate:H,isValidUrl:D}=p(),[P,S]=n(null),[G,N]=n(null),[$,K]=n(null);o((()=>{A&&H(j,A,W,U).then((e=>{let{templateVariableMapping:t,template:i,webpushBroadcastConfig:a}=e;k(t),null==F||F(t),null==V||V(Object.assign({},i)),R(a)}))}),[A,U]);const{descriptionComponents:q,bodyVariables:z,titleVariables:J}=l((()=>{if(O&&B){const e=m(B,O);return P||S(e.iconImage),G||N(e.bannerImage),$||K(e.redirectionLink),{descriptionComponents:e.descriptionComponents,bodyVariables:e.bodyVariables,titleVariables:e.titleVariables}}return{descriptionComponents:[],bodyVariables:[],titleVariables:[],iconImage:null,bannerImage:null}}),[O,B]),{uploadMediaLink:Q,uploadMediaFiles:X,validateMimeType:Y}=x,Z=r(null),_=b({uploadMediaLink:Q,uploadMediaFiles:X,updateTemplateImageUrl:e=>te(e,"icon"),validateMimeType:Y,mediaComponent:P,fileRef:Z}),ee=b({uploadMediaLink:Q,uploadMediaFiles:X,updateTemplateImageUrl:e=>te(e,"image"),validateMimeType:Y,mediaComponent:G,fileRef:Z});function te(e,t){const i=Object.assign({},j),n=a(i);"icon"===t?(n.webpushBroadcastConfig.icon=[e],S([e])):"image"===t&&(n.webpushBroadcastConfig.image=[e],N([e])),null==V||V(Object.assign({},n))}function ie(e,t,i){var n;const o=Object.assign({},j),l=a(o),r="custom"===t&&"string"==typeof e,s=null===(n=null==l?void 0:l.webpushBroadcastConfig)||void 0===n?void 0:n.buttons;if(s&&s.length>0){s[i]=r?e:"string"!=typeof e?e.placeHolder:"";const t=Object.assign(Object.assign({},l.webpushBroadcastConfig),{buttons:s});l.webpushBroadcastConfig=t}null==V||V(l)}const ae=_.openEditMedia?_:ee.openEditMedia?ee:null;if(ae)return e(g,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e(u,{mediaComponentFormat:s.IMAGE,uploadMedia:ae.uploadMedia,variableListForImage:[],useEditWhatsappTemplateMediaResponse:ae,setOpenEditMedia:ae.setOpenEditMedia,openEditMedia:ae.openEditMedia,editIconRef:ae.editIconRef,fileRef:Z,skipAddVariable:!0})}));return t(g,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:"auto"}},{children:[P&&P.length?e(h,{children:e(c,{imageName:P,handleImageChange:_.handleImageChange,mediaType:s.IMAGE,error:_.error,isLoading:_.loading,setOpenEditMedia:_.setOpenEditMedia})}):null,G&&G.length?e(h,{children:e(c,{imageName:G,handleImageChange:ee.handleImageChange,mediaType:s.IMAGE,error:ee.error,isLoading:ee.loading,setOpenEditMedia:ee.setOpenEditMedia})}):null,(null==z?void 0:z.length)||(null==J?void 0:J.length)?e(M,{containerStyle:{paddingTop:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}):null,null==q?void 0:q.map(((t,i)=>e(f,{originalVariableList:O,originalList:W,channel:C.WEBPUSH,type:t.type,descriptionComponent:t.component,showVariableModal:L},i))),$&&$.length?e("div",Object.assign({style:{padding:"16px 14px"}},{children:e(T,{labelText:"Redirection Link",id:"redirection-link",value:$[0].replace("https://",""),errorMessage:D($[0])?"":"Please enter a valid URL",maxCharLimit:2e3,noKeyDownChange:!0,state:U?"disabled":"none",prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:e=>{!function(e){var t;const i=`https://${e}`;K([i]);const n=a(j);(null===(t=n.webpushBroadcastConfig)||void 0===t?void 0:t.redirectionLink)&&(n.webpushBroadcastConfig.redirectionLink=[i]),null==V||V(Object.assign({},n))}(e)}})})):e(i,{}),(null===(w=null===(y=null==O?void 0:O.buttons)||void 0===y?void 0:y.filter((e=>"URL"===e.type)))||void 0===w?void 0:w.length)>0&&e(M,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(I=null==O?void 0:O.buttons)||void 0===I?void 0:I.map(((t,i)=>e(v,{variableListIndex:i,CTAoptions:null==x?void 0:x.CTAoptions,button:t,currentVariableList:O,updateSelectedURLTemplateBtn:ie},`${i}`)))]}))};export{E as default};
1
+ import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{cloneDeep as a}from"lodash";import{useState as n,useEffect as o,useMemo as l,useRef as r}from"react";import{Input as s}from"../../input/Input.js";import{CHANNEL_TYPE as d}from"../../template-preview/models/Channels.js";import{HEADER_TYPES as p}from"../../template-preview/models/TemplateMeta.js";import{useTemplateModalContext as m}from"../context/templateModalContext.js";import u from"../helpers/WebpushTemplateHelper.js";import{getAllDataFromWebpushTemplateComponent as c}from"../utils/getDataFromTemplateComponent.js";import h from"./EditMediaModal.js";import b from"./EditMediaV2.js";import{EditTemplateMediaContainer as g}from"./EditMediaV2.style.js";import{useEditWhatsappTemplateMedia as f}from"./useEditWhtasappTemplateMedia.js";import{Container as M}from"./VariableConnectorsPanel.js";import v from"./VariableConnectorWhatsApp.js";import C from"./VariableEditorHeader.js";import T from"./WhatsAppTemplateCardButtonV2.js";const E=E=>{let{template:j,onTemplateChange:V,whatsappSpecificPickerMeta:x,showVariableModal:L}=E;var y,w,I;const[O,k]=n(null),[B,R]=n(null),{variableList:A,disableEditVariable:U,originalVariableList:W,setOriginalVariableList:F}=m(),{processWebpushTemplate:H,isValidUrl:D}=u(),[P,S]=n(null),[G,N]=n(null),[$,K]=n(null);o((()=>{A&&H(j,A,W,U).then((e=>{let{templateVariableMapping:t,template:i,webpushBroadcastConfig:a}=e;k(t),null==F||F(t),null==V||V(Object.assign({},i)),R(a)}))}),[A,U]);const{descriptionComponents:q,bodyVariables:z,titleVariables:J}=l((()=>{if(O&&B){const e=c(B,O);return P||S(e.iconImage),G||N(e.bannerImage),$||K(e.redirectionLink),{descriptionComponents:e.descriptionComponents,bodyVariables:e.bodyVariables,titleVariables:e.titleVariables}}return{descriptionComponents:[],bodyVariables:[],titleVariables:[],iconImage:null,bannerImage:null}}),[O,B]),{uploadMediaLink:Q,uploadMediaFiles:X,validateMimeType:Y}=x,Z=r(null),_=f({uploadMediaLink:Q,uploadMediaFiles:X,updateTemplateImageUrl:e=>te(e,"icon"),validateMimeType:Y,mediaComponent:P,fileRef:Z}),ee=f({uploadMediaLink:Q,uploadMediaFiles:X,updateTemplateImageUrl:e=>te(e,"image"),validateMimeType:Y,mediaComponent:G,fileRef:Z});function te(e,t){const i=Object.assign({},j),n=a(i);"icon"===t?(n.webpushBroadcastConfig.icon=[e],S([e])):"image"===t&&(n.webpushBroadcastConfig.image=[e],N([e])),null==V||V(Object.assign({},n))}function ie(e,t,i){var n;const o=Object.assign({},j),l=a(o),r="custom"===t&&"string"==typeof e,s=null===(n=null==l?void 0:l.webpushBroadcastConfig)||void 0===n?void 0:n.buttons;if(s&&s.length>0){s[i]=r?e:"string"!=typeof e?e.placeHolder:"";const t=Object.assign(Object.assign({},l.webpushBroadcastConfig),{buttons:s});l.webpushBroadcastConfig=t}null==V||V(l)}const ae=_.openEditMedia?_:ee.openEditMedia?ee:null;if(ae)return e(M,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e(h,{mediaComponentFormat:p.IMAGE,uploadMedia:ae.uploadMedia,variableListForImage:[],useEditWhatsappTemplateMediaResponse:ae,setOpenEditMedia:ae.setOpenEditMedia,openEditMedia:ae.openEditMedia,editIconRef:ae.editIconRef,fileRef:Z,skipAddVariable:!0})}));return t(M,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:"auto"}},{children:[P&&P.length?e(g,{children:e(b,{imageName:P,handleImageChange:_.handleImageChange,mediaType:p.IMAGE,error:_.error,isLoading:_.loading,setOpenEditMedia:_.setOpenEditMedia})}):null,G&&G.length?e(g,{children:e(b,{imageName:G,handleImageChange:ee.handleImageChange,mediaType:p.IMAGE,error:ee.error,isLoading:ee.loading,setOpenEditMedia:ee.setOpenEditMedia})}):null,(null==z?void 0:z.length)||(null==J?void 0:J.length)?e(C,{containerStyle:{paddingTop:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}):null,null==q?void 0:q.map(((t,i)=>e(v,{originalVariableList:O,originalList:W,channel:d.WEBPUSH,type:t.type,descriptionComponent:t.component,showVariableModal:L},i))),$&&$.length?e("div",Object.assign({style:{padding:"16px 14px"}},{children:e(s,{labelText:"Redirection Link",id:"redirection-link",value:$[0].replace("https://",""),errorMessage:D($[0])?"":"Please enter a valid URL",maxCharLimit:2e3,noKeyDownChange:!0,state:U?"disabled":"none",prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:e=>{!function(e){var t;const i=`https://${e}`;K([i]);const n=a(j);(null===(t=n.webpushBroadcastConfig)||void 0===t?void 0:t.redirectionLink)&&(n.webpushBroadcastConfig.redirectionLink=[i]),null==V||V(Object.assign({},n))}(e)}})})):e(i,{}),(null===(w=null===(y=null==O?void 0:O.buttons)||void 0===y?void 0:y.filter((e=>"URL"===e.type)))||void 0===w?void 0:w.length)>0&&e(C,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(I=null==O?void 0:O.buttons)||void 0===I?void 0:I.map(((t,i)=>e(T,{variableListIndex:i,CTAoptions:null==x?void 0:x.CTAoptions,button:t,currentVariableList:O,updateSelectedURLTemplateBtn:ie},`${i}`)))]}))};export{E as default};