@bikdotai/bik-component-library 0.0.418 → 0.0.419-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/cjs/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/add-variableV2/AddVariableV2.js +1 -1
  5. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  6. package/dist/cjs/components/custom-date-time/CustomDateTime.js +1 -1
  7. package/dist/cjs/components/input/Input.js +1 -1
  8. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +4 -3
  9. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  10. package/dist/cjs/components/template-context-mapper/carousel/CarouselPreview.d.ts +12 -0
  11. package/dist/cjs/components/template-context-mapper/carousel/CarouselPreview.js +9 -0
  12. package/dist/cjs/components/template-context-mapper/carousel/CarouselPreviewCard.d.ts +10 -0
  13. package/dist/cjs/components/template-context-mapper/carousel/CarouselPreviewCard.js +15 -0
  14. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +15 -8
  15. package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.d.ts +12 -0
  16. package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -0
  17. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +7 -7
  18. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.js +3 -3
  19. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.d.ts +14 -0
  20. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -0
  21. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +2 -1
  22. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  23. package/dist/cjs/components/template-context-mapper/modalElements/Footer.d.ts +2 -1
  24. package/dist/cjs/components/template-context-mapper/modalElements/Footer.js +4 -4
  25. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.d.ts +2 -1
  26. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +1 -1
  27. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +1 -1
  28. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  29. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.d.ts +0 -1
  30. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  31. package/dist/cjs/components/template-context-mapper/modalElements/VariableEditorHeader.js +1 -1
  32. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts +2 -1
  33. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  34. package/dist/cjs/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  35. package/dist/cjs/components/template-context-mapper/utils/getPreviewDimension.d.ts +1 -1
  36. package/dist/cjs/components/template-context-mapper/utils/getPreviewDimension.js +1 -1
  37. package/dist/cjs/components/template-preview/TemplatePreview.d.ts +4 -2
  38. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  39. package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.d.ts +5 -1
  40. package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js +14 -6
  41. package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
  42. package/dist/cjs/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.d.ts +9 -0
  43. package/dist/cjs/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.js +20 -0
  44. package/dist/cjs/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +4 -6
  45. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.d.ts +1 -0
  46. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  47. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +7 -0
  48. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  49. package/dist/cjs/components/template-preview/models/TemplateMeta.d.ts +1 -1
  50. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +27 -4
  51. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.js +1 -1
  52. package/dist/cjs/components/template-preview/models/WhatsappCarouselTemplate.d.ts +80 -0
  53. package/dist/esm/assets/icons/copy-code-icon.svg.js +1 -0
  54. package/dist/esm/assets/icons/lto_icon.svg.js +1 -0
  55. package/dist/esm/components/TablePagination/TablePagination.js +1 -1
  56. package/dist/esm/components/add-variableV2/AddVariableV2.js +1 -1
  57. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  58. package/dist/esm/components/custom-date-time/CustomDateTime.js +1 -1
  59. package/dist/esm/components/input/Input.js +1 -1
  60. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +4 -3
  61. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  62. package/dist/esm/components/template-context-mapper/carousel/CarouselPreview.d.ts +12 -0
  63. package/dist/esm/components/template-context-mapper/carousel/CarouselPreview.js +9 -0
  64. package/dist/esm/components/template-context-mapper/carousel/CarouselPreviewCard.d.ts +10 -0
  65. package/dist/esm/components/template-context-mapper/carousel/CarouselPreviewCard.js +15 -0
  66. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +15 -8
  67. package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.d.ts +12 -0
  68. package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -0
  69. package/dist/esm/components/template-context-mapper/modalElements/Body.js +8 -8
  70. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.js +3 -3
  71. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.d.ts +14 -0
  72. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -0
  73. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +2 -1
  74. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  75. package/dist/esm/components/template-context-mapper/modalElements/Footer.d.ts +2 -1
  76. package/dist/esm/components/template-context-mapper/modalElements/Footer.js +4 -4
  77. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.d.ts +2 -1
  78. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +1 -1
  79. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +1 -1
  80. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  81. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.d.ts +0 -1
  82. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  83. package/dist/esm/components/template-context-mapper/modalElements/VariableEditorHeader.js +1 -1
  84. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts +2 -1
  85. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  86. package/dist/esm/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  87. package/dist/esm/components/template-context-mapper/utils/getPreviewDimension.d.ts +1 -1
  88. package/dist/esm/components/template-context-mapper/utils/getPreviewDimension.js +1 -1
  89. package/dist/esm/components/template-preview/TemplatePreview.d.ts +4 -2
  90. package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
  91. package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.d.ts +5 -1
  92. package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js +21 -13
  93. package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
  94. package/dist/esm/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.d.ts +9 -0
  95. package/dist/esm/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.js +20 -0
  96. package/dist/esm/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +3 -5
  97. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.d.ts +1 -0
  98. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  99. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +7 -0
  100. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  101. package/dist/esm/components/template-preview/models/TemplateMeta.d.ts +1 -1
  102. package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +27 -4
  103. package/dist/esm/components/template-preview/models/WhatsAppTemplate.js +1 -1
  104. package/dist/esm/components/template-preview/models/WhatsappCarouselTemplate.d.ts +80 -0
  105. package/package.json +1 -1
  106. package/dist/cjs/assets/icons/video_camcorder.svg.js +0 -1
  107. package/dist/esm/assets/icons/video_camcorder.svg.js +0 -1
@@ -0,0 +1,80 @@
1
+ import { HEADER_TYPES, TEMPLATE_STATUS, WhatsAppTemplateVariables } from "..";
2
+ import { CHANNEL_TYPE } from "./Channels";
3
+ import { CUSTOM_VARIABLE } from './TemplateMeta';
4
+ export type WhatsAppCarouselTemplate = {
5
+ name: string;
6
+ label: string;
7
+ recommended?: boolean;
8
+ templateId?: string;
9
+ channel: CHANNEL_TYPE;
10
+ templateCategory: string;
11
+ type?: 'email' | 'whatsapp';
12
+ components: {
13
+ type: 'BODY' | 'CAROUSEL';
14
+ format?: HEADER_TYPES;
15
+ text?: string;
16
+ example?: {
17
+ header_handle?: Array<string>;
18
+ body_text?: Array<string[]>;
19
+ header_text?: Array<string>;
20
+ };
21
+ cards?: {
22
+ components: {
23
+ type: 'HEADER' | 'BODY' | 'BUTTONS' | 'FOOTER';
24
+ format?: HEADER_TYPES;
25
+ text?: string;
26
+ buttons?: {
27
+ type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER';
28
+ text?: string;
29
+ url?: string;
30
+ example?: string[];
31
+ linkMode?: 'custom' | 'home';
32
+ phone_number?: string;
33
+ flowName?: string;
34
+ flowId?: string;
35
+ }[];
36
+ example?: {
37
+ header_handle?: Array<string>;
38
+ body_text?: Array<string[]>;
39
+ header_text?: Array<string>;
40
+ };
41
+ }[];
42
+ }[];
43
+ }[];
44
+ mapping: {
45
+ header?: string[];
46
+ body?: string[];
47
+ buttons?: string[];
48
+ cards?: {
49
+ header?: string[];
50
+ body?: string[];
51
+ buttons?: string[];
52
+ }[];
53
+ };
54
+ templateComponentValues: {
55
+ components: {
56
+ header?: string[];
57
+ body?: string[];
58
+ buttons?: string[];
59
+ cards?: {
60
+ header?: string[];
61
+ body?: string[];
62
+ buttons?: string[];
63
+ }[];
64
+ };
65
+ };
66
+ htmlContentUrl?: string;
67
+ language: 'en_US';
68
+ status: TEMPLATE_STATUS;
69
+ category: string;
70
+ thumbnailImageUrl?: string;
71
+ FB_blob_key?: string;
72
+ reason?: string;
73
+ createdAt: number;
74
+ updatedAt: number;
75
+ isDraft?: boolean;
76
+ };
77
+ export interface WhatsAppCarouselTemplateVariables {
78
+ body: CUSTOM_VARIABLE[];
79
+ cards: WhatsAppTemplateVariables[];
80
+ }
@@ -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 +1 @@
1
- import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as a,jsxs as i,Fragment as s}from"react/jsx-runtime";import l from"../../assets/icons/back_icon.svg.js";import t from"../../assets/icons/chevronRightAlt.svg.js";import n from"../../assets/icons/cross.svg.js";import r from"../../assets/icons/plus.svg.js";import o from"../../assets/icons/undo.svg.js";import{memo as c,useState as d,useEffect as b}from"react";import{AddVariableStyled as v}from"./AddVariableV2.styled.js";import{Button as m}from"../button/Button.js";import{IconButton as h}from"../icon-button/IconButton.js";import{SearchBar as g}from"../searchBar/searchBar.js";import{Tooltip as p}from"../tooltips/Tooltip.js";import{COLORS as u}from"../../constants/Theme.js";import{CloseButtonContainer as y}from"../modals/modal.styled.js";import{Switch as j}from"../switch/Switch.js";import{BodySecondary as f,TitleSmall as O,BodyCaption as N}from"../TypographyStyle.js";const V=c((c=>{const{data:V,hasHeader:w=!0,needsBorder:S=!0,styledCloseBtn:_=!1,readonly:C=!1}=c,[T,k]=d({}),[x,L]=d(),[B,I]=d(""),[A,F]=d(""),[H,E]=d(!0),z=/^[^.]*\.[^.]*$/,[P,R]=d(c.data),[$,M]=d(!0);b((()=>{const e={};V.forEach((a=>{e[a.displayName]=[]})),L(e)}),[V]),b((()=>{G(!0)}),[]),b((()=>{G($,!B)}),[T,B]),b((()=>{M(!0),F(""),D([],B),L((e=>Object.assign(Object.assign({},e),{[B]:[]}))),I("");const e=c.data.map((e=>J(e))).filter((e=>null!==e));R(e),e.length>0?E(!0):E(!1)}),[c.reRender]),b((()=>{let e=c.data;B&&(e=[T[B]]);W(e,$).length>0?E(!0):E(!1)}),[A]);const W=function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.flatMap((e=>Object.keys(e.variables).filter((i=>{var s;return(null===(s=e.variables[i].displayName)||void 0===s?void 0:s.toLowerCase().includes(A.toLowerCase()))&&(!a||e.variables[i].isAvailable===a)||q(e.variables[i])}))))},D=(e,a)=>{const i=V.find((e=>e.displayName===a));if(i){let s=i;e.forEach(((e,a)=>{s=s.variables[e]})),k((e=>Object.assign(Object.assign({},e),{[a]:s})))}},q=e=>{let a=!1;if(e.isSubHeader&&e.variables){const i=Object.keys(e.variables);for(let s=0;s<i.length;s++){const l=i[s];if(e.variables&&e.variables[l].displayName.toLowerCase().includes(A.toLowerCase())&&e.variables[l].isAvailable===$){a=!0;break}}}return a},G=function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(M(e),e){let i=[];if(!B||a)i=c.data.map((e=>J(e))).filter((e=>null!==e));else{const e=T[B];i=c.data.filter((e=>e.displayName===B)).map((a=>J(a,e))).filter((e=>null!=e))}R(i),A&&(i=W(i,e)),i.length>0?E(!0):E(!1)}else if(R(c.data),A){W(c.data,e).length>0?E(!0):E(!1)}else E(!0)};function J(e,a){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(a)for(const s in e.variables)if(e.variables[s].displayName===a.displayName)for(const a in e.variables[s].variables)e.variables[s].variables[a].isAvailable&&(i[a]=e.variables[s].variables[a]);else e.variables[s].isSubHeader&&J(e.variables[s],a,i);else for(const a in e.variables)e.variables[a].isAvailable&&(i[a]=e.variables[a]);return 0===Object.keys(i).length?null:Object.assign(Object.assign({},e),{variables:i})}const K=e=>{const i=e.item.description;return e.readonly?a("div",{children:a(Q,{item:e.item,readonly:e.readonly})}):a(s,{children:a(p,Object.assign({body:"",tooltipContent:a(N,Object.assign({color:u.content.primaryInverse,style:{whiteSpace:"pre-line",padding:8}},{children:e.item.isAvailable?i?`• ${i}\n• Recommended here`:"Recommended here":"Not recommended here"})),width:300,delay:300,placement:"bottom"},{children:a("div",{children:a(Q,{item:e.item})})}))})},Q=e=>a(m,{darkMode:c.enableVariable?c.enableVariable:e.item.isAvailable,size:"chip",disabled:!!e.readonly&&!e.item.isSubHeader,LeadingIcon:e.item.isSubHeader||e.readonly?void 0:r,TrailingIcon:()=>e.item.isSubHeader?a("div",Object.assign({className:"icon-trailing",style:{display:"flex"}},{children:a(t,{})})):a(s,{}),buttonText:e.item.displayName}),U=(e,i)=>$&&!e.isAvailable?a(s,{}):a("div",Object.assign({onClick:e.isSubHeader?()=>{W([e],$).length||E(!1),F("");const a=[...x[B],i];D(a,B),L((e=>Object.assign(Object.assign({},e),{[B]:a})))}:()=>{c.customTrigger?(c.customTrigger(e),c.setShowVariable(!1)):c.isEvaluationList?Y(e):c.setVariableValue(c.selectWithTypes?{actualValue:e.actualValue,variableType:e.variableType,needsFetching:e.needsFetching}:e.actualValue)}},{children:a(K,{item:e,readonly:C})})),X=(e,a)=>{const i=[...x[e.displayName],a];D(i,e.displayName),L((a=>Object.assign(Object.assign({},a),{[e.displayName]:i}))),I(e.displayName)},Y=e=>{if(e.actualValue.match(z)){const a=e.actualValue.replace("{{","").replace("}}","").split("."),i=a[0]+`['${a[1]}']`;c.setVariableValue(c.selectWithTypes?{actualValue:i,variableType:e.variableType,needsFetching:e.needsFetching}:i)}else{const a=e.actualValueEval?e.actualValueEval:e.actualValue;c.setVariableValue(c.selectWithTypes?{actualValue:a,variableType:e.variableType,needsFetching:e.needsFetching}:a)}},Z=(e,a)=>{if(c.customTrigger)c.customTrigger(e.variables[a]),c.setShowVariable(!1);else if(c.isEvaluationList){const i=e.variables[a];Y(i)}else c.setVariableValue(c.selectWithTypes?{actualValue:e.variables[a].actualValue,variableType:e.variables[a].variableType,needsFetching:e.variables[a].needsFetching}:e.variables[a].actualValue)},ee=c.isModalState?void 0:{top:`${c.topPosition?c.topPosition:"small"===c.pickerSize?"300px":"60px"}`,left:`${c.leftPosition?c.leftPosition+24:430}px`};return a("div",Object.assign({id:"varList",tabIndex:-1},{children:i(v,Object.assign({style:ee,onClick:e=>{e.stopPropagation()},pickerSize:c.pickerSize||"large",isModalState:c.isModalState,positionStrategy:c.positionStrategy,zIndex:c.zindex,height:c.height,needsBorder:S,width:c.width},{children:[_&&a(y,Object.assign({onClick:()=>{c.setShowVariable(!1)},style:{zIndex:300}},{children:a(n,{height:20,width:20,color:u.content.secondary})})),c.showVariable&&i("div",Object.assign({className:"popup"},{children:[i("div",Object.assign({className:"sticky__bar"},{children:[w&&i("div",Object.assign({className:"header__bar"},{children:[a("div",Object.assign({className:"add__variable"},{children:"Add a new variable"})),!_&&a("div",Object.assign({onClick:()=>{c.setShowVariable(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center"}},{children:a(h,{iconButtonType:"default",Icon:n})}))]})),i("div",Object.assign({className:"search__bar",onBlur:e=>{c.onSearchBlur&&c.onSearchBlur(e)}},{children:[a(g,{width:"100%",isEnabled:!0,onChange:e=>{F(e)},onEnter:()=>{},reset:!A,placeholder:"Search...",variant:"default"}),i("div",Object.assign({style:{display:"flex",alignItems:"center",marginTop:8,justifyContent:"space-between"}},{children:[a(f,Object.assign({style:{color:u.content.secondary}},{children:"Show only recommended variables"})),a(j,{value:$,onValueChange:a=>e(void 0,void 0,void 0,(function*(){return yield G(a)}))})]}))]})),B&&x[B].length>0&&i("div",Object.assign({className:"nav__bar"},{children:[i("div",Object.assign({className:"left__nav"},{children:[a(h,{Icon:l,style:{color:"#919191",display:"flex"},onClick:()=>{F("");const e=x[B].slice(0,-1);D(e,B),L((a=>Object.assign(Object.assign({},a),{[B]:e}))),e.length||I("")}}),i("div",Object.assign({className:"block"},{children:[a(O,{children:T[B].displayName}),T[B].description&&a(N,{children:T[B].description})]}))]})),i("div",Object.assign({className:"right__nav"},{children:[a(h,{Icon:o,style:{display:"flex"},onClick:()=>{F(""),D([],B),L((e=>Object.assign(Object.assign({},e),{[B]:[]}))),I("")}}),a("div",{children:"First page"})]}))]}))]})),!H&&i("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",marginTop:16}},{children:[a(O,{children:"No results found!"}),a(N,$?{children:"Sorry we could not find any recommended variables"}:{children:`Sorry we could not find any results for "${A}"`})]})),a("div",Object.assign({className:"wrapper"},{children:a("div",Object.assign({className:"list__map"},{children:i("div",Object.assign({className:"items"},{children:[!B&&P.map((e=>{let l=[];return A&&(l=Object.keys(e.variables).filter((a=>{var i;return(null===(i=e.variables[a].displayName)||void 0===i?void 0:i.toLowerCase().includes(A.toLowerCase()))||q(e.variables[a])}))),i(s,{children:[A?l.length>0?i("div",Object.assign({className:"block"},{children:[a("div",Object.assign({className:"heading__font"},{children:null==e?void 0:e.displayName})),a(N,Object.assign({style:{marginBottom:8,color:"#616161"}},{children:null==e?void 0:e.description}))]})):a(s,{}):i("div",Object.assign({className:"block"},{children:[a("div",Object.assign({className:"heading__font"},{children:null==e?void 0:e.displayName})),a(N,Object.assign({style:{marginBottom:8,color:"#616161"}},{children:null==e?void 0:e.description}))]})),Object.keys(e.variables).map((i=>{var l;return A?(null===(l=e.variables[i].displayName)||void 0===l?void 0:l.toLowerCase().includes(A.toLowerCase()))||q(e.variables[i])?a("div",Object.assign({onClick:e.variables[i].isSubHeader?()=>X(e,i):()=>Z(e,i)},{children:a(K,{item:e.variables[i],readonly:C})})):a(s,{}):a("div",Object.assign({onClick:e.variables[i].isSubHeader?()=>X(e,i):()=>Z(e,i)},{children:a(K,{item:e.variables[i],readonly:C})}))}))]})})),B&&a("div",Object.assign({className:"list__map"},{children:a("div",Object.assign({className:"items",style:{marginTop:16}},{children:Object.keys(T[B].variables).map(((e,i)=>{var l;return A?(null===(l=T[B].variables[e].displayName)||void 0===l?void 0:l.toLowerCase().includes(A.toLowerCase()))||q(T[B].variables[e])?U(T[B].variables[e],e):a(s,{}):U(T[B].variables[e],e)}))}))}))]}))}))})),a("div",{className:"bottom__padding"})]}))]}))}))}),((e,a)=>e.enableVariable===a.enableVariable&&(e.leftPosition===a.leftPosition&&e.reRender===a.reRender)));export{V as AddVariableV2};
1
+ import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as a,jsxs as i,Fragment as s}from"react/jsx-runtime";import l from"../../assets/icons/back_icon.svg.js";import t from"../../assets/icons/chevronRightAlt.svg.js";import n from"../../assets/icons/cross.svg.js";import r from"../../assets/icons/plus.svg.js";import o from"../../assets/icons/undo.svg.js";import{memo as c,useState as d,useEffect as b}from"react";import{AddVariableStyled as v}from"./AddVariableV2.styled.js";import{Button as m}from"../button/Button.js";import{IconButton as h}from"../icon-button/IconButton.js";import{SearchBar as g}from"../searchBar/searchBar.js";import{Tooltip as p}from"../tooltips/Tooltip.js";import{COLORS as u}from"../../constants/Theme.js";import{CloseButtonContainer as y}from"../modals/modal.styled.js";import{Switch as j}from"../switch/Switch.js";import{BodySecondary as f,TitleSmall as O,BodyCaption as N}from"../TypographyStyle.js";const V=c((c=>{const{data:V,hasHeader:w=!0,needsBorder:S=!0,styledCloseBtn:_=!1,readonly:T=!1}=c,[C,k]=d({}),[x,L]=d(),[B,I]=d(""),[A,F]=d(""),[H,E]=d(!0),z=/^[^.]*\.[^.]*$/,[P,R]=d(c.data),[$,M]=d(!0);b((()=>{const e={};V.forEach((a=>{e[a.displayName]=[]})),L(e)}),[V]),b((()=>{G(!0)}),[]),b((()=>{G($,!B)}),[C,B]),b((()=>{M(!0),F(""),D([],B),L((e=>Object.assign(Object.assign({},e),{[B]:[]}))),I("");const e=c.data.map((e=>J(e))).filter((e=>null!==e));R(e),e.length>0?E(!0):E(!1)}),[c.reRender]),b((()=>{let e=c.data;B&&(e=[C[B]]);W(e,$).length>0?E(!0):E(!1)}),[A]);const W=function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.flatMap((e=>Object.keys(e.variables).filter((i=>{var s;return(null===(s=e.variables[i].displayName)||void 0===s?void 0:s.toLowerCase().includes(A.toLowerCase()))&&(!a||e.variables[i].isAvailable===a)||q(e.variables[i])}))))},D=(e,a)=>{const i=V.find((e=>e.displayName===a));if(i){let s=i;e.forEach(((e,a)=>{s=s.variables[e]})),k((e=>Object.assign(Object.assign({},e),{[a]:s})))}},q=e=>{let a=!1;if(e.isSubHeader&&e.variables){const i=Object.keys(e.variables);for(let s=0;s<i.length;s++){const l=i[s];if(e.variables&&e.variables[l].displayName.toLowerCase().includes(A.toLowerCase())&&e.variables[l].isAvailable===$){a=!0;break}}}return a},G=function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(M(e),e){let i=[];if(!B||a)i=c.data.map((e=>J(e))).filter((e=>null!==e));else{const e=C[B];i=c.data.filter((e=>e.displayName===B)).map((a=>J(a,e))).filter((e=>null!=e))}R(i),A&&(i=W(i,e)),i.length>0?E(!0):E(!1)}else if(R(c.data),A){W(c.data,e).length>0?E(!0):E(!1)}else E(!0)};function J(e,a){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(a)for(const s in e.variables)if(e.variables[s].displayName===a.displayName)for(const a in e.variables[s].variables)e.variables[s].variables[a].isAvailable&&(i[a]=e.variables[s].variables[a]);else e.variables[s].isSubHeader&&J(e.variables[s],a,i);else for(const a in e.variables)e.variables[a].isAvailable&&(i[a]=e.variables[a]);return 0===Object.keys(i).length?null:Object.assign(Object.assign({},e),{variables:i})}const K=e=>{const i=e.item.description;return e.readonly?a("div",{children:a(Q,{item:e.item,readonly:e.readonly})}):a(s,{children:a(p,Object.assign({body:"",tooltipContent:a(N,Object.assign({color:u.content.primaryInverse,style:{whiteSpace:"pre-line",padding:8}},{children:e.item.isAvailable?i?`• ${i}\n• Recommended here`:"Recommended here":"Not recommended here"})),width:300,delay:300,placement:"bottom"},{children:a("div",{children:a(Q,{item:e.item})})}))})},Q=e=>a(m,{darkMode:c.enableVariable?c.enableVariable:e.item.isAvailable,size:"chip",disabled:!!e.readonly&&!e.item.isSubHeader,LeadingIcon:e.item.isSubHeader||e.readonly?void 0:r,TrailingIcon:()=>e.item.isSubHeader?a("div",Object.assign({className:"icon-trailing",style:{display:"flex"}},{children:a(t,{})})):a(s,{}),buttonText:e.item.displayName}),U=(e,i)=>$&&!e.isAvailable?a(s,{}):a("div",Object.assign({onClick:e.isSubHeader?()=>{W([e],$).length||E(!1),F("");const a=[...x[B],i];D(a,B),L((e=>Object.assign(Object.assign({},e),{[B]:a})))}:()=>{c.customTrigger?(c.customTrigger(e),c.setShowVariable(!1)):c.isEvaluationList?Y(e):c.setVariableValue(c.selectWithTypes?{actualValue:e.actualValue,variableType:e.variableType,needsFetching:e.needsFetching}:e.actualValue)}},{children:a(K,{item:e,readonly:T})})),X=(e,a)=>{const i=[...x[e.displayName],a];D(i,e.displayName),L((a=>Object.assign(Object.assign({},a),{[e.displayName]:i}))),I(e.displayName)},Y=e=>{if(e.actualValue.match(z)){const a=e.actualValue.replace("{{","").replace("}}","").split("."),i=a[0]+`['${a[1]}']`;c.setVariableValue(c.selectWithTypes?{actualValue:i,variableType:e.variableType,needsFetching:e.needsFetching}:i)}else{const a=e.actualValueEval?e.actualValueEval:e.actualValue;c.setVariableValue(c.selectWithTypes?{actualValue:a,variableType:e.variableType,needsFetching:e.needsFetching}:a)}},Z=(e,a)=>{if(c.customTrigger)console.log("props.customTrigger"),c.customTrigger(e.variables[a]),c.setShowVariable(!1);else if(c.isEvaluationList){const i=e.variables[a];Y(i)}else c.setVariableValue(c.selectWithTypes?{actualValue:e.variables[a].actualValue,variableType:e.variables[a].variableType,needsFetching:e.variables[a].needsFetching}:e.variables[a].actualValue)},ee=c.isModalState?void 0:{top:`${c.topPosition?c.topPosition:"small"===c.pickerSize?"300px":"60px"}`,left:`${c.leftPosition?c.leftPosition+24:430}px`};return a("div",Object.assign({id:"varList",tabIndex:-1},{children:i(v,Object.assign({style:ee,onClick:e=>{e.stopPropagation()},pickerSize:c.pickerSize||"large",isModalState:c.isModalState,positionStrategy:c.positionStrategy,zIndex:c.zindex,height:c.height,needsBorder:S,width:c.width},{children:[_&&a(y,Object.assign({onClick:()=>{c.setShowVariable(!1)},style:{zIndex:300}},{children:a(n,{height:20,width:20,color:u.content.secondary})})),c.showVariable&&i("div",Object.assign({className:"popup"},{children:[i("div",Object.assign({className:"sticky__bar"},{children:[w&&i("div",Object.assign({className:"header__bar"},{children:[a("div",Object.assign({className:"add__variable"},{children:"Add a new variable"})),!_&&a("div",Object.assign({onClick:()=>{c.setShowVariable(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center"}},{children:a(h,{iconButtonType:"default",Icon:n})}))]})),i("div",Object.assign({className:"search__bar",onBlur:e=>{c.onSearchBlur&&c.onSearchBlur(e)}},{children:[a(g,{width:"100%",isEnabled:!0,onChange:e=>{F(e)},onEnter:()=>{},reset:!A,placeholder:"Search...",variant:"default"}),i("div",Object.assign({style:{display:"flex",alignItems:"center",marginTop:8,justifyContent:"space-between"}},{children:[a(f,Object.assign({style:{color:u.content.secondary}},{children:"Show only recommended variables"})),a(j,{value:$,onValueChange:a=>e(void 0,void 0,void 0,(function*(){return yield G(a)}))})]}))]})),B&&x[B].length>0&&i("div",Object.assign({className:"nav__bar"},{children:[i("div",Object.assign({className:"left__nav"},{children:[a(h,{Icon:l,style:{color:"#919191",display:"flex"},onClick:()=>{F("");const e=x[B].slice(0,-1);D(e,B),L((a=>Object.assign(Object.assign({},a),{[B]:e}))),e.length||I("")}}),i("div",Object.assign({className:"block"},{children:[a(O,{children:C[B].displayName}),C[B].description&&a(N,{children:C[B].description})]}))]})),i("div",Object.assign({className:"right__nav"},{children:[a(h,{Icon:o,style:{display:"flex"},onClick:()=>{F(""),D([],B),L((e=>Object.assign(Object.assign({},e),{[B]:[]}))),I("")}}),a("div",{children:"First page"})]}))]}))]})),!H&&i("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",marginTop:16}},{children:[a(O,{children:"No results found!"}),a(N,$?{children:"Sorry we could not find any recommended variables"}:{children:`Sorry we could not find any results for "${A}"`})]})),a("div",Object.assign({className:"wrapper"},{children:a("div",Object.assign({className:"list__map"},{children:i("div",Object.assign({className:"items"},{children:[!B&&P.map((e=>{let l=[];return A&&(l=Object.keys(e.variables).filter((a=>{var i;return(null===(i=e.variables[a].displayName)||void 0===i?void 0:i.toLowerCase().includes(A.toLowerCase()))||q(e.variables[a])}))),i(s,{children:[A?l.length>0?i("div",Object.assign({className:"block"},{children:[a("div",Object.assign({className:"heading__font"},{children:null==e?void 0:e.displayName})),a(N,Object.assign({style:{marginBottom:8,color:"#616161"}},{children:null==e?void 0:e.description}))]})):a(s,{}):i("div",Object.assign({className:"block"},{children:[a("div",Object.assign({className:"heading__font"},{children:null==e?void 0:e.displayName})),a(N,Object.assign({style:{marginBottom:8,color:"#616161"}},{children:null==e?void 0:e.description}))]})),Object.keys(e.variables).map((i=>{var l;return A?(null===(l=e.variables[i].displayName)||void 0===l?void 0:l.toLowerCase().includes(A.toLowerCase()))||q(e.variables[i])?a("div",Object.assign({onClick:e.variables[i].isSubHeader?()=>X(e,i):()=>Z(e,i)},{children:a(K,{item:e.variables[i],readonly:T})})):a(s,{}):a("div",Object.assign({onClick:e.variables[i].isSubHeader?()=>X(e,i):()=>Z(e,i)},{children:a(K,{item:e.variables[i],readonly:T})}))}))]})})),B&&a("div",Object.assign({className:"list__map"},{children:a("div",Object.assign({className:"items",style:{marginTop:16}},{children:Object.keys(C[B].variables).map(((e,i)=>{var l;return A?(null===(l=C[B].variables[e].displayName)||void 0===l?void 0:l.toLowerCase().includes(A.toLowerCase()))||q(C[B].variables[e])?U(C[B].variables[e],e):a(s,{}):U(C[B].variables[e],e)}))}))}))]}))}))})),a("div",{className:"bottom__padding"})]}))]}))}))}),((e,a)=>e.enableVariable===a.enableVariable&&(e.leftPosition===a.leftPosition&&e.reRender===a.reRender)));export{V as AddVariableV2};
@@ -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{jsxs as e,jsx as o}from"react/jsx-runtime";import{format as t,isToday as r}from"date-fns";import{useState as n,useEffect as s}from"react";import i from"./DateSelector/DateSelector.js";import{DropdownPopover as m}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{BodySecondary as p}from"../TypographyStyle.js";import"../../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 as d}from"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import l from"../../utils/DateUtils.js";import c from"../../assets/icons/chevronDown.svg.js";import a from"../../assets/icons/clock.svg.js";import{CustomDateTimeStyle as u}from"./CustomDateTime.styled.js";const j=()=>{const e=[];for(let o=0;o<2;o++)for(let t=0;t<12;t++){let r;r=0===t?"12":t<10?`0${t}`:`${t}`;const n=`${r}:00 ${0===o?"AM":"PM"}`,s=`${r}:30 ${0===o?"AM":"PM"}`;e.push({label:n,value:n,selected:!1},{label:s,value:s,selected:!1})}return e},w=w=>{const[D,f]=n(w.time),[h,v]=n(w.date);s((()=>{w.setError(void 0);const e=l.convert12HourTimeTo24Hour(D),o=t(new Date,"HH:mm:ss");if(r(h)&&e<o)return void w.setError("Selected time should be later than current time");w.setError(void 0);const[n,s]=e.split(":"),i=new Date(h.getTime());i.setHours(+n,+s),w.onChange(i)}),[h,D]);return e(u,{children:[e("div",Object.assign({style:{display:"flex",gap:16}},{children:[o("div",Object.assign({style:{flex:1}},{children:o(i,{customDate:h,setCustomDate:v,placement:w.placement,minDate:w.minDate})})),o("div",Object.assign({style:{flex:1}},{children:o(m,Object.assign({options:j(),onSelect:e=>{f(e.value)}},{children:o(d,{value:D,leftIcon:{icon:a},rightIcon:{icon:c},onChangeText:e=>(e=>{if(l.timeFormatValidation(e)){const o=l.convert12HourTimeTo24Hour(e),n=t(new Date,"HH:mm:ss");if(r(h)&&o<n)return void w.setError("Selected time should be later than current time");w.setError(void 0),f(e)}else w.setError('Format of time should be "HH:MM AM" or "HH:MM PM"')})(e)})}))}))]})),w.error&&o(p,Object.assign({style:{paddingTop:8}},{children:w.error}))]})};export{w as CustomDateTime};
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import{format as t,isToday as r}from"date-fns";import{useState as n,useEffect as s}from"react";import i from"./DateSelector/DateSelector.js";import{DropdownPopover as m}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{BodySecondary as p}from"../TypographyStyle.js";import"../../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 as d}from"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import l from"../../utils/DateUtils.js";import c from"../../assets/icons/chevronDown.svg.js";import a from"../../assets/icons/clock.svg.js";import{CustomDateTimeStyle as u}from"./CustomDateTime.styled.js";const j=e=>{const o=[];for(let t=0;t<2;t++)for(let r=0;r<12;r++){let n;n=0===r?"12":r<10?`0${r}`:`${r}`;const s=`${n}:00 ${0===t?"AM":"PM"}`,i=`${n}:30 ${0===t?"AM":"PM"}`;o.push({label:s,value:s,selected:s===e},{label:i,value:i,selected:i===e})}return o},w=w=>{const[D,f]=n(w.time),[h,v]=n(w.date);s((()=>{w.setError(void 0);const e=l.convert12HourTimeTo24Hour(D),o=t(new Date,"HH:mm:ss");if(r(h)&&e<o)return void w.setError("Selected time should be later than current time");w.setError(void 0);const[n,s]=e.split(":"),i=new Date(h.getTime());i.setHours(+n,+s),w.onChange(i)}),[h,D]);return e(u,{children:[e("div",Object.assign({style:{display:"flex",gap:16}},{children:[o("div",Object.assign({style:{flex:1}},{children:o(i,{customDate:h,setCustomDate:v,placement:w.placement,minDate:w.minDate})})),o("div",Object.assign({style:{flex:1}},{children:o(m,Object.assign({options:j(D),onSelect:e=>{f(e.value)}},{children:o(d,{value:D,leftIcon:{icon:a},rightIcon:{icon:c},onChangeText:e=>(e=>{if(l.timeFormatValidation(e)){const o=l.convert12HourTimeTo24Hour(e),n=t(new Date,"HH:mm:ss");if(r(h)&&o<n)return void w.setError("Selected time should be later than current time");w.setError(void 0),f(e)}else w.setError('Format of time should be "HH:MM AM" or "HH:MM PM"')})(e)})}))}))]})),w.error&&o(p,Object.assign({style:{paddingTop:8}},{children:w.error}))]})};export{w as CustomDateTime};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{forwardRef as i,useState as r,useContext as l,useRef as o,useEffect as a}from"react";import{Button as s}from"../button/Button.js";import{isFunction as c,validateInput as u}from"./Input-helper.js";import{BodySecondary as v}from"../TypographyStyle.js";import d from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as h}from"./context/InputStyleProvider.js";import{RootContainer as p,InputFooter as g,InputWrapper as f,IconHolder as m,PrefixHolder as x,InputContainer as y,InputContainerSmall as b,SuffixHolder as j,InputHeader as C,MaxCharStyle as w}from"./Input.styled.js";const I=i(((i,I)=>{var O,k,L,T,D;const{placeholder:A,leftIcon:E,rightIcon:F,labelText:M,maxCharLimit:z,isRequired:B,hintText:S,type:K,state:R,validate:H,variant:q,button:N,suffixText:P,prefixText:V,onChangeText:W,value:G,noErrorHint:J,reset:Q,rangeValidation:U,noKeyDownChange:X,version:Y,noMaxCharCheck:Z}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},i),$=null==E?void 0:E.icon,_=null==F?void 0:F.icon,[ee,te]=r(!1),[ne,ie]=r(!1),[re,le]=r(),oe="small"===q?"18px":"22px",ae=l(h),[se,ce]=r(),ue=o(null),ve=null!=I?I:ue;a((()=>{ce(G)}),[G]),a((()=>{var e;ve.current&&(null===(e=i.onReferenceInit)||void 0===e||e.call(i,ve.current))}),[ve]),a((()=>{const e=ve.current;if(e)return e.addEventListener("wheel",ge,{passive:!1}),()=>{e.removeEventListener("wheel",ge)}}),[]),a((()=>{Q&&ce("")}),[Q]),a((()=>{var e;ie(!!i.isActive),i.isActive&&(null===(e=ve.current)||void 0===e||e.focus())}),[i.isActive]),a((()=>{le(i.errorMessage)}),[i.errorMessage]),a((()=>{var e;te(!1),("invalid"===i.state||re)&&te(!0),"active"===i.state&&(null===(e=ve.current)||void 0===e||e.focus())}),[i.state,re]),a((()=>{te(!!re)}),[re]);const de=function(e){if(c(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e(...n)}},he=()=>"zip"===K?6:60,pe=e=>{const t=z||he();if(X||W(G||"",e),Z)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},ge=e=>{e.preventDefault()},fe=e=>{const t=e.target.value,n=z||he();if(!Z&&n>0&&t.length>=n)return void e.preventDefault();W(t,e),i.textControl||ce(t);const r=H||u;if(!r||!c(r))return;const[l,o]=r(t,K,U);te(!l),le(i.errorMessage?i.errorMessage:o)},me=e=>{var t;i.skipFocus||ie(!0),de(null===(t=i.onFocus)||void 0===t?void 0:t.call(i,e))},xe=e=>{var t;i.skipFocus||ie(!1),de(null===(t=i.onBlur)||void 0===t?void 0:t.call(i,e))},ye=()=>{var r;return e(n,{children:["multiline"!==K&&t("input",{id:i.id,style:null!==(r=null==ae?void 0:ae.input)&&void 0!==r?r:{},ref:ve,type:["phonenumber","zip","number"].includes(K)?"number":K,value:se,onFocus:e=>me(e),onBlur:e=>xe(e),placeholder:A||"Enter here",onChange:fe,onKeyDown:e=>pe(e)}),"multiline"===K&&t("textarea",{value:se,ref:ve,onFocus:e=>me(e),onBlur:e=>xe(e),placeholder:A||"Enter here",onChange:fe,onKeyDown:e=>pe(e),maxLength:z>0?z:void 0})]})};return e(p,Object.assign({width:i.width,height:i.height,state:R,type:K,style:null!==(O=null==ae?void 0:ae.RootContainer)&&void 0!==O?O:{}},{children:[!J&&(!!S||!!re)&&e(g,Object.assign({invalid:!!re},{children:[!!re&&t(d,{width:16,height:16}),re||S]})),e(f,Object.assign({variant:q,state:R,width:i.width,isActive:"active"===R||ne,isInvalid:ee,style:null!==(k=null==ae?void 0:ae.InputWrapper)&&void 0!==k?k:{},version:Y,height:i.height},{children:[!!$&&t(m,Object.assign({variant:q,iconSize:oe,onClick:()=>de(null==E?void 0:E.callback),isLeft:!0,style:null!==(L=null==ae?void 0:ae.IconHolder)&&void 0!==L?L:{}},{children:t($,{})})),!!V&&t(x,Object.assign({variant:q},{children:V})),"default"===q&&t(y,Object.assign({height:i.height,type:i.type},{children:ye()})),"small"===q&&t(b,Object.assign({height:i.height,type:i.type},{children:ye()})),!!_&&t(m,Object.assign({variant:q,iconSize:oe,onClick:()=>de(null==F?void 0:F.callback),isLeft:!1},{children:t(_,{})})),!!P&&t(j,Object.assign({variant:q},{children:P})),N&&N.text&&t(s,{buttonText:N.text,onClick:()=>de(null==N?void 0:N.onClick)})]})),(!!M||!!z)&&e(C,Object.assign({invalid:ee},{children:[e(v,{children:[M,B?t("span",{children:"*"}):""]}),z>0&&e(w,{children:[null!==(D=null===(T=i.value)||void 0===T?void 0:T.length)&&void 0!==D?D:0,"/",z]})]}))]}))}));I.displayName="Input";export{I as Input};
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{forwardRef as i,useState as r,useContext as l,useRef as o,useEffect as a}from"react";import{Button as s}from"../button/Button.js";import{isFunction as c,validateInput as u}from"./Input-helper.js";import{BodySecondary as v}from"../TypographyStyle.js";import d from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as h}from"./context/InputStyleProvider.js";import{RootContainer as p,InputFooter as g,InputWrapper as m,IconHolder as f,PrefixHolder as b,InputContainer as x,InputContainerSmall as y,SuffixHolder as j,InputHeader as C,MaxCharStyle as w}from"./Input.styled.js";const I=i(((i,I)=>{var O,k,L,T,D;const{placeholder:z,leftIcon:A,rightIcon:E,labelText:F,maxCharLimit:M,isRequired:B,hintText:S,type:K,state:R,validate:H,variant:q,button:N,suffixText:P,prefixText:V,onChangeText:W,value:G,noErrorHint:J,reset:Q,rangeValidation:U,noKeyDownChange:X,version:Y,noMaxCharCheck:Z}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},i),$=null==A?void 0:A.icon,_=null==E?void 0:E.icon,[ee,te]=r(!1),[ne,ie]=r(!1),[re,le]=r(),oe="small"===q?"18px":"22px",ae=l(h),[se,ce]=r(),ue=o(null),ve=null!=I?I:ue;a((()=>{ce(G)}),[G]),a((()=>{var e;ve.current&&(null===(e=i.onReferenceInit)||void 0===e||e.call(i,ve.current))}),[ve]),a((()=>{const e=ve.current;if(e&&["phonenumber","zip","number"].includes(K))return e.addEventListener("wheel",ge,{passive:!1}),()=>{e.removeEventListener("wheel",ge)}}),[]),a((()=>{Q&&ce("")}),[Q]),a((()=>{var e;ie(!!i.isActive),i.isActive&&(null===(e=ve.current)||void 0===e||e.focus())}),[i.isActive]),a((()=>{le(i.errorMessage)}),[i.errorMessage]),a((()=>{var e;te(!1),("invalid"===i.state||re)&&te(!0),"active"===i.state&&(null===(e=ve.current)||void 0===e||e.focus())}),[i.state,re]),a((()=>{te(!!re)}),[re]);const de=function(e){if(c(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e(...n)}},he=()=>"zip"===K?6:60,pe=e=>{const t=0!==M?M:he();if(X||W(G||"",e),Z)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},ge=e=>{e.preventDefault()},me=e=>{const t=e.target.value,n=0!==M?M+1:he();if(!Z&&n>0&&t.length>=n)return void e.preventDefault();W(t,e),i.textControl||ce(t);const r=H||u;if(!r||!c(r))return;const[l,o]=r(t,K,U);te(!l),le(i.errorMessage?i.errorMessage:o)},fe=e=>{var t;i.skipFocus||ie(!0),de(null===(t=i.onFocus)||void 0===t?void 0:t.call(i,e))},be=e=>{var t;i.skipFocus||ie(!1),de(null===(t=i.onBlur)||void 0===t?void 0:t.call(i,e))},xe=()=>{var r;return e(n,{children:["multiline"!==K&&t("input",{id:i.id,style:null!==(r=null==ae?void 0:ae.input)&&void 0!==r?r:{},ref:ve,type:["phonenumber","zip","number"].includes(K)?"number":K,value:se,onFocus:e=>fe(e),onBlur:e=>be(e),placeholder:z||"Enter here",onChange:me,onKeyDown:e=>pe(e)}),"multiline"===K&&t("textarea",{value:se,ref:ve,onFocus:e=>fe(e),onBlur:e=>be(e),placeholder:z||"Enter here",onChange:me,onKeyDown:e=>pe(e),maxLength:M>0?M:void 0})]})};return e(p,Object.assign({width:i.width,height:i.height,state:R,type:K,style:null!==(O=null==ae?void 0:ae.RootContainer)&&void 0!==O?O:{}},{children:[!J&&(!!S||!!re)&&e(g,Object.assign({invalid:!!re},{children:[!!re&&t(d,{width:16,height:16}),re||S]})),e(m,Object.assign({variant:q,state:R,width:i.width,isActive:"active"===R||ne,isInvalid:ee,style:null!==(k=null==ae?void 0:ae.InputWrapper)&&void 0!==k?k:{},version:Y,height:i.height},{children:[!!$&&t(f,Object.assign({variant:q,iconSize:oe,onClick:()=>de(null==A?void 0:A.callback),isLeft:!0,style:null!==(L=null==ae?void 0:ae.IconHolder)&&void 0!==L?L:{}},{children:t($,{})})),!!V&&t(b,Object.assign({variant:q},{children:V})),"default"===q&&t(x,Object.assign({height:i.height,type:i.type},{children:xe()})),"small"===q&&t(y,Object.assign({height:i.height,type:i.type},{children:xe()})),!!_&&t(f,Object.assign({variant:q,iconSize:oe,onClick:()=>de(null==E?void 0:E.callback),isLeft:!1},{children:t(_,{})})),!!P&&t(j,Object.assign({variant:q},{children:P})),N&&N.text&&t(s,{buttonText:N.text,onClick:()=>de(null==N?void 0:N.onClick)})]})),(!!F||!!M)&&e(C,Object.assign({invalid:ee},{children:[e(v,{children:[F,B?t("span",{children:"*"}):""]}),M>0&&e(w,{children:[null!==(D=null===(T=i.value)||void 0===T?void 0:T.length)&&void 0!==D?D:0,"/",M]})]}))]}))}));I.displayName="Input";export{I as Input};
@@ -1,21 +1,22 @@
1
1
  import { VariableListInterfaceV2 } from "../add-variableV2/AddVariableV2";
2
+ import { WhatsAppCarouselTemplate, WhatsAppCarouselTemplateVariables } from "../template-preview/models/WhatsappCarouselTemplate";
2
3
  import { CHANNEL_TYPE } from '../template-preview/models/Channels';
3
4
  import { EmailTemplateType } from '../template-preview/models/EmailTemplate';
4
5
  import { SMSTemplateType } from '../template-preview/models/SmsTemplate';
5
6
  import { CUSTOM_VARIABLE, GlobalPlaceholderType } from '../template-preview/models/TemplateMeta';
6
7
  import { ExtrasWhatsapp, POD, WhatsAppPickerMeta, WhatsAppTemplate, WhatsAppTemplateVariables } from '../template-preview/models/WhatsAppTemplate';
7
8
  export interface TemplateContextMapperProps {
8
- selectedTemplate: WhatsAppTemplate | EmailTemplateType | SMSTemplateType;
9
+ selectedTemplate: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate;
9
10
  closeDialog?: () => void;
10
11
  showVariableMapping: boolean;
11
12
  channel: CHANNEL_TYPE;
12
13
  globalPlaceholders: GlobalPlaceholderType;
13
14
  /** List of variables being used in this template */
14
- templateVariables: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables;
15
+ templateVariables: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables | WhatsAppCarouselTemplateVariables;
15
16
  /** Only for initial-UI-purpose for the modal */
16
17
  htmlContent: string;
17
18
  showOnlyContent?: boolean;
18
- onTemplateSelect?(template: EmailTemplateType | SMSTemplateType | WhatsAppTemplate, variables: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables, display_content?: string): string | void;
19
+ onTemplateSelect?(template: EmailTemplateType | SMSTemplateType | WhatsAppTemplate | WhatsAppCarouselTemplate, variables: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables | WhatsAppCarouselTemplateVariables, display_content?: string): string | void;
19
20
  whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
20
21
  zIndex?: number;
21
22
  showVariableModal?: boolean;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{useEffect as o,useState as a,useMemo as i}from"react";import r from"../../utils/StringUtils.js";import{StyledModal as s}from"../modals/styledModal.js";import{CHANNEL_TYPE as n}from"../template-preview/models/Channels.js";import{TemplateModalContext as d}from"./context/templateModalContext.js";import c from"./modalElements/Footer.js";import m from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as p}from"./utils/convertPlaceholdersToBikDropdown.js";const u=u=>{let{selectedTemplate:h,closeDialog:b,showVariableMapping:g,channel:v,htmlContent:C,templateVariables:S,onTemplateSelect:f,globalPlaceholders:w,showOnlyContent:M,whatsappSpecificPickerMeta:T,zIndex:V,showVariableModal:j,variableList:x,discountCode:L,setDiscountCode:P,onBackPress:E,enabledCustomText:I,variableListForImage:y,showSampleValues:k,disableEditVariable:D,pod:A,extras:O}=u;var F,z;o((()=>{N(C)}),[C]);const[B,H]=a(v===n.EMAIL?"desktop":"mobile"),[$,N]=a(C),[U,W]=a(!1),[_,q]=a(h),[G,J]=a(null!=S?S:[]),[K,Q]=a(!1);const R=i((()=>p(w)),[w]);return e(d.Provider,Object.assign({value:{template:_,setTemplate:q,device:B,setDevice:H,display_content:$,setDisplayContent:N,originalVariableList:G,setOriginalVariableList:J,isError:U,setIsError:W,channel:v,globalNormalizedPlaceholders:R,templateSelectionTriggered:K,setTemplateSelectionTriggered:Q,enabledCustomText:I,disableEditVariable:D,pod:A,extras:O}},{children:M?e(m,{channel:n.EMAIL,hideHeader:!0}):t(s,Object.assign({zIndex:V,centralContainerStyles:{width:v===n.EMAIL&&g?1e3:700},open:!0,onClose:()=>{null==b||b()},headingTitle:null==_?void 0:_.label,headingSubtitle:v===n.WHATSAPP?`${r.capitaliseFirstLetterOfString(null!==(F=null==_?void 0:_.category)&&void 0!==F?F:"")} • ${null!==(z=null==_?void 0:_.templateCategory)&&void 0!==z?z:""}`:"",onBackPress:()=>{null==E||E()}},{children:[e(m,{showSampleValues:k,showVariableMapping:g,channel:v,whatsappSpecificPickerMeta:T,showVariableModal:j,variableList:x,discountCode:L,setDiscountCode:P,variableListForImage:y&&(null==y?void 0:y.length)>0?y:x}),f?e(c,{onSelect:function(){const e=null==f?void 0:f(_,G,null!=$?$:"");e?W(!!e):Q(!0)}}):e(l,{})]}))}))};export{u as TemplateContextMapper};
1
+ import{jsx as e,jsxs as l,Fragment as t}from"react/jsx-runtime";import{useEffect as o,useState as a,useMemo as i}from"react";import s from"../../utils/StringUtils.js";import{StyledModal as n}from"../modals/styledModal.js";import{CHANNEL_TYPE as r}from"../template-preview/models/Channels.js";import{TemplateModalContext as d}from"./context/templateModalContext.js";import c from"./modalElements/Footer.js";import p from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as m}from"./utils/convertPlaceholdersToBikDropdown.js";const u=u=>{let{selectedTemplate:h,closeDialog:b,showVariableMapping:g,channel:v,htmlContent:C,templateVariables:S,onTemplateSelect:f,globalPlaceholders:T,showOnlyContent:w,whatsappSpecificPickerMeta:x,zIndex:M,showVariableModal:P,variableList:L,discountCode:V,setDiscountCode:j,onBackPress:E,enabledCustomText:I,variableListForImage:y,showSampleValues:A,disableEditVariable:k,pod:D,extras:O}=u;var F,W,z,B;o((()=>{R(C)}),[C]);const H=v===r.WHATSAPP&&"CAROUSEL"===(null===(W=null===(F=h.components)||void 0===F?void 0:F[1])||void 0===W?void 0:W.type),[U,$]=a(v===r.EMAIL||H?"desktop":"mobile"),[N,R]=a(C),[_,q]=a(!1),[G,J]=a(h),[K,Q]=a(null!=S?S:[]),[X,Y]=a(!1),[Z,ee]=a(-1);const le=i((()=>m(T)),[T]);return e(d.Provider,Object.assign({value:{template:G,setTemplate:J,device:U,setDevice:$,display_content:N,setDisplayContent:R,originalVariableList:K,setOriginalVariableList:Q,isError:_,setIsError:q,channel:v,globalNormalizedPlaceholders:le,templateSelectionTriggered:X,setTemplateSelectionTriggered:Y,enabledCustomText:I,disableEditVariable:k,pod:D,extras:O,isWhatsappCarousel:H,selectedCarouselIndex:Z,setSelectedCarouselIndex:ee}},{children:w?e(p,{channel:r.EMAIL,hideHeader:!0}):l(n,Object.assign({zIndex:M,centralContainerStyles:{width:v===r.EMAIL&&g||H?900:800},open:!0,onClose:()=>{null==b||b()},headingTitle:null==G?void 0:G.label,headingSubtitle:v===r.WHATSAPP?`${s.capitaliseFirstLetterOfString(null!==(z=null==G?void 0:G.category)&&void 0!==z?z:"")} • ${null!==(B=null==G?void 0:G.templateCategory)&&void 0!==B?B:""}`:"",onBackPress:()=>{null==E||E()}},{children:[e(p,{showSampleValues:A,showVariableMapping:g,channel:v,whatsappSpecificPickerMeta:x,showVariableModal:P,variableList:L,discountCode:V,setDiscountCode:j,variableListForImage:y&&(null==y?void 0:y.length)>0?y:L}),f?e(c,{isWhatsappCarousel:null!=H&&H,onSelect:function(){const e=null==f?void 0:f(G,K,null!=N?N:"");e?q(!!e):Y(!0)}}):e(t,{})]}))}))};export{u as TemplateContextMapper};
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { CHANNEL_TYPE } from "../../template-preview/models/Channels";
3
+ import { EmailTemplateType } from "../../template-preview/models/EmailTemplate";
4
+ import { SMSTemplateType } from "../../template-preview/models/SmsTemplate";
5
+ import { WhatsAppCarouselTemplate } from "../../template-preview/models/WhatsappCarouselTemplate";
6
+ import { WhatsAppTemplate } from "../../template-preview/models/WhatsAppTemplate";
7
+ declare const CarouselPreview: React.ForwardRefExoticComponent<{
8
+ channel: CHANNEL_TYPE;
9
+ template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate | null;
10
+ showSampleValues?: boolean | undefined;
11
+ } & React.RefAttributes<HTMLDivElement>>;
12
+ export default CarouselPreview;
@@ -0,0 +1,9 @@
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import r,{useEffect as a}from"react";import i from"styled-components";import n from"./CarouselPreviewCard.js";import{COLORS as t}from"../../../constants/Theme.js";const l=i.div`
2
+ background-image: url('https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F341dba50-e84e-4457-b5b5-d9d8a0b95a73?alt=media&token=6fd32f23-8bb2-4980-bbee-bef39b38fd9f');
3
+ border: 1px solid ${t.stroke.primary};
4
+ border-radius: 4px;
5
+ background-repeat: no-repeat;
6
+ background-position: center;
7
+ background-size: cover;
8
+ position: relative;
9
+ `,d=r.forwardRef(((r,i)=>{let{channel:t,template:d,showSampleValues:s}=r;var p,c,m;return a((()=>{console.log("template preview uef: ",-1,d)}),[null===(p=null==d?void 0:d.components)||void 0===p?void 0:p[1].cards]),e(l,{children:[o(n,{channel:t,template:d,isHeader:!0,carouselCardIndex:-1}),o("div",Object.assign({style:{display:"flex",flexDirection:"row"}},{children:null===(m=null===(c=null==d?void 0:d.components)||void 0===c?void 0:c[1].cards)||void 0===m?void 0:m.map(((e,r)=>{var a,i;const l={components:e.components,mapping:null===(i=null===(a=null==d?void 0:d.mapping)||void 0===a?void 0:a.cards)||void 0===i?void 0:i[r]};return console.log("template preview c: ",r,l),o(n,{channel:t,template:l,isHeader:!1,carouselCardIndex:r},r)}))}))]})}));d.displayName="CarouselPreview";export{d as default};
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { CHANNEL_TYPE } from "../../template-preview/models/Channels";
3
+ declare const CarouselPreviewCard: React.ForwardRefExoticComponent<{
4
+ channel: CHANNEL_TYPE;
5
+ template: any;
6
+ showSampleValues?: boolean | undefined;
7
+ isHeader?: boolean | undefined;
8
+ carouselCardIndex?: number | undefined;
9
+ } & React.RefAttributes<HTMLDivElement>>;
10
+ export default CarouselPreviewCard;
@@ -0,0 +1,15 @@
1
+ import{jsx as e}from"react/jsx-runtime";import t from"react";import p from"styled-components";import{TemplatePreview as a}from"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import"../../../constants/Theme.js";import"../../template-preview/models/TemplateMeta.js";import"../../template-preview/models/WhatsAppTemplate.js";import{CHANNEL_TYPE as r}from"../../template-preview/models/Channels.js";const i=p.div`
2
+ position: relative;
3
+ height: ${e=>e.isHeader?"150px":"443px"};
4
+ width: ${e=>e.channel===r.WHATSAPP?"360px":"300px"};
5
+ overflow-y: auto;
6
+ `,l=p.div`
7
+ position: absolute;
8
+ flex: 1;
9
+ scroll-behavior: smooth;
10
+ left: 12px;
11
+ top: 8px;
12
+ width: calc(100% - 25px);
13
+ height: calc(100% - 17px);
14
+ overflow-y: auto;
15
+ `,o=t.forwardRef(((t,p)=>{let{channel:r,template:o,showSampleValues:s,isHeader:m,carouselCardIndex:n}=t;return e("div",{children:e(i,Object.assign({channel:r,isHeader:null!=m&&m},{children:e(l,Object.assign({ref:p},{children:e(a,{showSampleValues:s,template:o,channel:r,size:"small",hideHeader:!0,carouselCardIndex:n})}))}))})}));export{o as default};
@@ -3,6 +3,7 @@ import { CHANNEL_TYPE } from "../../template-preview/models/Channels";
3
3
  import { EmailTemplateType } from "../../template-preview/models/EmailTemplate";
4
4
  import { SMSTemplateType } from "../../template-preview/models/SmsTemplate";
5
5
  import { CUSTOM_VARIABLE, globalNormalizedPlaceholdersType } from "../../template-preview/models/TemplateMeta";
6
+ import { WhatsAppCarouselTemplate, WhatsAppCarouselTemplateVariables } from "../../template-preview/models/WhatsappCarouselTemplate";
6
7
  import { ExtrasWhatsapp, WhatsAppTemplate, WhatsAppTemplateVariables } from "../../template-preview/models/WhatsAppTemplate";
7
8
  export type DEVICE_TYPES = 'desktop' | 'mobile';
8
9
  export declare const TemplateModalContext: React.Context<{
@@ -10,12 +11,12 @@ export declare const TemplateModalContext: React.Context<{
10
11
  setDevice?: React.Dispatch<React.SetStateAction<DEVICE_TYPES>> | undefined;
11
12
  display_content: string | null;
12
13
  setDisplayContent?: React.Dispatch<React.SetStateAction<string | null>> | undefined;
13
- originalVariableList: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables;
14
- setOriginalVariableList?: React.Dispatch<React.SetStateAction<WhatsAppTemplateVariables | CUSTOM_VARIABLE[]>> | undefined;
14
+ originalVariableList: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables | WhatsAppCarouselTemplateVariables;
15
+ setOriginalVariableList?: React.Dispatch<React.SetStateAction<WhatsAppTemplateVariables | WhatsAppCarouselTemplateVariables | CUSTOM_VARIABLE[]>> | undefined;
15
16
  channel: CHANNEL_TYPE;
16
17
  setChannel?: React.Dispatch<React.SetStateAction<CHANNEL_TYPE>> | undefined;
17
- template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | null;
18
- setTemplate?: React.Dispatch<React.SetStateAction<WhatsAppTemplate | EmailTemplateType | SMSTemplateType | null>> | undefined;
18
+ template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate | null;
19
+ setTemplate?: React.Dispatch<React.SetStateAction<WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate | null>> | undefined;
19
20
  isError: boolean;
20
21
  setIsError?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
21
22
  globalNormalizedPlaceholders?: globalNormalizedPlaceholdersType[] | undefined;
@@ -25,18 +26,21 @@ export declare const TemplateModalContext: React.Context<{
25
26
  disableEditVariable?: boolean | undefined;
26
27
  pod?: string | undefined;
27
28
  extras?: ExtrasWhatsapp | undefined;
29
+ isWhatsappCarousel?: boolean | undefined;
30
+ selectedCarouselIndex?: number | undefined;
31
+ setSelectedCarouselIndex?: React.Dispatch<React.SetStateAction<number>> | undefined;
28
32
  }>;
29
33
  export declare const useTemplateModalContext: () => {
30
34
  device: DEVICE_TYPES;
31
35
  setDevice?: React.Dispatch<React.SetStateAction<DEVICE_TYPES>> | undefined;
32
36
  display_content: string | null;
33
37
  setDisplayContent?: React.Dispatch<React.SetStateAction<string | null>> | undefined;
34
- originalVariableList: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables;
35
- setOriginalVariableList?: React.Dispatch<React.SetStateAction<WhatsAppTemplateVariables | CUSTOM_VARIABLE[]>> | undefined;
38
+ originalVariableList: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables | WhatsAppCarouselTemplateVariables;
39
+ setOriginalVariableList?: React.Dispatch<React.SetStateAction<WhatsAppTemplateVariables | WhatsAppCarouselTemplateVariables | CUSTOM_VARIABLE[]>> | undefined;
36
40
  channel: CHANNEL_TYPE;
37
41
  setChannel?: React.Dispatch<React.SetStateAction<CHANNEL_TYPE>> | undefined;
38
- template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | null;
39
- setTemplate?: React.Dispatch<React.SetStateAction<WhatsAppTemplate | EmailTemplateType | SMSTemplateType | null>> | undefined;
42
+ template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate | null;
43
+ setTemplate?: React.Dispatch<React.SetStateAction<WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate | null>> | undefined;
40
44
  isError: boolean;
41
45
  setIsError?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
42
46
  globalNormalizedPlaceholders?: globalNormalizedPlaceholdersType[] | undefined;
@@ -46,4 +50,7 @@ export declare const useTemplateModalContext: () => {
46
50
  disableEditVariable?: boolean | undefined;
47
51
  pod?: string | undefined;
48
52
  extras?: ExtrasWhatsapp | undefined;
53
+ isWhatsappCarousel?: boolean | undefined;
54
+ selectedCarouselIndex?: number | undefined;
55
+ setSelectedCarouselIndex?: React.Dispatch<React.SetStateAction<number>> | undefined;
49
56
  };
@@ -0,0 +1,12 @@
1
+ import { VariableListInterfaceV2 } from "../../add-variableV2/AddVariableV2";
2
+ export type AdditionalVariableProps = {
3
+ variableList?: VariableListInterfaceV2[];
4
+ categoryDisplayName: string;
5
+ variableDisplayName: string;
6
+ variableValue: string;
7
+ };
8
+ /**
9
+ * Takes the previous variable list and adds any custom variable given as prop.
10
+ * E.g - Custom Text, Custom URL, Static Expiry
11
+ */
12
+ export declare const useAdditionalVariables: (props: AdditionalVariableProps) => VariableListInterfaceV2[] | undefined;
@@ -0,0 +1 @@
1
+ const a=a=>{const{variableList:e,categoryDisplayName:i,variableDisplayName:r,variableValue:l}=a;return e?[...e,{description:"",displayName:i,orderId:1,variables:{variableDisplayName:{description:void 0,displayName:r,actualValue:l,variableType:"any",isAvailable:!0}}}].sort(((a,e)=>a.orderId-e.orderId)):e};export{a as useAdditionalVariables};
@@ -1,17 +1,17 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useRef as l}from"react";import n from"styled-components";import{CHANNEL_TYPE as i}from"../../template-preview/models/Channels.js";import{COLORS as a}from"../../../constants/Theme.js";import{useTemplateModalContext as r}from"../context/templateModalContext.js";import{getVariableNameForEmailByIndex as s}from"../utils/getVariableNameEmail.js";import{highlightFor as p}from"../utils/highlightFor.js";import d from"./DesktopPreview.js";import m from"./EditWhatsAppTemplateV2.js";import c from"./MobilePreview.js";import u from"./VariableConnectorsPanel.js";const h=n.div`
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useRef as l}from"react";import a from"styled-components";import i from"../carousel/CarouselPreview.js";import n from"./EditWhatsAppCarouselTemplateV2.js";import{CHANNEL_TYPE as r}from"../../template-preview/models/Channels.js";import{COLORS as s}from"../../../constants/Theme.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";import{getVariableNameForEmailByIndex as m}from"../utils/getVariableNameEmail.js";import{highlightFor as d}from"../utils/highlightFor.js";import c from"./DesktopPreview.js";import u from"./EditWhatsAppTemplateV2.js";import h from"./MobilePreview.js";import f from"./VariableConnectorsPanel.js";const v=a.div`
2
2
  display: flex;
3
3
  // height: 100%;
4
- `,f=n.div`
4
+ `,w=a.div`
5
5
  padding: 16px 14px;
6
- max-width: 350px;
6
+ max-width: 450px;
7
7
 
8
- height: ${e=>e.channel===i.WHATSAPP?"500px":"475px"};
9
- overflow-y: 'auto';
8
+ height: ${e=>e.channel===r.WHATSAPP?"500px":"475px"};
9
+ overflow-y: auto;
10
10
  padding-bottom: 24px;
11
- border-left: ${a.stroke.primary} 1px solid;
12
- `,v=n.div`
11
+ border-left: ${s.stroke.primary} 1px solid;
12
+ `,g=a.div`
13
13
  padding: ${e=>e.showOnlyContent?"16px 14px":"16px 32px"};
14
14
  flex: 1;
15
15
  height: 475px;
16
16
  overflow-y: auto;
17
- `,g=n=>{const{showVariableMapping:g,showOnlyContent:w,whatsappSpecificPickerMeta:b,showVariableModal:x,variableList:y,discountCode:C,setDiscountCode:j,variableListForImage:M,showSampleValues:V}=n,P=l(),E=l(),{device:S,display_content:T,channel:k,template:A,setTemplate:L}=r();const I=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e(h,{children:[t(v,Object.assign({showOnlyContent:w,showVariableMapping:g},{children:"mobile"===S?t(c,{ref:E,display_content:null!=T?T:"",channel:k,template:A,showSampleValues:V}):k!==i.MESSAGE?t(d,{ref:P,channel:k,display_content:null!=T?T:"",showSampleValues:V}):t(o,{})})),g&&t(f,Object.assign({channel:k},{children:k!==i.WHATSAPP?t(u,{onFocus:k===i.EMAIL?function(e){var t,o,l;const n=null===document||void 0===document?void 0:document.getElementById("mobile"===S?"template_html_mobile":"template_html_desktop"),r=s(e+1),d=k===i.EMAIL?null===(t=null==n?void 0:n.contentWindow)||void 0===t?void 0:t.document.getElementById(r):document.getElementById(r),m=I(d),c=null==d?void 0:d.offsetLeft;"desktop"===S?m&&P.current&&(null===(o=null==n?void 0:n.contentWindow)||void 0===o||o.scrollTo(null!=c?c:0,m),p(r,a.background.warning.light,2,k,S)):m&&E.current&&(null===(l=null==n?void 0:n.contentWindow)||void 0===l||l.scrollTo(null!=c?c:0,m),p(r,a.background.warning.light,2,k,S))}:void 0,showVariableModal:x,variableList:y,discountCode:C,setDiscountCode:j}):t(m,{whatsappSpecificPickerMeta:b,template:A,onTemplateChange:e=>{null==L||L(e)},showVariableModal:x,variableList:y,variableListForImage:M,discountCode:C,setDiscountCode:j})}))]})};export{g as default};
17
+ `,b=a=>{const{showVariableMapping:b,showOnlyContent:x,whatsappSpecificPickerMeta:C,showVariableModal:P,variableList:j,discountCode:y,setDiscountCode:M,variableListForImage:V,showSampleValues:A}=a,S=l(),T=l(),{device:E,display_content:L,channel:W,template:k,setTemplate:I,isWhatsappCarousel:_}=p();const D=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e(v,{children:[t(g,Object.assign({showOnlyContent:x,showVariableMapping:b},{children:"mobile"===E?t(h,{ref:T,display_content:null!=L?L:"",channel:W,template:k,showSampleValues:A}):W===r.WHATSAPP&&_?t(i,{ref:S,channel:W,template:k,showSampleValues:A}):W!==r.MESSAGE?t(c,{ref:S,channel:W,display_content:null!=L?L:"",showSampleValues:A}):t(o,{})})),b&&t(w,Object.assign({channel:W},{children:W!==r.WHATSAPP?t(f,{onFocus:W===r.EMAIL?function(e){var t,o,l;const a=null===document||void 0===document?void 0:document.getElementById("mobile"===E?"template_html_mobile":"template_html_desktop"),i=m(e+1),n=W===r.EMAIL?null===(t=null==a?void 0:a.contentWindow)||void 0===t?void 0:t.document.getElementById(i):document.getElementById(i),p=D(n),c=null==n?void 0:n.offsetLeft;"desktop"===E?p&&S.current&&(null===(o=null==a?void 0:a.contentWindow)||void 0===o||o.scrollTo(null!=c?c:0,p),d(i,s.background.warning.light,2,W,E)):p&&T.current&&(null===(l=null==a?void 0:a.contentWindow)||void 0===l||l.scrollTo(null!=c?c:0,p),d(i,s.background.warning.light,2,W,E))}:void 0,showVariableModal:P,variableList:j,discountCode:y,setDiscountCode:M}):W===r.WHATSAPP&&_?t(n,{whatsappSpecificPickerMeta:C,template:k,showVariableModal:P,variableList:j,variableListForImage:V,discountCode:y,setDiscountCode:M}):t(u,{whatsappSpecificPickerMeta:C,template:k,onTemplateChange:e=>{null==I||I(e)},showVariableModal:P,variableList:j,variableListForImage:V,discountCode:y,setDiscountCode:M})}))]})};export{b as default};
@@ -1,8 +1,8 @@
1
- import{jsxs as e,jsx as i,Fragment as t}from"react/jsx-runtime";import o from"../../../assets/icons/document_pdf.svg.js";import r from"../../../assets/icons/edit.svg.js";import s from"../../../assets/icons/refresh.svg.js";import n from"../../../assets/icons/video_camcorder.svg.js";import l from"styled-components";import{ShimmerImage as d}from"../../shimmer-image/ShimmerImage.js";import{Spinner as a}from"../../spinner/Spinner.js";import{HEADER_TYPES as c}from"../../template-preview/models/TemplateMeta.js";import{BodyCaption as m,BodySecondary as p,Caption as h}from"../../TypographyStyle.js";import g from"../../../utils/StringUtils.js";import{COLORS as f}from"../../../constants/Theme.js";import{Container as j,ImageContainer as v,RightComponent as y}from"./EditMediaV2.style.js";const u=l.div`
1
+ import{jsxs as e,jsx as i,Fragment as t}from"react/jsx-runtime";import r from"../../../assets/icons/document_pdf.svg.js";import o from"../../../assets/icons/edit.svg.js";import s from"../../../assets/icons/refresh.svg.js";import n from"styled-components";import{ShimmerImage as l}from"../../shimmer-image/ShimmerImage.js";import{Spinner as d}from"../../spinner/Spinner.js";import{HEADER_TYPES as a}from"../../template-preview/models/TemplateMeta.js";import{BodyCaption as c,BodySecondary as m,Caption as p}from"../../TypographyStyle.js";import h from"../../../utils/StringUtils.js";import{COLORS as g}from"../../../constants/Theme.js";import{Container as f,ImageContainer as j,RightComponent as y}from"./EditMediaV2.style.js";const u=n.div`
2
2
  padding-left: 14px;
3
3
  padding-right: 6px;
4
4
  width: 44px;
5
5
  height: 24px;
6
- border-left: 1px solid ${f.stroke.primary};
6
+ border-left: 1px solid ${g.stroke.primary};
7
7
  cursor: pointer;
8
- `,b=l=>{const{imageName:b,error:w,isLoading:x,mediaType:O,disableEditVariable:E,selectedVariable:L,setOpenEditMedia:C}=l,M=null==b?void 0:b[0].split("/"),S=null==M?void 0:M[M.length-1];return e(j,{children:[i(v,Object.assign({error:!!w,onClick:()=>null==C?void 0:C(!0)},{children:w?i(s,{color:f.content.brand,width:32,height:32}):x?i(a,{size:"small"}):O===c.IMAGE?i(d,{imageUrl:null==b?void 0:b[0],width:56,height:56,borderRadius:8}):O===c.VIDEO?i(n,{width:18,height:22,color:f.content.placeholder}):i(o,{width:18,height:22,color:f.content.placeholder})})),e(y,{children:[i("div",Object.assign({style:{flex:1}},{children:b&&w?i(t,{}):x?i(m,Object.assign({style:{marginLeft:8}},{children:"Your media is getting loaded..."})):i(p,Object.assign({style:{color:f.content.primary,marginLeft:8}},{children:L||g.toCapitilize(null==O?void 0:O.toLowerCase())||S}))})),!!w&&e("div",Object.assign({style:{display:"flex",flexDirection:"column",marginLeft:8}},{children:[e(p,Object.assign({style:{color:f.content.negative}},{children:["Error loading this ",null==O?void 0:O.toLowerCase(),". Retry"]})),i(h,Object.assign({style:{color:f.content.secondary}},{children:w}))]})),!E&&!w&&!x&&i(u,Object.assign({onClick:()=>null==C?void 0:C(!0),onKeyDown:()=>null==C?void 0:C(!0),role:"presentation"},{children:i(r,{width:24,height:24,color:f.content.placeholder})}))]})]})};export{b as default};
8
+ `,v=n=>{const{imageName:v,error:b,isLoading:O,mediaType:w,disableEditVariable:x,selectedVariable:L,setOpenEditMedia:E}=n,k=null==v?void 0:v[0].split("/"),C=null==k?void 0:k[k.length-1];return e(f,{children:[i(j,Object.assign({error:!!b,onClick:()=>null==E?void 0:E(!0)},{children:b?i(s,{color:g.content.brand,width:32,height:32}):O?i(d,{size:"small"}):w===a.IMAGE?i(l,{imageUrl:null==v?void 0:v[0],width:56,height:56}):w===a.VIDEO?i("video",Object.assign({src:v[0],style:{width:56,height:56}},{children:i("track",{default:!0,kind:"captions",srcLang:"en",src:v[0]})})):i(r,{width:18,height:22,color:g.content.placeholder})})),e(y,{children:[i("div",Object.assign({style:{flex:1}},{children:v&&b?i(t,{}):O?i(c,Object.assign({style:{marginLeft:8}},{children:"Your media is getting loaded..."})):i(m,Object.assign({style:{color:g.content.primary,marginLeft:8}},{children:L||h.toCapitilize(null==w?void 0:w.toLowerCase())||C}))})),!!b&&e("div",Object.assign({style:{display:"flex",flexDirection:"column",marginLeft:8}},{children:[e(m,Object.assign({style:{color:g.content.negative}},{children:["Error loading this ",null==w?void 0:w.toLowerCase(),". Retry"]})),i(p,Object.assign({style:{color:g.content.secondary}},{children:b}))]})),!x&&!b&&!O&&i(u,Object.assign({onClick:()=>null==E?void 0:E(!0),onKeyDown:()=>null==E?void 0:E(!0),role:"presentation"},{children:i(o,{width:24,height:24,color:g.content.placeholder})}))]})]})};export{v as default};
@@ -0,0 +1,14 @@
1
+ import { VariableListInterfaceV2 } from "../../add-variableV2";
2
+ import { WhatsAppPickerMeta } from "../../template-preview";
3
+ import { WhatsAppCarouselTemplate } from "../../template-preview/models/WhatsappCarouselTemplate";
4
+ export interface EditWhatsAppCarouselTemplateV2Props {
5
+ whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
6
+ template: WhatsAppCarouselTemplate;
7
+ showVariableModal?: boolean;
8
+ variableList?: VariableListInterfaceV2[];
9
+ variableListForImage?: VariableListInterfaceV2[];
10
+ discountCode?: string;
11
+ setDiscountCode?: (code: string) => void;
12
+ }
13
+ declare const EditWhatsAppCarouselTemplateV2: ({ template, whatsappSpecificPickerMeta, showVariableModal, variableList, variableListForImage, discountCode, setDiscountCode, }: EditWhatsAppCarouselTemplateV2Props) => import("react/jsx-runtime").JSX.Element;
14
+ export default EditWhatsAppCarouselTemplateV2;
@@ -0,0 +1 @@
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as a,useEffect as r}from"react";import{useTemplateModalContext as s}from"../context/templateModalContext.js";import o from"./EditWhatsAppTemplateV2.js";import{TitleMedium as i}from"../../TypographyStyle.js";const l=l=>{let{template:p,whatsappSpecificPickerMeta:m,showVariableModal:c,variableList:n,variableListForImage:d,discountCode:u,setDiscountCode:C}=l;const{selectedCarouselIndex:f,setTemplate:g}=s(),[h,b]=a(-1==f?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)");return r((()=>{b(-1==f?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)")}),[f]),e("div",{children:[t(i,Object.assign({style:{marginLeft:10,marginBottom:10}},{children:h})),t(o,{whatsappSpecificPickerMeta:m,template:p,onTemplateChange:e=>{null==g||g(e)},showVariableModal:c,variableList:n,variableListForImage:d,discountCode:u,setDiscountCode:C})]})};export{l as default};
@@ -1,11 +1,12 @@
1
1
  import { VariableListInterfaceV2 } from "../../add-variableV2/AddVariableV2";
2
2
  import { EmailTemplateType } from "../../template-preview/models/EmailTemplate";
3
3
  import { SMSTemplateType } from "../../template-preview/models/SmsTemplate";
4
+ import { WhatsAppCarouselTemplate } from "../../template-preview/models/WhatsappCarouselTemplate";
4
5
  import { WhatsAppPickerMeta, WhatsAppTemplate } from "../../template-preview/models/WhatsAppTemplate";
5
6
  export interface EditWhatsAppTemplateV2Props {
6
7
  whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
7
8
  template: WhatsAppTemplate;
8
- onTemplateChange?: (template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType) => void;
9
+ onTemplateChange?: (template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate) => void;
9
10
  showVariableModal?: boolean;
10
11
  variableList?: VariableListInterfaceV2[];
11
12
  variableListForImage?: VariableListInterfaceV2[];
@@ -1 +1 @@
1
- import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useState as e,useEffect as n}from"react";import{POD as i}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as l}from"../context/templateModalContext.js";import{getAllDataFromTemplateComponent as a}from"../utils/getDataFromTemplateComponent.js";import{BackTrackComponent as s}from"./BackTrackComponent.js";import{DiscountCodeComponent as d}from"./DiscountCodeComponent.js";import{EditTemplateMediaContainer as r}from"./EditMediaV2.style.js";import p from"./EditWhatsAppTemplateMediaV2.js";import{Container as c}from"./VariableConnectorsPanel.js";import u from"./VariableConnectorWhatsApp.js";import m from"./VariableEditorHeader.js";import v from"./WhatsAppTemplateCardButtonV2.js";const b=b=>{let{template:g,onTemplateChange:h,whatsappSpecificPickerMeta:f,showVariableModal:T,variableList:j,variableListForImage:C,discountCode:O,setDiscountCode:x}=b;var E,k,y,V,w,B,L,I,A,M,R,U,H,D,S,N;const{originalVariableList:P,pod:Q,extras:W}=l(),{descriptionComponents:F,urlBtns:_,qrbBtns:K,imageComponent:Y,bodyVariables:$,headerVariables:q}=a(g),[X,z]=e(!1);function G(t,o){var e,n,i,l,a;const s=Object.assign({},g),d=null==s?void 0:s.components.findIndex((t=>"BUTTONS"===t.type));if(void 0!==d&&d>-1){const a=null===(e=null==s?void 0:s.components[d].buttons)||void 0===e?void 0:e.findIndex((t=>"URL"===t.type));if(void 0!==a&&a>-1){const e="custom"===o&&"string"==typeof t,r=[...null!==(l=null===(i=null===(n=s.components)||void 0===n?void 0:n[d])||void 0===i?void 0:i.buttons)&&void 0!==l?l:[]];r[a]=Object.assign(Object.assign({},r[a]),{url:"https://d.bik.ai/{{1}}",example:[e?t:"string"!=typeof t?t.defaultValue:""]});const p=Object.assign(Object.assign({},s.components[d]),{buttons:r}),c=Object.assign(Object.assign({},s.mapping),{buttons:e?["((customBtnPlaceholder))"]:"string"!=typeof t?[t.placeHolder]:void 0});s.mapping=c;const u=[...s.components];u[d]=p,s.components=u}}if("string"!=typeof t){"checkout.checkoutUrl"===(null===(a=t.placeHolder)||void 0===a?void 0:a.slice(2,-2))?z(!0):(z(!1),null==x||x(""))}null==h||h(s)}function J(t,o,e){var n;const i=Object.assign({},g),l=null==i?void 0:i.components.findIndex((t=>"BUTTONS"===t.type));if(void 0!==l&&l>-1){const o=null===(n=null==i?void 0:i.components[l].buttons)||void 0===n?void 0:n.filter((t=>"QUICK_REPLY"===t.type));o&&(o[e]=Object.assign(Object.assign({},o[e]),{flowId:t.flowId,flowName:t.flowName}));const a=Object.assign(Object.assign({},i.components[l]),{buttons:o}),s=[...i.components];s[l]=a,i.components=s}null==h||h(i)}return n((()=>{var t;const o=null===(t=g.mapping.buttons)||void 0===t?void 0:t[0];"checkout.checkoutUrl"===(null==o?void 0:o.slice(2,-2))?z(!0):(z(!1),null==x||x(""))}),[g]),t(c,Object.assign({style:{flexDirection:"column",maxHeight:460}},{children:[!!Y&&o(r,{children:o(p,{whatsappSpecificPickerMeta:f,mediaComponent:Y,updateTemplateImageUrl:function(t,o){var e;let n=Object.assign({},g);const i=null===(e=null==n?void 0:n.components)||void 0===e?void 0:e.findIndex((t=>{if("HEADER"===t.type&&"NONE"!==t.format&&"TEXT"!==t.format)return!0}));if(void 0!==i&&i>-1&&(null==n?void 0:n.components[i])){const e=Object.assign(Object.assign({},n.components[i]),{format:o,example:{header_handle:[t]}}),l=[...n.components];l[i]=e,n=Object.assign(Object.assign({},n),{components:l})}n.mapping&&(n.mapping=Object.assign(Object.assign({},n.mapping),{header:void 0})),null==h||h(Object.assign({},n))},template:g,variableListForImage:C})}),($.length>0||q.length>0)&&o(m,{containerStyle:{paddingTop:Y?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null==F?void 0:F.map(((t,e)=>o(u,{originalVariableList:P,type:t.type,descriptionComponent:t.component,variableMapping:"HEADER"===t.type?g.mapping.header:g.mapping.body,showVariableModal:T,variableList:j},e))),(null===(k=null===(E=_[0])||void 0===E?void 0:E.component)||void 0===k?void 0:k.buttons)&&(null===(w=null===(V=null===(y=_[0])||void 0===y?void 0:y.component)||void 0===V?void 0:V.buttons)||void 0===w?void 0:w.length)>0&&o(m,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(B=null==P?void 0:P.buttons)||void 0===B?void 0:B.map(((t,e)=>{if("URL"===t.type)return o(v,{CTAoptions:null==f?void 0:f.CTAoptions,button:t,originalVariableList:P,updateSelectedURLTemplateBtn:G,variableList:j},`${e}`)})),(null===(I=null===(L=K[0])||void 0===L?void 0:L.component)||void 0===I?void 0:I.buttons)&&(null===(R=null===(M=null===(A=K[0])||void 0===A?void 0:A.component)||void 0===M?void 0:M.buttons)||void 0===R?void 0:R.length)>0&&(Q!==i.CHATBOT?o(m,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):o(s,{backTrackMessage:null===(U=null==W?void 0:W.backTrackExtra)||void 0===U?void 0:U[0],setBackTrackMessage:null===(H=null==W?void 0:W.backTrackExtra)||void 0===H?void 0:H[1]})),null===(D=null==P?void 0:P.buttons)||void 0===D?void 0:D.map(((t,e)=>{if("QUICK_REPLY"===t.type)return o(v,{QRBoptions:null==f?void 0:f.QRBoptions,button:t,originalVariableList:P,updateSelectedQRBTemplateBtn:J},`${e}`)})),Q===i.CHATBOT&&X&&o(d,{discountCode:null===(S=null==W?void 0:W.discountCodeExtra)||void 0===S?void 0:S[0],setDiscountCode:null===(N=null==W?void 0:W.discountCodeExtra)||void 0===N?void 0:N[1],variableList:j})]}))};export{b as default};
1
+ import{jsxs as o,jsx as n}from"react/jsx-runtime";import{cloneDeep as e}from"lodash";import{useState as t,useEffect as i}from"react";import{POD as s}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as l}from"../context/templateModalContext.js";import{useAdditionalVariables as a}from"../custom-hooks/useAdditionalVariables.js";import{getAllDataFromTemplateComponent as d}from"../utils/getDataFromTemplateComponent.js";import{BackTrackComponent as r}from"./BackTrackComponent.js";import{DiscountCodeComponent as p}from"./DiscountCodeComponent.js";import{EditTemplateMediaContainer as c}from"./EditMediaV2.style.js";import m from"./EditWhatsAppTemplateMediaV2.js";import u from"./VariableConnector.js";import{Container as v}from"./VariableConnectorsPanel.js";import b from"./VariableConnectorWhatsApp.js";import g from"./VariableEditorHeader.js";import h from"./WhatsAppTemplateCardButtonV2.js";const f=f=>{let{template:C,onTemplateChange:j,whatsappSpecificPickerMeta:T,showVariableModal:V,variableList:x,variableListForImage:O,discountCode:B,setDiscountCode:y}=f;var E,k,L,w,I,A,U,M,N,q,D,R,S,H,P,Q,W,_;const{originalVariableList:F,pod:Y,extras:K,selectedCarouselIndex:$}=l(),{descriptionComponents:X,urlBtns:z,qrbBtns:G,imageComponent:J,bodyVariables:Z,headerVariables:oo}=d(C),[no,eo]=t(!1),[to,io]=t(-1===$?{descriptionComponents:X,urlBtns:z,qrbBtns:G,imageComponent:J,bodyVariables:Z,headerVariables:oo}:{});function so(o,n){var t,i,s,l,a,d,r;const p=null!=$&&$>-1?{components:null===(t=Object.assign({},C).components[1].cards)||void 0===t?void 0:t[$].components,mapping:null===(i=Object.assign({},C).mapping.cards)||void 0===i?void 0:i[$]}:Object.assign({},C),c=null==p?void 0:p.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==c&&c>-1){const e=null===(s=null==p?void 0:p.components[c].buttons)||void 0===s?void 0:s.findIndex((o=>"URL"===o.type));if(void 0!==e&&e>-1){const t="custom"===n&&"string"==typeof o,i=[...null!==(d=null===(a=null===(l=p.components)||void 0===l?void 0:l[c])||void 0===a?void 0:a.buttons)&&void 0!==d?d:[]];i[e]=Object.assign(Object.assign({},i[e]),{url:"https://d.bik.ai/{{1}}",example:[t?o:"string"!=typeof o?o.defaultValue:""]});const s=Object.assign(Object.assign({},p.components[c]),{buttons:i}),r=Object.assign(Object.assign({},p.mapping),{buttons:t?["((customBtnPlaceholder))"]:"string"!=typeof o?[o.placeHolder]:void 0});p.mapping=r;const m=[...p.components];m[c]=s,p.components=m}}if("string"!=typeof o){"checkout.checkoutUrl"===(null===(r=o.placeHolder)||void 0===r?void 0:r.slice(2,-2))?eo(!0):(eo(!1),null==y||y(""))}if(null!=$&&$>-1){const o=e(C);o.components[1].cards[$].components=p.components,o.mapping.cards[$]=p.mapping,null==j||j(Object.assign({},o))}else null==j||j(p)}function lo(o,n,t){var i,s,l;const a=null!=$&&$>-1?{components:null===(i=Object.assign({},C).components[1].cards)||void 0===i?void 0:i[$].components,mapping:null===(s=Object.assign({},C).mapping.cards)||void 0===s?void 0:s[$]}:Object.assign({},C),d=null==a?void 0:a.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==d&&d>-1){const n=null===(l=null==a?void 0:a.components[d].buttons)||void 0===l?void 0:l.filter((o=>"QUICK_REPLY"===o.type));n&&(n[t]=Object.assign(Object.assign({},n[t]),{flowId:o.flowId,flowName:o.flowName}));const e=Object.assign(Object.assign({},a.components[d]),{buttons:n}),i=[...a.components];i[d]=e,a.components=i}if(null!=$&&$>-1){const o=e(C);o.components[1].cards[$].components=a.components,o.mapping.cards[$]=a.mapping,null==j||j(Object.assign({},o))}else null==j||j(a)}i((()=>{var o,n;if(null===(o=C.mapping.buttons)||void 0===o?void 0:o.find((o=>"checkout.checkoutUrl"===o.slice(2,-2))))eo(!0);else{eo(!1);const o=null===(n=null==K?void 0:K.discountCodeExtra)||void 0===n?void 0:n[1];null==o||o("")}}),[C]),i((()=>{var o,n,e,t;if(console.log("right panel selectedCarouselIndex: ",$),null!=$&&$>-1){const i={components:null===(n=null===(o=C.components[1])||void 0===o?void 0:o.cards)||void 0===n?void 0:n[$].components,mapping:null===(t=null===(e=null==C?void 0:C.mapping)||void 0===e?void 0:e.cards)||void 0===t?void 0:t[$]},{descriptionComponents:s,urlBtns:l,qrbBtns:a,imageComponent:r,bodyVariables:p,headerVariables:c}=d(i);console.log("right panel descriptionComponents: ",{descriptionComponents:s,urlBtns:l,qrbBtns:a,imageComponent:r,bodyVariables:p,headerVariables:c}),io({descriptionComponents:s,urlBtns:l,qrbBtns:a,imageComponent:r,bodyVariables:p,headerVariables:c})}else if(null!=$&&-1===$){const{descriptionComponents:o,urlBtns:n,qrbBtns:e,imageComponent:t,bodyVariables:i,headerVariables:s}=d(C);io({descriptionComponents:o,urlBtns:n,qrbBtns:e,imageComponent:t,bodyVariables:i,headerVariables:s})}}),[$]);const ao=a({variableList:x,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom Text",variableValue:"{{custom.text}}"});return o(v,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!to.mediaComponent&&n(c,{children:n(m,{whatsappSpecificPickerMeta:T,mediaComponent:to.mediaComponent,updateTemplateImageUrl:function(o,n){var t,i,s,l,a;let d;d=null!=$&&$>-1?{components:null===(i=null===(t=C.components[1])||void 0===t?void 0:t.cards)||void 0===i?void 0:i[$].components,mapping:null===(l=null===(s=null==C?void 0:C.mapping)||void 0===s?void 0:s.cards)||void 0===l?void 0:l[$]}:Object.assign({},C);const r=null===(a=null==d?void 0:d.components)||void 0===a?void 0:a.findIndex((o=>{if("HEADER"===o.type&&"NONE"!==o.format&&"TEXT"!==o.format)return!0}));if(void 0!==r&&r>-1&&(null==d?void 0:d.components[r])){const e=Object.assign(Object.assign({},d.components[r]),{format:n,example:{header_handle:[o]}}),t=[...d.components];t[r]=e,d=Object.assign(Object.assign({},d),{components:t})}if(d.mapping&&(d.mapping=Object.assign(Object.assign({},d.mapping),{header:void 0})),null!=$&&$>-1){const o=e(C);o.components[1].cards[$].components=d.components,o.mapping.cards[$]=d.mapping,null==j||j(Object.assign({},o))}else null==j||j(Object.assign({},d))},template:C,variableListForImage:O})}),(to.bodyVariables.length>0||to.headerVariables.length>0)&&n(g,{containerStyle:{paddingTop:to.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(E=to.descriptionComponents)||void 0===E?void 0:E.map(((o,e)=>n(b,{originalVariableList:null!=$&&$>-1?F.cards[$]:F,type:o.type,descriptionComponent:o.component,showVariableModal:V,variableList:x},e))),(null===(L=null===(k=to.urlBtns[0])||void 0===k?void 0:k.component)||void 0===L?void 0:L.buttons)&&(null===(A=null===(I=null===(w=to.urlBtns[0])||void 0===w?void 0:w.component)||void 0===I?void 0:I.buttons)||void 0===A?void 0:A.length)>0&&n(g,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(U=null!=$&&$>-1?F.cards[$].buttons:null==F?void 0:F.buttons)||void 0===U?void 0:U.map(((o,e)=>{if("URL"===o.type)return n(h,{variableListIndex:e,CTAoptions:null==T?void 0:T.CTAoptions,button:o,originalVariableList:null!=$&&$>-1?F.cards[$]:F,updateSelectedURLTemplateBtn:so,variableList:x},`${e}`)})),(null===(N=null===(M=to.qrbBtns[0])||void 0===M?void 0:M.component)||void 0===N?void 0:N.buttons)&&(null===(R=null===(D=null===(q=to.qrbBtns[0])||void 0===q?void 0:q.component)||void 0===D?void 0:D.buttons)||void 0===R?void 0:R.length)>0&&(Y!==s.CHATBOT?n(g,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):n(r,{backTrackMessage:null===(S=null==K?void 0:K.backTrackExtra)||void 0===S?void 0:S[0],setBackTrackMessage:null===(H=null==K?void 0:K.backTrackExtra)||void 0===H?void 0:H[1]})),null===(P=null!=$&&$>-1?F.cards[$].buttons:null==F?void 0:F.buttons)||void 0===P?void 0:P.map(((o,e)=>{if("QUICK_REPLY"===o.type)return n(h,{variableListIndex:e,QRBoptions:null==T?void 0:T.QRBoptions,button:o,originalVariableList:null!=$&&$>-1?F.cards[$]:F,updateSelectedQRBTemplateBtn:lo},`${e}`)})),Y===s.CHATBOT&&no&&n(p,{discountCode:null===(Q=null==K?void 0:K.discountCodeExtra)||void 0===Q?void 0:Q[0],setDiscountCode:null===(W=null==K?void 0:K.discountCodeExtra)||void 0===W?void 0:W[1],variableList:x}),null===(_=null!=$&&$>-1?F.cards[$].buttons:null==F?void 0:F.buttons)||void 0===_?void 0:_.map(((o,e)=>{var t,i,s;if("COPY_CODE"===o.type)return n(u,{index:e,variable:{variableName:null!==(t=o.text)&&void 0!==t?t:"",updatedValue:null!==(i=o.buttonVariable)&&void 0!==i?i:"",type:"string",isEditableVariable:!0,index:null!==(s=o.index)&&void 0!==s?s:0},showVariableModal:!0,variableList:ao,componentType:"BUTTONS"},e)}))]}))};export{f as default};
@@ -1,5 +1,6 @@
1
1
  export interface FooterProps {
2
+ isWhatsappCarousel: boolean;
2
3
  onSelect: () => void;
3
4
  }
4
- declare const Footer: ({ onSelect }: FooterProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const Footer: ({ isWhatsappCarousel, onSelect }: FooterProps) => import("react/jsx-runtime").JSX.Element;
5
6
  export default Footer;
@@ -1,7 +1,7 @@
1
- import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"styled-components";import{Button as r}from"../../button/Button.js";import{COLORS as i}from"../../../constants/Theme.js";import{Badge as n}from"../Badge/index.js";import{useTemplateModalContext as s}from"../context/templateModalContext.js";const p=o.div`
2
- background: ${i.surface.standard};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as r}from"react";import s from"styled-components";import{Button as a}from"../../button/Button.js";import{COLORS as n}from"../../../constants/Theme.js";import{Badge as i}from"../Badge/index.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";const l=s.div`
2
+ background: ${n.surface.standard};
3
3
  border-top-width: 1px;
4
- border-top-color: ${i.stroke.primary};
4
+ border-top-color: ${n.stroke.primary};
5
5
  box-shadow: 0px -4px 12px rgba(0, 0, 0, 0.12);
6
6
  width: 100%;
7
7
  padding: 16px 24px;
@@ -10,4 +10,4 @@ import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"styled-component
10
10
  gap: 12;
11
11
  border-bottom-left-radius: 4px;
12
12
  border-bottom-right-radius: 4px;
13
- `,a=o=>{let{onSelect:i}=o;const{isError:a}=s();return t(p,{children:[a&&e(n,{errorText:"Some inputs are missing or incorrect. Please check"}),e(r,{id:"select-template-btn",buttonText:"Select template",size:"large",onClick:i})]})};export{a as default};
13
+ `,d=s=>{let{isWhatsappCarousel:n,onSelect:d}=s;const{isError:m,selectedCarouselIndex:c,setSelectedCarouselIndex:x}=p(),[u,f]=o(n?"Next":"Select template");return r((()=>{n&&-1===c?f("Next"):n&&null!=c&&c>-1&&f("Save & Select Template")}),[c]),e(l,{children:[m&&t(i,{errorText:"Some inputs are missing or incorrect. Please check"}),t(a,{id:"select-template-btn",buttonText:u,size:n?"small":"large",onClick:function(){n&&-1===c&&x&&x(0),d()}})]})};export{d as default};