@bikdotai/bik-component-library 0.0.655-beta.12 → 0.0.655

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  2. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  3. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  4. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  5. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  6. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  7. package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.d.ts +1 -2
  8. package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  9. package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +5 -7
  10. package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
  11. package/dist/cjs/components/data-source-panel/model.d.ts +7 -10
  12. package/dist/cjs/components/data-source-panel/model.js +1 -1
  13. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  14. package/dist/cjs/components/product-picker-v2/utility.d.ts +2 -2
  15. package/dist/cjs/components/product-picker-v2/utility.js +1 -1
  16. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +2 -2
  17. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.d.ts +4 -4
  18. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.js +1 -1
  19. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +5 -7
  20. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
  21. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.style.js +1 -1
  22. package/dist/cjs/index.d.ts +0 -1
  23. package/dist/cjs/index.js +1 -1
  24. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  25. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  26. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  27. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  28. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  29. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  30. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.d.ts +1 -2
  31. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  32. package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +5 -7
  33. package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
  34. package/dist/esm/components/data-source-panel/model.d.ts +7 -10
  35. package/dist/esm/components/data-source-panel/model.js +1 -1
  36. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  37. package/dist/esm/components/product-picker-v2/utility.d.ts +2 -2
  38. package/dist/esm/components/product-picker-v2/utility.js +1 -1
  39. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +1 -1
  40. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.d.ts +4 -4
  41. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.js +1 -1
  42. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +5 -7
  43. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
  44. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.style.js +1 -1
  45. package/dist/esm/index.d.ts +0 -1
  46. package/dist/esm/index.js +1 -1
  47. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
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 "../../../Types/QueryBuilderAPI.type";
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 "../../../Types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
3
3
  declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default IGTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { AppType, footerButtonOptionModel, MessageSource } from './model';
2
+ import { footerButtonOptionModel, MessageSource } from './model';
3
3
  interface SourceInfoFooterProps {
4
- appType: AppType;
5
4
  sourceIntent: string;
6
5
  messageSource?: MessageSource;
7
6
  hideAddDataButton?: boolean;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/alert_triangle.svg.js"),i=require("../../assets/icons/plus.svg.js"),o=require("react"),n=require("../../constants/Theme.js"),d=require("../button/Button.js"),r=require("../TypographyStyle.js"),a=require("./DataSourcePanel.style.js"),s=require("./model.js");const l=o.memo((l=>{const{appType:c,sourceIntent:v,hideHeading:g,messageSource:p,trainingSourceCount:h={},ShowTrainingDataSource:T={},faqCount:m,ChecklistType:b,footerButtonOption:y}=l,A=T,[j,O]=o.useState(!0),[C,f]=o.useState(!0),[I,x]=o.useState({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[F,R]=o.useState({title:"",subTitle:""}),S=o.useMemo((()=>{const e=(null==h?void 0:h[v])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[h,v]),_=()=>{var e;(null==I?void 0:I.redirectUrl)?window.open(`${window.location.origin}${null==I?void 0:I.redirectUrl}`,"_self"):Object.keys(null!==(e=null==I?void 0:I.addFaqProps)&&void 0!==e?e:{}).length>0?null==y||y.onClick(I):(null==y?void 0:y.navigate)&&(null==y||y.navigate("Training",c==s.AppType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return o.useEffect((()=>{var e,t,i,o,n,d,r,a,l,u,g,T;if(v){if(null===(e=null==p?void 0:p.sources)||void 0===e?void 0:e.length)if(A[v])v===b.ORDER_ENQUIRY&&f(!1);else{let e=null===(t=p.sources[0])||void 0===t?void 0:t.insights,y="";switch(v){case b.PRODUCT_DETAILS:"Product reviews"!==(null===(i=p.sources[0])||void 0===i?void 0:i.title)&&(e=`${m||"No"} FAQs added for this product`,y="Add product-specific information via FAQs to improve responses",x({buttonTitle:"Add FAQ",addFaqProps:{faqProducts:[{id:null===(o=p.sources[0])||void 0===o?void 0:o.productId,variantId:null===(n=p.sources[0])||void 0===n?void 0:n.variantId,name:null===(d=p.sources[0])||void 0===d?void 0:d.title,imageUrl:null===(r=p.sources[0])||void 0===r?void 0:r.imageUrl}]},redirectUrl:""}));break;case b.ORDER_MODIFICATION:e=(null==h?void 0:h[v])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",e&&x({buttonTitle:c==s.AppType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:c==s.AppType.MANIFEST?"/customise?tab=AgentHandover":"/bik-ai/training",addFaqProps:{}});break;case b.ORDER_CANCELLATION:e=(null==h?void 0:h[v])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",x({buttonTitle:c==s.AppType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:c==s.AppType.MANIFEST?"/customise?tab=AgentHandover":"/bik-ai/training",addFaqProps:{}});break;case b.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null===(a=p.sources[0])||void 0===a?void 0:a.subIntent))break;x({buttonTitle:c==s.AppType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:c==s.AppType.MANIFEST?"/training/order-management":"/bik-ai/training",addFaqProps:{}});break;case b.PRODUCT_SEARCH:if("QUIZ"===(null===(l=p.sources[0])||void 0===l?void 0:l.type))break;if(-1!==(null===(T=null===(g=null===(u=null==p?void 0:p.sources)||void 0===u?void 0:u[0])||void 0===g?void 0:g.title)||void 0===T?void 0:T.toLowerCase().indexOf("collection"))){e="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}e="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}R({title:null!=e?e:"",subTitle:y})}(A[v]||[b.PRODUCT_DETAILS,b.ORDER_MODIFICATION,b.ORDER_CANCELLATION,b.ORDER_TRACKING].includes(v))&&O(!1)}}),[null==p?void 0:p.messageId,h,v,null==p?void 0:p.sources,A,b,m,c,p]),e.jsx(a.SourceInfoFooterStyle,{children:!(null==F?void 0:F.title)&&h&&v in h?e.jsxs(e.Fragment,{children:[e.jsx(u,{hideHeading:null!=g&&g}),e.jsxs("div",Object.assign({className:"source_info_details "+(h[v]>0?"":"no_data_source")},{children:[h[v]>0&&C?e.jsxs(e.Fragment,{children:[e.jsx(r.BodyCaption,{children:S}),e.jsx(r.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):C&&e.jsxs("div",Object.assign({className:"no_data_source_title"},{children:[e.jsx(t.default,{width:15,height:15,color:n.COLORS.content.negative,style:{marginTop:2}}),e.jsx(r.BodyCaption,{children:"No data sources added to the identified link"})]})),!y||y.hideAddDataButton||j?e.jsx(e.Fragment,{}):e.jsx(d.Button,{size:"small",buttonType:"tertiary",LeadingIcon:i.default,buttonText:(null==I?void 0:I.buttonTitle.length)>0?null==I?void 0:I.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>_(),style:{backgroundColor:"unset"}})]}))]}):e.jsxs(e.Fragment,{children:[e.jsx(u,{hideHeading:null!=g&&g}),e.jsxs("div",Object.assign({className:"source_info_details"},{children:[C&&e.jsxs(e.Fragment,{children:[e.jsx(r.BodyCaption,{children:null==F?void 0:F.title}),e.jsx(r.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:null==F?void 0:F.subTitle}))]}),!y||y.hideAddDataButton||j?e.jsx(e.Fragment,{}):e.jsx(d.Button,{size:"small",buttonType:"tertiary",LeadingIcon:i.default,buttonText:(null==I?void 0:I.buttonTitle.length)>0?null==I?void 0:I.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>_(),style:{backgroundColor:"unset"}})]}))]})})})),u=o.memo((t=>t.hideHeading?null:e.jsx(r.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Training insights"}))));u.displayName="TrainingInsightsHeading",l.displayName="SourceInfoFooter",exports.default=l;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/alert_triangle.svg.js"),n=require("../../assets/icons/plus.svg.js"),i=require("react"),s=require("../../constants/Theme.js"),o=require("../button/Button.js"),a=require("../TypographyStyle.js"),r=require("./DataSourcePanel.style.js");const d=i.memo((d=>{const{sourceIntent:u,hideHeading:c,messageSource:h,trainingSourceCount:g={},ShowTrainingDataSource:j={},ChecklistType:m,footerButtonOption:x}=d,[y,v]=i.useState({}),O=j,[T,C]=i.useState(!0),[b,p]=i.useState(!0),f=i.useMemo((()=>{const e=(null==g?void 0:g[u])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[g,u]);return i.useEffect((()=>{var e,t;if(u){if(null===(e=null==h?void 0:h.sources)||void 0===e?void 0:e.length)if(O[u])u===m.ORDER_ENQUIRY&&p(!1);else{const e=null!==(t=null==x?void 0:x.title)&&void 0!==t?t:h.sources[0].insights,n=null==x?void 0:x.subtitle;v({title:e,subTitle:n})}(O[u]||[m.PRODUCT_DETAILS,m.ORDER_MODIFICATION,m.ORDER_CANCELLATION,m.ORDER_TRACKING].includes(u))&&C(!1)}}),[null==h?void 0:h.messageId,g,u]),e.jsx(r.SourceInfoFooterStyle,{children:!y.title&&g&&u in g?e.jsxs(e.Fragment,{children:[e.jsx(l,{hideHeading:null!=c&&c}),e.jsxs("div",Object.assign({className:"source_info_details "+(g[u]>0?"":"no_data_source")},{children:[g[u]>0&&b?e.jsxs(e.Fragment,{children:[e.jsx(a.BodyCaption,{children:f}),e.jsx(a.BodyCaption,Object.assign({color:s.COLORS.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):b&&e.jsxs("div",Object.assign({className:"no_data_source_title"},{children:[e.jsx(t.default,{width:15,height:15,color:s.COLORS.content.negative,style:{marginTop:2}}),e.jsx(a.BodyCaption,{children:"No data sources added to the identified link"})]})),!x||x.hideAddDataButton||T?e.jsx(e.Fragment,{}):e.jsx(o.Button,{size:"small",buttonType:"tertiary",LeadingIcon:n.default,buttonText:(null==x?void 0:x.buttonTitle.length)>0?null==x?void 0:x.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:x.onClick,style:{backgroundColor:"unset"}})]}))]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{hideHeading:null!=c&&c}),e.jsxs("div",Object.assign({className:"source_info_details"},{children:[b&&e.jsxs(e.Fragment,{children:[e.jsx(a.BodyCaption,{children:y.title}),e.jsx(a.BodyCaption,Object.assign({color:s.COLORS.content.secondary},{children:y.subTitle}))]}),!x||x.hideAddDataButton||T?e.jsx(e.Fragment,{}):e.jsx(o.Button,{size:"small",buttonType:"tertiary",LeadingIcon:n.default,buttonText:(null==x?void 0:x.buttonTitle.length)>0?null==x?void 0:x.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:x.onClick,style:{backgroundColor:"unset"}})]}))]})})})),l=i.memo((t=>t.hideHeading?null:e.jsx(a.BodyCaption,Object.assign({color:s.COLORS.content.secondary},{children:"Training insights"}))));l.displayName="TrainingInsightsHeading",d.displayName="SourceInfoFooter",exports.default=d;
@@ -1,25 +1,23 @@
1
1
  /// <reference types="react" />
2
- import { AllSourceInfoDetailsCustomDataModel, AppType, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource } from './model';
2
+ import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource } from './model';
3
3
  export interface DataSourcePanelProps {
4
4
  storeId: string;
5
- appType: AppType;
6
5
  messageSource: MessageSource;
7
6
  setMessageSourcePanel: (source?: MessageSource) => void;
8
7
  hideCloseButton?: boolean;
9
8
  title?: string;
10
9
  allSourceInfoDetail: AllSourceInfoDetailsCustomDataModel;
11
10
  isSourceInfoFetched?: boolean;
11
+ faqCount: number;
12
12
  editableSources: CustomDataType[];
13
13
  redirect: (sourceInfo: InfoContent) => void;
14
- preFillTrainingSourceCount?: {
14
+ trainingSourceCount: {
15
15
  [k in string]: number;
16
16
  };
17
17
  zeroStateButton: DataSourcePanelZeroState;
18
18
  ChecklistType: Record<string, string>;
19
+ IntentComponentMap: Record<string, JSX.Element>;
20
+ ShowTrainingDataSource: Record<string, string>;
19
21
  footerButtonOption?: footerButtonOptionModel;
20
- fetchTrainingSourceCount: (storeId: string) => Promise<{
21
- [k in string]: number;
22
- }>;
23
- fetchProductFAQCount: (storeId: string, productIds?: string[]) => Promise<number>;
24
22
  }
25
23
  export declare const DataSourcePanel: React.FC<DataSourcePanelProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/boxV2.svg.js"),i=require("../../assets/icons/cross.svg.js"),o=require("../../assets/icons/edit.svg.js"),s=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),a=require("../../assets/icons/info.svg.js"),r=require("../../assets/icons/openai.svg.js"),l=require("../../assets/icons/plus.svg.js"),d=require("../../assets/icons/redirect.svg.js"),c=require("../../assets/icons/text_t9.svg.js"),u=require("../../assets/icons/website.svg.js"),p=require("react"),y=require("../../constants/Theme.js"),g=require("../button/Button.js"),C=require("../icon-button/IconButton.js"),T=require("../shimmer/ShimmerComponent/BikShimmer.js"),x=require("../tag/Tag.js"),h=require("../tooltips/Tooltip.js"),O=require("../TypographyStyle.js"),S=require("./DataSourceInfoFooter.js"),I=require("./DataSourcePanel.style.js"),v=require("./model.js");exports.DataSourcePanel=E=>{var j,m;const{appType:f,storeId:L,messageSource:b,setMessageSourcePanel:N,hideCloseButton:R,isSourceInfoFetched:_,allSourceInfoDetail:D,ChecklistType:A,title:w,zeroStateButton:k,editableSources:F,preFillTrainingSourceCount:P,redirect:q,footerButtonOption:B,fetchTrainingSourceCount:U,fetchProductFAQCount:M}=E,{sources:K}=b,H=["blog","article","page","policy"],[Q,G]=p.useState(!1),[Y,W]=p.useState(!1),[$,z]=p.useState(0),[X,V]=p.useState(null!=P?P:{}),Z={};[{key:"GENERIC",type:"neutral",tagText:"Generic"},{key:"STORE_INFORMATION",type:"blue",tagText:"Store information"},{key:"SHIPPING_POLICY",type:"positive",tagText:"Shipping policy"},{key:"RETURN_AND_REFUND",type:"purple",tagText:"Returns & refund policy"},{key:"CONTACT_INFO",type:"warning",tagText:"Contact details"},{key:"STORE_LOCATION",type:"grey",tagText:"Store location"},{key:"SALES_AND_OFFERS",type:"purple",tagText:"Offers & rewards"},{key:"PRODUCT_CUSTOMISATION",type:"blue",tagText:"Product customisation"},{key:"PRODUCT_DETAILS",type:"blue",tagText:"Product details"},{key:"PAYMENT_METHODS",type:"positive",tagText:"Payment methods"},{key:"ORDER_TRACKING",type:"warning",tagText:"Order tracking"},{key:"PRODUCT_SEARCH",type:"neutral",tagText:"Product search"},{key:"PURCHASE",type:"blue",tagText:"Purchase"},{key:"CONNECT_TO_AGENT",type:"purple",tagText:"Talk to a person"},{key:"CHECKOUT_ENQUIRY",type:"purple",tagText:"Checkout enquiry"},{key:"ORDER_CANCELLATION",type:"positive",tagText:"Order cancellation"},{key:"ORDER_ENQUIRY",type:"neutral",tagText:"Order enquiry"},{key:"ORDER_MODIFICATION",type:"blue",tagText:"Order modification"},{key:"SUBSCRIPTION_ENQUIRY",type:"warning",tagText:"Subscription enquiry"},{key:"SALES_AND_OFFERS_ISSUES",type:"grey",tagText:"Offer-related enquiries"},{key:"COLLABORATION",type:"positive",tagText:"Collaboration"},{key:"QUIZ_GENERATION",type:"warning",tagText:"Start the quiz"},{key:"SIMILAR_PRODUCT",type:"blue",tagText:"Similar Product"},{key:"EMAIL_COLLECTION",type:"warning",tagText:"Email Collection"},{key:"ADD_TO_CART_SUCCESS",type:"blue",tagText:"Add to Cart Success"},{key:"ADD_TO_CART_SUCCESS_MESSAGE",type:"blue",tagText:"Add to Cart Success Message"},{key:"FEEDBACK",type:"blue",tagText:"Feedback"},{key:"PHONE_NUMBER_COLLECTION",type:"blue",tagText:"Phone no. collection"}].forEach((t=>{let{key:i,type:o,tagText:s}=t;A[i]&&(Z[A[i]]=e.jsx(x.Tag,{theme:"light",type:o,tagText:s,cursor:"pointer"}))}));const J=p.useMemo((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{A[t]&&(e[A[t]]=A[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[A]);p.useEffect((()=>{var e,t,i,o;if(!(null==b?void 0:b.messageId))return;G(!0),W(!1!==(null===(t=null===(e=b.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=b.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights));const s=b.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(s)).filter((e=>!!e));M(L,n).then((e=>z(e))).then((()=>{P?(V(P),setTimeout((()=>G(!1)),100)):U(L).then((e=>V(e))).then((()=>{setTimeout((()=>G(!1)),100)}))}))}),[M,U,null==b?void 0:b.messageId,b.sources,P,L]);const ee=e=>!(0!==e.length&&!(null==b?void 0:b.isUnsatisfactoryAnswer)),te=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=v.CustomDataType.FILES:H.includes(e)?e=v.CustomDataType.FETCHED_LINKS:"url"==e?e=v.CustomDataType.WEBSITE_LINKS:"text"===e?e=v.CustomDataType.TEXTS:"faq"===e&&(e=v.CustomDataType.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},ie=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return Q||!_?e.jsx(I.SourceInfoDetailsStyle,{children:e.jsx(T.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})}):e.jsx(e.Fragment,{children:e.jsx(I.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!w&&e.jsx(O.TitleSmall,{children:w}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(O.BodyCaption,Object.assign({color:y.COLORS.content.secondary},{children:"Intent"})),null!==(j=Z[b.intent])&&void 0!==j?j:Z.GENERIC,!R&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>N(void 0)},{children:e.jsx(i.default,{height:20,width:20,color:y.COLORS.content.secondary})}))]})),ee(K)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,i;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${y.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(a.default,{width:24,height:24,color:y.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(O.TitleSmall,{children:"Insufficient data"})})),e.jsx(O.BodySecondary,Object.assign({color:y.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),k&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=k.leadingIcon)&&void 0!==t?t:l.default,buttonText:null!==(i=k.title)&&void 0!==i?i:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{k.onClick()}})}))]}))})()})):e.jsx(x.Tag,{LeadingIcon:a.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:b.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${f===v.AppType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!ee(K)&&e.jsx("div",Object.assign({className:"info-container"},{children:e.jsx("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:K.map(((i,a)=>{var l,p,g,T,x,S,I,E,j,m,f,L,b,N,R,_,w;const k=te(i.type||i.subTitle||"OpenAI"),P=te(i.type||i.subTitle||"OpenAI",!0),B=(U=k)?"faq"==U.toLocaleLowerCase()?"FAQ":"openai"==U.toLocaleLowerCase()?"OPENAI":"files"==U.toLocaleLowerCase()?"PDF":"texts"==U.toLocaleLowerCase()?"Custom text":((U=(U=U.charAt(0).toUpperCase()+U.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(U=U.slice(0,-1)),U.replace("Website","Manual")):"";var U;const M=null==F?void 0:F.includes(P),K="Products"===i.subTitle?D[null!==(l=i.productId)&&void 0!==l?l:"Products"]:D[null!==(p=i.docId)&&void 0!==p?p:""],H=P.toLowerCase()===(null===(g=v.CustomDataType.FAQ)||void 0===g?void 0:g.toLowerCase())?"faq"===(null===(T=i.title)||void 0===T?void 0:T.toLowerCase())?i.subTitle:i.title:P.toLowerCase()===(null===(x=v.CustomDataType.FILES)||void 0===x?void 0:x.toLowerCase())||P.toLowerCase()===(null===(S=v.CustomDataType.FETCHED_LINKS)||void 0===S?void 0:S.toLowerCase())||P.toLowerCase()===(null===(I=v.CustomDataType.TEXTS)||void 0===I?void 0:I.toLowerCase())?i.title:P.toLowerCase()===(null===(E=v.CustomDataType.WEBSITE_LINKS)||void 0===E?void 0:E.toLowerCase())?i.title.split("/")[i.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):i.intent===A.EMAIL_COLLECTION?B:i.title,Q="faq"===P.toLowerCase()?null!==(f=null!==(j=null==K?void 0:K.content)&&void 0!==j?j:null===(m=null==K?void 0:K.data)||void 0===m?void 0:m.answer)&&void 0!==f?f:"":P.toLowerCase()===(null===(L=v.CustomDataType.FETCHED_LINKS)||void 0===L?void 0:L.toLowerCase())||P.toLowerCase()===(null===(b=v.CustomDataType.WEBSITE_LINKS)||void 0===b?void 0:b.toLowerCase())||P.toLowerCase()===(null===(N=v.CustomDataType.TEXTS)||void 0===N?void 0:N.toLowerCase())?null!==(w=null!==(R=null==K?void 0:K.content)&&void 0!==R?R:null===(_=null==K?void 0:K.data)||void 0===_?void 0:_.fileContentText)&&void 0!==w?w:"":i.intent===A.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"24px 0px",borderBottom:`1px solid ${y.COLORS.stroke.primary}`}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(h.Tooltip,Object.assign({body:H,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:P==v.CustomDataType.FETCHED_LINKS||P==v.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:y.COLORS.content.primary,className:"clamp-title",onClick:()=>P==v.CustomDataType.FETCHED_LINKS||P==v.CustomDataType.WEBSITE_LINKS?q(i):{}},{children:H}))}))})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[i.intent!==A.EMAIL_COLLECTION&&e.jsxs(e.Fragment,{children:[(G=k,"products"==G||"product"==G?e.jsx(t.default,{height:16,width:16,color:y.COLORS.content.secondary}):"files"==G?e.jsx(s.default,{height:16,width:16,color:y.COLORS.content.secondary}):"website links"==G||"fetched links"==G?e.jsx(u.default,{height:16,width:16,color:y.COLORS.content.secondary}):"faq"==G?e.jsx(n.default,{height:16,width:16,color:y.COLORS.content.secondary}):"texts"==G?e.jsx(c.default,{height:16,width:16,color:y.COLORS.content.secondary}):e.jsx(r.default,{height:16,width:16,color:y.COLORS.content.secondary})),e.jsx(O.BodyCaption,Object.assign({color:y.COLORS.content.secondary},{children:B}))]}),(i.link||i.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:M?e.jsx(C.IconButton,{Icon:o.default,height:16,width:16,bordered:!0,onClick:()=>null==K?void 0:K.onEditClick(K.data,K.type),disabled:!K,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:d.default,height:16,width:16,bordered:!0,disabled:"custom"===i.type&&!K,disabledTooltip:"This source is deleted",onClick:()=>q(i)})}))]}))]})),(null!=Q?Q:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${y.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:y.COLORS.surface.subdued}},{children:e.jsx(O.BodyCaption,Object.assign({color:y.COLORS.content.primary,className:"clamp-description"},{children:ie(null!=Q?Q:"").trim()}))}))]}),`info-${a}`);var G}))}))})),Y&&!ee(K)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(S.default,{appType:f,storeId:L,messageSource:b,sourceIntent:null!==(m=b.intent)&&void 0!==m?m:A.GENERIC,faqCount:$,trainingSourceCount:X,ShowTrainingDataSource:J,ChecklistType:A,footerButtonOption:B})}))]})})})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/boxV2.svg.js"),s=require("../../assets/icons/cross.svg.js"),i=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),a=require("../../assets/icons/info.svg.js"),r=require("../../assets/icons/openai.svg.js"),l=require("../../assets/icons/plus.svg.js"),d=require("../../assets/icons/redirect.svg.js"),c=require("../../assets/icons/text_t9.svg.js"),u=require("../../assets/icons/website.svg.js"),p=require("react"),h=require("../../constants/Theme.js"),g=require("../button/Button.js"),x=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),y=require("../tag/Tag.js"),j=require("../tooltips/Tooltip.js"),v=require("../TypographyStyle.js"),m=require("./DataSourceInfoFooter.js"),f=require("./DataSourcePanel.style.js"),L=require("./model.js");exports.DataSourcePanel=O=>{var S,T;const{storeId:I,messageSource:b,setMessageSourcePanel:w,hideCloseButton:E,faqCount:D=0,isSourceInfoFetched:q,allSourceInfoDetail:B,ChecklistType:N,IntentComponentMap:k,title:R,zeroStateButton:F,editableSources:_,redirect:A,trainingSourceCount:P,ShowTrainingDataSource:K,footerButtonOption:W}=O,{sources:M}=b,H=["blog","article","page","policy"],[Q,$]=p.useState(!1),[U,X]=p.useState(!1);p.useEffect((()=>{var e,t,s,i;(null==b?void 0:b.messageId)&&($(!0),setTimeout((()=>$(!1)),200),X(!1!==(null===(t=null===(e=b.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=b.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights)))}),[null==b?void 0:b.messageId]);const z=e=>!(0!==e.length&&!(null==b?void 0:b.isUnsatisfactoryAnswer)),G=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:H.includes(e)?e=L.CustomDataType.FETCHED_LINKS:"url"==e?e=L.CustomDataType.WEBSITE_LINKS:"text"===e?e=L.CustomDataType.TEXTS:"faq"===e&&(e=L.CustomDataType.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.replace(/_/g," ")};return Q||!q?e.jsx(f.SourceInfoDetailsStyle,{children:e.jsx(C.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})}):e.jsx(e.Fragment,{children:e.jsx(f.SourceInfoDetailsStyle,{children:!!(null==M?void 0:M.length)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!R&&e.jsx(v.TitleSmall,{children:R}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(S=k[b.intent])&&void 0!==S?S:k.GENERIC,!E&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>w(void 0)},{children:e.jsx(s.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),z(M)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(a.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(v.TitleSmall,{children:"Insufficient data"})})),e.jsx(v.BodySecondary,Object.assign({color:h.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),F&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=F.leadingIcon)&&void 0!==t?t:l.default,buttonText:null!==(s=F.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{F.onClick()}})}))]}))})()})):e.jsx(y.Tag,{LeadingIcon:a.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:b.isEditable?"If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in Manifest.":"Edit the original source and save again to update the response"})]})),!z(M)&&e.jsx("div",Object.assign({className:"info-container"},{children:e.jsx("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:M.map(((s,a)=>{var l,p,g,C,y,m,f,O,S,T,I,b,w,E;const D=G(s.type||s.subTitle||"OpenAI"),q=G(s.type||s.subTitle||"OpenAI",!0),k=(R=D)?"faq"==R.toLocaleLowerCase()?"FAQ":"openai"==R.toLocaleLowerCase()?"OPENAI":"files"==R.toLocaleLowerCase()?"PDF":"texts"==R.toLocaleLowerCase()?"Custom text":((R=(R=R.charAt(0).toUpperCase()+R.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(R=R.slice(0,-1)),R.replace("Website","Manual")):"";var R;const F=null==_?void 0:_.includes(q),P="Products"===s.subTitle?B[null!==(l=s.productId)&&void 0!==l?l:"Products"]:B[null!==(p=s.docId)&&void 0!==p?p:""],K=q.toLowerCase()===(null===(g=L.CustomDataType.FAQ)||void 0===g?void 0:g.toLowerCase())?"faq"===(null===(C=s.title)||void 0===C?void 0:C.toLowerCase())?s.subTitle:s.title:q.toLowerCase()===(null===(y=L.CustomDataType.FILES)||void 0===y?void 0:y.toLowerCase())||q.toLowerCase()===(null===(m=L.CustomDataType.FETCHED_LINKS)||void 0===m?void 0:m.toLowerCase())||q.toLowerCase()===(null===(f=L.CustomDataType.TEXTS)||void 0===f?void 0:f.toLowerCase())?s.title:q.toLowerCase()===(null===(O=L.CustomDataType.WEBSITE_LINKS)||void 0===O?void 0:O.toLowerCase())?s.title.split("/")[s.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):s.intent===N.EMAIL_COLLECTION?k:s.title,W="faq"===q.toLowerCase()?null===(S=null==P?void 0:P.data)||void 0===S?void 0:S.answer:q.toLowerCase()===(null===(T=L.CustomDataType.FETCHED_LINKS)||void 0===T?void 0:T.toLowerCase())||q.toLowerCase()===(null===(I=L.CustomDataType.WEBSITE_LINKS)||void 0===I?void 0:I.toLowerCase())||q.toLowerCase()===(null===(b=L.CustomDataType.TEXTS)||void 0===b?void 0:b.toLowerCase())?null!==(E=null===(w=null==P?void 0:P.data)||void 0===w?void 0:w.fileContentText)&&void 0!==E?E:"":s.intent===N.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"24px 0px",borderBottom:`1px solid ${h.COLORS.stroke.primary}`}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(j.Tooltip,Object.assign({body:K,placement:"top"},{children:e.jsx(v.BodySecondary,Object.assign({style:q==L.CustomDataType.FETCHED_LINKS||q==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>q==L.CustomDataType.FETCHED_LINKS||q==L.CustomDataType.WEBSITE_LINKS?A(s):{}},{children:K}))}))})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[s.intent!==N.EMAIL_COLLECTION&&e.jsxs(e.Fragment,{children:[(H=D,"products"==H?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==H?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==H||"fetched links"==H?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==H?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==H?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(r.default,{height:16,width:16,color:h.COLORS.content.secondary})),e.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:k}))]}),(s.link||s.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:F?e.jsx(x.IconButton,{Icon:i.default,height:16,width:16,bordered:!0,onClick:()=>null==P?void 0:P.onEditClick(P.data,P.type),disabled:!P,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,bordered:!0,disabled:"custom"===s.type&&!P,disabledTooltip:"This source is deleted",onClick:()=>A(s)})}))]}))]})),(null!=W?W:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:(M=null!=W?W:"",M.replace(/(<([^>]+)>)/gi,"")).trim()}))}))]}),`info-${a}`);var M,H}))}))})),U&&!z(M)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(m.default,{storeId:I,messageSource:b,sourceIntent:null!==(T=b.intent)&&void 0!==T?T:N.GENERIC,faqCount:D,trainingSourceCount:P,ShowTrainingDataSource:K,ChecklistType:N,footerButtonOption:W})}))]})})})};
@@ -124,15 +124,12 @@ export interface LiveChatCTA {
124
124
  buttonType: string;
125
125
  }
126
126
  export interface footerButtonOptionModel {
127
+ title?: string;
128
+ subtitle?: string;
129
+ buttonTitle: string;
130
+ addFaqProps?: any;
131
+ redirectUrl?: string;
127
132
  hideAddDataButton?: boolean;
128
- navigate?: (pagePathKey: string, params?: object, queryParam?: object, openInNewTab?: boolean) => void;
129
- onClick: ({ buttonTitle, redirectUrl, addFaqProps }: {
130
- buttonTitle: any;
131
- redirectUrl: any;
132
- addFaqProps: any;
133
- }) => void;
134
- }
135
- export declare enum AppType {
136
- MANIFEST = "MANIFEST",
137
- BIK = "BIK"
133
+ navigate?: (pagePathKey: Record<string, string>, params?: object, queryParam?: object, openInNewTab?: boolean) => void;
134
+ onClick: () => void;
138
135
  }
@@ -1 +1 @@
1
- "use strict";var e,t,o;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomDataCategories=void 0,(e=exports.CustomDataCategories||(exports.CustomDataCategories={})).PAGE="page",e.POLICY="policy",e.ARTICLE="article",e.UPLOADED="uploaded",e.TEXT="text",exports.CustomDataType=void 0,(t=exports.CustomDataType||(exports.CustomDataType={})).FAQ="FAQ",t.FILES="FILES",t.WEBSITE_LINKS="WEBSITE_LINKS",t.TEXTS="TEXTS",t.FETCHED_LINKS="FETCHED_LINKS",t.URL="URL",t.TRAINING_TEMPLATE="TRAINING_TEMPLATE",exports.AppType=void 0,(o=exports.AppType||(exports.AppType={})).MANIFEST="MANIFEST",o.BIK="BIK";
1
+ "use strict";var t,e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomDataCategories=void 0,(t=exports.CustomDataCategories||(exports.CustomDataCategories={})).PAGE="page",t.POLICY="policy",t.ARTICLE="article",t.UPLOADED="uploaded",t.TEXT="text",exports.CustomDataType=void 0,(e=exports.CustomDataType||(exports.CustomDataType={})).FAQ="FAQ",e.FILES="FILES",e.WEBSITE_LINKS="WEBSITE_LINKS",e.TEXTS="TEXTS",e.FETCHED_LINKS="FETCHED_LINKS",e.URL="URL",e.TRAINING_TEMPLATE="TRAINING_TEMPLATE";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),i=require("../input/Input.js"),l=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),h=require("./productInfoOverlay.js"),p=require("./productScreen.js"),S=require("./rearrangeScreen.js"),C=require("./reducers.js"),x=require("./searchScreen.js"),g=require("./selectedScreen.js"),j=require("./style.js"),y=require("./type.js"),m=require("./utility.js");exports.ScreenName=void 0,(e=exports.ScreenName||(exports.ScreenName={})).Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products";exports.ProductPickerModal=e=>{const{storeId:b,selectedItems:f,onClose:v,visible:k,zIndex:I,exactLimit:P,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:R,outOfStockAction:T=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,hideSelectionCount:N,title:E,width:A,left:w,renderWithoutModal:B,onClickSave:L,pickerType:M,hideProductVariants:V=!1,startupScreen:z=exports.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:_=!1,showProductDetails:H,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:K={},primaryButton:U,secondaryButton:Y,subtitle:J}=e,[Q,X]=c.useReducer(C.collectionsReducer,{}),[Z,ee]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections),[te,oe]=c.useState("grid"),[ce,re]=c.useState(""),[se,ne]=c.useState(""),[ie,le]=c.useState(0),[ae,de]=c.useState(!1),[ue,he]=c.useState(0),[pe,Se]=c.useState(""),[Ce,xe]=c.useState(!1),[ge,je]=c.useState(!1),[ye,me]=c.useReducer(C.searchReducer,{collections:{},products:{}}),[be,fe]=c.useReducer(C.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ve=c.useRef(null),[ke,Ie]=c.useState(!1),[Pe,Oe]=c.useState();c.useEffect((()=>{de(!0),je(!0),e.collectionFetcher(ie,b).then((e=>{X({type:"fetched",data:(null==e?void 0:e.collections)||{}}),de(!1),le((e=>e+1)),je(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;V?Object.keys(be||[]).forEach((t=>{var o;Object.keys((null===(o=be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&be[-1]&&(null===(c=be[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(be||[]).forEach((t=>{var o;Object.keys((null===(o=be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=be[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Q,be,V]),c.useEffect((()=>{se&&(de(!0),e.productFetcher(se,b).then((e=>{Object.keys(e).length&&X({type:"productsFetched",data:{collectionId:se,products:e}}),de(!1)})).catch())}),[se]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==Z&&(pe.length||"collections"!==Z)&&(pe.length?(xe(!0),e.searchFetcher(b,pe).then((e=>{"collections"in e&&"products"in e?(me({type:"set",data:e}),X({type:"searched",data:e.collections})):(me({type:"set",data:{collections:{},products:e}}),X({type:"searched",data:e})),ee("searchProducts"),de(!1),xe(!1)}))):ee("collections"))}),800);return()=>clearTimeout(t)}),[pe]),c.useEffect((()=>{L&&(e.onAdd(be,ue),Fe())}),[L]),c.useEffect((()=>{_&&Object.keys(be||{}).length&&ue&&(e.onAdd(be,ue),Fe())}),[_,be,ue]);const Fe=()=>{fe({type:"reset",data:{}})},Re=()=>P&&ue>P?t.jsx(d.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):O&&ue>O?t.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):ue>0?t.jsx(n.Button,{onClick:()=>{ee($?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:P?`${ue}/${P} products selected`:`${ue} products selected`,buttonType:["rearrange","view"].includes(Z)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(Z)}):t.jsx(n.Button,{disabled:!0,buttonText:P?`${ue}/${P} products selected`:`${ue} products selected`,buttonType:"tertiaryGray"}),Te=e=>ae?"Loading...":Z===exports.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",De=t.jsxs(j.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===Z||"searchProducts"===Z)&&t.jsx("div",Object.assign({style:{padding:B?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(i.Input,{placeholder:"Search for collections and products, or type a product ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Ce?t.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:pe,onChangeText:e=>{e.length&&e.trim().length?Se(e):Se("")}})}))}),t.jsxs(j.ScrollContainerStyle,Object.assign({ref:ve,screenName:Z},{children:["collections"===Z&&t.jsx(u.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:ge,collections:Q,selectedCollectionsDispatch:fe,setCollectionId:re,setSelectedCollectionId:ne,setScreen:ee,selectedCollections:be,collectionFetcher:e.collectionFetcher,storeId:b,collectionsDispatch:X,setSaveDisabled:de,pagingControls:{curPage:ie,setCurPage:le},hideCollectionCheckbox:F,renderWithoutModal:B,pickerType:M,scrollContainerRef:ve}),"products"===Z&&ce&&t.jsx(C.CollectionIdContext.Provider,Object.assign({value:ce},{children:t.jsx(p.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:ee,storeId:b,data:Q[ce],collectionsDispatch:X,selectedCollectionsDispatch:fe,selectedData:be,setSaveDisabled:de,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:R,outOfStockAction:T,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,renderWithoutModal:B,pickerType:M,hideProductVariants:V,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Oe(e)},showProductDetailInfoIcon:H,scrollContainerRef:ve})})),"view"===Z&&t.jsx(g.SelectedScreen,{selectedCollections:be||{},selectedCollectionsDispatch:fe,setScreen:ee,collections:Q,hideProductVariants:V,outOfStockAction:T,storeId:b,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===Z&&t.jsx(S.RearrangeScreen,{selectedCollections:be||{},selectedCollectionsDispatch:fe,setScreen:ee,outOfStockAction:T,rearrangeViewType:"grid"===te?"list":"grid",scrollContainerRef:ve,storeId:b,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===Z&&t.jsx(x.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:be||{},searchedCollections:ye||{},searchedCollectionsDispatch:me,selectedCollectionsDispatch:fe,setScreen:ee,collections:Q,onBackPress:()=>{Se(""),me({type:"set",data:{collections:{},products:{}}})},pickerType:M,hideProductCheckbox:R,hideProductVariants:V,hideVariantCheckbox:D,storeId:b,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:re,setSelectedCollectionId:ne,renderWithoutModal:B,hideCollectionCheckbox:F,outOfStockAction:T})]}))]}));return t.jsx(t.Fragment,{children:B?t.jsxs(t.Fragment,{children:[De,K.renderFooter?t.jsxs(j.StyledFooterForNonModal,{children:[Re(),t.jsx(n.Button,{buttonText:Te(K.primaryButtonText),disabled:!K.isLoading&&(ae||ue<1||P&&ue<P||!P&&O&&ue>O)||K.primaryButtonDisabled,isLoading:K.isLoading,onClick:()=>{e.onAdd(be,ue),Fe(),ee([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections)}})]}):t.jsx(t.Fragment,{}),ke&&Pe?t.jsx(h.ProductInfoOverlay,{productData:Pe,outOfStockAction:T,useDynamicInfoImageSize:e.useDynamicInfoImageSize,onClose:()=>{Ie(!1)}}):t.jsx(t.Fragment,{})]}):t.jsxs(l.StyledModal,Object.assign({zIndex:I,open:k,onClose:()=>{null==v||v(),Fe()},headingTitle:E||("collections"===Z||"products"===Z?"Select Products":"view"===Z?"Selected Products":"searchProducts"===Z?"Searched Results":"rearrange"===Z?"Rearrange Products":void 0),headingSubtitle:J,footerShadow:!0,centralContainerStyles:{width:A||"600px",left:w||"auto"},headerRightCustomElement:G?t.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:v},{children:t.jsx(s.default,{width:20,height:20,color:r.COLORS.content.secondary})})):t.jsx(t.Fragment,{}),footerContainerStyle:e.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:U?(t=>Object.assign(Object.assign({},t),{disabled:!t.isLoading&&(ae||ue<1||P&&ue<P||!P&&O&&ue>O)||t.disabled,onClick:()=>{e.onAdd(be,ue),Fe(),ee([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections)}}))(U):{buttonText:Te(),disabled:ae||ue<1||P&&ue<P||!P&&O&&ue>O||!1,onClick:()=>{e.onAdd(be,ue),Fe()}},secondaryButton:Y?(t=>Object.assign(Object.assign({},t),{disabled:ae||ue<1||P&&ue<P||!P&&O&&ue>O||!1,onClick:()=>{const t=m.updateAllVariantsForSelectedProducts(be,Q,ye);e.onAdd(t,ue,!0)}}))(Y):void 0,wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?t.jsx(t.Fragment,{}):Re(),hideCrossButton:ke||G},{children:[De,ke&&Pe?t.jsx(h.ProductInfoOverlay,{productData:Pe,useDynamicInfoImageSize:e.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Ie(!1)}}):t.jsx(t.Fragment,{})]}))})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),i=require("../input/Input.js"),l=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),h=require("./productInfoOverlay.js"),p=require("./productScreen.js"),S=require("./rearrangeScreen.js"),C=require("./reducers.js"),x=require("./searchScreen.js"),g=require("./selectedScreen.js"),j=require("./style.js"),y=require("./type.js"),m=require("./utility.js");exports.ScreenName=void 0,(e=exports.ScreenName||(exports.ScreenName={})).Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products";exports.ProductPickerModal=e=>{const{storeId:b,selectedItems:f,onClose:v,visible:k,zIndex:I,exactLimit:P,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:R,outOfStockAction:T=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,hideSelectionCount:N,title:E,width:A,left:w,renderWithoutModal:B,onClickSave:L,pickerType:M,hideProductVariants:V=!1,startupScreen:z=exports.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:_=!1,showProductDetails:H,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:K={},primaryButton:U,secondaryButton:Y,subtitle:J}=e,[Q,X]=c.useReducer(C.collectionsReducer,{}),[Z,ee]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections),[te,oe]=c.useState("grid"),[ce,re]=c.useState(""),[se,ne]=c.useState(""),[ie,le]=c.useState(0),[ae,de]=c.useState(!1),[ue,he]=c.useState(0),[pe,Se]=c.useState(""),[Ce,xe]=c.useState(!1),[ge,je]=c.useState(!1),[ye,me]=c.useReducer(C.searchReducer,{collections:{},products:{}}),[be,fe]=c.useReducer(C.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ve=c.useRef(null),[ke,Ie]=c.useState(!1),[Pe,Oe]=c.useState();c.useEffect((()=>{de(!0),je(!0),e.collectionFetcher(ie,b).then((e=>{X({type:"fetched",data:(null==e?void 0:e.collections)||{}}),de(!1),le((e=>e+1)),je(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;V?Object.keys(be||[]).forEach((t=>{var o;Object.keys((null===(o=be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&be[-1]&&(null===(c=be[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(be||[]).forEach((t=>{var o;Object.keys((null===(o=be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=be[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Q,be,V]),c.useEffect((()=>{se&&(de(!0),e.productFetcher(se,b).then((e=>{Object.keys(e).length&&X({type:"productsFetched",data:{collectionId:se,products:e}}),de(!1)})).catch())}),[se]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==Z&&(pe.length||"collections"!==Z)&&(pe.length?(xe(!0),e.searchFetcher(b,pe).then((e=>{"collections"in e&&"products"in e?(me({type:"set",data:e}),X({type:"searched",data:e.collections})):(me({type:"set",data:{collections:{},products:e}}),X({type:"searched",data:e})),ee("searchProducts"),de(!1),xe(!1)}))):ee("collections"))}),800);return()=>clearTimeout(t)}),[pe]),c.useEffect((()=>{L&&(e.onAdd(be,ue),Fe())}),[L]),c.useEffect((()=>{_&&Object.keys(be||{}).length&&ue&&(e.onAdd(be,ue),Fe())}),[_,be,ue]);const Fe=()=>{fe({type:"reset",data:{}})},Re=()=>P&&ue>P?t.jsx(d.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):O&&ue>O?t.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):ue>0?t.jsx(n.Button,{onClick:()=>{ee($?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:P?`${ue}/${P} products selected`:`${ue} products selected`,buttonType:["rearrange","view"].includes(Z)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(Z)}):t.jsx(n.Button,{disabled:!0,buttonText:P?`${ue}/${P} products selected`:`${ue} products selected`,buttonType:"tertiaryGray"}),Te=e=>ae?"Loading...":Z===exports.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",De=t.jsxs(j.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===Z||"searchProducts"===Z)&&t.jsx("div",Object.assign({style:{padding:B?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(i.Input,{placeholder:"Search for collections and products, or type a product ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Ce?t.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:pe,onChangeText:e=>{e.length&&e.trim().length?Se(e):Se("")}})}))}),t.jsxs(j.ScrollContainerStyle,Object.assign({ref:ve,screenName:Z},{children:["collections"===Z&&t.jsx(u.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:ge,collections:Q,selectedCollectionsDispatch:fe,setCollectionId:re,setSelectedCollectionId:ne,setScreen:ee,selectedCollections:be,collectionFetcher:e.collectionFetcher,storeId:b,collectionsDispatch:X,setSaveDisabled:de,pagingControls:{curPage:ie,setCurPage:le},hideCollectionCheckbox:F,renderWithoutModal:B,pickerType:M,scrollContainerRef:ve}),"products"===Z&&ce&&t.jsx(C.CollectionIdContext.Provider,Object.assign({value:ce},{children:t.jsx(p.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:ee,storeId:b,data:Q[ce],collectionsDispatch:X,selectedCollectionsDispatch:fe,selectedData:be,setSaveDisabled:de,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:R,outOfStockAction:T,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,renderWithoutModal:B,pickerType:M,hideProductVariants:V,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Oe(e)},showProductDetailInfoIcon:H,scrollContainerRef:ve})})),"view"===Z&&t.jsx(g.SelectedScreen,{selectedCollections:be||{},selectedCollectionsDispatch:fe,setScreen:ee,collections:Q,hideProductVariants:V,outOfStockAction:T,storeId:b,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===Z&&t.jsx(S.RearrangeScreen,{selectedCollections:be||{},selectedCollectionsDispatch:fe,setScreen:ee,outOfStockAction:T,rearrangeViewType:"grid"===te?"list":"grid",scrollContainerRef:ve,storeId:b,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===Z&&t.jsx(x.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:be||{},searchedCollections:ye||{},searchedCollectionsDispatch:me,selectedCollectionsDispatch:fe,setScreen:ee,collections:Q,onBackPress:()=>{Se(""),me({type:"set",data:{collections:{},products:{}}})},pickerType:M,hideProductCheckbox:R,hideProductVariants:V,hideVariantCheckbox:D,storeId:b,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:re,setSelectedCollectionId:ne,renderWithoutModal:B,hideCollectionCheckbox:F,outOfStockAction:T})]}))]}));return t.jsx(t.Fragment,{children:B?t.jsxs(t.Fragment,{children:[De,K.renderFooter?t.jsxs(j.StyledFooterForNonModal,{children:[Re(),t.jsx(n.Button,{buttonText:Te(K.primaryButtonText),disabled:!K.isLoading&&(ae||ue<1||P&&ue<P||!P&&O&&ue>O)||K.primaryButtonDisabled,isLoading:K.isLoading,onClick:()=>{e.onAdd(be,ue),Fe(),ee([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections)}})]}):t.jsx(t.Fragment,{}),ke&&Pe?t.jsx(h.ProductInfoOverlay,{productData:Pe,outOfStockAction:T,useDynamicInfoImageSize:e.useDynamicInfoImageSize,onClose:()=>{Ie(!1)}}):t.jsx(t.Fragment,{})]}):t.jsxs(l.StyledModal,Object.assign({zIndex:I,open:k,onClose:()=>{null==v||v(),Fe()},headingTitle:E||("collections"===Z||"products"===Z?"Select Products":"view"===Z?"Selected Products":"searchProducts"===Z?"Searched Results":"rearrange"===Z?"Rearrange Products":void 0),headingSubtitle:J,footerShadow:!0,centralContainerStyles:{width:A||"600px",left:w||"auto"},headerRightCustomElement:G?t.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:v},{children:t.jsx(s.default,{width:20,height:20,color:r.COLORS.content.secondary})})):t.jsx(t.Fragment,{}),footerContainerStyle:e.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:U?(t=>Object.assign(Object.assign({},t),{disabled:!t.isLoading&&(ae||ue<1||P&&ue<P||!P&&O&&ue>O)||t.disabled,onClick:()=>{e.onAdd(be,ue),Fe(),ee([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections)}}))(U):{buttonText:Te(),disabled:ae||ue<1||P&&ue<P||!P&&O&&ue>O||!1,onClick:()=>{e.onAdd(be,ue),Fe()}},secondaryButton:Y?(t=>Object.assign(Object.assign({},t),{disabled:ae||ue<1||P&&ue<P||!P&&O&&ue>O||!1,onClick:()=>{const t=m.updateAllVariantsForSelectedProducts(be,Q);e.onAdd(t,ue,!0)}}))(Y):void 0,wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?t.jsx(t.Fragment,{}):Re(),hideCrossButton:ke||G},{children:[De,ke&&Pe?t.jsx(h.ProductInfoOverlay,{productData:Pe,useDynamicInfoImageSize:e.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Ie(!1)}}):t.jsx(t.Fragment,{})]}))})};
@@ -1,4 +1,4 @@
1
- import { Collection, FbStatusFetcherReturn, Product, ProductVariant, SearchedItems, SelectedItems } from './modal';
1
+ import { Collection, FbStatusFetcherReturn, Product, ProductVariant, SelectedItems } from './modal';
2
2
  import { CollectionsActions } from './reducers';
3
3
  export declare const liftTheStateUp: (payload: any, data: any) => any;
4
4
  export declare function paginateSelectedItems(selectedItems: SelectedItems, limit: number, offset: number): {
@@ -47,4 +47,4 @@ export declare const updateAllVariantsForSelectedProducts: (selectedItems: {
47
47
  };
48
48
  } | undefined;
49
49
  };
50
- }, collections: Collection, searchedProducts: SearchedItems) => Record<string, any>;
50
+ }, collections: Collection) => Record<string, any>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("lodash");function l(o,l,t){if(!o)return{};const i=Object.keys(o).slice(t,t+l),n={};return i.forEach((l=>{n[l]=o[l]})),n}const t=(o,l,t)=>{Object.keys(o).forEach((l=>{var t,i;const n=null!==(i=null===(t=o[l])||void 0===t?void 0:t.products)&&void 0!==i?i:{};Object.keys(n).forEach((t=>{var i,n,d,v;const s=null!==(v=null===(d=null===(n=null===(i=o[l])||void 0===i?void 0:i.products)||void 0===n?void 0:n[t])||void 0===d?void 0:d.variants)&&void 0!==v?v:{};Object.keys(s).forEach((i=>{var n,d,v,s;const e=null===(s=null===(v=null===(d=null===(n=o[l])||void 0===n?void 0:n.products)||void 0===d?void 0:d[t])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[i];e&&!e.fbStatus&&(e.fbStatus="APPROVED")}))}))})),l({type:t,data:o})};exports.fetchFbStatusCollection=function(o,l,i,n){let d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";n||t(o,i,d);const v=(o=>{const l=[];return Object.keys(o).forEach((t=>{var i,n;const d=null!==(n=null===(i=o[t])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,v,s;const e=null!==(s=null===(v=null===(d=null===(n=o[t])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,v,s,e;const u=null===(e=null===(s=null===(v=null===(d=o[t])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];(null==u?void 0:u.fbStatus)||l.push(n)}))}))})),l})(o);v.length>0&&n&&n(l,v).then((l=>{const t=Object.assign({},o);Object.keys(t).forEach((o=>{var i,n;const d=null!==(n=null===(i=t[o])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,v,s;const e=null!==(s=null===(v=null===(d=null===(n=t[o])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,v,s,e;const u=null===(e=null===(s=null===(v=null===(d=t[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];u&&"REJECTED"===l[n]?u.fbStatus="REJECTED":u&&"APPROVED"===l[n]&&(u.fbStatus="APPROVED")}))}))})),i({type:d,data:t})})).catch((l=>{console.error("Error in fbStatusFetcher",l),t(o,i,d)}))},exports.getVariantIdsToFetchAtProductLevel=(o,l)=>{const t=[];return Object.keys(null!=o?o:{}).forEach((i=>{var n,d;const v=null!==(d=null===(n=null==o?void 0:o[i])||void 0===n?void 0:n.variants)&&void 0!==d?d:{};Object.keys(v).forEach((n=>{var d,v,s,e,u;let r;r=l?null===(s=null===(v=null===(d=null==l?void 0:l.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[n]:null===(u=null===(e=null==o?void 0:o[i])||void 0===e?void 0:e.variants)||void 0===u?void 0:u[n],(null==r?void 0:r.fbStatus)||t.push(n)}))})),t},exports.isCollectionPartiallyChecked=function(o,l,t){var i,n,d,v;let s=0,e=0;if(arguments.length>3&&void 0!==arguments[3]&&arguments[3]){const v=null!==(i=null==l?void 0:l.products)&&void 0!==i?i:{};s=Object.keys(v).length;const u=null!==(d=null===(n=t[o])||void 0===n?void 0:n.products)&&void 0!==d?d:{};e=Object.keys(u).length}else if(t[o]){const i=null==l?void 0:l.products;i&&Object.keys(i).forEach((o=>{var l;const t=null===(l=i[o])||void 0===l?void 0:l.variants;t&&Object.keys(t).forEach((o=>s+=1))}));const n=null===(v=t[o])||void 0===v?void 0:v.products;if(n&&Object.keys(n).forEach((o=>{var l;const t=null===(l=n[o])||void 0===l?void 0:l.variants;t&&Object.keys(t).forEach((o=>e+=1))})),s<=0&&e>0)return!1}return e>0&&s!==e},exports.isProductPartiallyChecked=(o,l,t,i,n)=>{var d,v,s,e,u,r,c,a,p,b,O,f,j,h,y,g,E,k,P;let D=0,S=0;if(null===(v=null===(d=null==t?void 0:t[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[l]){if(n)return!1;const d=(null===(u=null===(e=null===(s=null==t?void 0:t[o])||void 0===s?void 0:s.products)||void 0===e?void 0:e[l])||void 0===u?void 0:u.variants)||[];if(1===Object.keys(d).length)for(const i in d){const n=null===(c=null===(r=null==t?void 0:t[o])||void 0===r?void 0:r.products)||void 0===c?void 0:c[l],d=null===(O=null===(b=null===(p=null===(a=null==t?void 0:t[o])||void 0===a?void 0:a.products)||void 0===p?void 0:p[l])||void 0===b?void 0:b.variants)||void 0===O?void 0:O[i];if(null===(f=null==d?void 0:d.name)||void 0===f?void 0:f.includes(null!==(j=null==n?void 0:n.name)&&void 0!==j?j:""))return!1}if(null===(g=Object.keys((null===(y=null===(h=null==i?void 0:i.products)||void 0===h?void 0:h[l])||void 0===y?void 0:y.variants)||[]))||void 0===g||g.forEach((()=>S++)),Object.keys((null===(P=null===(k=null===(E=null==t?void 0:t[o])||void 0===E?void 0:E.products)||void 0===k?void 0:k[l])||void 0===P?void 0:P.variants)||[]).forEach((()=>D++)),D>0&&S!==D)return!0}return!1},exports.liftTheStateUp=(l,t)=>{const i=o.cloneDeep(t);if(delete i.products,(l=Object.assign(Object.assign({},l),{catalogOnlyData:i})).productId&&t.products){const n=o.cloneDeep(t.products[l.productId]);(null==n?void 0:n.variants)&&delete n.variants,l=Object.assign(Object.assign({},l),{catalogOnlyData:i,productOnlyData:n})}return l},exports.markVariantsAsApprovedProductsLevel=(o,l,t,i,n)=>{const d=Object.assign({},o);if(Object.keys(o).forEach((l=>{var t,i;Object.keys(null!==(i=null===(t=null==o?void 0:o[l])||void 0===t?void 0:t.variants)&&void 0!==i?i:{}).forEach((t=>{var i,n;const v=null===(i=null==o?void 0:o[l].variants)||void 0===i?void 0:i[t];v&&(v.fbStatus="APPROVED");const s=null===(n=null==d?void 0:d[l])||void 0===n?void 0:n.variants;s&&s[t]&&(s[t]=v)}))})),i&&n){const o=Object.assign({},i);o.products=d,n(o),l({type:"productsPaged",data:{collectionId:t,products:d}})}else l({type:"productsPaged",data:{collectionId:t,products:d}})},exports.paginateSelectedItems=function(o,t,i){var n;const d={};let v=0;for(const s in o)if(Object.prototype.hasOwnProperty.call(o,s)){const e=o[s],u=l(e.products,t,i-v);u&&Object.keys(u).length>0&&(d[s]=Object.assign(Object.assign({},e),{products:u})),v+=Object.keys(null!==(n=e.products)&&void 0!==n?n:{}).length}return d},exports.shouldShowVariant=o=>{const l=Object.keys(o.variants||[]);let t=!1;return!(l.length<=1)||(l.forEach((l=>{var i,n;t=null!==(n=null===(i=o.variants)||void 0===i?void 0:i[l].name.includes(o.name))&&void 0!==n&&n})),!t)},exports.updateAllVariantsForSelectedProducts=(l,t,i)=>Object.keys(l).reduce(((n,d)=>{var v;return d in t?(n[d]=Object.assign(Object.assign({},l[d]),{products:Object.keys(null!==(v=l[d].products)&&void 0!==v?v:{}).reduce(((n,v)=>{var s,e,u,r,c,a,p,b,O,f;const j=null===(s=t[d].products)||void 0===s?void 0:s[v],h=null===(r=null===(u=null===(e=null==i?void 0:i.products)||void 0===e?void 0:e[d])||void 0===u?void 0:u.products)||void 0===r?void 0:r[v];return j?n[v]=Object.assign(Object.assign({},(null===(c=l[d].products)||void 0===c?void 0:c[v])||{}),{allVariants:o.cloneDeep(j.variants)}):h?n[v]=Object.assign(Object.assign({},(null===(a=l[d].products)||void 0===a?void 0:a[v])||{}),{allVariants:o.cloneDeep(h.variants)}):(null===(b=null===(p=l[d].products)||void 0===p?void 0:p[v])||void 0===b?void 0:b.allVariants)&&(n[v]=Object.assign(Object.assign({},(null===(O=l[d].products)||void 0===O?void 0:O[v])||{}),{allVariants:o.cloneDeep(null===(f=l[d].products)||void 0===f?void 0:f[v].allVariants)})),n}),{})}),n):n}),{});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("lodash");function t(o,t,l){if(!o)return{};const i=Object.keys(o).slice(l,l+t),n={};return i.forEach((t=>{n[t]=o[t]})),n}const l=(o,t,l)=>{Object.keys(o).forEach((t=>{var l,i;const n=null!==(i=null===(l=o[t])||void 0===l?void 0:l.products)&&void 0!==i?i:{};Object.keys(n).forEach((l=>{var i,n,d,v;const s=null!==(v=null===(d=null===(n=null===(i=o[t])||void 0===i?void 0:i.products)||void 0===n?void 0:n[l])||void 0===d?void 0:d.variants)&&void 0!==v?v:{};Object.keys(s).forEach((i=>{var n,d,v,s;const e=null===(s=null===(v=null===(d=null===(n=o[t])||void 0===n?void 0:n.products)||void 0===d?void 0:d[l])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[i];e&&!e.fbStatus&&(e.fbStatus="APPROVED")}))}))})),t({type:l,data:o})};exports.fetchFbStatusCollection=function(o,t,i,n){let d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";n||l(o,i,d);const v=(o=>{const t=[];return Object.keys(o).forEach((l=>{var i,n;const d=null!==(n=null===(i=o[l])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,v,s;const e=null!==(s=null===(v=null===(d=null===(n=o[l])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,v,s,e;const r=null===(e=null===(s=null===(v=null===(d=o[l])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];(null==r?void 0:r.fbStatus)||t.push(n)}))}))})),t})(o);v.length>0&&n&&n(t,v).then((t=>{const l=Object.assign({},o);Object.keys(l).forEach((o=>{var i,n;const d=null!==(n=null===(i=l[o])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,v,s;const e=null!==(s=null===(v=null===(d=null===(n=l[o])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,v,s,e;const r=null===(e=null===(s=null===(v=null===(d=l[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];r&&"REJECTED"===t[n]?r.fbStatus="REJECTED":r&&"APPROVED"===t[n]&&(r.fbStatus="APPROVED")}))}))})),i({type:d,data:l})})).catch((t=>{console.error("Error in fbStatusFetcher",t),l(o,i,d)}))},exports.getVariantIdsToFetchAtProductLevel=(o,t)=>{const l=[];return Object.keys(null!=o?o:{}).forEach((i=>{var n,d;const v=null!==(d=null===(n=null==o?void 0:o[i])||void 0===n?void 0:n.variants)&&void 0!==d?d:{};Object.keys(v).forEach((n=>{var d,v,s,e,r;let u;u=t?null===(s=null===(v=null===(d=null==t?void 0:t.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[n]:null===(r=null===(e=null==o?void 0:o[i])||void 0===e?void 0:e.variants)||void 0===r?void 0:r[n],(null==u?void 0:u.fbStatus)||l.push(n)}))})),l},exports.isCollectionPartiallyChecked=function(o,t,l){var i,n,d,v;let s=0,e=0;if(arguments.length>3&&void 0!==arguments[3]&&arguments[3]){const v=null!==(i=null==t?void 0:t.products)&&void 0!==i?i:{};s=Object.keys(v).length;const r=null!==(d=null===(n=l[o])||void 0===n?void 0:n.products)&&void 0!==d?d:{};e=Object.keys(r).length}else if(l[o]){const i=null==t?void 0:t.products;i&&Object.keys(i).forEach((o=>{var t;const l=null===(t=i[o])||void 0===t?void 0:t.variants;l&&Object.keys(l).forEach((o=>s+=1))}));const n=null===(v=l[o])||void 0===v?void 0:v.products;if(n&&Object.keys(n).forEach((o=>{var t;const l=null===(t=n[o])||void 0===t?void 0:t.variants;l&&Object.keys(l).forEach((o=>e+=1))})),s<=0&&e>0)return!1}return e>0&&s!==e},exports.isProductPartiallyChecked=(o,t,l,i,n)=>{var d,v,s,e,r,u,c,a,p,b,O,f,j,h,y,E,g,k,P;let D=0,S=0;if(null===(v=null===(d=null==l?void 0:l[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[t]){if(n)return!1;const d=(null===(r=null===(e=null===(s=null==l?void 0:l[o])||void 0===s?void 0:s.products)||void 0===e?void 0:e[t])||void 0===r?void 0:r.variants)||[];if(1===Object.keys(d).length)for(const i in d){const n=null===(c=null===(u=null==l?void 0:l[o])||void 0===u?void 0:u.products)||void 0===c?void 0:c[t],d=null===(O=null===(b=null===(p=null===(a=null==l?void 0:l[o])||void 0===a?void 0:a.products)||void 0===p?void 0:p[t])||void 0===b?void 0:b.variants)||void 0===O?void 0:O[i];if(null===(f=null==d?void 0:d.name)||void 0===f?void 0:f.includes(null!==(j=null==n?void 0:n.name)&&void 0!==j?j:""))return!1}if(null===(E=Object.keys((null===(y=null===(h=null==i?void 0:i.products)||void 0===h?void 0:h[t])||void 0===y?void 0:y.variants)||[]))||void 0===E||E.forEach((()=>S++)),Object.keys((null===(P=null===(k=null===(g=null==l?void 0:l[o])||void 0===g?void 0:g.products)||void 0===k?void 0:k[t])||void 0===P?void 0:P.variants)||[]).forEach((()=>D++)),D>0&&S!==D)return!0}return!1},exports.liftTheStateUp=(t,l)=>{const i=o.cloneDeep(l);if(delete i.products,(t=Object.assign(Object.assign({},t),{catalogOnlyData:i})).productId&&l.products){const n=o.cloneDeep(l.products[t.productId]);(null==n?void 0:n.variants)&&delete n.variants,t=Object.assign(Object.assign({},t),{catalogOnlyData:i,productOnlyData:n})}return t},exports.markVariantsAsApprovedProductsLevel=(o,t,l,i,n)=>{const d=Object.assign({},o);if(Object.keys(o).forEach((t=>{var l,i;Object.keys(null!==(i=null===(l=null==o?void 0:o[t])||void 0===l?void 0:l.variants)&&void 0!==i?i:{}).forEach((l=>{var i,n;const v=null===(i=null==o?void 0:o[t].variants)||void 0===i?void 0:i[l];v&&(v.fbStatus="APPROVED");const s=null===(n=null==d?void 0:d[t])||void 0===n?void 0:n.variants;s&&s[l]&&(s[l]=v)}))})),i&&n){const o=Object.assign({},i);o.products=d,n(o),t({type:"productsPaged",data:{collectionId:l,products:d}})}else t({type:"productsPaged",data:{collectionId:l,products:d}})},exports.paginateSelectedItems=function(o,l,i){var n;const d={};let v=0;for(const s in o)if(Object.prototype.hasOwnProperty.call(o,s)){const e=o[s],r=t(e.products,l,i-v);r&&Object.keys(r).length>0&&(d[s]=Object.assign(Object.assign({},e),{products:r})),v+=Object.keys(null!==(n=e.products)&&void 0!==n?n:{}).length}return d},exports.shouldShowVariant=o=>{const t=Object.keys(o.variants||[]);let l=!1;return!(t.length<=1)||(t.forEach((t=>{var i,n;l=null!==(n=null===(i=o.variants)||void 0===i?void 0:i[t].name.includes(o.name))&&void 0!==n&&n})),!l)},exports.updateAllVariantsForSelectedProducts=(t,l)=>Object.keys(t).reduce(((i,n)=>{var d;return n in l?(i[n]=Object.assign(Object.assign({},t[n]),{products:Object.keys(null!==(d=t[n].products)&&void 0!==d?d:{}).reduce(((i,d)=>{var v,s,e,r,u,c;const a=null===(v=l[n].products)||void 0===v?void 0:v[d];return a?i[d]=Object.assign(Object.assign({},(null===(s=t[n].products)||void 0===s?void 0:s[d])||{}),{allVariants:o.cloneDeep(a.variants)}):(null===(r=null===(e=t[n].products)||void 0===e?void 0:e[d])||void 0===r?void 0:r.allVariants)&&(i[d]=Object.assign(Object.assign({},(null===(u=t[n].products)||void 0===u?void 0:u[d])||{}),{allVariants:o.cloneDeep(null===(c=t[n].products)||void 0===c?void 0:c[d].allVariants)})),i}),{})}),i):i}),{});
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/edit.svg.js"),l=require("../../../assets/icons/info.svg.js"),a=require("date-fns"),i=require("lodash"),n=require("react"),s=require("styled-components"),o=require("../../alerts/Alert.js"),u=require("../../alerts/AlertHelper.js"),d=require("../../custom-date-time/CustomDateTime.js"),r=require("../../dropdown/Dropdown.js"),c=require("../../input/Input.js"),p=require("../../product-picker-v2/collectionScreen.js"),v=require("../../template-preview/constants/regexPatterns.js"),m=require("../../template-preview/models/Channels.js"),b=require("../../template-preview/models/WebpushTemplate.js"),g=require("../../template-preview/models/WhatsAppTemplate.js"),O=require("../../TypographyStyle.js"),j=require("../../../utils/StringUtils.js"),x=require("../../../constants/Theme.js"),y=require("../context/templateModalContext.js"),E=require("../custom-hooks/useAdditionalVariables.js"),T=require("../utils/getVariableNameEmail.js"),_=require("./QueryParamsComponent.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=h(s);const C=f.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/edit.svg.js"),l=require("../../../assets/icons/info.svg.js"),a=require("date-fns"),i=require("lodash"),n=require("react"),s=require("styled-components"),o=require("../../alerts/Alert.js"),u=require("../../alerts/AlertHelper.js"),d=require("../../custom-date-time/CustomDateTime.js"),r=require("../../dropdown/Dropdown.js"),c=require("../../input/Input.js"),p=require("../../product-picker-v2/collectionScreen.js"),v=require("../../template-preview/constants/regexPatterns.js"),m=require("../../template-preview/models/Channels.js"),b=require("../../template-preview/models/WebpushTemplate.js"),g=require("../../template-preview/models/WhatsAppTemplate.js"),O=require("../../TypographyStyle.js"),j=require("../../../utils/StringUtils.js"),x=require("../../../constants/Theme.js"),E=require("../context/templateModalContext.js"),y=require("../custom-hooks/useAdditionalVariables.js"),T=require("../utils/getVariableNameEmail.js"),_=require("./QueryParamsComponent.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=h(s);const C=f.default.div`
2
2
  /* surface/$color-background-warning-light */
3
3
 
4
4
  background: ${e=>e.focused&&e.channel===m.CHANNEL_TYPE.EMAIL?x.COLORS.background.warning.light:"transparent"};
@@ -16,4 +16,4 @@
16
16
  height: 100%;
17
17
  width: 48%;
18
18
  background: rgba(0, 0, 0, 0.1);
19
- `,L={value:"custom_link",label:"Custom URL"},A={value:"custom_text",label:"Custom text"},S={value:"static_expiry",label:"Static Expiry"};exports.Container=C,exports.default=s=>{var h,f,V,H,k,D,B,Y,w;const{onFocus:U,variable:R,index:q,showVariableModal:I,setShowDiscountCheckBox:W,componentType:M,CTAoptions:$,buttonType:z}=s,[Z,F]=n.useState(!1),[G,Q]=n.useState(""),[K,J]=n.useState([]),[X,ee]=n.useState(),[te,le]=n.useState(!1),{variableList:ae,setVariableList:ie,setVariableCallback:ne,setShowVariablePicker:se,device:oe,channel:ue,isError:de,originalVariableList:re,template:ce,templateSelectionTriggered:pe,setTemplate:ve,setDisplayContent:me,setOriginalVariableList:be,globalNormalizedPlaceholders:ge,enabledCustomText:Oe,pod:je,selectedCarouselIndex:xe,isProductCarouselType:ye,isWhatsappCarousel:Ee,disableEditVariable:Te,disableEditExpiry:_e,templateErrorIndexes:he,maxCharLimit:fe,disableDatePicker:Ce,showDiscountCodeExpiryInfo:Ne,cardIndex:Pe=1}=y.useTemplateModalContext();function Le(e,t){var l,a,i,n;const s=e;Q(""),ee(s),ue===m.CHANNEL_TYPE.WHATSAPP||ue===m.CHANNEL_TYPE.RCS?"custom_text"!==s.value&&"custom_link"!==s.value&&"static_expiry"!==s.value?(Se(null!==(l=s.value)&&void 0!==l?l:"","string"),null==Ve||Ve(null!==(a=R.index)&&void 0!==a?a:0,s.value,!0)):(null==Ve||Ve(null!==(i=R.index)&&void 0!==i?i:0,"",!0,s.value),Se("","url"===s.bikPlaceholderType?"link":"string")):"custom_text"!==s.value&&"custom_link"!==s.value?(Se(s.value,"url"===s.bikPlaceholderType?"link":"string"),ue==m.CHANNEL_TYPE.WEBPUSH&&(null==ke||ke(null!==(n=R.index)&&void 0!==n?n:0,s.value))):(Q(""),Se("",s.value))}function Ae(e,t){var l,a;Q(t);const i="custom_link"===(null==X?void 0:X.value)&&t?t.includes("https")?t:`https://${t}`:t;Se(i,"static_expiry"===e?"string":e),ue!==m.CHANNEL_TYPE.WHATSAPP&&ue!==m.CHANNEL_TYPE.RCS||null==Ve||Ve(null!==(l=R.index)&&void 0!==l?l:0,i,"custom_link"===e,e),ue===m.CHANNEL_TYPE.WEBPUSH&&(null==ke||ke(null!==(a=R.index)&&void 0!==a?a:0,i))}function Se(e,t,l){var a,n,s,o,u;const d="custom_link"===t?"link":"custom_text"===t?"string":t;if(ue!==m.CHANNEL_TYPE.WHATSAPP&&ue!==m.CHANNEL_TYPE.WEBPUSH&&ue!==m.CHANNEL_TYPE.RCS){const l=T.getVariableNameForEmailByIndex(q+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===oe?"template_html_mobile":"template_html_desktop"),n=ue===m.CHANNEL_TYPE.EMAIL?null===(a=null==i?void 0:i.contentWindow)||void 0===a?void 0:a.document.getElementById(l):document.getElementById(l);n&&(n.textContent="custom_text"!==t&&"custom_link"!==t||e?e:R.variableName);const s=re.map(((t,l)=>l===q?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t));null==be||be(s)}if(ue===m.CHANNEL_TYPE.WEBPUSH){const t=re,l=t=>null==t?void 0:t.map(((t,l)=>l===q?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t)),a={BODY:"BODY"===M?l(t.body):t.body,TITLE:M===b.WEB_PUSH_COMPONENT_TYPE.TITLE.toUpperCase()?l(t.title):t.title};null==be||be((e=>Object.assign(Object.assign({},e),{title:a.TITLE,body:a.BODY,buttons:t.buttons})))}if(ue===m.CHANNEL_TYPE.WHATSAPP||ue===m.CHANNEL_TYPE.RCS){if(null!=xe&&xe>-1&&ye){const l=Object.assign({},re).cards.map(((l,a)=>{var i,n,s;return"BODY"===M?Object.assign(Object.assign({},l),{body:null===(i=l.body)||void 0===i?void 0:i.map(((t,l)=>q===l?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t))}):"TITLE"===M?Object.assign(Object.assign({},l),{title:null===(n=l.title)||void 0===n?void 0:n.map(((t,l)=>q===l?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t))}):"BUTTONS"===M?Object.assign(Object.assign({},l),{buttons:null===(s=l.buttons)||void 0===s?void 0:s.map(((l,a)=>a===q?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))}):l}));return void(null==be||be((e=>Object.assign(Object.assign({},e),{cards:l}))))}const a=null!=xe&&xe>-1?re.cards[xe]:re;let r=a.body,c=a.title,p=a.header,v=a.buttons;if("BODY"===M?r=null===(n=a.body)||void 0===n?void 0:n.map(((t,l)=>l===q?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t)):"TITLE"===M?c=null===(s=null==a?void 0:a.title)||void 0===s?void 0:s.map(((t,l)=>l===q?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t)):"HEADER"===M?p=null===(o=a.header)||void 0===o?void 0:o.map(((t,l)=>l===q?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t)):"BUTTONS"===M&&(v=null===(u=a.buttons)||void 0===u?void 0:u.map(((a,i)=>i===q?Object.assign(Object.assign({},a),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===a.type?e:[e],queryParams:null!=l?l:[]}):a))),null!=xe&&xe>-1){const e=i.cloneDeep(re.cards);e[xe]={header:p,body:r,buttons:v,title:c},null==be||be((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==be||be((e=>Object.assign(Object.assign({},e),{header:p,body:r,buttons:v,title:c})))}}function Ve(e,t,l,a){var n,s,o,u,d,r,c,p,v,m,b,g;if(null!=xe&&xe>-1&&ye){const s=Object.assign({},ce).components.map((l=>{var a;return isCarouselComponent(l.type)?Object.assign(Object.assign({},l),{cards:null===(a=l.cards)||void 0===a?void 0:a.map((l=>Object.assign(Object.assign({},l),{components:l.components.map((l=>{var a,i,n,s,o,u,d,r,c,p,v;if("BODY"===l.type&&"BODY"===M){if(null===(i=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===i?void 0:i[0]){const a=[...null!==(o=null===(s=null===(n=l.example)||void 0===n?void 0:n.body_text)||void 0===s?void 0:s[0])&&void 0!==o?o:[]];a[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const i=Object.assign(Object.assign({},l.example),{body_text:[a]});return Object.assign(Object.assign({},l),{example:i})}return l}if("TITLE"===l.type&&"TITLE"===M){if(null===(d=null===(u=l.example)||void 0===u?void 0:u.title_text)||void 0===d?void 0:d[0]){const a=[...null!==(p=null===(c=null===(r=l.example)||void 0===r?void 0:r.title_text)||void 0===c?void 0:c[0])&&void 0!==p?p:[]];a[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const i=Object.assign(Object.assign({},l.example),{title_text:[a]});return Object.assign(Object.assign({},l),{example:i})}return l}if("BUTTONS"===l.type&&"BUTTONS"===M){const a=null===(v=l.buttons)||void 0===v?void 0:v.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:[t]}):l));return a?Object.assign(Object.assign({},l),{buttons:a}):l}return l}))})))}):l})),o=i.cloneDeep(ce);if(l){const l=null===(n=Object.assign({},ce).mapping.cards)||void 0===n?void 0:n.map(((l,i)=>{var n,s,o,u;if("BODY"===M)return Object.assign(Object.assign({},l),{body:null===(n=l.body)||void 0===n?void 0:n.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))});if("TITLE"===M)return Object.assign(Object.assign({},l),{title:null===(s=null==l?void 0:l.title)||void 0===s?void 0:s.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))});if("BUTTONS"===M&&(null==l?void 0:l.buttons)){let n=-1,s=-1;return null===(o=ce.components[Pe].cards)||void 0===o||o[i].components.forEach((t=>{var l;"BUTTONS"===t.type&&(null===(l=t.buttons)||void 0===l||l.forEach(((t,l)=>{"URL"===t.type&&(n++,l===e&&"URL"==t.type&&(s=n))})))})),Object.assign(Object.assign({},l),{buttons:null===(u=l.buttons)||void 0===u?void 0:u.map(((e,l)=>l===s?"custom_link"===a?"((customPlaceholderName))":t:e))})}return l}));o.mapping.cards=l}return o.components=s,void(null==ve||ve(o))}const O=null!=xe&&xe>-1?{components:null===(s=Object.assign({},ce).components[Pe].cards)||void 0===s?void 0:s[xe].components,mapping:null===(o=Object.assign({},ce).mapping.cards)||void 0===o?void 0:o[xe]}:Object.assign({},ce),j=null===(u=null==O?void 0:O.components)||void 0===u?void 0:u.map((l=>{var a,i,n,s,o,u,d,r,c,p,v,m,b,g,O,j;const x=Object.assign({},l);if("BODY"===l.type&&"BODY"===M&&(Array.isArray(null===(a=l.example)||void 0===a?void 0:a.body_text)||(null===(n=null===(i=l.example)||void 0===i?void 0:i.body_text)||void 0===n?void 0:n[0]))){const l=[...null!==(u=null===(o=null===(s=x.example)||void 0===s?void 0:s.body_text)||void 0===o?void 0:o[0])&&void 0!==u?u:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},x.example),{body_text:[l]});return Object.assign(Object.assign({},x),{example:a})}if("TITLE"===l.type&&"TITLE"===M){if(Array.isArray(null===(d=l.example)||void 0===d?void 0:d.title_text)||(null===(c=null===(r=l.example)||void 0===r?void 0:r.title_text)||void 0===c?void 0:c[0])){const l=[...null!==(m=null===(v=null===(p=x.example)||void 0===p?void 0:p.title_text)||void 0===v?void 0:v[0])&&void 0!==m?m:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},x.example),{title_text:[l]});return Object.assign(Object.assign({},x),{example:a})}}else if("HEADER"===l.type&&"HEADER"===M){if(null===(b=l.example)||void 0===b?void 0:b.header_text){const l=[...null!==(O=null===(g=x.example)||void 0===g?void 0:g.header_text)&&void 0!==O?O:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},x.example),{header_text:l});return Object.assign(Object.assign({},x),{example:a})}}else{if("BUTTONS"===l.type&&"BUTTONS"===M){const a=null===(j=l.buttons)||void 0===j?void 0:j.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:"COPY_CODE"===l.type?t:[t]}):l));return a?Object.assign(Object.assign({},x),{buttons:a}):x}if("limited_time_offer"===l.type&&"limited_time_offer"===M)return Object.assign(Object.assign({},x),{example:Object.assign(Object.assign({},x.example),{limited_time_offer:t})})}return l}));if(O.components=j,l)if("BODY"===M&&(null===(d=null==O?void 0:O.mapping)||void 0===d?void 0:d.body))O.mapping=Object.assign(Object.assign({},O.mapping),{body:null===(c=null===(r=O.mapping)||void 0===r?void 0:r.body)||void 0===c?void 0:c.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))});else if("TITLE"===M&&(null===(p=null==O?void 0:O.mapping)||void 0===p?void 0:p.title))O.mapping=Object.assign(Object.assign({},O.mapping),{title:null===(m=null===(v=O.mapping)||void 0===v?void 0:v.title)||void 0===m?void 0:m.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))});else if("HEADER"===M&&(null===(b=null==O?void 0:O.mapping)||void 0===b?void 0:b.header))O.mapping=Object.assign(Object.assign({},O.mapping),{header:O.mapping.header.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+20}))`:t:l))});else if("BUTTONS"===M&&(null===(g=null==O?void 0:O.mapping)||void 0===g?void 0:g.buttons)){let l=-1,i=-1;j.forEach((t=>{var a;"BUTTONS"===t.type&&(null===(a=t.buttons)||void 0===a||a.forEach(((t,a)=>{"URL"===t.type&&(l++,a===e&&"URL"==t.type&&(i=l))})))})),O.mapping=Object.assign(Object.assign({},O.mapping),{buttons:O.mapping.buttons.map(((e,l)=>l===i?"custom_link"===a?"((customPlaceholderName))":t:e))})}if(null!=xe&&xe>-1&&ce){const e=i.cloneDeep(ce);e.components[Pe].cards[xe].components=O.components,e.mapping.cards[xe]=O.mapping,null==ve||ve(e)}else null==ve||ve(Object.assign({},O))}n.useEffect((()=>{Z&&(null==U||U())}),[Z]),n.useEffect((()=>{!function(){var e,t,l,a,i;const n="mobile"===oe?"template_html_mobile":"template_html_desktop",s=document.getElementById(n),o=(null!==(a=null===(l=null===(t=null===(e=null==s?void 0:s.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===l?void 0:l.innerHTML)&&void 0!==a?a:"")+(null===(i=null==s?void 0:s.contentWindow)||void 0===i?void 0:i.document.head.innerHTML);ue===m.CHANNEL_TYPE.EMAIL&&(null==me||me(o))}()}),[pe]),n.useEffect((()=>{!function(){var e,t;const l=[];let a=[];if(ue!==m.CHANNEL_TYPE.MESSAGE||Oe){"link"===(null==R?void 0:R.type)?(l.push({label:"",options:[L,A]}),ee(L)):"date_time"===(null==R?void 0:R.type)?(l.push({label:"",options:[L,A]}),ee(S)):(l.push({label:"",options:[L,A,S]}),ee(A));const e=null!=ge?ge:[];J([...l,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:j.default.toCapitilize(null===(l=null===(t=e.label)||void 0===t?void 0:t.replace(/([A-Z])/g," $1"))||void 0===l?void 0:l.toLowerCase())})}))]),a=[...l,...e]}else{const e=null!=ge?ge:[];J([{label:"",options:[A,L]},...e]),a=[{label:"",options:[A,L]},...e]}if((ue===m.CHANNEL_TYPE.WHATSAPP||ue===m.CHANNEL_TYPE.EMAIL||ue===m.CHANNEL_TYPE.MESSAGE||ue===m.CHANNEL_TYPE.WEBPUSH||ue===m.CHANNEL_TYPE.RCS)&&R.updatedValue)if(v.placeHolderNamePattern.test(R.updatedValue)&&(ue===m.CHANNEL_TYPE.WHATSAPP||ue===m.CHANNEL_TYPE.RCS)||R.updatedValue.startsWith("{{")&&ue!==m.CHANNEL_TYPE.WHATSAPP&&ue!==m.CHANNEL_TYPE.RCS){const e=function(e,t,l){var a;let i={label:"",value:""};const n=l===(m.CHANNEL_TYPE.WHATSAPP||m.CHANNEL_TYPE.RCS)?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");if(I){let t=e.updatedValue;if(je===g.POD.CHATBOT&&"BUTTONS"===M){const l=null==$?void 0:$.filter((t=>t.placeHolder===e.updatedValue));l&&l.length>0&&(t=l[0].label)}i={label:t?t.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}}else t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===n.trim()&&(i=e)}))}));return i}(R,a,ue);e.value&&ee(e)}else"date_time"===R.type?(ee(S),Q(R.updatedValue),Ve(null!==(e=R.index)&&void 0!==e?e:0,R.updatedValue)):(null===(t=R.updatedValue)||void 0===t?void 0:t.startsWith("https"))?(ee(L),Q(R.updatedValue.split("https://")[1])):(ee(A),Q(R.updatedValue))}()}),[xe]),n.useEffect((()=>{oe&&X&&G&&setTimeout((()=>{Se("custom_link"===(null==X?void 0:X.value)&&G?G.includes("https")?G:`https://${G}`:G,X.value)}),100)}),[oe]),n.useEffect((()=>{!te&&X&&R.updatedValue&&setTimeout((()=>{Se("custom_link"===(null==X?void 0:X.value)&&R.updatedValue?R.updatedValue.includes("https")?R.updatedValue:`https://${R.updatedValue}`:R.updatedValue,X.value),le(!0)}),100)}),[X]);const He=e=>{null==W||W(!1),"{{custom.url}}"===e.actualValue?Le({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?Le({label:e.displayName,selected:!0,value:"custom_text"}):"{{static.expiry}}"==e.actualValue?Le({label:e.displayName,selected:!0,value:"static_expiry"}):Le({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})};function ke(e,t){var l;const a=i.cloneDeep(ce),n=M.toLocaleLowerCase();(null===(l=a.webpushBroadcastConfig)||void 0===l?void 0:l[n])&&(a.webpushBroadcastConfig[n][e]=t),null==ve||ve(Object.assign({},a))}return e.jsxs(C,Object.assign({channel:ue,focused:Z,onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1)},{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(O.BodySecondary,Object.assign({style:{color:de&&!X?x.COLORS.content.negative:x.COLORS.content.primary}},{children:[null===(h=R.variableName)||void 0===h?void 0:h.replace("{{","").replace("}}","")," ","link"===(null==R?void 0:R.type)?"link":"variable"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:I?e.jsxs("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==X?void 0:X.label)?"space-between":"flex-end",backgroundColor:"date_time"===(null==R?void 0:R.type)&&_e?x.COLORS.background.base:void 0}},{children:[e.jsx(O.BodyPrimary,Object.assign({numberOfLines:1},{children:je===g.POD.CHATBOT?["static_expiry","custom_text","custom_link"].includes(null!==(f=null==X?void 0:X.value)&&void 0!==f?f:"")?null==X?void 0:X.label:null==X?void 0:X.value:p.truncate(null!==(V=null==X?void 0:X.label)&&void 0!==V?V:"",20,!0)})),Te||"date_time"===(null==R?void 0:R.type)&&_e?e.jsx(e.Fragment,{}):e.jsx(t.default,{onClick:()=>{(()=>{if(z===g.BUTTON_TYPE.URL&&je===g.POD.CHATBOT){const e=E.updateVariables({variableList:ae,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom URL",variableValue:"{{custom.url}}"});ie(e)}else if("limited_time_offer"===M){const e=E.updateVariables({variableList:ae,categoryDisplayName:"Static Variables",variableDisplayName:"Static Expiry",variableValue:"{{static.expiry}}"});ie(e)}else if(z===g.BUTTON_TYPE.COPY_CODE){const e=E.updateVariables({variableList:ae,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom Text",variableValue:"{{custom.text}}"});ie(e)}})(),ne((()=>He)),se(!0)},width:24,height:24,color:x.COLORS.content.primary})]})):e.jsx(r.Dropdown,{disabled:Te,options:K,isSearchable:!1,onSelect:Le,defaultOptions:X?[Object.assign(Object.assign({},X),{selected:!0})]:[]})})),("custom_text"===(null==X?void 0:X.value)||"custom_link"===(null==X?void 0:X.value))&&e.jsx(c.Input,{state:Te?"disabled":"none",labelText:"custom_text"===(null==X?void 0:X.value)?"Custom text value":"custom_link"===(null==X?void 0:X.value)?"Custom URL value":"",id:`variable-value-${null==X?void 0:X.value}-${q}`,value:G,errorMessage:de&&(null===(H=null==he?void 0:he.buttons)||void 0===H?void 0:H.includes(null!==(k=null==R?void 0:R.index)&&void 0!==k?k:-1))?G&&0!==G.trim().length?"custom_link"!==X.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${G.trim()}`)&&0!==G.trim().length?"custom_link"!==X.value&&G.length>30?"Length cannot be more than 30":"BUTTONS"===M&&"custom_link"!==X.value?"Enter valid alpha numeric code":"":"Enter valid URL":"Required field":"",maxCharLimit:fe||("custom_link"===(null==X?void 0:X.value)?2e3:"BUTTONS"===M?15:30),noKeyDownChange:!0,prefixText:"custom_link"===(null==X?void 0:X.value)?"https://":"",placeholder:"link"===R.type||"custom_link"===X.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{Ae(X.value,e)}}),"static_expiry"===(null==X?void 0:X.value)&&e.jsxs("div",Object.assign({style:{position:"relative"}},{children:[(Te||Ce)&&e.jsxs(N,Object.assign({onClick:e=>e.preventDefault(),style:{display:"flex",justifyContent:"space-between"}},{children:[e.jsx(P,{}),e.jsx(P,{})]})),e.jsx(d.CustomDateTime,{placement:"auto",time:G?a.format(new Date(G),"hh:mm a"):a.format(new Date,"hh:mm a"),date:G?new Date(G):new Date,minDate:new Date,error:"",setError:()=>{},onChange:e=>{Ae("static_expiry",e.toISOString())}})]})),"static_expiry"===(null==X?void 0:X.value)&&Ne&&e.jsx("div",Object.assign({style:{marginTop:8}},{children:e.jsx(o.Alert,{containerStyle:{padding:"4px 8px"},icon:()=>e.jsx(l.default,{width:16,height:16,color:x.COLORS.content.secondary}),type:u.ALERT_TYPES.NEUTRAL,text:"Please use the same expiration code that you applied when creating\nthe code on Shopify"})})),"link"===R.type&&"custom_link"!==(null==X?void 0:X.value)&&!ye&&!Ee&&je===g.POD.CHATBOT&&e.jsx(_.QueryParamsComponent,{isError:null!==(Y=null===(D=null==he?void 0:he.buttons)||void 0===D?void 0:D.includes(null!==(B=null==R?void 0:R.index)&&void 0!==B?B:-1))&&void 0!==Y&&Y,params:null!==(w=R.queryParams)&&void 0!==w?w:[],onChange:e=>{Se(R.updatedValue,"link",e)},variableValue:R.updatedValue})]}))};
19
+ `,L={value:"custom_link",label:"Custom URL"},A={value:"custom_text",label:"Custom text"},S={value:"static_expiry",label:"Static Expiry"};exports.Container=C,exports.default=s=>{var h,f,V,H,k,D,B,Y,w;const{onFocus:U,variable:R,index:q,showVariableModal:I,setShowDiscountCheckBox:W,componentType:M,CTAoptions:$,buttonType:z}=s,[Z,F]=n.useState(!1),[G,Q]=n.useState(""),[K,J]=n.useState([]),[X,ee]=n.useState(),[te,le]=n.useState(!1),{variableList:ae,setVariableList:ie,setVariableCallback:ne,setShowVariablePicker:se,device:oe,channel:ue,isError:de,originalVariableList:re,template:ce,templateSelectionTriggered:pe,setTemplate:ve,setDisplayContent:me,setOriginalVariableList:be,globalNormalizedPlaceholders:ge,enabledCustomText:Oe,pod:je,selectedCarouselIndex:xe,isProductCarouselType:Ee,isWhatsappCarousel:ye,disableEditVariable:Te,disableEditExpiry:_e,templateErrorIndexes:he,maxCharLimit:fe,disableDatePicker:Ce,showDiscountCodeExpiryInfo:Ne,cardIndex:Pe=1}=E.useTemplateModalContext();function Le(e,t){var l,a,i,n;const s=e;Q(""),ee(s),ue===m.CHANNEL_TYPE.WHATSAPP||ue===m.CHANNEL_TYPE.RCS?"custom_text"!==s.value&&"custom_link"!==s.value&&"static_expiry"!==s.value?(Se(null!==(l=s.value)&&void 0!==l?l:"","string"),null==Ve||Ve(null!==(a=R.index)&&void 0!==a?a:0,s.value,!0)):(null==Ve||Ve(null!==(i=R.index)&&void 0!==i?i:0,"",!0,s.value),Se("","url"===s.bikPlaceholderType?"link":"string")):"custom_text"!==s.value&&"custom_link"!==s.value?(Se(s.value,"url"===s.bikPlaceholderType?"link":"string"),ue==m.CHANNEL_TYPE.WEBPUSH&&(null==ke||ke(null!==(n=R.index)&&void 0!==n?n:0,s.value))):(Q(""),Se("",s.value))}function Ae(e,t){var l,a;Q(t);const i="custom_link"===(null==X?void 0:X.value)&&t?t.includes("https")?t:`https://${t}`:t;Se(i,"static_expiry"===e?"string":e),ue!==m.CHANNEL_TYPE.WHATSAPP&&ue!==m.CHANNEL_TYPE.RCS||null==Ve||Ve(null!==(l=R.index)&&void 0!==l?l:0,i,"custom_link"===e,e),ue===m.CHANNEL_TYPE.WEBPUSH&&(null==ke||ke(null!==(a=R.index)&&void 0!==a?a:0,i))}function Se(e,t,l){var a,n,s,o,u;const d="custom_link"===t?"link":"custom_text"===t?"string":t;if(ue!==m.CHANNEL_TYPE.WHATSAPP&&ue!==m.CHANNEL_TYPE.WEBPUSH&&ue!==m.CHANNEL_TYPE.RCS){const l=T.getVariableNameForEmailByIndex(q+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===oe?"template_html_mobile":"template_html_desktop"),n=ue===m.CHANNEL_TYPE.EMAIL?null===(a=null==i?void 0:i.contentWindow)||void 0===a?void 0:a.document.getElementById(l):document.getElementById(l);n&&(n.textContent="custom_text"!==t&&"custom_link"!==t||e?e:R.variableName);const s=re.map(((t,l)=>l===q?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t));null==be||be(s)}if(ue===m.CHANNEL_TYPE.WEBPUSH){const t=re,l=t=>null==t?void 0:t.map(((t,l)=>l===q?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t)),a={BODY:"BODY"===M?l(t.body):t.body,TITLE:M===b.WEB_PUSH_COMPONENT_TYPE.TITLE.toUpperCase()?l(t.title):t.title};null==be||be((e=>Object.assign(Object.assign({},e),{title:a.TITLE,body:a.BODY,buttons:t.buttons})))}if(ue===m.CHANNEL_TYPE.WHATSAPP||ue===m.CHANNEL_TYPE.RCS){if(null!=xe&&xe>-1&&Ee){const l=Object.assign({},re).cards.map(((l,a)=>{var i,n,s;return"BODY"===M?Object.assign(Object.assign({},l),{body:null===(i=l.body)||void 0===i?void 0:i.map(((t,l)=>q===l?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t))}):"TITLE"===M?Object.assign(Object.assign({},l),{title:null===(n=l.title)||void 0===n?void 0:n.map(((t,l)=>q===l?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t))}):"BUTTONS"===M?Object.assign(Object.assign({},l),{buttons:null===(s=l.buttons)||void 0===s?void 0:s.map(((l,a)=>a===q?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))}):l}));return void(null==be||be((e=>Object.assign(Object.assign({},e),{cards:l}))))}const a=null!=xe&&xe>-1?re.cards[xe]:re;let r=a.body,c=a.title,p=a.header,v=a.buttons;if("BODY"===M?r=null===(n=a.body)||void 0===n?void 0:n.map(((t,l)=>l===q?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t)):"TITLE"===M?c=null===(s=null==a?void 0:a.title)||void 0===s?void 0:s.map(((t,l)=>l===q?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t)):"HEADER"===M?p=null===(o=a.header)||void 0===o?void 0:o.map(((t,l)=>l===q?Object.assign(Object.assign({},t),{type:d,updatedValue:e}):t)):"BUTTONS"===M&&(v=null===(u=a.buttons)||void 0===u?void 0:u.map(((a,i)=>i===q?Object.assign(Object.assign({},a),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===a.type?e:[e],queryParams:null!=l?l:[]}):a))),null!=xe&&xe>-1){const e=i.cloneDeep(re.cards);e[xe]={header:p,body:r,buttons:v,title:c},null==be||be((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==be||be((e=>Object.assign(Object.assign({},e),{header:p,body:r,buttons:v,title:c})))}}function Ve(e,t,l,a){var n,s,o,u,d,r,c,p,v,m,b,g;if(null!=xe&&xe>-1&&Ee){const s=Object.assign({},ce).components.map((l=>{var a;return isCarouselComponent(l.type)?Object.assign(Object.assign({},l),{cards:null===(a=l.cards)||void 0===a?void 0:a.map((l=>Object.assign(Object.assign({},l),{components:l.components.map((l=>{var a,i,n,s,o,u,d,r,c,p,v;if("BODY"===l.type&&"BODY"===M){if(null===(i=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===i?void 0:i[0]){const a=[...null!==(o=null===(s=null===(n=l.example)||void 0===n?void 0:n.body_text)||void 0===s?void 0:s[0])&&void 0!==o?o:[]];a[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const i=Object.assign(Object.assign({},l.example),{body_text:[a]});return Object.assign(Object.assign({},l),{example:i})}return l}if("TITLE"===l.type&&"TITLE"===M){if(null===(d=null===(u=l.example)||void 0===u?void 0:u.title_text)||void 0===d?void 0:d[0]){const a=[...null!==(p=null===(c=null===(r=l.example)||void 0===r?void 0:r.title_text)||void 0===c?void 0:c[0])&&void 0!==p?p:[]];a[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const i=Object.assign(Object.assign({},l.example),{title_text:[a]});return Object.assign(Object.assign({},l),{example:i})}return l}if("BUTTONS"===l.type&&"BUTTONS"===M){const a=null===(v=l.buttons)||void 0===v?void 0:v.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:[t]}):l));return a?Object.assign(Object.assign({},l),{buttons:a}):l}return l}))})))}):l})),o=i.cloneDeep(ce);if(l){const l=null===(n=Object.assign({},ce).mapping.cards)||void 0===n?void 0:n.map(((l,i)=>{var n,s,o,u;if("BODY"===M)return Object.assign(Object.assign({},l),{body:null===(n=l.body)||void 0===n?void 0:n.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))});if("TITLE"===M)return Object.assign(Object.assign({},l),{title:null===(s=null==l?void 0:l.title)||void 0===s?void 0:s.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))});if("BUTTONS"===M&&(null==l?void 0:l.buttons)){let n=-1,s=-1;return null===(o=ce.components[Pe].cards)||void 0===o||o[i].components.forEach((t=>{var l;"BUTTONS"===t.type&&(null===(l=t.buttons)||void 0===l||l.forEach(((t,l)=>{"URL"===t.type&&(n++,l===e&&"URL"==t.type&&(s=n))})))})),Object.assign(Object.assign({},l),{buttons:null===(u=l.buttons)||void 0===u?void 0:u.map(((e,l)=>l===s?"custom_link"===a?"((customPlaceholderName))":t:e))})}return l}));o.mapping.cards=l}return o.components=s,void(null==ve||ve(o))}const O=null!=xe&&xe>-1?{components:null===(s=Object.assign({},ce).components[Pe].cards)||void 0===s?void 0:s[xe].components,mapping:null===(o=Object.assign({},ce).mapping.cards)||void 0===o?void 0:o[xe]}:Object.assign({},ce),j=null===(u=null==O?void 0:O.components)||void 0===u?void 0:u.map((l=>{var a,i,n,s,o,u,d,r,c,p,v,m,b,g,O,j;const x=Object.assign({},l);if("BODY"===l.type&&"BODY"===M&&(Array.isArray(null===(a=l.example)||void 0===a?void 0:a.body_text)||(null===(n=null===(i=l.example)||void 0===i?void 0:i.body_text)||void 0===n?void 0:n[0]))){const l=[...null!==(u=null===(o=null===(s=x.example)||void 0===s?void 0:s.body_text)||void 0===o?void 0:o[0])&&void 0!==u?u:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},x.example),{body_text:[l]});return Object.assign(Object.assign({},x),{example:a})}if("TITLE"===l.type&&"TITLE"===M){if(Array.isArray(null===(d=l.example)||void 0===d?void 0:d.title_text)||(null===(c=null===(r=l.example)||void 0===r?void 0:r.title_text)||void 0===c?void 0:c[0])){const l=[...null!==(m=null===(v=null===(p=x.example)||void 0===p?void 0:p.title_text)||void 0===v?void 0:v[0])&&void 0!==m?m:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},x.example),{title_text:[l]});return Object.assign(Object.assign({},x),{example:a})}}else if("HEADER"===l.type&&"HEADER"===M){if(null===(b=l.example)||void 0===b?void 0:b.header_text){const l=[...null!==(O=null===(g=x.example)||void 0===g?void 0:g.header_text)&&void 0!==O?O:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},x.example),{header_text:l});return Object.assign(Object.assign({},x),{example:a})}}else{if("BUTTONS"===l.type&&"BUTTONS"===M){const a=null===(j=l.buttons)||void 0===j?void 0:j.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:"COPY_CODE"===l.type?t:[t]}):l));return a?Object.assign(Object.assign({},x),{buttons:a}):x}if("limited_time_offer"===l.type&&"limited_time_offer"===M)return Object.assign(Object.assign({},x),{example:Object.assign(Object.assign({},x.example),{limited_time_offer:t})})}return l}));if(O.components=j,l)if("BODY"===M&&(null===(d=null==O?void 0:O.mapping)||void 0===d?void 0:d.body))O.mapping=Object.assign(Object.assign({},O.mapping),{body:null===(c=null===(r=O.mapping)||void 0===r?void 0:r.body)||void 0===c?void 0:c.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))});else if("TITLE"===M&&(null===(p=null==O?void 0:O.mapping)||void 0===p?void 0:p.title))O.mapping=Object.assign(Object.assign({},O.mapping),{title:null===(m=null===(v=O.mapping)||void 0===v?void 0:v.title)||void 0===m?void 0:m.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))});else if("HEADER"===M&&(null===(b=null==O?void 0:O.mapping)||void 0===b?void 0:b.header))O.mapping=Object.assign(Object.assign({},O.mapping),{header:O.mapping.header.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+20}))`:t:l))});else if("BUTTONS"===M&&(null===(g=null==O?void 0:O.mapping)||void 0===g?void 0:g.buttons)){let l=-1,i=-1;j.forEach((t=>{var a;"BUTTONS"===t.type&&(null===(a=t.buttons)||void 0===a||a.forEach(((t,a)=>{"URL"===t.type&&(l++,a===e&&"URL"==t.type&&(i=l))})))})),O.mapping=Object.assign(Object.assign({},O.mapping),{buttons:O.mapping.buttons.map(((e,l)=>l===i?"custom_link"===a?"((customPlaceholderName))":t:e))})}if(null!=xe&&xe>-1&&ce){const e=i.cloneDeep(ce);e.components[Pe].cards[xe].components=O.components,e.mapping.cards[xe]=O.mapping,null==ve||ve(e)}else null==ve||ve(Object.assign({},O))}n.useEffect((()=>{Z&&(null==U||U())}),[Z]),n.useEffect((()=>{!function(){var e,t,l,a,i;const n="mobile"===oe?"template_html_mobile":"template_html_desktop",s=document.getElementById(n),o=(null!==(a=null===(l=null===(t=null===(e=null==s?void 0:s.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===l?void 0:l.innerHTML)&&void 0!==a?a:"")+(null===(i=null==s?void 0:s.contentWindow)||void 0===i?void 0:i.document.head.innerHTML);ue===m.CHANNEL_TYPE.EMAIL&&(null==me||me(o))}()}),[pe]),n.useEffect((()=>{!function(){var e,t;const l=[];let a=[];if(ue!==m.CHANNEL_TYPE.MESSAGE||Oe){"link"===(null==R?void 0:R.type)?(l.push({label:"",options:[L,A]}),ee(L)):"date_time"===(null==R?void 0:R.type)?(l.push({label:"",options:[L,A]}),ee(S)):(l.push({label:"",options:[L,A,S]}),ee(A));const e=null!=ge?ge:[];J([...l,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:j.default.toCapitilize(null===(l=null===(t=e.label)||void 0===t?void 0:t.replace(/([A-Z])/g," $1"))||void 0===l?void 0:l.toLowerCase())})}))]),a=[...l,...e]}else{const e=null!=ge?ge:[];J([{label:"",options:[A,L]},...e]),a=[{label:"",options:[A,L]},...e]}if((ue===m.CHANNEL_TYPE.WHATSAPP||ue===m.CHANNEL_TYPE.EMAIL||ue===m.CHANNEL_TYPE.MESSAGE||ue===m.CHANNEL_TYPE.WEBPUSH||ue===m.CHANNEL_TYPE.RCS)&&R.updatedValue)if(v.placeHolderNamePattern.test(R.updatedValue)&&(ue===m.CHANNEL_TYPE.WHATSAPP||ue===m.CHANNEL_TYPE.RCS)||R.updatedValue.startsWith("{{")&&ue!==m.CHANNEL_TYPE.WHATSAPP&&ue!==m.CHANNEL_TYPE.RCS){const e=function(e,t,l){var a;let i={label:"",value:""};const n=l===(m.CHANNEL_TYPE.WHATSAPP||m.CHANNEL_TYPE.RCS)?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");if(I){let t=e.updatedValue;if(je===g.POD.CHATBOT&&"BUTTONS"===M){const l=null==$?void 0:$.filter((t=>t.placeHolder===e.updatedValue));l&&l.length>0&&(t=l[0].label)}i={label:t?t.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}}else t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===n.trim()&&(i=e)}))}));return i}(R,a,ue);e.value&&ee(e)}else"date_time"===R.type?(ee(S),Q(R.updatedValue),Ve(null!==(e=R.index)&&void 0!==e?e:0,R.updatedValue)):(null===(t=R.updatedValue)||void 0===t?void 0:t.startsWith("https"))?(ee(L),Q(R.updatedValue.split("https://")[1])):(ee(A),Q(R.updatedValue))}()}),[xe]),n.useEffect((()=>{oe&&X&&G&&setTimeout((()=>{Se("custom_link"===(null==X?void 0:X.value)&&G?G.includes("https")?G:`https://${G}`:G,X.value)}),100)}),[oe]),n.useEffect((()=>{!te&&X&&R.updatedValue&&setTimeout((()=>{Se("custom_link"===(null==X?void 0:X.value)&&R.updatedValue?R.updatedValue.includes("https")?R.updatedValue:`https://${R.updatedValue}`:R.updatedValue,X.value),le(!0)}),100)}),[X]);const He=e=>{null==W||W(!1),"{{custom.url}}"===e.actualValue?Le({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?Le({label:e.displayName,selected:!0,value:"custom_text"}):"{{static.expiry}}"==e.actualValue?Le({label:e.displayName,selected:!0,value:"static_expiry"}):Le({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})};function ke(e,t){var l;const a=i.cloneDeep(ce),n=M.toLocaleLowerCase();(null===(l=a.webpushBroadcastConfig)||void 0===l?void 0:l[n])&&(a.webpushBroadcastConfig[n][e]=t),null==ve||ve(Object.assign({},a))}return e.jsxs(C,Object.assign({channel:ue,focused:Z,onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1)},{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(O.BodySecondary,Object.assign({style:{color:de&&!X?x.COLORS.content.negative:x.COLORS.content.primary}},{children:[null===(h=R.variableName)||void 0===h?void 0:h.replace("{{","").replace("}}","")," ","link"===(null==R?void 0:R.type)?"link":"variable"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:I?e.jsxs("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==X?void 0:X.label)?"space-between":"flex-end"}},{children:[e.jsx(O.BodyPrimary,Object.assign({numberOfLines:1},{children:je===g.POD.CHATBOT?["static_expiry","custom_text","custom_link"].includes(null!==(f=null==X?void 0:X.value)&&void 0!==f?f:"")?null==X?void 0:X.label:null==X?void 0:X.value:p.truncate(null!==(V=null==X?void 0:X.label)&&void 0!==V?V:"",20,!0)})),Te||"date_time"===(null==R?void 0:R.type)&&_e?e.jsx(e.Fragment,{}):e.jsx(t.default,{onClick:()=>{(()=>{if(z===g.BUTTON_TYPE.URL&&je===g.POD.CHATBOT){const e=y.updateVariables({variableList:ae,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom URL",variableValue:"{{custom.url}}"});ie(e)}else if("limited_time_offer"===M){const e=y.updateVariables({variableList:ae,categoryDisplayName:"Static Variables",variableDisplayName:"Static Expiry",variableValue:"{{static.expiry}}"});ie(e)}else if(z===g.BUTTON_TYPE.COPY_CODE){const e=y.updateVariables({variableList:ae,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom Text",variableValue:"{{custom.text}}"});ie(e)}})(),ne((()=>He)),se(!0)},width:24,height:24,color:x.COLORS.content.primary})]})):e.jsx(r.Dropdown,{disabled:Te,options:K,isSearchable:!1,onSelect:Le,defaultOptions:X?[Object.assign(Object.assign({},X),{selected:!0})]:[]})})),("custom_text"===(null==X?void 0:X.value)||"custom_link"===(null==X?void 0:X.value))&&e.jsx(c.Input,{state:Te?"disabled":"none",labelText:"custom_text"===(null==X?void 0:X.value)?"Custom text value":"custom_link"===(null==X?void 0:X.value)?"Custom URL value":"",id:`variable-value-${null==X?void 0:X.value}-${q}`,value:G,errorMessage:de&&(null===(H=null==he?void 0:he.buttons)||void 0===H?void 0:H.includes(null!==(k=null==R?void 0:R.index)&&void 0!==k?k:-1))?G&&0!==G.trim().length?"custom_link"!==X.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${G.trim()}`)&&0!==G.trim().length?"custom_link"!==X.value&&G.length>30?"Length cannot be more than 30":"BUTTONS"===M&&"custom_link"!==X.value?"Enter valid alpha numeric code":"":"Enter valid URL":"Required field":"",maxCharLimit:fe||("custom_link"===(null==X?void 0:X.value)?2e3:"BUTTONS"===M?15:30),noKeyDownChange:!0,prefixText:"custom_link"===(null==X?void 0:X.value)?"https://":"",placeholder:"link"===R.type||"custom_link"===X.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{Ae(X.value,e)}}),"static_expiry"===(null==X?void 0:X.value)&&e.jsxs("div",Object.assign({style:{position:"relative"}},{children:[(Te||Ce)&&e.jsxs(N,Object.assign({onClick:e=>e.preventDefault(),style:{display:"flex",justifyContent:"space-between"}},{children:[e.jsx(P,{}),e.jsx(P,{})]})),e.jsx(d.CustomDateTime,{placement:"auto",time:G?a.format(new Date(G),"hh:mm a"):a.format(new Date,"hh:mm a"),date:G?new Date(G):new Date,minDate:new Date,error:"",setError:()=>{},onChange:e=>{Ae("static_expiry",e.toISOString())}})]})),"static_expiry"===(null==X?void 0:X.value)&&Ne&&e.jsx("div",Object.assign({style:{marginTop:8}},{children:e.jsx(o.Alert,{containerStyle:{padding:"4px 8px"},icon:()=>e.jsx(l.default,{width:16,height:16,color:x.COLORS.content.secondary}),type:u.ALERT_TYPES.NEUTRAL,text:"Please use the same expiration code that you applied when creating \nthe code on Shopify"})})),"link"===R.type&&"custom_link"!==(null==X?void 0:X.value)&&!Ee&&!ye&&je===g.POD.CHATBOT&&e.jsx(_.QueryParamsComponent,{isError:null!==(Y=null===(D=null==he?void 0:he.buttons)||void 0===D?void 0:D.includes(null!==(B=null==R?void 0:R.index)&&void 0!==B?B:-1))&&void 0!==Y&&Y,params:null!==(w=R.queryParams)&&void 0!==w?w:[],onChange:e=>{Se(R.updatedValue,"link",e)},variableValue:R.updatedValue})]}))};
@@ -4,10 +4,10 @@ export interface UnsatisfactoryCountIntentWiseProps {
4
4
  showUnsatisfactoryResponseModal: boolean;
5
5
  setShowUnsatisfactoryResponseModal: (value: boolean) => void;
6
6
  ChecklistType: Record<string, string>;
7
- UnsatisfactoryResponseIntentList?: string[];
8
- IntentHeaderTitle?: Record<string, string>;
9
- viewIntentWiseUnsatisfactoryResponse?: (intent: string) => void;
10
- fetchUnsatisfactoryResponseCountIntentWise?: () => Promise<{
7
+ UnsatisfactoryResponseIntentList: string[];
8
+ IntentHeaderTitle: Record<string, string>;
9
+ viewIntentWiseUnsatisfactoryResponse: (intent: string) => void;
10
+ fetchUnsatisfactoryResponseCountIntentWise: () => Promise<{
11
11
  [keys in string]?: number;
12
12
  }>;
13
13
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("../../constants/Theme.js"),i=require("../button/Button.js"),n=require("../modals/styledModal.js"),a=require("../shimmer/ShimmerComponent/BikShimmer.js"),l=require("../TypographyStyle.js"),r=require("./UnsatisfactoryCountIntentWiseModal.style.js");exports.UnsatisfactoryCountIntentWiseModal=c=>{const{storeId:o,setShowUnsatisfactoryResponseModal:d,showUnsatisfactoryResponseModal:j,ChecklistType:h,UnsatisfactoryResponseIntentList:m,viewIntentWiseUnsatisfactoryResponse:b,IntentHeaderTitle:x,fetchUnsatisfactoryResponseCountIntentWise:y}=c,[O,p]=s.useState(),[g,u]=s.useState(!1);return s.useEffect((()=>{o&&y&&(u(!0),y().then((e=>{p(e),u(!1)})))}),[o]),e.jsx(n.StyledModal,Object.assign({onClose:()=>d(!1),open:j,headingTitle:"Improve unsatisfactory response"},{children:e.jsxs(r.ModalBody,{children:[e.jsx("div",{children:e.jsx(l.BodyPrimary,Object.assign({style:{color:t.COLORS.content.primary}},{children:"Intent wise distribution of unsatisfactory response"}))}),e.jsxs("div",Object.assign({className:"modal-table"},{children:[e.jsxs("div",Object.assign({className:"table-row header"},{children:[e.jsx("div",Object.assign({className:"table-cell"},{children:e.jsx(l.TitleSmall,Object.assign({style:{color:t.COLORS.content.primary}},{children:"Intent"}))})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(l.TitleSmall,Object.assign({style:{color:t.COLORS.content.primary}},{children:"Unsatisfactory response"}))})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(l.TitleSmall,Object.assign({style:{color:t.COLORS.content.primary}},{children:"Action"}))}))]})),g&&[0,1,2,3,4,5,6].map((s=>e.jsxs("div",Object.assign({className:"table-row"},{children:[e.jsx("div",Object.assign({className:"table-cell"},{children:e.jsx(a.BikShimmer,{boxes:[{width:"196px",height:"20px"}]})})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(a.BikShimmer,{boxes:[{width:"176px",height:"20px"}]})})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(a.BikShimmer,{boxes:[{width:"56px",height:"20px"}]})}))]}),s))),!g&&m&&x&&b&&m.map((s=>e.jsxs("div",Object.assign({className:"table-row"},{children:[e.jsx("div",Object.assign({className:"table-cell"},{children:e.jsx(l.BodySecondary,Object.assign({style:{color:t.COLORS.content.primary}},{children:x[s]}))})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(l.BodySecondary,Object.assign({style:{color:t.COLORS.content.primary}},{children:(null==O?void 0:O[s])||"--"}))})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(i.Button,{buttonText:"Fix",buttonType:"tertiary",size:"small",onClick:()=>b(s),disabled:!(null==O?void 0:O[s])})}))]}),s)))]}))]})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("../../constants/Theme.js"),i=require("../button/Button.js"),n=require("../modals/styledModal.js"),a=require("../shimmer/ShimmerComponent/BikShimmer.js"),l=require("../TypographyStyle.js"),r=require("./UnsatisfactoryCountIntentWiseModal.style.js");exports.UnsatisfactoryCountIntentWiseModal=c=>{const{storeId:o,setShowUnsatisfactoryResponseModal:d,showUnsatisfactoryResponseModal:j,ChecklistType:h,UnsatisfactoryResponseIntentList:m,viewIntentWiseUnsatisfactoryResponse:b,IntentHeaderTitle:x,fetchUnsatisfactoryResponseCountIntentWise:y}=c,[O,p]=s.useState(),[g,u]=s.useState(!1);return s.useEffect((()=>{o&&(u(!0),y().then((e=>{p(e),u(!1)})))}),[o]),e.jsx(n.StyledModal,Object.assign({onClose:()=>d(!1),open:j,headingTitle:"Improve unsatisfactory response"},{children:e.jsxs(r.ModalBody,{children:[e.jsx("div",{children:e.jsx(l.BodyPrimary,Object.assign({style:{color:t.COLORS.content.primary}},{children:"Intent wise distribution of unsatisfactory response"}))}),e.jsxs("div",Object.assign({className:"modal-table"},{children:[e.jsxs("div",Object.assign({className:"table-row header"},{children:[e.jsx("div",Object.assign({className:"table-cell"},{children:e.jsx(l.TitleSmall,Object.assign({style:{color:t.COLORS.content.primary}},{children:"Intent"}))})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(l.TitleSmall,Object.assign({style:{color:t.COLORS.content.primary}},{children:"Unsatisfactory response"}))})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(l.TitleSmall,Object.assign({style:{color:t.COLORS.content.primary}},{children:"Action"}))}))]})),g&&[0,1,2,3,4,5,6].map((s=>e.jsxs("div",Object.assign({className:"table-row"},{children:[e.jsx("div",Object.assign({className:"table-cell"},{children:e.jsx(a.BikShimmer,{boxes:[{width:"196px",height:"20px"}]})})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(a.BikShimmer,{boxes:[{width:"176px",height:"20px"}]})})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(a.BikShimmer,{boxes:[{width:"56px",height:"20px"}]})}))]}),s))),!g&&m.map((s=>e.jsxs("div",Object.assign({className:"table-row"},{children:[e.jsx("div",Object.assign({className:"table-cell"},{children:e.jsx(l.BodySecondary,Object.assign({style:{color:t.COLORS.content.primary}},{children:x[s]}))})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(l.BodySecondary,Object.assign({style:{color:t.COLORS.content.primary}},{children:(null==O?void 0:O[s])||"--"}))})),e.jsx("div",Object.assign({className:"table-cell center-align"},{children:e.jsx(i.Button,{buttonText:"Fix",buttonType:"tertiary",size:"small",onClick:()=>b(s),disabled:!(null==O?void 0:O[s])})}))]}),s)))]}))]})}))};
@@ -1,18 +1,16 @@
1
1
  import React from 'react';
2
- import { AppType } from '../data-source-panel/model';
3
2
  export interface UnsatisfactoryResponseListProps {
4
3
  storeId?: string;
5
- appType: AppType;
6
4
  incorrectMessages: any;
7
5
  onIncorrectMessageBubbleClick: (messageId: string) => void;
8
6
  setShowIncorrectReplies: (show: boolean) => void;
9
7
  ChecklistType: Record<string, string>;
10
- IntentHeaderTitle?: Record<string, string>;
11
- IntentWiseUnsatisfactoryResponse?: string[];
12
- redirectToUnsatisfactoryResponse?: (intent: string) => void;
13
- fetchUnsatisfactoryResponseCountIntentWise?: () => Promise<{
8
+ IntentHeaderTitle: Record<string, string>;
9
+ IntentWiseUnsatisfactoryResponse: string[];
10
+ redirectToUnsatisfactoryResponse: (intent: string) => void;
11
+ fetchUnsatisfactoryResponseCountIntentWise: () => Promise<{
14
12
  [keys in string]?: number;
15
13
  }>;
16
- fetchUnsatisfactoryResponseCount?: () => Promise<number>;
14
+ fetchUnsatisfactoryResponseCount: () => Promise<number>;
17
15
  }
18
16
  export declare const UnsatisfactoryResponseList: React.FC<UnsatisfactoryResponseListProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/cross.svg.js"),t=require("../../assets/icons/info.svg.js"),n=require("date-fns"),r=require("react"),i=require("../../constants/Theme.js"),a=require("../avatar/Avatar.js"),o=require("../avatar/AvatarHelper.js"),l=require("../button/Button.js"),c=require("../data-source-panel/model.js"),d=require("../states/StateComponent.js");require("../../_virtual/_tslib.js");var u=require("../TypographyStyle.js"),y=require("./UnsatisfactoryCountIntentWiseModal.js"),p=require("./UnsatisfactoryResponseList.style.js");exports.UnsatisfactoryResponseList=h=>{const{storeId:j,appType:f,incorrectMessages:g,onIncorrectMessageBubbleClick:v,setShowIncorrectReplies:x,ChecklistType:I,IntentWiseUnsatisfactoryResponse:b,IntentHeaderTitle:C,redirectToUnsatisfactoryResponse:O,fetchUnsatisfactoryResponseCountIntentWise:S,fetchUnsatisfactoryResponseCount:m}=h,[R,T]=r.useState(""),[A,w]=r.useState((null==g?void 0:g.length)>0),[U,q]=r.useState(!1);return r.useEffect((()=>{!A&&m&&m().then((e=>{e>0&&w(!0),0===e&&x(!1)}))}),[]),e.jsx("div",Object.assign({style:{overflow:"scroll",height:"100%"}},{children:e.jsxs(p.IncorrectRepliesStyle,{children:[f==c.AppType.MANIFEST&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx(u.TitleRegular,{children:"Unsatisfactory responses"}),e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>x(!1)},{children:e.jsx(s.default,{height:16,width:16,color:i.COLORS.content.primary})}))]})),e.jsx(u.BodySecondary,Object.assign({style:{color:i.COLORS.content.secondary}},{children:"Spot unsatisfactory replies, dive deeper, and enhance with relevant data for improved responses."}))]})),!(null==g?void 0:g.length)&&e.jsx("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:e.jsx(d.StateComponent,{states:d.StateInterface.WARNING,heading:"No unsatisfactory responses",subline:"As of now, all responses are correct",isButtonEnabled:!1,width:0,size:o.SIZE.SMALL,icon:e.jsx(a.Avatar,{type:o.AVATAR_TYPES.ICON,size:o.SIZE.MEDIUM,background:o.AVATAR_BACKGROUND.LIGHT,icon:()=>e.jsx(t.default,{width:16,height:16,color:i.COLORS.content.warning})})})})),!!(null==g?void 0:g.length)&&e.jsxs(e.Fragment,{children:[f==c.AppType.MANIFEST&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%",justifyContent:(null==g?void 0:g.length)?"flex-start":"center"}},{children:e.jsx(l.Button,{buttonText:"Fix all unsatisfactory responses",buttonType:"tertiary",size:"small",onClick:()=>{q(!0)},disabled:!A})})),e.jsx(y.UnsatisfactoryCountIntentWiseModal,{storeId:j,setShowUnsatisfactoryResponseModal:q,showUnsatisfactoryResponseModal:U,ChecklistType:I,UnsatisfactoryResponseIntentList:b,IntentHeaderTitle:C,fetchUnsatisfactoryResponseCountIntentWise:S,viewIntentWiseUnsatisfactoryResponse:O}),g&&(null==g?void 0:g.length)>0&&e.jsx("div",Object.assign({className:"wrapper"},{children:g.map(((s,t)=>e.jsxs("div",Object.assign({className:"bubble",onClick:()=>{v(s.messageId),T(s.messageId)},style:R===s.messageId?{backgroundColor:i.COLORS.surface.hovered}:{}},{children:[e.jsx(u.BodySecondary,Object.assign({style:{color:i.COLORS.content.primary}},{children:s.message})),e.jsx("div",{children:e.jsxs(u.Caption,Object.assign({style:{color:i.COLORS.content.secondary}},{children:[n.format(new Date(null==s?void 0:s.date),"hh:mm a")," |"," ",n.format(new Date(null==s?void 0:s.date),"dd/MM/yyyy")]}))})]}),"incorrect-reply-"+t)))}))]})]})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/cross.svg.js"),t=require("../../assets/icons/info.svg.js"),n=require("date-fns"),r=require("react"),a=require("../../constants/Theme.js"),i=require("../avatar/Avatar.js"),o=require("../avatar/AvatarHelper.js"),c=require("../button/Button.js"),l=require("../states/StateComponent.js");require("../../_virtual/_tslib.js");var d=require("../TypographyStyle.js"),u=require("./UnsatisfactoryCountIntentWiseModal.js"),y=require("./UnsatisfactoryResponseList.style.js");exports.UnsatisfactoryResponseList=p=>{const{storeId:j,incorrectMessages:f,onIncorrectMessageBubbleClick:h,setShowIncorrectReplies:g,ChecklistType:x,IntentWiseUnsatisfactoryResponse:v,IntentHeaderTitle:b,redirectToUnsatisfactoryResponse:C,fetchUnsatisfactoryResponseCountIntentWise:I,fetchUnsatisfactoryResponseCount:O}=p,[R,S]=r.useState(""),[m,U]=r.useState((null==f?void 0:f.length)>0),[w,q]=r.useState(!1);return r.useEffect((()=>{m||O().then((e=>{e>0&&U(!0),0===e&&g(!1)}))}),[]),e.jsxs(y.IncorrectRepliesStyle,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx(d.TitleRegular,{children:"Unsatifactory responses"}),e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>g(!1)},{children:e.jsx(s.default,{height:16,width:16,color:a.COLORS.content.primary})}))]})),e.jsx(d.BodySecondary,Object.assign({style:{color:a.COLORS.content.secondary}},{children:"Spot unsatisfactory replies, dive deeper, and enhance with relevant data for improved responses."}))]})),!(null==f?void 0:f.length)&&e.jsx("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center"}},{children:e.jsx(l.StateComponent,{states:l.StateInterface.WARNING,heading:"No unsatisfactory responses",subline:"As of now, all responses are correct",isButtonEnabled:!1,width:0,size:o.SIZE.SMALL,icon:e.jsx(i.Avatar,{type:o.AVATAR_TYPES.ICON,size:o.SIZE.MEDIUM,background:o.AVATAR_BACKGROUND.LIGHT,icon:()=>e.jsx(t.default,{width:16,height:16,color:a.COLORS.content.warning})})})})),e.jsx("div",Object.assign({style:{display:"flex",width:"100%",justifyContent:(null==f?void 0:f.length)?"flex-start":"center"}},{children:e.jsx(c.Button,{buttonText:"Fix all unsatisfactory responses",buttonType:"tertiary",size:"small",onClick:()=>{q(!0)},disabled:!m})})),e.jsx(u.UnsatisfactoryCountIntentWiseModal,{storeId:j,setShowUnsatisfactoryResponseModal:q,showUnsatisfactoryResponseModal:w,ChecklistType:x,UnsatisfactoryResponseIntentList:v,IntentHeaderTitle:b,fetchUnsatisfactoryResponseCountIntentWise:I,viewIntentWiseUnsatisfactoryResponse:C}),!!(null==f?void 0:f.length)&&e.jsx("div",Object.assign({className:"wrapper"},{children:f.map(((s,t)=>e.jsxs("div",Object.assign({className:"bubble",onClick:()=>{h(s.messageId),S(s.messageId)},style:R===s.messageId?{backgroundColor:a.COLORS.surface.hovered}:{}},{children:[e.jsx(d.BodySecondary,Object.assign({style:{color:a.COLORS.content.primary}},{children:s.message})),e.jsx("div",{children:e.jsxs(d.Caption,Object.assign({style:{color:a.COLORS.content.secondary}},{children:[n.format(new Date(null==s?void 0:s.date),"hh:mm a")," |"," ",n.format(new Date(null==s?void 0:s.date),"dd/MM/yyyy")]}))})]}),"incorrect-reply-"+t)))}))]})};
@@ -11,7 +11,7 @@
11
11
  display: flex;
12
12
  flex-direction: column;
13
13
  gap: 8px;
14
- height: 100%; //calc(100% - 92px);
14
+ height: calc(100% - 92px);
15
15
  overflow-y: scroll;
16
16
  padding-right: 8px;
17
17
  &::-webkit-scrollbar-thumb {
@@ -93,4 +93,3 @@ export * from './components/multi-level-dropdown';
93
93
  export * from './components/data-source-panel';
94
94
  export * from './components/unsatisfactory-response-list/UnsatisfactoryResponseList';
95
95
  export * from './components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal';
96
- export * from './components/data-source-panel/model';