@bikdotai/bik-component-library 0.0.406 → 0.0.407-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/cjs/assets/icons/copy-code-icon.svg.js +1 -0
  2. package/dist/cjs/assets/icons/lto_icon.svg.js +1 -0
  3. package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
  4. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  5. package/dist/cjs/components/button/Button.js +1 -1
  6. package/dist/cjs/components/button/Button.styled.d.ts +1 -0
  7. package/dist/cjs/components/button/Button.styled.js +1 -1
  8. package/dist/cjs/components/button/model.d.ts +1 -0
  9. package/dist/cjs/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
  10. package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
  11. package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +1 -0
  12. package/dist/cjs/components/input-with-vars/InputWithVariables.js +1 -1
  13. package/dist/cjs/components/shimmer-image/ShimmerImage.d.ts +1 -1
  14. package/dist/cjs/components/tag/Tag.styled.js +1 -1
  15. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  16. package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.d.ts +8 -0
  17. package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -0
  18. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +1 -1
  19. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  20. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
  21. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
  22. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  23. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +3 -3
  24. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +3 -2
  25. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  26. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  27. package/dist/cjs/components/template-context-mapper/modalElements/VariableEditorHeader.js +1 -1
  28. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts +4 -1
  29. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  30. package/dist/cjs/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  31. package/dist/cjs/components/template-context-mapper/utils/getPreviewDimension.d.ts +2 -0
  32. package/dist/cjs/components/template-context-mapper/utils/getPreviewDimension.js +1 -0
  33. package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
  34. package/dist/cjs/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.d.ts +5 -0
  35. package/dist/cjs/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.js +18 -0
  36. package/dist/cjs/components/template-preview/WhatsApp/MediaCard.js +1 -1
  37. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  38. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -0
  39. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  40. package/dist/cjs/components/template-preview/models/TemplateMeta.d.ts +1 -1
  41. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +25 -3
  42. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.js +1 -1
  43. package/dist/esm/assets/icons/copy-code-icon.svg.js +1 -0
  44. package/dist/esm/assets/icons/lto_icon.svg.js +1 -0
  45. package/dist/esm/components/TablePagination/TablePagination.js +1 -1
  46. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  47. package/dist/esm/components/button/Button.js +1 -1
  48. package/dist/esm/components/button/Button.styled.d.ts +1 -0
  49. package/dist/esm/components/button/Button.styled.js +1 -1
  50. package/dist/esm/components/button/model.d.ts +1 -0
  51. package/dist/esm/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
  52. package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
  53. package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +1 -0
  54. package/dist/esm/components/input-with-vars/InputWithVariables.js +2 -2
  55. package/dist/esm/components/shimmer-image/ShimmerImage.d.ts +1 -1
  56. package/dist/esm/components/tag/Tag.styled.js +1 -1
  57. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  58. package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.d.ts +8 -0
  59. package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -0
  60. package/dist/esm/components/template-context-mapper/modalElements/Body.js +1 -1
  61. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  62. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
  63. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
  64. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  65. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +4 -4
  66. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +3 -2
  67. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  68. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  69. package/dist/esm/components/template-context-mapper/modalElements/VariableEditorHeader.js +1 -1
  70. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts +4 -1
  71. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  72. package/dist/esm/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  73. package/dist/esm/components/template-context-mapper/utils/getPreviewDimension.d.ts +2 -0
  74. package/dist/esm/components/template-context-mapper/utils/getPreviewDimension.js +1 -0
  75. package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
  76. package/dist/esm/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.d.ts +5 -0
  77. package/dist/esm/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.js +18 -0
  78. package/dist/esm/components/template-preview/WhatsApp/MediaCard.js +1 -1
  79. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  80. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -0
  81. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  82. package/dist/esm/components/template-preview/models/TemplateMeta.d.ts +1 -1
  83. package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +25 -3
  84. package/dist/esm/components/template-preview/models/WhatsAppTemplate.js +1 -1
  85. package/package.json +1 -1
  86. package/dist/cjs/assets/icons/video_camcorder.svg.js +0 -1
  87. package/dist/esm/assets/icons/video_camcorder.svg.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../input/Input.js"),i=require("../../TypographyStyle.js"),r=require("../../../constants/Theme.js"),t=require("../context/templateModalContext.js"),l=require("./VariableConnector.js");exports.default=s=>{let{descriptionComponent:n,type:d,showVariableModal:o,variableList:p}=s;var c,b;const{originalVariableList:x,disableEditVariable:u}=t.useTemplateModalContext();return"BODY"===n.type?e.jsx("div",{children:null===(c=null==x?void 0:x.body)||void 0===c?void 0:c.map(((t,s)=>u||!t.isEditableVariable?e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(i.BodySecondary,Object.assign({style:{color:r.COLORS.content.primary}},{children:["HEADER"===d?"Header":""," Locked variable ",s+1]})),e.jsx(a.Input,{state:"disabled",placeholder:t.variableName,onChangeText:()=>{}})]}),s):e.jsx(l.default,{index:s,variable:t,showVariableModal:o,variableList:p,componentType:n.type},`${s}-${t.index}`)))}):"HEADER"===n.type?e.jsx("div",{children:null===(b=null==x?void 0:x.header)||void 0===b?void 0:b.map(((t,s)=>t.isEditableVariable?e.jsx(l.default,{index:s,variable:t,showVariableModal:o,variableList:p,componentType:n.type},`${s}-${t.index}`):e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(i.BodySecondary,Object.assign({style:{color:r.COLORS.content.primary}},{children:["HEADER"===d?"Header":""," Locked variable ",s+1]})),e.jsx(a.Input,{state:"disabled",placeholder:t.variableName,onChangeText:()=>{}})]}),s)))}):e.jsx(e.Fragment,{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../input/Input.js"),i=require("../../TypographyStyle.js"),t=require("../../../constants/Theme.js"),l=require("../context/templateModalContext.js"),r=require("../custom-hooks/useAdditionalVariables.js"),d=require("./VariableConnector.js");exports.default=s=>{let{descriptionComponent:o,type:n,showVariableModal:p,variableList:b}=s;var c,u,v,x,y,m;const{originalVariableList:j,disableEditVariable:h}=l.useTemplateModalContext(),V=r.useAdditionalVariables({variableList:b,categoryDisplayName:"Static Variables",variableDisplayName:"Static Expiry",variableValue:"{{static.expiry}}"});return"BODY"===o.type?e.jsx("div",{children:null===(c=null==j?void 0:j.body)||void 0===c?void 0:c.map(((l,r)=>h||!l.isEditableVariable?e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(i.BodySecondary,Object.assign({style:{color:t.COLORS.content.primary}},{children:["HEADER"===n?"Header":""," Locked variable ",r+1]})),e.jsx(a.Input,{state:"disabled",placeholder:l.variableName,onChangeText:()=>{}})]}),r):e.jsx(d.default,{index:r,variable:l,showVariableModal:p,variableList:b,componentType:o.type},`${r}-${l.index}`)))}):"HEADER"===o.type?e.jsx("div",{children:null===(u=null==j?void 0:j.header)||void 0===u?void 0:u.map(((l,r)=>l.isEditableVariable?e.jsx(d.default,{index:r,variable:l,showVariableModal:p,variableList:b,componentType:o.type},`${r}-${l.index}`):e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(i.BodySecondary,Object.assign({style:{color:t.COLORS.content.primary}},{children:["HEADER"===n?"Header":""," Locked variable ",r+1]})),e.jsx(a.Input,{state:"disabled",placeholder:l.variableName,onChangeText:()=>{}})]}),r)))}):"limited_time_offer"===o.type?e.jsx("div",{children:e.jsx(d.default,{index:0,variable:{variableName:null!==(x=null===(v=null==o?void 0:o.limited_time_offer)||void 0===v?void 0:v.text)&&void 0!==x?x:"Expires after",updatedValue:null!==(m=null===(y=o.example)||void 0===y?void 0:y.limited_time_offer)&&void 0!==m?m:"",type:"date_time",isEditableVariable:!0,index:0},showVariableModal:p,variableList:V,componentType:o.type},`${o.type}`)}):e.jsx(e.Fragment,{})};
@@ -6,4 +6,4 @@
6
6
  padding-right: 10px;
7
7
  margin-bottom: 8px;
8
8
  line-height: normal;
9
- `;exports.default=i=>{let{headerText:o,subText:l,toolTipInfo:c,containerStyle:p}=i;return e.jsxs(d,Object.assign({style:Object.assign({},p)},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:8}},{children:[e.jsx(r.TitleRegular,Object.assign({style:{color:n.COLORS.content.primary}},{children:o})),c&&e.jsx(s.Tooltip,Object.assign({body:l},{children:e.jsx("div",{children:e.jsx(t.default,{width:20,height:20,color:n.COLORS.content.placeholder})})}))]})),e.jsx(a,Object.assign({style:{color:n.COLORS.content.secondary,marginBottom:0,lineHeight:20,display:"block"}},{children:l}))]}))};
9
+ `;exports.default=i=>{let{headerText:o,subText:l,toolTipInfo:c,containerStyle:p}=i;return e.jsxs(d,Object.assign({style:Object.assign({},p)},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:8}},{children:[e.jsx(r.TitleRegular,Object.assign({style:{color:n.COLORS.content.primary}},{children:o})),c&&e.jsx(s.Tooltip,Object.assign({body:c},{children:e.jsx("div",{children:e.jsx(t.default,{width:20,height:20,color:n.COLORS.content.placeholder})})}))]})),e.jsx(a,Object.assign({style:{color:n.COLORS.content.secondary,marginBottom:0,lineHeight:20,display:"block"}},{children:l}))]}))};
@@ -1,3 +1,4 @@
1
+ import { VariableListInterfaceV2 } from "../../add-variableV2/AddVariableV2";
1
2
  import { ButtonPlaceHolderOptions } from "../../template-preview/models/TemplateMeta";
2
3
  import { CTABtnValType, QRBBtnValType, TEMPLATE_BUTTON } from "../../template-preview/models/WhatsAppTemplate";
3
4
  import { WhatsAppTemplateVariables } from "../../template-preview/models/WhatsAppTemplate";
@@ -10,6 +11,8 @@ export interface WhatsAppTemplateCardButtonV2Props {
10
11
  button: TEMPLATE_BUTTON;
11
12
  CTAoptions?: ButtonPlaceHolderOptions[];
12
13
  QRBoptions?: ButtonPlaceHolderOptions[];
14
+ variableList?: VariableListInterfaceV2[];
15
+ variableListIndex: number;
13
16
  }
14
- declare const WhatsAppTemplateCardButtonV2: ({ button, updateSelectedURLTemplateBtn, updateSelectedQRBTemplateBtn, originalVariableList, CTAoptions, QRBoptions, }: WhatsAppTemplateCardButtonV2Props) => import("react/jsx-runtime").JSX.Element;
17
+ declare const WhatsAppTemplateCardButtonV2: ({ variableListIndex, button, updateSelectedURLTemplateBtn, updateSelectedQRBTemplateBtn, originalVariableList, CTAoptions, QRBoptions, variableList, }: WhatsAppTemplateCardButtonV2Props) => import("react/jsx-runtime").JSX.Element;
15
18
  export default WhatsAppTemplateCardButtonV2;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("../../dropdown/Dropdown.js"),a=require("../../input/Input.js"),s=require("../../template-preview/constants/regexPatterns.js"),n=require("../../template-preview/models/TemplateMeta.js"),i=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js"),d=require("../context/templateModalContext.js"),u=require("../utils/validateIsUrl.js"),c=require("./VariableConnector.js");exports.default=p=>{let{button:b,updateSelectedURLTemplateBtn:j,updateSelectedQRBTemplateBtn:m,originalVariableList:g,CTAoptions:x,QRBoptions:v}=p;const[y,O]=t.useState(""),[f,h]=t.useState(),{setOriginalVariableList:R,isError:U,disableEditVariable:L}=d.useTemplateModalContext();function T(e){O(e);const t=[Object.assign(Object.assign({},g.buttons[0]),{type:i.BUTTON_TYPE.URL,buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]})];null==R||R((e=>Object.assign(Object.assign({},e),{body:[...g.body],buttons:[...t]}))),null==j||j(`https://${e}`,"custom")}return t.useEffect((()=>{var e;if(b.buttonVariable&&s.editableVarPattern.test(b.buttonVariable))h(n.CUSTOM_URL_NAME),O((null===(e=b.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===b.type?x:v;e="URL"===b.type?t.findIndex((e=>e.placeHolder===b.buttonVariable)):t.findIndex((e=>e.label===b.flowName)),e>-1&&h(t[e])}}),[]),e.jsxs(c.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:o.COLORS.content.primary}},{children:[b.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(l.Dropdown,{disabled:L,options:"URL"===b.type?x:v,isSearchable:!1,onSelect:function(e,t){const l=e;h(l);const a=("URL"===b.type?x:v).find((e=>e.placeHolder===l.placeHolder));if(a)if("custom_link"!==a.value){let e;"URL"===b.type?(e=[Object.assign(Object.assign({},g.buttons[0]),{type:"URL",buttonVariable:l.placeHolder,example:["https://bik.ai/"]})],null==j||j({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder")):(e=g.buttons.map(((e,t)=>t===b.index?Object.assign(Object.assign({},e),{type:"QUICK_REPLY",flowName:l.label,flowId:l.value}):e)),null==m||m({flowName:l.label,flowId:l.value},"placeholder",b.index)),null==R||R((t=>Object.assign(Object.assign({},t),{body:[...g.body],buttons:[...e]})))}else T("")},defaultOptions:f?[Object.assign(Object.assign({},f),{selected:!0})]:[]})})),"custom_link"===(null==f?void 0:f.value)&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(a.Input,{state:L?"disabled":"none",errorMessage:U?y?u.validateIsUrl(y)?"":"Enter valid URL":"Required field":"",value:y,prefixText:"custom_link"===(null==f?void 0:f.value)?"https://":"",placeholder:"Enter custom URL here",onChangeText:T})}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("../../dropdown/Dropdown.js"),l=require("../../input/Input.js"),i=require("../../template-preview/constants/regexPatterns.js"),s=require("../../template-preview/models/TemplateMeta.js"),o=require("../../template-preview/models/WhatsAppTemplate.js"),n=require("../../TypographyStyle.js"),r=require("../../../constants/Theme.js"),d=require("../context/templateModalContext.js"),u=require("../custom-hooks/useAdditionalVariables.js"),b=require("../utils/validateIsUrl.js"),p=require("./VariableConnector.js");exports.default=c=>{let{variableListIndex:m,button:j,updateSelectedURLTemplateBtn:v,updateSelectedQRBTemplateBtn:x,originalVariableList:y,CTAoptions:g,QRBoptions:O,variableList:h}=c;var f,L,T,V;const[U,R]=t.useState(""),[q,C]=t.useState(),w=u.useAdditionalVariables({variableList:h,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom URL",variableValue:"{{custom.url}}"}),{setOriginalVariableList:B,isError:N,disableEditVariable:S,pod:I}=d.useTemplateModalContext();function E(e){R(e);const t=[Object.assign(Object.assign({},y.buttons[0]),{type:o.BUTTON_TYPE.URL,buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]})];null==B||B((e=>Object.assign(Object.assign({},e),{body:[...y.body],buttons:[...t]}))),null==v||v(`https://${e}`,"custom")}return t.useEffect((()=>{var e;if(j.buttonVariable&&i.editableVarPattern.test(j.buttonVariable))C(s.CUSTOM_URL_NAME),R((null===(e=j.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===j.type?g:O;e="URL"===j.type?t.findIndex((e=>e.placeHolder===j.buttonVariable)):t.findIndex((e=>e.label===j.flowName)),e>-1&&C(t[e])}}),[]),I!==o.POD.CHATBOT?e.jsxs(p.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(n.BodySecondary,Object.assign({style:{color:r.COLORS.content.primary}},{children:[j.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(a.Dropdown,{disabled:S,options:"URL"===j.type?g:O,isSearchable:!1,onSelect:function(e,t){const a=e;C(a);const l=("URL"===j.type?g:O).find((e=>e.placeHolder===a.placeHolder));if(l)if("custom_link"!==l.value){let e;"URL"===j.type?(e=[Object.assign(Object.assign({},y.buttons[0]),{type:"URL",buttonVariable:a.placeHolder,example:["https://bik.ai/"]})],null==v||v({defaultValue:l.value,placeHolder:l.placeHolder},"placeholder")):(e=y.buttons.map(((e,t)=>t===j.index?Object.assign(Object.assign({},e),{type:"QUICK_REPLY",flowName:a.label,flowId:a.value}):e)),null==x||x({flowName:a.label,flowId:a.value},"placeholder",j.index)),null==B||B((t=>Object.assign(Object.assign({},t),{body:[...y.body],buttons:[...e]})))}else E("")},defaultOptions:q?[Object.assign(Object.assign({},q),{selected:!0})]:[]})})),"custom_link"===(null==q?void 0:q.value)&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(l.Input,{state:S?"disabled":"none",errorMessage:N?U?b.validateIsUrl(U)?"":"Enter valid URL":"Required field":"",value:U,prefixText:"custom_link"===(null==q?void 0:q.value)?"https://":"",placeholder:"Enter custom URL here",onChangeText:E})}))]}):e.jsx(p.default,{index:m,variable:{variableName:null!==(f=j.text)&&void 0!==f?f:"",updatedValue:"((customPlaceholderName))"===j.buttonVariable?`${null===(L=j.example)||void 0===L?void 0:L[0]}`:null!==(T=j.buttonVariable)&&void 0!==T?T:"",type:"link",isEditableVariable:!0,index:null!==(V=j.index)&&void 0!==V?V:0},showVariableModal:!0,componentType:"BUTTONS",variableList:w,CTAoptions:g})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.getAllDataFromTemplateComponent=t=>{var e,o;const n=[],p=[],i=[],l=[],s=[];let a=null;return t.components.forEach(((t,e)=>{var o,l,s,r,u,d;if("BODY"===t.type&&t.text&&n.push({component:t,i:e,type:"BODY"}),"HEADER"===t.type&&"NONE"!==t.format&&"TEXT"!==t.format&&(null===(l=null===(o=t.example)||void 0===o?void 0:o.header_handle)||void 0===l?void 0:l[0])&&(a=t),"HEADER"===t.type&&"TEXT"===t.format&&n.push({component:t,i:e,type:"HEADER"}),"BUTTONS"===t.type){const o=null===(r=null===(s=t.buttons)||void 0===s?void 0:s.filter)||void 0===r?void 0:r.call(s,(t=>"URL"===t.type));p.push({component:Object.assign(Object.assign({},t),{buttons:o}),i:e});const n=null===(d=null===(u=t.buttons)||void 0===u?void 0:u.filter)||void 0===d?void 0:d.call(u,(t=>"QUICK_REPLY"===t.type));i.push({component:Object.assign(Object.assign({},t),{buttons:n}),i:e}),i.push}})),t.mapping&&(null===(e=t.mapping.body)||void 0===e||e.forEach((t=>{l.push(t)}))),t.mapping&&(null===(o=t.mapping.header)||void 0===o||o.forEach((t=>{s.push(t)}))),{imageComponent:a,descriptionComponents:n,urlBtns:p,qrbBtns:i,bodyVariables:l,headerVariables:s}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.getAllDataFromTemplateComponent=e=>{var t,o;const n=[],i=[],p=[],l=[],s=[];let a=null;return e.components.forEach(((e,t)=>{var o,l,s,r,d,u;if("BODY"===e.type&&e.text&&n.push({component:e,i:t,type:"BODY"}),"HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format&&(null===(l=null===(o=e.example)||void 0===o?void 0:o.header_handle)||void 0===l?void 0:l[0])&&(a=e),"HEADER"===e.type&&"TEXT"===e.format&&n.push({component:e,i:t,type:"HEADER"}),"BUTTONS"===e.type){const o=null===(r=null===(s=e.buttons)||void 0===s?void 0:s.filter)||void 0===r?void 0:r.call(s,(e=>"URL"===e.type));i.push({component:Object.assign(Object.assign({},e),{buttons:o}),i:t});const n=null===(u=null===(d=e.buttons)||void 0===d?void 0:d.filter)||void 0===u?void 0:u.call(d,(e=>"QUICK_REPLY"===e.type));p.push({component:Object.assign(Object.assign({},e),{buttons:n}),i:t})}"limited_time_offer"===e.type&&n.push({component:e,i:t,type:"limited_time_offer"})})),e.mapping&&(null===(t=e.mapping.body)||void 0===t||t.forEach((e=>{l.push(e)}))),e.mapping&&(null===(o=e.mapping.header)||void 0===o||o.forEach((e=>{s.push(e)}))),{imageComponent:a,descriptionComponents:n,urlBtns:i,qrbBtns:p,bodyVariables:l,headerVariables:s}};
@@ -0,0 +1,2 @@
1
+ import { CHANNEL_TYPE } from "../../template-preview/models/Channels";
2
+ export declare const getPreviewWidth: (channel: CHANNEL_TYPE) => 240 | 300 | 360;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../template-preview/models/Channels.js");exports.getPreviewWidth=r=>{switch(r){case e.CHANNEL_TYPE.WHATSAPP:return 240;case e.CHANNEL_TYPE.SMS:return 300;case e.CHANNEL_TYPE.EMAIL:return 360;default:return 300}};
@@ -1,19 +1,19 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/halfRectangle.svg.js"),r=require("../../../assets/icons/phone.svg.js"),s=require("../../../assets/icons/RedirectToNew.svg.js"),a=require("styled-components"),i=require("../../tooltips/Tooltip.js"),o=require("../../TypographyStyle.js"),n=require("../../../constants/Theme.js"),l=require("../helpers/VariableEditorHelper.js"),d=require("../models/TemplateMeta.js"),p=require("./ChatBtn.js"),h=require("./ChatUI.style.js"),x=require("./MediaCard.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(a);const j=u.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/copy-code-icon.svg.js"),r=require("../../../assets/icons/halfRectangle.svg.js"),i=require("../../../assets/icons/phone.svg.js"),s=require("../../../assets/icons/RedirectToNew.svg.js"),a=require("styled-components"),o=require("../../tooltips/Tooltip.js"),n=require("../../TypographyStyle.js"),d=require("../../../constants/Theme.js"),l=require("../helpers/VariableEditorHelper.js"),p=require("../models/TemplateMeta.js"),x=require("./ChatBtn.js"),m=require("./ChatUI.style.js"),h=require("./LimitedTimeOffer/LimitedTimeOffer.index.js"),c=require("./MediaCard.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j=u(a);const f=j.default.div`
2
2
  position: absolute;
3
3
  width: 8px;
4
4
  height: 8px;
5
5
  left: -8px;
6
6
  top: -9px;
7
- `,m=u.default.div`
7
+ `,T=j.default.div`
8
8
  font-family: 'Inter';
9
9
  font-style: normal;
10
10
  font-weight: 400;
11
11
  font-size: 14px;
12
12
  line-height: 20px;
13
13
  padding: 8px 12px 0px;
14
- color: ${n.COLORS.content.primary};
14
+ color: ${d.COLORS.content.primary};
15
15
  word-wrap: break-word;
16
- `,T=u.default(m)`
16
+ `,y=j.default(T)`
17
17
  font-weight: 600;
18
18
  margin-bottom: 8px;
19
- `,y=new l.VariableEditorHelper;exports.ChatUIV2=a=>{const{bodyText:n,footerText:l,headerMediaType:c,headerText:u,headerAssetLink:f,headerAssetName:g,quickReplybtn:E,ctaBtn:b,actionTypes:S,extras:v,showHeader:C,imagePreviewStyles:q,size:w,bodyVariableList:_,headerVariableList:A}=a,I=y.format(n,_),N=y.format(u,A);return e.jsxs(h.Container,{children:[e.jsx(j,{children:e.jsx(t.default,{color:"white",height:8,width:8})}),c===d.HEADER_TYPES.TEXT?e.jsx(T,{dangerouslySetInnerHTML:{__html:N}}):c!==d.HEADER_TYPES.NONE?e.jsx(x.MediaCard,{headerAssetLink:f,headerAssetName:g,mediaType:c,imagePreviewStyles:c===d.HEADER_TYPES.IMAGE?q:{}}):e.jsx(e.Fragment,{}),!!n&&e.jsx(e.Fragment,{children:e.jsx(m,{dangerouslySetInnerHTML:{__html:I}})}),e.jsxs(h.FooterWrapper,{children:[e.jsx(i.Tooltip,Object.assign({body:null!=l?l:"",placement:"top"},{children:e.jsx(h.TimeStamp,Object.assign({style:{flex:1}},{children:l}))})),e.jsx(h.TimeStamp,{children:"16:48"})]}),S===d.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==E?void 0:E.map(((t,r)=>e.jsx(p.ChatBtn,{text:t.text},r)))}):S===d.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==b?void 0:b.map(((t,a)=>e.jsx(p.ChatBtn,{textTypography:C?o.Caption:o.BodySecondary,extraContent:v?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?r.default:s.default,size:w},a)))}):e.jsx(e.Fragment,{})]})};
19
+ `,g=new l.VariableEditorHelper;exports.ChatUIV2=a=>{const{bodyText:d,footerText:l,headerMediaType:u,headerText:j,headerAssetLink:C,headerAssetName:E,quickReplybtn:v,ctaBtn:b,actionTypes:q,extras:O,showHeader:S,imagePreviewStyles:_,size:w,bodyVariableList:L,headerVariableList:I,buttons:P,limitedTimeOfferComponent:A}=a,N=g.format(d,L),R=g.format(j,I),H={COPY_CODE:t.default,PHONE_NUMBER:i.default,URL:s.default,QUICK_REPLY:()=>e.jsx(e.Fragment,{})};return console.log("vj: lto",{limitedTimeOfferComponent:A}),e.jsxs(m.Container,{children:[e.jsx(f,{children:e.jsx(r.default,{color:"white",height:8,width:8})}),u===p.HEADER_TYPES.TEXT?e.jsx(y,{dangerouslySetInnerHTML:{__html:R}}):u!==p.HEADER_TYPES.NONE?e.jsx(c.MediaCard,{headerAssetLink:C,headerAssetName:E,mediaType:u,imagePreviewStyles:u===p.HEADER_TYPES.IMAGE?_:{}}):e.jsx(e.Fragment,{}),(null==A?void 0:A.dateTime)?e.jsx(h.LimitedTimeOffer,{text:A.text,dateTime:A.dateTime,code:A.code}):e.jsx(e.Fragment,{}),!!d&&e.jsx(e.Fragment,{children:e.jsx(T,{dangerouslySetInnerHTML:{__html:N}})}),e.jsxs(m.FooterWrapper,{children:[e.jsx(o.Tooltip,Object.assign({body:null!=l?l:"",placement:"top"},{children:e.jsx(m.TimeStamp,Object.assign({style:{flex:1}},{children:l}))})),e.jsx(m.TimeStamp,{children:"16:48"})]}),P&&P.length>0?P.map(((t,r)=>e.jsx(x.ChatBtn,{text:t.text,Icon:H[t.type],size:w},r))):q===p.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==v?void 0:v.map(((t,r)=>e.jsx(x.ChatBtn,{text:t.text},r)))}):q===p.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==b?void 0:b.map(((t,r)=>e.jsx(x.ChatBtn,{textTypography:S?n.Caption:n.BodySecondary,extraContent:O?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?i.default:s.default,size:w},r)))}):e.jsx(e.Fragment,{})]})};
@@ -0,0 +1,5 @@
1
+ import { CreateTemplateType } from '../../models/WhatsAppTemplate';
2
+ export declare const LimitedTimeOffer: (props: CreateTemplateType['limitedTimeOfferComponent']) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const StyledLimitedOfferTime: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const StyledLtoIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ export declare const StyledLtoText: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,18 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../assets/icons/lto_icon.svg.js"),r=require("styled-components"),i=require("../../../TypographyStyle.js"),n=require("../../../../constants/Theme.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(r);const d=o.default.div`
2
+ display: flex;
3
+ flex-direction: row;
4
+ `,c=o.default.div`
5
+ width: 48px;
6
+ height: 48px;
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ border-radius: 24px;
11
+ background: #d8f0e7;
12
+ margin: 5px;
13
+ `,l=o.default.div`
14
+ display: flex;
15
+ flex-direction: column;
16
+ margin-top: 5px;
17
+ margin-right: 3px;
18
+ `;exports.LimitedTimeOffer=r=>{const{text:s,dateTime:o,code:a}=r;return e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t.default,{width:24,height:24,style:{display:"flex"}})}),e.jsxs(l,{children:[e.jsx(i.BodySecondary,Object.assign({numberOfLines:2,color:n.COLORS.content.primary},{children:s})),e.jsxs(i.BodyTiny,Object.assign({color:n.COLORS.content.secondary},{children:["Offer Ends on ",o]})),e.jsxs(i.BodyTiny,Object.assign({color:n.COLORS.content.placeholder},{children:["Code ",a]}))]})]})},exports.StyledLimitedOfferTime=d,exports.StyledLtoIcon=c,exports.StyledLtoText=l;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../assets/icons/filePdf.svg.js"),r=require("../../../assets/icons/image.svg.js"),t=require("../../../assets/icons/videoRecorder.svg.js"),a=require("../../TypographyStyle.js"),i=require("../../../constants/Theme.js"),n=require("../models/TemplateMeta.js"),d=require("./ChatUI.style.js");const o=o=>{let{headerAssetName:c,mediaType:l}=o;const j=l===n.HEADER_TYPES.IMAGE?r.default:l===n.HEADER_TYPES.VIDEO?t.default:s.default;return e.jsxs(d.MediaContainer,{children:[e.jsx(j,{height:40,width:40,color:i.COLORS.icon.placeholder}),!!c&&e.jsx(a.BodySecondary,Object.assign({style:{color:i.COLORS.content.secondary,marginTop:8}},{children:c}))]})};exports.MediaCard=s=>{let{headerAssetLink:r,headerAssetName:t,mediaType:a,imagePreviewStyles:i}=s;if(!r||a===n.HEADER_TYPES.DOCUMENT)return e.jsx(o,Object.assign({},{headerAssetLink:r,headerAssetName:t,mediaType:a}));const c={width:"100%",minHeight:"156px",borderRadius:8};return e.jsx(d.MediaContainer,{children:a===n.HEADER_TYPES.IMAGE?e.jsx("img",{alt:"Header displays here",style:Object.assign(Object.assign({},c),i),src:r}):a===n.HEADER_TYPES.VIDEO?e.jsx("video",Object.assign({src:r,style:c,controls:!0},{children:e.jsx("track",{default:!0,kind:"captions",srcLang:"en",src:r})})):e.jsx(e.Fragment,{})})},exports.NoMediaCard=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../assets/icons/filePdf.svg.js"),r=require("../../../assets/icons/image.svg.js"),i=require("../../../assets/icons/videoRecorder.svg.js"),t=require("../../TypographyStyle.js"),a=require("../../../constants/Theme.js"),d=require("../models/TemplateMeta.js"),n=require("./ChatUI.style.js"),o=require("../../shimmer-image/ShimmerImage.js");const c=o=>{let{headerAssetName:c,mediaType:l}=o;const m=l===d.HEADER_TYPES.IMAGE?r.default:l===d.HEADER_TYPES.VIDEO?i.default:s.default;return e.jsxs(n.MediaContainer,{children:[e.jsx(m,{height:40,width:40,color:a.COLORS.icon.placeholder}),!!c&&e.jsx(t.BodySecondary,Object.assign({style:{color:a.COLORS.content.secondary,marginTop:8}},{children:c}))]})};exports.MediaCard=s=>{let{headerAssetLink:r,headerAssetName:i,mediaType:t,imagePreviewStyles:a}=s;if(!r||t===d.HEADER_TYPES.DOCUMENT)return e.jsx(c,Object.assign({},{headerAssetLink:r,headerAssetName:i,mediaType:t}));return e.jsx(n.MediaContainer,{children:t===d.HEADER_TYPES.IMAGE?e.jsx(o.ShimmerImage,{imageUrl:r,alt:r,width:"100%",height:156,borderRadius:8}):t===d.HEADER_TYPES.VIDEO?e.jsx("video",Object.assign({src:r,style:{width:"100%",minHeight:"156px",borderRadius:8},controls:!0},{children:e.jsx("track",{default:!0,kind:"captions",srcLang:"en",src:r})})):e.jsx(e.Fragment,{})})},exports.NoMediaCard=c;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("./helpers/TemplateCreatorHelper.js"),a=require("./models/TemplateMeta.js"),i=require("./utils/TemplateHelperUtils.js"),r=require("./WhatsApp/WhatsAppLikePreview.js"),n=require("./WhatsApp/WhatsAppLikePreviewV2.js");exports.default=o=>{let{template:d,extras:s,containerStyle:u,usePlaceHolderName:p,showHeader:v,zeroStateComponent:h,size:x,showSampleValues:c}=o;var m,b,T,y,w,k,N,V,B,j,A,L,P,S,q,g,H,f,C,E,F,O;const[R,W]=l.useState(),U=new t.TemplateCreatorHelper,z=new i.TemplateHelperUtils,D=[];return(null===(b=null===(m=null==R?void 0:R.ctaBtn)||void 0===m?void 0:m.phoneNumber)||void 0===b?void 0:b.isChecked)&&D.push({type:"phoneNumber",text:null!==(T=R.ctaBtn.phoneNumber.btnText)&&void 0!==T?T:"",extra:null!==(y=R.ctaBtn.phoneNumber.phoneNumber)&&void 0!==y?y:""}),(null===(k=null===(w=null==R?void 0:R.ctaBtn)||void 0===w?void 0:w.websiteLinkBtn)||void 0===k?void 0:k.isChecked)&&D.push({type:"website",text:null!==(N=R.ctaBtn.websiteLinkBtn.btnText)&&void 0!==N?N:"",extra:null!==(B=null===(V=R.ctaBtn.websiteLinkBtn)||void 0===V?void 0:V.linkOpens)&&void 0!==B?B:"",placeholder:null!==(j=R.ctaBtn.websiteLinkBtn.placeholder)&&void 0!==j?j:""}),l.useEffect((()=>{d&&U.parseUITemplateFromDBFormat({dbFormattedTemplate:d,isDuplicate:!1,showSampleValues:c,isV2:!d.htmlContentUrl}).then((e=>{W(Object.assign({},e))}))}),[d,c]),d?d.htmlContentUrl?e.jsx(r.WhatsappLikePreview,{showHeader:v,containerPadding:"large"===x?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:u,textType:"html",bodyText:z.whatsappOnlyFillVariablesValueInBodyText(null!==(H=null==R?void 0:R.bodyText)&&void 0!==H?H:"",null!==(f=null==R?void 0:R.bodyVariables)&&void 0!==f?f:[],p),footerText:null==R?void 0:R.footerText,headerMediaType:(null==R?void 0:R.headerType)||a.HEADER_TYPES.NONE,headerText:z.fillVariablesValInBodyText(null!==(C=null==R?void 0:R.headerText)&&void 0!==C?C:"",null!==(E=null==R?void 0:R.headerVariables)&&void 0!==E?E:[],p),headerAssetLink:null!==(F=null==R?void 0:R.headerAssetLink)&&void 0!==F?F:"",headerAssetName:null!==(O=null==R?void 0:R.headerAssetName)&&void 0!==O?O:"",quickReplybtn:null==R?void 0:R.quickReply,ctaBtn:D,actionTypes:null==R?void 0:R.actionsType,extras:s,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},zeroStateComponent:null!=h?h:e.jsx(e.Fragment,{children:" "})}):e.jsx(n.WhatsappLikePreviewV2,{showHeader:v,containerPadding:"large"===x?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:u,textType:"html",bodyText:null==R?void 0:R.bodyText,footerText:null==R?void 0:R.footerText,headerMediaType:(null==R?void 0:R.headerType)||a.HEADER_TYPES.NONE,headerText:null==R?void 0:R.headerText,headerAssetLink:null!==(A=null==R?void 0:R.headerAssetLink)&&void 0!==A?A:"",headerAssetName:null!==(L=null==R?void 0:R.headerAssetName)&&void 0!==L?L:"",quickReplybtn:null==R?void 0:R.quickReply,ctaBtn:D,actionTypes:null==R?void 0:R.actionsType,extras:s,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},zeroStateComponent:null!=h?h:e.jsx(e.Fragment,{children:" "}),bodyVariableList:null!==(S=null===(P=null==R?void 0:R.bodyVariables)||void 0===P?void 0:P.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==S?S:[],headerVariableList:null!==(g=null===(q=null==R?void 0:R.headerVariables)||void 0===q?void 0:q.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==g?g:[]}):e.jsx(e.Fragment,{children:h})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("./helpers/TemplateCreatorHelper.js"),i=require("./models/TemplateMeta.js"),a=require("./utils/TemplateHelperUtils.js"),n=require("./WhatsApp/WhatsAppLikePreview.js"),r=require("./WhatsApp/WhatsAppLikePreviewV2.js");exports.default=o=>{let{template:d,extras:s,containerStyle:u,usePlaceHolderName:p,showHeader:v,zeroStateComponent:h,size:x,showSampleValues:m}=o;var c,b,T,y,w,k,N,B,V,j,A,L,P,f,S,q,C,g,H,E,F,O;const[R,W]=l.useState(),U=new t.TemplateCreatorHelper,z=new a.TemplateHelperUtils,D=[];return(null===(b=null===(c=null==R?void 0:R.ctaBtn)||void 0===c?void 0:c.phoneNumber)||void 0===b?void 0:b.isChecked)&&D.push({type:"phoneNumber",text:null!==(T=R.ctaBtn.phoneNumber.btnText)&&void 0!==T?T:"",extra:null!==(y=R.ctaBtn.phoneNumber.phoneNumber)&&void 0!==y?y:""}),(null===(k=null===(w=null==R?void 0:R.ctaBtn)||void 0===w?void 0:w.websiteLinkBtn)||void 0===k?void 0:k.isChecked)&&D.push({type:"website",text:null!==(N=R.ctaBtn.websiteLinkBtn.btnText)&&void 0!==N?N:"",extra:null!==(V=null===(B=R.ctaBtn.websiteLinkBtn)||void 0===B?void 0:B.linkOpens)&&void 0!==V?V:"",placeholder:null!==(j=R.ctaBtn.websiteLinkBtn.placeholder)&&void 0!==j?j:""}),l.useEffect((()=>{d&&U.parseUITemplateFromDBFormat({dbFormattedTemplate:d,isDuplicate:!1,showSampleValues:m,isV2:!d.htmlContentUrl}).then((e=>{W(Object.assign({},e))}))}),[d,m]),d?d.htmlContentUrl?e.jsx(n.WhatsappLikePreview,{showHeader:v,containerPadding:"large"===x?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:u,textType:"html",bodyText:z.whatsappOnlyFillVariablesValueInBodyText(null!==(C=null==R?void 0:R.bodyText)&&void 0!==C?C:"",null!==(g=null==R?void 0:R.bodyVariables)&&void 0!==g?g:[],p),footerText:null==R?void 0:R.footerText,headerMediaType:(null==R?void 0:R.headerType)||i.HEADER_TYPES.NONE,headerText:z.fillVariablesValInBodyText(null!==(H=null==R?void 0:R.headerText)&&void 0!==H?H:"",null!==(E=null==R?void 0:R.headerVariables)&&void 0!==E?E:[],p),headerAssetLink:null!==(F=null==R?void 0:R.headerAssetLink)&&void 0!==F?F:"",headerAssetName:null!==(O=null==R?void 0:R.headerAssetName)&&void 0!==O?O:"",quickReplybtn:null==R?void 0:R.quickReply,ctaBtn:D,actionTypes:null==R?void 0:R.actionsType,extras:s,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},zeroStateComponent:null!=h?h:e.jsx(e.Fragment,{children:" "})}):e.jsx(r.WhatsappLikePreviewV2,{showHeader:v,containerPadding:"large"===x?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:u,textType:"html",bodyText:null==R?void 0:R.bodyText,footerText:null==R?void 0:R.footerText,headerMediaType:(null==R?void 0:R.headerType)||i.HEADER_TYPES.NONE,headerText:null==R?void 0:R.headerText,headerAssetLink:null!==(A=null==R?void 0:R.headerAssetLink)&&void 0!==A?A:"",headerAssetName:null!==(L=null==R?void 0:R.headerAssetName)&&void 0!==L?L:"",quickReplybtn:null==R?void 0:R.quickReply,ctaBtn:D,actionTypes:null==R?void 0:R.actionsType,extras:s,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},zeroStateComponent:null!=h?h:e.jsx(e.Fragment,{children:" "}),bodyVariableList:null!==(f=null===(P=null==R?void 0:R.bodyVariables)||void 0===P?void 0:P.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==f?f:[],headerVariableList:null!==(q=null===(S=null==R?void 0:R.headerVariables)||void 0===S?void 0:S.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==q?q:[],buttons:null==R?void 0:R.allButtons,limitedTimeOfferComponent:null==R?void 0:R.limitedTimeOfferComponent}):e.jsx(e.Fragment,{children:h})};
@@ -12,6 +12,7 @@ export declare class TemplateCreatorHelper {
12
12
  private parseBodyComponent;
13
13
  private parseFooterComponent;
14
14
  private parseButtonComponent;
15
+ private parseLimitedTimeOfferComponent;
15
16
  parseUITemplateFromDBFormat(data: {
16
17
  dbFormattedTemplate: WhatsAppTemplate;
17
18
  isDuplicate?: boolean;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("../../../constants/Theme.js"),n=require("../constants/regexPatterns.js"),i=require("../constants/TemplateConstants.js"),l=require("../models/TemplateMeta.js"),o=require("../utils/TemplateHelperUtils.js");exports.TemplateCreatorHelper=class{parseDataFromHeaderComponent(e,t){var n,i,o,a,d,r,v,s,E,u;const T={headerType:l.HEADER_TYPES.NONE,headerVariables:[]},p=null===(n=e.components)||void 0===n?void 0:n.find((e=>"HEADER"===e.type));if(p){T.headerType=p.format,T.headerText=p.text,T.headerAssetLink=null===(o=null===(i=p.example)||void 0===i?void 0:i.header_handle)||void 0===o?void 0:o[0];const n=null===(d=null===(a=p.example)||void 0===a?void 0:a.header_text)||void 0===d?void 0:d[0],l=null===(v=null===(r=e.mapping)||void 0===r?void 0:r.header)||void 0===v?void 0:v[0],c=l;if(n&&l){const e=null==l?void 0:l.replace("[[","").replace("]]","").replace("{{","").replace("}}","").replace("((","").replace("))",""),i=/\(\(/.test(l),o={idx:0,variableVal:t?n:c,editable:i,editableDefaultValues:i?void 0:n,variableName:e};T.headerVariables=[o],(null===(E=null===(s=p.example)||void 0===s?void 0:s.header_text)||void 0===E?void 0:E.length)&&(T.headerText=null===(u=T.headerText)||void 0===u?void 0:u.replace("{{1}}",`{{${e}}}`))}}return T}validateState(e){var t,a,d,r,v,s,E,u,T,p,c,_,m,R,h,b,I,L,N,y,B;const A=/\p{Extended_Pictographic}/u;let D="valid";const C={meta:{},ctaBtn:{phoneNumber:{btnText:"",link:""},websiteLink:{btnText:"",link:""}},quickReply:[null,null,null]},O=new o.TemplateHelperUtils;let x=!1;const P=e=>{var t;null===(t=document.getElementById(e))||void 0===t||t.scrollIntoView({behavior:"smooth",block:"nearest"})};if((null===(t=e.meta)||void 0===t?void 0:t.name)?e.meta.name.trim().length>i.NAME_LEN_LIMIT?(C.meta.name=i.NAME_LEN_ERROR,D="invalid"):n.specialCharPattern.test(e.meta.name.trim())&&(C.meta.name=i.NO_SPECIAL_CHAR,D="invalid"):(C.meta.name=i.REQUIRED_FIELD,D="invalid"),C.meta.name&&!x&&(P(i.CREATE_TEMPLATE_DOM_IDS.name),x=!0),e.headerType===l.HEADER_TYPES.TEXT){const t=null!==(d=null===(a=e.headerText)||void 0===a?void 0:a.trim())&&void 0!==d?d:"";if(t)if(t.length>i.HEADER_TEXT_LEN_LIMIT)C.header=i.HEADER_LEN_ERROR,D="invalid";else{const e=O.getTemplateVariablesFromState(t);e&&e.length>1&&(C.header=i.ONE_VAR_ALLOWED,D="invalid")}else C.header=i.REQUIRED_FIELD,D="invalid"}else e.headerType===l.HEADER_TYPES.DOCUMENT||e.headerType===l.HEADER_TYPES.IMAGE||(e.headerType,l.HEADER_TYPES.VIDEO);if(e.headerType!==l.HEADER_TYPES.DOCUMENT&&e.headerType!==l.HEADER_TYPES.IMAGE&&e.headerType!==l.HEADER_TYPES.VIDEO||e.headerAssetLink||(C.header=i.HEADER_ASSET_LINK_ERROR,D="invalid"),C.header&&!x&&(P(i.CREATE_TEMPLATE_DOM_IDS.header),x=!0),e.bodyText?e.bodyTextRaw&&(null===(r=e.bodyTextRaw)||void 0===r?void 0:r.trim().length)>i.BODY_TEXT_LEN_LIMIT&&(C.body=i.BODY_LEN_ERROR,D="invalid"):(C.body=i.REQUIRED_FIELD,D="invalid"),C.body&&!x&&(P(i.CREATE_TEMPLATE_DOM_IDS.body),x=!0),e.footerText&&e.footerText.length>i.HEADER_TEXT_LEN_LIMIT&&(C.footer=i.HEADER_LEN_ERROR,D="invalid"),(null==C?void 0:C.footer)&&!x&&(P(i.CREATE_TEMPLATE_DOM_IDS.footer),x=!0),e.actionsType===l.ACTIONS_TYPES.CTA_BTN){if(null===(s=null===(v=e.ctaBtn)||void 0===v?void 0:v.phoneNumber)||void 0===s?void 0:s.isChecked){const t=null===(E=e.ctaBtn.phoneNumber.btnText)||void 0===E?void 0:E.trim(),n=e.ctaBtn.phoneNumber.phoneNumber;C.ctaBtn&&!t?(C.ctaBtn.phoneNumber.btnText=i.REQUIRED_FIELD,D="invalid"):C.ctaBtn&&t&&t.length>i.QUICK_REPLY_BTN_TEXT_LIMIT?(C.ctaBtn.phoneNumber.btnText=i.QUICK_REPLY_LEN_ERROR,D="invalid"):C.ctaBtn&&t&&A.test(t)&&(C.ctaBtn.phoneNumber.btnText=i.BUTTON_EMOJI_ERROR,D="invalid"),C.ctaBtn&&!n?(C.ctaBtn.phoneNumber.link=i.REQUIRED_FIELD,D="invalid"):C.ctaBtn&&n&&n.length<10&&(C.ctaBtn.phoneNumber.link=i.VALID_PHONE_NUMBER,D="invalid")}if(null===(T=null===(u=e.ctaBtn)||void 0===u?void 0:u.websiteLinkBtn)||void 0===T?void 0:T.isChecked){const t=null===(p=e.ctaBtn.websiteLinkBtn.btnText)||void 0===p?void 0:p.trim(),n=null===(c=e.ctaBtn.websiteLinkBtn.linkOpens)||void 0===c?void 0:c.trim(),l=null===(_=e.ctaBtn.websiteLinkBtn.placeholder)||void 0===_?void 0:_.trim();C.ctaBtn&&!t?(C.ctaBtn.websiteLink.btnText=i.REQUIRED_FIELD,D="invalid"):C.ctaBtn&&t&&t.length>i.QUICK_REPLY_BTN_TEXT_LIMIT?(C.ctaBtn.websiteLink.btnText=i.QUICK_REPLY_LEN_ERROR,D="invalid"):C.ctaBtn&&t&&A.test(t)&&(C.ctaBtn.websiteLink.btnText=i.BUTTON_EMOJI_ERROR,D="invalid"),!C.ctaBtn||n||l||(C.ctaBtn.websiteLink.link=i.REQUIRED_FIELD,D="invalid")}}else if(e.actionsType===l.ACTIONS_TYPES.QUICK_REPLY){const t=["","",""];e.quickReply.forEach(((n,l)=>{const o=n.text.trim();if(o)if(o.length>i.QUICK_REPLY_NAME_LEN_LIMIT)t[l]=i.QUICK_REPLY_LEN_ERROR,D="invalid";else if(A.test(o))t[l]=i.BUTTON_EMOJI_ERROR,D="invalid";else{const n=[...e.quickReply];n.splice(l,1);n.find((e=>e.text===o))&&(t[l]=i.QUICK_REPLY_NAME_ERROR,D="invalid")}else t[l]=i.REQUIRED_FIELD,D="invalid"})),C.quickReply=t}if(e.actionsType===l.ACTIONS_TYPES.CTA_BTN||e.actionsType===l.ACTIONS_TYPES.QUICK_REPLY){const e=null===(m=C.quickReply)||void 0===m?void 0:m.reduce(((e,t)=>e||!!t),!1);((null===(h=null===(R=null==C?void 0:C.ctaBtn)||void 0===R?void 0:R.websiteLink)||void 0===h?void 0:h.link)||(null===(I=null===(b=C.ctaBtn)||void 0===b?void 0:b.websiteLink)||void 0===I?void 0:I.btnText)||(null===(N=null===(L=C.ctaBtn)||void 0===L?void 0:L.phoneNumber)||void 0===N?void 0:N.link)||(null===(B=null===(y=C.ctaBtn)||void 0===y?void 0:y.phoneNumber)||void 0===B?void 0:B.btnText)||e)&&!x&&(P(i.CREATE_TEMPLATE_DOM_IDS.actionButtons),x=!0)}return{status:D,errors:C}}parseBodyComponent(e){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=arguments.length>2?arguments[2]:void 0;var o,a,d,r,v;const s=[];let E="";const u=null===(o=e.components)||void 0===o?void 0:o.find((e=>"BODY"===e.type));return u&&(null===(d=null===(a=u.example)||void 0===a?void 0:a.body_text)||void 0===d||d[0].forEach(((t,i)=>{var o,a;let d=null===(a=null===(o=e.mapping)||void 0===o?void 0:o.body)||void 0===a?void 0:a[i];const r=d,v=d&&/\(\(/.test(d),E=null==d?void 0:d.match(n.placeHolderNamePattern);(null==E?void 0:E[2])&&(d=null==E?void 0:E[2]),s.push({idx:i,variableVal:l?t:r,editable:!!v,editableDefaultValues:v?void 0:t,variableName:null!=d?d:""})})),E=e.htmlContentUrl?e.htmlContentUrl:(null===(r=u.text)||void 0===r?void 0:r.split(/\{\{[0-9]+\}\}/).length)?null===(v=u.text)||void 0===v?void 0:v.split(/\{\{[0-9]+\}\}/).map(((e,n)=>{if(null==s?void 0:s[n]){const l=s[n].variableName;return i?`${e}{{${l}}}`:`${e} <span> </span><span style="color: ${t.COLORS.content.brand}; text-decoration: underline;">{{${l}}}</span><span> </span>`}return e})).join(""):""),{bodyVariable:s,bodyText:E}}parseFooterComponent(e){var t;const n=null===(t=e.components)||void 0===t?void 0:t.find((e=>"FOOTER"===e.type));return null==n?void 0:n.text}parseButtonComponent(e){var t,i,o,a,d,r;const v={actionsType:l.ACTIONS_TYPES.NONE,quickReply:[],ctaBtn:{phoneNumber:void 0,websiteLinkBtn:void 0}},s=null===(t=e.components)||void 0===t?void 0:t.find((e=>"BUTTONS"===e.type));if(s&&(null===(i=null==s?void 0:s.buttons)||void 0===i?void 0:i.length)){const t="QUICK_REPLY"===(null===(o=null==s?void 0:s.buttons)||void 0===o?void 0:o[0].type)?l.ACTIONS_TYPES.QUICK_REPLY:l.ACTIONS_TYPES.CTA_BTN;if(v.actionsType=t,t===l.ACTIONS_TYPES.QUICK_REPLY){const e=null!==(d=null===(a=null==s?void 0:s.buttons)||void 0===a?void 0:a.map((e=>e)))&&void 0!==d?d:[];return v.quickReply=e,v}t===l.ACTIONS_TYPES.CTA_BTN&&(null===(r=null==s?void 0:s.buttons)||void 0===r||r.forEach((t=>{var i,l,o,a;if(t.phone_number&&(v.ctaBtn.phoneNumber={isChecked:!0,btnText:t.text,phoneNumber:t.phone_number}),t.url){const d=null!==(o=null===(l=null===(i=null==e?void 0:e.mapping)||void 0===i?void 0:i.buttons)||void 0===l?void 0:l[0])&&void 0!==o?o:void 0;let r=!1;d&&n.editableVarPattern.test(d)&&(r=!0),v.ctaBtn.websiteLinkBtn={isChecked:!0,btnText:t.text,linkOpens:r?null===(a=t.example)||void 0===a?void 0:a[0]:t.url,placeholder:r?void 0:d}}})))}return v}parseUITemplateFromDBFormat(t){var n;return e.__awaiter(this,void 0,void 0,(function*(){const{dbFormattedTemplate:e,isDuplicate:i,isV2:l=!1,showSampleValues:o}=t,{headerType:a,headerAssetLink:d,headerAssetName:r,headerText:v,headerVariables:s}=yield this.parseDataFromHeaderComponent(e),{bodyText:E,bodyVariable:u}=yield this.parseBodyComponent(e,l,o),{actionsType:T,quickReply:p,ctaBtn:c}=yield this.parseButtonComponent(e),_={quickReply:p,ctaBtn:c,meta:{name:i?`${e.label} Copy`:e.label,category:null===(n=e.category)||void 0===n?void 0:n.toUpperCase(),subCategory:e.templateCategory,language:e.language,templateId:e.templateId},error:{header:void 0,body:void 0,footer:void 0,quickReply:void 0,meta:void 0,ctaBtn:void 0},actionsType:T,footerText:this.parseFooterComponent(e),bodyVariables:u,bodyText:E,headerType:a,headerAssetLink:d,headerAssetName:r,headerText:v,headerVariables:s,alreadyAsADraft:e.isDraft,mode:"edit",initialLoading:!1},{errors:m}=this.validateState(_);return _.error=m,_}))}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("date-fns"),i=require("../../../constants/Theme.js"),n=require("../constants/regexPatterns.js"),l=require("../constants/TemplateConstants.js"),o=require("../models/TemplateMeta.js"),a=require("../utils/TemplateHelperUtils.js");exports.TemplateCreatorHelper=class{parseDataFromHeaderComponent(e,t){var i,n,l,a,d,r,s,v,E,u;const p={headerType:o.HEADER_TYPES.NONE,headerVariables:[]},T=null===(i=e.components)||void 0===i?void 0:i.find((e=>"HEADER"===e.type));if(T){p.headerType=T.format,p.headerText=T.text,p.headerAssetLink=null===(l=null===(n=T.example)||void 0===n?void 0:n.header_handle)||void 0===l?void 0:l[0];const i=null===(d=null===(a=T.example)||void 0===a?void 0:a.header_text)||void 0===d?void 0:d[0],o=null===(s=null===(r=e.mapping)||void 0===r?void 0:r.header)||void 0===s?void 0:s[0],c=o;if(i&&o){const e=null==o?void 0:o.replace("[[","").replace("]]","").replace("{{","").replace("}}","").replace("((","").replace("))",""),n=/\(\(/.test(o),l={idx:0,variableVal:t?i:c,editable:n,editableDefaultValues:n?void 0:i,variableName:e};p.headerVariables=[l],(null===(E=null===(v=T.example)||void 0===v?void 0:v.header_text)||void 0===E?void 0:E.length)&&(p.headerText=null===(u=p.headerText)||void 0===u?void 0:u.replace("{{1}}",`{{${e}}}`))}}return p}validateState(e){var t,i,d,r,s,v,E,u,p,T,c,_,m,h,R,b,I,L,y,B,N;const C=/\p{Extended_Pictographic}/u;let O="valid";const D={meta:{},ctaBtn:{phoneNumber:{btnText:"",link:""},websiteLink:{btnText:"",link:""}},quickReply:[null,null,null]},f=new a.TemplateHelperUtils;let x=!1;const A=e=>{var t;null===(t=document.getElementById(e))||void 0===t||t.scrollIntoView({behavior:"smooth",block:"nearest"})};if((null===(t=e.meta)||void 0===t?void 0:t.name)?e.meta.name.trim().length>l.NAME_LEN_LIMIT?(D.meta.name=l.NAME_LEN_ERROR,O="invalid"):n.specialCharPattern.test(e.meta.name.trim())&&(D.meta.name=l.NO_SPECIAL_CHAR,O="invalid"):(D.meta.name=l.REQUIRED_FIELD,O="invalid"),D.meta.name&&!x&&(A(l.CREATE_TEMPLATE_DOM_IDS.name),x=!0),e.headerType===o.HEADER_TYPES.TEXT){const t=null!==(d=null===(i=e.headerText)||void 0===i?void 0:i.trim())&&void 0!==d?d:"";if(t)if(t.length>l.HEADER_TEXT_LEN_LIMIT)D.header=l.HEADER_LEN_ERROR,O="invalid";else{const e=f.getTemplateVariablesFromState(t);e&&e.length>1&&(D.header=l.ONE_VAR_ALLOWED,O="invalid")}else D.header=l.REQUIRED_FIELD,O="invalid"}else e.headerType===o.HEADER_TYPES.DOCUMENT||e.headerType===o.HEADER_TYPES.IMAGE||(e.headerType,o.HEADER_TYPES.VIDEO);if(e.headerType!==o.HEADER_TYPES.DOCUMENT&&e.headerType!==o.HEADER_TYPES.IMAGE&&e.headerType!==o.HEADER_TYPES.VIDEO||e.headerAssetLink||(D.header=l.HEADER_ASSET_LINK_ERROR,O="invalid"),D.header&&!x&&(A(l.CREATE_TEMPLATE_DOM_IDS.header),x=!0),e.bodyText?e.bodyTextRaw&&(null===(r=e.bodyTextRaw)||void 0===r?void 0:r.trim().length)>l.BODY_TEXT_LEN_LIMIT&&(D.body=l.BODY_LEN_ERROR,O="invalid"):(D.body=l.REQUIRED_FIELD,O="invalid"),D.body&&!x&&(A(l.CREATE_TEMPLATE_DOM_IDS.body),x=!0),e.footerText&&e.footerText.length>l.HEADER_TEXT_LEN_LIMIT&&(D.footer=l.HEADER_LEN_ERROR,O="invalid"),(null==D?void 0:D.footer)&&!x&&(A(l.CREATE_TEMPLATE_DOM_IDS.footer),x=!0),e.actionsType===o.ACTIONS_TYPES.CTA_BTN){if(null===(v=null===(s=e.ctaBtn)||void 0===s?void 0:s.phoneNumber)||void 0===v?void 0:v.isChecked){const t=null===(E=e.ctaBtn.phoneNumber.btnText)||void 0===E?void 0:E.trim(),i=e.ctaBtn.phoneNumber.phoneNumber;D.ctaBtn&&!t?(D.ctaBtn.phoneNumber.btnText=l.REQUIRED_FIELD,O="invalid"):D.ctaBtn&&t&&t.length>l.QUICK_REPLY_BTN_TEXT_LIMIT?(D.ctaBtn.phoneNumber.btnText=l.QUICK_REPLY_LEN_ERROR,O="invalid"):D.ctaBtn&&t&&C.test(t)&&(D.ctaBtn.phoneNumber.btnText=l.BUTTON_EMOJI_ERROR,O="invalid"),D.ctaBtn&&!i?(D.ctaBtn.phoneNumber.link=l.REQUIRED_FIELD,O="invalid"):D.ctaBtn&&i&&i.length<10&&(D.ctaBtn.phoneNumber.link=l.VALID_PHONE_NUMBER,O="invalid")}if(null===(p=null===(u=e.ctaBtn)||void 0===u?void 0:u.websiteLinkBtn)||void 0===p?void 0:p.isChecked){const t=null===(T=e.ctaBtn.websiteLinkBtn.btnText)||void 0===T?void 0:T.trim(),i=null===(c=e.ctaBtn.websiteLinkBtn.linkOpens)||void 0===c?void 0:c.trim(),n=null===(_=e.ctaBtn.websiteLinkBtn.placeholder)||void 0===_?void 0:_.trim();D.ctaBtn&&!t?(D.ctaBtn.websiteLink.btnText=l.REQUIRED_FIELD,O="invalid"):D.ctaBtn&&t&&t.length>l.QUICK_REPLY_BTN_TEXT_LIMIT?(D.ctaBtn.websiteLink.btnText=l.QUICK_REPLY_LEN_ERROR,O="invalid"):D.ctaBtn&&t&&C.test(t)&&(D.ctaBtn.websiteLink.btnText=l.BUTTON_EMOJI_ERROR,O="invalid"),!D.ctaBtn||i||n||(D.ctaBtn.websiteLink.link=l.REQUIRED_FIELD,O="invalid")}}else if(e.actionsType===o.ACTIONS_TYPES.QUICK_REPLY){const t=["","",""];e.quickReply.forEach(((i,n)=>{const o=i.text.trim();if(o)if(o.length>l.QUICK_REPLY_NAME_LEN_LIMIT)t[n]=l.QUICK_REPLY_LEN_ERROR,O="invalid";else if(C.test(o))t[n]=l.BUTTON_EMOJI_ERROR,O="invalid";else{const i=[...e.quickReply];i.splice(n,1);i.find((e=>e.text===o))&&(t[n]=l.QUICK_REPLY_NAME_ERROR,O="invalid")}else t[n]=l.REQUIRED_FIELD,O="invalid"})),D.quickReply=t}if(e.actionsType===o.ACTIONS_TYPES.CTA_BTN||e.actionsType===o.ACTIONS_TYPES.QUICK_REPLY){const e=null===(m=D.quickReply)||void 0===m?void 0:m.reduce(((e,t)=>e||!!t),!1);((null===(R=null===(h=null==D?void 0:D.ctaBtn)||void 0===h?void 0:h.websiteLink)||void 0===R?void 0:R.link)||(null===(I=null===(b=D.ctaBtn)||void 0===b?void 0:b.websiteLink)||void 0===I?void 0:I.btnText)||(null===(y=null===(L=D.ctaBtn)||void 0===L?void 0:L.phoneNumber)||void 0===y?void 0:y.link)||(null===(N=null===(B=D.ctaBtn)||void 0===B?void 0:B.phoneNumber)||void 0===N?void 0:N.btnText)||e)&&!x&&(A(l.CREATE_TEMPLATE_DOM_IDS.actionButtons),x=!0)}return{status:O,errors:D}}parseBodyComponent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=arguments.length>2?arguments[2]:void 0;var o,a,d,r,s;const v=[];let E="";const u=null===(o=e.components)||void 0===o?void 0:o.find((e=>"BODY"===e.type));return u&&(null===(d=null===(a=u.example)||void 0===a?void 0:a.body_text)||void 0===d||d[0].forEach(((t,i)=>{var o,a;let d=null===(a=null===(o=e.mapping)||void 0===o?void 0:o.body)||void 0===a?void 0:a[i];const r=d,s=d&&/\(\(/.test(d),E=null==d?void 0:d.match(n.placeHolderNamePattern);(null==E?void 0:E[2])&&(d=null==E?void 0:E[2]),v.push({idx:i,variableVal:l?t:r,editable:!!s,editableDefaultValues:s?void 0:t,variableName:null!=d?d:""})})),E=e.htmlContentUrl?e.htmlContentUrl:(null===(r=u.text)||void 0===r?void 0:r.split(/\{\{[0-9]+\}\}/).length)?null===(s=u.text)||void 0===s?void 0:s.split(/\{\{[0-9]+\}\}/).map(((e,n)=>{if(null==v?void 0:v[n]){const l=v[n].variableName;return t?`${e}{{${l}}}`:`${e} <span> </span><span style="color: ${i.COLORS.content.brand}; text-decoration: underline;">{{${l}}}</span><span> </span>`}return e})).join(""):""),{bodyVariable:v,bodyText:E}}parseFooterComponent(e){var t;const i=null===(t=e.components)||void 0===t?void 0:t.find((e=>"FOOTER"===e.type));return null==i?void 0:i.text}parseButtonComponent(e){var t,i,l,a,d,r,s;const v={actionsType:o.ACTIONS_TYPES.NONE,quickReply:[],ctaBtn:{phoneNumber:void 0,websiteLinkBtn:void 0},allButtons:[]},E=null===(t=e.components)||void 0===t?void 0:t.find((e=>"BUTTONS"===e.type));if(E&&(null===(i=null==E?void 0:E.buttons)||void 0===i?void 0:i.length)){const t="QUICK_REPLY"===(null===(l=null==E?void 0:E.buttons)||void 0===l?void 0:l[0].type)?o.ACTIONS_TYPES.QUICK_REPLY:o.ACTIONS_TYPES.CTA_BTN;if(v.actionsType=t,t===o.ACTIONS_TYPES.QUICK_REPLY){const e=null!==(d=null===(a=null==E?void 0:E.buttons)||void 0===a?void 0:a.map((e=>e)))&&void 0!==d?d:[];return v.quickReply=e,v}t===o.ACTIONS_TYPES.CTA_BTN&&(null===(r=null==E?void 0:E.buttons)||void 0===r||r.forEach((t=>{var i,l,o,a;if(t.phone_number&&(v.ctaBtn.phoneNumber={isChecked:!0,btnText:t.text,phoneNumber:t.phone_number}),t.url){const d=null!==(o=null===(l=null===(i=null==e?void 0:e.mapping)||void 0===i?void 0:i.buttons)||void 0===l?void 0:l[0])&&void 0!==o?o:void 0;let r=!1;d&&n.editableVarPattern.test(d)&&(r=!0),v.ctaBtn.websiteLinkBtn={isChecked:!0,btnText:t.text,linkOpens:r?null===(a=t.example)||void 0===a?void 0:a[0]:t.url,placeholder:r?void 0:d}}}))),v.allButtons=null===(s=E.buttons)||void 0===s?void 0:s.map((e=>{var t;return"COPY_CODE"===e.type?Object.assign(Object.assign({},e),{placeholder:null===(t=e.example)||void 0===t?void 0:t[0]}):e}))}return v}parseLimitedTimeOfferComponent(e,i){const n={text:"",dateTime:"",code:""};return e.components.forEach((e=>{var l,o,a;if("limited_time_offer"===e.type){n.text=null!==(o=null===(l=e.limited_time_offer)||void 0===l?void 0:l.text)&&void 0!==o?o:"";const i=null===(a=e.example)||void 0===a?void 0:a.limited_time_offer;i&&i.startsWith("{{")&&i.endsWith("}}")?n.dateTime=i:n.dateTime=t.format(i?new Date(i):new Date,"MMM dd")}console.log("vj: limited time offer",n),i.forEach((e=>{var t;"COPY_CODE"===e.type&&(n.code=null!==(t=e.placeholder)&&void 0!==t?t:"")}))})),n}parseUITemplateFromDBFormat(t){var i;return e.__awaiter(this,void 0,void 0,(function*(){const{dbFormattedTemplate:e,isDuplicate:n,isV2:l=!1,showSampleValues:o}=t,{headerType:a,headerAssetLink:d,headerAssetName:r,headerText:s,headerVariables:v}=yield this.parseDataFromHeaderComponent(e),{bodyText:E,bodyVariable:u}=yield this.parseBodyComponent(e,l,o),{actionsType:p,quickReply:T,ctaBtn:c,allButtons:_}=yield this.parseButtonComponent(e),m=this.parseLimitedTimeOfferComponent(e,_),h={quickReply:T,ctaBtn:c,allButtons:_,meta:{name:n?`${e.label} Copy`:e.label,category:null===(i=e.category)||void 0===i?void 0:i.toUpperCase(),subCategory:e.templateCategory,language:e.language,templateId:e.templateId},error:{header:void 0,body:void 0,footer:void 0,quickReply:void 0,meta:void 0,ctaBtn:void 0},actionsType:p,footerText:this.parseFooterComponent(e),bodyVariables:u,bodyText:E,headerType:a,headerAssetLink:d,headerAssetName:r,headerText:s,headerVariables:v,alreadyAsADraft:e.isDraft,mode:"edit",initialLoading:!1,limitedTimeOfferComponent:m},{errors:R}=this.validateState(h);return h.error=R,h}))}};
@@ -1,7 +1,7 @@
1
1
  import { SingleOption } from "../../dropdown/type";
2
2
  export type CUSTOM_VARIABLE = {
3
3
  variableName: string;
4
- type: 'string' | 'link' | 'image';
4
+ type: 'string' | 'link' | 'image' | 'button' | 'date_time';
5
5
  isEditableVariable: boolean;
6
6
  updatedValue: string;
7
7
  index?: number;
@@ -11,11 +11,15 @@ export type WhatsAppTemplate = {
11
11
  templateCategory: string;
12
12
  type?: 'email' | 'whatsapp';
13
13
  components: {
14
- type: 'HEADER' | 'BODY' | 'BUTTONS' | 'FOOTER';
14
+ type: 'HEADER' | 'BODY' | 'BUTTONS' | 'FOOTER' | 'limited_time_offer';
15
15
  format?: HEADER_TYPES;
16
16
  text?: string;
17
+ limited_time_offer?: {
18
+ text: string;
19
+ has_expiration: boolean;
20
+ };
17
21
  buttons?: {
18
- type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER';
22
+ type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE';
19
23
  text?: string;
20
24
  url?: string;
21
25
  example?: string[];
@@ -28,6 +32,7 @@ export type WhatsAppTemplate = {
28
32
  header_handle?: Array<string>;
29
33
  body_text?: Array<string[]>;
30
34
  header_text?: Array<string>;
35
+ limited_time_offer?: string;
31
36
  };
32
37
  }[];
33
38
  mapping: {
@@ -46,6 +51,7 @@ export type WhatsAppTemplate = {
46
51
  updatedAt: number;
47
52
  isDraft?: boolean;
48
53
  };
54
+ export type WhatsappTemplateButtonTypes = 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE';
49
55
  export type CreateTemplateType = {
50
56
  /** Data */
51
57
  headerType: HEADER_TYPES;
@@ -72,6 +78,7 @@ export type CreateTemplateType = {
72
78
  placeholder?: string;
73
79
  };
74
80
  };
81
+ allButtons: WhatsappPreviewButtonType[];
75
82
  meta: {
76
83
  name: string;
77
84
  category?: string;
@@ -83,6 +90,11 @@ export type CreateTemplateType = {
83
90
  alreadyAsADraft?: boolean;
84
91
  /** UI */
85
92
  initialLoading: boolean;
93
+ limitedTimeOfferComponent: {
94
+ text: string;
95
+ dateTime: string;
96
+ code: string;
97
+ };
86
98
  error: {
87
99
  modalError?: string;
88
100
  header?: string;
@@ -172,6 +184,15 @@ export type WhatsappLikePreviewTypes = {
172
184
  children?: React.ReactNode;
173
185
  bodyVariableList?: variableType[];
174
186
  headerVariableList?: variableType[];
187
+ buttons?: WhatsappPreviewButtonType[];
188
+ limitedTimeOfferComponent?: CreateTemplateType['limitedTimeOfferComponent'];
189
+ };
190
+ export type WhatsappPreviewButtonType = {
191
+ type: WhatsappTemplateButtonTypes;
192
+ text: string;
193
+ placeholder?: string;
194
+ flowId: string;
195
+ flowName: string;
175
196
  };
176
197
  export type WhatsappMeta = {
177
198
  containerStyle?: React.CSSProperties | undefined;
@@ -224,7 +245,8 @@ export type TEMPLATE_BUTTON = {
224
245
  export declare enum BUTTON_TYPE {
225
246
  QUICK_REPLY = "QUICK_REPLY",
226
247
  URL = "URL",
227
- PHONE_NUMBER = "PHONE_NUMBER"
248
+ PHONE_NUMBER = "PHONE_NUMBER",
249
+ COPY_CODE = "COPY_CODE"
228
250
  }
229
251
  export declare enum POD {
230
252
  CHATBOT = "CHATBOT",
@@ -1 +1 @@
1
- "use strict";var T,N;Object.defineProperty(exports,"__esModule",{value:!0}),exports.BUTTON_TYPE=void 0,(T=exports.BUTTON_TYPE||(exports.BUTTON_TYPE={})).QUICK_REPLY="QUICK_REPLY",T.URL="URL",T.PHONE_NUMBER="PHONE_NUMBER",exports.POD=void 0,(N=exports.POD||(exports.POD={})).CHATBOT="CHATBOT",N.GROWTH="GROWTH",N.CAMPAIGN="CAMPAIGN",N.CRM="CRM",N.INTEGRATIONS="INTEGRATIONS",N.OPENAI="OPENAI",N.DM="DM",N.FRONTEND="FRONTEND";
1
+ "use strict";var O,T;Object.defineProperty(exports,"__esModule",{value:!0}),exports.BUTTON_TYPE=void 0,(O=exports.BUTTON_TYPE||(exports.BUTTON_TYPE={})).QUICK_REPLY="QUICK_REPLY",O.URL="URL",O.PHONE_NUMBER="PHONE_NUMBER",O.COPY_CODE="COPY_CODE",exports.POD=void 0,(T=exports.POD||(exports.POD={})).CHATBOT="CHATBOT",T.GROWTH="GROWTH",T.CAMPAIGN="CAMPAIGN",T.CRM="CRM",T.INTEGRATIONS="INTEGRATIONS",T.OPENAI="OPENAI",T.DM="DM",T.FRONTEND="FRONTEND";
@@ -0,0 +1 @@
1
+ import*as e from"react";var a;function t(){return t=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},t.apply(this,arguments)}var r=r=>e.createElement("svg",t({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16"},r),a||(a=e.createElement("g",{fill:"#1877F2"},e.createElement("path",{d:"M2.695 2.196A.667.667 0 0 1 3.167 2h6a.667.667 0 0 1 .666.667v.667a.667.667 0 1 0 1.333 0v-.667a2 2 0 0 0-2-2h-6a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h.667a.667.667 0 0 0 0-1.333h-.667a.667.667 0 0 1-.666-.667v-6c0-.177.07-.346.195-.471Z"}),e.createElement("path",{fillRule:"evenodd",d:"M7.833 5.334a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-6Zm-.667 2c0-.369.299-.667.667-.667h6c.368 0 .667.298.667.667v6a.667.667 0 0 1-.667.666h-6a.667.667 0 0 1-.667-.666v-6Z",clipRule:"evenodd"}))));export{r as default};
@@ -0,0 +1 @@
1
+ import*as a from"react";var e;function t(){return t=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(a[r]=t[r])}return a},t.apply(this,arguments)}var r=r=>a.createElement("svg",t({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},r),e||(e=a.createElement("path",{fill:"#4AA189",fillRule:"evenodd",d:"M9.778 7.112a1.833 1.833 0 1 1 0-3.667 1.833 1.833 0 0 1 0 3.667ZM6.444 5.279a3.333 3.333 0 0 1 6.112-1.844A3.333 3.333 0 1 1 17.818 7.5H20a2 2 0 0 1 2 2V21.057a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.501a2 2 0 0 1 2-2h3.293a3.32 3.32 0 0 1-.849-2.222ZM13.634 9l2.752 3.93a.75.75 0 0 0 1.228-.86L15.465 9H20a.5.5 0 0 1 .5.5v6.194h-17V9.501A.5.5 0 0 1 4 9h5.646l-2.15 3.07a.75.75 0 1 0 1.23.86l2.75-3.93h2.158ZM20.5 21.056v-2.86h-17v2.86a.5.5 0 0 0 .5.5h16a.5.5 0 0 0 .5-.5Zm-7-15.777a1.833 1.833 0 1 0 3.667 0 1.833 1.833 0 0 0-3.667 0Z",clipRule:"evenodd"})));export{r as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import s from"../../assets/icons/chevronLeft.svg.js";import o from"../../assets/icons/chevronRight.svg.js";import{StyledTablePaginationContainer as i,StyledPagingContainer as n}from"./TablePagination.styled.js";import{DEFAULT_THEME as a}from"../../constants/Theme.js";import{BodySecondary as r}from"../TypographyStyle.js";import{Dropdown as c}from"../dropdown/Dropdown.js";const l=l=>{let{pageNumber:d,pageSize:p,totalRows:g,updatePageNumber:h,updatePageSize:m,hidePageSizeOptions:b}=l;const j=a.colorsV2,v=(d-1)*p+1,y=(d-1)*p+p,f=Math.ceil(g/p),u=1==f;let w=[];w=f>=5?d===f?[d-4,d-3,d-2,d-1,d]:1===d?[d,d+1,d+2,d+3,d+4]:2===d?[d-1,d,d+1,d+2,d+3]:d===f-1?[d-3,d-2,d-1,d,d+1]:[d-2,d-1,d,d+1,d+2]:Array.from({length:f},((e,t)=>t+1));return e(i,{children:[!b&&t("div",{children:t(c,{size:"small",options:[{label:"5 rows per page",value:"5",selected:5===p},{label:"10 rows per page",value:"10",selected:10===p},{label:"20 rows per page",value:"20",selected:20===p}],onSelect:m,width:"162px"})}),e("div",Object.assign({className:"paging__container"},{children:[!b&&g&&e(r,Object.assign({style:{color:j.content.placeholder,marginRight:8}},{children:["Showing ",v,"-",y>g?g:y," of"," ",g," results"]})),e("div",Object.assign({className:"pages__buttons-container"},{children:[!u&&t(n,Object.assign({active:!1,onClick:()=>{1!==d&&h(Math.max(d-1,1))},disabled:1===d},{children:t(s,{color:j.content.secondary,height:14,width:14})})),w.map((e=>t(n,Object.assign({active:e==d,onClick:()=>h(e),style:{display:1==e&&g<=p?"none":"flex"}},{children:t(r,Object.assign({style:{color:e==d?j.content.primaryInverse:j.content.secondary}},{children:e}))}),e))),!u&&t(n,Object.assign({isLast:!0,active:!1,onClick:()=>{d!==f&&h(Math.min(d+1,f))},disabled:d===f},{children:t(o,{color:j.content.secondary,height:14,width:14})}))]}))]}))]})};export{l as TablePagination};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import s from"../../assets/icons/chevronLeft.svg.js";import o from"../../assets/icons/chevronRight.svg.js";import{StyledTablePaginationContainer as i,StyledPagingContainer as n}from"./TablePagination.styled.js";import{DEFAULT_THEME as a}from"../../constants/Theme.js";import{Dropdown as r}from"../dropdown/Dropdown.js";import{BodySecondary as c}from"../TypographyStyle.js";const l=l=>{let{pageNumber:d,pageSize:p,totalRows:g,updatePageNumber:h,updatePageSize:m,hidePageSizeOptions:b}=l;const j=a.colorsV2,v=(d-1)*p+1,y=(d-1)*p+p,f=Math.ceil(g/p),u=1==f;let w=[];w=f>=5?d===f?[d-4,d-3,d-2,d-1,d]:1===d?[d,d+1,d+2,d+3,d+4]:2===d?[d-1,d,d+1,d+2,d+3]:d===f-1?[d-3,d-2,d-1,d,d+1]:[d-2,d-1,d,d+1,d+2]:Array.from({length:f},((e,t)=>t+1));return e(i,{children:[!b&&t("div",{children:t(r,{size:"small",options:[{label:"5 rows per page",value:"5",selected:5===p},{label:"10 rows per page",value:"10",selected:10===p},{label:"20 rows per page",value:"20",selected:20===p}],onSelect:m,width:"162px"})}),e("div",Object.assign({className:"paging__container"},{children:[!b&&g&&e(c,Object.assign({style:{color:j.content.placeholder,marginRight:8}},{children:["Showing ",v,"-",y>g?g:y," of"," ",g," results"]})),e("div",Object.assign({className:"pages__buttons-container"},{children:[!u&&t(n,Object.assign({active:!1,onClick:()=>{1!==d&&h(Math.max(d-1,1))},disabled:1===d},{children:t(s,{color:j.content.secondary,height:14,width:14})})),w.map((e=>t(n,Object.assign({active:e==d,onClick:()=>h(e),style:{display:1==e&&g<=p?"none":"flex"}},{children:t(c,Object.assign({style:{color:e==d?j.content.primaryInverse:j.content.secondary}},{children:e}))}),e))),!u&&t(n,Object.assign({isLast:!0,active:!1,onClick:()=>{d!==f&&h(Math.min(d+1,f))},disabled:d===f},{children:t(o,{color:j.content.secondary,height:14,width:14})}))]}))]}))]})};export{l as TablePagination};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1 +1 @@
1
- import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as i,jsxs as t,Fragment as n}from"react/jsx-runtime";import s,{forwardRef as a}from"react";import{Spinner as o}from"../spinner/Spinner.js";import{Button as r,ButtonCustomDashedBorder as c}from"./Button.styled.js";import{getButtonIconColor as l,SpinnerColorMap as d,GetButtonTextComponent as m}from"./themes.js";const b=a(((a,b)=>{var{version:h,id:p,buttonType:g="primary",size:u="small",buttonText:v,disabled:j,IconComponent:N,LeadingIcon:y,TrailingIcon:O,isLoading:f,inverse:k,onClick:T,matchParentWidth:x,subtitle:I,darkMode:C}=a,L=e(a,["version","id","buttonType","size","buttonText","disabled","IconComponent","LeadingIcon","TrailingIcon","isLoading","inverse","onClick","matchParentWidth","subtitle","darkMode"]);const z=m(u,g),W="chip"===u?16:20,B={height:W,width:W,color:l(u,g,k,j,f,C),style:{display:"block"},className:"icon"};return i(r,Object.assign({version:h,onClick:f?()=>{}:T,ref:b,id:p,disabled:j,size:u,buttonType:g,isLoading:f,inverse:k,matchParentWidth:x,darkMode:C},L,{children:t("div",Object.assign({className:"button-container"},{children:[g.startsWith("dash")&&i(c,{}),i("div",Object.assign({className:"overlay-container"},{children:f&&i(o,{className:"spinner",size:"small",color:d(g,k)})})),N&&i("div",Object.assign({className:"icon-component"},{children:s.createElement(N,B)})),y&&i("div",Object.assign({className:"icon-leading"},{children:s.createElement(y,B)})),v?t(z,Object.assign({className:"text"},{children:[v,i("div",Object.assign({className:"text-subtitle"},{children:I}))]})):i(n,{}),O&&i("div",Object.assign({className:"icon-trailing"},{children:s.createElement(O,B)}))]}))}))}));b.displayName="Button";export{b as Button};
1
+ import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as i,jsxs as t,Fragment as n}from"react/jsx-runtime";import s,{forwardRef as a}from"react";import{Spinner as o}from"../spinner/Spinner.js";import{Button as c,ButtonCustomDashedBorder as r}from"./Button.styled.js";import{getButtonIconColor as l,SpinnerColorMap as d,GetButtonTextComponent as m}from"./themes.js";const b=a(((a,b)=>{var{version:h,id:p,buttonType:g="primary",size:v="small",buttonText:u,disabled:j,IconComponent:N,LeadingIcon:y,TrailingIcon:O,isLoading:f,inverse:k,onClick:T,matchParentWidth:x,subtitle:I,darkMode:C,activated:L}=a,z=e(a,["version","id","buttonType","size","buttonText","disabled","IconComponent","LeadingIcon","TrailingIcon","isLoading","inverse","onClick","matchParentWidth","subtitle","darkMode","activated"]);const W=m(v,g),B="chip"===v?16:20,E={height:B,width:B,color:l(v,g,k,j,f,C),style:{display:"block"},className:"icon"};return i(c,Object.assign({version:h,onClick:f?()=>{}:T,ref:b,id:p,disabled:j,size:v,buttonType:g,isLoading:f,inverse:k,matchParentWidth:x,darkMode:C,activated:L},z,{children:t("div",Object.assign({className:"button-container"},{children:[g.startsWith("dash")&&i(r,{}),i("div",Object.assign({className:"overlay-container"},{children:f&&i(o,{className:"spinner",size:"small",color:d(g,k)})})),N&&i("div",Object.assign({className:"icon-component"},{children:s.createElement(N,E)})),y&&i("div",Object.assign({className:"icon-leading"},{children:s.createElement(y,E)})),u?t(W,Object.assign({className:"text"},{children:[u,i("div",Object.assign({className:"text-subtitle"},{children:I}))]})):i(n,{}),O&&i("div",Object.assign({className:"icon-trailing"},{children:s.createElement(O,E)}))]}))}))}));b.displayName="Button";export{b as Button};
@@ -12,5 +12,6 @@ export declare const Button: import("@emotion/styled").StyledComponent<{
12
12
  matchParentWidth?: boolean | undefined;
13
13
  version?: "1.0" | "2.0" | undefined;
14
14
  darkMode?: boolean | undefined;
15
+ activated?: boolean | undefined;
15
16
  }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
16
17
  export declare const ButtonCustomDashedBorder: () => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- import t from"@emotion/styled/base";import{jsxs as c,Fragment as d,jsx as n}from"react/jsx-runtime";import{COLORS as l}from"../../constants/Theme.js";import{getBackgroundColor as H,getPadding as X,getBorder as b,getColor as x,getDashedBorderStyling as e,generateDisabledStyling as i,getDisabledTextColor as R,getClickEffect as G,getHoverButtonBackground as u,getHoverButtonTextDecorationStyle as g,generateInverseHoverBackground as o,getLoadingBorder as y,getLoadingBackground as I}from"./themes.js";const a=t("button","production"===process.env.NODE_ENV?{target:"exlualr0"}:{target:"exlualr0",label:"Button"})("all:unset;cursor:pointer;display:flex;gap:8.83px;border-radius:",(t=>"text"==t.buttonType?"0":"4px"),";overflow:hidden;",(t=>t.matchParentWidth?"flex-grow: 1;":"")," background-color:",(t=>H(t.buttonType,t.size,t.inverse,t.darkMode)),";",(t=>{var c;return t.buttonType.startsWith("dash")?`.button-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tposition: relative;\n\t\t\t\t\tborder-radius: 4px;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\t${t.matchParentWidth?"justify-content: center;":""}\n\t\t\t\t\tpadding: ${X(t.buttonType,t.size)};\n\t\t\t\t}`:`padding: ${X(t.buttonType,t.size)};\n\t${b(null!==(c=t.version)&&void 0!==c?c:"1.0",t.buttonType,t.size,t.inverse)}`})," .icon-component{height:",(t=>"chip"===t.size?"16px":"20px"),";width:",(t=>"chip"===t.size?"16px":"20px"),";}.icon-trailing{height:",(t=>"chip"===t.size?"16px":"20px"),";width:",(t=>"chip"===t.size?"16px":"20px"),";}.text{color:",(t=>x(t.buttonType,t.size,t.inverse,t.darkMode)),";}.icon-leading{height:",(t=>"chip"===t.size?"16px":"20px"),";width:",(t=>"chip"===t.size?"16px":"20px"),";}",(t=>e(t.buttonType,t.size,t.isLoading?l.stroke.brandLightAlt:void 0))," .overlay-container{display:none;}:disabled{cursor:",(t=>"text"===t.buttonType?"auto":"not-allowed"),";",(t=>e(t.buttonType,t.size,l.stroke.primary)),";.overlay-container{display:none!important;}",(t=>i(t.buttonType,t.size,t.inverse))," .text{color:",(t=>R(t.inverse)),"!important;}}",(t=>!t.disabled&&!t.isLoading&&`:active {\n\t\t\t\t.button-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\t${t.matchParentWidth?"justify-content: center;":""}\n\t\t\t\t\tposition: relative;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\t.overlay-container {\n\t\t\t\t\t\tdisplay: none !important;\n\t\t\t\t\t}\n\t\t\t\t\t${"chip"===t.size&&`.text {\n\t\t\t\t\t\tcolor: ${l.background.inverseLight} !important;\n\t\t\t\t\t}\n\t\t\t\t\t.icon {\n\t\t\t\t\t\tcolor: ${l.background.inverseLight};\n\t\t\t\t\t}\n\t\t\t\t\t`}\n\t\t\t\t}\n\n\n\t\t\t${G(t.buttonType,t.size,t.inverse)}\n\t\t\t${e(t.buttonType,t.size,l.content.brand)}\n\t\t}`)," ",(t=>t.isLoading?`\n\t\t\tcursor: not-allowed;\n\t\t\tpadding: 0;\n\t\t${y(t.buttonType,t.size,t.inverse)}\n\n\t\t.button-container {\n\t\t\tdisplay: flex;\n\t\t\tposition: relative;\n\t\t\twidth: 100%;\n\t\t\t.text {\n\t\t\t\topacity: 0;\n\t\t\t}\n\t\t\tpadding: ${X(t.buttonType,t.size)};\n\t\t\t.overlay-container {\n\t\t\t\tdisplay: block;\n\t\t\t\tposition: absolute;\n\t\t\t\tpadding: 0;\n\t\t\t\tpadding-top: 1px;\n\t\t\t\ttop: 0;\n\t\t\t\tleft: 0;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t\t${I(t.buttonType,t.size,t.inverse)}\n\t\t\t\t.spinner {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\ttop: calc(50% - 14px);\n\t\t\t\t\tleft: calc(50% - 7px);\n\t\t\t\t}\n\n\t\t\t}\n\t\t}`:`:not(:active):not(:disabled):hover {\n\t\t\tpadding: 0;\n\t\t\t.button-container {\n\t\t\t\tdisplay: flex;\n\t\t\t\tposition: relative;\n\t\t\t\twidth: 100%;\n\t\t\t\t${t.matchParentWidth?"justify-content: center;":""}\n\t\t\t\tpadding: ${X(t.buttonType,t.size)};\n\t\t\t\t.overlay-container {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tpadding: 0;\n\t\t\t\t\ttop: 0;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\t${u(t.buttonType,t.inverse)}\n\t\t\t\t}\n\t\t\t\t${"chip"===t.size&&"text"!==t.buttonType?t.darkMode?`background-color: ${l.stroke.primary};`:`background-color: ${l.surface.hovered};`:""}\n\t\t\t\t${"primary"!==t.buttonType||"chip"===t.size||t.inverse?"":`background-color: ${l.background.inverse};`}\n\t\t\t}\n\t\t\t${"text"===t.buttonType?g(t.buttonType,t.disabled):""}\n\t\t\t${t.inverse?o(t.buttonType,t.disabled):""}\n\t\t}`)," .button-container{display:flex;gap:8.33px;",(t=>t.matchParentWidth?"margin: auto;":""),";}"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkJ1dHRvbi5zdHlsZWQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlvQyIsImZpbGUiOiJCdXR0b24uc3R5bGVkLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGpzeCBhcyBfanN4LCBGcmFnbWVudCBhcyBfRnJhZ21lbnQsIGpzeHMgYXMgX2pzeHMgfSBmcm9tIFwicmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xyXG5pbXBvcnQgeyBDT0xPUlMgfSBmcm9tIFwiLi4vLi4vY29uc3RhbnRzL1RoZW1lXCI7XHJcbmltcG9ydCB7IGdlbmVyYXRlRGlzYWJsZWRTdHlsaW5nLCBnZW5lcmF0ZUludmVyc2VIb3ZlckJhY2tncm91bmQsIGdldEJhY2tncm91bmRDb2xvciwgZ2V0Qm9yZGVyLCBnZXRDbGlja0VmZmVjdCwgZ2V0Q29sb3IsIGdldERhc2hlZEJvcmRlclN0eWxpbmcsIGdldERpc2FibGVkVGV4dENvbG9yLCBnZXRIb3ZlckJ1dHRvbkJhY2tncm91bmQsIGdldEhvdmVyQnV0dG9uVGV4dERlY29yYXRpb25TdHlsZSwgZ2V0TG9hZGluZ0JhY2tncm91bm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5tYXAiXX0= */")),m=()=>c(d,{children:[n("div",{className:"line-top"}),n("div",{className:"line-left"}),n("div",{className:"line-bottom"}),n("div",{className:"line-right"})]});export{a as Button,m as ButtonCustomDashedBorder};
1
+ import t from"@emotion/styled/base";import{jsxs as c,Fragment as d,jsx as n}from"react/jsx-runtime";import{COLORS as l}from"../../constants/Theme.js";import{getBackgroundColor as H,getPadding as b,getBorder as X,getColor as x,getDashedBorderStyling as e,getClickEffect as i,generateDisabledStyling as R,getDisabledTextColor as g,getHoverButtonBackground as u,getHoverButtonTextDecorationStyle as o,generateInverseHoverBackground as G,getLoadingBorder as a,getLoadingBackground as Z}from"./themes.js";const m=t("button","production"===process.env.NODE_ENV?{target:"exlualr0"}:{target:"exlualr0",label:"Button"})("all:unset;cursor:pointer;display:flex;gap:8.83px;border-radius:",(t=>"text"==t.buttonType?"0":"4px"),";overflow:hidden;",(t=>t.matchParentWidth?"flex-grow: 1;":"")," background-color:",(t=>H(t.buttonType,t.size,t.inverse,t.darkMode)),";",(t=>{var c;return t.buttonType.startsWith("dash")?`.button-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tposition: relative;\n\t\t\t\t\tborder-radius: 4px;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\t${t.matchParentWidth?"justify-content: center;":""}\n\t\t\t\t\tpadding: ${b(t.buttonType,t.size)};\n\t\t\t\t}`:`padding: ${b(t.buttonType,t.size)};\n\t${X(null!==(c=t.version)&&void 0!==c?c:"1.0",t.buttonType,t.size,t.inverse)}`})," .icon-component{height:",(t=>"chip"===t.size?"16px":"20px"),";width:",(t=>"chip"===t.size?"16px":"20px"),";}.icon-trailing{height:",(t=>"chip"===t.size?"16px":"20px"),";width:",(t=>"chip"===t.size?"16px":"20px"),";}.text{color:",(t=>x(t.buttonType,t.size,t.inverse,t.darkMode)),";}.icon-leading{height:",(t=>"chip"===t.size?"16px":"20px"),";width:",(t=>"chip"===t.size?"16px":"20px"),";}",(t=>e(t.buttonType,t.size,t.isLoading?l.stroke.brandLightAlt:void 0))," .overlay-container{display:none;}",(t=>!t.disabled&&!t.isLoading&&t.activated&&("dashBold"==t.buttonType||"dashRegular"==t.buttonType)&&`\n\t.button-container {\n\t\tdisplay: flex;\n\t\t${t.matchParentWidth?"justify-content: center;":""}\n\t\tposition: relative;\n\t\twidth: 100%;\n\t\t.overlay-container {\n\t\t\tdisplay: none !important;\n\t\t}\n\t\t.text {\n\t\t\tcolor: ${l.content.brand} !important;\n\t\t}\n\t\t.icon {\n\t\t\tcolor: ${l.background.brand};\n\t\t}\n\t\t\n\t}\n\t${i(t.buttonType,t.size,t.inverse)}\n\t${e(t.buttonType,t.size,l.content.brand)}\n\t`)," :disabled{cursor:",(t=>"text"===t.buttonType?"auto":"not-allowed"),";",(t=>e(t.buttonType,t.size,l.stroke.primary)),";.overlay-container{display:none!important;}",(t=>R(t.buttonType,t.size,t.inverse))," .text{color:",(t=>g(t.inverse)),"!important;}}",(t=>!t.disabled&&!t.isLoading&&`:active {\n\t\t\t\t.button-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\t${t.matchParentWidth?"justify-content: center;":""}\n\t\t\t\t\tposition: relative;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\t.overlay-container {\n\t\t\t\t\t\tdisplay: none !important;\n\t\t\t\t\t}\n\t\t\t\t\t${"chip"===t.size&&`.text {\n\t\t\t\t\t\tcolor: ${l.background.inverseLight} !important;\n\t\t\t\t\t}\n\t\t\t\t\t.icon {\n\t\t\t\t\t\tcolor: ${l.background.inverseLight};\n\t\t\t\t\t}\n\t\t\t\t\t`}\n\t\t\t\t}\n\n\n\t\t\t${i(t.buttonType,t.size,t.inverse)}\n\t\t\t${e(t.buttonType,t.size,l.content.brand)}\n\t\t}`)," ",(t=>t.isLoading?`\n\t\t\tcursor: not-allowed;\n\t\t\tpadding: 0;\n\t\t${a(t.buttonType,t.size,t.inverse)}\n\n\t\t.button-container {\n\t\t\tdisplay: flex;\n\t\t\tposition: relative;\n\t\t\twidth: 100%;\n\t\t\t.text {\n\t\t\t\topacity: 0;\n\t\t\t}\n\t\t\tpadding: ${b(t.buttonType,t.size)};\n\t\t\t.overlay-container {\n\t\t\t\tdisplay: block;\n\t\t\t\tposition: absolute;\n\t\t\t\tpadding: 0;\n\t\t\t\tpadding-top: 1px;\n\t\t\t\ttop: 0;\n\t\t\t\tleft: 0;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t\t${Z(t.buttonType,t.size,t.inverse)}\n\t\t\t\t.spinner {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\ttop: calc(50% - 14px);\n\t\t\t\t\tleft: calc(50% - 7px);\n\t\t\t\t}\n\n\t\t\t}\n\t\t}`:`:not(:active):not(:disabled):hover {\n\t\t\tpadding: 0;\n\t\t\t.button-container {\n\t\t\t\tdisplay: flex;\n\t\t\t\tposition: relative;\n\t\t\t\twidth: 100%;\n\t\t\t\t${t.matchParentWidth?"justify-content: center;":""}\n\t\t\t\tpadding: ${b(t.buttonType,t.size)};\n\t\t\t\t.overlay-container {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tpadding: 0;\n\t\t\t\t\ttop: 0;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\t${u(t.buttonType,t.inverse)}\n\t\t\t\t}\n\t\t\t\t${"chip"===t.size&&"text"!==t.buttonType?t.darkMode?`background-color: ${l.stroke.primary};`:`background-color: ${l.surface.hovered};`:""}\n\t\t\t\t${"primary"!==t.buttonType||"chip"===t.size||t.inverse?"":`background-color: ${l.background.inverse};`}\n\t\t\t}\n\t\t\t${"text"===t.buttonType?o(t.buttonType,t.disabled):""}\n\t\t\t${t.inverse?G(t.buttonType,t.disabled):""}\n\t\t}`)," .button-container{display:flex;gap:8.33px;",(t=>t.matchParentWidth?"margin: auto;":""),";}"+("production"===process.env.NODE_EN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xuXHRcdC5idXR0b24tY29udGFpbmVyIHtcblx0XHRkaXNwbGF5OiBmbGV4O1xuXHRcdGdhcDogOC4zM3B4O1xuXHRcdCR7KHByb3BzKSA9PiAocHJvcHMubWF0Y2hQYXJlbnRXaWR0aCA/ICdtYXJnaW46IGF1dG87JyA6ICcnKX1cblx0fVxuYDtcclxuZXhwb3J0IGNvbnN0IEJ1dHRvbkN1c3RvbURhc2hlZEJvcmRlciA9ICgpID0+IHtcclxuICAgIHJldHVybiAoX2pzeHMoX0ZyYWdtZW50LCB7IGNoaWxkcmVuOiBbX2pzeChcImRpdlwiLCB7IGNsYXNzTmFtZTogXCJsaW5lLXRvcFwiIH0pLCBfanN4KFwiZGl2XCIsIHsgY2xhc3NOYW1lOiBcImxpbmUtbGVmdFwiIH0pLCBfanN4KFwiZGl2XCIsIHsgY2xhc3NOYW1lOiBcImxpbmUtYm90dG9tXCIgfSksIF9qc3goXCJkaXZcIiwgeyBjbGFzc05hbWU6IFwibGluZS1yaWdodFwiIH0pXSB9KSk7XHJcbn07XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPUJ1dHRvbi5zdHlsZWQuanMubWFwIl19 */")),p=()=>c(d,{children:[n("div",{className:"line-top"}),n("div",{className:"line-left"}),n("div",{className:"line-bottom"}),n("div",{className:"line-right"})]});export{m as Button,p as ButtonCustomDashedBorder};
@@ -62,4 +62,5 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
62
62
  subtitle?: string;
63
63
  version?: '1.0' | '2.0';
64
64
  darkMode?: boolean;
65
+ activated?: boolean;
65
66
  }
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import{format as a}from"date-fns";import{useState as n,useEffect as o}from"react";import{CustomDateTime as r}from"../../custom-date-time/CustomDateTime.js";import{Input as s}from"../../input/Input.js";import{RadioButton as d}from"../../radioButton/RadioButton.js";import{TitleRegular as c,BodySecondary as p}from"../../TypographyStyle.js";var D;!function(e){e.FIXED_EXPIRATION="fixedExpiration",e.DYNAMIC_EXPIRATION="dynamicExpiration"}(D||(D={}));const I=I=>{var l;const[m,u]=n(I.discountData.expireAt?D.FIXED_EXPIRATION:I.discountData.expireAfter?D.DYNAMIC_EXPIRATION:void 0),[A,x]=n(),[E,v]=n(),O=(new Date).setDate((new Date).getDate()+1);o((()=>{(null==m||A||E)&&I.setDiscountData(Object.assign(Object.assign({},I.discountData),{expireAfter:void 0,expireAt:void 0})),m&&(A||E)&&(m===D.FIXED_EXPIRATION?v(void 0):x(void 0))}),[m,A,E]);return e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:13}},{children:[t(c,{children:"Coupon expiration (optional)"}),e("div",Object.assign({style:{display:"flex",gap:18}},{children:[t(d,{isActive:m===D.DYNAMIC_EXPIRATION,onValueChange:()=>{v(void 0),u(m===D.DYNAMIC_EXPIRATION?void 0:D.DYNAMIC_EXPIRATION)}}),t(p,{children:"Validity days from coupon claim"})]})),m===D.DYNAMIC_EXPIRATION&&t(s,{errorMessage:E,value:null===(l=I.discountData.expireAfter)||void 0===l?void 0:l.toString(),placeholder:"Enter the number of days",width:"400px",type:"number",onChangeText:e=>{(e=>{v(void 0);const t=Number.parseInt(e);t>0?I.setDiscountData(Object.assign(Object.assign({},I.discountData),{expireAfter:t,expireAt:void 0})):v("Please enter valid input")})(e)}}),e("div",Object.assign({style:{display:"flex",gap:18}},{children:[t(d,{isActive:m===D.FIXED_EXPIRATION,onValueChange:()=>{u(m===D.FIXED_EXPIRATION?void 0:D.FIXED_EXPIRATION)}}),t(p,{children:"Fixed expiry date"})]})),m===D.FIXED_EXPIRATION&&e(i,{children:[t(p,{children:"Ending on"}),t(r,{placement:"bottom-start",time:I.discountData.expireAt?a(new Date(I.discountData.expireAt),"hh:mm a"):a(new Date(O),"hh:mm a"),date:I.discountData.expireAt?new Date(I.discountData.expireAt):new Date(O),error:A,setError:x,onChange:e=>{I.setDiscountData(Object.assign(Object.assign({},I.discountData),{expireAt:e,expireAfter:void 0}))},minDate:new Date(O)})]})]}))};export{D as COUPON_EXPIRATION,I as CouponExpiration};
1
+ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import{format as a}from"date-fns";import{useState as n,useEffect as o}from"react";import{CustomDateTime as r}from"../../custom-date-time/CustomDateTime.js";import{Input as s}from"../../input/Input.js";import{RadioButton as d}from"../../radioButton/RadioButton.js";import{TitleRegular as c,BodySecondary as p}from"../../TypographyStyle.js";var D;!function(e){e.FIXED_EXPIRATION="fixedExpiration",e.DYNAMIC_EXPIRATION="dynamicExpiration"}(D||(D={}));const I=I=>{var A;const[u,l]=n(I.discountData.expireAt?D.FIXED_EXPIRATION:I.discountData.expireAfter?D.DYNAMIC_EXPIRATION:void 0),[m,x]=n(),[E,O]=n(),f=(new Date).setDate((new Date).getDate()+1);o((()=>{l(I.discountData.expireAt?D.FIXED_EXPIRATION:I.discountData.expireAfter?D.DYNAMIC_EXPIRATION:void 0)}),[I.discountData.expireAt,I.discountData.expireAfter]),o((()=>{(null==u||m||E)&&I.setDiscountData(Object.assign(Object.assign({},I.discountData),{expireAfter:void 0,expireAt:void 0})),u&&(m||E)&&(u===D.FIXED_EXPIRATION?O(void 0):x(void 0))}),[u,m,E]);return e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:13}},{children:[t(c,{children:"Coupon expiration (optional)"}),e("div",Object.assign({style:{display:"flex",gap:18}},{children:[t(d,{isActive:u===D.DYNAMIC_EXPIRATION,onValueChange:()=>{O(void 0),l(u===D.DYNAMIC_EXPIRATION?void 0:D.DYNAMIC_EXPIRATION)}}),t(p,{children:"Validity days from coupon claim"})]})),u===D.DYNAMIC_EXPIRATION&&t(s,{errorMessage:E,value:null===(A=I.discountData.expireAfter)||void 0===A?void 0:A.toString(),placeholder:"Enter the number of days",width:"400px",type:"number",onChangeText:e=>{(e=>{O(void 0);const t=Number.parseInt(e);t>0?I.setDiscountData(Object.assign(Object.assign({},I.discountData),{expireAfter:t,expireAt:void 0})):O("Please enter valid input")})(e)}}),e("div",Object.assign({style:{display:"flex",gap:18}},{children:[t(d,{isActive:u===D.FIXED_EXPIRATION,onValueChange:()=>{l(u===D.FIXED_EXPIRATION?void 0:D.FIXED_EXPIRATION)}}),t(p,{children:"Fixed expiry date"})]})),u===D.FIXED_EXPIRATION&&e(i,{children:[t(p,{children:"Ending on"}),t(r,{placement:"bottom-start",time:I.discountData.expireAt?a(new Date(I.discountData.expireAt),"hh:mm a"):a(new Date(f),"hh:mm a"),date:I.discountData.expireAt?new Date(I.discountData.expireAt):new Date(f),error:m,setError:x,onChange:e=>{I.setDiscountData(Object.assign(Object.assign({},I.discountData),{expireAt:e,expireAfter:void 0}))},minDate:new Date(f)})]})]}))};export{D as COUPON_EXPIRATION,I as CouponExpiration};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{MIN_PURCHASE_REQUIREMENT as r,DISCOUNT_TARGET_TYPES as c,DISCOUNT_TYPES as d,DISCOUNT_TARGET_SELECTION as l,DISCOUNT_VALUE_TYPES as s}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as a}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{TitleSmall as u,BodyCaption as p}from"../TypographyStyle.js";import{DEFAULT_THEME as C}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledModal as v}from"../modals/styledModal.js";import{ProductPickerContent as m}from"../product-picker/ProductPickerModal.js";import{Tag as h}from"../tag/Tag.js";import{Tooltip as b}from"../tooltips/Tooltip.js";import y from"../../assets/icons/triangle_error.svg.js";import{ProductPickerModal as T}from"../product-picker-v2/modal.js";import{StyledDiscountDialogueContainer as P,CouponTypeContainerStyled as I}from"./DiscountModal.styled.js";import{validateDiscountData as O,descriptionBuilder as f}from"./DiscountUtils.js";import g,{DISCOUNT_PRODUCTS as E}from"./DynamicCoupon/DynamicCoupon.js";import S from"./StaticCoupon/StaticCoupon.js";const j=j=>{var w,_,k,D,N,F,q,M,A,L;const[x,R]=i(),[U,G]=i(),[B,Y]=i(null!==(w=j.data)&&void 0!==w?w:"string"==typeof j.hideOption?{isStaticCoupon:"dynamic"===j.hideOption}:{isStaticCoupon:!1}),[X,H]=i(!0),[V,z]=i(),[K,Q]=i((null===(_=j.data)||void 0===_?void 0:_.minAmount)?r.AMOUNT:(null===(k=j.data)||void 0===k?void 0:k.minQuantity)?r.QUANTITY:r.NA),[$,Z]=i(void 0),[J,W]=i(void 0),[ee,te]=i(void 0),[oe,ie]=i(void 0),[ne,re]=i(0);n((()=>{let e;const{tempCouponData:t,discountType:o}=ce();z(o),Y(Object.assign({},t)),j.hideProbability||(e=le()),H(O(t,K,o,j.hideProbability||!1,e,!!t.isStaticCoupon)),j.hideProbability||le()}),[]),n((()=>{let e;j.hideProbability||(e=le()),H(O(B,K,V,j.hideProbability||!1,e,!!B.isStaticCoupon))}),[B,ne,V,K]),n((()=>{var e,t,o,i,n,r,c;if(!j.newPickerConf&&((null===(e=j.products)||void 0===e?void 0:e.length)||(null===(t=j.collection)||void 0===t?void 0:t.length))){if(j.products&&(null===(o=j.products)||void 0===o?void 0:o.length)){if(null===(i=j.data)||void 0===i?void 0:i.entitledProductIds){const e=j.products.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.entitledProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));W(e)}if(null===(n=j.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=j.products.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));Z(e)}}if(j.collection&&j.collection.length){if(null===(r=j.data)||void 0===r?void 0:r.entitledCollectionIds){const e=j.collection.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));ie(e)}if(null===(c=j.data)||void 0===c?void 0:c.prerequisiteCollectionIds){const e=j.collection.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));te(e)}}}}),[j.products,j.collection]),n((()=>{var e,t,o,i,n,r,c,d;(null===(t=null===(e=j.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&W(j.data.productsConf.entitledProducts),(null===(i=null===(o=j.data)||void 0===o?void 0:o.productsConf)||void 0===i?void 0:i.prerequisiteProducts)&&Z(j.data.productsConf.prerequisiteProducts),(null===(r=null===(n=j.data)||void 0===n?void 0:n.collectionsConf)||void 0===r?void 0:r.entitledCollections)&&ie(j.data.collectionsConf.entitledCollections),(null===(d=null===(c=j.data)||void 0===c?void 0:c.collectionsConf)||void 0===d?void 0:d.prerequisiteCollections)&&te(j.data.collectionsConf.prerequisiteCollections)}),[null===(D=j.data)||void 0===D?void 0:D.productsConf,null===(N=j.data)||void 0===N?void 0:N.collectionsConf]),n((()=>{if(!J)return;if(j.newPickerConf){const e=[];return Object.values(J).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void Y(Object.assign(Object.assign({},B),{entitledProductIds:e}))}const e=J.map((e=>parseInt(e.id)));Y(Object.assign(Object.assign({},B),{entitledProductIds:e}))}),[J]),n((()=>{if(!$)return;if(j.newPickerConf){const e=[];return Object.values($).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void Y(Object.assign(Object.assign({},B),{prerequisiteProductIds:e}))}const e=$.map((e=>parseInt(e.id)));Y(Object.assign(Object.assign({},B),{prerequisiteProductIds:e}))}),[$]),n((()=>{if(!oe)return;if(j.newPickerConf){(null==oe?void 0:oe.isCustom)&&delete oe.isCustom;const e=Object.keys(oe).map((e=>parseInt(e)));return void Y(Object.assign(Object.assign({},B),{entitledCollectionIds:e}))}const e=oe.map((e=>parseInt(e.id)));Y(Object.assign(Object.assign({},B),{entitledCollectionIds:e}))}),[oe]),n((()=>{if(!ee)return;if(j.newPickerConf){(null==ee?void 0:ee.isCustom)&&delete ee.isCustom;const e=Object.keys(ee).map((e=>parseInt(e)));return void Y(Object.assign(Object.assign({},B),{prerequisiteCollectionIds:e}))}const e=ee.map((e=>parseInt(e.id)));Y(Object.assign(Object.assign({},B),{prerequisiteCollectionIds:e}))}),[ee]);const ce=()=>{var e,t;let o,i=B;return B.isStaticCoupon||(B.targetType===c.SHIPPING_LINE?o=d.FREE_SHIPPING:B.targetType===c.LINE_ITEM?o=B.targetSelection===l.ENTITLED?(null===(e=B.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=B.prerequisiteCollectionIds)||void 0===t?void 0:t.length)?d.BUY_X_GET_Y:d.AMOUNT_OFF_PRODUCTS:d.AMOUNT_OFF_ORDER:(i=Object.assign(Object.assign({},i),{targetType:c.LINE_ITEM,targetSelection:l.ALL,valueType:s.FIXED_AMOUNT}),o=d.AMOUNT_OFF_ORDER)),{discountType:o,tempCouponData:i}},de=[{value:d.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:V===d.AMOUNT_OFF_ORDER},{value:d.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:V===d.AMOUNT_OFF_PRODUCTS},{value:d.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:V===d.BUY_X_GET_Y},{value:d.FREE_SHIPPING,label:"Free shipping",selected:V===d.FREE_SHIPPING}],le=()=>{if(!j.quadrant||!j.probability)return;const e=[...j.probability];let t=[];e.length>=j.quadrant&&e.splice(j.quadrant-1,1),t=e;const o=t.reduce(((e,t)=>e+t),0)+(B.probability||0);return re(parseFloat(o.toFixed(4))),parseFloat(o.toFixed(4))},se=e=>{var t,o,i,n;const a=e.value;z(a),Z([]),W([]),te([]),ie([]),Q(r.NA),a===d.FREE_SHIPPING?Y({value:100,targetSelection:l.ALL,targetType:c.SHIPPING_LINE,valueType:s.PERCENTAGE,quadrant:B.quadrant,isStaticCoupon:!1,title:""}):a===d.BUY_X_GET_Y?Y({targetSelection:l.ENTITLED,targetType:c.LINE_ITEM,valueType:s.PERCENTAGE,quadrant:B.quadrant,isStaticCoupon:!1,title:""}):a===d.AMOUNT_OFF_ORDER?Y({targetSelection:l.ALL,targetType:c.LINE_ITEM,valueType:null!==(o=null===(t=j.data)||void 0===t?void 0:t.valueType)&&void 0!==o?o:s.FIXED_AMOUNT,quadrant:B.quadrant,isStaticCoupon:!1,title:""}):a===d.AMOUNT_OFF_PRODUCTS&&Y({targetSelection:l.ENTITLED,targetType:c.LINE_ITEM,valueType:null!==(n=null===(i=j.data)||void 0===i?void 0:i.valueType)&&void 0!==n?n:s.FIXED_AMOUNT,quadrant:B.quadrant,isStaticCoupon:!1,title:""})};return e(v,Object.assign({width:(U||x)&&j.newPickerConf?"25px":"750px",open:j.isOpen,headingTitle:x?"Select Products":j.title,headingSubtitle:x?void 0:j.subTitle,footerLeftCustomElement:j.errorMsg?j.errorMsg&&t(h,{theme:"light",tagText:j.errorMsg,type:"negative"}):!j.quadrant||j.hideProbability?t(o,{}):ne<=1?t(h,{theme:"light",tagText:`Current probability sum: ${ne}`,type:"white"}):t(b,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:t("div",{children:t(h,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${ne}`,type:"negative",LeadingIcon:y})})})),headerRightCustomElement:j.allowStaticCoupon||x?void 0:t(a,{options:de,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{se(e)}}),onClose:j.onClose,footerShadow:!0,primaryButton:x?{buttonType:"primary",onClick:()=>{R(void 0)},buttonText:"Add"}:U?{buttonType:"primary",onClick:()=>{G(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Add code",disabled:X,isLoading:null!==(F=j.loading)&&void 0!==F&&F,onClick:()=>{var e,t;B.isStaticCoupon?j.onSaveClicked({quadrant:B.quadrant,couponCode:B.couponCode,description:B.description,isStaticCoupon:B.isStaticCoupon,probability:B.probability,title:B.title}):j.onSaveClicked(Object.assign(Object.assign({},B),{description:f(B,j.currency,null!==(e=j.products)&&void 0!==e?e:[],null!==(t=j.collection)&&void 0!==t?t:[]),productsConf:{entitledProducts:J,prerequisiteProducts:$},collectionsConf:{entitledCollections:oe,prerequisiteCollections:ee}}))}},secondaryButton:x?{buttonType:"tertiaryGray",onClick:()=>{R(void 0)},buttonText:"Back"}:U?{buttonType:"tertiaryGray",onClick:()=>{G(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:j.onClose,buttonText:"Close"}},{children:[!x&&!U&&e(P,{children:[j.allowStaticCoupon&&!x&&e(I,Object.assign({selectedDiv:B.isStaticCoupon?1:2},{children:["static"===j.hideOption?t(o,{}):e("div",Object.assign({className:"coupon-type__container",onClick:()=>{B.isStaticCoupon||Y({isStaticCoupon:!0,quadrant:B.quadrant})}},{children:[t(u,Object.assign({style:B.isStaticCoupon?{color:C.colorsV2.content.brand}:{}},{children:"Static code"})),t(p,Object.assign({style:B.isStaticCoupon?{color:C.colorsV2.content.brand}:{}},{children:"One static code for all customers"}))]})),"dynamic"===j.hideOption?t(o,{}):e("div",Object.assign({className:"coupon-type__container",onClick:()=>{B.isStaticCoupon&&(z(d.AMOUNT_OFF_ORDER),Y({isStaticCoupon:!1,quadrant:B.quadrant,targetType:c.LINE_ITEM,targetSelection:l.ALL,valueType:s.FIXED_AMOUNT}))}},{children:[t(u,Object.assign({style:B.isStaticCoupon?{}:{color:C.colorsV2.content.brand}},{children:"Dynamic code"})),t(p,Object.assign({style:B.isStaticCoupon?{}:{color:C.colorsV2.content.brand}},{children:"New code generated for everyone"}))]}))]})),B.isStaticCoupon&&!x&&t(S,{discountData:B,setDiscountData:Y,hideProbability:j.hideProbability||!1,discountAdminUrl:j.discountAdminUrl}),!B.isStaticCoupon&&!x&&!U&&t(g,{currency:j.currency,entitledProducts:null!=J?J:[],prerequisiteProducts:null!=$?$:[],setEntitledProducts:W,setPrerequisiteProducts:Z,discountData:B,productPickerOpen:x,setIsProductPickerOpen:R,setDiscountData:Y,selectedCouponType:V,setSelectedCouponType:z,selectedMinimumRequirement:K,setSelectedMinimumRequirement:Q,hideProbability:j.hideProbability||!1,hideExpiration:j.hideExpiration||!1,allowStaticCoupon:j.allowStaticCoupon,onChangeCouponType:se,collectionPickerOpen:U,entitledCollections:null!=oe?oe:[],prerequisiteCollections:null!=ee?ee:[],setIsCollectionPickerOpen:G,setEntitledCollections:ie,setPrerequisiteCollections:te,useNewPicker:!!j.newPickerConf})]}),!!x&&e(o,{children:[!j.newPickerConf&&t("div",Object.assign({style:{padding:"12px 0"}},{children:t(m,{show:!0,onSave:()=>{},products:null!==(q=j.products)&&void 0!==q?q:[],title:"Select Products",onClose:()=>{R(void 0)},selectedProducts:null!==(M=x===E.ENTITLED?J:$)&&void 0!==M?M:[],setSelectedProducts:x===E.ENTITLED?W:Z,onSearchKeyChange:j.onProductSearch})})),j.newPickerConf&&t(T,{visible:!0,onClose:()=>R(void 0),collectionFetcher:j.newPickerConf.fetchCollections,productFetcher:j.newPickerConf.fetchProducts,selectedItems:x===E.ENTITLED?J:$,onAdd:e=>{x===E.ENTITLED?W(e):Z(e),R(void 0)},zIndex:200,storeId:j.newPickerConf.storeId,searchInCollectionFetcher:j.newPickerConf.searchInCollection,customCollectionRestriction:!1,searchFetcher:j.newPickerConf.searchProducts,hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!U&&t("div",Object.assign({style:{padding:"12px 0"}},{children:e(o,{children:[j.newPickerConf&&t(T,{visible:!0,onClose:()=>G(void 0),collectionFetcher:j.newPickerConf.fetchCollections,productFetcher:j.newPickerConf.fetchProducts,selectedItems:U===E.ENTITLED?oe:ee,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),U===E.ENTITLED?ie(e):te(e),G(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:j.newPickerConf.storeId,searchInCollectionFetcher:j.newPickerConf.searchInCollection,searchFetcher:j.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!j.newPickerConf&&t(m,{show:!0,onSave:()=>{},products:null!==(A=j.collection)&&void 0!==A?A:[],title:"Select Products",onClose:()=>{G(void 0)},selectedProducts:null!==(L=U===E.ENTITLED?oe:ee)&&void 0!==L?L:[],setSelectedProducts:U===E.ENTITLED?ie:te,onSearchKeyChange:j.onCollectionSearch,searchPlaceholder:"Search collections..."})]})}))]}))};export{j as DiscountModal};
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{MIN_PURCHASE_REQUIREMENT as r,DISCOUNT_TARGET_TYPES as d,DISCOUNT_TYPES as c,DISCOUNT_TARGET_SELECTION as l,DISCOUNT_VALUE_TYPES as s}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as a}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{TitleSmall as u,BodyCaption as p}from"../TypographyStyle.js";import{DEFAULT_THEME as v}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledModal as C}from"../modals/styledModal.js";import{ProductPickerContent as m}from"../product-picker/ProductPickerModal.js";import{Tag as h}from"../tag/Tag.js";import{Tooltip as b}from"../tooltips/Tooltip.js";import y from"../../assets/icons/triangle_error.svg.js";import{ProductPickerModal as T}from"../product-picker-v2/modal.js";import{StyledDiscountDialogueContainer as P,CouponTypeContainerStyled as f}from"./DiscountModal.styled.js";import{validateDiscountData as I,descriptionBuilder as O}from"./DiscountUtils.js";import g,{DISCOUNT_PRODUCTS as E}from"./DynamicCoupon/DynamicCoupon.js";import S from"./StaticCoupon/StaticCoupon.js";const j=j=>{var w,_,k,D,N,F,A,q,x,M;const[L,R]=i(),[U,G]=i(),[B,Y]=i(null!==(w=j.data)&&void 0!==w?w:"string"==typeof j.hideOption?{isStaticCoupon:"dynamic"===j.hideOption}:{isStaticCoupon:!1}),[X,H]=i(!0),[V,z]=i(),[K,Q]=i((null===(_=j.data)||void 0===_?void 0:_.minAmount)?r.AMOUNT:(null===(k=j.data)||void 0===k?void 0:k.minQuantity)?r.QUANTITY:r.NA),[$,Z]=i(void 0),[J,W]=i(void 0),[ee,te]=i(void 0),[oe,ie]=i(void 0),[ne,re]=i(0);n((()=>{let e;const{tempCouponData:t,discountType:o}=de();z(o),Y(Object.assign({},t)),j.hideProbability||(e=le()),H(I(t,K,o,j.hideProbability||!1,e,!!t.isStaticCoupon)),j.hideProbability||le()}),[]),n((()=>{let e;j.hideProbability||(e=le()),H(I(B,K,V,j.hideProbability||!1,e,!!B.isStaticCoupon))}),[B,ne,V,K]),n((()=>{var e,t,o,i,n,r,d;if(!j.newPickerConf&&((null===(e=j.products)||void 0===e?void 0:e.length)||(null===(t=j.collection)||void 0===t?void 0:t.length))){if(j.products&&(null===(o=j.products)||void 0===o?void 0:o.length)){if(null===(i=j.data)||void 0===i?void 0:i.entitledProductIds){const e=j.products.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.entitledProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));W(e)}if(null===(n=j.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=j.products.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));Z(e)}}if(j.collection&&j.collection.length){if(null===(r=j.data)||void 0===r?void 0:r.entitledCollectionIds){const e=j.collection.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));ie(e)}if(null===(d=j.data)||void 0===d?void 0:d.prerequisiteCollectionIds){const e=j.collection.filter((e=>{var t,o;return null===(o=null===(t=j.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===o?void 0:o.includes(parseInt(e.id))}));te(e)}}}}),[j.products,j.collection]),n((()=>{var e,t,o,i,n,r,d,c;(null===(t=null===(e=j.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&W(j.data.productsConf.entitledProducts),(null===(i=null===(o=j.data)||void 0===o?void 0:o.productsConf)||void 0===i?void 0:i.prerequisiteProducts)&&Z(j.data.productsConf.prerequisiteProducts),(null===(r=null===(n=j.data)||void 0===n?void 0:n.collectionsConf)||void 0===r?void 0:r.entitledCollections)&&ie(j.data.collectionsConf.entitledCollections),(null===(c=null===(d=j.data)||void 0===d?void 0:d.collectionsConf)||void 0===c?void 0:c.prerequisiteCollections)&&te(j.data.collectionsConf.prerequisiteCollections)}),[null===(D=j.data)||void 0===D?void 0:D.productsConf,null===(N=j.data)||void 0===N?void 0:N.collectionsConf]),n((()=>{if(!J)return;if(j.newPickerConf){const e=[];return Object.values(J).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void Y(Object.assign(Object.assign({},B),{entitledProductIds:e}))}const e=J.map((e=>parseInt(e.id)));Y(Object.assign(Object.assign({},B),{entitledProductIds:e}))}),[J]),n((()=>{if(!$)return;if(j.newPickerConf){const e=[];return Object.values($).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void Y(Object.assign(Object.assign({},B),{prerequisiteProductIds:e}))}const e=$.map((e=>parseInt(e.id)));Y(Object.assign(Object.assign({},B),{prerequisiteProductIds:e}))}),[$]),n((()=>{if(!oe)return;if(j.newPickerConf){(null==oe?void 0:oe.isCustom)&&delete oe.isCustom;const e=Object.keys(oe).map((e=>parseInt(e)));return void Y(Object.assign(Object.assign({},B),{entitledCollectionIds:e}))}const e=oe.map((e=>parseInt(e.id)));Y(Object.assign(Object.assign({},B),{entitledCollectionIds:e}))}),[oe]),n((()=>{if(!ee)return;if(j.newPickerConf){(null==ee?void 0:ee.isCustom)&&delete ee.isCustom;const e=Object.keys(ee).map((e=>parseInt(e)));return void Y(Object.assign(Object.assign({},B),{prerequisiteCollectionIds:e}))}const e=ee.map((e=>parseInt(e.id)));Y(Object.assign(Object.assign({},B),{prerequisiteCollectionIds:e}))}),[ee]);const de=()=>{var e,t;let o,i=B;return B.isStaticCoupon||(B.targetType===d.SHIPPING_LINE?o=c.FREE_SHIPPING:B.targetType===d.LINE_ITEM?o=B.targetSelection===l.ENTITLED?(null===(e=B.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=B.prerequisiteCollectionIds)||void 0===t?void 0:t.length)?c.BUY_X_GET_Y:c.AMOUNT_OFF_PRODUCTS:c.AMOUNT_OFF_ORDER:(i=Object.assign(Object.assign({},i),{targetType:d.LINE_ITEM,targetSelection:l.ALL,valueType:s.FIXED_AMOUNT}),o=c.AMOUNT_OFF_ORDER)),{discountType:o,tempCouponData:i}},ce=[{value:c.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:V===c.AMOUNT_OFF_ORDER},{value:c.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:V===c.AMOUNT_OFF_PRODUCTS},{value:c.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:V===c.BUY_X_GET_Y},{value:c.FREE_SHIPPING,label:"Free shipping",selected:V===c.FREE_SHIPPING}],le=()=>{if(!j.quadrant||!j.probability)return;const e=[...j.probability];let t=[];e.length>=j.quadrant&&e.splice(j.quadrant-1,1),t=e;const o=t.reduce(((e,t)=>e+t),0)+(B.probability||0);return re(parseFloat(o.toFixed(4))),parseFloat(o.toFixed(4))},se=e=>{var t,o,i,n;const a=e.value;z(a),Z([]),W([]),te([]),ie([]),Q(r.NA),a===c.FREE_SHIPPING?Y({value:100,targetSelection:l.ALL,targetType:d.SHIPPING_LINE,valueType:s.PERCENTAGE,quadrant:B.quadrant,isStaticCoupon:!1,title:"",expireAt:void 0,expireAfter:void 0}):a===c.BUY_X_GET_Y?Y({targetSelection:l.ENTITLED,targetType:d.LINE_ITEM,valueType:s.PERCENTAGE,quadrant:B.quadrant,isStaticCoupon:!1,title:"",expireAt:void 0,expireAfter:void 0}):a===c.AMOUNT_OFF_ORDER?Y({targetSelection:l.ALL,targetType:d.LINE_ITEM,valueType:null!==(o=null===(t=j.data)||void 0===t?void 0:t.valueType)&&void 0!==o?o:s.FIXED_AMOUNT,quadrant:B.quadrant,isStaticCoupon:!1,title:"",expireAt:void 0,expireAfter:void 0}):a===c.AMOUNT_OFF_PRODUCTS&&Y({targetSelection:l.ENTITLED,targetType:d.LINE_ITEM,valueType:null!==(n=null===(i=j.data)||void 0===i?void 0:i.valueType)&&void 0!==n?n:s.FIXED_AMOUNT,quadrant:B.quadrant,isStaticCoupon:!1,title:"",expireAt:void 0,expireAfter:void 0})};return e(C,Object.assign({width:(U||L)&&j.newPickerConf?"25px":"750px",open:j.isOpen,headingTitle:L?"Select Products":j.title,headingSubtitle:L?void 0:j.subTitle,footerLeftCustomElement:j.errorMsg?j.errorMsg&&t(h,{theme:"light",tagText:j.errorMsg,type:"negative"}):!j.quadrant||j.hideProbability?t(o,{}):ne<=1?t(h,{theme:"light",tagText:`Current probability sum: ${ne}`,type:"white"}):t(b,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:t("div",{children:t(h,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${ne}`,type:"negative",LeadingIcon:y})})})),headerRightCustomElement:j.allowStaticCoupon||L?void 0:t(a,{options:ce,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{se(e)}}),onClose:j.onClose,footerShadow:!0,primaryButton:L?{buttonType:"primary",onClick:()=>{R(void 0)},buttonText:"Add"}:U?{buttonType:"primary",onClick:()=>{G(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Add code",disabled:X,isLoading:null!==(F=j.loading)&&void 0!==F&&F,onClick:()=>{var e,t;B.isStaticCoupon?j.onSaveClicked({quadrant:B.quadrant,couponCode:B.couponCode,description:B.description,isStaticCoupon:B.isStaticCoupon,probability:B.probability,title:B.title}):j.onSaveClicked(Object.assign(Object.assign({},B),{description:O(B,j.currency,null!==(e=j.products)&&void 0!==e?e:[],null!==(t=j.collection)&&void 0!==t?t:[]),productsConf:{entitledProducts:J,prerequisiteProducts:$},collectionsConf:{entitledCollections:oe,prerequisiteCollections:ee}}))}},secondaryButton:L?{buttonType:"tertiaryGray",onClick:()=>{R(void 0)},buttonText:"Back"}:U?{buttonType:"tertiaryGray",onClick:()=>{G(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:j.onClose,buttonText:"Close"}},{children:[!L&&!U&&e(P,{children:[j.allowStaticCoupon&&!L&&e(f,Object.assign({selectedDiv:B.isStaticCoupon?1:2},{children:["static"===j.hideOption?t(o,{}):e("div",Object.assign({className:"coupon-type__container",onClick:()=>{B.isStaticCoupon||Y({isStaticCoupon:!0,quadrant:B.quadrant})}},{children:[t(u,Object.assign({style:B.isStaticCoupon?{color:v.colorsV2.content.brand}:{}},{children:"Static code"})),t(p,Object.assign({style:B.isStaticCoupon?{color:v.colorsV2.content.brand}:{}},{children:"One static code for all customers"}))]})),"dynamic"===j.hideOption?t(o,{}):e("div",Object.assign({className:"coupon-type__container",onClick:()=>{B.isStaticCoupon&&(z(c.AMOUNT_OFF_ORDER),Y({isStaticCoupon:!1,quadrant:B.quadrant,targetType:d.LINE_ITEM,targetSelection:l.ALL,valueType:s.FIXED_AMOUNT}))}},{children:[t(u,Object.assign({style:B.isStaticCoupon?{}:{color:v.colorsV2.content.brand}},{children:"Dynamic code"})),t(p,Object.assign({style:B.isStaticCoupon?{}:{color:v.colorsV2.content.brand}},{children:"New code generated for everyone"}))]}))]})),B.isStaticCoupon&&!L&&t(S,{discountData:B,setDiscountData:Y,hideProbability:j.hideProbability||!1,discountAdminUrl:j.discountAdminUrl}),!B.isStaticCoupon&&!L&&!U&&t(g,{currency:j.currency,entitledProducts:null!=J?J:[],prerequisiteProducts:null!=$?$:[],setEntitledProducts:W,setPrerequisiteProducts:Z,discountData:B,productPickerOpen:L,setIsProductPickerOpen:R,setDiscountData:Y,selectedCouponType:V,setSelectedCouponType:z,selectedMinimumRequirement:K,setSelectedMinimumRequirement:Q,hideProbability:j.hideProbability||!1,hideExpiration:j.hideExpiration||!1,allowStaticCoupon:j.allowStaticCoupon,onChangeCouponType:se,collectionPickerOpen:U,entitledCollections:null!=oe?oe:[],prerequisiteCollections:null!=ee?ee:[],setIsCollectionPickerOpen:G,setEntitledCollections:ie,setPrerequisiteCollections:te,useNewPicker:!!j.newPickerConf})]}),!!L&&e(o,{children:[!j.newPickerConf&&t("div",Object.assign({style:{padding:"12px 0"}},{children:t(m,{show:!0,onSave:()=>{},products:null!==(A=j.products)&&void 0!==A?A:[],title:"Select Products",onClose:()=>{R(void 0)},selectedProducts:null!==(q=L===E.ENTITLED?J:$)&&void 0!==q?q:[],setSelectedProducts:L===E.ENTITLED?W:Z,onSearchKeyChange:j.onProductSearch})})),j.newPickerConf&&t(T,{visible:!0,onClose:()=>R(void 0),collectionFetcher:j.newPickerConf.fetchCollections,productFetcher:j.newPickerConf.fetchProducts,selectedItems:L===E.ENTITLED?J:$,onAdd:e=>{L===E.ENTITLED?W(e):Z(e),R(void 0)},zIndex:200,storeId:j.newPickerConf.storeId,searchInCollectionFetcher:j.newPickerConf.searchInCollection,customCollectionRestriction:!1,searchFetcher:j.newPickerConf.searchProducts,hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!U&&t("div",Object.assign({style:{padding:"12px 0"}},{children:e(o,{children:[j.newPickerConf&&t(T,{visible:!0,onClose:()=>G(void 0),collectionFetcher:j.newPickerConf.fetchCollections,productFetcher:j.newPickerConf.fetchProducts,selectedItems:U===E.ENTITLED?oe:ee,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),U===E.ENTITLED?ie(e):te(e),G(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:j.newPickerConf.storeId,searchInCollectionFetcher:j.newPickerConf.searchInCollection,searchFetcher:j.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!j.newPickerConf&&t(m,{show:!0,onSave:()=>{},products:null!==(x=j.collection)&&void 0!==x?x:[],title:"Select Products",onClose:()=>{G(void 0)},selectedProducts:null!==(M=U===E.ENTITLED?oe:ee)&&void 0!==M?M:[],setSelectedProducts:U===E.ENTITLED?ie:te,onSearchKeyChange:j.onCollectionSearch,searchPlaceholder:"Search collections..."})]})}))]}))};export{j as DiscountModal};