@bikdotai/bik-component-library 0.0.407-beta.2 → 0.0.407-beta.21

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 (117) hide show
  1. package/dist/cjs/assets/icons/lto_icon.svg.js +1 -0
  2. package/dist/cjs/components/SearchFilter/components/FilterChipListRenderer.js +1 -1
  3. package/dist/cjs/components/SearchFilter/components/SearchFilterItem.js +1 -1
  4. package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
  5. package/dist/cjs/components/alerts/Alert.d.ts +3 -1
  6. package/dist/cjs/components/alerts/Alert.js +1 -1
  7. package/dist/cjs/components/alerts/Alert.styled.d.ts +2 -1
  8. package/dist/cjs/components/alerts/Alert.styled.js +4 -4
  9. package/dist/cjs/components/alerts/AlertHelper.d.ts +5 -0
  10. package/dist/cjs/components/alerts/AlertHelper.js +1 -1
  11. package/dist/cjs/components/analytics-chips-and-dropdowns/CommonStyles.js +1 -1
  12. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  13. package/dist/cjs/components/bik-layout/BikProfile.js +1 -1
  14. package/dist/cjs/components/bik-layout/FeatureModalV2.js +1 -1
  15. package/dist/cjs/components/button/Button.js +1 -1
  16. package/dist/cjs/components/button/Button.styled.d.ts +1 -0
  17. package/dist/cjs/components/button/Button.styled.js +1 -1
  18. package/dist/cjs/components/button/model.d.ts +1 -0
  19. package/dist/cjs/components/custom-date-time/CustomDateTime.js +1 -1
  20. package/dist/cjs/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
  21. package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
  22. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  23. package/dist/cjs/components/input/Input.js +1 -1
  24. package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +1 -0
  25. package/dist/cjs/components/input-with-vars/InputWithVariables.js +1 -1
  26. package/dist/cjs/components/postPicker/postPicker.js +1 -1
  27. package/dist/cjs/components/shimmer-image/ShimmerImage.d.ts +1 -1
  28. package/dist/cjs/components/tag/Tag.styled.js +1 -1
  29. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  30. package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.d.ts +8 -0
  31. package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -0
  32. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +1 -1
  33. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  34. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  35. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
  36. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
  37. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  38. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +3 -3
  39. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +1 -1
  40. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  41. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  42. package/dist/cjs/components/template-context-mapper/modalElements/VariableEditorHeader.js +1 -1
  43. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  44. package/dist/cjs/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  45. package/dist/cjs/components/template-context-mapper/utils/getPreviewDimension.d.ts +2 -0
  46. package/dist/cjs/components/template-context-mapper/utils/getPreviewDimension.js +1 -0
  47. package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
  48. package/dist/cjs/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.d.ts +5 -0
  49. package/dist/cjs/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.js +20 -0
  50. package/dist/cjs/components/template-preview/WhatsApp/MediaCard.js +1 -1
  51. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  52. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -0
  53. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  54. package/dist/cjs/components/template-preview/models/TemplateMeta.d.ts +1 -1
  55. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +12 -1
  56. package/dist/cjs/components/tooltips/Tooltip.js +1 -1
  57. package/dist/cjs/index.js +1 -1
  58. package/dist/esm/assets/icons/lto_icon.svg.js +1 -0
  59. package/dist/esm/components/SearchFilter/components/FilterChipListRenderer.js +1 -1
  60. package/dist/esm/components/SearchFilter/components/SearchFilterItem.js +1 -1
  61. package/dist/esm/components/TablePagination/TablePagination.js +1 -1
  62. package/dist/esm/components/alerts/Alert.d.ts +3 -1
  63. package/dist/esm/components/alerts/Alert.js +1 -1
  64. package/dist/esm/components/alerts/Alert.styled.d.ts +2 -1
  65. package/dist/esm/components/alerts/Alert.styled.js +5 -5
  66. package/dist/esm/components/alerts/AlertHelper.d.ts +5 -0
  67. package/dist/esm/components/alerts/AlertHelper.js +1 -1
  68. package/dist/esm/components/analytics-chips-and-dropdowns/CommonStyles.js +1 -1
  69. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  70. package/dist/esm/components/bik-layout/BikProfile.js +1 -1
  71. package/dist/esm/components/bik-layout/FeatureModalV2.js +1 -1
  72. package/dist/esm/components/button/Button.js +1 -1
  73. package/dist/esm/components/button/Button.styled.d.ts +1 -0
  74. package/dist/esm/components/button/Button.styled.js +1 -1
  75. package/dist/esm/components/button/model.d.ts +1 -0
  76. package/dist/esm/components/custom-date-time/CustomDateTime.js +1 -1
  77. package/dist/esm/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
  78. package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
  79. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  80. package/dist/esm/components/input/Input.js +1 -1
  81. package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +1 -0
  82. package/dist/esm/components/input-with-vars/InputWithVariables.js +2 -2
  83. package/dist/esm/components/postPicker/postPicker.js +1 -1
  84. package/dist/esm/components/shimmer-image/ShimmerImage.d.ts +1 -1
  85. package/dist/esm/components/tag/Tag.styled.js +1 -1
  86. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  87. package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.d.ts +8 -0
  88. package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -0
  89. package/dist/esm/components/template-context-mapper/modalElements/Body.js +1 -1
  90. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  91. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  92. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
  93. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
  94. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  95. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +4 -4
  96. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +1 -1
  97. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  98. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  99. package/dist/esm/components/template-context-mapper/modalElements/VariableEditorHeader.js +1 -1
  100. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  101. package/dist/esm/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  102. package/dist/esm/components/template-context-mapper/utils/getPreviewDimension.d.ts +2 -0
  103. package/dist/esm/components/template-context-mapper/utils/getPreviewDimension.js +1 -0
  104. package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
  105. package/dist/esm/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.d.ts +5 -0
  106. package/dist/esm/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.js +20 -0
  107. package/dist/esm/components/template-preview/WhatsApp/MediaCard.js +1 -1
  108. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  109. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -0
  110. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  111. package/dist/esm/components/template-preview/models/TemplateMeta.d.ts +1 -1
  112. package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +12 -1
  113. package/dist/esm/components/tooltips/Tooltip.js +1 -1
  114. package/dist/esm/index.js +1 -1
  115. package/package.json +1 -1
  116. package/dist/cjs/assets/icons/video_camcorder.svg.js +0 -1
  117. package/dist/esm/assets/icons/video_camcorder.svg.js +0 -1
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import{cloneDeep as a}from"lodash";import{Button as s}from"../../button/Button.js";import"react";import{DISCOUNT_TYPES as n,MIN_PURCHASE_REQUIREMENT as o,DISCOUNT_VALUE_TYPES as l}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as r}from"../../dropdown/Dropdown.js";import"../../dropdown/ChipDropdown.js";import"../../zeroState/ZeroState.js";import{TitleRegular as d,TitleSmall as c,TitleMedium as u,BodyPrimary as p,BodySecondary as m}from"../../TypographyStyle.js";import{DEFAULT_THEME as v}from"../../../constants/Theme.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../checkBox/CheckBox.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import{Input as b}from"../../input/Input.js";import g from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import"../../modals/styledModal.js";import"../../../node_modules/lodash.debounce/index.js";import"../../bik-layout/CommonStyles.js";import"../../product-picker/ProductPicker.styled.js";import"../../../utils/DateUtils.js";import"../../tag/Tag.js";import"@tippyjs/react";import"../../tooltips/TooltipInternal.js";import"../../product-picker-v2/modal.js";import{DynamicCouponContainer as D}from"../DiscountModal.styled.js";import{CouponExpiration as h}from"../CouponExpiration/CouponExpiration.js";import{RadioButton as y}from"../../radioButton/RadioButton.js";import T from"../../../assets/icons/cursor.svg.js";import O from"../../../assets/icons/plus.svg.js";const j="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg";var x;function E(){return null}!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(x||(x={}));const _=_=>{var C;const N=[{value:n.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:_.selectedCouponType===n.AMOUNT_OFF_ORDER},{value:n.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:_.selectedCouponType===n.AMOUNT_OFF_PRODUCTS},{value:n.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:_.selectedCouponType===n.BUY_X_GET_Y},{value:n.FREE_SHIPPING,label:"Free shipping",selected:_.selectedCouponType===n.FREE_SHIPPING}],f=[{selected:_.selectedMinimumRequirement===o.NA,label:"No minimum requirements",value:o.NA},{selected:_.selectedMinimumRequirement===o.AMOUNT,label:`Minimum purchase amount (${null!==(C=_.currency)&&void 0!==C?C:"₹"})`,value:o.AMOUNT},{selected:_.selectedMinimumRequirement===o.QUANTITY,label:"Minimum quantity of items",value:o.QUANTITY}],F=()=>{var e,t,i,a,s;if(_.discountData.valueType===l.FIXED_AMOUNT){if((null===(e=_.discountData)||void 0===e?void 0:e.value)&&(null===(t=_.discountData)||void 0===t?void 0:t.value)<=0)return"Enter a valid input"}else if((null===(i=_.discountData)||void 0===i?void 0:i.value)&&((null===(a=_.discountData)||void 0===a?void 0:a.value)<=0||(null===(s=_.discountData)||void 0===s?void 0:s.value)>100))return"Enter a valid input"},I=()=>{var i,a,s,n,l;return e("div",Object.assign({className:"input__rows"},{children:[e("div",Object.assign({className:"input__wrapper"},{children:[t(m,Object.assign({style:{marginBottom:10}},{children:"Min purchase requirements"})),t(r,{options:f,placement:"bottom-start",onSelect:e=>{const t=e.value;_.setSelectedMinimumRequirement(t),_.setDiscountData(Object.assign(Object.assign({},_.discountData),{minQuantity:void 0,minAmount:void 0}))}})]})),t("div",Object.assign({className:"input__wrapper"},{children:_.selectedMinimumRequirement!==o.NA&&t(b,{value:_.selectedMinimumRequirement===o.AMOUNT?null!==(a=null===(i=_.discountData.minAmount)||void 0===i?void 0:i.toString())&&void 0!==a?a:"":null!==(n=null===(s=_.discountData.minQuantity)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",onChangeText:e=>{_.selectedMinimumRequirement===o.AMOUNT?_.setDiscountData(Object.assign(Object.assign({},_.discountData),{minAmount:parseInt(e)})):_.selectedMinimumRequirement===o.QUANTITY&&_.setDiscountData(Object.assign(Object.assign({},_.discountData),{minQuantity:parseInt(e)}))},labelText:_.selectedMinimumRequirement===o.AMOUNT?"Minimum purchase amount":"Minimum purchase quantity",prefixText:_.selectedMinimumRequirement===o.AMOUNT?null!==(l=_.currency)&&void 0!==l?l:"₹":void 0,type:"number",placeholder:_.selectedMinimumRequirement===o.AMOUNT?"1000.00":"2"})}))]}))},w=(n,o)=>{var l,r,u,p;let m=[],D=[],h={},y={};return _.useNewPicker?(h=n===x.ENTITLED?_.entitledProducts:_.prerequisiteProducts,y=null!==(l=n===x.ENTITLED?_.entitledCollections:_.prerequisiteCollections)&&void 0!==l?l:[],(null==h?void 0:h.isCustom)&&delete h.isCustom,(null==y?void 0:y.isCustom)&&delete y.isCustom,Object.values(h).forEach((e=>{Object.keys(e.products).forEach((t=>{m.push({id:t,name:e.products[t].name,image:e.products[t].image})}))})),Object.keys(y).forEach((e=>{"isCustom"!==e&&D.push({id:e,name:y[e].name,image:y[e].image})}))):(m=n===x.ENTITLED?_.entitledProducts:_.prerequisiteProducts,D=null!==(r=n===x.ENTITLED?_.entitledCollections:_.prerequisiteCollections)&&void 0!==r?r:[]),e(i,{children:[!o&&e(i,{children:[t(d,{children:n===x.PREREQUISITE?"Customer buys":"Customer gets"}),e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:n===x.ENTITLED?null===(u=_.discountData.entitledQuantity)||void 0===u?void 0:u.toString():null===(p=_.discountData.prerequisiteQuantity)||void 0===p?void 0:p.toString(),type:"number",onChangeText:e=>{n===x.ENTITLED?_.setDiscountData(Object.assign(Object.assign({},_.discountData),{entitledQuantity:parseInt(e)})):_.setDiscountData(Object.assign(Object.assign({},_.discountData),{prerequisiteQuantity:parseInt(e)}))},labelText:"Add quantity",placeholder:"Add quantity"})})),t("div",{className:"input__wrapper"})]}))]}),e("div",Object.assign({style:{display:"flex",gap:18}},{children:[!(null==D?void 0:D.length)&&t(s,{buttonText:"Add product",buttonType:"tertiary",LeadingIcon:O,onClick:()=>{_.setIsProductPickerOpen(n)}}),!(null==m?void 0:m.length)&&t(s,{buttonText:"Add collection",buttonType:"tertiary",LeadingIcon:O,onClick:()=>{_.setIsCollectionPickerOpen(n)}})]})),!!m.length&&e("div",Object.assign({style:{margin:"8px 0"}},{children:[t(c,{children:"Products"}),m.map((i=>e("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${v.colorsV2.stroke.primary}`,display:"flex"}},{children:[e("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[t("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),t(c,{children:i.name})]})),t("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:t("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(_.useNewPicker){const e=a(h);Object.values(e).forEach((e=>{var t,a;(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t[i.id])&&(null===(a=null==e?void 0:e.products)||void 0===a||delete a[i.id])})),n===x.ENTITLED?_.setEntitledProducts(e):_.setPrerequisiteProducts(e)}else{const e=m.filter((e=>e.id!==i.id));n===x.ENTITLED?_.setEntitledProducts(e):_.setPrerequisiteProducts(e)}}},{children:t(g,{width:14,color:v.colorsV2.content.primary})}))}))]}),i.id)))]})),!!D.length&&e("div",Object.assign({style:{margin:"8px 0"}},{children:[t(c,{children:"Collections"}),D.map((i=>e("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${v.colorsV2.stroke.primary}`,display:"flex"}},{children:[e("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[t("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),t(c,{children:i.name})]})),t("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:t("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(_.useNewPicker){const e=a(y);delete e[i.id],n===x.ENTITLED?_.setEntitledCollections(e):_.setPrerequisiteCollections(e)}else{const e=D.filter((e=>e.id!==i.id));n===x.ENTITLED?_.setEntitledCollections(e):_.setPrerequisiteCollections(e)}}},{children:t(g,{width:14,color:v.colorsV2.content.primary})}))}))]}),i.id)))]}))]})};return e(D,{children:[_.allowStaticCoupon&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(r,{options:N,width:"338px",placement:"bottom-start",onSelect:e=>{_.onChangeCouponType(e)}})})),t("div",Object.assign({className:"input__wrapper",style:{display:"flex",alignItems:"center",gap:8}},{children:(_.selectedCouponType===n.AMOUNT_OFF_PRODUCTS||_.selectedCouponType===n.AMOUNT_OFF_ORDER)&&e(i,{children:[t(y,{isActive:_.discountData.valueType===l.FIXED_AMOUNT,onValueChange:()=>{_.discountData.valueType!==l.FIXED_AMOUNT&&_.setDiscountData(Object.assign(Object.assign({},_.discountData),{valueType:l.FIXED_AMOUNT,value:void 0}))},label:"Fixed amount"}),t(y,{isActive:_.discountData.valueType===l.PERCENTAGE,onValueChange:()=>{_.discountData.valueType!==l.PERCENTAGE&&_.setDiscountData(Object.assign(Object.assign({},_.discountData),{valueType:l.PERCENTAGE,value:void 0}))},label:"Percentage"})]})}))]})),_.selectedCouponType===n.AMOUNT_OFF_ORDER&&(()=>{var a,s,n,o,r;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:null!==(n=null===(s=null===(a=_.discountData)||void 0===a?void 0:a.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",labelText:"Discount code value",type:"number",errorMessage:F(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:parseInt(e)}))},placeholder:_.discountData.valueType===l.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:_.discountData.valueType===l.FIXED_AMOUNT?null!==(o=_.currency)&&void 0!==o?o:"₹":void 0,suffixText:_.discountData.valueType===l.PERCENTAGE?"%":void 0})}))]})),I(),!_.hideProbability&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{type:"number",value:null===(r=_.discountData.probability)||void 0===r?void 0:r.toString(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)",maxCharLimit:4})})),t("div",{className:"input__wrapper"})]}))]})})(),_.selectedCouponType===n.AMOUNT_OFF_PRODUCTS&&(()=>{var a,s,n,o,r;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:null!==(n=null===(s=null===(a=_.discountData)||void 0===a?void 0:a.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",labelText:"Discount code value",type:"number",errorMessage:F(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:parseInt(e)}))},placeholder:_.discountData.valueType===l.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:_.discountData.valueType===l.FIXED_AMOUNT?null!==(o=_.currency)&&void 0!==o?o:"₹":void 0,suffixText:_.discountData.valueType===l.PERCENTAGE?"%":void 0})}))]})),w(x.ENTITLED,!0),!_.hideProbability&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{type:"number",value:null===(r=_.discountData.probability)||void 0===r?void 0:r.toString(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)",maxCharLimit:4})})),t("div",{className:"input__wrapper"})]}))]})})(),_.selectedCouponType===n.FREE_SHIPPING&&(()=>{var a;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},labelText:"Code title",placeholder:"eg: Flat 50% Off",maxCharLimit:18})})),t("div",Object.assign({className:"input__wrapper"},{children:!_.hideProbability&&t(b,{value:null===(a=_.discountData.probability)||void 0===a?void 0:a.toString(),type:"number",onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)",maxCharLimit:4})}))]})),I()]})})(),_.selectedCouponType===n.BUY_X_GET_Y&&(()=>{var i,a,s,n;return e(D,{children:[t("div",Object.assign({className:"input__rows"},{children:e("div",Object.assign({style:{display:"flex",gap:20,flex:1}},{children:[t("div",Object.assign({style:{flex:1}},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),!_.hideProbability&&t("div",Object.assign({style:{flex:1}},{children:t(b,{value:null===(i=_.discountData.probability)||void 0===i?void 0:i.toString(),type:"number",onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)",maxCharLimit:4})}))]}))})),t(E,{}),w(x.PREREQUISITE),t(E,{}),w(x.ENTITLED),t(E,{}),t(d,{children:"At a discount value"}),e("div",Object.assign({style:{display:"flex",gap:18,alignItems:"flex-start"}},{children:[t(y,{label:"Percentage",isActive:100!==_.discountData.value,onValueChange:()=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:void 0}))}}),100!==_.discountData.value&&t(b,{variant:"small",value:null!==(n=null===(s=null===(a=_.discountData)||void 0===a?void 0:a.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:parseInt(e)}))},errorMessage:F(),type:"number",placeholder:"Enter percentage eg: 10%",suffixText:"%",width:"238px"})]})),t("div",{children:t(y,{label:"Free",isActive:100===_.discountData.value,onValueChange:e=>{e?_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:100})):_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:void 0}))}})})]})})(),_.selectedCouponType&&!_.hideExpiration&&e(i,{children:[t("div",{style:_.selectedCouponType!==n.BUY_X_GET_Y&&_.selectedCouponType!==n.AMOUNT_OFF_PRODUCTS||!_.hideProbability?{height:6,borderTop:`1px solid ${v.colorsV2.stroke.primary}`,marginTop:12}:{}}),t(h,{discountData:_.discountData,setDiscountData:_.setDiscountData})]}),!_.selectedCouponType&&e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:10,padding:"40px 0",justifyContent:"center",alignItems:"center"}},{children:[t("div",Object.assign({style:{height:52,width:52,backgroundColor:v.colorsV2.background.inverse,borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},{children:t(T,{width:32,color:v.colorsV2.content.primaryInverse})})),t(u,{children:"No discount has been selected"}),t(p,{children:"Please select a discount type"})]}))]})};export{x as DISCOUNT_PRODUCTS,_ as default};
1
+ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import{cloneDeep as a}from"lodash";import{Button as s}from"../../button/Button.js";import"react";import{DISCOUNT_TYPES as n,MIN_PURCHASE_REQUIREMENT as o,DISCOUNT_VALUE_TYPES as l}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as r}from"../../dropdown/Dropdown.js";import"../../dropdown/ChipDropdown.js";import"../../zeroState/ZeroState.js";import{TitleRegular as d,TitleSmall as c,TitleMedium as u,BodyPrimary as p,BodySecondary as m}from"../../TypographyStyle.js";import{DEFAULT_THEME as v}from"../../../constants/Theme.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../checkBox/CheckBox.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import{Input as b}from"../../input/Input.js";import g from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import"../../modals/styledModal.js";import"../../../node_modules/lodash.debounce/index.js";import"../../bik-layout/CommonStyles.js";import"../../product-picker/ProductPicker.styled.js";import"../../../utils/DateUtils.js";import"../../tag/Tag.js";import"../../tooltips/Tooltip.js";import"../../product-picker-v2/modal.js";import{DynamicCouponContainer as D}from"../DiscountModal.styled.js";import{CouponExpiration as h}from"../CouponExpiration/CouponExpiration.js";import{RadioButton as T}from"../../radioButton/RadioButton.js";import y from"../../../assets/icons/cursor.svg.js";import O from"../../../assets/icons/plus.svg.js";const j="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg";var x;function E(){return null}!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(x||(x={}));const _=_=>{var C;const N=[{value:n.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:_.selectedCouponType===n.AMOUNT_OFF_ORDER},{value:n.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:_.selectedCouponType===n.AMOUNT_OFF_PRODUCTS},{value:n.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:_.selectedCouponType===n.BUY_X_GET_Y},{value:n.FREE_SHIPPING,label:"Free shipping",selected:_.selectedCouponType===n.FREE_SHIPPING}],f=[{selected:_.selectedMinimumRequirement===o.NA,label:"No minimum requirements",value:o.NA},{selected:_.selectedMinimumRequirement===o.AMOUNT,label:`Minimum purchase amount (${null!==(C=_.currency)&&void 0!==C?C:"₹"})`,value:o.AMOUNT},{selected:_.selectedMinimumRequirement===o.QUANTITY,label:"Minimum quantity of items",value:o.QUANTITY}],F=()=>{var e,t,i,a,s;if(_.discountData.valueType===l.FIXED_AMOUNT){if((null===(e=_.discountData)||void 0===e?void 0:e.value)&&(null===(t=_.discountData)||void 0===t?void 0:t.value)<=0)return"Enter a valid input"}else if((null===(i=_.discountData)||void 0===i?void 0:i.value)&&((null===(a=_.discountData)||void 0===a?void 0:a.value)<=0||(null===(s=_.discountData)||void 0===s?void 0:s.value)>100))return"Enter a valid input"},I=()=>{var i,a,s,n,l;return e("div",Object.assign({className:"input__rows"},{children:[e("div",Object.assign({className:"input__wrapper"},{children:[t(m,Object.assign({style:{marginBottom:10}},{children:"Min purchase requirements"})),t(r,{options:f,placement:"bottom-start",onSelect:e=>{const t=e.value;_.setSelectedMinimumRequirement(t),_.setDiscountData(Object.assign(Object.assign({},_.discountData),{minQuantity:void 0,minAmount:void 0}))}})]})),t("div",Object.assign({className:"input__wrapper"},{children:_.selectedMinimumRequirement!==o.NA&&t(b,{value:_.selectedMinimumRequirement===o.AMOUNT?null!==(a=null===(i=_.discountData.minAmount)||void 0===i?void 0:i.toString())&&void 0!==a?a:"":null!==(n=null===(s=_.discountData.minQuantity)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",onChangeText:e=>{_.selectedMinimumRequirement===o.AMOUNT?_.setDiscountData(Object.assign(Object.assign({},_.discountData),{minAmount:parseInt(e)})):_.selectedMinimumRequirement===o.QUANTITY&&_.setDiscountData(Object.assign(Object.assign({},_.discountData),{minQuantity:parseInt(e)}))},labelText:_.selectedMinimumRequirement===o.AMOUNT?"Minimum purchase amount":"Minimum purchase quantity",prefixText:_.selectedMinimumRequirement===o.AMOUNT?null!==(l=_.currency)&&void 0!==l?l:"₹":void 0,type:"number",placeholder:_.selectedMinimumRequirement===o.AMOUNT?"1000.00":"2"})}))]}))},w=(n,o)=>{var l,r,u,p;let m=[],D=[],h={},T={};return _.useNewPicker?(h=n===x.ENTITLED?_.entitledProducts:_.prerequisiteProducts,T=null!==(l=n===x.ENTITLED?_.entitledCollections:_.prerequisiteCollections)&&void 0!==l?l:[],(null==h?void 0:h.isCustom)&&delete h.isCustom,(null==T?void 0:T.isCustom)&&delete T.isCustom,Object.values(h).forEach((e=>{Object.keys(e.products).forEach((t=>{m.push({id:t,name:e.products[t].name,image:e.products[t].image})}))})),Object.keys(T).forEach((e=>{"isCustom"!==e&&D.push({id:e,name:T[e].name,image:T[e].image})}))):(m=n===x.ENTITLED?_.entitledProducts:_.prerequisiteProducts,D=null!==(r=n===x.ENTITLED?_.entitledCollections:_.prerequisiteCollections)&&void 0!==r?r:[]),e(i,{children:[!o&&e(i,{children:[t(d,{children:n===x.PREREQUISITE?"Customer buys":"Customer gets"}),e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:n===x.ENTITLED?null===(u=_.discountData.entitledQuantity)||void 0===u?void 0:u.toString():null===(p=_.discountData.prerequisiteQuantity)||void 0===p?void 0:p.toString(),type:"number",onChangeText:e=>{n===x.ENTITLED?_.setDiscountData(Object.assign(Object.assign({},_.discountData),{entitledQuantity:parseInt(e)})):_.setDiscountData(Object.assign(Object.assign({},_.discountData),{prerequisiteQuantity:parseInt(e)}))},labelText:"Add quantity",placeholder:"Add quantity"})})),t("div",{className:"input__wrapper"})]}))]}),e("div",Object.assign({style:{display:"flex",gap:18}},{children:[!(null==D?void 0:D.length)&&t(s,{buttonText:"Add product",buttonType:"tertiary",LeadingIcon:O,onClick:()=>{_.setIsProductPickerOpen(n)}}),!(null==m?void 0:m.length)&&t(s,{buttonText:"Add collection",buttonType:"tertiary",LeadingIcon:O,onClick:()=>{_.setIsCollectionPickerOpen(n)}})]})),!!m.length&&e("div",Object.assign({style:{margin:"8px 0"}},{children:[t(c,{children:"Products"}),m.map((i=>e("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${v.colorsV2.stroke.primary}`,display:"flex"}},{children:[e("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[t("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),t(c,{children:i.name})]})),t("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:t("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(_.useNewPicker){const e=a(h);Object.values(e).forEach((e=>{var t,a;(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t[i.id])&&(null===(a=null==e?void 0:e.products)||void 0===a||delete a[i.id])})),n===x.ENTITLED?_.setEntitledProducts(e):_.setPrerequisiteProducts(e)}else{const e=m.filter((e=>e.id!==i.id));n===x.ENTITLED?_.setEntitledProducts(e):_.setPrerequisiteProducts(e)}}},{children:t(g,{width:14,color:v.colorsV2.content.primary})}))}))]}),i.id)))]})),!!D.length&&e("div",Object.assign({style:{margin:"8px 0"}},{children:[t(c,{children:"Collections"}),D.map((i=>e("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${v.colorsV2.stroke.primary}`,display:"flex"}},{children:[e("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[t("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),t(c,{children:i.name})]})),t("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:t("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(_.useNewPicker){const e=a(T);delete e[i.id],n===x.ENTITLED?_.setEntitledCollections(e):_.setPrerequisiteCollections(e)}else{const e=D.filter((e=>e.id!==i.id));n===x.ENTITLED?_.setEntitledCollections(e):_.setPrerequisiteCollections(e)}}},{children:t(g,{width:14,color:v.colorsV2.content.primary})}))}))]}),i.id)))]}))]})};return e(D,{children:[_.allowStaticCoupon&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(r,{options:N,width:"338px",placement:"bottom-start",onSelect:e=>{_.onChangeCouponType(e)}})})),t("div",Object.assign({className:"input__wrapper",style:{display:"flex",alignItems:"center",gap:8}},{children:(_.selectedCouponType===n.AMOUNT_OFF_PRODUCTS||_.selectedCouponType===n.AMOUNT_OFF_ORDER)&&e(i,{children:[t(T,{isActive:_.discountData.valueType===l.FIXED_AMOUNT,onValueChange:()=>{_.discountData.valueType!==l.FIXED_AMOUNT&&_.setDiscountData(Object.assign(Object.assign({},_.discountData),{valueType:l.FIXED_AMOUNT,value:void 0}))},label:"Fixed amount"}),t(T,{isActive:_.discountData.valueType===l.PERCENTAGE,onValueChange:()=>{_.discountData.valueType!==l.PERCENTAGE&&_.setDiscountData(Object.assign(Object.assign({},_.discountData),{valueType:l.PERCENTAGE,value:void 0}))},label:"Percentage"})]})}))]})),_.selectedCouponType===n.AMOUNT_OFF_ORDER&&(()=>{var a,s,n,o,r;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:null!==(n=null===(s=null===(a=_.discountData)||void 0===a?void 0:a.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",labelText:"Discount code value",type:"number",errorMessage:F(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:parseInt(e)}))},placeholder:_.discountData.valueType===l.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:_.discountData.valueType===l.FIXED_AMOUNT?null!==(o=_.currency)&&void 0!==o?o:"₹":void 0,suffixText:_.discountData.valueType===l.PERCENTAGE?"%":void 0})}))]})),I(),!_.hideProbability&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{type:"number",value:null===(r=_.discountData.probability)||void 0===r?void 0:r.toString(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)",maxCharLimit:4})})),t("div",{className:"input__wrapper"})]}))]})})(),_.selectedCouponType===n.AMOUNT_OFF_PRODUCTS&&(()=>{var a,s,n,o,r;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:null!==(n=null===(s=null===(a=_.discountData)||void 0===a?void 0:a.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",labelText:"Discount code value",type:"number",errorMessage:F(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:parseInt(e)}))},placeholder:_.discountData.valueType===l.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:_.discountData.valueType===l.FIXED_AMOUNT?null!==(o=_.currency)&&void 0!==o?o:"₹":void 0,suffixText:_.discountData.valueType===l.PERCENTAGE?"%":void 0})}))]})),w(x.ENTITLED,!0),!_.hideProbability&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{type:"number",value:null===(r=_.discountData.probability)||void 0===r?void 0:r.toString(),onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)",maxCharLimit:4})})),t("div",{className:"input__wrapper"})]}))]})})(),_.selectedCouponType===n.FREE_SHIPPING&&(()=>{var a;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},labelText:"Code title",placeholder:"eg: Flat 50% Off",maxCharLimit:18})})),t("div",Object.assign({className:"input__wrapper"},{children:!_.hideProbability&&t(b,{value:null===(a=_.discountData.probability)||void 0===a?void 0:a.toString(),type:"number",onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)",maxCharLimit:4})}))]})),I()]})})(),_.selectedCouponType===n.BUY_X_GET_Y&&(()=>{var i,a,s,n;return e(D,{children:[t("div",Object.assign({className:"input__rows"},{children:e("div",Object.assign({style:{display:"flex",gap:20,flex:1}},{children:[t("div",Object.assign({style:{flex:1}},{children:t(b,{value:_.discountData.title,onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),!_.hideProbability&&t("div",Object.assign({style:{flex:1}},{children:t(b,{value:null===(i=_.discountData.probability)||void 0===i?void 0:i.toString(),type:"number",onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)",maxCharLimit:4})}))]}))})),t(E,{}),w(x.PREREQUISITE),t(E,{}),w(x.ENTITLED),t(E,{}),t(d,{children:"At a discount value"}),e("div",Object.assign({style:{display:"flex",gap:18,alignItems:"flex-start"}},{children:[t(T,{label:"Percentage",isActive:100!==_.discountData.value,onValueChange:()=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:void 0}))}}),100!==_.discountData.value&&t(b,{variant:"small",value:null!==(n=null===(s=null===(a=_.discountData)||void 0===a?void 0:a.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",onChangeText:e=>{_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:parseInt(e)}))},errorMessage:F(),type:"number",placeholder:"Enter percentage eg: 10%",suffixText:"%",width:"238px"})]})),t("div",{children:t(T,{label:"Free",isActive:100===_.discountData.value,onValueChange:e=>{e?_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:100})):_.setDiscountData(Object.assign(Object.assign({},_.discountData),{value:void 0}))}})})]})})(),_.selectedCouponType&&!_.hideExpiration&&e(i,{children:[t("div",{style:_.selectedCouponType!==n.BUY_X_GET_Y&&_.selectedCouponType!==n.AMOUNT_OFF_PRODUCTS||!_.hideProbability?{height:6,borderTop:`1px solid ${v.colorsV2.stroke.primary}`,marginTop:12}:{}}),t(h,{discountData:_.discountData,setDiscountData:_.setDiscountData})]}),!_.selectedCouponType&&e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:10,padding:"40px 0",justifyContent:"center",alignItems:"center"}},{children:[t("div",Object.assign({style:{height:52,width:52,backgroundColor:v.colorsV2.background.inverse,borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},{children:t(y,{width:32,color:v.colorsV2.content.primaryInverse})})),t(u,{children:"No discount has been selected"}),t(p,{children:"Please select a discount type"})]}))]})};export{x as DISCOUNT_PRODUCTS,_ as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{forwardRef as i,useState as r,useContext as l,useRef as o,useEffect as a}from"react";import{Button as s}from"../button/Button.js";import{isFunction as c,validateInput as u}from"./Input-helper.js";import{BodySecondary as v}from"../TypographyStyle.js";import d from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as h}from"./context/InputStyleProvider.js";import{RootContainer as p,InputFooter as g,InputWrapper as f,IconHolder as m,PrefixHolder as x,InputContainer as y,InputContainerSmall as b,SuffixHolder as j,InputHeader as C,MaxCharStyle as w}from"./Input.styled.js";const I=i(((i,I)=>{var O,k,L,T,D;const{placeholder:A,leftIcon:E,rightIcon:F,labelText:M,maxCharLimit:z,isRequired:B,hintText:S,type:K,state:R,validate:H,variant:q,button:N,suffixText:P,prefixText:V,onChangeText:W,value:G,noErrorHint:J,reset:Q,rangeValidation:U,noKeyDownChange:X,version:Y,noMaxCharCheck:Z}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},i),$=null==E?void 0:E.icon,_=null==F?void 0:F.icon,[ee,te]=r(!1),[ne,ie]=r(!1),[re,le]=r(),oe="small"===q?"18px":"22px",ae=l(h),[se,ce]=r(),ue=o(null),ve=null!=I?I:ue;a((()=>{ce(G)}),[G]),a((()=>{var e;ve.current&&(null===(e=i.onReferenceInit)||void 0===e||e.call(i,ve.current))}),[ve]),a((()=>{const e=ve.current;if(e)return e.addEventListener("wheel",ge,{passive:!1}),()=>{e.removeEventListener("wheel",ge)}}),[]),a((()=>{Q&&ce("")}),[Q]),a((()=>{var e;ie(!!i.isActive),i.isActive&&(null===(e=ve.current)||void 0===e||e.focus())}),[i.isActive]),a((()=>{le(i.errorMessage)}),[i.errorMessage]),a((()=>{var e;te(!1),("invalid"===i.state||re)&&te(!0),"active"===i.state&&(null===(e=ve.current)||void 0===e||e.focus())}),[i.state,re]),a((()=>{te(!!re)}),[re]);const de=function(e){if(c(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e(...n)}},he=()=>"zip"===K?6:60,pe=e=>{const t=z||he();if(X||W(G||"",e),Z)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},ge=e=>{e.preventDefault()},fe=e=>{const t=e.target.value,n=z||he();if(!Z&&n>0&&t.length>=n)return void e.preventDefault();W(t,e),i.textControl||ce(t);const r=H||u;if(!r||!c(r))return;const[l,o]=r(t,K,U);te(!l),le(i.errorMessage?i.errorMessage:o)},me=e=>{var t;i.skipFocus||ie(!0),de(null===(t=i.onFocus)||void 0===t?void 0:t.call(i,e))},xe=e=>{var t;i.skipFocus||ie(!1),de(null===(t=i.onBlur)||void 0===t?void 0:t.call(i,e))},ye=()=>{var r;return e(n,{children:["multiline"!==K&&t("input",{id:i.id,style:null!==(r=null==ae?void 0:ae.input)&&void 0!==r?r:{},ref:ve,type:["phonenumber","zip","number"].includes(K)?"number":K,value:se,onFocus:e=>me(e),onBlur:e=>xe(e),placeholder:A||"Enter here",onChange:fe,onKeyDown:e=>pe(e)}),"multiline"===K&&t("textarea",{value:se,ref:ve,onFocus:e=>me(e),onBlur:e=>xe(e),placeholder:A||"Enter here",onChange:fe,onKeyDown:e=>pe(e),maxLength:z>0?z:void 0})]})};return e(p,Object.assign({width:i.width,height:i.height,state:R,type:K,style:null!==(O=null==ae?void 0:ae.RootContainer)&&void 0!==O?O:{}},{children:[!J&&(!!S||!!re)&&e(g,Object.assign({invalid:!!re},{children:[!!re&&t(d,{width:16,height:16}),re||S]})),e(f,Object.assign({variant:q,state:R,width:i.width,isActive:"active"===R||ne,isInvalid:ee,style:null!==(k=null==ae?void 0:ae.InputWrapper)&&void 0!==k?k:{},version:Y,height:i.height},{children:[!!$&&t(m,Object.assign({variant:q,iconSize:oe,onClick:()=>de(null==E?void 0:E.callback),isLeft:!0,style:null!==(L=null==ae?void 0:ae.IconHolder)&&void 0!==L?L:{}},{children:t($,{})})),!!V&&t(x,Object.assign({variant:q},{children:V})),"default"===q&&t(y,Object.assign({height:i.height,type:i.type},{children:ye()})),"small"===q&&t(b,Object.assign({height:i.height,type:i.type},{children:ye()})),!!_&&t(m,Object.assign({variant:q,iconSize:oe,onClick:()=>de(null==F?void 0:F.callback),isLeft:!1},{children:t(_,{})})),!!P&&t(j,Object.assign({variant:q},{children:P})),N&&N.text&&t(s,{buttonText:N.text,onClick:()=>de(null==N?void 0:N.onClick)})]})),(!!M||!!z)&&e(C,Object.assign({invalid:ee},{children:[e(v,{children:[M,B?t("span",{children:"*"}):""]}),z>0&&e(w,{children:[null!==(D=null===(T=i.value)||void 0===T?void 0:T.length)&&void 0!==D?D:0,"/",z]})]}))]}))}));I.displayName="Input";export{I as Input};
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{forwardRef as i,useState as r,useContext as l,useRef as o,useEffect as a}from"react";import{Button as s}from"../button/Button.js";import{isFunction as c,validateInput as u}from"./Input-helper.js";import{BodySecondary as v}from"../TypographyStyle.js";import d from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as h}from"./context/InputStyleProvider.js";import{RootContainer as p,InputFooter as g,InputWrapper as f,IconHolder as m,PrefixHolder as x,InputContainer as y,InputContainerSmall as b,SuffixHolder as j,InputHeader as C,MaxCharStyle as w}from"./Input.styled.js";const I=i(((i,I)=>{var O,k,L,T,D;const{placeholder:A,leftIcon:E,rightIcon:F,labelText:M,maxCharLimit:z,isRequired:B,hintText:S,type:K,state:R,validate:H,variant:q,button:N,suffixText:P,prefixText:V,onChangeText:W,value:G,noErrorHint:J,reset:Q,rangeValidation:U,noKeyDownChange:X,version:Y,noMaxCharCheck:Z}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},i),$=null==E?void 0:E.icon,_=null==F?void 0:F.icon,[ee,te]=r(!1),[ne,ie]=r(!1),[re,le]=r(),oe="small"===q?"18px":"22px",ae=l(h),[se,ce]=r(),ue=o(null),ve=null!=I?I:ue;a((()=>{ce(G)}),[G]),a((()=>{var e;ve.current&&(null===(e=i.onReferenceInit)||void 0===e||e.call(i,ve.current))}),[ve]),a((()=>{const e=ve.current;if(e)return e.addEventListener("wheel",ge,{passive:!1}),()=>{e.removeEventListener("wheel",ge)}}),[]),a((()=>{Q&&ce("")}),[Q]),a((()=>{var e;ie(!!i.isActive),i.isActive&&(null===(e=ve.current)||void 0===e||e.focus())}),[i.isActive]),a((()=>{le(i.errorMessage)}),[i.errorMessage]),a((()=>{var e;te(!1),("invalid"===i.state||re)&&te(!0),"active"===i.state&&(null===(e=ve.current)||void 0===e||e.focus())}),[i.state,re]),a((()=>{te(!!re)}),[re]);const de=function(e){if(c(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e(...n)}},he=()=>"zip"===K?6:60,pe=e=>{const t=0!==z?z:he();if(X||W(G||"",e),Z)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},ge=e=>{e.preventDefault()},fe=e=>{const t=e.target.value,n=0!==z?z+1:he();if(!Z&&n>0&&t.length>=n)return void e.preventDefault();W(t,e),i.textControl||ce(t);const r=H||u;if(!r||!c(r))return;const[l,o]=r(t,K,U);te(!l),le(i.errorMessage?i.errorMessage:o)},me=e=>{var t;i.skipFocus||ie(!0),de(null===(t=i.onFocus)||void 0===t?void 0:t.call(i,e))},xe=e=>{var t;i.skipFocus||ie(!1),de(null===(t=i.onBlur)||void 0===t?void 0:t.call(i,e))},ye=()=>{var r;return e(n,{children:["multiline"!==K&&t("input",{id:i.id,style:null!==(r=null==ae?void 0:ae.input)&&void 0!==r?r:{},ref:ve,type:["phonenumber","zip","number"].includes(K)?"number":K,value:se,onFocus:e=>me(e),onBlur:e=>xe(e),placeholder:A||"Enter here",onChange:fe,onKeyDown:e=>pe(e)}),"multiline"===K&&t("textarea",{value:se,ref:ve,onFocus:e=>me(e),onBlur:e=>xe(e),placeholder:A||"Enter here",onChange:fe,onKeyDown:e=>pe(e),maxLength:z>0?z:void 0})]})};return e(p,Object.assign({width:i.width,height:i.height,state:R,type:K,style:null!==(O=null==ae?void 0:ae.RootContainer)&&void 0!==O?O:{}},{children:[!J&&(!!S||!!re)&&e(g,Object.assign({invalid:!!re},{children:[!!re&&t(d,{width:16,height:16}),re||S]})),e(f,Object.assign({variant:q,state:R,width:i.width,isActive:"active"===R||ne,isInvalid:ee,style:null!==(k=null==ae?void 0:ae.InputWrapper)&&void 0!==k?k:{},version:Y,height:i.height},{children:[!!$&&t(m,Object.assign({variant:q,iconSize:oe,onClick:()=>de(null==E?void 0:E.callback),isLeft:!0,style:null!==(L=null==ae?void 0:ae.IconHolder)&&void 0!==L?L:{}},{children:t($,{})})),!!V&&t(x,Object.assign({variant:q},{children:V})),"default"===q&&t(y,Object.assign({height:i.height,type:i.type},{children:ye()})),"small"===q&&t(b,Object.assign({height:i.height,type:i.type},{children:ye()})),!!_&&t(m,Object.assign({variant:q,iconSize:oe,onClick:()=>de(null==F?void 0:F.callback),isLeft:!1},{children:t(_,{})})),!!P&&t(j,Object.assign({variant:q},{children:P})),N&&N.text&&t(s,{buttonText:N.text,onClick:()=>de(null==N?void 0:N.onClick)})]})),(!!M||!!z)&&e(C,Object.assign({invalid:ee},{children:[e(v,{children:[M,B?t("span",{children:"*"}):""]}),z>0&&e(w,{children:[null!==(D=null===(T=i.value)||void 0===T?void 0:T.length)&&void 0!==D?D:0,"/",z]})]}))]}))}));I.displayName="Input";export{I as Input};
@@ -15,6 +15,7 @@ interface InputWithVariablesProps {
15
15
  showAddButton?: boolean;
16
16
  errorMessage?: string;
17
17
  showSideModal?: boolean;
18
+ noMaxCharCheck?: boolean;
18
19
  }
19
20
  export declare const InputWithVariables: React.FC<InputWithVariablesProps>;
20
21
  export {};
@@ -1,6 +1,6 @@
1
- import{jsxs as e,Fragment as a,jsx as l}from"react/jsx-runtime";import r from"../../assets/icons/PlusIcon.js";import{useRef as i,useState as d,useEffect as t}from"react";import o from"styled-components";import{v4 as s}from"uuid";import{COLORS as n}from"../../constants/Theme.js";import{AddVariableV2SideModal as u}from"../add-variableV2/AddVariableV2SideModal.js";import{AddVariableV2 as c}from"../add-variableV2/AddVariableV2.js";import{AddVariableStyled as v}from"../add-variableV2/AddVariableBox.styled.js";import{Input as p}from"../input/Input.js";import{BodyCaption as g}from"../TypographyStyle.js";const m=o=>{let{addVarBoxRight:n,allowMix:m,onChange:h,prevVariable:V,variablesList:T,onBlur:y,onlyVariables:f,placeHolder:j,showAddButton:x=!0,showHelp:w,showSideVariablePanel:B,errorMessage:S,showSideModal:A}=o;const N=i(null),[C,O]=d(!1),[k]=d(s()),[I,L]=d(),[M,E]=d(V),[F,q]=d(!1),[Z,$]=d(!1),[z,H]=d(S||"");return t((()=>{I&&I.actualValue&&E(m?e=>({actualValue:e.actualValue+I.actualValue,variableType:"string"}):e=>({actualValue:I.actualValue,variableType:I.variableType,needsFetching:I.needsFetching}))}),[I]),t((()=>{h(M)}),[M]),e(a,{children:[e(b,Object.assign({isVar:/^{{.*}}$/.test(M.actualValue)},{children:[l(p,{id:k,ref:N,skipFocus:!0,textControl:!0,isActive:C,value:M.actualValue,validate:e=>[!0,""],errorMessage:z,placeholder:j||"Add a value",onChangeText:(e,a)=>{if(H(""),f){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||E({actualValue:"",variableType:"string"})}else E(m?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{O(!0),$(!0),document.getElementById("varList")&&!F&&q(!0)},onBlur:e=>{var a,l,r,i,d,t;null==y||y(e,M),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"varList"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(i=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===i?void 0:i.includes("exlualr0"))||(null===(t=null===(d=e.relatedTarget)||void 0===d?void 0:d.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?(N.current&&N.current.focus(),O(!0)):document.getElementById("varList")?O(!0):(O(!1),q(!1),$(!1))}}),e("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[M.actualValue&&w&&l("div",Object.assign({style:{marginTop:4}},{children:l(g,{children:`This value is of type ${M.variableType}`})})),x&&Z&&l("div",Object.assign({style:{marginTop:S?"-24px":"0px"}},{children:l(v,Object.assign({right:n,id:"addVar",onClick:()=>{q(!F)}},{children:e("div",Object.assign({className:"add"},{children:[l(r,{color:"white"}),l("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),!B&&F&&l(c,{data:T,showVariable:!0,setShowVariable:()=>{q(!1)},variableValue:I,setVariableValue:L,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,i,d,t;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?N.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==k&&(q(!1),$(!1),O(!1)):(q(!1),$(!1),O(!1))}})]})),B&&F&&l(u,{zIndex:2e3,data:null!=T?T:[],showVariable:F,setShowVariable:()=>{q(!1)},placeholder:"Add a variable",customTrigger:e=>{L({actualValue:e.actualValue,variableType:"string"}),E(e)},onSearchBlur:e=>{var a,l,r,i,d,t;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?N.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==k&&(q(!1),$(!1),O(!1)):(q(!1),$(!1),O(!1))}})]})},b=o.div`
1
+ import{jsxs as e,Fragment as a,jsx as l}from"react/jsx-runtime";import r from"../../assets/icons/PlusIcon.js";import{useRef as i,useState as d,useEffect as t}from"react";import o from"styled-components";import{v4 as s}from"uuid";import{COLORS as n}from"../../constants/Theme.js";import{AddVariableV2SideModal as u}from"../add-variableV2/AddVariableV2SideModal.js";import{AddVariableV2 as c}from"../add-variableV2/AddVariableV2.js";import{AddVariableStyled as v}from"../add-variableV2/AddVariableBox.styled.js";import{Input as p}from"../input/Input.js";import{BodyCaption as g}from"../TypographyStyle.js";const h=o=>{let{addVarBoxRight:n,allowMix:h,onChange:b,prevVariable:V,variablesList:T,onBlur:y,onlyVariables:f,placeHolder:x,showAddButton:j=!0,showHelp:w,showSideVariablePanel:C,errorMessage:B,showSideModal:S,noMaxCharCheck:k}=o;const A=i(null),[N,M]=d(!1),[O]=d(s()),[I,L]=d(),[E,F]=d(V),[q,Z]=d(!1),[$,z]=d(!1),[H,P]=d(B||"");return t((()=>{I&&I.actualValue&&F(h?e=>({actualValue:e.actualValue+I.actualValue,variableType:"string"}):e=>({actualValue:I.actualValue,variableType:I.variableType,needsFetching:I.needsFetching}))}),[I]),t((()=>{b(E)}),[E]),e(a,{children:[e(m,Object.assign({isVar:/^{{.*}}$/.test(E.actualValue)},{children:[l(p,{id:O,ref:A,skipFocus:!0,textControl:!0,isActive:N,value:E.actualValue,validate:e=>[!0,""],errorMessage:H,placeholder:x||"Add a value",onChangeText:(e,a)=>{if(P(""),f){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||F({actualValue:"",variableType:"string"})}else F(h?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{M(!0),z(!0),document.getElementById("varList")&&!q&&Z(!0)},onBlur:e=>{var a,l,r,i,d,t;null==y||y(e,E),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"varList"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(i=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===i?void 0:i.includes("exlualr0"))||(null===(t=null===(d=e.relatedTarget)||void 0===d?void 0:d.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?(A.current&&A.current.focus(),M(!0)):document.getElementById("varList")?M(!0):(M(!1),Z(!1),z(!1))},noMaxCharCheck:k}),e("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[E.actualValue&&w&&l("div",Object.assign({style:{marginTop:4}},{children:l(g,{children:`This value is of type ${E.variableType}`})})),j&&$&&l("div",Object.assign({style:{marginTop:B?"-24px":"0px"}},{children:l(v,Object.assign({right:n,id:"addVar",onClick:()=>{Z(!q)}},{children:e("div",Object.assign({className:"add"},{children:[l(r,{color:"white"}),l("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),!C&&q&&l(c,{data:T,showVariable:!0,setShowVariable:()=>{Z(!1)},variableValue:I,setVariableValue:L,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,i,d,t;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?A.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==O&&(Z(!1),z(!1),M(!1)):(Z(!1),z(!1),M(!1))}})]})),C&&q&&l(u,{zIndex:2e3,data:null!=T?T:[],showVariable:q,setShowVariable:()=>{Z(!1)},placeholder:"Add a variable",customTrigger:e=>{L({actualValue:e.actualValue,variableType:"string"}),F(e)},onSearchBlur:e=>{var a,l,r,i,d,t;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?A.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==O&&(Z(!1),z(!1),M(!1)):(Z(!1),z(!1),M(!1))}})]})},m=o.div`
2
2
  margin-bottom: 16px;
3
3
  input {
4
4
  color: ${e=>e.isVar?n.stroke.brand:"black"};
5
5
  }
6
- `;export{m as InputWithVariables};
6
+ `;export{h as InputWithVariables};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as a}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{StyledProductGrid as o,StyledProduct as r}from"./PostPicker.styled.js";import{Tag as s}from"../tag/Tag.js";import{ButtonRegular as l,BodyPrimary as d,BodyCaption as c,TitleMedium as p,ButtonLarge as m,BodySecondary as h}from"../TypographyStyle.js";import{unCamelCase as y}from"../../utils/unCamelCase.js";import{PRIMARY as g}from"../../constants/colors.js";import{COLORS as u}from"../../constants/Theme.js";import j from"../../assets/icons/instagram.svg.js";import w from"../../assets/icons/warning.svg.js";import{StyledModal as f}from"../modals/styledModal.js";import{BikShimmer as v}from"../shimmer/ShimmerComponent/BikShimmer.js";import{ShimmerImage as b}from"../shimmer-image/ShimmerImage.js";import{StateComponent as C,StateInterface as T}from"../states/StateComponent.js";import"../../_virtual/_tslib.js";import"@tippyjs/react";import"../tooltips/TooltipInternal.js";import"../analytics-chips-and-dropdowns/CommonStyles.js";import{AnalyticsDropdown as D}from"../analytics-chips-and-dropdowns/AnalyticsDropdown.js";import"../analytics-chips-and-dropdowns/AnalyticsMetric.js";import"../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js";import"react-bootstrap";import"../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js";import"../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js";import"../analytics-chips-and-dropdowns/chart/Pie/PieChart.js";import"../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js";import"../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js";import"../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";import"../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js";import"../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";import{SearchIcon as O}from"../../assets/icons/searchIcon.js";var x,S;!function(e){e.STORY="story",e.POST="post",e.REEL="reel"}(x||(x={})),function(e){e.Today="Today",e["7_Days"]="7",e["30_Days"]="30",e.custom="custom",e.Yesterday="Yesterday"}(S||(S={}));const k=[{label:"Today",value:"today",key:S.Today,typeValue:[new Date,new Date]},{label:"Last 7 days",value:"7 days",key:S["7_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-6)),new Date]},{label:"Last 30 days",value:"30 days",key:S["30_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-29)),new Date]},{label:"Custom range",value:"calender",key:S.custom,isCustom:!0,dateRangeSelectionOptions:{selectRange:!0,maxDate:new Date((new Date).setMonth((new Date).getMonth()+3))}}],B=S=>{var B,I;const[P,_]=i(null!==(B=S.previouslySelected)&&void 0!==B?B:[]),[L,V]=i(""),[G,N]=i(!1),[R,$]=i(S.media),[A,M]=i(!1),[E,z]=i(!1);n((()=>{S.media.length||(N(!0),setTimeout((()=>{N(!1)}),2e3)),_(S.selected||[])}),[]),n((()=>{S.media.length>0&&($(S.media),N(!1))}),[null===(I=null==S?void 0:S.media)||void 0===I?void 0:I.length]),n((()=>{P.length>0&&V("")}),[P.length]),n((()=>{A&&($(S.media),z(!1))}),[A]);return e(t,{children:a(f,Object.assign({zIndex:201,open:S.showModal,headingTitle:S.title,onClose:S.onClose,centralContainerStyles:{width:1071,height:S.showFilter?612:564},primaryButton:{disabled:!R.length,buttonType:"primary",buttonText:`Select ${y(S.mediaType)}`,onClick:()=>{P.length?S.onSelect(P):V(`Please select a ${S.mediaType} to proceed`)}},secondaryButton:{buttonType:"secondary",buttonText:"Back",onClick:()=>S.onClose()},footerLeftCustomElement:L?e(s,{tagText:L,type:"negative",LeadingIcon:w}):P.length?a(h,{children:[P.length," selected"]}):null},{children:[S.showFilter&&a("div",Object.assign({style:{marginTop:24,marginBottom:24,padding:"0 24px",display:"flex",flexDirection:"row",gap:8,alignItems:"center"}},{children:[e(D,{options:k,placeholder:"posted on",resetDropdown:A,onOptionSelected:e=>{var t,a;let i=null,n=null;"Custom range"===e.label?(i=(null===(t=null==e?void 0:e.selectedRange)||void 0===t?void 0:t[0])||new Date,n=(null===(a=null==e?void 0:e.selectedRange)||void 0===a?void 0:a[1])||new Date):(i=e.typeValue[0],n=e.typeValue[1]);const o=S.media.filter((e=>function(e,t,a){const i=new Date(e),n=new Date(t),o=new Date(a);return i>=n&&i<=o}(e.timestamp,i,n)));$(o),z(!0),M(!1)}}),E&&e(l,Object.assign({color:u.content.secondary,onClick:()=>M(!0)},{children:"Clear"}))]})),G?e("div",Object.assign({style:{padding:"0 24px"}},{children:e(v,{boxes:[{width:(S.mediaType==x.POST?148:104)+"px",height:(S.mediaType==x.POST?148:172)+"px"}]})})):e(t,{children:R&&R.length?e(o,Object.assign({mediaType:S.mediaType},{children:R.map((t=>{return a(r,Object.assign({mediaType:S.mediaType,className:""+(i=t,n=P,n.some((e=>e.id===i.id))?"selected":""),onClick:()=>{return e=t,void _((()=>P.find((t=>t.id===e.id))?P.filter((t=>t.id!==e.id)):!S.limit||P.length<S.limit?[...P,e]:(V(`Only ${S.limit} ${S.mediaType}s can be selected`),P)));var e}},{children:[e(b,{imageUrl:t.imageUrl,width:S.mediaType==x.POST?148:104,height:S.mediaType==x.POST?148:172,alt:t.overlayCaption}),a("div",Object.assign({className:"overlay"},{children:[e("a",Object.assign({target:"_blank",rel:"noreferrer",href:t.redirectionUrl},{children:a("div",Object.assign({className:"overlay__redirection"},{children:[e(j,{height:22,width:22}),e(d,Object.assign({color:g,style:{fontWeight:500}},{children:"View"}))]}))})),e("div",Object.assign({className:"overlay__caption"},{children:e(c,Object.assign({color:u.content.placeholder},{children:t.overlayCaption}))}))]}))]}),t.id);var i,n}))})):e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",display:"flex",height:422}},{children:S.media.length?R.length?e(t,{}):a("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"48px",height:"48px",backgroundColor:`${u.background.inverse}`,borderRadius:"50%"}},{children:e(O,{color:u.content.primaryInverse})})),a("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},{children:[e(p,{children:"No results found"}),e(d,{children:"Sorry we could not find any results for the selected filter"})]})),e("div",Object.assign({onClick:()=>{M(!0)}},{children:e(m,Object.assign({color:`${u.content.brand}`},{children:"Clear Filter"}))}))]})):e(C,{states:T.WARNING,heading:`No ${S.mediaType}s on your account`,subline:`There seems to be no ${S.mediaType}s on your account`,isButtonEnabled:!1,width:400})}))})]}))})};export{S as DateKeys,x as MEDIA_TYPES,B as PostPicker,k as dateOptions};
1
+ import{jsx as e,Fragment as t,jsxs as a}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{StyledProductGrid as o,StyledProduct as r}from"./PostPicker.styled.js";import{Tag as s}from"../tag/Tag.js";import{ButtonRegular as l,BodyPrimary as d,BodyCaption as c,TitleMedium as p,ButtonLarge as m,BodySecondary as h}from"../TypographyStyle.js";import{unCamelCase as y}from"../../utils/unCamelCase.js";import{PRIMARY as g}from"../../constants/colors.js";import{COLORS as u}from"../../constants/Theme.js";import j from"../../assets/icons/instagram.svg.js";import w from"../../assets/icons/warning.svg.js";import{StyledModal as f}from"../modals/styledModal.js";import{BikShimmer as v}from"../shimmer/ShimmerComponent/BikShimmer.js";import{ShimmerImage as b}from"../shimmer-image/ShimmerImage.js";import{StateComponent as C,StateInterface as T}from"../states/StateComponent.js";import"../../_virtual/_tslib.js";import"../tooltips/Tooltip.js";import"../analytics-chips-and-dropdowns/CommonStyles.js";import{AnalyticsDropdown as D}from"../analytics-chips-and-dropdowns/AnalyticsDropdown.js";import"../analytics-chips-and-dropdowns/AnalyticsMetric.js";import"../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js";import"react-bootstrap";import"../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js";import"../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js";import"../analytics-chips-and-dropdowns/chart/Pie/PieChart.js";import"../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js";import"../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js";import"../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";import"../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js";import"../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";import{SearchIcon as O}from"../../assets/icons/searchIcon.js";var x,S;!function(e){e.STORY="story",e.POST="post",e.REEL="reel"}(x||(x={})),function(e){e.Today="Today",e["7_Days"]="7",e["30_Days"]="30",e.custom="custom",e.Yesterday="Yesterday"}(S||(S={}));const k=[{label:"Today",value:"today",key:S.Today,typeValue:[new Date,new Date]},{label:"Last 7 days",value:"7 days",key:S["7_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-6)),new Date]},{label:"Last 30 days",value:"30 days",key:S["30_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-29)),new Date]},{label:"Custom range",value:"calender",key:S.custom,isCustom:!0,dateRangeSelectionOptions:{selectRange:!0,maxDate:new Date((new Date).setMonth((new Date).getMonth()+3))}}],B=S=>{var B,P;const[I,_]=i(null!==(B=S.previouslySelected)&&void 0!==B?B:[]),[L,V]=i(""),[G,N]=i(!1),[R,$]=i(S.media),[A,M]=i(!1),[E,z]=i(!1);n((()=>{S.media.length||(N(!0),setTimeout((()=>{N(!1)}),2e3)),_(S.selected||[])}),[]),n((()=>{S.media.length>0&&($(S.media),N(!1))}),[null===(P=null==S?void 0:S.media)||void 0===P?void 0:P.length]),n((()=>{I.length>0&&V("")}),[I.length]),n((()=>{A&&($(S.media),z(!1))}),[A]);return e(t,{children:a(f,Object.assign({zIndex:201,open:S.showModal,headingTitle:S.title,onClose:S.onClose,centralContainerStyles:{width:1071,height:S.showFilter?612:564},primaryButton:{disabled:!R.length,buttonType:"primary",buttonText:`Select ${y(S.mediaType)}`,onClick:()=>{I.length?S.onSelect(I):V(`Please select a ${S.mediaType} to proceed`)}},secondaryButton:{buttonType:"secondary",buttonText:"Back",onClick:()=>S.onClose()},footerLeftCustomElement:L?e(s,{tagText:L,type:"negative",LeadingIcon:w}):I.length?a(h,{children:[I.length," selected"]}):null},{children:[S.showFilter&&a("div",Object.assign({style:{marginTop:24,marginBottom:24,padding:"0 24px",display:"flex",flexDirection:"row",gap:8,alignItems:"center"}},{children:[e(D,{options:k,placeholder:"posted on",resetDropdown:A,onOptionSelected:e=>{var t,a;let i=null,n=null;"Custom range"===e.label?(i=(null===(t=null==e?void 0:e.selectedRange)||void 0===t?void 0:t[0])||new Date,n=(null===(a=null==e?void 0:e.selectedRange)||void 0===a?void 0:a[1])||new Date):(i=e.typeValue[0],n=e.typeValue[1]);const o=S.media.filter((e=>function(e,t,a){const i=new Date(e),n=new Date(t),o=new Date(a);return i>=n&&i<=o}(e.timestamp,i,n)));$(o),z(!0),M(!1)}}),E&&e(l,Object.assign({color:u.content.secondary,onClick:()=>M(!0)},{children:"Clear"}))]})),G?e("div",Object.assign({style:{padding:"0 24px"}},{children:e(v,{boxes:[{width:(S.mediaType==x.POST?148:104)+"px",height:(S.mediaType==x.POST?148:172)+"px"}]})})):e(t,{children:R&&R.length?e(o,Object.assign({mediaType:S.mediaType},{children:R.map((t=>{return a(r,Object.assign({mediaType:S.mediaType,className:""+(i=t,n=I,n.some((e=>e.id===i.id))?"selected":""),onClick:()=>{return e=t,void _((()=>I.find((t=>t.id===e.id))?I.filter((t=>t.id!==e.id)):!S.limit||I.length<S.limit?[...I,e]:(V(`Only ${S.limit} ${S.mediaType}s can be selected`),I)));var e}},{children:[e(b,{imageUrl:t.imageUrl,width:S.mediaType==x.POST?148:104,height:S.mediaType==x.POST?148:172,alt:t.overlayCaption}),a("div",Object.assign({className:"overlay"},{children:[e("a",Object.assign({target:"_blank",rel:"noreferrer",href:t.redirectionUrl},{children:a("div",Object.assign({className:"overlay__redirection"},{children:[e(j,{height:22,width:22}),e(d,Object.assign({color:g,style:{fontWeight:500}},{children:"View"}))]}))})),e("div",Object.assign({className:"overlay__caption"},{children:e(c,Object.assign({color:u.content.placeholder},{children:t.overlayCaption}))}))]}))]}),t.id);var i,n}))})):e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",display:"flex",height:422}},{children:S.media.length?R.length?e(t,{}):a("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"48px",height:"48px",backgroundColor:`${u.background.inverse}`,borderRadius:"50%"}},{children:e(O,{color:u.content.primaryInverse})})),a("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},{children:[e(p,{children:"No results found"}),e(d,{children:"Sorry we could not find any results for the selected filter"})]})),e("div",Object.assign({onClick:()=>{M(!0)}},{children:e(m,Object.assign({color:`${u.content.brand}`},{children:"Clear Filter"}))}))]})):e(C,{states:T.WARNING,heading:`No ${S.mediaType}s on your account`,subline:`There seems to be no ${S.mediaType}s on your account`,isButtonEnabled:!1,width:400})}))})]}))})};export{S as DateKeys,x as MEDIA_TYPES,B as PostPicker,k as dateOptions};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  export type ShimmerImageProps = {
3
3
  imageUrl: string;
4
- width: number;
4
+ width: number | string;
5
5
  height: number;
6
6
  alt?: string;
7
7
  borderRadius?: number;
@@ -1 +1 @@
1
- import c from"@emotion/styled/base";import{getPadding as l,getBackgroundColor as b,generateBorder as d,getTextColor as X}from"./themes.js";const g=c("div","production"===process.env.NODE_ENV?{target:"e930jd90"}:{target:"e930jd90",label:"Tag"})("cursor:",(c=>{var l;return null!==(l=c.cursor)&&void 0!==l?l:"default"}),";",(c=>"regular"===c.variant?"display: block;\n\t\t height: 26px;\n\t\t":"height: 20px;")," .container{display:flex;align-items:center;gap:6px;padding:",(c=>l(c.variant)),";background-color:",(c=>b(c.theme,c.type)),";border-radius:",(c=>"regular"===c.variant?"4px":"12px"),";",(c=>"light"===c.theme&&`border: ${"2.0"===c.version?.5:1}px solid ${d(c.type)};`)," .text{color:",(c=>X(c.theme,c.type)),";}.icon-trailing{all:unset;display:flex;}.icon-leading{all:unset;display:flex;}}"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRhZy5zdHlsZWQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUU4QiIsImZpbGUiOiJUYWcuc3R5bGVkLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcclxuaW1wb3J0IHsgZ2VuZXJhdGVCb3JkZXIsIGdldEJhY2tncm91bmRDb2xvciwgZ2V0UGFkZGluZywgZ2V0VGV4dENvbG9yLCB9IGZyb20gJy4vdGhlbWVzJztcclxuZXhwb3J0IGNvbnN0IFRhZyA9IHN0eWxlZC5kaXYgYFxuXHRjdXJzb3I6ICR7KHByb3BzKSA9PiB7IHZhciBfYTsgcmV0dXJuIChfYSA9IHByb3BzLmN1cnNvcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogJ2RlZmF1bHQnOyB9fTtcblx0JHsocHJvcHMpID0+IHByb3BzLnZhcmlhbnQgPT09ICdyZWd1bGFyJ1xyXG4gICAgPyBgZGlzcGxheTogYmxvY2s7XG5cdFx0ICAgICBoZWlnaHQ6IDI2cHg7XG5cdFx0YFxyXG4gICAgOiBgaGVpZ2h0OiAyMHB4O2B9XG5cdC5jb250YWluZXIge1xuXHRcdGRpc3BsYXk6IGZsZXg7XG5cdFx0YWxpZ24taXRlbXM6IGNlbnRlcjtcblx0XHRnYXA6IDZweDtcblx0XHRwYWRkaW5nOiAkeyhwcm9wcykgPT4gZ2V0UGFkZGluZyhwcm9wcy52YXJpYW50KX07XG5cblx0XHRiYWNrZ3JvdW5kLWNvbG9yOiAkeyhwcm9wcykgPT4gZ2V0QmFja2dyb3VuZENvbG9yKHByb3BzLnRoZW1lLCBwcm9wcy50eXBlKX07XG5cblx0XHRib3JkZXItcmFkaXVzOiAkeyhwcm9wcykgPT4gKHByb3BzLnZhcmlhbnQgPT09ICdyZWd1bGFyJyA/ICc0cHgnIDogJzEycHgnKX07XG5cblx0XHQkeyhwcm9wcykgPT4gcHJvcHMudGhlbWUgPT09ICdsaWdodCcgJiZcclxuICAgIGBib3JkZXI6ICR7cHJvcHMudmVyc2lvbiA9PT0gJzIuMCcgPyAwLjUgOiAxfXB4IHNvbGlkICR7Z2VuZXJhdGVCb3JkZXIocHJvcHMudHlwZSl9O2B9XG5cblx0XHQudGV4dCB7XG5cdFx0XHRjb2xvcjogJHsocHJvcHMpID0+IGdldFRleHRDb2xvcihwcm9wcy50aGVtZSwgcHJvcHMudHlwZSl9O1xuXHRcdH1cblxuXHRcdC5pY29uLXRyYWlsaW5nIHtcblx0XHRcdGFsbDogdW5zZXQ7XG5cdFx0XHRkaXNwbGF5OiBmbGV4O1xuXHRcdH1cblxuXHRcdC5pY29uLWxlYWRpbmcge1xuXHRcdFx0YWxsOiB1bnNldDtcblx0XHRcdGRpc3BsYXk6IGZsZXg7XG5cdFx0fVxuXHR9XG5gO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1UYWcuc3R5bGVkLmpzLm1hcCJdfQ== */"));export{g as Tag};
1
+ import c from"@emotion/styled/base";import{getPadding as l,getBackgroundColor as b,generateBorder as d,getTextColor as t}from"./themes.js";const e=c("div","production"===process.env.NODE_ENV?{target:"e930jd90"}:{target:"e930jd90",label:"Tag"})("cursor:",(c=>{var l;return null!==(l=c.cursor)&&void 0!==l?l:"default"}),";",(c=>"regular"===c.variant?"display: block;\n\t\t min-height: 26px;\n\t\t":"min-height: 20px;")," .container{display:flex;align-items:center;gap:6px;padding:",(c=>l(c.variant)),";background-color:",(c=>b(c.theme,c.type)),";border-radius:",(c=>"regular"===c.variant?"4px":"12px"),";",(c=>"light"===c.theme&&`border: ${"2.0"===c.version?.5:1}px solid ${d(c.type)};`)," .text{color:",(c=>t(c.theme,c.type)),";}.icon-trailing{all:unset;display:flex;}.icon-leading{all:unset;display:flex;}}"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRhZy5zdHlsZWQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUU4QiIsImZpbGUiOiJUYWcuc3R5bGVkLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcclxuaW1wb3J0IHsgZ2VuZXJhdGVCb3JkZXIsIGdldEJhY2tncm91bmRDb2xvciwgZ2V0UGFkZGluZywgZ2V0VGV4dENvbG9yLCB9IGZyb20gJy4vdGhlbWVzJztcclxuZXhwb3J0IGNvbnN0IFRhZyA9IHN0eWxlZC5kaXYgYFxuXHRjdXJzb3I6ICR7KHByb3BzKSA9PiB7IHZhciBfYTsgcmV0dXJuIChfYSA9IHByb3BzLmN1cnNvcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogJ2RlZmF1bHQnOyB9fTtcblx0JHsocHJvcHMpID0+IHByb3BzLnZhcmlhbnQgPT09ICdyZWd1bGFyJ1xyXG4gICAgPyBgZGlzcGxheTogYmxvY2s7XG5cdFx0ICAgICBtaW4taGVpZ2h0OiAyNnB4O1xuXHRcdGBcclxuICAgIDogYG1pbi1oZWlnaHQ6IDIwcHg7YH1cblx0LmNvbnRhaW5lciB7XG5cdFx0ZGlzcGxheTogZmxleDtcblx0XHRhbGlnbi1pdGVtczogY2VudGVyO1xuXHRcdGdhcDogNnB4O1xuXHRcdHBhZGRpbmc6ICR7KHByb3BzKSA9PiBnZXRQYWRkaW5nKHByb3BzLnZhcmlhbnQpfTtcblxuXHRcdGJhY2tncm91bmQtY29sb3I6ICR7KHByb3BzKSA9PiBnZXRCYWNrZ3JvdW5kQ29sb3IocHJvcHMudGhlbWUsIHByb3BzLnR5cGUpfTtcblxuXHRcdGJvcmRlci1yYWRpdXM6ICR7KHByb3BzKSA9PiAocHJvcHMudmFyaWFudCA9PT0gJ3JlZ3VsYXInID8gJzRweCcgOiAnMTJweCcpfTtcblxuXHRcdCR7KHByb3BzKSA9PiBwcm9wcy50aGVtZSA9PT0gJ2xpZ2h0JyAmJlxyXG4gICAgYGJvcmRlcjogJHtwcm9wcy52ZXJzaW9uID09PSAnMi4wJyA/IDAuNSA6IDF9cHggc29saWQgJHtnZW5lcmF0ZUJvcmRlcihwcm9wcy50eXBlKX07YH1cblxuXHRcdC50ZXh0IHtcblx0XHRcdGNvbG9yOiAkeyhwcm9wcykgPT4gZ2V0VGV4dENvbG9yKHByb3BzLnRoZW1lLCBwcm9wcy50eXBlKX07XG5cdFx0fVxuXG5cdFx0Lmljb24tdHJhaWxpbmcge1xuXHRcdFx0YWxsOiB1bnNldDtcblx0XHRcdGRpc3BsYXk6IGZsZXg7XG5cdFx0fVxuXG5cdFx0Lmljb24tbGVhZGluZyB7XG5cdFx0XHRhbGw6IHVuc2V0O1xuXHRcdFx0ZGlzcGxheTogZmxleDtcblx0XHR9XG5cdH1cbmA7XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPVRhZy5zdHlsZWQuanMubWFwIl19 */"));export{e as Tag};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{useEffect as o,useState as a,useMemo as i}from"react";import r from"../../utils/StringUtils.js";import{StyledModal as s}from"../modals/styledModal.js";import{CHANNEL_TYPE as n}from"../template-preview/models/Channels.js";import{TemplateModalContext as d}from"./context/templateModalContext.js";import c from"./modalElements/Footer.js";import m from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as p}from"./utils/convertPlaceholdersToBikDropdown.js";const u=u=>{let{selectedTemplate:h,closeDialog:b,showVariableMapping:g,channel:v,htmlContent:C,templateVariables:S,onTemplateSelect:f,globalPlaceholders:w,showOnlyContent:M,whatsappSpecificPickerMeta:T,zIndex:V,showVariableModal:j,variableList:x,discountCode:L,setDiscountCode:P,onBackPress:E,enabledCustomText:I,variableListForImage:y,showSampleValues:k,disableEditVariable:D,pod:A,extras:O}=u;var F,z;o((()=>{N(C)}),[C]);const[B,H]=a(v===n.EMAIL?"desktop":"mobile"),[$,N]=a(C),[U,W]=a(!1),[_,q]=a(h),[G,J]=a(null!=S?S:[]),[K,Q]=a(!1);const R=i((()=>p(w)),[w]);return e(d.Provider,Object.assign({value:{template:_,setTemplate:q,device:B,setDevice:H,display_content:$,setDisplayContent:N,originalVariableList:G,setOriginalVariableList:J,isError:U,setIsError:W,channel:v,globalNormalizedPlaceholders:R,templateSelectionTriggered:K,setTemplateSelectionTriggered:Q,enabledCustomText:I,disableEditVariable:D,pod:A,extras:O}},{children:M?e(m,{channel:n.EMAIL,hideHeader:!0}):t(s,Object.assign({zIndex:V,centralContainerStyles:{width:v===n.EMAIL&&g?1e3:700},open:!0,onClose:()=>{null==b||b()},headingTitle:null==_?void 0:_.label,headingSubtitle:v===n.WHATSAPP?`${r.capitaliseFirstLetterOfString(null!==(F=null==_?void 0:_.category)&&void 0!==F?F:"")} • ${null!==(z=null==_?void 0:_.templateCategory)&&void 0!==z?z:""}`:"",onBackPress:()=>{null==E||E()}},{children:[e(m,{showSampleValues:k,showVariableMapping:g,channel:v,whatsappSpecificPickerMeta:T,showVariableModal:j,variableList:x,discountCode:L,setDiscountCode:P,variableListForImage:y&&(null==y?void 0:y.length)>0?y:x}),f?e(c,{onSelect:function(){const e=null==f?void 0:f(_,G,null!=$?$:"");e?W(!!e):Q(!0)}}):e(l,{})]}))}))};export{u as TemplateContextMapper};
1
+ import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{useEffect as o,useState as a,useMemo as i}from"react";import r from"../../utils/StringUtils.js";import{StyledModal as s}from"../modals/styledModal.js";import{CHANNEL_TYPE as n}from"../template-preview/models/Channels.js";import{TemplateModalContext as d}from"./context/templateModalContext.js";import c from"./modalElements/Footer.js";import m from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as p}from"./utils/convertPlaceholdersToBikDropdown.js";const u=u=>{let{selectedTemplate:h,closeDialog:b,showVariableMapping:g,channel:v,htmlContent:C,templateVariables:S,onTemplateSelect:f,globalPlaceholders:w,showOnlyContent:M,whatsappSpecificPickerMeta:T,zIndex:V,showVariableModal:j,variableList:x,discountCode:L,setDiscountCode:P,onBackPress:E,enabledCustomText:I,variableListForImage:y,showSampleValues:k,disableEditVariable:D,pod:A,extras:O}=u;var F,z;o((()=>{N(C)}),[C]);const[B,H]=a(v===n.EMAIL?"desktop":"mobile"),[$,N]=a(C),[U,W]=a(!1),[_,q]=a(h),[G,J]=a(null!=S?S:[]),[K,Q]=a(!1);const R=i((()=>p(w)),[w]);return e(d.Provider,Object.assign({value:{template:_,setTemplate:q,device:B,setDevice:H,display_content:$,setDisplayContent:N,originalVariableList:G,setOriginalVariableList:J,isError:U,setIsError:W,channel:v,globalNormalizedPlaceholders:R,templateSelectionTriggered:K,setTemplateSelectionTriggered:Q,enabledCustomText:I,disableEditVariable:D,pod:A,extras:O}},{children:M?e(m,{channel:n.EMAIL,hideHeader:!0}):t(s,Object.assign({zIndex:V,centralContainerStyles:{width:v===n.EMAIL&&g?1e3:800},open:!0,onClose:()=>{null==b||b()},headingTitle:null==_?void 0:_.label,headingSubtitle:v===n.WHATSAPP?`${r.capitaliseFirstLetterOfString(null!==(F=null==_?void 0:_.category)&&void 0!==F?F:"")} • ${null!==(z=null==_?void 0:_.templateCategory)&&void 0!==z?z:""}`:"",onBackPress:()=>{null==E||E()}},{children:[e(m,{showSampleValues:k,showVariableMapping:g,channel:v,whatsappSpecificPickerMeta:T,showVariableModal:j,variableList:x,discountCode:L,setDiscountCode:P,variableListForImage:y&&(null==y?void 0:y.length)>0?y:x}),f?e(c,{onSelect:function(){const e=null==f?void 0:f(_,G,null!=$?$:"");e?W(!!e):Q(!0)}}):e(l,{})]}))}))};export{u as TemplateContextMapper};
@@ -0,0 +1,8 @@
1
+ import { VariableListInterfaceV2 } from "../../add-variableV2/AddVariableV2";
2
+ export type AdditionalVariableProps = {
3
+ variableList?: VariableListInterfaceV2[];
4
+ categoryDisplayName: string;
5
+ variableDisplayName: string;
6
+ variableValue: string;
7
+ };
8
+ export declare const useAdditionalVariables: (props: AdditionalVariableProps) => VariableListInterfaceV2[] | undefined;
@@ -0,0 +1 @@
1
+ const a=a=>{const{variableList:e,categoryDisplayName:i,variableDisplayName:r,variableValue:l}=a;return e?[...e,{description:"",displayName:i,orderId:1,variables:{variableDisplayName:{description:void 0,displayName:r,actualValue:l,variableType:"any",isAvailable:!0}}}].sort(((a,e)=>a.orderId-e.orderId)):e};export{a as useAdditionalVariables};
@@ -3,7 +3,7 @@ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useRef as
3
3
  // height: 100%;
4
4
  `,f=n.div`
5
5
  padding: 16px 14px;
6
- max-width: 350px;
6
+ max-width: 450px;
7
7
 
8
8
  height: ${e=>e.channel===i.WHATSAPP?"500px":"475px"};
9
9
  overflow-y: 'auto';
@@ -1 +1 @@
1
- import{jsxs as e,Fragment as t,jsx as r}from"react/jsx-runtime";import i from"../../../assets/icons/PlusIcon.js";import{useState as o,useRef as a,useEffect as s}from"react";import{AddVariableV2SideModal as l}from"../../add-variableV2/AddVariableV2SideModal.js";import"../../../_virtual/_tslib.js";import"../../add-variableV2/AddVariableV2.styled.js";import"../../button/Button.js";import"../../icon-button/IconButton.js";import{Input as n}from"../../input/Input.js";import"@tippyjs/react";import"../../tooltips/TooltipInternal.js";import"../../../constants/Theme.js";import"../../modals/modal.styled.js";import"../../switch/Switch.js";import{TitleSmall as d}from"../../TypographyStyle.js";import{CheckBox as c}from"../../checkBox/CheckBox.js";import{AddVariableStyled as m}from"./VariableConnectorsPanel.js";const p=p=>{const{discountCode:u,setDiscountCode:h,variableList:b}=p,[j,g]=o(""),[v,V]=o(!!u),[f,y]=o(!1),[x,C]=o(!1),w=a(),T=a();return s((()=>{h&&j&&h(u+j)}),[j]),e(t,{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[r(c,{isChecked:v,onValueChange:()=>{v&&h&&(h(""),g("")),V(!v)}}),r(d,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),v&&e("div",Object.assign({ref:w,style:{margin:10}},{children:[r(n,{placeholder:"Enter your discount code",onChangeText:e=>{h&&h(e)},value:u,onFocus:()=>{y(!0)},onBlur:e=>{var t;"addVar"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.id)?(w.current&&w.current.focus(),y(!0)):(y(!1),C(!1))},noErrorHint:!0,validate:e=>[!0,""]}),f&&r(m,Object.assign({ref:T,id:"addVar",onClick:e=>{e.stopPropagation(),C(!0)}},{children:e("div",Object.assign({className:"add"},{children:[r(i,{width:14,height:14,color:"white"}),r("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]})),x&&r(l,{zIndex:2e3,data:null!=b?b:[],showVariable:x,setShowVariable:C,variableValue:j,setVariableValue:g,placeholder:"Add a variable",customTrigger:e=>{g(e.actualValue),y(!1)}})]})};export{p as DiscountCodeComponent};
1
+ import{jsxs as e,Fragment as t,jsx as i}from"react/jsx-runtime";import r from"../../../assets/icons/PlusIcon.js";import{useState as o,useRef as a,useEffect as s}from"react";import{AddVariableV2SideModal as l}from"../../add-variableV2/AddVariableV2SideModal.js";import"../../../_virtual/_tslib.js";import"../../add-variableV2/AddVariableV2.styled.js";import"../../button/Button.js";import"../../icon-button/IconButton.js";import{Input as d}from"../../input/Input.js";import"../../tooltips/Tooltip.js";import"../../../constants/Theme.js";import"../../modals/modal.styled.js";import"../../switch/Switch.js";import{TitleSmall as n}from"../../TypographyStyle.js";import{CheckBox as c}from"../../checkBox/CheckBox.js";import{AddVariableStyled as m}from"./VariableConnectorsPanel.js";const p=p=>{const{discountCode:u,setDiscountCode:h,variableList:b}=p,[j,g]=o(""),[v,V]=o(!!u),[f,y]=o(!1),[x,C]=o(!1),w=a(),T=a();return s((()=>{h&&j&&h(u+j)}),[j]),e(t,{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[i(c,{isChecked:v,onValueChange:()=>{v&&h&&(h(""),g("")),V(!v)}}),i(n,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),v&&e("div",Object.assign({ref:w,style:{margin:10}},{children:[i(d,{placeholder:"Enter your discount code",onChangeText:e=>{h&&h(e)},value:u,onFocus:()=>{y(!0)},onBlur:e=>{var t;"addVar"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.id)?(w.current&&w.current.focus(),y(!0)):(y(!1),C(!1))},noErrorHint:!0,validate:e=>[!0,""]}),f&&i(m,Object.assign({ref:T,id:"addVar",onClick:e=>{e.stopPropagation(),C(!0)}},{children:e("div",Object.assign({className:"add"},{children:[i(r,{width:14,height:14,color:"white"}),i("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]})),x&&i(l,{zIndex:2e3,data:null!=b?b:[],showVariable:x,setShowVariable:C,variableValue:j,setVariableValue:g,placeholder:"Add a variable",customTrigger:e=>{g(e.actualValue),y(!1)}})]})};export{p as DiscountCodeComponent};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Button as i}from"../../button/Button.js";import{InputWithVariables as a}from"../../input-with-vars/InputWithVariables.js";import{StyledModal as s}from"../../modals/styledModal.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{DEFAULT_THEME as o}from"../../../constants/Theme.js";import{HEADER_TYPES as r}from"../../template-preview/models/TemplateMeta.js";import"../../template-preview/models/WhatsAppTemplate.js";import{TitleMedium as l,BodySecondary as d,BodyRegular as n,BodyCaption as p}from"../../TypographyStyle.js";import m from"../../../assets/icons/file.svg.js";import c from"../../../assets/icons/filePdf.svg.js";import h from"../../../assets/icons/image.svg.js";import g from"../../../assets/icons/upload.svg.js";const u=u=>{let{setOpenEditMedia:b,mediaComponentFormat:f,variableListForImage:j,openEditMedia:v,uploadMedia:y}=u;return e(s,Object.assign({open:v,zIndex:2e3,onClose:()=>b(!1),width:"440px"},{children:t("div",Object.assign({style:{padding:24,borderRadius:4}},{children:[e(l,Object.assign({style:{marginBottom:16}},{children:"Update media"})),t("div",Object.assign({style:{padding:24,border:`1px dashed ${o.colorsV2.stroke.primary}`,backgroundColor:o.colorsV2.surface.subdued}},{children:[t("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[e("div",Object.assign({style:{height:80,width:80,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:o.colorsV2.background.base}},{children:f===r.IMAGE?e(h,{width:40,height:40}):f===r.VIDEO?e(m,{width:40,height:40}):e(c,{width:40,height:40})})),e(l,{children:f===r.IMAGE?"Upload an image":f===r.VIDEO?"Upload a video":"Upload a document"}),e(d,{children:f===r.IMAGE?"JPEG/ PNG format • Max 5MB":f===r.VIDEO?"MP4 format video • Max 16MB":"PDF format a document • Max 100MB"})]})),t("div",Object.assign({style:{marginBottom:16}},{children:[e(n,{children:"Media"}),e(a,{addVarBoxRight:"46px",allowMix:!1,onChange:e=>{},prevVariable:{actualValue:"",variableType:"string"},variablesList:j,showSideVariablePanel:!0,placeHolder:"Enter URL or add variable...",onBlur:(e,t)=>{t&&t.actualValue&&y(t.actualValue)},showAddButton:[r.IMAGE,r.VIDEO,r.DOCUMENT].includes(f)})]})),t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4}},{children:[e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e(p,Object.assign({style:{flex:1}},{children:"Or upload media from device"})),e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(i,{matchParentWidth:!0,buttonText:"Upload",buttonType:"secondary",LeadingIcon:g,onClick:()=>y()})}))]}))]}))}))};export{u as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Button as a}from"../../button/Button.js";import{InputWithVariables as i}from"../../input-with-vars/InputWithVariables.js";import{StyledModal as o}from"../../modals/styledModal.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{DEFAULT_THEME as r}from"../../../constants/Theme.js";import{HEADER_TYPES as s}from"../../template-preview/models/TemplateMeta.js";import{POD as l}from"../../template-preview/models/WhatsAppTemplate.js";import{TitleMedium as d,BodySecondary as n,BodyRegular as p,BodyCaption as m}from"../../TypographyStyle.js";import c from"../../../assets/icons/file.svg.js";import h from"../../../assets/icons/filePdf.svg.js";import g from"../../../assets/icons/image.svg.js";import u from"../../../assets/icons/upload.svg.js";import{useTemplateModalContext as b}from"../context/templateModalContext.js";const f=f=>{let{setOpenEditMedia:j,mediaComponentFormat:v,variableListForImage:y,openEditMedia:x,uploadMedia:M}=f;const{pod:w}=b();return e(o,Object.assign({open:x,zIndex:2e3,onClose:()=>j(!1),width:"440px"},{children:t("div",Object.assign({style:{padding:24,borderRadius:4}},{children:[e(d,Object.assign({style:{marginBottom:16}},{children:"Update media"})),t("div",Object.assign({style:{padding:24,border:`1px dashed ${r.colorsV2.stroke.primary}`,backgroundColor:r.colorsV2.surface.subdued}},{children:[t("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[e("div",Object.assign({style:{height:80,width:80,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:r.colorsV2.background.base}},{children:v===s.IMAGE?e(g,{width:40,height:40}):v===s.VIDEO?e(c,{width:40,height:40}):e(h,{width:40,height:40})})),e(d,{children:v===s.IMAGE?"Upload an image":v===s.VIDEO?"Upload a video":"Upload a document"}),e(n,{children:v===s.IMAGE?"JPEG/ PNG format • Max 5MB":v===s.VIDEO?"MP4 format video • Max 16MB":"PDF format a document • Max 100MB"})]})),t("div",Object.assign({style:{marginBottom:16}},{children:[e(p,{children:"Media"}),e(i,{noMaxCharCheck:!0,addVarBoxRight:"46px",allowMix:!1,onChange:e=>{},prevVariable:{actualValue:"",variableType:"string"},variablesList:y,showSideVariablePanel:!0,placeHolder:"Enter URL or add variable...",onBlur:(e,t)=>{t&&t.actualValue&&M(t.actualValue)},showAddButton:w!==l.CAMPAIGN||v===s.IMAGE})]})),t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4}},{children:[e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e(m,Object.assign({style:{flex:1}},{children:"Or upload media from device"})),e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(a,{matchParentWidth:!0,buttonText:"Upload",buttonType:"secondary",LeadingIcon:u,onClick:()=>M()})}))]}))]}))}))};export{f as default};
@@ -1,8 +1,8 @@
1
- import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import o from"../../../assets/icons/document_pdf.svg.js";import r from"../../../assets/icons/edit.svg.js";import s from"../../../assets/icons/refresh.svg.js";import n from"../../../assets/icons/video_camcorder.svg.js";import l from"styled-components";import{Spinner as d}from"../../spinner/Spinner.js";import{HEADER_TYPES as a}from"../../template-preview/models/TemplateMeta.js";import{BodyCaption as c,BodySecondary as m,Caption as p}from"../../TypographyStyle.js";import h from"../../../utils/StringUtils.js";import{COLORS as g}from"../../../constants/Theme.js";import{Container as f,ImageContainer as j,RightComponent as v}from"./EditMediaV2.style.js";const y=l.div`
1
+ import{jsxs as e,jsx as i,Fragment as t}from"react/jsx-runtime";import r from"../../../assets/icons/document_pdf.svg.js";import o from"../../../assets/icons/edit.svg.js";import s from"../../../assets/icons/refresh.svg.js";import n from"styled-components";import{ShimmerImage as l}from"../../shimmer-image/ShimmerImage.js";import{Spinner as d}from"../../spinner/Spinner.js";import{HEADER_TYPES as a}from"../../template-preview/models/TemplateMeta.js";import{BodyCaption as c,BodySecondary as m,Caption as p}from"../../TypographyStyle.js";import h from"../../../utils/StringUtils.js";import{COLORS as g}from"../../../constants/Theme.js";import{Container as f,ImageContainer as j,RightComponent as y}from"./EditMediaV2.style.js";const u=n.div`
2
2
  padding-left: 14px;
3
3
  padding-right: 6px;
4
4
  width: 44px;
5
5
  height: 24px;
6
6
  border-left: 1px solid ${g.stroke.primary};
7
7
  cursor: pointer;
8
- `,u=l=>{const{imageName:u,error:b,isLoading:x,mediaType:w,handleImageChange:O,disableEditVariable:C,selectedVariable:E,setOpenEditMedia:L}=l,M=null==u?void 0:u[0].split("/"),T=null==M?void 0:M[M.length-1];return e(f,{children:[t(j,Object.assign({error:!!b,onClick:b?O:void 0},{children:b?t(s,{color:g.content.brand,width:32,height:32}):x?t(d,{size:"small"}):w===a.IMAGE?t("img",{alt:"",src:null==u?void 0:u[0],style:{width:"100%",height:"56px",borderRadius:8,objectFit:"cover"}}):w===a.VIDEO?t(n,{width:18,height:22,color:g.content.placeholder}):t(o,{width:18,height:22,color:g.content.placeholder})})),e(v,{children:[t("div",Object.assign({style:{flex:1}},{children:u&&b?t(i,{}):x?t(c,Object.assign({style:{marginLeft:8}},{children:"Your media is getting loaded..."})):t(m,Object.assign({style:{color:g.content.primary,marginLeft:8}},{children:E||h.toCapitilize(null==w?void 0:w.toLowerCase())||T}))})),!!b&&e("div",Object.assign({style:{display:"flex",flexDirection:"column",marginLeft:8}},{children:[e(m,Object.assign({style:{color:g.content.negative}},{children:["Error loading this ",null==w?void 0:w.toLowerCase(),". Retry"]})),t(p,Object.assign({style:{color:g.content.secondary}},{children:b}))]})),!C&&!b&&!x&&t(y,Object.assign({onClick:()=>null==L?void 0:L(!0),onKeyDown:()=>null==L?void 0:L(!0),role:"presentation"},{children:t(r,{width:24,height:24,color:g.content.placeholder})}))]})]})};export{u as default};
8
+ `,v=n=>{const{imageName:v,error:b,isLoading:O,mediaType:w,disableEditVariable:x,selectedVariable:L,setOpenEditMedia:E}=n,k=null==v?void 0:v[0].split("/"),C=null==k?void 0:k[k.length-1];return e(f,{children:[i(j,Object.assign({error:!!b,onClick:()=>null==E?void 0:E(!0)},{children:b?i(s,{color:g.content.brand,width:32,height:32}):O?i(d,{size:"small"}):w===a.IMAGE?i(l,{imageUrl:null==v?void 0:v[0],width:56,height:56}):w===a.VIDEO?i("video",Object.assign({src:v[0],style:{width:56,height:56}},{children:i("track",{default:!0,kind:"captions",srcLang:"en",src:v[0]})})):i(r,{width:18,height:22,color:g.content.placeholder})})),e(y,{children:[i("div",Object.assign({style:{flex:1}},{children:v&&b?i(t,{}):O?i(c,Object.assign({style:{marginLeft:8}},{children:"Your media is getting loaded..."})):i(m,Object.assign({style:{color:g.content.primary,marginLeft:8}},{children:L||h.toCapitilize(null==w?void 0:w.toLowerCase())||C}))})),!!b&&e("div",Object.assign({style:{display:"flex",flexDirection:"column",marginLeft:8}},{children:[e(m,Object.assign({style:{color:g.content.negative}},{children:["Error loading this ",null==w?void 0:w.toLowerCase(),". Retry"]})),i(p,Object.assign({style:{color:g.content.secondary}},{children:b}))]})),!x&&!b&&!O&&i(u,Object.assign({onClick:()=>null==E?void 0:E(!0),onKeyDown:()=>null==E?void 0:E(!0),role:"presentation"},{children:i(o,{width:24,height:24,color:g.content.placeholder})}))]})]})};export{v as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../_virtual/_tslib.js";import{jsxs as t,Fragment as i,jsx as o}from"react/jsx-runtime";import n,{useState as a}from"react";import{FileUploaderHelper as r}from"../../helpers/FileUploaderHelper.js";import{BikImageCropper as l}from"../../image-cropper/BikImageCropper.js";import"../../image-compress/ImageCompress.js";import"../../states/StateComponent.js";import"../../../constants/zindex.js";import"../../modals/styledModal.js";import"../../spinner/Spinner.js";import{DEFAULT_IMAGE as s}from"../../shimmer-image/ShimmerImage.js";import{HEADER_TYPES as m}from"../../template-preview/models/TemplateMeta.js";import{useTemplateModalContext as d}from"../context/templateModalContext.js";import p from"./EditMediaModal.js";import c from"./EditMediaV2.js";const f=f=>{let{mediaComponent:u,template:v,updateTemplateImageUrl:g,whatsappSpecificPickerMeta:h,variableListForImage:j}=f;var b,E,M;const{disableEditVariable:I}=d(),[y,C]=a(void 0),[O,A]=a(),[x,k]=a(),[w,T]=a(!1),F=n.createRef(),[R,U]=a(!1),[L,N]=a(""),{template:V,setTemplate:D}=d();let G;function S(){var e;(null===(e=null==F?void 0:F.current)||void 0===e?void 0:e.click)&&F.current.click()}function _(t){var i;return e(this,void 0,void 0,(function*(){const e=new r;if(t instanceof Blob){const o=e.validate(t);if(o)N(o),U(!1);else{const e=u.format===m.IMAGE,o=yield h.uploadMediaFiles({file:t,fileName:y,isImage:e});if(o.success){const[e]=t.type.split("/");g(null!==(i=o.url)&&void 0!==i?i:"","application"===e?m.DOCUMENT:m[e.toUpperCase()])}else N("An unknown technical error occured");U(!1)}}else N("An unknown technical error occured"),U(!1)}))}return G=u.format===m.IMAGE?"image/png, image/jpeg":u.format===m.VIDEO?"video/mp4":"application/pdf",t(i,{children:[o(p,{mediaComponentFormat:null!==(b=u.format)&&void 0!==b?b:m.IMAGE,uploadMedia:function(t){var i;return e(this,void 0,void 0,(function*(){if(N(""),k(""),T(!1),t)if(t.startsWith("https"))try{U(!0);const e=yield fetch(t),i=yield e.blob();yield _(i)}catch(e){N("An unknown technical error occurred")}else if(/^{{.*}}$/.test(t)){k(t);const e=Object.assign({},V);if(e.components){const t=null===(i=null==e?void 0:e.components)||void 0===i?void 0:i.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==t&&t>-1&&(null==e?void 0:e.components[t])){const i=Object.assign(Object.assign({},e.components[t]),{format:u.format,example:{header_handle:[s]}}),o=[...e.components];o[t]=i,e.components=o}}e.mapping&&(e.mapping=Object.assign(Object.assign({},e.mapping),{header:[t]})),U(!1),null==D||D(Object.assign({},e))}else U(!1),N("Invalid URL or variable");else S()}))},variableListForImage:j||[],setOpenEditMedia:T,openEditMedia:w}),!!O&&o(l,{aspectRatio:15/8,src:O,onCropComplete:function(t){return e(this,void 0,void 0,(function*(){U(!1),N("");const e=yield fetch(t);_(yield e.blob()).then((()=>{A(void 0)}))}))},onCancel:()=>{U(!1),A(""),F.current&&(F.current.value="")}}),o("input",{ref:F,style:{display:"none"},type:"file",onChange:function(e){var t;N(""),U(!0);const i=null===(t=e.target.files)||void 0===t?void 0:t[0];if(u.format===m.IMAGE){const e=new FileReader;A(""),C(""),e.onload=()=>{A(e.result),C(null==i?void 0:i.name)},i&&e.readAsDataURL(i)}else _(i)},accept:G}),o(c,{imageName:null!==(M=null===(E=null==u?void 0:u.example)||void 0===E?void 0:E.header_handle)&&void 0!==M?M:[],handleImageChange:S,mediaType:null==u?void 0:u.format,error:L,isLoading:R,setOpenEditMedia:T,selectedVariable:x,disableEditVariable:I})]})};export{f as default};
1
+ import{__awaiter as e}from"../../../_virtual/_tslib.js";import{jsxs as i,Fragment as o,jsx as t}from"react/jsx-runtime";import n,{useState as a}from"react";import{FileUploaderHelper as l}from"../../helpers/FileUploaderHelper.js";import{BikImageCropper as r}from"../../image-cropper/BikImageCropper.js";import"../../image-compress/ImageCompress.js";import"../../states/StateComponent.js";import"../../../constants/zindex.js";import"../../modals/styledModal.js";import"../../spinner/Spinner.js";import{HEADER_TYPES as d}from"../../template-preview/models/TemplateMeta.js";import{useTemplateModalContext as s}from"../context/templateModalContext.js";import p from"./EditMediaModal.js";import m from"./EditMediaV2.js";const c=e=>/^{{.*}}$/.test(e),u=u=>{let{mediaComponent:v,template:f,updateTemplateImageUrl:g,whatsappSpecificPickerMeta:h,variableListForImage:b}=u;var j,E,M,y,I,C,O,x;const{disableEditVariable:A}=s(),[k,w]=a(void 0),[T,F]=a(),[R,U]=a(),[_,L]=a(!1),N=n.createRef(),[V,D]=a(!1),[G,S]=a(""),{template:B,setTemplate:H}=s();let z;function P(){var e;(null===(e=null==N?void 0:N.current)||void 0===e?void 0:e.click)&&N.current.click()}function W(i){var o;return e(this,void 0,void 0,(function*(){const e=new l;if(i instanceof Blob){const t=e.validate(i);if(t)S(t),D(!1);else{const e=v.format===d.IMAGE,t=yield h.uploadMediaFiles({file:i,fileName:k,isImage:e});if(t.success){const[e]=i.type.split("/");g(null!==(o=t.url)&&void 0!==o?o:"","application"===e?d.DOCUMENT:d[e.toUpperCase()])}else S("An unknown technical error occured");D(!1)}}else S("An unknown technical error occured"),D(!1)}))}return z=v.format===d.IMAGE?"image/png, image/jpeg":v.format===d.VIDEO?"video/mp4":"application/pdf",i(o,{children:[t(p,{mediaComponentFormat:null!==(j=v.format)&&void 0!==j?j:d.IMAGE,uploadMedia:function(i){var o;return e(this,void 0,void 0,(function*(){if(S(""),U(""),L(!1),i)if(i.startsWith("https"))try{D(!0);const e=yield fetch(i),o=yield e.blob();yield W(o)}catch(e){S("An unknown technical error occurred")}else if(c(i)){U(i);const e=Object.assign({},B);if(e.components){const t=null===(o=null==e?void 0:e.components)||void 0===o?void 0:o.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==t&&t>-1&&(null==e?void 0:e.components[t])){const o=Object.assign(Object.assign({},e.components[t]),{format:v.format,example:{header_handle:[i]}}),n=[...e.components];n[t]=o,e.components=n}}e.mapping&&(e.mapping=Object.assign(Object.assign({},e.mapping),{header:[i]})),D(!1),null==H||H(Object.assign({},e))}else D(!1),S("Invalid URL or variable");else P()}))},variableListForImage:b||[],setOpenEditMedia:L,openEditMedia:_}),!!T&&t(r,{aspectRatio:15/8,src:T,onCropComplete:function(i){return e(this,void 0,void 0,(function*(){D(!1),S("");const e=yield fetch(i);W(yield e.blob()).then((()=>{F(void 0)}))}))},onCancel:()=>{D(!1),F(""),N.current&&(N.current.value="")}}),t("input",{ref:N,style:{display:"none"},type:"file",onChange:function(e){var i;S(""),D(!0);const o=null===(i=e.target.files)||void 0===i?void 0:i[0];if(v.format===d.IMAGE){const e=new FileReader;F(""),w(""),e.onload=()=>{F(e.result),w(null==o?void 0:o.name)},o&&e.readAsDataURL(o)}else W(o)},accept:z}),t(m,{imageName:null!==(M=null===(E=null==v?void 0:v.example)||void 0===E?void 0:E.header_handle)&&void 0!==M?M:[],handleImageChange:P,mediaType:null==v?void 0:v.format,error:G,isLoading:V,setOpenEditMedia:L,selectedVariable:c(null!==(C=null===(I=null===(y=null==v?void 0:v.example)||void 0===y?void 0:y.header_handle)||void 0===I?void 0:I[0])&&void 0!==C?C:"")?null===(x=null===(O=null==v?void 0:v.example)||void 0===O?void 0:O.header_handle)||void 0===x?void 0:x[0]:R,disableEditVariable:A})]})};export{u as default};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useState as e,useEffect as i,useCallback as n,useMemo as a}from"react";import{POD as l}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as s}from"../context/templateModalContext.js";import{getAllDataFromTemplateComponent as d}from"../utils/getDataFromTemplateComponent.js";import{BackTrackComponent as r}from"./BackTrackComponent.js";import{DiscountCodeComponent as p}from"./DiscountCodeComponent.js";import{EditTemplateMediaContainer as c}from"./EditMediaV2.style.js";import u from"./EditWhatsAppTemplateMediaV2.js";import m from"./VariableConnector.js";import{Container as v}from"./VariableConnectorsPanel.js";import b from"./VariableConnectorWhatsApp.js";import g from"./VariableEditorHeader.js";import h from"./WhatsAppTemplateCardButtonV2.js";const f=f=>{let{template:T,onTemplateChange:j,whatsappSpecificPickerMeta:x,showVariableModal:C,variableList:O,variableListForImage:y,discountCode:E,setDiscountCode:V}=f;var k,I,L,w,B,A,M,U,N,R,D,H,S,P,Q,W,_;const{originalVariableList:F,pod:Y,extras:K}=s(),{descriptionComponents:$,urlBtns:q,qrbBtns:X,imageComponent:z,bodyVariables:G,headerVariables:J}=d(T),[Z,tt]=e(!1);function ot(t,o){var e,i,n,a,l;const s=Object.assign({},T),d=null==s?void 0:s.components.findIndex((t=>"BUTTONS"===t.type));if(void 0!==d&&d>-1){const l=null===(e=null==s?void 0:s.components[d].buttons)||void 0===e?void 0:e.findIndex((t=>"URL"===t.type));if(void 0!==l&&l>-1){const e="custom"===o&&"string"==typeof t,r=[...null!==(a=null===(n=null===(i=s.components)||void 0===i?void 0:i[d])||void 0===n?void 0:n.buttons)&&void 0!==a?a:[]];r[l]=Object.assign(Object.assign({},r[l]),{url:"https://d.bik.ai/{{1}}",example:[e?t:"string"!=typeof t?t.defaultValue:""]});const p=Object.assign(Object.assign({},s.components[d]),{buttons:r}),c=Object.assign(Object.assign({},s.mapping),{buttons:e?["((customBtnPlaceholder))"]:"string"!=typeof t?[t.placeHolder]:void 0});s.mapping=c;const u=[...s.components];u[d]=p,s.components=u}}if("string"!=typeof t){"checkout.checkoutUrl"===(null===(l=t.placeHolder)||void 0===l?void 0:l.slice(2,-2))?tt(!0):(tt(!1),null==V||V(""))}null==j||j(s)}function et(t,o,e){var i;const n=Object.assign({},T),a=null==n?void 0:n.components.findIndex((t=>"BUTTONS"===t.type));if(void 0!==a&&a>-1){const o=null===(i=null==n?void 0:n.components[a].buttons)||void 0===i?void 0:i.filter((t=>"QUICK_REPLY"===t.type));o&&(o[e]=Object.assign(Object.assign({},o[e]),{flowId:t.flowId,flowName:t.flowName}));const l=Object.assign(Object.assign({},n.components[a]),{buttons:o}),s=[...n.components];s[a]=l,n.components=s}null==j||j(n)}i((()=>{var t;const o=null===(t=T.mapping.buttons)||void 0===t?void 0:t[0];"checkout.checkoutUrl"===(null==o?void 0:o.slice(2,-2))?tt(!0):(tt(!1),null==V||V(""))}),[T]);const it=n((()=>O?[...O,{description:"",displayName:"Custom variables",orderId:1,variables:{"Custom text":{description:void 0,displayName:"Custom text",actualValue:"{{custom.text}}",variableType:"any",isAvailable:!0}}}].sort(((t,o)=>t.orderId-o.orderId)):O),[O]),nt=a((()=>it()),[it]);return t(v,Object.assign({style:{flexDirection:"column",maxHeight:460}},{children:[!!z&&o(c,{children:o(u,{whatsappSpecificPickerMeta:x,mediaComponent:z,updateTemplateImageUrl:function(t,o){var e;let i=Object.assign({},T);const n=null===(e=null==i?void 0:i.components)||void 0===e?void 0:e.findIndex((t=>{if("HEADER"===t.type&&"NONE"!==t.format&&"TEXT"!==t.format)return!0}));if(void 0!==n&&n>-1&&(null==i?void 0:i.components[n])){const e=Object.assign(Object.assign({},i.components[n]),{format:o,example:{header_handle:[t]}}),a=[...i.components];a[n]=e,i=Object.assign(Object.assign({},i),{components:a})}i.mapping&&(i.mapping=Object.assign(Object.assign({},i.mapping),{header:void 0})),null==j||j(Object.assign({},i))},template:T,variableListForImage:y})}),(G.length>0||J.length>0)&&o(g,{containerStyle:{paddingTop:z?24: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==$?void 0:$.map(((t,e)=>o(b,{originalVariableList:F,type:t.type,descriptionComponent:t.component,variableMapping:"HEADER"===t.type?T.mapping.header:T.mapping.body,showVariableModal:C,variableList:O},e))),(null===(I=null===(k=q[0])||void 0===k?void 0:k.component)||void 0===I?void 0:I.buttons)&&(null===(B=null===(w=null===(L=q[0])||void 0===L?void 0:L.component)||void 0===w?void 0:w.buttons)||void 0===B?void 0:B.length)>0&&o(g,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(A=null==F?void 0:F.buttons)||void 0===A?void 0:A.map(((t,e)=>{if("URL"===t.type)return o(h,{variableListIndex:e,CTAoptions:null==x?void 0:x.CTAoptions,button:t,originalVariableList:F,updateSelectedURLTemplateBtn:ot,variableList:O},`${e}`)})),(null===(U=null===(M=X[0])||void 0===M?void 0:M.component)||void 0===U?void 0:U.buttons)&&(null===(D=null===(R=null===(N=X[0])||void 0===N?void 0:N.component)||void 0===R?void 0:R.buttons)||void 0===D?void 0:D.length)>0&&(Y!==l.CHATBOT?o(g,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):o(r,{backTrackMessage:null===(H=null==K?void 0:K.backTrackExtra)||void 0===H?void 0:H[0],setBackTrackMessage:null===(S=null==K?void 0:K.backTrackExtra)||void 0===S?void 0:S[1]})),null===(P=null==F?void 0:F.buttons)||void 0===P?void 0:P.map(((t,e)=>{if("QUICK_REPLY"===t.type)return o(h,{variableListIndex:e,QRBoptions:null==x?void 0:x.QRBoptions,button:t,originalVariableList:F,updateSelectedQRBTemplateBtn:et},`${e}`)})),Y===l.CHATBOT&&Z&&o(p,{discountCode:null===(Q=null==K?void 0:K.discountCodeExtra)||void 0===Q?void 0:Q[0],setDiscountCode:null===(W=null==K?void 0:K.discountCodeExtra)||void 0===W?void 0:W[1],variableList:O}),null===(_=null==F?void 0:F.buttons)||void 0===_?void 0:_.map(((t,e)=>{var i,n,a;if("COPY_CODE"===t.type)return o(m,{index:e,variable:{variableName:null!==(i=t.text)&&void 0!==i?i:"",updatedValue:null!==(n=t.buttonVariable)&&void 0!==n?n:"",type:"string",isEditableVariable:!0,index:null!==(a=t.index)&&void 0!==a?a:0},showVariableModal:!0,variableList:nt,componentType:"BUTTONS"},e)}))]}))};export{f as default};
1
+ import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useState as e,useEffect as i}from"react";import{POD as n}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as a}from"../context/templateModalContext.js";import{useAdditionalVariables as l}from"../custom-hooks/useAdditionalVariables.js";import{getAllDataFromTemplateComponent as s}from"../utils/getDataFromTemplateComponent.js";import{BackTrackComponent as d}from"./BackTrackComponent.js";import{DiscountCodeComponent as r}from"./DiscountCodeComponent.js";import{EditTemplateMediaContainer as p}from"./EditMediaV2.style.js";import c from"./EditWhatsAppTemplateMediaV2.js";import u from"./VariableConnector.js";import{Container as m}from"./VariableConnectorsPanel.js";import v from"./VariableConnectorWhatsApp.js";import b from"./VariableEditorHeader.js";import g from"./WhatsAppTemplateCardButtonV2.js";const h=h=>{let{template:f,onTemplateChange:T,whatsappSpecificPickerMeta:j,showVariableModal:x,variableList:C,variableListForImage:O,discountCode:y,setDiscountCode:V}=h;var E,k,L,w,B,I,A,M,U,D,N,R,H,S,P,Q,W;const{originalVariableList:_,pod:F,extras:Y}=a(),{descriptionComponents:K,urlBtns:$,qrbBtns:q,imageComponent:X,bodyVariables:z,headerVariables:G}=s(f),[J,Z]=e(!1);function tt(t,o){var e,i,n,a,l;const s=Object.assign({},f),d=null==s?void 0:s.components.findIndex((t=>"BUTTONS"===t.type));if(void 0!==d&&d>-1){const l=null===(e=null==s?void 0:s.components[d].buttons)||void 0===e?void 0:e.findIndex((t=>"URL"===t.type));if(void 0!==l&&l>-1){const e="custom"===o&&"string"==typeof t,r=[...null!==(a=null===(n=null===(i=s.components)||void 0===i?void 0:i[d])||void 0===n?void 0:n.buttons)&&void 0!==a?a:[]];r[l]=Object.assign(Object.assign({},r[l]),{url:"https://d.bik.ai/{{1}}",example:[e?t:"string"!=typeof t?t.defaultValue:""]});const p=Object.assign(Object.assign({},s.components[d]),{buttons:r}),c=Object.assign(Object.assign({},s.mapping),{buttons:e?["((customBtnPlaceholder))"]:"string"!=typeof t?[t.placeHolder]:void 0});s.mapping=c;const u=[...s.components];u[d]=p,s.components=u}}if("string"!=typeof t){"checkout.checkoutUrl"===(null===(l=t.placeHolder)||void 0===l?void 0:l.slice(2,-2))?Z(!0):(Z(!1),null==V||V(""))}null==T||T(s)}function ot(t,o,e){var i;const n=Object.assign({},f),a=null==n?void 0:n.components.findIndex((t=>"BUTTONS"===t.type));if(void 0!==a&&a>-1){const o=null===(i=null==n?void 0:n.components[a].buttons)||void 0===i?void 0:i.filter((t=>"QUICK_REPLY"===t.type));o&&(o[e]=Object.assign(Object.assign({},o[e]),{flowId:t.flowId,flowName:t.flowName}));const l=Object.assign(Object.assign({},n.components[a]),{buttons:o}),s=[...n.components];s[a]=l,n.components=s}null==T||T(n)}i((()=>{var t;const o=null===(t=f.mapping.buttons)||void 0===t?void 0:t[0];"checkout.checkoutUrl"===(null==o?void 0:o.slice(2,-2))?Z(!0):(Z(!1),null==V||V(""))}),[f]);const et=l({variableList:C,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom Text",variableValue:"{{custom.text}}"});return t(m,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!X&&o(p,{children:o(c,{whatsappSpecificPickerMeta:j,mediaComponent:X,updateTemplateImageUrl:function(t,o){var e;let i=Object.assign({},f);const n=null===(e=null==i?void 0:i.components)||void 0===e?void 0:e.findIndex((t=>{if("HEADER"===t.type&&"NONE"!==t.format&&"TEXT"!==t.format)return!0}));if(void 0!==n&&n>-1&&(null==i?void 0:i.components[n])){const e=Object.assign(Object.assign({},i.components[n]),{format:o,example:{header_handle:[t]}}),a=[...i.components];a[n]=e,i=Object.assign(Object.assign({},i),{components:a})}i.mapping&&(i.mapping=Object.assign(Object.assign({},i.mapping),{header:void 0})),null==T||T(Object.assign({},i))},template:f,variableListForImage:O})}),(z.length>0||G.length>0)&&o(b,{containerStyle:{paddingTop:X?24: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==K?void 0:K.map(((t,e)=>o(v,{originalVariableList:_,type:t.type,descriptionComponent:t.component,variableMapping:"HEADER"===t.type?f.mapping.header:f.mapping.body,showVariableModal:x,variableList:C},e))),(null===(k=null===(E=$[0])||void 0===E?void 0:E.component)||void 0===k?void 0:k.buttons)&&(null===(B=null===(w=null===(L=$[0])||void 0===L?void 0:L.component)||void 0===w?void 0:w.buttons)||void 0===B?void 0:B.length)>0&&o(b,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(I=null==_?void 0:_.buttons)||void 0===I?void 0:I.map(((t,e)=>{if("URL"===t.type)return o(g,{variableListIndex:e,CTAoptions:null==j?void 0:j.CTAoptions,button:t,originalVariableList:_,updateSelectedURLTemplateBtn:tt,variableList:C},`${e}`)})),(null===(M=null===(A=q[0])||void 0===A?void 0:A.component)||void 0===M?void 0:M.buttons)&&(null===(N=null===(D=null===(U=q[0])||void 0===U?void 0:U.component)||void 0===D?void 0:D.buttons)||void 0===N?void 0:N.length)>0&&(F!==n.CHATBOT?o(b,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):o(d,{backTrackMessage:null===(R=null==Y?void 0:Y.backTrackExtra)||void 0===R?void 0:R[0],setBackTrackMessage:null===(H=null==Y?void 0:Y.backTrackExtra)||void 0===H?void 0:H[1]})),null===(S=null==_?void 0:_.buttons)||void 0===S?void 0:S.map(((t,e)=>{if("QUICK_REPLY"===t.type)return o(g,{variableListIndex:e,QRBoptions:null==j?void 0:j.QRBoptions,button:t,originalVariableList:_,updateSelectedQRBTemplateBtn:ot},`${e}`)})),F===n.CHATBOT&&J&&o(r,{discountCode:null===(P=null==Y?void 0:Y.discountCodeExtra)||void 0===P?void 0:P[0],setDiscountCode:null===(Q=null==Y?void 0:Y.discountCodeExtra)||void 0===Q?void 0:Q[1],variableList:C}),null===(W=null==_?void 0:_.buttons)||void 0===W?void 0:W.map(((t,e)=>{var i,n,a;if("COPY_CODE"===t.type)return o(u,{index:e,variable:{variableName:null!==(i=t.text)&&void 0!==i?i:"",updatedValue:null!==(n=t.buttonVariable)&&void 0!==n?n:"",type:"string",isEditableVariable:!0,index:null!==(a=t.index)&&void 0!==a?a:0},showVariableModal:!0,variableList:et,componentType:"BUTTONS"},e)}))]}))};export{h as default};
@@ -1,12 +1,12 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import i from"react";import a from"styled-components";import{TemplatePreview as o}from"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import"../../../constants/Theme.js";import"../../template-preview/models/TemplateMeta.js";import{POD as p}from"../../template-preview/models/WhatsAppTemplate.js";import{CHANNEL_TYPE as r}from"../../template-preview/models/Channels.js";import{useTemplateModalContext as l}from"../context/templateModalContext.js";const s=a.div`
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import i from"react";import o from"styled-components";import{TemplatePreview as a}from"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import"../../../constants/Theme.js";import"../../template-preview/models/TemplateMeta.js";import{POD as p}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as r}from"../context/templateModalContext.js";import{getPreviewWidth as s}from"../utils/getPreviewDimension.js";const l=o.div`
2
2
  position: relative;
3
3
  height: 100%;
4
4
  border-radius: 31px;
5
- width: ${e=>e.channel===r.WHATSAPP?"236px":"300px"};
5
+ width: ${e=>s(e.channel)}px;
6
6
  background-color: white;
7
7
  margin: auto;
8
8
  overflow-y: auto;
9
- `,m=a.div`
9
+ `,m=o.div`
10
10
  position: absolute;
11
11
  flex: 1;
12
12
  background-color: white;
@@ -17,4 +17,4 @@ import{jsx as e,jsxs as t}from"react/jsx-runtime";import i from"react";import a
17
17
  height: calc(100% - 17px);
18
18
  border-radius: 16px;
19
19
  overflow-y: auto;
20
- `,n=i.forwardRef(((i,a)=>{let{display_content:n,channel:h,template:c,showSampleValues:d}=i;const{pod:w}=l();return e("div",{children:t(s,Object.assign({channel:h},{children:[e("img",{alt:"",src:"https://firebasestorage.googleapis.com/v0/b/staging-bikayi.appspot.com/o/bik%2FkNwEVoGlLpVjOsXoO1M8WgvWicP2%2F6f07b850-8b4b-4d58-96cc-8ba6df7b4e4a-Device___Frame.jpg?alt=media&token=253f1bfe-8481-4f54-bdef-3c0a73697d6a",style:{width:h===r.WHATSAPP?236:300,height:443}}),e(m,Object.assign({ref:a},{children:e(o,{showSampleValues:d,template:c,channel:h,smsSpecificMeta:{smsDisplayContent:n},whatsAppSpecificMeta:{showWhatsAppHeader:!0,whatsAppExtras:w!==p.CHATBOT,containerStyle:{border:"none",borderBottomRightRadius:0,borderBottomLeftRadius:0,minHeight:426,width:236}},size:"small",hideHeader:!0,emailSpecificMeta:{emailDisplayContent:n,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_mobile",containerStyle:{height:"100%",width:"100%"},templateContainerStyles:{height:"100%"}}})}))]}))})}));n.displayName="MobilePreview";export{n as default};
20
+ `,n=i.forwardRef(((i,o)=>{let{display_content:n,channel:h,template:c,showSampleValues:d}=i;const{pod:w}=r();return e("div",{children:t(l,Object.assign({channel:h},{children:[e("img",{alt:"",src:"https://firebasestorage.googleapis.com/v0/b/staging-bikayi.appspot.com/o/bik%2FkNwEVoGlLpVjOsXoO1M8WgvWicP2%2F6f07b850-8b4b-4d58-96cc-8ba6df7b4e4a-Device___Frame.jpg?alt=media&token=253f1bfe-8481-4f54-bdef-3c0a73697d6a",style:{width:s(h),height:443}}),e(m,Object.assign({ref:o},{children:e(a,{showSampleValues:d,template:c,channel:h,smsSpecificMeta:{smsDisplayContent:n},whatsAppSpecificMeta:{showWhatsAppHeader:!0,whatsAppExtras:w!==p.CHATBOT,containerStyle:{border:"none",borderBottomRightRadius:0,borderBottomLeftRadius:0,minHeight:426,width:240}},size:"small",hideHeader:!0,emailSpecificMeta:{emailDisplayContent:n,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_mobile",containerStyle:{height:"100%",width:"100%"},templateContainerStyles:{height:"100%"}}})}))]}))})}));n.displayName="MobilePreview";export{n as default};
@@ -14,7 +14,7 @@ export interface VariableConnectorProps {
14
14
  showVariableModal?: boolean;
15
15
  variableList?: VariableListInterfaceV2[];
16
16
  setShowDiscountCheckBox?: any;
17
- componentType?: 'HEADER' | 'BODY' | 'BUTTONS' | 'FOOTER';
17
+ componentType?: 'HEADER' | 'BODY' | 'BUTTONS' | 'FOOTER' | 'limited_time_offer';
18
18
  CTAoptions?: ButtonPlaceHolderOptions[];
19
19
  }
20
20
  declare const VariableConnector: React.FC<VariableConnectorProps>;
@@ -1,7 +1,7 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import l from"../../../assets/icons/edit.svg.js";import{useState as a,useEffect as i}from"react";import n from"styled-components";import{AddVariableV2SideModal as o}from"../../add-variableV2/AddVariableV2SideModal.js";import{Dropdown as s}from"../../dropdown/Dropdown.js";import{Input as u}from"../../input/Input.js";import{truncate as d}from"../../product-picker-v2/collectionScreen.js";import{placeHolderNamePattern as r}from"../../template-preview/constants/regexPatterns.js";import{CHANNEL_TYPE as c}from"../../template-preview/models/Channels.js";import{POD as p}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as m,BodyPrimary as v}from"../../TypographyStyle.js";import b from"../../../utils/StringUtils.js";import{COLORS as g}from"../../../constants/Theme.js";import{useTemplateModalContext as h}from"../context/templateModalContext.js";import{getVariableNameForEmailByIndex as x}from"../utils/getVariableNameEmail.js";const j=n.div`
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import l from"../../../assets/icons/edit.svg.js";import{format as a}from"date-fns";import{useState as i,useEffect as n}from"react";import o from"styled-components";import{AddVariableV2SideModal as s}from"../../add-variableV2/AddVariableV2SideModal.js";import{CustomDateTime as u}from"../../custom-date-time/CustomDateTime.js";import{Dropdown as d}from"../../dropdown/Dropdown.js";import{Input as r}from"../../input/Input.js";import{truncate as c}from"../../product-picker-v2/collectionScreen.js";import{placeHolderNamePattern as p}from"../../template-preview/constants/regexPatterns.js";import{CHANNEL_TYPE as m}from"../../template-preview/models/Channels.js";import{POD as v}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as b,BodyPrimary as g}from"../../TypographyStyle.js";import h from"../../../utils/StringUtils.js";import{COLORS as x}from"../../../constants/Theme.js";import{useTemplateModalContext as f}from"../context/templateModalContext.js";import{getVariableNameForEmailByIndex as j}from"../utils/getVariableNameEmail.js";const O=o.div`
2
2
  /* surface/$color-background-warning-light */
3
3
 
4
- background: ${e=>e.focused&&e.channel===c.EMAIL?g.background.warning.light:"transparent"};
4
+ background: ${e=>e.focused&&e.channel===m.EMAIL?x.background.warning.light:"transparent"};
5
5
  border-radius: 4px;
6
6
  padding: 8px 10px;
7
- `,O={value:"custom_link",label:"Custom URL"},_={value:"custom_text",label:"Custom text"},f=n=>{let{onFocus:f,variable:y,index:T,showVariableModal:k,variableList:A,setShowDiscountCheckBox:V,componentType:E,CTAoptions:S}=n;var P,w;const[C,B]=a(!1),[L,H]=a(""),[N,M]=a([]),[W,$]=a(),[D,I]=a(!1),[R,U]=a(!1),{device:z,channel:Y,isError:Z,originalVariableList:G,template:q,templateSelectionTriggered:F,setTemplate:J,setDisplayContent:K,setOriginalVariableList:Q,globalNormalizedPlaceholders:X,enabledCustomText:ee,pod:te}=h();function le(e,t){var l,a,i;const n=e;H(""),$(n),Y===c.WHATSAPP?"custom_text"!==n.value&&"custom_link"!==n.value?(ae(null!==(l=n.value)&&void 0!==l?l:"","string"),null==ie||ie(null!==(a=y.index)&&void 0!==a?a:0,n.value,!0)):(null==ie||ie(null!==(i=y.index)&&void 0!==i?i:0,y.variableName,!0,"custom_text"),ae("","url"===n.bikPlaceholderType?"link":"string")):"custom_text"!==n.value&&"custom_link"!==n.value?ae(n.value,"url"===n.bikPlaceholderType?"link":"string"):(H(""),ae("",n.value))}function ae(e,t){var l,a,i,n;const o="custom_link"===t?"link":"custom_text"===t?"string":t;if(Y!==c.WHATSAPP){const a=x(T+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===z?"template_html_mobile":"template_html_desktop"),n=Y===c.EMAIL?null===(l=null==i?void 0:i.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);n&&(n.textContent="custom_text"!==t&&"custom_link"!==t||e?e:y.variableName);const s=G.map(((t,l)=>l===T?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t));null==Q||Q(s)}if(Y===c.WHATSAPP){const l=G;let s=l.body,u=l.header,d=l.buttons;"BODY"===E?s=null===(a=l.body)||void 0===a?void 0:a.map(((t,l)=>l===T?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t)):"HEADER"===E?u=null===(i=l.header)||void 0===i?void 0:i.map(((t,l)=>l===T?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t)):"BUTTONS"===E&&(d=null===(n=l.buttons)||void 0===n?void 0:n.map(((l,a)=>a===T?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:[e]}):l))),null==Q||Q((e=>Object.assign(Object.assign({},e),{header:u,body:s,buttons:d})))}}function ie(e,t,l,a){var i,n,o,s;const u=Object.assign({},q),d=null===(i=null==u?void 0:u.components)||void 0===i?void 0:i.map((l=>{var a,i,n,o,s,u,d,r,c,p;const m=Object.assign({},l);if("BODY"===l.type&&"BODY"===E){if(null===(i=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===i?void 0:i[0]){const l=[...null!==(s=null===(o=null===(n=m.example)||void 0===n?void 0:n.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},m.example),{body_text:[l]});return Object.assign(Object.assign({},m),{example:a})}}else if("HEADER"===l.type&&"HEADER"===E){if(null===(u=l.example)||void 0===u?void 0:u.header_text){const l=[...null!==(r=null===(d=m.example)||void 0===d?void 0:d.header_text)&&void 0!==r?r:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},m.example),{header_text:l});return Object.assign(Object.assign({},m),{example:a})}}else if("BUTTONS"===l.type&&"BUTTONS"===E&&(null===(p=null===(c=l.buttons)||void 0===c?void 0:c[e])||void 0===p?void 0:p.example)){const a=l.buttons.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:[t]}):l));return Object.assign(Object.assign({},m),{buttons:a})}return l}));u.components=d,l&&("BODY"===E&&(null===(n=null==u?void 0:u.mapping)||void 0===n?void 0:n.body)?u.mapping=Object.assign(Object.assign({},u.mapping),{body:u.mapping.body.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))}):"HEADER"===E&&(null===(o=null==u?void 0:u.mapping)||void 0===o?void 0:o.header)?u.mapping=Object.assign(Object.assign({},u.mapping),{header:u.mapping.header.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+20}))`:t:l))}):"BUTTONS"===E&&(null===(s=null==u?void 0:u.mapping)||void 0===s?void 0:s.buttons)&&(u.mapping=Object.assign(Object.assign({},u.mapping),{buttons:u.mapping.buttons.map(((l,i)=>i===e?"custom_link"===a?"((customPlaceholderName))":t:l))}))),null==J||J(Object.assign({},u))}return i((()=>{C&&(null==f||f())}),[C]),i((()=>{!function(){var e,t,l,a,i;const n="mobile"===z?"template_html_mobile":"template_html_desktop",o=document.getElementById(n),s=(null!==(a=null===(l=null===(t=null===(e=null==o?void 0:o.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===l?void 0:l.innerHTML)&&void 0!==a?a:"")+(null===(i=null==o?void 0:o.contentWindow)||void 0===i?void 0:i.document.head.innerHTML);Y===c.EMAIL&&(null==K||K(s))}()}),[F]),i((()=>{var e;const t=[];let l=[];if(Y!==c.MESSAGE||ee){"link"===(null==y?void 0:y.type)?(t.push({label:"",options:[O,_]}),$(O)):(t.push({label:"",options:[O,_]}),$(_));const e=null!=X?X:[];M([...t,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:b.toCapitilize(null===(l=null===(t=e.label)||void 0===t?void 0:t.replace(/([A-Z])/g," $1"))||void 0===l?void 0:l.toLowerCase())})}))]),l=[...t,...e]}else{const e=null!=X?X:[];M([{label:"",options:[_,O]},...e]),l=[{label:"",options:[_,O]},...e]}if((Y===c.WHATSAPP||Y===c.EMAIL||Y===c.MESSAGE)&&y.updatedValue)if(r.test(y.updatedValue)&&Y===c.WHATSAPP||y.updatedValue.startsWith("{{")&&Y!==c.WHATSAPP){const e=function(e,t,l){var a;let i={label:"",value:""};const n=l===c.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");if(k){let t=e.updatedValue;if(te===p.CHATBOT&&"BUTTONS"===E){const l=null==S?void 0:S.filter((t=>t.placeHolder===e.updatedValue));l&&l.length>0&&(t=l[0].label)}i={label:t?t.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}}else t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===n.trim()&&(i=e)}))}));return i}(y,l,Y);e.value&&$(e)}else(null===(e=y.updatedValue)||void 0===e?void 0:e.startsWith("https"))?($(O),H(y.updatedValue.split("https://")[1])):($(_),H(y.updatedValue))}),[]),i((()=>{z&&W&&L&&setTimeout((()=>{ae("custom_link"===(null==W?void 0:W.value)&&L?L.includes("https")?L:`https://${L}`:L,W.value)}),100)}),[z]),i((()=>{!R&&W&&y.updatedValue&&setTimeout((()=>{ae("custom_link"===(null==W?void 0:W.value)&&y.updatedValue?y.updatedValue.includes("https")?y.updatedValue:`https://${y.updatedValue}`:y.updatedValue,W.value),U(!0)}),100)}),[W]),e(j,Object.assign({channel:Y,focused:C,onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1)},{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(m,Object.assign({style:{color:Z&&!W?g.content.negative:g.content.primary}},{children:[null===(P=y.variableName)||void 0===P?void 0:P.replace("{{","").replace("}}","")," ","link"===(null==y?void 0:y.type)?"link":"variable"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:k?e("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==W?void 0:W.label)?"space-between":"flex-end"}},{children:[t(v,{children:d(null!==(w=null==W?void 0:W.label)&&void 0!==w?w:"",20,!0)}),t(l,{onClick:()=>{I(!D)},width:24,height:24,color:g.content.primary})]})):t(s,{options:N,isSearchable:!1,onSelect:le,defaultOptions:W?[Object.assign(Object.assign({},W),{selected:!0})]:[]})})),("custom_text"===(null==W?void 0:W.value)||"custom_link"===(null==W?void 0:W.value))&&t(u,{labelText:"custom_text"===(null==W?void 0:W.value)?"Custom text value":"custom_link"===(null==W?void 0:W.value)?"Custom URL value":"",id:`variable-value-${null==W?void 0:W.value}-${T}`,value:L,errorMessage:Z?L&&0!==L.trim().length?"custom_link"!==W.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${L.trim()}`)&&0!==L.trim().length?"custom_link"!==W.value&&L.length>30?"Length cannot be more than 30":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==W?void 0:W.value)?void 0:30,prefixText:"custom_link"===(null==W?void 0:W.value)?"https://":"",placeholder:"link"===y.type||"custom_link"===W.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{!function(e,t){var l;H(t);const a="custom_link"===(null==W?void 0:W.value)&&t?t.includes("https")?t:`https://${t}`:t;ae(a,e),Y===c.WHATSAPP&&(null==ie||ie(null!==(l=y.index)&&void 0!==l?l:0,a,"custom_link"===e,e))}(W.value,e)}}),D&&t(o,{zIndex:2e3,data:null!=A?A:[],showVariable:D,setShowVariable:I,placeholder:"Add a variable",customTrigger:e=>{null==V||V(!1),"{{custom.url}}"===e.actualValue?le({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?le({label:e.displayName,selected:!0,value:"custom_text"}):le({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};export{j as Container,f as default};
7
+ `,_={value:"custom_link",label:"Custom URL"},y={value:"custom_text",label:"Custom text"},T={value:"static_expiry",label:"Static Expiry"},k=o=>{let{onFocus:k,variable:V,index:A,showVariableModal:E,variableList:S,setShowDiscountCheckBox:w,componentType:P,CTAoptions:C}=o;var B,D;const[L,N]=i(!1),[H,U]=i(""),[M,W]=i([]),[R,$]=i(),[I,z]=i(!1),[Y,Z]=i(!1),{device:G,channel:q,isError:F,originalVariableList:K,template:J,templateSelectionTriggered:Q,setTemplate:X,setDisplayContent:ee,setOriginalVariableList:te,globalNormalizedPlaceholders:le,enabledCustomText:ae,pod:ie}=f();function ne(e,t){var l,a,i;const n=e;U(""),$(n),q===m.WHATSAPP?"custom_text"!==n.value&&"custom_link"!==n.value&&"static_expiry"!==n.value?(se(null!==(l=n.value)&&void 0!==l?l:"","string"),null==ue||ue(null!==(a=V.index)&&void 0!==a?a:0,n.value,!0)):(null==ue||ue(null!==(i=V.index)&&void 0!==i?i:0,H,!0,n.value),se("","url"===n.bikPlaceholderType?"link":"string")):"custom_text"!==n.value&&"custom_link"!==n.value?se(n.value,"url"===n.bikPlaceholderType?"link":"string"):(U(""),se("",n.value))}function oe(e,t){var l;U(t);const a="custom_link"===(null==R?void 0:R.value)&&t?t.includes("https")?t:`https://${t}`:t;se(a,"static_expiry"===e?"string":e),q===m.WHATSAPP&&(null==ue||ue(null!==(l=V.index)&&void 0!==l?l:0,a,"custom_link"===e,e))}function se(e,t){var l,a,i,n;const o="custom_link"===t?"link":"custom_text"===t?"string":t;if(q!==m.WHATSAPP){const a=j(A+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===G?"template_html_mobile":"template_html_desktop"),n=q===m.EMAIL?null===(l=null==i?void 0:i.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);n&&(n.textContent="custom_text"!==t&&"custom_link"!==t||e?e:V.variableName);const s=K.map(((t,l)=>l===A?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t));null==te||te(s)}if(q===m.WHATSAPP){const l=K;let s=l.body,u=l.header,d=l.buttons;"BODY"===P?s=null===(a=l.body)||void 0===a?void 0:a.map(((t,l)=>l===A?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t)):"HEADER"===P?u=null===(i=l.header)||void 0===i?void 0:i.map(((t,l)=>l===A?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t)):"BUTTONS"===P&&(d=null===(n=l.buttons)||void 0===n?void 0:n.map(((l,a)=>a===A?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:[e]}):l))),null==te||te((e=>Object.assign(Object.assign({},e),{header:u,body:s,buttons:d})))}}function ue(e,t,l,a){var i,n,o,s;const u=Object.assign({},J),d=null===(i=null==u?void 0:u.components)||void 0===i?void 0:i.map((l=>{var a,i,n,o,s,u,d,r,c,p;const m=Object.assign({},l);if("BODY"===l.type&&"BODY"===P){if(null===(i=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===i?void 0:i[0]){const l=[...null!==(s=null===(o=null===(n=m.example)||void 0===n?void 0:n.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},m.example),{body_text:[l]});return Object.assign(Object.assign({},m),{example:a})}}else if("HEADER"===l.type&&"HEADER"===P){if(null===(u=l.example)||void 0===u?void 0:u.header_text){const l=[...null!==(r=null===(d=m.example)||void 0===d?void 0:d.header_text)&&void 0!==r?r:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},m.example),{header_text:l});return Object.assign(Object.assign({},m),{example:a})}}else if("BUTTONS"===l.type&&"BUTTONS"===P){if(null===(p=null===(c=l.buttons)||void 0===c?void 0:c[e])||void 0===p?void 0:p.example){const a=l.buttons.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:[t]}):l));return Object.assign(Object.assign({},m),{buttons:a})}}else if("limited_time_offer"===l.type&&"limited_time_offer"===P)return Object.assign(Object.assign({},m),{example:Object.assign(Object.assign({},m.example),{limited_time_offer:t})});return l}));if(u.components=d,l)if("BODY"===P&&(null===(n=null==u?void 0:u.mapping)||void 0===n?void 0:n.body))u.mapping=Object.assign(Object.assign({},u.mapping),{body:u.mapping.body.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))});else if("HEADER"===P&&(null===(o=null==u?void 0:u.mapping)||void 0===o?void 0:o.header))u.mapping=Object.assign(Object.assign({},u.mapping),{header:u.mapping.header.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+20}))`:t:l))});else if("BUTTONS"===P&&(null===(s=null==u?void 0:u.mapping)||void 0===s?void 0:s.buttons)){let l=-1,i=-1;d.forEach((t=>{var a;"BUTTONS"===t.type&&(null===(a=t.buttons)||void 0===a||a.forEach(((t,a)=>{"URL"===t.type&&(l++,a===e&&"URL"==t.type&&(i=l))})))})),u.mapping=Object.assign(Object.assign({},u.mapping),{buttons:u.mapping.buttons.map(((e,l)=>l===i?"custom_link"===a?"((customPlaceholderName))":t:e))})}null==X||X(Object.assign({},u))}return n((()=>{L&&(null==k||k())}),[L]),n((()=>{!function(){var e,t,l,a,i;const n="mobile"===G?"template_html_mobile":"template_html_desktop",o=document.getElementById(n),s=(null!==(a=null===(l=null===(t=null===(e=null==o?void 0:o.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===l?void 0:l.innerHTML)&&void 0!==a?a:"")+(null===(i=null==o?void 0:o.contentWindow)||void 0===i?void 0:i.document.head.innerHTML);q===m.EMAIL&&(null==ee||ee(s))}()}),[Q]),n((()=>{var e,t;const l=[];let a=[];if(q!==m.MESSAGE||ae){"link"===(null==V?void 0:V.type)?(l.push({label:"",options:[_,y]}),$(_)):"date_time"===(null==V?void 0:V.type)?(l.push({label:"",options:[_,y]}),$(T)):(l.push({label:"",options:[_,y,T]}),$(y));const e=null!=le?le:[];W([...l,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:h.toCapitilize(null===(l=null===(t=e.label)||void 0===t?void 0:t.replace(/([A-Z])/g," $1"))||void 0===l?void 0:l.toLowerCase())})}))]),a=[...l,...e]}else{const e=null!=le?le:[];W([{label:"",options:[y,_]},...e]),a=[{label:"",options:[y,_]},...e]}if((q===m.WHATSAPP||q===m.EMAIL||q===m.MESSAGE)&&V.updatedValue)if(p.test(V.updatedValue)&&q===m.WHATSAPP||V.updatedValue.startsWith("{{")&&q!==m.WHATSAPP){const e=function(e,t,l){var a;let i={label:"",value:""};const n=l===m.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");if(E){let t=e.updatedValue;if(ie===v.CHATBOT&&"BUTTONS"===P){const l=null==C?void 0:C.filter((t=>t.placeHolder===e.updatedValue));l&&l.length>0&&(t=l[0].label)}i={label:t?t.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}}else t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===n.trim()&&(i=e)}))}));return i}(V,a,q);e.value&&$(e)}else"date_time"===V.type?($(T),U(V.updatedValue),ue(null!==(e=V.index)&&void 0!==e?e:0,V.updatedValue)):(null===(t=V.updatedValue)||void 0===t?void 0:t.startsWith("https"))?($(_),U(V.updatedValue.split("https://")[1])):($(y),U(V.updatedValue))}),[]),n((()=>{G&&R&&H&&setTimeout((()=>{se("custom_link"===(null==R?void 0:R.value)&&H?H.includes("https")?H:`https://${H}`:H,R.value)}),100)}),[G]),n((()=>{!Y&&R&&V.updatedValue&&setTimeout((()=>{se("custom_link"===(null==R?void 0:R.value)&&V.updatedValue?V.updatedValue.includes("https")?V.updatedValue:`https://${V.updatedValue}`:V.updatedValue,R.value),Z(!0)}),100)}),[R]),e(O,Object.assign({channel:q,focused:L,onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1)},{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(b,Object.assign({style:{color:F&&!R?x.content.negative:x.content.primary}},{children:[null===(B=V.variableName)||void 0===B?void 0:B.replace("{{","").replace("}}","")," ","link"===(null==V?void 0:V.type)?"link":"variable"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:E?e("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==R?void 0:R.label)?"space-between":"flex-end"}},{children:[t(g,{children:c(null!==(D=null==R?void 0:R.label)&&void 0!==D?D:"",20,!0)}),t(l,{onClick:()=>{z(!I)},width:24,height:24,color:x.content.primary})]})):t(d,{options:M,isSearchable:!1,onSelect:ne,defaultOptions:R?[Object.assign(Object.assign({},R),{selected:!0})]:[]})})),("custom_text"===(null==R?void 0:R.value)||"custom_link"===(null==R?void 0:R.value))&&t(r,{labelText:"custom_text"===(null==R?void 0:R.value)?"Custom text value":"custom_link"===(null==R?void 0:R.value)?"Custom URL value":"",id:`variable-value-${null==R?void 0:R.value}-${A}`,value:H,errorMessage:F?H&&0!==H.trim().length?"custom_link"!==R.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${H.trim()}`)&&0!==H.trim().length?"custom_link"!==R.value&&H.length>30?"Length cannot be more than 30":"BUTTONS"===P&&"custom_link"!==R.value?"Enter valid alpha numeric code":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==R?void 0:R.value)?2e3:"BUTTONS"===P?15:30,noKeyDownChange:!0,prefixText:"custom_link"===(null==R?void 0:R.value)?"https://":"",placeholder:"link"===V.type||"custom_link"===R.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{oe(R.value,e)}}),"static_expiry"===(null==R?void 0:R.value)&&t(u,{placement:"auto",time:a(H?new Date(H):new Date,"hh:mm a"),date:H?new Date(H):new Date,minDate:new Date,error:"",setError:function(e){},onChange:e=>{oe("static_expiry",e.toISOString())}}),I&&t(s,{zIndex:2e3,data:null!=S?S:[],showVariable:I,setShowVariable:z,placeholder:"Add a variable",customTrigger:e=>{null==w||w(!1),"{{custom.url}}"===e.actualValue?ne({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?ne({label:e.displayName,selected:!0,value:"custom_text"}):"{{static.expiry}}"==e.actualValue?ne({label:e.displayName,selected:!0,value:"static_expiry"}):ne({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};export{O as Container,k as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as a,Fragment as i}from"react/jsx-runtime";import{Input as t}from"../../input/Input.js";import{BodySecondary as r}from"../../TypographyStyle.js";import{COLORS as l}from"../../../constants/Theme.js";import{useTemplateModalContext as o}from"../context/templateModalContext.js";import n from"./VariableConnector.js";const d=d=>{let{descriptionComponent:s,type:p,showVariableModal:b,variableList:c}=d;var m,v;const{originalVariableList:y,disableEditVariable:h}=o();return"BODY"===s.type?e("div",{children:null===(m=null==y?void 0:y.body)||void 0===m?void 0:m.map(((i,o)=>h||!i.isEditableVariable?a("div",Object.assign({style:{margin:"16px 8px"}},{children:[a(r,Object.assign({style:{color:l.content.primary}},{children:["HEADER"===p?"Header":""," Locked variable ",o+1]})),e(t,{state:"disabled",placeholder:i.variableName,onChangeText:()=>{}})]}),o):e(n,{index:o,variable:i,showVariableModal:b,variableList:c,componentType:s.type},`${o}-${i.index}`)))}):"HEADER"===s.type?e("div",{children:null===(v=null==y?void 0:y.header)||void 0===v?void 0:v.map(((i,o)=>i.isEditableVariable?e(n,{index:o,variable:i,showVariableModal:b,variableList:c,componentType:s.type},`${o}-${i.index}`):a("div",Object.assign({style:{margin:"16px 8px"}},{children:[a(r,Object.assign({style:{color:l.content.primary}},{children:["HEADER"===p?"Header":""," Locked variable ",o+1]})),e(t,{state:"disabled",placeholder:i.variableName,onChangeText:()=>{}})]}),o)))}):e(i,{})};export{d as default};
1
+ import{jsx as e,jsxs as i,Fragment as a}from"react/jsx-runtime";import{Input as t}from"../../input/Input.js";import{BodySecondary as l}from"../../TypographyStyle.js";import{COLORS as r}from"../../../constants/Theme.js";import{useTemplateModalContext as o}from"../context/templateModalContext.js";import{useAdditionalVariables as d}from"../custom-hooks/useAdditionalVariables.js";import n from"./VariableConnector.js";const s=s=>{let{descriptionComponent:p,type:m,showVariableModal:b,variableList:c}=s;var v,y,x,h,u,f;const{originalVariableList:V,disableEditVariable:g}=o(),E=d({variableList:c,categoryDisplayName:"Static Variables",variableDisplayName:"Static Expiry",variableValue:"{{static.expiry}}"});return"BODY"===p.type?e("div",{children:null===(v=null==V?void 0:V.body)||void 0===v?void 0:v.map(((a,o)=>g||!a.isEditableVariable?i("div",Object.assign({style:{margin:"16px 8px"}},{children:[i(l,Object.assign({style:{color:r.content.primary}},{children:["HEADER"===m?"Header":""," Locked variable ",o+1]})),e(t,{state:"disabled",placeholder:a.variableName,onChangeText:()=>{}})]}),o):e(n,{index:o,variable:a,showVariableModal:b,variableList:c,componentType:p.type},`${o}-${a.index}`)))}):"HEADER"===p.type?e("div",{children:null===(y=null==V?void 0:V.header)||void 0===y?void 0:y.map(((a,o)=>a.isEditableVariable?e(n,{index:o,variable:a,showVariableModal:b,variableList:c,componentType:p.type},`${o}-${a.index}`):i("div",Object.assign({style:{margin:"16px 8px"}},{children:[i(l,Object.assign({style:{color:r.content.primary}},{children:["HEADER"===m?"Header":""," Locked variable ",o+1]})),e(t,{state:"disabled",placeholder:a.variableName,onChangeText:()=>{}})]}),o)))}):"limited_time_offer"===p.type?e("div",{children:e(n,{index:0,variable:{variableName:null!==(h=null===(x=null==p?void 0:p.limited_time_offer)||void 0===x?void 0:x.text)&&void 0!==h?h:"Expires after",updatedValue:null!==(f=null===(u=p.example)||void 0===u?void 0:u.limited_time_offer)&&void 0!==f?f:(new Date).toISOString(),type:"date_time",isEditableVariable:!0,index:0},showVariableModal:b,variableList:E,componentType:p.type},`${p.type}`)}):e(a,{})};export{s as default};
@@ -6,4 +6,4 @@ import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../../assets/
6
6
  padding-right: 10px;
7
7
  margin-bottom: 8px;
8
8
  line-height: normal;
9
- `,p=i=>{let{headerText:r,subText:p,toolTipInfo:d,containerStyle:m}=i;return t(c,Object.assign({style:Object.assign({},m)},{children:[t("div",Object.assign({style:{display:"flex",gap:8}},{children:[e(s,Object.assign({style:{color:l.content.primary}},{children:r})),d&&e(n,Object.assign({body:p},{children:e("div",{children:e(o,{width:20,height:20,color:l.content.placeholder})})}))]})),e(a,Object.assign({style:{color:l.content.secondary,marginBottom:0,lineHeight:20,display:"block"}},{children:p}))]}))};export{p as default};
9
+ `,p=i=>{let{headerText:r,subText:p,toolTipInfo:d,containerStyle:m}=i;return t(c,Object.assign({style:Object.assign({},m)},{children:[t("div",Object.assign({style:{display:"flex",gap:8}},{children:[e(s,Object.assign({style:{color:l.content.primary}},{children:r})),d&&e(n,Object.assign({body:d},{children:e("div",{children:e(o,{width:20,height:20,color:l.content.placeholder})})}))]})),e(a,Object.assign({style:{color:l.content.secondary,marginBottom:0,lineHeight:20,display:"block"}},{children:p}))]}))};export{p as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as l,useCallback as a,useMemo as o,useEffect as i}from"react";import{Dropdown as s}from"../../dropdown/Dropdown.js";import{Input as n}from"../../input/Input.js";import{editableVarPattern as r}from"../../template-preview/constants/regexPatterns.js";import{CUSTOM_URL_NAME as d}from"../../template-preview/models/TemplateMeta.js";import{POD as p,BUTTON_TYPE as m}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as b}from"../../TypographyStyle.js";import{COLORS as c}from"../../../constants/Theme.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";import{validateIsUrl as v}from"../utils/validateIsUrl.js";import f,{Container as j}from"./VariableConnector.js";const y=y=>{let{variableListIndex:g,button:h,updateSelectedURLTemplateBtn:x,updateSelectedQRBTemplateBtn:O,originalVariableList:L,CTAoptions:T,QRBoptions:V,variableList:R}=y;var U,w,I,C;const[B,N]=l(""),[H,E]=l(),S=a((()=>R?[...R,{description:"",displayName:"Custom variables",orderId:1,variables:{"Custom url":{description:void 0,displayName:"Custom url",actualValue:"{{custom.url}}",variableType:"any",isAvailable:!0}}}].sort(((e,t)=>e.orderId-t.orderId)):R),[R]),k=o((()=>S()),[S]),{setOriginalVariableList:A,isError:M,disableEditVariable:P,pod:_}=u();function Q(e){N(e);const t=[Object.assign(Object.assign({},L.buttons[0]),{type:m.URL,buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]})];null==A||A((e=>Object.assign(Object.assign({},e),{body:[...L.body],buttons:[...t]}))),null==x||x(`https://${e}`,"custom")}return i((()=>{var e;if(h.buttonVariable&&r.test(h.buttonVariable))E(d),N((null===(e=h.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===h.type?T:V;e="URL"===h.type?t.findIndex((e=>e.placeHolder===h.buttonVariable)):t.findIndex((e=>e.label===h.flowName)),e>-1&&E(t[e])}}),[]),_!==p.CHATBOT?e(j,{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(b,Object.assign({style:{color:c.content.primary}},{children:[h.text," button"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:t(s,{disabled:P,options:"URL"===h.type?T:V,isSearchable:!1,onSelect:function(e,t){const l=e;E(l);const a=("URL"===h.type?T:V).find((e=>e.placeHolder===l.placeHolder));if(a)if("custom_link"!==a.value){let e;"URL"===h.type?(e=[Object.assign(Object.assign({},L.buttons[0]),{type:"URL",buttonVariable:l.placeHolder,example:["https://bik.ai/"]})],null==x||x({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder")):(e=L.buttons.map(((e,t)=>t===h.index?Object.assign(Object.assign({},e),{type:"QUICK_REPLY",flowName:l.label,flowId:l.value}):e)),null==O||O({flowName:l.label,flowId:l.value},"placeholder",h.index)),null==A||A((t=>Object.assign(Object.assign({},t),{body:[...L.body],buttons:[...e]})))}else Q("")},defaultOptions:H?[Object.assign(Object.assign({},H),{selected:!0})]:[]})})),"custom_link"===(null==H?void 0:H.value)&&t("div",Object.assign({style:{marginBottom:20}},{children:t(n,{state:P?"disabled":"none",errorMessage:M?B?v(B)?"":"Enter valid URL":"Required field":"",value:B,prefixText:"custom_link"===(null==H?void 0:H.value)?"https://":"",placeholder:"Enter custom URL here",onChangeText:Q})}))]}):t(f,{index:g,variable:{variableName:null!==(U=h.text)&&void 0!==U?U:"",updatedValue:"((customPlaceholderName))"===h.buttonVariable?`${null===(w=h.example)||void 0===w?void 0:w[0]}`:null!==(I=h.buttonVariable)&&void 0!==I?I:"",type:"link",isEditableVariable:!0,index:null!==(C=h.index)&&void 0!==C?C:0},showVariableModal:!0,componentType:"BUTTONS",variableList:k,CTAoptions:T})};export{y as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as a,useEffect as l}from"react";import{Dropdown as o}from"../../dropdown/Dropdown.js";import{Input as i}from"../../input/Input.js";import{editableVarPattern as s}from"../../template-preview/constants/regexPatterns.js";import{CUSTOM_URL_NAME as n}from"../../template-preview/models/TemplateMeta.js";import{POD as r,BUTTON_TYPE as p}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as d}from"../../TypographyStyle.js";import{COLORS as m}from"../../../constants/Theme.js";import{useTemplateModalContext as b}from"../context/templateModalContext.js";import{useAdditionalVariables as c}from"../custom-hooks/useAdditionalVariables.js";import{validateIsUrl as u}from"../utils/validateIsUrl.js";import v,{Container as f}from"./VariableConnector.js";const j=j=>{let{variableListIndex:g,button:y,updateSelectedURLTemplateBtn:h,updateSelectedQRBTemplateBtn:x,originalVariableList:O,CTAoptions:L,QRBoptions:V,variableList:R}=j;var T,U,w,C;const[B,N]=a(""),[I,H]=a(),E=c({variableList:R,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom URL",variableValue:"{{custom.url}}"}),{setOriginalVariableList:S,isError:k,disableEditVariable:A,pod:M}=b();function P(e){N(e);const t=[Object.assign(Object.assign({},O.buttons[0]),{type:p.URL,buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]})];null==S||S((e=>Object.assign(Object.assign({},e),{body:[...O.body],buttons:[...t]}))),null==h||h(`https://${e}`,"custom")}return l((()=>{var e;if(y.buttonVariable&&s.test(y.buttonVariable))H(n),N((null===(e=y.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===y.type?L:V;e="URL"===y.type?t.findIndex((e=>e.placeHolder===y.buttonVariable)):t.findIndex((e=>e.label===y.flowName)),e>-1&&H(t[e])}}),[]),M!==r.CHATBOT?e(f,{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(d,Object.assign({style:{color:m.content.primary}},{children:[y.text," button"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:t(o,{disabled:A,options:"URL"===y.type?L:V,isSearchable:!1,onSelect:function(e,t){const a=e;H(a);const l=("URL"===y.type?L:V).find((e=>e.placeHolder===a.placeHolder));if(l)if("custom_link"!==l.value){let e;"URL"===y.type?(e=[Object.assign(Object.assign({},O.buttons[0]),{type:"URL",buttonVariable:a.placeHolder,example:["https://bik.ai/"]})],null==h||h({defaultValue:l.value,placeHolder:l.placeHolder},"placeholder")):(e=O.buttons.map(((e,t)=>t===y.index?Object.assign(Object.assign({},e),{type:"QUICK_REPLY",flowName:a.label,flowId:a.value}):e)),null==x||x({flowName:a.label,flowId:a.value},"placeholder",y.index)),null==S||S((t=>Object.assign(Object.assign({},t),{body:[...O.body],buttons:[...e]})))}else P("")},defaultOptions:I?[Object.assign(Object.assign({},I),{selected:!0})]:[]})})),"custom_link"===(null==I?void 0:I.value)&&t("div",Object.assign({style:{marginBottom:20}},{children:t(i,{state:A?"disabled":"none",errorMessage:k?B?u(B)?"":"Enter valid URL":"Required field":"",value:B,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:P,maxCharLimit:2e3})}))]}):t(v,{index:g,variable:{variableName:null!==(T=y.text)&&void 0!==T?T:"",updatedValue:"((customPlaceholderName))"===y.buttonVariable?`${null===(U=y.example)||void 0===U?void 0:U[0]}`:null!==(w=y.buttonVariable)&&void 0!==w?w:"",type:"link",isEditableVariable:!0,index:null!==(C=y.index)&&void 0!==C?C:0},showVariableModal:!0,componentType:"BUTTONS",variableList:E,CTAoptions:L})};export{j as default};