@bikdotai/bik-component-library 0.0.392-beta.1 → 0.0.394-beta-styles
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.
- package/dist/cjs/components/add-variableV2/AddVariableV2.d.ts +11 -1
- package/dist/cjs/components/add-variableV2/AddVariableV2.js +1 -1
- package/dist/cjs/components/add-variableV2/AddVariableV2.styled.d.ts +5 -0
- package/dist/cjs/components/add-variableV2/AddVariableV2.styled.js +5 -5
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/cjs/components/bik-layout/BikSidebar.d.ts +2 -0
- package/dist/cjs/components/bik-layout/BikSidebar.js +1 -1
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +5 -15
- package/dist/cjs/components/bik-layout/SidebarPopup.d.ts +12 -0
- package/dist/cjs/components/bik-layout/SidebarPopup.js +1 -0
- package/dist/cjs/components/bik-layout/SidebarStyles.d.ts +11 -0
- package/dist/cjs/components/bik-layout/SidebarStyles.js +1 -1
- package/dist/cjs/components/bik-layout/SimpleSidebar.d.ts +1 -0
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +4 -4
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +6 -14
- package/dist/cjs/components/input-with-vars/InputWithVariables.js +3 -3
- package/dist/cjs/components/plans/NewSubscriptionPlan.js +1 -1
- package/dist/cjs/components/plans/SubscriptionPlansCollected.js +2 -2
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +1 -3
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/Body.d.ts +0 -2
- package/dist/cjs/components/template-context-mapper/modalElements/Body.js +5 -5
- package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.d.ts +0 -1
- package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.js +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.d.ts +0 -3
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.d.ts +0 -2
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +1 -2
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.d.ts +0 -1
- package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +1 -3
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +1 -3
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/cjs/components/template-preview/TemplatePreview.d.ts +1 -2
- package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.d.ts +0 -1
- package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/constants/regexPatterns.js +1 -1
- package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -6
- package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
- package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +0 -1
- package/dist/cjs/constants/Theme.js +1 -1
- package/dist/esm/components/add-variableV2/AddVariableV2.d.ts +11 -1
- package/dist/esm/components/add-variableV2/AddVariableV2.js +1 -1
- package/dist/esm/components/add-variableV2/AddVariableV2.styled.d.ts +5 -0
- package/dist/esm/components/add-variableV2/AddVariableV2.styled.js +5 -5
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/esm/components/bik-layout/BikSidebar.d.ts +2 -0
- package/dist/esm/components/bik-layout/BikSidebar.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +5 -15
- package/dist/esm/components/bik-layout/SidebarPopup.d.ts +12 -0
- package/dist/esm/components/bik-layout/SidebarPopup.js +1 -0
- package/dist/esm/components/bik-layout/SidebarStyles.d.ts +11 -0
- package/dist/esm/components/bik-layout/SidebarStyles.js +1 -1
- package/dist/esm/components/bik-layout/SimpleSidebar.d.ts +1 -0
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +4 -4
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +6 -14
- package/dist/esm/components/input-with-vars/InputWithVariables.js +3 -3
- package/dist/esm/components/plans/NewSubscriptionPlan.js +1 -1
- package/dist/esm/components/plans/SubscriptionPlansCollected.js +2 -2
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +1 -3
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/Body.d.ts +0 -2
- package/dist/esm/components/template-context-mapper/modalElements/Body.js +4 -4
- package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.d.ts +0 -1
- package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.js +4 -4
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.d.ts +0 -3
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.d.ts +0 -2
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +1 -2
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.d.ts +0 -1
- package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +1 -3
- package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +1 -3
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -3
- package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/esm/components/template-preview/TemplatePreview.d.ts +1 -2
- package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/WhatsAppTemplatePreview.d.ts +0 -1
- package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/constants/regexPatterns.js +1 -1
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -6
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
- package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +0 -1
- package/dist/esm/constants/Theme.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.d.ts +0 -11
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +0 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.d.ts +0 -11
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),s=require("../../button/Button.js");require("react");var i=require("../type.js");require("../../dropdown/DropdownPopover/index.js");var n=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("../../zeroState/ZeroState.js");var a=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../checkBox/CheckBox.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js");var l=require("../../input/Input.js"),r=require("../../../assets/icons/cross.svg.js");require("../../dropdown/MenuItem/MenuItem.js"),require("../../modals/styledModal.js"),require("../../../node_modules/lodash.debounce/index.js"),require("../../bik-layout/CommonStyles.js"),require("../../product-picker/ProductPicker.styled.js"),require("../../../utils/DateUtils.js"),require("../../tag/Tag.js"),require("@tippyjs/react"),require("../../tooltips/TooltipInternal.js"),require("../../product-picker-v2/modal.js");var d=require("../DiscountModal.styled.js"),u=require("../CouponExpiration/CouponExpiration.js"),c=require("../../radioButton/RadioButton.js"),p=require("../../../assets/icons/cursor.svg.js"),T=require("../../../assets/icons/plus.svg.js");const j="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg";var D;function x(){return null}exports.DISCOUNT_PRODUCTS=void 0,(D=exports.DISCOUNT_PRODUCTS||(exports.DISCOUNT_PRODUCTS={})).ENTITLED="entitled",D.PREREQUISITE="prerequisite";exports.default=D=>{var v;const E=[{value:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:i.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:D.selectedCouponType===i.DISCOUNT_TYPES.BUY_X_GET_Y},{value:i.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:D.selectedCouponType===i.DISCOUNT_TYPES.FREE_SHIPPING}],O=[{selected:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.NA,label:"No minimum requirements",value:i.MIN_PURCHASE_REQUIREMENT.NA},{selected:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT,label:`Minimum purchase amount (${null!==(v=D.currency)&&void 0!==v?v:"₹"})`,value:i.MIN_PURCHASE_REQUIREMENT.AMOUNT},{selected:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.QUANTITY,label:"Minimum quantity of items",value:i.MIN_PURCHASE_REQUIREMENT.QUANTITY}],m=()=>{var e,t,s,n,a;if(D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT){if((null===(e=D.discountData)||void 0===e?void 0:e.value)&&(null===(t=D.discountData)||void 0===t?void 0:t.value)<=0)return"Enter a valid input"}else if((null===(s=D.discountData)||void 0===s?void 0:s.value)&&((null===(n=D.discountData)||void 0===n?void 0:n.value)<=0||(null===(a=D.discountData)||void 0===a?void 0:a.value)>100))return"Enter a valid input"},g=()=>{var t,s,o,r,d;return e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsxs("div",Object.assign({className:"input__wrapper"},{children:[e.jsx(a.BodySecondary,Object.assign({style:{marginBottom:10}},{children:"Min purchase requirements"})),e.jsx(n.Dropdown,{options:O,placement:"bottom-start",onSelect:e=>{const t=e.value;D.setSelectedMinimumRequirement(t),D.setDiscountData(Object.assign(Object.assign({},D.discountData),{minQuantity:void 0,minAmount:void 0}))}})]})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:D.selectedMinimumRequirement!==i.MIN_PURCHASE_REQUIREMENT.NA&&e.jsx(l.Input,{value:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(s=null===(t=D.discountData.minAmount)||void 0===t?void 0:t.toString())&&void 0!==s?s:"":null!==(r=null===(o=D.discountData.minQuantity)||void 0===o?void 0:o.toString())&&void 0!==r?r:"",onChangeText:e=>{D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?D.setDiscountData(Object.assign(Object.assign({},D.discountData),{minAmount:parseInt(e)})):D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.QUANTITY&&D.setDiscountData(Object.assign(Object.assign({},D.discountData),{minQuantity:parseInt(e)}))},labelText:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?"Minimum purchase amount":"Minimum purchase quantity",prefixText:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(d=D.currency)&&void 0!==d?d:"₹":void 0,type:"number",placeholder:D.selectedMinimumRequirement===i.MIN_PURCHASE_REQUIREMENT.AMOUNT?"1000.00":"2"})}))]}))},b=(i,n)=>{var d,u,c,p;let x=[],v=[],E={},O={};return D.useNewPicker?(E=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledProducts:D.prerequisiteProducts,O=null!==(d=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledCollections:D.prerequisiteCollections)&&void 0!==d?d:[],(null==E?void 0:E.isCustom)&&delete E.isCustom,(null==O?void 0:O.isCustom)&&delete O.isCustom,Object.values(E).forEach((e=>{Object.keys(e.products).forEach((t=>{x.push({id:t,name:e.products[t].name,image:e.products[t].image})}))})),Object.keys(O).forEach((e=>{"isCustom"!==e&&v.push({id:e,name:O[e].name,image:O[e].image})}))):(x=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledProducts:D.prerequisiteProducts,v=null!==(u=i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.entitledCollections:D.prerequisiteCollections)&&void 0!==u?u:[]),e.jsxs(e.Fragment,{children:[!n&&e.jsxs(e.Fragment,{children:[e.jsx(a.TitleRegular,{children:i===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"Customer buys":"Customer gets"}),e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:i===exports.DISCOUNT_PRODUCTS.ENTITLED?null===(c=D.discountData.entitledQuantity)||void 0===c?void 0:c.toString():null===(p=D.discountData.prerequisiteQuantity)||void 0===p?void 0:p.toString(),type:"number",onChangeText:e=>{i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setDiscountData(Object.assign(Object.assign({},D.discountData),{entitledQuantity:parseInt(e)})):D.setDiscountData(Object.assign(Object.assign({},D.discountData),{prerequisiteQuantity:parseInt(e)}))},labelText:"Add quantity",placeholder:"Add quantity"})})),e.jsx("div",{className:"input__wrapper"})]}))]}),e.jsxs("div",Object.assign({style:{display:"flex",gap:18}},{children:[!(null==v?void 0:v.length)&&e.jsx(s.Button,{buttonText:"Add product",buttonType:"tertiary",LeadingIcon:T.default,onClick:()=>{D.setIsProductPickerOpen(i)}}),!(null==x?void 0:x.length)&&e.jsx(s.Button,{buttonText:"Add collection",buttonType:"tertiary",LeadingIcon:T.default,onClick:()=>{D.setIsCollectionPickerOpen(i)}})]})),!!x.length&&e.jsxs("div",Object.assign({style:{margin:"8px 0"}},{children:[e.jsx(a.TitleSmall,{children:"Products"}),x.map((s=>e.jsxs("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,display:"flex"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[e.jsx("img",{src:s.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),e.jsx(a.TitleSmall,{children:s.name})]})),e.jsx("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(D.useNewPicker){const e=t.cloneDeep(E);Object.values(e).forEach((e=>{var t,i;(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t[s.id])&&(null===(i=null==e?void 0:e.products)||void 0===i||delete i[s.id])})),i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledProducts(e):D.setPrerequisiteProducts(e)}else{const e=x.filter((e=>e.id!==s.id));i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledProducts(e):D.setPrerequisiteProducts(e)}}},{children:e.jsx(r.default,{width:14,color:o.DEFAULT_THEME.colorsV2.content.primary})}))}))]}),s.id)))]})),!!v.length&&e.jsxs("div",Object.assign({style:{margin:"8px 0"}},{children:[e.jsx(a.TitleSmall,{children:"Collections"}),v.map((s=>e.jsxs("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,display:"flex"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[e.jsx("img",{src:s.image,onError:e=>{e.target.onerror=null,e.target.src=j},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),e.jsx(a.TitleSmall,{children:s.name})]})),e.jsx("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(D.useNewPicker){const e=t.cloneDeep(O);delete e[s.id],i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledCollections(e):D.setPrerequisiteCollections(e)}else{const e=v.filter((e=>e.id!==s.id));i===exports.DISCOUNT_PRODUCTS.ENTITLED?D.setEntitledCollections(e):D.setPrerequisiteCollections(e)}}},{children:e.jsx(r.default,{width:14,color:o.DEFAULT_THEME.colorsV2.content.primary})}))}))]}),s.id)))]}))]})};return e.jsxs(d.DynamicCouponContainer,{children:[D.allowStaticCoupon&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(n.Dropdown,{options:E,width:"338px",placement:"bottom-start",onSelect:e=>{D.onChangeCouponType(e)}})})),e.jsx("div",Object.assign({className:"input__wrapper",style:{display:"flex",alignItems:"center",gap:8}},{children:(D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)&&e.jsxs(e.Fragment,{children:[e.jsx(c.RadioButton,{isActive:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,onValueChange:()=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,value:void 0}))},label:"Fixed amount"}),e.jsx(c.RadioButton,{isActive:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.PERCENTAGE,onValueChange:()=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,value:void 0}))},label:"Percentage"})]})}))]})),D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&(()=>{var t,s,n,a,o;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:null!==(n=null===(s=null===(t=D.discountData)||void 0===t?void 0:t.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",labelText:"Discount code value",type:"number",errorMessage:m(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:parseInt(e)}))},placeholder:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(a=D.currency)&&void 0!==a?a:"₹":void 0,suffixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0})}))]})),g(),!D.hideProbability&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{type:"number",value:null===(o=D.discountData.probability)||void 0===o?void 0:o.toString(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})})),e.jsx("div",{className:"input__wrapper"})]}))]})})(),D.selectedCouponType===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&(()=>{var t,s,n,a,o;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:null!==(n=null===(s=null===(t=D.discountData)||void 0===t?void 0:t.value)||void 0===s?void 0:s.toString())&&void 0!==n?n:"",labelText:"Discount code value",type:"number",errorMessage:m(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:parseInt(e)}))},placeholder:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(a=D.currency)&&void 0!==a?a:"₹":void 0,suffixText:D.discountData.valueType===i.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0})}))]})),b(exports.DISCOUNT_PRODUCTS.ENTITLED,!0),!D.hideProbability&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{type:"number",value:null===(o=D.discountData.probability)||void 0===o?void 0:o.toString(),onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})})),e.jsx("div",{className:"input__wrapper"})]}))]})})(),D.selectedCouponType===i.DISCOUNT_TYPES.FREE_SHIPPING&&(()=>{var t;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},labelText:"Code title",placeholder:"eg: Flat 50% Off",maxCharLimit:18})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:!D.hideProbability&&e.jsx(l.Input,{value:null===(t=D.discountData.probability)||void 0===t?void 0:t.toString(),type:"number",onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})}))]})),g()]})})(),D.selectedCouponType===i.DISCOUNT_TYPES.BUY_X_GET_Y&&(()=>{var t,s,i,n;return e.jsxs(d.DynamicCouponContainer,{children:[e.jsx("div",Object.assign({className:"input__rows"},{children:e.jsxs("div",Object.assign({style:{display:"flex",gap:20,flex:1}},{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(l.Input,{value:D.discountData.title,onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),!D.hideProbability&&e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(l.Input,{value:null===(t=D.discountData.probability)||void 0===t?void 0:t.toString(),type:"number",onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability",placeholder:"Enter probability in decimals (0 - 1)"})}))]}))})),e.jsx(x,{}),b(exports.DISCOUNT_PRODUCTS.PREREQUISITE),e.jsx(x,{}),b(exports.DISCOUNT_PRODUCTS.ENTITLED),e.jsx(x,{}),e.jsx(a.TitleRegular,{children:"At a discount value"}),e.jsxs("div",Object.assign({style:{display:"flex",gap:18,alignItems:"flex-start"}},{children:[e.jsx(c.RadioButton,{label:"Percentage",isActive:100!==D.discountData.value,onValueChange:()=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:void 0}))}}),100!==D.discountData.value&&e.jsx(l.Input,{variant:"small",value:null!==(n=null===(i=null===(s=D.discountData)||void 0===s?void 0:s.value)||void 0===i?void 0:i.toString())&&void 0!==n?n:"",onChangeText:e=>{D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:parseInt(e)}))},errorMessage:m(),type:"number",placeholder:"Enter percentage eg: 10%",suffixText:"%",width:"238px"})]})),e.jsx("div",{children:e.jsx(c.RadioButton,{label:"Free",isActive:100===D.discountData.value,onValueChange:e=>{e?D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:100})):D.setDiscountData(Object.assign(Object.assign({},D.discountData),{value:void 0}))}})})]})})(),D.selectedCouponType&&!D.hideExpiration&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:D.selectedCouponType!==i.DISCOUNT_TYPES.BUY_X_GET_Y&&D.selectedCouponType!==i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||!D.hideProbability?{height:6,borderTop:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,marginTop:12}:{}}),e.jsx(u.CouponExpiration,{discountData:D.discountData,setDiscountData:D.setDiscountData})]}),!D.selectedCouponType&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:10,padding:"40px 0",justifyContent:"center",alignItems:"center"}},{children:[e.jsx("div",Object.assign({style:{height:52,width:52,backgroundColor:o.DEFAULT_THEME.colorsV2.background.inverse,borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},{children:e.jsx(p.default,{width:32,color:o.DEFAULT_THEME.colorsV2.content.primaryInverse})})),e.jsx(a.TitleMedium,{children:"No discount has been selected"}),e.jsx(a.BodyPrimary,{children:"Please select a discount type"})]}))]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),i=require("../../button/Button.js");require("react");var s=require("../type.js");require("../../dropdown/DropdownPopover/index.js");var a=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("../../zeroState/ZeroState.js");var n=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../checkBox/CheckBox.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js");var l=require("../../input/Input.js"),r=require("../../../assets/icons/cross.svg.js");require("../../dropdown/MenuItem/MenuItem.js"),require("../../modals/styledModal.js"),require("../../../node_modules/lodash.debounce/index.js"),require("../../bik-layout/CommonStyles.js"),require("../../product-picker/ProductPicker.styled.js"),require("../../../utils/DateUtils.js"),require("../../tag/Tag.js"),require("@tippyjs/react"),require("../../tooltips/TooltipInternal.js"),require("../../product-picker-v2/modal.js");var d=require("../DiscountModal.styled.js"),u=require("../CouponExpiration/CouponExpiration.js"),c=require("../../radioButton/RadioButton.js"),p=require("../../../assets/icons/cursor.svg.js"),T=require("../../../assets/icons/plus.svg.js");const D="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg";var j;function E(){return null}exports.DISCOUNT_PRODUCTS=void 0,(j=exports.DISCOUNT_PRODUCTS||(exports.DISCOUNT_PRODUCTS={})).ENTITLED="entitled",j.PREREQUISITE="prerequisite";exports.default=j=>{var x;const m=[{value:s.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:j.selectedCouponType===s.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:s.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:j.selectedCouponType===s.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:s.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:j.selectedCouponType===s.DISCOUNT_TYPES.BUY_X_GET_Y},{value:s.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:j.selectedCouponType===s.DISCOUNT_TYPES.FREE_SHIPPING}],v=[{selected:j.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.NA,label:"No minimum requirements",value:s.MIN_PURCHASE_REQUIREMENT.NA},{selected:j.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT,label:`Minimum purchase amount (${null!==(x=j.currency)&&void 0!==x?x:"₹"})`,value:s.MIN_PURCHASE_REQUIREMENT.AMOUNT},{selected:j.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.QUANTITY,label:"Minimum quantity of items",value:s.MIN_PURCHASE_REQUIREMENT.QUANTITY}],O=()=>{var e,t,i,a,n;if(j.discountData.valueType===s.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT){if((null===(e=j.discountData)||void 0===e?void 0:e.value)&&(null===(t=j.discountData)||void 0===t?void 0:t.value)<=0)return"Enter a valid input"}else if((null===(i=j.discountData)||void 0===i?void 0:i.value)&&((null===(a=j.discountData)||void 0===a?void 0:a.value)<=0||(null===(n=j.discountData)||void 0===n?void 0:n.value)>100))return"Enter a valid input"},g=()=>{var t,i,o,r,d;return e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsxs("div",Object.assign({className:"input__wrapper"},{children:[e.jsx(n.BodySecondary,Object.assign({style:{marginBottom:10}},{children:"Min purchase requirements"})),e.jsx(a.Dropdown,{options:v,placement:"bottom-start",onSelect:e=>{const t=e.value;j.setSelectedMinimumRequirement(t),j.setDiscountData(Object.assign(Object.assign({},j.discountData),{minQuantity:void 0,minAmount:void 0}))}})]})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:j.selectedMinimumRequirement!==s.MIN_PURCHASE_REQUIREMENT.NA&&e.jsx(l.Input,{value:j.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(i=null===(t=j.discountData.minAmount)||void 0===t?void 0:t.toString())&&void 0!==i?i:"":null!==(r=null===(o=j.discountData.minQuantity)||void 0===o?void 0:o.toString())&&void 0!==r?r:"",onChangeText:e=>{j.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?j.setDiscountData(Object.assign(Object.assign({},j.discountData),{minAmount:parseInt(e)})):j.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.QUANTITY&&j.setDiscountData(Object.assign(Object.assign({},j.discountData),{minQuantity:parseInt(e)}))},labelText:j.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?"Minimum purchase amount":"Minimum purchase quantity",prefixText:j.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(d=j.currency)&&void 0!==d?d:"₹":void 0,type:"number",placeholder:j.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?"1000.00":"2"})}))]}))},_=(s,a)=>{var d,u,c,p;let E=[],x=[],m={},v={};return j.useNewPicker?(m=s===exports.DISCOUNT_PRODUCTS.ENTITLED?j.entitledProducts:j.prerequisiteProducts,v=null!==(d=s===exports.DISCOUNT_PRODUCTS.ENTITLED?j.entitledCollections:j.prerequisiteCollections)&&void 0!==d?d:[],(null==m?void 0:m.isCustom)&&delete m.isCustom,(null==v?void 0:v.isCustom)&&delete v.isCustom,Object.values(m).forEach((e=>{Object.keys(e.products).forEach((t=>{E.push({id:t,name:e.products[t].name,image:e.products[t].image})}))})),Object.keys(v).forEach((e=>{"isCustom"!==e&&x.push({id:e,name:v[e].name,image:v[e].image})}))):(E=s===exports.DISCOUNT_PRODUCTS.ENTITLED?j.entitledProducts:j.prerequisiteProducts,x=null!==(u=s===exports.DISCOUNT_PRODUCTS.ENTITLED?j.entitledCollections:j.prerequisiteCollections)&&void 0!==u?u:[]),e.jsxs(e.Fragment,{children:[!a&&e.jsxs(e.Fragment,{children:[e.jsx(n.TitleRegular,{children:s===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"Customer buys":"Customer gets"}),e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:s===exports.DISCOUNT_PRODUCTS.ENTITLED?null===(c=j.discountData.entitledQuantity)||void 0===c?void 0:c.toString():null===(p=j.discountData.prerequisiteQuantity)||void 0===p?void 0:p.toString(),type:"number",onChangeText:e=>{s===exports.DISCOUNT_PRODUCTS.ENTITLED?j.setDiscountData(Object.assign(Object.assign({},j.discountData),{entitledQuantity:parseInt(e)})):j.setDiscountData(Object.assign(Object.assign({},j.discountData),{prerequisiteQuantity:parseInt(e)}))},labelText:"Add quantity",placeholder:"Add quantity"})})),e.jsx("div",{className:"input__wrapper"})]}))]}),e.jsxs("div",Object.assign({style:{display:"flex",gap:18}},{children:[!(null==x?void 0:x.length)&&e.jsx(i.Button,{buttonText:"Add product",buttonType:"tertiary",LeadingIcon:T.default,onClick:()=>{j.setIsProductPickerOpen(s)}}),!(null==E?void 0:E.length)&&e.jsx(i.Button,{buttonText:"Add collection",buttonType:"tertiary",LeadingIcon:T.default,onClick:()=>{j.setIsCollectionPickerOpen(s)}})]})),!!E.length&&e.jsxs("div",Object.assign({style:{margin:"8px 0"}},{children:[e.jsx(n.TitleSmall,{children:"Products"}),E.map((i=>e.jsxs("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,display:"flex"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[e.jsx("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src=D},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),e.jsx(n.TitleSmall,{children:i.name})]})),e.jsx("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(j.useNewPicker){const e=t.cloneDeep(m);Object.values(e).forEach((e=>{var t,s;(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t[i.id])&&(null===(s=null==e?void 0:e.products)||void 0===s||delete s[i.id])})),s===exports.DISCOUNT_PRODUCTS.ENTITLED?j.setEntitledProducts(e):j.setPrerequisiteProducts(e)}else{const e=E.filter((e=>e.id!==i.id));s===exports.DISCOUNT_PRODUCTS.ENTITLED?j.setEntitledProducts(e):j.setPrerequisiteProducts(e)}}},{children:e.jsx(r.default,{width:14,color:o.DEFAULT_THEME.colorsV2.content.primary})}))}))]}),i.id)))]})),!!x.length&&e.jsxs("div",Object.assign({style:{margin:"8px 0"}},{children:[e.jsx(n.TitleSmall,{children:"Collections"}),x.map((i=>e.jsxs("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,display:"flex"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[e.jsx("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src=D},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),e.jsx(n.TitleSmall,{children:i.name})]})),e.jsx("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{if(j.useNewPicker){const e=t.cloneDeep(v);delete e[i.id],s===exports.DISCOUNT_PRODUCTS.ENTITLED?j.setEntitledCollections(e):j.setPrerequisiteCollections(e)}else{const e=x.filter((e=>e.id!==i.id));s===exports.DISCOUNT_PRODUCTS.ENTITLED?j.setEntitledCollections(e):j.setPrerequisiteCollections(e)}}},{children:e.jsx(r.default,{width:14,color:o.DEFAULT_THEME.colorsV2.content.primary})}))}))]}),i.id)))]}))]})};return e.jsxs(d.DynamicCouponContainer,{children:[j.allowStaticCoupon&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(a.Dropdown,{options:m,width:"338px",placement:"bottom-start",onSelect:e=>{j.onChangeCouponType(e)}})})),e.jsx("div",Object.assign({className:"input__wrapper",style:{display:"flex",alignItems:"center",gap:8}},{children:(j.selectedCouponType===s.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||j.selectedCouponType===s.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)&&e.jsxs(e.Fragment,{children:[e.jsx(c.RadioButton,{isActive:j.discountData.valueType===s.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,onValueChange:()=>{j.discountData.valueType!==s.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT&&j.setDiscountData(Object.assign(Object.assign({},j.discountData),{valueType:s.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,value:void 0}))},label:"Fixed amount"}),e.jsx(c.RadioButton,{isActive:j.discountData.valueType===s.DISCOUNT_VALUE_TYPES.PERCENTAGE,onValueChange:()=>{j.discountData.valueType!==s.DISCOUNT_VALUE_TYPES.PERCENTAGE&&j.setDiscountData(Object.assign(Object.assign({},j.discountData),{valueType:s.DISCOUNT_VALUE_TYPES.PERCENTAGE,value:void 0}))},label:"Percentage"})]})}))]})),j.selectedCouponType===s.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&(()=>{var t,i,a,n,o;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:j.discountData.title,onChangeText:e=>{j.setDiscountData(Object.assign(Object.assign({},j.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:null!==(a=null===(i=null===(t=j.discountData)||void 0===t?void 0:t.value)||void 0===i?void 0:i.toString())&&void 0!==a?a:"",labelText:"Discount code value",type:"number",errorMessage:O(),onChangeText:e=>{j.setDiscountData(Object.assign(Object.assign({},j.discountData),{value:parseInt(e)}))},placeholder:j.discountData.valueType===s.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:j.discountData.valueType===s.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(n=j.currency)&&void 0!==n?n:"₹":void 0,suffixText:j.discountData.valueType===s.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0})}))]})),g(),!j.hideProbability&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{type:"number",value:null===(o=j.discountData.probability)||void 0===o?void 0:o.toString(),onChangeText:e=>{j.setDiscountData(Object.assign(Object.assign({},j.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})})),e.jsx("div",{className:"input__wrapper"})]}))]})})(),j.selectedCouponType===s.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&(()=>{var t,i,a,n,o;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:j.discountData.title,onChangeText:e=>{j.setDiscountData(Object.assign(Object.assign({},j.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:null!==(a=null===(i=null===(t=j.discountData)||void 0===t?void 0:t.value)||void 0===i?void 0:i.toString())&&void 0!==a?a:"",labelText:"Discount code value",type:"number",errorMessage:O(),onChangeText:e=>{j.setDiscountData(Object.assign(Object.assign({},j.discountData),{value:parseInt(e)}))},placeholder:j.discountData.valueType===s.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:j.discountData.valueType===s.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(n=j.currency)&&void 0!==n?n:"₹":void 0,suffixText:j.discountData.valueType===s.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0})}))]})),_(exports.DISCOUNT_PRODUCTS.ENTITLED,!0),!j.hideProbability&&e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{type:"number",value:null===(o=j.discountData.probability)||void 0===o?void 0:o.toString(),onChangeText:e=>{j.setDiscountData(Object.assign(Object.assign({},j.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})})),e.jsx("div",{className:"input__wrapper"})]}))]})})(),j.selectedCouponType===s.DISCOUNT_TYPES.FREE_SHIPPING&&(()=>{var t;return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"input__rows"},{children:[e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(l.Input,{value:j.discountData.title,onChangeText:e=>{j.setDiscountData(Object.assign(Object.assign({},j.discountData),{title:e.trim()}))},labelText:"Code title",placeholder:"eg: Flat 50% Off",maxCharLimit:18})})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:!j.hideProbability&&e.jsx(l.Input,{value:null===(t=j.discountData.probability)||void 0===t?void 0:t.toString(),type:"number",onChangeText:e=>{j.setDiscountData(Object.assign(Object.assign({},j.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})}))]})),g()]})})(),j.selectedCouponType===s.DISCOUNT_TYPES.BUY_X_GET_Y&&(()=>{var t,i,s,a;return e.jsxs(d.DynamicCouponContainer,{children:[e.jsx("div",Object.assign({className:"input__rows"},{children:e.jsxs("div",Object.assign({style:{display:"flex",gap:20,flex:1}},{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(l.Input,{value:j.discountData.title,onChangeText:e=>{j.setDiscountData(Object.assign(Object.assign({},j.discountData),{title:e.trim()}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),!j.hideProbability&&e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(l.Input,{value:null===(t=j.discountData.probability)||void 0===t?void 0:t.toString(),type:"number",onChangeText:e=>{j.setDiscountData(Object.assign(Object.assign({},j.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})}))]}))})),e.jsx(E,{}),_(exports.DISCOUNT_PRODUCTS.PREREQUISITE),e.jsx(E,{}),_(exports.DISCOUNT_PRODUCTS.ENTITLED),e.jsx(E,{}),e.jsx(n.TitleRegular,{children:"At a discount value"}),e.jsxs("div",Object.assign({style:{display:"flex",gap:18,alignItems:"flex-start"}},{children:[e.jsx(c.RadioButton,{label:"Percentage",isActive:100!==j.discountData.value,onValueChange:()=>{j.setDiscountData(Object.assign(Object.assign({},j.discountData),{value:void 0}))}}),100!==j.discountData.value&&e.jsx(l.Input,{variant:"small",value:null!==(a=null===(s=null===(i=j.discountData)||void 0===i?void 0:i.value)||void 0===s?void 0:s.toString())&&void 0!==a?a:"",onChangeText:e=>{j.setDiscountData(Object.assign(Object.assign({},j.discountData),{value:parseInt(e)}))},errorMessage:O(),type:"number",placeholder:"Enter percentage eg: 10%",suffixText:"%",width:"238px"})]})),e.jsx("div",{children:e.jsx(c.RadioButton,{label:"Free",isActive:100===j.discountData.value,onValueChange:e=>{e?j.setDiscountData(Object.assign(Object.assign({},j.discountData),{value:100})):j.setDiscountData(Object.assign(Object.assign({},j.discountData),{value:void 0}))}})})]})})(),j.selectedCouponType&&!j.hideExpiration&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:j.selectedCouponType!==s.DISCOUNT_TYPES.BUY_X_GET_Y&&j.selectedCouponType!==s.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||!j.hideProbability?{height:6,borderTop:`1px solid ${o.DEFAULT_THEME.colorsV2.stroke.primary}`,marginTop:12}:{}}),e.jsx(u.CouponExpiration,{discountData:j.discountData,setDiscountData:j.setDiscountData})]}),!j.selectedCouponType&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:10,padding:"40px 0",justifyContent:"center",alignItems:"center"}},{children:[e.jsx("div",Object.assign({style:{height:52,width:52,backgroundColor:o.DEFAULT_THEME.colorsV2.background.inverse,borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},{children:e.jsx(p.default,{width:32,color:o.DEFAULT_THEME.colorsV2.content.primaryInverse})})),e.jsx(n.TitleMedium,{children:"No discount has been selected"}),e.jsx(n.BodyPrimary,{children:"Please select a discount type"})]}))]})};
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Variable } from '../add-variableV2/AddVariableV2';
|
|
3
1
|
import { SelectedVariable } from '../add-variableV2/types';
|
|
4
|
-
|
|
2
|
+
export declare const InputWithVariables: (props: {
|
|
5
3
|
variablesList: any;
|
|
6
4
|
onChange: (val: SelectedVariable) => void;
|
|
7
|
-
onBlur?: (e: Event, val?: SelectedVariable | Variable) => void;
|
|
8
5
|
addVarBoxRight: string;
|
|
9
6
|
allowMix: boolean;
|
|
10
7
|
prevVariable: SelectedVariable;
|
|
11
|
-
showHelp?: boolean;
|
|
12
|
-
onlyVariables?: boolean;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
errorMessage?: string;
|
|
17
|
-
showSideModal?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare const InputWithVariables: React.FC<InputWithVariablesProps>;
|
|
20
|
-
export {};
|
|
8
|
+
showHelp?: boolean | undefined;
|
|
9
|
+
onlyVariables?: boolean | undefined;
|
|
10
|
+
showSideModal?: boolean | undefined;
|
|
11
|
+
errorMessage?: string | undefined;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),l=require("react"),r=require("styled-components"),i=require("uuid"),d=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),l=require("react"),r=require("styled-components"),i=require("uuid"),d=require("../add-variableV2/AddVariableV2SideModal.js"),t=require("../add-variableV2/AddVariableV2.js"),s=require("../../constants/Theme.js"),u=require("../add-variableV2/AddVariableBox.styled.js"),o=require("../input/Input.js"),n=require("../TypographyStyle.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const v=c(r).default.div`
|
|
2
2
|
margin-bottom: 16px;
|
|
3
3
|
input {
|
|
4
|
-
color: ${e=>e.isVar?
|
|
4
|
+
color: ${e=>e.isVar?s.COLORS.stroke.brand:"black"};
|
|
5
5
|
}
|
|
6
|
-
`;exports.InputWithVariables=r=>{
|
|
6
|
+
`;exports.InputWithVariables=r=>{var s;const c=l.useRef(null),[b,g]=l.useState(!1),[V]=l.useState(i.v4()),[p,h]=l.useState(),[T,j]=l.useState(r.prevVariable),[x,y]=l.useState(!1),[f,S]=l.useState(!1),[m,q]=l.useState("");return l.useEffect((()=>{p&&p.actualValue&&(r.allowMix?j((e=>({actualValue:e.actualValue+p.actualValue,variableType:"string"}))):j((e=>({actualValue:p.actualValue,variableType:p.variableType,needsFetching:p.needsFetching}))))}),[p]),l.useEffect((()=>{r.onChange(T)}),[T]),l.useEffect((()=>{(null==r?void 0:r.errorMessage)&&q(null==r?void 0:r.errorMessage)}),[null==r?void 0:r.errorMessage]),e.jsxs(v,Object.assign({isVar:/^{{.*}}$/.test(T.actualValue)},{children:[e.jsx(o.Input,{id:V,ref:c,skipFocus:!0,textControl:!0,isActive:b,value:T.actualValue,validate:e=>[!0,""],errorMessage:m,placeholder:"Add a value",onChangeText:function(e,a){if(q(""),r.onlyVariables){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!=e&&46!=e||j({actualValue:"",variableType:"string"})}else r.allowMix?j({actualValue:e,variableType:"string"}):j({actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{var a;g(!0),S(!0),"Search..."!==(null===(a=e.relatedTarget)||void 0===a?void 0:a.placeholder)||x||y(!0)},onBlur:e=>{var a,l,r,i,d,t,s;"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 "))?(c.current&&c.current.focus(),g(!0)):"Search..."===(null===(s=e.relatedTarget)||void 0===s?void 0:s.placeholder)?g(!0):(g(!1),y(!1),S(!1))}}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[T.actualValue&&r.showHelp?e.jsx("div",Object.assign({style:{marginTop:4}},{children:e.jsx(n.BodyCaption,{children:`This value is of type ${T.variableType}`})})):e.jsx("div",{}),f&&e.jsx("div",Object.assign({style:{marginTop:m?"-24px":"0px"}},{children:e.jsx(u.AddVariableStyled,Object.assign({right:r.addVarBoxRight,id:"addVar",onClick:()=>{y(!x)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(a.default,{color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),x&&!r.showSideModal&&e.jsx(t.AddVariableV2,{data:r.variablesList,showVariable:!0,setShowVariable:()=>{y(!1)},variableValue:p,setVariableValue:h,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 "))?c.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==V&&(y(!1),S(!1),g(!1)):(y(!1),S(!1),g(!1))}}),x&&r.showSideModal&&e.jsx(d.AddVariableV2SideModal,{zIndex:2e3,data:null!==(s=r.variablesList)&&void 0!==s?s:[],showVariable:x,setShowVariable:()=>{y(!1)},placeholder:"Add a variable",customTrigger:e=>{h({actualValue:e.actualValue,variableType:"string"})},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 "))?c.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==V&&(y(!1),S(!1),g(!1)):(y(!1),S(!1),g(!1))}})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/check.svg.js"),t=require("../../assets/icons/checkCircle.svg.js"),i=require("../../assets/icons/quotes.svg.js"),a=require("../../assets/icons/WhiteStarFilled.svg.js"),n=require("../button/Button.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/check.svg.js"),t=require("../../assets/icons/checkCircle.svg.js"),i=require("../../assets/icons/quotes.svg.js"),a=require("../../assets/icons/WhiteStarFilled.svg.js"),n=require("../button/Button.js"),o=require("./SubscriptionPlanStyled.js"),r=require("../TypographyStyle.js"),l=require("../../hooks/useCurreny.js"),c=require("../../constants/Theme.js"),d=require("../tag/Tag.js");exports.NewSubscriptionPlan=h=>{var u;const{formatCurrency:j}=l.useCurrency(),p=h.showMonthlyOptions?h.features:h.annualFeatures||[],g=h.showMonthlyOptions?h.monthlyPlan:h.yearlyPlan,m=!h.isDisabled&&h.isMostPopular,x=h.showMonthlyOptions?h.code:null!==(u=h.yearlyCode)&&void 0!==u?u:h.code,{planName:b,isSelected:y=!1,isDisabled:O=!1,onPlanSelect:C,oldPrice:v,hideMonthYearTag:S,planDescription:T,planDescriptionDiscount:N,showTrialOptions:f,freeTrialMessages:L,extraBlockMessage:P,isLoading:w,buttonText:M,bottomDescription:k,showMonthlyOptions:B,popularTestimony:q,skipRadioSelection:R=!1,includeText:D,height:F,showFeaturesButton:$,businessDescription:_,isPlanSelected:z=!1,onClickShowAllFeatures:W,showSelectedPlanChip:H=!1,perMonthForYearly:I=!1}=h,U=e=>I&&!B?0==e?"$0":j(Math.round(e/12),"USD"):0==e?"$0":j(e,"USD");return e.jsxs(o.NewSubscriptionStyled,Object.assign({height:F,showMostPopularChip:m||!1,onClick:()=>C(x)},{children:[m&&e.jsxs("div",Object.assign({className:"most-popular-chip"},{children:[e.jsx(r.Caption,Object.assign({className:"popular-text"},{children:"Most popular "})),e.jsx(a.default,{height:12,width:12})]})),e.jsxs("div",Object.assign({className:`box ${O?"disabled":""} \n\t\t\t\t`},{children:[e.jsxs("div",Object.assign({className:"radio-flex"},{children:[!R&&e.jsx("input",{type:"radio",id:"html",name:"fav_language",value:"HTML",disabled:null!=O&&O,onChange:()=>C(x),className:"radio-button",checked:z}),e.jsx(r.TitleRegular,Object.assign({style:{color:c.COLORS.content.secondary,marginBottom:4}},{children:b})),H&&e.jsx("div",Object.assign({style:{marginLeft:"auto"}},{children:e.jsx(d.Tag,{tagText:"Current plan",type:"positive",theme:"dark"})}))]})),e.jsxs("div",Object.assign({className:"price-block"},{children:[v?e.jsx(r.BodyCaption,Object.assign({className:"old--price"},{children:U(g.price)})):e.jsx(e.Fragment,{}),e.jsx(r.TitleLarge,Object.assign({style:{color:c.COLORS.content.primary}},{children:U(v||g.price)})),e.jsx(r.Caption,Object.assign({style:{color:c.COLORS.content.secondary,marginLeft:4}},{children:S?"":"/ "+(B?"month":I?"month billed annually":"year")}))]})),T&&e.jsxs("div",Object.assign({className:"per-message-price"},{children:[e.jsx(r.BodyCaption,Object.assign({style:{color:c.COLORS.content.secondary}},{children:T})),N&&e.jsx(r.BodyCaption,Object.assign({style:{color:c.COLORS.background.positive.vibrant,marginLeft:4}},{children:N}))]})),_&&_.length&&e.jsx("div",Object.assign({style:{marginTop:4}},{children:_.map(((s,t)=>e.jsx(r.BodyCaption,{style:{color:c.COLORS.content.secondary},dangerouslySetInnerHTML:{__html:s}},t)))})),f&&e.jsxs(r.Caption,Object.assign({className:"trial "+(y?"selected":"")},{children:["7 day free trial with ",L," messages"]})),P&&e.jsx(r.Caption,Object.assign({className:"trial "+(y?"selected":"")},{children:P})),e.jsx(r.TitleSmall,Object.assign({className:"extra-include-margin",style:{height:D?"":"20px"}},{children:D||""})),e.jsx("div",Object.assign({className:"features"},{children:p.map(((s,i)=>e.jsxs("div",Object.assign({className:"feature"},{children:[e.jsx("div",{children:e.jsx(t.default,{height:20,width:20,color:c.COLORS.content.primary})}),e.jsx(r.BodyCaption,Object.assign({className:"feature-text"},{children:s.detail}),i)]}),s.detail)))})),$&&e.jsx(n.Button,{isLoading:!1,buttonType:"tertiary",buttonText:"See all features",size:"small",onClick:e=>{e.stopPropagation(),W&&W()}}),R&&e.jsx("div",Object.assign({className:"button-box"},{children:w?e.jsx(n.Button,{isLoading:!0,buttonType:"primary",buttonText:"Choose plan",size:"medium",matchParentWidth:!0}):e.jsxs(e.Fragment,{children:[y&&e.jsx(n.Button,{disabled:O,LeadingIcon:s.default,buttonType:"tertiary",size:"medium",matchParentWidth:!0,buttonText:M||"Selected Plan"}),!y&&!O&&e.jsx(n.Button,{buttonType:"primary",size:"medium",onClick:e=>{e.stopPropagation(),C(x)},matchParentWidth:!0,buttonText:M||"Choose plan"})]})})),q&&e.jsxs("div",Object.assign({className:"popular-testimony"},{children:[e.jsx(i.default,{height:26,width:70}),e.jsx("div",Object.assign({className:"testimony-text"},{children:e.jsx("i",{children:q})}))]}))]})),k&&e.jsx("div",Object.assign({className:`plan-bottom-information\n\t\t\t\t\t${O?"disabled":""}\n\t\t\t\t\t${y?"selected":""}\n\t\t\t\t`},{children:e.jsx(r.Caption,Object.assign({className:"text",style:{color:c.COLORS.background.inverse}},{children:k}))}))]}))};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("styled-components"),n=require("./NewSubscriptionPlan.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("styled-components"),n=require("./NewSubscriptionPlan.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const i=s(l).default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
column-gap: 22px;
|
|
4
4
|
align-items: stretch;
|
|
5
5
|
overflow-x: auto;
|
|
6
|
-
`;exports.SubscriptionPlansCollected=l=>{var s;const[a
|
|
6
|
+
`;exports.SubscriptionPlansCollected=l=>{var s;const[o,a]=t.useState(null!==(s=l.selectedPlan)&&void 0!==s?s:"");return e.jsx(i,Object.assign({style:{padding:"28px 0px"}},{children:l.plans.map(((s,i)=>{var r,c,d;return e.jsx("div",Object.assign({style:{minWidth:null!==(r=l.staticWidth)&&void 0!==r?r:280,maxWidth:null!==(c=l.staticWidth)&&void 0!==c?c:280}},{children:t.createElement(n.NewSubscriptionPlan,Object.assign({},s,{showMonthly:!0,showMonthlyOptions:null!==(d="monthly"==l.selectedTab)&&void 0!==d&&d,showTrialOptions:l.showTrialOptions||!1,onPlanSelect:e=>{l.onPlanSelect(e),a(e)},key:s.planName,isPlanSelected:o==("monthly"==l.selectedTab?s.code:s.yearlyCode),onClickShowAllFeatures:l.onClickShowAllFeatures,showSelectedPlanChip:l.currentPlan==("monthly"==l.selectedTab?s.code:s.yearlyCode)}))}),i)}))}))};
|
|
@@ -20,12 +20,10 @@ export interface TemplateContextMapperProps {
|
|
|
20
20
|
zIndex?: number;
|
|
21
21
|
showVariableModal?: boolean;
|
|
22
22
|
variableList?: VariableListInterfaceV2[];
|
|
23
|
-
variableListForImage?: VariableListInterfaceV2[];
|
|
24
23
|
onBackPress?: () => void;
|
|
25
24
|
discountCode?: string;
|
|
26
25
|
setDiscountCode?: (code: string) => void;
|
|
27
26
|
enabledCustomText?: boolean;
|
|
28
|
-
showSampleValues?: boolean;
|
|
29
27
|
disableEditVariable?: boolean;
|
|
30
28
|
}
|
|
31
|
-
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, disableEditVariable,
|
|
29
|
+
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, disableEditVariable, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("../../utils/StringUtils.js"),a=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("./context/templateModalContext.js"),o=require("./modalElements/Footer.js"),r=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("../../utils/StringUtils.js"),a=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("./context/templateModalContext.js"),o=require("./modalElements/Footer.js"),r=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:c,closeDialog:u,showVariableMapping:p,channel:m,htmlContent:b,templateVariables:h,onTemplateSelect:C,globalPlaceholders:g,showOnlyContent:S,whatsappSpecificPickerMeta:T,zIndex:v,showVariableModal:E,variableList:j,discountCode:x,setDiscountCode:M,onBackPress:P,enabledCustomText:L,disableEditVariable:f}=d;var w,q;t.useEffect((()=>{V(b)}),[b]);const[y,A]=t.useState(m===s.CHANNEL_TYPE.EMAIL?"desktop":"mobile"),[N,V]=t.useState(b),[k,D]=t.useState(!1),[_,H]=t.useState(c),[I,O]=t.useState(null!=h?h:[]),[B,Y]=t.useState(!1);const z=t.useMemo((()=>n.convertPlaceholdersToBikDropdown(g)),[g]);return e.jsx(i.TemplateModalContext.Provider,Object.assign({value:{template:_,setTemplate:H,device:y,setDevice:A,display_content:N,setDisplayContent:V,originalVariableList:I,setOriginalVariableList:O,isError:k,setIsError:D,channel:m,globalNormalizedPlaceholders:z,templateSelectionTriggered:B,setTemplateSelectionTriggered:Y,enabledCustomText:L,disableEditVariable:f}},{children:S?e.jsx(r.default,{channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(a.StyledModal,Object.assign({zIndex:v,centralContainerStyles:{width:m===s.CHANNEL_TYPE.EMAIL&&p?1e3:650},open:!0,onClose:()=>{null==u||u()},headingTitle:null==_?void 0:_.label,headingSubtitle:m===s.CHANNEL_TYPE.WHATSAPP?`${l.default.capitaliseFirstLetterOfString(null!==(w=null==_?void 0:_.category)&&void 0!==w?w:"")} • ${null!==(q=null==_?void 0:_.templateCategory)&&void 0!==q?q:""}`:"",onBackPress:()=>{null==P||P()}},{children:[e.jsx(r.default,{showVariableMapping:p,channel:m,whatsappSpecificPickerMeta:T,showVariableModal:E,variableList:j,discountCode:x,setDiscountCode:M}),C?e.jsx(o.default,{onSelect:function(){const e=null==C?void 0:C(_,I,null!=N?N:"");e?D(!!e):Y(!0)}}):e.jsx(e.Fragment,{})]}))}))};
|
|
@@ -6,10 +6,8 @@ export interface BodyProps {
|
|
|
6
6
|
whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
|
|
7
7
|
showVariableModal?: boolean;
|
|
8
8
|
variableList?: VariableListInterfaceV2[];
|
|
9
|
-
variableListForImage?: VariableListInterfaceV2[];
|
|
10
9
|
discountCode?: string;
|
|
11
10
|
setDiscountCode?: (code: string) => void;
|
|
12
|
-
showSampleValues?: boolean;
|
|
13
11
|
}
|
|
14
12
|
declare const Body: (props: BodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
13
|
export default Body;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("styled-components"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("styled-components"),n=require("../../template-preview/models/Channels.js"),o=require("../../../constants/Theme.js"),i=require("../context/templateModalContext.js"),a=require("../utils/getVariableNameEmail.js"),r=require("../utils/highlightFor.js"),s=require("./DesktopPreview.js"),d=require("./EditWhatsAppTemplateV2.js"),u=require("./MobilePreview.js"),c=require("./VariableConnectorsPanel.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=p(l);const m=h.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
// height: 100%;
|
|
4
4
|
`,f=h.default.div`
|
|
5
5
|
padding: 16px 14px;
|
|
6
6
|
max-width: 350px;
|
|
7
7
|
|
|
8
|
-
height: ${e=>e.channel===
|
|
8
|
+
height: ${e=>e.channel===n.CHANNEL_TYPE.WHATSAPP?"500px":"475px"};
|
|
9
9
|
overflow-y: 'auto';
|
|
10
10
|
padding-bottom: 24px;
|
|
11
|
-
border-left: ${
|
|
12
|
-
`,
|
|
11
|
+
border-left: ${o.COLORS.stroke.primary} 1px solid;
|
|
12
|
+
`,x=h.default.div`
|
|
13
13
|
padding: ${e=>e.showOnlyContent?"16px 14px":"16px 32px"};
|
|
14
14
|
flex: 1;
|
|
15
15
|
height: 475px;
|
|
16
16
|
overflow-y: auto;
|
|
17
|
-
`;exports.default=l=>{const{showVariableMapping:
|
|
17
|
+
`;exports.default=l=>{const{showVariableMapping:p,showOnlyContent:h,whatsappSpecificPickerMeta:g,showVariableModal:v,variableList:b,discountCode:j,setDiscountCode:w}=l,C=t.useRef(),E=t.useRef(),{device:y,display_content:P,channel:T,template:L,setTemplate:M}=i.useTemplateModalContext();const _=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e.jsxs(m,{children:[e.jsx(x,Object.assign({showOnlyContent:h,showVariableMapping:p},{children:"mobile"===y?e.jsx(u.default,{ref:E,display_content:null!=P?P:"",channel:T,template:L}):T!==n.CHANNEL_TYPE.MESSAGE?e.jsx(s.default,{ref:C,channel:T,display_content:null!=P?P:""}):e.jsx(e.Fragment,{})})),p&&e.jsx(f,Object.assign({channel:T},{children:T!==n.CHANNEL_TYPE.WHATSAPP?e.jsx(c.default,{onFocus:T===n.CHANNEL_TYPE.EMAIL?function(e){var t,l,i;const s=null===document||void 0===document?void 0:document.getElementById("mobile"===y?"template_html_mobile":"template_html_desktop"),d=a.getVariableNameForEmailByIndex(e+1),u=T===n.CHANNEL_TYPE.EMAIL?null===(t=null==s?void 0:s.contentWindow)||void 0===t?void 0:t.document.getElementById(d):document.getElementById(d),c=_(u),p=null==u?void 0:u.offsetLeft;"desktop"===y?c&&C.current&&(null===(l=null==s?void 0:s.contentWindow)||void 0===l||l.scrollTo(null!=p?p:0,c),r.highlightFor(d,o.COLORS.background.warning.light,2,T,y)):c&&E.current&&(null===(i=null==s?void 0:s.contentWindow)||void 0===i||i.scrollTo(null!=p?p:0,c),r.highlightFor(d,o.COLORS.background.warning.light,2,T,y))}:void 0,showVariableModal:v,variableList:b,discountCode:j,setDiscountCode:w}):e.jsx(d.default,{whatsappSpecificPickerMeta:g,template:L,onTemplateChange:e=>{null==M||M(e)},showVariableModal:v,variableList:b})}))]})};
|
|
@@ -3,6 +3,5 @@ import { CHANNEL_TYPE } from "../../template-preview/models/Channels";
|
|
|
3
3
|
declare const DesktopPreview: React.ForwardRefExoticComponent<{
|
|
4
4
|
display_content: string;
|
|
5
5
|
channel: CHANNEL_TYPE;
|
|
6
|
-
showSampleValues?: boolean | undefined;
|
|
7
6
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
7
|
export default DesktopPreview;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("styled-components"),i=require("../../spinner/Spinner.js"),a=require("../../template-preview/TemplatePreview.js");require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var s=require("../../../constants/Theme.js");require("../../template-preview/models/TemplateMeta.js");var p=require("../../template-preview/models/Channels.js");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("styled-components"),i=require("../../spinner/Spinner.js"),a=require("../../template-preview/TemplatePreview.js");require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var s=require("../../../constants/Theme.js");require("../../template-preview/models/TemplateMeta.js");var p=require("../../template-preview/models/Channels.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=d(r),o=d(t);const n=o.default.div`
|
|
2
2
|
background: ${s.COLORS.surface.standard};
|
|
3
3
|
border: 1px solid ${s.COLORS.stroke.primary};
|
|
4
4
|
border-radius: 8px;
|
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
height: 6px;
|
|
18
18
|
background: #d9d9d9;
|
|
19
19
|
border-radius: 3px;
|
|
20
|
-
`,m=
|
|
20
|
+
`,m=l.default.forwardRef(((r,t)=>{let{display_content:s}=r;return e.jsxs(n,Object.assign({ref:t},{children:[e.jsxs(u,{children:[e.jsx(h,{}),e.jsx(h,{}),e.jsx(h,{})]}),e.jsx("div",{children:s?e.jsx(a.TemplatePreview,{channel:p.CHANNEL_TYPE.EMAIL,hideHeader:!0,emailSpecificMeta:{emailDisplayContent:s,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_desktop",containerStyle:{width:584,height:441},templateContainerStyles:{height:"100%"}}}):e.jsx("div",Object.assign({style:{padding:20}},{children:e.jsx(i.Spinner,{size:"small"})}))})]}))}));m.displayName="DesktopPreview",exports.default=m;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { HEADER_TYPES } from "../../template-preview/models/TemplateMeta";
|
|
3
2
|
export interface EditMediaV2Props {
|
|
4
3
|
imageName: string[];
|
|
5
|
-
selectedVariable?: string;
|
|
6
4
|
errorSecondaryText?: string;
|
|
7
5
|
error?: string;
|
|
8
6
|
isLoading?: boolean;
|
|
9
7
|
mediaType?: HEADER_TYPES;
|
|
10
8
|
handleImageChange?: () => void;
|
|
11
9
|
disableEditVariable?: boolean;
|
|
12
|
-
setOpenEditMedia?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
13
10
|
}
|
|
14
11
|
declare const EditMediaV2: (props: EditMediaV2Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
12
|
export default EditMediaV2;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/document_pdf.svg.js"),i=require("../../../assets/icons/edit.svg.js"),s=require("../../../assets/icons/refresh.svg.js"),r=require("../../../assets/icons/video_camcorder.svg.js"),n=require("styled-components"),o=require("../../spinner/Spinner.js"),l=require("../../template-preview/models/TemplateMeta.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/document_pdf.svg.js"),i=require("../../../assets/icons/edit.svg.js"),s=require("../../../assets/icons/refresh.svg.js"),r=require("../../../assets/icons/video_camcorder.svg.js"),n=require("styled-components"),o=require("../../spinner/Spinner.js"),l=require("../../template-preview/models/TemplateMeta.js"),a=require("../../TypographyStyle.js"),d=require("../../../utils/StringUtils.js"),c=require("../../../constants/Theme.js"),h=require("./EditMediaV2.style.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const j=g(n).default.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 ${c.COLORS.stroke.primary};
|
|
7
7
|
cursor: pointer;
|
|
8
|
-
`;exports.default=n=>{const{imageName:
|
|
8
|
+
`;exports.default=n=>{const{imageName:g,error:u,isLoading:p,mediaType:x,handleImageChange:y,disableEditVariable:O}=n,m=null==g?void 0:g[0].split("/"),f=null==m?void 0:m[m.length-1];return e.jsxs(h.Container,{children:[e.jsx(h.ImageContainer,Object.assign({error:!!u,onClick:u?y:void 0},{children:u?e.jsx(s.default,{color:c.COLORS.content.brand,width:32,height:32}):p?e.jsx(o.Spinner,{size:"small"}):x===l.HEADER_TYPES.IMAGE?e.jsx("img",{alt:"",src:null==g?void 0:g[0],style:{width:"100%",height:"56px",borderRadius:8,objectFit:"cover"}}):x===l.HEADER_TYPES.VIDEO?e.jsx(r.default,{width:18,height:22,color:c.COLORS.content.placeholder}):e.jsx(t.default,{width:18,height:22,color:c.COLORS.content.placeholder})})),e.jsxs(h.RightComponent,{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:g&&u?e.jsx(e.Fragment,{}):p?e.jsx(a.BodyCaption,Object.assign({style:{marginLeft:8}},{children:"Your media is getting loaded..."})):e.jsx(a.BodySecondary,Object.assign({style:{color:c.COLORS.content.primary,marginLeft:8}},{children:d.default.toCapitilize(null==x?void 0:x.toLowerCase())||f}))})),!!u&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",marginLeft:8}},{children:[e.jsxs(a.BodySecondary,Object.assign({style:{color:c.COLORS.content.negative}},{children:["Error loading this ",null==x?void 0:x.toLowerCase(),". Retry"]})),e.jsx(a.Caption,Object.assign({style:{color:c.COLORS.content.secondary}},{children:u}))]})),!O&&!u&&!p&&e.jsx(j,Object.assign({onClick:y,onKeyDown:y,role:"presentation"},{children:e.jsx(i.default,{width:24,height:24,color:c.COLORS.content.placeholder})}))]})]})};
|
package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { VariableListInterfaceV2 } from "../../add-variableV2";
|
|
3
2
|
import { WhatsAppPickerMeta, WhatsAppTemplate } from "../../template-preview/models/WhatsAppTemplate";
|
|
4
3
|
declare const EditMediaTemplateMediaV2: React.FC<{
|
|
5
4
|
mediaComponent: WhatsAppTemplate['components'][0];
|
|
6
5
|
template: WhatsAppTemplate;
|
|
7
6
|
whatsappSpecificPickerMeta: WhatsAppPickerMeta;
|
|
8
7
|
updateTemplateImageUrl(url: string, format: WhatsAppTemplate['components'][0]['format']): void;
|
|
9
|
-
variableListForImage?: VariableListInterfaceV2[];
|
|
10
8
|
}>;
|
|
11
9
|
export default EditMediaTemplateMediaV2;
|
package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),i=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),i=require("react"),r=require("../../helpers/FileUploaderHelper.js"),a=require("../../image-cropper/BikImageCropper.js");require("../../image-compress/ImageCompress.js"),require("../../states/StateComponent.js"),require("../../../constants/zindex.js"),require("../../modals/styledModal.js"),require("../../spinner/Spinner.js");var o=require("../../template-preview/models/TemplateMeta.js"),l=require("../context/templateModalContext.js"),n=require("./EditMediaV2.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=s(i);exports.default=s=>{let{mediaComponent:u,template:c,updateTemplateImageUrl:p,whatsappSpecificPickerMeta:m}=s;var f,v;const{disableEditVariable:E}=l.useTemplateModalContext(),[j,g]=i.useState(void 0),[_,h]=i.useState(),C=d.default.createRef(),[q,S]=i.useState(!1),[x,A]=i.useState("");function M(t){var i;return e.__awaiter(this,void 0,void 0,(function*(){const e=new r.FileUploaderHelper;if(t instanceof Blob){const r=e.validate(t);if(r)A(r),S(!1);else{const e=u.format===o.HEADER_TYPES.IMAGE,r=yield m.uploadMediaFiles({file:t,fileName:j,isImage:e});if(r.success){const[e]=t.type.split("/");p(null!==(i=r.url)&&void 0!==i?i:"","application"===e?o.HEADER_TYPES.DOCUMENT:o.HEADER_TYPES[e.toUpperCase()])}else A("An unknown technical error occured");S(!1)}}else A("An unknown technical error occured"),S(!1)}))}let y;return y=u.format===o.HEADER_TYPES.IMAGE?"image/png, image/jpeg":u.format===o.HEADER_TYPES.VIDEO?"video/mp4":"application/pdf",t.jsxs(t.Fragment,{children:[!!_&&t.jsx(a.BikImageCropper,{aspectRatio:15/8,src:_,onCropComplete:function(t){return e.__awaiter(this,void 0,void 0,(function*(){S(!1),A("");const e=yield fetch(t);M(yield e.blob()).then((()=>{h(void 0)}))}))},onCancel:()=>{S(!1),h("")}}),t.jsx("input",{ref:C,style:{display:"none"},type:"file",onChange:function(e){var t;A(""),S(!0);const i=null===(t=e.target.files)||void 0===t?void 0:t[0];if(u.format===o.HEADER_TYPES.IMAGE){const e=new FileReader;h(""),g(""),e.onload=()=>{h(e.result),g(null==i?void 0:i.name)},i&&e.readAsDataURL(i)}else M(i)},accept:y}),t.jsx(n.default,{imageName:null!==(v=null===(f=null==u?void 0:u.example)||void 0===f?void 0:f.header_handle)&&void 0!==v?v:[],handleImageChange:function(){var e;(null===(e=null==C?void 0:C.current)||void 0===e?void 0:e.click)&&C.current.click()},mediaType:null==u?void 0:u.format,error:x,isLoading:q,disableEditVariable:E})]})};
|
package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export interface EditWhatsAppTemplateV2Props {
|
|
|
8
8
|
onTemplateChange?: (template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType) => void;
|
|
9
9
|
showVariableModal?: boolean;
|
|
10
10
|
variableList?: VariableListInterfaceV2[];
|
|
11
|
-
variableListForImage?: VariableListInterfaceV2[];
|
|
12
11
|
}
|
|
13
|
-
declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, showVariableModal, variableList,
|
|
12
|
+
declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, showVariableModal, variableList, }: EditWhatsAppTemplateV2Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
13
|
export default EditWhatsAppTemplateV2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../context/templateModalContext.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../context/templateModalContext.js"),o=require("../utils/getDataFromTemplateComponent.js"),n=require("./EditMediaV2.style.js"),i=require("./EditWhatsAppTemplateMediaV2.js"),l=require("./VariableConnectorsPanel.js"),a=require("./VariableConnectorWhatsApp.js"),s=require("./VariableEditorHeader.js"),d=require("./WhatsAppTemplateCardButtonV2.js");exports.default=r=>{let{template:p,onTemplateChange:u,whatsappSpecificPickerMeta:c,showVariableModal:m,variableList:b}=r;var v,g,h,f,j,x,T,O,y,C,E,V;const{originalVariableList:w}=t.useTemplateModalContext(),{descriptionComponents:B,urlBtns:I,qrbBtns:L,imageComponent:M,bodyVariables:q,headerVariables:R}=o.getAllDataFromTemplateComponent(p);function A(e,t){var o,n,i,l;const a=Object.assign({},p),s=null==a?void 0:a.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==s&&s>-1){const d=null===(o=null==a?void 0:a.components[s].buttons)||void 0===o?void 0:o.findIndex((e=>"URL"===e.type));if(void 0!==d&&d>-1){const o="custom"===t&&"string"==typeof e,r=[...null!==(l=null===(i=null===(n=a.components)||void 0===n?void 0:n[s])||void 0===i?void 0:i.buttons)&&void 0!==l?l:[]];r[d]=Object.assign(Object.assign({},r[d]),{url:"https://d.bik.ai/{{1}}",example:[o?e:"string"!=typeof e?e.defaultValue:""]});const p=Object.assign(Object.assign({},a.components[s]),{buttons:r}),u=Object.assign(Object.assign({},a.mapping),{buttons:o?["((customBtnPlaceholder))"]:"string"!=typeof e?[e.placeHolder]:void 0});a.mapping=u;const c=[...a.components];c[s]=p,a.components=c}}null==u||u(a)}function U(e,t,o){var n;const i=Object.assign({},p),l=null==i?void 0:i.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==l&&l>-1){const t=null===(n=null==i?void 0:i.components[l].buttons)||void 0===n?void 0:n.filter((e=>"QUICK_REPLY"===e.type));t&&(t[o]=Object.assign(Object.assign({},t[o]),{flowId:e.flowId,flowName:e.flowName}));const a=Object.assign(Object.assign({},i.components[l]),{buttons:t}),s=[...i.components];s[l]=a,i.components=s}null==u||u(i)}return e.jsxs(l.Container,Object.assign({style:{flexDirection:"column",maxHeight:460}},{children:[!!M&&e.jsx(n.EditTemplateMediaContainer,{children:e.jsx(i.default,{whatsappSpecificPickerMeta:c,mediaComponent:M,updateTemplateImageUrl:function(e,t){var o;let n=Object.assign({},p);const i=null===(o=null==n?void 0:n.components)||void 0===o?void 0:o.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==i&&i>-1&&(null==n?void 0:n.components[i])){const o=Object.assign(Object.assign({},n.components[i]),{format:t,example:{header_handle:[e]}}),l=[...n.components];l[i]=o,n=Object.assign(Object.assign({},n),{components:l})}null==u||u(n)},template:p})}),(q.length>0||R.length>0)&&e.jsx(s.default,{containerStyle:{paddingTop:M?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==B?void 0:B.map(((t,o)=>e.jsx(a.default,{originalVariableList:w,type:t.type,descriptionComponent:t.component,variableMapping:"HEADER"===t.type?p.mapping.header:p.mapping.body,showVariableModal:m,variableList:b},o))),(null===(g=null===(v=I[0])||void 0===v?void 0:v.component)||void 0===g?void 0:g.buttons)&&(null===(j=null===(f=null===(h=I[0])||void 0===h?void 0:h.component)||void 0===f?void 0:f.buttons)||void 0===j?void 0:j.length)>0&&e.jsx(s.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(x=null==w?void 0:w.buttons)||void 0===x?void 0:x.map(((t,o)=>{if("URL"===t.type)return e.jsx(d.default,{CTAoptions:null==c?void 0:c.CTAoptions,button:t,originalVariableList:w,updateSelectedURLTemplateBtn:A},`${o}`)})),(null===(O=null===(T=L[0])||void 0===T?void 0:T.component)||void 0===O?void 0:O.buttons)&&(null===(E=null===(C=null===(y=L[0])||void 0===y?void 0:y.component)||void 0===C?void 0:C.buttons)||void 0===E?void 0:E.length)>0&&e.jsx(s.default,{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"}),null===(V=null==w?void 0:w.buttons)||void 0===V?void 0:V.map(((t,o)=>{if("QUICK_REPLY"===t.type)return e.jsx(d.default,{QRBoptions:null==c?void 0:c.QRBoptions,button:t,originalVariableList:w,updateSelectedQRBTemplateBtn:U},`${o}`)}))]}))};
|
|
@@ -7,6 +7,5 @@ declare const MobilePreview: React.ForwardRefExoticComponent<{
|
|
|
7
7
|
display_content: string;
|
|
8
8
|
channel: CHANNEL_TYPE;
|
|
9
9
|
template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | null;
|
|
10
|
-
showSampleValues?: boolean | undefined;
|
|
11
10
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
12
11
|
export default MobilePreview;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("styled-components"),a=require("../../template-preview/TemplatePreview.js");require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../../constants/Theme.js"),require("../../template-preview/models/TemplateMeta.js");var r=require("../../template-preview/models/Channels.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(t),l=o(i);const p=l.default.div`
|
|
2
2
|
position: relative;
|
|
3
3
|
height: 100%;
|
|
4
4
|
border-radius: 31px;
|
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
height: calc(100% - 17px);
|
|
18
18
|
border-radius: 16px;
|
|
19
19
|
overflow-y: auto;
|
|
20
|
-
`,d=
|
|
20
|
+
`,d=s.default.forwardRef(((t,i)=>{let{display_content:o,channel:s,template:l}=t;return e.jsx("div",{children:e.jsxs(p,Object.assign({channel:s},{children:[e.jsx("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===r.CHANNEL_TYPE.WHATSAPP?236:300,height:443}}),e.jsx(n,Object.assign({ref:i},{children:e.jsx(a.TemplatePreview,{template:l,channel:s,smsSpecificMeta:{smsDisplayContent:o},whatsAppSpecificMeta:{showWhatsAppHeader:!0,whatsAppExtras:!0,containerStyle:{border:"none",borderBottomRightRadius:0,borderBottomLeftRadius:0,minHeight:426}},size:"small",hideHeader:!0,emailSpecificMeta:{emailDisplayContent:o,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_mobile",containerStyle:{height:"100%",width:"100%"},templateContainerStyles:{height:"100%"}}})}))]}))})}));d.displayName="MobilePreview",exports.default=d;
|
package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts
CHANGED
|
@@ -9,10 +9,8 @@ export interface TemplateSelectModalContentProps {
|
|
|
9
9
|
whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
|
|
10
10
|
showVariableModal?: boolean;
|
|
11
11
|
variableList?: VariableListInterfaceV2[];
|
|
12
|
-
variableListForImage?: VariableListInterfaceV2[];
|
|
13
12
|
discountCode?: string;
|
|
14
13
|
setDiscountCode?: (code: string) => void;
|
|
15
|
-
showSampleValues?: boolean;
|
|
16
14
|
}
|
|
17
|
-
declare const TemplateSelectModalContent: ({ channel, showVariableMapping, showOnlyContent, whatsappSpecificPickerMeta, showVariableModal, variableList, discountCode, setDiscountCode,
|
|
15
|
+
declare const TemplateSelectModalContent: ({ channel, showVariableMapping, showOnlyContent, whatsappSpecificPickerMeta, showVariableModal, variableList, discountCode, setDiscountCode, }: TemplateSelectModalContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
16
|
export default TemplateSelectModalContent;
|
package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../template-preview/models/Channels.js"),s=require("./Body.js"),a=require("./Header.js");exports.default=i=>{let{channel:r,showVariableMapping:o,showOnlyContent:n,whatsappSpecificPickerMeta:l,showVariableModal:d,variableList:c,discountCode:p,setDiscountCode:u}=i;return e.jsx("div",Object.assign({style:{paddingBottom:0}},{children:e.jsxs("div",{children:[r===t.CHANNEL_TYPE.EMAIL&&e.jsx(a.default,{showOnlyContent:n}),e.jsx(s.default,{whatsappSpecificPickerMeta:l,showVariableMapping:!!o,showOnlyContent:n,showVariableModal:d,variableList:c,discountCode:p,setDiscountCode:u})]})}))};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { VariableListInterfaceV2 } from "../../add-variableV2/AddVariableV2";
|
|
3
2
|
import { CHANNEL_TYPE } from "../../template-preview/models/Channels";
|
|
4
3
|
import { CUSTOM_VARIABLE } from "../../template-preview/models/TemplateMeta";
|
|
@@ -14,7 +13,6 @@ export interface VariableConnectorProps {
|
|
|
14
13
|
showVariableModal?: boolean;
|
|
15
14
|
variableList?: VariableListInterfaceV2[];
|
|
16
15
|
setShowDiscountCheckBox?: any;
|
|
17
|
-
componentType?: 'HEADER' | 'BODY' | 'BUTTONS' | 'FOOTER';
|
|
18
16
|
}
|
|
19
|
-
declare const VariableConnector:
|
|
17
|
+
declare const VariableConnector: ({ onFocus, variable, index, showVariableModal, variableList, setShowDiscountCheckBox, }: VariableConnectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
18
|
export default VariableConnector;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/edit.svg.js"),l=require("react"),a=require("styled-components"),n=require("../../add-variableV2/AddVariableV2SideModal.js"),i=require("../../dropdown/Dropdown.js"),o=require("../../input/Input.js"),u=require("../../product-picker-v2/collectionScreen.js"),s=require("../../template-preview/constants/regexPatterns.js"),d=require("../../template-preview/models/Channels.js"),r=require("../../TypographyStyle.js"),c=require("../../../utils/StringUtils.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/edit.svg.js"),l=require("react"),a=require("styled-components"),n=require("../../add-variableV2/AddVariableV2SideModal.js"),i=require("../../dropdown/Dropdown.js"),o=require("../../input/Input.js"),u=require("../../product-picker-v2/collectionScreen.js"),s=require("../../template-preview/constants/regexPatterns.js"),d=require("../../template-preview/models/Channels.js"),r=require("../../TypographyStyle.js"),c=require("../../../utils/StringUtils.js"),v=require("../../../constants/Theme.js"),p=require("../context/templateModalContext.js"),m=require("../utils/getVariableNameEmail.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const g=b(a).default.div`
|
|
2
2
|
/* surface/$color-background-warning-light */
|
|
3
3
|
|
|
4
|
-
background: ${e=>e.focused&&e.channel===d.CHANNEL_TYPE.EMAIL?
|
|
4
|
+
background: ${e=>e.focused&&e.channel===d.CHANNEL_TYPE.EMAIL?v.COLORS.background.warning.light:"transparent"};
|
|
5
5
|
border-radius: 4px;
|
|
6
6
|
padding: 8px 10px;
|
|
7
|
-
`,
|
|
7
|
+
`,h={value:"custom_link",label:"Custom URL"},x={value:"custom_text",label:"Custom text"};exports.Container=g,exports.default=a=>{let{onFocus:b,variable:E,index:_,showVariableModal:j,variableList:A,setShowDiscountCheckBox:y}=a;var f,T;const[P,N]=l.useState(!1),[C,L]=l.useState(""),[k,O]=l.useState([]),[S,V]=l.useState(),[H,w]=l.useState(!1),[M,q]=l.useState(!1),{device:Y,channel:W,isError:I,originalVariableList:B,template:$,templateSelectionTriggered:R,setTemplate:z,setDisplayContent:D,setOriginalVariableList:U,globalNormalizedPlaceholders:Z,enabledCustomText:F}=p.useTemplateModalContext();function G(e,t){var l,a,n;const i=e;L(""),V(i),W===d.CHANNEL_TYPE.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value?(J(null!==(l=i.value)&&void 0!==l?l:"","string"),null==K||K(null!==(a=E.index)&&void 0!==a?a:0,`[[${i.value}]]`)):(null==K||K(null!==(n=E.index)&&void 0!==n?n:0,E.variableName),J("","url"===i.bikPlaceholderType?"link":"string")):"custom_text"!==i.value&&"custom_link"!==i.value?J(i.value,"url"===i.bikPlaceholderType?"link":"string"):(L(""),J("",i.value))}function J(e,t){var l,a;const n="custom_link"===t?"link":"custom_text"===t?"string":t;if(W!==d.CHANNEL_TYPE.WHATSAPP){const a=m.getVariableNameForEmailByIndex(_+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===Y?"template_html_mobile":"template_html_desktop"),o=W===d.CHANNEL_TYPE.EMAIL?null===(l=null==i?void 0:i.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);o&&(o.textContent="custom_text"!==t&&"custom_link"!==t||e?e:E.variableName);const u=B.map(((t,l)=>l===_?Object.assign(Object.assign({},t),{type:n,updatedValue:e}):t));null==U||U(u)}if(W===d.CHANNEL_TYPE.WHATSAPP){const t=null===(a=B.body)||void 0===a?void 0:a.map(((t,l)=>l===_?Object.assign(Object.assign({},t),{type:n,updatedValue:e}):t));null==U||U((e=>Object.assign(Object.assign({},e),{body:t,buttons:B.buttons})))}}function K(e,t){var l;const a=Object.assign({},$),n=null===(l=null==a?void 0:a.components)||void 0===l?void 0:l.map((l=>{var a,n,i,o,u;const s=Object.assign({},l);if("BODY"===l.type&&(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0])){const l=[...null!==(u=null===(o=null===(i=s.example)||void 0===i?void 0:i.body_text)||void 0===o?void 0:o[0])&&void 0!==u?u:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},s.example),{body_text:[l]});return Object.assign(Object.assign({},s),{example:a})}return l}));a.components=n,null==z||z(a)}return l.useEffect((()=>{P&&(null==b||b())}),[P]),l.useEffect((()=>{!function(){var e,t,l,a,n;const i="mobile"===Y?"template_html_mobile":"template_html_desktop",o=document.getElementById(i),u=(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===(n=null==o?void 0:o.contentWindow)||void 0===n?void 0:n.document.head.innerHTML);W===d.CHANNEL_TYPE.EMAIL&&(null==D||D(u))}()}),[R]),l.useEffect((()=>{var e;const t=[];let l=[];if(W!==d.CHANNEL_TYPE.MESSAGE||F){"link"===(null==E?void 0:E.type)?(t.push({label:"",options:[h,x]}),V(h)):(t.push({label:"",options:[h,x]}),V(x));const e=null!=Z?Z:[];O([...t,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:c.default.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!=Z?Z:[];O([{label:"",options:[x,h]},...e]),l=[{label:"",options:[x,h]},...e]}if((W===d.CHANNEL_TYPE.WHATSAPP||W===d.CHANNEL_TYPE.EMAIL||W===d.CHANNEL_TYPE.MESSAGE)&&E.updatedValue)if(s.placeHolderNamePattern.test(E.updatedValue)&&W===d.CHANNEL_TYPE.WHATSAPP||E.updatedValue.startsWith("{{")&&W!==d.CHANNEL_TYPE.WHATSAPP){const e=function(e,t,l){var a;let n={label:"",value:""};const i=l===d.CHANNEL_TYPE.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");j?n={label:e.updatedValue?e.updatedValue.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}:t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===i.trim()&&(n=e)}))}));return n}(E,l,W);e.value&&V(e)}else(null===(e=E.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(V(h),L(E.updatedValue.split("https://")[1])):(V(x),L(E.updatedValue))}),[]),l.useEffect((()=>{Y&&S&&C&&setTimeout((()=>{J("custom_link"===(null==S?void 0:S.value)?C.includes("https")?C:`https://${C}`:C,S.value)}),100)}),[Y]),l.useEffect((()=>{!M&&S&&E.updatedValue&&setTimeout((()=>{J("custom_link"===(null==S?void 0:S.value)?C.includes("https")?E.updatedValue:`https://${E.updatedValue}`:E.updatedValue,S.value),q(!0)}),100)}),[S]),e.jsxs(g,Object.assign({channel:W,focused:P,onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1)},{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:I&&!S?v.COLORS.content.negative:v.COLORS.content.primary}},{children:[null===(f=E.variableName)||void 0===f?void 0:f.replace("{{","").replace("}}","")," ","link"===(null==E?void 0:E.type)?"link":"variable"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:j?e.jsxs("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==S?void 0:S.label)?"space-between":"flex-end"}},{children:[e.jsx(r.BodyPrimary,{children:u.truncate(null!==(T=null==S?void 0:S.label)&&void 0!==T?T:"",20,!0)}),e.jsx(t.default,{onClick:()=>{w(!H)},width:24,height:24,color:v.COLORS.content.primary})]})):e.jsx(i.Dropdown,{options:k,isSearchable:!1,onSelect:G,defaultOptions:S?[Object.assign(Object.assign({},S),{selected:!0})]:[]})})),("custom_text"===(null==S?void 0:S.value)||"custom_link"===(null==S?void 0:S.value))&&e.jsx(o.Input,{labelText:"custom_text"===(null==S?void 0:S.value)?"Custom text value":"custom_link"===(null==S?void 0:S.value)?"Custom URL value":"",id:`variable-value-${null==S?void 0:S.value}-${_}`,value:C,errorMessage:I?C&&0!==C.trim().length?"custom_link"!==S.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${C.trim()}`)&&0!==C.trim().length?"custom_link"!==S.value&&C.length>30?"Length cannot be more than 30":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==S?void 0:S.value)?void 0:30,prefixText:"custom_link"===(null==S?void 0:S.value)?"https://":"",placeholder:"link"===E.type||"custom_link"===S.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{!function(e,t){var l;L(t);const a="custom_link"===(null==S?void 0:S.value)?t.includes("https")?t:`https://${t}`:t;J(a,e),W===d.CHANNEL_TYPE.WHATSAPP&&(null==K||K(null!==(l=E.index)&&void 0!==l?l:0,a))}(S.value,e)}}),H&&e.jsx(n.AddVariableV2SideModal,{zIndex:2e3,data:null!=A?A:[],showVariable:H,setShowVariable:w,placeholder:"Add a variable",customTrigger:e=>{y(!1),"{{custom.url}}"===e.actualValue?G({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?G({label:e.displayName,selected:!0,value:"custom_text"}):G({label:e.actualValue.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};
|