@bikdotai/bik-component-library 0.0.684-beta.ai-content-2 → 0.0.684

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 (107) hide show
  1. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  2. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  3. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  4. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  5. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  6. package/dist/cjs/components/SearchFilter/components/DatePickerButton.js +1 -1
  7. package/dist/cjs/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  8. package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
  9. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  10. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  11. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
  12. package/dist/cjs/components/carousel-secondary/CarouselSecondary.d.ts +4 -2
  13. package/dist/cjs/components/carousel-secondary/CarouselSecondary.js +1 -1
  14. package/dist/cjs/components/carousel-secondary/CarouselSecondary.style.d.ts +1 -1
  15. package/dist/cjs/components/carousel-secondary/CarouselSecondary.style.js +1 -1
  16. package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  17. package/dist/cjs/components/datePicker/DatePickerWrapper.d.ts +4 -1
  18. package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
  19. package/dist/cjs/components/datePicker/DatePickerWrapper.styled.d.ts +1 -1
  20. package/dist/cjs/components/datePicker/DatePickerWrapper.styled.js +2 -2
  21. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +2 -1
  22. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  23. package/dist/cjs/components/dropdown/ChipDropdown.d.ts +1 -1
  24. package/dist/cjs/components/dropdown/ChipDropdown.js +3 -3
  25. package/dist/cjs/components/dropdown/MenuItem/MenuItem.d.ts +1 -1
  26. package/dist/cjs/components/dropdown/MenuItem/MenuItem.js +5 -5
  27. package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
  28. package/dist/cjs/components/product-picker-v2/modal.d.ts +8 -1
  29. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  30. package/dist/cjs/components/product-picker-v2/style.js +1 -1
  31. package/dist/cjs/components/product-picker-v2/type.d.ts +0 -7
  32. package/dist/cjs/components/product-picker-v2/type.js +1 -1
  33. package/dist/cjs/components/product-picker-v2/variant.js +1 -1
  34. package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
  35. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  36. package/dist/cjs/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
  37. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  38. package/dist/cjs/components/template-preview/RCS/RCSMediaCard.d.ts +1 -1
  39. package/dist/cjs/components/template-preview/RCS/RCSMediaCard.js +1 -1
  40. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  41. package/dist/cjs/components/template-preview/WhatsApp/MediaCard.js +1 -1
  42. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +0 -1
  43. package/dist/cjs/components/variable-picker-v3/Content.d.ts +1 -0
  44. package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
  45. package/dist/cjs/components/variable-picker-v3/SubHeaderItems.js +1 -1
  46. package/dist/cjs/index.js +1 -1
  47. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  48. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  49. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  50. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  51. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  52. package/dist/esm/components/SearchFilter/components/DatePickerButton.js +1 -1
  53. package/dist/esm/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  54. package/dist/esm/components/TablePagination/TablePagination.js +1 -1
  55. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  56. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  57. package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
  58. package/dist/esm/components/carousel-secondary/CarouselSecondary.d.ts +4 -2
  59. package/dist/esm/components/carousel-secondary/CarouselSecondary.js +1 -1
  60. package/dist/esm/components/carousel-secondary/CarouselSecondary.style.d.ts +1 -1
  61. package/dist/esm/components/carousel-secondary/CarouselSecondary.style.js +1 -1
  62. package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  63. package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +4 -1
  64. package/dist/esm/components/datePicker/DatePickerWrapper.js +1 -1
  65. package/dist/esm/components/datePicker/DatePickerWrapper.styled.d.ts +1 -1
  66. package/dist/esm/components/datePicker/DatePickerWrapper.styled.js +11 -11
  67. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +2 -1
  68. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  69. package/dist/esm/components/dropdown/ChipDropdown.d.ts +1 -1
  70. package/dist/esm/components/dropdown/ChipDropdown.js +3 -3
  71. package/dist/esm/components/dropdown/MenuItem/MenuItem.d.ts +1 -1
  72. package/dist/esm/components/dropdown/MenuItem/MenuItem.js +5 -5
  73. package/dist/esm/components/multi-level-dropdown/MenuItem.js +1 -1
  74. package/dist/esm/components/product-picker-v2/modal.d.ts +8 -1
  75. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  76. package/dist/esm/components/product-picker-v2/style.js +4 -4
  77. package/dist/esm/components/product-picker-v2/type.d.ts +0 -7
  78. package/dist/esm/components/product-picker-v2/type.js +1 -1
  79. package/dist/esm/components/product-picker-v2/variant.js +1 -1
  80. package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
  81. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  82. package/dist/esm/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
  83. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  84. package/dist/esm/components/template-preview/RCS/RCSMediaCard.d.ts +1 -1
  85. package/dist/esm/components/template-preview/RCS/RCSMediaCard.js +1 -1
  86. package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
  87. package/dist/esm/components/template-preview/WhatsApp/MediaCard.js +1 -1
  88. package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +0 -1
  89. package/dist/esm/components/variable-picker-v3/Content.d.ts +1 -0
  90. package/dist/esm/components/variable-picker-v3/Content.js +1 -1
  91. package/dist/esm/components/variable-picker-v3/SubHeaderItems.js +1 -1
  92. package/dist/esm/index.js +1 -1
  93. package/package.json +1 -1
  94. package/dist/cjs/assets/icons/aiContentIcon.svg.js +0 -1
  95. package/dist/cjs/components/carousel-secondary/model.d.ts +0 -4
  96. package/dist/cjs/components/carousel-secondary/model.js +0 -1
  97. package/dist/cjs/components/datePicker/model.d.ts +0 -4
  98. package/dist/cjs/components/datePicker/model.js +0 -1
  99. package/dist/cjs/components/variable-picker-v3/highlightSearchText.d.ts +0 -1
  100. package/dist/cjs/components/variable-picker-v3/highlightSearchText.js +0 -1
  101. package/dist/esm/assets/icons/aiContentIcon.svg.js +0 -1
  102. package/dist/esm/components/carousel-secondary/model.d.ts +0 -4
  103. package/dist/esm/components/carousel-secondary/model.js +0 -1
  104. package/dist/esm/components/datePicker/model.d.ts +0 -4
  105. package/dist/esm/components/datePicker/model.js +0 -1
  106. package/dist/esm/components/variable-picker-v3/highlightSearchText.d.ts +0 -1
  107. package/dist/esm/components/variable-picker-v3/highlightSearchText.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("../../../assets/icons/info.svg.js"),o=require("../../alerts/Alert.js"),s=require("../../alerts/AlertHelper.js"),n=require("../../button/Button.js"),r=require("../../checkBox/CheckBox.js"),l=require("../type.js");require("../../dropdown/DropdownPopover/index.js");var a=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("react"),require("../../zeroState/ZeroState.js");var d=require("../../TypographyStyle.js"),c=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../icon-button/IconButton.js");var u=require("../../input/Input.js"),p=require("../../../assets/icons/cross.svg.js");require("../../dropdown/MenuItem/MenuItem.js");var T,C=require("../../radioButton/RadioButton.js"),E=require("../../../assets/icons/cubeIcon.svg.js"),D=require("../../../assets/icons/delete.svg.js"),O=require("../../../assets/icons/edit.svg.js"),S=require("../../../assets/icons/plus.svg.js"),P=require("../CouponExpiration/CouponExpiration.js"),I=require("../DiscountModal.styled.js"),x=require("./DynamicCoupon.styled.js"),v=require("./MinimumRequirementComponent.js"),_=require("./ZeroState.js");exports.DISCOUNT_PRODUCTS=void 0,(T=exports.DISCOUNT_PRODUCTS||(exports.DISCOUNT_PRODUCTS={})).ENTITLED="entitled",T.PREREQUISITE="prerequisite";exports.default=T=>{var j,b,g,m,y,U,h,R;const N=[{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER,label:"Entire Order",value:l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER},{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS}],V=[{selected:T.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],A=[{selected:T.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],L=(e,r,a)=>{var u,C,P,I,v,_,j,b,g,m,y,U;let h=[],R=[],N={},V={};T.useNewPicker?(N=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,V=null!==(u=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==u?u:[],(null==N?void 0:N.isCustom)&&delete N.isCustom,(null==V?void 0:V.isCustom)&&delete V.isCustom,Object.values(N).forEach((e=>{Object.keys(e.products).forEach((i=>{h.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(V).forEach((e=>{"isCustom"!==e&&R.push({id:e,name:V[e].name,image:V[e].image})}))):(h=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,R=null!==(C=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==C?C:[]);const A=[null===(P=T.dynamicDiscountValidationError)||void 0===P?void 0:P.inValidProductSelection,null===(I=T.dynamicDiscountValidationError)||void 0===I?void 0:I.inValidProductVariableSelection,null===(v=T.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidCollectionSelection],L=[null===(_=T.dynamicDiscountValidationError)||void 0===_?void 0:_.inValidBuyXCollectionSelection,null===(j=T.dynamicDiscountValidationError)||void 0===j?void 0:j.inValidBuyXProductSelection,null===(b=T.dynamicDiscountValidationError)||void 0===b?void 0:b.inValidBuyXProductVariableSelection],f=[null===(g=T.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidGetYCollectionSelection,null===(m=T.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYProductSelection,null===(y=T.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidGetYProductVariableSelection];let F=!1;return"couponAppliesTo"===a&&(F=A.some(Boolean)),"buyX"===a&&(F=L.some(Boolean)),"getY"===a&&(F=f.some(Boolean)),i.jsxs(i.Fragment,{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS&&0===h.length&&(r===exports.DISCOUNT_PRODUCTS.ENTITLED&&!T.entitledProductVariable||r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&!T.preRequisiteProductVariable)&&!(null==R?void 0:R.length)&&i.jsxs(x.AddProductButtonsContainer,{children:[i.jsx("div",Object.assign({style:{width:T.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsProductPickerOpen(r)},error:F})})),T.isProductVariableSupported&&T.productVariableList&&i.jsxs(i.Fragment,{children:[i.jsx(d.BodySecondary,Object.assign({color:c.DEFAULT_THEME.colorsV2.content.placeholder},{children:"OR"})),i.jsx(n.Button,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsProductVariablePickerOpen(r)},error:F})]})]}),e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&0===R.length&&!(null==h?void 0:h.length)&&i.jsx("div",Object.assign({style:{width:"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsCollectionPickerOpen(r)},style:{marginTop:"16px"},error:F})}))]})),F&&i.jsx("div",Object.assign({style:{margin:"8px 0 0"}},{children:i.jsx(o.Alert,{type:s.ALERT_TYPES.NEGATIVE,text:"Required Field",contentPosition:s.CONTENT_POSITION.START,icon:()=>i.jsx(t.default,{width:16,height:16,color:c.DEFAULT_THEME.colorsV2.content.negative})})})),h.length||R.length?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"8px 0"}},{children:e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i.jsxs(x.ProductCollectionCard,{children:[i.jsx(x.CubeIconContainer,{children:i.jsx(E.default,{width:20,height:20,color:c.DEFAULT_THEME.colorsV2.content.secondary})}),i.jsxs(d.TitleSmall,{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?h.length:R.length," ",e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i.jsxs("div",Object.assign({style:{display:"flex",gap:4}},{children:[i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?T.setIsProductPickerOpen(r):T.setIsCollectionPickerOpen(r)}},{children:i.jsx(O.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})})),i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setEntitledProducts([]):T.setPrerequisiteProducts([]):r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setEntitledCollections([]):T.setPrerequisiteCollections([])}},{children:i.jsx(D.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})}))]}))]})]}):r===exports.DISCOUNT_PRODUCTS.ENTITLED&&T.entitledProductVariable?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:T.entitledProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{T.setEntitledProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(U=T.preRequisiteProductVariable)||void 0===U?void 0:U.displayName)?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:T.preRequisiteProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{T.setPreRequisiteProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):i.jsx(i.Fragment,{children:" "})]})},f=(e,t)=>{var o,s,n,r,c,p,C,E,D,O;let S=[],P=[],I={},x={};T.useNewPicker?(I=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,x=null!==(o=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==o?o:[],(null==I?void 0:I.isCustom)&&delete I.isCustom,(null==x?void 0:x.isCustom)&&delete x.isCustom,Object.values(I).forEach((e=>{Object.keys(e.products).forEach((i=>{S.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(x).forEach((e=>{"isCustom"!==e&&P.push({id:e,name:x[e].name,image:x[e].image})}))):(S=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,P=null!==(s=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==s?s:[]);const v=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?T.offerAppliesToBuy:T.offerAppliesToGet,_=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?exports.DISCOUNT_PRODUCTS.PREREQUISITE:exports.DISCOUNT_PRODUCTS.ENTITLED,j=v===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS?l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS;return i.jsxs("div",{children:[i.jsx(d.TitleSmall,Object.assign({style:{marginBottom:16}},{children:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"Customer buys":"Customer gets"})),i.jsxs("div",Object.assign({style:{display:"flex"}},{children:[!t&&i.jsx("div",{children:i.jsxs("div",Object.assign({className:"input__rows"},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:e===exports.DISCOUNT_PRODUCTS.ENTITLED?null!==(r=null===(n=T.discountData.entitledQuantity)||void 0===n?void 0:n.toString())&&void 0!==r?r:"":null!==(p=null===(c=T.discountData.prerequisiteQuantity)||void 0===c?void 0:c.toString())&&void 0!==p?p:"",type:"number",onChangeText:i=>{e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setDiscountData(Object.assign(Object.assign({},T.discountData),{entitledQuantity:parseInt(i)})):T.setDiscountData(Object.assign(Object.assign({},T.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(C=T.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(E=T.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidGetYValue)?"Required Field":"",state:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(D=T.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(O=T.dynamicDiscountValidationError)||void 0===O?void 0:O.inValidGetYValue)?"invalid":"none"})})),i.jsx("div",{className:"input__wrapper"})]}))}),i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&i.jsx(a.Dropdown,{width:"244px",options:V,placement:"bottom-start",onSelect:e=>{var i,t,o;T.setOfferAppliesToBuy(e.value),T.setPrerequisiteProducts([]),T.setPrerequisiteCollections([]),T.setPreRequisiteProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=T.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=T.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=T.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===exports.DISCOUNT_PRODUCTS.ENTITLED&&i.jsx(a.Dropdown,{width:"244px",options:A,placement:"bottom-start",onSelect:e=>{var i,t,o;T.setOfferAppliesToGet(e.value),T.setEntitledProducts([]),T.setEntitledCollections([]),T.setEntitledProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=T.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=T.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=T.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),L(j,_,e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"buyX":"getY")]})};return i.jsxs(I.DynamicCouponContainer,{children:[i.jsxs("div",{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:16}},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(j=T.discountData.title)&&void 0!==j?j:"",onChangeText:e=>{var i;T.setDiscountData(Object.assign(Object.assign({},T.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(b=T.currency)&&void 0!==b?b:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(g=T.dynamicDiscountValidationError)||void 0===g?void 0:g.invalidCouponTitle)?"Required Field":"",state:(null===(m=T.dynamicDiscountValidationError)||void 0===m?void 0:m.invalidCouponTitle)?"invalid":"none"})})),!T.hideProbability&&i.jsx(u.Input,{value:null!==(U=null===(y=T.discountData.probability)||void 0===y?void 0:y.toString())&&void 0!==U?U:"",type:"number",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(h=T.dynamicDiscountValidationError)||void 0===h?void 0:h.inValidProbability)?"Required Field":"",state:(null===(R=T.dynamicDiscountValidationError)||void 0===R?void 0:R.inValidProbability)?"invalid":"none"})]})),i.jsx("div",{style:{height:"1px",width:"100%",background:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),T.allowStaticCoupon&&i.jsx((()=>i.jsxs("div",{children:[i.jsx(d.TitleRegular,{children:"Discount Details"}),i.jsx(x.DiscountOptionsContainer,{children:T.discountDetailsOptions.map((t=>{return i.jsxs(x.DiscountDetailsOption,Object.assign({selected:T.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(T.selectedDiscountDetails.id!==i.id)if(T.resetValidationErrors(),T.setValidationErrorMessage(""),T.setDiscountCouponAppliesTo(l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),T.setSelectedDiscountDetails(i),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0})),T.setPreRequisiteProductVariable(void 0),T.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){T.onChangeCouponType({label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},T.discountData),{valueType:"percentage"===i.value?l.DISCOUNT_VALUE_TYPES.PERCENTAGE:l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,value:void 0,targetType:l.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:l.DISCOUNT_TARGET_SELECTION.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e.__rest(t,["entitledQuantity","prerequisiteQuantity"]);T.setDiscountData(o)}else T.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,T.selectedDiscountDetails.id===o?c.DEFAULT_THEME.colorsV2.stroke.brand:c.DEFAULT_THEME.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(T.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER||T.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,t,o,s,n,r;return i.jsxs(i.Fragment,{children:[i.jsx("div",Object.assign({className:"input__rows"},{children:i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=T.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:T.discountData.valueType===l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(s=T.currency)&&void 0!==s?s:"":void 0,suffixText:T.discountData.valueType===l.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0,errorMessage:(null===(n=T.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"Required Field":"",state:(null===(r=T.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"invalid":"none"})}))})),i.jsx("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsxs("div",Object.assign({className:"input__wrapper"},{children:[i.jsx(d.TitleRegular,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),i.jsx("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:i.jsx(a.Dropdown,{width:"300px",options:N,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS};T.onChangeCouponType(i),T.setDiscountCouponAppliesTo(e.value),T.setEntitledProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS)&&L(T.discountCouponAppliesTo,exports.DISCOUNT_PRODUCTS.ENTITLED,"couponAppliesTo")]}))}))]})})(),T.selectedCouponType===l.DISCOUNT_TYPES.BUY_X_GET_Y&&(()=>{var e,t,o,s,n;return i.jsxs(I.DynamicCouponContainer,Object.assign({style:{border:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[f(exports.DISCOUNT_PRODUCTS.PREREQUISITE),i.jsx("div",{style:{width:"100%",height:"1px",backgroundColor:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"8px 0"}}),f(exports.DISCOUNT_PRODUCTS.ENTITLED),i.jsx(d.BodySecondary,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),i.jsx("div",{children:i.jsx(C.RadioButton,{label:"Free",isActive:100===T.discountData.value,onValueChange:e=>{e?T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:100})):T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0}))}})}),i.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[i.jsx(C.RadioButton,{label:"Percentage off",isActive:100!==T.discountData.value,onValueChange:()=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0}))}}),100!==T.discountData.value&&i.jsx("div",Object.assign({style:{marginTop:8}},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=T.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(s=T.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"Required Field":"",state:(null===(n=T.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!T.selectedCouponType&&i.jsx(_.default,{}),T.allowStaticCoupon&&T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y&&i.jsx("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsx(v.default,{selectedMinimumRequirement:T.selectedMinimumRequirement,setSelectedMinimumRequirement:T.setSelectedMinimumRequirement,discountData:T.discountData,setDiscountData:T.setDiscountData,currency:T.currency,dynamicDiscountValidationError:T.dynamicDiscountValidationError})})),T.selectedCouponType&&!T.hideExpiration&&i.jsxs("div",Object.assign({style:{padding:T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`:"none"}},{children:[i.jsx(r.CheckBox,{label:"Add expiration",isDisabled:!!T.makeExpiryMandatory,isChecked:T.isAddExpirationChecked,onValueChange:e=>{T.setIsAddExpirationChecked(e),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{expireAfter:void 0,expireAt:void 0})),T.setSelectedExpiration(l.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),i.jsx(d.BodySecondary,Object.assign({style:{color:c.DEFAULT_THEME.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),T.isAddExpirationChecked&&i.jsx(P.CouponExpiration,{discountData:T.discountData,setDiscountData:T.setDiscountData,isAddExpirationChecked:T.isAddExpirationChecked,inValidCouponExpiry:T.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:T.selectedExpiration,setSelectedExpiration:T.setSelectedExpiration})]}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("../../../assets/icons/info.svg.js"),o=require("../../alerts/Alert.js"),s=require("../../alerts/AlertHelper.js"),n=require("../../button/Button.js"),r=require("../../checkBox/CheckBox.js");require("../../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js"),require("react");var l=require("../type.js");require("../../dropdown/DropdownPopover/index.js");var a=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("../../zeroState/ZeroState.js");var d=require("../../TypographyStyle.js"),c=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../icon-button/IconButton.js");var u=require("../../input/Input.js"),p=require("../../../assets/icons/cross.svg.js");require("../../dropdown/MenuItem/MenuItem.js"),require("../../modals/styledModal.js"),require("../../../node_modules/lodash.debounce/index.js"),require("../../bik-layout/CommonStyles.js"),require("../../product-picker/ProductPicker.styled.js"),require("../../../utils/DateUtils.js"),require("../../tag/Tag.js"),require("../../tooltips/Tooltip.js"),require("../../product-picker-v2/modal.js"),require("../../variable-picker-v3/model.js"),require("../../modals/modal.styled.js");var T=require("../../../assets/icons/plus.svg.js");require("../../accordion/Accordion.style.js"),require("../../accordion/AccordionArrow.js"),require("../../switch/Switch.js"),require("../../variable-picker-v3/NoResult.js"),require("../../variable-picker-v3/styles.js"),require("lodash");var C,E=require("../DiscountModal.styled.js"),D=require("../CouponExpiration/CouponExpiration.js"),O=require("../../radioButton/RadioButton.js"),S=require("../../../assets/icons/cubeIcon.svg.js"),P=require("../../../assets/icons/delete.svg.js"),I=require("../../../assets/icons/edit.svg.js"),x=require("./DynamicCoupon.styled.js"),v=require("./MinimumRequirementComponent.js"),j=require("./ZeroState.js");exports.DISCOUNT_PRODUCTS=void 0,(C=exports.DISCOUNT_PRODUCTS||(exports.DISCOUNT_PRODUCTS={})).ENTITLED="entitled",C.PREREQUISITE="prerequisite";exports.default=C=>{var _,b,m,g,y,h,U,R;const N=[{selected:C.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER,label:"Entire Order",value:l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER},{selected:C.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:C.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS}],V=[{selected:C.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:C.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],A=[{selected:C.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:C.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],q=(e,r,a)=>{var u,E,D,O,v,j,_,b,m,g,y,h;let U=[],R=[],N={},V={};C.useNewPicker?(N=r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledProducts:C.prerequisiteProducts,V=null!==(u=r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledCollections:C.prerequisiteCollections)&&void 0!==u?u:[],(null==N?void 0:N.isCustom)&&delete N.isCustom,(null==V?void 0:V.isCustom)&&delete V.isCustom,Object.values(N).forEach((e=>{Object.keys(e.products).forEach((i=>{U.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(V).forEach((e=>{"isCustom"!==e&&R.push({id:e,name:V[e].name,image:V[e].image})}))):(U=r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledProducts:C.prerequisiteProducts,R=null!==(E=r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledCollections:C.prerequisiteCollections)&&void 0!==E?E:[]);const A=[null===(D=C.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidProductSelection,null===(O=C.dynamicDiscountValidationError)||void 0===O?void 0:O.inValidProductVariableSelection,null===(v=C.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidCollectionSelection],q=[null===(j=C.dynamicDiscountValidationError)||void 0===j?void 0:j.inValidBuyXCollectionSelection,null===(_=C.dynamicDiscountValidationError)||void 0===_?void 0:_.inValidBuyXProductSelection,null===(b=C.dynamicDiscountValidationError)||void 0===b?void 0:b.inValidBuyXProductVariableSelection],L=[null===(m=C.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYCollectionSelection,null===(g=C.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidGetYProductSelection,null===(y=C.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidGetYProductVariableSelection];let f=!1;return"couponAppliesTo"===a&&(f=A.some(Boolean)),"buyX"===a&&(f=q.some(Boolean)),"getY"===a&&(f=L.some(Boolean)),i.jsxs(i.Fragment,{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS&&0===U.length&&(r===exports.DISCOUNT_PRODUCTS.ENTITLED&&!C.entitledProductVariable||r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&!C.preRequisiteProductVariable)&&!(null==R?void 0:R.length)&&i.jsxs(x.AddProductButtonsContainer,{children:[i.jsx("div",Object.assign({style:{width:C.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:T.default,matchParentWidth:!0,onClick:()=>{C.setIsProductPickerOpen(r)},error:f})})),C.isProductVariableSupported&&C.productVariableList&&i.jsxs(i.Fragment,{children:[i.jsx(d.BodySecondary,Object.assign({color:c.DEFAULT_THEME.colorsV2.content.placeholder},{children:"OR"})),i.jsx(n.Button,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:T.default,matchParentWidth:!0,onClick:()=>{C.setIsProductVariablePickerOpen(r)},error:f})]})]}),e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&0===R.length&&!(null==U?void 0:U.length)&&i.jsx("div",Object.assign({style:{width:"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:T.default,matchParentWidth:!0,onClick:()=>{C.setIsCollectionPickerOpen(r)},style:{marginTop:"16px"},error:f})}))]})),f&&i.jsx("div",Object.assign({style:{margin:"8px 0 0"}},{children:i.jsx(o.Alert,{type:s.ALERT_TYPES.NEGATIVE,text:"Required Field",contentPosition:s.CONTENT_POSITION.START,icon:()=>i.jsx(t.default,{width:16,height:16,color:c.DEFAULT_THEME.colorsV2.content.negative})})})),U.length||R.length?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"8px 0"}},{children:e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i.jsxs(x.ProductCollectionCard,{children:[i.jsx(x.CubeIconContainer,{children:i.jsx(S.default,{width:20,height:20,color:c.DEFAULT_THEME.colorsV2.content.secondary})}),i.jsxs(d.TitleSmall,{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?U.length:R.length," ",e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i.jsxs("div",Object.assign({style:{display:"flex",gap:4}},{children:[i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?C.setIsProductPickerOpen(r):C.setIsCollectionPickerOpen(r)}},{children:i.jsx(I.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})})),i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.setEntitledProducts([]):C.setPrerequisiteProducts([]):r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.setEntitledCollections([]):C.setPrerequisiteCollections([])}},{children:i.jsx(P.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})}))]}))]})]}):r===exports.DISCOUNT_PRODUCTS.ENTITLED&&C.entitledProductVariable?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:C.entitledProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{C.setEntitledProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(h=C.preRequisiteProductVariable)||void 0===h?void 0:h.displayName)?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:C.preRequisiteProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{C.setPreRequisiteProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):i.jsx(i.Fragment,{children:" "})]})},L=(e,t)=>{var o,s,n,r,c,p,T,E,D,O;let S=[],P=[],I={},x={};C.useNewPicker?(I=e===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledProducts:C.prerequisiteProducts,x=null!==(o=e===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledCollections:C.prerequisiteCollections)&&void 0!==o?o:[],(null==I?void 0:I.isCustom)&&delete I.isCustom,(null==x?void 0:x.isCustom)&&delete x.isCustom,Object.values(I).forEach((e=>{Object.keys(e.products).forEach((i=>{S.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(x).forEach((e=>{"isCustom"!==e&&P.push({id:e,name:x[e].name,image:x[e].image})}))):(S=e===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledProducts:C.prerequisiteProducts,P=null!==(s=e===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledCollections:C.prerequisiteCollections)&&void 0!==s?s:[]);const v=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?C.offerAppliesToBuy:C.offerAppliesToGet,j=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?exports.DISCOUNT_PRODUCTS.PREREQUISITE:exports.DISCOUNT_PRODUCTS.ENTITLED,_=v===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS?l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS;return i.jsxs("div",{children:[i.jsx(d.TitleSmall,Object.assign({style:{marginBottom:16}},{children:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"Customer buys":"Customer gets"})),i.jsxs("div",Object.assign({style:{display:"flex"}},{children:[!t&&i.jsx("div",{children:i.jsxs("div",Object.assign({className:"input__rows"},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:e===exports.DISCOUNT_PRODUCTS.ENTITLED?null!==(r=null===(n=C.discountData.entitledQuantity)||void 0===n?void 0:n.toString())&&void 0!==r?r:"":null!==(p=null===(c=C.discountData.prerequisiteQuantity)||void 0===c?void 0:c.toString())&&void 0!==p?p:"",type:"number",onChangeText:i=>{e===exports.DISCOUNT_PRODUCTS.ENTITLED?C.setDiscountData(Object.assign(Object.assign({},C.discountData),{entitledQuantity:parseInt(i)})):C.setDiscountData(Object.assign(Object.assign({},C.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(T=C.dynamicDiscountValidationError)||void 0===T?void 0:T.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(E=C.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidGetYValue)?"Required Field":"",state:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(D=C.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(O=C.dynamicDiscountValidationError)||void 0===O?void 0:O.inValidGetYValue)?"invalid":"none"})})),i.jsx("div",{className:"input__wrapper"})]}))}),i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&i.jsx(a.Dropdown,{width:"244px",options:V,placement:"bottom-start",onSelect:e=>{var i,t,o;C.setOfferAppliesToBuy(e.value),C.setPrerequisiteProducts([]),C.setPrerequisiteCollections([]),C.setPreRequisiteProductVariable(void 0),C.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),C.setDiscountData(Object.assign(Object.assign({},C.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=C.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=C.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=C.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===exports.DISCOUNT_PRODUCTS.ENTITLED&&i.jsx(a.Dropdown,{width:"244px",options:A,placement:"bottom-start",onSelect:e=>{var i,t,o;C.setOfferAppliesToGet(e.value),C.setEntitledProducts([]),C.setEntitledCollections([]),C.setEntitledProductVariable(void 0),C.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),C.setDiscountData(Object.assign(Object.assign({},C.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=C.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=C.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=C.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),q(_,j,e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"buyX":"getY")]})};return i.jsxs(E.DynamicCouponContainer,{children:[i.jsxs("div",{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:16}},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(_=C.discountData.title)&&void 0!==_?_:"",onChangeText:e=>{var i;C.setDiscountData(Object.assign(Object.assign({},C.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(b=C.currency)&&void 0!==b?b:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(m=C.dynamicDiscountValidationError)||void 0===m?void 0:m.invalidCouponTitle)?"Required Field":"",state:(null===(g=C.dynamicDiscountValidationError)||void 0===g?void 0:g.invalidCouponTitle)?"invalid":"none"})})),!C.hideProbability&&i.jsx(u.Input,{value:null!==(h=null===(y=C.discountData.probability)||void 0===y?void 0:y.toString())&&void 0!==h?h:"",type:"number",onChangeText:e=>{C.setDiscountData(Object.assign(Object.assign({},C.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(U=C.dynamicDiscountValidationError)||void 0===U?void 0:U.inValidProbability)?"Required Field":"",state:(null===(R=C.dynamicDiscountValidationError)||void 0===R?void 0:R.inValidProbability)?"invalid":"none"})]})),i.jsx("div",{style:{height:"1px",width:"100%",background:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),C.allowStaticCoupon&&i.jsx((()=>i.jsxs("div",{children:[i.jsx(d.TitleRegular,{children:"Discount Details"}),i.jsx(x.DiscountOptionsContainer,{children:C.discountDetailsOptions.map((t=>{return i.jsxs(x.DiscountDetailsOption,Object.assign({selected:C.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(C.selectedDiscountDetails.id!==i.id)if(C.resetValidationErrors(),C.setValidationErrorMessage(""),C.setDiscountCouponAppliesTo(l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),C.setSelectedDiscountDetails(i),C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:void 0})),C.setPreRequisiteProductVariable(void 0),C.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){C.onChangeCouponType({label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},C.discountData),{valueType:"percentage"===i.value?l.DISCOUNT_VALUE_TYPES.PERCENTAGE:l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,value:void 0,targetType:l.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:l.DISCOUNT_TARGET_SELECTION.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e.__rest(t,["entitledQuantity","prerequisiteQuantity"]);C.setDiscountData(o)}else C.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,C.selectedDiscountDetails.id===o?c.DEFAULT_THEME.colorsV2.stroke.brand:c.DEFAULT_THEME.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(C.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER||C.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,t,o,s,n,r;return i.jsxs(i.Fragment,{children:[i.jsx("div",Object.assign({className:"input__rows"},{children:i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=C.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:C.discountData.valueType===l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(s=C.currency)&&void 0!==s?s:"":void 0,suffixText:C.discountData.valueType===l.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0,errorMessage:(null===(n=C.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"Required Field":"",state:(null===(r=C.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"invalid":"none"})}))})),i.jsx("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsxs("div",Object.assign({className:"input__wrapper"},{children:[i.jsx(d.TitleRegular,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),i.jsx("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:i.jsx(a.Dropdown,{width:"300px",options:N,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS};C.onChangeCouponType(i),C.setDiscountCouponAppliesTo(e.value),C.setEntitledProductVariable(void 0),C.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(C.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||C.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS)&&q(C.discountCouponAppliesTo,exports.DISCOUNT_PRODUCTS.ENTITLED,"couponAppliesTo")]}))}))]})})(),C.selectedCouponType===l.DISCOUNT_TYPES.BUY_X_GET_Y&&(()=>{var e,t,o,s,n;return i.jsxs(E.DynamicCouponContainer,Object.assign({style:{border:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[L(exports.DISCOUNT_PRODUCTS.PREREQUISITE),i.jsx("div",{style:{width:"100%",height:"1px",backgroundColor:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"8px 0"}}),L(exports.DISCOUNT_PRODUCTS.ENTITLED),i.jsx(d.BodySecondary,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),i.jsx("div",{children:i.jsx(O.RadioButton,{label:"Free",isActive:100===C.discountData.value,onValueChange:e=>{e?C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:100})):C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:void 0}))}})}),i.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[i.jsx(O.RadioButton,{label:"Percentage off",isActive:100!==C.discountData.value,onValueChange:()=>{C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:void 0}))}}),100!==C.discountData.value&&i.jsx("div",Object.assign({style:{marginTop:8}},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=C.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",onChangeText:e=>{C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(s=C.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"Required Field":"",state:(null===(n=C.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!C.selectedCouponType&&i.jsx(j.default,{}),C.allowStaticCoupon&&C.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y&&i.jsx("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsx(v.default,{selectedMinimumRequirement:C.selectedMinimumRequirement,setSelectedMinimumRequirement:C.setSelectedMinimumRequirement,discountData:C.discountData,setDiscountData:C.setDiscountData,currency:C.currency,dynamicDiscountValidationError:C.dynamicDiscountValidationError})})),C.selectedCouponType&&!C.hideExpiration&&i.jsxs("div",Object.assign({style:{padding:C.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:C.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`:"none"}},{children:[i.jsx(r.CheckBox,{label:"Add expiration",isDisabled:!!C.makeExpiryMandatory,isChecked:C.isAddExpirationChecked,onValueChange:e=>{C.setIsAddExpirationChecked(e),C.setDiscountData(Object.assign(Object.assign({},C.discountData),{expireAfter:void 0,expireAt:void 0})),C.setSelectedExpiration(l.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),i.jsx(d.BodySecondary,Object.assign({style:{color:c.DEFAULT_THEME.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),C.isAddExpirationChecked&&i.jsx(D.CouponExpiration,{discountData:C.discountData,setDiscountData:C.setDiscountData,isAddExpirationChecked:C.isAddExpirationChecked,inValidCouponExpiry:C.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:C.selectedExpiration,setSelectedExpiration:C.setSelectedExpiration})]}))]})};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { DropdownProps } from './Dropdown';
2
+ import { DropdownProps } from "./";
3
3
  export declare const ChipDropdown: React.FC<DropdownProps>;
4
4
  export declare const ChipDropdownContainer: import("styled-components").StyledComponent<"div", any, {
5
5
  width?: string | undefined;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),i=require("styled-components"),o=require("../tag/Tag.js"),n=require("../../constants/Theme.js"),s=require("../../assets/icons/chevronDown.svg.js"),l=require("../../assets/icons/chevronDownOutline.svg.js"),a=require("../../assets/icons/chevronUpOutline.svg.js"),d=require("../TypographyStyle.js"),u=require("./DropdownPopover/index.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=p(i);const h=i=>{var{placeHolder:p,onSelect:c}=i,h=e.__rest(i,["placeHolder","onSelect"]);const[j,x]=r.useState(!1),v=r.useRef();return t.jsx(u.DropdownPopover,Object.assign({ref:v,onDropdownVisbilityChange:e=>x(e),onSelect:function(e){null==c||c(e)}},h,{children:"default"==h.inputType?t.jsxs(g,Object.assign({width:null==h?void 0:h.width,height:null==h?void 0:h.height},{children:[t.jsx(d.BodySecondary,Object.assign({color:n.COLORS.content.placeholder},{children:p})),t.jsx(s.default,{style:{transform:j?"rotate(180deg)":"rotate(0deg)"},width:20,height:20,color:n.COLORS.content.primary})]})):t.jsx(o.Tag,{tagText:null!=p?p:"",theme:"light",type:"neutral",variant:"regular",TrailingIcon:j?a.default:l.default})}))};h.displayName="ChipDropdown";const g=c.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),t=require("react"),n=require("styled-components"),o=require("./DropdownPopover/index.js");require("./Dropdown.js"),require("../zeroState/ZeroState.js");var i=require("../TypographyStyle.js"),s=require("../../constants/Theme.js");require("./OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("./OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("./OpenedDropdown/components/menu/MenuItem.js"),require("./OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("./OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("./OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("./MenuItem/MenuItem.js");var u=require("../tag/Tag.js"),d=require("../../assets/icons/chevronDown.svg.js"),p=require("../../assets/icons/chevronDownOutline.svg.js"),l=require("../../assets/icons/chevronUpOutline.svg.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(n);const h=n=>{var{placeHolder:a,onSelect:c}=n,h=e.__rest(n,["placeHolder","onSelect"]);const[g,m]=t.useState(!1),q=t.useRef();return r.jsx(o.DropdownPopover,Object.assign({ref:q,onDropdownVisbilityChange:e=>m(e),onSelect:function(e){null==c||c(e)}},h,{children:"default"==h.inputType?r.jsxs(j,Object.assign({width:null==h?void 0:h.width,height:null==h?void 0:h.height},{children:[r.jsx(i.BodySecondary,Object.assign({color:s.COLORS.content.placeholder},{children:a})),r.jsx(d.default,{style:{transform:g?"rotate(180deg)":"rotate(0deg)"},width:20,height:20,color:s.COLORS.content.primary})]})):r.jsx(u.Tag,{tagText:null!=a?a:"",theme:"light",type:"neutral",variant:"regular",TrailingIcon:g?l.default:p.default})}))};h.displayName="ChipDropdown";const j=c.default.div`
2
2
  display: flex;
3
3
  flex-direction: row;
4
4
  width: ${e=>(null==e?void 0:e.width)?e.width:"240px"};
@@ -6,9 +6,9 @@
6
6
  gap: 8px;
7
7
  justify-content: space-between;
8
8
  align-items: center;
9
- border: 1px solid ${n.COLORS.stroke.primary};
9
+ border: 1px solid ${s.COLORS.stroke.primary};
10
10
  border-radius: 4px;
11
11
  padding-left: 8px;
12
12
  padding-right: 8px;
13
13
  cursor: pointer;
14
- `;exports.ChipDropdown=h,exports.ChipDropdownContainer=g;
14
+ `;exports.ChipDropdown=h,exports.ChipDropdownContainer=j;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { OpenDropdownProps } from '../type';
2
+ import { OpenDropdownProps } from "../type";
3
3
  export type MenuItemDropdownProps = OpenDropdownProps & {
4
4
  isHorizontal: boolean;
5
5
  children?: React.ReactNode;
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../assets/icons/horizontal_dots.svg.js"),s=require("../../../assets/icons/vertical_dots.svg.js"),o=require("styled-components"),t=require("../../icon-button/IconButton.js"),i=require("../../../constants/Theme.js"),n=require("../DropdownPopover/index.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const a=d(o).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../assets/icons/horizontal_dots.svg.js"),o=require("../../../assets/icons/vertical_dots.svg.js"),t=require("styled-components"),n=require("../DropdownPopover/index.js");require("../Dropdown.js"),require("../ChipDropdown.js"),require("react"),require("../../zeroState/ZeroState.js"),require("../../TypographyStyle.js");var s=require("../../../constants/Theme.js");require("../OpenedDropdown/components/description/Description.styled.js"),require("../../checkBox/CheckBox.styled.js"),require("../../list-item/ListItem.js"),require("../OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../OpenedDropdown/components/menu/MenuItem.js"),require("../OpenedDropdown/components/menu/MenuList.styled.js"),require("../../button/Button.js"),require("../OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../OpenedDropdown/components/OpennedDropdown.styled.js");var i=require("../../icon-button/IconButton.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../input/Input.js");const u=d(t).default.div`
2
2
  :hover {
3
- background: ${i.COLORS.surface.subdued};
3
+ background: ${s.COLORS.surface.subdued};
4
4
  }
5
5
  position: ${e=>e.isNewTag?"relative":""};
6
6
  .new--tag {
@@ -11,10 +11,10 @@
11
11
  border-radius: 50%;
12
12
  width: 14px;
13
13
  height: 14px;
14
- background: ${i.COLORS.background.negative.vibrant};
15
- border: 1.25px solid ${i.COLORS.surface.standard};
14
+ background: ${s.COLORS.background.negative.vibrant};
15
+ border: 1.25px solid ${s.COLORS.surface.standard};
16
16
  display: flex;
17
17
  justify-content: center;
18
18
  align-items: center;
19
19
  }
20
- `,u=o=>e.jsx(a,Object.assign({isNewTag:o.isNewTag},{children:e.jsxs(n.DropdownPopover,Object.assign({},o,{children:[e.jsx("div",{children:e.jsx(t.IconButton,{Icon:o.isHorizontal?r.default:s.default,bordered:!(null==o?void 0:o.hideBorder)})}),o.isNewTag?e.jsx("div",{className:"new--tag"}):null]}))}));u.displayName="MenuItemDropdown",exports.MenuItemDropdown=u;
20
+ `,p=t=>e.jsx(u,Object.assign({isNewTag:t.isNewTag},{children:e.jsxs(n.DropdownPopover,Object.assign({},t,{children:[e.jsx("div",{children:e.jsx(i.IconButton,{Icon:t.isHorizontal?r.default:o.default,bordered:!(null==t?void 0:t.hideBorder)})}),t.isNewTag?e.jsx("div",{className:"new--tag"}):null]}))}));p.displayName="MenuItemDropdown",exports.MenuItemDropdown=p;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("../../assets/icons/chevronRight2.svg.js"),t=require("react"),i=require("../../constants/Theme.js"),o=require("../TypographyStyle.js"),s=require("./MultiLevelDropdown.styled.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=r(t);const d=l.default.lazy((()=>Promise.resolve().then((function(){return require("./MenuList.js")})).then((e=>({default:e.MenuList})))));exports.MenuItem=r=>{let{width:a,onDropdownItemClick:c,option:u,parents:p}=r;var h,j,g,v,O,b,C;const[x,f]=l.default.useState(!1),[S,m]=l.default.useState(!1),[L,y]=l.default.useState({top:0,left:0}),M=t.useRef({top:0,left:0});return e.jsxs(s.MenuItemWrapper,Object.assign({onMouseEnter:e=>{f(!0),(e=>{const n=e.currentTarget.getBoundingClientRect();y({top:n.top,left:n.right}),M.current={top:n.top,left:n.right}})(e)},onMouseLeave:()=>{f(!1)},onClick:()=>{var e,n;!c||null!==(e=u.disabled)&&void 0!==e&&e||(null===(n=u.children)||void 0===n?void 0:n.length)||c(u,p)},id:"menuItemWrapper",style:{cursor:null!==(h=u.disabled)&&void 0!==h&&h?"not-allowed":"pointer",backgroundColor:null!==(j=u.disabled)&&void 0!==j&&j?i.COLORS.surface.standard:"transparent"}},{children:[u.customComponent?u.customComponent:e.jsxs(s.MenuItemContainer,Object.assign({isSelected:u.selected,isSubMenuOpen:x,isHovered:S,isDisabled:null!==(g=u.disabled)&&void 0!==g&&g},{children:[e.jsxs(s.ContentContainer,{children:[u.leadingIcon&&e.jsx(s.LeadingIconContainer,{children:u.leadingIcon}),e.jsxs("div",{children:[e.jsx(o.BodyCaption,Object.assign({style:{color:null!==(v=u.disabled)&&void 0!==v&&v?i.COLORS.content.inactive:u.selected||S?i.COLORS.content.positive:i.COLORS.content.primary}},{children:u.label})),u.subText&&e.jsx(o.BodyTiny,Object.assign({style:{color:null!==(O=u.disabled)&&void 0!==O&&O?i.COLORS.content.inactive:u.selected||S?i.COLORS.content.positive:i.COLORS.content.secondary,marginTop:"2px"}},{children:u.subText}))]})]}),u.children&&u.children.length>0?e.jsx(s.TrailingIconContainer,{children:e.jsx(n.default,{width:16,height:16,color:null!==(b=u.disabled)&&void 0!==b&&b?i.COLORS.content.inactive:u.selected||S?i.COLORS.content.positive:i.COLORS.content.primary})}):u.trailingIcon?e.jsx(s.TrailingIconContainer,{children:u.trailingIcon}):e.jsx(e.Fragment,{})]})),!(null!==(C=u.disabled)&&void 0!==C&&C)&&u.children&&u.children.length>0&&x&&e.jsx(s.SubMenuContainer,Object.assign({width:a,className:"submenu",onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1)},{children:e.jsx(s.StyledSubMenuWrapper,Object.assign({width:a,top:L.top,left:L.left},{children:e.jsx(s.SubMenuListContainer,{children:e.jsx(t.Suspense,Object.assign({fallback:e.jsx("div",{children:"Loading..."})},{children:e.jsx(d,{width:a,onDropdownItemClick:c,options:u.children,parents:[...p,u]})}))})}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("../../assets/icons/chevronRight2.svg.js"),t=require("react"),i=require("../../constants/Theme.js"),o=require("../TypographyStyle.js"),r=require("./MenuList.js"),s=require("./MultiLevelDropdown.styled.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=l(t);exports.MenuItem=l=>{let{width:a,onDropdownItemClick:c,option:u,parents:p}=l;var h,j,g,v,O,b,C;const[x,S]=d.default.useState(!1),[m,f]=d.default.useState(!1),[L,y]=d.default.useState({top:0,left:0}),M=t.useRef({top:0,left:0});return e.jsxs(s.MenuItemWrapper,Object.assign({onMouseEnter:e=>{S(!0),(e=>{const n=e.currentTarget.getBoundingClientRect();y({top:n.top,left:n.right}),M.current={top:n.top,left:n.right}})(e)},onMouseLeave:()=>{S(!1)},onClick:()=>{var e,n;!c||null!==(e=u.disabled)&&void 0!==e&&e||(null===(n=u.children)||void 0===n?void 0:n.length)||c(u,p)},id:"menuItemWrapper",style:{cursor:null!==(h=u.disabled)&&void 0!==h&&h?"not-allowed":"pointer",backgroundColor:null!==(j=u.disabled)&&void 0!==j&&j?i.COLORS.surface.standard:"transparent"}},{children:[u.customComponent?u.customComponent:e.jsxs(s.MenuItemContainer,Object.assign({isSelected:u.selected,isSubMenuOpen:x,isHovered:m,isDisabled:null!==(g=u.disabled)&&void 0!==g&&g},{children:[e.jsxs(s.ContentContainer,{children:[u.leadingIcon&&e.jsx(s.LeadingIconContainer,{children:u.leadingIcon}),e.jsxs("div",{children:[e.jsx(o.BodyCaption,Object.assign({style:{color:null!==(v=u.disabled)&&void 0!==v&&v?i.COLORS.content.inactive:u.selected||m?i.COLORS.content.positive:i.COLORS.content.primary}},{children:u.label})),u.subText&&e.jsx(o.BodyTiny,Object.assign({style:{color:null!==(O=u.disabled)&&void 0!==O&&O?i.COLORS.content.inactive:u.selected||m?i.COLORS.content.positive:i.COLORS.content.secondary,marginTop:"2px"}},{children:u.subText}))]})]}),u.children&&u.children.length>0?e.jsx(s.TrailingIconContainer,{children:e.jsx(n.default,{width:16,height:16,color:null!==(b=u.disabled)&&void 0!==b&&b?i.COLORS.content.inactive:u.selected||m?i.COLORS.content.positive:i.COLORS.content.primary})}):u.trailingIcon?e.jsx(s.TrailingIconContainer,{children:u.trailingIcon}):e.jsx(e.Fragment,{})]})),!(null!==(C=u.disabled)&&void 0!==C&&C)&&u.children&&u.children.length>0&&x&&e.jsx(s.SubMenuContainer,Object.assign({width:a,className:"submenu",onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1)},{children:e.jsx(s.StyledSubMenuWrapper,Object.assign({width:a,top:L.top,left:L.left},{children:e.jsx(s.SubMenuListContainer,{children:e.jsx(r.MenuList,{width:a,onDropdownItemClick:c,options:u.children,parents:[...p,u]})})}))}))]}))};
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { ButtonProps } from '../button/model';
4
- import { FooterForNonModalI, OUT_OF_STOCK_ACTION, ScreenName } from './type';
4
+ import { FooterForNonModalI, OUT_OF_STOCK_ACTION } from './type';
5
5
  export interface ProductVariant {
6
6
  name: string;
7
7
  price: string;
@@ -58,6 +58,13 @@ export type FbStatusFetcherReturn = Promise<{
58
58
  [key: string]: FbProductStatus;
59
59
  }>;
60
60
  export type FbProductStatus = 'APPROVED' | 'REJECTED';
61
+ export declare enum ScreenName {
62
+ Collections = "collections",
63
+ RearrangeProducts = "rearrange",
64
+ SelectedProducts = "view",
65
+ SearchProducts = "searchProducts",
66
+ Products = "products"
67
+ }
61
68
  export type ProductPickerInterface = {
62
69
  hideGlobalSearch?: boolean;
63
70
  hideInCollectionSearch?: boolean;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/search.svg.js"),o=require("react"),c=require("../../constants/Theme.js"),r=require("../../assets/icons/cross.svg.js"),s=require("../button/Button.js"),n=require("../input/Input.js"),i=require("../modals/styledModal.js"),l=require("../spinner/Spinner.js"),a=require("../tag/Tag.js"),d=require("./collectionScreen.js"),u=require("./productInfoOverlay.js"),h=require("./productScreen.js"),p=require("./rearrangeScreen.js"),S=require("./reducers.js"),C=require("./searchScreen.js"),g=require("./selectedScreen.js"),y=require("./style.js"),j=require("./type.js"),x=require("./utility.js"),b=require("../../_virtual/bik-store.js");exports.ProductPickerModal=m=>{const{storeId:f,selectedItems:v,onClose:k,visible:I,zIndex:O,exactLimit:F,limit:P,hideCollectionCheckbox:T,hideProductCheckbox:R,outOfStockAction:D=j.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:q,selectProductsFromCustomCollection:E,hideSelectionCount:N,title:A,width:B,left:w,renderWithoutModal:L,onClickSave:M,pickerType:V,hideProductVariants:_=!1,startupScreen:z=j.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:H=!1,showProductDetails:K,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:U={},primaryButton:Y,secondaryButton:J,subtitle:Q}=m,X=m.appType||b.__exports.ApplicationType.BIK,[Z,ee]=o.useReducer(S.collectionsReducer,{}),[te,oe]=o.useState([j.ScreenName.Collections,j.ScreenName.RearrangeProducts].includes(z)?z:j.ScreenName.Collections),[ce,re]=o.useState("grid"),[se,ne]=o.useState(""),[ie,le]=o.useState(""),[ae,de]=o.useState(0),[ue,he]=o.useState(!1),[pe,Se]=o.useState(0),[Ce,ge]=o.useState(""),[ye,je]=o.useState(!1),[xe,be]=o.useState(!1),[me,fe]=o.useReducer(S.searchReducer,{collections:{},products:{}}),[ve,ke]=o.useReducer(S.selectedColectionsReducer,Object.keys(v).length>0?v:{}),Ie=o.useRef(null),[Oe,Fe]=o.useState(!1),[Pe,Te]=o.useState();o.useEffect((()=>{he(!0),be(!0),m.collectionFetcher(ae,f,X).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),he(!1),de((e=>e+1)),be(!1)})).catch()}),[]),o.useEffect((()=>{let e=0;_?Object.keys(ve||[]).forEach((t=>{var o;Object.keys((null===(o=ve[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&ve[-1]&&(null===(c=ve[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(ve||[]).forEach((t=>{var o;Object.keys((null===(o=ve[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=ve[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),Se(e)}),[Z,ve,_]),o.useEffect((()=>{ie&&(he(!0),m.productFetcher(ie,f,X).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),he(!1)})).catch())}),[ie]),o.useEffect((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(Ce.length||"collections"!==te)&&(Ce.length?(je(!0),m.searchFetcher(f,Ce,X).then((e=>{"collections"in e&&"products"in e?(fe({type:"set",data:e}),ee({type:"searched",data:e.collections}),ee({type:"searched",data:e.products})):(fe({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),he(!1),je(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[Ce]),o.useEffect((()=>{M&&(m.onAdd(ve,pe),Re())}),[M]),o.useEffect((()=>{H&&Object.keys(ve||{}).length&&pe&&(m.onAdd(ve,pe),Re())}),[H,ve,pe]);const Re=()=>{ke({type:"reset",data:{}})},De=()=>F&&pe>F?e.jsx(a.Tag,{tagText:`You can only select ${F} products`,type:"negative"}):P&&pe>P?e.jsx(a.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):pe>0?e.jsx(s.Button,{onClick:()=>{oe($?j.ScreenName.RearrangeProducts:j.ScreenName.SelectedProducts)},buttonText:F?`${pe}/${F} products selected`:`${pe} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}):e.jsx(s.Button,{disabled:!0,buttonText:F?`${pe}/${F} products selected`:`${pe} products selected`,buttonType:"tertiaryGray"}),qe=e=>ue?"Loading...":te===j.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",Ee=e.jsxs(y.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[m.postHeader&&e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:m.postHeader})),!m.hideGlobalSearch&&e.jsx(e.Fragment,{children:("collections"===te||"searchProducts"===te)&&e.jsx("div",Object.assign({style:{padding:L?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(n.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ye?e.jsx(l.Spinner,{size:"small",color:c.COLORS.content.primary}):e.jsx(t.default,{})},id:"listInput",height:"24px",type:"text",value:Ce,onChangeText:e=>{e.length&&e.trim().length?ge(e):ge("")}})}))}),e.jsxs(y.ScrollContainerStyle,Object.assign({ref:Ie,screenName:te},{children:["collections"===te&&e.jsx(d.CollectionsScreen,{customCollectionRestriction:m.customCollectionRestriction,dataLoading:xe,collections:Z,selectedCollectionsDispatch:ke,setCollectionId:ne,setSelectedCollectionId:le,setScreen:oe,selectedCollections:ve,collectionFetcher:m.collectionFetcher,storeId:f,appType:X,collectionsDispatch:ee,setSaveDisabled:he,pagingControls:{curPage:ae,setCurPage:de},hideCollectionCheckbox:T,renderWithoutModal:L,pickerType:V,scrollContainerRef:Ie}),"products"===te&&se&&e.jsx(S.CollectionIdContext.Provider,Object.assign({value:se},{children:e.jsx(h.ProductsScreen,{hideInCollectionSearch:m.hideInCollectionSearch,customCollectionRestriction:m.customCollectionRestriction,productFetcher:m.productFetcher,setScreen:oe,storeId:f,appType:X,data:Z[se],collectionsDispatch:ee,selectedCollectionsDispatch:ke,selectedData:ve,setSaveDisabled:he,searchInCollectionFetcher:m.searchInCollectionFetcher,hideProductCheckbox:R,outOfStockAction:D,hideVariantCheckbox:q,selectProductsFromCustomCollection:E,renderWithoutModal:L,pickerType:V,hideProductVariants:_,fbStatusFetcher:m.fbStatusFetcher,onProductDetailClick:e=>{Fe(!0),Te(e)},showProductDetailInfoIcon:K,scrollContainerRef:Ie})})),"view"===te&&e.jsx(g.SelectedScreen,{selectedCollections:ve||{},selectedCollectionsDispatch:ke,setScreen:oe,collections:Z,hideProductVariants:_,outOfStockAction:D,storeId:f,appType:X,fbStatusFetcher:m.fbStatusFetcher}),"rearrange"===te&&e.jsx(p.RearrangeScreen,{selectedCollections:ve||{},selectedCollectionsDispatch:ke,setScreen:oe,outOfStockAction:D,rearrangeViewType:"grid"===ce?"list":"grid",scrollContainerRef:Ie,storeId:f,appType:X,fbStatusFetcher:m.fbStatusFetcher}),"searchProducts"===te&&e.jsx(C.SearchScreen,{customCollectionRestriction:m.customCollectionRestriction,selectedCollections:ve||{},searchedCollections:me||{},searchedCollectionsDispatch:fe,selectedCollectionsDispatch:ke,setScreen:oe,collections:Z,onBackPress:()=>{ge(""),fe({type:"set",data:{collections:{},products:{}}})},pickerType:V,hideProductCheckbox:R,hideProductVariants:_,hideVariantCheckbox:q,storeId:f,appType:X,fbStatusFetcher:m.fbStatusFetcher,setCollectionId:ne,setSelectedCollectionId:le,renderWithoutModal:L,hideCollectionCheckbox:T,outOfStockAction:D})]}))]}));return e.jsx(e.Fragment,{children:L?e.jsxs(e.Fragment,{children:[Ee,U.renderFooter?e.jsxs(y.StyledFooterForNonModal,{children:[De(),e.jsx(s.Button,{buttonText:qe(U.primaryButtonText),disabled:!U.isLoading&&(ue||pe<1||F&&pe<F||!F&&P&&pe>P)||U.primaryButtonDisabled,isLoading:U.isLoading,onClick:()=>{m.onAdd(ve,pe),Re(),oe([j.ScreenName.Collections,j.ScreenName.RearrangeProducts].includes(z)?z:j.ScreenName.Collections)}})]}):e.jsx(e.Fragment,{}),Oe&&Pe?e.jsx(u.ProductInfoOverlay,{productData:Pe,outOfStockAction:D,useDynamicInfoImageSize:m.useDynamicInfoImageSize,onClose:()=>{Fe(!1)}}):e.jsx(e.Fragment,{})]}):e.jsxs(i.StyledModal,Object.assign({zIndex:O,open:I,onClose:()=>{null==k||k(),Re()},headingTitle:A||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),headingSubtitle:Q,footerShadow:!0,centralContainerStyles:{width:B||"600px",left:w||"auto"},headerRightCustomElement:G?e.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:k},{children:e.jsx(r.default,{width:20,height:20,color:c.COLORS.content.secondary})})):e.jsx(e.Fragment,{}),footerContainerStyle:m.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:c.COLORS.surface.standard}:void 0,primaryButton:Y?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ue||pe<1||F&&pe<F||!F&&P&&pe>P)||e.disabled,onClick:()=>{m.onAdd(ve,pe),Re(),oe([j.ScreenName.Collections,j.ScreenName.RearrangeProducts].includes(z)?z:j.ScreenName.Collections)}}))(Y):{buttonText:qe(),disabled:ue||pe<1||F&&pe<F||!F&&P&&pe>P||!1,onClick:()=>{m.onAdd(ve,pe),Re()}},secondaryButton:J?(e=>Object.assign(Object.assign({},e),{disabled:ue||pe<1||F&&pe<F||!F&&P&&pe>P||!1,onClick:()=>{const e=x.updateAllVariantsForSelectedProducts(ve,Z,me);m.onAdd(e,pe,!0)}}))(J):void 0,wrapperStyle:m.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?e.jsx(e.Fragment,{}):De(),hideCrossButton:Oe||G},{children:[Ee,Oe&&Pe?e.jsx(u.ProductInfoOverlay,{productData:Pe,useDynamicInfoImageSize:m.useDynamicInfoImageSize,outOfStockAction:D,onClose:()=>{Fe(!1)}}):e.jsx(e.Fragment,{})]}))})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t,o=require("../../assets/icons/search.svg.js"),r=require("react"),c=require("../../constants/Theme.js"),s=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),i=require("../input/Input.js"),l=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),p=require("./productInfoOverlay.js"),h=require("./productScreen.js"),S=require("./rearrangeScreen.js"),g=require("./reducers.js"),x=require("./searchScreen.js"),C=require("./selectedScreen.js"),y=require("./style.js"),j=require("./type.js"),m=require("./utility.js"),b=require("../../_virtual/bik-store.js");exports.ScreenName=void 0,(t=exports.ScreenName||(exports.ScreenName={})).Collections="collections",t.RearrangeProducts="rearrange",t.SelectedProducts="view",t.SearchProducts="searchProducts",t.Products="products";exports.ProductPickerModal=t=>{const{storeId:f,selectedItems:v,onClose:k,visible:I,zIndex:P,exactLimit:O,limit:F,hideCollectionCheckbox:T,hideProductCheckbox:R,outOfStockAction:D=j.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:q,selectProductsFromCustomCollection:N,hideSelectionCount:E,title:A,width:w,left:B,renderWithoutModal:L,onClickSave:M,pickerType:V,hideProductVariants:_=!1,startupScreen:z=exports.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:H=!1,showProductDetails:K,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:U={},primaryButton:Y,secondaryButton:J,subtitle:Q}=t,X=t.appType||b.__exports.ApplicationType.BIK,[Z,ee]=r.useReducer(g.collectionsReducer,{}),[te,oe]=r.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections),[re,ce]=r.useState("grid"),[se,ne]=r.useState(""),[ie,le]=r.useState(""),[ae,de]=r.useState(0),[ue,pe]=r.useState(!1),[he,Se]=r.useState(0),[ge,xe]=r.useState(""),[Ce,ye]=r.useState(!1),[je,me]=r.useState(!1),[be,fe]=r.useReducer(g.searchReducer,{collections:{},products:{}}),[ve,ke]=r.useReducer(g.selectedColectionsReducer,Object.keys(v).length>0?v:{}),Ie=r.useRef(null),[Pe,Oe]=r.useState(!1),[Fe,Te]=r.useState();r.useEffect((()=>{pe(!0),me(!0),t.collectionFetcher(ae,f,X).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),pe(!1),de((e=>e+1)),me(!1)})).catch()}),[]),r.useEffect((()=>{let e=0;_?Object.keys(ve||[]).forEach((t=>{var o;Object.keys((null===(o=ve[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var r;"-1"!==t&&ve[-1]&&(null===(r=ve[-1].products)||void 0===r?void 0:r[o])||(e+=1)}))})):Object.keys(ve||[]).forEach((t=>{var o;Object.keys((null===(o=ve[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var r,c;Object.keys((null===(c=null===(r=ve[t].products)||void 0===r?void 0:r[o])||void 0===c?void 0:c.variants)||[]).forEach((()=>{e+=1}))}))})),Se(e)}),[Z,ve,_]),r.useEffect((()=>{ie&&(pe(!0),t.productFetcher(ie,f,X).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),pe(!1)})).catch())}),[ie]),r.useEffect((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(ge.length||"collections"!==te)&&(ge.length?(ye(!0),t.searchFetcher(f,ge,X).then((e=>{"collections"in e&&"products"in e?(fe({type:"set",data:e}),ee({type:"searched",data:e.collections}),ee({type:"searched",data:e.products})):(fe({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),pe(!1),ye(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[ge]),r.useEffect((()=>{M&&(t.onAdd(ve,he),Re())}),[M]),r.useEffect((()=>{H&&Object.keys(ve||{}).length&&he&&(t.onAdd(ve,he),Re())}),[H,ve,he]);const Re=()=>{ke({type:"reset",data:{}})},De=()=>O&&he>O?e.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):F&&he>F?e.jsx(d.Tag,{tagText:`You can only select ${F} products`,type:"negative"}):he>0?e.jsx(n.Button,{onClick:()=>{oe($?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:O?`${he}/${O} products selected`:`${he} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}):e.jsx(n.Button,{disabled:!0,buttonText:O?`${he}/${O} products selected`:`${he} products selected`,buttonType:"tertiaryGray"}),qe=e=>ue?"Loading...":te===exports.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",Ne=e.jsxs(y.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[t.postHeader&&e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:t.postHeader})),!t.hideGlobalSearch&&e.jsx(e.Fragment,{children:("collections"===te||"searchProducts"===te)&&e.jsx("div",Object.assign({style:{padding:L?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(i.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Ce?e.jsx(a.Spinner,{size:"small",color:c.COLORS.content.primary}):e.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:ge,onChangeText:e=>{e.length&&e.trim().length?xe(e):xe("")}})}))}),e.jsxs(y.ScrollContainerStyle,Object.assign({ref:Ie,screenName:te},{children:["collections"===te&&e.jsx(u.CollectionsScreen,{customCollectionRestriction:t.customCollectionRestriction,dataLoading:je,collections:Z,selectedCollectionsDispatch:ke,setCollectionId:ne,setSelectedCollectionId:le,setScreen:oe,selectedCollections:ve,collectionFetcher:t.collectionFetcher,storeId:f,appType:X,collectionsDispatch:ee,setSaveDisabled:pe,pagingControls:{curPage:ae,setCurPage:de},hideCollectionCheckbox:T,renderWithoutModal:L,pickerType:V,scrollContainerRef:Ie}),"products"===te&&se&&e.jsx(g.CollectionIdContext.Provider,Object.assign({value:se},{children:e.jsx(h.ProductsScreen,{hideInCollectionSearch:t.hideInCollectionSearch,customCollectionRestriction:t.customCollectionRestriction,productFetcher:t.productFetcher,setScreen:oe,storeId:f,appType:X,data:Z[se],collectionsDispatch:ee,selectedCollectionsDispatch:ke,selectedData:ve,setSaveDisabled:pe,searchInCollectionFetcher:t.searchInCollectionFetcher,hideProductCheckbox:R,outOfStockAction:D,hideVariantCheckbox:q,selectProductsFromCustomCollection:N,renderWithoutModal:L,pickerType:V,hideProductVariants:_,fbStatusFetcher:t.fbStatusFetcher,onProductDetailClick:e=>{Oe(!0),Te(e)},showProductDetailInfoIcon:K,scrollContainerRef:Ie})})),"view"===te&&e.jsx(C.SelectedScreen,{selectedCollections:ve||{},selectedCollectionsDispatch:ke,setScreen:oe,collections:Z,hideProductVariants:_,outOfStockAction:D,storeId:f,appType:X,fbStatusFetcher:t.fbStatusFetcher}),"rearrange"===te&&e.jsx(S.RearrangeScreen,{selectedCollections:ve||{},selectedCollectionsDispatch:ke,setScreen:oe,outOfStockAction:D,rearrangeViewType:"grid"===re?"list":"grid",scrollContainerRef:Ie,storeId:f,appType:X,fbStatusFetcher:t.fbStatusFetcher}),"searchProducts"===te&&e.jsx(x.SearchScreen,{customCollectionRestriction:t.customCollectionRestriction,selectedCollections:ve||{},searchedCollections:be||{},searchedCollectionsDispatch:fe,selectedCollectionsDispatch:ke,setScreen:oe,collections:Z,onBackPress:()=>{xe(""),fe({type:"set",data:{collections:{},products:{}}})},pickerType:V,hideProductCheckbox:R,hideProductVariants:_,hideVariantCheckbox:q,storeId:f,appType:X,fbStatusFetcher:t.fbStatusFetcher,setCollectionId:ne,setSelectedCollectionId:le,renderWithoutModal:L,hideCollectionCheckbox:T,outOfStockAction:D})]}))]}));return e.jsx(e.Fragment,{children:L?e.jsxs(e.Fragment,{children:[Ne,U.renderFooter?e.jsxs(y.StyledFooterForNonModal,{children:[De(),e.jsx(n.Button,{buttonText:qe(U.primaryButtonText),disabled:!U.isLoading&&(ue||he<1||O&&he<O||!O&&F&&he>F)||U.primaryButtonDisabled,isLoading:U.isLoading,onClick:()=>{t.onAdd(ve,he),Re(),oe([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections)}})]}):e.jsx(e.Fragment,{}),Pe&&Fe?e.jsx(p.ProductInfoOverlay,{productData:Fe,outOfStockAction:D,useDynamicInfoImageSize:t.useDynamicInfoImageSize,onClose:()=>{Oe(!1)}}):e.jsx(e.Fragment,{})]}):e.jsxs(l.StyledModal,Object.assign({zIndex:P,open:I,onClose:()=>{null==k||k(),Re()},headingTitle:A||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),headingSubtitle:Q,footerShadow:!0,centralContainerStyles:{width:w||"600px",left:B||"auto"},headerRightCustomElement:G?e.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:k},{children:e.jsx(s.default,{width:20,height:20,color:c.COLORS.content.secondary})})):e.jsx(e.Fragment,{}),footerContainerStyle:t.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:c.COLORS.surface.standard}:void 0,primaryButton:Y?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ue||he<1||O&&he<O||!O&&F&&he>F)||e.disabled,onClick:()=>{t.onAdd(ve,he),Re(),oe([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections)}}))(Y):{buttonText:qe(),disabled:ue||he<1||O&&he<O||!O&&F&&he>F||!1,onClick:()=>{t.onAdd(ve,he),Re()}},secondaryButton:J?(e=>Object.assign(Object.assign({},e),{disabled:ue||he<1||O&&he<O||!O&&F&&he>F||!1,onClick:()=>{const e=m.updateAllVariantsForSelectedProducts(ve,Z,be);t.onAdd(e,he,!0)}}))(J):void 0,wrapperStyle:t.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:E?e.jsx(e.Fragment,{}):De(),hideCrossButton:Pe||G},{children:[Ne,Pe&&Fe?e.jsx(p.ProductInfoOverlay,{productData:Fe,useDynamicInfoImageSize:t.useDynamicInfoImageSize,outOfStockAction:D,onClose:()=>{Oe(!1)}}):e.jsx(e.Fragment,{})]}))})};
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("../TypographyStyle.js"),o=require("./type.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=r(e);const d=l.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("../TypographyStyle.js"),o=require("./modal.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=r(e);const d=l.default.div`
2
2
  display: flex;
3
3
  background-color: white;
4
4
  height: ${e=>e.renderWithoutModal?"90%":"75vh"};
@@ -10,10 +10,3 @@ export interface FooterForNonModalI {
10
10
  primaryButtonDisabled?: boolean;
11
11
  isLoading?: boolean;
12
12
  }
13
- export declare enum ScreenName {
14
- Collections = "collections",
15
- RearrangeProducts = "rearrange",
16
- SelectedProducts = "view",
17
- SearchProducts = "searchProducts",
18
- Products = "products"
19
- }
@@ -1 +1 @@
1
- "use strict";var e,r;Object.defineProperty(exports,"__esModule",{value:!0}),exports.OUT_OF_STOCK_ACTION=void 0,(e=exports.OUT_OF_STOCK_ACTION||(exports.OUT_OF_STOCK_ACTION={})).HIDE="HIDE",e.NORMAL="NORMAL",e.BLUR="BLUR",exports.ScreenName=void 0,(r=exports.ScreenName||(exports.ScreenName={})).Collections="collections",r.RearrangeProducts="rearrange",r.SelectedProducts="view",r.SearchProducts="searchProducts",r.Products="products";
1
+ "use strict";var O;Object.defineProperty(exports,"__esModule",{value:!0}),exports.OUT_OF_STOCK_ACTION=void 0,(O=exports.OUT_OF_STOCK_ACTION||(exports.OUT_OF_STOCK_ACTION={})).HIDE="HIDE",O.NORMAL="NORMAL",O.BLUR="BLUR";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),r=require("../../assets/icons/drag_handle.svg.js"),i=require("../tooltips/Tooltip.js"),a=require("../../constants/Theme.js"),s=require("../icon-button/IconButton.js"),n=require("../shimmer-image/ShimmerImage.js"),o=require("../TypographyStyle.js"),c=require("./constants.js"),l=require("./helpers/ProductHelper.js"),d=require("./ProductPickerTag.js"),u=require("./style.js");exports.VariantCardGridView=t=>{const{data:r}=t;return e.jsx(u.VariantCardGridStyle,{children:e.jsx(i.Tooltip,Object.assign({body:r.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e.jsx(n.ShimmerImage,{width:72,height:72,imageUrl:r.image,alt:"Item",borderRadius:4})}))})},exports.VariantCardListView=j=>{var h,m,g;const{data:p,selectedCollectionsDispatch:x,outOfStockAction:y}=j,b=()=>{let e;return e=p.name.includes(p.productName)?p.name:`${p.productName} ${p.name}`,e},{dataForProductPickerTag:v,tagText:I,tagType:O}=l.ProductHelper.getDataForProductPickerTag(p,!0,y),T=`${p.currency&&null!==(h=c.CurrencySymbols[p.currency])&&void 0!==h?h:""}${null!==(g=null!==(m=p.price)&&void 0!==m?m:p.actualPrice)&&void 0!==g?g:""}`,S=p.skuId;return e.jsx(u.VariantCardListStyle,{children:e.jsxs("div",Object.assign({className:"text-container"},{children:[e.jsx(r.default,{width:24,height:24,color:a.COLORS.content.placeholder}),e.jsx("div",{children:e.jsx(n.ShimmerImage,{width:40,height:40,imageUrl:p.image,alt:"Item",borderRadius:4},p.variantId)}),e.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsxs("div",Object.assign({className:"tooltip-title-tag"},{children:[e.jsx(i.Tooltip,Object.assign({body:b(),placement:"bottom",delay:400,variant:"light"},{children:e.jsx(o.TitleSmall,Object.assign({numberOfLines:1,style:{flex:1,minWidth:0}},{children:b()}))})),e.jsxs(u.ProductInfo,{children:[e.jsx(d.ProductPickerTag,{isVariant:!0,data:v,tagText:I,tagType:O}),e.jsx(s.IconButton,{Icon:()=>e.jsx(t.default,{width:24,height:24,color:a.COLORS.content.placeholder}),onClick:()=>{x&&x({type:"variantUnselected",data:{productId:p.productId,variantId:p.variantId,collectionId:p.collectionId}}),j.onDelete&&j.onDelete()}})]})]})),e.jsxs(u.ProductSubTitle,{children:[e.jsx(o.BodyCaption,Object.assign({color:a.COLORS.content.secondary},{children:!(null==v?void 0:v.fbStatus)||I?null:T})),S&&e.jsx(i.Tooltip,Object.assign({body:S,placement:"top"},{children:e.jsx(u.SKUIDBadge,{children:e.jsx(u.EllipsedBodyTiny,{children:`SKU ID: ${S}`})})}))]})]}))]}))})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),r=require("../../assets/icons/drag_handle.svg.js"),i=require("../../constants/Theme.js"),a=require("../icon-button/IconButton.js"),s=require("../shimmer-image/ShimmerImage.js"),n=require("../TypographyStyle.js"),o=require("./constants.js"),c=require("./helpers/ProductHelper.js"),l=require("./ProductPickerTag.js"),d=require("./style.js"),u=require("../tooltips/Tooltip.js");exports.VariantCardGridView=t=>{const{data:r}=t;return e.jsx(d.VariantCardGridStyle,{children:e.jsx(u.Tooltip,Object.assign({body:r.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e.jsx(s.ShimmerImage,{width:72,height:72,imageUrl:r.image,alt:"Item",borderRadius:4})}))})},exports.VariantCardListView=j=>{var h,m,g;const{data:p,selectedCollectionsDispatch:x,outOfStockAction:y}=j,b=()=>{let e;return e=p.name.includes(p.productName)?p.name:`${p.productName} ${p.name}`,e},{dataForProductPickerTag:v,tagText:I,tagType:O}=c.ProductHelper.getDataForProductPickerTag(p,!0,y),T=`${p.currency&&null!==(h=o.CurrencySymbols[p.currency])&&void 0!==h?h:""}${null!==(g=null!==(m=p.price)&&void 0!==m?m:p.actualPrice)&&void 0!==g?g:""}`,S=p.skuId;return e.jsx(d.VariantCardListStyle,{children:e.jsxs("div",Object.assign({className:"text-container"},{children:[e.jsx(r.default,{width:24,height:24,color:i.COLORS.content.placeholder}),e.jsx("div",{children:e.jsx(s.ShimmerImage,{width:40,height:40,imageUrl:p.image,alt:"Item",borderRadius:4},p.variantId)}),e.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsxs("div",Object.assign({className:"tooltip-title-tag"},{children:[e.jsx(u.Tooltip,Object.assign({body:b(),placement:"bottom",delay:400,variant:"light"},{children:e.jsx(n.TitleSmall,Object.assign({numberOfLines:1,style:{flex:1,minWidth:0}},{children:b()}))})),e.jsxs(d.ProductInfo,{children:[e.jsx(l.ProductPickerTag,{isVariant:!0,data:v,tagText:I,tagType:O}),e.jsx(a.IconButton,{Icon:()=>e.jsx(t.default,{width:24,height:24,color:i.COLORS.content.placeholder}),onClick:()=>{x&&x({type:"variantUnselected",data:{productId:p.productId,variantId:p.variantId,collectionId:p.collectionId}}),j.onDelete&&j.onDelete()}})]})]})),e.jsxs(d.ProductSubTitle,{children:[e.jsx(n.BodyCaption,Object.assign({color:i.COLORS.content.secondary},{children:!(null==v?void 0:v.fbStatus)||I?null:T})),S&&e.jsx(u.Tooltip,Object.assign({body:S,placement:"top"},{children:e.jsx(d.SKUIDBadge,{children:e.jsx(d.EllipsedBodyTiny,{children:`SKU ID: ${S}`})})}))]})]}))]}))})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../checkBox/CheckBox.js"),a=require("../../input/Input.js"),i=require("../../TypographyStyle.js");exports.BackTrackComponent=s=>{const{backTrackMessage:n,setBackTrackMessage:c}=s,[l,x]=r.useState(!!n);return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8,width:"300px",padding:"20px 0px"}},{children:[e.jsx(t.CheckBox,{isChecked:l,onValueChange:()=>{l&&c&&c(""),x(!l)}}),e.jsx(i.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Prevent BackTracking"}))]})),l&&e.jsx("div",Object.assign({style:{margin:10}},{children:e.jsx(a.Input,{type:"multiline",placeholder:"Enter your text here",labelText:"Message if user tries backtracking",onChangeText:e=>{c&&c(e)},height:"120px",maxCharLimit:1024,value:n,noErrorHint:!0,validate:e=>[!0,""]})}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../checkBox/CheckBox.js"),a=require("../../TypographyStyle.js"),i=require("../../input/Input.js");exports.BackTrackComponent=s=>{const{backTrackMessage:n,setBackTrackMessage:c}=s,[l,x]=r.useState(!!n);return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8,width:"300px",padding:"20px 0px"}},{children:[e.jsx(t.CheckBox,{isChecked:l,onValueChange:()=>{l&&c&&c(""),x(!l)}}),e.jsx(a.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Prevent BackTracking"}))]})),l&&e.jsx("div",Object.assign({style:{margin:10}},{children:e.jsx(i.Input,{type:"multiline",placeholder:"Enter your text here",labelText:"Message if user tries backtracking",onChangeText:e=>{c&&c(e)},height:"120px",maxCharLimit:1024,value:n,noErrorHint:!0,validate:e=>[!0,""]})}))]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../assets/icons/PlusIcon.js"),t=require("react"),r=require("../../checkBox/CheckBox.js"),a=require("../../input/Input.js"),i=require("../../TypographyStyle.js"),n=require("../context/templateModalContext.js"),o=require("./VariableConnectorsPanel.js");exports.DiscountCodeComponent=l=>{const{discountCode:c,setDiscountCode:d}=l,[u,j]=t.useState(""),[x,h]=t.useState(!!c),[g,p]=t.useState(!1),{setVariableCallback:b,setShowVariablePicker:C}=n.useTemplateModalContext(),f=t.useRef(),v=t.useRef();t.useEffect((()=>{d&&u&&d(c+u)}),[u]);const m=e=>{j(e.actualValue)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[e.jsx(r.CheckBox,{isChecked:x,onValueChange:()=>{x&&d&&(d(""),j("")),h(!x)}}),e.jsx(i.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),x&&e.jsxs("div",Object.assign({ref:f,style:{margin:10}},{children:[e.jsx(a.Input,{placeholder:"Enter your discount code",onChangeText:e=>{d&&d(e)},value:c,onFocus:()=>{p(!0)},onBlur:e=>{var s;"addVar"===(null===(s=e.relatedTarget)||void 0===s?void 0:s.id)?(f.current&&f.current.focus(),p(!0)):p(!1)},noErrorHint:!0,validate:e=>[!0,""]}),g&&e.jsx(o.AddVariableStyled,Object.assign({ref:v,id:"addVar",onClick:e=>{e.stopPropagation(),b((()=>m)),C(!0)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(s.default,{width:14,height:14,color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../assets/icons/PlusIcon.js"),t=require("react"),r=require("../../checkBox/CheckBox.js"),a=require("../../TypographyStyle.js"),i=require("../context/templateModalContext.js"),n=require("./VariableConnectorsPanel.js"),o=require("../../input/Input.js");exports.DiscountCodeComponent=l=>{const{discountCode:c,setDiscountCode:d}=l,[u,j]=t.useState(""),[x,h]=t.useState(!!c),[g,p]=t.useState(!1),{setVariableCallback:b,setShowVariablePicker:C}=i.useTemplateModalContext(),f=t.useRef(),v=t.useRef();t.useEffect((()=>{d&&u&&d(c+u)}),[u]);const m=e=>{j(e.actualValue)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[e.jsx(r.CheckBox,{isChecked:x,onValueChange:()=>{x&&d&&(d(""),j("")),h(!x)}}),e.jsx(a.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),x&&e.jsxs("div",Object.assign({ref:f,style:{margin:10}},{children:[e.jsx(o.Input,{placeholder:"Enter your discount code",onChangeText:e=>{d&&d(e)},value:c,onFocus:()=>{p(!0)},onBlur:e=>{var s;"addVar"===(null===(s=e.relatedTarget)||void 0===s?void 0:s.id)?(f.current&&f.current.focus(),p(!0)):p(!1)},noErrorHint:!0,validate:e=>[!0,""]}),g&&e.jsx(n.AddVariableStyled,Object.assign({ref:v,id:"addVar",onClick:e=>{e.stopPropagation(),b((()=>m)),C(!0)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(s.default,{width:14,height:14,color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]}))]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),a=require("react"),i=require("../../input/Input.js"),n=require("../../template-preview/models/Channels.js"),l=require("../../template-preview/models/TemplateMeta.js"),o=require("../context/templateModalContext.js"),s=require("../helpers/WebpushTemplateHelper.js"),d=require("../utils/getDataFromTemplateComponent.js"),r=require("./EditMediaModal.js"),p=require("./EditMediaV2.js"),u=require("./EditMediaV2.style.js"),c=require("./useEditWhtasappTemplateMedia.js"),m=require("./VariableConnectorsPanel.js"),h=require("./VariableConnectorWhatsApp.js"),b=require("./VariableEditorHeader.js"),g=require("./WhatsAppTemplateCardButtonV2.js");exports.default=f=>{let{template:M,onTemplateChange:E,whatsappSpecificPickerMeta:j,showVariableModal:C}=f;var T,x,v;const[V,L]=a.useState(null),[y,I]=a.useState(null),{variableList:w,disableEditVariable:O,originalVariableList:q,setOriginalVariableList:R}=o.useTemplateModalContext(),{processWebpushTemplate:A,isValidUrl:S}=s.default(),[k,B]=a.useState(null),[D,W]=a.useState(null),[H,P]=a.useState(null);a.useEffect((()=>{w&&A(M,w,q,O).then((e=>{let{templateVariableMapping:t,template:a,webpushBroadcastConfig:i}=e;L(t),null==R||R(t),null==E||E(Object.assign({},a)),I(i)}))}),[w,O]);const{descriptionComponents:F,bodyVariables:U,titleVariables:_}=a.useMemo((()=>{if(V&&y){const e=d.getAllDataFromWebpushTemplateComponent(y,V);return k||B(e.iconImage),D||W(e.bannerImage),H||P(e.redirectionLink),{descriptionComponents:e.descriptionComponents,bodyVariables:e.bodyVariables,titleVariables:e.titleVariables}}return{descriptionComponents:[],bodyVariables:[],titleVariables:[],iconImage:null,bannerImage:null}}),[V,y]),{uploadMediaLink:N,uploadMediaFiles:Y,validateMimeType:G}=j,$=a.useRef(null),K=c.useEditWhatsappTemplateMedia({uploadMediaLink:N,uploadMediaFiles:Y,updateTemplateImageUrl:e=>J(e,"icon"),validateMimeType:G,mediaComponent:k,fileRef:$}),z=c.useEditWhatsappTemplateMedia({uploadMediaLink:N,uploadMediaFiles:Y,updateTemplateImageUrl:e=>J(e,"image"),validateMimeType:G,mediaComponent:D,fileRef:$});function J(e,a){const i=Object.assign({},M),n=t.cloneDeep(i);"icon"===a?(n.webpushBroadcastConfig.icon=[e],B([e])):"image"===a&&(n.webpushBroadcastConfig.image=[e],W([e])),null==E||E(Object.assign({},n))}function Q(e,a,i){var n;const l=Object.assign({},M),o=t.cloneDeep(l),s="custom"===a&&"string"==typeof e,d=null===(n=null==o?void 0:o.webpushBroadcastConfig)||void 0===n?void 0:n.buttons;if(d&&d.length>0){d[i]=s?e:"string"!=typeof e?e.placeHolder:"";const t=Object.assign(Object.assign({},o.webpushBroadcastConfig),{buttons:d});o.webpushBroadcastConfig=t}null==E||E(o)}const X=K.openEditMedia?K:z.openEditMedia?z:null;if(X)return e.jsx(m.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(r.default,{mediaComponentFormat:l.HEADER_TYPES.IMAGE,uploadMedia:X.uploadMedia,variableListForImage:[],useEditWhatsappTemplateMediaResponse:X,setOpenEditMedia:X.setOpenEditMedia,openEditMedia:X.openEditMedia,editIconRef:X.editIconRef,fileRef:$,skipAddVariable:!0})}));return e.jsxs(m.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:"auto"}},{children:[k&&k.length?e.jsx(u.EditTemplateMediaContainer,{children:e.jsx(p.default,{imageName:k,handleImageChange:K.handleImageChange,mediaType:l.HEADER_TYPES.IMAGE,error:K.error,isLoading:K.loading,setOpenEditMedia:K.setOpenEditMedia})}):null,D&&D.length?e.jsx(u.EditTemplateMediaContainer,{children:e.jsx(p.default,{imageName:D,handleImageChange:z.handleImageChange,mediaType:l.HEADER_TYPES.IMAGE,error:z.error,isLoading:z.loading,setOpenEditMedia:z.setOpenEditMedia})}):null,(null==U?void 0:U.length)||(null==_?void 0:_.length)?e.jsx(b.default,{containerStyle:{paddingTop:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}):null,null==F?void 0:F.map(((t,a)=>e.jsx(h.default,{originalVariableList:V,originalList:q,channel:n.CHANNEL_TYPE.WEBPUSH,type:t.type,descriptionComponent:t.component,showVariableModal:C},a))),H&&H.length?e.jsx("div",Object.assign({style:{padding:"16px 14px"}},{children:e.jsx(i.Input,{labelText:"Redirection Link",id:"redirection-link",value:H[0].replace("https://",""),errorMessage:S(H[0])?"":"Please enter a valid URL",maxCharLimit:2e3,noKeyDownChange:!0,state:O?"disabled":"none",prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:e=>{!function(e){var a;const i=`https://${e}`;P([i]);const n=t.cloneDeep(M);(null===(a=n.webpushBroadcastConfig)||void 0===a?void 0:a.redirectionLink)&&(n.webpushBroadcastConfig.redirectionLink=[i]),null==E||E(Object.assign({},n))}(e)}})})):e.jsx(e.Fragment,{}),(null===(x=null===(T=null==V?void 0:V.buttons)||void 0===T?void 0:T.filter((e=>"URL"===e.type)))||void 0===x?void 0:x.length)>0&&e.jsx(b.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(v=null==V?void 0:V.buttons)||void 0===v?void 0:v.map(((t,a)=>e.jsx(g.default,{variableListIndex:a,CTAoptions:null==j?void 0:j.CTAoptions,button:t,currentVariableList:V,updateSelectedURLTemplateBtn:Q},`${a}`)))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),a=require("react"),i=require("../../template-preview/models/TemplateMeta.js"),n=require("../context/templateModalContext.js"),l=require("../helpers/WebpushTemplateHelper.js"),o=require("../utils/getDataFromTemplateComponent.js"),s=require("./EditMediaModal.js"),d=require("./EditMediaV2.js"),r=require("./EditMediaV2.style.js"),p=require("./useEditWhtasappTemplateMedia.js"),u=require("./VariableConnectorsPanel.js"),c=require("./VariableConnectorWhatsApp.js"),m=require("./VariableEditorHeader.js"),h=require("./WhatsAppTemplateCardButtonV2.js"),b=require("../../template-preview/models/Channels.js"),g=require("../../input/Input.js");exports.default=f=>{let{template:M,onTemplateChange:E,whatsappSpecificPickerMeta:j,showVariableModal:C}=f;var T,x,v;const[V,L]=a.useState(null),[y,I]=a.useState(null),{variableList:w,disableEditVariable:O,originalVariableList:q,setOriginalVariableList:R}=n.useTemplateModalContext(),{processWebpushTemplate:A,isValidUrl:S}=l.default(),[k,B]=a.useState(null),[D,W]=a.useState(null),[H,P]=a.useState(null);a.useEffect((()=>{w&&A(M,w,q,O).then((e=>{let{templateVariableMapping:t,template:a,webpushBroadcastConfig:i}=e;L(t),null==R||R(t),null==E||E(Object.assign({},a)),I(i)}))}),[w,O]);const{descriptionComponents:F,bodyVariables:U,titleVariables:_}=a.useMemo((()=>{if(V&&y){const e=o.getAllDataFromWebpushTemplateComponent(y,V);return k||B(e.iconImage),D||W(e.bannerImage),H||P(e.redirectionLink),{descriptionComponents:e.descriptionComponents,bodyVariables:e.bodyVariables,titleVariables:e.titleVariables}}return{descriptionComponents:[],bodyVariables:[],titleVariables:[],iconImage:null,bannerImage:null}}),[V,y]),{uploadMediaLink:N,uploadMediaFiles:Y,validateMimeType:G}=j,$=a.useRef(null),K=p.useEditWhatsappTemplateMedia({uploadMediaLink:N,uploadMediaFiles:Y,updateTemplateImageUrl:e=>J(e,"icon"),validateMimeType:G,mediaComponent:k,fileRef:$}),z=p.useEditWhatsappTemplateMedia({uploadMediaLink:N,uploadMediaFiles:Y,updateTemplateImageUrl:e=>J(e,"image"),validateMimeType:G,mediaComponent:D,fileRef:$});function J(e,a){const i=Object.assign({},M),n=t.cloneDeep(i);"icon"===a?(n.webpushBroadcastConfig.icon=[e],B([e])):"image"===a&&(n.webpushBroadcastConfig.image=[e],W([e])),null==E||E(Object.assign({},n))}function Q(e,a,i){var n;const l=Object.assign({},M),o=t.cloneDeep(l),s="custom"===a&&"string"==typeof e,d=null===(n=null==o?void 0:o.webpushBroadcastConfig)||void 0===n?void 0:n.buttons;if(d&&d.length>0){d[i]=s?e:"string"!=typeof e?e.placeHolder:"";const t=Object.assign(Object.assign({},o.webpushBroadcastConfig),{buttons:d});o.webpushBroadcastConfig=t}null==E||E(o)}const X=K.openEditMedia?K:z.openEditMedia?z:null;if(X)return e.jsx(u.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(s.default,{mediaComponentFormat:i.HEADER_TYPES.IMAGE,uploadMedia:X.uploadMedia,variableListForImage:[],useEditWhatsappTemplateMediaResponse:X,setOpenEditMedia:X.setOpenEditMedia,openEditMedia:X.openEditMedia,editIconRef:X.editIconRef,fileRef:$,skipAddVariable:!0})}));return e.jsxs(u.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:"auto"}},{children:[k&&k.length?e.jsx(r.EditTemplateMediaContainer,{children:e.jsx(d.default,{imageName:k,handleImageChange:K.handleImageChange,mediaType:i.HEADER_TYPES.IMAGE,error:K.error,isLoading:K.loading,setOpenEditMedia:K.setOpenEditMedia})}):null,D&&D.length?e.jsx(r.EditTemplateMediaContainer,{children:e.jsx(d.default,{imageName:D,handleImageChange:z.handleImageChange,mediaType:i.HEADER_TYPES.IMAGE,error:z.error,isLoading:z.loading,setOpenEditMedia:z.setOpenEditMedia})}):null,(null==U?void 0:U.length)||(null==_?void 0:_.length)?e.jsx(m.default,{containerStyle:{paddingTop:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}):null,null==F?void 0:F.map(((t,a)=>e.jsx(c.default,{originalVariableList:V,originalList:q,channel:b.CHANNEL_TYPE.WEBPUSH,type:t.type,descriptionComponent:t.component,showVariableModal:C},a))),H&&H.length?e.jsx("div",Object.assign({style:{padding:"16px 14px"}},{children:e.jsx(g.Input,{labelText:"Redirection Link",id:"redirection-link",value:H[0].replace("https://",""),errorMessage:S(H[0])?"":"Please enter a valid URL",maxCharLimit:2e3,noKeyDownChange:!0,state:O?"disabled":"none",prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:e=>{!function(e){var a;const i=`https://${e}`;P([i]);const n=t.cloneDeep(M);(null===(a=n.webpushBroadcastConfig)||void 0===a?void 0:a.redirectionLink)&&(n.webpushBroadcastConfig.redirectionLink=[i]),null==E||E(Object.assign({},n))}(e)}})})):e.jsx(e.Fragment,{}),(null===(x=null===(T=null==V?void 0:V.buttons)||void 0===T?void 0:T.filter((e=>"URL"===e.type)))||void 0===x?void 0:x.length)>0&&e.jsx(m.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(v=null==V?void 0:V.buttons)||void 0===v?void 0:v.map(((t,a)=>e.jsx(h.default,{variableListIndex:a,CTAoptions:null==j?void 0:j.CTAoptions,button:t,currentVariableList:V,updateSelectedURLTemplateBtn:Q},`${a}`)))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../../assets/icons/arrow_back.svg.js"),l=require("../../../assets/icons/chevronLeft.svg.js"),n=require("../../../assets/icons/chevronRight.svg.js"),i=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),s=require("../../icon-button/IconButton.js"),d=require("../../product-picker-v2/modal.js"),c=require("../../product-picker-v2/type.js"),u=require("../Badge/index.js"),p=require("../context/templateModalContext.js"),v=require("./EditWhatsAppTemplateV2.js"),h=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var m=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var g=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var y=require("../../template-preview/helpers/templateMiscHelper.js"),j=require("../../TypographyStyle.js"),x=require("../../../_virtual/bik-store.js");exports.default=f=>{let{template:b,whatsappSpecificPickerMeta:C,showVariableModal:O,variableListForImage:I,discountCode:S,setDiscountCode:k}=f;var q,w,P,T,B,L,R,E;const{selectedCarouselIndex:M,setTemplate:A,pickerConf:D,isProductCarouselType:F,pod:_,cardCount:V,carouselProducts:W,setCarouselProducts:N,isError:$,cardImages:z,disableEditVariable:G,onDeleteSelectedProducts:H,setSelectedCarouselIndex:K,setVariableCallback:J,setShowVariablePicker:Q,sliderRef:U}=p.useTemplateModalContext(),[X,Y]=r.useState(y.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(w=null===(q=null==b?void 0:b.mapping)||void 0===q?void 0:q.body)||void 0===w?void 0:w.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(T=null===(P=null==b?void 0:b.mapping)||void 0===P?void 0:P.body)||void 0===T?void 0:T.length)?"(Step 2/2)":"")),[Z,ee]=r.useState(!1),[te,le]=r.useState(!1),ne=M===(null!=V?V:-1)-1,ie=(null!=M?M:-1)<1;r.useEffect((()=>{var e,t,l,n;Y(y.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(t=null===(e=null==b?void 0:b.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==b?void 0:b.mapping)||void 0===l?void 0:l.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[M]);const oe=e=>{null==N||N([{name:"variable",productName:e.actualValue}])};return r.useEffect((()=>{-1===M&&y.isRCSChannel(null==b?void 0:b.channel)&&(null==K||K(0))}),[M,null==b?void 0:b.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:[!y.isRCSChannel(null==b?void 0:b.channel)&&null!=M&&M>=0&&!!(null===(L=null===(B=null==b?void 0:b.mapping)||void 0===B?void 0:B.body)||void 0===L?void 0:L.length)&&e.jsx(s.IconButton,{Icon:t.default,onClick:()=>{null==K||K(-1)}}),e.jsx(j.TitleMedium,Object.assign({style:{marginLeft:10}},{children:X}))]})),F&&(null!==(R=null==W?void 0:W.length)&&void 0!==R?R: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(h.ProductBox,{editItem:()=>{1===(null==W?void 0:W.length)&&"variable"===W[0].name?(J((()=>oe)),Q(!0)):ee(!Z)},cardBody:1===(null==W?void 0:W.length)&&"variable"===W[0].name?`${W[0].productName}`:`${null==W?void 0:W.length} Products Selected`,hideIcon:1===(null==W?void 0:W.length)&&"variable"===W[0].name,deleteItem:()=>{var e;if(1===(null==W?void 0:W.length)&&"variable"===W[0].name)return void(null==N||N([]));const t=o.cloneDeep(Object.assign({},b));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==A||A(t)),null==N||N([]),null==H||H()}}),W&&(null==W?void 0:W.length)>0&&"variable"!=W[0].name&&e.jsx(a.Button,{disabled:(null!==(E=null==W?void 0:W.length)&&void 0!==E?E:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{le(!0),ee(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!G&&F&&0===(null==W?void 0:W.length)&&null!=M&&M>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(j.TitleRegular,{children:"Product(s)"}),e.jsx(j.BodySecondary,{children:`Select ${null!=V?V:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:$?16:12,marginRight:$?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:$?`2px dashed ${m.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:$?"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:m.COLORS.content.secondary})})),onClick:e=>{ee(!0)}}),_===g.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}}),e.jsx(j.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:$?`2px dashed ${m.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:$?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.default,{width:18,height:18,color:m.COLORS.content.secondary})})),onClick:e=>{J((()=>oe)),Q(!0)}})]})]})),$&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(u.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!F&&(null!=M?M:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:m.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(s.IconButton,{Icon:l.default,disabled:ie,width:8,height:14,svgStyle:ie?{}:{color:m.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(j.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:m.COLORS.content.secondary},{children:`Card ${(null!=M?M:0)+1}/${V}`})),e.jsx(s.IconButton,{Icon:n.default,width:8,height:14,disabled:ne,svgStyle:ne?{}:{color:m.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickNext(),(null!=M?M:-1)>=(null!=V?V:-1)-1||null==K||K((e=>e+1))}})]})),e.jsx(v.default,{whatsappSpecificPickerMeta:C,template:b,onTemplateChange:e=>{null==A||A(e)},showVariableModal:O,variableListForImage:I,discountCode:S,setDiscountCode:k}),Z&&D&&e.jsx(d.ProductPickerModal,{zIndex:200,startupScreen:te?c.ScreenName.RearrangeProducts:c.ScreenName.Collections,rearrangeEnabled:!0,storeId:D.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,i=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[i]={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!=W?W:[]),collectionFetcher:D.fetchCollections,productFetcher:D.fetchProducts,onAdd:(e,t)=>{var l,n,i,r,a,s;le(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const o=e[t].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const c=o[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:m}=c[u],g={name:p,image:null!==(n=null!=v?v:null===(l=o[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:h,variantId:u,productId:e,displayOrder:m,collectionId:t,productName:null!==(r=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==r?r:"",productImage:null!==(s=null===(a=o[e])||void 0===a?void 0:a.image)&&void 0!==s?s:""};d.push(g)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},b));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==z?void 0:z[t])&&void 0!==l?l:""]})),null==A||A(p)),null==N||N(c),ee(!1)},searchInCollectionFetcher:D.searchInCollection,searchFetcher:D.searchProducts,visible:Z,onClose:()=>{ee(!1)},exactLimit:null!=V?V:1,appType:D.appType||x.__exports.ApplicationType.BIK})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../../assets/icons/arrow_back.svg.js"),l=require("../../../assets/icons/chevronLeft.svg.js"),n=require("../../../assets/icons/chevronRight.svg.js"),i=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),s=require("../../icon-button/IconButton.js"),d=require("../../product-picker-v2/modal.js"),c=require("../Badge/index.js"),u=require("../context/templateModalContext.js"),p=require("./EditWhatsAppTemplateV2.js"),v=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var h=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var m=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var g=require("../../template-preview/helpers/templateMiscHelper.js"),y=require("../../TypographyStyle.js"),j=require("../../../_virtual/bik-store.js");exports.default=x=>{let{template:f,whatsappSpecificPickerMeta:b,showVariableModal:C,variableListForImage:O,discountCode:I,setDiscountCode:S}=x;var k,q,w,P,T,B,L,R;const{selectedCarouselIndex:E,setTemplate:M,pickerConf:A,isProductCarouselType:D,pod:F,cardCount:_,carouselProducts:V,setCarouselProducts:W,isError:N,cardImages:$,disableEditVariable:z,onDeleteSelectedProducts:G,setSelectedCarouselIndex:H,setVariableCallback:K,setShowVariablePicker:J,sliderRef:Q}=u.useTemplateModalContext(),[U,X]=r.useState(g.isRCSChannel(null==f?void 0:f.channel)?"Carousel Cards":-1==E?"First Message (Step 1/2)":D?"Product Carousel "+((null===(q=null===(k=null==f?void 0:f.mapping)||void 0===k?void 0:k.body)||void 0===q?void 0:q.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(P=null===(w=null==f?void 0:f.mapping)||void 0===w?void 0:w.body)||void 0===P?void 0:P.length)?"(Step 2/2)":"")),[Y,Z]=r.useState(!1),[ee,te]=r.useState(!1),le=E===(null!=_?_:-1)-1,ne=(null!=E?E:-1)<1;r.useEffect((()=>{var e,t,l,n;X(g.isRCSChannel(null==f?void 0:f.channel)?"Carousel Cards":-1==E?"First Message (Step 1/2)":D?"Product Carousel "+((null===(t=null===(e=null==f?void 0:f.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==f?void 0:f.mapping)||void 0===l?void 0:l.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[E]);const ie=e=>{null==W||W([{name:"variable",productName:e.actualValue}])};return r.useEffect((()=>{-1===E&&g.isRCSChannel(null==f?void 0:f.channel)&&(null==H||H(0))}),[E,null==f?void 0:f.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:[!g.isRCSChannel(null==f?void 0:f.channel)&&null!=E&&E>=0&&!!(null===(B=null===(T=null==f?void 0:f.mapping)||void 0===T?void 0:T.body)||void 0===B?void 0:B.length)&&e.jsx(s.IconButton,{Icon:t.default,onClick:()=>{null==H||H(-1)}}),e.jsx(y.TitleMedium,Object.assign({style:{marginLeft:10}},{children:U}))]})),D&&(null!==(L=null==V?void 0:V.length)&&void 0!==L?L:0)>0&&null!=E&&E>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(v.ProductBox,{editItem:()=>{1===(null==V?void 0:V.length)&&"variable"===V[0].name?(K((()=>ie)),J(!0)):Z(!Y)},cardBody:1===(null==V?void 0:V.length)&&"variable"===V[0].name?`${V[0].productName}`:`${null==V?void 0:V.length} Products Selected`,hideIcon:1===(null==V?void 0:V.length)&&"variable"===V[0].name,deleteItem:()=>{var e;if(1===(null==V?void 0:V.length)&&"variable"===V[0].name)return void(null==W||W([]));const t=o.cloneDeep(Object.assign({},f));t&&($&&$.length>0?null==$||$.forEach(((e,l)=>{var n;t.components[1].cards[l].components[0].example.header_handle=[null!==(n=$[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==M||M(t)),null==W||W([]),null==G||G()}}),V&&(null==V?void 0:V.length)>0&&"variable"!=V[0].name&&e.jsx(a.Button,{disabled:(null!==(R=null==V?void 0:V.length)&&void 0!==R?R:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{te(!0),Z(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!z&&D&&0===(null==V?void 0:V.length)&&null!=E&&E>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(y.TitleRegular,{children:"Product(s)"}),e.jsx(y.BodySecondary,{children:`Select ${null!=_?_:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:N?16:12,marginRight:N?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:N?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:N?"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:h.COLORS.content.secondary})})),onClick:e=>{Z(!0)}}),F===m.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}}),e.jsx(y.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:N?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:N?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{K((()=>ie)),J(!0)}})]})]})),N&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(c.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!D&&(null!=E?E:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:h.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(s.IconButton,{Icon:l.default,disabled:ne,width:8,height:14,svgStyle:ne?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==Q?void 0:Q.current)||void 0===e||e.slickPrev(),(null!=E?E:-1)<1||null==H||H((e=>e-1))}}),e.jsx(y.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:h.COLORS.content.secondary},{children:`Card ${(null!=E?E:0)+1}/${_}`})),e.jsx(s.IconButton,{Icon:n.default,width:8,height:14,disabled:le,svgStyle:le?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==Q?void 0:Q.current)||void 0===e||e.slickNext(),(null!=E?E:-1)>=(null!=_?_:-1)-1||null==H||H((e=>e+1))}})]})),e.jsx(p.default,{whatsappSpecificPickerMeta:b,template:f,onTemplateChange:e=>{null==M||M(e)},showVariableModal:C,variableListForImage:O,discountCode:I,setDiscountCode:S}),Y&&A&&e.jsx(d.ProductPickerModal,{zIndex:200,startupScreen:ee?d.ScreenName.RearrangeProducts:d.ScreenName.Collections,rearrangeEnabled:!0,storeId:A.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,i=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[i]={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!=V?V:[]),collectionFetcher:A.fetchCollections,productFetcher:A.fetchProducts,onAdd:(e,t)=>{var l,n,i,r,a,s;te(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const o=e[t].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const c=o[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:m}=c[u],g={name:p,image:null!==(n=null!=v?v:null===(l=o[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:h,variantId:u,productId:e,displayOrder:m,collectionId:t,productName:null!==(r=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==r?r:"",productImage:null!==(s=null===(a=o[e])||void 0===a?void 0:a.image)&&void 0!==s?s:""};d.push(g)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},f));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==$?void 0:$[t])&&void 0!==l?l:""]})),null==M||M(p)),null==W||W(c),Z(!1)},searchInCollectionFetcher:A.searchInCollection,searchFetcher:A.searchProducts,visible:Y,onClose:()=>{Z(!1)},exactLimit:null!=_?_:1,appType:A.appType||j.__exports.ApplicationType.BIK})]}))};
@@ -1,6 +1,6 @@
1
+ import { HEADER_TYPES } from "../../../index";
1
2
  import React from 'react';
2
3
  import { CSSProperties } from 'styled-components';
3
- import { HEADER_TYPES } from '../models/TemplateMeta';
4
4
  export declare const PdfMediaCard: React.FC<{
5
5
  headerAssetLink?: string;
6
6
  headerAssetName?: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../assets/icons/RCS_PDF.svg.js"),r=require("../../shimmer-image/ShimmerImage.js"),i=require("../../../constants/Theme.js"),t=require("../models/TemplateMeta.js"),a=require("./RCSPreview.styled.js");exports.PdfMediaCard=r=>{let{headerAssetLink:t,headerAssetName:d}=r;var n;const o=s.default,l=d||(null===(n=null==t?void 0:t.split("/").pop())||void 0===n?void 0:n.replace(".pdf",""))||"xxxxxxxx";return e.jsxs(a.RCSPdfContainer,{children:[e.jsx(o,{height:24,width:24,color:i.COLORS.icon.placeholder}),!!l&&e.jsxs(a.PdfComineText,{children:[e.jsx(a.PdfText,{children:l}),e.jsx(a.PdfText,{children:".pdf"})]})]})},exports.RCSMediaCard=s=>{let{headerAssetLink:i,headerAssetName:d,mediaType:n,imagePreviewStyles:o,isHorizontal:l}=s;const c={width:"100%",minHeight:l?"100%":"240px",height:l?"100%":"240px",objectFit:"cover",borderRadius:l?"8px":""};return e.jsx(a.RCSMediaContainer,Object.assign({isHorizontal:!!l},{children:n===t.HEADER_TYPES.IMAGE?e.jsx(r.ShimmerImage,{imageUrl:i,alt:i,width:"100%",height:l?"100%":240,imagePreviewStyles:Object.assign(Object.assign({},o),{borderTopRightRadius:8,borderTopLeftRadius:8})}):n===t.HEADER_TYPES.VIDEO?e.jsx("video",Object.assign({src:i,style:c,controls:!0,muted:!0},{children:e.jsx("track",{default:!0,kind:"captions",srcLang:"en",src:i})})):e.jsx(e.Fragment,{})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../assets/icons/RCS_PDF.svg.js"),r=require("../../../constants/Theme.js"),i=require("./RCSPreview.styled.js"),t=require("../models/TemplateMeta.js"),a=require("../../shimmer-image/ShimmerImage.js");exports.PdfMediaCard=t=>{let{headerAssetLink:a,headerAssetName:d}=t;var n;const o=s.default,l=d||(null===(n=null==a?void 0:a.split("/").pop())||void 0===n?void 0:n.replace(".pdf",""))||"xxxxxxxx";return e.jsxs(i.RCSPdfContainer,{children:[e.jsx(o,{height:24,width:24,color:r.COLORS.icon.placeholder}),!!l&&e.jsxs(i.PdfComineText,{children:[e.jsx(i.PdfText,{children:l}),e.jsx(i.PdfText,{children:".pdf"})]})]})},exports.RCSMediaCard=s=>{let{headerAssetLink:r,headerAssetName:d,mediaType:n,imagePreviewStyles:o,isHorizontal:l}=s;const c={width:"100%",minHeight:l?"100%":"240px",height:l?"100%":"240px",objectFit:"cover",borderRadius:l?"8px":""};return e.jsx(i.RCSMediaContainer,Object.assign({isHorizontal:!!l},{children:n===t.HEADER_TYPES.IMAGE?e.jsx(a.ShimmerImage,{imageUrl:r,alt:r,width:"100%",height:l?"100%":240,imagePreviewStyles:Object.assign(Object.assign({},o),{borderTopRightRadius:8,borderTopLeftRadius:8})}):n===t.HEADER_TYPES.VIDEO?e.jsx("video",Object.assign({src:r,style:c,controls:!0,muted:!0},{children:e.jsx("track",{default:!0,kind:"captions",srcLang:"en",src:r})})):e.jsx(e.Fragment,{})}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../template-context-mapper/context/templateModalContext.js"),l=require("../../utils/StringUtils.js"),i=require("../../constants/Theme.js"),a=require("../../assets/icons/aiContentIcon.svg.js"),n=require("../TypographyStyle.js"),s=require("./EmailTemplateThumbnailPreview.js"),r=require("./models/Channels.js"),o=require("./SmsTemplatePreview.js"),d=require("./webpush/WebpushPreview.js"),u=require("./WhatsAppTemplatePreview.js");const p={WhatsAppWrapper:{backgroundColor:i.COLORS.surface.standard,borderRadius:4,border:`1px solid ${i.COLORS.background.inactive}`,marginTop:16}};exports.TemplatePreview=c=>{let{template:m,channel:v,whatsAppSpecificMeta:h,templateCreationsInfo:j,hideHeader:C,size:g,onlyTemplateContent:b,emailSpecificMeta:x,smsSpecificMeta:y,showSampleValues:S,carouselCardIndex:T,isWhatsappCarousel:w,isPreview:O,applyBorderBottom:P,webPushSpecificMeta:f,hidePointerEvents:E}=c;var H,A;const{setSelectedCarouselIndex:q}=t.useTemplateModalContext();return v===r.CHANNEL_TYPE.SMS?e.jsx("div",Object.assign({style:Object.assign({marginTop:j?16:0,border:j?`1px solid ${i.COLORS.stroke.primary}`:"none",borderRadius:4},null==y?void 0:y.templateContainerStyles)},{children:e.jsx(o.default,{template:m,hideHeader:C,onlyTemplateContent:b,size:null!=g?g:"large",variableStore:null==y?void 0:y.smsVariableStore,display_content:null==y?void 0:y.smsDisplayContent,uniqueId:null==y?void 0:y.uniqueId})})):v===r.CHANNEL_TYPE.EMAIL?e.jsx("div",Object.assign({style:Object.assign({marginTop:j?16:0},null==x?void 0:x.templateContainerStyles)},{children:e.jsx(s.default,{template:m,handleViewTemplate:()=>{var e;null===(e=null==x?void 0:x.handleViewTemplate)||void 0===e||e.call(x)},hideHeader:C,hideViewButton:null==x?void 0:x.hideViewButtonForEmail,containerStyle:null==x?void 0:x.containerStyle,emailDisplayContent:null==x?void 0:x.emailDisplayContent,emailHtmlContainerId:null==x?void 0:x.emailHtmlContainerId,applyBorderBottom:P,hidePointerEvents:E})})):v===r.CHANNEL_TYPE.WHATSAPP||v===r.CHANNEL_TYPE.RCS?e.jsxs("div",Object.assign({style:Object.assign(Object.assign(Object.assign({},null==h?void 0:h.templateContainerStyles),j?p.WhatsAppWrapper:{}),{position:"relative"}),onClick:()=>{var e,t;if(q&&w){if(-1===T&&!(null===(t=null===(e=null==m?void 0:m.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length))return;q(null!=T?T:-1)}}},{children:[j?e.jsx("div",Object.assign({style:{padding:16}},{children:e.jsx(n.TitleRegular,{children:l.default.convertToTitleCase(null!==(H=null==m?void 0:m.label)&&void 0!==H?H:"")})})):e.jsx(e.Fragment,{}),e.jsx(u.default,{showSampleValues:S,showHeader:null==h?void 0:h.showWhatsAppHeader,extras:null==h?void 0:h.whatsAppExtras,template:m,size:j?"small":null!=g?g:"large",containerStyle:Object.assign(Object.assign({borderWidth:j?0:1,borderTopWidth:1},null!==(A=null==h?void 0:h.containerStyle)&&void 0!==A?A:{}),{height:"100%"}),zeroStateComponent:null==h?void 0:h.zeroStateComponent,usePlaceHolderName:null==h?void 0:h.usePlaceHolderName,carouselCardIndex:T,isWhatsappCarousel:w,isPreview:O,channel:v}),!!(null==m?void 0:m.aiContentConfigId)&&e.jsx("div",Object.assign({style:{position:"absolute",top:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:48,height:48,zIndex:5}},{children:e.jsx(a.default,{width:48,height:48})}))]})):v==r.CHANNEL_TYPE.WEBPUSH?e.jsx("div",Object.assign({style:Object.assign({},null==f?void 0:f.containerStyle)},{children:e.jsx(d.default,{template:m,extraContainerCss:null==f?void 0:f.extraContainerCss})})):e.jsx(e.Fragment,{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../template-context-mapper/context/templateModalContext.js"),l=require("../../utils/StringUtils.js"),i=require("../../constants/Theme.js"),a=require("../TypographyStyle.js"),n=require("./EmailTemplateThumbnailPreview.js"),s=require("./models/Channels.js"),r=require("./SmsTemplatePreview.js"),o=require("./webpush/WebpushPreview.js"),d=require("./WhatsAppTemplatePreview.js");const u={WhatsAppWrapper:{backgroundColor:i.COLORS.surface.standard,borderRadius:4,border:`1px solid ${i.COLORS.background.inactive}`,marginTop:16}};exports.TemplatePreview=p=>{let{template:c,channel:m,whatsAppSpecificMeta:v,templateCreationsInfo:h,hideHeader:C,size:j,onlyTemplateContent:S,emailSpecificMeta:b,smsSpecificMeta:g,showSampleValues:x,carouselCardIndex:y,isWhatsappCarousel:T,isPreview:P,applyBorderBottom:w,webPushSpecificMeta:O,hidePointerEvents:E}=p;var H,f;const{setSelectedCarouselIndex:A}=t.useTemplateModalContext();return m===s.CHANNEL_TYPE.SMS?e.jsx("div",Object.assign({style:Object.assign({marginTop:h?16:0,border:h?`1px solid ${i.COLORS.stroke.primary}`:"none",borderRadius:4},null==g?void 0:g.templateContainerStyles)},{children:e.jsx(r.default,{template:c,hideHeader:C,onlyTemplateContent:S,size:null!=j?j:"large",variableStore:null==g?void 0:g.smsVariableStore,display_content:null==g?void 0:g.smsDisplayContent,uniqueId:null==g?void 0:g.uniqueId})})):m===s.CHANNEL_TYPE.EMAIL?e.jsx("div",Object.assign({style:Object.assign({marginTop:h?16:0},null==b?void 0:b.templateContainerStyles)},{children:e.jsx(n.default,{template:c,handleViewTemplate:()=>{var e;null===(e=null==b?void 0:b.handleViewTemplate)||void 0===e||e.call(b)},hideHeader:C,hideViewButton:null==b?void 0:b.hideViewButtonForEmail,containerStyle:null==b?void 0:b.containerStyle,emailDisplayContent:null==b?void 0:b.emailDisplayContent,emailHtmlContainerId:null==b?void 0:b.emailHtmlContainerId,applyBorderBottom:w,hidePointerEvents:E})})):m===s.CHANNEL_TYPE.WHATSAPP||m===s.CHANNEL_TYPE.RCS?e.jsxs("div",Object.assign({style:Object.assign(Object.assign({},null==v?void 0:v.templateContainerStyles),h?u.WhatsAppWrapper:{}),onClick:()=>{var e,t;if(A&&T){if(-1===y&&!(null===(t=null===(e=null==c?void 0:c.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length))return;A(null!=y?y:-1)}}},{children:[h?e.jsx("div",Object.assign({style:{padding:16}},{children:e.jsx(a.TitleRegular,{children:l.default.convertToTitleCase(null!==(H=null==c?void 0:c.label)&&void 0!==H?H:"")})})):e.jsx(e.Fragment,{}),e.jsx(d.default,{showSampleValues:x,showHeader:null==v?void 0:v.showWhatsAppHeader,extras:null==v?void 0:v.whatsAppExtras,template:c,size:h?"small":null!=j?j:"large",containerStyle:Object.assign(Object.assign({borderWidth:h?0:1,borderTopWidth:1},null!==(f=null==v?void 0:v.containerStyle)&&void 0!==f?f:{}),{height:"100%"}),zeroStateComponent:null==v?void 0:v.zeroStateComponent,usePlaceHolderName:null==v?void 0:v.usePlaceHolderName,carouselCardIndex:y,isWhatsappCarousel:T,isPreview:P,channel:m})]})):m==s.CHANNEL_TYPE.WEBPUSH?e.jsx("div",Object.assign({style:Object.assign({},null==O?void 0:O.containerStyle)},{children:e.jsx(o.default,{template:c,extraContainerCss:null==O?void 0:O.extraContainerCss})})):e.jsx(e.Fragment,{})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../assets/icons/filePdf.svg.js"),r=require("../../../assets/icons/image.svg.js"),i=require("../../../assets/icons/videoRecorder.svg.js"),t=require("../../shimmer-image/ShimmerImage.js"),a=require("../../TypographyStyle.js"),d=require("../../../constants/Theme.js"),n=require("../models/TemplateMeta.js"),o=require("./ChatUI.style.js");const c=t=>{let{headerAssetName:c,mediaType:l}=t;const h=l===n.HEADER_TYPES.IMAGE?r.default:l===n.HEADER_TYPES.VIDEO?i.default:s.default;return e.jsxs(o.MediaContainer,{children:[e.jsx(h,{height:40,width:40,color:d.COLORS.icon.placeholder}),!!c&&e.jsx(a.BodySecondary,Object.assign({style:{color:d.COLORS.content.secondary,marginTop:8}},{children:c}))]})};exports.MediaCard=s=>{let{headerAssetLink:r,headerAssetName:i,mediaType:a,imagePreviewStyles:d}=s;if(!r||a===n.HEADER_TYPES.DOCUMENT)return e.jsx(c,Object.assign({},{headerAssetLink:r,headerAssetName:i,mediaType:a}));return e.jsx(o.MediaContainer,{children:a===n.HEADER_TYPES.IMAGE?e.jsx(t.ShimmerImage,{imageUrl:r,alt:r,width:"100%",height:240,borderRadius:8}):a===n.HEADER_TYPES.VIDEO?e.jsx("video",Object.assign({src:r,style:{width:"100%",minHeight:"240px",height:"240px",borderRadius:8},controls:!0,muted:!0},{children:e.jsx("track",{default:!0,kind:"captions",srcLang:"en",src:r})})):e.jsx(e.Fragment,{})})},exports.NoMediaCard=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../assets/icons/filePdf.svg.js"),r=require("../../../assets/icons/image.svg.js"),i=require("../../../assets/icons/videoRecorder.svg.js"),t=require("../../TypographyStyle.js"),a=require("../../../constants/Theme.js"),d=require("../models/TemplateMeta.js"),n=require("./ChatUI.style.js"),o=require("../../shimmer-image/ShimmerImage.js");const c=o=>{let{headerAssetName:c,mediaType:l}=o;const h=l===d.HEADER_TYPES.IMAGE?r.default:l===d.HEADER_TYPES.VIDEO?i.default:s.default;return e.jsxs(n.MediaContainer,{children:[e.jsx(h,{height:40,width:40,color:a.COLORS.icon.placeholder}),!!c&&e.jsx(t.BodySecondary,Object.assign({style:{color:a.COLORS.content.secondary,marginTop:8}},{children:c}))]})};exports.MediaCard=s=>{let{headerAssetLink:r,headerAssetName:i,mediaType:t,imagePreviewStyles:a}=s;if(!r||t===d.HEADER_TYPES.DOCUMENT)return e.jsx(c,Object.assign({},{headerAssetLink:r,headerAssetName:i,mediaType:t}));return e.jsx(n.MediaContainer,{children:t===d.HEADER_TYPES.IMAGE?e.jsx(o.ShimmerImage,{imageUrl:r,alt:r,width:"100%",height:240,borderRadius:8}):t===d.HEADER_TYPES.VIDEO?e.jsx("video",Object.assign({src:r,style:{width:"100%",minHeight:"240px",height:"240px",borderRadius:8},controls:!0,muted:!0},{children:e.jsx("track",{default:!0,kind:"captions",srcLang:"en",src:r})})):e.jsx(e.Fragment,{})})},exports.NoMediaCard=c;
@@ -54,7 +54,6 @@ export type WhatsAppTemplate = {
54
54
  isDraft?: boolean;
55
55
  newQualityScore?: TEMPLATE_QUALITY;
56
56
  previousQualityScore?: TEMPLATE_QUALITY;
57
- aiContentConfigId?: string;
58
57
  };
59
58
  export type WhatsappTemplateButtonTypes = 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE';
60
59
  export type CreateTemplateType = {
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { VariablePickerV3Props } from './model';
3
3
  type Props = VariablePickerV3Props;
4
+ export declare const highlightSearchText: (text: string, searchText: string) => string | import("react/jsx-runtime").JSX.Element;
4
5
  export declare const VariablePickerContent: React.FC<Props>;
5
6
  export {};