@bikdotai/bik-component-library 0.0.610 → 0.0.611-beat.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +0 -2
- package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +0 -2
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts +3 -1
- package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/utils/constants.d.ts +1 -0
- package/dist/cjs/components/template-context-mapper/utils/constants.js +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +0 -2
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +0 -2
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts +3 -1
- package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/esm/components/template-context-mapper/utils/constants.d.ts +1 -0
- package/dist/esm/components/template-context-mapper/utils/constants.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default EventsTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
3
|
+
import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
|
|
4
|
+
import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
|
|
5
5
|
declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
|
|
6
6
|
cacheKey: string;
|
|
7
7
|
propertyAddBtnText: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),o=require("../../constants/Theme.js"),r=require("../../assets/icons/chevronDown.svg.js"),i=require("../input/Input.js"),l=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),o=require("../../constants/Theme.js"),r=require("../../assets/icons/chevronDown.svg.js"),i=require("../input/Input.js"),l=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),a=require("./DropdownPopover/index.js"),d=require("./OpenedDropdown/utils/iterationOnOptions.js");function u(){}const p=p=>{var c,h,v,j,{placeHolder:f,size:g,onSelect:x,defaultOptions:w,disabled:S,noErrorHint:b,placeHolderHeight:O,showPlaceholderWhenSelected:y=!1,inputStyle:D={},inputType:q="default",onDeleteChip:H,truncatedText:m}=p,C=e.__rest(p,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText"]);const[T,I]=n.useState(!1),E=null!=g?g:"default",P=n.useRef(),[_,z]=n.useState(null!=w?w:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==C?void 0:C.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),z([...t])}),[C.options]),n.useEffect((()=>{w&&z([...w])}),[w]);const W=d.getSelectedOptionsAsText(_);return t.jsx(l.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:O||("small"===E?32:48),width:null!==(h=null!==(c=C.buttonWidth)&&void 0!==c?c:C.width)&&void 0!==h?h:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},D),input:{minHeight:"100%"}}},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":C["data-test"],ref:P,onSelect:function(e){Array.isArray(e)?z([...e]):z([e]),null==x||x(e)},disabled:S,onDropdownVisbilityChange:e=>I(e)},C,{children:["default"==q&&t.jsx(i.Input,{version:C.version,noErrorHint:b,state:S?"disabled":"none",value:y?f:null!=W?W:"",errorMessage:C.error,variant:E,placeholder:null!=f?f:"Select an option",width:null!==(v=C.width)&&void 0!==v?v:"100%",onChangeText:u,rightIcon:{icon:()=>t.jsx(r.default,{style:{transform:T?"rotate(180deg)":"rotate(0deg)"},onClick:u,width:"small"===E?20:24,height:"small"===E?20:24,color:o.COLORS.content.primary})},truncateText:null==m||m}),"chip"==q&&t.jsx(s.default,{placeholder:null!=f?f:"Select options",chips:_,onDeleteChip:e=>{null==H||H(e)},isDropdownOpened:T,sizeToUse:E,containerStyle:{width:null!==(j=C.width)&&void 0!==j?j:"100%",cursor:"pointer"}})]}))}))};p.displayName="Dropdown",exports.Dropdown=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),t=require("react"),n=require("react-popper"),r=require("../../dropShadow/DropShadow.js"),l=require("../../tooltips/Tooltip.js"),s=require("../Common.styled.js"),i=require("../OpenedDropdown/components/OpennedDropdown.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=a(t).default.forwardRef(((a,d)=>{var{children:p,onDropdownVisbilityChange:c,version:u="1.0",tooltipContent:v,tooltipDirection:j,showTooltipArrow:w}=a,b=e.__rest(a,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const h=d,[f,D]=t.useState(!1),[O,g]=t.useState(null),[x,y]=t.useState(null),m=t.useRef(null),{styles:S,attributes:C}=n.usePopper(O,x,{placement:b.placement,strategy:b.strategy}),q=e=>{var o,t;"2.0"===u&&b.isMultiSelect&&e&&(null===(o=b.onSelect)||void 0===o||o.call(b,[...e])),D(!1),null===(t=null==b?void 0:b.onClose)||void 0===t||t.call(b)};t.useImperativeHandle(h,(()=>({openDropdown:f})),[]),t.useEffect((()=>{(null==h?void 0:h.current)&&(h.current.openDropdown=f)}),[f]),t.useEffect((()=>{null==c||c(f)}),[f]);const E=()=>o.jsxs(o.Fragment,{children:[o.jsxs("div",Object.assign({style:{position:"relative"},ref:g},{children:[o.jsx(s.OverLapAbs,Object.assign({ref:m,allowEvents:b.allowEvents,disabled:b.disabled,onClick:e=>{var o;null===(o=b.onDropdownOpen)||void 0===o||o.call(b),f?(D(!1),e.preventDefault()):b.disabled||D(!0)}},{children:b.allowEvents?p:null})),b.allowEvents?null:p]})),f&&o.jsx(s.OpenDropdownContainer,Object.assign({ref:y,style:Object.assign(Object.assign({},S.popper),{zIndex:3})},C.popper,{children:o.jsx(r.DropShadow,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:o.jsx(i.OpenedDropdown,Object.assign({},b,{onSelect:e=>{var o;"2.0"===u&&b.isMultiSelect||(null===(o=b.onSelect)||void 0===o||o.call(b,e),D(!1))},onClose:q,version:u,headerRef:m}))}))}))]});return o.jsx(o.Fragment,{children:f||void 0===v?E():o.jsx(l.Tooltip,Object.assign({body:v,placement:j,hideArrow:!w},{children:o.jsx("div",Object.assign({"data-test":b["data-test"]},{children:E()}))}))})}));d.displayName="DropdownPopover",exports.DropdownPopover=d;
|
|
@@ -15,7 +15,6 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
15
15
|
selectedLabel?: string | undefined;
|
|
16
16
|
children?: SingleOption[] | undefined;
|
|
17
17
|
parent?: SingleOption | undefined;
|
|
18
|
-
'data-test'?: string | undefined;
|
|
19
18
|
} | {
|
|
20
19
|
label?: string | undefined;
|
|
21
20
|
value?: string | undefined;
|
|
@@ -31,7 +30,6 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
31
30
|
selectedLabel?: string | undefined;
|
|
32
31
|
children?: SingleOption[] | undefined;
|
|
33
32
|
parent?: SingleOption | undefined;
|
|
34
|
-
'data-test'?: string | undefined;
|
|
35
33
|
options: SingleOption[];
|
|
36
34
|
})[];
|
|
37
35
|
export declare function iterateOnOptionsRaw(options: DropdownOption[], cb: (option: SingleOption) => void): void;
|
|
@@ -22,7 +22,6 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
22
22
|
selectedLabel?: string | undefined;
|
|
23
23
|
children?: SingleOption[] | undefined;
|
|
24
24
|
parent?: SingleOption | undefined;
|
|
25
|
-
'data-test'?: string | undefined;
|
|
26
25
|
} | {
|
|
27
26
|
label?: string | undefined;
|
|
28
27
|
value?: string | undefined;
|
|
@@ -38,7 +37,6 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
38
37
|
selectedLabel?: string | undefined;
|
|
39
38
|
children?: SingleOption[] | undefined;
|
|
40
39
|
parent?: SingleOption | undefined;
|
|
41
|
-
'data-test'?: string | undefined;
|
|
42
40
|
options: SingleOption[];
|
|
43
41
|
})[] | undefined;
|
|
44
42
|
selectAllHandler: (newState: SelectAllCheckboxState) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("lodash"),t=require("react"),o=require("styled-components"),i=require("../../input/Input.js"),l=require("../../template-preview/models/TemplateMeta.js"),a=require("../../template-preview/models/WhatsAppTemplate.js"),s=require("../context/templateModalContext.js"),d=require("../utils/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("lodash"),t=require("react"),o=require("styled-components"),i=require("../../input/Input.js"),l=require("../../template-preview/models/TemplateMeta.js"),a=require("../../template-preview/models/WhatsAppTemplate.js"),s=require("../context/templateModalContext.js"),d=require("../utils/constants.js"),u=require("../utils/getDataFromTemplateComponent.js"),r=require("../utils/validateIsUrl.js"),p=require("../utils/validateName.js"),c=require("./BackTrackComponent.js"),v=require("./DiscountCodeComponent.js"),m=require("./EditMediaModal.js"),b=require("./EditMediaV2.js"),g=require("./EditMediaV2.style.js"),f=require("./useEditWhtasappTemplateMedia.js"),j=require("./VariableConnector.js"),h=require("./VariableConnectorsPanel.js"),C=require("./VariableConnectorWhatsApp.js"),x=require("./VariableEditorHeader.js"),O=require("./WhatsAppTemplateCardButtonV2.js");function T(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const y=T(o).default.div`
|
|
2
2
|
padding-top: 24px;
|
|
3
3
|
padding-left: 10px;
|
|
4
4
|
padding-right: 10px;
|
|
5
5
|
margin-bottom: 8px;
|
|
6
6
|
line-height: normal;
|
|
7
|
-
`;exports.default=o=>{let{template:O,onTemplateChange:y,whatsappSpecificPickerMeta:E,showVariableModal:V,variableListForImage:B,setDiscountCode:M,fileName:k,setFileName:I}=o;var q,R,D,L,U,P,w,A,N,S,_,F,H,Q,Y,K,W,$,G,X,z,J,Z,ee,ne,te,oe,ie,le,ae,se,de,ue,re,pe,ce,ve,me,be;const ge=O.isCarouselType,{originalVariableList:fe,pod:je,extras:he,selectedCarouselIndex:Ce,isProductCarouselType:xe,disableCopyCode:Oe}=s.useTemplateModalContext(),{descriptionComponents:Te,urlBtns:ye,qrbBtns:Ee,imageComponent:Ve,bodyVariables:Be,headerVariables:Me}=d.getAllDataFromTemplateComponent(O),ke=t.useRef(null),[Ie,qe]=t.useState(!1),[Re,De]=t.useState(-1===Ce?{descriptionComponents:Te,urlBtns:ye,qrbBtns:Ee,imageComponent:Ve,bodyVariables:Be,headerVariables:Me}:{}),{uploadMediaLink:Le,uploadMediaFiles:Ue,validateMimeType:Pe}=E,we=g.useEditWhatsappTemplateMedia({uploadMediaLink:Le,uploadMediaFiles:Ue,updateTemplateImageUrl:function(e,t){var o,i,l,a,s,d,u,r;let p;p=null!=Ce&&Ce>-1?{components:null===(i=null===(o=O.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[Ce].components,mapping:null===(a=null===(l=null==O?void 0:O.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Ce]}:Object.assign({},O);const c=null===(s=null==p?void 0:p.components)||void 0===s?void 0:s.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==c&&c>-1&&(null==p?void 0:p.components[c])){const n=Object.assign(Object.assign({},p.components[c]),{format:t,example:{header_handle:[e]}}),o=[...p.components];o[c]=n,p=Object.assign(Object.assign({},p),{components:o})}p.mapping&&(p.mapping=Object.assign(Object.assign({},p.mapping),{header:void 0}));if(null!=Ce&&Ce>-1){const e=n.cloneDeep(O);e.components[1].cards[Ce].components=p.components,(null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)&&(null===(u=null==e?void 0:e.mapping)||void 0===u?void 0:u.cards.length)>0&&(e.mapping.cards[Ce]=null!==(r=p.mapping)&&void 0!==r?r:{}),null==y||y(Object.assign({},e)),Ne(!0)}else null==y||y(Object.assign({},p))},validateMimeType:Pe,mediaComponent:ge?Re.imageComponent:Ve,fileRef:ke}),[Ae,Ne]=t.useState(!1),[Se,_e]=t.useState(k),[Fe,He]=t.useState();function Qe(e,t,o){var i,l,a,s,d,u,r,p,c,v;const m=null!=Ce&&Ce>-1?{components:null===(i=Object.assign({},O).components[1].cards)||void 0===i?void 0:i[Ce].components,mapping:null===(l=Object.assign({},O).mapping.cards)||void 0===l?void 0:l[Ce]}:Object.assign({},O),b=n.cloneDeep(m),g="custom"===t&&"string"==typeof e,f=g?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Ce&&Ce>-1&&xe){const t=Object.assign({},O).components.map((e=>{var n;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(n=e.cards)||void 0===n?void 0:n.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var n,t,i;if("BUTTONS"===e.type){const l=null===(n=e.buttons)||void 0===n?void 0:n.filter((e=>"URL"===e.type));let a=null!==(t=null==l?void 0:l[o])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const s=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},e),{buttons:s})}return e}))})))}):e})),i=null===(s=null===(a=Object.assign({},O).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((n=>{var t;return Object.assign(Object.assign({},n),{buttons:null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.map((n=>g?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:""))})})),l=n.cloneDeep(O);return l.components=t,l.mapping.cards=i,void(null==y||y(Object.assign({},l)))}const j=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==j&&j>-1){const n=null===(d=null==b?void 0:b.components[j].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==n?void 0:n.length)>0){const i="custom"===t&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let a=n[o];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(p=null===(r=null===(u=b.components)||void 0===u?void 0:u[j])||void 0===r?void 0:r.buttons)&&void 0!==p?p:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e)),d=Object.assign(Object.assign({},b.components[j]),{buttons:s}),v=null===(c=b.mapping)||void 0===c?void 0:c.buttons;v&&v.length>0&&(v[o]=i?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[j]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?qe(!0):(qe(!1),null==M||M(""))}if(null!=Ce&&Ce>-1){const e=n.cloneDeep(O);e.components[1].cards[Ce].components=b.components,e.mapping.cards[Ce]=b.mapping,null==y||y(Object.assign({},e))}else null==y||y(b)}function Ye(e,t,o){var i,l,a,s,d,u,r;const p=null!=Ce&&Ce>-1?{components:null===(i=Object.assign({},O).components[1].cards)||void 0===i?void 0:i[Ce].components,mapping:null===(l=Object.assign({},O).mapping.cards)||void 0===l?void 0:l[Ce]}:Object.assign({},O);if(null!=Ce&&Ce>-1&&xe){const t=Object.assign({},O).components.map((n=>{var t;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(t=n.cards)||void 0===t?void 0:t.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var t,i,l;if("BUTTONS"===n.type){const a=null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let s=null!==(i=null==a?void 0:a[o])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=null==n?void 0:n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=n.cloneDeep(O);return i.components=t,void(null==y||y(Object.assign({},i)))}const c=null==p?void 0:p.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==c&&c>-1){const n=null===(s=null===(a=null==p?void 0:p.components[c])||void 0===a?void 0:a.buttons)||void 0===s?void 0:s.filter((e=>"QUICK_REPLY"===e.type));if(n){let t=n[o];t=Object.assign(Object.assign({},t),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(r=null===(u=null===(d=p.components)||void 0===d?void 0:d[c])||void 0===u?void 0:u.buttons)&&void 0!==r?r:[]].map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),l=Object.assign(Object.assign({},p.components[c]),{buttons:i}),a=[...p.components];a[c]=l,p.components=a}}if(null!=Ce&&Ce>-1){const e=n.cloneDeep(O);e.components[1].cards[Ce].components=p.components,null==y||y(Object.assign({},e))}else null==y||y(p)}t.useEffect((()=>{var e,n;if(null===(e=O.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))qe(!0);else{qe(!1);const e=null===(n=null==he?void 0:he.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[O]),t.useEffect((()=>{var e,n,t,o;if(null!=Ce&&Ce>-1){const i={components:null===(n=null===(e=O.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[Ce].components,mapping:null===(o=null===(t=null==O?void 0:O.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[Ce]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:u,bodyVariables:r,headerVariables:p}=d.getAllDataFromTemplateComponent(i);De({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:u,bodyVariables:r,headerVariables:p})}else if(null!=Ce&&-1===Ce){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l}=d.getAllDataFromTemplateComponent(O);De({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l})}}),[Ce]),t.useEffect((()=>{var e,n,t,o;if(null!=Ce&&Ce>-1&&Ae){const i={components:null===(n=null===(e=O.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[Ce].components,mapping:null===(o=null===(t=null==O?void 0:O.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[Ce]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:u,bodyVariables:r,headerVariables:p}=d.getAllDataFromTemplateComponent(i);De({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:u,bodyVariables:r,headerVariables:p}),Ne(!1)}}),[Ae]);const Ke=ge?Re.imageComponent:Ve;return we.openEditMedia?e.jsx(j.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(v.default,{mediaComponentFormat:null!==(q=Ke.format)&&void 0!==q?q:l.HEADER_TYPES.IMAGE,uploadMedia:we.uploadMedia,variableListForImage:B||[],useEditWhatsappTemplateMediaResponse:we,setOpenEditMedia:we.setOpenEditMedia,openEditMedia:we.openEditMedia,editIconRef:we.editIconRef,fileRef:ke})})):e.jsxs(j.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:xe?"420px":"auto"}},{children:[!!Re.imageComponent&&!xe&&e.jsxs(b.EditTemplateMediaContainer,{children:[e.jsx(m.default,{imageName:null!==(D=null===(R=null==Ke?void 0:Ke.example)||void 0===R?void 0:R.header_handle)&&void 0!==D?D:[],handleImageChange:we.handleImageChange,mediaType:null==Ke?void 0:Ke.format,error:we.error,isLoading:we.loading,setOpenEditMedia:we.setOpenEditMedia,selectedVariable:u.isVariable(null!==(P=null===(U=null===(L=null==Ke?void 0:Ke.example)||void 0===L?void 0:L.header_handle)||void 0===U?void 0:U[0])&&void 0!==P?P:"")?null===(A=null===(w=null==Ke?void 0:Ke.example)||void 0===w?void 0:w.header_handle)||void 0===A?void 0:A[0]:(null===(S=null===(N=null==O?void 0:O.mapping)||void 0===N?void 0:N.header)||void 0===S?void 0:S[0])?null===(F=null===(_=null==O?void 0:O.mapping)||void 0===_?void 0:_.header)||void 0===F?void 0:F[0]:we.selectedVariable}),(null==Ve?void 0:Ve.format)==l.HEADER_TYPES.DOCUMENT?e.jsx(T,{children:e.jsx(i.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:Se,errorMessage:Fe||void 0,onBlur:()=>{if(!Se)return null==I||I(""),void He("PDF name is Required");const e=r.validateInputName(Se);null==I||I(Se),He(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{He(""),_e(e)}})}):e.jsx(e.Fragment,{})]}),(null===(H=Re.bodyVariables)||void 0===H?void 0:H.length)>0&&e.jsx(C.default,{containerStyle:{paddingTop:Re.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===(Q=Re.descriptionComponents)||void 0===Q?void 0:Q.map(((n,t)=>e.jsx(h.default,{originalVariableList:null!=Ce&&Ce>-1?fe.cards[Ce]:fe,type:n.type,descriptionComponent:n.component,showVariableModal:V},t))),(null===(W=null===(K=null!=Ce&&Ce>-1?null===(Y=fe.cards[Ce])||void 0===Y?void 0:Y.buttons:null==fe?void 0:fe.buttons)||void 0===K?void 0:K.filter((e=>"URL"===e.type)))||void 0===W?void 0:W.length)>0&&e.jsx(C.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(X=null===(G=null!=Ce&&Ce>-1?null===($=fe.cards[Ce])||void 0===$?void 0:$.buttons:null==fe?void 0:fe.buttons)||void 0===G?void 0:G.filter((e=>je===a.POD.CHATBOT||"URL"===e.type)))||void 0===X?void 0:X.map(((n,t)=>{if("URL"===n.type)return e.jsx(x.default,{variableListIndex:t,CTAoptions:null==E?void 0:E.CTAoptions,button:n,currentVariableList:null!=Ce&&Ce>-1?Object.assign({},fe.cards[Ce]):Object.assign({},fe),updateSelectedURLTemplateBtn:Qe},`${t}_${Ce}`)})),je===a.POD.CHATBOT&&(null===(J=null===(z=Ee[0])||void 0===z?void 0:z.component)||void 0===J?void 0:J.buttons)&&(null===(ne=null===(ee=null===(Z=Ee[0])||void 0===Z?void 0:Z.component)||void 0===ee?void 0:ee.buttons)||void 0===ne?void 0:ne.length)>0&&e.jsx(p.BackTrackComponent,{backTrackMessage:null===(te=null==he?void 0:he.backTrackExtra)||void 0===te?void 0:te[0],setBackTrackMessage:null===(oe=null==he?void 0:he.backTrackExtra)||void 0===oe?void 0:oe[1]}),(null===(ae=null===(le=null!=Ce&&Ce>-1?null===(ie=fe.cards[Ce])||void 0===ie?void 0:ie.buttons:null==fe?void 0:fe.buttons)||void 0===le?void 0:le.filter((e=>"QUICK_REPLY"===e.type)))||void 0===ae?void 0:ae.length)>0&&(je!==a.POD.CHATBOT?e.jsx(C.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):e.jsx(p.BackTrackComponent,{backTrackMessage:null===(se=null==he?void 0:he.backTrackExtra)||void 0===se?void 0:se[0],setBackTrackMessage:null===(de=null==he?void 0:he.backTrackExtra)||void 0===de?void 0:de[1]})),null===(pe=null===(re=null!=Ce&&Ce>-1?null===(ue=fe.cards[Ce])||void 0===ue?void 0:ue.buttons:null==fe?void 0:fe.buttons)||void 0===re?void 0:re.filter((e=>"QUICK_REPLY"===e.type)))||void 0===pe?void 0:pe.map(((n,t)=>{if("QUICK_REPLY"===n.type&&je!==a.POD.CHATBOT)return e.jsx(x.default,{variableListIndex:t,QRBoptions:null==E?void 0:E.QRBoptions,button:n,currentVariableList:null!=Ce&&Ce>-1?Object.assign({},fe.cards[Ce]):Object.assign({},fe),updateSelectedQRBTemplateBtn:Ye},`${t}_${Ce}`)})),je===a.POD.CHATBOT&&Ie&&e.jsx(c.DiscountCodeComponent,{discountCode:null===(ce=null==he?void 0:he.discountCodeExtra)||void 0===ce?void 0:ce[0],setDiscountCode:null===(ve=null==he?void 0:he.discountCodeExtra)||void 0===ve?void 0:ve[1]}),null===(be=null!=Ce&&Ce>-1?null===(me=fe.cards[Ce])||void 0===me?void 0:me.buttons:null==fe?void 0:fe.buttons)||void 0===be?void 0:be.map(((n,t)=>{var o,l,a,s,d;if("COPY_CODE"===n.type)return e.jsx(e.Fragment,{children:Oe?e.jsx("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:e.jsx(i.Input,{state:"disabled",labelText:null!==(o=n.text)&&void 0!==o?o:"Copy Code",value:null!==(l=n.buttonVariable)&&void 0!==l?l:"",onChangeText:()=>{}})})):e.jsx(f.default,{index:t,variable:{variableName:null!==(a=n.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=n.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(d=n.index)&&void 0!==d?d:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:n.type},t)})}))]}))};
|
|
7
|
+
`;exports.default=o=>{let{template:T,onTemplateChange:E,whatsappSpecificPickerMeta:V,showVariableModal:B,variableListForImage:M,setDiscountCode:k,fileName:I,setFileName:R}=o;var q,D,L,U,A,P,w,_,N,S,F,H,Q,Y,K,W,$,G,X,z,J,Z,ee,ne,te,oe,ie,le,ae,se,de,ue,re,pe,ce,ve,me,be,ge;const fe=T.isCarouselType,{originalVariableList:je,pod:he,extras:Ce,selectedCarouselIndex:xe,isProductCarouselType:Oe,disableCopyCode:Te}=s.useTemplateModalContext(),{descriptionComponents:ye,urlBtns:Ee,qrbBtns:Ve,imageComponent:Be,bodyVariables:Me,headerVariables:ke}=u.getAllDataFromTemplateComponent(T),Ie=t.useRef(null),[Re,qe]=t.useState(!1),[De,Le]=t.useState(-1===xe?{descriptionComponents:ye,urlBtns:Ee,qrbBtns:Ve,imageComponent:Be,bodyVariables:Me,headerVariables:ke}:{}),{uploadMediaLink:Ue,uploadMediaFiles:Ae,validateMimeType:Pe}=V,we=f.useEditWhatsappTemplateMedia({uploadMediaLink:Ue,uploadMediaFiles:Ae,updateTemplateImageUrl:function(e,t){var o,i,l,a,s,d,u,r;let p;p=null!=xe&&xe>-1?{components:null===(i=null===(o=T.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[xe].components,mapping:null===(a=null===(l=null==T?void 0:T.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[xe]}:Object.assign({},T);const c=null===(s=null==p?void 0:p.components)||void 0===s?void 0:s.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==c&&c>-1&&(null==p?void 0:p.components[c])){const n=Object.assign(Object.assign({},p.components[c]),{format:t,example:{header_handle:[e]}}),o=[...p.components];o[c]=n,p=Object.assign(Object.assign({},p),{components:o})}p.mapping&&(p.mapping=Object.assign(Object.assign({},p.mapping),{header:void 0}));if(null!=xe&&xe>-1){const e=n.cloneDeep(T);e.components[1].cards[xe].components=p.components,(null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)&&(null===(u=null==e?void 0:e.mapping)||void 0===u?void 0:u.cards.length)>0&&(e.mapping.cards[xe]=null!==(r=p.mapping)&&void 0!==r?r:{}),null==E||E(Object.assign({},e)),Ne(!0)}else null==E||E(Object.assign({},p))},validateMimeType:Pe,mediaComponent:fe?De.imageComponent:Be,fileRef:Ie}),[_e,Ne]=t.useState(!1),[Se,Fe]=t.useState(I),[He,Qe]=t.useState();function Ye(e,t,o){var i,l,a,s,d,u,r,p,c,v;const m=null!=xe&&xe>-1?{components:null===(i=Object.assign({},T).components[1].cards)||void 0===i?void 0:i[xe].components,mapping:null===(l=Object.assign({},T).mapping.cards)||void 0===l?void 0:l[xe]}:Object.assign({},T),b=n.cloneDeep(m),g="custom"===t&&"string"==typeof e,f=g?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=xe&&xe>-1&&Oe){const t=Object.assign({},T).components.map((e=>{var n;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(n=e.cards)||void 0===n?void 0:n.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var n,t,i;if("BUTTONS"===e.type){const l=null===(n=e.buttons)||void 0===n?void 0:n.filter((e=>"URL"===e.type));let a=null!==(t=null==l?void 0:l[o])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const s=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},e),{buttons:s})}return e}))})))}):e})),i=null===(s=null===(a=Object.assign({},T).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((n=>{var t;return Object.assign(Object.assign({},n),{buttons:null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.map((n=>g?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:""))})})),l=n.cloneDeep(T);return l.components=t,l.mapping.cards=i,void(null==E||E(Object.assign({},l)))}const j=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==j&&j>-1){const n=null===(d=null==b?void 0:b.components[j].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==n?void 0:n.length)>0){const i="custom"===t&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let a=n[o];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(p=null===(r=null===(u=b.components)||void 0===u?void 0:u[j])||void 0===r?void 0:r.buttons)&&void 0!==p?p:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e)),d=Object.assign(Object.assign({},b.components[j]),{buttons:s}),v=null===(c=b.mapping)||void 0===c?void 0:c.buttons;v&&v.length>0&&(v[o]=i?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[j]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?qe(!0):(qe(!1),null==k||k(""))}if(null!=xe&&xe>-1){const e=n.cloneDeep(T);e.components[1].cards[xe].components=b.components,e.mapping.cards[xe]=b.mapping,null==E||E(Object.assign({},e))}else null==E||E(b)}function Ke(e,t,o){var i,l,a,s,d,u,r;const p=null!=xe&&xe>-1?{components:null===(i=Object.assign({},T).components[1].cards)||void 0===i?void 0:i[xe].components,mapping:null===(l=Object.assign({},T).mapping.cards)||void 0===l?void 0:l[xe]}:Object.assign({},T);if(null!=xe&&xe>-1&&Oe){const t=Object.assign({},T).components.map((n=>{var t;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(t=n.cards)||void 0===t?void 0:t.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var t,i,l;if("BUTTONS"===n.type){const a=null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let s=null!==(i=null==a?void 0:a[o])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=null==n?void 0:n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=n.cloneDeep(T);return i.components=t,void(null==E||E(Object.assign({},i)))}const c=null==p?void 0:p.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==c&&c>-1){const n=null===(s=null===(a=null==p?void 0:p.components[c])||void 0===a?void 0:a.buttons)||void 0===s?void 0:s.filter((e=>"QUICK_REPLY"===e.type));if(n){let t=n[o];t=Object.assign(Object.assign({},t),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(r=null===(u=null===(d=p.components)||void 0===d?void 0:d[c])||void 0===u?void 0:u.buttons)&&void 0!==r?r:[]].map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),l=Object.assign(Object.assign({},p.components[c]),{buttons:i}),a=[...p.components];a[c]=l,p.components=a}}if(null!=xe&&xe>-1){const e=n.cloneDeep(T);e.components[1].cards[xe].components=p.components,null==E||E(Object.assign({},e))}else null==E||E(p)}t.useEffect((()=>{var e,n;if(null===(e=T.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))qe(!0);else{qe(!1);const e=null===(n=null==Ce?void 0:Ce.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[T]),t.useEffect((()=>{var e,n,t,o;if(null!=xe&&xe>-1){const i={components:null===(n=null===(e=T.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[xe].components,mapping:null===(o=null===(t=null==T?void 0:T.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[xe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=u.getAllDataFromTemplateComponent(i);Le({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p})}else if(null!=xe&&-1===xe){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l}=u.getAllDataFromTemplateComponent(T);Le({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l})}}),[xe]),t.useEffect((()=>{var e,n,t,o;if(null!=xe&&xe>-1&&_e){const i={components:null===(n=null===(e=T.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[xe].components,mapping:null===(o=null===(t=null==T?void 0:T.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[xe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=u.getAllDataFromTemplateComponent(i);Le({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}),Ne(!1)}}),[_e]);const We=fe?De.imageComponent:Be;return we.openEditMedia?e.jsx(h.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(m.default,{mediaComponentFormat:null!==(q=We.format)&&void 0!==q?q:l.HEADER_TYPES.IMAGE,uploadMedia:we.uploadMedia,variableListForImage:M||[],useEditWhatsappTemplateMediaResponse:we,setOpenEditMedia:we.setOpenEditMedia,openEditMedia:we.openEditMedia,editIconRef:we.editIconRef,fileRef:Ie})})):e.jsxs(h.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Oe?"420px":"auto"}},{children:[!!De.imageComponent&&!Oe&&e.jsxs(g.EditTemplateMediaContainer,{children:[e.jsx(b.default,{imageName:null!==(L=null===(D=null==We?void 0:We.example)||void 0===D?void 0:D.header_handle)&&void 0!==L?L:[],handleImageChange:we.handleImageChange,mediaType:null==We?void 0:We.format,error:we.error,isLoading:we.loading,setOpenEditMedia:we.setOpenEditMedia,selectedVariable:r.isVariable(null!==(P=null===(A=null===(U=null==We?void 0:We.example)||void 0===U?void 0:U.header_handle)||void 0===A?void 0:A[0])&&void 0!==P?P:"")?null===(_=null===(w=null==We?void 0:We.example)||void 0===w?void 0:w.header_handle)||void 0===_?void 0:_[0]:(null===(S=null===(N=null==T?void 0:T.mapping)||void 0===N?void 0:N.header)||void 0===S?void 0:S[0])?null===(H=null===(F=null==T?void 0:T.mapping)||void 0===F?void 0:F.header)||void 0===H?void 0:H[0]:we.selectedVariable}),(null==Be?void 0:Be.format)==l.HEADER_TYPES.DOCUMENT?e.jsx(y,{children:e.jsx(i.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:Se,errorMessage:He||void 0,onBlur:()=>{if(!Se)return null==R||R(""),void Qe("PDF name is Required");const e=p.validateInputName(Se);null==R||R(Se),Qe(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{Qe(""),Fe(e)}})}):e.jsx(e.Fragment,{})]}),(null===(Q=De.bodyVariables)||void 0===Q?void 0:Q.length)>0&&e.jsx(x.default,{containerStyle:{paddingTop:De.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===(Y=De.descriptionComponents)||void 0===Y?void 0:Y.map(((n,t)=>e.jsx(C.default,{originalVariableList:null!=xe&&xe>-1?je.cards[xe]:je,type:n.type,descriptionComponent:n.component,showVariableModal:B},t))),(null===($=null===(W=null!=xe&&xe>-1?null===(K=je.cards[xe])||void 0===K?void 0:K.buttons:null==je?void 0:je.buttons)||void 0===W?void 0:W.filter((e=>"URL"===e.type)))||void 0===$?void 0:$.length)>0&&e.jsx(x.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(z=null===(X=null!=xe&&xe>-1?null===(G=je.cards[xe])||void 0===G?void 0:G.buttons:null==je?void 0:je.buttons)||void 0===X?void 0:X.filter((e=>he===a.POD.CHATBOT||"URL"===e.type)))||void 0===z?void 0:z.map(((n,t)=>{const o=n.buttonVariable===d.STATIC_URL_VARIABLE_NAME;if("URL"===n.type)return e.jsx(O.default,{variableListIndex:t,disableEdit:o,CTAoptions:null==V?void 0:V.CTAoptions,button:n,currentVariableList:null!=xe&&xe>-1?Object.assign({},je.cards[xe]):Object.assign({},je),updateSelectedURLTemplateBtn:Ye},`${t}_${xe}`)})),he===a.POD.CHATBOT&&(null===(Z=null===(J=Ve[0])||void 0===J?void 0:J.component)||void 0===Z?void 0:Z.buttons)&&(null===(te=null===(ne=null===(ee=Ve[0])||void 0===ee?void 0:ee.component)||void 0===ne?void 0:ne.buttons)||void 0===te?void 0:te.length)>0&&e.jsx(c.BackTrackComponent,{backTrackMessage:null===(oe=null==Ce?void 0:Ce.backTrackExtra)||void 0===oe?void 0:oe[0],setBackTrackMessage:null===(ie=null==Ce?void 0:Ce.backTrackExtra)||void 0===ie?void 0:ie[1]}),(null===(se=null===(ae=null!=xe&&xe>-1?null===(le=je.cards[xe])||void 0===le?void 0:le.buttons:null==je?void 0:je.buttons)||void 0===ae?void 0:ae.filter((e=>"QUICK_REPLY"===e.type)))||void 0===se?void 0:se.length)>0&&(he!==a.POD.CHATBOT?e.jsx(x.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):e.jsx(c.BackTrackComponent,{backTrackMessage:null===(de=null==Ce?void 0:Ce.backTrackExtra)||void 0===de?void 0:de[0],setBackTrackMessage:null===(ue=null==Ce?void 0:Ce.backTrackExtra)||void 0===ue?void 0:ue[1]})),null===(ce=null===(pe=null!=xe&&xe>-1?null===(re=je.cards[xe])||void 0===re?void 0:re.buttons:null==je?void 0:je.buttons)||void 0===pe?void 0:pe.filter((e=>"QUICK_REPLY"===e.type)))||void 0===ce?void 0:ce.map(((n,t)=>{if("QUICK_REPLY"===n.type&&he!==a.POD.CHATBOT)return e.jsx(O.default,{variableListIndex:t,QRBoptions:null==V?void 0:V.QRBoptions,button:n,currentVariableList:null!=xe&&xe>-1?Object.assign({},je.cards[xe]):Object.assign({},je),updateSelectedQRBTemplateBtn:Ke},`${t}_${xe}`)})),he===a.POD.CHATBOT&&Re&&e.jsx(v.DiscountCodeComponent,{discountCode:null===(ve=null==Ce?void 0:Ce.discountCodeExtra)||void 0===ve?void 0:ve[0],setDiscountCode:null===(me=null==Ce?void 0:Ce.discountCodeExtra)||void 0===me?void 0:me[1]}),null===(ge=null!=xe&&xe>-1?null===(be=je.cards[xe])||void 0===be?void 0:be.buttons:null==je?void 0:je.buttons)||void 0===ge?void 0:ge.map(((n,t)=>{var o,l,a,s,d;if("COPY_CODE"===n.type)return e.jsx(e.Fragment,{children:Te?e.jsx("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:e.jsx(i.Input,{state:"disabled",labelText:null!==(o=n.text)&&void 0!==o?o:"Copy Code",value:null!==(l=n.buttonVariable)&&void 0!==l?l:"",onChangeText:()=>{}})})):e.jsx(j.default,{index:t,variable:{variableName:null!==(a=n.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=n.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(d=n.index)&&void 0!==d?d:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:n.type},t)})}))]}))};
|
package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ButtonPlaceHolderOptions } from "../../template-preview/models/TemplateMeta";
|
|
2
3
|
import { CTABtnValType, QRBBtnValType, TEMPLATE_BUTTON } from "../../template-preview/models/WhatsAppTemplate";
|
|
3
4
|
import { WhatsAppTemplateVariables } from "../../template-preview/models/WhatsAppTemplate";
|
|
@@ -11,6 +12,7 @@ export interface WhatsAppTemplateCardButtonV2Props {
|
|
|
11
12
|
CTAoptions?: ButtonPlaceHolderOptions[];
|
|
12
13
|
QRBoptions?: ButtonPlaceHolderOptions[];
|
|
13
14
|
variableListIndex: number;
|
|
15
|
+
disableEdit?: boolean;
|
|
14
16
|
}
|
|
15
|
-
declare const WhatsAppTemplateCardButtonV2:
|
|
17
|
+
declare const WhatsAppTemplateCardButtonV2: React.FC<WhatsAppTemplateCardButtonV2Props>;
|
|
16
18
|
export default WhatsAppTemplateCardButtonV2;
|
package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),s=require("../../dropdown/Dropdown.js"),a=require("../../input/Input.js"),n=require("../../template-preview/constants/regexPatterns.js"),i=require("../../template-preview/models/TemplateMeta.js"),o=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../../TypographyStyle.js"),u=require("../../../constants/Theme.js"),c=require("../context/templateModalContext.js"),d=require("../utils/validateIsUrl.js"),b=require("./VariableConnector.js");exports.default=p=>{let{variableListIndex:j,button:m,updateSelectedURLTemplateBtn:v,updateSelectedQRBTemplateBtn:O,currentVariableList:g,CTAoptions:x,QRBoptions:f}=p;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),s=require("../../dropdown/Dropdown.js"),a=require("../../input/Input.js"),n=require("../../template-preview/constants/regexPatterns.js"),i=require("../../template-preview/models/TemplateMeta.js"),o=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../../TypographyStyle.js"),u=require("../../../constants/Theme.js"),c=require("../context/templateModalContext.js"),d=require("../utils/validateIsUrl.js"),b=require("./VariableConnector.js");exports.default=p=>{let{variableListIndex:j,button:m,updateSelectedURLTemplateBtn:v,updateSelectedQRBTemplateBtn:O,currentVariableList:g,CTAoptions:x,QRBoptions:f,disableEdit:y}=p;var L,h,R,U,V;const[C,T]=l.useState(""),[q,I]=l.useState(),w=null==x?void 0:x.map((e=>Object.assign(Object.assign({},e),{selected:(null==q?void 0:q.value)===e.value}))),E=null==f?void 0:f.map((e=>Object.assign(Object.assign({},e),{selected:(null==q?void 0:q.value)===e.value}))),{isError:P,disableEditVariable:N,pod:S,selectedCarouselIndex:_,originalVariableList:B,setOriginalVariableList:H,isProductCarouselType:M,ctaOptionsErrors:Q,setCtaOptionsErrors:A}=c.useTemplateModalContext();function D(e){if(T(e),null!=_&&_>-1&&M){const l=t.cloneDeep(B);if("URL"===m.type){const t=l.cards.map((t=>{let l=t.buttons.filter((e=>"URL"===e.type))[j];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=t.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e));return Object.assign(Object.assign({},t),{buttons:s})}));null==H||H((e=>Object.assign(Object.assign({},e),{cards:t}))),null==v||v(`https://${e}`,"custom",j)}return}let l=g.buttons.filter((e=>"URL"===e.type))[j];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=g.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e)),a=Object.assign({},null!=_&&_>-1?B.cards[_]:B);if(a.buttons=s,null!=_&&_>-1){const e=[...B.cards];e[_]=a,null==H||H((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==H||H((e=>Object.assign(Object.assign({},e),{buttons:[...s]})));null==v||v(`https://${e}`,"custom",j)}return l.useEffect((()=>{var e;if(m.buttonVariable&&n.editableVarPattern.test(m.buttonVariable))I(i.CUSTOM_URL_NAME),T((null===(e=m.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===m.type?x:f;e="URL"===m.type?t.findIndex((e=>e.placeHolder===m.buttonVariable)):t.findIndex((e=>e.label===m.flowName)),e>-1?I(t[e]):null==A||A((e=>Object.assign(Object.assign({},e),{[j]:"Required field!"})))}}),[]),S!==o.POD.CHATBOT?e.jsxs(b.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:u.COLORS.content.primary}},{children:[m.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(s.Dropdown,{disabled:N||y,options:"URL"===m.type?w:E,isSearchable:!0,onSelect:function(e,l){null==A||A((e=>(delete e[j],Object.assign({},e))));const s=e;I(s);const a=("URL"===m.type?x:f).find((e=>e.placeHolder===s.placeHolder));if(a)if("custom_link"!==a.value){if(null!=_&&_>-1&&M){const e=t.cloneDeep(B);if("URL"===m.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"URL"===e.type))[j];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder});const l=e.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",j),null==H||H((e=>Object.assign(Object.assign({},e),{cards:t})))}else if("QUICK_REPLY"===m.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"QUICK_REPLY"===e.type))[j];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value});const l=e.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==O||O({flowName:s.label,flowId:s.value},"placeholder",j),null==H||H((e=>Object.assign(Object.assign({},e),{cards:t})))}return}let e;if("URL"===m.type){let t=g.buttons.filter((e=>"URL"===e.type))[j];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder,example:[(null==s?void 0:s.value)||"https://d.bik.ai/"]}),e=g.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",j)}else{let t=g.buttons.filter((e=>"QUICK_REPLY"===e.type))[j];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value}),e=g.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==O||O({flowName:s.label,flowId:s.value},"placeholder",j)}const l=Object.assign({},null!=_&&_>-1?B.cards[_]:B);if(l.buttons=e,null!=_&&_>-1){const e=[...B.cards];e[_]=l,null==H||H((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==H||H((t=>Object.assign(Object.assign({},t),{buttons:[...e]})))}else D("")},defaultOptions:q?[Object.assign(Object.assign({},q),{selected:!0})]:[],error:P?null==Q?void 0:Q[j]:void 0})})),"custom_link"===(null==q?void 0:q.value)&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(a.Input,{state:N||y?"disabled":"none",errorMessage:P?C?d.validateIsUrl(C)?"":"Enter valid URL":"Required field":"",value:C,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:D,maxCharLimit:2e3})}))]}):e.jsx(b.default,{index:j,variable:{variableName:null!==(L=m.text)&&void 0!==L?L:"",updatedValue:"((customPlaceholderName))"===m.buttonVariable?`${null===(h=m.example)||void 0===h?void 0:h[0]}`:null!==(R=m.buttonVariable)&&void 0!==R?R:"",type:"link",isEditableVariable:!0,index:null!==(U=m.index)&&void 0!==U?U:0,queryParams:null!==(V=m.queryParams)&&void 0!==V?V:[]},showVariableModal:!0,componentType:"BUTTONS",buttonType:m.type,CTAoptions:x})};
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export declare const BACKGROUND_PREVIEW_IMAGE = "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";
|
|
2
|
+
export declare const STATIC_URL_VARIABLE_NAME = "((staticPlaceholderName))";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.BACKGROUND_PREVIEW_IMAGE="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";
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.BACKGROUND_PREVIEW_IMAGE="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",exports.STATIC_URL_VARIABLE_NAME="((staticPlaceholderName))";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default EventsTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
3
|
+
import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
|
|
4
|
+
import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
|
|
5
5
|
declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
|
|
6
6
|
cacheKey: string;
|
|
7
7
|
propertyAddBtnText: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as o}from"react/jsx-runtime";import{useState as n,useRef as i,useEffect as r}from"react";import{COLORS as l}from"../../constants/Theme.js";import s from"../../assets/icons/chevronDown.svg.js";import{Input as
|
|
1
|
+
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as o}from"react/jsx-runtime";import{useState as n,useRef as i,useEffect as r}from"react";import{COLORS as l}from"../../constants/Theme.js";import s from"../../assets/icons/chevronDown.svg.js";import{Input as a}from"../input/Input.js";import{InputStyleContext as p}from"../input/context/InputStyleProvider.js";import d from"./ChipInput.js";import{DropdownPopover as c}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as u}from"./OpenedDropdown/utils/iterationOnOptions.js";function h(){}const m=m=>{var f,v,g,w,{placeHolder:b,size:j,onSelect:y,defaultOptions:x,disabled:O,noErrorHint:S,placeHolderHeight:H,showPlaceholderWhenSelected:D=!1,inputStyle:T={},inputType:C="default",onDeleteChip:I,truncatedText:E}=m,P=e(m,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText"]);const[z,W]=n(!1),A=null!=j?j:"default",_=i(),[k,M]=n(null!=x?x:[]);r((()=>{var e;const t=[];null===(e=null==P?void 0:P.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),M([...t])}),[P.options]),r((()=>{x&&M([...x])}),[x]);const N=u(k);return t(p.Provider,Object.assign({value:{InputWrapper:Object.assign({height:H||("small"===A?32:48),width:null!==(v=null!==(f=P.buttonWidth)&&void 0!==f?f:P.width)&&void 0!==v?v:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},T),input:{minHeight:"100%"}}},{children:o(c,Object.assign({"data-test":P["data-test"],ref:_,onSelect:function(e){Array.isArray(e)?M([...e]):M([e]),null==y||y(e)},disabled:O,onDropdownVisbilityChange:e=>W(e)},P,{children:["default"==C&&t(a,{version:P.version,noErrorHint:S,state:O?"disabled":"none",value:D?b:null!=N?N:"",errorMessage:P.error,variant:A,placeholder:null!=b?b:"Select an option",width:null!==(g=P.width)&&void 0!==g?g:"100%",onChangeText:h,rightIcon:{icon:()=>t(s,{style:{transform:z?"rotate(180deg)":"rotate(0deg)"},onClick:h,width:"small"===A?20:24,height:"small"===A?20:24,color:l.content.primary})},truncateText:null==E||E}),"chip"==C&&t(d,{placeholder:null!=b?b:"Select options",chips:k,onDeleteChip:e=>{null==I||I(e)},isDropdownOpened:z,sizeToUse:A,containerStyle:{width:null!==(w=P.width)&&void 0!==w?w:"100%",cursor:"pointer"}})]}))}))};m.displayName="Dropdown";export{m as Dropdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as
|
|
1
|
+
import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as t,jsxs as l}from"react/jsx-runtime";import n,{useState as r,useRef as i,useImperativeHandle as s,useEffect as d}from"react";import{usePopper as p}from"react-popper";import{DropShadow as a}from"../../dropShadow/DropShadow.js";import{Tooltip as c}from"../../tooltips/Tooltip.js";import{OverLapAbs as v,OpenDropdownContainer as m}from"../Common.styled.js";import{OpenedDropdown as u}from"../OpenedDropdown/components/OpennedDropdown.js";const w=n.forwardRef(((n,w)=>{var{children:b,onDropdownVisbilityChange:h,version:f="1.0",tooltipContent:j,tooltipDirection:g,showTooltipArrow:D}=n,O=o(n,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const y=w,[C,S]=r(!1),[E,x]=r(null),[A,R]=r(null),T=i(null),{styles:z,attributes:M}=p(E,A,{placement:O.placement,strategy:O.strategy}),V=o=>{var e,t;"2.0"===f&&O.isMultiSelect&&o&&(null===(e=O.onSelect)||void 0===e||e.call(O,[...o])),S(!1),null===(t=null==O?void 0:O.onClose)||void 0===t||t.call(O)};s(y,(()=>({openDropdown:C})),[]),d((()=>{(null==y?void 0:y.current)&&(y.current.openDropdown=C)}),[C]),d((()=>{null==h||h(C)}),[C]);const _=()=>l(t,{children:[l("div",Object.assign({style:{position:"relative"},ref:x},{children:[e(v,Object.assign({ref:T,allowEvents:O.allowEvents,disabled:O.disabled,onClick:o=>{var e;null===(e=O.onDropdownOpen)||void 0===e||e.call(O),C?(S(!1),o.preventDefault()):O.disabled||S(!0)}},{children:O.allowEvents?b:null})),O.allowEvents?null:b]})),C&&e(m,Object.assign({ref:R,style:Object.assign(Object.assign({},z.popper),{zIndex:3})},M.popper,{children:e(a,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:e(u,Object.assign({},O,{onSelect:o=>{var e;"2.0"===f&&O.isMultiSelect||(null===(e=O.onSelect)||void 0===e||e.call(O,o),S(!1))},onClose:V,version:f,headerRef:T}))}))}))]});return e(t,{children:C||void 0===j?_():e(c,Object.assign({body:j,placement:g,hideArrow:!D},{children:e("div",Object.assign({"data-test":O["data-test"]},{children:_()}))}))})}));w.displayName="DropdownPopover";export{w as DropdownPopover};
|
|
@@ -15,7 +15,6 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
15
15
|
selectedLabel?: string | undefined;
|
|
16
16
|
children?: SingleOption[] | undefined;
|
|
17
17
|
parent?: SingleOption | undefined;
|
|
18
|
-
'data-test'?: string | undefined;
|
|
19
18
|
} | {
|
|
20
19
|
label?: string | undefined;
|
|
21
20
|
value?: string | undefined;
|
|
@@ -31,7 +30,6 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
31
30
|
selectedLabel?: string | undefined;
|
|
32
31
|
children?: SingleOption[] | undefined;
|
|
33
32
|
parent?: SingleOption | undefined;
|
|
34
|
-
'data-test'?: string | undefined;
|
|
35
33
|
options: SingleOption[];
|
|
36
34
|
})[];
|
|
37
35
|
export declare function iterateOnOptionsRaw(options: DropdownOption[], cb: (option: SingleOption) => void): void;
|
|
@@ -22,7 +22,6 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
22
22
|
selectedLabel?: string | undefined;
|
|
23
23
|
children?: SingleOption[] | undefined;
|
|
24
24
|
parent?: SingleOption | undefined;
|
|
25
|
-
'data-test'?: string | undefined;
|
|
26
25
|
} | {
|
|
27
26
|
label?: string | undefined;
|
|
28
27
|
value?: string | undefined;
|
|
@@ -38,7 +37,6 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
38
37
|
selectedLabel?: string | undefined;
|
|
39
38
|
children?: SingleOption[] | undefined;
|
|
40
39
|
parent?: SingleOption | undefined;
|
|
41
|
-
'data-test'?: string | undefined;
|
|
42
40
|
options: SingleOption[];
|
|
43
41
|
})[] | undefined;
|
|
44
42
|
selectAllHandler: (newState: SelectAllCheckboxState) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{jsx as o,jsxs as e,Fragment as n}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useRef as i,useState as l,useEffect as a}from"react";import d from"styled-components";import{Input as s}from"../../input/Input.js";import{HEADER_TYPES as r}from"../../template-preview/models/TemplateMeta.js";import{POD as p}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";import{getAllDataFromTemplateComponent as c}from"../utils/getDataFromTemplateComponent.js";import{isVariable as v}from"../utils/validateIsUrl.js";import{validateInputName as m}from"../utils/validateName.js";import{BackTrackComponent as b}from"./BackTrackComponent.js";import{DiscountCodeComponent as g}from"./DiscountCodeComponent.js";import f from"./EditMediaModal.js";import h from"./EditMediaV2.js";import{EditTemplateMediaContainer as O}from"./EditMediaV2.style.js";import{useEditWhatsappTemplateMedia as j}from"./useEditWhtasappTemplateMedia.js";import C from"./VariableConnector.js";import{Container as T}from"./VariableConnectorsPanel.js";import x from"./VariableConnectorWhatsApp.js";import y from"./VariableEditorHeader.js";import E from"./WhatsAppTemplateCardButtonV2.js";const V=d=>{let{template:V,onTemplateChange:M,whatsappSpecificPickerMeta:k,showVariableModal:I,variableListForImage:L,setDiscountCode:R,fileName:U,setFileName:w}=d;var N,P,A,_,D,H,S,F,Q,q,Y,K,W,$,G,X,z,J,Z,oo,eo,no,to,io,lo,ao,so,ro,po,uo,co,vo,mo,bo,go,fo,ho,Oo,jo;const Co=V.isCarouselType,{originalVariableList:To,pod:xo,extras:yo,selectedCarouselIndex:Eo,isProductCarouselType:Vo,disableCopyCode:Bo}=u(),{descriptionComponents:Mo,urlBtns:ko,qrbBtns:Io,imageComponent:Lo,bodyVariables:Ro,headerVariables:Uo}=c(V),wo=i(null),[No,Po]=l(!1),[Ao,_o]=l(-1===Eo?{descriptionComponents:Mo,urlBtns:ko,qrbBtns:Io,imageComponent:Lo,bodyVariables:Ro,headerVariables:Uo}:{}),{uploadMediaLink:Do,uploadMediaFiles:Ho,validateMimeType:So}=k,Fo=j({uploadMediaLink:Do,uploadMediaFiles:Ho,updateTemplateImageUrl:function(o,e){var n,i,l,a,d,s,r,p;let u;u=null!=Eo&&Eo>-1?{components:null===(i=null===(n=V.components[1])||void 0===n?void 0:n.cards)||void 0===i?void 0:i[Eo].components,mapping:null===(a=null===(l=null==V?void 0:V.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Eo]}:Object.assign({},V);const c=null===(d=null==u?void 0:u.components)||void 0===d?void 0:d.findIndex((o=>{if("HEADER"===o.type&&"NONE"!==o.format&&"TEXT"!==o.format)return!0}));if(void 0!==c&&c>-1&&(null==u?void 0:u.components[c])){const n=Object.assign(Object.assign({},u.components[c]),{format:e,example:{header_handle:[o]}}),t=[...u.components];t[c]=n,u=Object.assign(Object.assign({},u),{components:t})}u.mapping&&(u.mapping=Object.assign(Object.assign({},u.mapping),{header:void 0}));if(null!=Eo&&Eo>-1){const o=t(V);o.components[1].cards[Eo].components=u.components,(null===(s=null==o?void 0:o.mapping)||void 0===s?void 0:s.cards)&&(null===(r=null==o?void 0:o.mapping)||void 0===r?void 0:r.cards.length)>0&&(o.mapping.cards[Eo]=null!==(p=u.mapping)&&void 0!==p?p:{}),null==M||M(Object.assign({},o)),qo(!0)}else null==M||M(Object.assign({},u))},validateMimeType:So,mediaComponent:Co?Ao.imageComponent:Lo,fileRef:wo}),[Qo,qo]=l(!1),[Yo,Ko]=l(U),[Wo,$o]=l();function Go(o,e,n){var i,l,a,d,s,r,p,u,c,v;const m=null!=Eo&&Eo>-1?{components:null===(i=Object.assign({},V).components[1].cards)||void 0===i?void 0:i[Eo].components,mapping:null===(l=Object.assign({},V).mapping.cards)||void 0===l?void 0:l[Eo]}:Object.assign({},V),b=t(m),g="custom"===e&&"string"==typeof o,f=g?o:"string"!=typeof o?o.defaultValue?o.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Eo&&Eo>-1&&Vo){const e=Object.assign({},V).components.map((o=>{var e;return"CAROUSEL"===o.type?Object.assign(Object.assign({},o),{cards:null===(e=o.cards)||void 0===e?void 0:e.map((o=>Object.assign(Object.assign({},o),{components:o.components.map((o=>{var e,t,i;if("BUTTONS"===o.type){const l=null===(e=o.buttons)||void 0===e?void 0:e.filter((o=>"URL"===o.type));let a=null!==(t=null==l?void 0:l[n])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const d=null===(i=o.buttons)||void 0===i?void 0:i.map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o));return Object.assign(Object.assign({},o),{buttons:d})}return o}))})))}):o})),i=null===(d=null===(a=Object.assign({},V).mapping)||void 0===a?void 0:a.cards)||void 0===d?void 0:d.map((e=>{var n;return Object.assign(Object.assign({},e),{buttons:null===(n=null==e?void 0:e.buttons)||void 0===n?void 0:n.map((e=>g?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:""))})})),l=t(V);return l.components=e,l.mapping.cards=i,void(null==M||M(Object.assign({},l)))}const h=null==b?void 0:b.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==h&&h>-1){const t=null===(s=null==b?void 0:b.components[h].buttons)||void 0===s?void 0:s.filter((o=>"URL"===o.type));if((null==t?void 0:t.length)>0){const i="custom"===e&&"string"==typeof o,l=i?o:"string"!=typeof o&&o.defaultValue?o.defaultValue:"https://d.bik.ai/";let a=t[n];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const d=[...null!==(u=null===(p=null===(r=b.components)||void 0===r?void 0:r[h])||void 0===p?void 0:p.buttons)&&void 0!==u?u:[]].map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o)),s=Object.assign(Object.assign({},b.components[h]),{buttons:d}),v=null===(c=b.mapping)||void 0===c?void 0:c.buttons;v&&v.length>0&&(v[n]=i?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[h]=s,b.components=g}}if("string"!=typeof o){"checkout.checkoutUrl"===(null===(v=o.placeHolder)||void 0===v?void 0:v.slice(2,-2))?Po(!0):(Po(!1),null==R||R(""))}if(null!=Eo&&Eo>-1){const o=t(V);o.components[1].cards[Eo].components=b.components,o.mapping.cards[Eo]=b.mapping,null==M||M(Object.assign({},o))}else null==M||M(b)}function Xo(o,e,n){var i,l,a,d,s,r,p;const u=null!=Eo&&Eo>-1?{components:null===(i=Object.assign({},V).components[1].cards)||void 0===i?void 0:i[Eo].components,mapping:null===(l=Object.assign({},V).mapping.cards)||void 0===l?void 0:l[Eo]}:Object.assign({},V);if(null!=Eo&&Eo>-1&&Vo){const e=Object.assign({},V).components.map((e=>{var t;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(t=e.cards)||void 0===t?void 0:t.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var t,i,l;if("BUTTONS"===e.type){const a=null===(t=null==e?void 0:e.buttons)||void 0===t?void 0:t.filter((o=>"QUICK_REPLY"===o.type));let d=null!==(i=null==a?void 0:a[n])&&void 0!==i?i:{};d=Object.assign(Object.assign({},d),{flowId:o.flowId,flowName:o.flowName});const s=null===(l=null==e?void 0:e.buttons)||void 0===l?void 0:l.map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==d?void 0:d.text)?d:o));return Object.assign(Object.assign({},e),{buttons:s})}return e}))})))}):e})),i=t(V);return i.components=e,void(null==M||M(Object.assign({},i)))}const c=null==u?void 0:u.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==c&&c>-1){const e=null===(d=null===(a=null==u?void 0:u.components[c])||void 0===a?void 0:a.buttons)||void 0===d?void 0:d.filter((o=>"QUICK_REPLY"===o.type));if(e){let t=e[n];t=Object.assign(Object.assign({},t),{flowId:o.flowId,flowName:o.flowName});const i=[...null!==(p=null===(r=null===(s=u.components)||void 0===s?void 0:s[c])||void 0===r?void 0:r.buttons)&&void 0!==p?p:[]].map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==t?void 0:t.text)?t:o)),l=Object.assign(Object.assign({},u.components[c]),{buttons:i}),a=[...u.components];a[c]=l,u.components=a}}if(null!=Eo&&Eo>-1){const o=t(V);o.components[1].cards[Eo].components=u.components,null==M||M(Object.assign({},o))}else null==M||M(u)}a((()=>{var o,e;if(null===(o=V.mapping.buttons)||void 0===o?void 0:o.find((o=>"checkout.checkoutUrl"===o.slice(2,-2))))Po(!0);else{Po(!1);const o=null===(e=null==yo?void 0:yo.discountCodeExtra)||void 0===e?void 0:e[1];null==o||o("")}}),[V]),a((()=>{var o,e,n,t;if(null!=Eo&&Eo>-1){const i={components:null===(e=null===(o=V.components[1])||void 0===o?void 0:o.cards)||void 0===e?void 0:e[Eo].components,mapping:null===(t=null===(n=null==V?void 0:V.mapping)||void 0===n?void 0:n.cards)||void 0===t?void 0:t[Eo]},{descriptionComponents:l,urlBtns:a,qrbBtns:d,imageComponent:s,bodyVariables:r,headerVariables:p}=c(i);_o({descriptionComponents:l,urlBtns:a,qrbBtns:d,imageComponent:s,bodyVariables:r,headerVariables:p})}else if(null!=Eo&&-1===Eo){const{descriptionComponents:o,urlBtns:e,qrbBtns:n,imageComponent:t,bodyVariables:i,headerVariables:l}=c(V);_o({descriptionComponents:o,urlBtns:e,qrbBtns:n,imageComponent:t,bodyVariables:i,headerVariables:l})}}),[Eo]),a((()=>{var o,e,n,t;if(null!=Eo&&Eo>-1&&Qo){const i={components:null===(e=null===(o=V.components[1])||void 0===o?void 0:o.cards)||void 0===e?void 0:e[Eo].components,mapping:null===(t=null===(n=null==V?void 0:V.mapping)||void 0===n?void 0:n.cards)||void 0===t?void 0:t[Eo]},{descriptionComponents:l,urlBtns:a,qrbBtns:d,imageComponent:s,bodyVariables:r,headerVariables:p}=c(i);_o({descriptionComponents:l,urlBtns:a,qrbBtns:d,imageComponent:s,bodyVariables:r,headerVariables:p}),qo(!1)}}),[Qo]);const zo=Co?Ao.imageComponent:Lo;return Fo.openEditMedia?o(T,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:o(f,{mediaComponentFormat:null!==(N=zo.format)&&void 0!==N?N:r.IMAGE,uploadMedia:Fo.uploadMedia,variableListForImage:L||[],useEditWhatsappTemplateMediaResponse:Fo,setOpenEditMedia:Fo.setOpenEditMedia,openEditMedia:Fo.openEditMedia,editIconRef:Fo.editIconRef,fileRef:wo})})):e(T,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Vo?"420px":"auto"}},{children:[!!Ao.imageComponent&&!Vo&&e(O,{children:[o(h,{imageName:null!==(A=null===(P=null==zo?void 0:zo.example)||void 0===P?void 0:P.header_handle)&&void 0!==A?A:[],handleImageChange:Fo.handleImageChange,mediaType:null==zo?void 0:zo.format,error:Fo.error,isLoading:Fo.loading,setOpenEditMedia:Fo.setOpenEditMedia,selectedVariable:v(null!==(H=null===(D=null===(_=null==zo?void 0:zo.example)||void 0===_?void 0:_.header_handle)||void 0===D?void 0:D[0])&&void 0!==H?H:"")?null===(F=null===(S=null==zo?void 0:zo.example)||void 0===S?void 0:S.header_handle)||void 0===F?void 0:F[0]:(null===(q=null===(Q=null==V?void 0:V.mapping)||void 0===Q?void 0:Q.header)||void 0===q?void 0:q[0])?null===(K=null===(Y=null==V?void 0:V.mapping)||void 0===Y?void 0:Y.header)||void 0===K?void 0:K[0]:Fo.selectedVariable}),(null==Lo?void 0:Lo.format)==r.DOCUMENT?o(B,{children:o(s,{labelText:"PDF Name",placeholder:"Enter the name",value:Yo,errorMessage:Wo||void 0,onBlur:()=>{if(!Yo)return null==w||w(""),void $o("PDF name is Required");const o=m(Yo);null==w||w(Yo),$o(o?"Please enter a valid PDF name":void 0)},onChangeText:o=>{$o(""),Ko(o)}})}):o(n,{})]}),(null===(W=Ao.bodyVariables)||void 0===W?void 0:W.length)>0&&o(y,{containerStyle:{paddingTop:Ao.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===($=Ao.descriptionComponents)||void 0===$?void 0:$.map(((e,n)=>o(x,{originalVariableList:null!=Eo&&Eo>-1?To.cards[Eo]:To,type:e.type,descriptionComponent:e.component,showVariableModal:I},n))),(null===(z=null===(X=null!=Eo&&Eo>-1?null===(G=To.cards[Eo])||void 0===G?void 0:G.buttons:null==To?void 0:To.buttons)||void 0===X?void 0:X.filter((o=>"URL"===o.type)))||void 0===z?void 0:z.length)>0&&o(y,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(oo=null===(Z=null!=Eo&&Eo>-1?null===(J=To.cards[Eo])||void 0===J?void 0:J.buttons:null==To?void 0:To.buttons)||void 0===Z?void 0:Z.filter((o=>xo===p.CHATBOT||"URL"===o.type)))||void 0===oo?void 0:oo.map(((e,n)=>{if("URL"===e.type)return o(E,{variableListIndex:n,CTAoptions:null==k?void 0:k.CTAoptions,button:e,currentVariableList:null!=Eo&&Eo>-1?Object.assign({},To.cards[Eo]):Object.assign({},To),updateSelectedURLTemplateBtn:Go},`${n}_${Eo}`)})),xo===p.CHATBOT&&(null===(no=null===(eo=Io[0])||void 0===eo?void 0:eo.component)||void 0===no?void 0:no.buttons)&&(null===(lo=null===(io=null===(to=Io[0])||void 0===to?void 0:to.component)||void 0===io?void 0:io.buttons)||void 0===lo?void 0:lo.length)>0&&o(b,{backTrackMessage:null===(ao=null==yo?void 0:yo.backTrackExtra)||void 0===ao?void 0:ao[0],setBackTrackMessage:null===(so=null==yo?void 0:yo.backTrackExtra)||void 0===so?void 0:so[1]}),(null===(uo=null===(po=null!=Eo&&Eo>-1?null===(ro=To.cards[Eo])||void 0===ro?void 0:ro.buttons:null==To?void 0:To.buttons)||void 0===po?void 0:po.filter((o=>"QUICK_REPLY"===o.type)))||void 0===uo?void 0:uo.length)>0&&(xo!==p.CHATBOT?o(y,{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(b,{backTrackMessage:null===(co=null==yo?void 0:yo.backTrackExtra)||void 0===co?void 0:co[0],setBackTrackMessage:null===(vo=null==yo?void 0:yo.backTrackExtra)||void 0===vo?void 0:vo[1]})),null===(go=null===(bo=null!=Eo&&Eo>-1?null===(mo=To.cards[Eo])||void 0===mo?void 0:mo.buttons:null==To?void 0:To.buttons)||void 0===bo?void 0:bo.filter((o=>"QUICK_REPLY"===o.type)))||void 0===go?void 0:go.map(((e,n)=>{if("QUICK_REPLY"===e.type&&xo!==p.CHATBOT)return o(E,{variableListIndex:n,QRBoptions:null==k?void 0:k.QRBoptions,button:e,currentVariableList:null!=Eo&&Eo>-1?Object.assign({},To.cards[Eo]):Object.assign({},To),updateSelectedQRBTemplateBtn:Xo},`${n}_${Eo}`)})),xo===p.CHATBOT&&No&&o(g,{discountCode:null===(fo=null==yo?void 0:yo.discountCodeExtra)||void 0===fo?void 0:fo[0],setDiscountCode:null===(ho=null==yo?void 0:yo.discountCodeExtra)||void 0===ho?void 0:ho[1]}),null===(jo=null!=Eo&&Eo>-1?null===(Oo=To.cards[Eo])||void 0===Oo?void 0:Oo.buttons:null==To?void 0:To.buttons)||void 0===jo?void 0:jo.map(((e,t)=>{var i,l,a,d,r;if("COPY_CODE"===e.type)return o(n,{children:Bo?o("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:o(s,{state:"disabled",labelText:null!==(i=e.text)&&void 0!==i?i:"Copy Code",value:null!==(l=e.buttonVariable)&&void 0!==l?l:"",onChangeText:()=>{}})})):o(C,{index:t,variable:{variableName:null!==(a=e.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(d=e.buttonVariable)&&void 0!==d?d:"",type:"string",isEditableVariable:!0,index:null!==(r=e.index)&&void 0!==r?r:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:e.type},t)})}))]}))},B=d.div`
|
|
1
|
+
import{jsx as o,jsxs as n,Fragment as e}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useRef as i,useState as l,useEffect as a}from"react";import s from"styled-components";import{Input as d}from"../../input/Input.js";import{HEADER_TYPES as r}from"../../template-preview/models/TemplateMeta.js";import{POD as p}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";import{STATIC_URL_VARIABLE_NAME as c}from"../utils/constants.js";import{getAllDataFromTemplateComponent as m}from"../utils/getDataFromTemplateComponent.js";import{isVariable as v}from"../utils/validateIsUrl.js";import{validateInputName as b}from"../utils/validateName.js";import{BackTrackComponent as g}from"./BackTrackComponent.js";import{DiscountCodeComponent as f}from"./DiscountCodeComponent.js";import h from"./EditMediaModal.js";import j from"./EditMediaV2.js";import{EditTemplateMediaContainer as O}from"./EditMediaV2.style.js";import{useEditWhatsappTemplateMedia as C}from"./useEditWhtasappTemplateMedia.js";import T from"./VariableConnector.js";import{Container as x}from"./VariableConnectorsPanel.js";import y from"./VariableConnectorWhatsApp.js";import E from"./VariableEditorHeader.js";import V from"./WhatsAppTemplateCardButtonV2.js";const B=s=>{let{template:B,onTemplateChange:k,whatsappSpecificPickerMeta:I,showVariableModal:L,variableListForImage:R,setDiscountCode:U,fileName:w,setFileName:N}=s;var P,A,_,D,H,S,F,Q,q,Y,K,W,$,G,X,z,J,Z,oo,no,eo,to,io,lo,ao,so,ro,po,uo,co,mo,vo,bo,go,fo,ho,jo,Oo,Co;const To=B.isCarouselType,{originalVariableList:xo,pod:yo,extras:Eo,selectedCarouselIndex:Vo,isProductCarouselType:Bo,disableCopyCode:Mo}=u(),{descriptionComponents:ko,urlBtns:Io,qrbBtns:Lo,imageComponent:Ro,bodyVariables:Uo,headerVariables:wo}=m(B),No=i(null),[Po,Ao]=l(!1),[_o,Do]=l(-1===Vo?{descriptionComponents:ko,urlBtns:Io,qrbBtns:Lo,imageComponent:Ro,bodyVariables:Uo,headerVariables:wo}:{}),{uploadMediaLink:Ho,uploadMediaFiles:So,validateMimeType:Fo}=I,Qo=C({uploadMediaLink:Ho,uploadMediaFiles:So,updateTemplateImageUrl:function(o,n){var e,i,l,a,s,d,r,p;let u;u=null!=Vo&&Vo>-1?{components:null===(i=null===(e=B.components[1])||void 0===e?void 0:e.cards)||void 0===i?void 0:i[Vo].components,mapping:null===(a=null===(l=null==B?void 0:B.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Vo]}:Object.assign({},B);const c=null===(s=null==u?void 0:u.components)||void 0===s?void 0:s.findIndex((o=>{if("HEADER"===o.type&&"NONE"!==o.format&&"TEXT"!==o.format)return!0}));if(void 0!==c&&c>-1&&(null==u?void 0:u.components[c])){const e=Object.assign(Object.assign({},u.components[c]),{format:n,example:{header_handle:[o]}}),t=[...u.components];t[c]=e,u=Object.assign(Object.assign({},u),{components:t})}u.mapping&&(u.mapping=Object.assign(Object.assign({},u.mapping),{header:void 0}));if(null!=Vo&&Vo>-1){const o=t(B);o.components[1].cards[Vo].components=u.components,(null===(d=null==o?void 0:o.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==o?void 0:o.mapping)||void 0===r?void 0:r.cards.length)>0&&(o.mapping.cards[Vo]=null!==(p=u.mapping)&&void 0!==p?p:{}),null==k||k(Object.assign({},o)),Yo(!0)}else null==k||k(Object.assign({},u))},validateMimeType:Fo,mediaComponent:To?_o.imageComponent:Ro,fileRef:No}),[qo,Yo]=l(!1),[Ko,Wo]=l(w),[$o,Go]=l();function Xo(o,n,e){var i,l,a,s,d,r,p,u,c,m;const v=null!=Vo&&Vo>-1?{components:null===(i=Object.assign({},B).components[1].cards)||void 0===i?void 0:i[Vo].components,mapping:null===(l=Object.assign({},B).mapping.cards)||void 0===l?void 0:l[Vo]}:Object.assign({},B),b=t(v),g="custom"===n&&"string"==typeof o,f=g?o:"string"!=typeof o?o.defaultValue?o.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Vo&&Vo>-1&&Bo){const n=Object.assign({},B).components.map((o=>{var n;return"CAROUSEL"===o.type?Object.assign(Object.assign({},o),{cards:null===(n=o.cards)||void 0===n?void 0:n.map((o=>Object.assign(Object.assign({},o),{components:o.components.map((o=>{var n,t,i;if("BUTTONS"===o.type){const l=null===(n=o.buttons)||void 0===n?void 0:n.filter((o=>"URL"===o.type));let a=null!==(t=null==l?void 0:l[e])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const s=null===(i=o.buttons)||void 0===i?void 0:i.map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o));return Object.assign(Object.assign({},o),{buttons:s})}return o}))})))}):o})),i=null===(s=null===(a=Object.assign({},B).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((n=>{var e;return Object.assign(Object.assign({},n),{buttons:null===(e=null==n?void 0:n.buttons)||void 0===e?void 0:e.map((n=>g?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:""))})})),l=t(B);return l.components=n,l.mapping.cards=i,void(null==k||k(Object.assign({},l)))}const h=null==b?void 0:b.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==h&&h>-1){const t=null===(d=null==b?void 0:b.components[h].buttons)||void 0===d?void 0:d.filter((o=>"URL"===o.type));if((null==t?void 0:t.length)>0){const i="custom"===n&&"string"==typeof o,l=i?o:"string"!=typeof o&&o.defaultValue?o.defaultValue:"https://d.bik.ai/";let a=t[e];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(u=null===(p=null===(r=b.components)||void 0===r?void 0:r[h])||void 0===p?void 0:p.buttons)&&void 0!==u?u:[]].map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o)),d=Object.assign(Object.assign({},b.components[h]),{buttons:s}),m=null===(c=b.mapping)||void 0===c?void 0:c.buttons;m&&m.length>0&&(m[e]=i?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:"");const v=Object.assign(Object.assign({},b.mapping),{buttons:m});b.mapping=v;const g=[...b.components];g[h]=d,b.components=g}}if("string"!=typeof o){"checkout.checkoutUrl"===(null===(m=o.placeHolder)||void 0===m?void 0:m.slice(2,-2))?Ao(!0):(Ao(!1),null==U||U(""))}if(null!=Vo&&Vo>-1){const o=t(B);o.components[1].cards[Vo].components=b.components,o.mapping.cards[Vo]=b.mapping,null==k||k(Object.assign({},o))}else null==k||k(b)}function zo(o,n,e){var i,l,a,s,d,r,p;const u=null!=Vo&&Vo>-1?{components:null===(i=Object.assign({},B).components[1].cards)||void 0===i?void 0:i[Vo].components,mapping:null===(l=Object.assign({},B).mapping.cards)||void 0===l?void 0:l[Vo]}:Object.assign({},B);if(null!=Vo&&Vo>-1&&Bo){const n=Object.assign({},B).components.map((n=>{var t;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(t=n.cards)||void 0===t?void 0:t.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var t,i,l;if("BUTTONS"===n.type){const a=null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.filter((o=>"QUICK_REPLY"===o.type));let s=null!==(i=null==a?void 0:a[e])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:o.flowId,flowName:o.flowName});const d=null===(l=null==n?void 0:n.buttons)||void 0===l?void 0:l.map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==s?void 0:s.text)?s:o));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=t(B);return i.components=n,void(null==k||k(Object.assign({},i)))}const c=null==u?void 0:u.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==c&&c>-1){const n=null===(s=null===(a=null==u?void 0:u.components[c])||void 0===a?void 0:a.buttons)||void 0===s?void 0:s.filter((o=>"QUICK_REPLY"===o.type));if(n){let t=n[e];t=Object.assign(Object.assign({},t),{flowId:o.flowId,flowName:o.flowName});const i=[...null!==(p=null===(r=null===(d=u.components)||void 0===d?void 0:d[c])||void 0===r?void 0:r.buttons)&&void 0!==p?p:[]].map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==t?void 0:t.text)?t:o)),l=Object.assign(Object.assign({},u.components[c]),{buttons:i}),a=[...u.components];a[c]=l,u.components=a}}if(null!=Vo&&Vo>-1){const o=t(B);o.components[1].cards[Vo].components=u.components,null==k||k(Object.assign({},o))}else null==k||k(u)}a((()=>{var o,n;if(null===(o=B.mapping.buttons)||void 0===o?void 0:o.find((o=>"checkout.checkoutUrl"===o.slice(2,-2))))Ao(!0);else{Ao(!1);const o=null===(n=null==Eo?void 0:Eo.discountCodeExtra)||void 0===n?void 0:n[1];null==o||o("")}}),[B]),a((()=>{var o,n,e,t;if(null!=Vo&&Vo>-1){const i={components:null===(n=null===(o=B.components[1])||void 0===o?void 0:o.cards)||void 0===n?void 0:n[Vo].components,mapping:null===(t=null===(e=null==B?void 0:B.mapping)||void 0===e?void 0:e.cards)||void 0===t?void 0:t[Vo]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=m(i);Do({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p})}else if(null!=Vo&&-1===Vo){const{descriptionComponents:o,urlBtns:n,qrbBtns:e,imageComponent:t,bodyVariables:i,headerVariables:l}=m(B);Do({descriptionComponents:o,urlBtns:n,qrbBtns:e,imageComponent:t,bodyVariables:i,headerVariables:l})}}),[Vo]),a((()=>{var o,n,e,t;if(null!=Vo&&Vo>-1&&qo){const i={components:null===(n=null===(o=B.components[1])||void 0===o?void 0:o.cards)||void 0===n?void 0:n[Vo].components,mapping:null===(t=null===(e=null==B?void 0:B.mapping)||void 0===e?void 0:e.cards)||void 0===t?void 0:t[Vo]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=m(i);Do({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}),Yo(!1)}}),[qo]);const Jo=To?_o.imageComponent:Ro;return Qo.openEditMedia?o(x,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:o(h,{mediaComponentFormat:null!==(P=Jo.format)&&void 0!==P?P:r.IMAGE,uploadMedia:Qo.uploadMedia,variableListForImage:R||[],useEditWhatsappTemplateMediaResponse:Qo,setOpenEditMedia:Qo.setOpenEditMedia,openEditMedia:Qo.openEditMedia,editIconRef:Qo.editIconRef,fileRef:No})})):n(x,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Bo?"420px":"auto"}},{children:[!!_o.imageComponent&&!Bo&&n(O,{children:[o(j,{imageName:null!==(_=null===(A=null==Jo?void 0:Jo.example)||void 0===A?void 0:A.header_handle)&&void 0!==_?_:[],handleImageChange:Qo.handleImageChange,mediaType:null==Jo?void 0:Jo.format,error:Qo.error,isLoading:Qo.loading,setOpenEditMedia:Qo.setOpenEditMedia,selectedVariable:v(null!==(S=null===(H=null===(D=null==Jo?void 0:Jo.example)||void 0===D?void 0:D.header_handle)||void 0===H?void 0:H[0])&&void 0!==S?S:"")?null===(Q=null===(F=null==Jo?void 0:Jo.example)||void 0===F?void 0:F.header_handle)||void 0===Q?void 0:Q[0]:(null===(Y=null===(q=null==B?void 0:B.mapping)||void 0===q?void 0:q.header)||void 0===Y?void 0:Y[0])?null===(W=null===(K=null==B?void 0:B.mapping)||void 0===K?void 0:K.header)||void 0===W?void 0:W[0]:Qo.selectedVariable}),(null==Ro?void 0:Ro.format)==r.DOCUMENT?o(M,{children:o(d,{labelText:"PDF Name",placeholder:"Enter the name",value:Ko,errorMessage:$o||void 0,onBlur:()=>{if(!Ko)return null==N||N(""),void Go("PDF name is Required");const o=b(Ko);null==N||N(Ko),Go(o?"Please enter a valid PDF name":void 0)},onChangeText:o=>{Go(""),Wo(o)}})}):o(e,{})]}),(null===($=_o.bodyVariables)||void 0===$?void 0:$.length)>0&&o(E,{containerStyle:{paddingTop:_o.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===(G=_o.descriptionComponents)||void 0===G?void 0:G.map(((n,e)=>o(y,{originalVariableList:null!=Vo&&Vo>-1?xo.cards[Vo]:xo,type:n.type,descriptionComponent:n.component,showVariableModal:L},e))),(null===(J=null===(z=null!=Vo&&Vo>-1?null===(X=xo.cards[Vo])||void 0===X?void 0:X.buttons:null==xo?void 0:xo.buttons)||void 0===z?void 0:z.filter((o=>"URL"===o.type)))||void 0===J?void 0:J.length)>0&&o(E,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(no=null===(oo=null!=Vo&&Vo>-1?null===(Z=xo.cards[Vo])||void 0===Z?void 0:Z.buttons:null==xo?void 0:xo.buttons)||void 0===oo?void 0:oo.filter((o=>yo===p.CHATBOT||"URL"===o.type)))||void 0===no?void 0:no.map(((n,e)=>{const t=n.buttonVariable===c;if("URL"===n.type)return o(V,{variableListIndex:e,disableEdit:t,CTAoptions:null==I?void 0:I.CTAoptions,button:n,currentVariableList:null!=Vo&&Vo>-1?Object.assign({},xo.cards[Vo]):Object.assign({},xo),updateSelectedURLTemplateBtn:Xo},`${e}_${Vo}`)})),yo===p.CHATBOT&&(null===(to=null===(eo=Lo[0])||void 0===eo?void 0:eo.component)||void 0===to?void 0:to.buttons)&&(null===(ao=null===(lo=null===(io=Lo[0])||void 0===io?void 0:io.component)||void 0===lo?void 0:lo.buttons)||void 0===ao?void 0:ao.length)>0&&o(g,{backTrackMessage:null===(so=null==Eo?void 0:Eo.backTrackExtra)||void 0===so?void 0:so[0],setBackTrackMessage:null===(ro=null==Eo?void 0:Eo.backTrackExtra)||void 0===ro?void 0:ro[1]}),(null===(co=null===(uo=null!=Vo&&Vo>-1?null===(po=xo.cards[Vo])||void 0===po?void 0:po.buttons:null==xo?void 0:xo.buttons)||void 0===uo?void 0:uo.filter((o=>"QUICK_REPLY"===o.type)))||void 0===co?void 0:co.length)>0&&(yo!==p.CHATBOT?o(E,{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(g,{backTrackMessage:null===(mo=null==Eo?void 0:Eo.backTrackExtra)||void 0===mo?void 0:mo[0],setBackTrackMessage:null===(vo=null==Eo?void 0:Eo.backTrackExtra)||void 0===vo?void 0:vo[1]})),null===(fo=null===(go=null!=Vo&&Vo>-1?null===(bo=xo.cards[Vo])||void 0===bo?void 0:bo.buttons:null==xo?void 0:xo.buttons)||void 0===go?void 0:go.filter((o=>"QUICK_REPLY"===o.type)))||void 0===fo?void 0:fo.map(((n,e)=>{if("QUICK_REPLY"===n.type&&yo!==p.CHATBOT)return o(V,{variableListIndex:e,QRBoptions:null==I?void 0:I.QRBoptions,button:n,currentVariableList:null!=Vo&&Vo>-1?Object.assign({},xo.cards[Vo]):Object.assign({},xo),updateSelectedQRBTemplateBtn:zo},`${e}_${Vo}`)})),yo===p.CHATBOT&&Po&&o(f,{discountCode:null===(ho=null==Eo?void 0:Eo.discountCodeExtra)||void 0===ho?void 0:ho[0],setDiscountCode:null===(jo=null==Eo?void 0:Eo.discountCodeExtra)||void 0===jo?void 0:jo[1]}),null===(Co=null!=Vo&&Vo>-1?null===(Oo=xo.cards[Vo])||void 0===Oo?void 0:Oo.buttons:null==xo?void 0:xo.buttons)||void 0===Co?void 0:Co.map(((n,t)=>{var i,l,a,s,r;if("COPY_CODE"===n.type)return o(e,{children:Mo?o("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:o(d,{state:"disabled",labelText:null!==(i=n.text)&&void 0!==i?i:"Copy Code",value:null!==(l=n.buttonVariable)&&void 0!==l?l:"",onChangeText:()=>{}})})):o(T,{index:t,variable:{variableName:null!==(a=n.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=n.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(r=n.index)&&void 0!==r?r:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:n.type},t)})}))]}))},M=s.div`
|
|
2
2
|
padding-top: 24px;
|
|
3
3
|
padding-left: 10px;
|
|
4
4
|
padding-right: 10px;
|
|
5
5
|
margin-bottom: 8px;
|
|
6
6
|
line-height: normal;
|
|
7
|
-
`;export{
|
|
7
|
+
`;export{B as default};
|
package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ButtonPlaceHolderOptions } from "../../template-preview/models/TemplateMeta";
|
|
2
3
|
import { CTABtnValType, QRBBtnValType, TEMPLATE_BUTTON } from "../../template-preview/models/WhatsAppTemplate";
|
|
3
4
|
import { WhatsAppTemplateVariables } from "../../template-preview/models/WhatsAppTemplate";
|
|
@@ -11,6 +12,7 @@ export interface WhatsAppTemplateCardButtonV2Props {
|
|
|
11
12
|
CTAoptions?: ButtonPlaceHolderOptions[];
|
|
12
13
|
QRBoptions?: ButtonPlaceHolderOptions[];
|
|
13
14
|
variableListIndex: number;
|
|
15
|
+
disableEdit?: boolean;
|
|
14
16
|
}
|
|
15
|
-
declare const WhatsAppTemplateCardButtonV2:
|
|
17
|
+
declare const WhatsAppTemplateCardButtonV2: React.FC<WhatsAppTemplateCardButtonV2Props>;
|
|
16
18
|
export default WhatsAppTemplateCardButtonV2;
|
package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{cloneDeep as l}from"lodash";import{useState as s,useEffect as a}from"react";import{Dropdown as n}from"../../dropdown/Dropdown.js";import{Input as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{cloneDeep as l}from"lodash";import{useState as s,useEffect as a}from"react";import{Dropdown as n}from"../../dropdown/Dropdown.js";import{Input as i}from"../../input/Input.js";import{editableVarPattern as o}from"../../template-preview/constants/regexPatterns.js";import{CUSTOM_URL_NAME as r}from"../../template-preview/models/TemplateMeta.js";import{POD as u}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as c}from"../../TypographyStyle.js";import{COLORS as d}from"../../../constants/Theme.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";import{validateIsUrl as b}from"../utils/validateIsUrl.js";import m,{Container as j}from"./VariableConnector.js";const g=g=>{let{variableListIndex:v,button:O,updateSelectedURLTemplateBtn:f,updateSelectedQRBTemplateBtn:x,currentVariableList:y,CTAoptions:h,QRBoptions:L,disableEdit:R}=g;var U,V,T,w,C;const[I,E]=s(""),[P,H]=s(),N=null==h?void 0:h.map((e=>Object.assign(Object.assign({},e),{selected:(null==P?void 0:P.value)===e.value}))),B=null==L?void 0:L.map((e=>Object.assign(Object.assign({},e),{selected:(null==P?void 0:P.value)===e.value}))),{isError:Q,disableEditVariable:_,pod:S,selectedCarouselIndex:K,originalVariableList:Y,setOriginalVariableList:$,isProductCarouselType:k,ctaOptionsErrors:q,setCtaOptionsErrors:A}=p();function M(e){if(E(e),null!=K&&K>-1&&k){const t=l(Y);if("URL"===O.type){const l=t.cards.map((t=>{let l=t.buttons.filter((e=>"URL"===e.type))[v];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=t.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e));return Object.assign(Object.assign({},t),{buttons:s})}));null==$||$((e=>Object.assign(Object.assign({},e),{cards:l}))),null==f||f(`https://${e}`,"custom",v)}return}let t=y.buttons.filter((e=>"URL"===e.type))[v];t=Object.assign(Object.assign({},t),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=y.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),a=Object.assign({},null!=K&&K>-1?Y.cards[K]:Y);if(a.buttons=s,null!=K&&K>-1){const e=[...Y.cards];e[K]=a,null==$||$((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==$||$((e=>Object.assign(Object.assign({},e),{buttons:[...s]})));null==f||f(`https://${e}`,"custom",v)}return a((()=>{var e;if(O.buttonVariable&&o.test(O.buttonVariable))H(r),E((null===(e=O.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===O.type?h:L;e="URL"===O.type?t.findIndex((e=>e.placeHolder===O.buttonVariable)):t.findIndex((e=>e.label===O.flowName)),e>-1?H(t[e]):null==A||A((e=>Object.assign(Object.assign({},e),{[v]:"Required field!"})))}}),[]),S!==u.CHATBOT?e(j,{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(c,Object.assign({style:{color:d.content.primary}},{children:[O.text," button"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:t(n,{disabled:_||R,options:"URL"===O.type?N:B,isSearchable:!0,onSelect:function(e,t){null==A||A((e=>(delete e[v],Object.assign({},e))));const s=e;H(s);const a=("URL"===O.type?h:L).find((e=>e.placeHolder===s.placeHolder));if(a)if("custom_link"!==a.value){if(null!=K&&K>-1&&k){const e=l(Y);if("URL"===O.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"URL"===e.type))[v];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder});const l=e.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==f||f({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",v),null==$||$((e=>Object.assign(Object.assign({},e),{cards:t})))}else if("QUICK_REPLY"===O.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"QUICK_REPLY"===e.type))[v];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value});const l=e.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==x||x({flowName:s.label,flowId:s.value},"placeholder",v),null==$||$((e=>Object.assign(Object.assign({},e),{cards:t})))}return}let e;if("URL"===O.type){let t=y.buttons.filter((e=>"URL"===e.type))[v];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder,example:[(null==s?void 0:s.value)||"https://d.bik.ai/"]}),e=y.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==f||f({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",v)}else{let t=y.buttons.filter((e=>"QUICK_REPLY"===e.type))[v];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value}),e=y.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==x||x({flowName:s.label,flowId:s.value},"placeholder",v)}const t=Object.assign({},null!=K&&K>-1?Y.cards[K]:Y);if(t.buttons=e,null!=K&&K>-1){const e=[...Y.cards];e[K]=t,null==$||$((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==$||$((t=>Object.assign(Object.assign({},t),{buttons:[...e]})))}else M("")},defaultOptions:P?[Object.assign(Object.assign({},P),{selected:!0})]:[],error:Q?null==q?void 0:q[v]:void 0})})),"custom_link"===(null==P?void 0:P.value)&&t("div",Object.assign({style:{marginBottom:20}},{children:t(i,{state:_||R?"disabled":"none",errorMessage:Q?I?b(I)?"":"Enter valid URL":"Required field":"",value:I,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:M,maxCharLimit:2e3})}))]}):t(m,{index:v,variable:{variableName:null!==(U=O.text)&&void 0!==U?U:"",updatedValue:"((customPlaceholderName))"===O.buttonVariable?`${null===(V=O.example)||void 0===V?void 0:V[0]}`:null!==(T=O.buttonVariable)&&void 0!==T?T:"",type:"link",isEditableVariable:!0,index:null!==(w=O.index)&&void 0!==w?w:0,queryParams:null!==(C=O.queryParams)&&void 0!==C?C:[]},showVariableModal:!0,componentType:"BUTTONS",buttonType:O.type,CTAoptions:h})};export{g as default};
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export declare const BACKGROUND_PREVIEW_IMAGE = "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";
|
|
2
|
+
export declare const STATIC_URL_VARIABLE_NAME = "((staticPlaceholderName))";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e="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",a="((staticPlaceholderName))";export{e as BACKGROUND_PREVIEW_IMAGE,a as STATIC_URL_VARIABLE_NAME};
|