@bikdotai/bik-component-library 0.0.792-beta.5 → 0.0.792

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 (33) 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/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  7. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +1 -0
  8. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +5 -5
  9. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +1 -0
  10. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
  11. package/dist/cjs/components/dropdown/type.d.ts +2 -0
  12. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  13. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +0 -4
  14. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  15. package/dist/cjs/components/template-context-mapper/modalElements/Footer.js +2 -2
  16. package/dist/cjs/components/template-context-mapper/modalElements/modal.d.ts +0 -1
  17. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  18. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  19. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  20. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  21. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  22. package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  23. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +1 -0
  24. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +11 -11
  25. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +1 -0
  26. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
  27. package/dist/esm/components/dropdown/type.d.ts +2 -0
  28. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  29. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +0 -4
  30. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  31. package/dist/esm/components/template-context-mapper/modalElements/Footer.js +2 -2
  32. package/dist/esm/components/template-context-mapper/modalElements/modal.d.ts +0 -1
  33. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
3
3
  declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default EventsTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
3
3
  declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default IGTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
3
+ import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
4
+ import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
5
5
  declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
6
6
  cacheKey: string;
7
7
  propertyAddBtnText: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../assets/icons/errorInfo.svg.js"),n=require("../../../../assets/icons/refresh-purple.svg.js"),s=require("react"),r=require("../../../zeroState/ZeroState.js"),o=require("../../../../hooks/useOutside.js"),i=require("../../../../constants/Theme.js"),l=require("../../hooks/useDropdown.js"),u=require("./description/Description.js"),c=require("./menu/FreeFormMenu.js"),a=require("./menu/MenuList.js"),d=require("./menu/SelectAllMenu.js"),p=require("./multiSelect/MultiSelectDropdownBottomBar.js"),h=require("./OpennedDropdown.styled.js"),f=require("./searchbox/SearchBox.js"),g=require("./searchbox/SearchZeroState.js");const b=304,S=290;exports.OpenedDropdown=v=>{let{options:j,isSearchable:O,isMultiSelect:x,maxSelections:m,width:w,allowFreeForm:y,height:C,onClose:L,onSelect:k,onSearch:D,version:q,skipSorting:E,headerRef:M,hideSelectAll:R,primaryButtonText:I,onInfiniteScroll:T,onMultiSelectClear:A,onDropdownItemClick:B,buttonOptions:F,isSearchLoading:H,isOptionsLoading:Z,optionsErrorState:z,disableSearchOptions:P,disableSearchedOptionExcept:V,useDefaultCursor:W,containerStyle:$={},zeroState:_,isDraggable:K=!1,onOptionsReorder:N,hideClearButton:U=!1}=v;var G;const J=s.useCallback((e=>{if(!K||!x)return e;const t=[],n=[];return e.forEach((e=>{if(e.options)n.push(e);else{e.selected?t.push(e):n.push(e)}})),[...t,...n]}),[K,x]),[Q,X]=s.useState((()=>J(j))),Y=s.useRef(Q),ee=s.useRef(!1),te=s.useRef(N);s.useEffect((()=>{X(J(j))}),[j,J]),s.useEffect((()=>{Y.current=Q}),[Q]),s.useEffect((()=>{te.current=N}),[N]),s.useEffect((()=>()=>{ee.current&&te.current&&te.current(Y.current)}),[]);const ne=s.useCallback((e=>{X(e),"2.0"===q?null==N||N(e):ee.current=!0}),[N,q]),se=K?Q:j,{dropdownOptions:re,search:oe,searchedString:ie,searchedOptions:le,searchError:ue,retrySearch:ce,onApplyHandler:ae,selectAllHandler:de,onMultiSelectClear:pe,onFreeFormSelect:he,onMultiSelectApply:fe,latestDropdownOptionsRef:ge,getSelectedOptions:be,getCurrentSelectionCount:Se}=l.useDropdown(q,se,k,E||K,x,D,P,V,m),[ve,je]=s.useState(null!=w?w:S),[Oe,xe]=s.useState(null),[me,we]=s.useState(-1),ye=s.useRef(null),Ce=s.useRef([]),Le=s.useRef(null);o.useOutside(ye,(()=>{if(xe(null),x&&"2.0"===q){const e=be(ge.current);null==L||L(e)}else null==L||L(re)}),[M,Ce]),s.useEffect((()=>{const e=setTimeout((()=>{ye.current&&ye.current.focus({preventScroll:!0})}),0);return()=>clearTimeout(e)}),[]);s.useEffect((()=>{const e=e=>{const t=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const n=e;n.disabled||t.push(n)}})),t})(ie&&D?le:re);if(0!==t.length)if("ArrowDown"===e.key)e.preventDefault(),we((e=>{const n=e<t.length-1?e+1:0;return setTimeout((()=>{var e;const t=null===(e=Le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${n}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),n}));else if("ArrowUp"===e.key)e.preventDefault(),we((e=>{const n=e>0?e-1:t.length-1;return setTimeout((()=>{var e;const t=null===(e=Le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${n}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),n}));else if("Enter"===e.key&&me>=0){e.preventDefault();const n=t[me];n&&(ae(Object.assign(Object.assign({},n),{selected:!n.selected})),B&&B(n))}},t=ye.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[me,ie,le,re,D,ae,B]);const ke=null!=C?C:b,De="number"==typeof ke?O&&x?ke-96:O&&!x||!O&&x?ke-48:ke:ke;s.useEffect((()=>{const e=null!=w?w:S;if(null===Oe)je(e);else if("number"==typeof e)je(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));je(t)}}),[Oe]);const qe=[],Ee=(e=>{if(!x||!m&&0!==m)return e;const t=Se(re)>=m;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const n=e;return Object.assign(Object.assign({},n),{disabled:n.disabled||!n.selected&&t})}})):e})((ie&&D?le:re).map((e=>{var t,n;if(ie&&!D){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(ie.toLowerCase()))&&(qe.push(!ie||e.label===ie),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(ie.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(ie.toLowerCase()))?(qe.push(!ie||e.label===ie),e):null}return e})).filter((e=>null!==e))),Me=!!O&&ie&&0===Ee.length,Re=!ie&&!!Z,Ie=!ie&&!!z&&!Re,Te=!(ie||Ee.length||Re||Ie),Ae=Re||Ie||Te,Be=(null==_?void 0:_.title)||"No results found",Fe=(null==_?void 0:_.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance.",He=(null==z?void 0:z.title)||"Failed to load options",Ze=(null==z?void 0:z.subTitle)||"Something went wrong while fetching the list. Please try again",ze={buttonText:"Try again",buttonType:"text",size:"small",buttonTextColor:i.COLORS.background.inverseLight,customIconColor:i.COLORS.background.inverseLight,LeadingIcon:n.default},Pe=Object.assign({IconHolderStyle:{background:i.COLORS.background.negative.light},Icon:e.jsx(t.default,{color:i.COLORS.content.negative,width:24,height:24})},z);Pe.actionButton=Object.assign(Object.assign({},ze),null!==(G=null==z?void 0:z.actionButton)&&void 0!==G?G:{});const Ve=Re?void 0:Ie?Pe:_;return e.jsxs(h.OpennedDropdownContainer,Object.assign({version:q,ref:ye,tabIndex:-1,style:Object.assign(Object.assign({width:ve},$),{outline:"none"})},{children:[e.jsxs("div",Object.assign({style:{width:Oe?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!O&&e.jsx(f.SearchBox,{onSearch:oe,version:q}),Ae?e.jsx("div",Object.assign({style:{height:ke,display:"flex",background:i.COLORS.background.base}},{children:e.jsx(r.ZeroState,Object.assign({},null!=Ve?Ve:{},{isLoading:Re,title:Ie?He:Be,subTitle:Ie?Ze:Fe}))})):e.jsxs(h.MenuListContainer,Object.assign({minHeight:ke,maxHeight:De,ref:Le},{children:[!!x&&!Me&&!R&&e.jsx(d.SelectAllMenu,{version:q,options:ie&&D?le:re,onSelect:de}),!y&&Me&&e.jsx(g.SearchZeroState,{isLoading:H,errorMessage:ue,onRetry:ce,height:De,searchedString:ie,containerWidth:w}),y&&(Me||!!qe.length&&qe.every((e=>!1===e)))&&e.jsx(c.FreeFormMenu,{version:q,isMultiSelect:x,onSelect:he,searchedString:ie}),e.jsx(a.MenuList,{onInfiniteScroll:T,onDropdownItemClick:B,version:q,onSelect:ae,showDescription:function(e,t){xe(e&&t?{title:e,description:t}:null)},isMultiSelect:x,options:Ee,useDefaultCursor:W,ref:Ce,focusedIndex:me,isDraggable:K,onOptionsReorder:ne})]})),!!x&&!Ae&&"2.0"!==q&&e.jsx(p.default,{onClear:()=>{pe(),null==A||A()},onApply:fe,list:ie&&D?le:re,buttonText:I,buttonOptions:F,hideClearButton:U})]})),!!Oe&&e.jsx(u.Description,{title:Oe.title,description:Oe.description,version:q})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../assets/icons/errorInfo.svg.js"),n=require("../../../../assets/icons/refresh-purple.svg.js"),o=require("react"),s=require("../../../zeroState/ZeroState.js"),r=require("../../../../hooks/useOutside.js"),i=require("../../../../constants/Theme.js"),l=require("../../hooks/useDropdown.js"),u=require("./description/Description.js"),c=require("./menu/FreeFormMenu.js"),a=require("./menu/MenuList.js"),d=require("./menu/SelectAllMenu.js"),p=require("./multiSelect/MultiSelectDropdownBottomBar.js"),h=require("./OpennedDropdown.styled.js"),f=require("./searchbox/SearchBox.js"),g=require("./searchbox/SearchZeroState.js");const b=304,S=290;exports.OpenedDropdown=v=>{let{options:j,isSearchable:O,isMultiSelect:x,maxSelections:m,width:w,allowFreeForm:C,height:y,onClose:k,onSelect:L,onSearch:D,version:q,skipSorting:E,headerRef:M,hideSelectAll:R,primaryButtonText:I,onInfiniteScroll:T,onMultiSelectClear:F,onDropdownItemClick:A,buttonOptions:B,isSearchLoading:H,isOptionsLoading:Z,optionsErrorState:z,disableSearchOptions:P,disableSearchedOptionExcept:V,useDefaultCursor:W,containerStyle:$={},zeroState:_,isDraggable:K=!1,onOptionsReorder:N,hideClearButton:U=!1,showCheckboxForCustomElement:G=!1}=v;var J;const Q=o.useCallback((e=>{if(!K||!x)return e;const t=[],n=[];return e.forEach((e=>{if(e.options)n.push(e);else{e.selected?t.push(e):n.push(e)}})),[...t,...n]}),[K,x]),[X,Y]=o.useState((()=>Q(j))),ee=o.useRef(X),te=o.useRef(!1),ne=o.useRef(N);o.useEffect((()=>{Y(Q(j))}),[j,Q]),o.useEffect((()=>{ee.current=X}),[X]),o.useEffect((()=>{ne.current=N}),[N]),o.useEffect((()=>()=>{te.current&&ne.current&&ne.current(ee.current)}),[]);const oe=o.useCallback((e=>{Y(e),"2.0"===q?null==N||N(e):te.current=!0}),[N,q]),se=K?X:j,{dropdownOptions:re,search:ie,searchedString:le,searchedOptions:ue,searchError:ce,retrySearch:ae,onApplyHandler:de,selectAllHandler:pe,onMultiSelectClear:he,onFreeFormSelect:fe,onMultiSelectApply:ge,latestDropdownOptionsRef:be,getSelectedOptions:Se,getCurrentSelectionCount:ve}=l.useDropdown(q,se,L,E||K,x,D,P,V,m),[je,Oe]=o.useState(null!=w?w:S),[xe,me]=o.useState(null),[we,Ce]=o.useState(-1),ye=o.useRef(null),ke=o.useRef([]),Le=o.useRef(null);r.useOutside(ye,(()=>{if(me(null),x&&"2.0"===q){const e=Se(be.current);null==k||k(e)}else null==k||k(re)}),[M,ke]),o.useEffect((()=>{const e=setTimeout((()=>{ye.current&&ye.current.focus({preventScroll:!0})}),0);return()=>clearTimeout(e)}),[]);o.useEffect((()=>{const e=e=>{const t=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const n=e;n.disabled||t.push(n)}})),t})(le&&D?ue:re);if(0!==t.length)if("ArrowDown"===e.key)e.preventDefault(),Ce((e=>{const n=e<t.length-1?e+1:0;return setTimeout((()=>{var e;const t=null===(e=Le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${n}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),n}));else if("ArrowUp"===e.key)e.preventDefault(),Ce((e=>{const n=e>0?e-1:t.length-1;return setTimeout((()=>{var e;const t=null===(e=Le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${n}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),n}));else if("Enter"===e.key&&we>=0){e.preventDefault();const n=t[we];n&&(de(Object.assign(Object.assign({},n),{selected:!n.selected})),A&&A(n))}},t=ye.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[we,le,ue,re,D,de,A]);const De=null!=y?y:b,qe="number"==typeof De?O&&x?De-96:O&&!x||!O&&x?De-48:De:De;o.useEffect((()=>{const e=null!=w?w:S;if(null===xe)Oe(e);else if("number"==typeof e)Oe(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));Oe(t)}}),[xe]);const Ee=[],Me=(e=>{if(!x||!m&&0!==m)return e;const t=ve(re)>=m;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const n=e;return Object.assign(Object.assign({},n),{disabled:n.disabled||!n.selected&&t})}})):e})((le&&D?ue:re).map((e=>{var t,n;if(le&&!D){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(le.toLowerCase()))&&(Ee.push(!le||e.label===le),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(le.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(le.toLowerCase()))?(Ee.push(!le||e.label===le),e):null}return e})).filter((e=>null!==e))),Re=!!O&&le&&0===Me.length,Ie=!le&&!!Z,Te=!le&&!!z&&!Ie,Fe=!(le||Me.length||Ie||Te),Ae=Ie||Te||Fe,Be=(null==_?void 0:_.title)||"No results found",He=(null==_?void 0:_.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance.",Ze=(null==z?void 0:z.title)||"Failed to load options",ze=(null==z?void 0:z.subTitle)||"Something went wrong while fetching the list. Please try again",Pe={buttonText:"Try again",buttonType:"text",size:"small",buttonTextColor:i.COLORS.background.inverseLight,customIconColor:i.COLORS.background.inverseLight,LeadingIcon:n.default},Ve=Object.assign({IconHolderStyle:{background:i.COLORS.background.negative.light},Icon:e.jsx(t.default,{color:i.COLORS.content.negative,width:24,height:24})},z);Ve.actionButton=Object.assign(Object.assign({},Pe),null!==(J=null==z?void 0:z.actionButton)&&void 0!==J?J:{});const We=Ie?void 0:Te?Ve:_;return e.jsxs(h.OpennedDropdownContainer,Object.assign({version:q,ref:ye,tabIndex:-1,style:Object.assign(Object.assign({width:je},$),{outline:"none"})},{children:[e.jsxs("div",Object.assign({style:{width:xe?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!O&&e.jsx(f.SearchBox,{onSearch:ie,version:q}),Ae?e.jsx("div",Object.assign({style:{height:De,display:"flex",background:i.COLORS.background.base}},{children:e.jsx(s.ZeroState,Object.assign({},null!=We?We:{},{isLoading:Ie,title:Te?Ze:Be,subTitle:Te?ze:He}))})):e.jsxs(h.MenuListContainer,Object.assign({minHeight:De,maxHeight:qe,ref:Le},{children:[!!x&&!Re&&!R&&e.jsx(d.SelectAllMenu,{version:q,options:le&&D?ue:re,onSelect:pe}),!C&&Re&&e.jsx(g.SearchZeroState,{isLoading:H,errorMessage:ce,onRetry:ae,height:qe,searchedString:le,containerWidth:w}),C&&(Re||!!Ee.length&&Ee.every((e=>!1===e)))&&e.jsx(c.FreeFormMenu,{version:q,isMultiSelect:x,onSelect:fe,searchedString:le}),e.jsx(a.MenuList,{onInfiniteScroll:T,onDropdownItemClick:A,version:q,onSelect:de,showDescription:function(e,t){me(e&&t?{title:e,description:t}:null)},isMultiSelect:x,options:Me,useDefaultCursor:W,ref:ke,focusedIndex:we,isDraggable:K,onOptionsReorder:oe,showCheckboxForCustomElement:G})]})),!!x&&!Ae&&"2.0"!==q&&e.jsx(p.default,{onClear:()=>{he(),null==F||F()},onApply:ge,list:le&&D?ue:re,buttonText:I,buttonOptions:B,hideClearButton:U})]})),!!xe&&e.jsx(u.Description,{title:xe.title,description:xe.description,version:q})]}))};
@@ -17,6 +17,7 @@ interface MenuItemProps {
17
17
  onDrop?: (e: React.DragEvent<HTMLDivElement>) => void;
18
18
  onDragEnd?: (e: React.DragEvent<HTMLDivElement>) => void;
19
19
  isDraggedOver?: boolean;
20
+ showCheckboxForCustomElement?: boolean;
20
21
  }
21
22
  export declare const MenuItem: import("react").ForwardRefExoticComponent<MenuItemProps & import("react").RefAttributes<HTMLDivElement>>;
22
23
  export {};
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../../assets/icons/chevronRight.svg.js"),n=require("react"),r=require("styled-components"),i=require("../../../../checkBox/CheckBox.js"),o=require("../../../../list-item/ListItem.js"),s=require("../../../../tooltips/Tooltip.js"),a=require("../../../../TypographyStyle.js"),l=require("../../../../../constants/Theme.js"),d=require("./FreeFormMenu.styled.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(r);const g=u.default(o.ListItem)`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../../assets/icons/chevronRight.svg.js"),n=require("react"),r=require("styled-components"),o=require("../../../../checkBox/CheckBox.js"),i=require("../../../../list-item/ListItem.js"),s=require("../../../../tooltips/Tooltip.js"),a=require("../../../../TypographyStyle.js"),l=require("../../../../../constants/Theme.js"),d=require("./FreeFormMenu.styled.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(r);const g=u.default(i.ListItem)`
2
2
  padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
3
3
  cursor: pointer;
4
4
  margin-top: ${e=>"2.0"===e.version?"2px":"0"};
@@ -22,7 +22,7 @@
22
22
  align-self: center;
23
23
  height: fit-content;
24
24
  min-height: 18px;
25
- `,v=u.default.div`
25
+ `,h=u.default.div`
26
26
  width: 2.86px;
27
27
  height: 2.86px;
28
28
  border-radius: 50%;
@@ -33,11 +33,11 @@
33
33
  align-content: center;
34
34
  justify-content: center;
35
35
  gap: 8px;
36
- `,h=u.default.div`
36
+ `,m=u.default.div`
37
37
  margin-right: -4px;
38
- `,b=u.default.div`
38
+ `,v=u.default.div`
39
39
  display: flex;
40
40
  align-items: center;
41
41
  flex-direction: column;
42
42
  flex: 1;
43
- `,m=t=>{let{onDragStart:n,onDragEnd:r}=t;return e.jsxs(x,Object.assign({draggable:!0,onDragStart:n,onDragEnd:r},{children:[e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{})]}))},f=n.forwardRef(((r,o)=>{let{option:c,isMultiSelect:u,showDescription:x,onSelect:v,last:f,version:O,onDropdownItemClick:D,useDefaultCursor:y,isFocused:C=!1,dataIndex:I=-1,isDraggable:F=!1,onDragStart:T,onDragOver:S,onDrop:E,onDragEnd:k,isDraggedOver:w=!1}=r;var L;const[q,M]=n.useState(c.selected),$=(e,t)=>{if(!e.children){B(!e.selected);const n=t?Object.assign(Object.assign({},e),{parent:t}):e;null==D||D(n)}},B=e=>{c.disabled||v(Object.assign(Object.assign({},c),{selected:e}))},R=y?{cursor:"default"}:{};return e.jsx(e.Fragment,{children:e.jsx(s.Tooltip,Object.assign({body:"",tooltipContent:c.children?e.jsx("div",Object.assign({style:{backgroundColor:l.DEFAULT_THEME.colorsV2.surface.standard},ref:o,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1)},{children:e.jsx(p,Object.assign({version:null!=O?O:"2.0"},{children:c.children.map((t=>{var n;return e.jsx(g,{version:O,style:"1.0"!==O&&(null!==(n=null==c?void 0:c.children)&&void 0!==n?n:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),$(t,c)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:c.disabled?"inactive":t.selected?"selected":"default"},t.value)}))}))})):e.jsx(e.Fragment,{}),placement:"right-start",hideArrow:!0},{children:e.jsx(g,{version:O,style:f?Object.assign(Object.assign({borderBottom:0},R),w?{borderTop:`2px solid ${l.COLORS.content.brand}`,opacity:.5}:{}):Object.assign(Object.assign({},R),w?{borderTop:`2px solid ${l.COLORS.content.brand}`,opacity:.5}:{}),onClick:e=>{e.preventDefault(),$(c)},onMouseOver:()=>{c.description?x(c.label,c.description):x()},listItem:{value:c.value,label:c.label},subText:c.subText,"data-option-index":I,role:"option",id:`dropdown-option-${I}`,"aria-selected":!!c.selected,onDragOver:F?S:void 0,onDrop:F?E:void 0,leadingIcon:u?e.jsxs(j,{children:[F&&e.jsx(m,{onDragStart:T,onDragEnd:k}),e.jsx(i.CheckBox,{size:"2.0"===O?"SMALL":"DEFAULT",isDisabled:null!==(L=c.disabled)&&void 0!==L&&L,isChecked:!!c.selected,onValueChange:B}),e.jsx(h,{children:c.leadingIcon})]}):F?e.jsxs(b,{children:[e.jsx(m,{onDragStart:T,onDragEnd:k}),c.leadingIcon&&e.jsx("div",{children:c.leadingIcon})]}):c.leadingIcon?e.jsx(e.Fragment,{children:c.leadingIcon}):void 0,customComponent:c.customComponent,trailingIcon:c.isFreeForm?e.jsx(d.FreeFormContainer,{children:e.jsx(a.BodyCaption,Object.assign({style:{color:l.COLORS.content.secondary}},{children:"Freeform"}))}):c.children?e.jsx(t.default,{width:12,height:12}):c.trailingIcon?e.jsx(e.Fragment,{children:c.trailingIcon}):void 0,variant:c.disabled?"inactive":C||c.selected||!u&&q?"selected":"default"})}))})}));exports.MenuItem=f;
43
+ `,b=t=>{let{onDragStart:n,onDragEnd:r}=t;return e.jsxs(x,Object.assign({draggable:!0,onDragStart:n,onDragEnd:r},{children:[e.jsx(h,{}),e.jsx(h,{}),e.jsx(h,{}),e.jsx(h,{}),e.jsx(h,{}),e.jsx(h,{})]}))},f=n.forwardRef(((r,i)=>{let{option:c,isMultiSelect:u,showDescription:x,onSelect:h,last:f,version:D,onDropdownItemClick:C,useDefaultCursor:O,isFocused:y=!1,dataIndex:I=-1,isDraggable:F=!1,onDragStart:E,onDragOver:S,onDrop:T,onDragEnd:k,isDraggedOver:L=!1,showCheckboxForCustomElement:w=!1}=r;var M,q;const[$,A]=n.useState(c.selected),B=(e,t)=>{if(!e.children){R(!e.selected);const n=t?Object.assign(Object.assign({},e),{parent:t}):e;null==C||C(n)}},R=e=>{c.disabled||h(Object.assign(Object.assign({},c),{selected:e}))},U=O?{cursor:"default"}:{};return e.jsx(e.Fragment,{children:e.jsx(s.Tooltip,Object.assign({body:"",tooltipContent:c.children?e.jsx("div",Object.assign({style:{backgroundColor:l.DEFAULT_THEME.colorsV2.surface.standard},ref:i,onMouseEnter:()=>A(!0),onMouseLeave:()=>A(!1)},{children:e.jsx(p,Object.assign({version:null!=D?D:"2.0"},{children:c.children.map((t=>{var n;return e.jsx(g,{version:D,style:"1.0"!==D&&(null!==(n=null==c?void 0:c.children)&&void 0!==n?n:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),B(t,c)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:c.disabled?"inactive":t.selected?"selected":"default"},t.value)}))}))})):e.jsx(e.Fragment,{}),placement:"right-start",hideArrow:!0},{children:e.jsx(g,{version:D,style:f?Object.assign(Object.assign({borderBottom:0},U),L?{borderTop:`2px solid ${l.COLORS.content.brand}`,opacity:.5}:{}):Object.assign(Object.assign({},U),L?{borderTop:`2px solid ${l.COLORS.content.brand}`,opacity:.5}:{}),onClick:e=>{e.preventDefault(),B(c)},onMouseOver:()=>{c.description?x(c.label,c.description):x()},listItem:{value:c.value,label:c.label},subText:c.subText,"data-option-index":I,role:"option",id:`dropdown-option-${I}`,"aria-selected":!!c.selected,onDragOver:F?S:void 0,onDrop:F?T:void 0,leadingIcon:!u||w&&c.customComponent?F?e.jsxs(v,{children:[e.jsx(b,{onDragStart:E,onDragEnd:k}),c.leadingIcon&&e.jsx("div",{children:c.leadingIcon})]}):c.leadingIcon?e.jsx(e.Fragment,{children:c.leadingIcon}):void 0:e.jsxs(j,{children:[F&&e.jsx(b,{onDragStart:E,onDragEnd:k}),e.jsx(o.CheckBox,{size:"2.0"===D?"SMALL":"DEFAULT",isDisabled:null!==(M=c.disabled)&&void 0!==M&&M,isChecked:!!c.selected,onValueChange:R}),e.jsx(m,{children:c.leadingIcon})]}),customComponent:u&&w&&c.customComponent?e.jsxs(j,{children:[F&&e.jsx(b,{onDragStart:E,onDragEnd:k}),e.jsx(o.CheckBox,{size:"2.0"===D?"SMALL":"DEFAULT",isDisabled:null!==(q=c.disabled)&&void 0!==q&&q,isChecked:!!c.selected,onValueChange:R}),c.customComponent]}):c.customComponent,trailingIcon:c.isFreeForm?e.jsx(d.FreeFormContainer,{children:e.jsx(a.BodyCaption,Object.assign({style:{color:l.COLORS.content.secondary}},{children:"Freeform"}))}):c.children?e.jsx(t.default,{width:12,height:12}):c.trailingIcon?e.jsx(e.Fragment,{children:c.trailingIcon}):void 0,variant:c.disabled?"inactive":y||c.selected||!u&&$?"selected":"default"})}))})}));exports.MenuItem=f;
@@ -12,6 +12,7 @@ interface MenuListProps {
12
12
  focusedIndex?: number;
13
13
  isDraggable?: boolean;
14
14
  onOptionsReorder?: (reorderedOptions: DropdownOption[]) => void;
15
+ showCheckboxForCustomElement?: boolean;
15
16
  }
16
17
  export declare const MenuList: import("react").ForwardRefExoticComponent<MenuListProps & import("react").RefAttributes<HTMLDivElement[]>>;
17
18
  export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("./MenuItem.js"),r=require("./MenuList.styled.js");const s=n.forwardRef(((s,l)=>{let{options:o,isMultiSelect:i,showDescription:u,onSelect:c,version:a,onInfiniteScroll:d,onDropdownItemClick:p,useDefaultCursor:f,focusedIndex:g=-1,isDraggable:b=!1,onOptionsReorder:D}=s;const j=n.useRef(null),v=n.useRef(null),[x,m]=n.useState(null),[I,h]=n.useState(null),C=n.useCallback((()=>{j.current&&j.current.disconnect(),j.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==d||d())})),v.current&&j.current.observe(v.current)}),[d]);n.useEffect((()=>(C(),()=>{j.current&&j.current.disconnect()})),[C,o]);const S=n.useCallback((e=>n=>{b&&(m(e),n.dataTransfer.effectAllowed="move")}),[b]),w=n.useCallback((e=>n=>{b&&(n.preventDefault(),n.dataTransfer.dropEffect="move",h(e))}),[b]),M=n.useCallback((e=>n=>{if(b&&null!==x){if(n.preventDefault(),x!==e){const n=[...o],[t]=n.splice(x,1);n.splice(e,0,t),null==D||D(n)}m(null),h(null)}}),[b,x,o,D]),k=n.useCallback((()=>{m(null),h(null)}),[]),O=new Map;let y=-1;return o.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||(y++,O.set(e,y))}));else{const n=e;n.disabled||(y++,O.set(n,y))}})),e.jsx(e.Fragment,{children:o.map(((n,s)=>{const d=s===o.length-1;if(n.options){const o=n;return e.jsxs("div",Object.assign({style:{marginTop:"2.0"===a?2:0}},{children:[e.jsxs(r.StyledGroupedLabel,Object.assign({version:a},{children:[o.leadingIcon?e.jsx("span",Object.assign({style:{marginRight:8}},{children:o.leadingIcon})):null,o.label]})),o.options.map(((n,r)=>{const d=O.get(n),b=d===g&&!n.disabled;return e.jsx(t.MenuItem,{version:a,last:r===o.options.length-1,onSelect:c,showDescription:u,onDropdownItemClick:p,isMultiSelect:i,option:n,useDefaultCursor:f,isFocused:b,dataIndex:d,isDraggable:!1,ref:e=>{l&&"object"==typeof l&&l.current&&e&&e&&e&&e&&(l.current[s]=e)}},`${s}-${r}`)})),d?e.jsx("span",{ref:v}):null]}),s)}const D=n,j=O.get(D),x=j===g&&!D.disabled;return e.jsxs("div",{children:[e.jsx(t.MenuItem,{version:a,last:d,onSelect:c,showDescription:u,onDropdownItemClick:p,isMultiSelect:i,option:D,useDefaultCursor:f,isFocused:x,dataIndex:j,isDraggable:b,onDragStart:S(s),onDragOver:w(s),onDrop:M(s),onDragEnd:k,isDraggedOver:I===s,ref:e=>{l&&"object"==typeof l&&l.current&&e&&(l.current[s]=e)}},D.value),d?e.jsx("span",{ref:v}):null]},s)}))})}));exports.MenuList=s;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("./MenuItem.js"),s=require("./MenuList.styled.js");const r=n.forwardRef(((r,o)=>{let{options:l,isMultiSelect:i,showDescription:u,onSelect:c,version:a,onInfiniteScroll:d,onDropdownItemClick:p,useDefaultCursor:f,focusedIndex:b=-1,isDraggable:g=!1,onOptionsReorder:m,showCheckboxForCustomElement:h=!1}=r;const D=n.useRef(null),j=n.useRef(null),[x,v]=n.useState(null),[C,I]=n.useState(null),w=n.useCallback((()=>{D.current&&D.current.disconnect(),D.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==d||d())})),j.current&&D.current.observe(j.current)}),[d]);n.useEffect((()=>(w(),()=>{D.current&&D.current.disconnect()})),[w,l]);const k=n.useCallback((e=>n=>{g&&(v(e),n.dataTransfer.effectAllowed="move")}),[g]),S=n.useCallback((e=>n=>{g&&(n.preventDefault(),n.dataTransfer.dropEffect="move",I(e))}),[g]),M=n.useCallback((e=>n=>{if(g&&null!==x){if(n.preventDefault(),x!==e){const n=[...l],[t]=n.splice(x,1);n.splice(e,0,t),null==m||m(n)}v(null),I(null)}}),[g,x,l,m]),E=n.useCallback((()=>{v(null),I(null)}),[]),O=new Map;let y=-1;return l.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||(y++,O.set(e,y))}));else{const n=e;n.disabled||(y++,O.set(n,y))}})),e.jsx(e.Fragment,{children:l.map(((n,r)=>{const d=r===l.length-1;if(n.options){const l=n;return e.jsxs("div",Object.assign({style:{marginTop:"2.0"===a?2:0}},{children:[e.jsxs(s.StyledGroupedLabel,Object.assign({version:a},{children:[l.leadingIcon?e.jsx("span",Object.assign({style:{marginRight:8}},{children:l.leadingIcon})):null,l.label]})),l.options.map(((n,s)=>{const d=O.get(n),g=d===b&&!n.disabled;return e.jsx(t.MenuItem,{version:a,last:s===l.options.length-1,onSelect:c,showDescription:u,onDropdownItemClick:p,isMultiSelect:i,option:n,useDefaultCursor:f,isFocused:g,dataIndex:d,isDraggable:!1,showCheckboxForCustomElement:h,ref:e=>{o&&"object"==typeof o&&o.current&&e&&e&&e&&e&&(o.current[r]=e)}},`${r}-${s}`)})),d?e.jsx("span",{ref:j}):null]}),r)}const m=n,D=O.get(m),x=D===b&&!m.disabled;return e.jsxs("div",{children:[e.jsx(t.MenuItem,{version:a,last:d,onSelect:c,showDescription:u,onDropdownItemClick:p,isMultiSelect:i,option:m,useDefaultCursor:f,isFocused:x,dataIndex:D,isDraggable:g,onDragStart:k(r),onDragOver:S(r),onDrop:M(r),onDragEnd:E,isDraggedOver:C===r,showCheckboxForCustomElement:h,ref:e=>{o&&"object"==typeof o&&o.current&&e&&(o.current[r]=e)}},m.value),d?e.jsx("span",{ref:j}):null]},r)}))})}));exports.MenuList=r;
@@ -56,6 +56,8 @@ export interface OpenDropdownProps {
56
56
  onOptionsReorder?: (reorderedOptions: DropdownOption[]) => void;
57
57
  /** z-index of the dropdown popover. Defaults to 3. */
58
58
  dropdownZIndex?: number;
59
+ /** When true, renders a checkbox alongside the customComponent in multiselect mode */
60
+ showCheckboxForCustomElement?: boolean;
59
61
  }
60
62
  export type GroupedOption = {
61
63
  label?: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash/cloneDeep"),l=require("react"),o=require("../../utils/StringUtils.js"),i=require("../../constants/Theme.js"),a=require("../modals/styledModal.js"),r=require("../template-preview/helpers/templateMiscHelper.js"),n=require("../template-preview/models/Channels.js"),s=require("../template-preview/models/WhatsAppTemplate.js"),d=require("./context/templateModalContext.js"),u=require("./modalElements/Footer.js"),c=require("./modalElements/TemplateAnalyticsComponent.js"),p=require("./modalElements/TemplateSelectModalContent.js"),v=require("./utils/convertPlaceholdersToBikDropdown.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=m(t);exports.TemplateContextMapper=t=>{var m,C,f,b,S,E,x,g;const{selectedTemplate:T,closeDialog:y,showVariableMapping:P,channel:I,htmlContent:D,templateVariables:j,onTemplateSelect:L,globalPlaceholders:w,showOnlyContent:A,whatsappSpecificPickerMeta:k,zIndex:V,showVariableModal:M,variableList:N,discountCode:H,setDiscountCode:B,onBackPress:O,enabledCustomText:q,variableListForImage:F,showSampleValues:_,disableEditVariable:W,pod:Y,extras:$,pickerConf:R,selectedCarouselProducts:z,disableEditExpiry:Q,cardWidth:U,onDeleteSelectedProducts:G,fileName:J,setFileName:K,hideDeviceContainerInPreview:X,maxCharLimit:Z,onDefaultVariableSelect:ee,skipDefaultVariableContent:te,disableDatePicker:le,disableCopyCode:oe,initialExpiryDateTime:ie,showDiscountCodeExpiryInfo:ae,footerButtonText:re,footerInfoText:ne,templateAnalytics:se}=t;l.useEffect((()=>{fe(D)}),[D]);const de=r.determineCardIndex(I),ue=r.isItCarousal(I,T),ce=null==T?void 0:T.isProductCarouselType,[pe,ve]=l.useState(I===n.CHANNEL_TYPE.EMAIL||I==n.CHANNEL_TYPE.WEBPUSH||ue?"desktop":"mobile"),[me,he]=l.useState(!1),[Ce,fe]=l.useState(D),[be,Se]=l.useState(!1),[Ee,xe]=l.useState([]),[ge,Te]=l.useState({}),[ye,Pe]=l.useState(T),[Ie,De]=l.useState([]),[je,Le]=l.useState(null),[we,Ae]=l.useState(!1),[ke,Ve]=l.useState(null!=j?j:[]),[Me,Ne]=l.useState(!1),[He,Be]=l.useState(ue?(null===(C=null===(m=null==ye?void 0:ye.mapping)||void 0===m?void 0:m.body)||void 0===C?void 0:C.length)?-1:0:-1),[Oe,qe]=l.useState([]),[Fe,_e]=l.useState(void 0),We=l.useRef(null),[Ye,$e]=l.useState(!1),[Re,ze]=l.useState(!1),[Qe,Ue]=l.useState(!1),[Ge,Je]=l.useState(!0),[Ke,Xe]=l.useState(!0),[Ze,et]=l.useState({}),[tt,lt]=l.useState("");l.useEffect((()=>{z?qe(z):ce&&qe([])}),[z]),l.useEffect((()=>{var e;if(!we&&ce&&(!z||0===qe.length)){const t=null===(e=null==ye?void 0:ye.components)||void 0===e?void 0:e[de].cards,l=[];null==t||t.forEach((e=>{var t;null===(t=null==e?void 0:e.components)||void 0===t||t.forEach((e=>{var t,o,i;"HEADER"===e.type&&l.push(null!==(i=null===(o=null===(t=e.example)||void 0===t?void 0:t.header_handle)||void 0===o?void 0:o[0])&&void 0!==i?i:"")}))})),De(l),Ae(!0)}}),[we]);const ot=l.useMemo((()=>v.convertPlaceholdersToBikDropdown(w)),[w]);return l.useEffect((()=>{_e(h.default(N))}),[N]),(null==se?void 0:se.show)&&Ge&&se.templateQuality&&Object.values(s.TEMPLATE_QUALITY).find((e=>e===String(se.templateQuality)))?e.jsx(c.TemplateAnalyticsComponent,{headingTitle:null==ye?void 0:ye.label,headingSubtitle:I===n.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(f=null==ye?void 0:ye.category)&&void 0!==f?f:"")} • ${null!==(b=null==ye?void 0:ye.templateCategory)&&void 0!==b?b:""}`:"",templateAnalytics:se,analyticsData:se.data,onClose:()=>{null==y||y(),Je(!1),Xe(!1)},onCancel:()=>{Je(!1),Xe(!1)},onProceed:()=>{Je(!1),Xe(!0)},templateId:(null==ye?void 0:ye.templateId)||""}):e.jsx(d.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:Qe,setHideFooterButton:Ue,hideCrossButton:Re,setHideCrossButton:ze,variableList:Fe,setVariableList:_e,variableCallback:je,setVariableCallback:Le,showVariablePicker:me,setShowVariablePicker:he,template:ye,setTemplate:Pe,device:pe,setDevice:ve,display_content:Ce,setDisplayContent:fe,originalVariableList:ke,setOriginalVariableList:Ve,isError:be,setIsError:Se,channel:I,globalNormalizedPlaceholders:ot,templateSelectionTriggered:Me,setTemplateSelectionTriggered:Ne,enabledCustomText:q,disableEditVariable:W,pod:Y,extras:$,isWhatsappCarousel:ue,selectedCarouselIndex:He,setSelectedCarouselIndex:Be,isProductCarouselType:ce,templateErrorIndexes:ge,cardCount:ue?null===(E=null===(S=T.components)||void 0===S?void 0:S[de].cards)||void 0===E?void 0:E.length:void 0,errorIndexes:Ee,setErrorIndexes:xe,pickerConf:R,carouselProducts:Oe,setCarouselProducts:qe,disableEditExpiry:Q,cardWidth:U,cardImages:Ie,onDeleteSelectedProducts:G,hideDeviceContainerInPreview:X,sliderRef:We,isCarouselHovered:Ye,setIsCarouselHovered:$e,maxCharLimit:Z,ctaOptionsErrors:Ze,setCtaOptionsErrors:et,onDefaultVariableSelect:ee,carouselBodyError:tt,setCarouselBodyError:lt,disableDatePicker:le,disableCopyCode:oe,initialExpiryDateTime:ie,showDiscountCodeExpiryInfo:ae,cardIndex:de}},{children:A?e.jsx(p.default,{variableListFromProps:N,channel:n.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(a.StyledModal,Object.assign({hideCrossButton:Re,zIndex:V,centralContainerStyles:{width:ue?900:I===n.CHANNEL_TYPE.EMAIL&&P?1e3:800},open:Ke,onClose:()=>{Xe(!1),null==y||y()},headingTitle:null==ye?void 0:ye.label,headingSubtitle:I===n.CHANNEL_TYPE.WHATSAPP||r.isRCSChannel(I)?`${o.default.capitaliseFirstLetterOfString(null!==(x=null==ye?void 0:ye.category)&&void 0!==x?x:"")} • ${null!==(g=null==ye?void 0:ye.templateCategory)&&void 0!==g?g:""}`:"",onBackPress:()=>{if(null==se?void 0:se.show)return Je(!0),void Xe(!1);null==O||O()},modalHeaderStyles:{borderBottom:`1px solid ${i.COLORS.stroke.primary}`}},{children:[e.jsx(p.default,{variableListFromProps:N,showSampleValues:_,showVariableMapping:P,channel:I,whatsappSpecificPickerMeta:k,showVariableModal:M,discountCode:H,setDiscountCode:B,variableListForImage:F&&(null==F?void 0:F.length)>0?F:Fe,fileName:J,setFileName:e=>{null==K||K(e)},skipDefaultVariableContent:te}),L?e.jsx(u.default,{isWhatsappCarousel:null!=ue&&ue,onSelect:function(){var e,t;if(lt(""),(null==Oe?void 0:Oe.length)<1&&ce)return void Se(!0);if(Object.keys(Ze).length>0&&Y!==s.POD.CHATBOT)return void Se(!0);if(ce&&(null!==(e=null==Oe?void 0:Oe.length)&&void 0!==e?e:0)>0){const e=function(e,t,l){var o,i,a,r,n,s,d,u,c,p;const v=null===(i=null===(o=null==e?void 0:e.components)||void 0===o?void 0:o[l])||void 0===i?void 0:i.cards;if(!(null==v?void 0:v.length)||!(null==t?void 0:t.length))return"";const m=null!==(s=null===(n=null===(r=null===(a=v[0])||void 0===a?void 0:a.components)||void 0===r?void 0:r.find((e=>"BODY"===e.type)))||void 0===n?void 0:n.text)&&void 0!==s?s:"";if(!m)return"";const h=null!==(p=null===(c=null===(u=null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)||void 0===u?void 0:u[0])||void 0===c?void 0:c.body)&&void 0!==p?p:[];if(!h.length)return"";const C={"{{product.name}}":"productName","{{product.description}}":"productDescription"};for(const e of t){let t=m;for(let l=0;l<h.length;l++){const o=h[l],i=C[o];if(void 0===i)continue;const a=e[i];if(!a)return`Variable ${o} is missing for product "${e.productName}".`;t=t.replace(`{{${l+1}}}`,a)}if(t.length>160)return"Selected products description/name making the description more than 160."}return""}(ye,Oe,de);if(e)return lt(e),void Se(!0)}const l=null==L?void 0:L(ye,ke,null!=Ce?Ce:"",Oe);Te(null!==(t=null==l?void 0:l.templateErrorIndexes)&&void 0!==t?t:{body:[],buttons:[]}),(null==l?void 0:l.errorIndexes)||(null==l?void 0:l.error)?((null==l?void 0:l.errorIndexes)&&xe(l.errorIndexes),(null==l?void 0:l.error)&&Se(!!(null==l?void 0:l.error))):Ne(!0)},footerButtonText:re,footerInfoText:ne}):e.jsx(e.Fragment,{})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash/cloneDeep"),l=require("react"),a=require("../../utils/StringUtils.js"),o=require("../../constants/Theme.js"),i=require("../modals/styledModal.js"),r=require("../template-preview/helpers/templateMiscHelper.js"),s=require("../template-preview/models/Channels.js"),n=require("../template-preview/models/WhatsAppTemplate.js"),d=require("./context/templateModalContext.js"),u=require("./modalElements/Footer.js"),c=require("./modalElements/TemplateAnalyticsComponent.js"),p=require("./modalElements/TemplateSelectModalContent.js"),v=require("./utils/convertPlaceholdersToBikDropdown.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var C=m(t);exports.TemplateContextMapper=t=>{var m,h,b,S,f,E,x,T;const{selectedTemplate:P,closeDialog:g,showVariableMapping:y,channel:I,htmlContent:j,templateVariables:D,onTemplateSelect:L,globalPlaceholders:w,showOnlyContent:A,whatsappSpecificPickerMeta:k,zIndex:M,showVariableModal:V,variableList:H,discountCode:N,setDiscountCode:O,onBackPress:q,enabledCustomText:B,variableListForImage:F,showSampleValues:_,disableEditVariable:W,pod:Y,extras:R,pickerConf:$,selectedCarouselProducts:z,disableEditExpiry:Q,cardWidth:U,onDeleteSelectedProducts:G,fileName:J,setFileName:K,hideDeviceContainerInPreview:X,maxCharLimit:Z,onDefaultVariableSelect:ee,skipDefaultVariableContent:te,disableDatePicker:le,disableCopyCode:ae,initialExpiryDateTime:oe,showDiscountCodeExpiryInfo:ie,footerButtonText:re,footerInfoText:se,templateAnalytics:ne}=t;l.useEffect((()=>{be(j)}),[j]);const de=r.determineCardIndex(I),ue=r.isItCarousal(I,P),ce=null==P?void 0:P.isProductCarouselType,[pe,ve]=l.useState(I===s.CHANNEL_TYPE.EMAIL||I==s.CHANNEL_TYPE.WEBPUSH||ue?"desktop":"mobile"),[me,Ce]=l.useState(!1),[he,be]=l.useState(j),[Se,fe]=l.useState(!1),[Ee,xe]=l.useState([]),[Te,Pe]=l.useState({}),[ge,ye]=l.useState(P),[Ie,je]=l.useState([]),[De,Le]=l.useState(null),[we,Ae]=l.useState(!1),[ke,Me]=l.useState(null!=D?D:[]),[Ve,He]=l.useState(!1),[Ne,Oe]=l.useState(ue?(null===(h=null===(m=null==ge?void 0:ge.mapping)||void 0===m?void 0:m.body)||void 0===h?void 0:h.length)?-1:0:-1),[qe,Be]=l.useState([]),[Fe,_e]=l.useState(void 0),We=l.useRef(null),[Ye,Re]=l.useState(!1),[$e,ze]=l.useState(!1),[Qe,Ue]=l.useState(!1),[Ge,Je]=l.useState(!0),[Ke,Xe]=l.useState(!0),[Ze,et]=l.useState({});l.useEffect((()=>{z?Be(z):ce&&Be([])}),[z]),l.useEffect((()=>{var e;if(!we&&ce&&(!z||0===Be.length)){const t=null===(e=null==ge?void 0:ge.components)||void 0===e?void 0:e[de].cards,l=[];null==t||t.forEach((e=>{var t;null===(t=null==e?void 0:e.components)||void 0===t||t.forEach((e=>{var t,a,o;"HEADER"===e.type&&l.push(null!==(o=null===(a=null===(t=e.example)||void 0===t?void 0:t.header_handle)||void 0===a?void 0:a[0])&&void 0!==o?o:"")}))})),je(l),Ae(!0)}}),[we]);const tt=l.useMemo((()=>v.convertPlaceholdersToBikDropdown(w)),[w]);return l.useEffect((()=>{_e(C.default(H))}),[H]),(null==ne?void 0:ne.show)&&Ge&&ne.templateQuality&&Object.values(n.TEMPLATE_QUALITY).find((e=>e===String(ne.templateQuality)))?e.jsx(c.TemplateAnalyticsComponent,{headingTitle:null==ge?void 0:ge.label,headingSubtitle:I===s.CHANNEL_TYPE.WHATSAPP?`${a.default.capitaliseFirstLetterOfString(null!==(b=null==ge?void 0:ge.category)&&void 0!==b?b:"")} • ${null!==(S=null==ge?void 0:ge.templateCategory)&&void 0!==S?S:""}`:"",templateAnalytics:ne,analyticsData:ne.data,onClose:()=>{null==g||g(),Je(!1),Xe(!1)},onCancel:()=>{Je(!1),Xe(!1)},onProceed:()=>{Je(!1),Xe(!0)},templateId:(null==ge?void 0:ge.templateId)||""}):e.jsx(d.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:Qe,setHideFooterButton:Ue,hideCrossButton:$e,setHideCrossButton:ze,variableList:Fe,setVariableList:_e,variableCallback:De,setVariableCallback:Le,showVariablePicker:me,setShowVariablePicker:Ce,template:ge,setTemplate:ye,device:pe,setDevice:ve,display_content:he,setDisplayContent:be,originalVariableList:ke,setOriginalVariableList:Me,isError:Se,setIsError:fe,channel:I,globalNormalizedPlaceholders:tt,templateSelectionTriggered:Ve,setTemplateSelectionTriggered:He,enabledCustomText:B,disableEditVariable:W,pod:Y,extras:R,isWhatsappCarousel:ue,selectedCarouselIndex:Ne,setSelectedCarouselIndex:Oe,isProductCarouselType:ce,templateErrorIndexes:Te,cardCount:ue?null===(E=null===(f=P.components)||void 0===f?void 0:f[de].cards)||void 0===E?void 0:E.length:void 0,errorIndexes:Ee,setErrorIndexes:xe,pickerConf:$,carouselProducts:qe,setCarouselProducts:Be,disableEditExpiry:Q,cardWidth:U,cardImages:Ie,onDeleteSelectedProducts:G,hideDeviceContainerInPreview:X,sliderRef:We,isCarouselHovered:Ye,setIsCarouselHovered:Re,maxCharLimit:Z,ctaOptionsErrors:Ze,setCtaOptionsErrors:et,onDefaultVariableSelect:ee,disableDatePicker:le,disableCopyCode:ae,initialExpiryDateTime:oe,showDiscountCodeExpiryInfo:ie,cardIndex:de}},{children:A?e.jsx(p.default,{variableListFromProps:H,channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(i.StyledModal,Object.assign({hideCrossButton:$e,zIndex:M,centralContainerStyles:{width:ue?900:I===s.CHANNEL_TYPE.EMAIL&&y?1e3:800},open:Ke,onClose:()=>{Xe(!1),null==g||g()},headingTitle:null==ge?void 0:ge.label,headingSubtitle:I===s.CHANNEL_TYPE.WHATSAPP||r.isRCSChannel(I)?`${a.default.capitaliseFirstLetterOfString(null!==(x=null==ge?void 0:ge.category)&&void 0!==x?x:"")} • ${null!==(T=null==ge?void 0:ge.templateCategory)&&void 0!==T?T:""}`:"",onBackPress:()=>{if(null==ne?void 0:ne.show)return Je(!0),void Xe(!1);null==q||q()},modalHeaderStyles:{borderBottom:`1px solid ${o.COLORS.stroke.primary}`}},{children:[e.jsx(p.default,{variableListFromProps:H,showSampleValues:_,showVariableMapping:y,channel:I,whatsappSpecificPickerMeta:k,showVariableModal:V,discountCode:N,setDiscountCode:O,variableListForImage:F&&(null==F?void 0:F.length)>0?F:Fe,fileName:J,setFileName:e=>{null==K||K(e)},skipDefaultVariableContent:te}),L?e.jsx(u.default,{isWhatsappCarousel:null!=ue&&ue,onSelect:function(){var e;if((null==qe?void 0:qe.length)<1&&ce)return void fe(!0);if(Object.keys(Ze).length>0&&Y!==n.POD.CHATBOT)return void fe(!0);const t=null==L?void 0:L(ge,ke,null!=he?he:"",qe);Pe(null!==(e=null==t?void 0:t.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==t?void 0:t.errorIndexes)||(null==t?void 0:t.error)?((null==t?void 0:t.errorIndexes)&&xe(t.errorIndexes),(null==t?void 0:t.error)&&fe(!!(null==t?void 0:t.error))):He(!0)},footerButtonText:re,footerInfoText:se}):e.jsx(e.Fragment,{})]}))}))};
@@ -80,8 +80,6 @@ export declare const TemplateModalContext: React.Context<{
80
80
  [key: string]: string;
81
81
  }>> | undefined;
82
82
  onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
83
- carouselBodyError?: string | undefined;
84
- setCarouselBodyError?: React.Dispatch<React.SetStateAction<string>> | undefined;
85
83
  cardIndex: number;
86
84
  }>;
87
85
  export declare const useTemplateModalContext: () => {
@@ -155,7 +153,5 @@ export declare const useTemplateModalContext: () => {
155
153
  [key: string]: string;
156
154
  }>> | undefined;
157
155
  onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
158
- carouselBodyError?: string | undefined;
159
- setCarouselBodyError?: React.Dispatch<React.SetStateAction<string>> | undefined;
160
156
  cardIndex: number;
161
157
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("@bikdotai/bik-models/growth/models/bik-store"),t=require("../../../assets/icons/arrow_back.svg.js"),n=require("../../../assets/icons/chevronLeft.svg.js"),o=require("../../../assets/icons/chevronRight.svg.js"),i=require("../../../assets/icons/PlusIcon.js"),r=require("lodash/cloneDeep"),s=require("react"),a=require("../../button/Button.js"),d=require("../../icon-button/IconButton.js"),c=require("../../product-picker-v2/modal.js"),u=require("../../product-picker-v2/type.js"),p=require("../Badge/index.js"),v=require("../context/templateModalContext.js"),h=require("./EditWhatsAppTemplateV2.js"),g=require("./ProductBox.js"),m=require("../../template-preview/helpers/templateMiscHelper.js"),y=require("../../template-preview/models/WhatsAppTemplate.js"),x=require("../../TypographyStyle.js"),f=require("../../../constants/Theme.js");function j(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=j(r);exports.default=r=>{let{template:j,whatsappSpecificPickerMeta:C,showVariableModal:O,variableListForImage:I,discountCode:S,setDiscountCode:k}=r;var P,q,T,w,B,R,L,E;const{selectedCarouselIndex:M,setTemplate:D,pickerConf:F,isProductCarouselType:V,pod:A,cardCount:N,carouselProducts:$,setCarouselProducts:_,isError:W,cardImages:z,disableEditVariable:G,onDeleteSelectedProducts:H,setSelectedCarouselIndex:K,setVariableCallback:J,setShowVariablePicker:Q,sliderRef:U,setCarouselBodyError:X}=v.useTemplateModalContext(),[Y,Z]=s.useState(m.isRCSChannel(null==j?void 0:j.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":V?"Product Carousel "+((null===(q=null===(P=null==j?void 0:j.mapping)||void 0===P?void 0:P.body)||void 0===q?void 0:q.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(w=null===(T=null==j?void 0:j.mapping)||void 0===T?void 0:T.body)||void 0===w?void 0:w.length)?"(Step 2/2)":"")),[ee,le]=s.useState(!1),[te,ne]=s.useState(!1),oe=M===(null!=N?N:-1)-1,ie=(null!=M?M:-1)<1;s.useEffect((()=>{var e,l,t,n;Z(m.isRCSChannel(null==j?void 0:j.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":V?"Product Carousel "+((null===(l=null===(e=null==j?void 0:j.mapping)||void 0===e?void 0:e.body)||void 0===l?void 0:l.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(t=null==j?void 0:j.mapping)||void 0===t?void 0:t.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[M]),s.useEffect((()=>{Q(!1)}),[M]);const re=e=>{null==_||_([{name:"variable",productName:e.actualValue}])};return s.useEffect((()=>{-1===M&&m.isRCSChannel(null==j?void 0:j.channel)&&(null==K||K(0))}),[M,null==j?void 0:j.channel]),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!m.isRCSChannel(null==j?void 0:j.channel)&&null!=M&&M>=0&&!!(null===(R=null===(B=null==j?void 0:j.mapping)||void 0===B?void 0:B.body)||void 0===R?void 0:R.length)&&e.jsx(d.IconButton,{Icon:t.default,onClick:()=>{null==K||K(-1)}}),e.jsx(x.TitleMedium,Object.assign({style:{marginLeft:10}},{children:Y}))]})),V&&(null!==(L=null==$?void 0:$.length)&&void 0!==L?L:0)>0&&null!=M&&M>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(g.ProductBox,{editItem:()=>{1===(null==$?void 0:$.length)&&"variable"===$[0].name?(J((()=>re)),Q(!0)):le(!ee)},cardBody:1===(null==$?void 0:$.length)&&"variable"===$[0].name?`${$[0].productName}`:`${null==$?void 0:$.length} Products Selected`,hideIcon:1===(null==$?void 0:$.length)&&"variable"===$[0].name,deleteItem:()=>{var e;if(1===(null==$?void 0:$.length)&&"variable"===$[0].name)return void(null==_||_([]));const l=b.default(Object.assign({},j));l&&(z&&z.length>0?null==z||z.forEach(((e,t)=>{var n;l.components[1].cards[t].components[0].example.header_handle=[null!==(n=z[t])&&void 0!==n?n:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==l?void 0:l.components[1].cards)||void 0===e||e.forEach(((e,t)=>{l.components[1].cards[t].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==D||D(l)),null==_||_([]),null==X||X(""),null==H||H()}}),$&&(null==$?void 0:$.length)>0&&"variable"!=$[0].name&&e.jsx(a.Button,{disabled:(null!==(E=null==$?void 0:$.length)&&void 0!==E?E:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{ne(!0),le(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!G&&V&&0===(null==$?void 0:$.length)&&null!=M&&M>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(x.TitleRegular,{children:"Product(s)"}),e.jsx(x.BodySecondary,{children:`Select ${null!=N?N:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:W?16:12,marginRight:W?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:W?`2px dashed ${f.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:W?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(i.default,{width:18,height:18,color:f.COLORS.content.secondary})})),onClick:e=>{le(!0)}}),A===y.POD.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8,flex:1}}),e.jsx(x.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8,flex:1}})]})),e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:W?`2px dashed ${f.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:W?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.default,{width:18,height:18,color:f.COLORS.content.secondary})})),onClick:e=>{J((()=>re)),Q(!0)}})]})]})),W&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(p.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!V&&(null!=M?M:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:f.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(d.IconButton,{Icon:n.default,disabled:ie,width:8,height:14,svgStyle:ie?{}:{color:f.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickPrev(),(null!=M?M:-1)<1||null==K||K((e=>e-1))}}),e.jsx(x.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:f.COLORS.content.secondary},{children:`Card ${(null!=M?M:0)+1}/${N}`})),e.jsx(d.IconButton,{Icon:o.default,width:8,height:14,disabled:oe,svgStyle:oe?{}:{color:f.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickNext(),(null!=M?M:-1)>=(null!=N?N:-1)-1||null==K||K((e=>e+1))}})]})),e.jsx(h.default,{whatsappSpecificPickerMeta:C,template:j,onTemplateChange:e=>{null==D||D(e)},showVariableModal:O,variableListForImage:I,discountCode:S,setDiscountCode:k}),ee&&F&&e.jsx(c.ProductPickerModal,{zIndex:200,startupScreen:te?u.ScreenName.RearrangeProducts:u.ScreenName.Collections,rearrangeEnabled:!0,storeId:F.storeId,selectedItems:(e=>{if(e.length>0){const l={};for(const t of e){const e=null==t?void 0:t.collectionId,n=t.productId,o=t.variantId;e in l||(l[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in l[e].products||(l[e].products[n]={variants:{},name:(null==t?void 0:t.productName)||"",image:(null==t?void 0:t.productImage)||""}),l[e].products[n].variants[o]={name:(null==t?void 0:t.name)||"",price:"",image:(null==t?void 0:t.image)||"",quantity:t.quantity||0,displayOrder:t.displayOrder}}return l}return{}})(null!=$?$:[]),collectionFetcher:F.fetchCollections,productFetcher:F.fetchProducts,onAdd:(e,l)=>{var t,n,o,i,r,s,a,d;ne(!1);const c=[];delete e.isCustom;for(const l of Object.keys(e)){const u=e[l].products;if(void 0!==u&&Object.keys(u).length)for(const e of Object.keys(u)){const p=u[e].variants;if(void 0!==p&&Object.keys(p).length)for(const v of Object.keys(p)){const{name:h,image:g,quantity:m,displayOrder:y}=p[v],x={name:h,image:null!==(n=null!=g?g:null===(t=u[e])||void 0===t?void 0:t.image)&&void 0!==n?n:"",quantity:m,variantId:v,productId:e,displayOrder:y,collectionId:l,productName:null!==(i=null===(o=u[e])||void 0===o?void 0:o.name)&&void 0!==i?i:"",productImage:null!==(s=null===(r=u[e])||void 0===r?void 0:r.image)&&void 0!==s?s:"",productDescription:null!==(d=null===(a=u[e])||void 0===a?void 0:a.description)&&void 0!==d?d:""};c.push(x)}}}const u=c.sort(((e,l)=>e.displayOrder-l.displayOrder)),p=c.map((e=>e.image)),v=b.default(Object.assign({},j));v&&(p.forEach(((e,l)=>{var t;v.components[1].cards[l].components[0].example.header_handle=e?[e]:[null!==(t=null==z?void 0:z[l])&&void 0!==t?t:""]})),null==D||D(v)),null==_||_(u),null==X||X(""),le(!1)},searchInCollectionFetcher:F.searchInCollection,searchFetcher:F.searchProducts,visible:ee,onClose:()=>{le(!1)},exactLimit:null!=N?N:1,appType:F.appType||l.ApplicationType.BIK})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@bikdotai/bik-models/growth/models/bik-store"),l=require("../../../assets/icons/arrow_back.svg.js"),n=require("../../../assets/icons/chevronLeft.svg.js"),o=require("../../../assets/icons/chevronRight.svg.js"),i=require("../../../assets/icons/PlusIcon.js"),a=require("lodash/cloneDeep"),r=require("react"),s=require("../../button/Button.js"),d=require("../../icon-button/IconButton.js"),c=require("../../product-picker-v2/modal.js"),u=require("../../product-picker-v2/type.js"),p=require("../Badge/index.js"),v=require("../context/templateModalContext.js"),h=require("./EditWhatsAppTemplateV2.js"),g=require("./ProductBox.js"),m=require("../../template-preview/helpers/templateMiscHelper.js"),y=require("../../template-preview/models/WhatsAppTemplate.js"),x=require("../../TypographyStyle.js"),f=require("../../../constants/Theme.js");function j(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=j(a);exports.default=a=>{let{template:j,whatsappSpecificPickerMeta:C,showVariableModal:O,variableListForImage:I,discountCode:S,setDiscountCode:k}=a;var P,q,T,w,B,R,L,E;const{selectedCarouselIndex:M,setTemplate:D,pickerConf:F,isProductCarouselType:V,pod:A,cardCount:N,carouselProducts:$,setCarouselProducts:_,isError:W,cardImages:z,disableEditVariable:G,onDeleteSelectedProducts:H,setSelectedCarouselIndex:K,setVariableCallback:J,setShowVariablePicker:Q,sliderRef:U}=v.useTemplateModalContext(),[X,Y]=r.useState(m.isRCSChannel(null==j?void 0:j.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":V?"Product Carousel "+((null===(q=null===(P=null==j?void 0:j.mapping)||void 0===P?void 0:P.body)||void 0===q?void 0:q.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(w=null===(T=null==j?void 0:j.mapping)||void 0===T?void 0:T.body)||void 0===w?void 0:w.length)?"(Step 2/2)":"")),[Z,ee]=r.useState(!1),[te,le]=r.useState(!1),ne=M===(null!=N?N:-1)-1,oe=(null!=M?M:-1)<1;r.useEffect((()=>{var e,t,l,n;Y(m.isRCSChannel(null==j?void 0:j.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":V?"Product Carousel "+((null===(t=null===(e=null==j?void 0:j.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(l=null==j?void 0:j.mapping)||void 0===l?void 0:l.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[M]),r.useEffect((()=>{Q(!1)}),[M]);const ie=e=>{null==_||_([{name:"variable",productName:e.actualValue}])};return r.useEffect((()=>{-1===M&&m.isRCSChannel(null==j?void 0:j.channel)&&(null==K||K(0))}),[M,null==j?void 0:j.channel]),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!m.isRCSChannel(null==j?void 0:j.channel)&&null!=M&&M>=0&&!!(null===(R=null===(B=null==j?void 0:j.mapping)||void 0===B?void 0:B.body)||void 0===R?void 0:R.length)&&e.jsx(d.IconButton,{Icon:l.default,onClick:()=>{null==K||K(-1)}}),e.jsx(x.TitleMedium,Object.assign({style:{marginLeft:10}},{children:X}))]})),V&&(null!==(L=null==$?void 0:$.length)&&void 0!==L?L:0)>0&&null!=M&&M>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(g.ProductBox,{editItem:()=>{1===(null==$?void 0:$.length)&&"variable"===$[0].name?(J((()=>ie)),Q(!0)):ee(!Z)},cardBody:1===(null==$?void 0:$.length)&&"variable"===$[0].name?`${$[0].productName}`:`${null==$?void 0:$.length} Products Selected`,hideIcon:1===(null==$?void 0:$.length)&&"variable"===$[0].name,deleteItem:()=>{var e;if(1===(null==$?void 0:$.length)&&"variable"===$[0].name)return void(null==_||_([]));const t=b.default(Object.assign({},j));t&&(z&&z.length>0?null==z||z.forEach(((e,l)=>{var n;t.components[1].cards[l].components[0].example.header_handle=[null!==(n=z[l])&&void 0!==n?n:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==D||D(t)),null==_||_([]),null==H||H()}}),$&&(null==$?void 0:$.length)>0&&"variable"!=$[0].name&&e.jsx(s.Button,{disabled:(null!==(E=null==$?void 0:$.length)&&void 0!==E?E:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{le(!0),ee(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!G&&V&&0===(null==$?void 0:$.length)&&null!=M&&M>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(x.TitleRegular,{children:"Product(s)"}),e.jsx(x.BodySecondary,{children:`Select ${null!=N?N:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:W?16:12,marginRight:W?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:W?`2px dashed ${f.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:W?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(i.default,{width:18,height:18,color:f.COLORS.content.secondary})})),onClick:e=>{ee(!0)}}),A===y.POD.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8,flex:1}}),e.jsx(x.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8,flex:1}})]})),e.jsx(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:W?`2px dashed ${f.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:W?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.default,{width:18,height:18,color:f.COLORS.content.secondary})})),onClick:e=>{J((()=>ie)),Q(!0)}})]})]})),W&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(p.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!V&&(null!=M?M:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:f.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(d.IconButton,{Icon:n.default,disabled:oe,width:8,height:14,svgStyle:oe?{}:{color:f.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickPrev(),(null!=M?M:-1)<1||null==K||K((e=>e-1))}}),e.jsx(x.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:f.COLORS.content.secondary},{children:`Card ${(null!=M?M:0)+1}/${N}`})),e.jsx(d.IconButton,{Icon:o.default,width:8,height:14,disabled:ne,svgStyle:ne?{}:{color:f.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickNext(),(null!=M?M:-1)>=(null!=N?N:-1)-1||null==K||K((e=>e+1))}})]})),e.jsx(h.default,{whatsappSpecificPickerMeta:C,template:j,onTemplateChange:e=>{null==D||D(e)},showVariableModal:O,variableListForImage:I,discountCode:S,setDiscountCode:k}),Z&&F&&e.jsx(c.ProductPickerModal,{zIndex:200,startupScreen:te?u.ScreenName.RearrangeProducts:u.ScreenName.Collections,rearrangeEnabled:!0,storeId:F.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,n=l.productId,o=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in t[e].products||(t[e].products[n]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[n].variants[o]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=$?$:[]),collectionFetcher:F.fetchCollections,productFetcher:F.fetchProducts,onAdd:(e,t)=>{var l,n,o,i,a,r;le(!1);const s=[];delete e.isCustom;for(const t of Object.keys(e)){const d=e[t].products;if(void 0!==d&&Object.keys(d).length)for(const e of Object.keys(d)){const c=d[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:v,quantity:h,displayOrder:g}=c[u],m={name:p,image:null!==(n=null!=v?v:null===(l=d[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:h,variantId:u,productId:e,displayOrder:g,collectionId:t,productName:null!==(i=null===(o=d[e])||void 0===o?void 0:o.name)&&void 0!==i?i:"",productImage:null!==(r=null===(a=d[e])||void 0===a?void 0:a.image)&&void 0!==r?r:""};s.push(m)}}}const d=s.sort(((e,t)=>e.displayOrder-t.displayOrder)),c=s.map((e=>e.image)),u=b.default(Object.assign({},j));u&&(c.forEach(((e,t)=>{var l;u.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==z?void 0:z[t])&&void 0!==l?l:""]})),null==D||D(u)),null==_||_(d),ee(!1)},searchInCollectionFetcher:F.searchInCollection,searchFetcher:F.searchProducts,visible:Z,onClose:()=>{ee(!1)},exactLimit:null!=N?N:1,appType:F.appType||t.ApplicationType.BIK})]}))};
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/info.svg.js"),r=require("react"),s=require("styled-components"),o=require("../../button/Button.js"),l=require("../../tag/Tag.js"),i=require("../../template-preview/helpers/templateMiscHelper.js"),n=require("../../template-preview/models/Channels.js"),a=require("../../TypographyStyle.js"),d=require("../../../constants/Theme.js"),u=require("../Badge/index.js"),c=require("../context/templateModalContext.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const x=p(s).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/info.svg.js"),r=require("react"),s=require("styled-components"),l=require("../../button/Button.js"),i=require("../../tag/Tag.js"),n=require("../../template-preview/models/Channels.js"),o=require("../../template-preview/helpers/templateMiscHelper.js"),a=require("../../TypographyStyle.js"),d=require("../../../constants/Theme.js"),u=require("../Badge/index.js"),p=require("../context/templateModalContext.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const x=c(s).default.div`
2
2
  background: ${d.COLORS.surface.standard};
3
3
  border-top-width: 1px;
4
4
  border-top-color: ${d.COLORS.stroke.primary};
@@ -12,4 +12,4 @@
12
12
  border-bottom-left-radius: 4px;
13
13
  border-bottom-right-radius: 4px;
14
14
  height: ${e=>e.isWhatsappCarousel?64:80}px;
15
- `;exports.default=s=>{let{isWhatsappCarousel:p,onSelect:g,footerButtonText:j,footerInfoText:h}=s;var m,b,f,v;const{isError:y,selectedCarouselIndex:C,setSelectedCarouselIndex:T,setErrorIndexes:S,template:q,showVariablePicker:O,hideFooterButton:w,carouselBodyError:B}=c.useTemplateModalContext(),[R,E]=r.useState(p?"Next":"Select template");return r.useEffect((()=>{j?E(j):p&&-1===C?E("Next"):p&&null!=C&&C>-1&&E("Save & Select Template")}),[C]),e.jsxs(x,Object.assign({isWhatsappCarousel:p,justifyContent:p&&(null===(b=null===(m=null==q?void 0:q.mapping)||void 0===m?void 0:m.body)||void 0===b?void 0:b.length)?"space-between":"end"},{children:[i.isRCSChannel((null==q?void 0:q.channel)||n.CHANNEL_TYPE.WHATSAPP)?e.jsx(a.TitleRegular,{}):p&&null!=C&&C>=-1&&!!(null===(v=null===(f=null==q?void 0:q.mapping)||void 0===f?void 0:f.body)||void 0===v?void 0:v.length)&&e.jsx(a.TitleRegular,Object.assign({color:d.COLORS.text.secondary},{children:`Step ${-1===C?1:2}/2`})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[y&&e.jsx(u.Badge,{errorText:B||"Some inputs are missing or incorrect. Please check"}),!y&&h&&e.jsx("div",Object.assign({style:{marginRight:12}},{children:e.jsx(l.Tag,{tagText:h,LeadingIcon:t.default})})),!w&&e.jsx(o.Button,{disabled:O,id:"select-template-btn",buttonText:R,size:p?"small":"large",onClick:function(){p&&-1===C&&T?T(0):(null==S||S([]),g())}})]}))]}))};
15
+ `;exports.default=s=>{let{isWhatsappCarousel:c,onSelect:g,footerButtonText:j,footerInfoText:h}=s;var m,b,f,v;const{isError:y,selectedCarouselIndex:C,setSelectedCarouselIndex:T,setErrorIndexes:S,template:q,showVariablePicker:O,hideFooterButton:w}=p.useTemplateModalContext(),[R,B]=r.useState(c?"Next":"Select template");return r.useEffect((()=>{j?B(j):c&&-1===C?B("Next"):c&&null!=C&&C>-1&&B("Save & Select Template")}),[C]),e.jsxs(x,Object.assign({isWhatsappCarousel:c,justifyContent:c&&(null===(b=null===(m=null==q?void 0:q.mapping)||void 0===m?void 0:m.body)||void 0===b?void 0:b.length)?"space-between":"end"},{children:[o.isRCSChannel((null==q?void 0:q.channel)||n.CHANNEL_TYPE.WHATSAPP)?e.jsx(a.TitleRegular,{}):c&&null!=C&&C>=-1&&!!(null===(v=null===(f=null==q?void 0:q.mapping)||void 0===f?void 0:f.body)||void 0===v?void 0:v.length)&&e.jsx(a.TitleRegular,Object.assign({color:d.COLORS.text.secondary},{children:`Step ${-1===C?1:2}/2`})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[y&&e.jsx(u.Badge,{errorText:"Some inputs are missing or incorrect. Please check"}),!y&&h&&e.jsx("div",Object.assign({style:{marginRight:12}},{children:e.jsx(i.Tag,{tagText:h,LeadingIcon:t.default})})),!w&&e.jsx(l.Button,{disabled:O,id:"select-template-btn",buttonText:R,size:c?"small":"large",onClick:function(){c&&-1===C&&T?T(0):(null==S||S([]),g())}})]}))]}))};
@@ -9,6 +9,5 @@ export interface CarouselProduct {
9
9
  collectionId: string;
10
10
  productName: string;
11
11
  productImage: string;
12
- productDescription?: string;
13
12
  }
14
13
  export type ComponentType = WhatsAppTemplate['components'][0];
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
3
3
  declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default EventsTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
3
3
  declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default IGTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
3
+ import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
4
+ import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
5
5
  declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
6
6
  cacheKey: string;
7
7
  propertyAddBtnText: string;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"../../../../assets/icons/errorInfo.svg.js";import n from"../../../../assets/icons/refresh-purple.svg.js";import{useCallback as r,useState as i,useRef as s,useEffect as l}from"react";import{ZeroState as c}from"../../../zeroState/ZeroState.js";import{useOutside as a}from"../../../../hooks/useOutside.js";import{COLORS as u}from"../../../../constants/Theme.js";import{useDropdown as d}from"../../hooks/useDropdown.js";import{Description as p}from"./description/Description.js";import{FreeFormMenu as h}from"./menu/FreeFormMenu.js";import{MenuList as g}from"./menu/MenuList.js";import{SelectAllMenu as f}from"./menu/SelectAllMenu.js";import m from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as b,MenuListContainer as v}from"./OpennedDropdown.styled.js";import{SearchBox as S}from"./searchbox/SearchBox.js";import{SearchZeroState as j}from"./searchbox/SearchZeroState.js";const O=304,y=290,w=w=>{let{options:x,isSearchable:k,isMultiSelect:C,maxSelections:D,width:L,allowFreeForm:I,height:T,onClose:M,onSelect:E,onSearch:A,version:B,skipSorting:F,headerRef:H,hideSelectAll:R,primaryButtonText:q,onInfiniteScroll:z,onMultiSelectClear:P,onDropdownItemClick:V,buttonOptions:W,isSearchLoading:Z,isOptionsLoading:$,optionsErrorState:K,disableSearchOptions:N,disableSearchedOptionExcept:U,useDefaultCursor:G,containerStyle:J={},zeroState:Q,isDraggable:X=!1,onOptionsReorder:Y,hideClearButton:_=!1}=w;var ee;const te=r((e=>{if(!X||!C)return e;const t=[],o=[];return e.forEach((e=>{if(e.options)o.push(e);else{e.selected?t.push(e):o.push(e)}})),[...t,...o]}),[X,C]),[oe,ne]=i((()=>te(x))),re=s(oe),ie=s(!1),se=s(Y);l((()=>{ne(te(x))}),[x,te]),l((()=>{re.current=oe}),[oe]),l((()=>{se.current=Y}),[Y]),l((()=>()=>{ie.current&&se.current&&se.current(re.current)}),[]);const le=r((e=>{ne(e),"2.0"===B?null==Y||Y(e):ie.current=!0}),[Y,B]),ce=X?oe:x,{dropdownOptions:ae,search:ue,searchedString:de,searchedOptions:pe,searchError:he,retrySearch:ge,onApplyHandler:fe,selectAllHandler:me,onMultiSelectClear:be,onFreeFormSelect:ve,onMultiSelectApply:Se,latestDropdownOptionsRef:je,getSelectedOptions:Oe,getCurrentSelectionCount:ye}=d(B,ce,E,F||X,C,A,N,U,D),[we,xe]=i(null!=L?L:y),[ke,Ce]=i(null),[De,Le]=i(-1),Ie=s(null),Te=s([]),Me=s(null);a(Ie,(()=>{if(Ce(null),C&&"2.0"===B){const e=Oe(je.current);null==M||M(e)}else null==M||M(ae)}),[H,Te]),l((()=>{const e=setTimeout((()=>{Ie.current&&Ie.current.focus({preventScroll:!0})}),0);return()=>clearTimeout(e)}),[]);l((()=>{const e=e=>{const t=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const o=e;o.disabled||t.push(o)}})),t})(de&&A?pe:ae);if(0!==t.length)if("ArrowDown"===e.key)e.preventDefault(),Le((e=>{const o=e<t.length-1?e+1:0;return setTimeout((()=>{var e;const t=null===(e=Me.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${o}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),o}));else if("ArrowUp"===e.key)e.preventDefault(),Le((e=>{const o=e>0?e-1:t.length-1;return setTimeout((()=>{var e;const t=null===(e=Me.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${o}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),o}));else if("Enter"===e.key&&De>=0){e.preventDefault();const o=t[De];o&&(fe(Object.assign(Object.assign({},o),{selected:!o.selected})),V&&V(o))}},t=Ie.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[De,de,pe,ae,A,fe,V]);const Ee=null!=T?T:O,Ae="number"==typeof Ee?k&&C?Ee-96:k&&!C||!k&&C?Ee-48:Ee:Ee;l((()=>{const e=null!=L?L:y;if(null===ke)xe(e);else if("number"==typeof e)xe(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));xe(t)}}),[ke]);const Be=[],Fe=(e=>{if(!C||!D&&0!==D)return e;const t=ye(ae)>=D;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const o=e;return Object.assign(Object.assign({},o),{disabled:o.disabled||!o.selected&&t})}})):e})((de&&A?pe:ae).map((e=>{var t,o;if(de&&!A){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(de.toLowerCase()))&&(Be.push(!de||e.label===de),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(de.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(de.toLowerCase()))?(Be.push(!de||e.label===de),e):null}return e})).filter((e=>null!==e))),He=!!k&&de&&0===Fe.length,Re=!de&&!!$,qe=!de&&!!K&&!Re,ze=!(de||Fe.length||Re||qe),Pe=Re||qe||ze,Ve=(null==Q?void 0:Q.title)||"No results found",We=(null==Q?void 0:Q.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance.",Ze=(null==K?void 0:K.title)||"Failed to load options",$e=(null==K?void 0:K.subTitle)||"Something went wrong while fetching the list. Please try again",Ke={buttonText:"Try again",buttonType:"text",size:"small",buttonTextColor:u.background.inverseLight,customIconColor:u.background.inverseLight,LeadingIcon:n},Ne=Object.assign({IconHolderStyle:{background:u.background.negative.light},Icon:e(o,{color:u.content.negative,width:24,height:24})},K);Ne.actionButton=Object.assign(Object.assign({},Ke),null!==(ee=null==K?void 0:K.actionButton)&&void 0!==ee?ee:{});const Ue=Re?void 0:qe?Ne:Q;return t(b,Object.assign({version:B,ref:Ie,tabIndex:-1,style:Object.assign(Object.assign({width:we},J),{outline:"none"})},{children:[t("div",Object.assign({style:{width:ke?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!k&&e(S,{onSearch:ue,version:B}),Pe?e("div",Object.assign({style:{height:Ee,display:"flex",background:u.background.base}},{children:e(c,Object.assign({},null!=Ue?Ue:{},{isLoading:Re,title:qe?Ze:Ve,subTitle:qe?$e:We}))})):t(v,Object.assign({minHeight:Ee,maxHeight:Ae,ref:Me},{children:[!!C&&!He&&!R&&e(f,{version:B,options:de&&A?pe:ae,onSelect:me}),!I&&He&&e(j,{isLoading:Z,errorMessage:he,onRetry:ge,height:Ae,searchedString:de,containerWidth:L}),I&&(He||!!Be.length&&Be.every((e=>!1===e)))&&e(h,{version:B,isMultiSelect:C,onSelect:ve,searchedString:de}),e(g,{onInfiniteScroll:z,onDropdownItemClick:V,version:B,onSelect:fe,showDescription:function(e,t){Ce(e&&t?{title:e,description:t}:null)},isMultiSelect:C,options:Fe,useDefaultCursor:G,ref:Te,focusedIndex:De,isDraggable:X,onOptionsReorder:le})]})),!!C&&!Pe&&"2.0"!==B&&e(m,{onClear:()=>{be(),null==P||P()},onApply:Se,list:de&&A?pe:ae,buttonText:q,buttonOptions:W,hideClearButton:_})]})),!!ke&&e(p,{title:ke.title,description:ke.description,version:B})]}))};export{w as OpenedDropdown};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"../../../../assets/icons/errorInfo.svg.js";import n from"../../../../assets/icons/refresh-purple.svg.js";import{useCallback as r,useState as i,useRef as s,useEffect as l}from"react";import{ZeroState as c}from"../../../zeroState/ZeroState.js";import{useOutside as a}from"../../../../hooks/useOutside.js";import{COLORS as u}from"../../../../constants/Theme.js";import{useDropdown as d}from"../../hooks/useDropdown.js";import{Description as p}from"./description/Description.js";import{FreeFormMenu as h}from"./menu/FreeFormMenu.js";import{MenuList as g}from"./menu/MenuList.js";import{SelectAllMenu as m}from"./menu/SelectAllMenu.js";import f from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as b,MenuListContainer as v}from"./OpennedDropdown.styled.js";import{SearchBox as S}from"./searchbox/SearchBox.js";import{SearchZeroState as j}from"./searchbox/SearchZeroState.js";const w=304,O=290,y=y=>{let{options:x,isSearchable:C,isMultiSelect:k,maxSelections:D,width:L,allowFreeForm:I,height:T,onClose:E,onSelect:M,onSearch:F,version:A,skipSorting:B,headerRef:H,hideSelectAll:R,primaryButtonText:q,onInfiniteScroll:z,onMultiSelectClear:P,onDropdownItemClick:V,buttonOptions:W,isSearchLoading:Z,isOptionsLoading:$,optionsErrorState:K,disableSearchOptions:N,disableSearchedOptionExcept:U,useDefaultCursor:G,containerStyle:J={},zeroState:Q,isDraggable:X=!1,onOptionsReorder:Y,hideClearButton:_=!1,showCheckboxForCustomElement:ee=!1}=y;var te;const oe=r((e=>{if(!X||!k)return e;const t=[],o=[];return e.forEach((e=>{if(e.options)o.push(e);else{e.selected?t.push(e):o.push(e)}})),[...t,...o]}),[X,k]),[ne,re]=i((()=>oe(x))),ie=s(ne),se=s(!1),le=s(Y);l((()=>{re(oe(x))}),[x,oe]),l((()=>{ie.current=ne}),[ne]),l((()=>{le.current=Y}),[Y]),l((()=>()=>{se.current&&le.current&&le.current(ie.current)}),[]);const ce=r((e=>{re(e),"2.0"===A?null==Y||Y(e):se.current=!0}),[Y,A]),ae=X?ne:x,{dropdownOptions:ue,search:de,searchedString:pe,searchedOptions:he,searchError:ge,retrySearch:me,onApplyHandler:fe,selectAllHandler:be,onMultiSelectClear:ve,onFreeFormSelect:Se,onMultiSelectApply:je,latestDropdownOptionsRef:we,getSelectedOptions:Oe,getCurrentSelectionCount:ye}=d(A,ae,M,B||X,k,F,N,U,D),[xe,Ce]=i(null!=L?L:O),[ke,De]=i(null),[Le,Ie]=i(-1),Te=s(null),Ee=s([]),Me=s(null);a(Te,(()=>{if(De(null),k&&"2.0"===A){const e=Oe(we.current);null==E||E(e)}else null==E||E(ue)}),[H,Ee]),l((()=>{const e=setTimeout((()=>{Te.current&&Te.current.focus({preventScroll:!0})}),0);return()=>clearTimeout(e)}),[]);l((()=>{const e=e=>{const t=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const o=e;o.disabled||t.push(o)}})),t})(pe&&F?he:ue);if(0!==t.length)if("ArrowDown"===e.key)e.preventDefault(),Ie((e=>{const o=e<t.length-1?e+1:0;return setTimeout((()=>{var e;const t=null===(e=Me.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${o}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),o}));else if("ArrowUp"===e.key)e.preventDefault(),Ie((e=>{const o=e>0?e-1:t.length-1;return setTimeout((()=>{var e;const t=null===(e=Me.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${o}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),o}));else if("Enter"===e.key&&Le>=0){e.preventDefault();const o=t[Le];o&&(fe(Object.assign(Object.assign({},o),{selected:!o.selected})),V&&V(o))}},t=Te.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[Le,pe,he,ue,F,fe,V]);const Fe=null!=T?T:w,Ae="number"==typeof Fe?C&&k?Fe-96:C&&!k||!C&&k?Fe-48:Fe:Fe;l((()=>{const e=null!=L?L:O;if(null===ke)Ce(e);else if("number"==typeof e)Ce(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));Ce(t)}}),[ke]);const Be=[],He=(e=>{if(!k||!D&&0!==D)return e;const t=ye(ue)>=D;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const o=e;return Object.assign(Object.assign({},o),{disabled:o.disabled||!o.selected&&t})}})):e})((pe&&F?he:ue).map((e=>{var t,o;if(pe&&!F){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(pe.toLowerCase()))&&(Be.push(!pe||e.label===pe),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(pe.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(pe.toLowerCase()))?(Be.push(!pe||e.label===pe),e):null}return e})).filter((e=>null!==e))),Re=!!C&&pe&&0===He.length,qe=!pe&&!!$,ze=!pe&&!!K&&!qe,Pe=!(pe||He.length||qe||ze),Ve=qe||ze||Pe,We=(null==Q?void 0:Q.title)||"No results found",Ze=(null==Q?void 0:Q.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance.",$e=(null==K?void 0:K.title)||"Failed to load options",Ke=(null==K?void 0:K.subTitle)||"Something went wrong while fetching the list. Please try again",Ne={buttonText:"Try again",buttonType:"text",size:"small",buttonTextColor:u.background.inverseLight,customIconColor:u.background.inverseLight,LeadingIcon:n},Ue=Object.assign({IconHolderStyle:{background:u.background.negative.light},Icon:e(o,{color:u.content.negative,width:24,height:24})},K);Ue.actionButton=Object.assign(Object.assign({},Ne),null!==(te=null==K?void 0:K.actionButton)&&void 0!==te?te:{});const Ge=qe?void 0:ze?Ue:Q;return t(b,Object.assign({version:A,ref:Te,tabIndex:-1,style:Object.assign(Object.assign({width:xe},J),{outline:"none"})},{children:[t("div",Object.assign({style:{width:ke?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!C&&e(S,{onSearch:de,version:A}),Ve?e("div",Object.assign({style:{height:Fe,display:"flex",background:u.background.base}},{children:e(c,Object.assign({},null!=Ge?Ge:{},{isLoading:qe,title:ze?$e:We,subTitle:ze?Ke:Ze}))})):t(v,Object.assign({minHeight:Fe,maxHeight:Ae,ref:Me},{children:[!!k&&!Re&&!R&&e(m,{version:A,options:pe&&F?he:ue,onSelect:be}),!I&&Re&&e(j,{isLoading:Z,errorMessage:ge,onRetry:me,height:Ae,searchedString:pe,containerWidth:L}),I&&(Re||!!Be.length&&Be.every((e=>!1===e)))&&e(h,{version:A,isMultiSelect:k,onSelect:Se,searchedString:pe}),e(g,{onInfiniteScroll:z,onDropdownItemClick:V,version:A,onSelect:fe,showDescription:function(e,t){De(e&&t?{title:e,description:t}:null)},isMultiSelect:k,options:He,useDefaultCursor:G,ref:Ee,focusedIndex:Le,isDraggable:X,onOptionsReorder:ce,showCheckboxForCustomElement:ee})]})),!!k&&!Ve&&"2.0"!==A&&e(f,{onClear:()=>{ve(),null==P||P()},onApply:je,list:pe&&F?he:ue,buttonText:q,buttonOptions:W,hideClearButton:_})]})),!!ke&&e(p,{title:ke.title,description:ke.description,version:A})]}))};export{y as OpenedDropdown};
@@ -17,6 +17,7 @@ interface MenuItemProps {
17
17
  onDrop?: (e: React.DragEvent<HTMLDivElement>) => void;
18
18
  onDragEnd?: (e: React.DragEvent<HTMLDivElement>) => void;
19
19
  isDraggedOver?: boolean;
20
+ showCheckboxForCustomElement?: boolean;
20
21
  }
21
22
  export declare const MenuItem: import("react").ForwardRefExoticComponent<MenuItemProps & import("react").RefAttributes<HTMLDivElement>>;
22
23
  export {};
@@ -1,16 +1,16 @@
1
- import{jsx as e,Fragment as n,jsxs as o}from"react/jsx-runtime";import t from"../../../../../assets/icons/chevronRight.svg.js";import{forwardRef as r,useState as i}from"react";import l from"styled-components";import{CheckBox as a}from"../../../../checkBox/CheckBox.js";import{ListItem as s}from"../../../../list-item/ListItem.js";import{Tooltip as d}from"../../../../tooltips/Tooltip.js";import{BodyCaption as c}from"../../../../TypographyStyle.js";import{DEFAULT_THEME as p,COLORS as g}from"../../../../../constants/Theme.js";import{FreeFormContainer as m}from"./FreeFormMenu.styled.js";const u=l(s)`
1
+ import{jsx as e,Fragment as o,jsxs as n}from"react/jsx-runtime";import t from"../../../../../assets/icons/chevronRight.svg.js";import{forwardRef as r,useState as i}from"react";import s from"styled-components";import{CheckBox as l}from"../../../../checkBox/CheckBox.js";import{ListItem as a}from"../../../../list-item/ListItem.js";import{Tooltip as d}from"../../../../tooltips/Tooltip.js";import{BodyCaption as c}from"../../../../TypographyStyle.js";import{DEFAULT_THEME as p,COLORS as g}from"../../../../../constants/Theme.js";import{FreeFormContainer as m}from"./FreeFormMenu.styled.js";const u=s(a)`
2
2
  padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
3
3
  cursor: pointer;
4
4
  margin-top: ${e=>"2.0"===e.version?"2px":"0"};
5
- `,v=l.div`
5
+ `,h=s.div`
6
6
  box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.12);
7
- border-radius: ${e=>{let{version:n}=e;return"1.0"===n?"0":"8px"}};
8
- padding: ${e=>{let{version:n}=e;return"1.0"===n?"0":"4px"}};
7
+ border-radius: ${e=>{let{version:o}=e;return"1.0"===o?"0":"8px"}};
8
+ padding: ${e=>{let{version:o}=e;return"1.0"===o?"0":"4px"}};
9
9
  min-width: 148px;
10
- border: ${e=>{let{version:n}=e;return"1.0"===n?`1px solid ${p.colorsV2.stroke.primary}`:"none"}};
10
+ border: ${e=>{let{version:o}=e;return"1.0"===o?`1px solid ${p.colorsV2.stroke.primary}`:"none"}};
11
11
  max-height: 248px;
12
12
  overflow-y: auto;
13
- `,h=l.div`
13
+ `,v=s.div`
14
14
  display: grid;
15
15
  grid-template-columns: repeat(2, 2.86px);
16
16
  grid-template-rows: repeat(3, 2.86px);
@@ -22,22 +22,22 @@ import{jsx as e,Fragment as n,jsxs as o}from"react/jsx-runtime";import t from"..
22
22
  align-self: center;
23
23
  height: fit-content;
24
24
  min-height: 18px;
25
- `,x=l.div`
25
+ `,b=s.div`
26
26
  width: 2.86px;
27
27
  height: 2.86px;
28
28
  border-radius: 50%;
29
29
  background-color: ${g.content.inactive};
30
30
  flex-shrink: 0;
31
- `,b=l.div`
31
+ `,x=s.div`
32
32
  display: flex;
33
33
  align-content: center;
34
34
  justify-content: center;
35
35
  gap: 8px;
36
- `,f=l.div`
36
+ `,f=s.div`
37
37
  margin-right: -4px;
38
- `,D=l.div`
38
+ `,D=s.div`
39
39
  display: flex;
40
40
  align-items: center;
41
41
  flex-direction: column;
42
42
  flex: 1;
43
- `,j=n=>{let{onDragStart:t,onDragEnd:r}=n;return o(h,Object.assign({draggable:!0,onDragStart:t,onDragEnd:r},{children:[e(x,{}),e(x,{}),e(x,{}),e(x,{}),e(x,{}),e(x,{})]}))},y=r(((r,l)=>{let{option:s,isMultiSelect:h,showDescription:x,onSelect:y,last:I,version:O,onDropdownItemClick:C,useDefaultCursor:k,isFocused:w=!1,dataIndex:T=-1,isDraggable:$=!1,onDragStart:S,onDragOver:E,onDrop:F,onDragEnd:M,isDraggedOver:L=!1}=r;var B;const[A,V]=i(s.selected),z=(e,n)=>{if(!e.children){R(!e.selected);const o=n?Object.assign(Object.assign({},e),{parent:n}):e;null==C||C(o)}},R=e=>{s.disabled||y(Object.assign(Object.assign({},s),{selected:e}))},U=k?{cursor:"default"}:{};return e(n,{children:e(d,Object.assign({body:"",tooltipContent:s.children?e("div",Object.assign({style:{backgroundColor:p.colorsV2.surface.standard},ref:l,onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1)},{children:e(v,Object.assign({version:null!=O?O:"2.0"},{children:s.children.map((n=>{var o;return e(u,{version:O,style:"1.0"!==O&&(null!==(o=null==s?void 0:s.children)&&void 0!==o?o:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),z(n,s)},listItem:{value:n.value,label:n.label},subText:n.subText,leadingIcon:n.leadingIcon||void 0,customComponent:n.customComponent,trailingIcon:n.trailingIcon||void 0,variant:s.disabled?"inactive":n.selected?"selected":"default"},n.value)}))}))})):e(n,{}),placement:"right-start",hideArrow:!0},{children:e(u,{version:O,style:I?Object.assign(Object.assign({borderBottom:0},U),L?{borderTop:`2px solid ${g.content.brand}`,opacity:.5}:{}):Object.assign(Object.assign({},U),L?{borderTop:`2px solid ${g.content.brand}`,opacity:.5}:{}),onClick:e=>{e.preventDefault(),z(s)},onMouseOver:()=>{s.description?x(s.label,s.description):x()},listItem:{value:s.value,label:s.label},subText:s.subText,"data-option-index":T,role:"option",id:`dropdown-option-${T}`,"aria-selected":!!s.selected,onDragOver:$?E:void 0,onDrop:$?F:void 0,leadingIcon:h?o(b,{children:[$&&e(j,{onDragStart:S,onDragEnd:M}),e(a,{size:"2.0"===O?"SMALL":"DEFAULT",isDisabled:null!==(B=s.disabled)&&void 0!==B&&B,isChecked:!!s.selected,onValueChange:R}),e(f,{children:s.leadingIcon})]}):$?o(D,{children:[e(j,{onDragStart:S,onDragEnd:M}),s.leadingIcon&&e("div",{children:s.leadingIcon})]}):s.leadingIcon?e(n,{children:s.leadingIcon}):void 0,customComponent:s.customComponent,trailingIcon:s.isFreeForm?e(m,{children:e(c,Object.assign({style:{color:g.content.secondary}},{children:"Freeform"}))}):s.children?e(t,{width:12,height:12}):s.trailingIcon?e(n,{children:s.trailingIcon}):void 0,variant:s.disabled?"inactive":w||s.selected||!h&&A?"selected":"default"})}))})}));export{y as MenuItem};
43
+ `,j=o=>{let{onDragStart:t,onDragEnd:r}=o;return n(v,Object.assign({draggable:!0,onDragStart:t,onDragEnd:r},{children:[e(b,{}),e(b,{}),e(b,{}),e(b,{}),e(b,{}),e(b,{})]}))},C=r(((r,s)=>{let{option:a,isMultiSelect:v,showDescription:b,onSelect:C,last:y,version:I,onDropdownItemClick:O,useDefaultCursor:k,isFocused:w=!1,dataIndex:S=-1,isDraggable:T=!1,onDragStart:E,onDragOver:$,onDrop:F,onDragEnd:L,isDraggedOver:M=!1,showCheckboxForCustomElement:A=!1}=r;var B,V;const[z,U]=i(a.selected),R=(e,o)=>{if(!e.children){q(!e.selected);const n=o?Object.assign(Object.assign({},e),{parent:o}):e;null==O||O(n)}},q=e=>{a.disabled||C(Object.assign(Object.assign({},a),{selected:e}))},G=k?{cursor:"default"}:{};return e(o,{children:e(d,Object.assign({body:"",tooltipContent:a.children?e("div",Object.assign({style:{backgroundColor:p.colorsV2.surface.standard},ref:s,onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1)},{children:e(h,Object.assign({version:null!=I?I:"2.0"},{children:a.children.map((o=>{var n;return e(u,{version:I,style:"1.0"!==I&&(null!==(n=null==a?void 0:a.children)&&void 0!==n?n:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),R(o,a)},listItem:{value:o.value,label:o.label},subText:o.subText,leadingIcon:o.leadingIcon||void 0,customComponent:o.customComponent,trailingIcon:o.trailingIcon||void 0,variant:a.disabled?"inactive":o.selected?"selected":"default"},o.value)}))}))})):e(o,{}),placement:"right-start",hideArrow:!0},{children:e(u,{version:I,style:y?Object.assign(Object.assign({borderBottom:0},G),M?{borderTop:`2px solid ${g.content.brand}`,opacity:.5}:{}):Object.assign(Object.assign({},G),M?{borderTop:`2px solid ${g.content.brand}`,opacity:.5}:{}),onClick:e=>{e.preventDefault(),R(a)},onMouseOver:()=>{a.description?b(a.label,a.description):b()},listItem:{value:a.value,label:a.label},subText:a.subText,"data-option-index":S,role:"option",id:`dropdown-option-${S}`,"aria-selected":!!a.selected,onDragOver:T?$:void 0,onDrop:T?F:void 0,leadingIcon:!v||A&&a.customComponent?T?n(D,{children:[e(j,{onDragStart:E,onDragEnd:L}),a.leadingIcon&&e("div",{children:a.leadingIcon})]}):a.leadingIcon?e(o,{children:a.leadingIcon}):void 0:n(x,{children:[T&&e(j,{onDragStart:E,onDragEnd:L}),e(l,{size:"2.0"===I?"SMALL":"DEFAULT",isDisabled:null!==(B=a.disabled)&&void 0!==B&&B,isChecked:!!a.selected,onValueChange:q}),e(f,{children:a.leadingIcon})]}),customComponent:v&&A&&a.customComponent?n(x,{children:[T&&e(j,{onDragStart:E,onDragEnd:L}),e(l,{size:"2.0"===I?"SMALL":"DEFAULT",isDisabled:null!==(V=a.disabled)&&void 0!==V&&V,isChecked:!!a.selected,onValueChange:q}),a.customComponent]}):a.customComponent,trailingIcon:a.isFreeForm?e(m,{children:e(c,Object.assign({style:{color:g.content.secondary}},{children:"Freeform"}))}):a.children?e(t,{width:12,height:12}):a.trailingIcon?e(o,{children:a.trailingIcon}):void 0,variant:a.disabled?"inactive":w||a.selected||!v&&z?"selected":"default"})}))})}));export{C as MenuItem};
@@ -12,6 +12,7 @@ interface MenuListProps {
12
12
  focusedIndex?: number;
13
13
  isDraggable?: boolean;
14
14
  onOptionsReorder?: (reorderedOptions: DropdownOption[]) => void;
15
+ showCheckboxForCustomElement?: boolean;
15
16
  }
16
17
  export declare const MenuList: import("react").ForwardRefExoticComponent<MenuListProps & import("react").RefAttributes<HTMLDivElement[]>>;
17
18
  export {};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import{forwardRef as r,useRef as o,useState as s,useCallback as l,useEffect as i}from"react";import{MenuItem as c}from"./MenuItem.js";import{StyledGroupedLabel as a}from"./MenuList.styled.js";const u=r(((r,u)=>{let{options:d,isMultiSelect:p,showDescription:f,onSelect:g,version:m,onInfiniteScroll:D,onDropdownItemClick:b,useDefaultCursor:v,focusedIndex:h=-1,isDraggable:I=!1,onOptionsReorder:w}=r;const j=o(null),S=o(null),[O,C]=s(null),[M,x]=s(null),y=l((()=>{j.current&&j.current.disconnect(),j.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==D||D())})),S.current&&j.current.observe(S.current)}),[D]);i((()=>(y(),()=>{j.current&&j.current.disconnect()})),[y,d]);const E=l((e=>n=>{I&&(C(e),n.dataTransfer.effectAllowed="move")}),[I]),k=l((e=>n=>{I&&(n.preventDefault(),n.dataTransfer.dropEffect="move",x(e))}),[I]),T=l((e=>n=>{if(I&&null!==O){if(n.preventDefault(),O!==e){const n=[...d],[t]=n.splice(O,1);n.splice(e,0,t),null==w||w(n)}C(null),x(null)}}),[I,O,d,w]),F=l((()=>{C(null),x(null)}),[]),R=new Map;let $=-1;return d.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||($++,R.set(e,$))}));else{const n=e;n.disabled||($++,R.set(n,$))}})),e(n,{children:d.map(((n,r)=>{const o=r===d.length-1;if(n.options){const s=n;return t("div",Object.assign({style:{marginTop:"2.0"===m?2:0}},{children:[t(a,Object.assign({version:m},{children:[s.leadingIcon?e("span",Object.assign({style:{marginRight:8}},{children:s.leadingIcon})):null,s.label]})),s.options.map(((n,t)=>{const o=R.get(n),l=o===h&&!n.disabled;return e(c,{version:m,last:t===s.options.length-1,onSelect:g,showDescription:f,onDropdownItemClick:b,isMultiSelect:p,option:n,useDefaultCursor:v,isFocused:l,dataIndex:o,isDraggable:!1,ref:e=>{u&&"object"==typeof u&&u.current&&e&&e&&e&&e&&(u.current[r]=e)}},`${r}-${t}`)})),o?e("span",{ref:S}):null]}),r)}const s=n,l=R.get(s),i=l===h&&!s.disabled;return t("div",{children:[e(c,{version:m,last:o,onSelect:g,showDescription:f,onDropdownItemClick:b,isMultiSelect:p,option:s,useDefaultCursor:v,isFocused:i,dataIndex:l,isDraggable:I,onDragStart:E(r),onDragOver:k(r),onDrop:T(r),onDragEnd:F,isDraggedOver:M===r,ref:e=>{u&&"object"==typeof u&&u.current&&e&&(u.current[r]=e)}},s.value),o?e("span",{ref:S}):null]},r)}))})}));export{u as MenuList};
1
+ import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import{forwardRef as r,useRef as o,useState as s,useCallback as l,useEffect as i}from"react";import{MenuItem as c}from"./MenuItem.js";import{StyledGroupedLabel as u}from"./MenuList.styled.js";const a=r(((r,a)=>{let{options:d,isMultiSelect:p,showDescription:f,onSelect:m,version:g,onInfiniteScroll:h,onDropdownItemClick:D,useDefaultCursor:b,focusedIndex:v=-1,isDraggable:w=!1,onOptionsReorder:C,showCheckboxForCustomElement:I=!1}=r;const j=o(null),x=o(null),[S,E]=s(null),[O,k]=s(null),M=l((()=>{j.current&&j.current.disconnect(),j.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==h||h())})),x.current&&j.current.observe(x.current)}),[h]);i((()=>(M(),()=>{j.current&&j.current.disconnect()})),[M,d]);const y=l((e=>n=>{w&&(E(e),n.dataTransfer.effectAllowed="move")}),[w]),F=l((e=>n=>{w&&(n.preventDefault(),n.dataTransfer.dropEffect="move",k(e))}),[w]),T=l((e=>n=>{if(w&&null!==S){if(n.preventDefault(),S!==e){const n=[...d],[t]=n.splice(S,1);n.splice(e,0,t),null==C||C(n)}E(null),k(null)}}),[w,S,d,C]),R=l((()=>{E(null),k(null)}),[]),$=new Map;let A=-1;return d.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||(A++,$.set(e,A))}));else{const n=e;n.disabled||(A++,$.set(n,A))}})),e(n,{children:d.map(((n,r)=>{const o=r===d.length-1;if(n.options){const s=n;return t("div",Object.assign({style:{marginTop:"2.0"===g?2:0}},{children:[t(u,Object.assign({version:g},{children:[s.leadingIcon?e("span",Object.assign({style:{marginRight:8}},{children:s.leadingIcon})):null,s.label]})),s.options.map(((n,t)=>{const o=$.get(n),l=o===v&&!n.disabled;return e(c,{version:g,last:t===s.options.length-1,onSelect:m,showDescription:f,onDropdownItemClick:D,isMultiSelect:p,option:n,useDefaultCursor:b,isFocused:l,dataIndex:o,isDraggable:!1,showCheckboxForCustomElement:I,ref:e=>{a&&"object"==typeof a&&a.current&&e&&e&&e&&e&&(a.current[r]=e)}},`${r}-${t}`)})),o?e("span",{ref:x}):null]}),r)}const s=n,l=$.get(s),i=l===v&&!s.disabled;return t("div",{children:[e(c,{version:g,last:o,onSelect:m,showDescription:f,onDropdownItemClick:D,isMultiSelect:p,option:s,useDefaultCursor:b,isFocused:i,dataIndex:l,isDraggable:w,onDragStart:y(r),onDragOver:F(r),onDrop:T(r),onDragEnd:R,isDraggedOver:O===r,showCheckboxForCustomElement:I,ref:e=>{a&&"object"==typeof a&&a.current&&e&&(a.current[r]=e)}},s.value),o?e("span",{ref:x}):null]},r)}))})}));export{a as MenuList};
@@ -56,6 +56,8 @@ export interface OpenDropdownProps {
56
56
  onOptionsReorder?: (reorderedOptions: DropdownOption[]) => void;
57
57
  /** z-index of the dropdown popover. Defaults to 3. */
58
58
  dropdownZIndex?: number;
59
+ /** When true, renders a checkbox alongside the customComponent in multiselect mode */
60
+ showCheckboxForCustomElement?: boolean;
59
61
  }
60
62
  export type GroupedOption = {
61
63
  label?: string;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as o,Fragment as l}from"react/jsx-runtime";import t from"lodash/cloneDeep";import{useEffect as i,useState as r,useRef as n,useMemo as a}from"react";import s from"../../utils/StringUtils.js";import{COLORS as d}from"../../constants/Theme.js";import{StyledModal as u}from"../modals/styledModal.js";import{determineCardIndex as c,isItCarousal as p,isRCSChannel as m}from"../template-preview/helpers/templateMiscHelper.js";import{CHANNEL_TYPE as v}from"../template-preview/models/Channels.js";import{TEMPLATE_QUALITY as h,POD as f}from"../template-preview/models/WhatsAppTemplate.js";import{TemplateModalContext as b}from"./context/templateModalContext.js";import C from"./modalElements/Footer.js";import{TemplateAnalyticsComponent as g}from"./modalElements/TemplateAnalyticsComponent.js";import x from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as y}from"./utils/convertPlaceholdersToBikDropdown.js";const E=E=>{var P,I,S,T,D,w,V,k;const{selectedTemplate:j,closeDialog:B,showVariableMapping:L,channel:A,htmlContent:M,templateVariables:H,onTemplateSelect:O,globalPlaceholders:F,showOnlyContent:W,whatsappSpecificPickerMeta:$,zIndex:N,showVariableModal:z,variableList:Q,discountCode:R,setDiscountCode:U,onBackPress:_,enabledCustomText:Y,variableListForImage:q,showSampleValues:G,disableEditVariable:J,pod:K,extras:X,pickerConf:Z,selectedCarouselProducts:ee,disableEditExpiry:oe,cardWidth:le,onDeleteSelectedProducts:te,fileName:ie,setFileName:re,hideDeviceContainerInPreview:ne,maxCharLimit:ae,onDefaultVariableSelect:se,skipDefaultVariableContent:de,disableDatePicker:ue,disableCopyCode:ce,initialExpiryDateTime:pe,showDiscountCodeExpiryInfo:me,footerButtonText:ve,footerInfoText:he,templateAnalytics:fe}=E;i((()=>{Se(M)}),[M]);const be=c(A),Ce=p(A,j),ge=null==j?void 0:j.isProductCarouselType,[xe,ye]=r(A===v.EMAIL||A==v.WEBPUSH||Ce?"desktop":"mobile"),[Ee,Pe]=r(!1),[Ie,Se]=r(M),[Te,De]=r(!1),[we,Ve]=r([]),[ke,je]=r({}),[Be,Le]=r(j),[Ae,Me]=r([]),[He,Oe]=r(null),[Fe,We]=r(!1),[$e,Ne]=r(null!=H?H:[]),[ze,Qe]=r(!1),[Re,Ue]=r(Ce?(null===(I=null===(P=null==Be?void 0:Be.mapping)||void 0===P?void 0:P.body)||void 0===I?void 0:I.length)?-1:0:-1),[_e,Ye]=r([]),[qe,Ge]=r(void 0),Je=n(null),[Ke,Xe]=r(!1),[Ze,eo]=r(!1),[oo,lo]=r(!1),[to,io]=r(!0),[ro,no]=r(!0),[ao,so]=r({}),[uo,co]=r("");i((()=>{ee?Ye(ee):ge&&Ye([])}),[ee]),i((()=>{var e;if(!Fe&&ge&&(!ee||0===Ye.length)){const o=null===(e=null==Be?void 0:Be.components)||void 0===e?void 0:e[be].cards,l=[];null==o||o.forEach((e=>{var o;null===(o=null==e?void 0:e.components)||void 0===o||o.forEach((e=>{var o,t,i;"HEADER"===e.type&&l.push(null!==(i=null===(t=null===(o=e.example)||void 0===o?void 0:o.header_handle)||void 0===t?void 0:t[0])&&void 0!==i?i:"")}))})),Me(l),We(!0)}}),[Fe]);const po=a((()=>y(F)),[F]);return i((()=>{Ge(t(Q))}),[Q]),(null==fe?void 0:fe.show)&&to&&fe.templateQuality&&Object.values(h).find((e=>e===String(fe.templateQuality)))?e(g,{headingTitle:null==Be?void 0:Be.label,headingSubtitle:A===v.WHATSAPP?`${s.capitaliseFirstLetterOfString(null!==(S=null==Be?void 0:Be.category)&&void 0!==S?S:"")} • ${null!==(T=null==Be?void 0:Be.templateCategory)&&void 0!==T?T:""}`:"",templateAnalytics:fe,analyticsData:fe.data,onClose:()=>{null==B||B(),io(!1),no(!1)},onCancel:()=>{io(!1),no(!1)},onProceed:()=>{io(!1),no(!0)},templateId:(null==Be?void 0:Be.templateId)||""}):e(b.Provider,Object.assign({value:{hideFooterButton:oo,setHideFooterButton:lo,hideCrossButton:Ze,setHideCrossButton:eo,variableList:qe,setVariableList:Ge,variableCallback:He,setVariableCallback:Oe,showVariablePicker:Ee,setShowVariablePicker:Pe,template:Be,setTemplate:Le,device:xe,setDevice:ye,display_content:Ie,setDisplayContent:Se,originalVariableList:$e,setOriginalVariableList:Ne,isError:Te,setIsError:De,channel:A,globalNormalizedPlaceholders:po,templateSelectionTriggered:ze,setTemplateSelectionTriggered:Qe,enabledCustomText:Y,disableEditVariable:J,pod:K,extras:X,isWhatsappCarousel:Ce,selectedCarouselIndex:Re,setSelectedCarouselIndex:Ue,isProductCarouselType:ge,templateErrorIndexes:ke,cardCount:Ce?null===(w=null===(D=j.components)||void 0===D?void 0:D[be].cards)||void 0===w?void 0:w.length:void 0,errorIndexes:we,setErrorIndexes:Ve,pickerConf:Z,carouselProducts:_e,setCarouselProducts:Ye,disableEditExpiry:oe,cardWidth:le,cardImages:Ae,onDeleteSelectedProducts:te,hideDeviceContainerInPreview:ne,sliderRef:Je,isCarouselHovered:Ke,setIsCarouselHovered:Xe,maxCharLimit:ae,ctaOptionsErrors:ao,setCtaOptionsErrors:so,onDefaultVariableSelect:se,carouselBodyError:uo,setCarouselBodyError:co,disableDatePicker:ue,disableCopyCode:ce,initialExpiryDateTime:pe,showDiscountCodeExpiryInfo:me,cardIndex:be}},{children:W?e(x,{variableListFromProps:Q,channel:v.EMAIL,hideHeader:!0}):o(u,Object.assign({hideCrossButton:Ze,zIndex:N,centralContainerStyles:{width:Ce?900:A===v.EMAIL&&L?1e3:800},open:ro,onClose:()=>{no(!1),null==B||B()},headingTitle:null==Be?void 0:Be.label,headingSubtitle:A===v.WHATSAPP||m(A)?`${s.capitaliseFirstLetterOfString(null!==(V=null==Be?void 0:Be.category)&&void 0!==V?V:"")} • ${null!==(k=null==Be?void 0:Be.templateCategory)&&void 0!==k?k:""}`:"",onBackPress:()=>{if(null==fe?void 0:fe.show)return io(!0),void no(!1);null==_||_()},modalHeaderStyles:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:[e(x,{variableListFromProps:Q,showSampleValues:G,showVariableMapping:L,channel:A,whatsappSpecificPickerMeta:$,showVariableModal:z,discountCode:R,setDiscountCode:U,variableListForImage:q&&(null==q?void 0:q.length)>0?q:qe,fileName:ie,setFileName:e=>{null==re||re(e)},skipDefaultVariableContent:de}),O?e(C,{isWhatsappCarousel:null!=Ce&&Ce,onSelect:function(){var e,o;if(co(""),(null==_e?void 0:_e.length)<1&&ge)return void De(!0);if(Object.keys(ao).length>0&&K!==f.CHATBOT)return void De(!0);if(ge&&(null!==(e=null==_e?void 0:_e.length)&&void 0!==e?e:0)>0){const e=function(e,o,l){var t,i,r,n,a,s,d,u,c,p;const m=null===(i=null===(t=null==e?void 0:e.components)||void 0===t?void 0:t[l])||void 0===i?void 0:i.cards;if(!(null==m?void 0:m.length)||!(null==o?void 0:o.length))return"";const v=null!==(s=null===(a=null===(n=null===(r=m[0])||void 0===r?void 0:r.components)||void 0===n?void 0:n.find((e=>"BODY"===e.type)))||void 0===a?void 0:a.text)&&void 0!==s?s:"";if(!v)return"";const h=null!==(p=null===(c=null===(u=null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)||void 0===u?void 0:u[0])||void 0===c?void 0:c.body)&&void 0!==p?p:[];if(!h.length)return"";const f={"{{product.name}}":"productName","{{product.description}}":"productDescription"};for(const e of o){let o=v;for(let l=0;l<h.length;l++){const t=h[l],i=f[t];if(void 0===i)continue;const r=e[i];if(!r)return`Variable ${t} is missing for product "${e.productName}".`;o=o.replace(`{{${l+1}}}`,r)}if(o.length>160)return"Selected products description/name making the description more than 160."}return""}(Be,_e,be);if(e)return co(e),void De(!0)}const l=null==O?void 0:O(Be,$e,null!=Ie?Ie:"",_e);je(null!==(o=null==l?void 0:l.templateErrorIndexes)&&void 0!==o?o:{body:[],buttons:[]}),(null==l?void 0:l.errorIndexes)||(null==l?void 0:l.error)?((null==l?void 0:l.errorIndexes)&&Ve(l.errorIndexes),(null==l?void 0:l.error)&&De(!!(null==l?void 0:l.error))):Qe(!0)},footerButtonText:ve,footerInfoText:he}):e(l,{})]}))}))};export{E as TemplateContextMapper};
1
+ import{jsx as e,jsxs as l,Fragment as t}from"react/jsx-runtime";import o from"lodash/cloneDeep";import{useEffect as i,useState as a,useRef as r,useMemo as n}from"react";import s from"../../utils/StringUtils.js";import{COLORS as d}from"../../constants/Theme.js";import{StyledModal as p}from"../modals/styledModal.js";import{determineCardIndex as u,isItCarousal as c,isRCSChannel as m}from"../template-preview/helpers/templateMiscHelper.js";import{CHANNEL_TYPE as v}from"../template-preview/models/Channels.js";import{TEMPLATE_QUALITY as h,POD as b}from"../template-preview/models/WhatsAppTemplate.js";import{TemplateModalContext as C}from"./context/templateModalContext.js";import f from"./modalElements/Footer.js";import{TemplateAnalyticsComponent as g}from"./modalElements/TemplateAnalyticsComponent.js";import x from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as y}from"./utils/convertPlaceholdersToBikDropdown.js";const P=P=>{var E,I,T,S,D,w,V,k;const{selectedTemplate:j,closeDialog:L,showVariableMapping:A,channel:B,htmlContent:M,templateVariables:H,onTemplateSelect:F,globalPlaceholders:O,showOnlyContent:W,whatsappSpecificPickerMeta:N,zIndex:$,showVariableModal:z,variableList:Q,discountCode:R,setDiscountCode:U,onBackPress:_,enabledCustomText:q,variableListForImage:G,showSampleValues:J,disableEditVariable:K,pod:X,extras:Y,pickerConf:Z,selectedCarouselProducts:ee,disableEditExpiry:le,cardWidth:te,onDeleteSelectedProducts:oe,fileName:ie,setFileName:ae,hideDeviceContainerInPreview:re,maxCharLimit:ne,onDefaultVariableSelect:se,skipDefaultVariableContent:de,disableDatePicker:pe,disableCopyCode:ue,initialExpiryDateTime:ce,showDiscountCodeExpiryInfo:me,footerButtonText:ve,footerInfoText:he,templateAnalytics:be}=P;i((()=>{Te(M)}),[M]);const Ce=u(B),fe=c(B,j),ge=null==j?void 0:j.isProductCarouselType,[xe,ye]=a(B===v.EMAIL||B==v.WEBPUSH||fe?"desktop":"mobile"),[Pe,Ee]=a(!1),[Ie,Te]=a(M),[Se,De]=a(!1),[we,Ve]=a([]),[ke,je]=a({}),[Le,Ae]=a(j),[Be,Me]=a([]),[He,Fe]=a(null),[Oe,We]=a(!1),[Ne,$e]=a(null!=H?H:[]),[ze,Qe]=a(!1),[Re,Ue]=a(fe?(null===(I=null===(E=null==Le?void 0:Le.mapping)||void 0===E?void 0:E.body)||void 0===I?void 0:I.length)?-1:0:-1),[_e,qe]=a([]),[Ge,Je]=a(void 0),Ke=r(null),[Xe,Ye]=a(!1),[Ze,el]=a(!1),[ll,tl]=a(!1),[ol,il]=a(!0),[al,rl]=a(!0),[nl,sl]=a({});i((()=>{ee?qe(ee):ge&&qe([])}),[ee]),i((()=>{var e;if(!Oe&&ge&&(!ee||0===qe.length)){const l=null===(e=null==Le?void 0:Le.components)||void 0===e?void 0:e[Ce].cards,t=[];null==l||l.forEach((e=>{var l;null===(l=null==e?void 0:e.components)||void 0===l||l.forEach((e=>{var l,o,i;"HEADER"===e.type&&t.push(null!==(i=null===(o=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===o?void 0:o[0])&&void 0!==i?i:"")}))})),Me(t),We(!0)}}),[Oe]);const dl=n((()=>y(O)),[O]);return i((()=>{Je(o(Q))}),[Q]),(null==be?void 0:be.show)&&ol&&be.templateQuality&&Object.values(h).find((e=>e===String(be.templateQuality)))?e(g,{headingTitle:null==Le?void 0:Le.label,headingSubtitle:B===v.WHATSAPP?`${s.capitaliseFirstLetterOfString(null!==(T=null==Le?void 0:Le.category)&&void 0!==T?T:"")} • ${null!==(S=null==Le?void 0:Le.templateCategory)&&void 0!==S?S:""}`:"",templateAnalytics:be,analyticsData:be.data,onClose:()=>{null==L||L(),il(!1),rl(!1)},onCancel:()=>{il(!1),rl(!1)},onProceed:()=>{il(!1),rl(!0)},templateId:(null==Le?void 0:Le.templateId)||""}):e(C.Provider,Object.assign({value:{hideFooterButton:ll,setHideFooterButton:tl,hideCrossButton:Ze,setHideCrossButton:el,variableList:Ge,setVariableList:Je,variableCallback:He,setVariableCallback:Fe,showVariablePicker:Pe,setShowVariablePicker:Ee,template:Le,setTemplate:Ae,device:xe,setDevice:ye,display_content:Ie,setDisplayContent:Te,originalVariableList:Ne,setOriginalVariableList:$e,isError:Se,setIsError:De,channel:B,globalNormalizedPlaceholders:dl,templateSelectionTriggered:ze,setTemplateSelectionTriggered:Qe,enabledCustomText:q,disableEditVariable:K,pod:X,extras:Y,isWhatsappCarousel:fe,selectedCarouselIndex:Re,setSelectedCarouselIndex:Ue,isProductCarouselType:ge,templateErrorIndexes:ke,cardCount:fe?null===(w=null===(D=j.components)||void 0===D?void 0:D[Ce].cards)||void 0===w?void 0:w.length:void 0,errorIndexes:we,setErrorIndexes:Ve,pickerConf:Z,carouselProducts:_e,setCarouselProducts:qe,disableEditExpiry:le,cardWidth:te,cardImages:Be,onDeleteSelectedProducts:oe,hideDeviceContainerInPreview:re,sliderRef:Ke,isCarouselHovered:Xe,setIsCarouselHovered:Ye,maxCharLimit:ne,ctaOptionsErrors:nl,setCtaOptionsErrors:sl,onDefaultVariableSelect:se,disableDatePicker:pe,disableCopyCode:ue,initialExpiryDateTime:ce,showDiscountCodeExpiryInfo:me,cardIndex:Ce}},{children:W?e(x,{variableListFromProps:Q,channel:v.EMAIL,hideHeader:!0}):l(p,Object.assign({hideCrossButton:Ze,zIndex:$,centralContainerStyles:{width:fe?900:B===v.EMAIL&&A?1e3:800},open:al,onClose:()=>{rl(!1),null==L||L()},headingTitle:null==Le?void 0:Le.label,headingSubtitle:B===v.WHATSAPP||m(B)?`${s.capitaliseFirstLetterOfString(null!==(V=null==Le?void 0:Le.category)&&void 0!==V?V:"")} • ${null!==(k=null==Le?void 0:Le.templateCategory)&&void 0!==k?k:""}`:"",onBackPress:()=>{if(null==be?void 0:be.show)return il(!0),void rl(!1);null==_||_()},modalHeaderStyles:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:[e(x,{variableListFromProps:Q,showSampleValues:J,showVariableMapping:A,channel:B,whatsappSpecificPickerMeta:N,showVariableModal:z,discountCode:R,setDiscountCode:U,variableListForImage:G&&(null==G?void 0:G.length)>0?G:Ge,fileName:ie,setFileName:e=>{null==ae||ae(e)},skipDefaultVariableContent:de}),F?e(f,{isWhatsappCarousel:null!=fe&&fe,onSelect:function(){var e;if((null==_e?void 0:_e.length)<1&&ge)return void De(!0);if(Object.keys(nl).length>0&&X!==b.CHATBOT)return void De(!0);const l=null==F?void 0:F(Le,Ne,null!=Ie?Ie:"",_e);je(null!==(e=null==l?void 0:l.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==l?void 0:l.errorIndexes)||(null==l?void 0:l.error)?((null==l?void 0:l.errorIndexes)&&Ve(l.errorIndexes),(null==l?void 0:l.error)&&De(!!(null==l?void 0:l.error))):Qe(!0)},footerButtonText:ve,footerInfoText:he}):e(t,{})]}))}))};export{P as TemplateContextMapper};
@@ -80,8 +80,6 @@ export declare const TemplateModalContext: React.Context<{
80
80
  [key: string]: string;
81
81
  }>> | undefined;
82
82
  onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
83
- carouselBodyError?: string | undefined;
84
- setCarouselBodyError?: React.Dispatch<React.SetStateAction<string>> | undefined;
85
83
  cardIndex: number;
86
84
  }>;
87
85
  export declare const useTemplateModalContext: () => {
@@ -155,7 +153,5 @@ export declare const useTemplateModalContext: () => {
155
153
  [key: string]: string;
156
154
  }>> | undefined;
157
155
  onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
158
- carouselBodyError?: string | undefined;
159
- setCarouselBodyError?: React.Dispatch<React.SetStateAction<string>> | undefined;
160
156
  cardIndex: number;
161
157
  };
@@ -1 +1 @@
1
- import{jsxs as e,jsx as l,Fragment as t}from"react/jsx-runtime";import{ApplicationType as o}from"@bikdotai/bik-models/growth/models/bik-store";import n from"../../../assets/icons/arrow_back.svg.js";import i from"../../../assets/icons/chevronLeft.svg.js";import r from"../../../assets/icons/chevronRight.svg.js";import d from"../../../assets/icons/PlusIcon.js";import a from"lodash/cloneDeep";import{useState as s,useEffect as c}from"react";import{Button as u}from"../../button/Button.js";import{IconButton as p}from"../../icon-button/IconButton.js";import{ProductPickerModal as m}from"../../product-picker-v2/modal.js";import{ScreenName as v}from"../../product-picker-v2/type.js";import{Badge as h}from"../Badge/index.js";import{useTemplateModalContext as g}from"../context/templateModalContext.js";import f from"./EditWhatsAppTemplateV2.js";import{ProductBox as y}from"./ProductBox.js";import{isRCSChannel as b}from"../../template-preview/helpers/templateMiscHelper.js";import{POD as x}from"../../template-preview/models/WhatsAppTemplate.js";import{TitleMedium as C,TitleRegular as j,BodySecondary as I,BodyCaption as k}from"../../TypographyStyle.js";import{COLORS as O}from"../../../constants/Theme.js";const w=w=>{let{template:P,whatsappSpecificPickerMeta:T,showVariableModal:S,variableListForImage:B,discountCode:E,setDiscountCode:L}=w;var D,F,M,R,V,$,q,A;const{selectedCarouselIndex:N,setTemplate:W,pickerConf:_,isProductCarouselType:z,pod:G,cardCount:H,carouselProducts:K,setCarouselProducts:J,isError:Q,cardImages:U,disableEditVariable:X,onDeleteSelectedProducts:Y,setSelectedCarouselIndex:Z,setVariableCallback:ee,setShowVariablePicker:le,sliderRef:te,setCarouselBodyError:oe}=g(),[ne,ie]=s(b(null==P?void 0:P.channel)?"Carousel Cards":-1==N?"First Message (Step 1/2)":z?"Product Carousel "+((null===(F=null===(D=null==P?void 0:P.mapping)||void 0===D?void 0:D.body)||void 0===F?void 0:F.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(R=null===(M=null==P?void 0:P.mapping)||void 0===M?void 0:M.body)||void 0===R?void 0:R.length)?"(Step 2/2)":"")),[re,de]=s(!1),[ae,se]=s(!1),ce=N===(null!=H?H:-1)-1,ue=(null!=N?N:-1)<1;c((()=>{var e,l,t,o;ie(b(null==P?void 0:P.channel)?"Carousel Cards":-1==N?"First Message (Step 1/2)":z?"Product Carousel "+((null===(l=null===(e=null==P?void 0:P.mapping)||void 0===e?void 0:e.body)||void 0===l?void 0:l.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(o=null===(t=null==P?void 0:P.mapping)||void 0===t?void 0:t.body)||void 0===o?void 0:o.length)?"(Step 2/2)":""))}),[N]),c((()=>{le(!1)}),[N]);const pe=e=>{null==J||J([{name:"variable",productName:e.actualValue}])};return c((()=>{-1===N&&b(null==P?void 0:P.channel)&&(null==Z||Z(0))}),[N,null==P?void 0:P.channel]),e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!b(null==P?void 0:P.channel)&&null!=N&&N>=0&&!!(null===($=null===(V=null==P?void 0:P.mapping)||void 0===V?void 0:V.body)||void 0===$?void 0:$.length)&&l(p,{Icon:n,onClick:()=>{null==Z||Z(-1)}}),l(C,Object.assign({style:{marginLeft:10}},{children:ne}))]})),z&&(null!==(q=null==K?void 0:K.length)&&void 0!==q?q:0)>0&&null!=N&&N>=0&&e("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[l(y,{editItem:()=>{1===(null==K?void 0:K.length)&&"variable"===K[0].name?(ee((()=>pe)),le(!0)):de(!re)},cardBody:1===(null==K?void 0:K.length)&&"variable"===K[0].name?`${K[0].productName}`:`${null==K?void 0:K.length} Products Selected`,hideIcon:1===(null==K?void 0:K.length)&&"variable"===K[0].name,deleteItem:()=>{var e;if(1===(null==K?void 0:K.length)&&"variable"===K[0].name)return void(null==J||J([]));const l=a(Object.assign({},P));l&&(U&&U.length>0?null==U||U.forEach(((e,t)=>{var o;l.components[1].cards[t].components[0].example.header_handle=[null!==(o=U[t])&&void 0!==o?o:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==l?void 0:l.components[1].cards)||void 0===e||e.forEach(((e,t)=>{l.components[1].cards[t].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==W||W(l)),null==J||J([]),null==oe||oe(""),null==Y||Y()}}),K&&(null==K?void 0:K.length)>0&&"variable"!=K[0].name&&l(u,{disabled:(null!==(A=null==K?void 0:K.length)&&void 0!==A?A:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{se(!0),de(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!X&&z&&0===(null==K?void 0:K.length)&&null!=N&&N>=0&&e(t,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[l(j,{children:"Product(s)"}),l(I,{children:`Select ${null!=H?H:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:Q?16:12,marginRight:Q?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[l(u,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:Q?`2px dashed ${O.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:Q?"tertiaryGray":"dashBold",LeadingIcon:()=>l("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:l(d,{width:18,height:18,color:O.content.secondary})})),onClick:e=>{de(!0)}}),G===x.CHATBOT&&e(t,{children:[e("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[l("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8,flex:1}}),l(k,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),l("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8,flex:1}})]})),l(u,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:Q?`2px dashed ${O.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:Q?"tertiaryGray":"dashBold",LeadingIcon:()=>l("div",Object.assign({style:{display:"flex"}},{children:l(d,{width:18,height:18,color:O.content.secondary})})),onClick:e=>{ee((()=>pe)),le(!0)}})]})]})),Q&&l("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:l(h,{padding:"8px",errorText:"Please add products"})}))]}),!z&&(null!=N?N:-1)>-1&&e("div",Object.assign({style:{display:"flex",background:O.surface.hovered,alignItems:"center"}},{children:[l(p,{Icon:i,disabled:ue,width:8,height:14,svgStyle:ue?{}:{color:O.content.secondary},onClick:()=>{var e;null===(e=null==te?void 0:te.current)||void 0===e||e.slickPrev(),(null!=N?N:-1)<1||null==Z||Z((e=>e-1))}}),l(j,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:O.content.secondary},{children:`Card ${(null!=N?N:0)+1}/${H}`})),l(p,{Icon:r,width:8,height:14,disabled:ce,svgStyle:ce?{}:{color:O.content.secondary},onClick:()=>{var e;null===(e=null==te?void 0:te.current)||void 0===e||e.slickNext(),(null!=N?N:-1)>=(null!=H?H:-1)-1||null==Z||Z((e=>e+1))}})]})),l(f,{whatsappSpecificPickerMeta:T,template:P,onTemplateChange:e=>{null==W||W(e)},showVariableModal:S,variableListForImage:B,discountCode:E,setDiscountCode:L}),re&&_&&l(m,{zIndex:200,startupScreen:ae?v.RearrangeProducts:v.Collections,rearrangeEnabled:!0,storeId:_.storeId,selectedItems:(e=>{if(e.length>0){const l={};for(const t of e){const e=null==t?void 0:t.collectionId,o=t.productId,n=t.variantId;e in l||(l[e]={products:{},name:"",image:"",isSmartCollection:!1}),o in l[e].products||(l[e].products[o]={variants:{},name:(null==t?void 0:t.productName)||"",image:(null==t?void 0:t.productImage)||""}),l[e].products[o].variants[n]={name:(null==t?void 0:t.name)||"",price:"",image:(null==t?void 0:t.image)||"",quantity:t.quantity||0,displayOrder:t.displayOrder}}return l}return{}})(null!=K?K:[]),collectionFetcher:_.fetchCollections,productFetcher:_.fetchProducts,onAdd:(e,l)=>{var t,o,n,i,r,d,s,c;se(!1);const u=[];delete e.isCustom;for(const l of Object.keys(e)){const a=e[l].products;if(void 0!==a&&Object.keys(a).length)for(const e of Object.keys(a)){const p=a[e].variants;if(void 0!==p&&Object.keys(p).length)for(const m of Object.keys(p)){const{name:v,image:h,quantity:g,displayOrder:f}=p[m],y={name:v,image:null!==(o=null!=h?h:null===(t=a[e])||void 0===t?void 0:t.image)&&void 0!==o?o:"",quantity:g,variantId:m,productId:e,displayOrder:f,collectionId:l,productName:null!==(i=null===(n=a[e])||void 0===n?void 0:n.name)&&void 0!==i?i:"",productImage:null!==(d=null===(r=a[e])||void 0===r?void 0:r.image)&&void 0!==d?d:"",productDescription:null!==(c=null===(s=a[e])||void 0===s?void 0:s.description)&&void 0!==c?c:""};u.push(y)}}}const p=u.sort(((e,l)=>e.displayOrder-l.displayOrder)),m=u.map((e=>e.image)),v=a(Object.assign({},P));v&&(m.forEach(((e,l)=>{var t;v.components[1].cards[l].components[0].example.header_handle=e?[e]:[null!==(t=null==U?void 0:U[l])&&void 0!==t?t:""]})),null==W||W(v)),null==J||J(p),null==oe||oe(""),de(!1)},searchInCollectionFetcher:_.searchInCollection,searchFetcher:_.searchProducts,visible:re,onClose:()=>{de(!1)},exactLimit:null!=H?H:1,appType:_.appType||o.BIK})]}))};export{w as default};
1
+ import{jsxs as e,jsx as l,Fragment as t}from"react/jsx-runtime";import{ApplicationType as o}from"@bikdotai/bik-models/growth/models/bik-store";import n from"../../../assets/icons/arrow_back.svg.js";import i from"../../../assets/icons/chevronLeft.svg.js";import r from"../../../assets/icons/chevronRight.svg.js";import a from"../../../assets/icons/PlusIcon.js";import d from"lodash/cloneDeep";import{useState as s,useEffect as c}from"react";import{Button as u}from"../../button/Button.js";import{IconButton as p}from"../../icon-button/IconButton.js";import{ProductPickerModal as m}from"../../product-picker-v2/modal.js";import{ScreenName as v}from"../../product-picker-v2/type.js";import{Badge as h}from"../Badge/index.js";import{useTemplateModalContext as g}from"../context/templateModalContext.js";import f from"./EditWhatsAppTemplateV2.js";import{ProductBox as y}from"./ProductBox.js";import{isRCSChannel as b}from"../../template-preview/helpers/templateMiscHelper.js";import{POD as x}from"../../template-preview/models/WhatsAppTemplate.js";import{TitleMedium as C,TitleRegular as j,BodySecondary as I,BodyCaption as k}from"../../TypographyStyle.js";import{COLORS as O}from"../../../constants/Theme.js";const w=w=>{let{template:P,whatsappSpecificPickerMeta:T,showVariableModal:S,variableListForImage:B,discountCode:E,setDiscountCode:L}=w;var D,F,M,R,V,$,q,A;const{selectedCarouselIndex:N,setTemplate:W,pickerConf:_,isProductCarouselType:z,pod:G,cardCount:H,carouselProducts:K,setCarouselProducts:J,isError:Q,cardImages:U,disableEditVariable:X,onDeleteSelectedProducts:Y,setSelectedCarouselIndex:Z,setVariableCallback:ee,setShowVariablePicker:le,sliderRef:te}=g(),[oe,ne]=s(b(null==P?void 0:P.channel)?"Carousel Cards":-1==N?"First Message (Step 1/2)":z?"Product Carousel "+((null===(F=null===(D=null==P?void 0:P.mapping)||void 0===D?void 0:D.body)||void 0===F?void 0:F.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(R=null===(M=null==P?void 0:P.mapping)||void 0===M?void 0:M.body)||void 0===R?void 0:R.length)?"(Step 2/2)":"")),[ie,re]=s(!1),[ae,de]=s(!1),se=N===(null!=H?H:-1)-1,ce=(null!=N?N:-1)<1;c((()=>{var e,l,t,o;ne(b(null==P?void 0:P.channel)?"Carousel Cards":-1==N?"First Message (Step 1/2)":z?"Product Carousel "+((null===(l=null===(e=null==P?void 0:P.mapping)||void 0===e?void 0:e.body)||void 0===l?void 0:l.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(o=null===(t=null==P?void 0:P.mapping)||void 0===t?void 0:t.body)||void 0===o?void 0:o.length)?"(Step 2/2)":""))}),[N]),c((()=>{le(!1)}),[N]);const ue=e=>{null==J||J([{name:"variable",productName:e.actualValue}])};return c((()=>{-1===N&&b(null==P?void 0:P.channel)&&(null==Z||Z(0))}),[N,null==P?void 0:P.channel]),e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!b(null==P?void 0:P.channel)&&null!=N&&N>=0&&!!(null===($=null===(V=null==P?void 0:P.mapping)||void 0===V?void 0:V.body)||void 0===$?void 0:$.length)&&l(p,{Icon:n,onClick:()=>{null==Z||Z(-1)}}),l(C,Object.assign({style:{marginLeft:10}},{children:oe}))]})),z&&(null!==(q=null==K?void 0:K.length)&&void 0!==q?q:0)>0&&null!=N&&N>=0&&e("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[l(y,{editItem:()=>{1===(null==K?void 0:K.length)&&"variable"===K[0].name?(ee((()=>ue)),le(!0)):re(!ie)},cardBody:1===(null==K?void 0:K.length)&&"variable"===K[0].name?`${K[0].productName}`:`${null==K?void 0:K.length} Products Selected`,hideIcon:1===(null==K?void 0:K.length)&&"variable"===K[0].name,deleteItem:()=>{var e;if(1===(null==K?void 0:K.length)&&"variable"===K[0].name)return void(null==J||J([]));const l=d(Object.assign({},P));l&&(U&&U.length>0?null==U||U.forEach(((e,t)=>{var o;l.components[1].cards[t].components[0].example.header_handle=[null!==(o=U[t])&&void 0!==o?o:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==l?void 0:l.components[1].cards)||void 0===e||e.forEach(((e,t)=>{l.components[1].cards[t].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==W||W(l)),null==J||J([]),null==Y||Y()}}),K&&(null==K?void 0:K.length)>0&&"variable"!=K[0].name&&l(u,{disabled:(null!==(A=null==K?void 0:K.length)&&void 0!==A?A:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{de(!0),re(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!X&&z&&0===(null==K?void 0:K.length)&&null!=N&&N>=0&&e(t,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[l(j,{children:"Product(s)"}),l(I,{children:`Select ${null!=H?H:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:Q?16:12,marginRight:Q?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[l(u,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:Q?`2px dashed ${O.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:Q?"tertiaryGray":"dashBold",LeadingIcon:()=>l("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:l(a,{width:18,height:18,color:O.content.secondary})})),onClick:e=>{re(!0)}}),G===x.CHATBOT&&e(t,{children:[e("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[l("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8,flex:1}}),l(k,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),l("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8,flex:1}})]})),l(u,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:Q?`2px dashed ${O.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:Q?"tertiaryGray":"dashBold",LeadingIcon:()=>l("div",Object.assign({style:{display:"flex"}},{children:l(a,{width:18,height:18,color:O.content.secondary})})),onClick:e=>{ee((()=>ue)),le(!0)}})]})]})),Q&&l("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:l(h,{padding:"8px",errorText:"Please add products"})}))]}),!z&&(null!=N?N:-1)>-1&&e("div",Object.assign({style:{display:"flex",background:O.surface.hovered,alignItems:"center"}},{children:[l(p,{Icon:i,disabled:ce,width:8,height:14,svgStyle:ce?{}:{color:O.content.secondary},onClick:()=>{var e;null===(e=null==te?void 0:te.current)||void 0===e||e.slickPrev(),(null!=N?N:-1)<1||null==Z||Z((e=>e-1))}}),l(j,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:O.content.secondary},{children:`Card ${(null!=N?N:0)+1}/${H}`})),l(p,{Icon:r,width:8,height:14,disabled:se,svgStyle:se?{}:{color:O.content.secondary},onClick:()=>{var e;null===(e=null==te?void 0:te.current)||void 0===e||e.slickNext(),(null!=N?N:-1)>=(null!=H?H:-1)-1||null==Z||Z((e=>e+1))}})]})),l(f,{whatsappSpecificPickerMeta:T,template:P,onTemplateChange:e=>{null==W||W(e)},showVariableModal:S,variableListForImage:B,discountCode:E,setDiscountCode:L}),ie&&_&&l(m,{zIndex:200,startupScreen:ae?v.RearrangeProducts:v.Collections,rearrangeEnabled:!0,storeId:_.storeId,selectedItems:(e=>{if(e.length>0){const l={};for(const t of e){const e=null==t?void 0:t.collectionId,o=t.productId,n=t.variantId;e in l||(l[e]={products:{},name:"",image:"",isSmartCollection:!1}),o in l[e].products||(l[e].products[o]={variants:{},name:(null==t?void 0:t.productName)||"",image:(null==t?void 0:t.productImage)||""}),l[e].products[o].variants[n]={name:(null==t?void 0:t.name)||"",price:"",image:(null==t?void 0:t.image)||"",quantity:t.quantity||0,displayOrder:t.displayOrder}}return l}return{}})(null!=K?K:[]),collectionFetcher:_.fetchCollections,productFetcher:_.fetchProducts,onAdd:(e,l)=>{var t,o,n,i,r,a;de(!1);const s=[];delete e.isCustom;for(const l of Object.keys(e)){const d=e[l].products;if(void 0!==d&&Object.keys(d).length)for(const e of Object.keys(d)){const c=d[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:m,quantity:v,displayOrder:h}=c[u],g={name:p,image:null!==(o=null!=m?m:null===(t=d[e])||void 0===t?void 0:t.image)&&void 0!==o?o:"",quantity:v,variantId:u,productId:e,displayOrder:h,collectionId:l,productName:null!==(i=null===(n=d[e])||void 0===n?void 0:n.name)&&void 0!==i?i:"",productImage:null!==(a=null===(r=d[e])||void 0===r?void 0:r.image)&&void 0!==a?a:""};s.push(g)}}}const c=s.sort(((e,l)=>e.displayOrder-l.displayOrder)),u=s.map((e=>e.image)),p=d(Object.assign({},P));p&&(u.forEach(((e,l)=>{var t;p.components[1].cards[l].components[0].example.header_handle=e?[e]:[null!==(t=null==U?void 0:U[l])&&void 0!==t?t:""]})),null==W||W(p)),null==J||J(c),re(!1)},searchInCollectionFetcher:_.searchInCollection,searchFetcher:_.searchProducts,visible:ie,onClose:()=>{re(!1)},exactLimit:null!=H?H:1,appType:_.appType||o.BIK})]}))};export{w as default};
@@ -1,4 +1,4 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import o from"../../../assets/icons/info.svg.js";import{useState as r,useEffect as i}from"react";import n from"styled-components";import{Button as l}from"../../button/Button.js";import{Tag as s}from"../../tag/Tag.js";import{isRCSChannel as a}from"../../template-preview/helpers/templateMiscHelper.js";import{CHANNEL_TYPE as d}from"../../template-preview/models/Channels.js";import{TitleRegular as p}from"../../TypographyStyle.js";import{COLORS as m}from"../../../constants/Theme.js";import{Badge as c}from"../Badge/index.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";const x=n.div`
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import o from"../../../assets/icons/info.svg.js";import{useState as r,useEffect as i}from"react";import n from"styled-components";import{Button as l}from"../../button/Button.js";import{Tag as s}from"../../tag/Tag.js";import{CHANNEL_TYPE as a}from"../../template-preview/models/Channels.js";import{isRCSChannel as d}from"../../template-preview/helpers/templateMiscHelper.js";import{TitleRegular as p}from"../../TypographyStyle.js";import{COLORS as m}from"../../../constants/Theme.js";import{Badge as c}from"../Badge/index.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";const x=n.div`
2
2
  background: ${m.surface.standard};
3
3
  border-top-width: 1px;
4
4
  border-top-color: ${m.stroke.primary};
@@ -12,4 +12,4 @@ import{jsxs as e,jsx as t}from"react/jsx-runtime";import o from"../../../assets/
12
12
  border-bottom-left-radius: 4px;
13
13
  border-bottom-right-radius: 4px;
14
14
  height: ${e=>e.isWhatsappCarousel?64:80}px;
15
- `,g=n=>{let{isWhatsappCarousel:g,onSelect:f,footerButtonText:h,footerInfoText:b}=n;var v,j,y,C;const{isError:T,selectedCarouselIndex:S,setSelectedCarouselIndex:w,setErrorIndexes:I,template:k,showVariablePicker:B,hideFooterButton:$,carouselBodyError:O}=u(),[P,W]=r(g?"Next":"Select template");return i((()=>{h?W(h):g&&-1===S?W("Next"):g&&null!=S&&S>-1&&W("Save & Select Template")}),[S]),e(x,Object.assign({isWhatsappCarousel:g,justifyContent:g&&(null===(j=null===(v=null==k?void 0:k.mapping)||void 0===v?void 0:v.body)||void 0===j?void 0:j.length)?"space-between":"end"},{children:[a((null==k?void 0:k.channel)||d.WHATSAPP)?t(p,{}):g&&null!=S&&S>=-1&&!!(null===(C=null===(y=null==k?void 0:k.mapping)||void 0===y?void 0:y.body)||void 0===C?void 0:C.length)&&t(p,Object.assign({color:m.text.secondary},{children:`Step ${-1===S?1:2}/2`})),e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[T&&t(c,{errorText:O||"Some inputs are missing or incorrect. Please check"}),!T&&b&&t("div",Object.assign({style:{marginRight:12}},{children:t(s,{tagText:b,LeadingIcon:o})})),!$&&t(l,{disabled:B,id:"select-template-btn",buttonText:P,size:g?"small":"large",onClick:function(){g&&-1===S&&w?w(0):(null==I||I([]),f())}})]}))]}))};export{g as default};
15
+ `,g=n=>{let{isWhatsappCarousel:g,onSelect:f,footerButtonText:h,footerInfoText:b}=n;var v,j,y,C;const{isError:T,selectedCarouselIndex:S,setSelectedCarouselIndex:w,setErrorIndexes:I,template:k,showVariablePicker:$,hideFooterButton:B}=u(),[O,P]=r(g?"Next":"Select template");return i((()=>{h?P(h):g&&-1===S?P("Next"):g&&null!=S&&S>-1&&P("Save & Select Template")}),[S]),e(x,Object.assign({isWhatsappCarousel:g,justifyContent:g&&(null===(j=null===(v=null==k?void 0:k.mapping)||void 0===v?void 0:v.body)||void 0===j?void 0:j.length)?"space-between":"end"},{children:[d((null==k?void 0:k.channel)||a.WHATSAPP)?t(p,{}):g&&null!=S&&S>=-1&&!!(null===(C=null===(y=null==k?void 0:k.mapping)||void 0===y?void 0:y.body)||void 0===C?void 0:C.length)&&t(p,Object.assign({color:m.text.secondary},{children:`Step ${-1===S?1:2}/2`})),e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[T&&t(c,{errorText:"Some inputs are missing or incorrect. Please check"}),!T&&b&&t("div",Object.assign({style:{marginRight:12}},{children:t(s,{tagText:b,LeadingIcon:o})})),!B&&t(l,{disabled:$,id:"select-template-btn",buttonText:O,size:g?"small":"large",onClick:function(){g&&-1===S&&w?w(0):(null==I||I([]),f())}})]}))]}))};export{g as default};
@@ -9,6 +9,5 @@ export interface CarouselProduct {
9
9
  collectionId: string;
10
10
  productName: string;
11
11
  productImage: string;
12
- productDescription?: string;
13
12
  }
14
13
  export type ComponentType = WhatsAppTemplate['components'][0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.792-beta.5",
3
+ "version": "0.0.792",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",